google-shopping-merchant-notifications-v1 0.a → 0.1.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 (27) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +154 -8
  5. data/lib/google/shopping/merchant/notifications/v1/notifications_api_service/client.rb +971 -0
  6. data/lib/google/shopping/merchant/notifications/v1/notifications_api_service/credentials.rb +49 -0
  7. data/lib/google/shopping/merchant/notifications/v1/notifications_api_service/paths.rb +83 -0
  8. data/lib/google/shopping/merchant/notifications/v1/notifications_api_service/rest/client.rb +903 -0
  9. data/lib/google/shopping/merchant/notifications/v1/notifications_api_service/rest/service_stub.rb +451 -0
  10. data/lib/google/shopping/merchant/notifications/v1/notifications_api_service/rest.rb +54 -0
  11. data/lib/google/shopping/merchant/notifications/v1/notifications_api_service.rb +57 -0
  12. data/lib/google/shopping/merchant/notifications/v1/notificationsapi_pb.rb +61 -0
  13. data/lib/google/shopping/merchant/notifications/v1/notificationsapi_services_pb.rb +81 -0
  14. data/lib/google/shopping/merchant/notifications/v1/rest.rb +39 -0
  15. data/lib/google/shopping/merchant/notifications/v1/version.rb +7 -2
  16. data/lib/google/shopping/merchant/notifications/v1.rb +47 -0
  17. data/lib/google-shopping-merchant-notifications-v1.rb +21 -0
  18. data/proto_docs/README.md +4 -0
  19. data/proto_docs/google/api/client.rb +473 -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/v1/notificationsapi.rb +184 -0
  27. metadata +71 -9
