Interface ProductSearchGrpc.AsyncService (3.12.0)

public static interface ProductSearchGrpc.AsyncService

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 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 resources, named projects/*/locations/*/products/*
  • Each Product has a collection of ReferenceImage resources, named projects/*/locations/*/products/*/referenceImages/*

Methods

addProductToProductSet(AddProductToProductSetRequest request, StreamObserver<Empty> responseObserver)

public default void addProductToProductSet(AddProductToProductSetRequest request, StreamObserver<Empty> responseObserver)

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.
Parameters
NameDescription
requestAddProductToProductSetRequest
responseObserverio.grpc.stub.StreamObserver<Empty>

createProduct(CreateProductRequest request, StreamObserver<Product> responseObserver)

public default void createProduct(CreateProductRequest request, StreamObserver<Product> responseObserver)

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.
Parameters
NameDescription
requestCreateProductRequest
responseObserverio.grpc.stub.StreamObserver<Product>

createProductSet(CreateProductSetRequest request, StreamObserver<ProductSet> responseObserver)

public default void createProductSet(CreateProductSetRequest request, StreamObserver<ProductSet> responseObserver)

Creates and returns a new ProductSet resource. Possible errors:

  • Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.
Parameters
NameDescription
requestCreateProductSetRequest
responseObserverio.grpc.stub.StreamObserver<ProductSet>

createReferenceImage(CreateReferenceImageRequest request, StreamObserver<ReferenceImage> responseObserver)

public default void createReferenceImage(CreateReferenceImageRequest request, StreamObserver<ReferenceImage> responseObserver)

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.
Parameters
NameDescription
requestCreateReferenceImageRequest
responseObserverio.grpc.stub.StreamObserver<ReferenceImage>

deleteProduct(DeleteProductRequest request, StreamObserver<Empty> responseObserver)

public default void deleteProduct(DeleteProductRequest request, StreamObserver<Empty> responseObserver)

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. Possible errors:

  • Returns NOT_FOUND if the product does not exist.
Parameters
NameDescription
requestDeleteProductRequest
responseObserverio.grpc.stub.StreamObserver<Empty>

deleteProductSet(DeleteProductSetRequest request, StreamObserver<Empty> responseObserver)

public default void deleteProductSet(DeleteProductSetRequest request, StreamObserver<Empty> responseObserver)

Permanently deletes a ProductSet. All Products and ReferenceImages in the ProductSet will be deleted. The actual image files are not deleted from Google Cloud Storage. Possible errors:

  • Returns NOT_FOUND if the ProductSet does not exist.
Parameters
NameDescription
requestDeleteProductSetRequest
responseObserverio.grpc.stub.StreamObserver<Empty>

deleteReferenceImage(DeleteReferenceImageRequest request, StreamObserver<Empty> responseObserver)

public default void deleteReferenceImage(DeleteReferenceImageRequest request, StreamObserver<Empty> responseObserver)

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. Possible errors:

  • Returns NOT_FOUND if the reference image does not exist.
Parameters
NameDescription
requestDeleteReferenceImageRequest
responseObserverio.grpc.stub.StreamObserver<Empty>

getProduct(GetProductRequest request, StreamObserver<Product> responseObserver)

public default void getProduct(GetProductRequest request, StreamObserver<Product> responseObserver)

Gets information associated with a Product. Possible errors:

  • Returns NOT_FOUND if the Product does not exist.
Parameters
NameDescription
requestGetProductRequest
responseObserverio.grpc.stub.StreamObserver<Product>

getProductSet(GetProductSetRequest request, StreamObserver<ProductSet> responseObserver)

public default void getProductSet(GetProductSetRequest request, StreamObserver<ProductSet> responseObserver)

Gets information associated with a ProductSet. Possible errors:

  • Returns NOT_FOUND if the ProductSet does not exist.
Parameters
NameDescription
requestGetProductSetRequest
responseObserverio.grpc.stub.StreamObserver<ProductSet>

getReferenceImage(GetReferenceImageRequest request, StreamObserver<ReferenceImage> responseObserver)

public default void getReferenceImage(GetReferenceImageRequest request, StreamObserver<ReferenceImage> responseObserver)

Gets information associated with a ReferenceImage. Possible errors:

  • Returns NOT_FOUND if the specified image does not exist.
Parameters
NameDescription
requestGetReferenceImageRequest
responseObserverio.grpc.stub.StreamObserver<ReferenceImage>

importProductSets(ImportProductSetsRequest request, StreamObserver<Operation> responseObserver)

public default void importProductSets(ImportProductSetsRequest request, StreamObserver<Operation> responseObserver)

Asynchronous API that imports a list of reference images to specified product sets based on a list of image information. The 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.

Parameters
NameDescription
requestImportProductSetsRequest
responseObserverio.grpc.stub.StreamObserver<Operation>

listProductSets(ListProductSetsRequest request, StreamObserver<ListProductSetsResponse> responseObserver)

public default void listProductSets(ListProductSetsRequest request, StreamObserver<ListProductSetsResponse> responseObserver)

Lists ProductSets in an unspecified order. Possible errors:

  • Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.
Parameters
NameDescription
requestListProductSetsRequest
responseObserverio.grpc.stub.StreamObserver<ListProductSetsResponse>

listProducts(ListProductsRequest request, StreamObserver<ListProductsResponse> responseObserver)

public default void listProducts(ListProductsRequest request, StreamObserver<ListProductsResponse> responseObserver)

Lists products in an unspecified order. Possible errors:

  • Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
Parameters
NameDescription
requestListProductsRequest
responseObserverio.grpc.stub.StreamObserver<ListProductsResponse>

listProductsInProductSet(ListProductsInProductSetRequest request, StreamObserver<ListProductsInProductSetResponse> responseObserver)

public default void listProductsInProductSet(ListProductsInProductSetRequest request, StreamObserver<ListProductsInProductSetResponse> responseObserver)

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.
Parameters
NameDescription
requestListProductsInProductSetRequest
responseObserverio.grpc.stub.StreamObserver<ListProductsInProductSetResponse>

listReferenceImages(ListReferenceImagesRequest request, StreamObserver<ListReferenceImagesResponse> responseObserver)

public default void listReferenceImages(ListReferenceImagesRequest request, StreamObserver<ListReferenceImagesResponse> responseObserver)

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.
Parameters
NameDescription
requestListReferenceImagesRequest
responseObserverio.grpc.stub.StreamObserver<ListReferenceImagesResponse>

removeProductFromProductSet(RemoveProductFromProductSetRequest request, StreamObserver<Empty> responseObserver)

public default void removeProductFromProductSet(RemoveProductFromProductSetRequest request, StreamObserver<Empty> responseObserver)

Removes a Product from the specified ProductSet. Possible errors:

  • Returns NOT_FOUND If the Product is not found under the ProductSet.
Parameters
NameDescription
requestRemoveProductFromProductSetRequest
responseObserverio.grpc.stub.StreamObserver<Empty>

updateProduct(UpdateProductRequest request, StreamObserver<Product> responseObserver)

public default void updateProduct(UpdateProductRequest request, StreamObserver<Product> responseObserver)

Makes changes to a Product resource. Only display_name, description and labels 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.
Parameters
NameDescription
requestUpdateProductRequest
responseObserverio.grpc.stub.StreamObserver<Product>

updateProductSet(UpdateProductSetRequest request, StreamObserver<ProductSet> responseObserver)

public default void updateProductSet(UpdateProductSetRequest request, StreamObserver<ProductSet> responseObserver)

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.
Parameters
NameDescription
requestUpdateProductSetRequest
responseObserverio.grpc.stub.StreamObserver<ProductSet>