Recommendations AI V1beta1 API - Class Google::Cloud::RecommendationEngine::V1beta1::CatalogService::Rest::Client (v0.9.0)

Reference documentation and code samples for the Recommendations AI V1beta1 API class Google::Cloud::RecommendationEngine::V1beta1::CatalogService::Rest::Client.

REST client for the CatalogService service.

Service for ingesting catalog information of the customer's website.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the CatalogService 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 CatalogService clients
::Google::Cloud::RecommendationEngine::V1beta1::CatalogService::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the CatalogService 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_catalog_item

def create_catalog_item(request, options = nil) -> ::Google::Cloud::RecommendationEngine::V1beta1::CatalogItem
def create_catalog_item(parent: nil, catalog_item: nil) -> ::Google::Cloud::RecommendationEngine::V1beta1::CatalogItem

Creates a catalog item.

Overloads
def create_catalog_item(request, options = nil) -> ::Google::Cloud::RecommendationEngine::V1beta1::CatalogItem
Pass arguments to create_catalog_item via a request object, either of type Google::Cloud::RecommendationEngine::V1beta1::CreateCatalogItemRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::RecommendationEngine::V1beta1::CreateCatalogItemRequest, ::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_catalog_item(parent: nil, catalog_item: nil) -> ::Google::Cloud::RecommendationEngine::V1beta1::CatalogItem
Pass arguments to create_catalog_item 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/recommendation_engine/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecommendationEngine::V1beta1::CatalogService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecommendationEngine::V1beta1::CreateCatalogItemRequest.new

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

# The returned object is of type Google::Cloud::RecommendationEngine::V1beta1::CatalogItem.
p result

#delete_catalog_item

def delete_catalog_item(request, options = nil) -> ::Google::Protobuf::Empty
def delete_catalog_item(name: nil) -> ::Google::Protobuf::Empty

Deletes a catalog item.