@@ -0,0 +1,903 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2025 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/v1/notificationsapi_pb"
21
+ require "google/shopping/merchant/notifications/v1/notifications_api_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Shopping
25
+ module Merchant
26
+ module Notifications
27
+ module V1
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::V1::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::V1::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", "V1"]
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::V1::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::V1::NotificationsApiService::Rest::Client.new
123
+ #
124
+ # # Create a client using a custom configuration
125
+ # client = ::Google::Shopping::Merchant::Notifications::V1::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::V1::NotificationsApiService::Rest::ServiceStub.new(
156
+ endpoint: @config.endpoint,
157
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
158
+ universe_domain: @config.universe_domain,
159
+ credentials: credentials,
160
+ logger: @config.logger
161
+ )
162
+
163
+ @notifications_api_service_stub.logger(stub: true)&.info do |entry|
164
+ entry.set_system_name
165
+ entry.set_service
166
+ entry.message = "Created client for #{entry.service}"
167
+ entry.set_credentials_fields credentials
168
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
169
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
170
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
171
+ end
172
+ end
173
+
174
+ ##
175
+ # The logger used for request/response debug logging.
176
+ #
177
+ # @return [Logger]
178
+ #
179
+ def logger
180
+ @notifications_api_service_stub.logger
181
+ end
182
+
183
+ # Service calls
184
+
185
+ ##
186
+ # Gets notification subscriptions for an account.
187
+ #
188
+ # @overload get_notification_subscription(request, options = nil)
189
+ # Pass arguments to `get_notification_subscription` via a request object, either of type
190
+ # {::Google::Shopping::Merchant::Notifications::V1::GetNotificationSubscriptionRequest} or an equivalent Hash.
191
+ #
192
+ # @param request [::Google::Shopping::Merchant::Notifications::V1::GetNotificationSubscriptionRequest, ::Hash]
193
+ # A request object representing the call parameters. Required. To specify no
194
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
195
+ # @param options [::Gapic::CallOptions, ::Hash]
196
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
197
+ #
198
+ # @overload get_notification_subscription(name: nil)
199
+ # Pass arguments to `get_notification_subscription` via keyword arguments. Note that at
200
+ # least one keyword argument is required. To specify no parameters, or to keep all
201
+ # the default parameter values, pass an empty Hash as a request object (see above).
202
+ #
203
+ # @param name [::String]
204
+ # Required. The `name` of the notification subscription.
205
+ # @yield [result, operation] Access the result along with the TransportOperation object
206
+ # @yieldparam result [::Google::Shopping::Merchant::Notifications::V1::NotificationSubscription]
207
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
208
+ #
209
+ # @return [::Google::Shopping::Merchant::Notifications::V1::NotificationSubscription]
210
+ #
211
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
212
+ #
213
+ # @example Basic example
214
+ # require "google/shopping/merchant/notifications/v1"
215
+ #
216
+ # # Create a client object. The client can be reused for multiple calls.
217
+ # client = Google::Shopping::Merchant::Notifications::V1::NotificationsApiService::Rest::Client.new
218
+ #
219
+ # # Create a request. To set request fields, pass in keyword arguments.
220
+ # request = Google::Shopping::Merchant::Notifications::V1::GetNotificationSubscriptionRequest.new
221
+ #
222
+ # # Call the get_notification_subscription method.
223
+ # result = client.get_notification_subscription request
224
+ #
225
+ # # The returned object is of type Google::Shopping::Merchant::Notifications::V1::NotificationSubscription.
226
+ # p result
227
+ #
228
+ def get_notification_subscription request, options = nil
229
+ raise ::ArgumentError, "request must be provided" if request.nil?
230
+
231
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Notifications::V1::GetNotificationSubscriptionRequest
232
+
233
+ # Converts hash and nil to an options object
234
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
235
+
236
+ # Customize the options with defaults
237
+ call_metadata = @config.rpcs.get_notification_subscription.metadata.to_h
238
+
239
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
240
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
241
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
242
+ gapic_version: ::Google::Shopping::Merchant::Notifications::V1::VERSION,
243
+ transports_version_send: [:rest]
244
+
245
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
246
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
247
+
248
+ options.apply_defaults timeout: @config.rpcs.get_notification_subscription.timeout,
249
+ metadata: call_metadata,
250
+ retry_policy: @config.rpcs.get_notification_subscription.retry_policy
251
+
252
+ options.apply_defaults timeout: @config.timeout,
253
+ metadata: @config.metadata,
254
+ retry_policy: @config.retry_policy
255
+
256
+ @notifications_api_service_stub.get_notification_subscription request, options do |result, operation|
257
+ yield result, operation if block_given?
258
+ end
259
+ rescue ::Gapic::Rest::Error => e
260
+ raise ::Google::Cloud::Error.from_error(e)
261
+ end
262
+
263
+ ##
264
+ # Creates a notification subscription for a business.
265
+ # For standalone or subaccounts accounts, the business can create a
266
+ # subscription for self. For MCAs, the business can create a
267
+ # subscription for all managed accounts or for a specific subaccount.
268
+ #
269
+ # We will allow the following types of notification subscriptions to exist
270
+ # together (per business as a subscriber per event type):
271
+ #
272
+ # 1. Subscription for all managed accounts + subscription for self.
273
+ #
274
+ # 2. Multiple "partial" subscriptions for managed accounts + subscription
275
+ # for self.
276
+ #
277
+ # we will not allow (per business as a subscriber per event type):
278
+ #
279
+ # 1. Multiple self subscriptions.
280
+ #
281
+ # 2. Multiple "all managed accounts" subscriptions.
282
+ #
283
+ # 3. "All managed accounts" subscription and partial subscriptions at the
284
+ # same time.
285
+ #
286
+ # 4. Multiple partial subscriptions for the same target account.
287
+ #
288
+ # @overload create_notification_subscription(request, options = nil)
289
+ # Pass arguments to `create_notification_subscription` via a request object, either of type
290
+ # {::Google::Shopping::Merchant::Notifications::V1::CreateNotificationSubscriptionRequest} or an equivalent Hash.
291
+ #
292
+ # @param request [::Google::Shopping::Merchant::Notifications::V1::CreateNotificationSubscriptionRequest, ::Hash]
293
+ # A request object representing the call parameters. Required. To specify no
294
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
295
+ # @param options [::Gapic::CallOptions, ::Hash]
296
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
297
+ #
298
+ # @overload create_notification_subscription(parent: nil, notification_subscription: nil)
299
+ # Pass arguments to `create_notification_subscription` via keyword arguments. Note that at
300
+ # least one keyword argument is required. To specify no parameters, or to keep all
301
+ # the default parameter values, pass an empty Hash as a request object (see above).
302
+ #
303
+ # @param parent [::String]
304
+ # Required. The merchant account that owns the new notification subscription.
305
+ # Format: `accounts/{account}`
306
+ # @param notification_subscription [::Google::Shopping::Merchant::Notifications::V1::NotificationSubscription, ::Hash]
307
+ # Required. The notification subscription to create.
308
+ # @yield [result, operation] Access the result along with the TransportOperation object
309
+ # @yieldparam result [::Google::Shopping::Merchant::Notifications::V1::NotificationSubscription]
310
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
311
+ #
312
+ # @return [::Google::Shopping::Merchant::Notifications::V1::NotificationSubscription]
313
+ #
314
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
315
+ #
316
+ # @example Basic example
317
+ # require "google/shopping/merchant/notifications/v1"
318
+ #
319
+ # # Create a client object. The client can be reused for multiple calls.
320
+ # client = Google::Shopping::Merchant::Notifications::V1::NotificationsApiService::Rest::Client.new
321
+ #
322
+ # # Create a request. To set request fields, pass in keyword arguments.
323
+ # request = Google::Shopping::Merchant::Notifications::V1::CreateNotificationSubscriptionRequest.new
324
+ #
325
+ # # Call the create_notification_subscription method.
326
+ # result = client.create_notification_subscription request
327
+ #
328
+ # # The returned object is of type Google::Shopping::Merchant::Notifications::V1::NotificationSubscription.
329
+ # p result
330
+ #
331
+ def create_notification_subscription request, options = nil
332
+ raise ::ArgumentError, "request must be provided" if request.nil?
333
+
334
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Notifications::V1::CreateNotificationSubscriptionRequest
335
+
336
+ # Converts hash and nil to an options object
337
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
338
+
339
+ # Customize the options with defaults
340
+ call_metadata = @config.rpcs.create_notification_subscription.metadata.to_h
341
+
342
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
343
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
344
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
345
+ gapic_version: ::Google::Shopping::Merchant::Notifications::V1::VERSION,
346
+ transports_version_send: [:rest]
347
+
348
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
349
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
350
+
351
+ options.apply_defaults timeout: @config.rpcs.create_notification_subscription.timeout,
352
+ metadata: call_metadata,
353
+ retry_policy: @config.rpcs.create_notification_subscription.retry_policy
354
+
355
+ options.apply_defaults timeout: @config.timeout,
356
+ metadata: @config.metadata,
357
+ retry_policy: @config.retry_policy
358
+
359
+ @notifications_api_service_stub.create_notification_subscription request, options do |result, operation|
360
+ yield result, operation if block_given?
361
+ end
362
+ rescue ::Gapic::Rest::Error => e
363
+ raise ::Google::Cloud::Error.from_error(e)
364
+ end
365
+
366
+ ##
367
+ # Updates an existing notification subscription for a merchant.
368
+ #
369
+ # @overload update_notification_subscription(request, options = nil)
370
+ # Pass arguments to `update_notification_subscription` via a request object, either of type
371
+ # {::Google::Shopping::Merchant::Notifications::V1::UpdateNotificationSubscriptionRequest} or an equivalent Hash.
372
+ #
373
+ # @param request [::Google::Shopping::Merchant::Notifications::V1::UpdateNotificationSubscriptionRequest, ::Hash]
374
+ # A request object representing the call parameters. Required. To specify no
375
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
376
+ # @param options [::Gapic::CallOptions, ::Hash]
377
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
378
+ #
379
+ # @overload update_notification_subscription(notification_subscription: nil, update_mask: nil)
380
+ # Pass arguments to `update_notification_subscription` via keyword arguments. Note that at
381
+ # least one keyword argument is required. To specify no parameters, or to keep all
382
+ # the default parameter values, pass an empty Hash as a request object (see above).
383
+ #
384
+ # @param notification_subscription [::Google::Shopping::Merchant::Notifications::V1::NotificationSubscription, ::Hash]
385
+ # Required. The new version of the notification subscription that should be
386
+ # updated.
387
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
388
+ # List of fields being updated.
389
+ # @yield [result, operation] Access the result along with the TransportOperation object
390
+ # @yieldparam result [::Google::Shopping::Merchant::Notifications::V1::NotificationSubscription]
391
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
392
+ #
393
+ # @return [::Google::Shopping::Merchant::Notifications::V1::NotificationSubscription]
394
+ #
395
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
396
+ #
397
+ # @example Basic example
398
+ # require "google/shopping/merchant/notifications/v1"
399
+ #
400
+ # # Create a client object. The client can be reused for multiple calls.
401
+ # client = Google::Shopping::Merchant::Notifications::V1::NotificationsApiService::Rest::Client.new
402
+ #
403
+ # # Create a request. To set request fields, pass in keyword arguments.
404
+ # request = Google::Shopping::Merchant::Notifications::V1::UpdateNotificationSubscriptionRequest.new
405
+ #
406
+ # # Call the update_notification_subscription method.
407
+ # result = client.update_notification_subscription request
408
+ #
409
+ # # The returned object is of type Google::Shopping::Merchant::Notifications::V1::NotificationSubscription.
410
+ # p result
411
+ #
412
+ def update_notification_subscription request, options = nil
413
+ raise ::ArgumentError, "request must be provided" if request.nil?
414
+
415
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Notifications::V1::UpdateNotificationSubscriptionRequest
416
+
417
+ # Converts hash and nil to an options object
418
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
419
+
420
+ # Customize the options with defaults
421
+ call_metadata = @config.rpcs.update_notification_subscription.metadata.to_h
422
+
423
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
424
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
425
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
426
+ gapic_version: ::Google::Shopping::Merchant::Notifications::V1::VERSION,
427
+ transports_version_send: [:rest]
428
+
429
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
430
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
431
+
432
+ options.apply_defaults timeout: @config.rpcs.update_notification_subscription.timeout,
433
+ metadata: call_metadata,
434
+ retry_policy: @config.rpcs.update_notification_subscription.retry_policy
435
+
436
+ options.apply_defaults timeout: @config.timeout,
437
+ metadata: @config.metadata,
438
+ retry_policy: @config.retry_policy
439
+
440
+ @notifications_api_service_stub.update_notification_subscription request, options do |result, operation|
441
+ yield result, operation if block_given?
442
+ end
443
+ rescue ::Gapic::Rest::Error => e
444
+ raise ::Google::Cloud::Error.from_error(e)
445
+ end
446
+
447
+ ##
448
+ # Deletes a notification subscription for a merchant.
449
+ #
450
+ # @overload delete_notification_subscription(request, options = nil)
451
+ # Pass arguments to `delete_notification_subscription` via a request object, either of type
452
+ # {::Google::Shopping::Merchant::Notifications::V1::DeleteNotificationSubscriptionRequest} or an equivalent Hash.
453
+ #
454
+ # @param request [::Google::Shopping::Merchant::Notifications::V1::DeleteNotificationSubscriptionRequest, ::Hash]
455
+ # A request object representing the call parameters. Required. To specify no
456
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
457
+ # @param options [::Gapic::CallOptions, ::Hash]
458
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
459
+ #
460
+ # @overload delete_notification_subscription(name: nil)
461
+ # Pass arguments to `delete_notification_subscription` via keyword arguments. Note that at
462
+ # least one keyword argument is required. To specify no parameters, or to keep all
463
+ # the default parameter values, pass an empty Hash as a request object (see above).
464
+ #
465
+ # @param name [::String]
466
+ # Required. The name of the notification subscription to be deleted.
467
+ # @yield [result, operation] Access the result along with the TransportOperation object
468
+ # @yieldparam result [::Google::Protobuf::Empty]
469
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
470
+ #
471
+ # @return [::Google::Protobuf::Empty]
472
+ #
473
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
474
+ #
475
+ # @example Basic example
476
+ # require "google/shopping/merchant/notifications/v1"
477
+ #
478
+ # # Create a client object. The client can be reused for multiple calls.
479
+ # client = Google::Shopping::Merchant::Notifications::V1::NotificationsApiService::Rest::Client.new
480
+ #
481
+ # # Create a request. To set request fields, pass in keyword arguments.
482
+ # request = Google::Shopping::Merchant::Notifications::V1::DeleteNotificationSubscriptionRequest.new
483
+ #
484
+ # # Call the delete_notification_subscription method.
485
+ # result = client.delete_notification_subscription request
486
+ #
487
+ # # The returned object is of type Google::Protobuf::Empty.
488
+ # p result
489
+ #
490
+ def delete_notification_subscription request, options = nil
491
+ raise ::ArgumentError, "request must be provided" if request.nil?
492
+
493
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Notifications::V1::DeleteNotificationSubscriptionRequest
494
+
495
+ # Converts hash and nil to an options object
496
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
497
+
498
+ # Customize the options with defaults
499
+ call_metadata = @config.rpcs.delete_notification_subscription.metadata.to_h
500
+
501
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
502
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
503
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
504
+ gapic_version: ::Google::Shopping::Merchant::Notifications::V1::VERSION,
505
+ transports_version_send: [:rest]
506
+
507
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
508
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
509
+
510
+ options.apply_defaults timeout: @config.rpcs.delete_notification_subscription.timeout,
511
+ metadata: call_metadata,
512
+ retry_policy: @config.rpcs.delete_notification_subscription.retry_policy
513
+
514
+ options.apply_defaults timeout: @config.timeout,
515
+ metadata: @config.metadata,
516
+ retry_policy: @config.retry_policy
517
+
518
+ @notifications_api_service_stub.delete_notification_subscription request, options do |result, operation|
519
+ yield result, operation if block_given?
520
+ end
521
+ rescue ::Gapic::Rest::Error => e
522
+ raise ::Google::Cloud::Error.from_error(e)
523
+ end
524
+
525
+ ##
526
+ # Gets all the notification subscriptions for a merchant.
527
+ #
528
+ # @overload list_notification_subscriptions(request, options = nil)
529
+ # Pass arguments to `list_notification_subscriptions` via a request object, either of type
530
+ # {::Google::Shopping::Merchant::Notifications::V1::ListNotificationSubscriptionsRequest} or an equivalent Hash.
531
+ #
532
+ # @param request [::Google::Shopping::Merchant::Notifications::V1::ListNotificationSubscriptionsRequest, ::Hash]
533
+ # A request object representing the call parameters. Required. To specify no
534
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
535
+ # @param options [::Gapic::CallOptions, ::Hash]
536
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
537
+ #
538
+ # @overload list_notification_subscriptions(parent: nil, page_size: nil, page_token: nil)
539
+ # Pass arguments to `list_notification_subscriptions` via keyword arguments. Note that at
540
+ # least one keyword argument is required. To specify no parameters, or to keep all
541
+ # the default parameter values, pass an empty Hash as a request object (see above).
542
+ #
543
+ # @param parent [::String]
544
+ # Required. The merchant account who owns the notification subscriptions.
545
+ # Format: `accounts/{account}`
546
+ # @param page_size [::Integer]
547
+ # The maximum number of notification subscriptions to return in a page.
548
+ # The default value for `page_size` is 100. The
549
+ # maximum value is `200`. Values above `200` will be coerced to `200`.
550
+ # @param page_token [::String]
551
+ # Token (if provided) to retrieve the subsequent page. All other parameters
552
+ # must match the original call that provided the page token.
553
+ # @yield [result, operation] Access the result along with the TransportOperation object
554
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Shopping::Merchant::Notifications::V1::NotificationSubscription>]
555
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
556
+ #
557
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Shopping::Merchant::Notifications::V1::NotificationSubscription>]
558
+ #
559
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
560
+ #
561
+ # @example Basic example
562
+ # require "google/shopping/merchant/notifications/v1"
563
+ #
564
+ # # Create a client object. The client can be reused for multiple calls.
565
+ # client = Google::Shopping::Merchant::Notifications::V1::NotificationsApiService::Rest::Client.new
566
+ #
567
+ # # Create a request. To set request fields, pass in keyword arguments.
568
+ # request = Google::Shopping::Merchant::Notifications::V1::ListNotificationSubscriptionsRequest.new
569
+ #
570
+ # # Call the list_notification_subscriptions method.
571
+ # result = client.list_notification_subscriptions request
572
+ #
573
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
574
+ # # over elements, and API calls will be issued to fetch pages as needed.
575
+ # result.each do |item|
576
+ # # Each element is of type ::Google::Shopping::Merchant::Notifications::V1::NotificationSubscription.
577
+ # p item
578
+ # end
579
+ #
580
+ def list_notification_subscriptions request, options = nil
581
+ raise ::ArgumentError, "request must be provided" if request.nil?
582
+
583
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Notifications::V1::ListNotificationSubscriptionsRequest
584
+
585
+ # Converts hash and nil to an options object
586
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
587
+
588
+ # Customize the options with defaults
589
+ call_metadata = @config.rpcs.list_notification_subscriptions.metadata.to_h
590
+
591
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
592
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
593
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
594
+ gapic_version: ::Google::Shopping::Merchant::Notifications::V1::VERSION,
595
+ transports_version_send: [:rest]
596
+
597
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
598
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
599
+
600
+ options.apply_defaults timeout: @config.rpcs.list_notification_subscriptions.timeout,
601
+ metadata: call_metadata,
602
+ retry_policy: @config.rpcs.list_notification_subscriptions.retry_policy
603
+
604
+ options.apply_defaults timeout: @config.timeout,
605
+ metadata: @config.metadata,
606
+ retry_policy: @config.retry_policy
607
+
608
+ @notifications_api_service_stub.list_notification_subscriptions request, options do |result, operation|
609
+ result = ::Gapic::Rest::PagedEnumerable.new @notifications_api_service_stub, :list_notification_subscriptions, "notification_subscriptions", request, result, options
610
+ yield result, operation if block_given?
611
+ throw :response, result
612
+ end
613
+ rescue ::Gapic::Rest::Error => e
614
+ raise ::Google::Cloud::Error.from_error(e)
615
+ end
616
+
617
+ ##
618
+ # Retrieves notification subscription health metrics for a merchant.
619
+ # We recommend calling this periodically (hourly or daily) to monitor health
620
+ # of your callback endpoint.
621
+ #
622
+ # @overload get_notification_subscription_health_metrics(request, options = nil)
623
+ # Pass arguments to `get_notification_subscription_health_metrics` via a request object, either of type
624
+ # {::Google::Shopping::Merchant::Notifications::V1::GetNotificationSubscriptionHealthMetricsRequest} or an equivalent Hash.
625
+ #
626
+ # @param request [::Google::Shopping::Merchant::Notifications::V1::GetNotificationSubscriptionHealthMetricsRequest, ::Hash]
627
+ # A request object representing the call parameters. Required. To specify no
628
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
629
+ # @param options [::Gapic::CallOptions, ::Hash]
630
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
631
+ #
632
+ # @overload get_notification_subscription_health_metrics(name: nil)
633
+ # Pass arguments to `get_notification_subscription_health_metrics` via keyword arguments. Note that at
634
+ # least one keyword argument is required. To specify no parameters, or to keep all
635
+ # the default parameter values, pass an empty Hash as a request object (see above).
636
+ #
637
+ # @param name [::String]
638
+ # Required. The `name` of the notification subscription for which metrics are
639
+ # retrieved.
640
+ # Format:
641
+ # `accounts/{account}/notificationsubscriptions/{notification_subscription}`
642
+ # @yield [result, operation] Access the result along with the TransportOperation object
643
+ # @yieldparam result [::Google::Shopping::Merchant::Notifications::V1::NotificationSubscriptionHealthMetrics]
644
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
645
+ #
646
+ # @return [::Google::Shopping::Merchant::Notifications::V1::NotificationSubscriptionHealthMetrics]
647
+ #
648
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
649
+ #
650
+ # @example Basic example
651
+ # require "google/shopping/merchant/notifications/v1"
652
+ #
653
+ # # Create a client object. The client can be reused for multiple calls.
654
+ # client = Google::Shopping::Merchant::Notifications::V1::NotificationsApiService::Rest::Client.new
655
+ #
656
+ # # Create a request. To set request fields, pass in keyword arguments.
657
+ # request = Google::Shopping::Merchant::Notifications::V1::GetNotificationSubscriptionHealthMetricsRequest.new
658
+ #
659
+ # # Call the get_notification_subscription_health_metrics method.
660
+ # result = client.get_notification_subscription_health_metrics request
661
+ #
662
+ # # The returned object is of type Google::Shopping::Merchant::Notifications::V1::NotificationSubscriptionHealthMetrics.
663
+ # p result
664
+ #
665
+ def get_notification_subscription_health_metrics request, options = nil
666
+ raise ::ArgumentError, "request must be provided" if request.nil?
667
+
668
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Notifications::V1::GetNotificationSubscriptionHealthMetricsRequest
669
+
670
+ # Converts hash and nil to an options object
671
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
672
+
673
+ # Customize the options with defaults
674
+ call_metadata = @config.rpcs.get_notification_subscription_health_metrics.metadata.to_h
675
+
676
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
677
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
678
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
679
+ gapic_version: ::Google::Shopping::Merchant::Notifications::V1::VERSION,
680
+ transports_version_send: [:rest]
681
+
682
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
683
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
684
+
685
+ options.apply_defaults timeout: @config.rpcs.get_notification_subscription_health_metrics.timeout,
686
+ metadata: call_metadata,
687
+ retry_policy: @config.rpcs.get_notification_subscription_health_metrics.retry_policy
688
+
689
+ options.apply_defaults timeout: @config.timeout,
690
+ metadata: @config.metadata,
691
+ retry_policy: @config.retry_policy
692
+
693
+ @notifications_api_service_stub.get_notification_subscription_health_metrics request, options do |result, operation|
694
+ yield result, operation if block_given?
695
+ end
696
+ rescue ::Gapic::Rest::Error => e
697
+ raise ::Google::Cloud::Error.from_error(e)
698
+ end
699
+
700
+ ##
701
+ # Configuration class for the NotificationsApiService REST API.
702
+ #
703
+ # This class represents the configuration for NotificationsApiService REST,
704
+ # providing control over timeouts, retry behavior, logging, transport
705
+ # parameters, and other low-level controls. Certain parameters can also be
706
+ # applied individually to specific RPCs. See
707
+ # {::Google::Shopping::Merchant::Notifications::V1::NotificationsApiService::Rest::Client::Configuration::Rpcs}
708
+ # for a list of RPCs that can be configured independently.
709
+ #
710
+ # Configuration can be applied globally to all clients, or to a single client
711
+ # on construction.
712
+ #
713
+ # @example
714
+ #
715
+ # # Modify the global config, setting the timeout for
716
+ # # get_notification_subscription to 20 seconds,
717
+ # # and all remaining timeouts to 10 seconds.
718
+ # ::Google::Shopping::Merchant::Notifications::V1::NotificationsApiService::Rest::Client.configure do |config|
719
+ # config.timeout = 10.0
720
+ # config.rpcs.get_notification_subscription.timeout = 20.0
721
+ # end
722
+ #
723
+ # # Apply the above configuration only to a new client.
724
+ # client = ::Google::Shopping::Merchant::Notifications::V1::NotificationsApiService::Rest::Client.new do |config|
725
+ # config.timeout = 10.0
726
+ # config.rpcs.get_notification_subscription.timeout = 20.0
727
+ # end
728
+ #
729
+ # @!attribute [rw] endpoint
730
+ # A custom service endpoint, as a hostname or hostname:port. The default is
731
+ # nil, indicating to use the default endpoint in the current universe domain.
732
+ # @return [::String,nil]
733
+ # @!attribute [rw] credentials
734
+ # Credentials to send with calls. You may provide any of the following types:
735
+ # * (`String`) The path to a service account key file in JSON format
736
+ # * (`Hash`) A service account key as a Hash
737
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
738
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
739
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
740
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
741
+ # * (`nil`) indicating no credentials
742
+ #
743
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
744
+ # external source for authentication to Google Cloud, you must validate it before
745
+ # providing it to a Google API client library. Providing an unvalidated credential
746
+ # configuration to Google APIs can compromise the security of your systems and data.
747
+ # For more information, refer to [Validate credential configurations from external
748
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
749
+ # @return [::Object]
750
+ # @!attribute [rw] scope
751
+ # The OAuth scopes
752
+ # @return [::Array<::String>]
753
+ # @!attribute [rw] lib_name
754
+ # The library name as recorded in instrumentation and logging
755
+ # @return [::String]
756
+ # @!attribute [rw] lib_version
757
+ # The library version as recorded in instrumentation and logging
758
+ # @return [::String]
759
+ # @!attribute [rw] timeout
760
+ # The call timeout in seconds.
761
+ # @return [::Numeric]
762
+ # @!attribute [rw] metadata
763
+ # Additional headers to be sent with the call.
764
+ # @return [::Hash{::Symbol=>::String}]
765
+ # @!attribute [rw] retry_policy
766
+ # The retry policy. The value is a hash with the following keys:
767
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
768
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
769
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
770
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
771
+ # trigger a retry.
772
+ # @return [::Hash]
773
+ # @!attribute [rw] quota_project
774
+ # A separate project against which to charge quota.
775
+ # @return [::String]
776
+ # @!attribute [rw] universe_domain
777
+ # The universe domain within which to make requests. This determines the
778
+ # default endpoint URL. The default value of nil uses the environment
779
+ # universe (usually the default "googleapis.com" universe).
780
+ # @return [::String,nil]
781
+ # @!attribute [rw] logger
782
+ # A custom logger to use for request/response debug logging, or the value
783
+ # `:default` (the default) to construct a default logger, or `nil` to
784
+ # explicitly disable logging.
785
+ # @return [::Logger,:default,nil]
786
+ #
787
+ class Configuration
788
+ extend ::Gapic::Config
789
+
790
+ # @private
791
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
792
+ DEFAULT_ENDPOINT = "merchantapi.googleapis.com"
793
+
794
+ config_attr :endpoint, nil, ::String, nil
795
+ config_attr :credentials, nil do |value|
796
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
797
+ allowed.any? { |klass| klass === value }
798
+ end
799
+ config_attr :scope, nil, ::String, ::Array, nil
800
+ config_attr :lib_name, nil, ::String, nil
801
+ config_attr :lib_version, nil, ::String, nil
802
+ config_attr :timeout, nil, ::Numeric, nil
803
+ config_attr :metadata, nil, ::Hash, nil
804
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
805
+ config_attr :quota_project, nil, ::String, nil
806
+ config_attr :universe_domain, nil, ::String, nil
807
+ config_attr :logger, :default, ::Logger, nil, :default
808
+
809
+ # @private
810
+ def initialize parent_config = nil
811
+ @parent_config = parent_config unless parent_config.nil?
812
+
813
+ yield self if block_given?
814
+ end
815
+
816
+ ##
817
+ # Configurations for individual RPCs
818
+ # @return [Rpcs]
819
+ #
820
+ def rpcs
821
+ @rpcs ||= begin
822
+ parent_rpcs = nil
823
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
824
+ Rpcs.new parent_rpcs
825
+ end
826
+ end
827
+
828
+ ##
829
+ # Configuration RPC class for the NotificationsApiService API.
830
+ #
831
+ # Includes fields providing the configuration for each RPC in this service.
832
+ # Each configuration object is of type `Gapic::Config::Method` and includes
833
+ # the following configuration fields:
834
+ #
835
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
836
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
837
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
838
+ # include the following keys:
839
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
840
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
841
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
842
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
843
+ # trigger a retry.
844
+ #
845
+ class Rpcs
846
+ ##
847
+ # RPC-specific configuration for `get_notification_subscription`
848
+ # @return [::Gapic::Config::Method]
849
+ #
850
+ attr_reader :get_notification_subscription
851
+ ##
852
+ # RPC-specific configuration for `create_notification_subscription`
853
+ # @return [::Gapic::Config::Method]
854
+ #
855
+ attr_reader :create_notification_subscription
856
+ ##
857
+ # RPC-specific configuration for `update_notification_subscription`
858
+ # @return [::Gapic::Config::Method]
859
+ #
860
+ attr_reader :update_notification_subscription
861
+ ##
862
+ # RPC-specific configuration for `delete_notification_subscription`
863
+ # @return [::Gapic::Config::Method]
864
+ #
865
+ attr_reader :delete_notification_subscription
866
+ ##
867
+ # RPC-specific configuration for `list_notification_subscriptions`
868
+ # @return [::Gapic::Config::Method]
869
+ #
870
+ attr_reader :list_notification_subscriptions
871
+ ##
872
+ # RPC-specific configuration for `get_notification_subscription_health_metrics`
873
+ # @return [::Gapic::Config::Method]
874
+ #
875
+ attr_reader :get_notification_subscription_health_metrics
876
+
877
+ # @private
878
+ def initialize parent_rpcs = nil
879
+ get_notification_subscription_config = parent_rpcs.get_notification_subscription if parent_rpcs.respond_to? :get_notification_subscription
880
+ @get_notification_subscription = ::Gapic::Config::Method.new get_notification_subscription_config
881
+ create_notification_subscription_config = parent_rpcs.create_notification_subscription if parent_rpcs.respond_to? :create_notification_subscription
882
+ @create_notification_subscription = ::Gapic::Config::Method.new create_notification_subscription_config
883
+ update_notification_subscription_config = parent_rpcs.update_notification_subscription if parent_rpcs.respond_to? :update_notification_subscription
884
+ @update_notification_subscription = ::Gapic::Config::Method.new update_notification_subscription_config
885
+ delete_notification_subscription_config = parent_rpcs.delete_notification_subscription if parent_rpcs.respond_to? :delete_notification_subscription
886
+ @delete_notification_subscription = ::Gapic::Config::Method.new delete_notification_subscription_config
887
+ list_notification_subscriptions_config = parent_rpcs.list_notification_subscriptions if parent_rpcs.respond_to? :list_notification_subscriptions
888
+ @list_notification_subscriptions = ::Gapic::Config::Method.new list_notification_subscriptions_config
889
+ get_notification_subscription_health_metrics_config = parent_rpcs.get_notification_subscription_health_metrics if parent_rpcs.respond_to? :get_notification_subscription_health_metrics
890
+ @get_notification_subscription_health_metrics = ::Gapic::Config::Method.new get_notification_subscription_health_metrics_config
891
+
892
+ yield self if block_given?
893
+ end
894
+ end
895
+ end
896
+ end
897
+ end
898
+ end
899
+ end
900
+ end
901
+ end
902
+ end
903
+ end