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.
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,1220 @@
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/catalog_service_pb"
21
+ require "google/cloud/retail/v2/catalog_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 CatalogService
29
+ module Rest
30
+ ##
31
+ # REST client for the CatalogService service.
32
+ #
33
+ # Service for managing catalog configuration.
34
+ #
35
+ class Client
36
+ include Paths
37
+
38
+ # @private
39
+ attr_reader :catalog_service_stub
40
+
41
+ ##
42
+ # Configure the CatalogService Client class.
43
+ #
44
+ # See {::Google::Cloud::Retail::V2::CatalogService::Rest::Client::Configuration}
45
+ # for a description of the configuration fields.
46
+ #
47
+ # @example
48
+ #
49
+ # # Modify the configuration for all CatalogService clients
50
+ # ::Google::Cloud::Retail::V2::CatalogService::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.timeout = 5.0
71
+ default_config.retry_policy = {
72
+ initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14, 4]
73
+ }
74
+
75
+ default_config
76
+ end
77
+ yield @configure if block_given?
78
+ @configure
79
+ end
80
+
81
+ ##
82
+ # Configure the CatalogService Client instance.
83
+ #
84
+ # The configuration is set to the derived mode, meaning that values can be changed,
85
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
86
+ # should be made on {Client.configure}.
87
+ #
88
+ # See {::Google::Cloud::Retail::V2::CatalogService::Rest::Client::Configuration}
89
+ # for a description of the configuration fields.
90
+ #
91
+ # @yield [config] Configure the Client client.
92
+ # @yieldparam config [Client::Configuration]
93
+ #
94
+ # @return [Client::Configuration]
95
+ #
96
+ def configure
97
+ yield @config if block_given?
98
+ @config
99
+ end
100
+
101
+ ##
102
+ # Create a new CatalogService REST client object.
103
+ #
104
+ # @example
105
+ #
106
+ # # Create a client using the default configuration
107
+ # client = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new
108
+ #
109
+ # # Create a client using a custom configuration
110
+ # client = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config|
111
+ # config.timeout = 10.0
112
+ # end
113
+ #
114
+ # @yield [config] Configure the CatalogService client.
115
+ # @yieldparam config [Client::Configuration]
116
+ #
117
+ def initialize
118
+ # Create the configuration object
119
+ @config = Configuration.new Client.configure
120
+
121
+ # Yield the configuration if needed
122
+ yield @config if block_given?
123
+
124
+ # Create credentials
125
+ credentials = @config.credentials
126
+ # Use self-signed JWT if the endpoint is unchanged from default,
127
+ # but only if the default endpoint does not have a region prefix.
128
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
129
+ !@config.endpoint.split(".").first.include?("-")
130
+ credentials ||= Credentials.default scope: @config.scope,
131
+ enable_self_signed_jwt: enable_self_signed_jwt
132
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
133
+ credentials = Credentials.new credentials, scope: @config.scope
134
+ end
135
+
136
+ @quota_project_id = @config.quota_project
137
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
138
+
139
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
140
+ config.credentials = credentials
141
+ config.quota_project = @quota_project_id
142
+ config.endpoint = @config.endpoint
143
+ end
144
+
145
+ @catalog_service_stub = ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
146
+ end
147
+
148
+ ##
149
+ # Get the associated client for mix-in of the Locations.
150
+ #
151
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
152
+ #
153
+ attr_reader :location_client
154
+
155
+ # Service calls
156
+
157
+ ##
158
+ # Lists all the {::Google::Cloud::Retail::V2::Catalog Catalog}s associated with
159
+ # the project.
160
+ #
161
+ # @overload list_catalogs(request, options = nil)
162
+ # Pass arguments to `list_catalogs` via a request object, either of type
163
+ # {::Google::Cloud::Retail::V2::ListCatalogsRequest} or an equivalent Hash.
164
+ #
165
+ # @param request [::Google::Cloud::Retail::V2::ListCatalogsRequest, ::Hash]
166
+ # A request object representing the call parameters. Required. To specify no
167
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
168
+ # @param options [::Gapic::CallOptions, ::Hash]
169
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
170
+ #
171
+ # @overload list_catalogs(parent: nil, page_size: nil, page_token: nil)
172
+ # Pass arguments to `list_catalogs` via keyword arguments. Note that at
173
+ # least one keyword argument is required. To specify no parameters, or to keep all
174
+ # the default parameter values, pass an empty Hash as a request object (see above).
175
+ #
176
+ # @param parent [::String]
177
+ # Required. The account resource name with an associated location.
178
+ #
179
+ # If the caller does not have permission to list
180
+ # {::Google::Cloud::Retail::V2::Catalog Catalog}s under this location, regardless
181
+ # of whether or not this location exists, a PERMISSION_DENIED error is
182
+ # returned.
183
+ # @param page_size [::Integer]
184
+ # Maximum number of {::Google::Cloud::Retail::V2::Catalog Catalog}s to return. If
185
+ # unspecified, defaults to 50. The maximum allowed value is 1000. Values
186
+ # above 1000 will be coerced to 1000.
187
+ #
188
+ # If this field is negative, an INVALID_ARGUMENT is returned.
189
+ # @param page_token [::String]
190
+ # A page token
191
+ # {::Google::Cloud::Retail::V2::ListCatalogsResponse#next_page_token ListCatalogsResponse.next_page_token},
192
+ # received from a previous
193
+ # {::Google::Cloud::Retail::V2::CatalogService::Rest::Client#list_catalogs CatalogService.ListCatalogs}
194
+ # call. Provide this to retrieve the subsequent page.
195
+ #
196
+ # When paginating, all other parameters provided to
197
+ # {::Google::Cloud::Retail::V2::CatalogService::Rest::Client#list_catalogs CatalogService.ListCatalogs}
198
+ # must match the call that provided the page token. Otherwise, an
199
+ # INVALID_ARGUMENT error is returned.
200
+ # @yield [result, operation] Access the result along with the TransportOperation object
201
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Catalog>]
202
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
203
+ #
204
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Catalog>]
205
+ #
206
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
207
+ def list_catalogs request, options = nil
208
+ raise ::ArgumentError, "request must be provided" if request.nil?
209
+
210
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListCatalogsRequest
211
+
212
+ # Converts hash and nil to an options object
213
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
214
+
215
+ # Customize the options with defaults
216
+ call_metadata = @config.rpcs.list_catalogs.metadata.to_h
217
+
218
+ # Set x-goog-api-client and x-goog-user-project headers
219
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
220
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
221
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION,
222
+ transports_version_send: [:rest]
223
+
224
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
225
+
226
+ options.apply_defaults timeout: @config.rpcs.list_catalogs.timeout,
227
+ metadata: call_metadata,
228
+ retry_policy: @config.rpcs.list_catalogs.retry_policy
229
+
230
+ options.apply_defaults timeout: @config.timeout,
231
+ metadata: @config.metadata,
232
+ retry_policy: @config.retry_policy
233
+
234
+ @catalog_service_stub.list_catalogs request, options do |result, operation|
235
+ result = ::Gapic::Rest::PagedEnumerable.new @catalog_service_stub, :list_catalogs, "catalogs", request, result, options
236
+ yield result, operation if block_given?
237
+ return result
238
+ end
239
+ rescue ::Gapic::Rest::Error => e
240
+ raise ::Google::Cloud::Error.from_error(e)
241
+ end
242
+
243
+ ##
244
+ # Updates the {::Google::Cloud::Retail::V2::Catalog Catalog}s.
245
+ #
246
+ # @overload update_catalog(request, options = nil)
247
+ # Pass arguments to `update_catalog` via a request object, either of type
248
+ # {::Google::Cloud::Retail::V2::UpdateCatalogRequest} or an equivalent Hash.
249
+ #
250
+ # @param request [::Google::Cloud::Retail::V2::UpdateCatalogRequest, ::Hash]
251
+ # A request object representing the call parameters. Required. To specify no
252
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
253
+ # @param options [::Gapic::CallOptions, ::Hash]
254
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
255
+ #
256
+ # @overload update_catalog(catalog: nil, update_mask: nil)
257
+ # Pass arguments to `update_catalog` via keyword arguments. Note that at
258
+ # least one keyword argument is required. To specify no parameters, or to keep all
259
+ # the default parameter values, pass an empty Hash as a request object (see above).
260
+ #
261
+ # @param catalog [::Google::Cloud::Retail::V2::Catalog, ::Hash]
262
+ # Required. The {::Google::Cloud::Retail::V2::Catalog Catalog} to update.
263
+ #
264
+ # If the caller does not have permission to update the
265
+ # {::Google::Cloud::Retail::V2::Catalog Catalog}, regardless of whether or not it
266
+ # exists, a PERMISSION_DENIED error is returned.
267
+ #
268
+ # If the {::Google::Cloud::Retail::V2::Catalog Catalog} to update does not exist,
269
+ # a NOT_FOUND error is returned.
270
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
271
+ # Indicates which fields in the provided
272
+ # {::Google::Cloud::Retail::V2::Catalog Catalog} to update.
273
+ #
274
+ # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
275
+ # is returned.
276
+ # @yield [result, operation] Access the result along with the TransportOperation object
277
+ # @yieldparam result [::Google::Cloud::Retail::V2::Catalog]
278
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
279
+ #
280
+ # @return [::Google::Cloud::Retail::V2::Catalog]
281
+ #
282
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
283
+ def update_catalog request, options = nil
284
+ raise ::ArgumentError, "request must be provided" if request.nil?
285
+
286
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateCatalogRequest
287
+
288
+ # Converts hash and nil to an options object
289
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
290
+
291
+ # Customize the options with defaults
292
+ call_metadata = @config.rpcs.update_catalog.metadata.to_h
293
+
294
+ # Set x-goog-api-client and x-goog-user-project headers
295
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
296
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
297
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION,
298
+ transports_version_send: [:rest]
299
+
300
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
301
+
302
+ options.apply_defaults timeout: @config.rpcs.update_catalog.timeout,
303
+ metadata: call_metadata,
304
+ retry_policy: @config.rpcs.update_catalog.retry_policy
305
+
306
+ options.apply_defaults timeout: @config.timeout,
307
+ metadata: @config.metadata,
308
+ retry_policy: @config.retry_policy
309
+
310
+ @catalog_service_stub.update_catalog request, options do |result, operation|
311
+ yield result, operation if block_given?
312
+ return result
313
+ end
314
+ rescue ::Gapic::Rest::Error => e
315
+ raise ::Google::Cloud::Error.from_error(e)
316
+ end
317
+
318
+ ##
319
+ # Set a specified branch id as default branch. API methods such as
320
+ # {::Google::Cloud::Retail::V2::SearchService::Rest::Client#search SearchService.Search},
321
+ # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#get_product ProductService.GetProduct},
322
+ # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts}
323
+ # will treat requests using "default_branch" to the actual branch id set as
324
+ # default.
325
+ #
326
+ # For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as
327
+ # default, setting
328
+ # {::Google::Cloud::Retail::V2::SearchRequest#branch SearchRequest.branch} to
329
+ # `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent
330
+ # to setting
331
+ # {::Google::Cloud::Retail::V2::SearchRequest#branch SearchRequest.branch} to
332
+ # `projects/*/locations/*/catalogs/*/branches/1`.
333
+ #
334
+ # Using multiple branches can be useful when developers would like
335
+ # to have a staging branch to test and verify for future usage. When it
336
+ # becomes ready, developers switch on the staging branch using this API while
337
+ # keeping using `projects/*/locations/*/catalogs/*/branches/default_branch`
338
+ # as {::Google::Cloud::Retail::V2::SearchRequest#branch SearchRequest.branch} to
339
+ # route the traffic to this staging branch.
340
+ #
341
+ # CAUTION: If you have live predict/search traffic, switching the default
342
+ # branch could potentially cause outages if the ID space of the new branch is
343
+ # very different from the old one.
344
+ #
345
+ # More specifically:
346
+ #
347
+ # * PredictionService will only return product IDs from branch \\{newBranch}.
348
+ # * SearchService will only return product IDs from branch \\{newBranch}
349
+ # (if branch is not explicitly set).
350
+ # * UserEventService will only join events with products from branch
351
+ # \\{newBranch}.
352
+ #
353
+ # @overload set_default_branch(request, options = nil)
354
+ # Pass arguments to `set_default_branch` via a request object, either of type
355
+ # {::Google::Cloud::Retail::V2::SetDefaultBranchRequest} or an equivalent Hash.
356
+ #
357
+ # @param request [::Google::Cloud::Retail::V2::SetDefaultBranchRequest, ::Hash]
358
+ # A request object representing the call parameters. Required. To specify no
359
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
360
+ # @param options [::Gapic::CallOptions, ::Hash]
361
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
362
+ #
363
+ # @overload set_default_branch(catalog: nil, branch_id: nil, note: nil, force: nil)
364
+ # Pass arguments to `set_default_branch` via keyword arguments. Note that at
365
+ # least one keyword argument is required. To specify no parameters, or to keep all
366
+ # the default parameter values, pass an empty Hash as a request object (see above).
367
+ #
368
+ # @param catalog [::String]
369
+ # Full resource name of the catalog, such as
370
+ # `projects/*/locations/global/catalogs/default_catalog`.
371
+ # @param branch_id [::String]
372
+ # The final component of the resource name of a branch.
373
+ #
374
+ # This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT
375
+ # error is returned.
376
+ #
377
+ # If there are no sufficient active products in the targeted branch and
378
+ # {::Google::Cloud::Retail::V2::SetDefaultBranchRequest#force force} is not set, a
379
+ # FAILED_PRECONDITION error is returned.
380
+ # @param note [::String]
381
+ # Some note on this request, this can be retrieved by
382
+ # {::Google::Cloud::Retail::V2::CatalogService::Rest::Client#get_default_branch CatalogService.GetDefaultBranch}
383
+ # before next valid default branch set occurs.
384
+ #
385
+ # This field must be a UTF-8 encoded string with a length limit of 1,000
386
+ # characters. Otherwise, an INVALID_ARGUMENT error is returned.
387
+ # @param force [::Boolean]
388
+ # If set to true, it permits switching to a branch with
389
+ # {::Google::Cloud::Retail::V2::SetDefaultBranchRequest#branch_id branch_id} even
390
+ # if it has no sufficient active products.
391
+ # @yield [result, operation] Access the result along with the TransportOperation object
392
+ # @yieldparam result [::Google::Protobuf::Empty]
393
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
394
+ #
395
+ # @return [::Google::Protobuf::Empty]
396
+ #
397
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
398
+ def set_default_branch request, options = nil
399
+ raise ::ArgumentError, "request must be provided" if request.nil?
400
+
401
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::SetDefaultBranchRequest
402
+
403
+ # Converts hash and nil to an options object
404
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
405
+
406
+ # Customize the options with defaults
407
+ call_metadata = @config.rpcs.set_default_branch.metadata.to_h
408
+
409
+ # Set x-goog-api-client and x-goog-user-project headers
410
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
411
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
412
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION,
413
+ transports_version_send: [:rest]
414
+
415
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
416
+
417
+ options.apply_defaults timeout: @config.rpcs.set_default_branch.timeout,
418
+ metadata: call_metadata,
419
+ retry_policy: @config.rpcs.set_default_branch.retry_policy
420
+
421
+ options.apply_defaults timeout: @config.timeout,
422
+ metadata: @config.metadata,
423
+ retry_policy: @config.retry_policy
424
+
425
+ @catalog_service_stub.set_default_branch request, options do |result, operation|
426
+ yield result, operation if block_given?
427
+ return result
428
+ end
429
+ rescue ::Gapic::Rest::Error => e
430
+ raise ::Google::Cloud::Error.from_error(e)
431
+ end
432
+
433
+ ##
434
+ # Get which branch is currently default branch set by
435
+ # {::Google::Cloud::Retail::V2::CatalogService::Rest::Client#set_default_branch CatalogService.SetDefaultBranch}
436
+ # method under a specified parent catalog.
437
+ #
438
+ # @overload get_default_branch(request, options = nil)
439
+ # Pass arguments to `get_default_branch` via a request object, either of type
440
+ # {::Google::Cloud::Retail::V2::GetDefaultBranchRequest} or an equivalent Hash.
441
+ #
442
+ # @param request [::Google::Cloud::Retail::V2::GetDefaultBranchRequest, ::Hash]
443
+ # A request object representing the call parameters. Required. To specify no
444
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
445
+ # @param options [::Gapic::CallOptions, ::Hash]
446
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
447
+ #
448
+ # @overload get_default_branch(catalog: nil)
449
+ # Pass arguments to `get_default_branch` via keyword arguments. Note that at
450
+ # least one keyword argument is required. To specify no parameters, or to keep all
451
+ # the default parameter values, pass an empty Hash as a request object (see above).
452
+ #
453
+ # @param catalog [::String]
454
+ # The parent catalog resource name, such as
455
+ # `projects/*/locations/global/catalogs/default_catalog`.
456
+ # @yield [result, operation] Access the result along with the TransportOperation object
457
+ # @yieldparam result [::Google::Cloud::Retail::V2::GetDefaultBranchResponse]
458
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
459
+ #
460
+ # @return [::Google::Cloud::Retail::V2::GetDefaultBranchResponse]
461
+ #
462
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
463
+ def get_default_branch request, options = nil
464
+ raise ::ArgumentError, "request must be provided" if request.nil?
465
+
466
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetDefaultBranchRequest
467
+
468
+ # Converts hash and nil to an options object
469
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
470
+
471
+ # Customize the options with defaults
472
+ call_metadata = @config.rpcs.get_default_branch.metadata.to_h
473
+
474
+ # Set x-goog-api-client and x-goog-user-project headers
475
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
476
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
477
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION,
478
+ transports_version_send: [:rest]
479
+
480
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
481
+
482
+ options.apply_defaults timeout: @config.rpcs.get_default_branch.timeout,
483
+ metadata: call_metadata,
484
+ retry_policy: @config.rpcs.get_default_branch.retry_policy
485
+
486
+ options.apply_defaults timeout: @config.timeout,
487
+ metadata: @config.metadata,
488
+ retry_policy: @config.retry_policy
489
+
490
+ @catalog_service_stub.get_default_branch request, options do |result, operation|
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
+ # Gets a {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig}.
500
+ #
501
+ # @overload get_completion_config(request, options = nil)
502
+ # Pass arguments to `get_completion_config` via a request object, either of type
503
+ # {::Google::Cloud::Retail::V2::GetCompletionConfigRequest} or an equivalent Hash.
504
+ #
505
+ # @param request [::Google::Cloud::Retail::V2::GetCompletionConfigRequest, ::Hash]
506
+ # A request object representing the call parameters. Required. To specify no
507
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
508
+ # @param options [::Gapic::CallOptions, ::Hash]
509
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
510
+ #
511
+ # @overload get_completion_config(name: nil)
512
+ # Pass arguments to `get_completion_config` via keyword arguments. Note that at
513
+ # least one keyword argument is required. To specify no parameters, or to keep all
514
+ # the default parameter values, pass an empty Hash as a request object (see above).
515
+ #
516
+ # @param name [::String]
517
+ # Required. Full CompletionConfig resource name. Format:
518
+ # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig`
519
+ # @yield [result, operation] Access the result along with the TransportOperation object
520
+ # @yieldparam result [::Google::Cloud::Retail::V2::CompletionConfig]
521
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
522
+ #
523
+ # @return [::Google::Cloud::Retail::V2::CompletionConfig]
524
+ #
525
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
526
+ def get_completion_config request, options = nil
527
+ raise ::ArgumentError, "request must be provided" if request.nil?
528
+
529
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetCompletionConfigRequest
530
+
531
+ # Converts hash and nil to an options object
532
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
533
+
534
+ # Customize the options with defaults
535
+ call_metadata = @config.rpcs.get_completion_config.metadata.to_h
536
+
537
+ # Set x-goog-api-client and x-goog-user-project headers
538
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
539
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
540
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION,
541
+ transports_version_send: [:rest]
542
+
543
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
544
+
545
+ options.apply_defaults timeout: @config.rpcs.get_completion_config.timeout,
546
+ metadata: call_metadata,
547
+ retry_policy: @config.rpcs.get_completion_config.retry_policy
548
+
549
+ options.apply_defaults timeout: @config.timeout,
550
+ metadata: @config.metadata,
551
+ retry_policy: @config.retry_policy
552
+
553
+ @catalog_service_stub.get_completion_config request, options do |result, operation|
554
+ yield result, operation if block_given?
555
+ return result
556
+ end
557
+ rescue ::Gapic::Rest::Error => e
558
+ raise ::Google::Cloud::Error.from_error(e)
559
+ end
560
+
561
+ ##
562
+ # Updates the {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig}s.
563
+ #
564
+ # @overload update_completion_config(request, options = nil)
565
+ # Pass arguments to `update_completion_config` via a request object, either of type
566
+ # {::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest} or an equivalent Hash.
567
+ #
568
+ # @param request [::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest, ::Hash]
569
+ # A request object representing the call parameters. Required. To specify no
570
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
571
+ # @param options [::Gapic::CallOptions, ::Hash]
572
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
573
+ #
574
+ # @overload update_completion_config(completion_config: nil, update_mask: nil)
575
+ # Pass arguments to `update_completion_config` via keyword arguments. Note that at
576
+ # least one keyword argument is required. To specify no parameters, or to keep all
577
+ # the default parameter values, pass an empty Hash as a request object (see above).
578
+ #
579
+ # @param completion_config [::Google::Cloud::Retail::V2::CompletionConfig, ::Hash]
580
+ # Required. The {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig}
581
+ # to update.
582
+ #
583
+ # If the caller does not have permission to update the
584
+ # {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig}, then a
585
+ # PERMISSION_DENIED error is returned.
586
+ #
587
+ # If the {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig} to
588
+ # update does not exist, a NOT_FOUND error is returned.
589
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
590
+ # Indicates which fields in the provided
591
+ # {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig} to update. The
592
+ # following are the only supported fields:
593
+ #
594
+ # * {::Google::Cloud::Retail::V2::CompletionConfig#matching_order CompletionConfig.matching_order}
595
+ # * {::Google::Cloud::Retail::V2::CompletionConfig#max_suggestions CompletionConfig.max_suggestions}
596
+ # * {::Google::Cloud::Retail::V2::CompletionConfig#min_prefix_length CompletionConfig.min_prefix_length}
597
+ # * {::Google::Cloud::Retail::V2::CompletionConfig#auto_learning CompletionConfig.auto_learning}
598
+ #
599
+ # If not set, all supported fields are updated.
600
+ # @yield [result, operation] Access the result along with the TransportOperation object
601
+ # @yieldparam result [::Google::Cloud::Retail::V2::CompletionConfig]
602
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
603
+ #
604
+ # @return [::Google::Cloud::Retail::V2::CompletionConfig]
605
+ #
606
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
607
+ def update_completion_config request, options = nil
608
+ raise ::ArgumentError, "request must be provided" if request.nil?
609
+
610
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest
611
+
612
+ # Converts hash and nil to an options object
613
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
614
+
615
+ # Customize the options with defaults
616
+ call_metadata = @config.rpcs.update_completion_config.metadata.to_h
617
+
618
+ # Set x-goog-api-client and x-goog-user-project headers
619
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
620
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
621
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION,
622
+ transports_version_send: [:rest]
623
+
624
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
625
+
626
+ options.apply_defaults timeout: @config.rpcs.update_completion_config.timeout,
627
+ metadata: call_metadata,
628
+ retry_policy: @config.rpcs.update_completion_config.retry_policy
629
+
630
+ options.apply_defaults timeout: @config.timeout,
631
+ metadata: @config.metadata,
632
+ retry_policy: @config.retry_policy
633
+
634
+ @catalog_service_stub.update_completion_config request, options do |result, operation|
635
+ yield result, operation if block_given?
636
+ return result
637
+ end
638
+ rescue ::Gapic::Rest::Error => e
639
+ raise ::Google::Cloud::Error.from_error(e)
640
+ end
641
+
642
+ ##
643
+ # Gets an {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig}.
644
+ #
645
+ # @overload get_attributes_config(request, options = nil)
646
+ # Pass arguments to `get_attributes_config` via a request object, either of type
647
+ # {::Google::Cloud::Retail::V2::GetAttributesConfigRequest} or an equivalent Hash.
648
+ #
649
+ # @param request [::Google::Cloud::Retail::V2::GetAttributesConfigRequest, ::Hash]
650
+ # A request object representing the call parameters. Required. To specify no
651
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
652
+ # @param options [::Gapic::CallOptions, ::Hash]
653
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
654
+ #
655
+ # @overload get_attributes_config(name: nil)
656
+ # Pass arguments to `get_attributes_config` via keyword arguments. Note that at
657
+ # least one keyword argument is required. To specify no parameters, or to keep all
658
+ # the default parameter values, pass an empty Hash as a request object (see above).
659
+ #
660
+ # @param name [::String]
661
+ # Required. Full AttributesConfig resource name. Format:
662
+ # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
663
+ # @yield [result, operation] Access the result along with the TransportOperation object
664
+ # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig]
665
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
666
+ #
667
+ # @return [::Google::Cloud::Retail::V2::AttributesConfig]
668
+ #
669
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
670
+ def get_attributes_config request, options = nil
671
+ raise ::ArgumentError, "request must be provided" if request.nil?
672
+
673
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetAttributesConfigRequest
674
+
675
+ # Converts hash and nil to an options object
676
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
677
+
678
+ # Customize the options with defaults
679
+ call_metadata = @config.rpcs.get_attributes_config.metadata.to_h
680
+
681
+ # Set x-goog-api-client and x-goog-user-project headers
682
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
683
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
684
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION,
685
+ transports_version_send: [:rest]
686
+
687
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
688
+
689
+ options.apply_defaults timeout: @config.rpcs.get_attributes_config.timeout,
690
+ metadata: call_metadata,
691
+ retry_policy: @config.rpcs.get_attributes_config.retry_policy
692
+
693
+ options.apply_defaults timeout: @config.timeout,
694
+ metadata: @config.metadata,
695
+ retry_policy: @config.retry_policy
696
+
697
+ @catalog_service_stub.get_attributes_config request, options do |result, operation|
698
+ yield result, operation if block_given?
699
+ return result
700
+ end
701
+ rescue ::Gapic::Rest::Error => e
702
+ raise ::Google::Cloud::Error.from_error(e)
703
+ end
704
+
705
+ ##
706
+ # Updates the {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig}.
707
+ #
708
+ # The catalog attributes in the request will be updated in the catalog, or
709
+ # inserted if they do not exist. Existing catalog attributes not included in
710
+ # the request will remain unchanged. Attributes that are assigned to
711
+ # products, but do not exist at the catalog level, are always included in the
712
+ # response. The product attribute is assigned default values for missing
713
+ # catalog attribute fields, e.g., searchable and dynamic facetable options.
714
+ #
715
+ # @overload update_attributes_config(request, options = nil)
716
+ # Pass arguments to `update_attributes_config` via a request object, either of type
717
+ # {::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest} or an equivalent Hash.
718
+ #
719
+ # @param request [::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest, ::Hash]
720
+ # A request object representing the call parameters. Required. To specify no
721
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
722
+ # @param options [::Gapic::CallOptions, ::Hash]
723
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
724
+ #
725
+ # @overload update_attributes_config(attributes_config: nil, update_mask: nil)
726
+ # Pass arguments to `update_attributes_config` via keyword arguments. Note that at
727
+ # least one keyword argument is required. To specify no parameters, or to keep all
728
+ # the default parameter values, pass an empty Hash as a request object (see above).
729
+ #
730
+ # @param attributes_config [::Google::Cloud::Retail::V2::AttributesConfig, ::Hash]
731
+ # Required. The {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig}
732
+ # to update.
733
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
734
+ # Indicates which fields in the provided
735
+ # {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig} to update. The
736
+ # following is the only supported field:
737
+ #
738
+ # * {::Google::Cloud::Retail::V2::AttributesConfig#catalog_attributes AttributesConfig.catalog_attributes}
739
+ #
740
+ # If not set, all supported fields are updated.
741
+ # @yield [result, operation] Access the result along with the TransportOperation object
742
+ # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig]
743
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
744
+ #
745
+ # @return [::Google::Cloud::Retail::V2::AttributesConfig]
746
+ #
747
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
748
+ def update_attributes_config request, options = nil
749
+ raise ::ArgumentError, "request must be provided" if request.nil?
750
+
751
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest
752
+
753
+ # Converts hash and nil to an options object
754
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
755
+
756
+ # Customize the options with defaults
757
+ call_metadata = @config.rpcs.update_attributes_config.metadata.to_h
758
+
759
+ # Set x-goog-api-client and x-goog-user-project headers
760
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
761
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
762
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION,
763
+ transports_version_send: [:rest]
764
+
765
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
766
+
767
+ options.apply_defaults timeout: @config.rpcs.update_attributes_config.timeout,
768
+ metadata: call_metadata,
769
+ retry_policy: @config.rpcs.update_attributes_config.retry_policy
770
+
771
+ options.apply_defaults timeout: @config.timeout,
772
+ metadata: @config.metadata,
773
+ retry_policy: @config.retry_policy
774
+
775
+ @catalog_service_stub.update_attributes_config request, options do |result, operation|
776
+ yield result, operation if block_given?
777
+ return result
778
+ end
779
+ rescue ::Gapic::Rest::Error => e
780
+ raise ::Google::Cloud::Error.from_error(e)
781
+ end
782
+
783
+ ##
784
+ # Adds the specified
785
+ # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to the
786
+ # {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig}.
787
+ #
788
+ # If the {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to add
789
+ # already exists, an ALREADY_EXISTS error is returned.
790
+ #
791
+ # @overload add_catalog_attribute(request, options = nil)
792
+ # Pass arguments to `add_catalog_attribute` via a request object, either of type
793
+ # {::Google::Cloud::Retail::V2::AddCatalogAttributeRequest} or an equivalent Hash.
794
+ #
795
+ # @param request [::Google::Cloud::Retail::V2::AddCatalogAttributeRequest, ::Hash]
796
+ # A request object representing the call parameters. Required. To specify no
797
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
798
+ # @param options [::Gapic::CallOptions, ::Hash]
799
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
800
+ #
801
+ # @overload add_catalog_attribute(attributes_config: nil, catalog_attribute: nil)
802
+ # Pass arguments to `add_catalog_attribute` via keyword arguments. Note that at
803
+ # least one keyword argument is required. To specify no parameters, or to keep all
804
+ # the default parameter values, pass an empty Hash as a request object (see above).
805
+ #
806
+ # @param attributes_config [::String]
807
+ # Required. Full AttributesConfig resource name. Format:
808
+ # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
809
+ # @param catalog_attribute [::Google::Cloud::Retail::V2::CatalogAttribute, ::Hash]
810
+ # Required. The {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute}
811
+ # to add.
812
+ # @yield [result, operation] Access the result along with the TransportOperation object
813
+ # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig]
814
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
815
+ #
816
+ # @return [::Google::Cloud::Retail::V2::AttributesConfig]
817
+ #
818
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
819
+ def add_catalog_attribute request, options = nil
820
+ raise ::ArgumentError, "request must be provided" if request.nil?
821
+
822
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddCatalogAttributeRequest
823
+
824
+ # Converts hash and nil to an options object
825
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
826
+
827
+ # Customize the options with defaults
828
+ call_metadata = @config.rpcs.add_catalog_attribute.metadata.to_h
829
+
830
+ # Set x-goog-api-client and x-goog-user-project headers
831
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
832
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
833
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION,
834
+ transports_version_send: [:rest]
835
+
836
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
837
+
838
+ options.apply_defaults timeout: @config.rpcs.add_catalog_attribute.timeout,
839
+ metadata: call_metadata,
840
+ retry_policy: @config.rpcs.add_catalog_attribute.retry_policy
841
+
842
+ options.apply_defaults timeout: @config.timeout,
843
+ metadata: @config.metadata,
844
+ retry_policy: @config.retry_policy
845
+
846
+ @catalog_service_stub.add_catalog_attribute request, options do |result, operation|
847
+ yield result, operation if block_given?
848
+ return result
849
+ end
850
+ rescue ::Gapic::Rest::Error => e
851
+ raise ::Google::Cloud::Error.from_error(e)
852
+ end
853
+
854
+ ##
855
+ # Removes the specified
856
+ # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} from the
857
+ # {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig}.
858
+ #
859
+ # If the {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to
860
+ # remove does not exist, a NOT_FOUND error is returned.
861
+ #
862
+ # @overload remove_catalog_attribute(request, options = nil)
863
+ # Pass arguments to `remove_catalog_attribute` via a request object, either of type
864
+ # {::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest} or an equivalent Hash.
865
+ #
866
+ # @param request [::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest, ::Hash]
867
+ # A request object representing the call parameters. Required. To specify no
868
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
869
+ # @param options [::Gapic::CallOptions, ::Hash]
870
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
871
+ #
872
+ # @overload remove_catalog_attribute(attributes_config: nil, key: nil)
873
+ # Pass arguments to `remove_catalog_attribute` via keyword arguments. Note that at
874
+ # least one keyword argument is required. To specify no parameters, or to keep all
875
+ # the default parameter values, pass an empty Hash as a request object (see above).
876
+ #
877
+ # @param attributes_config [::String]
878
+ # Required. Full AttributesConfig resource name. Format:
879
+ # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
880
+ # @param key [::String]
881
+ # Required. The attribute name key of the
882
+ # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to remove.
883
+ # @yield [result, operation] Access the result along with the TransportOperation object
884
+ # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig]
885
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
886
+ #
887
+ # @return [::Google::Cloud::Retail::V2::AttributesConfig]
888
+ #
889
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
890
+ def remove_catalog_attribute request, options = nil
891
+ raise ::ArgumentError, "request must be provided" if request.nil?
892
+
893
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest
894
+
895
+ # Converts hash and nil to an options object
896
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
897
+
898
+ # Customize the options with defaults
899
+ call_metadata = @config.rpcs.remove_catalog_attribute.metadata.to_h
900
+
901
+ # Set x-goog-api-client and x-goog-user-project headers
902
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
903
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
904
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION,
905
+ transports_version_send: [:rest]
906
+
907
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
908
+
909
+ options.apply_defaults timeout: @config.rpcs.remove_catalog_attribute.timeout,
910
+ metadata: call_metadata,
911
+ retry_policy: @config.rpcs.remove_catalog_attribute.retry_policy
912
+
913
+ options.apply_defaults timeout: @config.timeout,
914
+ metadata: @config.metadata,
915
+ retry_policy: @config.retry_policy
916
+
917
+ @catalog_service_stub.remove_catalog_attribute request, options do |result, operation|
918
+ yield result, operation if block_given?
919
+ return result
920
+ end
921
+ rescue ::Gapic::Rest::Error => e
922
+ raise ::Google::Cloud::Error.from_error(e)
923
+ end
924
+
925
+ ##
926
+ # Replaces the specified
927
+ # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} in the
928
+ # {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig} by updating the
929
+ # catalog attribute with the same
930
+ # {::Google::Cloud::Retail::V2::CatalogAttribute#key CatalogAttribute.key}.
931
+ #
932
+ # If the {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to
933
+ # replace does not exist, a NOT_FOUND error is returned.
934
+ #
935
+ # @overload replace_catalog_attribute(request, options = nil)
936
+ # Pass arguments to `replace_catalog_attribute` via a request object, either of type
937
+ # {::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest} or an equivalent Hash.
938
+ #
939
+ # @param request [::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest, ::Hash]
940
+ # A request object representing the call parameters. Required. To specify no
941
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
942
+ # @param options [::Gapic::CallOptions, ::Hash]
943
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
944
+ #
945
+ # @overload replace_catalog_attribute(attributes_config: nil, catalog_attribute: nil, update_mask: nil)
946
+ # Pass arguments to `replace_catalog_attribute` via keyword arguments. Note that at
947
+ # least one keyword argument is required. To specify no parameters, or to keep all
948
+ # the default parameter values, pass an empty Hash as a request object (see above).
949
+ #
950
+ # @param attributes_config [::String]
951
+ # Required. Full AttributesConfig resource name. Format:
952
+ # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
953
+ # @param catalog_attribute [::Google::Cloud::Retail::V2::CatalogAttribute, ::Hash]
954
+ # Required. The updated
955
+ # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute}.
956
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
957
+ # Indicates which fields in the provided
958
+ # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to update. The
959
+ # following are NOT supported:
960
+ #
961
+ # * {::Google::Cloud::Retail::V2::CatalogAttribute#key CatalogAttribute.key}
962
+ #
963
+ # If not set, all supported fields are updated.
964
+ # @yield [result, operation] Access the result along with the TransportOperation object
965
+ # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig]
966
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
967
+ #
968
+ # @return [::Google::Cloud::Retail::V2::AttributesConfig]
969
+ #
970
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
971
+ def replace_catalog_attribute request, options = nil
972
+ raise ::ArgumentError, "request must be provided" if request.nil?
973
+
974
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest
975
+
976
+ # Converts hash and nil to an options object
977
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
978
+
979
+ # Customize the options with defaults
980
+ call_metadata = @config.rpcs.replace_catalog_attribute.metadata.to_h
981
+
982
+ # Set x-goog-api-client and x-goog-user-project headers
983
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
984
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
985
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION,
986
+ transports_version_send: [:rest]
987
+
988
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
989
+
990
+ options.apply_defaults timeout: @config.rpcs.replace_catalog_attribute.timeout,
991
+ metadata: call_metadata,
992
+ retry_policy: @config.rpcs.replace_catalog_attribute.retry_policy
993
+
994
+ options.apply_defaults timeout: @config.timeout,
995
+ metadata: @config.metadata,
996
+ retry_policy: @config.retry_policy
997
+
998
+ @catalog_service_stub.replace_catalog_attribute request, options do |result, operation|
999
+ yield result, operation if block_given?
1000
+ return result
1001
+ end
1002
+ rescue ::Gapic::Rest::Error => e
1003
+ raise ::Google::Cloud::Error.from_error(e)
1004
+ end
1005
+
1006
+ ##
1007
+ # Configuration class for the CatalogService REST API.
1008
+ #
1009
+ # This class represents the configuration for CatalogService REST,
1010
+ # providing control over timeouts, retry behavior, logging, transport
1011
+ # parameters, and other low-level controls. Certain parameters can also be
1012
+ # applied individually to specific RPCs. See
1013
+ # {::Google::Cloud::Retail::V2::CatalogService::Rest::Client::Configuration::Rpcs}
1014
+ # for a list of RPCs that can be configured independently.
1015
+ #
1016
+ # Configuration can be applied globally to all clients, or to a single client
1017
+ # on construction.
1018
+ #
1019
+ # @example
1020
+ #
1021
+ # # Modify the global config, setting the timeout for
1022
+ # # list_catalogs to 20 seconds,
1023
+ # # and all remaining timeouts to 10 seconds.
1024
+ # ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.configure do |config|
1025
+ # config.timeout = 10.0
1026
+ # config.rpcs.list_catalogs.timeout = 20.0
1027
+ # end
1028
+ #
1029
+ # # Apply the above configuration only to a new client.
1030
+ # client = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config|
1031
+ # config.timeout = 10.0
1032
+ # config.rpcs.list_catalogs.timeout = 20.0
1033
+ # end
1034
+ #
1035
+ # @!attribute [rw] endpoint
1036
+ # The hostname or hostname:port of the service endpoint.
1037
+ # Defaults to `"retail.googleapis.com"`.
1038
+ # @return [::String]
1039
+ # @!attribute [rw] credentials
1040
+ # Credentials to send with calls. You may provide any of the following types:
1041
+ # * (`String`) The path to a service account key file in JSON format
1042
+ # * (`Hash`) A service account key as a Hash
1043
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1044
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1045
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1046
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1047
+ # * (`nil`) indicating no credentials
1048
+ # @return [::Object]
1049
+ # @!attribute [rw] scope
1050
+ # The OAuth scopes
1051
+ # @return [::Array<::String>]
1052
+ # @!attribute [rw] lib_name
1053
+ # The library name as recorded in instrumentation and logging
1054
+ # @return [::String]
1055
+ # @!attribute [rw] lib_version
1056
+ # The library version as recorded in instrumentation and logging
1057
+ # @return [::String]
1058
+ # @!attribute [rw] timeout
1059
+ # The call timeout in seconds.
1060
+ # @return [::Numeric]
1061
+ # @!attribute [rw] metadata
1062
+ # Additional headers to be sent with the call.
1063
+ # @return [::Hash{::Symbol=>::String}]
1064
+ # @!attribute [rw] retry_policy
1065
+ # The retry policy. The value is a hash with the following keys:
1066
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1067
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1068
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1069
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1070
+ # trigger a retry.
1071
+ # @return [::Hash]
1072
+ # @!attribute [rw] quota_project
1073
+ # A separate project against which to charge quota.
1074
+ # @return [::String]
1075
+ #
1076
+ class Configuration
1077
+ extend ::Gapic::Config
1078
+
1079
+ config_attr :endpoint, "retail.googleapis.com", ::String
1080
+ config_attr :credentials, nil do |value|
1081
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1082
+ allowed.any? { |klass| klass === value }
1083
+ end
1084
+ config_attr :scope, nil, ::String, ::Array, nil
1085
+ config_attr :lib_name, nil, ::String, nil
1086
+ config_attr :lib_version, nil, ::String, nil
1087
+ config_attr :timeout, nil, ::Numeric, nil
1088
+ config_attr :metadata, nil, ::Hash, nil
1089
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1090
+ config_attr :quota_project, nil, ::String, nil
1091
+
1092
+ # @private
1093
+ def initialize parent_config = nil
1094
+ @parent_config = parent_config unless parent_config.nil?
1095
+
1096
+ yield self if block_given?
1097
+ end
1098
+
1099
+ ##
1100
+ # Configurations for individual RPCs
1101
+ # @return [Rpcs]
1102
+ #
1103
+ def rpcs
1104
+ @rpcs ||= begin
1105
+ parent_rpcs = nil
1106
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1107
+ Rpcs.new parent_rpcs
1108
+ end
1109
+ end
1110
+
1111
+ ##
1112
+ # Configuration RPC class for the CatalogService API.
1113
+ #
1114
+ # Includes fields providing the configuration for each RPC in this service.
1115
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1116
+ # the following configuration fields:
1117
+ #
1118
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1119
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1120
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1121
+ # include the following keys:
1122
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1123
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1124
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1125
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1126
+ # trigger a retry.
1127
+ #
1128
+ class Rpcs
1129
+ ##
1130
+ # RPC-specific configuration for `list_catalogs`
1131
+ # @return [::Gapic::Config::Method]
1132
+ #
1133
+ attr_reader :list_catalogs
1134
+ ##
1135
+ # RPC-specific configuration for `update_catalog`
1136
+ # @return [::Gapic::Config::Method]
1137
+ #
1138
+ attr_reader :update_catalog
1139
+ ##
1140
+ # RPC-specific configuration for `set_default_branch`
1141
+ # @return [::Gapic::Config::Method]
1142
+ #
1143
+ attr_reader :set_default_branch
1144
+ ##
1145
+ # RPC-specific configuration for `get_default_branch`
1146
+ # @return [::Gapic::Config::Method]
1147
+ #
1148
+ attr_reader :get_default_branch
1149
+ ##
1150
+ # RPC-specific configuration for `get_completion_config`
1151
+ # @return [::Gapic::Config::Method]
1152
+ #
1153
+ attr_reader :get_completion_config
1154
+ ##
1155
+ # RPC-specific configuration for `update_completion_config`
1156
+ # @return [::Gapic::Config::Method]
1157
+ #
1158
+ attr_reader :update_completion_config
1159
+ ##
1160
+ # RPC-specific configuration for `get_attributes_config`
1161
+ # @return [::Gapic::Config::Method]
1162
+ #
1163
+ attr_reader :get_attributes_config
1164
+ ##
1165
+ # RPC-specific configuration for `update_attributes_config`
1166
+ # @return [::Gapic::Config::Method]
1167
+ #
1168
+ attr_reader :update_attributes_config
1169
+ ##
1170
+ # RPC-specific configuration for `add_catalog_attribute`
1171
+ # @return [::Gapic::Config::Method]
1172
+ #
1173
+ attr_reader :add_catalog_attribute
1174
+ ##
1175
+ # RPC-specific configuration for `remove_catalog_attribute`
1176
+ # @return [::Gapic::Config::Method]
1177
+ #
1178
+ attr_reader :remove_catalog_attribute
1179
+ ##
1180
+ # RPC-specific configuration for `replace_catalog_attribute`
1181
+ # @return [::Gapic::Config::Method]
1182
+ #
1183
+ attr_reader :replace_catalog_attribute
1184
+
1185
+ # @private
1186
+ def initialize parent_rpcs = nil
1187
+ list_catalogs_config = parent_rpcs.list_catalogs if parent_rpcs.respond_to? :list_catalogs
1188
+ @list_catalogs = ::Gapic::Config::Method.new list_catalogs_config
1189
+ update_catalog_config = parent_rpcs.update_catalog if parent_rpcs.respond_to? :update_catalog
1190
+ @update_catalog = ::Gapic::Config::Method.new update_catalog_config
1191
+ set_default_branch_config = parent_rpcs.set_default_branch if parent_rpcs.respond_to? :set_default_branch
1192
+ @set_default_branch = ::Gapic::Config::Method.new set_default_branch_config
1193
+ get_default_branch_config = parent_rpcs.get_default_branch if parent_rpcs.respond_to? :get_default_branch
1194
+ @get_default_branch = ::Gapic::Config::Method.new get_default_branch_config
1195
+ get_completion_config_config = parent_rpcs.get_completion_config if parent_rpcs.respond_to? :get_completion_config
1196
+ @get_completion_config = ::Gapic::Config::Method.new get_completion_config_config
1197
+ update_completion_config_config = parent_rpcs.update_completion_config if parent_rpcs.respond_to? :update_completion_config
1198
+ @update_completion_config = ::Gapic::Config::Method.new update_completion_config_config
1199
+ get_attributes_config_config = parent_rpcs.get_attributes_config if parent_rpcs.respond_to? :get_attributes_config
1200
+ @get_attributes_config = ::Gapic::Config::Method.new get_attributes_config_config
1201
+ update_attributes_config_config = parent_rpcs.update_attributes_config if parent_rpcs.respond_to? :update_attributes_config
1202
+ @update_attributes_config = ::Gapic::Config::Method.new update_attributes_config_config
1203
+ add_catalog_attribute_config = parent_rpcs.add_catalog_attribute if parent_rpcs.respond_to? :add_catalog_attribute
1204
+ @add_catalog_attribute = ::Gapic::Config::Method.new add_catalog_attribute_config
1205
+ remove_catalog_attribute_config = parent_rpcs.remove_catalog_attribute if parent_rpcs.respond_to? :remove_catalog_attribute
1206
+ @remove_catalog_attribute = ::Gapic::Config::Method.new remove_catalog_attribute_config
1207
+ replace_catalog_attribute_config = parent_rpcs.replace_catalog_attribute if parent_rpcs.respond_to? :replace_catalog_attribute
1208
+ @replace_catalog_attribute = ::Gapic::Config::Method.new replace_catalog_attribute_config
1209
+
1210
+ yield self if block_given?
1211
+ end
1212
+ end
1213
+ end
1214
+ end
1215
+ end
1216
+ end
1217
+ end
1218
+ end
1219
+ end
1220
+ end