class Google::Cloud::Vision::V1p3beta1::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 {::Google::Cloud::Vision::V1p3beta1::ProductSet 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 {::Google::Cloud::Vision::V1p3beta1::Product Product} resources, named `projects//locations//products/*`
-
Each {::Google::Cloud::Vision::V1p3beta1::Product Product} has a collection of {::Google::Cloud::Vision::V1p3beta1::ReferenceImage ReferenceImage} resources, named `projects//locations//products//referenceImages/`
Attributes
Get the associated client for long-running operations.
@return [::Google::Cloud::Vision::V1p3beta1::ProductSearch::Operations]
@private
Public Class Methods
Configure the ProductSearch
Client
class.
See {::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client::Configuration} for a description of the configuration fields.
@example
# Modify the configuration for all ProductSearch clients ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.configure do |config| config.timeout = 10.0 end
@yield [config] Configure the Client
client. @yieldparam config [Client::Configuration]
@return [Client::Configuration]
# File lib/google/cloud/vision/v1p3beta1/product_search/client.rb, line 69 def self.configure @configure ||= begin namespace = ["Google", "Cloud", "Vision", "V1p3beta1"] parent_config = while namespace.any? parent_name = namespace.join "::" parent_const = const_get parent_name break parent_const.configure if parent_const.respond_to? :configure namespace.pop end default_config = Client::Configuration.new parent_config default_config.rpcs.create_product_set.timeout = 600.0 default_config.rpcs.create_product_set.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [] } default_config.rpcs.list_product_sets.timeout = 600.0 default_config.rpcs.list_product_sets.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] } default_config.rpcs.get_product_set.timeout = 600.0 default_config.rpcs.get_product_set.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] } default_config.rpcs.update_product_set.timeout = 600.0 default_config.rpcs.update_product_set.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [] } default_config.rpcs.delete_product_set.timeout = 600.0 default_config.rpcs.delete_product_set.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] } default_config.rpcs.create_product.timeout = 600.0 default_config.rpcs.create_product.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [] } default_config.rpcs.list_products.timeout = 600.0 default_config.rpcs.list_products.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] } default_config.rpcs.get_product.timeout = 600.0 default_config.rpcs.get_product.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] } default_config.rpcs.update_product.timeout = 600.0 default_config.rpcs.update_product.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [] } default_config.rpcs.delete_product.timeout = 600.0 default_config.rpcs.delete_product.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] } default_config.rpcs.create_reference_image.timeout = 600.0 default_config.rpcs.create_reference_image.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [] } default_config.rpcs.delete_reference_image.timeout = 600.0 default_config.rpcs.delete_reference_image.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] } default_config.rpcs.list_reference_images.timeout = 600.0 default_config.rpcs.list_reference_images.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] } default_config.rpcs.get_reference_image.timeout = 600.0 default_config.rpcs.get_reference_image.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] } default_config.rpcs.add_product_to_product_set.timeout = 600.0 default_config.rpcs.add_product_to_product_set.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [] } default_config.rpcs.remove_product_from_product_set.timeout = 600.0 default_config.rpcs.remove_product_from_product_set.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [] } default_config.rpcs.list_products_in_product_set.timeout = 600.0 default_config.rpcs.list_products_in_product_set.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] } default_config.rpcs.import_product_sets.timeout = 600.0 default_config.rpcs.import_product_sets.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [] } default_config end yield @configure if block_given? @configure end
Create a new ProductSearch
client object.
@example
# Create a client using the default configuration client = ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new do |config| config.timeout = 10.0 end
@yield [config] Configure the ProductSearch
client. @yieldparam config [Client::Configuration]
# File lib/google/cloud/vision/v1p3beta1/product_search/client.rb, line 212 def initialize # These require statements are intentionally placed here to initialize # the gRPC module only when it's required. # See https://github.com/googleapis/toolkit/issues/446 require "gapic/grpc" require "google/cloud/vision/v1p3beta1/product_search_service_services_pb" # Create the configuration object @config = Configuration.new Client.configure # Yield the configuration if needed yield @config if block_given? # Create credentials credentials = @config.credentials # Use self-signed JWT if the endpoint is unchanged from default, # but only if the default endpoint does not have a region prefix. enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint && !@config.endpoint.split(".").first.include?("-") credentials ||= Credentials.default scope: @config.scope, enable_self_signed_jwt: enable_self_signed_jwt if credentials.is_a?(::String) || credentials.is_a?(::Hash) credentials = Credentials.new credentials, scope: @config.scope end @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id @operations_client = Operations.new do |config| config.credentials = credentials config.endpoint = @config.endpoint end @product_search_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Stub, credentials: credentials, endpoint: @config.endpoint, channel_args: @config.channel_args, interceptors: @config.interceptors ) end
Public Instance Methods
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.
@overload add_product_to_product_set
(request, options = nil)
Pass arguments to `add_product_to_product_set` via a request object, either of type {::Google::Cloud::Vision::V1p3beta1::AddProductToProductSetRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload add_product_to_product_set
(name: nil, product: nil)
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). @param name [::String] Required. The resource name for the ProductSet to modify. Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` @param 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`
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Protobuf::Empty] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Protobuf::Empty]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/vision/v1p3beta1/product_search/client.rb, line 1448 def add_product_to_product_set request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p3beta1::AddProductToProductSetRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.add_product_to_product_set.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.add_product_to_product_set.timeout, metadata: metadata, retry_policy: @config.rpcs.add_product_to_product_set.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @product_search_stub.call_rpc :add_product_to_product_set, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
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 {::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client::Configuration} for a description of the configuration fields.
@yield [config] Configure the Client
client. @yieldparam config [Client::Configuration]
@return [Client::Configuration]
# File lib/google/cloud/vision/v1p3beta1/product_search/client.rb, line 191 def configure yield @config if block_given? @config end
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.
@overload create_product
(request, options = nil)
Pass arguments to `create_product` via a request object, either of type {::Google::Cloud::Vision::V1p3beta1::CreateProductRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload create_product
(parent: nil, product: nil, product_id: nil)
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). @param parent [::String] Required. The project in which the Product should be created. Format is `projects/PROJECT_ID/locations/LOC_ID`. @param product [::Google::Cloud::Vision::V1p3beta1::Product, ::Hash] Required. The product to create. @param 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 `/`.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Vision::V1p3beta1::Product] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Vision::V1p3beta1::Product]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/vision/v1p3beta1/product_search/client.rb, line 703 def create_product request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p3beta1::CreateProductRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.create_product.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "parent" => request.parent } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.create_product.timeout, metadata: metadata, retry_policy: @config.rpcs.create_product.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @product_search_stub.call_rpc :create_product, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Creates and returns a new ProductSet resource.
Possible errors:
-
Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.
@overload create_product_set
(request, options = nil)
Pass arguments to `create_product_set` via a request object, either of type {::Google::Cloud::Vision::V1p3beta1::CreateProductSetRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload create_product_set
(parent: nil, product_set: nil, product_set_id: nil)
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). @param parent [::String] Required. The project in which the ProductSet should be created. Format is `projects/PROJECT_ID/locations/LOC_ID`. @param product_set [::Google::Cloud::Vision::V1p3beta1::ProductSet, ::Hash] Required. The ProductSet to create. @param 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 `/`.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Vision::V1p3beta1::ProductSet] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Vision::V1p3beta1::ProductSet]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/vision/v1p3beta1/product_search/client.rb, line 305 def create_product_set request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p3beta1::CreateProductSetRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.create_product_set.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "parent" => request.parent } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.create_product_set.timeout, metadata: metadata, retry_policy: @config.rpcs.create_product_set.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @product_search_stub.call_rpc :create_product_set, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
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.
@overload create_reference_image
(request, options = nil)
Pass arguments to `create_reference_image` via a request object, either of type {::Google::Cloud::Vision::V1p3beta1::CreateReferenceImageRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload create_reference_image
(parent: nil, reference_image: nil, reference_image_id: nil)
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). @param 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`. @param reference_image [::Google::Cloud::Vision::V1p3beta1::ReferenceImage, ::Hash] Required. The reference image to create. If an image ID is specified, it is ignored. @param 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 `/`.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Vision::V1p3beta1::ReferenceImage] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Vision::V1p3beta1::ReferenceImage]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/vision/v1p3beta1/product_search/client.rb, line 1122 def create_reference_image request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p3beta1::CreateReferenceImageRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.create_reference_image.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "parent" => request.parent } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.create_reference_image.timeout, metadata: metadata, retry_policy: @config.rpcs.create_reference_image.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @product_search_stub.call_rpc :create_reference_image, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
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.
@overload delete_product
(request, options = nil)
Pass arguments to `delete_product` via a request object, either of type {::Google::Cloud::Vision::V1p3beta1::DeleteProductRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload delete_product
(name: nil)
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). @param name [::String] Required. Resource name of product to delete. Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Protobuf::Empty] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Protobuf::Empty]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/vision/v1p3beta1/product_search/client.rb, line 1025 def delete_product request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p3beta1::DeleteProductRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.delete_product.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.delete_product.timeout, metadata: metadata, retry_policy: @config.rpcs.delete_product.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @product_search_stub.call_rpc :delete_product, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
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.
@overload delete_product_set
(request, options = nil)
Pass arguments to `delete_product_set` via a request object, either of type {::Google::Cloud::Vision::V1p3beta1::DeleteProductSetRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload delete_product_set
(name: nil)
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). @param name [::String] Required. Resource name of the ProductSet to delete. Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Protobuf::Empty] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Protobuf::Empty]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/vision/v1p3beta1/product_search/client.rb, line 618 def delete_product_set request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p3beta1::DeleteProductSetRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.delete_product_set.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.delete_product_set.timeout, metadata: metadata, retry_policy: @config.rpcs.delete_product_set.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @product_search_stub.call_rpc :delete_product_set, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
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.
@overload delete_reference_image
(request, options = nil)
Pass arguments to `delete_reference_image` via a request object, either of type {::Google::Cloud::Vision::V1p3beta1::DeleteReferenceImageRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload delete_reference_image
(name: nil)
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). @param 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`
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Protobuf::Empty] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Protobuf::Empty]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/vision/v1p3beta1/product_search/client.rb, line 1204 def delete_reference_image request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p3beta1::DeleteReferenceImageRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.delete_reference_image.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.delete_reference_image.timeout, metadata: metadata, retry_policy: @config.rpcs.delete_reference_image.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @product_search_stub.call_rpc :delete_reference_image, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Gets information associated with a Product
.
Possible errors:
-
Returns NOT_FOUND if the
Product
does not exist.
@overload get_product
(request, options = nil)
Pass arguments to `get_product` via a request object, either of type {::Google::Cloud::Vision::V1p3beta1::GetProductRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload get_product
(name: nil)
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). @param name [::String] Required. Resource name of the Product to get. Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Vision::V1p3beta1::Product] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Vision::V1p3beta1::Product]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/vision/v1p3beta1/product_search/client.rb, line 858 def get_product request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p3beta1::GetProductRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.get_product.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_product.timeout, metadata: metadata, retry_policy: @config.rpcs.get_product.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @product_search_stub.call_rpc :get_product, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Gets information associated with a ProductSet.
Possible errors:
-
Returns NOT_FOUND if the ProductSet does not exist.
@overload get_product_set
(request, options = nil)
Pass arguments to `get_product_set` via a request object, either of type {::Google::Cloud::Vision::V1p3beta1::GetProductSetRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload get_product_set
(name: nil)
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). @param name [::String] Required. Resource name of the ProductSet to get. Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Vision::V1p3beta1::ProductSet] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Vision::V1p3beta1::ProductSet]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/vision/v1p3beta1/product_search/client.rb, line 460 def get_product_set request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p3beta1::GetProductSetRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.get_product_set.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_product_set.timeout, metadata: metadata, retry_policy: @config.rpcs.get_product_set.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @product_search_stub.call_rpc :get_product_set, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Gets information associated with a ReferenceImage.
Possible errors:
-
Returns NOT_FOUND if the specified image does not exist.
@overload get_reference_image
(request, options = nil)
Pass arguments to `get_reference_image` via a request object, either of type {::Google::Cloud::Vision::V1p3beta1::GetReferenceImageRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload get_reference_image
(name: nil)
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). @param 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`.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Vision::V1p3beta1::ReferenceImage] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Vision::V1p3beta1::ReferenceImage]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/vision/v1p3beta1/product_search/client.rb, line 1365 def get_reference_image request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p3beta1::GetReferenceImageRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.get_reference_image.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_reference_image.timeout, metadata: metadata, retry_policy: @config.rpcs.get_reference_image.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @product_search_stub.call_rpc :get_reference_image, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Asynchronous API that imports a list of reference images to specified product sets based on a list of image information.
The {::Google::Longrunning::Operation google.longrunning.Operation} API can be used to keep track of the progress and results of the request. `Operation.metadata` contains `BatchOperationMetadata`. (progress) `Operation.response` contains `ImportProductSetsResponse`. (results)
The input source of this method is a csv file on Google
Cloud
Storage. For the format of the csv file please see {::Google::Cloud::Vision::V1p3beta1::ImportProductSetsGcsSource#csv_file_uri ImportProductSetsGcsSource.csv_file_uri}.
@overload import_product_sets
(request, options = nil)
Pass arguments to `import_product_sets` via a request object, either of type {::Google::Cloud::Vision::V1p3beta1::ImportProductSetsRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload import_product_sets
(parent: nil, input_config: nil)
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). @param parent [::String] Required. The project in which the ProductSets should be imported. Format is `projects/PROJECT_ID/locations/LOC_ID`. @param input_config [::Google::Cloud::Vision::V1p3beta1::ImportProductSetsInputConfig, ::Hash] Required. The input content for the list of requests.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::Operation] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Gapic::Operation]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/vision/v1p3beta1/product_search/client.rb, line 1692 def import_product_sets request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p3beta1::ImportProductSetsRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.import_product_sets.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "parent" => request.parent } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.import_product_sets.timeout, metadata: metadata, retry_policy: @config.rpcs.import_product_sets.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @product_search_stub.call_rpc :import_product_sets, request, options: options do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: options yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Lists ProductSets in an unspecified order.
Possible errors:
-
Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.
@overload list_product_sets
(request, options = nil)
Pass arguments to `list_product_sets` via a request object, either of type {::Google::Cloud::Vision::V1p3beta1::ListProductSetsRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload list_product_sets
(parent: nil, page_size: nil, page_token: nil)
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). @param parent [::String] Required. The project from which ProductSets should be listed. Format is `projects/PROJECT_ID/locations/LOC_ID`. @param page_size [::Integer] The maximum number of items to return. Default 10, maximum 100. @param page_token [::String] The next_page_token returned from a previous List request, if any.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::ProductSet>] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::ProductSet>]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/vision/v1p3beta1/product_search/client.rb, line 384 def list_product_sets request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p3beta1::ListProductSetsRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.list_product_sets.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "parent" => request.parent } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_product_sets.timeout, metadata: metadata, retry_policy: @config.rpcs.list_product_sets.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @product_search_stub.call_rpc :list_product_sets, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @product_search_stub, :list_product_sets, request, response, operation, options yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Lists products in an unspecified order.
Possible errors:
-
Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
@overload list_products
(request, options = nil)
Pass arguments to `list_products` via a request object, either of type {::Google::Cloud::Vision::V1p3beta1::ListProductsRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload list_products
(parent: nil, page_size: nil, page_token: nil)
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). @param parent [::String] Required. The project OR ProductSet from which Products should be listed. Format: `projects/PROJECT_ID/locations/LOC_ID` @param page_size [::Integer] The maximum number of items to return. Default 10, maximum 100. @param page_token [::String] The next_page_token returned from a previous List request, if any.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::Product>] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::Product>]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/vision/v1p3beta1/product_search/client.rb, line 782 def list_products request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p3beta1::ListProductsRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.list_products.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "parent" => request.parent } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_products.timeout, metadata: metadata, retry_policy: @config.rpcs.list_products.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @product_search_stub.call_rpc :list_products, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @product_search_stub, :list_products, request, response, operation, options yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
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.
@overload list_products_in_product_set
(request, options = nil)
Pass arguments to `list_products_in_product_set` via a request object, either of type {::Google::Cloud::Vision::V1p3beta1::ListProductsInProductSetRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload list_products_in_product_set
(name: nil, page_size: nil, page_token: nil)
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). @param name [::String] Required. The ProductSet resource for which to retrieve Products. Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` @param page_size [::Integer] The maximum number of items to return. Default 10, maximum 100. @param page_token [::String] The next_page_token returned from a previous List request, if any.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::Product>] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::Product>]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/vision/v1p3beta1/product_search/client.rb, line 1609 def list_products_in_product_set request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p3beta1::ListProductsInProductSetRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.list_products_in_product_set.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_products_in_product_set.timeout, metadata: metadata, retry_policy: @config.rpcs.list_products_in_product_set.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @product_search_stub.call_rpc :list_products_in_product_set, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @product_search_stub, :list_products_in_product_set, request, response, operation, options yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
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.
@overload list_reference_images
(request, options = nil)
Pass arguments to `list_reference_images` via a request object, either of type {::Google::Cloud::Vision::V1p3beta1::ListReferenceImagesRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload list_reference_images
(parent: nil, page_size: nil, page_token: nil)
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). @param parent [::String] Required. Resource name of the product containing the reference images. Format is `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. @param page_size [::Integer] The maximum number of items to return. Default 10, maximum 100. @param 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.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::ReferenceImage>] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Gapic::PagedEnumerable<::Google::Cloud::Vision::V1p3beta1::ReferenceImage>]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/vision/v1p3beta1/product_search/client.rb, line 1288 def list_reference_images request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p3beta1::ListReferenceImagesRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.list_reference_images.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "parent" => request.parent } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_reference_images.timeout, metadata: metadata, retry_policy: @config.rpcs.list_reference_images.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @product_search_stub.call_rpc :list_reference_images, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @product_search_stub, :list_reference_images, request, response, operation, options yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Removes a Product
from the specified ProductSet.
Possible errors:
-
Returns NOT_FOUND If the
Product
is not found under the ProductSet.
@overload remove_product_from_product_set
(request, options = nil)
Pass arguments to `remove_product_from_product_set` via a request object, either of type {::Google::Cloud::Vision::V1p3beta1::RemoveProductFromProductSetRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload remove_product_from_product_set
(name: nil, product: nil)
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). @param name [::String] Required. The resource name for the ProductSet to modify. Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` @param 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`
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Protobuf::Empty] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Protobuf::Empty]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/vision/v1p3beta1/product_search/client.rb, line 1528 def remove_product_from_product_set request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p3beta1::RemoveProductFromProductSetRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.remove_product_from_product_set.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.remove_product_from_product_set.timeout, metadata: metadata, retry_policy: @config.rpcs.remove_product_from_product_set.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @product_search_stub.call_rpc :remove_product_from_product_set, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
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.
@overload update_product
(request, options = nil)
Pass arguments to `update_product` via a request object, either of type {::Google::Cloud::Vision::V1p3beta1::UpdateProductRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload update_product
(product: nil, update_mask: nil)
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). @param product [::Google::Cloud::Vision::V1p3beta1::Product, ::Hash] Required. The Product resource which replaces the one on the server. product.name is immutable. @param update_mask [::Google::Protobuf::FieldMask, ::Hash] The {::Google::Protobuf::FieldMask 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`.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Vision::V1p3beta1::Product] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Vision::V1p3beta1::Product]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/vision/v1p3beta1/product_search/client.rb, line 946 def update_product request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p3beta1::UpdateProductRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.update_product.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "product.name" => request.product.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.update_product.timeout, metadata: metadata, retry_policy: @config.rpcs.update_product.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @product_search_stub.call_rpc :update_product, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
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.
@overload update_product_set
(request, options = nil)
Pass arguments to `update_product_set` via a request object, either of type {::Google::Cloud::Vision::V1p3beta1::UpdateProductSetRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload update_product_set
(product_set: nil, update_mask: nil)
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). @param product_set [::Google::Cloud::Vision::V1p3beta1::ProductSet, ::Hash] Required. The ProductSet resource which replaces the one on the server. @param update_mask [::Google::Protobuf::FieldMask, ::Hash] The {::Google::Protobuf::FieldMask 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`.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Vision::V1p3beta1::ProductSet] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Vision::V1p3beta1::ProductSet]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/vision/v1p3beta1/product_search/client.rb, line 540 def update_product_set request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p3beta1::UpdateProductSetRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.update_product_set.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "product_set.name" => request.product_set.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.update_product_set.timeout, metadata: metadata, retry_policy: @config.rpcs.update_product_set.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @product_search_stub.call_rpc :update_product_set, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end