Cloud Vision V1p3beta1 API - Class Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::Client (v0.11.0)

Reference documentation and code samples for the Cloud Vision V1p3beta1 API class Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::Client.

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

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all ProductSearch clients
::Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::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.
Overloads
def add_product_to_product_set(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to add_product_to_product_set via a request object, either of type AddProductToProductSetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Vision::V1p3beta1::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
Pass arguments to 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).
Parameters
  • 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

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/vision/v1p3beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Vision::V1p3beta1::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.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#create_product

def create_product(request, options = nil) -> ::Google::Cloud::Vision::V1p3beta1::Product
def create_product(parent: nil, product: nil, product_id: nil) -> ::Google::Cloud::Vision::V1p3beta1::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.
Overloads
def create_product(request, options = nil) -> ::Google::Cloud::Vision::V1p3beta1::Product
Pass arguments to create_product via a request object, either of type CreateProductRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Vision::V1p3beta1::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::V1p3beta1::Product
Pass arguments to 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).
Parameters
  • parent (::String) — Required. The project in which the Product should be created.

    Format is projects/PROJECT_ID/locations/LOC_ID.

  • product (::Google::Cloud::Vision::V1p3beta1::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 /.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/vision/v1p3beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Vision::V1p3beta1::CreateProductRequest.new

# Call the create_product method.
result = client.create_product request

# The returned object is of type Google::Cloud::Vision::V1p3beta1::Product.
p result

#create_product_set

def create_product_set(request, options = nil) -> ::Google::Cloud::Vision::V1p3beta1::ProductSet
def create_product_set(parent: nil, product_set: nil, product_set_id: nil) -> ::Google::Cloud::Vision::V1p3beta1::ProductSet

Creates and returns a new ProductSet resource.

Possible errors:

  • Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.
Overloads
def create_product_set(request, options = nil) -> ::Google::Cloud::Vision::V1p3beta1::ProductSet
Pass arguments to create_product_set via a request object, either of type CreateProductSetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Vision::V1p3beta1::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::V1p3beta1::ProductSet
Pass arguments to 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).
Parameters
  • 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::V1p3beta1::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 /.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/vision/v1p3beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Vision::V1p3beta1::CreateProductSetRequest.new

# Call the create_product_set method.
result = client.create_product_set request

# The returned object is of type Google::Cloud::Vision::V1p3beta1::ProductSet.
p result

#create_reference_image

def create_reference_image(request, options = nil) -> ::Google::Cloud::Vision::V1p3beta1::ReferenceImage
def create_reference_image(parent: nil, reference_image: nil, reference_image_id: nil) -> ::Google::Cloud::Vision::V1p3beta1::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.
Overloads
def create_reference_image(request, options = nil) -> ::Google::Cloud::Vision::V1p3beta1::ReferenceImage
Pass arguments to create_reference_image via a request object, either of type CreateReferenceImageRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Vision::V1p3beta1::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::V1p3beta1::ReferenceImage
Pass arguments to 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).
Parameters
  • 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::V1p3beta1::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 /.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/vision/v1p3beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Vision::V1p3beta1::CreateReferenceImageRequest.new

# Call the create_reference_image method.
result = client.create_reference_image request

# The returned object is of type Google::Cloud::Vision::V1p3beta1::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.

Possible errors:

  • Returns NOT_FOUND if the product does not exist.
Overloads
def delete_product(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_product via a request object, either of type DeleteProductRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Vision::V1p3beta1::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
Pass arguments to 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).
Parameter
  • name (::String) — Required. Resource name of product to delete.

    Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/vision/v1p3beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Vision::V1p3beta1::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. All Products and ReferenceImages in the ProductSet will be deleted.

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

Possible errors:

  • Returns NOT_FOUND if the ProductSet does not exist.
Overloads
def delete_product_set(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_product_set via a request object, either of type DeleteProductSetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Vision::V1p3beta1::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
Pass arguments to 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).
Parameter
  • name (::String) — Required. Resource name of the ProductSet to delete.

    Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/vision/v1p3beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Vision::V1p3beta1::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.

