google-cloud-retail-v2 0.13.0 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/retail/v2/catalog_service/rest/client.rb +1220 -0
  4. data/lib/google/cloud/retail/v2/catalog_service/rest/service_stub.rb +704 -0
  5. data/lib/google/cloud/retail/v2/catalog_service/rest.rb +52 -0
  6. data/lib/google/cloud/retail/v2/catalog_service.rb +6 -0
  7. data/lib/google/cloud/retail/v2/completion_service/rest/client.rb +533 -0
  8. data/lib/google/cloud/retail/v2/completion_service/rest/operations.rb +828 -0
  9. data/lib/google/cloud/retail/v2/completion_service/rest/service_stub.rb +167 -0
  10. data/lib/google/cloud/retail/v2/completion_service/rest.rb +56 -0
  11. data/lib/google/cloud/retail/v2/completion_service.rb +6 -0
  12. data/lib/google/cloud/retail/v2/control_service/rest/client.rb +680 -0
  13. data/lib/google/cloud/retail/v2/control_service/rest/service_stub.rb +345 -0
  14. data/lib/google/cloud/retail/v2/control_service/rest.rb +52 -0
  15. data/lib/google/cloud/retail/v2/control_service.rb +6 -0
  16. data/lib/google/cloud/retail/v2/prediction_service/rest/client.rb +486 -0
  17. data/lib/google/cloud/retail/v2/prediction_service/rest/service_stub.rb +116 -0
  18. data/lib/google/cloud/retail/v2/prediction_service/rest.rb +52 -0
  19. data/lib/google/cloud/retail/v2/prediction_service.rb +6 -0
  20. data/lib/google/cloud/retail/v2/product_service/rest/client.rb +1649 -0
  21. data/lib/google/cloud/retail/v2/product_service/rest/operations.rb +828 -0
  22. data/lib/google/cloud/retail/v2/product_service/rest/service_stub.rb +705 -0
  23. data/lib/google/cloud/retail/v2/product_service/rest.rb +54 -0
  24. data/lib/google/cloud/retail/v2/product_service.rb +6 -0
  25. data/lib/google/cloud/retail/v2/rest.rb +44 -0
  26. data/lib/google/cloud/retail/v2/search_service/rest/client.rb +598 -0
  27. data/lib/google/cloud/retail/v2/search_service/rest/service_stub.rb +116 -0
  28. data/lib/google/cloud/retail/v2/search_service/rest.rb +55 -0
  29. data/lib/google/cloud/retail/v2/search_service.rb +6 -0
  30. data/lib/google/cloud/retail/v2/serving_config_service/rest/client.rb +825 -0
  31. data/lib/google/cloud/retail/v2/serving_config_service/rest/service_stub.rb +465 -0
  32. data/lib/google/cloud/retail/v2/serving_config_service/rest.rb +52 -0
  33. data/lib/google/cloud/retail/v2/serving_config_service.rb +6 -0
  34. data/lib/google/cloud/retail/v2/user_event_service/rest/client.rb +755 -0
  35. data/lib/google/cloud/retail/v2/user_event_service/rest/operations.rb +828 -0
  36. data/lib/google/cloud/retail/v2/user_event_service/rest/service_stub.rb +347 -0
  37. data/lib/google/cloud/retail/v2/user_event_service/rest.rb +53 -0
  38. data/lib/google/cloud/retail/v2/user_event_service.rb +6 -0
  39. data/lib/google/cloud/retail/v2/version.rb +1 -1
  40. data/lib/google/cloud/retail/v2.rb +5 -0
  41. metadata +35 -5
