Class ProductSearchClient

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

Inheritance

builtins.object > ProductSearchClient

Properties

transport

Returns the transport used by the client instance.

Returns
TypeDescription
ProductSearchTransportThe transport used by the client instance.

Methods

__exit__

__exit__(type, value, traceback)

Releases underlying transport's resources.

.. warning:: ONLY use as a context manager if the transport is NOT shared with other clients! Exiting the with block will CLOSE the transport and may cause errors in other clients!

add_product_to_product_set

add_product_to_product_set(request: Optional[Union[google.cloud.vision_v1p4beta1.types.product_search_service.AddProductToProductSetRequest, dict]] = None, *, name: Optional[str] = None, product: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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
request Union[google.cloud.vision_v1p4beta1.types.AddProductToProductSetRequest, dict]

The request object. Request message for the AddProductToProductSet method.

name str

Required. The resource name for the ProductSet to modify. Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID This corresponds to the name field on the request instance; if request is provided, this should not be set.

product str

Required. The resource name for the Product to be added to this ProductSet. Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID This corresponds to the product field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

common_billing_account_path

common_billing_account_path(billing_account: str)

Returns a fully-qualified billing_account string.

Parameter
NameDescription
billing_account str

common_folder_path

common_folder_path(folder: str)

Returns a fully-qualified folder string.

Parameter
NameDescription
folder str

common_location_path

common_location_path(project: str, location: str)

Returns a fully-qualified location string.

Parameters
NameDescription
project str
location str

common_organization_path

common_organization_path(organization: str)

Returns a fully-qualified organization string.

Parameter
NameDescription
organization str

common_project_path

common_project_path(project: str)

Returns a fully-qualified project string.

Parameter
NameDescription
project str

create_product

create_product(request: Optional[Union[google.cloud.vision_v1p4beta1.types.product_search_service.CreateProductRequest, dict]] = None, *, parent: Optional[str] = None, product: Optional[google.cloud.vision_v1p4beta1.types.product_search_service.Product] = None, product_id: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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
request Union[google.cloud.vision_v1p4beta1.types.CreateProductRequest, dict]

The request object. Request message for the CreateProduct method.

parent str

Required. The project in which the Product should be created. Format is projects/PROJECT_ID/locations/LOC_ID. This corresponds to the parent field on the request instance; if request is provided, this should not be set.

product google.cloud.vision_v1p4beta1.types.Product

Required. The product to create. This corresponds to the product field on the request instance; if request is provided, this should not be set.

product_id str

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 /. This corresponds to the product_id field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.cloud.vision_v1p4beta1.types.ProductA Product contains ReferenceImages.

create_product_set

create_product_set(request: Optional[Union[google.cloud.vision_v1p4beta1.types.product_search_service.CreateProductSetRequest, dict]] = None, *, parent: Optional[str] = None, product_set: Optional[google.cloud.vision_v1p4beta1.types.product_search_service.ProductSet] = None, product_set_id: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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
request Union[google.cloud.vision_v1p4beta1.types.CreateProductSetRequest, dict]

The request object. Request message for the CreateProductSet method.

parent str

Required. The project in which the ProductSet should be created. Format is projects/PROJECT_ID/locations/LOC_ID. This corresponds to the parent field on the request instance; if request is provided, this should not be set.

product_set google.cloud.vision_v1p4beta1.types.ProductSet

Required. The ProductSet to create. This corresponds to the product_set field on the request instance; if request is provided, this should not be set.

product_set_id str

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 /. This corresponds to the product_set_id field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.cloud.vision_v1p4beta1.types.ProductSetA ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit is exceeded, periodic indexing will fail.

create_reference_image

create_reference_image(request: Optional[Union[google.cloud.vision_v1p4beta1.types.product_search_service.CreateReferenceImageRequest, dict]] = None, *, parent: Optional[str] = None, reference_image: Optional[google.cloud.vision_v1p4beta1.types.product_search_service.ReferenceImage] = None, reference_image_id: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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
request Union[google.cloud.vision_v1p4beta1.types.CreateReferenceImageRequest, dict]

The request object. Request message for the CreateReferenceImage method.

parent str

Required. Resource name of the product in which to create the reference image. Format is projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID. This corresponds to the parent field on the request instance; if request is provided, this should not be set.

reference_image google.cloud.vision_v1p4beta1.types.ReferenceImage

Required. The reference image to create. If an image ID is specified, it is ignored. This corresponds to the reference_image field on the request instance; if request is provided, this should not be set.

reference_image_id str

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 /. This corresponds to the reference_image_id field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.cloud.vision_v1p4beta1.types.ReferenceImageA ReferenceImage represents a product image and its associated metadata, such as bounding boxes.

delete_product

delete_product(request: Optional[Union[google.cloud.vision_v1p4beta1.types.product_search_service.DeleteProductRequest, dict]] = None, *, name: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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
NameDescription
request Union[google.cloud.vision_v1p4beta1.types.DeleteProductRequest, dict]

The request object. Request message for the DeleteProduct method.

name str

Required. Resource name of product to delete. Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID This corresponds to the name field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

delete_product_set

delete_product_set(request: Optional[Union[google.cloud.vision_v1p4beta1.types.product_search_service.DeleteProductSetRequest, dict]] = None, *, name: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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
NameDescription
request Union[google.cloud.vision_v1p4beta1.types.DeleteProductSetRequest, dict]

The request object. Request message for the DeleteProductSet method.

name str

Required. Resource name of the ProductSet to delete. Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID This corresponds to the name field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

delete_reference_image

delete_reference_image(request: Optional[Union[google.cloud.vision_v1p4beta1.types.product_search_service.DeleteReferenceImageRequest, dict]] = None, *, name: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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
NameDescription
request Union[google.cloud.vision_v1p4beta1.types.DeleteReferenceImageRequest, dict]

The request object. Request message for the DeleteReferenceImage method.

name str

Required. The resource name of the reference image to delete. Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID This corresponds to the name field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

from_service_account_file

from_service_account_file(filename: str, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameters
NameDescription
filename str

The path to the service account private key json file.

args

Additional arguments to pass to the constructor.

kwargs

Additional arguments to pass to the constructor.

Returns
TypeDescription
ProductSearchClientThe constructed client.

from_service_account_info

from_service_account_info(info: dict, *args, **kwargs)

Creates an instance of this client using the provided credentials info.

Parameters
NameDescription
info dict

The service account private key info.

args

Additional arguments to pass to the constructor.

kwargs

Additional arguments to pass to the constructor.

Returns
TypeDescription
ProductSearchClientThe constructed client.

from_service_account_json

from_service_account_json(filename: str, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameters
NameDescription
filename str

The path to the service account private key json file.

args

Additional arguments to pass to the constructor.

kwargs

Additional arguments to pass to the constructor.

Returns
TypeDescription
ProductSearchClientThe constructed client.

get_product

get_product(request: Optional[Union[google.cloud.vision_v1p4beta1.types.product_search_service.GetProductRequest, dict]] = None, *, name: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Gets information associated with a Product.

Possible errors:

  • Returns NOT_FOUND if the Product does not exist.
Parameters
NameDescription
request Union[google.cloud.vision_v1p4beta1.types.GetProductRequest, dict]

The request object. Request message for the GetProduct method.

name str

Required. Resource name of the Product to get. Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID This corresponds to the name field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.cloud.vision_v1p4beta1.types.ProductA Product contains ReferenceImages.

get_product_set

get_product_set(request: Optional[Union[google.cloud.vision_v1p4beta1.types.product_search_service.GetProductSetRequest, dict]] = None, *, name: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Gets information associated with a ProductSet.

Possible errors:

  • Returns NOT_FOUND if the ProductSet does not exist.
Parameters
NameDescription
request Union[google.cloud.vision_v1p4beta1.types.GetProductSetRequest, dict]

The request object. Request message for the GetProductSet method.

name str

Required. Resource name of the ProductSet to get. Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID This corresponds to the name field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.cloud.vision_v1p4beta1.types.ProductSetA ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit is exceeded, periodic indexing will fail.

get_reference_image

get_reference_image(request: Optional[Union[google.cloud.vision_v1p4beta1.types.product_search_service.GetReferenceImageRequest, dict]] = None, *, name: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Gets information associated with a ReferenceImage.

Possible errors:

  • Returns NOT_FOUND if the specified image does not exist.
Parameters
NameDescription
request Union[google.cloud.vision_v1p4beta1.types.GetReferenceImageRequest, dict]

The request object. Request message for the GetReferenceImage method.

name str

Required. The resource name of the ReferenceImage to get. Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID. This corresponds to the name field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.cloud.vision_v1p4beta1.types.ReferenceImageA ReferenceImage represents a product image and its associated metadata, such as bounding boxes.

import_product_sets

import_product_sets(request: Optional[Union[google.cloud.vision_v1p4beta1.types.product_search_service.ImportProductSetsRequest, dict]] = None, *, parent: Optional[str] = None, input_config: Optional[google.cloud.vision_v1p4beta1.types.product_search_service.ImportProductSetsInputConfig] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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 xref_ImportProductSetsGcsSource.csv_file_uri.

Parameters
NameDescription
request Union[google.cloud.vision_v1p4beta1.types.ImportProductSetsRequest, dict]

The request object. Request message for the ImportProductSets method.

parent str

Required. The project in which the ProductSets should be imported. Format is projects/PROJECT_ID/locations/LOC_ID. This corresponds to the parent field on the request instance; if request is provided, this should not be set.

input_config google.cloud.vision_v1p4beta1.types.ImportProductSetsInputConfig

Required. The input content for the list of requests. This corresponds to the input_config field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.api_core.operation.OperationAn object representing a long-running operation. The result type for the operation will be ImportProductSetsResponse Response message for the ImportProductSets method. This message is returned by the `google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation]` method in the returned `google.longrunning.Operation.response][google.longrunning.Operation.response]` field.

list_product_sets

list_product_sets(request: Optional[Union[google.cloud.vision_v1p4beta1.types.product_search_service.ListProductSetsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Lists ProductSets in an unspecified order.

Possible errors:

  • Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.
Parameters
NameDescription
request Union[google.cloud.vision_v1p4beta1.types.ListProductSetsRequest, dict]

The request object. Request message for the ListProductSets method.

parent str

Required. The project from which ProductSets should be listed. Format is projects/PROJECT_ID/locations/LOC_ID. This corresponds to the parent field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductSetsPagerResponse message for the ListProductSets method. Iterating over this object will yield results and resolve additional pages automatically.

list_products

list_products(request: Optional[Union[google.cloud.vision_v1p4beta1.types.product_search_service.ListProductsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Lists products in an unspecified order.

Possible errors:

  • Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
Parameters
NameDescription
request Union[google.cloud.vision_v1p4beta1.types.ListProductsRequest, dict]

The request object. Request message for the ListProducts method.

parent str

Required. The project OR ProductSet from which Products should be listed. Format: projects/PROJECT_ID/locations/LOC_ID This corresponds to the parent field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductsPagerResponse message for the ListProducts method. Iterating over this object will yield results and resolve additional pages automatically.

list_products_in_product_set

list_products_in_product_set(request: Optional[Union[google.cloud.vision_v1p4beta1.types.product_search_service.ListProductsInProductSetRequest, dict]] = None, *, name: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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
request Union[google.cloud.vision_v1p4beta1.types.ListProductsInProductSetRequest, dict]

The request object. Request message for the ListProductsInProductSet method.

name str

Required. The ProductSet resource for which to retrieve Products. Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID This corresponds to the name field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductsInProductSetPagerResponse message for the ListProductsInProductSet method. Iterating over this object will yield results and resolve additional pages automatically.

list_reference_images

list_reference_images(request: Optional[Union[google.cloud.vision_v1p4beta1.types.product_search_service.ListReferenceImagesRequest, dict]] = None, *, parent: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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
request Union[google.cloud.vision_v1p4beta1.types.ListReferenceImagesRequest, dict]

The request object. Request message for the ListReferenceImages method.

parent str

Required. Resource name of the product containing the reference images. Format is projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID. This corresponds to the parent field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.cloud.vision_v1p4beta1.services.product_search.pagers.ListReferenceImagesPagerResponse message for the ListReferenceImages method. Iterating over this object will yield results and resolve additional pages automatically.

parse_common_billing_account_path

parse_common_billing_account_path(path: str)

Parse a billing_account path into its component segments.

Parameter
NameDescription
path str

parse_common_folder_path

parse_common_folder_path(path: str)

Parse a folder path into its component segments.

Parameter
NameDescription
path str

parse_common_location_path

parse_common_location_path(path: str)

Parse a location path into its component segments.

Parameter
NameDescription
path str

parse_common_organization_path

parse_common_organization_path(path: str)

Parse a organization path into its component segments.

Parameter
NameDescription
path str

parse_common_project_path

parse_common_project_path(path: str)

Parse a project path into its component segments.

Parameter
NameDescription
path str

parse_product_path

parse_product_path(path: str)

Parses a product path into its component segments.

Parameter
NameDescription
path str

parse_product_set_path

parse_product_set_path(path: str)

Parses a product_set path into its component segments.

Parameter
NameDescription
path str

parse_reference_image_path

parse_reference_image_path(path: str)

Parses a reference_image path into its component segments.

Parameter
NameDescription
path str

product_path

product_path(project: str, location: str, product: str)

Returns a fully-qualified product string.

Parameters
NameDescription
project str
location str
product str

product_set_path

product_set_path(project: str, location: str, product_set: str)

Returns a fully-qualified product_set string.

Parameters
NameDescription
project str
location str
product_set str

purge_products

purge_products(request: Optional[Union[google.cloud.vision_v1p4beta1.types.product_search_service.PurgeProductsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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)

Parameters
NameDescription
request Union[google.cloud.vision_v1p4beta1.types.PurgeProductsRequest, dict]

The request object. Request message for the PurgeProducts method.

parent str

Required. The project and location in which the Products should be deleted. Format is projects/PROJECT_ID/locations/LOC_ID. This corresponds to the parent field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.api_core.operation.OperationAn object representing a long-running operation. The result type for the operation will be `google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for Empty is empty JSON object {}.

reference_image_path

reference_image_path(
    project: str, location: str, product: str, reference_image: str
)

Returns a fully-qualified reference_image string.

Parameters
NameDescription
project str
location str
product str
reference_image str

remove_product_from_product_set

remove_product_from_product_set(request: Optional[Union[google.cloud.vision_v1p4beta1.types.product_search_service.RemoveProductFromProductSetRequest, dict]] = None, *, name: Optional[str] = None, product: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Removes a Product from the specified ProductSet.

Parameters
NameDescription
request Union[google.cloud.vision_v1p4beta1.types.RemoveProductFromProductSetRequest, dict]

The request object. Request message for the RemoveProductFromProductSet method.

name str

Required. The resource name for the ProductSet to modify. Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID This corresponds to the name field on the request instance; if request is provided, this should not be set.

product str

Required. The resource name for the Product to be removed from this ProductSet. Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID This corresponds to the product field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

update_product

update_product(request: Optional[Union[google.cloud.vision_v1p4beta1.types.product_search_service.UpdateProductRequest, dict]] = None, *, product: Optional[google.cloud.vision_v1p4beta1.types.product_search_service.Product] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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
NameDescription
request Union[google.cloud.vision_v1p4beta1.types.UpdateProductRequest, dict]

The request object. Request message for the UpdateProduct method.

product google.cloud.vision_v1p4beta1.types.Product

Required. The Product resource which replaces the one on the server. product.name is immutable. This corresponds to the product field on the request instance; if request is provided, this should not be set.

update_mask google.protobuf.field_mask_pb2.FieldMask

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. This corresponds to the update_mask field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.cloud.vision_v1p4beta1.types.ProductA Product contains ReferenceImages.

update_product_set

update_product_set(request: Optional[Union[google.cloud.vision_v1p4beta1.types.product_search_service.UpdateProductSetRequest, dict]] = None, *, product_set: Optional[google.cloud.vision_v1p4beta1.types.product_search_service.ProductSet] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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
request Union[google.cloud.vision_v1p4beta1.types.UpdateProductSetRequest, dict]

The request object. Request message for the UpdateProductSet method.

product_set google.cloud.vision_v1p4beta1.types.ProductSet

Required. The ProductSet resource which replaces the one on the server. This corresponds to the product_set field on the request instance; if request is provided, this should not be set.

update_mask google.protobuf.field_mask_pb2.FieldMask

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. This corresponds to the update_mask field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.cloud.vision_v1p4beta1.types.ProductSetA ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit is exceeded, periodic indexing will fail.