Class ProductSearchClient

  • All Implemented Interfaces:
    com.google.api.gax.core.BackgroundResource, AutoCloseable

    @BetaApi
    @Generated("by gapic-generator-java")
    public class ProductSearchClient
    extends Object
    implements com.google.api.gax.core.BackgroundResource
    Service Description: Manages Products and ProductSets of reference images for use in product search. It uses the following resource model:

    - The API has a collection of [ProductSet][google.cloud.vision.v1p4beta1.ProductSet] resources, named `projects/*/locations/*/productSets/*`, which acts as a way to put different products into groups to limit identification.

    In parallel,

    - The API has a collection of [Product][google.cloud.vision.v1p4beta1.Product] resources, named `projects/*/locations/*/products/*`

    - Each [Product][google.cloud.vision.v1p4beta1.Product] has a collection of [ReferenceImage][google.cloud.vision.v1p4beta1.ReferenceImage] resources, named `projects/*/locations/*/products/*/referenceImages/*`

    This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:

    
     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
       LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
       ProductSet productSet = ProductSet.newBuilder().build();
       String productSetId = "productSetId1003042158";
       ProductSet response = productSearchClient.createProductSet(parent, productSet, productSetId);
     }
     

    Note: close() needs to be called on the ProductSearchClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

    The surface of this class includes several types of Java methods for each of the API's methods:

    1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
    2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
    3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

    See the individual methods for example code.

    Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

    This class can be customized by passing in a custom instance of ProductSearchSettings to create(). For example:

    To customize credentials:

    
     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     ProductSearchSettings productSearchSettings =
         ProductSearchSettings.newBuilder()
             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
             .build();
     ProductSearchClient productSearchClient = ProductSearchClient.create(productSearchSettings);
     

    To customize the endpoint:

    
     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     ProductSearchSettings productSearchSettings =
         ProductSearchSettings.newBuilder().setEndpoint(myEndpoint).build();
     ProductSearchClient productSearchClient = ProductSearchClient.create(productSearchSettings);
     

    To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:

    
     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     ProductSearchSettings productSearchSettings =
         ProductSearchSettings.newHttpJsonBuilder().build();
     ProductSearchClient productSearchClient = ProductSearchClient.create(productSearchSettings);
     

    Please refer to the GitHub repository's samples for more quickstart code snippets.

    • Constructor Detail

      • ProductSearchClient

        protected ProductSearchClient​(ProductSearchSettings settings)
                               throws IOException
        Constructs an instance of ProductSearchClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
        Throws:
        IOException
    • Method Detail

      • create

        public static final ProductSearchClient create​(ProductSearchSettings settings)
                                                throws IOException
        Constructs an instance of ProductSearchClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
        Throws:
        IOException
      • create

        public static final ProductSearchClient create​(ProductSearchStub stub)
        Constructs an instance of ProductSearchClient, using the given stub for making calls. This is for advanced usage - prefer using create(ProductSearchSettings).
      • getOperationsClient

        public final com.google.longrunning.OperationsClient getOperationsClient()
        Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
      • getHttpJsonOperationsClient

        @BetaApi
        public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
        Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
      • createProductSet

        public final ProductSet createProductSet​(LocationName parent,
                                                 ProductSet productSet,
                                                 String productSetId)
        Creates and returns a new ProductSet resource.

        Possible errors:

        • Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
           ProductSet productSet = ProductSet.newBuilder().build();
           String productSetId = "productSetId1003042158";
           ProductSet response = productSearchClient.createProductSet(parent, productSet, productSetId);
         }
         
        Parameters:
        parent - Required. The project in which the ProductSet should be created.

        Format is `projects/PROJECT_ID/locations/LOC_ID`.

        productSet - Required. The ProductSet to create.
        productSetId - A user-supplied resource id for this ProductSet. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character `/`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createProductSet

        public final ProductSet createProductSet​(String parent,
                                                 ProductSet productSet,
                                                 String productSetId)
        Creates and returns a new ProductSet resource.

        Possible errors:

        • Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
           ProductSet productSet = ProductSet.newBuilder().build();
           String productSetId = "productSetId1003042158";
           ProductSet response = productSearchClient.createProductSet(parent, productSet, productSetId);
         }
         
        Parameters:
        parent - Required. The project in which the ProductSet should be created.

        Format is `projects/PROJECT_ID/locations/LOC_ID`.

        productSet - Required. The ProductSet to create.
        productSetId - A user-supplied resource id for this ProductSet. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character `/`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createProductSet

        public final ProductSet createProductSet​(CreateProductSetRequest request)
        Creates and returns a new ProductSet resource.

        Possible errors:

        • Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           CreateProductSetRequest request =
               CreateProductSetRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setProductSet(ProductSet.newBuilder().build())
                   .setProductSetId("productSetId1003042158")
                   .build();
           ProductSet response = productSearchClient.createProductSet(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createProductSetCallable

        public final com.google.api.gax.rpc.UnaryCallable<CreateProductSetRequest,​ProductSet> createProductSetCallable()
        Creates and returns a new ProductSet resource.

        Possible errors:

        • Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           CreateProductSetRequest request =
               CreateProductSetRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setProductSet(ProductSet.newBuilder().build())
                   .setProductSetId("productSetId1003042158")
                   .build();
           ApiFuture<ProductSet> future =
               productSearchClient.createProductSetCallable().futureCall(request);
           // Do something.
           ProductSet response = future.get();
         }
         
      • listProductSets

        public final ProductSearchClient.ListProductSetsPagedResponse listProductSets​(LocationName parent)
        Lists ProductSets in an unspecified order.

        Possible errors:

        • Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
           for (ProductSet element : productSearchClient.listProductSets(parent).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        parent - Required. The project from which ProductSets should be listed.

        Format is `projects/PROJECT_ID/locations/LOC_ID`.

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listProductSets

        public final ProductSearchClient.ListProductSetsPagedResponse listProductSets​(String parent)
        Lists ProductSets in an unspecified order.

        Possible errors:

        • Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
           for (ProductSet element : productSearchClient.listProductSets(parent).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        parent - Required. The project from which ProductSets should be listed.

        Format is `projects/PROJECT_ID/locations/LOC_ID`.

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listProductSets

        public final ProductSearchClient.ListProductSetsPagedResponse listProductSets​(ListProductSetsRequest request)
        Lists ProductSets in an unspecified order.

        Possible errors:

        • Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ListProductSetsRequest request =
               ListProductSetsRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           for (ProductSet element : productSearchClient.listProductSets(request).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listProductSetsPagedCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListProductSetsRequest,​ProductSearchClient.ListProductSetsPagedResponse> listProductSetsPagedCallable()
        Lists ProductSets in an unspecified order.

        Possible errors:

        • Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ListProductSetsRequest request =
               ListProductSetsRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           ApiFuture<ProductSet> future =
               productSearchClient.listProductSetsPagedCallable().futureCall(request);
           // Do something.
           for (ProductSet element : future.get().iterateAll()) {
             // doThingsWith(element);
           }
         }
         
      • listProductSetsCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListProductSetsRequest,​ListProductSetsResponse> listProductSetsCallable()
        Lists ProductSets in an unspecified order.

        Possible errors:

        • Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ListProductSetsRequest request =
               ListProductSetsRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           while (true) {
             ListProductSetsResponse response =
                 productSearchClient.listProductSetsCallable().call(request);
             for (ProductSet element : response.getProductSetsList()) {
               // doThingsWith(element);
             }
             String nextPageToken = response.getNextPageToken();
             if (!Strings.isNullOrEmpty(nextPageToken)) {
               request = request.toBuilder().setPageToken(nextPageToken).build();
             } else {
               break;
             }
           }
         }
         
      • getProductSet

        public final ProductSet getProductSet​(ProductSetName name)
        Gets information associated with a ProductSet.

        Possible errors:

        • Returns NOT_FOUND if the ProductSet does not exist.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
           ProductSet response = productSearchClient.getProductSet(name);
         }
         
        Parameters:
        name - Required. Resource name of the ProductSet to get.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getProductSet

        public final ProductSet getProductSet​(String name)
        Gets information associated with a ProductSet.

        Possible errors:

        • Returns NOT_FOUND if the ProductSet does not exist.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           String name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString();
           ProductSet response = productSearchClient.getProductSet(name);
         }
         
        Parameters:
        name - Required. Resource name of the ProductSet to get.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getProductSet

        public final ProductSet getProductSet​(GetProductSetRequest request)
        Gets information associated with a ProductSet.

        Possible errors:

        • Returns NOT_FOUND if the ProductSet does not exist.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           GetProductSetRequest request =
               GetProductSetRequest.newBuilder()
                   .setName(ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString())
                   .build();
           ProductSet response = productSearchClient.getProductSet(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getProductSetCallable

        public final com.google.api.gax.rpc.UnaryCallable<GetProductSetRequest,​ProductSet> getProductSetCallable()
        Gets information associated with a ProductSet.

        Possible errors:

        • Returns NOT_FOUND if the ProductSet does not exist.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           GetProductSetRequest request =
               GetProductSetRequest.newBuilder()
                   .setName(ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString())
                   .build();
           ApiFuture<ProductSet> future =
               productSearchClient.getProductSetCallable().futureCall(request);
           // Do something.
           ProductSet response = future.get();
         }
         
      • updateProductSet

        public final ProductSet updateProductSet​(ProductSet productSet,
                                                 com.google.protobuf.FieldMask updateMask)
        Makes changes to a ProductSet resource. Only display_name can be updated currently.

        Possible errors:

        • Returns NOT_FOUND if the ProductSet does not exist.
        • Returns INVALID_ARGUMENT if display_name is present in update_mask but missing from the request or longer than 4096 characters.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ProductSet productSet = ProductSet.newBuilder().build();
           FieldMask updateMask = FieldMask.newBuilder().build();
           ProductSet response = productSearchClient.updateProductSet(productSet, updateMask);
         }
         
        Parameters:
        productSet - Required. The ProductSet resource which replaces the one on the server.
        updateMask - The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask path is `display_name`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateProductSet

        public final ProductSet updateProductSet​(UpdateProductSetRequest request)
        Makes changes to a ProductSet resource. Only display_name can be updated currently.

        Possible errors:

        • Returns NOT_FOUND if the ProductSet does not exist.
        • Returns INVALID_ARGUMENT if display_name is present in update_mask but missing from the request or longer than 4096 characters.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           UpdateProductSetRequest request =
               UpdateProductSetRequest.newBuilder()
                   .setProductSet(ProductSet.newBuilder().build())
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .build();
           ProductSet response = productSearchClient.updateProductSet(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateProductSetCallable

        public final com.google.api.gax.rpc.UnaryCallable<UpdateProductSetRequest,​ProductSet> updateProductSetCallable()
        Makes changes to a ProductSet resource. Only display_name can be updated currently.

        Possible errors:

        • Returns NOT_FOUND if the ProductSet does not exist.
        • Returns INVALID_ARGUMENT if display_name is present in update_mask but missing from the request or longer than 4096 characters.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           UpdateProductSetRequest request =
               UpdateProductSetRequest.newBuilder()
                   .setProductSet(ProductSet.newBuilder().build())
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .build();
           ApiFuture<ProductSet> future =
               productSearchClient.updateProductSetCallable().futureCall(request);
           // Do something.
           ProductSet response = future.get();
         }
         
      • deleteProductSet

        public final void deleteProductSet​(ProductSetName name)
        Permanently deletes a ProductSet. Products and ReferenceImages in the ProductSet are not deleted.

        The actual image files are not deleted from Google Cloud Storage.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
           productSearchClient.deleteProductSet(name);
         }
         
        Parameters:
        name - Required. Resource name of the ProductSet to delete.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteProductSet

        public final void deleteProductSet​(String name)
        Permanently deletes a ProductSet. Products and ReferenceImages in the ProductSet are not deleted.

        The actual image files are not deleted from Google Cloud Storage.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           String name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString();
           productSearchClient.deleteProductSet(name);
         }
         
        Parameters:
        name - Required. Resource name of the ProductSet to delete.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteProductSet

        public final void deleteProductSet​(DeleteProductSetRequest request)
        Permanently deletes a ProductSet. Products and ReferenceImages in the ProductSet are not deleted.

        The actual image files are not deleted from Google Cloud Storage.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           DeleteProductSetRequest request =
               DeleteProductSetRequest.newBuilder()
                   .setName(ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString())
                   .build();
           productSearchClient.deleteProductSet(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteProductSetCallable

        public final com.google.api.gax.rpc.UnaryCallable<DeleteProductSetRequest,​com.google.protobuf.Empty> deleteProductSetCallable()
        Permanently deletes a ProductSet. Products and ReferenceImages in the ProductSet are not deleted.

        The actual image files are not deleted from Google Cloud Storage.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           DeleteProductSetRequest request =
               DeleteProductSetRequest.newBuilder()
                   .setName(ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString())
                   .build();
           ApiFuture<Empty> future = productSearchClient.deleteProductSetCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • createProduct

        public final Product createProduct​(LocationName parent,
                                           Product product,
                                           String productId)
        Creates and returns a new product resource.

        Possible errors:

        • Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters.
        • Returns INVALID_ARGUMENT if description is longer than 4096 characters.
        • Returns INVALID_ARGUMENT if product_category is missing or invalid.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
           Product product = Product.newBuilder().build();
           String productId = "productId-1051830678";
           Product response = productSearchClient.createProduct(parent, product, productId);
         }
         
        Parameters:
        parent - Required. The project in which the Product should be created.

        Format is `projects/PROJECT_ID/locations/LOC_ID`.

        product - Required. The product to create.
        productId - A user-supplied resource id for this Product. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character `/`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createProduct

        public final Product createProduct​(String parent,
                                           Product product,
                                           String productId)
        Creates and returns a new product resource.

        Possible errors:

        • Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters.
        • Returns INVALID_ARGUMENT if description is longer than 4096 characters.
        • Returns INVALID_ARGUMENT if product_category is missing or invalid.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
           Product product = Product.newBuilder().build();
           String productId = "productId-1051830678";
           Product response = productSearchClient.createProduct(parent, product, productId);
         }
         
        Parameters:
        parent - Required. The project in which the Product should be created.

        Format is `projects/PROJECT_ID/locations/LOC_ID`.

        product - Required. The product to create.
        productId - A user-supplied resource id for this Product. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character `/`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createProduct

        public final Product createProduct​(CreateProductRequest request)
        Creates and returns a new product resource.

        Possible errors:

        • Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters.
        • Returns INVALID_ARGUMENT if description is longer than 4096 characters.
        • Returns INVALID_ARGUMENT if product_category is missing or invalid.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           CreateProductRequest request =
               CreateProductRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setProduct(Product.newBuilder().build())
                   .setProductId("productId-1051830678")
                   .build();
           Product response = productSearchClient.createProduct(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createProductCallable

        public final com.google.api.gax.rpc.UnaryCallable<CreateProductRequest,​Product> createProductCallable()
        Creates and returns a new product resource.

        Possible errors:

        • Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters.
        • Returns INVALID_ARGUMENT if description is longer than 4096 characters.
        • Returns INVALID_ARGUMENT if product_category is missing or invalid.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           CreateProductRequest request =
               CreateProductRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setProduct(Product.newBuilder().build())
                   .setProductId("productId-1051830678")
                   .build();
           ApiFuture<Product> future = productSearchClient.createProductCallable().futureCall(request);
           // Do something.
           Product response = future.get();
         }
         
      • listProducts

        public final ProductSearchClient.ListProductsPagedResponse listProducts​(LocationName parent)
        Lists products in an unspecified order.

        Possible errors:

        • Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
           for (Product element : productSearchClient.listProducts(parent).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        parent - Required. The project OR ProductSet from which Products should be listed.

        Format: `projects/PROJECT_ID/locations/LOC_ID`

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listProducts

        public final ProductSearchClient.ListProductsPagedResponse listProducts​(String parent)
        Lists products in an unspecified order.

        Possible errors:

        • Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
           for (Product element : productSearchClient.listProducts(parent).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        parent - Required. The project OR ProductSet from which Products should be listed.

        Format: `projects/PROJECT_ID/locations/LOC_ID`

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listProducts

        public final ProductSearchClient.ListProductsPagedResponse listProducts​(ListProductsRequest request)
        Lists products in an unspecified order.

        Possible errors:

        • Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ListProductsRequest request =
               ListProductsRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           for (Product element : productSearchClient.listProducts(request).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listProductsPagedCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListProductsRequest,​ProductSearchClient.ListProductsPagedResponse> listProductsPagedCallable()
        Lists products in an unspecified order.

        Possible errors:

        • Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ListProductsRequest request =
               ListProductsRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           ApiFuture<Product> future =
               productSearchClient.listProductsPagedCallable().futureCall(request);
           // Do something.
           for (Product element : future.get().iterateAll()) {
             // doThingsWith(element);
           }
         }
         
      • listProductsCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListProductsRequest,​ListProductsResponse> listProductsCallable()
        Lists products in an unspecified order.

        Possible errors:

        • Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ListProductsRequest request =
               ListProductsRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           while (true) {
             ListProductsResponse response = productSearchClient.listProductsCallable().call(request);
             for (Product element : response.getProductsList()) {
               // doThingsWith(element);
             }
             String nextPageToken = response.getNextPageToken();
             if (!Strings.isNullOrEmpty(nextPageToken)) {
               request = request.toBuilder().setPageToken(nextPageToken).build();
             } else {
               break;
             }
           }
         }
         
      • getProduct

        public final Product getProduct​(ProductName name)
        Gets information associated with a Product.

        Possible errors:

        • Returns NOT_FOUND if the Product does not exist.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ProductName name = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
           Product response = productSearchClient.getProduct(name);
         }
         
        Parameters:
        name - Required. Resource name of the Product to get.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getProduct

        public final Product getProduct​(String name)
        Gets information associated with a Product.

        Possible errors:

        • Returns NOT_FOUND if the Product does not exist.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           String name = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString();
           Product response = productSearchClient.getProduct(name);
         }
         
        Parameters:
        name - Required. Resource name of the Product to get.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getProduct

        public final Product getProduct​(GetProductRequest request)
        Gets information associated with a Product.

        Possible errors:

        • Returns NOT_FOUND if the Product does not exist.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           GetProductRequest request =
               GetProductRequest.newBuilder()
                   .setName(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
                   .build();
           Product response = productSearchClient.getProduct(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getProductCallable

        public final com.google.api.gax.rpc.UnaryCallable<GetProductRequest,​Product> getProductCallable()
        Gets information associated with a Product.

        Possible errors:

        • Returns NOT_FOUND if the Product does not exist.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           GetProductRequest request =
               GetProductRequest.newBuilder()
                   .setName(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
                   .build();
           ApiFuture<Product> future = productSearchClient.getProductCallable().futureCall(request);
           // Do something.
           Product response = future.get();
         }
         
      • updateProduct

        public final Product updateProduct​(Product product,
                                           com.google.protobuf.FieldMask updateMask)
        Makes changes to a Product resource. Only the `display_name`, `description`, and `labels` fields can be updated right now.

        If labels are updated, the change will not be reflected in queries until the next index time.

        Possible errors:

        • Returns NOT_FOUND if the Product does not exist.
        • Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from the request or longer than 4096 characters.
        • Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096 characters.
        • Returns INVALID_ARGUMENT if product_category is present in update_mask.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           Product product = Product.newBuilder().build();
           FieldMask updateMask = FieldMask.newBuilder().build();
           Product response = productSearchClient.updateProduct(product, updateMask);
         }
         
        Parameters:
        product - Required. The Product resource which replaces the one on the server. product.name is immutable.
        updateMask - The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask paths include `product_labels`, `display_name`, and `description`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateProduct

        public final Product updateProduct​(UpdateProductRequest request)
        Makes changes to a Product resource. Only the `display_name`, `description`, and `labels` fields can be updated right now.

        If labels are updated, the change will not be reflected in queries until the next index time.

        Possible errors:

        • Returns NOT_FOUND if the Product does not exist.
        • Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from the request or longer than 4096 characters.
        • Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096 characters.
        • Returns INVALID_ARGUMENT if product_category is present in update_mask.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           UpdateProductRequest request =
               UpdateProductRequest.newBuilder()
                   .setProduct(Product.newBuilder().build())
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .build();
           Product response = productSearchClient.updateProduct(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateProductCallable

        public final com.google.api.gax.rpc.UnaryCallable<UpdateProductRequest,​Product> updateProductCallable()
        Makes changes to a Product resource. Only the `display_name`, `description`, and `labels` fields can be updated right now.

        If labels are updated, the change will not be reflected in queries until the next index time.

        Possible errors:

        • Returns NOT_FOUND if the Product does not exist.
        • Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from the request or longer than 4096 characters.
        • Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096 characters.
        • Returns INVALID_ARGUMENT if product_category is present in update_mask.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           UpdateProductRequest request =
               UpdateProductRequest.newBuilder()
                   .setProduct(Product.newBuilder().build())
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .build();
           ApiFuture<Product> future = productSearchClient.updateProductCallable().futureCall(request);
           // Do something.
           Product response = future.get();
         }
         
      • deleteProduct

        public final void deleteProduct​(ProductName name)
        Permanently deletes a product and its reference images.

        Metadata of the product and all its images will be deleted right away, but search queries against ProductSets containing the product may still work until all related caches are refreshed.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ProductName name = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
           productSearchClient.deleteProduct(name);
         }
         
        Parameters:
        name - Required. Resource name of product to delete.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteProduct

        public final void deleteProduct​(String name)
        Permanently deletes a product and its reference images.

        Metadata of the product and all its images will be deleted right away, but search queries against ProductSets containing the product may still work until all related caches are refreshed.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           String name = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString();
           productSearchClient.deleteProduct(name);
         }
         
        Parameters:
        name - Required. Resource name of product to delete.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteProduct

        public final void deleteProduct​(DeleteProductRequest request)
        Permanently deletes a product and its reference images.

        Metadata of the product and all its images will be deleted right away, but search queries against ProductSets containing the product may still work until all related caches are refreshed.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           DeleteProductRequest request =
               DeleteProductRequest.newBuilder()
                   .setName(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
                   .build();
           productSearchClient.deleteProduct(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteProductCallable

        public final com.google.api.gax.rpc.UnaryCallable<DeleteProductRequest,​com.google.protobuf.Empty> deleteProductCallable()
        Permanently deletes a product and its reference images.

        Metadata of the product and all its images will be deleted right away, but search queries against ProductSets containing the product may still work until all related caches are refreshed.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           DeleteProductRequest request =
               DeleteProductRequest.newBuilder()
                   .setName(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
                   .build();
           ApiFuture<Empty> future = productSearchClient.deleteProductCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • createReferenceImage

        public final ReferenceImage createReferenceImage​(ProductName parent,
                                                         ReferenceImage referenceImage,
                                                         String referenceImageId)
        Creates and returns a new ReferenceImage resource.

        The `bounding_poly` field is optional. If `bounding_poly` is not specified, the system will try to detect regions of interest in the image that are compatible with the product_category on the parent product. If it is specified, detection is ALWAYS skipped. The system converts polygons into non-rotated rectangles.

        Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP).

        Possible errors:

        • Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters.
        • Returns INVALID_ARGUMENT if the product does not exist.
        • Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with the parent product's product_category is detected.
        • Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ProductName parent = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
           ReferenceImage referenceImage = ReferenceImage.newBuilder().build();
           String referenceImageId = "referenceImageId1224107531";
           ReferenceImage response =
               productSearchClient.createReferenceImage(parent, referenceImage, referenceImageId);
         }
         
        Parameters:
        parent - Required. Resource name of the product in which to create the reference image.

        Format is `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.

        referenceImage - Required. The reference image to create. If an image ID is specified, it is ignored.
        referenceImageId - A user-supplied resource id for the ReferenceImage to be added. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character `/`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createReferenceImage

        public final ReferenceImage createReferenceImage​(String parent,
                                                         ReferenceImage referenceImage,
                                                         String referenceImageId)
        Creates and returns a new ReferenceImage resource.

        The `bounding_poly` field is optional. If `bounding_poly` is not specified, the system will try to detect regions of interest in the image that are compatible with the product_category on the parent product. If it is specified, detection is ALWAYS skipped. The system converts polygons into non-rotated rectangles.

        Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP).

        Possible errors:

        • Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters.
        • Returns INVALID_ARGUMENT if the product does not exist.
        • Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with the parent product's product_category is detected.
        • Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           String parent = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString();
           ReferenceImage referenceImage = ReferenceImage.newBuilder().build();
           String referenceImageId = "referenceImageId1224107531";
           ReferenceImage response =
               productSearchClient.createReferenceImage(parent, referenceImage, referenceImageId);
         }
         
        Parameters:
        parent - Required. Resource name of the product in which to create the reference image.

        Format is `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.

        referenceImage - Required. The reference image to create. If an image ID is specified, it is ignored.
        referenceImageId - A user-supplied resource id for the ReferenceImage to be added. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character `/`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createReferenceImage

        public final ReferenceImage createReferenceImage​(CreateReferenceImageRequest request)
        Creates and returns a new ReferenceImage resource.

        The `bounding_poly` field is optional. If `bounding_poly` is not specified, the system will try to detect regions of interest in the image that are compatible with the product_category on the parent product. If it is specified, detection is ALWAYS skipped. The system converts polygons into non-rotated rectangles.

        Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP).

        Possible errors:

        • Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters.
        • Returns INVALID_ARGUMENT if the product does not exist.
        • Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with the parent product's product_category is detected.
        • Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           CreateReferenceImageRequest request =
               CreateReferenceImageRequest.newBuilder()
                   .setParent(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
                   .setReferenceImage(ReferenceImage.newBuilder().build())
                   .setReferenceImageId("referenceImageId1224107531")
                   .build();
           ReferenceImage response = productSearchClient.createReferenceImage(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createReferenceImageCallable

        public final com.google.api.gax.rpc.UnaryCallable<CreateReferenceImageRequest,​ReferenceImage> createReferenceImageCallable()
        Creates and returns a new ReferenceImage resource.

        The `bounding_poly` field is optional. If `bounding_poly` is not specified, the system will try to detect regions of interest in the image that are compatible with the product_category on the parent product. If it is specified, detection is ALWAYS skipped. The system converts polygons into non-rotated rectangles.

        Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP).

        Possible errors:

        • Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters.
        • Returns INVALID_ARGUMENT if the product does not exist.
        • Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with the parent product's product_category is detected.
        • Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           CreateReferenceImageRequest request =
               CreateReferenceImageRequest.newBuilder()
                   .setParent(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
                   .setReferenceImage(ReferenceImage.newBuilder().build())
                   .setReferenceImageId("referenceImageId1224107531")
                   .build();
           ApiFuture<ReferenceImage> future =
               productSearchClient.createReferenceImageCallable().futureCall(request);
           // Do something.
           ReferenceImage response = future.get();
         }
         
      • deleteReferenceImage

        public final void deleteReferenceImage​(ReferenceImageName name)
        Permanently deletes a reference image.

        The image metadata will be deleted right away, but search queries against ProductSets containing the image may still work until all related caches are refreshed.

        The actual image files are not deleted from Google Cloud Storage.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ReferenceImageName name =
               ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]");
           productSearchClient.deleteReferenceImage(name);
         }
         
        Parameters:
        name - Required. The resource name of the reference image to delete.

        Format is:

        `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteReferenceImage

        public final void deleteReferenceImage​(String name)
        Permanently deletes a reference image.

        The image metadata will be deleted right away, but search queries against ProductSets containing the image may still work until all related caches are refreshed.

        The actual image files are not deleted from Google Cloud Storage.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           String name =
               ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]")
                   .toString();
           productSearchClient.deleteReferenceImage(name);
         }
         
        Parameters:
        name - Required. The resource name of the reference image to delete.

        Format is:

        `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteReferenceImage

        public final void deleteReferenceImage​(DeleteReferenceImageRequest request)
        Permanently deletes a reference image.

        The image metadata will be deleted right away, but search queries against ProductSets containing the image may still work until all related caches are refreshed.

        The actual image files are not deleted from Google Cloud Storage.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           DeleteReferenceImageRequest request =
               DeleteReferenceImageRequest.newBuilder()
                   .setName(
                       ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]")
                           .toString())
                   .build();
           productSearchClient.deleteReferenceImage(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteReferenceImageCallable

        public final com.google.api.gax.rpc.UnaryCallable<DeleteReferenceImageRequest,​com.google.protobuf.Empty> deleteReferenceImageCallable()
        Permanently deletes a reference image.

        The image metadata will be deleted right away, but search queries against ProductSets containing the image may still work until all related caches are refreshed.

        The actual image files are not deleted from Google Cloud Storage.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           DeleteReferenceImageRequest request =
               DeleteReferenceImageRequest.newBuilder()
                   .setName(
                       ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]")
                           .toString())
                   .build();
           ApiFuture<Empty> future =
               productSearchClient.deleteReferenceImageCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • listReferenceImages

        public final ProductSearchClient.ListReferenceImagesPagedResponse listReferenceImages​(ProductName parent)
        Lists reference images.

        Possible errors:

        • Returns NOT_FOUND if the parent product does not exist.
        • Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ProductName parent = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
           for (ReferenceImage element : productSearchClient.listReferenceImages(parent).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        parent - Required. Resource name of the product containing the reference images.

        Format is `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listReferenceImages

        public final ProductSearchClient.ListReferenceImagesPagedResponse listReferenceImages​(String parent)
        Lists reference images.

        Possible errors:

        • Returns NOT_FOUND if the parent product does not exist.
        • Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           String parent = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString();
           for (ReferenceImage element : productSearchClient.listReferenceImages(parent).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        parent - Required. Resource name of the product containing the reference images.

        Format is `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listReferenceImages

        public final ProductSearchClient.ListReferenceImagesPagedResponse listReferenceImages​(ListReferenceImagesRequest request)
        Lists reference images.

        Possible errors:

        • Returns NOT_FOUND if the parent product does not exist.
        • Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ListReferenceImagesRequest request =
               ListReferenceImagesRequest.newBuilder()
                   .setParent(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           for (ReferenceImage element : productSearchClient.listReferenceImages(request).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listReferenceImagesPagedCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListReferenceImagesRequest,​ProductSearchClient.ListReferenceImagesPagedResponse> listReferenceImagesPagedCallable()
        Lists reference images.

        Possible errors:

        • Returns NOT_FOUND if the parent product does not exist.
        • Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ListReferenceImagesRequest request =
               ListReferenceImagesRequest.newBuilder()
                   .setParent(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           ApiFuture<ReferenceImage> future =
               productSearchClient.listReferenceImagesPagedCallable().futureCall(request);
           // Do something.
           for (ReferenceImage element : future.get().iterateAll()) {
             // doThingsWith(element);
           }
         }
         
      • listReferenceImagesCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListReferenceImagesRequest,​ListReferenceImagesResponse> listReferenceImagesCallable()
        Lists reference images.

        Possible errors:

        • Returns NOT_FOUND if the parent product does not exist.
        • Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ListReferenceImagesRequest request =
               ListReferenceImagesRequest.newBuilder()
                   .setParent(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           while (true) {
             ListReferenceImagesResponse response =
                 productSearchClient.listReferenceImagesCallable().call(request);
             for (ReferenceImage element : response.getReferenceImagesList()) {
               // doThingsWith(element);
             }
             String nextPageToken = response.getNextPageToken();
             if (!Strings.isNullOrEmpty(nextPageToken)) {
               request = request.toBuilder().setPageToken(nextPageToken).build();
             } else {
               break;
             }
           }
         }
         
      • getReferenceImage

        public final ReferenceImage getReferenceImage​(ReferenceImageName name)
        Gets information associated with a ReferenceImage.

        Possible errors:

        • Returns NOT_FOUND if the specified image does not exist.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ReferenceImageName name =
               ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]");
           ReferenceImage response = productSearchClient.getReferenceImage(name);
         }
         
        Parameters:
        name - Required. The resource name of the ReferenceImage to get.

        Format is:

        `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`.

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getReferenceImage

        public final ReferenceImage getReferenceImage​(String name)
        Gets information associated with a ReferenceImage.

        Possible errors:

        • Returns NOT_FOUND if the specified image does not exist.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           String name =
               ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]")
                   .toString();
           ReferenceImage response = productSearchClient.getReferenceImage(name);
         }
         
        Parameters:
        name - Required. The resource name of the ReferenceImage to get.

        Format is:

        `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`.

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getReferenceImage

        public final ReferenceImage getReferenceImage​(GetReferenceImageRequest request)
        Gets information associated with a ReferenceImage.

        Possible errors:

        • Returns NOT_FOUND if the specified image does not exist.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           GetReferenceImageRequest request =
               GetReferenceImageRequest.newBuilder()
                   .setName(
                       ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]")
                           .toString())
                   .build();
           ReferenceImage response = productSearchClient.getReferenceImage(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getReferenceImageCallable

        public final com.google.api.gax.rpc.UnaryCallable<GetReferenceImageRequest,​ReferenceImage> getReferenceImageCallable()
        Gets information associated with a ReferenceImage.

        Possible errors:

        • Returns NOT_FOUND if the specified image does not exist.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           GetReferenceImageRequest request =
               GetReferenceImageRequest.newBuilder()
                   .setName(
                       ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]")
                           .toString())
                   .build();
           ApiFuture<ReferenceImage> future =
               productSearchClient.getReferenceImageCallable().futureCall(request);
           // Do something.
           ReferenceImage response = future.get();
         }
         
      • addProductToProductSet

        public final void addProductToProductSet​(ProductSetName name,
                                                 ProductName product)
        Adds a Product to the specified ProductSet. If the Product is already present, no change is made.

        One Product can be added to at most 100 ProductSets.

        Possible errors:

        • Returns NOT_FOUND if the Product or the ProductSet doesn't exist.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
           ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
           productSearchClient.addProductToProductSet(name, product);
         }
         
        Parameters:
        name - Required. The resource name for the ProductSet to modify.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`

        product - Required. The resource name for the Product to be added to this ProductSet.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • addProductToProductSet

        public final void addProductToProductSet​(ProductSetName name,
                                                 String product)
        Adds a Product to the specified ProductSet. If the Product is already present, no change is made.

        One Product can be added to at most 100 ProductSets.

        Possible errors:

        • Returns NOT_FOUND if the Product or the ProductSet doesn't exist.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
           String product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString();
           productSearchClient.addProductToProductSet(name, product);
         }
         
        Parameters:
        name - Required. The resource name for the ProductSet to modify.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`

        product - Required. The resource name for the Product to be added to this ProductSet.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • addProductToProductSet

        public final void addProductToProductSet​(String name,
                                                 ProductName product)
        Adds a Product to the specified ProductSet. If the Product is already present, no change is made.

        One Product can be added to at most 100 ProductSets.

        Possible errors:

        • Returns NOT_FOUND if the Product or the ProductSet doesn't exist.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           String name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString();
           ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
           productSearchClient.addProductToProductSet(name, product);
         }
         
        Parameters:
        name - Required. The resource name for the ProductSet to modify.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`

        product - Required. The resource name for the Product to be added to this ProductSet.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • addProductToProductSet

        public final void addProductToProductSet​(String name,
                                                 String product)
        Adds a Product to the specified ProductSet. If the Product is already present, no change is made.

        One Product can be added to at most 100 ProductSets.

        Possible errors:

        • Returns NOT_FOUND if the Product or the ProductSet doesn't exist.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           String name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString();
           String product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString();
           productSearchClient.addProductToProductSet(name, product);
         }
         
        Parameters:
        name - Required. The resource name for the ProductSet to modify.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`

        product - Required. The resource name for the Product to be added to this ProductSet.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • addProductToProductSet

        public final void addProductToProductSet​(AddProductToProductSetRequest request)
        Adds a Product to the specified ProductSet. If the Product is already present, no change is made.

        One Product can be added to at most 100 ProductSets.

        Possible errors:

        • Returns NOT_FOUND if the Product or the ProductSet doesn't exist.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           AddProductToProductSetRequest request =
               AddProductToProductSetRequest.newBuilder()
                   .setName(ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString())
                   .setProduct(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
                   .build();
           productSearchClient.addProductToProductSet(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • addProductToProductSetCallable

        public final com.google.api.gax.rpc.UnaryCallable<AddProductToProductSetRequest,​com.google.protobuf.Empty> addProductToProductSetCallable()
        Adds a Product to the specified ProductSet. If the Product is already present, no change is made.

        One Product can be added to at most 100 ProductSets.

        Possible errors:

        • Returns NOT_FOUND if the Product or the ProductSet doesn't exist.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           AddProductToProductSetRequest request =
               AddProductToProductSetRequest.newBuilder()
                   .setName(ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString())
                   .setProduct(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
                   .build();
           ApiFuture<Empty> future =
               productSearchClient.addProductToProductSetCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • removeProductFromProductSet

        public final void removeProductFromProductSet​(ProductSetName name,
                                                      ProductName product)
        Removes a Product from the specified ProductSet.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
           ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
           productSearchClient.removeProductFromProductSet(name, product);
         }
         
        Parameters:
        name - Required. The resource name for the ProductSet to modify.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`

        product - Required. The resource name for the Product to be removed from this ProductSet.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • removeProductFromProductSet

        public final void removeProductFromProductSet​(ProductSetName name,
                                                      String product)
        Removes a Product from the specified ProductSet.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
           String product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString();
           productSearchClient.removeProductFromProductSet(name, product);
         }
         
        Parameters:
        name - Required. The resource name for the ProductSet to modify.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`

        product - Required. The resource name for the Product to be removed from this ProductSet.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • removeProductFromProductSet

        public final void removeProductFromProductSet​(String name,
                                                      ProductName product)
        Removes a Product from the specified ProductSet.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           String name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString();
           ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
           productSearchClient.removeProductFromProductSet(name, product);
         }
         
        Parameters:
        name - Required. The resource name for the ProductSet to modify.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`

        product - Required. The resource name for the Product to be removed from this ProductSet.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • removeProductFromProductSet

        public final void removeProductFromProductSet​(String name,
                                                      String product)
        Removes a Product from the specified ProductSet.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           String name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString();
           String product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString();
           productSearchClient.removeProductFromProductSet(name, product);
         }
         
        Parameters:
        name - Required. The resource name for the ProductSet to modify.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`

        product - Required. The resource name for the Product to be removed from this ProductSet.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • removeProductFromProductSet

        public final void removeProductFromProductSet​(RemoveProductFromProductSetRequest request)
        Removes a Product from the specified ProductSet.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           RemoveProductFromProductSetRequest request =
               RemoveProductFromProductSetRequest.newBuilder()
                   .setName(ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString())
                   .setProduct(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
                   .build();
           productSearchClient.removeProductFromProductSet(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • removeProductFromProductSetCallable

        public final com.google.api.gax.rpc.UnaryCallable<RemoveProductFromProductSetRequest,​com.google.protobuf.Empty> removeProductFromProductSetCallable()
        Removes a Product from the specified ProductSet.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           RemoveProductFromProductSetRequest request =
               RemoveProductFromProductSetRequest.newBuilder()
                   .setName(ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString())
                   .setProduct(ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]").toString())
                   .build();
           ApiFuture<Empty> future =
               productSearchClient.removeProductFromProductSetCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • listProductsInProductSet

        public final ProductSearchClient.ListProductsInProductSetPagedResponse listProductsInProductSet​(ProductSetName name)
        Lists the Products in a ProductSet, in an unspecified order. If the ProductSet does not exist, the products field of the response will be empty.

        Possible errors:

        • Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
           for (Product element : productSearchClient.listProductsInProductSet(name).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        name - Required. The ProductSet resource for which to retrieve Products.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listProductsInProductSet

        public final ProductSearchClient.ListProductsInProductSetPagedResponse listProductsInProductSet​(String name)
        Lists the Products in a ProductSet, in an unspecified order. If the ProductSet does not exist, the products field of the response will be empty.

        Possible errors:

        • Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           String name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString();
           for (Product element : productSearchClient.listProductsInProductSet(name).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        name - Required. The ProductSet resource for which to retrieve Products.

        Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listProductsInProductSet

        public final ProductSearchClient.ListProductsInProductSetPagedResponse listProductsInProductSet​(ListProductsInProductSetRequest request)
        Lists the Products in a ProductSet, in an unspecified order. If the ProductSet does not exist, the products field of the response will be empty.

        Possible errors:

        • Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ListProductsInProductSetRequest request =
               ListProductsInProductSetRequest.newBuilder()
                   .setName(ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           for (Product element : productSearchClient.listProductsInProductSet(request).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listProductsInProductSetPagedCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListProductsInProductSetRequest,​ProductSearchClient.ListProductsInProductSetPagedResponse> listProductsInProductSetPagedCallable()
        Lists the Products in a ProductSet, in an unspecified order. If the ProductSet does not exist, the products field of the response will be empty.

        Possible errors:

        • Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ListProductsInProductSetRequest request =
               ListProductsInProductSetRequest.newBuilder()
                   .setName(ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           ApiFuture<Product> future =
               productSearchClient.listProductsInProductSetPagedCallable().futureCall(request);
           // Do something.
           for (Product element : future.get().iterateAll()) {
             // doThingsWith(element);
           }
         }
         
      • listProductsInProductSetCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListProductsInProductSetRequest,​ListProductsInProductSetResponse> listProductsInProductSetCallable()
        Lists the Products in a ProductSet, in an unspecified order. If the ProductSet does not exist, the products field of the response will be empty.

        Possible errors:

        • Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ListProductsInProductSetRequest request =
               ListProductsInProductSetRequest.newBuilder()
                   .setName(ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           while (true) {
             ListProductsInProductSetResponse response =
                 productSearchClient.listProductsInProductSetCallable().call(request);
             for (Product element : response.getProductsList()) {
               // doThingsWith(element);
             }
             String nextPageToken = response.getNextPageToken();
             if (!Strings.isNullOrEmpty(nextPageToken)) {
               request = request.toBuilder().setPageToken(nextPageToken).build();
             } else {
               break;
             }
           }
         }
         
      • importProductSetsAsync

        public final com.google.api.gax.longrunning.OperationFuture<ImportProductSetsResponse,​BatchOperationMetadata> importProductSetsAsync​(LocationName parent,
                                                                                                                                                   ImportProductSetsInputConfig inputConfig)
        Asynchronous API that imports a list of reference images to specified product sets based on a list of image information.

        The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the progress and results of the request. `Operation.metadata` contains `BatchOperationMetadata`. (progress) `Operation.response` contains `ImportProductSetsResponse`. (results)

        The input source of this method is a csv file on Google Cloud Storage. For the format of the csv file please see [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.csv_file_uri].

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
           ImportProductSetsInputConfig inputConfig = ImportProductSetsInputConfig.newBuilder().build();
           ImportProductSetsResponse response =
               productSearchClient.importProductSetsAsync(parent, inputConfig).get();
         }
         
        Parameters:
        parent - Required. The project in which the ProductSets should be imported.

        Format is `projects/PROJECT_ID/locations/LOC_ID`.

        inputConfig - Required. The input content for the list of requests.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • importProductSetsAsync

        public final com.google.api.gax.longrunning.OperationFuture<ImportProductSetsResponse,​BatchOperationMetadata> importProductSetsAsync​(String parent,
                                                                                                                                                   ImportProductSetsInputConfig inputConfig)
        Asynchronous API that imports a list of reference images to specified product sets based on a list of image information.

        The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the progress and results of the request. `Operation.metadata` contains `BatchOperationMetadata`. (progress) `Operation.response` contains `ImportProductSetsResponse`. (results)

        The input source of this method is a csv file on Google Cloud Storage. For the format of the csv file please see [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.csv_file_uri].

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
           ImportProductSetsInputConfig inputConfig = ImportProductSetsInputConfig.newBuilder().build();
           ImportProductSetsResponse response =
               productSearchClient.importProductSetsAsync(parent, inputConfig).get();
         }
         
        Parameters:
        parent - Required. The project in which the ProductSets should be imported.

        Format is `projects/PROJECT_ID/locations/LOC_ID`.

        inputConfig - Required. The input content for the list of requests.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • importProductSetsAsync

        public final com.google.api.gax.longrunning.OperationFuture<ImportProductSetsResponse,​BatchOperationMetadata> importProductSetsAsync​(ImportProductSetsRequest request)
        Asynchronous API that imports a list of reference images to specified product sets based on a list of image information.

        The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the progress and results of the request. `Operation.metadata` contains `BatchOperationMetadata`. (progress) `Operation.response` contains `ImportProductSetsResponse`. (results)

        The input source of this method is a csv file on Google Cloud Storage. For the format of the csv file please see [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.csv_file_uri].

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ImportProductSetsRequest request =
               ImportProductSetsRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setInputConfig(ImportProductSetsInputConfig.newBuilder().build())
                   .build();
           ImportProductSetsResponse response =
               productSearchClient.importProductSetsAsync(request).get();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • importProductSetsOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<ImportProductSetsRequest,​ImportProductSetsResponse,​BatchOperationMetadata> importProductSetsOperationCallable()
        Asynchronous API that imports a list of reference images to specified product sets based on a list of image information.

        The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the progress and results of the request. `Operation.metadata` contains `BatchOperationMetadata`. (progress) `Operation.response` contains `ImportProductSetsResponse`. (results)

        The input source of this method is a csv file on Google Cloud Storage. For the format of the csv file please see [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.csv_file_uri].

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ImportProductSetsRequest request =
               ImportProductSetsRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setInputConfig(ImportProductSetsInputConfig.newBuilder().build())
                   .build();
           OperationFuture<ImportProductSetsResponse, BatchOperationMetadata> future =
               productSearchClient.importProductSetsOperationCallable().futureCall(request);
           // Do something.
           ImportProductSetsResponse response = future.get();
         }
         
      • importProductSetsCallable

        public final com.google.api.gax.rpc.UnaryCallable<ImportProductSetsRequest,​com.google.longrunning.Operation> importProductSetsCallable()
        Asynchronous API that imports a list of reference images to specified product sets based on a list of image information.

        The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the progress and results of the request. `Operation.metadata` contains `BatchOperationMetadata`. (progress) `Operation.response` contains `ImportProductSetsResponse`. (results)

        The input source of this method is a csv file on Google Cloud Storage. For the format of the csv file please see [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.csv_file_uri].

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           ImportProductSetsRequest request =
               ImportProductSetsRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setInputConfig(ImportProductSetsInputConfig.newBuilder().build())
                   .build();
           ApiFuture<Operation> future =
               productSearchClient.importProductSetsCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • purgeProductsAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​BatchOperationMetadata> purgeProductsAsync​(LocationName parent)
        Asynchronous API to delete all Products in a ProductSet or all Products that are in no ProductSet.

        If a Product is a member of the specified ProductSet in addition to other ProductSets, the Product will still be deleted.

        It is recommended to not delete the specified ProductSet until after this operation has completed. It is also recommended to not add any of the Products involved in the batch delete to a new ProductSet while this operation is running because those Products may still end up deleted.

        It's not possible to undo the PurgeProducts operation. Therefore, it is recommended to keep the csv files used in ImportProductSets (if that was how you originally built the Product Set) before starting PurgeProducts, in case you need to re-import the data after deletion.

        If the plan is to purge all of the Products from a ProductSet and then re-use the empty ProductSet to re-import new Products into the empty ProductSet, you must wait until the PurgeProducts operation has finished for that ProductSet.

        The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the progress and results of the request. `Operation.metadata` contains `BatchOperationMetadata`. (progress)

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
           productSearchClient.purgeProductsAsync(parent).get();
         }
         
        Parameters:
        parent - Required. The project and location in which the Products should be deleted.

        Format is `projects/PROJECT_ID/locations/LOC_ID`.

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • purgeProductsAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​BatchOperationMetadata> purgeProductsAsync​(String parent)
        Asynchronous API to delete all Products in a ProductSet or all Products that are in no ProductSet.

        If a Product is a member of the specified ProductSet in addition to other ProductSets, the Product will still be deleted.

        It is recommended to not delete the specified ProductSet until after this operation has completed. It is also recommended to not add any of the Products involved in the batch delete to a new ProductSet while this operation is running because those Products may still end up deleted.

        It's not possible to undo the PurgeProducts operation. Therefore, it is recommended to keep the csv files used in ImportProductSets (if that was how you originally built the Product Set) before starting PurgeProducts, in case you need to re-import the data after deletion.

        If the plan is to purge all of the Products from a ProductSet and then re-use the empty ProductSet to re-import new Products into the empty ProductSet, you must wait until the PurgeProducts operation has finished for that ProductSet.

        The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the progress and results of the request. `Operation.metadata` contains `BatchOperationMetadata`. (progress)

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
           productSearchClient.purgeProductsAsync(parent).get();
         }
         
        Parameters:
        parent - Required. The project and location in which the Products should be deleted.

        Format is `projects/PROJECT_ID/locations/LOC_ID`.

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • purgeProductsAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​BatchOperationMetadata> purgeProductsAsync​(PurgeProductsRequest request)
        Asynchronous API to delete all Products in a ProductSet or all Products that are in no ProductSet.

        If a Product is a member of the specified ProductSet in addition to other ProductSets, the Product will still be deleted.

        It is recommended to not delete the specified ProductSet until after this operation has completed. It is also recommended to not add any of the Products involved in the batch delete to a new ProductSet while this operation is running because those Products may still end up deleted.

        It's not possible to undo the PurgeProducts operation. Therefore, it is recommended to keep the csv files used in ImportProductSets (if that was how you originally built the Product Set) before starting PurgeProducts, in case you need to re-import the data after deletion.

        If the plan is to purge all of the Products from a ProductSet and then re-use the empty ProductSet to re-import new Products into the empty ProductSet, you must wait until the PurgeProducts operation has finished for that ProductSet.

        The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the progress and results of the request. `Operation.metadata` contains `BatchOperationMetadata`. (progress)

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           PurgeProductsRequest request =
               PurgeProductsRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setForce(true)
                   .build();
           productSearchClient.purgeProductsAsync(request).get();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • purgeProductsOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<PurgeProductsRequest,​com.google.protobuf.Empty,​BatchOperationMetadata> purgeProductsOperationCallable()
        Asynchronous API to delete all Products in a ProductSet or all Products that are in no ProductSet.

        If a Product is a member of the specified ProductSet in addition to other ProductSets, the Product will still be deleted.

        It is recommended to not delete the specified ProductSet until after this operation has completed. It is also recommended to not add any of the Products involved in the batch delete to a new ProductSet while this operation is running because those Products may still end up deleted.

        It's not possible to undo the PurgeProducts operation. Therefore, it is recommended to keep the csv files used in ImportProductSets (if that was how you originally built the Product Set) before starting PurgeProducts, in case you need to re-import the data after deletion.

        If the plan is to purge all of the Products from a ProductSet and then re-use the empty ProductSet to re-import new Products into the empty ProductSet, you must wait until the PurgeProducts operation has finished for that ProductSet.

        The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the progress and results of the request. `Operation.metadata` contains `BatchOperationMetadata`. (progress)

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           PurgeProductsRequest request =
               PurgeProductsRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setForce(true)
                   .build();
           OperationFuture<Empty, BatchOperationMetadata> future =
               productSearchClient.purgeProductsOperationCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • purgeProductsCallable

        public final com.google.api.gax.rpc.UnaryCallable<PurgeProductsRequest,​com.google.longrunning.Operation> purgeProductsCallable()
        Asynchronous API to delete all Products in a ProductSet or all Products that are in no ProductSet.

        If a Product is a member of the specified ProductSet in addition to other ProductSets, the Product will still be deleted.

        It is recommended to not delete the specified ProductSet until after this operation has completed. It is also recommended to not add any of the Products involved in the batch delete to a new ProductSet while this operation is running because those Products may still end up deleted.

        It's not possible to undo the PurgeProducts operation. Therefore, it is recommended to keep the csv files used in ImportProductSets (if that was how you originally built the Product Set) before starting PurgeProducts, in case you need to re-import the data after deletion.

        If the plan is to purge all of the Products from a ProductSet and then re-use the empty ProductSet to re-import new Products into the empty ProductSet, you must wait until the PurgeProducts operation has finished for that ProductSet.

        The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the progress and results of the request. `Operation.metadata` contains `BatchOperationMetadata`. (progress)

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
           PurgeProductsRequest request =
               PurgeProductsRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setForce(true)
                   .build();
           ApiFuture<Operation> future = productSearchClient.purgeProductsCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • shutdown

        public void shutdown()
        Specified by:
        shutdown in interface com.google.api.gax.core.BackgroundResource
      • isShutdown

        public boolean isShutdown()
        Specified by:
        isShutdown in interface com.google.api.gax.core.BackgroundResource
      • isTerminated

        public boolean isTerminated()
        Specified by:
        isTerminated in interface com.google.api.gax.core.BackgroundResource
      • shutdownNow

        public void shutdownNow()
        Specified by:
        shutdownNow in interface com.google.api.gax.core.BackgroundResource