Reference documentation and code samples for the Cloud Vision V1p4beta1 API class Google::Cloud::Vision::V1p4beta1::ProductSearch::Client.
Client for the ProductSearch service.
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/*
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration
Configure the ProductSearch Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all ProductSearch clients ::Google::Cloud::Vision::V1p4beta1::ProductSearch::Client.configure do |config| config.timeout = 10.0 end
#add_product_to_product_set
def add_product_to_product_set(request, options = nil) -> ::Google::Protobuf::Empty
def add_product_to_product_set(name: nil, product: nil) -> ::Google::Protobuf::Empty
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.
def add_product_to_product_set(request, options = nil) -> ::Google::Protobuf::Empty
add_product_to_product_set
via a request object, either of type
AddProductToProductSetRequest or an equivalent Hash.
- request (::Google::Cloud::Vision::V1p4beta1::AddProductToProductSetRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def add_product_to_product_set(name: nil, product: nil) -> ::Google::Protobuf::Empty
add_product_to_product_set
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. The resource name for the ProductSet to modify.
Format is:
projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID
-
product (::String) — Required. The resource name for the Product to be added to this ProductSet.
Format is:
projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Protobuf::Empty)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/vision/v1p4beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Vision::V1p4beta1::ProductSearch::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Vision::V1p4beta1::AddProductToProductSetRequest.new # Call the add_product_to_product_set method. result = client.add_product_to_product_set request # The returned object is of type Google::Protobuf::Empty. p result
#configure
def configure() { |config| ... } -> Client::Configuration
Configure the ProductSearch Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
#create_product
def create_product(request, options = nil) -> ::Google::Cloud::Vision::V1p4beta1::Product
def create_product(parent: nil, product: nil, product_id: nil) -> ::Google::Cloud::Vision::V1p4beta1::Product
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.
def create_product(request, options = nil) -> ::Google::Cloud::Vision::V1p4beta1::Product
create_product
via a request object, either of type
CreateProductRequest or an equivalent Hash.
- request (::Google::Cloud::Vision::V1p4beta1::CreateProductRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_product(parent: nil, product: nil, product_id: nil) -> ::Google::Cloud::Vision::V1p4beta1::Product
create_product
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The project in which the Product should be created.
Format is
projects/PROJECT_ID/locations/LOC_ID
. - product (::Google::Cloud::Vision::V1p4beta1::Product, ::Hash) — Required. The product to create.
-
product_id (::String) — 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
/
.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Vision::V1p4beta1::Product)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/vision/v1p4beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Vision::V1p4beta1::ProductSearch::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Vision::V1p4beta1::CreateProductRequest.new # Call the create_product method. result = client.create_product request # The returned object is of type Google::Cloud::Vision::V1p4beta1::Product. p result
#create_product_set
def create_product_set(request, options = nil) -> ::Google::Cloud::Vision::V1p4beta1::ProductSet
def create_product_set(parent: nil, product_set: nil, product_set_id: nil) -> ::Google::Cloud::Vision::V1p4beta1::ProductSet
Creates and returns a new ProductSet resource.
Possible errors:
- Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.
def create_product_set(request, options = nil) -> ::Google::Cloud::Vision::V1p4beta1::ProductSet
create_product_set
via a request object, either of type
CreateProductSetRequest or an equivalent Hash.
- request (::Google::Cloud::Vision::V1p4beta1::CreateProductSetRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_product_set(parent: nil, product_set: nil, product_set_id: nil) -> ::Google::Cloud::Vision::V1p4beta1::ProductSet
create_product_set
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The project in which the ProductSet should be created.
Format is
projects/PROJECT_ID/locations/LOC_ID
. - product_set (::Google::Cloud::Vision::V1p4beta1::ProductSet, ::Hash) — Required. The ProductSet to create.
-
product_set_id (::String) — 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
/
.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Vision::V1p4beta1::ProductSet)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/vision/v1p4beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Vision::V1p4beta1::ProductSearch::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Vision::V1p4beta1::CreateProductSetRequest.new # Call the create_product_set method. result = client.create_product_set request # The returned object is of type Google::Cloud::Vision::V1p4beta1::ProductSet. p result
#create_reference_image
def create_reference_image(request, options = nil) -> ::Google::Cloud::Vision::V1p4beta1::ReferenceImage
def create_reference_image(parent: nil, reference_image: nil, reference_image_id: nil) -> ::Google::Cloud::Vision::V1p4beta1::ReferenceImage
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.
def create_reference_image(request, options = nil) -> ::Google::Cloud::Vision::V1p4beta1::ReferenceImage
create_reference_image
via a request object, either of type
CreateReferenceImageRequest or an equivalent Hash.
- request (::Google::Cloud::Vision::V1p4beta1::CreateReferenceImageRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_reference_image(parent: nil, reference_image: nil, reference_image_id: nil) -> ::Google::Cloud::Vision::V1p4beta1::ReferenceImage
create_reference_image
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — 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::V1p4beta1::ReferenceImage, ::Hash) — Required. The reference image to create. If an image ID is specified, it is ignored.
-
reference_image_id (::String) — 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
/
.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Vision::V1p4beta1::ReferenceImage)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/vision/v1p4beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Vision::V1p4beta1::ProductSearch::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Vision::V1p4beta1::CreateReferenceImageRequest.new # Call the create_reference_image method. result = client.create_reference_image request # The returned object is of type Google::Cloud::Vision::V1p4beta1::ReferenceImage. p result
#delete_product
def delete_product(request, options = nil) -> ::Google::Protobuf::Empty
def delete_product(name: nil) -> ::Google::Protobuf::Empty
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.
def delete_product(request, options = nil) -> ::Google::Protobuf::Empty
delete_product
via a request object, either of type
DeleteProductRequest or an equivalent Hash.
- request (::Google::Cloud::Vision::V1p4beta1::DeleteProductRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_product(name: nil) -> ::Google::Protobuf::Empty
delete_product
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. Resource name of product to delete.
Format is:
projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Protobuf::Empty)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/vision/v1p4beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Vision::V1p4beta1::ProductSearch::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Vision::V1p4beta1::DeleteProductRequest.new # Call the delete_product method. result = client.delete_product request # The returned object is of type Google::Protobuf::Empty. p result
#delete_product_set
def delete_product_set(request, options = nil) -> ::Google::Protobuf::Empty
def delete_product_set(name: nil) -> ::Google::Protobuf::Empty
Permanently deletes a ProductSet. Products and ReferenceImages in the ProductSet are not deleted.
The actual image files are not deleted from Google Cloud Storage.
def delete_product_set(request, options = nil) -> ::Google::Protobuf::Empty
delete_product_set
via a request object, either of type
DeleteProductSetRequest or an equivalent Hash.
- request (::Google::Cloud::Vision::V1p4beta1::DeleteProductSetRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_product_set(name: nil) -> ::Google::Protobuf::Empty
delete_product_set
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. Resource name of the ProductSet to delete.
Format is:
projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Protobuf::Empty)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/vision/v1p4beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Vision::V1p4beta1::ProductSearch::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Vision::V1p4beta1::DeleteProductSetRequest.new # Call the delete_product_set method. result = client.delete_product_set request # The returned object is of type Google::Protobuf::Empty. p result
#delete_reference_image
def delete_reference_image(request, options = nil) -> ::Google::Protobuf::Empty
def delete_reference_image(name: nil) -> ::Google::Protobuf::Empty
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.
def delete_reference_image(request, options = nil) -> ::Google::Protobuf::Empty
delete_reference_image
via a request object, either of type
DeleteReferenceImageRequest or an equivalent Hash.
- request (::Google::Cloud::Vision::V1p4beta1::DeleteReferenceImageRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_reference_image(name: nil) -> ::Google::Protobuf::Empty
delete_reference_image
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. The resource name of the reference image to delete.
Format is:
projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Protobuf::Empty)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/vision/v1p4beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Vision::V1p4beta1::ProductSearch::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Vision::V1p4beta1::DeleteReferenceImageRequest.new # Call the delete_reference_image method. result = client.delete_reference_image request # The returned object is of type Google::Protobuf::Empty. p result
#get_product
def get_product(request, options = nil) -> ::Google::Cloud::Vision::V1p4beta1::Product
def get_product(name: nil) -> ::Google::Cloud::Vision::V1p4beta1::Product
Gets information associated with a Product.
Possible errors:
- Returns NOT_FOUND if the Product does not exist.
def get_product(request, options = nil) -> ::Google::Cloud::Vision::V1p4beta1::Product
get_product
via a request object, either of type
GetProductRequest or an equivalent Hash.
- request (::Google::Cloud::Vision::V1p4beta1::GetProductRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_product(name: nil) -> ::Google::Cloud::Vision::V1p4beta1::Product
get_product
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. Resource name of the Product to get.
Format is:
projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Vision::V1p4beta1::Product)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/vision/v1p4beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Vision::V1p4beta1::ProductSearch::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Vision::V1p4beta1::GetProductRequest.new # Call the get_product method. result = client.get_product request # The returned object is of type Google::Cloud::Vision::V1p4beta1::Product. p result
#get_product_set
def get_product_set(request, options = nil) -> ::Google::Cloud::Vision::V1p4beta1::ProductSet
def get_product_set(name: nil) -> ::Google::Cloud::Vision::V1p4beta1::ProductSet
Gets information associated with a ProductSet.
Possible errors:
- Returns NOT_FOUND if the ProductSet does not exist.
def get_product_set(request, options = nil) -> ::Google::Cloud::Vision::V1p4beta1::ProductSet
get_product_set
via a request object, either of type
GetProductSetRequest or an equivalent Hash.
- request (::Google::Cloud::Vision::V1p4beta1::GetProductSetRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_product_set(name: nil) -> ::Google::Cloud::Vision::V1p4beta1::ProductSet
get_product_set
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. Resource name of the ProductSet to get.
Format is:
projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Vision::V1p4beta1::ProductSet)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/vision/v1p4beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Vision::V1p4beta1::ProductSearch::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Vision::V1p4beta1::GetProductSetRequest.new # Call the get_product_set method. result = client.get_product_set request # The returned object is of type Google::Cloud::Vision::V1p4beta1::ProductSet. p result
#get_reference_image
def get_reference_image(request, options = nil) -> ::Google::Cloud::Vision::V1p4beta1::ReferenceImage
def get_reference_image(name: nil) -> ::Google::Cloud::Vision::V1p4beta1::ReferenceImage
Gets information associated with a ReferenceImage.
Possible errors:
- Returns NOT_FOUND if the specified image does not exist.
def get_reference_image(request, options = nil) -> ::Google::Cloud::Vision::V1p4beta1::ReferenceImage
get_reference_image
via a request object, either of type
GetReferenceImageRequest or an equivalent Hash.
- request (::Google::Cloud::Vision::V1p4beta1::GetReferenceImageRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_reference_image(name: nil) -> ::Google::Cloud::Vision::V1p4beta1::ReferenceImage
get_reference_image
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. The resource name of the ReferenceImage to get.
Format is:
projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID
.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Vision::V1p4beta1::ReferenceImage)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/vision/v1p4beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Vision::V1p4beta1::ProductSearch::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Vision::V1p4beta1::GetReferenceImageRequest.new # Call the get_reference_image method. result = client.get_reference_image request # The returned object is of type Google::Cloud::Vision::V1p4beta1::ReferenceImage. p result
#import_product_sets
def import_product_sets(request, options = nil) -> ::Gapic::Operation
def import_product_sets(parent: nil, input_config: nil) -> ::Gapic::Operation
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.
def import_product_sets(request, options = nil) -> ::Gapic::Operation
import_product_sets
via a request object, either of type
ImportProductSetsRequest or an equivalent Hash.
- request (::Google::Cloud::Vision::V1p4beta1::ImportProductSetsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def import_product_sets(parent: nil, input_config: nil) -> ::Gapic::Operation
import_product_sets
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The project in which the ProductSets should be imported.
Format is
projects/PROJECT_ID/locations/LOC_ID
. - input_config (::Google::Cloud::Vision::V1p4beta1::ImportProductSetsInputConfig, ::Hash) — Required. The input content for the list of requests.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/vision/v1p4beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Vision::V1p4beta1::ProductSearch::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Vision::V1p4beta1::ImportProductSetsRequest.new # Call the import_product_sets method. result = client.import_product_sets request # The returned object is of type Gapic::Operation. You can use this # object to check the status of an operation, cancel it, or wait # for results. Here is how to block until completion: result.wait_until_done! timeout: 60 if result.response? p result.response else puts "Error!" end
#initialize
def initialize() { |config| ... } -> Client
Create a new ProductSearch client object.
- (config) — Configure the ProductSearch client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::Vision::V1p4beta1::ProductSearch::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Vision::V1p4beta1::ProductSearch::Client.new do |config| config.timeout = 10.0 end
#list_product_sets
def list_product_sets(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::ProductSet>
def list_product_sets(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::ProductSet>
Lists ProductSets in an unspecified order.
Possible errors:
- Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.
def list_product_sets(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::ProductSet>
list_product_sets
via a request object, either of type
ListProductSetsRequest or an equivalent Hash.
- request (::Google::Cloud::Vision::V1p4beta1::ListProductSetsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_product_sets(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::ProductSet>
list_product_sets
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The project from which ProductSets should be listed.
Format is
projects/PROJECT_ID/locations/LOC_ID
. - page_size (::Integer) — The maximum number of items to return. Default 10, maximum 100.
- page_token (::String) — The next_page_token returned from a previous List request, if any.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::ProductSet>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::ProductSet>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/vision/v1p4beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Vision::V1p4beta1::ProductSearch::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Vision::V1p4beta1::ListProductSetsRequest.new # Call the list_product_sets method. result = client.list_product_sets request # The returned object is of type Gapic::PagedEnumerable. You can # iterate over all elements by calling #each, and the enumerable # will lazily make API calls to fetch subsequent pages. Other # methods are also available for managing paging directly. result.each do |response| # Each element is of type ::Google::Cloud::Vision::V1p4beta1::ProductSet. p response end
#list_products
def list_products(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::Product>
def list_products(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::Product>
Lists products in an unspecified order.
Possible errors:
- Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
def list_products(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::Product>
list_products
via a request object, either of type
ListProductsRequest or an equivalent Hash.
- request (::Google::Cloud::Vision::V1p4beta1::ListProductsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_products(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::Product>
list_products
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The project OR ProductSet from which Products should be listed.
Format:
projects/PROJECT_ID/locations/LOC_ID
- page_size (::Integer) — The maximum number of items to return. Default 10, maximum 100.
- page_token (::String) — The next_page_token returned from a previous List request, if any.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::Product>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::Product>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/vision/v1p4beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Vision::V1p4beta1::ProductSearch::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Vision::V1p4beta1::ListProductsRequest.new # Call the list_products method. result = client.list_products request # The returned object is of type Gapic::PagedEnumerable. You can # iterate over all elements by calling #each, and the enumerable # will lazily make API calls to fetch subsequent pages. Other # methods are also available for managing paging directly. result.each do |response| # Each element is of type ::Google::Cloud::Vision::V1p4beta1::Product. p response end
#list_products_in_product_set
def list_products_in_product_set(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::Product>
def list_products_in_product_set(name: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::Product>
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.
def list_products_in_product_set(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::Product>
list_products_in_product_set
via a request object, either of type
ListProductsInProductSetRequest or an equivalent Hash.
- request (::Google::Cloud::Vision::V1p4beta1::ListProductsInProductSetRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_products_in_product_set(name: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::Product>
list_products_in_product_set
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. The ProductSet resource for which to retrieve Products.
Format is:
projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID
- page_size (::Integer) — The maximum number of items to return. Default 10, maximum 100.
- page_token (::String) — The next_page_token returned from a previous List request, if any.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::Product>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::Product>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/vision/v1p4beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Vision::V1p4beta1::ProductSearch::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Vision::V1p4beta1::ListProductsInProductSetRequest.new # Call the list_products_in_product_set method. result = client.list_products_in_product_set request # The returned object is of type Gapic::PagedEnumerable. You can # iterate over all elements by calling #each, and the enumerable # will lazily make API calls to fetch subsequent pages. Other # methods are also available for managing paging directly. result.each do |response| # Each element is of type ::Google::Cloud::Vision::V1p4beta1::Product. p response end
#list_reference_images
def list_reference_images(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::ReferenceImage>
def list_reference_images(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::ReferenceImage>
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.
def list_reference_images(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::ReferenceImage>
list_reference_images
via a request object, either of type
ListReferenceImagesRequest or an equivalent Hash.
- request (::Google::Cloud::Vision::V1p4beta1::ListReferenceImagesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_reference_images(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::ReferenceImage>
list_reference_images
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. Resource name of the product containing the reference images.
Format is
projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID
. - page_size (::Integer) — The maximum number of items to return. Default 10, maximum 100.
-
page_token (::String) — A token identifying a page of results to be returned. This is the value
of
nextPageToken
returned in a previous reference image list request.Defaults to the first page if not specified.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::ReferenceImage>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p4beta1::ReferenceImage>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/vision/v1p4beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Vision::V1p4beta1::ProductSearch::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Vision::V1p4beta1::ListReferenceImagesRequest.new # Call the list_reference_images method. result = client.list_reference_images request # The returned object is of type Gapic::PagedEnumerable. You can # iterate over all elements by calling #each, and the enumerable # will lazily make API calls to fetch subsequent pages. Other # methods are also available for managing paging directly. result.each do |response| # Each element is of type ::Google::Cloud::Vision::V1p4beta1::ReferenceImage. p response end
#operations_client
def operations_client() -> ::Google::Cloud::Vision::V1p4beta1::ProductSearch::Operations
Get the associated client for long-running operations.
#purge_products
def purge_products(request, options = nil) -> ::Gapic::Operation
def purge_products(product_set_purge_config: nil, delete_orphan_products: nil, parent: nil, force: nil) -> ::Gapic::Operation
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)
def purge_products(request, options = nil) -> ::Gapic::Operation
purge_products
via a request object, either of type
Google::Cloud::Vision::V1p4beta1::PurgeProductsRequest or an equivalent Hash.
- request (::Google::Cloud::Vision::V1p4beta1::PurgeProductsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def purge_products(product_set_purge_config: nil, delete_orphan_products: nil, parent: nil, force: nil) -> ::Gapic::Operation
purge_products
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- product_set_purge_config (::Google::Cloud::Vision::V1p4beta1::ProductSetPurgeConfig, ::Hash) — Specify which ProductSet contains the Products to be deleted.
- delete_orphan_products (::Boolean) — If delete_orphan_products is true, all Products that are not in any ProductSet will be deleted.
-
parent (::String) — Required. The project and location in which the Products should be deleted.
Format is
projects/PROJECT_ID/locations/LOC_ID
. - force (::Boolean) — The default value is false. Override this value to true to actually perform the purge.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/vision/v1p4beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Vision::V1p4beta1::ProductSearch::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Vision::V1p4beta1::PurgeProductsRequest.new # Call the purge_products method. result = client.purge_products request # The returned object is of type Gapic::Operation. You can use this # object to check the status of an operation, cancel it, or wait # for results. Here is how to block until completion: result.wait_until_done! timeout: 60 if result.response? p result.response else puts "Error!" end
#remove_product_from_product_set
def remove_product_from_product_set(request, options = nil) -> ::Google::Protobuf::Empty
def remove_product_from_product_set(name: nil, product: nil) -> ::Google::Protobuf::Empty
Removes a Product from the specified ProductSet.
def remove_product_from_product_set(request, options = nil) -> ::Google::Protobuf::Empty
remove_product_from_product_set
via a request object, either of type
RemoveProductFromProductSetRequest or an equivalent Hash.
- request (::Google::Cloud::Vision::V1p4beta1::RemoveProductFromProductSetRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def remove_product_from_product_set(name: nil, product: nil) -> ::Google::Protobuf::Empty
remove_product_from_product_set
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. The resource name for the ProductSet to modify.
Format is:
projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID
-
product (::String) — Required. The resource name for the Product to be removed from this
ProductSet.
Format is:
projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Protobuf::Empty)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/vision/v1p4beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Vision::V1p4beta1::ProductSearch::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Vision::V1p4beta1::RemoveProductFromProductSetRequest.new # Call the remove_product_from_product_set method. result = client.remove_product_from_product_set request # The returned object is of type Google::Protobuf::Empty. p result
#update_product
def update_product(request, options = nil) -> ::Google::Cloud::Vision::V1p4beta1::Product
def update_product(product: nil, update_mask: nil) -> ::Google::Cloud::Vision::V1p4beta1::Product
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.
def update_product(request, options = nil) -> ::Google::Cloud::Vision::V1p4beta1::Product
update_product
via a request object, either of type
UpdateProductRequest or an equivalent Hash.
- request (::Google::Cloud::Vision::V1p4beta1::UpdateProductRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def update_product(product: nil, update_mask: nil) -> ::Google::Cloud::Vision::V1p4beta1::Product
update_product
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- product (::Google::Cloud::Vision::V1p4beta1::Product, ::Hash) — Required. The Product resource which replaces the one on the server. product.name is immutable.
-
update_mask (::Google::Protobuf::FieldMask, ::Hash) — The 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
, anddescription
.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Vision::V1p4beta1::Product)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/vision/v1p4beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Vision::V1p4beta1::ProductSearch::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Vision::V1p4beta1::UpdateProductRequest.new # Call the update_product method. result = client.update_product request # The returned object is of type Google::Cloud::Vision::V1p4beta1::Product. p result
#update_product_set
def update_product_set(request, options = nil) -> ::Google::Cloud::Vision::V1p4beta1::ProductSet
def update_product_set(product_set: nil, update_mask: nil) -> ::Google::Cloud::Vision::V1p4beta1::ProductSet
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.
def update_product_set(request, options = nil) -> ::Google::Cloud::Vision::V1p4beta1::ProductSet
update_product_set
via a request object, either of type
UpdateProductSetRequest or an equivalent Hash.
- request (::Google::Cloud::Vision::V1p4beta1::UpdateProductSetRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def update_product_set(product_set: nil, update_mask: nil) -> ::Google::Cloud::Vision::V1p4beta1::ProductSet
update_product_set
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- product_set (::Google::Cloud::Vision::V1p4beta1::ProductSet, ::Hash) — Required. The ProductSet resource which replaces the one on the server.
-
update_mask (::Google::Protobuf::FieldMask, ::Hash) — The 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
.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Vision::V1p4beta1::ProductSet)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/vision/v1p4beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Vision::V1p4beta1::ProductSearch::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Vision::V1p4beta1::UpdateProductSetRequest.new # Call the update_product_set method. result = client.update_product_set request # The returned object is of type Google::Cloud::Vision::V1p4beta1::ProductSet. p result