Possible errors:

  • Returns NOT_FOUND if the reference image does not exist.
Overloads
def delete_reference_image(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_reference_image via a request object, either of type DeleteReferenceImageRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Vision::V1p3beta1::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
Pass arguments to 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).
Parameter
  • 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

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/vision/v1p3beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Vision::V1p3beta1::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::V1p3beta1::Product
def get_product(name: nil) -> ::Google::Cloud::Vision::V1p3beta1::Product

Gets information associated with a Product.

Possible errors:

  • Returns NOT_FOUND if the Product does not exist.
Overloads
def get_product(request, options = nil) -> ::Google::Cloud::Vision::V1p3beta1::Product
Pass arguments to get_product via a request object, either of type GetProductRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Vision::V1p3beta1::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::V1p3beta1::Product
Pass arguments to 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).
Parameter
  • name (::String) — Required. Resource name of the Product to get.

    Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/vision/v1p3beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Vision::V1p3beta1::GetProductRequest.new

# Call the get_product method.
result = client.get_product request

# The returned object is of type Google::Cloud::Vision::V1p3beta1::Product.
p result

#get_product_set

def get_product_set(request, options = nil) -> ::Google::Cloud::Vision::V1p3beta1::ProductSet
def get_product_set(name: nil) -> ::Google::Cloud::Vision::V1p3beta1::ProductSet

Gets information associated with a ProductSet.

Possible errors:

  • Returns NOT_FOUND if the ProductSet does not exist.
Overloads
def get_product_set(request, options = nil) -> ::Google::Cloud::Vision::V1p3beta1::ProductSet
Pass arguments to get_product_set via a request object, either of type GetProductSetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Vision::V1p3beta1::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::V1p3beta1::ProductSet
Pass arguments to 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).
Parameter
  • name (::String) — Required. Resource name of the ProductSet to get.

    Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/vision/v1p3beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Vision::V1p3beta1::GetProductSetRequest.new

# Call the get_product_set method.
result = client.get_product_set request

# The returned object is of type Google::Cloud::Vision::V1p3beta1::ProductSet.
p result

#get_reference_image

def get_reference_image(request, options = nil) -> ::Google::Cloud::Vision::V1p3beta1::ReferenceImage
def get_reference_image(name: nil) -> ::Google::Cloud::Vision::V1p3beta1::ReferenceImage

Gets information associated with a ReferenceImage.

Possible errors:

  • Returns NOT_FOUND if the specified image does not exist.
Overloads
def get_reference_image(request, options = nil) -> ::Google::Cloud::Vision::V1p3beta1::ReferenceImage
Pass arguments to get_reference_image via a request object, either of type GetReferenceImageRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Vision::V1p3beta1::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::V1p3beta1::ReferenceImage
Pass arguments to 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).
Parameter
  • 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.

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/vision/v1p3beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Vision::V1p3beta1::GetReferenceImageRequest.new

# Call the get_reference_image method.
result = client.get_reference_image request

# The returned object is of type Google::Cloud::Vision::V1p3beta1::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.

Overloads
def import_product_sets(request, options = nil) -> ::Gapic::Operation
Pass arguments to import_product_sets via a request object, either of type ImportProductSetsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Vision::V1p3beta1::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
Pass arguments to 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).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/vision/v1p3beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Vision::V1p3beta1::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 it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#initialize

def initialize() { |config| ... } -> Client

Create a new ProductSearch REST client object.

Yields
  • (config) — Configure the ProductSearch client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::Client.new do |config|
  config.timeout = 10.0
end

#list_product_sets

