google-cloud-retail-v2 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/google/cloud/retail/v2/catalog_service/rest/client.rb +1220 -0
- data/lib/google/cloud/retail/v2/catalog_service/rest/service_stub.rb +704 -0
- data/lib/google/cloud/retail/v2/catalog_service/rest.rb +52 -0
- data/lib/google/cloud/retail/v2/catalog_service.rb +6 -0
- data/lib/google/cloud/retail/v2/completion_service/rest/client.rb +533 -0
- data/lib/google/cloud/retail/v2/completion_service/rest/operations.rb +828 -0
- data/lib/google/cloud/retail/v2/completion_service/rest/service_stub.rb +167 -0
- data/lib/google/cloud/retail/v2/completion_service/rest.rb +56 -0
- data/lib/google/cloud/retail/v2/completion_service.rb +6 -0
- data/lib/google/cloud/retail/v2/control_service/rest/client.rb +680 -0
- data/lib/google/cloud/retail/v2/control_service/rest/service_stub.rb +345 -0
- data/lib/google/cloud/retail/v2/control_service/rest.rb +52 -0
- data/lib/google/cloud/retail/v2/control_service.rb +6 -0
- data/lib/google/cloud/retail/v2/prediction_service/rest/client.rb +486 -0
- data/lib/google/cloud/retail/v2/prediction_service/rest/service_stub.rb +116 -0
- data/lib/google/cloud/retail/v2/prediction_service/rest.rb +52 -0
- data/lib/google/cloud/retail/v2/prediction_service.rb +6 -0
- data/lib/google/cloud/retail/v2/product_service/rest/client.rb +1649 -0
- data/lib/google/cloud/retail/v2/product_service/rest/operations.rb +828 -0
- data/lib/google/cloud/retail/v2/product_service/rest/service_stub.rb +705 -0
- data/lib/google/cloud/retail/v2/product_service/rest.rb +54 -0
- data/lib/google/cloud/retail/v2/product_service.rb +6 -0
- data/lib/google/cloud/retail/v2/rest.rb +44 -0
- data/lib/google/cloud/retail/v2/search_service/rest/client.rb +598 -0
- data/lib/google/cloud/retail/v2/search_service/rest/service_stub.rb +116 -0
- data/lib/google/cloud/retail/v2/search_service/rest.rb +55 -0
- data/lib/google/cloud/retail/v2/search_service.rb +6 -0
- data/lib/google/cloud/retail/v2/serving_config_service/rest/client.rb +825 -0
- data/lib/google/cloud/retail/v2/serving_config_service/rest/service_stub.rb +465 -0
- data/lib/google/cloud/retail/v2/serving_config_service/rest.rb +52 -0
- data/lib/google/cloud/retail/v2/serving_config_service.rb +6 -0
- data/lib/google/cloud/retail/v2/user_event_service/rest/client.rb +755 -0
- data/lib/google/cloud/retail/v2/user_event_service/rest/operations.rb +828 -0
- data/lib/google/cloud/retail/v2/user_event_service/rest/service_stub.rb +347 -0
- data/lib/google/cloud/retail/v2/user_event_service/rest.rb +53 -0
- data/lib/google/cloud/retail/v2/user_event_service.rb +6 -0
- data/lib/google/cloud/retail/v2/version.rb +1 -1
- data/lib/google/cloud/retail/v2.rb +5 -0
- metadata +35 -5
@@ -0,0 +1,1649 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/cloud/retail/v2/product_service_pb"
|
21
|
+
require "google/cloud/retail/v2/product_service/rest/service_stub"
|
22
|
+
require "google/cloud/location/rest"
|
23
|
+
|
24
|
+
module Google
|
25
|
+
module Cloud
|
26
|
+
module Retail
|
27
|
+
module V2
|
28
|
+
module ProductService
|
29
|
+
module Rest
|
30
|
+
##
|
31
|
+
# REST client for the ProductService service.
|
32
|
+
#
|
33
|
+
# Service for ingesting {::Google::Cloud::Retail::V2::Product Product} information
|
34
|
+
# of the customer's website.
|
35
|
+
#
|
36
|
+
class Client
|
37
|
+
include Paths
|
38
|
+
|
39
|
+
# @private
|
40
|
+
attr_reader :product_service_stub
|
41
|
+
|
42
|
+
##
|
43
|
+
# Configure the ProductService Client class.
|
44
|
+
#
|
45
|
+
# See {::Google::Cloud::Retail::V2::ProductService::Rest::Client::Configuration}
|
46
|
+
# for a description of the configuration fields.
|
47
|
+
#
|
48
|
+
# @example
|
49
|
+
#
|
50
|
+
# # Modify the configuration for all ProductService clients
|
51
|
+
# ::Google::Cloud::Retail::V2::ProductService::Rest::Client.configure do |config|
|
52
|
+
# config.timeout = 10.0
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# @yield [config] Configure the Client client.
|
56
|
+
# @yieldparam config [Client::Configuration]
|
57
|
+
#
|
58
|
+
# @return [Client::Configuration]
|
59
|
+
#
|
60
|
+
def self.configure
|
61
|
+
@configure ||= begin
|
62
|
+
namespace = ["Google", "Cloud", "Retail", "V2"]
|
63
|
+
parent_config = while namespace.any?
|
64
|
+
parent_name = namespace.join "::"
|
65
|
+
parent_const = const_get parent_name
|
66
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
67
|
+
namespace.pop
|
68
|
+
end
|
69
|
+
default_config = Client::Configuration.new parent_config
|
70
|
+
|
71
|
+
default_config.timeout = 30.0
|
72
|
+
default_config.retry_policy = {
|
73
|
+
initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14, 4]
|
74
|
+
}
|
75
|
+
|
76
|
+
default_config.rpcs.import_products.timeout = 300.0
|
77
|
+
default_config.rpcs.import_products.retry_policy = {
|
78
|
+
initial_delay: 0.1, max_delay: 300.0, multiplier: 1.3, retry_codes: [14, 4]
|
79
|
+
}
|
80
|
+
|
81
|
+
default_config
|
82
|
+
end
|
83
|
+
yield @configure if block_given?
|
84
|
+
@configure
|
85
|
+
end
|
86
|
+
|
87
|
+
##
|
88
|
+
# Configure the ProductService Client instance.
|
89
|
+
#
|
90
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
91
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
92
|
+
# should be made on {Client.configure}.
|
93
|
+
#
|
94
|
+
# See {::Google::Cloud::Retail::V2::ProductService::Rest::Client::Configuration}
|
95
|
+
# for a description of the configuration fields.
|
96
|
+
#
|
97
|
+
# @yield [config] Configure the Client client.
|
98
|
+
# @yieldparam config [Client::Configuration]
|
99
|
+
#
|
100
|
+
# @return [Client::Configuration]
|
101
|
+
#
|
102
|
+
def configure
|
103
|
+
yield @config if block_given?
|
104
|
+
@config
|
105
|
+
end
|
106
|
+
|
107
|
+
##
|
108
|
+
# Create a new ProductService REST client object.
|
109
|
+
#
|
110
|
+
# @example
|
111
|
+
#
|
112
|
+
# # Create a client using the default configuration
|
113
|
+
# client = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new
|
114
|
+
#
|
115
|
+
# # Create a client using a custom configuration
|
116
|
+
# client = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config|
|
117
|
+
# config.timeout = 10.0
|
118
|
+
# end
|
119
|
+
#
|
120
|
+
# @yield [config] Configure the ProductService client.
|
121
|
+
# @yieldparam config [Client::Configuration]
|
122
|
+
#
|
123
|
+
def initialize
|
124
|
+
# Create the configuration object
|
125
|
+
@config = Configuration.new Client.configure
|
126
|
+
|
127
|
+
# Yield the configuration if needed
|
128
|
+
yield @config if block_given?
|
129
|
+
|
130
|
+
# Create credentials
|
131
|
+
credentials = @config.credentials
|
132
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
133
|
+
# but only if the default endpoint does not have a region prefix.
|
134
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
135
|
+
!@config.endpoint.split(".").first.include?("-")
|
136
|
+
credentials ||= Credentials.default scope: @config.scope,
|
137
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
138
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
139
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
140
|
+
end
|
141
|
+
|
142
|
+
@quota_project_id = @config.quota_project
|
143
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
144
|
+
|
145
|
+
@operations_client = ::Google::Cloud::Retail::V2::ProductService::Rest::Operations.new do |config|
|
146
|
+
config.credentials = credentials
|
147
|
+
config.quota_project = @quota_project_id
|
148
|
+
config.endpoint = @config.endpoint
|
149
|
+
end
|
150
|
+
|
151
|
+
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
152
|
+
config.credentials = credentials
|
153
|
+
config.quota_project = @quota_project_id
|
154
|
+
config.endpoint = @config.endpoint
|
155
|
+
end
|
156
|
+
|
157
|
+
@product_service_stub = ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
158
|
+
end
|
159
|
+
|
160
|
+
##
|
161
|
+
# Get the associated client for long-running operations.
|
162
|
+
#
|
163
|
+
# @return [::Google::Cloud::Retail::V2::ProductService::Rest::Operations]
|
164
|
+
#
|
165
|
+
attr_reader :operations_client
|
166
|
+
|
167
|
+
##
|
168
|
+
# Get the associated client for mix-in of the Locations.
|
169
|
+
#
|
170
|
+
# @return [Google::Cloud::Location::Locations::Rest::Client]
|
171
|
+
#
|
172
|
+
attr_reader :location_client
|
173
|
+
|
174
|
+
# Service calls
|
175
|
+
|
176
|
+
##
|
177
|
+
# Creates a {::Google::Cloud::Retail::V2::Product Product}.
|
178
|
+
#
|
179
|
+
# @overload create_product(request, options = nil)
|
180
|
+
# Pass arguments to `create_product` via a request object, either of type
|
181
|
+
# {::Google::Cloud::Retail::V2::CreateProductRequest} or an equivalent Hash.
|
182
|
+
#
|
183
|
+
# @param request [::Google::Cloud::Retail::V2::CreateProductRequest, ::Hash]
|
184
|
+
# A request object representing the call parameters. Required. To specify no
|
185
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
186
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
187
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
188
|
+
#
|
189
|
+
# @overload create_product(parent: nil, product: nil, product_id: nil)
|
190
|
+
# Pass arguments to `create_product` via keyword arguments. Note that at
|
191
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
192
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
193
|
+
#
|
194
|
+
# @param parent [::String]
|
195
|
+
# Required. The parent catalog resource name, such as
|
196
|
+
# `projects/*/locations/global/catalogs/default_catalog/branches/default_branch`.
|
197
|
+
# @param product [::Google::Cloud::Retail::V2::Product, ::Hash]
|
198
|
+
# Required. The {::Google::Cloud::Retail::V2::Product Product} to create.
|
199
|
+
# @param product_id [::String]
|
200
|
+
# Required. The ID to use for the {::Google::Cloud::Retail::V2::Product Product},
|
201
|
+
# which will become the final component of the
|
202
|
+
# {::Google::Cloud::Retail::V2::Product#name Product.name}.
|
203
|
+
#
|
204
|
+
# If the caller does not have permission to create the
|
205
|
+
# {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it
|
206
|
+
# exists, a PERMISSION_DENIED error is returned.
|
207
|
+
#
|
208
|
+
# This field must be unique among all
|
209
|
+
# {::Google::Cloud::Retail::V2::Product Product}s with the same
|
210
|
+
# {::Google::Cloud::Retail::V2::CreateProductRequest#parent parent}. Otherwise, an
|
211
|
+
# ALREADY_EXISTS error is returned.
|
212
|
+
#
|
213
|
+
# This field must be a UTF-8 encoded string with a length limit of 128
|
214
|
+
# characters. Otherwise, an INVALID_ARGUMENT error is returned.
|
215
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
216
|
+
# @yieldparam result [::Google::Cloud::Retail::V2::Product]
|
217
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
218
|
+
#
|
219
|
+
# @return [::Google::Cloud::Retail::V2::Product]
|
220
|
+
#
|
221
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
222
|
+
def create_product request, options = nil
|
223
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
224
|
+
|
225
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CreateProductRequest
|
226
|
+
|
227
|
+
# Converts hash and nil to an options object
|
228
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
229
|
+
|
230
|
+
# Customize the options with defaults
|
231
|
+
call_metadata = @config.rpcs.create_product.metadata.to_h
|
232
|
+
|
233
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
234
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
235
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
236
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION,
|
237
|
+
transports_version_send: [:rest]
|
238
|
+
|
239
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
240
|
+
|
241
|
+
options.apply_defaults timeout: @config.rpcs.create_product.timeout,
|
242
|
+
metadata: call_metadata,
|
243
|
+
retry_policy: @config.rpcs.create_product.retry_policy
|
244
|
+
|
245
|
+
options.apply_defaults timeout: @config.timeout,
|
246
|
+
metadata: @config.metadata,
|
247
|
+
retry_policy: @config.retry_policy
|
248
|
+
|
249
|
+
@product_service_stub.create_product request, options do |result, operation|
|
250
|
+
yield result, operation if block_given?
|
251
|
+
return result
|
252
|
+
end
|
253
|
+
rescue ::Gapic::Rest::Error => e
|
254
|
+
raise ::Google::Cloud::Error.from_error(e)
|
255
|
+
end
|
256
|
+
|
257
|
+
##
|
258
|
+
# Gets a {::Google::Cloud::Retail::V2::Product Product}.
|
259
|
+
#
|
260
|
+
# @overload get_product(request, options = nil)
|
261
|
+
# Pass arguments to `get_product` via a request object, either of type
|
262
|
+
# {::Google::Cloud::Retail::V2::GetProductRequest} or an equivalent Hash.
|
263
|
+
#
|
264
|
+
# @param request [::Google::Cloud::Retail::V2::GetProductRequest, ::Hash]
|
265
|
+
# A request object representing the call parameters. Required. To specify no
|
266
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
267
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
268
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
269
|
+
#
|
270
|
+
# @overload get_product(name: nil)
|
271
|
+
# Pass arguments to `get_product` via keyword arguments. Note that at
|
272
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
273
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
274
|
+
#
|
275
|
+
# @param name [::String]
|
276
|
+
# Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product},
|
277
|
+
# such as
|
278
|
+
# `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
|
279
|
+
#
|
280
|
+
# If the caller does not have permission to access the
|
281
|
+
# {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it
|
282
|
+
# exists, a PERMISSION_DENIED error is returned.
|
283
|
+
#
|
284
|
+
# If the requested {::Google::Cloud::Retail::V2::Product Product} does not exist,
|
285
|
+
# a NOT_FOUND error is returned.
|
286
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
287
|
+
# @yieldparam result [::Google::Cloud::Retail::V2::Product]
|
288
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
289
|
+
#
|
290
|
+
# @return [::Google::Cloud::Retail::V2::Product]
|
291
|
+
#
|
292
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
293
|
+
def get_product request, options = nil
|
294
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
295
|
+
|
296
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetProductRequest
|
297
|
+
|
298
|
+
# Converts hash and nil to an options object
|
299
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
300
|
+
|
301
|
+
# Customize the options with defaults
|
302
|
+
call_metadata = @config.rpcs.get_product.metadata.to_h
|
303
|
+
|
304
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
305
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
306
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
307
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION,
|
308
|
+
transports_version_send: [:rest]
|
309
|
+
|
310
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
311
|
+
|
312
|
+
options.apply_defaults timeout: @config.rpcs.get_product.timeout,
|
313
|
+
metadata: call_metadata,
|
314
|
+
retry_policy: @config.rpcs.get_product.retry_policy
|
315
|
+
|
316
|
+
options.apply_defaults timeout: @config.timeout,
|
317
|
+
metadata: @config.metadata,
|
318
|
+
retry_policy: @config.retry_policy
|
319
|
+
|
320
|
+
@product_service_stub.get_product request, options do |result, operation|
|
321
|
+
yield result, operation if block_given?
|
322
|
+
return result
|
323
|
+
end
|
324
|
+
rescue ::Gapic::Rest::Error => e
|
325
|
+
raise ::Google::Cloud::Error.from_error(e)
|
326
|
+
end
|
327
|
+
|
328
|
+
##
|
329
|
+
# Gets a list of {::Google::Cloud::Retail::V2::Product Product}s.
|
330
|
+
#
|
331
|
+
# @overload list_products(request, options = nil)
|
332
|
+
# Pass arguments to `list_products` via a request object, either of type
|
333
|
+
# {::Google::Cloud::Retail::V2::ListProductsRequest} or an equivalent Hash.
|
334
|
+
#
|
335
|
+
# @param request [::Google::Cloud::Retail::V2::ListProductsRequest, ::Hash]
|
336
|
+
# A request object representing the call parameters. Required. To specify no
|
337
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
338
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
339
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
340
|
+
#
|
341
|
+
# @overload list_products(parent: nil, page_size: nil, page_token: nil, filter: nil, read_mask: nil)
|
342
|
+
# Pass arguments to `list_products` via keyword arguments. Note that at
|
343
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
344
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
345
|
+
#
|
346
|
+
# @param parent [::String]
|
347
|
+
# Required. The parent branch resource name, such as
|
348
|
+
# `projects/*/locations/global/catalogs/default_catalog/branches/0`. Use
|
349
|
+
# `default_branch` as the branch ID, to list products under the default
|
350
|
+
# branch.
|
351
|
+
#
|
352
|
+
# If the caller does not have permission to list
|
353
|
+
# {::Google::Cloud::Retail::V2::Product Product}s under this branch, regardless of
|
354
|
+
# whether or not this branch exists, a PERMISSION_DENIED error is returned.
|
355
|
+
# @param page_size [::Integer]
|
356
|
+
# Maximum number of {::Google::Cloud::Retail::V2::Product Product}s to return. If
|
357
|
+
# unspecified, defaults to 100. The maximum allowed value is 1000. Values
|
358
|
+
# above 1000 will be coerced to 1000.
|
359
|
+
#
|
360
|
+
# If this field is negative, an INVALID_ARGUMENT error is returned.
|
361
|
+
# @param page_token [::String]
|
362
|
+
# A page token
|
363
|
+
# {::Google::Cloud::Retail::V2::ListProductsResponse#next_page_token ListProductsResponse.next_page_token},
|
364
|
+
# received from a previous
|
365
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts}
|
366
|
+
# call. Provide this to retrieve the subsequent page.
|
367
|
+
#
|
368
|
+
# When paginating, all other parameters provided to
|
369
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts}
|
370
|
+
# must match the call that provided the page token. Otherwise, an
|
371
|
+
# INVALID_ARGUMENT error is returned.
|
372
|
+
# @param filter [::String]
|
373
|
+
# A filter to apply on the list results. Supported features:
|
374
|
+
#
|
375
|
+
# * List all the products under the parent branch if
|
376
|
+
# {::Google::Cloud::Retail::V2::ListProductsRequest#filter filter} is unset.
|
377
|
+
# * List {::Google::Cloud::Retail::V2::Product::Type::VARIANT Product.Type.VARIANT}
|
378
|
+
# {::Google::Cloud::Retail::V2::Product Product}s sharing the same
|
379
|
+
# {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY}
|
380
|
+
# {::Google::Cloud::Retail::V2::Product Product}. For example:
|
381
|
+
# `primary_product_id = "some_product_id"`
|
382
|
+
# * List {::Google::Cloud::Retail::V2::Product Product}s bundled in a
|
383
|
+
# {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION}
|
384
|
+
# {::Google::Cloud::Retail::V2::Product Product}.
|
385
|
+
# For example:
|
386
|
+
# `collection_product_id = "some_product_id"`
|
387
|
+
# * List {::Google::Cloud::Retail::V2::Product Product}s with a partibular type.
|
388
|
+
# For example:
|
389
|
+
# `type = "PRIMARY"`
|
390
|
+
# `type = "VARIANT"`
|
391
|
+
# `type = "COLLECTION"`
|
392
|
+
#
|
393
|
+
# If the field is unrecognizable, an INVALID_ARGUMENT error is returned.
|
394
|
+
#
|
395
|
+
# If the specified
|
396
|
+
# {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY}
|
397
|
+
# {::Google::Cloud::Retail::V2::Product Product} or
|
398
|
+
# {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION}
|
399
|
+
# {::Google::Cloud::Retail::V2::Product Product} does not exist, a NOT_FOUND error
|
400
|
+
# is returned.
|
401
|
+
# @param read_mask [::Google::Protobuf::FieldMask, ::Hash]
|
402
|
+
# The fields of {::Google::Cloud::Retail::V2::Product Product} to return in the
|
403
|
+
# responses. If not set or empty, the following fields are returned:
|
404
|
+
#
|
405
|
+
# * {::Google::Cloud::Retail::V2::Product#name Product.name}
|
406
|
+
# * {::Google::Cloud::Retail::V2::Product#id Product.id}
|
407
|
+
# * {::Google::Cloud::Retail::V2::Product#title Product.title}
|
408
|
+
# * {::Google::Cloud::Retail::V2::Product#uri Product.uri}
|
409
|
+
# * {::Google::Cloud::Retail::V2::Product#images Product.images}
|
410
|
+
# * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info}
|
411
|
+
# * {::Google::Cloud::Retail::V2::Product#brands Product.brands}
|
412
|
+
#
|
413
|
+
# If "*" is provided, all fields are returned.
|
414
|
+
# {::Google::Cloud::Retail::V2::Product#name Product.name} is always returned no
|
415
|
+
# matter what mask is set.
|
416
|
+
#
|
417
|
+
# If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
|
418
|
+
# is returned.
|
419
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
420
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Product>]
|
421
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
422
|
+
#
|
423
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Product>]
|
424
|
+
#
|
425
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
426
|
+
def list_products request, options = nil
|
427
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
428
|
+
|
429
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListProductsRequest
|
430
|
+
|
431
|
+
# Converts hash and nil to an options object
|
432
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
433
|
+
|
434
|
+
# Customize the options with defaults
|
435
|
+
call_metadata = @config.rpcs.list_products.metadata.to_h
|
436
|
+
|
437
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
438
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
439
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
440
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION,
|
441
|
+
transports_version_send: [:rest]
|
442
|
+
|
443
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
444
|
+
|
445
|
+
options.apply_defaults timeout: @config.rpcs.list_products.timeout,
|
446
|
+
metadata: call_metadata,
|
447
|
+
retry_policy: @config.rpcs.list_products.retry_policy
|
448
|
+
|
449
|
+
options.apply_defaults timeout: @config.timeout,
|
450
|
+
metadata: @config.metadata,
|
451
|
+
retry_policy: @config.retry_policy
|
452
|
+
|
453
|
+
@product_service_stub.list_products request, options do |result, operation|
|
454
|
+
result = ::Gapic::Rest::PagedEnumerable.new @product_service_stub, :list_products, "products", request, result, options
|
455
|
+
yield result, operation if block_given?
|
456
|
+
return result
|
457
|
+
end
|
458
|
+
rescue ::Gapic::Rest::Error => e
|
459
|
+
raise ::Google::Cloud::Error.from_error(e)
|
460
|
+
end
|
461
|
+
|
462
|
+
##
|
463
|
+
# Updates a {::Google::Cloud::Retail::V2::Product Product}.
|
464
|
+
#
|
465
|
+
# @overload update_product(request, options = nil)
|
466
|
+
# Pass arguments to `update_product` via a request object, either of type
|
467
|
+
# {::Google::Cloud::Retail::V2::UpdateProductRequest} or an equivalent Hash.
|
468
|
+
#
|
469
|
+
# @param request [::Google::Cloud::Retail::V2::UpdateProductRequest, ::Hash]
|
470
|
+
# A request object representing the call parameters. Required. To specify no
|
471
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
472
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
473
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
474
|
+
#
|
475
|
+
# @overload update_product(product: nil, update_mask: nil, allow_missing: nil)
|
476
|
+
# Pass arguments to `update_product` via keyword arguments. Note that at
|
477
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
478
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
479
|
+
#
|
480
|
+
# @param product [::Google::Cloud::Retail::V2::Product, ::Hash]
|
481
|
+
# Required. The product to update/create.
|
482
|
+
#
|
483
|
+
# If the caller does not have permission to update the
|
484
|
+
# {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it
|
485
|
+
# exists, a PERMISSION_DENIED error is returned.
|
486
|
+
#
|
487
|
+
# If the {::Google::Cloud::Retail::V2::Product Product} to update does not exist
|
488
|
+
# and
|
489
|
+
# {::Google::Cloud::Retail::V2::UpdateProductRequest#allow_missing allow_missing}
|
490
|
+
# is not set, a NOT_FOUND error is returned.
|
491
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
492
|
+
# Indicates which fields in the provided
|
493
|
+
# {::Google::Cloud::Retail::V2::Product Product} to update. The immutable and
|
494
|
+
# output only fields are NOT supported. If not set, all supported fields (the
|
495
|
+
# fields that are neither immutable nor output only) are updated.
|
496
|
+
#
|
497
|
+
# If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
|
498
|
+
# is returned.
|
499
|
+
#
|
500
|
+
# The attribute key can be updated by setting the mask path as
|
501
|
+
# "attributes.$\\{key_name}". If a key name is present in the mask but not in
|
502
|
+
# the patching product from the request, this key will be deleted after the
|
503
|
+
# update.
|
504
|
+
# @param allow_missing [::Boolean]
|
505
|
+
# If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not
|
506
|
+
# found, a new {::Google::Cloud::Retail::V2::Product Product} will be created. In
|
507
|
+
# this situation, `update_mask` is ignored.
|
508
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
509
|
+
# @yieldparam result [::Google::Cloud::Retail::V2::Product]
|
510
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
511
|
+
#
|
512
|
+
# @return [::Google::Cloud::Retail::V2::Product]
|
513
|
+
#
|
514
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
515
|
+
def update_product request, options = nil
|
516
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
517
|
+
|
518
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateProductRequest
|
519
|
+
|
520
|
+
# Converts hash and nil to an options object
|
521
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
522
|
+
|
523
|
+
# Customize the options with defaults
|
524
|
+
call_metadata = @config.rpcs.update_product.metadata.to_h
|
525
|
+
|
526
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
527
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
528
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
529
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION,
|
530
|
+
transports_version_send: [:rest]
|
531
|
+
|
532
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
533
|
+
|
534
|
+
options.apply_defaults timeout: @config.rpcs.update_product.timeout,
|
535
|
+
metadata: call_metadata,
|
536
|
+
retry_policy: @config.rpcs.update_product.retry_policy
|
537
|
+
|
538
|
+
options.apply_defaults timeout: @config.timeout,
|
539
|
+
metadata: @config.metadata,
|
540
|
+
retry_policy: @config.retry_policy
|
541
|
+
|
542
|
+
@product_service_stub.update_product request, options do |result, operation|
|
543
|
+
yield result, operation if block_given?
|
544
|
+
return result
|
545
|
+
end
|
546
|
+
rescue ::Gapic::Rest::Error => e
|
547
|
+
raise ::Google::Cloud::Error.from_error(e)
|
548
|
+
end
|
549
|
+
|
550
|
+
##
|
551
|
+
# Deletes a {::Google::Cloud::Retail::V2::Product Product}.
|
552
|
+
#
|
553
|
+
# @overload delete_product(request, options = nil)
|
554
|
+
# Pass arguments to `delete_product` via a request object, either of type
|
555
|
+
# {::Google::Cloud::Retail::V2::DeleteProductRequest} or an equivalent Hash.
|
556
|
+
#
|
557
|
+
# @param request [::Google::Cloud::Retail::V2::DeleteProductRequest, ::Hash]
|
558
|
+
# A request object representing the call parameters. Required. To specify no
|
559
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
560
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
561
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
562
|
+
#
|
563
|
+
# @overload delete_product(name: nil)
|
564
|
+
# Pass arguments to `delete_product` via keyword arguments. Note that at
|
565
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
566
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
567
|
+
#
|
568
|
+
# @param name [::String]
|
569
|
+
# Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product},
|
570
|
+
# such as
|
571
|
+
# `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
|
572
|
+
#
|
573
|
+
# If the caller does not have permission to delete the
|
574
|
+
# {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it
|
575
|
+
# exists, a PERMISSION_DENIED error is returned.
|
576
|
+
#
|
577
|
+
# If the {::Google::Cloud::Retail::V2::Product Product} to delete does not exist,
|
578
|
+
# a NOT_FOUND error is returned.
|
579
|
+
#
|
580
|
+
# The {::Google::Cloud::Retail::V2::Product Product} to delete can neither be a
|
581
|
+
# {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION}
|
582
|
+
# {::Google::Cloud::Retail::V2::Product Product} member nor a
|
583
|
+
# {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY}
|
584
|
+
# {::Google::Cloud::Retail::V2::Product Product} with more than one
|
585
|
+
# {::Google::Cloud::Retail::V2::Product::Type::VARIANT variants}. Otherwise, an
|
586
|
+
# INVALID_ARGUMENT error is returned.
|
587
|
+
#
|
588
|
+
# All inventory information for the named
|
589
|
+
# {::Google::Cloud::Retail::V2::Product Product} will be deleted.
|
590
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
591
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
592
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
593
|
+
#
|
594
|
+
# @return [::Google::Protobuf::Empty]
|
595
|
+
#
|
596
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
597
|
+
def delete_product request, options = nil
|
598
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
599
|
+
|
600
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::DeleteProductRequest
|
601
|
+
|
602
|
+
# Converts hash and nil to an options object
|
603
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
604
|
+
|
605
|
+
# Customize the options with defaults
|
606
|
+
call_metadata = @config.rpcs.delete_product.metadata.to_h
|
607
|
+
|
608
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
609
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
610
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
611
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION,
|
612
|
+
transports_version_send: [:rest]
|
613
|
+
|
614
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
615
|
+
|
616
|
+
options.apply_defaults timeout: @config.rpcs.delete_product.timeout,
|
617
|
+
metadata: call_metadata,
|
618
|
+
retry_policy: @config.rpcs.delete_product.retry_policy
|
619
|
+
|
620
|
+
options.apply_defaults timeout: @config.timeout,
|
621
|
+
metadata: @config.metadata,
|
622
|
+
retry_policy: @config.retry_policy
|
623
|
+
|
624
|
+
@product_service_stub.delete_product request, options do |result, operation|
|
625
|
+
yield result, operation if block_given?
|
626
|
+
return result
|
627
|
+
end
|
628
|
+
rescue ::Gapic::Rest::Error => e
|
629
|
+
raise ::Google::Cloud::Error.from_error(e)
|
630
|
+
end
|
631
|
+
|
632
|
+
##
|
633
|
+
# Bulk import of multiple {::Google::Cloud::Retail::V2::Product Product}s.
|
634
|
+
#
|
635
|
+
# Request processing may be synchronous.
|
636
|
+
# Non-existing items are created.
|
637
|
+
#
|
638
|
+
# Note that it is possible for a subset of the
|
639
|
+
# {::Google::Cloud::Retail::V2::Product Product}s to be successfully updated.
|
640
|
+
#
|
641
|
+
# @overload import_products(request, options = nil)
|
642
|
+
# Pass arguments to `import_products` via a request object, either of type
|
643
|
+
# {::Google::Cloud::Retail::V2::ImportProductsRequest} or an equivalent Hash.
|
644
|
+
#
|
645
|
+
# @param request [::Google::Cloud::Retail::V2::ImportProductsRequest, ::Hash]
|
646
|
+
# A request object representing the call parameters. Required. To specify no
|
647
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
648
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
649
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
650
|
+
#
|
651
|
+
# @overload import_products(parent: nil, request_id: nil, input_config: nil, errors_config: nil, update_mask: nil, reconciliation_mode: nil, notification_pubsub_topic: nil)
|
652
|
+
# Pass arguments to `import_products` via keyword arguments. Note that at
|
653
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
654
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
655
|
+
#
|
656
|
+
# @param parent [::String]
|
657
|
+
# Required.
|
658
|
+
# `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch`
|
659
|
+
#
|
660
|
+
# If no updateMask is specified, requires products.create permission.
|
661
|
+
# If updateMask is specified, requires products.update permission.
|
662
|
+
# @param request_id [::String]
|
663
|
+
# Deprecated. This field has no effect.
|
664
|
+
# @param input_config [::Google::Cloud::Retail::V2::ProductInputConfig, ::Hash]
|
665
|
+
# Required. The desired input location of the data.
|
666
|
+
# @param errors_config [::Google::Cloud::Retail::V2::ImportErrorsConfig, ::Hash]
|
667
|
+
# The desired location of errors incurred during the Import.
|
668
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
669
|
+
# Indicates which fields in the provided imported `products` to update. If
|
670
|
+
# not set, all fields are updated.
|
671
|
+
# @param reconciliation_mode [::Google::Cloud::Retail::V2::ImportProductsRequest::ReconciliationMode]
|
672
|
+
# The mode of reconciliation between existing products and the products to be
|
673
|
+
# imported. Defaults to
|
674
|
+
# {::Google::Cloud::Retail::V2::ImportProductsRequest::ReconciliationMode::INCREMENTAL ReconciliationMode.INCREMENTAL}.
|
675
|
+
# @param notification_pubsub_topic [::String]
|
676
|
+
# Full Pub/Sub topic name for receiving notification. If this field is set,
|
677
|
+
# when the import is finished, a notification is sent to
|
678
|
+
# specified Pub/Sub topic. The message data is JSON string of a
|
679
|
+
# {::Google::Longrunning::Operation Operation}.
|
680
|
+
#
|
681
|
+
# Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has
|
682
|
+
# to be within the same project as
|
683
|
+
# {::Google::Cloud::Retail::V2::ImportProductsRequest#parent ImportProductsRequest.parent}.
|
684
|
+
# Make sure that `service-<project
|
685
|
+
# number>@gcp-sa-retail.iam.gserviceaccount.com` has the
|
686
|
+
# `pubsub.topics.publish` IAM permission on the topic.
|
687
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
688
|
+
# @yieldparam result [::Gapic::Operation]
|
689
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
690
|
+
#
|
691
|
+
# @return [::Gapic::Operation]
|
692
|
+
#
|
693
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
694
|
+
def import_products request, options = nil
|
695
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
696
|
+
|
697
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ImportProductsRequest
|
698
|
+
|
699
|
+
# Converts hash and nil to an options object
|
700
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
701
|
+
|
702
|
+
# Customize the options with defaults
|
703
|
+
call_metadata = @config.rpcs.import_products.metadata.to_h
|
704
|
+
|
705
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
706
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
707
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
708
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION,
|
709
|
+
transports_version_send: [:rest]
|
710
|
+
|
711
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
712
|
+
|
713
|
+
options.apply_defaults timeout: @config.rpcs.import_products.timeout,
|
714
|
+
metadata: call_metadata,
|
715
|
+
retry_policy: @config.rpcs.import_products.retry_policy
|
716
|
+
|
717
|
+
options.apply_defaults timeout: @config.timeout,
|
718
|
+
metadata: @config.metadata,
|
719
|
+
retry_policy: @config.retry_policy
|
720
|
+
|
721
|
+
@product_service_stub.import_products request, options do |result, operation|
|
722
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
723
|
+
yield result, operation if block_given?
|
724
|
+
return result
|
725
|
+
end
|
726
|
+
rescue ::Gapic::Rest::Error => e
|
727
|
+
raise ::Google::Cloud::Error.from_error(e)
|
728
|
+
end
|
729
|
+
|
730
|
+
##
|
731
|
+
# Updates inventory information for a
|
732
|
+
# {::Google::Cloud::Retail::V2::Product Product} while respecting the last update
|
733
|
+
# timestamps of each inventory field.
|
734
|
+
#
|
735
|
+
# This process is asynchronous and does not require the
|
736
|
+
# {::Google::Cloud::Retail::V2::Product Product} to exist before updating
|
737
|
+
# fulfillment information. If the request is valid, the update is enqueued
|
738
|
+
# and processed downstream. As a consequence, when a response is returned,
|
739
|
+
# updates are not immediately manifested in the
|
740
|
+
# {::Google::Cloud::Retail::V2::Product Product} queried by
|
741
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#get_product ProductService.GetProduct}
|
742
|
+
# or
|
743
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts}.
|
744
|
+
#
|
745
|
+
# When inventory is updated with
|
746
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#create_product ProductService.CreateProduct}
|
747
|
+
# and
|
748
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#update_product ProductService.UpdateProduct},
|
749
|
+
# the specified inventory field value(s) overwrite any existing value(s)
|
750
|
+
# while ignoring the last update time for this field. Furthermore, the last
|
751
|
+
# update times for the specified inventory fields are overwritten by the
|
752
|
+
# times of the
|
753
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#create_product ProductService.CreateProduct}
|
754
|
+
# or
|
755
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#update_product ProductService.UpdateProduct}
|
756
|
+
# request.
|
757
|
+
#
|
758
|
+
# If no inventory fields are set in
|
759
|
+
# {::Google::Cloud::Retail::V2::CreateProductRequest#product CreateProductRequest.product},
|
760
|
+
# then any pre-existing inventory information for this product is used.
|
761
|
+
#
|
762
|
+
# If no inventory fields are set in
|
763
|
+
# {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask},
|
764
|
+
# then any existing inventory information is preserved.
|
765
|
+
#
|
766
|
+
# Pre-existing inventory information can only be updated with
|
767
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#set_inventory ProductService.SetInventory},
|
768
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#add_fulfillment_places ProductService.AddFulfillmentPlaces},
|
769
|
+
# and
|
770
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#remove_fulfillment_places ProductService.RemoveFulfillmentPlaces}.
|
771
|
+
#
|
772
|
+
# The returned {::Google::Longrunning::Operation Operation}s is obsolete after
|
773
|
+
# one day, and the GetOperation
|
774
|
+
# API returns `NOT_FOUND` afterwards.
|
775
|
+
#
|
776
|
+
# If conflicting updates are issued, the
|
777
|
+
# {::Google::Longrunning::Operation Operation}s associated with the stale
|
778
|
+
# updates are not marked as {::Google::Longrunning::Operation#done done} until
|
779
|
+
# they are obsolete.
|
780
|
+
#
|
781
|
+
# This feature is only available for users who have Retail Search enabled.
|
782
|
+
# Enable Retail Search on Cloud Console before using this feature.
|
783
|
+
#
|
784
|
+
# @overload set_inventory(request, options = nil)
|
785
|
+
# Pass arguments to `set_inventory` via a request object, either of type
|
786
|
+
# {::Google::Cloud::Retail::V2::SetInventoryRequest} or an equivalent Hash.
|
787
|
+
#
|
788
|
+
# @param request [::Google::Cloud::Retail::V2::SetInventoryRequest, ::Hash]
|
789
|
+
# A request object representing the call parameters. Required. To specify no
|
790
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
791
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
792
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
793
|
+
#
|
794
|
+
# @overload set_inventory(inventory: nil, set_mask: nil, set_time: nil, allow_missing: nil)
|
795
|
+
# Pass arguments to `set_inventory` via keyword arguments. Note that at
|
796
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
797
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
798
|
+
#
|
799
|
+
# @param inventory [::Google::Cloud::Retail::V2::Product, ::Hash]
|
800
|
+
# Required. The inventory information to update. The allowable fields to
|
801
|
+
# update are:
|
802
|
+
#
|
803
|
+
# * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info}
|
804
|
+
# * {::Google::Cloud::Retail::V2::Product#availability Product.availability}
|
805
|
+
# * {::Google::Cloud::Retail::V2::Product#available_quantity Product.available_quantity}
|
806
|
+
# * {::Google::Cloud::Retail::V2::Product#fulfillment_info Product.fulfillment_info}
|
807
|
+
# The updated inventory fields must be specified in
|
808
|
+
# {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask}.
|
809
|
+
#
|
810
|
+
# If
|
811
|
+
# {::Google::Cloud::Retail::V2::Product#name SetInventoryRequest.inventory.name}
|
812
|
+
# is empty or invalid, an INVALID_ARGUMENT error is returned.
|
813
|
+
#
|
814
|
+
# If the caller does not have permission to update the
|
815
|
+
# {::Google::Cloud::Retail::V2::Product Product} named in
|
816
|
+
# {::Google::Cloud::Retail::V2::Product#name Product.name}, regardless of whether
|
817
|
+
# or not it exists, a PERMISSION_DENIED error is returned.
|
818
|
+
#
|
819
|
+
# If the {::Google::Cloud::Retail::V2::Product Product} to update does not have
|
820
|
+
# existing inventory information, the provided inventory information will be
|
821
|
+
# inserted.
|
822
|
+
#
|
823
|
+
# If the {::Google::Cloud::Retail::V2::Product Product} to update has existing
|
824
|
+
# inventory information, the provided inventory information will be merged
|
825
|
+
# while respecting the last update time for each inventory field, using the
|
826
|
+
# provided or default value for
|
827
|
+
# {::Google::Cloud::Retail::V2::SetInventoryRequest#set_time SetInventoryRequest.set_time}.
|
828
|
+
#
|
829
|
+
# The caller can replace place IDs for a subset of fulfillment types in the
|
830
|
+
# following ways:
|
831
|
+
#
|
832
|
+
# * Adds "fulfillment_info" in
|
833
|
+
# {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask}
|
834
|
+
# * Specifies only the desired fulfillment types and corresponding place IDs
|
835
|
+
# to update in
|
836
|
+
# {::Google::Cloud::Retail::V2::Product#fulfillment_info SetInventoryRequest.inventory.fulfillment_info}
|
837
|
+
#
|
838
|
+
# The caller can clear all place IDs from a subset of fulfillment types in
|
839
|
+
# the following ways:
|
840
|
+
#
|
841
|
+
# * Adds "fulfillment_info" in
|
842
|
+
# {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask}
|
843
|
+
# * Specifies only the desired fulfillment types to clear in
|
844
|
+
# {::Google::Cloud::Retail::V2::Product#fulfillment_info SetInventoryRequest.inventory.fulfillment_info}
|
845
|
+
# * Checks that only the desired fulfillment info types have empty
|
846
|
+
# {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids SetInventoryRequest.inventory.fulfillment_info.place_ids}
|
847
|
+
#
|
848
|
+
# The last update time is recorded for the following inventory fields:
|
849
|
+
# * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info}
|
850
|
+
# * {::Google::Cloud::Retail::V2::Product#availability Product.availability}
|
851
|
+
# * {::Google::Cloud::Retail::V2::Product#available_quantity Product.available_quantity}
|
852
|
+
# * {::Google::Cloud::Retail::V2::Product#fulfillment_info Product.fulfillment_info}
|
853
|
+
#
|
854
|
+
# If a full overwrite of inventory information while ignoring timestamps is
|
855
|
+
# needed,
|
856
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#update_product ProductService.UpdateProduct}
|
857
|
+
# should be invoked instead.
|
858
|
+
# @param set_mask [::Google::Protobuf::FieldMask, ::Hash]
|
859
|
+
# Indicates which inventory fields in the provided
|
860
|
+
# {::Google::Cloud::Retail::V2::Product Product} to update.
|
861
|
+
#
|
862
|
+
# At least one field must be provided.
|
863
|
+
#
|
864
|
+
# If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
|
865
|
+
# is returned and the entire update will be ignored.
|
866
|
+
# @param set_time [::Google::Protobuf::Timestamp, ::Hash]
|
867
|
+
# The time when the request is issued, used to prevent
|
868
|
+
# out-of-order updates on inventory fields with the last update time
|
869
|
+
# recorded. If not provided, the internal system time will be used.
|
870
|
+
# @param allow_missing [::Boolean]
|
871
|
+
# If set to true, and the {::Google::Cloud::Retail::V2::Product Product} with name
|
872
|
+
# {::Google::Cloud::Retail::V2::Product#name Product.name} is not found, the
|
873
|
+
# inventory update will still be processed and retained for at most 1 day
|
874
|
+
# until the {::Google::Cloud::Retail::V2::Product Product} is created. If set to
|
875
|
+
# false, a NOT_FOUND error is returned if the
|
876
|
+
# {::Google::Cloud::Retail::V2::Product Product} is not found.
|
877
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
878
|
+
# @yieldparam result [::Gapic::Operation]
|
879
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
880
|
+
#
|
881
|
+
# @return [::Gapic::Operation]
|
882
|
+
#
|
883
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
884
|
+
def set_inventory request, options = nil
|
885
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
886
|
+
|
887
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::SetInventoryRequest
|
888
|
+
|
889
|
+
# Converts hash and nil to an options object
|
890
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
891
|
+
|
892
|
+
# Customize the options with defaults
|
893
|
+
call_metadata = @config.rpcs.set_inventory.metadata.to_h
|
894
|
+
|
895
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
896
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
897
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
898
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION,
|
899
|
+
transports_version_send: [:rest]
|
900
|
+
|
901
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
902
|
+
|
903
|
+
options.apply_defaults timeout: @config.rpcs.set_inventory.timeout,
|
904
|
+
metadata: call_metadata,
|
905
|
+
retry_policy: @config.rpcs.set_inventory.retry_policy
|
906
|
+
|
907
|
+
options.apply_defaults timeout: @config.timeout,
|
908
|
+
metadata: @config.metadata,
|
909
|
+
retry_policy: @config.retry_policy
|
910
|
+
|
911
|
+
@product_service_stub.set_inventory request, options do |result, operation|
|
912
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
913
|
+
yield result, operation if block_given?
|
914
|
+
return result
|
915
|
+
end
|
916
|
+
rescue ::Gapic::Rest::Error => e
|
917
|
+
raise ::Google::Cloud::Error.from_error(e)
|
918
|
+
end
|
919
|
+
|
920
|
+
##
|
921
|
+
# Incrementally adds place IDs to
|
922
|
+
# {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids Product.fulfillment_info.place_ids}.
|
923
|
+
#
|
924
|
+
# This process is asynchronous and does not require the
|
925
|
+
# {::Google::Cloud::Retail::V2::Product Product} to exist before updating
|
926
|
+
# fulfillment information. If the request is valid, the update will be
|
927
|
+
# enqueued and processed downstream. As a consequence, when a response is
|
928
|
+
# returned, the added place IDs are not immediately manifested in the
|
929
|
+
# {::Google::Cloud::Retail::V2::Product Product} queried by
|
930
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#get_product ProductService.GetProduct}
|
931
|
+
# or
|
932
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts}.
|
933
|
+
#
|
934
|
+
# The returned {::Google::Longrunning::Operation Operation}s will be obsolete
|
935
|
+
# after 1 day, and GetOperation
|
936
|
+
# API will return NOT_FOUND afterwards.
|
937
|
+
#
|
938
|
+
# If conflicting updates are issued, the
|
939
|
+
# {::Google::Longrunning::Operation Operation}s associated with the stale
|
940
|
+
# updates will not be marked as {::Google::Longrunning::Operation#done done}
|
941
|
+
# until being obsolete.
|
942
|
+
#
|
943
|
+
# This feature is only available for users who have Retail Search enabled.
|
944
|
+
# Enable Retail Search on Cloud Console before using this feature.
|
945
|
+
#
|
946
|
+
# @overload add_fulfillment_places(request, options = nil)
|
947
|
+
# Pass arguments to `add_fulfillment_places` via a request object, either of type
|
948
|
+
# {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest} or an equivalent Hash.
|
949
|
+
#
|
950
|
+
# @param request [::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest, ::Hash]
|
951
|
+
# A request object representing the call parameters. Required. To specify no
|
952
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
953
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
954
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
955
|
+
#
|
956
|
+
# @overload add_fulfillment_places(product: nil, type: nil, place_ids: nil, add_time: nil, allow_missing: nil)
|
957
|
+
# Pass arguments to `add_fulfillment_places` via keyword arguments. Note that at
|
958
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
959
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
960
|
+
#
|
961
|
+
# @param product [::String]
|
962
|
+
# Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product},
|
963
|
+
# such as
|
964
|
+
# `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
|
965
|
+
#
|
966
|
+
# If the caller does not have permission to access the
|
967
|
+
# {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it
|
968
|
+
# exists, a PERMISSION_DENIED error is returned.
|
969
|
+
# @param type [::String]
|
970
|
+
# Required. The fulfillment type, including commonly used types (such as
|
971
|
+
# pickup in store and same day delivery), and custom types.
|
972
|
+
#
|
973
|
+
# Supported values:
|
974
|
+
#
|
975
|
+
# * "pickup-in-store"
|
976
|
+
# * "ship-to-store"
|
977
|
+
# * "same-day-delivery"
|
978
|
+
# * "next-day-delivery"
|
979
|
+
# * "custom-type-1"
|
980
|
+
# * "custom-type-2"
|
981
|
+
# * "custom-type-3"
|
982
|
+
# * "custom-type-4"
|
983
|
+
# * "custom-type-5"
|
984
|
+
#
|
985
|
+
# If this field is set to an invalid value other than these, an
|
986
|
+
# INVALID_ARGUMENT error is returned.
|
987
|
+
#
|
988
|
+
# This field directly corresponds to
|
989
|
+
# {::Google::Cloud::Retail::V2::FulfillmentInfo#type Product.fulfillment_info.type}.
|
990
|
+
# @param place_ids [::Array<::String>]
|
991
|
+
# Required. The IDs for this
|
992
|
+
# {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type}, such as
|
993
|
+
# the store IDs for "pickup-in-store" or the region IDs for
|
994
|
+
# "same-day-delivery" to be added for this
|
995
|
+
# {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type}. Duplicate
|
996
|
+
# IDs will be automatically ignored.
|
997
|
+
#
|
998
|
+
# At least 1 value is required, and a maximum of 2000 values are allowed.
|
999
|
+
# Each value must be a string with a length limit of 10 characters, matching
|
1000
|
+
# the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an
|
1001
|
+
# INVALID_ARGUMENT error is returned.
|
1002
|
+
#
|
1003
|
+
# If the total number of place IDs exceeds 2000 for this
|
1004
|
+
# {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type} after
|
1005
|
+
# adding, then the update will be rejected.
|
1006
|
+
# @param add_time [::Google::Protobuf::Timestamp, ::Hash]
|
1007
|
+
# The time when the fulfillment updates are issued, used to prevent
|
1008
|
+
# out-of-order updates on fulfillment information. If not provided, the
|
1009
|
+
# internal system time will be used.
|
1010
|
+
# @param allow_missing [::Boolean]
|
1011
|
+
# If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not
|
1012
|
+
# found, the fulfillment information will still be processed and retained for
|
1013
|
+
# at most 1 day and processed once the
|
1014
|
+
# {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, a
|
1015
|
+
# NOT_FOUND error is returned if the
|
1016
|
+
# {::Google::Cloud::Retail::V2::Product Product} is not found.
|
1017
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1018
|
+
# @yieldparam result [::Gapic::Operation]
|
1019
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1020
|
+
#
|
1021
|
+
# @return [::Gapic::Operation]
|
1022
|
+
#
|
1023
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1024
|
+
def add_fulfillment_places request, options = nil
|
1025
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1026
|
+
|
1027
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest
|
1028
|
+
|
1029
|
+
# Converts hash and nil to an options object
|
1030
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1031
|
+
|
1032
|
+
# Customize the options with defaults
|
1033
|
+
call_metadata = @config.rpcs.add_fulfillment_places.metadata.to_h
|
1034
|
+
|
1035
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1036
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1037
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1038
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION,
|
1039
|
+
transports_version_send: [:rest]
|
1040
|
+
|
1041
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1042
|
+
|
1043
|
+
options.apply_defaults timeout: @config.rpcs.add_fulfillment_places.timeout,
|
1044
|
+
metadata: call_metadata,
|
1045
|
+
retry_policy: @config.rpcs.add_fulfillment_places.retry_policy
|
1046
|
+
|
1047
|
+
options.apply_defaults timeout: @config.timeout,
|
1048
|
+
metadata: @config.metadata,
|
1049
|
+
retry_policy: @config.retry_policy
|
1050
|
+
|
1051
|
+
@product_service_stub.add_fulfillment_places request, options do |result, operation|
|
1052
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
1053
|
+
yield result, operation if block_given?
|
1054
|
+
return result
|
1055
|
+
end
|
1056
|
+
rescue ::Gapic::Rest::Error => e
|
1057
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1058
|
+
end
|
1059
|
+
|
1060
|
+
##
|
1061
|
+
# Incrementally removes place IDs from a
|
1062
|
+
# {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids Product.fulfillment_info.place_ids}.
|
1063
|
+
#
|
1064
|
+
# This process is asynchronous and does not require the
|
1065
|
+
# {::Google::Cloud::Retail::V2::Product Product} to exist before updating
|
1066
|
+
# fulfillment information. If the request is valid, the update will be
|
1067
|
+
# enqueued and processed downstream. As a consequence, when a response is
|
1068
|
+
# returned, the removed place IDs are not immediately manifested in the
|
1069
|
+
# {::Google::Cloud::Retail::V2::Product Product} queried by
|
1070
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#get_product ProductService.GetProduct}
|
1071
|
+
# or
|
1072
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts}.
|
1073
|
+
#
|
1074
|
+
# The returned {::Google::Longrunning::Operation Operation}s will be obsolete
|
1075
|
+
# after 1 day, and GetOperation
|
1076
|
+
# API will return NOT_FOUND afterwards.
|
1077
|
+
#
|
1078
|
+
# If conflicting updates are issued, the
|
1079
|
+
# {::Google::Longrunning::Operation Operation}s associated with the stale
|
1080
|
+
# updates will not be marked as {::Google::Longrunning::Operation#done done}
|
1081
|
+
# until being obsolete.
|
1082
|
+
#
|
1083
|
+
# This feature is only available for users who have Retail Search enabled.
|
1084
|
+
# Enable Retail Search on Cloud Console before using this feature.
|
1085
|
+
#
|
1086
|
+
# @overload remove_fulfillment_places(request, options = nil)
|
1087
|
+
# Pass arguments to `remove_fulfillment_places` via a request object, either of type
|
1088
|
+
# {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest} or an equivalent Hash.
|
1089
|
+
#
|
1090
|
+
# @param request [::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest, ::Hash]
|
1091
|
+
# A request object representing the call parameters. Required. To specify no
|
1092
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1093
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1094
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1095
|
+
#
|
1096
|
+
# @overload remove_fulfillment_places(product: nil, type: nil, place_ids: nil, remove_time: nil, allow_missing: nil)
|
1097
|
+
# Pass arguments to `remove_fulfillment_places` via keyword arguments. Note that at
|
1098
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1099
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1100
|
+
#
|
1101
|
+
# @param product [::String]
|
1102
|
+
# Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product},
|
1103
|
+
# such as
|
1104
|
+
# `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
|
1105
|
+
#
|
1106
|
+
# If the caller does not have permission to access the
|
1107
|
+
# {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it
|
1108
|
+
# exists, a PERMISSION_DENIED error is returned.
|
1109
|
+
# @param type [::String]
|
1110
|
+
# Required. The fulfillment type, including commonly used types (such as
|
1111
|
+
# pickup in store and same day delivery), and custom types.
|
1112
|
+
#
|
1113
|
+
# Supported values:
|
1114
|
+
#
|
1115
|
+
# * "pickup-in-store"
|
1116
|
+
# * "ship-to-store"
|
1117
|
+
# * "same-day-delivery"
|
1118
|
+
# * "next-day-delivery"
|
1119
|
+
# * "custom-type-1"
|
1120
|
+
# * "custom-type-2"
|
1121
|
+
# * "custom-type-3"
|
1122
|
+
# * "custom-type-4"
|
1123
|
+
# * "custom-type-5"
|
1124
|
+
#
|
1125
|
+
# If this field is set to an invalid value other than these, an
|
1126
|
+
# INVALID_ARGUMENT error is returned.
|
1127
|
+
#
|
1128
|
+
# This field directly corresponds to
|
1129
|
+
# {::Google::Cloud::Retail::V2::FulfillmentInfo#type Product.fulfillment_info.type}.
|
1130
|
+
# @param place_ids [::Array<::String>]
|
1131
|
+
# Required. The IDs for this
|
1132
|
+
# {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest#type type}, such as
|
1133
|
+
# the store IDs for "pickup-in-store" or the region IDs for
|
1134
|
+
# "same-day-delivery", to be removed for this
|
1135
|
+
# {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest#type type}.
|
1136
|
+
#
|
1137
|
+
# At least 1 value is required, and a maximum of 2000 values are allowed.
|
1138
|
+
# Each value must be a string with a length limit of 10 characters, matching
|
1139
|
+
# the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an
|
1140
|
+
# INVALID_ARGUMENT error is returned.
|
1141
|
+
# @param remove_time [::Google::Protobuf::Timestamp, ::Hash]
|
1142
|
+
# The time when the fulfillment updates are issued, used to prevent
|
1143
|
+
# out-of-order updates on fulfillment information. If not provided, the
|
1144
|
+
# internal system time will be used.
|
1145
|
+
# @param allow_missing [::Boolean]
|
1146
|
+
# If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not
|
1147
|
+
# found, the fulfillment information will still be processed and retained for
|
1148
|
+
# at most 1 day and processed once the
|
1149
|
+
# {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, a
|
1150
|
+
# NOT_FOUND error is returned if the
|
1151
|
+
# {::Google::Cloud::Retail::V2::Product Product} is not found.
|
1152
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1153
|
+
# @yieldparam result [::Gapic::Operation]
|
1154
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1155
|
+
#
|
1156
|
+
# @return [::Gapic::Operation]
|
1157
|
+
#
|
1158
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1159
|
+
def remove_fulfillment_places request, options = nil
|
1160
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1161
|
+
|
1162
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest
|
1163
|
+
|
1164
|
+
# Converts hash and nil to an options object
|
1165
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1166
|
+
|
1167
|
+
# Customize the options with defaults
|
1168
|
+
call_metadata = @config.rpcs.remove_fulfillment_places.metadata.to_h
|
1169
|
+
|
1170
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1171
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1172
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1173
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION,
|
1174
|
+
transports_version_send: [:rest]
|
1175
|
+
|
1176
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1177
|
+
|
1178
|
+
options.apply_defaults timeout: @config.rpcs.remove_fulfillment_places.timeout,
|
1179
|
+
metadata: call_metadata,
|
1180
|
+
retry_policy: @config.rpcs.remove_fulfillment_places.retry_policy
|
1181
|
+
|
1182
|
+
options.apply_defaults timeout: @config.timeout,
|
1183
|
+
metadata: @config.metadata,
|
1184
|
+
retry_policy: @config.retry_policy
|
1185
|
+
|
1186
|
+
@product_service_stub.remove_fulfillment_places request, options do |result, operation|
|
1187
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
1188
|
+
yield result, operation if block_given?
|
1189
|
+
return result
|
1190
|
+
end
|
1191
|
+
rescue ::Gapic::Rest::Error => e
|
1192
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1193
|
+
end
|
1194
|
+
|
1195
|
+
##
|
1196
|
+
# Updates local inventory information for a
|
1197
|
+
# {::Google::Cloud::Retail::V2::Product Product} at a list of places, while
|
1198
|
+
# respecting the last update timestamps of each inventory field.
|
1199
|
+
#
|
1200
|
+
# This process is asynchronous and does not require the
|
1201
|
+
# {::Google::Cloud::Retail::V2::Product Product} to exist before updating
|
1202
|
+
# inventory information. If the request is valid, the update will be enqueued
|
1203
|
+
# and processed downstream. As a consequence, when a response is returned,
|
1204
|
+
# updates are not immediately manifested in the
|
1205
|
+
# {::Google::Cloud::Retail::V2::Product Product} queried by
|
1206
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#get_product ProductService.GetProduct}
|
1207
|
+
# or
|
1208
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts}.
|
1209
|
+
#
|
1210
|
+
# Local inventory information can only be modified using this method.
|
1211
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#create_product ProductService.CreateProduct}
|
1212
|
+
# and
|
1213
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#update_product ProductService.UpdateProduct}
|
1214
|
+
# has no effect on local inventories.
|
1215
|
+
#
|
1216
|
+
# The returned {::Google::Longrunning::Operation Operation}s will be obsolete
|
1217
|
+
# after 1 day, and GetOperation
|
1218
|
+
# API will return NOT_FOUND afterwards.
|
1219
|
+
#
|
1220
|
+
# If conflicting updates are issued, the
|
1221
|
+
# {::Google::Longrunning::Operation Operation}s associated with the stale
|
1222
|
+
# updates will not be marked as {::Google::Longrunning::Operation#done done}
|
1223
|
+
# until being obsolete.
|
1224
|
+
#
|
1225
|
+
# This feature is only available for users who have Retail Search enabled.
|
1226
|
+
# Enable Retail Search on Cloud Console before using this feature.
|
1227
|
+
#
|
1228
|
+
# @overload add_local_inventories(request, options = nil)
|
1229
|
+
# Pass arguments to `add_local_inventories` via a request object, either of type
|
1230
|
+
# {::Google::Cloud::Retail::V2::AddLocalInventoriesRequest} or an equivalent Hash.
|
1231
|
+
#
|
1232
|
+
# @param request [::Google::Cloud::Retail::V2::AddLocalInventoriesRequest, ::Hash]
|
1233
|
+
# A request object representing the call parameters. Required. To specify no
|
1234
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1235
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1236
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1237
|
+
#
|
1238
|
+
# @overload add_local_inventories(product: nil, local_inventories: nil, add_mask: nil, add_time: nil, allow_missing: nil)
|
1239
|
+
# Pass arguments to `add_local_inventories` via keyword arguments. Note that at
|
1240
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1241
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1242
|
+
#
|
1243
|
+
# @param product [::String]
|
1244
|
+
# Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product},
|
1245
|
+
# such as
|
1246
|
+
# `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
|
1247
|
+
#
|
1248
|
+
# If the caller does not have permission to access the
|
1249
|
+
# {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it
|
1250
|
+
# exists, a PERMISSION_DENIED error is returned.
|
1251
|
+
# @param local_inventories [::Array<::Google::Cloud::Retail::V2::LocalInventory, ::Hash>]
|
1252
|
+
# Required. A list of inventory information at difference places. Each place
|
1253
|
+
# is identified by its place ID. At most 3000 inventories are allowed per
|
1254
|
+
# request.
|
1255
|
+
# @param add_mask [::Google::Protobuf::FieldMask, ::Hash]
|
1256
|
+
# Indicates which inventory fields in the provided list of
|
1257
|
+
# {::Google::Cloud::Retail::V2::LocalInventory LocalInventory} to update. The
|
1258
|
+
# field is updated to the provided value.
|
1259
|
+
#
|
1260
|
+
# If a field is set while the place does not have a previous local inventory,
|
1261
|
+
# the local inventory at that store is created.
|
1262
|
+
#
|
1263
|
+
# If a field is set while the value of that field is not provided, the
|
1264
|
+
# original field value, if it exists, is deleted.
|
1265
|
+
#
|
1266
|
+
# If the mask is not set or set with empty paths, all inventory fields will
|
1267
|
+
# be updated.
|
1268
|
+
#
|
1269
|
+
# If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
|
1270
|
+
# is returned and the entire update will be ignored.
|
1271
|
+
# @param add_time [::Google::Protobuf::Timestamp, ::Hash]
|
1272
|
+
# The time when the inventory updates are issued. Used to prevent
|
1273
|
+
# out-of-order updates on local inventory fields. If not provided, the
|
1274
|
+
# internal system time will be used.
|
1275
|
+
# @param allow_missing [::Boolean]
|
1276
|
+
# If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not
|
1277
|
+
# found, the local inventory will still be processed and retained for at most
|
1278
|
+
# 1 day and processed once the {::Google::Cloud::Retail::V2::Product Product} is
|
1279
|
+
# created. If set to false, a NOT_FOUND error is returned if the
|
1280
|
+
# {::Google::Cloud::Retail::V2::Product Product} is not found.
|
1281
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1282
|
+
# @yieldparam result [::Gapic::Operation]
|
1283
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1284
|
+
#
|
1285
|
+
# @return [::Gapic::Operation]
|
1286
|
+
#
|
1287
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1288
|
+
def add_local_inventories request, options = nil
|
1289
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1290
|
+
|
1291
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddLocalInventoriesRequest
|
1292
|
+
|
1293
|
+
# Converts hash and nil to an options object
|
1294
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1295
|
+
|
1296
|
+
# Customize the options with defaults
|
1297
|
+
call_metadata = @config.rpcs.add_local_inventories.metadata.to_h
|
1298
|
+
|
1299
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1300
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1301
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1302
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION,
|
1303
|
+
transports_version_send: [:rest]
|
1304
|
+
|
1305
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1306
|
+
|
1307
|
+
options.apply_defaults timeout: @config.rpcs.add_local_inventories.timeout,
|
1308
|
+
metadata: call_metadata,
|
1309
|
+
retry_policy: @config.rpcs.add_local_inventories.retry_policy
|
1310
|
+
|
1311
|
+
options.apply_defaults timeout: @config.timeout,
|
1312
|
+
metadata: @config.metadata,
|
1313
|
+
retry_policy: @config.retry_policy
|
1314
|
+
|
1315
|
+
@product_service_stub.add_local_inventories request, options do |result, operation|
|
1316
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
1317
|
+
yield result, operation if block_given?
|
1318
|
+
return result
|
1319
|
+
end
|
1320
|
+
rescue ::Gapic::Rest::Error => e
|
1321
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1322
|
+
end
|
1323
|
+
|
1324
|
+
##
|
1325
|
+
# Remove local inventory information for a
|
1326
|
+
# {::Google::Cloud::Retail::V2::Product Product} at a list of places at a removal
|
1327
|
+
# timestamp.
|
1328
|
+
#
|
1329
|
+
# This process is asynchronous. If the request is valid, the removal will be
|
1330
|
+
# enqueued and processed downstream. As a consequence, when a response is
|
1331
|
+
# returned, removals are not immediately manifested in the
|
1332
|
+
# {::Google::Cloud::Retail::V2::Product Product} queried by
|
1333
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#get_product ProductService.GetProduct}
|
1334
|
+
# or
|
1335
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts}.
|
1336
|
+
#
|
1337
|
+
# Local inventory information can only be removed using this method.
|
1338
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#create_product ProductService.CreateProduct}
|
1339
|
+
# and
|
1340
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client#update_product ProductService.UpdateProduct}
|
1341
|
+
# has no effect on local inventories.
|
1342
|
+
#
|
1343
|
+
# The returned {::Google::Longrunning::Operation Operation}s will be obsolete
|
1344
|
+
# after 1 day, and GetOperation
|
1345
|
+
# API will return NOT_FOUND afterwards.
|
1346
|
+
#
|
1347
|
+
# If conflicting updates are issued, the
|
1348
|
+
# {::Google::Longrunning::Operation Operation}s associated with the stale
|
1349
|
+
# updates will not be marked as {::Google::Longrunning::Operation#done done}
|
1350
|
+
# until being obsolete.
|
1351
|
+
#
|
1352
|
+
# This feature is only available for users who have Retail Search enabled.
|
1353
|
+
# Enable Retail Search on Cloud Console before using this feature.
|
1354
|
+
#
|
1355
|
+
# @overload remove_local_inventories(request, options = nil)
|
1356
|
+
# Pass arguments to `remove_local_inventories` via a request object, either of type
|
1357
|
+
# {::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest} or an equivalent Hash.
|
1358
|
+
#
|
1359
|
+
# @param request [::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest, ::Hash]
|
1360
|
+
# A request object representing the call parameters. Required. To specify no
|
1361
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1362
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1363
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1364
|
+
#
|
1365
|
+
# @overload remove_local_inventories(product: nil, place_ids: nil, remove_time: nil, allow_missing: nil)
|
1366
|
+
# Pass arguments to `remove_local_inventories` via keyword arguments. Note that at
|
1367
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1368
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1369
|
+
#
|
1370
|
+
# @param product [::String]
|
1371
|
+
# Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product},
|
1372
|
+
# such as
|
1373
|
+
# `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
|
1374
|
+
#
|
1375
|
+
# If the caller does not have permission to access the
|
1376
|
+
# {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it
|
1377
|
+
# exists, a PERMISSION_DENIED error is returned.
|
1378
|
+
# @param place_ids [::Array<::String>]
|
1379
|
+
# Required. A list of place IDs to have their inventory deleted.
|
1380
|
+
# At most 3000 place IDs are allowed per request.
|
1381
|
+
# @param remove_time [::Google::Protobuf::Timestamp, ::Hash]
|
1382
|
+
# The time when the inventory deletions are issued. Used to prevent
|
1383
|
+
# out-of-order updates and deletions on local inventory fields. If not
|
1384
|
+
# provided, the internal system time will be used.
|
1385
|
+
# @param allow_missing [::Boolean]
|
1386
|
+
# If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not
|
1387
|
+
# found, the local inventory removal request will still be processed and
|
1388
|
+
# retained for at most 1 day and processed once the
|
1389
|
+
# {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, a
|
1390
|
+
# NOT_FOUND error is returned if the
|
1391
|
+
# {::Google::Cloud::Retail::V2::Product Product} is not found.
|
1392
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1393
|
+
# @yieldparam result [::Gapic::Operation]
|
1394
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1395
|
+
#
|
1396
|
+
# @return [::Gapic::Operation]
|
1397
|
+
#
|
1398
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1399
|
+
def remove_local_inventories request, options = nil
|
1400
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1401
|
+
|
1402
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest
|
1403
|
+
|
1404
|
+
# Converts hash and nil to an options object
|
1405
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1406
|
+
|
1407
|
+
# Customize the options with defaults
|
1408
|
+
call_metadata = @config.rpcs.remove_local_inventories.metadata.to_h
|
1409
|
+
|
1410
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1411
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1412
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1413
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION,
|
1414
|
+
transports_version_send: [:rest]
|
1415
|
+
|
1416
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1417
|
+
|
1418
|
+
options.apply_defaults timeout: @config.rpcs.remove_local_inventories.timeout,
|
1419
|
+
metadata: call_metadata,
|
1420
|
+
retry_policy: @config.rpcs.remove_local_inventories.retry_policy
|
1421
|
+
|
1422
|
+
options.apply_defaults timeout: @config.timeout,
|
1423
|
+
metadata: @config.metadata,
|
1424
|
+
retry_policy: @config.retry_policy
|
1425
|
+
|
1426
|
+
@product_service_stub.remove_local_inventories request, options do |result, operation|
|
1427
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
1428
|
+
yield result, operation if block_given?
|
1429
|
+
return result
|
1430
|
+
end
|
1431
|
+
rescue ::Gapic::Rest::Error => e
|
1432
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1433
|
+
end
|
1434
|
+
|
1435
|
+
##
|
1436
|
+
# Configuration class for the ProductService REST API.
|
1437
|
+
#
|
1438
|
+
# This class represents the configuration for ProductService REST,
|
1439
|
+
# providing control over timeouts, retry behavior, logging, transport
|
1440
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
1441
|
+
# applied individually to specific RPCs. See
|
1442
|
+
# {::Google::Cloud::Retail::V2::ProductService::Rest::Client::Configuration::Rpcs}
|
1443
|
+
# for a list of RPCs that can be configured independently.
|
1444
|
+
#
|
1445
|
+
# Configuration can be applied globally to all clients, or to a single client
|
1446
|
+
# on construction.
|
1447
|
+
#
|
1448
|
+
# @example
|
1449
|
+
#
|
1450
|
+
# # Modify the global config, setting the timeout for
|
1451
|
+
# # create_product to 20 seconds,
|
1452
|
+
# # and all remaining timeouts to 10 seconds.
|
1453
|
+
# ::Google::Cloud::Retail::V2::ProductService::Rest::Client.configure do |config|
|
1454
|
+
# config.timeout = 10.0
|
1455
|
+
# config.rpcs.create_product.timeout = 20.0
|
1456
|
+
# end
|
1457
|
+
#
|
1458
|
+
# # Apply the above configuration only to a new client.
|
1459
|
+
# client = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config|
|
1460
|
+
# config.timeout = 10.0
|
1461
|
+
# config.rpcs.create_product.timeout = 20.0
|
1462
|
+
# end
|
1463
|
+
#
|
1464
|
+
# @!attribute [rw] endpoint
|
1465
|
+
# The hostname or hostname:port of the service endpoint.
|
1466
|
+
# Defaults to `"retail.googleapis.com"`.
|
1467
|
+
# @return [::String]
|
1468
|
+
# @!attribute [rw] credentials
|
1469
|
+
# Credentials to send with calls. You may provide any of the following types:
|
1470
|
+
# * (`String`) The path to a service account key file in JSON format
|
1471
|
+
# * (`Hash`) A service account key as a Hash
|
1472
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
1473
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
1474
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
1475
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
1476
|
+
# * (`nil`) indicating no credentials
|
1477
|
+
# @return [::Object]
|
1478
|
+
# @!attribute [rw] scope
|
1479
|
+
# The OAuth scopes
|
1480
|
+
# @return [::Array<::String>]
|
1481
|
+
# @!attribute [rw] lib_name
|
1482
|
+
# The library name as recorded in instrumentation and logging
|
1483
|
+
# @return [::String]
|
1484
|
+
# @!attribute [rw] lib_version
|
1485
|
+
# The library version as recorded in instrumentation and logging
|
1486
|
+
# @return [::String]
|
1487
|
+
# @!attribute [rw] timeout
|
1488
|
+
# The call timeout in seconds.
|
1489
|
+
# @return [::Numeric]
|
1490
|
+
# @!attribute [rw] metadata
|
1491
|
+
# Additional headers to be sent with the call.
|
1492
|
+
# @return [::Hash{::Symbol=>::String}]
|
1493
|
+
# @!attribute [rw] retry_policy
|
1494
|
+
# The retry policy. The value is a hash with the following keys:
|
1495
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1496
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1497
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1498
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1499
|
+
# trigger a retry.
|
1500
|
+
# @return [::Hash]
|
1501
|
+
# @!attribute [rw] quota_project
|
1502
|
+
# A separate project against which to charge quota.
|
1503
|
+
# @return [::String]
|
1504
|
+
#
|
1505
|
+
class Configuration
|
1506
|
+
extend ::Gapic::Config
|
1507
|
+
|
1508
|
+
config_attr :endpoint, "retail.googleapis.com", ::String
|
1509
|
+
config_attr :credentials, nil do |value|
|
1510
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
1511
|
+
allowed.any? { |klass| klass === value }
|
1512
|
+
end
|
1513
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
1514
|
+
config_attr :lib_name, nil, ::String, nil
|
1515
|
+
config_attr :lib_version, nil, ::String, nil
|
1516
|
+
config_attr :timeout, nil, ::Numeric, nil
|
1517
|
+
config_attr :metadata, nil, ::Hash, nil
|
1518
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
1519
|
+
config_attr :quota_project, nil, ::String, nil
|
1520
|
+
|
1521
|
+
# @private
|
1522
|
+
def initialize parent_config = nil
|
1523
|
+
@parent_config = parent_config unless parent_config.nil?
|
1524
|
+
|
1525
|
+
yield self if block_given?
|
1526
|
+
end
|
1527
|
+
|
1528
|
+
##
|
1529
|
+
# Configurations for individual RPCs
|
1530
|
+
# @return [Rpcs]
|
1531
|
+
#
|
1532
|
+
def rpcs
|
1533
|
+
@rpcs ||= begin
|
1534
|
+
parent_rpcs = nil
|
1535
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
1536
|
+
Rpcs.new parent_rpcs
|
1537
|
+
end
|
1538
|
+
end
|
1539
|
+
|
1540
|
+
##
|
1541
|
+
# Configuration RPC class for the ProductService API.
|
1542
|
+
#
|
1543
|
+
# Includes fields providing the configuration for each RPC in this service.
|
1544
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
1545
|
+
# the following configuration fields:
|
1546
|
+
#
|
1547
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
1548
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
1549
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
1550
|
+
# include the following keys:
|
1551
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1552
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1553
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1554
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1555
|
+
# trigger a retry.
|
1556
|
+
#
|
1557
|
+
class Rpcs
|
1558
|
+
##
|
1559
|
+
# RPC-specific configuration for `create_product`
|
1560
|
+
# @return [::Gapic::Config::Method]
|
1561
|
+
#
|
1562
|
+
attr_reader :create_product
|
1563
|
+
##
|
1564
|
+
# RPC-specific configuration for `get_product`
|
1565
|
+
# @return [::Gapic::Config::Method]
|
1566
|
+
#
|
1567
|
+
attr_reader :get_product
|
1568
|
+
##
|
1569
|
+
# RPC-specific configuration for `list_products`
|
1570
|
+
# @return [::Gapic::Config::Method]
|
1571
|
+
#
|
1572
|
+
attr_reader :list_products
|
1573
|
+
##
|
1574
|
+
# RPC-specific configuration for `update_product`
|
1575
|
+
# @return [::Gapic::Config::Method]
|
1576
|
+
#
|
1577
|
+
attr_reader :update_product
|
1578
|
+
##
|
1579
|
+
# RPC-specific configuration for `delete_product`
|
1580
|
+
# @return [::Gapic::Config::Method]
|
1581
|
+
#
|
1582
|
+
attr_reader :delete_product
|
1583
|
+
##
|
1584
|
+
# RPC-specific configuration for `import_products`
|
1585
|
+
# @return [::Gapic::Config::Method]
|
1586
|
+
#
|
1587
|
+
attr_reader :import_products
|
1588
|
+
##
|
1589
|
+
# RPC-specific configuration for `set_inventory`
|
1590
|
+
# @return [::Gapic::Config::Method]
|
1591
|
+
#
|
1592
|
+
attr_reader :set_inventory
|
1593
|
+
##
|
1594
|
+
# RPC-specific configuration for `add_fulfillment_places`
|
1595
|
+
# @return [::Gapic::Config::Method]
|
1596
|
+
#
|
1597
|
+
attr_reader :add_fulfillment_places
|
1598
|
+
##
|
1599
|
+
# RPC-specific configuration for `remove_fulfillment_places`
|
1600
|
+
# @return [::Gapic::Config::Method]
|
1601
|
+
#
|
1602
|
+
attr_reader :remove_fulfillment_places
|
1603
|
+
##
|
1604
|
+
# RPC-specific configuration for `add_local_inventories`
|
1605
|
+
# @return [::Gapic::Config::Method]
|
1606
|
+
#
|
1607
|
+
attr_reader :add_local_inventories
|
1608
|
+
##
|
1609
|
+
# RPC-specific configuration for `remove_local_inventories`
|
1610
|
+
# @return [::Gapic::Config::Method]
|
1611
|
+
#
|
1612
|
+
attr_reader :remove_local_inventories
|
1613
|
+
|
1614
|
+
# @private
|
1615
|
+
def initialize parent_rpcs = nil
|
1616
|
+
create_product_config = parent_rpcs.create_product if parent_rpcs.respond_to? :create_product
|
1617
|
+
@create_product = ::Gapic::Config::Method.new create_product_config
|
1618
|
+
get_product_config = parent_rpcs.get_product if parent_rpcs.respond_to? :get_product
|
1619
|
+
@get_product = ::Gapic::Config::Method.new get_product_config
|
1620
|
+
list_products_config = parent_rpcs.list_products if parent_rpcs.respond_to? :list_products
|
1621
|
+
@list_products = ::Gapic::Config::Method.new list_products_config
|
1622
|
+
update_product_config = parent_rpcs.update_product if parent_rpcs.respond_to? :update_product
|
1623
|
+
@update_product = ::Gapic::Config::Method.new update_product_config
|
1624
|
+
delete_product_config = parent_rpcs.delete_product if parent_rpcs.respond_to? :delete_product
|
1625
|
+
@delete_product = ::Gapic::Config::Method.new delete_product_config
|
1626
|
+
import_products_config = parent_rpcs.import_products if parent_rpcs.respond_to? :import_products
|
1627
|
+
@import_products = ::Gapic::Config::Method.new import_products_config
|
1628
|
+
set_inventory_config = parent_rpcs.set_inventory if parent_rpcs.respond_to? :set_inventory
|
1629
|
+
@set_inventory = ::Gapic::Config::Method.new set_inventory_config
|
1630
|
+
add_fulfillment_places_config = parent_rpcs.add_fulfillment_places if parent_rpcs.respond_to? :add_fulfillment_places
|
1631
|
+
@add_fulfillment_places = ::Gapic::Config::Method.new add_fulfillment_places_config
|
1632
|
+
remove_fulfillment_places_config = parent_rpcs.remove_fulfillment_places if parent_rpcs.respond_to? :remove_fulfillment_places
|
1633
|
+
@remove_fulfillment_places = ::Gapic::Config::Method.new remove_fulfillment_places_config
|
1634
|
+
add_local_inventories_config = parent_rpcs.add_local_inventories if parent_rpcs.respond_to? :add_local_inventories
|
1635
|
+
@add_local_inventories = ::Gapic::Config::Method.new add_local_inventories_config
|
1636
|
+
remove_local_inventories_config = parent_rpcs.remove_local_inventories if parent_rpcs.respond_to? :remove_local_inventories
|
1637
|
+
@remove_local_inventories = ::Gapic::Config::Method.new remove_local_inventories_config
|
1638
|
+
|
1639
|
+
yield self if block_given?
|
1640
|
+
end
|
1641
|
+
end
|
1642
|
+
end
|
1643
|
+
end
|
1644
|
+
end
|
1645
|
+
end
|
1646
|
+
end
|
1647
|
+
end
|
1648
|
+
end
|
1649
|
+
end
|