google-cloud-retail-v2 0.3.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +8 -8
- data/README.md +1 -1
- data/lib/google/cloud/retail/v2.rb +2 -0
- data/lib/google/cloud/retail/v2/catalog_pb.rb +2 -0
- data/lib/google/cloud/retail/v2/catalog_service/client.rb +242 -45
- data/lib/google/cloud/retail/v2/catalog_service/paths.rb +21 -0
- data/lib/google/cloud/retail/v2/catalog_service_pb.rb +16 -0
- data/lib/google/cloud/retail/v2/catalog_service_services_pb.rb +47 -1
- data/lib/google/cloud/retail/v2/common_pb.rb +46 -0
- data/lib/google/cloud/retail/v2/completion_service.rb +54 -0
- data/lib/google/cloud/retail/v2/completion_service/client.rb +543 -0
- data/lib/google/cloud/retail/v2/completion_service/credentials.rb +51 -0
- data/lib/google/cloud/retail/v2/completion_service/operations.rb +664 -0
- data/lib/google/cloud/retail/v2/completion_service/paths.rb +52 -0
- data/lib/google/cloud/retail/v2/completion_service_pb.rb +50 -0
- data/lib/google/cloud/retail/v2/completion_service_services_pb.rb +61 -0
- data/lib/google/cloud/retail/v2/import_config_pb.rb +32 -0
- data/lib/google/cloud/retail/v2/prediction_service/client.rb +68 -75
- data/lib/google/cloud/retail/v2/prediction_service_services_pb.rb +1 -1
- data/lib/google/cloud/retail/v2/product_pb.rb +21 -0
- data/lib/google/cloud/retail/v2/product_service/client.rb +684 -48
- data/lib/google/cloud/retail/v2/product_service/operations.rb +34 -25
- data/lib/google/cloud/retail/v2/product_service_pb.rb +56 -0
- data/lib/google/cloud/retail/v2/product_service_services_pb.rb +76 -1
- data/lib/google/cloud/retail/v2/search_service.rb +53 -0
- data/lib/google/cloud/retail/v2/search_service/client.rb +531 -0
- data/lib/google/cloud/retail/v2/search_service/credentials.rb +51 -0
- data/lib/google/cloud/retail/v2/search_service/paths.rb +54 -0
- data/lib/google/cloud/retail/v2/search_service_pb.rb +131 -0
- data/lib/google/cloud/retail/v2/search_service_services_pb.rb +53 -0
- data/lib/google/cloud/retail/v2/user_event_pb.rb +11 -0
- data/lib/google/cloud/retail/v2/user_event_service/client.rb +47 -47
- data/lib/google/cloud/retail/v2/user_event_service/operations.rb +34 -25
- data/lib/google/cloud/retail/v2/user_event_service/paths.rb +19 -0
- data/lib/google/cloud/retail/v2/user_event_service_services_pb.rb +1 -1
- data/lib/google/cloud/retail/v2/version.rb +1 -1
- data/proto_docs/google/api/field_behavior.rb +7 -1
- data/proto_docs/google/api/httpbody.rb +4 -3
- data/proto_docs/google/cloud/retail/v2/catalog.rb +6 -6
- data/proto_docs/google/cloud/retail/v2/catalog_service.rb +53 -4
- data/proto_docs/google/cloud/retail/v2/common.rb +272 -4
- data/proto_docs/google/cloud/retail/v2/completion_service.rb +162 -0
- data/proto_docs/google/cloud/retail/v2/import_config.rb +122 -6
- data/proto_docs/google/cloud/retail/v2/prediction_service.rb +32 -31
- data/proto_docs/google/cloud/retail/v2/product.rb +266 -10
- data/proto_docs/google/cloud/retail/v2/product_service.rb +362 -2
- data/proto_docs/google/cloud/retail/v2/purge_config.rb +1 -1
- data/proto_docs/google/cloud/retail/v2/search_service.rb +681 -0
- data/proto_docs/google/cloud/retail/v2/user_event.rb +95 -3
- data/proto_docs/google/type/date.rb +53 -0
- metadata +20 -4
@@ -7,6 +7,7 @@ require 'google/api/annotations_pb'
|
|
7
7
|
require 'google/api/field_behavior_pb'
|
8
8
|
require 'google/api/resource_pb'
|
9
9
|
require 'google/cloud/retail/v2/common_pb'
|
10
|
+
require 'google/protobuf/duration_pb'
|
10
11
|
require 'google/protobuf/field_mask_pb'
|
11
12
|
require 'google/protobuf/timestamp_pb'
|
12
13
|
require 'google/protobuf/wrappers_pb'
|
@@ -17,17 +18,37 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
17
18
|
optional :id, :string, 2
|
18
19
|
optional :type, :enum, 3, "google.cloud.retail.v2.Product.Type"
|
19
20
|
optional :primary_product_id, :string, 4
|
21
|
+
repeated :collection_member_ids, :string, 5
|
22
|
+
optional :gtin, :string, 6
|
20
23
|
repeated :categories, :string, 7
|
21
24
|
optional :title, :string, 8
|
25
|
+
repeated :brands, :string, 9
|
22
26
|
optional :description, :string, 10
|
27
|
+
optional :language_code, :string, 11
|
23
28
|
map :attributes, :string, :message, 12, "google.cloud.retail.v2.CustomAttribute"
|
24
29
|
repeated :tags, :string, 13
|
25
30
|
optional :price_info, :message, 14, "google.cloud.retail.v2.PriceInfo"
|
31
|
+
optional :rating, :message, 15, "google.cloud.retail.v2.Rating"
|
26
32
|
optional :available_time, :message, 18, "google.protobuf.Timestamp"
|
27
33
|
optional :availability, :enum, 19, "google.cloud.retail.v2.Product.Availability"
|
28
34
|
optional :available_quantity, :message, 20, "google.protobuf.Int32Value"
|
35
|
+
repeated :fulfillment_info, :message, 21, "google.cloud.retail.v2.FulfillmentInfo"
|
29
36
|
optional :uri, :string, 22
|
30
37
|
repeated :images, :message, 23, "google.cloud.retail.v2.Image"
|
38
|
+
optional :audience, :message, 24, "google.cloud.retail.v2.Audience"
|
39
|
+
optional :color_info, :message, 25, "google.cloud.retail.v2.ColorInfo"
|
40
|
+
repeated :sizes, :string, 26
|
41
|
+
repeated :materials, :string, 27
|
42
|
+
repeated :patterns, :string, 28
|
43
|
+
repeated :conditions, :string, 29
|
44
|
+
repeated :promotions, :message, 34, "google.cloud.retail.v2.Promotion"
|
45
|
+
optional :publish_time, :message, 33, "google.protobuf.Timestamp"
|
46
|
+
optional :retrievable_fields, :message, 30, "google.protobuf.FieldMask"
|
47
|
+
repeated :variants, :message, 31, "google.cloud.retail.v2.Product"
|
48
|
+
oneof :expiration do
|
49
|
+
optional :expire_time, :message, 16, "google.protobuf.Timestamp"
|
50
|
+
optional :ttl, :message, 17, "google.protobuf.Duration"
|
51
|
+
end
|
31
52
|
end
|
32
53
|
add_enum "google.cloud.retail.v2.Product.Type" do
|
33
54
|
value :TYPE_UNSPECIFIED, 0
|
@@ -42,13 +42,12 @@ module Google
|
|
42
42
|
# See {::Google::Cloud::Retail::V2::ProductService::Client::Configuration}
|
43
43
|
# for a description of the configuration fields.
|
44
44
|
#
|
45
|
-
#
|
45
|
+
# @example
|
46
46
|
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
# end
|
47
|
+
# # Modify the configuration for all ProductService clients
|
48
|
+
# ::Google::Cloud::Retail::V2::ProductService::Client.configure do |config|
|
49
|
+
# config.timeout = 10.0
|
50
|
+
# end
|
52
51
|
#
|
53
52
|
# @yield [config] Configure the Client client.
|
54
53
|
# @yieldparam config [Client::Configuration]
|
@@ -68,10 +67,7 @@ module Google
|
|
68
67
|
|
69
68
|
default_config.timeout = 60.0
|
70
69
|
default_config.retry_policy = {
|
71
|
-
initial_delay: 0.1,
|
72
|
-
max_delay: 60.0,
|
73
|
-
multiplier: 1.3,
|
74
|
-
retry_codes: [14, 4]
|
70
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
75
71
|
}
|
76
72
|
|
77
73
|
default_config
|
@@ -103,19 +99,15 @@ module Google
|
|
103
99
|
##
|
104
100
|
# Create a new ProductService client object.
|
105
101
|
#
|
106
|
-
#
|
107
|
-
#
|
108
|
-
# To create a new ProductService client with the default
|
109
|
-
# configuration:
|
102
|
+
# @example
|
110
103
|
#
|
111
|
-
#
|
104
|
+
# # Create a client using the default configuration
|
105
|
+
# client = ::Google::Cloud::Retail::V2::ProductService::Client.new
|
112
106
|
#
|
113
|
-
#
|
114
|
-
#
|
115
|
-
#
|
116
|
-
#
|
117
|
-
# config.timeout = 10.0
|
118
|
-
# end
|
107
|
+
# # Create a client using a custom configuration
|
108
|
+
# client = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config|
|
109
|
+
# config.timeout = 10.0
|
110
|
+
# end
|
119
111
|
#
|
120
112
|
# @yield [config] Configure the ProductService client.
|
121
113
|
# @yieldparam config [Client::Configuration]
|
@@ -135,14 +127,13 @@ module Google
|
|
135
127
|
|
136
128
|
# Create credentials
|
137
129
|
credentials = @config.credentials
|
138
|
-
# Use self-signed JWT if the
|
130
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
139
131
|
# but only if the default endpoint does not have a region prefix.
|
140
|
-
enable_self_signed_jwt = @config.
|
141
|
-
@config.endpoint == Client.configure.endpoint &&
|
132
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
142
133
|
!@config.endpoint.split(".").first.include?("-")
|
143
134
|
credentials ||= Credentials.default scope: @config.scope,
|
144
135
|
enable_self_signed_jwt: enable_self_signed_jwt
|
145
|
-
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
136
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
146
137
|
credentials = Credentials.new credentials, scope: @config.scope
|
147
138
|
end
|
148
139
|
@quota_project_id = @config.quota_project
|
@@ -245,7 +236,9 @@ module Google
|
|
245
236
|
options.apply_defaults timeout: @config.rpcs.create_product.timeout,
|
246
237
|
metadata: metadata,
|
247
238
|
retry_policy: @config.rpcs.create_product.retry_policy
|
248
|
-
|
239
|
+
|
240
|
+
options.apply_defaults timeout: @config.timeout,
|
241
|
+
metadata: @config.metadata,
|
249
242
|
retry_policy: @config.retry_policy
|
250
243
|
|
251
244
|
@product_service_stub.call_rpc :create_product, request, options: options do |response, operation|
|
@@ -320,7 +313,9 @@ module Google
|
|
320
313
|
options.apply_defaults timeout: @config.rpcs.get_product.timeout,
|
321
314
|
metadata: metadata,
|
322
315
|
retry_policy: @config.rpcs.get_product.retry_policy
|
323
|
-
|
316
|
+
|
317
|
+
options.apply_defaults timeout: @config.timeout,
|
318
|
+
metadata: @config.metadata,
|
324
319
|
retry_policy: @config.retry_policy
|
325
320
|
|
326
321
|
@product_service_stub.call_rpc :get_product, request, options: options do |response, operation|
|
@@ -331,6 +326,146 @@ module Google
|
|
331
326
|
raise ::Google::Cloud::Error.from_error(e)
|
332
327
|
end
|
333
328
|
|
329
|
+
##
|
330
|
+
# Gets a list of {::Google::Cloud::Retail::V2::Product Product}s.
|
331
|
+
#
|
332
|
+
# @overload list_products(request, options = nil)
|
333
|
+
# Pass arguments to `list_products` via a request object, either of type
|
334
|
+
# {::Google::Cloud::Retail::V2::ListProductsRequest} or an equivalent Hash.
|
335
|
+
#
|
336
|
+
# @param request [::Google::Cloud::Retail::V2::ListProductsRequest, ::Hash]
|
337
|
+
# A request object representing the call parameters. Required. To specify no
|
338
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
339
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
340
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
341
|
+
#
|
342
|
+
# @overload list_products(parent: nil, page_size: nil, page_token: nil, filter: nil, read_mask: nil)
|
343
|
+
# Pass arguments to `list_products` via keyword arguments. Note that at
|
344
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
345
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
346
|
+
#
|
347
|
+
# @param parent [::String]
|
348
|
+
# Required. The parent branch resource name, such as
|
349
|
+
# `projects/*/locations/global/catalogs/default_catalog/branches/0`. Use
|
350
|
+
# `default_branch` as the branch ID, to list products under the default
|
351
|
+
# branch.
|
352
|
+
#
|
353
|
+
# If the caller does not have permission to list
|
354
|
+
# {::Google::Cloud::Retail::V2::Product Product}s under this branch, regardless of
|
355
|
+
# whether or not this branch exists, a PERMISSION_DENIED error is returned.
|
356
|
+
# @param page_size [::Integer]
|
357
|
+
# Maximum number of {::Google::Cloud::Retail::V2::Product Product}s to return. If
|
358
|
+
# unspecified, defaults to 100. The maximum allowed value is 1000. Values
|
359
|
+
# above 1000 will be coerced to 1000.
|
360
|
+
#
|
361
|
+
# If this field is negative, an INVALID_ARGUMENT error is returned.
|
362
|
+
# @param page_token [::String]
|
363
|
+
# A page token
|
364
|
+
# {::Google::Cloud::Retail::V2::ListProductsResponse#next_page_token ListProductsResponse.next_page_token},
|
365
|
+
# received from a previous
|
366
|
+
# {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts}
|
367
|
+
# call. Provide this to retrieve the subsequent page.
|
368
|
+
#
|
369
|
+
# When paginating, all other parameters provided to
|
370
|
+
# {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts}
|
371
|
+
# must match the call that provided the page token. Otherwise, an
|
372
|
+
# INVALID_ARGUMENT error is returned.
|
373
|
+
# @param filter [::String]
|
374
|
+
# A filter to apply on the list results. Supported features:
|
375
|
+
#
|
376
|
+
# * List all the products under the parent branch if
|
377
|
+
# {::Google::Cloud::Retail::V2::ListProductsRequest#filter filter} is unset.
|
378
|
+
# * List {::Google::Cloud::Retail::V2::Product::Type::VARIANT Product.Type.VARIANT}
|
379
|
+
# {::Google::Cloud::Retail::V2::Product Product}s sharing the same
|
380
|
+
# {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY}
|
381
|
+
# {::Google::Cloud::Retail::V2::Product Product}. For example:
|
382
|
+
# `primary_product_id = "some_product_id"`
|
383
|
+
# * List {::Google::Cloud::Retail::V2::Product Product}s bundled in a
|
384
|
+
# {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION}
|
385
|
+
# {::Google::Cloud::Retail::V2::Product Product}.
|
386
|
+
# For example:
|
387
|
+
# `collection_product_id = "some_product_id"`
|
388
|
+
# * List {::Google::Cloud::Retail::V2::Product Product}s with a partibular type.
|
389
|
+
# For example:
|
390
|
+
# `type = "PRIMARY"`
|
391
|
+
# `type = "VARIANT"`
|
392
|
+
# `type = "COLLECTION"`
|
393
|
+
#
|
394
|
+
# If the field is unrecognizable, an INVALID_ARGUMENT error is returned.
|
395
|
+
#
|
396
|
+
# If the specified
|
397
|
+
# {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY}
|
398
|
+
# {::Google::Cloud::Retail::V2::Product Product} or
|
399
|
+
# {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION}
|
400
|
+
# {::Google::Cloud::Retail::V2::Product Product} does not exist, a NOT_FOUND error
|
401
|
+
# is returned.
|
402
|
+
# @param read_mask [::Google::Protobuf::FieldMask, ::Hash]
|
403
|
+
# The fields of {::Google::Cloud::Retail::V2::Product Product} to return in the
|
404
|
+
# responses. If not set or empty, the following fields are returned:
|
405
|
+
#
|
406
|
+
# * {::Google::Cloud::Retail::V2::Product#name Product.name}
|
407
|
+
# * {::Google::Cloud::Retail::V2::Product#id Product.id}
|
408
|
+
# * {::Google::Cloud::Retail::V2::Product#title Product.title}
|
409
|
+
# * {::Google::Cloud::Retail::V2::Product#uri Product.uri}
|
410
|
+
# * {::Google::Cloud::Retail::V2::Product#images Product.images}
|
411
|
+
# * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info}
|
412
|
+
# * {::Google::Cloud::Retail::V2::Product#brands Product.brands}
|
413
|
+
#
|
414
|
+
# If "*" is provided, all fields are returned.
|
415
|
+
# {::Google::Cloud::Retail::V2::Product#name Product.name} is always returned no
|
416
|
+
# matter what mask is set.
|
417
|
+
#
|
418
|
+
# If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
|
419
|
+
# is returned.
|
420
|
+
#
|
421
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
422
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Product>]
|
423
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
424
|
+
#
|
425
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Product>]
|
426
|
+
#
|
427
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
428
|
+
#
|
429
|
+
def list_products request, options = nil
|
430
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
431
|
+
|
432
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListProductsRequest
|
433
|
+
|
434
|
+
# Converts hash and nil to an options object
|
435
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
436
|
+
|
437
|
+
# Customize the options with defaults
|
438
|
+
metadata = @config.rpcs.list_products.metadata.to_h
|
439
|
+
|
440
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
441
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
442
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
443
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION
|
444
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
445
|
+
|
446
|
+
header_params = {
|
447
|
+
"parent" => request.parent
|
448
|
+
}
|
449
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
450
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
451
|
+
|
452
|
+
options.apply_defaults timeout: @config.rpcs.list_products.timeout,
|
453
|
+
metadata: metadata,
|
454
|
+
retry_policy: @config.rpcs.list_products.retry_policy
|
455
|
+
|
456
|
+
options.apply_defaults timeout: @config.timeout,
|
457
|
+
metadata: @config.metadata,
|
458
|
+
retry_policy: @config.retry_policy
|
459
|
+
|
460
|
+
@product_service_stub.call_rpc :list_products, request, options: options do |response, operation|
|
461
|
+
response = ::Gapic::PagedEnumerable.new @product_service_stub, :list_products, request, response, operation, options
|
462
|
+
yield response, operation if block_given?
|
463
|
+
return response
|
464
|
+
end
|
465
|
+
rescue ::GRPC::BadStatus => e
|
466
|
+
raise ::Google::Cloud::Error.from_error(e)
|
467
|
+
end
|
468
|
+
|
334
469
|
##
|
335
470
|
# Updates a {::Google::Cloud::Retail::V2::Product Product}.
|
336
471
|
#
|
@@ -344,7 +479,7 @@ module Google
|
|
344
479
|
# @param options [::Gapic::CallOptions, ::Hash]
|
345
480
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
346
481
|
#
|
347
|
-
# @overload update_product(product: nil, update_mask: nil)
|
482
|
+
# @overload update_product(product: nil, update_mask: nil, allow_missing: nil)
|
348
483
|
# Pass arguments to `update_product` via keyword arguments. Note that at
|
349
484
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
350
485
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -356,8 +491,10 @@ module Google
|
|
356
491
|
# {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it
|
357
492
|
# exists, a PERMISSION_DENIED error is returned.
|
358
493
|
#
|
359
|
-
# If the {::Google::Cloud::Retail::V2::Product Product} to update does not exist
|
360
|
-
#
|
494
|
+
# If the {::Google::Cloud::Retail::V2::Product Product} to update does not exist
|
495
|
+
# and
|
496
|
+
# {::Google::Cloud::Retail::V2::UpdateProductRequest#allow_missing allow_missing}
|
497
|
+
# is not set, a NOT_FOUND error is returned.
|
361
498
|
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
362
499
|
# Indicates which fields in the provided
|
363
500
|
# {::Google::Cloud::Retail::V2::Product Product} to update. The immutable and
|
@@ -366,6 +503,10 @@ module Google
|
|
366
503
|
#
|
367
504
|
# If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
|
368
505
|
# is returned.
|
506
|
+
# @param allow_missing [::Boolean]
|
507
|
+
# If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not
|
508
|
+
# found, a new {::Google::Cloud::Retail::V2::Product Product} will be created. In
|
509
|
+
# this situation, `update_mask` is ignored.
|
369
510
|
#
|
370
511
|
# @yield [response, operation] Access the result along with the RPC operation
|
371
512
|
# @yieldparam response [::Google::Cloud::Retail::V2::Product]
|
@@ -401,7 +542,9 @@ module Google
|
|
401
542
|
options.apply_defaults timeout: @config.rpcs.update_product.timeout,
|
402
543
|
metadata: metadata,
|
403
544
|
retry_policy: @config.rpcs.update_product.retry_policy
|
404
|
-
|
545
|
+
|
546
|
+
options.apply_defaults timeout: @config.timeout,
|
547
|
+
metadata: @config.metadata,
|
405
548
|
retry_policy: @config.retry_policy
|
406
549
|
|
407
550
|
@product_service_stub.call_rpc :update_product, request, options: options do |response, operation|
|
@@ -442,6 +585,17 @@ module Google
|
|
442
585
|
# If the {::Google::Cloud::Retail::V2::Product Product} to delete does not exist,
|
443
586
|
# a NOT_FOUND error is returned.
|
444
587
|
#
|
588
|
+
# The {::Google::Cloud::Retail::V2::Product Product} to delete can neither be a
|
589
|
+
# {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION}
|
590
|
+
# {::Google::Cloud::Retail::V2::Product Product} member nor a
|
591
|
+
# {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY}
|
592
|
+
# {::Google::Cloud::Retail::V2::Product Product} with more than one
|
593
|
+
# {::Google::Cloud::Retail::V2::Product::Type::VARIANT variants}. Otherwise, an
|
594
|
+
# INVALID_ARGUMENT error is returned.
|
595
|
+
#
|
596
|
+
# All inventory information for the named
|
597
|
+
# {::Google::Cloud::Retail::V2::Product Product} will be deleted.
|
598
|
+
#
|
445
599
|
# @yield [response, operation] Access the result along with the RPC operation
|
446
600
|
# @yieldparam response [::Google::Protobuf::Empty]
|
447
601
|
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
@@ -476,7 +630,9 @@ module Google
|
|
476
630
|
options.apply_defaults timeout: @config.rpcs.delete_product.timeout,
|
477
631
|
metadata: metadata,
|
478
632
|
retry_policy: @config.rpcs.delete_product.retry_policy
|
479
|
-
|
633
|
+
|
634
|
+
options.apply_defaults timeout: @config.timeout,
|
635
|
+
metadata: @config.metadata,
|
480
636
|
retry_policy: @config.retry_policy
|
481
637
|
|
482
638
|
@product_service_stub.call_rpc :delete_product, request, options: options do |response, operation|
|
@@ -506,7 +662,7 @@ module Google
|
|
506
662
|
# @param options [::Gapic::CallOptions, ::Hash]
|
507
663
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
508
664
|
#
|
509
|
-
# @overload import_products(parent: nil, input_config: nil, errors_config: nil, update_mask: nil)
|
665
|
+
# @overload import_products(parent: nil, request_id: nil, input_config: nil, errors_config: nil, update_mask: nil, reconciliation_mode: nil, notification_pubsub_topic: nil)
|
510
666
|
# Pass arguments to `import_products` via keyword arguments. Note that at
|
511
667
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
512
668
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -517,6 +673,16 @@ module Google
|
|
517
673
|
#
|
518
674
|
# If no updateMask is specified, requires products.create permission.
|
519
675
|
# If updateMask is specified, requires products.update permission.
|
676
|
+
# @param request_id [::String]
|
677
|
+
# Unique identifier provided by client, within the ancestor
|
678
|
+
# dataset scope. Ensures idempotency and used for request deduplication.
|
679
|
+
# Server-generated if unspecified. Up to 128 characters long and must match
|
680
|
+
# the pattern: "[a-zA-Z0-9_]+". This is returned as [Operation.name][] in
|
681
|
+
# {::Google::Cloud::Retail::V2::ImportMetadata ImportMetadata}.
|
682
|
+
#
|
683
|
+
# Only supported when
|
684
|
+
# {::Google::Cloud::Retail::V2::ImportProductsRequest#reconciliation_mode ImportProductsRequest.reconciliation_mode}
|
685
|
+
# is set to `FULL`.
|
520
686
|
# @param input_config [::Google::Cloud::Retail::V2::ProductInputConfig, ::Hash]
|
521
687
|
# Required. The desired input location of the data.
|
522
688
|
# @param errors_config [::Google::Cloud::Retail::V2::ImportErrorsConfig, ::Hash]
|
@@ -524,6 +690,20 @@ module Google
|
|
524
690
|
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
525
691
|
# Indicates which fields in the provided imported 'products' to update. If
|
526
692
|
# not set, will by default update all fields.
|
693
|
+
# @param reconciliation_mode [::Google::Cloud::Retail::V2::ImportProductsRequest::ReconciliationMode]
|
694
|
+
# The mode of reconciliation between existing products and the products to be
|
695
|
+
# imported. Defaults to
|
696
|
+
# {::Google::Cloud::Retail::V2::ImportProductsRequest::ReconciliationMode::INCREMENTAL ReconciliationMode.INCREMENTAL}.
|
697
|
+
# @param notification_pubsub_topic [::String]
|
698
|
+
# Pub/Sub topic for receiving notification. If this field is set,
|
699
|
+
# when the import is finished, a notification will be sent to
|
700
|
+
# specified Pub/Sub topic. The message data will be JSON string of a
|
701
|
+
# {::Google::Longrunning::Operation Operation}.
|
702
|
+
# Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
|
703
|
+
#
|
704
|
+
# Only supported when
|
705
|
+
# {::Google::Cloud::Retail::V2::ImportProductsRequest#reconciliation_mode ImportProductsRequest.reconciliation_mode}
|
706
|
+
# is set to `FULL`.
|
527
707
|
#
|
528
708
|
# @yield [response, operation] Access the result along with the RPC operation
|
529
709
|
# @yieldparam response [::Gapic::Operation]
|
@@ -559,7 +739,9 @@ module Google
|
|
559
739
|
options.apply_defaults timeout: @config.rpcs.import_products.timeout,
|
560
740
|
metadata: metadata,
|
561
741
|
retry_policy: @config.rpcs.import_products.retry_policy
|
562
|
-
|
742
|
+
|
743
|
+
options.apply_defaults timeout: @config.timeout,
|
744
|
+
metadata: @config.metadata,
|
563
745
|
retry_policy: @config.retry_policy
|
564
746
|
|
565
747
|
@product_service_stub.call_rpc :import_products, request, options: options do |response, operation|
|
@@ -571,6 +753,433 @@ module Google
|
|
571
753
|
raise ::Google::Cloud::Error.from_error(e)
|
572
754
|
end
|
573
755
|
|
756
|
+
##
|
757
|
+
# Updates inventory information for a
|
758
|
+
# {::Google::Cloud::Retail::V2::Product Product} while respecting the last update
|
759
|
+
# timestamps of each inventory field.
|
760
|
+
#
|
761
|
+
# This process is asynchronous and does not require the
|
762
|
+
# {::Google::Cloud::Retail::V2::Product Product} to exist before updating
|
763
|
+
# fulfillment information. If the request is valid, the update will be
|
764
|
+
# enqueued and processed downstream. As a consequence, when a response is
|
765
|
+
# returned, updates are not immediately manifested in the
|
766
|
+
# {::Google::Cloud::Retail::V2::Product Product} queried by
|
767
|
+
# {::Google::Cloud::Retail::V2::ProductService::Client#get_product GetProduct} or
|
768
|
+
# {::Google::Cloud::Retail::V2::ProductService::Client#list_products ListProducts}.
|
769
|
+
#
|
770
|
+
# When inventory is updated with
|
771
|
+
# {::Google::Cloud::Retail::V2::ProductService::Client#create_product CreateProduct} and
|
772
|
+
# {::Google::Cloud::Retail::V2::ProductService::Client#update_product UpdateProduct}, the
|
773
|
+
# specified inventory field value(s) will overwrite any existing value(s)
|
774
|
+
# while ignoring the last update time for this field. Furthermore, the last
|
775
|
+
# update time for the specified inventory fields will be overwritten to the
|
776
|
+
# time of the
|
777
|
+
# {::Google::Cloud::Retail::V2::ProductService::Client#create_product CreateProduct} or
|
778
|
+
# {::Google::Cloud::Retail::V2::ProductService::Client#update_product UpdateProduct}
|
779
|
+
# request.
|
780
|
+
#
|
781
|
+
# If no inventory fields are set in
|
782
|
+
# {::Google::Cloud::Retail::V2::CreateProductRequest#product CreateProductRequest.product},
|
783
|
+
# then any pre-existing inventory information for this product will be used.
|
784
|
+
#
|
785
|
+
# If no inventory fields are set in [UpdateProductRequest.set_mask][],
|
786
|
+
# then any existing inventory information will be preserved.
|
787
|
+
#
|
788
|
+
# Pre-existing inventory information can only be updated with
|
789
|
+
# {::Google::Cloud::Retail::V2::ProductService::Client#set_inventory SetInventory},
|
790
|
+
# {::Google::Cloud::Retail::V2::ProductService::Client#add_fulfillment_places AddFulfillmentPlaces},
|
791
|
+
# and
|
792
|
+
# {::Google::Cloud::Retail::V2::ProductService::Client#remove_fulfillment_places RemoveFulfillmentPlaces}.
|
793
|
+
#
|
794
|
+
# This feature is only available for users who have Retail Search enabled.
|
795
|
+
# Contact Retail Support (retail-search-support@google.com) if you are
|
796
|
+
# interested in using Retail Search.
|
797
|
+
#
|
798
|
+
# @overload set_inventory(request, options = nil)
|
799
|
+
# Pass arguments to `set_inventory` via a request object, either of type
|
800
|
+
# {::Google::Cloud::Retail::V2::SetInventoryRequest} or an equivalent Hash.
|
801
|
+
#
|
802
|
+
# @param request [::Google::Cloud::Retail::V2::SetInventoryRequest, ::Hash]
|
803
|
+
# A request object representing the call parameters. Required. To specify no
|
804
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
805
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
806
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
807
|
+
#
|
808
|
+
# @overload set_inventory(inventory: nil, set_mask: nil, set_time: nil, allow_missing: nil)
|
809
|
+
# Pass arguments to `set_inventory` via keyword arguments. Note that at
|
810
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
811
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
812
|
+
#
|
813
|
+
# @param inventory [::Google::Cloud::Retail::V2::Product, ::Hash]
|
814
|
+
# Required. The inventory information to update. The allowable fields to
|
815
|
+
# update are:
|
816
|
+
# * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info}
|
817
|
+
# * {::Google::Cloud::Retail::V2::Product#availability Product.availability}
|
818
|
+
# * {::Google::Cloud::Retail::V2::Product#available_quantity Product.available_quantity}
|
819
|
+
# * {::Google::Cloud::Retail::V2::Product#fulfillment_info Product.fulfillment_info}
|
820
|
+
# The updated inventory fields must be specified in
|
821
|
+
# {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask}.
|
822
|
+
#
|
823
|
+
# If [SetInventoryRequest.inventory.name][] is empty or invalid, an
|
824
|
+
# INVALID_ARGUMENT error is returned.
|
825
|
+
#
|
826
|
+
# If the caller does not have permission to update the
|
827
|
+
# {::Google::Cloud::Retail::V2::Product Product} named in
|
828
|
+
# {::Google::Cloud::Retail::V2::Product#name Product.name}, regardless of whether
|
829
|
+
# or not it exists, a PERMISSION_DENIED error is returned.
|
830
|
+
#
|
831
|
+
# If the {::Google::Cloud::Retail::V2::Product Product} to update does not have
|
832
|
+
# existing inventory information, the provided inventory information will be
|
833
|
+
# inserted.
|
834
|
+
#
|
835
|
+
# If the {::Google::Cloud::Retail::V2::Product Product} to update has existing
|
836
|
+
# inventory information, the provided inventory information will be merged
|
837
|
+
# while respecting the last update time for each inventory field, using the
|
838
|
+
# provided or default value for
|
839
|
+
# {::Google::Cloud::Retail::V2::SetInventoryRequest#set_time SetInventoryRequest.set_time}.
|
840
|
+
#
|
841
|
+
# The last update time is recorded for the following inventory fields:
|
842
|
+
# * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info}
|
843
|
+
# * {::Google::Cloud::Retail::V2::Product#availability Product.availability}
|
844
|
+
# * {::Google::Cloud::Retail::V2::Product#available_quantity Product.available_quantity}
|
845
|
+
# * {::Google::Cloud::Retail::V2::Product#fulfillment_info Product.fulfillment_info}
|
846
|
+
#
|
847
|
+
# If a full overwrite of inventory information while ignoring timestamps is
|
848
|
+
# needed, [UpdateProduct][] should be invoked instead.
|
849
|
+
# @param set_mask [::Google::Protobuf::FieldMask, ::Hash]
|
850
|
+
# Indicates which inventory fields in the provided
|
851
|
+
# {::Google::Cloud::Retail::V2::Product Product} to update. If not set or set with
|
852
|
+
# empty paths, all inventory fields will be updated.
|
853
|
+
#
|
854
|
+
# If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
|
855
|
+
# is returned and the entire update will be ignored.
|
856
|
+
# @param set_time [::Google::Protobuf::Timestamp, ::Hash]
|
857
|
+
# The time when the request is issued, used to prevent
|
858
|
+
# out-of-order updates on inventory fields with the last update time
|
859
|
+
# recorded. If not provided, the internal system time will be used.
|
860
|
+
# @param allow_missing [::Boolean]
|
861
|
+
# If set to true, and the {::Google::Cloud::Retail::V2::Product Product} with name
|
862
|
+
# {::Google::Cloud::Retail::V2::Product#name Product.name} is not found, the
|
863
|
+
# inventory update will still be processed and retained for at most 1 day
|
864
|
+
# until the {::Google::Cloud::Retail::V2::Product Product} is created. If set to
|
865
|
+
# false, an INVALID_ARGUMENT error is returned if the
|
866
|
+
# {::Google::Cloud::Retail::V2::Product Product} is not found.
|
867
|
+
#
|
868
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
869
|
+
# @yieldparam response [::Gapic::Operation]
|
870
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
871
|
+
#
|
872
|
+
# @return [::Gapic::Operation]
|
873
|
+
#
|
874
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
875
|
+
#
|
876
|
+
def set_inventory request, options = nil
|
877
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
878
|
+
|
879
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::SetInventoryRequest
|
880
|
+
|
881
|
+
# Converts hash and nil to an options object
|
882
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
883
|
+
|
884
|
+
# Customize the options with defaults
|
885
|
+
metadata = @config.rpcs.set_inventory.metadata.to_h
|
886
|
+
|
887
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
888
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
889
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
890
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION
|
891
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
892
|
+
|
893
|
+
header_params = {
|
894
|
+
"inventory.name" => request.inventory.name
|
895
|
+
}
|
896
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
897
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
898
|
+
|
899
|
+
options.apply_defaults timeout: @config.rpcs.set_inventory.timeout,
|
900
|
+
metadata: metadata,
|
901
|
+
retry_policy: @config.rpcs.set_inventory.retry_policy
|
902
|
+
|
903
|
+
options.apply_defaults timeout: @config.timeout,
|
904
|
+
metadata: @config.metadata,
|
905
|
+
retry_policy: @config.retry_policy
|
906
|
+
|
907
|
+
@product_service_stub.call_rpc :set_inventory, request, options: options do |response, operation|
|
908
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
909
|
+
yield response, operation if block_given?
|
910
|
+
return response
|
911
|
+
end
|
912
|
+
rescue ::GRPC::BadStatus => e
|
913
|
+
raise ::Google::Cloud::Error.from_error(e)
|
914
|
+
end
|
915
|
+
|
916
|
+
##
|
917
|
+
# Incrementally adds place IDs to
|
918
|
+
# {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids Product.fulfillment_info.place_ids}.
|
919
|
+
#
|
920
|
+
# This process is asynchronous and does not require the
|
921
|
+
# {::Google::Cloud::Retail::V2::Product Product} to exist before updating
|
922
|
+
# fulfillment information. If the request is valid, the update will be
|
923
|
+
# enqueued and processed downstream. As a consequence, when a response is
|
924
|
+
# returned, the added place IDs are not immediately manifested in the
|
925
|
+
# {::Google::Cloud::Retail::V2::Product Product} queried by
|
926
|
+
# {::Google::Cloud::Retail::V2::ProductService::Client#get_product GetProduct} or
|
927
|
+
# {::Google::Cloud::Retail::V2::ProductService::Client#list_products ListProducts}.
|
928
|
+
#
|
929
|
+
# This feature is only available for users who have Retail Search enabled.
|
930
|
+
# Contact Retail Support (retail-search-support@google.com) if you are
|
931
|
+
# interested in using Retail Search.
|
932
|
+
#
|
933
|
+
# @overload add_fulfillment_places(request, options = nil)
|
934
|
+
# Pass arguments to `add_fulfillment_places` via a request object, either of type
|
935
|
+
# {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest} or an equivalent Hash.
|
936
|
+
#
|
937
|
+
# @param request [::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest, ::Hash]
|
938
|
+
# A request object representing the call parameters. Required. To specify no
|
939
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
940
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
941
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
942
|
+
#
|
943
|
+
# @overload add_fulfillment_places(product: nil, type: nil, place_ids: nil, add_time: nil, allow_missing: nil)
|
944
|
+
# Pass arguments to `add_fulfillment_places` via keyword arguments. Note that at
|
945
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
946
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
947
|
+
#
|
948
|
+
# @param product [::String]
|
949
|
+
# Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product},
|
950
|
+
# such as
|
951
|
+
# `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
|
952
|
+
#
|
953
|
+
# If the caller does not have permission to access the
|
954
|
+
# {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it
|
955
|
+
# exists, a PERMISSION_DENIED error is returned.
|
956
|
+
# @param type [::String]
|
957
|
+
# Required. The fulfillment type, including commonly used types (such as
|
958
|
+
# pickup in store and same day delivery), and custom types.
|
959
|
+
#
|
960
|
+
# Supported values:
|
961
|
+
#
|
962
|
+
# * "pickup-in-store"
|
963
|
+
# * "ship-to-store"
|
964
|
+
# * "same-day-delivery"
|
965
|
+
# * "next-day-delivery"
|
966
|
+
# * "custom-type-1"
|
967
|
+
# * "custom-type-2"
|
968
|
+
# * "custom-type-3"
|
969
|
+
# * "custom-type-4"
|
970
|
+
# * "custom-type-5"
|
971
|
+
#
|
972
|
+
# If this field is set to an invalid value other than these, an
|
973
|
+
# INVALID_ARGUMENT error is returned.
|
974
|
+
#
|
975
|
+
# This field directly corresponds to [Product.fulfillment_info.type][].
|
976
|
+
# @param place_ids [::Array<::String>]
|
977
|
+
# Required. The IDs for this
|
978
|
+
# {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type}, such as
|
979
|
+
# the store IDs for "pickup-in-store" or the region IDs for
|
980
|
+
# "same-day-delivery" to be added for this
|
981
|
+
# {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type}. Duplicate
|
982
|
+
# IDs will be automatically ignored.
|
983
|
+
#
|
984
|
+
# At least 1 value is required, and a maximum of 2000 values are allowed.
|
985
|
+
# Each value must be a string with a length limit of 10 characters, matching
|
986
|
+
# the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an
|
987
|
+
# INVALID_ARGUMENT error is returned.
|
988
|
+
#
|
989
|
+
# If the total number of place IDs exceeds 2000 for this
|
990
|
+
# {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type} after
|
991
|
+
# adding, then the update will be rejected.
|
992
|
+
# @param add_time [::Google::Protobuf::Timestamp, ::Hash]
|
993
|
+
# The time when the fulfillment updates are issued, used to prevent
|
994
|
+
# out-of-order updates on fulfillment information. If not provided, the
|
995
|
+
# internal system time will be used.
|
996
|
+
# @param allow_missing [::Boolean]
|
997
|
+
# If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not
|
998
|
+
# found, the fulfillment information will still be processed and retained for
|
999
|
+
# at most 1 day and processed once the
|
1000
|
+
# {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, an
|
1001
|
+
# INVALID_ARGUMENT error is returned if the
|
1002
|
+
# {::Google::Cloud::Retail::V2::Product Product} is not found.
|
1003
|
+
#
|
1004
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1005
|
+
# @yieldparam response [::Gapic::Operation]
|
1006
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1007
|
+
#
|
1008
|
+
# @return [::Gapic::Operation]
|
1009
|
+
#
|
1010
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1011
|
+
#
|
1012
|
+
def add_fulfillment_places request, options = nil
|
1013
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1014
|
+
|
1015
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest
|
1016
|
+
|
1017
|
+
# Converts hash and nil to an options object
|
1018
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1019
|
+
|
1020
|
+
# Customize the options with defaults
|
1021
|
+
metadata = @config.rpcs.add_fulfillment_places.metadata.to_h
|
1022
|
+
|
1023
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1024
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1025
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1026
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION
|
1027
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1028
|
+
|
1029
|
+
header_params = {
|
1030
|
+
"product" => request.product
|
1031
|
+
}
|
1032
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1033
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1034
|
+
|
1035
|
+
options.apply_defaults timeout: @config.rpcs.add_fulfillment_places.timeout,
|
1036
|
+
metadata: metadata,
|
1037
|
+
retry_policy: @config.rpcs.add_fulfillment_places.retry_policy
|
1038
|
+
|
1039
|
+
options.apply_defaults timeout: @config.timeout,
|
1040
|
+
metadata: @config.metadata,
|
1041
|
+
retry_policy: @config.retry_policy
|
1042
|
+
|
1043
|
+
@product_service_stub.call_rpc :add_fulfillment_places, request, options: options do |response, operation|
|
1044
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1045
|
+
yield response, operation if block_given?
|
1046
|
+
return response
|
1047
|
+
end
|
1048
|
+
rescue ::GRPC::BadStatus => e
|
1049
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1050
|
+
end
|
1051
|
+
|
1052
|
+
##
|
1053
|
+
# Incrementally removes place IDs from a
|
1054
|
+
# {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids Product.fulfillment_info.place_ids}.
|
1055
|
+
#
|
1056
|
+
# This process is asynchronous and does not require the
|
1057
|
+
# {::Google::Cloud::Retail::V2::Product Product} to exist before updating
|
1058
|
+
# fulfillment information. If the request is valid, the update will be
|
1059
|
+
# enqueued and processed downstream. As a consequence, when a response is
|
1060
|
+
# returned, the removed place IDs are not immediately manifested in the
|
1061
|
+
# {::Google::Cloud::Retail::V2::Product Product} queried by
|
1062
|
+
# {::Google::Cloud::Retail::V2::ProductService::Client#get_product GetProduct} or
|
1063
|
+
# {::Google::Cloud::Retail::V2::ProductService::Client#list_products ListProducts}.
|
1064
|
+
#
|
1065
|
+
# This feature is only available for users who have Retail Search enabled.
|
1066
|
+
# Contact Retail Support (retail-search-support@google.com) if you are
|
1067
|
+
# interested in using Retail Search.
|
1068
|
+
#
|
1069
|
+
# @overload remove_fulfillment_places(request, options = nil)
|
1070
|
+
# Pass arguments to `remove_fulfillment_places` via a request object, either of type
|
1071
|
+
# {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest} or an equivalent Hash.
|
1072
|
+
#
|
1073
|
+
# @param request [::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest, ::Hash]
|
1074
|
+
# A request object representing the call parameters. Required. To specify no
|
1075
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1076
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1077
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1078
|
+
#
|
1079
|
+
# @overload remove_fulfillment_places(product: nil, type: nil, place_ids: nil, remove_time: nil, allow_missing: nil)
|
1080
|
+
# Pass arguments to `remove_fulfillment_places` via keyword arguments. Note that at
|
1081
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1082
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1083
|
+
#
|
1084
|
+
# @param product [::String]
|
1085
|
+
# Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product},
|
1086
|
+
# such as
|
1087
|
+
# `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
|
1088
|
+
#
|
1089
|
+
# If the caller does not have permission to access the
|
1090
|
+
# {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it
|
1091
|
+
# exists, a PERMISSION_DENIED error is returned.
|
1092
|
+
# @param type [::String]
|
1093
|
+
# Required. The fulfillment type, including commonly used types (such as
|
1094
|
+
# pickup in store and same day delivery), and custom types.
|
1095
|
+
#
|
1096
|
+
# Supported values:
|
1097
|
+
#
|
1098
|
+
# * "pickup-in-store"
|
1099
|
+
# * "ship-to-store"
|
1100
|
+
# * "same-day-delivery"
|
1101
|
+
# * "next-day-delivery"
|
1102
|
+
# * "custom-type-1"
|
1103
|
+
# * "custom-type-2"
|
1104
|
+
# * "custom-type-3"
|
1105
|
+
# * "custom-type-4"
|
1106
|
+
# * "custom-type-5"
|
1107
|
+
#
|
1108
|
+
# If this field is set to an invalid value other than these, an
|
1109
|
+
# INVALID_ARGUMENT error is returned.
|
1110
|
+
#
|
1111
|
+
# This field directly corresponds to [Product.fulfillment_info.type][].
|
1112
|
+
# @param place_ids [::Array<::String>]
|
1113
|
+
# Required. The IDs for this
|
1114
|
+
# {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest#type type}, such as
|
1115
|
+
# the store IDs for "pickup-in-store" or the region IDs for
|
1116
|
+
# "same-day-delivery", to be removed for this
|
1117
|
+
# {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest#type type}.
|
1118
|
+
#
|
1119
|
+
# At least 1 value is required, and a maximum of 2000 values are allowed.
|
1120
|
+
# Each value must be a string with a length limit of 10 characters, matching
|
1121
|
+
# the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an
|
1122
|
+
# INVALID_ARGUMENT error is returned.
|
1123
|
+
# @param remove_time [::Google::Protobuf::Timestamp, ::Hash]
|
1124
|
+
# The time when the fulfillment updates are issued, used to prevent
|
1125
|
+
# out-of-order updates on fulfillment information. If not provided, the
|
1126
|
+
# internal system time will be used.
|
1127
|
+
# @param allow_missing [::Boolean]
|
1128
|
+
# If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not
|
1129
|
+
# found, the fulfillment information will still be processed and retained for
|
1130
|
+
# at most 1 day and processed once the
|
1131
|
+
# {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, an
|
1132
|
+
# INVALID_ARGUMENT error is returned if the
|
1133
|
+
# {::Google::Cloud::Retail::V2::Product Product} is not found.
|
1134
|
+
#
|
1135
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1136
|
+
# @yieldparam response [::Gapic::Operation]
|
1137
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1138
|
+
#
|
1139
|
+
# @return [::Gapic::Operation]
|
1140
|
+
#
|
1141
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1142
|
+
#
|
1143
|
+
def remove_fulfillment_places request, options = nil
|
1144
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1145
|
+
|
1146
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest
|
1147
|
+
|
1148
|
+
# Converts hash and nil to an options object
|
1149
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1150
|
+
|
1151
|
+
# Customize the options with defaults
|
1152
|
+
metadata = @config.rpcs.remove_fulfillment_places.metadata.to_h
|
1153
|
+
|
1154
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1155
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1156
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1157
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION
|
1158
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1159
|
+
|
1160
|
+
header_params = {
|
1161
|
+
"product" => request.product
|
1162
|
+
}
|
1163
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1164
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1165
|
+
|
1166
|
+
options.apply_defaults timeout: @config.rpcs.remove_fulfillment_places.timeout,
|
1167
|
+
metadata: metadata,
|
1168
|
+
retry_policy: @config.rpcs.remove_fulfillment_places.retry_policy
|
1169
|
+
|
1170
|
+
options.apply_defaults timeout: @config.timeout,
|
1171
|
+
metadata: @config.metadata,
|
1172
|
+
retry_policy: @config.retry_policy
|
1173
|
+
|
1174
|
+
@product_service_stub.call_rpc :remove_fulfillment_places, request, options: options do |response, operation|
|
1175
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1176
|
+
yield response, operation if block_given?
|
1177
|
+
return response
|
1178
|
+
end
|
1179
|
+
rescue ::GRPC::BadStatus => e
|
1180
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1181
|
+
end
|
1182
|
+
|
574
1183
|
##
|
575
1184
|
# Configuration class for the ProductService API.
|
576
1185
|
#
|
@@ -584,22 +1193,21 @@ module Google
|
|
584
1193
|
# Configuration can be applied globally to all clients, or to a single client
|
585
1194
|
# on construction.
|
586
1195
|
#
|
587
|
-
#
|
588
|
-
#
|
589
|
-
# To modify the global config, setting the timeout for create_product
|
590
|
-
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
1196
|
+
# @example
|
591
1197
|
#
|
592
|
-
#
|
593
|
-
#
|
594
|
-
#
|
595
|
-
#
|
1198
|
+
# # Modify the global config, setting the timeout for
|
1199
|
+
# # create_product to 20 seconds,
|
1200
|
+
# # and all remaining timeouts to 10 seconds.
|
1201
|
+
# ::Google::Cloud::Retail::V2::ProductService::Client.configure do |config|
|
1202
|
+
# config.timeout = 10.0
|
1203
|
+
# config.rpcs.create_product.timeout = 20.0
|
1204
|
+
# end
|
596
1205
|
#
|
597
|
-
#
|
598
|
-
#
|
599
|
-
#
|
600
|
-
#
|
601
|
-
#
|
602
|
-
# end
|
1206
|
+
# # Apply the above configuration only to a new client.
|
1207
|
+
# client = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config|
|
1208
|
+
# config.timeout = 10.0
|
1209
|
+
# config.rpcs.create_product.timeout = 20.0
|
1210
|
+
# end
|
603
1211
|
#
|
604
1212
|
# @!attribute [rw] endpoint
|
605
1213
|
# The hostname or hostname:port of the service endpoint.
|
@@ -718,6 +1326,11 @@ module Google
|
|
718
1326
|
#
|
719
1327
|
attr_reader :get_product
|
720
1328
|
##
|
1329
|
+
# RPC-specific configuration for `list_products`
|
1330
|
+
# @return [::Gapic::Config::Method]
|
1331
|
+
#
|
1332
|
+
attr_reader :list_products
|
1333
|
+
##
|
721
1334
|
# RPC-specific configuration for `update_product`
|
722
1335
|
# @return [::Gapic::Config::Method]
|
723
1336
|
#
|
@@ -732,6 +1345,21 @@ module Google
|
|
732
1345
|
# @return [::Gapic::Config::Method]
|
733
1346
|
#
|
734
1347
|
attr_reader :import_products
|
1348
|
+
##
|
1349
|
+
# RPC-specific configuration for `set_inventory`
|
1350
|
+
# @return [::Gapic::Config::Method]
|
1351
|
+
#
|
1352
|
+
attr_reader :set_inventory
|
1353
|
+
##
|
1354
|
+
# RPC-specific configuration for `add_fulfillment_places`
|
1355
|
+
# @return [::Gapic::Config::Method]
|
1356
|
+
#
|
1357
|
+
attr_reader :add_fulfillment_places
|
1358
|
+
##
|
1359
|
+
# RPC-specific configuration for `remove_fulfillment_places`
|
1360
|
+
# @return [::Gapic::Config::Method]
|
1361
|
+
#
|
1362
|
+
attr_reader :remove_fulfillment_places
|
735
1363
|
|
736
1364
|
# @private
|
737
1365
|
def initialize parent_rpcs = nil
|
@@ -739,12 +1367,20 @@ module Google
|
|
739
1367
|
@create_product = ::Gapic::Config::Method.new create_product_config
|
740
1368
|
get_product_config = parent_rpcs.get_product if parent_rpcs.respond_to? :get_product
|
741
1369
|
@get_product = ::Gapic::Config::Method.new get_product_config
|
1370
|
+
list_products_config = parent_rpcs.list_products if parent_rpcs.respond_to? :list_products
|
1371
|
+
@list_products = ::Gapic::Config::Method.new list_products_config
|
742
1372
|
update_product_config = parent_rpcs.update_product if parent_rpcs.respond_to? :update_product
|
743
1373
|
@update_product = ::Gapic::Config::Method.new update_product_config
|
744
1374
|
delete_product_config = parent_rpcs.delete_product if parent_rpcs.respond_to? :delete_product
|
745
1375
|
@delete_product = ::Gapic::Config::Method.new delete_product_config
|
746
1376
|
import_products_config = parent_rpcs.import_products if parent_rpcs.respond_to? :import_products
|
747
1377
|
@import_products = ::Gapic::Config::Method.new import_products_config
|
1378
|
+
set_inventory_config = parent_rpcs.set_inventory if parent_rpcs.respond_to? :set_inventory
|
1379
|
+
@set_inventory = ::Gapic::Config::Method.new set_inventory_config
|
1380
|
+
add_fulfillment_places_config = parent_rpcs.add_fulfillment_places if parent_rpcs.respond_to? :add_fulfillment_places
|
1381
|
+
@add_fulfillment_places = ::Gapic::Config::Method.new add_fulfillment_places_config
|
1382
|
+
remove_fulfillment_places_config = parent_rpcs.remove_fulfillment_places if parent_rpcs.respond_to? :remove_fulfillment_places
|
1383
|
+
@remove_fulfillment_places = ::Gapic::Config::Method.new remove_fulfillment_places_config
|
748
1384
|
|
749
1385
|
yield self if block_given?
|
750
1386
|
end
|