Overloads
def delete_catalog_item(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_catalog_item via a request object, either of type DeleteCatalogItemRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::RecommendationEngine::V1beta1::DeleteCatalogItemRequest, ::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_catalog_item(name: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_catalog_item 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. Full resource name of catalog item, such as projects/*/locations/global/catalogs/default_catalog/catalogItems/some_catalog_item_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/recommendation_engine/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecommendationEngine::V1beta1::CatalogService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecommendationEngine::V1beta1::DeleteCatalogItemRequest.new

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

# The returned object is of type Google::Protobuf::Empty.
p result

#get_catalog_item

def get_catalog_item(request, options = nil) -> ::Google::Cloud::RecommendationEngine::V1beta1::CatalogItem
def get_catalog_item(name: nil) -> ::Google::Cloud::RecommendationEngine::V1beta1::CatalogItem

Gets a specific catalog item.

Overloads
def get_catalog_item(request, options = nil) -> ::Google::Cloud::RecommendationEngine::V1beta1::CatalogItem
Pass arguments to get_catalog_item via a request object, either of type GetCatalogItemRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::RecommendationEngine::V1beta1::GetCatalogItemRequest, ::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_catalog_item(name: nil) -> ::Google::Cloud::RecommendationEngine::V1beta1::CatalogItem
Pass arguments to get_catalog_item 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. Full resource name of catalog item, such as projects/*/locations/global/catalogs/default_catalog/catalogitems/some_catalog_item_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/recommendation_engine/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecommendationEngine::V1beta1::CatalogService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecommendationEngine::V1beta1::GetCatalogItemRequest.new

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

# The returned object is of type Google::Cloud::RecommendationEngine::V1beta1::CatalogItem.
p result

#import_catalog_items

def import_catalog_items(request, options = nil) -> ::Gapic::Operation
def import_catalog_items(parent: nil, request_id: nil, input_config: nil, errors_config: nil) -> ::Gapic::Operation

Bulk import of multiple catalog items. Request processing may be synchronous. No partial updating supported. Non-existing items will be created.

Operation.response is of type ImportResponse. Note that it is possible for a subset of the items to be successfully updated.

Overloads
def import_catalog_items(request, options = nil) -> ::Gapic::Operation
Pass arguments to import_catalog_items via a request object, either of type ImportCatalogItemsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::RecommendationEngine::V1beta1::ImportCatalogItemsRequest, ::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_catalog_items(parent: nil, request_id: nil, input_config: nil, errors_config: nil) -> ::Gapic::Operation
Pass arguments to import_catalog_items 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. projects/1234/locations/global/catalogs/default_catalog
  • request_id (::String) — Optional. Unique identifier provided by client, within the ancestor dataset scope. Ensures idempotency and used for request deduplication. Server-generated if unspecified. Up to 128 characters long. This is returned as google.longrunning.Operation.name in the response.
  • input_config (::Google::Cloud::RecommendationEngine::V1beta1::InputConfig, ::Hash) — Required. The desired input location of the data.
  • errors_config (::Google::Cloud::RecommendationEngine::V1beta1::ImportErrorsConfig, ::Hash) — Optional. The desired location of errors incurred during the Import.
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/recommendation_engine/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecommendationEngine::V1beta1::CatalogService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecommendationEngine::V1beta1::ImportCatalogItemsRequest.new

# Call the import_catalog_items method.
result = client.import_catalog_items 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 CatalogService REST client object.

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

# Create a client using a custom configuration
client = ::Google::Cloud::RecommendationEngine::V1beta1::CatalogService::Rest::Client.new do |config|
  config.timeout = 10.0
end

#list_catalog_items

def list_catalog_items(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::RecommendationEngine::V1beta1::CatalogItem>
def list_catalog_items(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::RecommendationEngine::V1beta1::CatalogItem>

Gets a list of catalog items.

Overloads
def list_catalog_items(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::RecommendationEngine::V1beta1::CatalogItem>
Pass arguments to list_catalog_items via a request object, either of type ListCatalogItemsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::RecommendationEngine::V1beta1::ListCatalogItemsRequest, ::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_catalog_items(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::RecommendationEngine::V1beta1::CatalogItem>
Pass arguments to list_catalog_items 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 parent catalog resource name, such as projects/*/locations/global/catalogs/default_catalog.
  • page_size (::Integer) — Optional. Maximum number of results to return per page. If zero, the service will choose a reasonable default.
  • page_token (::String) — Optional. The previous ListCatalogItemsResponse.next_page_token.
  • filter (::String) — Optional. A filter to apply on the list results.
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/recommendation_engine/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecommendationEngine::V1beta1::CatalogService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecommendationEngine::V1beta1::ListCatalogItemsRequest.new

# Call the list_catalog_items method.
result = client.list_catalog_items 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::RecommendationEngine::V1beta1::CatalogItem.
  p item
end

#operations_client

def operations_client() -> ::Google::Cloud::RecommendationEngine::V1beta1::CatalogService::Rest::Operations

Get the associated client for long-running operations.

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#update_catalog_item

def update_catalog_item(request, options = nil) -> ::Google::Cloud::RecommendationEngine::V1beta1::CatalogItem
def update_catalog_item(name: nil, catalog_item: nil, update_mask: nil) -> ::Google::Cloud::RecommendationEngine::V1beta1::CatalogItem

Updates a catalog item. Partial updating is supported. Non-existing items will be created.

Overloads
def update_catalog_item(request, options = nil) -> ::Google::Cloud::RecommendationEngine::V1beta1::CatalogItem
Pass arguments to update_catalog_item via a request object, either of type UpdateCatalogItemRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::RecommendationEngine::V1beta1::UpdateCatalogItemRequest, ::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_catalog_item(name: nil, catalog_item: nil, update_mask: nil) -> ::Google::Cloud::RecommendationEngine::V1beta1::CatalogItem
Pass arguments to update_catalog_item 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. Full resource name of catalog item, such as projects/*/locations/global/catalogs/default_catalog/catalogItems/some_catalog_item_id.
  • catalog_item (::Google::Cloud::RecommendationEngine::V1beta1::CatalogItem, ::Hash) — Required. The catalog item to update/create. The 'catalog_item_id' field has to match that in the 'name'.
  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — Optional. Indicates which fields in the provided 'item' to update. If not set, will by default update all fields.
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/recommendation_engine/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecommendationEngine::V1beta1::CatalogService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecommendationEngine::V1beta1::UpdateCatalogItemRequest.new

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

# The returned object is of type Google::Cloud::RecommendationEngine::V1beta1::CatalogItem.
p result