def list_product_sets(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::ProductSet>
def list_product_sets(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::ProductSet>

Lists ProductSets in an unspecified order.

Possible errors:

  • Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.
Overloads
def list_product_sets(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::ProductSet>
Pass arguments to list_product_sets via a request object, either of type ListProductSetsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Vision::V1p3beta1::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::Rest::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::ProductSet>
Pass arguments to 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).
Parameters
  • 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.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/vision/v1p3beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Vision::V1p3beta1::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 elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Vision::V1p3beta1::ProductSet.
  p item
end

#list_products

def list_products(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::Product>
def list_products(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::Product>

Lists products in an unspecified order.

Possible errors:

  • Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
Overloads
def list_products(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::Product>
Pass arguments to list_products via a request object, either of type ListProductsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Vision::V1p3beta1::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::Rest::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::Product>
Pass arguments to 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).
Parameters
  • 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.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/vision/v1p3beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Vision::V1p3beta1::ListProductsRequest.new

# Call the list_products method.
result = client.list_products request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Vision::V1p3beta1::Product.
  p item
end

#list_products_in_product_set

def list_products_in_product_set(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::Product>
def list_products_in_product_set(name: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::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.
Overloads
def list_products_in_product_set(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::Product>
Pass arguments to list_products_in_product_set via a request object, either of type ListProductsInProductSetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Vision::V1p3beta1::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::Rest::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::Product>
Pass arguments to 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).
Parameters
  • 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.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/vision/v1p3beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Vision::V1p3beta1::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 elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Vision::V1p3beta1::Product.
  p item
end

#list_reference_images

def list_reference_images(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::ReferenceImage>
def list_reference_images(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::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.
Overloads
def list_reference_images(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::ReferenceImage>
Pass arguments to list_reference_images via a request object, either of type ListReferenceImagesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Vision::V1p3beta1::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::Rest::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::ReferenceImage>
Pass arguments to 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).
Parameters
  • 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.

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/vision/v1p3beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Vision::V1p3beta1::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 elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Vision::V1p3beta1::ReferenceImage.
  p item
end

#operations_client

def operations_client() -> ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::Operations

Get the associated client for long-running operations.

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

Possible errors:

  • Returns NOT_FOUND If the Product is not found under the ProductSet.
Overloads
def remove_product_from_product_set(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to remove_product_from_product_set via a request object, either of type RemoveProductFromProductSetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Vision::V1p3beta1::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
Pass arguments to 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).
Parameters
  • 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

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/vision/v1p3beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Vision::V1p3beta1::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::V1p3beta1::Product
def update_product(product: nil, update_mask: nil) -> ::Google::Cloud::Vision::V1p3beta1::Product

Makes changes to a Product resource. Only display_name, description and labels can be updated right now.

If labels are updated, the change will not be reflected in queries until the next index time.

Possible errors:

  • Returns NOT_FOUND if the Product does not exist.
  • Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from the request or longer than 4096 characters.
  • Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096 characters.
  • Returns INVALID_ARGUMENT if product_category is present in update_mask.
Overloads
def update_product(request, options = nil) -> ::Google::Cloud::Vision::V1p3beta1::Product
Pass arguments to update_product via a request object, either of type UpdateProductRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Vision::V1p3beta1::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::V1p3beta1::Product
Pass arguments to 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).
Parameters
  • product (::Google::Cloud::Vision::V1p3beta1::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, and description.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/vision/v1p3beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Vision::V1p3beta1::UpdateProductRequest.new

# Call the update_product method.
result = client.update_product request

# The returned object is of type Google::Cloud::Vision::V1p3beta1::Product.
p result

#update_product_set

def update_product_set(request, options = nil) -> ::Google::Cloud::Vision::V1p3beta1::ProductSet
def update_product_set(product_set: nil, update_mask: nil) -> ::Google::Cloud::Vision::V1p3beta1::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.
Overloads
def update_product_set(request, options = nil) -> ::Google::Cloud::Vision::V1p3beta1::ProductSet
Pass arguments to update_product_set via a request object, either of type UpdateProductSetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Vision::V1p3beta1::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::V1p3beta1::ProductSet
Pass arguments to 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).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/vision/v1p3beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Vision::V1p3beta1::UpdateProductSetRequest.new

# Call the update_product_set method.
result = client.update_product_set request

# The returned object is of type Google::Cloud::Vision::V1p3beta1::ProductSet.
p result