@@ -0,0 +1,825 @@
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/serving_config_service_pb"
21
+ require "google/cloud/retail/v2/serving_config_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 ServingConfigService
29
+ module Rest
30
+ ##
31
+ # REST client for the ServingConfigService service.
32
+ #
33
+ # Service for modifying ServingConfig.
34
+ #
35
+ class Client
36
+ include Paths
37
+
38
+ # @private
39
+ attr_reader :serving_config_service_stub
40
+
41
+ ##
42
+ # Configure the ServingConfigService Client class.
43
+ #
44
+ # See {::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client::Configuration}
45
+ # for a description of the configuration fields.
46
+ #
47
+ # @example
48
+ #
49
+ # # Modify the configuration for all ServingConfigService clients
50
+ # ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.configure do |config|
51
+ # config.timeout = 10.0
52
+ # end
53
+ #
54
+ # @yield [config] Configure the Client client.
55
+ # @yieldparam config [Client::Configuration]
56
+ #
57
+ # @return [Client::Configuration]
58
+ #
59
+ def self.configure
60
+ @configure ||= begin
61
+ namespace = ["Google", "Cloud", "Retail", "V2"]
62
+ parent_config = while namespace.any?
63
+ parent_name = namespace.join "::"
64
+ parent_const = const_get parent_name
65
+ break parent_const.configure if parent_const.respond_to? :configure
66
+ namespace.pop
67
+ end
68
+ default_config = Client::Configuration.new parent_config
69
+
70
+ default_config
71
+ end
72
+ yield @configure if block_given?
73
+ @configure
74
+ end
75
+
76
+ ##
77
+ # Configure the ServingConfigService Client instance.
78
+ #
79
+ # The configuration is set to the derived mode, meaning that values can be changed,
80
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
81
+ # should be made on {Client.configure}.
82
+ #
83
+ # See {::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client::Configuration}
84
+ # for a description of the configuration fields.
85
+ #
86
+ # @yield [config] Configure the Client client.
87
+ # @yieldparam config [Client::Configuration]
88
+ #
89
+ # @return [Client::Configuration]
90
+ #
91
+ def configure
92
+ yield @config if block_given?
93
+ @config
94
+ end
95
+
96
+ ##
97
+ # Create a new ServingConfigService REST client object.
98
+ #
99
+ # @example
100
+ #
101
+ # # Create a client using the default configuration
102
+ # client = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new
103
+ #
104
+ # # Create a client using a custom configuration
105
+ # client = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new do |config|
106
+ # config.timeout = 10.0
107
+ # end
108
+ #
109
+ # @yield [config] Configure the ServingConfigService client.
110
+ # @yieldparam config [Client::Configuration]
111
+ #
112
+ def initialize
113
+ # Create the configuration object
114
+ @config = Configuration.new Client.configure
115
+
116
+ # Yield the configuration if needed
117
+ yield @config if block_given?
118
+
119
+ # Create credentials
120
+ credentials = @config.credentials
121
+ # Use self-signed JWT if the endpoint is unchanged from default,
122
+ # but only if the default endpoint does not have a region prefix.
123
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
124
+ !@config.endpoint.split(".").first.include?("-")
125
+ credentials ||= Credentials.default scope: @config.scope,
126
+ enable_self_signed_jwt: enable_self_signed_jwt
127
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
128
+ credentials = Credentials.new credentials, scope: @config.scope
129
+ end
130
+
131
+ @quota_project_id = @config.quota_project
132
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
133
+
134
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
135
+ config.credentials = credentials
136
+ config.quota_project = @quota_project_id
137
+ config.endpoint = @config.endpoint
138
+ end
139
+
140
+ @serving_config_service_stub = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
141
+ end
142
+
143
+ ##
144
+ # Get the associated client for mix-in of the Locations.
145
+ #
146
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
147
+ #
148
+ attr_reader :location_client
149
+
150
+ # Service calls
151
+
152
+ ##
153
+ # Creates a ServingConfig.
154
+ #
155
+ # A maximum of 100 {::Google::Cloud::Retail::V2::ServingConfig ServingConfig}s are
156
+ # allowed in a {::Google::Cloud::Retail::V2::Catalog Catalog}, otherwise a
157
+ # FAILED_PRECONDITION error is returned.
158
+ #
159
+ # @overload create_serving_config(request, options = nil)
160
+ # Pass arguments to `create_serving_config` via a request object, either of type
161
+ # {::Google::Cloud::Retail::V2::CreateServingConfigRequest} or an equivalent Hash.
162
+ #
163
+ # @param request [::Google::Cloud::Retail::V2::CreateServingConfigRequest, ::Hash]
164
+ # A request object representing the call parameters. Required. To specify no
165
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
166
+ # @param options [::Gapic::CallOptions, ::Hash]
167
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
168
+ #
169
+ # @overload create_serving_config(parent: nil, serving_config: nil, serving_config_id: nil)
170
+ # Pass arguments to `create_serving_config` via keyword arguments. Note that at
171
+ # least one keyword argument is required. To specify no parameters, or to keep all
172
+ # the default parameter values, pass an empty Hash as a request object (see above).
173
+ #
174
+ # @param parent [::String]
175
+ # Required. Full resource name of parent. Format:
176
+ # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
177
+ # @param serving_config [::Google::Cloud::Retail::V2::ServingConfig, ::Hash]
178
+ # Required. The ServingConfig to create.
179
+ # @param serving_config_id [::String]
180
+ # Required. The ID to use for the ServingConfig, which will become the final
181
+ # component of the ServingConfig's resource name.
182
+ #
183
+ # This value should be 4-63 characters, and valid characters
184
+ # are /[a-z][0-9]-_/.
185
+ # @yield [result, operation] Access the result along with the TransportOperation object
186
+ # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig]
187
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
188
+ #
189
+ # @return [::Google::Cloud::Retail::V2::ServingConfig]
190
+ #
191
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
192
+ def create_serving_config request, options = nil
193
+ raise ::ArgumentError, "request must be provided" if request.nil?
194
+
195
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CreateServingConfigRequest
196
+
197
+ # Converts hash and nil to an options object
198
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
199
+
200
+ # Customize the options with defaults
201
+ call_metadata = @config.rpcs.create_serving_config.metadata.to_h
202
+
203
+ # Set x-goog-api-client and x-goog-user-project headers
204
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
205
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
206
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION,
207
+ transports_version_send: [:rest]
208
+
209
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
210
+
211
+ options.apply_defaults timeout: @config.rpcs.create_serving_config.timeout,
212
+ metadata: call_metadata,
213
+ retry_policy: @config.rpcs.create_serving_config.retry_policy
214
+
215
+ options.apply_defaults timeout: @config.timeout,
216
+ metadata: @config.metadata,
217
+ retry_policy: @config.retry_policy
218
+
219
+ @serving_config_service_stub.create_serving_config request, options do |result, operation|
220
+ yield result, operation if block_given?
221
+ return result
222
+ end
223
+ rescue ::Gapic::Rest::Error => e
224
+ raise ::Google::Cloud::Error.from_error(e)
225
+ end
226
+
227
+ ##
228
+ # Deletes a ServingConfig.
229
+ #
230
+ # Returns a NotFound error if the ServingConfig does not exist.
231
+ #
232
+ # @overload delete_serving_config(request, options = nil)
233
+ # Pass arguments to `delete_serving_config` via a request object, either of type
234
+ # {::Google::Cloud::Retail::V2::DeleteServingConfigRequest} or an equivalent Hash.
235
+ #
236
+ # @param request [::Google::Cloud::Retail::V2::DeleteServingConfigRequest, ::Hash]
237
+ # A request object representing the call parameters. Required. To specify no
238
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
239
+ # @param options [::Gapic::CallOptions, ::Hash]
240
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
241
+ #
242
+ # @overload delete_serving_config(name: nil)
243
+ # Pass arguments to `delete_serving_config` via keyword arguments. Note that at
244
+ # least one keyword argument is required. To specify no parameters, or to keep all
245
+ # the default parameter values, pass an empty Hash as a request object (see above).
246
+ #
247
+ # @param name [::String]
248
+ # Required. The resource name of the ServingConfig to delete. Format:
249
+ # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
250
+ # @yield [result, operation] Access the result along with the TransportOperation object
251
+ # @yieldparam result [::Google::Protobuf::Empty]
252
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
253
+ #
254
+ # @return [::Google::Protobuf::Empty]
255
+ #
256
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
257
+ def delete_serving_config request, options = nil
258
+ raise ::ArgumentError, "request must be provided" if request.nil?
259
+
260
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::DeleteServingConfigRequest
261
+
262
+ # Converts hash and nil to an options object
263
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
264
+
265
+ # Customize the options with defaults
266
+ call_metadata = @config.rpcs.delete_serving_config.metadata.to_h
267
+
268
+ # Set x-goog-api-client and x-goog-user-project headers
269
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
270
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
271
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION,
272
+ transports_version_send: [:rest]
273
+
274
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
275
+
276
+ options.apply_defaults timeout: @config.rpcs.delete_serving_config.timeout,
277
+ metadata: call_metadata,
278
+ retry_policy: @config.rpcs.delete_serving_config.retry_policy
279
+
280
+ options.apply_defaults timeout: @config.timeout,
281
+ metadata: @config.metadata,
282
+ retry_policy: @config.retry_policy
283
+
284
+ @serving_config_service_stub.delete_serving_config request, options do |result, operation|
285
+ yield result, operation if block_given?
286
+ return result
287
+ end
288
+ rescue ::Gapic::Rest::Error => e
289
+ raise ::Google::Cloud::Error.from_error(e)
290
+ end
291
+
292
+ ##
293
+ # Updates a ServingConfig.
294
+ #
295
+ # @overload update_serving_config(request, options = nil)
296
+ # Pass arguments to `update_serving_config` via a request object, either of type
297
+ # {::Google::Cloud::Retail::V2::UpdateServingConfigRequest} or an equivalent Hash.
298
+ #
299
+ # @param request [::Google::Cloud::Retail::V2::UpdateServingConfigRequest, ::Hash]
300
+ # A request object representing the call parameters. Required. To specify no
301
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
302
+ # @param options [::Gapic::CallOptions, ::Hash]
303
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
304
+ #
305
+ # @overload update_serving_config(serving_config: nil, update_mask: nil)
306
+ # Pass arguments to `update_serving_config` via keyword arguments. Note that at
307
+ # least one keyword argument is required. To specify no parameters, or to keep all
308
+ # the default parameter values, pass an empty Hash as a request object (see above).
309
+ #
310
+ # @param serving_config [::Google::Cloud::Retail::V2::ServingConfig, ::Hash]
311
+ # Required. The ServingConfig to update.
312
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
313
+ # Indicates which fields in the provided
314
+ # {::Google::Cloud::Retail::V2::ServingConfig ServingConfig} to update. The
315
+ # following are NOT supported:
316
+ #
317
+ # * {::Google::Cloud::Retail::V2::ServingConfig#name ServingConfig.name}
318
+ #
319
+ # If not set, all supported fields are updated.
320
+ # @yield [result, operation] Access the result along with the TransportOperation object
321
+ # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig]
322
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
323
+ #
324
+ # @return [::Google::Cloud::Retail::V2::ServingConfig]
325
+ #
326
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
327
+ def update_serving_config request, options = nil
328
+ raise ::ArgumentError, "request must be provided" if request.nil?
329
+
330
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateServingConfigRequest
331
+
332
+ # Converts hash and nil to an options object
333
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
334
+
335
+ # Customize the options with defaults
336
+ call_metadata = @config.rpcs.update_serving_config.metadata.to_h
337
+
338
+ # Set x-goog-api-client and x-goog-user-project headers
339
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
340
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
341
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION,
342
+ transports_version_send: [:rest]
343
+
344
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
345
+
346
+ options.apply_defaults timeout: @config.rpcs.update_serving_config.timeout,
347
+ metadata: call_metadata,
348
+ retry_policy: @config.rpcs.update_serving_config.retry_policy
349
+
350
+ options.apply_defaults timeout: @config.timeout,
351
+ metadata: @config.metadata,
352
+ retry_policy: @config.retry_policy
353
+
354
+ @serving_config_service_stub.update_serving_config request, options do |result, operation|
355
+ yield result, operation if block_given?
356
+ return result
357
+ end
358
+ rescue ::Gapic::Rest::Error => e
359
+ raise ::Google::Cloud::Error.from_error(e)
360
+ end
361
+
362
+ ##
363
+ # Gets a ServingConfig.
364
+ #
365
+ # Returns a NotFound error if the ServingConfig does not exist.
366
+ #
367
+ # @overload get_serving_config(request, options = nil)
368
+ # Pass arguments to `get_serving_config` via a request object, either of type
369
+ # {::Google::Cloud::Retail::V2::GetServingConfigRequest} or an equivalent Hash.
370
+ #
371
+ # @param request [::Google::Cloud::Retail::V2::GetServingConfigRequest, ::Hash]
372
+ # A request object representing the call parameters. Required. To specify no
373
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
374
+ # @param options [::Gapic::CallOptions, ::Hash]
375
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
376
+ #
377
+ # @overload get_serving_config(name: nil)
378
+ # Pass arguments to `get_serving_config` via keyword arguments. Note that at
379
+ # least one keyword argument is required. To specify no parameters, or to keep all
380
+ # the default parameter values, pass an empty Hash as a request object (see above).
381
+ #
382
+ # @param name [::String]
383
+ # Required. The resource name of the ServingConfig to get. Format:
384
+ # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
385
+ # @yield [result, operation] Access the result along with the TransportOperation object
386
+ # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig]
387
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
388
+ #
389
+ # @return [::Google::Cloud::Retail::V2::ServingConfig]
390
+ #
391
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
392
+ def get_serving_config request, options = nil
393
+ raise ::ArgumentError, "request must be provided" if request.nil?
394
+
395
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetServingConfigRequest
396
+
397
+ # Converts hash and nil to an options object
398
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
399
+
400
+ # Customize the options with defaults
401
+ call_metadata = @config.rpcs.get_serving_config.metadata.to_h
402
+
403
+ # Set x-goog-api-client and x-goog-user-project headers
404
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
405
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
406
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION,
407
+ transports_version_send: [:rest]
408
+
409
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
410
+
411
+ options.apply_defaults timeout: @config.rpcs.get_serving_config.timeout,
412
+ metadata: call_metadata,
413
+ retry_policy: @config.rpcs.get_serving_config.retry_policy
414
+
415
+ options.apply_defaults timeout: @config.timeout,
416
+ metadata: @config.metadata,
417
+ retry_policy: @config.retry_policy
418
+
419
+ @serving_config_service_stub.get_serving_config request, options do |result, operation|
420
+ yield result, operation if block_given?
421
+ return result
422
+ end
423
+ rescue ::Gapic::Rest::Error => e
424
+ raise ::Google::Cloud::Error.from_error(e)
425
+ end
426
+
427
+ ##
428
+ # Lists all ServingConfigs linked to this catalog.
429
+ #
430
+ # @overload list_serving_configs(request, options = nil)
431
+ # Pass arguments to `list_serving_configs` via a request object, either of type
432
+ # {::Google::Cloud::Retail::V2::ListServingConfigsRequest} or an equivalent Hash.
433
+ #
434
+ # @param request [::Google::Cloud::Retail::V2::ListServingConfigsRequest, ::Hash]
435
+ # A request object representing the call parameters. Required. To specify no
436
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
437
+ # @param options [::Gapic::CallOptions, ::Hash]
438
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
439
+ #
440
+ # @overload list_serving_configs(parent: nil, page_size: nil, page_token: nil)
441
+ # Pass arguments to `list_serving_configs` via keyword arguments. Note that at
442
+ # least one keyword argument is required. To specify no parameters, or to keep all
443
+ # the default parameter values, pass an empty Hash as a request object (see above).
444
+ #
445
+ # @param parent [::String]
446
+ # Required. The catalog resource name. Format:
447
+ # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
448
+ # @param page_size [::Integer]
449
+ # Optional. Maximum number of results to return. If unspecified, defaults
450
+ # to 100. If a value greater than 100 is provided, at most 100 results are
451
+ # returned.
452
+ # @param page_token [::String]
453
+ # Optional. A page token, received from a previous `ListServingConfigs` call.
454
+ # Provide this to retrieve the subsequent page.
455
+ # @yield [result, operation] Access the result along with the TransportOperation object
456
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::ServingConfig>]
457
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
458
+ #
459
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::ServingConfig>]
460
+ #
461
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
462
+ def list_serving_configs request, options = nil
463
+ raise ::ArgumentError, "request must be provided" if request.nil?
464
+
465
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListServingConfigsRequest
466
+
467
+ # Converts hash and nil to an options object
468
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
469
+
470
+ # Customize the options with defaults
471
+ call_metadata = @config.rpcs.list_serving_configs.metadata.to_h
472
+
473
+ # Set x-goog-api-client and x-goog-user-project headers
474
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
475
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
476
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION,
477
+ transports_version_send: [:rest]
478
+
479
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
480
+
481
+ options.apply_defaults timeout: @config.rpcs.list_serving_configs.timeout,
482
+ metadata: call_metadata,
483
+ retry_policy: @config.rpcs.list_serving_configs.retry_policy
484
+
485
+ options.apply_defaults timeout: @config.timeout,
486
+ metadata: @config.metadata,
487
+ retry_policy: @config.retry_policy
488
+
489
+ @serving_config_service_stub.list_serving_configs request, options do |result, operation|
490
+ result = ::Gapic::Rest::PagedEnumerable.new @serving_config_service_stub, :list_serving_configs, "serving_configs", request, result, options
491
+ yield result, operation if block_given?
492
+ return result
493
+ end
494
+ rescue ::Gapic::Rest::Error => e
495
+ raise ::Google::Cloud::Error.from_error(e)
496
+ end
497
+
498
+ ##
499
+ # Enables a Control on the specified ServingConfig.
500
+ # The control is added in the last position of the list of controls
501
+ # it belongs to (e.g. if it's a facet spec control it will be applied
502
+ # in the last position of servingConfig.facetSpecIds)
503
+ # Returns a ALREADY_EXISTS error if the control has already been applied.
504
+ # Returns a FAILED_PRECONDITION error if the addition could exceed maximum
505
+ # number of control allowed for that type of control.
506
+ #
507
+ # @overload add_control(request, options = nil)
508
+ # Pass arguments to `add_control` via a request object, either of type
509
+ # {::Google::Cloud::Retail::V2::AddControlRequest} or an equivalent Hash.
510
+ #
511
+ # @param request [::Google::Cloud::Retail::V2::AddControlRequest, ::Hash]
512
+ # A request object representing the call parameters. Required. To specify no
513
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
514
+ # @param options [::Gapic::CallOptions, ::Hash]
515
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
516
+ #
517
+ # @overload add_control(serving_config: nil, control_id: nil)
518
+ # Pass arguments to `add_control` via keyword arguments. Note that at
519
+ # least one keyword argument is required. To specify no parameters, or to keep all
520
+ # the default parameter values, pass an empty Hash as a request object (see above).
521
+ #
522
+ # @param serving_config [::String]
523
+ # Required. The source ServingConfig resource name . Format:
524
+ # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
525
+ # @param control_id [::String]
526
+ # Required. The id of the control to apply. Assumed to be in the same catalog
527
+ # as the serving config - if id is not found a NOT_FOUND error is returned.
528
+ # @yield [result, operation] Access the result along with the TransportOperation object
529
+ # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig]
530
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
531
+ #
532
+ # @return [::Google::Cloud::Retail::V2::ServingConfig]
533
+ #
534
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
535
+ def add_control request, options = nil
536
+ raise ::ArgumentError, "request must be provided" if request.nil?
537
+
538
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddControlRequest
539
+
540
+ # Converts hash and nil to an options object
541
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
542
+
543
+ # Customize the options with defaults
544
+ call_metadata = @config.rpcs.add_control.metadata.to_h
545
+
546
+ # Set x-goog-api-client and x-goog-user-project headers
547
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
548
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
549
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION,
550
+ transports_version_send: [:rest]
551
+
552
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
553
+
554
+ options.apply_defaults timeout: @config.rpcs.add_control.timeout,
555
+ metadata: call_metadata,
556
+ retry_policy: @config.rpcs.add_control.retry_policy
557
+
558
+ options.apply_defaults timeout: @config.timeout,
559
+ metadata: @config.metadata,
560
+ retry_policy: @config.retry_policy
561
+
562
+ @serving_config_service_stub.add_control request, options do |result, operation|
563
+ yield result, operation if block_given?
564
+ return result
565
+ end
566
+ rescue ::Gapic::Rest::Error => e
567
+ raise ::Google::Cloud::Error.from_error(e)
568
+ end
569
+
570
+ ##
571
+ # Disables a Control on the specified ServingConfig.
572
+ # The control is removed from the ServingConfig.
573
+ # Returns a NOT_FOUND error if the Control is not enabled for the
574
+ # ServingConfig.
575
+ #
576
+ # @overload remove_control(request, options = nil)
577
+ # Pass arguments to `remove_control` via a request object, either of type
578
+ # {::Google::Cloud::Retail::V2::RemoveControlRequest} or an equivalent Hash.
579
+ #
580
+ # @param request [::Google::Cloud::Retail::V2::RemoveControlRequest, ::Hash]
581
+ # A request object representing the call parameters. Required. To specify no
582
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
583
+ # @param options [::Gapic::CallOptions, ::Hash]
584
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
585
+ #
586
+ # @overload remove_control(serving_config: nil, control_id: nil)
587
+ # Pass arguments to `remove_control` via keyword arguments. Note that at
588
+ # least one keyword argument is required. To specify no parameters, or to keep all
589
+ # the default parameter values, pass an empty Hash as a request object (see above).
590
+ #
591
+ # @param serving_config [::String]
592
+ # Required. The source ServingConfig resource name . Format:
593
+ # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
594
+ # @param control_id [::String]
595
+ # Required. The id of the control to apply. Assumed to be in the same catalog
596
+ # as the serving config.
597
+ # @yield [result, operation] Access the result along with the TransportOperation object
598
+ # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig]
599
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
600
+ #
601
+ # @return [::Google::Cloud::Retail::V2::ServingConfig]
602
+ #
603
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
604
+ def remove_control request, options = nil
605
+ raise ::ArgumentError, "request must be provided" if request.nil?
606
+
607
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveControlRequest
608
+
609
+ # Converts hash and nil to an options object
610
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
611
+
612
+ # Customize the options with defaults
613
+ call_metadata = @config.rpcs.remove_control.metadata.to_h
614
+
615
+ # Set x-goog-api-client and x-goog-user-project headers
616
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
617
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
618
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION,
619
+ transports_version_send: [:rest]
620
+
621
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
622
+
623
+ options.apply_defaults timeout: @config.rpcs.remove_control.timeout,
624
+ metadata: call_metadata,
625
+ retry_policy: @config.rpcs.remove_control.retry_policy
626
+
627
+ options.apply_defaults timeout: @config.timeout,
628
+ metadata: @config.metadata,
629
+ retry_policy: @config.retry_policy
630
+
631
+ @serving_config_service_stub.remove_control request, options do |result, operation|
632
+ yield result, operation if block_given?
633
+ return result
634
+ end
635
+ rescue ::Gapic::Rest::Error => e
636
+ raise ::Google::Cloud::Error.from_error(e)
637
+ end
638
+
639
+ ##
640
+ # Configuration class for the ServingConfigService REST API.
641
+ #
642
+ # This class represents the configuration for ServingConfigService REST,
643
+ # providing control over timeouts, retry behavior, logging, transport
644
+ # parameters, and other low-level controls. Certain parameters can also be
645
+ # applied individually to specific RPCs. See
646
+ # {::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client::Configuration::Rpcs}
647
+ # for a list of RPCs that can be configured independently.
648
+ #
649
+ # Configuration can be applied globally to all clients, or to a single client
650
+ # on construction.
651
+ #
652
+ # @example
653
+ #
654
+ # # Modify the global config, setting the timeout for
655
+ # # create_serving_config to 20 seconds,
656
+ # # and all remaining timeouts to 10 seconds.
657
+ # ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.configure do |config|
658
+ # config.timeout = 10.0
659
+ # config.rpcs.create_serving_config.timeout = 20.0
660
+ # end
661
+ #
662
+ # # Apply the above configuration only to a new client.
663
+ # client = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new do |config|
664
+ # config.timeout = 10.0
665
+ # config.rpcs.create_serving_config.timeout = 20.0
666
+ # end
667
+ #
668
+ # @!attribute [rw] endpoint
669
+ # The hostname or hostname:port of the service endpoint.
670
+ # Defaults to `"retail.googleapis.com"`.
671
+ # @return [::String]
672
+ # @!attribute [rw] credentials
673
+ # Credentials to send with calls. You may provide any of the following types:
674
+ # * (`String`) The path to a service account key file in JSON format
675
+ # * (`Hash`) A service account key as a Hash
676
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
677
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
678
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
679
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
680
+ # * (`nil`) indicating no credentials
681
+ # @return [::Object]
682
+ # @!attribute [rw] scope
683
+ # The OAuth scopes
684
+ # @return [::Array<::String>]
685
+ # @!attribute [rw] lib_name
686
+ # The library name as recorded in instrumentation and logging
687
+ # @return [::String]
688
+ # @!attribute [rw] lib_version
689
+ # The library version as recorded in instrumentation and logging
690
+ # @return [::String]
691
+ # @!attribute [rw] timeout
692
+ # The call timeout in seconds.
693
+ # @return [::Numeric]
694
+ # @!attribute [rw] metadata
695
+ # Additional headers to be sent with the call.
696
+ # @return [::Hash{::Symbol=>::String}]
697
+ # @!attribute [rw] retry_policy
698
+ # The retry policy. The value is a hash with the following keys:
699
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
700
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
701
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
702
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
703
+ # trigger a retry.
704
+ # @return [::Hash]
705
+ # @!attribute [rw] quota_project
706
+ # A separate project against which to charge quota.
707
+ # @return [::String]
708
+ #
709
+ class Configuration
710
+ extend ::Gapic::Config
711
+
712
+ config_attr :endpoint, "retail.googleapis.com", ::String
713
+ config_attr :credentials, nil do |value|
714
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
715
+ allowed.any? { |klass| klass === value }
716
+ end
717
+ config_attr :scope, nil, ::String, ::Array, nil
718
+ config_attr :lib_name, nil, ::String, nil
719
+ config_attr :lib_version, nil, ::String, nil
720
+ config_attr :timeout, nil, ::Numeric, nil
721
+ config_attr :metadata, nil, ::Hash, nil
722
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
723
+ config_attr :quota_project, nil, ::String, nil
724
+
725
+ # @private
726
+ def initialize parent_config = nil
727
+ @parent_config = parent_config unless parent_config.nil?
728
+
729
+ yield self if block_given?
730
+ end
731
+
732
+ ##
733
+ # Configurations for individual RPCs
734
+ # @return [Rpcs]
735
+ #
736
+ def rpcs
737
+ @rpcs ||= begin
738
+ parent_rpcs = nil
739
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
740
+ Rpcs.new parent_rpcs
741
+ end
742
+ end
743
+
744
+ ##
745
+ # Configuration RPC class for the ServingConfigService API.
746
+ #
747
+ # Includes fields providing the configuration for each RPC in this service.
748
+ # Each configuration object is of type `Gapic::Config::Method` and includes
749
+ # the following configuration fields:
750
+ #
751
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
752
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
753
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
754
+ # include the following keys:
755
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
756
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
757
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
758
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
759
+ # trigger a retry.
760
+ #
761
+ class Rpcs
762
+ ##
763
+ # RPC-specific configuration for `create_serving_config`
764
+ # @return [::Gapic::Config::Method]
765
+ #
766
+ attr_reader :create_serving_config
767
+ ##
768
+ # RPC-specific configuration for `delete_serving_config`
769
+ # @return [::Gapic::Config::Method]
770
+ #
771
+ attr_reader :delete_serving_config
772
+ ##
773
+ # RPC-specific configuration for `update_serving_config`
774
+ # @return [::Gapic::Config::Method]
775
+ #
776
+ attr_reader :update_serving_config
777
+ ##
778
+ # RPC-specific configuration for `get_serving_config`
779
+ # @return [::Gapic::Config::Method]
780
+ #
781
+ attr_reader :get_serving_config
782
+ ##
783
+ # RPC-specific configuration for `list_serving_configs`
784
+ # @return [::Gapic::Config::Method]
785
+ #
786
+ attr_reader :list_serving_configs
787
+ ##
788
+ # RPC-specific configuration for `add_control`
789
+ # @return [::Gapic::Config::Method]
790
+ #
791
+ attr_reader :add_control
792
+ ##
793
+ # RPC-specific configuration for `remove_control`
794
+ # @return [::Gapic::Config::Method]
795
+ #
796
+ attr_reader :remove_control
797
+
798
+ # @private
799
+ def initialize parent_rpcs = nil
800
+ create_serving_config_config = parent_rpcs.create_serving_config if parent_rpcs.respond_to? :create_serving_config
801
+ @create_serving_config = ::Gapic::Config::Method.new create_serving_config_config
802
+ delete_serving_config_config = parent_rpcs.delete_serving_config if parent_rpcs.respond_to? :delete_serving_config
803
+ @delete_serving_config = ::Gapic::Config::Method.new delete_serving_config_config
804
+ update_serving_config_config = parent_rpcs.update_serving_config if parent_rpcs.respond_to? :update_serving_config
805
+ @update_serving_config = ::Gapic::Config::Method.new update_serving_config_config
806
+ get_serving_config_config = parent_rpcs.get_serving_config if parent_rpcs.respond_to? :get_serving_config
807
+ @get_serving_config = ::Gapic::Config::Method.new get_serving_config_config
808
+ list_serving_configs_config = parent_rpcs.list_serving_configs if parent_rpcs.respond_to? :list_serving_configs
809
+ @list_serving_configs = ::Gapic::Config::Method.new list_serving_configs_config
810
+ add_control_config = parent_rpcs.add_control if parent_rpcs.respond_to? :add_control
811
+ @add_control = ::Gapic::Config::Method.new add_control_config
812
+ remove_control_config = parent_rpcs.remove_control if parent_rpcs.respond_to? :remove_control
813
+ @remove_control = ::Gapic::Config::Method.new remove_control_config
814
+
815
+ yield self if block_given?
816
+ end
817
+ end
818
+ end
819
+ end
820
+ end
821
+ end
822
+ end
823
+ end
824
+ end
825
+ end