google-shopping-merchant-notifications-v1beta 0.a → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +143 -8
  5. data/lib/google/shopping/merchant/notifications/v1beta/notifications_api_service/client.rb +834 -0
  6. data/lib/google/shopping/merchant/notifications/v1beta/notifications_api_service/credentials.rb +49 -0
  7. data/lib/google/shopping/merchant/notifications/v1beta/notifications_api_service/paths.rb +66 -0
  8. data/lib/google/shopping/merchant/notifications/v1beta/notifications_api_service/rest/client.rb +773 -0
  9. data/lib/google/shopping/merchant/notifications/v1beta/notifications_api_service/rest/service_stub.rb +368 -0
  10. data/lib/google/shopping/merchant/notifications/v1beta/notifications_api_service/rest.rb +54 -0
  11. data/lib/google/shopping/merchant/notifications/v1beta/notifications_api_service.rb +57 -0
  12. data/lib/google/shopping/merchant/notifications/v1beta/notificationsapi_pb.rb +64 -0
  13. data/lib/google/shopping/merchant/notifications/v1beta/notificationsapi_services_pb.rb +66 -0
  14. data/lib/google/shopping/merchant/notifications/v1beta/rest.rb +39 -0
  15. data/lib/google/shopping/merchant/notifications/v1beta/version.rb +7 -2
  16. data/lib/google/shopping/merchant/notifications/v1beta.rb +47 -0
  17. data/lib/google-shopping-merchant-notifications-v1beta.rb +21 -0
  18. data/proto_docs/README.md +4 -0
  19. data/proto_docs/google/api/client.rb +420 -0
  20. data/proto_docs/google/api/field_behavior.rb +85 -0
  21. data/proto_docs/google/api/launch_stage.rb +71 -0
  22. data/proto_docs/google/api/resource.rb +227 -0
  23. data/proto_docs/google/protobuf/duration.rb +98 -0
  24. data/proto_docs/google/protobuf/empty.rb +34 -0
  25. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  26. data/proto_docs/google/shopping/merchant/notifications/v1beta/notificationsapi.rb +215 -0
  27. data/proto_docs/google/shopping/type/types.rb +210 -0
  28. metadata +87 -10
