Class ProductSearchClient (2.14.0)

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/*
Equality

Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection> objects compare equal. Objects that compare equal share the same underlying resources.

Performance

Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.

Thread Safety

Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.

Constructors

ProductSearchClient(ProductSearchClient const &)

Copy and move support

Parameter
Name Description
ProductSearchClient const &

ProductSearchClient(ProductSearchClient &&)

Copy and move support

Parameter
Name Description
ProductSearchClient &&

ProductSearchClient(std::shared_ptr< ProductSearchConnection >, Options)

Parameters
Name Description
connection std::shared_ptr< ProductSearchConnection >
opts Options

Operators

operator=(ProductSearchClient const &)

Copy and move support

Parameter
Name Description
ProductSearchClient const &
Returns
Type Description
ProductSearchClient &

operator=(ProductSearchClient &&)

Copy and move support

Parameter
Name Description
ProductSearchClient &&
Returns
Type Description
ProductSearchClient &

Functions

CreateProductSet(std::string const &, google::cloud::vision::v1::ProductSet const &, std::string const &, Options)

Creates and returns a new ProductSet resource.

Possible errors:

  • Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.
Parameters
Name Description
parent std::string const &

Required. The project in which the ProductSet should be created.
Format is projects/PROJECT_ID/locations/LOC_ID.

product_set google::cloud::vision::v1::ProductSet const &

Required. The ProductSet to create.

product_set_id std::string const &

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 /.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::vision::v1::ProductSet >

the result of the RPC. The response message type (google.cloud.vision.v1.ProductSet) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

CreateProductSet(google::cloud::vision::v1::CreateProductSetRequest const &, Options)

Creates and returns a new ProductSet resource.

Possible errors:

  • Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.
Parameters
Name Description
request google::cloud::vision::v1::CreateProductSetRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.vision.v1.CreateProductSetRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::vision::v1::ProductSet >

the result of the RPC. The response message type (google.cloud.vision.v1.ProductSet) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

ListProductSets(std::string const &, Options)

Lists ProductSets in an unspecified order.

Possible errors:

  • Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.
Parameters
Name Description
parent std::string const &

Required. The project from which ProductSets should be listed.
Format is projects/PROJECT_ID/locations/LOC_ID.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::vision::v1::ProductSet >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.vision.v1.ProductSet, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ListProductSets(google::cloud::vision::v1::ListProductSetsRequest, Options)

Lists ProductSets in an unspecified order.

Possible errors:

  • Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.
Parameters
Name Description
request google::cloud::vision::v1::ListProductSetsRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.vision.v1.ListProductSetsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::vision::v1::ProductSet >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.vision.v1.ProductSet, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

GetProductSet(std::string const &, Options)

Gets information associated with a ProductSet.

Possible errors:

  • Returns NOT_FOUND if the ProductSet does not exist.
Parameters
Name Description
name std::string const &

Required. Resource name of the ProductSet to get.
Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::vision::v1::ProductSet >

the result of the RPC. The response message type (google.cloud.vision.v1.ProductSet) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetProductSet(google::cloud::vision::v1::GetProductSetRequest const &, Options)

Gets information associated with a ProductSet.

Possible errors:

  • Returns NOT_FOUND if the ProductSet does not exist.
Parameters
Name Description
request google::cloud::vision::v1::GetProductSetRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.vision.v1.GetProductSetRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::vision::v1::ProductSet >

the result of the RPC. The response message type (google.cloud.vision.v1.ProductSet) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateProductSet(google::cloud::vision::v1::ProductSet const &, google::protobuf::FieldMask const &, Options)

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
Name Description
product_set google::cloud::vision::v1::ProductSet const &

Required. The ProductSet resource which replaces the one on the server.

update_mask google::protobuf::FieldMask const &

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.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::vision::v1::ProductSet >

the result of the RPC. The response message type (google.cloud.vision.v1.ProductSet) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateProductSet(google::cloud::vision::v1::UpdateProductSetRequest const &, Options)

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
Name Description
request google::cloud::vision::v1::UpdateProductSetRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.vision.v1.UpdateProductSetRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::vision::v1::ProductSet >

the result of the RPC. The response message type (google.cloud.vision.v1.ProductSet) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

DeleteProductSet(std::string const &, Options)

Permanently deletes a ProductSet.

Products and ReferenceImages in the ProductSet are not deleted.

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

Parameters
Name Description
name std::string const &

Required. Resource name of the ProductSet to delete.
Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

DeleteProductSet(google::cloud::vision::v1::DeleteProductSetRequest const &, Options)

Permanently deletes a ProductSet.

Products and ReferenceImages in the ProductSet are not deleted.

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

Parameters
Name Description
request google::cloud::vision::v1::DeleteProductSetRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.vision.v1.DeleteProductSetRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

CreateProduct(std::string const &, google::cloud::vision::v1::Product const &, std::string const &, Options)

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
Name Description
parent std::string const &

Required. The project in which the Product should be created.
Format is projects/PROJECT_ID/locations/LOC_ID.

product google::cloud::vision::v1::Product const &

Required. The product to create.

product_id std::string const &

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 /.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::vision::v1::Product >

the result of the RPC. The response message type (google.cloud.vision.v1.Product) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

CreateProduct(google::cloud::vision::v1::CreateProductRequest const &, Options)

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
Name Description
request google::cloud::vision::v1::CreateProductRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.vision.v1.CreateProductRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::vision::v1::Product >

the result of the RPC. The response message type (google.cloud.vision.v1.Product) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

ListProducts(std::string const &, Options)

Lists products in an unspecified order.

Possible errors:

  • Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
Parameters
Name Description
parent std::string const &

Required. The project OR ProductSet from which Products should be listed.
Format: projects/PROJECT_ID/locations/LOC_ID

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::vision::v1::Product >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.vision.v1.Product, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ListProducts(google::cloud::vision::v1::ListProductsRequest, Options)

Lists products in an unspecified order.

Possible errors:

  • Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
Parameters
Name Description
request google::cloud::vision::v1::ListProductsRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.vision.v1.ListProductsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::vision::v1::Product >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.vision.v1.Product, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

GetProduct(std::string const &, Options)

Gets information associated with a Product.

Possible errors:

  • Returns NOT_FOUND if the Product does not exist.
Parameters
Name Description
name std::string const &

Required. Resource name of the Product to get.
Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::vision::v1::Product >

the result of the RPC. The response message type (google.cloud.vision.v1.Product) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetProduct(google::cloud::vision::v1::GetProductRequest const &, Options)

Gets information associated with a Product.

Possible errors:

  • Returns NOT_FOUND if the Product does not exist.
Parameters
Name Description
request google::cloud::vision::v1::GetProductRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.vision.v1.GetProductRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::vision::v1::Product >

the result of the RPC. The response message type (google.cloud.vision.v1.Product) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateProduct(google::cloud::vision::v1::Product const &, google::protobuf::FieldMask const &, Options)

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.
Parameters
Name Description
product google::cloud::vision::v1::Product const &

Required. The Product resource which replaces the one on the server. product.name is immutable.

update_mask google::protobuf::FieldMask const &

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.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::vision::v1::Product >

the result of the RPC. The response message type (google.cloud.vision.v1.Product) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateProduct(google::cloud::vision::v1::UpdateProductRequest const &, Options)

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.
Parameters
Name Description
request google::cloud::vision::v1::UpdateProductRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.vision.v1.UpdateProductRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::vision::v1::Product >

the result of the RPC. The response message type (google.cloud.vision.v1.Product) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

DeleteProduct(std::string const &, Options)

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.

Parameters
Name Description
name std::string const &

Required. Resource name of product to delete.
Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

DeleteProduct(google::cloud::vision::v1::DeleteProductRequest const &, Options)

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.

Parameters
Name Description
request google::cloud::vision::v1::DeleteProductRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.vision.v1.DeleteProductRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

CreateReferenceImage(std::string const &, google::cloud::vision::v1::ReferenceImage const &, std::string const &, Options)

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
Name Description
parent std::string const &

Required. Resource name of the product in which to create the reference image.
Format is projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID.

reference_image google::cloud::vision::v1::ReferenceImage const &

Required. The reference image to create. If an image ID is specified, it is ignored.

reference_image_id std::string const &

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 /.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::vision::v1::ReferenceImage >

the result of the RPC. The response message type (google.cloud.vision.v1.ReferenceImage) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

CreateReferenceImage(google::cloud::vision::v1::CreateReferenceImageRequest const &, Options)

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
Name Description
request google::cloud::vision::v1::CreateReferenceImageRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.vision.v1.CreateReferenceImageRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::vision::v1::ReferenceImage >

the result of the RPC. The response message type (google.cloud.vision.v1.ReferenceImage) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

DeleteReferenceImage(std::string const &, Options)

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.

Parameters
Name Description
name std::string const &

Required. The resource name of the reference image to delete.
Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

DeleteReferenceImage(google::cloud::vision::v1::DeleteReferenceImageRequest const &, Options)

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.

Parameters
Name Description
request google::cloud::vision::v1::DeleteReferenceImageRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.vision.v1.DeleteReferenceImageRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

ListReferenceImages(std::string const &, Options)

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
Name Description
parent std::string const &

Required. Resource name of the product containing the reference images.
Format is projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::vision::v1::ReferenceImage >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.vision.v1.ReferenceImage, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ListReferenceImages(google::cloud::vision::v1::ListReferenceImagesRequest, Options)

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
Name Description
request google::cloud::vision::v1::ListReferenceImagesRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.vision.v1.ListReferenceImagesRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::vision::v1::ReferenceImage >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.vision.v1.ReferenceImage, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

GetReferenceImage(std::string const &, Options)

Gets information associated with a ReferenceImage.

Possible errors:

  • Returns NOT_FOUND if the specified image does not exist.
Parameters
Name Description
name std::string const &

Required. The resource name of the ReferenceImage to get.
Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::vision::v1::ReferenceImage >

the result of the RPC. The response message type (google.cloud.vision.v1.ReferenceImage) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetReferenceImage(google::cloud::vision::v1::GetReferenceImageRequest const &, Options)

Gets information associated with a ReferenceImage.

Possible errors:

  • Returns NOT_FOUND if the specified image does not exist.
Parameters
Name Description
request google::cloud::vision::v1::GetReferenceImageRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.vision.v1.GetReferenceImageRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::vision::v1::ReferenceImage >

the result of the RPC. The response message type (google.cloud.vision.v1.ReferenceImage) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

AddProductToProductSet(std::string const &, std::string const &, Options)

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
Name Description
name std::string const &

Required. The resource name for the ProductSet to modify.
Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID

product std::string const &

Required. The resource name for the Product to be added to this ProductSet.
Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

AddProductToProductSet(google::cloud::vision::v1::AddProductToProductSetRequest const &, Options)

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
Name Description
request google::cloud::vision::v1::AddProductToProductSetRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.vision.v1.AddProductToProductSetRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

RemoveProductFromProductSet(std::string const &, std::string const &, Options)

Removes a Product from the specified ProductSet.

Parameters
Name Description
name std::string const &

Required. The resource name for the ProductSet to modify.
Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID

product std::string const &

Required. The resource name for the Product to be removed from this ProductSet.
Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

RemoveProductFromProductSet(google::cloud::vision::v1::RemoveProductFromProductSetRequest const &, Options)

Removes a Product from the specified ProductSet.

Parameters
Name Description
request google::cloud::vision::v1::RemoveProductFromProductSetRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.vision.v1.RemoveProductFromProductSetRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

ListProductsInProductSet(std::string const &, Options)

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
Name Description
name std::string const &

Required. The ProductSet resource for which to retrieve Products.
Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::vision::v1::Product >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.vision.v1.Product, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ListProductsInProductSet(google::cloud::vision::v1::ListProductsInProductSetRequest, Options)

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
Name Description
request google::cloud::vision::v1::ListProductsInProductSetRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.vision.v1.ListProductsInProductSetRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::vision::v1::Product >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.vision.v1.Product, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ImportProductSets(std::string const &, google::cloud::vision::v1::ImportProductSetsInputConfig const &, Options)

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
Name Description
parent std::string const &

Required. The project in which the ProductSets should be imported.
Format is projects/PROJECT_ID/locations/LOC_ID.

input_config google::cloud::vision::v1::ImportProductSetsInputConfig const &

Required. The input content for the list of requests.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
future< StatusOr< google::cloud::vision::v1::ImportProductSetsResponse > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.vision.v1.ImportProductSetsResponse proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

ImportProductSets(google::cloud::vision::v1::ImportProductSetsRequest const &, Options)

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
Name Description
request google::cloud::vision::v1::ImportProductSetsRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.vision.v1.ImportProductSetsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
future< StatusOr< google::cloud::vision::v1::ImportProductSetsResponse > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.vision.v1.ImportProductSetsResponse proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

PurgeProducts(std::string const &, Options)

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 API can be used to keep track of the progress and results of the request. Operation.metadata contains BatchOperationMetadata. (progress)

Parameters
Name Description
parent std::string const &

Required. The project and location in which the Products should be deleted.
Format is projects/PROJECT_ID/locations/LOC_ID.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
future< StatusOr< google::cloud::vision::v1::BatchOperationMetadata > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.vision.v1.BatchOperationMetadata proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

PurgeProducts(google::cloud::vision::v1::PurgeProductsRequest const &, Options)

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 API can be used to keep track of the progress and results of the request. Operation.metadata contains BatchOperationMetadata. (progress)

Parameters
Name Description
request google::cloud::vision::v1::PurgeProductsRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.vision.v1.PurgeProductsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
future< StatusOr< google::cloud::vision::v1::BatchOperationMetadata > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.vision.v1.BatchOperationMetadata proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.