google-cloud-recommendation_engine-v1beta1 0.4.1 → 0.5.0

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