@@ -0,0 +1,773 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 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/shopping/merchant/notifications/v1beta/notificationsapi_pb"
21
+ require "google/shopping/merchant/notifications/v1beta/notifications_api_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Shopping
25
+ module Merchant
26
+ module Notifications
27
+ module V1beta
28
+ module NotificationsApiService
29
+ module Rest
30
+ ##
31
+ # REST client for the NotificationsApiService service.
32
+ #
33
+ # Service to manage notification subscriptions for merchants
34
+ #
35
+ class Client
36
+ # @private
37
+ API_VERSION = ""
38
+
39
+ # @private
40
+ DEFAULT_ENDPOINT_TEMPLATE = "merchantapi.$UNIVERSE_DOMAIN$"
41
+
42
+ include Paths
43
+
44
+ # @private
45
+ attr_reader :notifications_api_service_stub
46
+
47
+ ##
48
+ # Configure the NotificationsApiService Client class.
49
+ #
50
+ # See {::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::Client::Configuration}
51
+ # for a description of the configuration fields.
52
+ #
53
+ # @example
54
+ #
55
+ # # Modify the configuration for all NotificationsApiService clients
56
+ # ::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::Client.configure do |config|
57
+ # config.timeout = 10.0
58
+ # end
59
+ #
60
+ # @yield [config] Configure the Client client.
61
+ # @yieldparam config [Client::Configuration]
62
+ #
63
+ # @return [Client::Configuration]
64
+ #
65
+ def self.configure
66
+ @configure ||= begin
67
+ namespace = ["Google", "Shopping", "Merchant", "Notifications", "V1beta"]
68
+ parent_config = while namespace.any?
69
+ parent_name = namespace.join "::"
70
+ parent_const = const_get parent_name
71
+ break parent_const.configure if parent_const.respond_to? :configure
72
+ namespace.pop
73
+ end
74
+ default_config = Client::Configuration.new parent_config
75
+
76
+ default_config.timeout = 60.0
77
+ default_config.retry_policy = {
78
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
79
+ }
80
+
81
+ default_config
82
+ end
83
+ yield @configure if block_given?
84
+ @configure
85
+ end
86
+
87
+ ##
88
+ # Configure the NotificationsApiService Client instance.
89
+ #
90
+ # The configuration is set to the derived mode, meaning that values can be changed,
91
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
92
+ # should be made on {Client.configure}.
93
+ #
94
+ # See {::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::Client::Configuration}
95
+ # for a description of the configuration fields.
96
+ #
97
+ # @yield [config] Configure the Client client.
98
+ # @yieldparam config [Client::Configuration]
99
+ #
100
+ # @return [Client::Configuration]
101
+ #
102
+ def configure
103
+ yield @config if block_given?
104
+ @config
105
+ end
106
+
107
+ ##
108
+ # The effective universe domain
109
+ #
110
+ # @return [String]
111
+ #
112
+ def universe_domain
113
+ @notifications_api_service_stub.universe_domain
114
+ end
115
+
116
+ ##
117
+ # Create a new NotificationsApiService REST client object.
118
+ #
119
+ # @example
120
+ #
121
+ # # Create a client using the default configuration
122
+ # client = ::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::Client.new
123
+ #
124
+ # # Create a client using a custom configuration
125
+ # client = ::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::Client.new do |config|
126
+ # config.timeout = 10.0
127
+ # end
128
+ #
129
+ # @yield [config] Configure the NotificationsApiService client.
130
+ # @yieldparam config [Client::Configuration]
131
+ #
132
+ def initialize
133
+ # Create the configuration object
134
+ @config = Configuration.new Client.configure
135
+
136
+ # Yield the configuration if needed
137
+ yield @config if block_given?
138
+
139
+ # Create credentials
140
+ credentials = @config.credentials
141
+ # Use self-signed JWT if the endpoint is unchanged from default,
142
+ # but only if the default endpoint does not have a region prefix.
143
+ enable_self_signed_jwt = @config.endpoint.nil? ||
144
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
145
+ !@config.endpoint.split(".").first.include?("-"))
146
+ credentials ||= Credentials.default scope: @config.scope,
147
+ enable_self_signed_jwt: enable_self_signed_jwt
148
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
149
+ credentials = Credentials.new credentials, scope: @config.scope
150
+ end
151
+
152
+ @quota_project_id = @config.quota_project
153
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
154
+
155
+ @notifications_api_service_stub = ::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::ServiceStub.new(
156
+ endpoint: @config.endpoint,
157
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
158
+ universe_domain: @config.universe_domain,
159
+ credentials: credentials
160
+ )
161
+ end
162
+
163
+ # Service calls
164
+
165
+ ##
166
+ # Gets notification subscriptions for an account.
167
+ #
168
+ # @overload get_notification_subscription(request, options = nil)
169
+ # Pass arguments to `get_notification_subscription` via a request object, either of type
170
+ # {::Google::Shopping::Merchant::Notifications::V1beta::GetNotificationSubscriptionRequest} or an equivalent Hash.
171
+ #
172
+ # @param request [::Google::Shopping::Merchant::Notifications::V1beta::GetNotificationSubscriptionRequest, ::Hash]
173
+ # A request object representing the call parameters. Required. To specify no
174
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
175
+ # @param options [::Gapic::CallOptions, ::Hash]
176
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
177
+ #
178
+ # @overload get_notification_subscription(name: nil)
179
+ # Pass arguments to `get_notification_subscription` via keyword arguments. Note that at
180
+ # least one keyword argument is required. To specify no parameters, or to keep all
181
+ # the default parameter values, pass an empty Hash as a request object (see above).
182
+ #
183
+ # @param name [::String]
184
+ # Required. The `name` of the notification subscription.
185
+ # @yield [result, operation] Access the result along with the TransportOperation object
186
+ # @yieldparam result [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription]
187
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
188
+ #
189
+ # @return [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription]
190
+ #
191
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
192
+ #
193
+ # @example Basic example
194
+ # require "google/shopping/merchant/notifications/v1beta"
195
+ #
196
+ # # Create a client object. The client can be reused for multiple calls.
197
+ # client = Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::Client.new
198
+ #
199
+ # # Create a request. To set request fields, pass in keyword arguments.
200
+ # request = Google::Shopping::Merchant::Notifications::V1beta::GetNotificationSubscriptionRequest.new
201
+ #
202
+ # # Call the get_notification_subscription method.
203
+ # result = client.get_notification_subscription request
204
+ #
205
+ # # The returned object is of type Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription.
206
+ # p result
207
+ #
208
+ def get_notification_subscription request, options = nil
209
+ raise ::ArgumentError, "request must be provided" if request.nil?
210
+
211
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Notifications::V1beta::GetNotificationSubscriptionRequest
212
+
213
+ # Converts hash and nil to an options object
214
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
215
+
216
+ # Customize the options with defaults
217
+ call_metadata = @config.rpcs.get_notification_subscription.metadata.to_h
218
+
219
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
220
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
221
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
222
+ gapic_version: ::Google::Shopping::Merchant::Notifications::V1beta::VERSION,
223
+ transports_version_send: [:rest]
224
+
225
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
226
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
227
+
228
+ options.apply_defaults timeout: @config.rpcs.get_notification_subscription.timeout,
229
+ metadata: call_metadata,
230
+ retry_policy: @config.rpcs.get_notification_subscription.retry_policy
231
+
232
+ options.apply_defaults timeout: @config.timeout,
233
+ metadata: @config.metadata,
234
+ retry_policy: @config.retry_policy
235
+
236
+ @notifications_api_service_stub.get_notification_subscription request, options do |result, operation|
237
+ yield result, operation if block_given?
238
+ return result
239
+ end
240
+ rescue ::Gapic::Rest::Error => e
241
+ raise ::Google::Cloud::Error.from_error(e)
242
+ end
243
+
244
+ ##
245
+ # Creates a notification subscription for a merchant. We will allow the
246
+ # following types of notification subscriptions to exist together (per
247
+ # merchant as a subscriber per event type):
248
+ # 1. Subscription for all managed accounts + subscription for self
249
+ # 2. Multiple "partial" subscriptions for managed accounts + subscription
250
+ # for self
251
+ #
252
+ # we will not allow (per merchant as a subscriber per event type):
253
+ # 1. multiple self subscriptions.
254
+ # 2. multiple "all managed accounts" subscriptions.
255
+ # 3. all and partial subscriptions at the same time.
256
+ # 4. multiple partial subscriptions for the same target account
257
+ #
258
+ # @overload create_notification_subscription(request, options = nil)
259
+ # Pass arguments to `create_notification_subscription` via a request object, either of type
260
+ # {::Google::Shopping::Merchant::Notifications::V1beta::CreateNotificationSubscriptionRequest} or an equivalent Hash.
261
+ #
262
+ # @param request [::Google::Shopping::Merchant::Notifications::V1beta::CreateNotificationSubscriptionRequest, ::Hash]
263
+ # A request object representing the call parameters. Required. To specify no
264
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
265
+ # @param options [::Gapic::CallOptions, ::Hash]
266
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
267
+ #
268
+ # @overload create_notification_subscription(parent: nil, notification_subscription: nil)
269
+ # Pass arguments to `create_notification_subscription` via keyword arguments. Note that at
270
+ # least one keyword argument is required. To specify no parameters, or to keep all
271
+ # the default parameter values, pass an empty Hash as a request object (see above).
272
+ #
273
+ # @param parent [::String]
274
+ # Required. The merchant account that owns the new notification subscription.
275
+ # Format: `accounts/{account}`
276
+ # @param notification_subscription [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription, ::Hash]
277
+ # Required. The notification subscription to create.
278
+ # @yield [result, operation] Access the result along with the TransportOperation object
279
+ # @yieldparam result [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription]
280
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
281
+ #
282
+ # @return [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription]
283
+ #
284
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
285
+ #
286
+ # @example Basic example
287
+ # require "google/shopping/merchant/notifications/v1beta"
288
+ #
289
+ # # Create a client object. The client can be reused for multiple calls.
290
+ # client = Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::Client.new
291
+ #
292
+ # # Create a request. To set request fields, pass in keyword arguments.
293
+ # request = Google::Shopping::Merchant::Notifications::V1beta::CreateNotificationSubscriptionRequest.new
294
+ #
295
+ # # Call the create_notification_subscription method.
296
+ # result = client.create_notification_subscription request
297
+ #
298
+ # # The returned object is of type Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription.
299
+ # p result
300
+ #
301
+ def create_notification_subscription request, options = nil
302
+ raise ::ArgumentError, "request must be provided" if request.nil?
303
+
304
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Notifications::V1beta::CreateNotificationSubscriptionRequest
305
+
306
+ # Converts hash and nil to an options object
307
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
308
+
309
+ # Customize the options with defaults
310
+ call_metadata = @config.rpcs.create_notification_subscription.metadata.to_h
311
+
312
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
313
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
314
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
315
+ gapic_version: ::Google::Shopping::Merchant::Notifications::V1beta::VERSION,
316
+ transports_version_send: [:rest]
317
+
318
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
319
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
320
+
321
+ options.apply_defaults timeout: @config.rpcs.create_notification_subscription.timeout,
322
+ metadata: call_metadata,
323
+ retry_policy: @config.rpcs.create_notification_subscription.retry_policy
324
+
325
+ options.apply_defaults timeout: @config.timeout,
326
+ metadata: @config.metadata,
327
+ retry_policy: @config.retry_policy
328
+
329
+ @notifications_api_service_stub.create_notification_subscription request, options do |result, operation|
330
+ yield result, operation if block_given?
331
+ return result
332
+ end
333
+ rescue ::Gapic::Rest::Error => e
334
+ raise ::Google::Cloud::Error.from_error(e)
335
+ end
336
+
337
+ ##
338
+ # Updates an existing notification subscription for a merchant.
339
+ #
340
+ # @overload update_notification_subscription(request, options = nil)
341
+ # Pass arguments to `update_notification_subscription` via a request object, either of type
342
+ # {::Google::Shopping::Merchant::Notifications::V1beta::UpdateNotificationSubscriptionRequest} or an equivalent Hash.
343
+ #
344
+ # @param request [::Google::Shopping::Merchant::Notifications::V1beta::UpdateNotificationSubscriptionRequest, ::Hash]
345
+ # A request object representing the call parameters. Required. To specify no
346
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
347
+ # @param options [::Gapic::CallOptions, ::Hash]
348
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
349
+ #
350
+ # @overload update_notification_subscription(notification_subscription: nil, update_mask: nil)
351
+ # Pass arguments to `update_notification_subscription` via keyword arguments. Note that at
352
+ # least one keyword argument is required. To specify no parameters, or to keep all
353
+ # the default parameter values, pass an empty Hash as a request object (see above).
354
+ #
355
+ # @param notification_subscription [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription, ::Hash]
356
+ # Required. The new version of the notification subscription that should be
357
+ # updated.
358
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
359
+ # List of fields being updated.
360
+ # @yield [result, operation] Access the result along with the TransportOperation object
361
+ # @yieldparam result [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription]
362
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
363
+ #
364
+ # @return [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription]
365
+ #
366
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
367
+ #
368
+ # @example Basic example
369
+ # require "google/shopping/merchant/notifications/v1beta"
370
+ #
371
+ # # Create a client object. The client can be reused for multiple calls.
372
+ # client = Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::Client.new
373
+ #
374
+ # # Create a request. To set request fields, pass in keyword arguments.
375
+ # request = Google::Shopping::Merchant::Notifications::V1beta::UpdateNotificationSubscriptionRequest.new
376
+ #
377
+ # # Call the update_notification_subscription method.
378
+ # result = client.update_notification_subscription request
379
+ #
380
+ # # The returned object is of type Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription.
381
+ # p result
382
+ #
383
+ def update_notification_subscription request, options = nil
384
+ raise ::ArgumentError, "request must be provided" if request.nil?
385
+
386
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Notifications::V1beta::UpdateNotificationSubscriptionRequest
387
+
388
+ # Converts hash and nil to an options object
389
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
390
+
391
+ # Customize the options with defaults
392
+ call_metadata = @config.rpcs.update_notification_subscription.metadata.to_h
393
+
394
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
395
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
396
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
397
+ gapic_version: ::Google::Shopping::Merchant::Notifications::V1beta::VERSION,
398
+ transports_version_send: [:rest]
399
+
400
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
401
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
402
+
403
+ options.apply_defaults timeout: @config.rpcs.update_notification_subscription.timeout,
404
+ metadata: call_metadata,
405
+ retry_policy: @config.rpcs.update_notification_subscription.retry_policy
406
+
407
+ options.apply_defaults timeout: @config.timeout,
408
+ metadata: @config.metadata,
409
+ retry_policy: @config.retry_policy
410
+
411
+ @notifications_api_service_stub.update_notification_subscription request, options do |result, operation|
412
+ yield result, operation if block_given?
413
+ return result
414
+ end
415
+ rescue ::Gapic::Rest::Error => e
416
+ raise ::Google::Cloud::Error.from_error(e)
417
+ end
418
+
419
+ ##
420
+ # Deletes a notification subscription for a merchant.
421
+ #
422
+ # @overload delete_notification_subscription(request, options = nil)
423
+ # Pass arguments to `delete_notification_subscription` via a request object, either of type
424
+ # {::Google::Shopping::Merchant::Notifications::V1beta::DeleteNotificationSubscriptionRequest} or an equivalent Hash.
425
+ #
426
+ # @param request [::Google::Shopping::Merchant::Notifications::V1beta::DeleteNotificationSubscriptionRequest, ::Hash]
427
+ # A request object representing the call parameters. Required. To specify no
428
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
429
+ # @param options [::Gapic::CallOptions, ::Hash]
430
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
431
+ #
432
+ # @overload delete_notification_subscription(name: nil)
433
+ # Pass arguments to `delete_notification_subscription` via keyword arguments. Note that at
434
+ # least one keyword argument is required. To specify no parameters, or to keep all
435
+ # the default parameter values, pass an empty Hash as a request object (see above).
436
+ #
437
+ # @param name [::String]
438
+ # Required. The name of the notification subscription to be deleted.
439
+ # @yield [result, operation] Access the result along with the TransportOperation object
440
+ # @yieldparam result [::Google::Protobuf::Empty]
441
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
442
+ #
443
+ # @return [::Google::Protobuf::Empty]
444
+ #
445
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
446
+ #
447
+ # @example Basic example
448
+ # require "google/shopping/merchant/notifications/v1beta"
449
+ #
450
+ # # Create a client object. The client can be reused for multiple calls.
451
+ # client = Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::Client.new
452
+ #
453
+ # # Create a request. To set request fields, pass in keyword arguments.
454
+ # request = Google::Shopping::Merchant::Notifications::V1beta::DeleteNotificationSubscriptionRequest.new
455
+ #
456
+ # # Call the delete_notification_subscription method.
457
+ # result = client.delete_notification_subscription request
458
+ #
459
+ # # The returned object is of type Google::Protobuf::Empty.
460
+ # p result
461
+ #
462
+ def delete_notification_subscription request, options = nil
463
+ raise ::ArgumentError, "request must be provided" if request.nil?
464
+
465
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Notifications::V1beta::DeleteNotificationSubscriptionRequest
466
+
467
+ # Converts hash and nil to an options object
468
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
469
+
470
+ # Customize the options with defaults
471
+ call_metadata = @config.rpcs.delete_notification_subscription.metadata.to_h
472
+
473
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
474
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
475
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
476
+ gapic_version: ::Google::Shopping::Merchant::Notifications::V1beta::VERSION,
477
+ transports_version_send: [:rest]
478
+
479
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
480
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
481
+
482
+ options.apply_defaults timeout: @config.rpcs.delete_notification_subscription.timeout,
483
+ metadata: call_metadata,
484
+ retry_policy: @config.rpcs.delete_notification_subscription.retry_policy
485
+
486
+ options.apply_defaults timeout: @config.timeout,
487
+ metadata: @config.metadata,
488
+ retry_policy: @config.retry_policy
489
+
490
+ @notifications_api_service_stub.delete_notification_subscription 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 all the notification subscriptions for a merchant.
500
+ #
501
+ # @overload list_notification_subscriptions(request, options = nil)
502
+ # Pass arguments to `list_notification_subscriptions` via a request object, either of type
503
+ # {::Google::Shopping::Merchant::Notifications::V1beta::ListNotificationSubscriptionsRequest} or an equivalent Hash.
504
+ #
505
+ # @param request [::Google::Shopping::Merchant::Notifications::V1beta::ListNotificationSubscriptionsRequest, ::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 list_notification_subscriptions(parent: nil, page_size: nil, page_token: nil)
512
+ # Pass arguments to `list_notification_subscriptions` 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 parent [::String]
517
+ # Required. The merchant account who owns the notification subscriptions.
518
+ # Format: `accounts/{account}`
519
+ # @param page_size [::Integer]
520
+ # The maximum number of notification subscriptions to return in a page.
521
+ # The default value for `page_size` is 100. The
522
+ # maximum value is `200`. Values above `200` will be coerced to `200`.
523
+ # @param page_token [::String]
524
+ # Token (if provided) to retrieve the subsequent page. All other parameters
525
+ # must match the original call that provided the page token.
526
+ # @yield [result, operation] Access the result along with the TransportOperation object
527
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription>]
528
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
529
+ #
530
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription>]
531
+ #
532
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
533
+ #
534
+ # @example Basic example
535
+ # require "google/shopping/merchant/notifications/v1beta"
536
+ #
537
+ # # Create a client object. The client can be reused for multiple calls.
538
+ # client = Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::Client.new
539
+ #
540
+ # # Create a request. To set request fields, pass in keyword arguments.
541
+ # request = Google::Shopping::Merchant::Notifications::V1beta::ListNotificationSubscriptionsRequest.new
542
+ #
543
+ # # Call the list_notification_subscriptions method.
544
+ # result = client.list_notification_subscriptions request
545
+ #
546
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
547
+ # # over elements, and API calls will be issued to fetch pages as needed.
548
+ # result.each do |item|
549
+ # # Each element is of type ::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription.
550
+ # p item
551
+ # end
552
+ #
553
+ def list_notification_subscriptions request, options = nil
554
+ raise ::ArgumentError, "request must be provided" if request.nil?
555
+
556
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Notifications::V1beta::ListNotificationSubscriptionsRequest
557
+
558
+ # Converts hash and nil to an options object
559
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
560
+
561
+ # Customize the options with defaults
562
+ call_metadata = @config.rpcs.list_notification_subscriptions.metadata.to_h
563
+
564
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
565
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
566
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
567
+ gapic_version: ::Google::Shopping::Merchant::Notifications::V1beta::VERSION,
568
+ transports_version_send: [:rest]
569
+
570
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
571
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
572
+
573
+ options.apply_defaults timeout: @config.rpcs.list_notification_subscriptions.timeout,
574
+ metadata: call_metadata,
575
+ retry_policy: @config.rpcs.list_notification_subscriptions.retry_policy
576
+
577
+ options.apply_defaults timeout: @config.timeout,
578
+ metadata: @config.metadata,
579
+ retry_policy: @config.retry_policy
580
+
581
+ @notifications_api_service_stub.list_notification_subscriptions request, options do |result, operation|
582
+ result = ::Gapic::Rest::PagedEnumerable.new @notifications_api_service_stub, :list_notification_subscriptions, "notification_subscriptions", request, result, 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 NotificationsApiService REST API.
592
+ #
593
+ # This class represents the configuration for NotificationsApiService 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::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::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
+ # # get_notification_subscription to 20 seconds,
607
+ # # and all remaining timeouts to 10 seconds.
608
+ # ::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::Client.configure do |config|
609
+ # config.timeout = 10.0
610
+ # config.rpcs.get_notification_subscription.timeout = 20.0
611
+ # end
612
+ #
613
+ # # Apply the above configuration only to a new client.
614
+ # client = ::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::Client.new do |config|
615
+ # config.timeout = 10.0
616
+ # config.rpcs.get_notification_subscription.timeout = 20.0
617
+ # end
618
+ #
619
+ # @!attribute [rw] endpoint
620
+ # A custom service endpoint, as a hostname or hostname:port. The default is
621
+ # nil, indicating to use the default endpoint in the current universe domain.
622
+ # @return [::String,nil]
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://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
629
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
630
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
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
+ # @!attribute [rw] universe_domain
660
+ # The universe domain within which to make requests. This determines the
661
+ # default endpoint URL. The default value of nil uses the environment
662
+ # universe (usually the default "googleapis.com" universe).
663
+ # @return [::String,nil]
664
+ #
665
+ class Configuration
666
+ extend ::Gapic::Config
667
+
668
+ # @private
669
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
670
+ DEFAULT_ENDPOINT = "merchantapi.googleapis.com"
671
+
672
+ config_attr :endpoint, nil, ::String, nil
673
+ config_attr :credentials, nil do |value|
674
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
675
+ allowed.any? { |klass| klass === value }
676
+ end
677
+ config_attr :scope, nil, ::String, ::Array, nil
678
+ config_attr :lib_name, nil, ::String, nil
679
+ config_attr :lib_version, nil, ::String, nil
680
+ config_attr :timeout, nil, ::Numeric, nil
681
+ config_attr :metadata, nil, ::Hash, nil
682
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
683
+ config_attr :quota_project, nil, ::String, nil
684
+ config_attr :universe_domain, nil, ::String, nil
685
+
686
+ # @private
687
+ def initialize parent_config = nil
688
+ @parent_config = parent_config unless parent_config.nil?
689
+
690
+ yield self if block_given?
691
+ end
692
+
693
+ ##
694
+ # Configurations for individual RPCs
695
+ # @return [Rpcs]
696
+ #
697
+ def rpcs
698
+ @rpcs ||= begin
699
+ parent_rpcs = nil
700
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
701
+ Rpcs.new parent_rpcs
702
+ end
703
+ end
704
+
705
+ ##
706
+ # Configuration RPC class for the NotificationsApiService API.
707
+ #
708
+ # Includes fields providing the configuration for each RPC in this service.
709
+ # Each configuration object is of type `Gapic::Config::Method` and includes
710
+ # the following configuration fields:
711
+ #
712
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
713
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
714
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
715
+ # include the following keys:
716
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
717
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
718
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
719
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
720
+ # trigger a retry.
721
+ #
722
+ class Rpcs
723
+ ##
724
+ # RPC-specific configuration for `get_notification_subscription`
725
+ # @return [::Gapic::Config::Method]
726
+ #
727
+ attr_reader :get_notification_subscription
728
+ ##
729
+ # RPC-specific configuration for `create_notification_subscription`
730
+ # @return [::Gapic::Config::Method]
731
+ #
732
+ attr_reader :create_notification_subscription
733
+ ##
734
+ # RPC-specific configuration for `update_notification_subscription`
735
+ # @return [::Gapic::Config::Method]
736
+ #
737
+ attr_reader :update_notification_subscription
738
+ ##
739
+ # RPC-specific configuration for `delete_notification_subscription`
740
+ # @return [::Gapic::Config::Method]
741
+ #
742
+ attr_reader :delete_notification_subscription
743
+ ##
744
+ # RPC-specific configuration for `list_notification_subscriptions`
745
+ # @return [::Gapic::Config::Method]
746
+ #
747
+ attr_reader :list_notification_subscriptions
748
+
749
+ # @private
750
+ def initialize parent_rpcs = nil
751
+ get_notification_subscription_config = parent_rpcs.get_notification_subscription if parent_rpcs.respond_to? :get_notification_subscription
752
+ @get_notification_subscription = ::Gapic::Config::Method.new get_notification_subscription_config
753
+ create_notification_subscription_config = parent_rpcs.create_notification_subscription if parent_rpcs.respond_to? :create_notification_subscription
754
+ @create_notification_subscription = ::Gapic::Config::Method.new create_notification_subscription_config
755
+ update_notification_subscription_config = parent_rpcs.update_notification_subscription if parent_rpcs.respond_to? :update_notification_subscription
756
+ @update_notification_subscription = ::Gapic::Config::Method.new update_notification_subscription_config
757
+ delete_notification_subscription_config = parent_rpcs.delete_notification_subscription if parent_rpcs.respond_to? :delete_notification_subscription
758
+ @delete_notification_subscription = ::Gapic::Config::Method.new delete_notification_subscription_config
759
+ list_notification_subscriptions_config = parent_rpcs.list_notification_subscriptions if parent_rpcs.respond_to? :list_notification_subscriptions
760
+ @list_notification_subscriptions = ::Gapic::Config::Method.new list_notification_subscriptions_config
761
+
762
+ yield self if block_given?
763
+ end
764
+ end
765
+ end
766
+ end
767
+ end
768
+ end
769
+ end
770
+ end
771
+ end
772
+ end
773
+ end