pub struct ProductSearchClient<T> { /* private fields */ }
Expand description

Manages Products and ProductSets of reference images for use in product search. It uses the following resource model:

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

In parallel,

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

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

Implementations§

source§

impl<T> ProductSearchClient<T>
where T: GrpcService<BoxBody>, T::Error: Into<StdError>, T::ResponseBody: Body<Data = Bytes> + Send + 'static, <T::ResponseBody as Body>::Error: Into<StdError> + Send,

source

pub fn new(inner: T) -> Self

source

pub fn with_origin(inner: T, origin: Uri) -> Self

source

pub fn with_interceptor<F>( inner: T, interceptor: F ) -> ProductSearchClient<InterceptedService<T, F>>
where F: Interceptor, T::ResponseBody: Default, T: Service<Request<BoxBody>, Response = Response<<T as GrpcService<BoxBody>>::ResponseBody>>, <T as Service<Request<BoxBody>>>::Error: Into<StdError> + Send + Sync,

source

pub fn send_compressed(self, encoding: CompressionEncoding) -> Self

Compress requests with the given encoding.

This requires the server to support it otherwise it might respond with an error.

source

pub fn accept_compressed(self, encoding: CompressionEncoding) -> Self

Enable decompressing responses.

source

pub fn max_decoding_message_size(self, limit: usize) -> Self

Limits the maximum size of a decoded message.

Default: 4MB

source

pub fn max_encoding_message_size(self, limit: usize) -> Self

Limits the maximum size of an encoded message.

Default: usize::MAX

source

pub async fn create_product_set( &mut self, request: impl IntoRequest<CreateProductSetRequest> ) -> Result<Response<ProductSet>, Status>

Creates and returns a new ProductSet resource.

Possible errors:

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

pub async fn list_product_sets( &mut self, request: impl IntoRequest<ListProductSetsRequest> ) -> Result<Response<ListProductSetsResponse>, Status>

Lists ProductSets in an unspecified order.

Possible errors:

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

pub async fn get_product_set( &mut self, request: impl IntoRequest<GetProductSetRequest> ) -> Result<Response<ProductSet>, Status>

Gets information associated with a ProductSet.

Possible errors:

  • Returns NOT_FOUND if the ProductSet does not exist.
source

pub async fn update_product_set( &mut self, request: impl IntoRequest<UpdateProductSetRequest> ) -> Result<Response<ProductSet>, Status>

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

pub async fn delete_product_set( &mut self, request: impl IntoRequest<DeleteProductSetRequest> ) -> Result<Response<()>, Status>

Permanently deletes a ProductSet. Products and ReferenceImages in the ProductSet are not deleted.

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

source

pub async fn create_product( &mut self, request: impl IntoRequest<CreateProductRequest> ) -> Result<Response<Product>, Status>

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

pub async fn list_products( &mut self, request: impl IntoRequest<ListProductsRequest> ) -> Result<Response<ListProductsResponse>, Status>

Lists products in an unspecified order.

Possible errors:

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

pub async fn get_product( &mut self, request: impl IntoRequest<GetProductRequest> ) -> Result<Response<Product>, Status>

Gets information associated with a Product.

Possible errors:

  • Returns NOT_FOUND if the Product does not exist.
source

pub async fn update_product( &mut self, request: impl IntoRequest<UpdateProductRequest> ) -> Result<Response<Product>, Status>

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

pub async fn delete_product( &mut self, request: impl IntoRequest<DeleteProductRequest> ) -> Result<Response<()>, Status>

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.

source

pub async fn create_reference_image( &mut self, request: impl IntoRequest<CreateReferenceImageRequest> ) -> Result<Response<ReferenceImage>, Status>

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

pub async fn delete_reference_image( &mut self, request: impl IntoRequest<DeleteReferenceImageRequest> ) -> Result<Response<()>, Status>

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.

source

pub async fn list_reference_images( &mut self, request: impl IntoRequest<ListReferenceImagesRequest> ) -> Result<Response<ListReferenceImagesResponse>, Status>

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

pub async fn get_reference_image( &mut self, request: impl IntoRequest<GetReferenceImageRequest> ) -> Result<Response<ReferenceImage>, Status>

Gets information associated with a ReferenceImage.

Possible errors:

  • Returns NOT_FOUND if the specified image does not exist.
source

pub async fn add_product_to_product_set( &mut self, request: impl IntoRequest<AddProductToProductSetRequest> ) -> Result<Response<()>, Status>

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

pub async fn remove_product_from_product_set( &mut self, request: impl IntoRequest<RemoveProductFromProductSetRequest> ) -> Result<Response<()>, Status>

Removes a Product from the specified ProductSet.

source

pub async fn list_products_in_product_set( &mut self, request: impl IntoRequest<ListProductsInProductSetRequest> ) -> Result<Response<ListProductsInProductSetResponse>, Status>

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

pub async fn import_product_sets( &mut self, request: impl IntoRequest<ImportProductSetsRequest> ) -> Result<Response<Operation>, Status>

Asynchronous API that imports a list of reference images to specified product sets based on a list of image information.

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

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

source

pub async fn purge_products( &mut self, request: impl IntoRequest<PurgeProductsRequest> ) -> Result<Response<Operation>, Status>

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)

Trait Implementations§

source§

impl<T: Clone> Clone for ProductSearchClient<T>

source§

fn clone(&self) -> ProductSearchClient<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug> Debug for ProductSearchClient<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> !Freeze for ProductSearchClient<T>

§

impl<T> RefUnwindSafe for ProductSearchClient<T>
where T: RefUnwindSafe,

§

impl<T> Send for ProductSearchClient<T>
where T: Send,

§

impl<T> Sync for ProductSearchClient<T>
where T: Sync,

§

impl<T> Unpin for ProductSearchClient<T>
where T: Unpin,

§

impl<T> UnwindSafe for ProductSearchClient<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more