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,834 @@
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
+
22
+ module Google
23
+ module Shopping
24
+ module Merchant
25
+ module Notifications
26
+ module V1beta
27
+ module NotificationsApiService
28
+ ##
29
+ # Client for the NotificationsApiService service.
30
+ #
31
+ # Service to manage notification subscriptions for merchants
32
+ #
33
+ class Client
34
+ # @private
35
+ API_VERSION = ""
36
+
37
+ # @private
38
+ DEFAULT_ENDPOINT_TEMPLATE = "merchantapi.$UNIVERSE_DOMAIN$"
39
+
40
+ include Paths
41
+
42
+ # @private
43
+ attr_reader :notifications_api_service_stub
44
+
45
+ ##
46
+ # Configure the NotificationsApiService Client class.
47
+ #
48
+ # See {::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Client::Configuration}
49
+ # for a description of the configuration fields.
50
+ #
51
+ # @example
52
+ #
53
+ # # Modify the configuration for all NotificationsApiService clients
54
+ # ::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Client.configure do |config|
55
+ # config.timeout = 10.0
56
+ # end
57
+ #
58
+ # @yield [config] Configure the Client client.
59
+ # @yieldparam config [Client::Configuration]
60
+ #
61
+ # @return [Client::Configuration]
62
+ #
63
+ def self.configure
64
+ @configure ||= begin
65
+ namespace = ["Google", "Shopping", "Merchant", "Notifications", "V1beta"]
66
+ parent_config = while namespace.any?
67
+ parent_name = namespace.join "::"
68
+ parent_const = const_get parent_name
69
+ break parent_const.configure if parent_const.respond_to? :configure
70
+ namespace.pop
71
+ end
72
+ default_config = Client::Configuration.new parent_config
73
+
74
+ default_config.timeout = 60.0
75
+ default_config.retry_policy = {
76
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
77
+ }
78
+
79
+ default_config
80
+ end
81
+ yield @configure if block_given?
82
+ @configure
83
+ end
84
+
85
+ ##
86
+ # Configure the NotificationsApiService Client instance.
87
+ #
88
+ # The configuration is set to the derived mode, meaning that values can be changed,
89
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
90
+ # should be made on {Client.configure}.
91
+ #
92
+ # See {::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Client::Configuration}
93
+ # for a description of the configuration fields.
94
+ #
95
+ # @yield [config] Configure the Client client.
96
+ # @yieldparam config [Client::Configuration]
97
+ #
98
+ # @return [Client::Configuration]
99
+ #
100
+ def configure
101
+ yield @config if block_given?
102
+ @config
103
+ end
104
+
105
+ ##
106
+ # The effective universe domain
107
+ #
108
+ # @return [String]
109
+ #
110
+ def universe_domain
111
+ @notifications_api_service_stub.universe_domain
112
+ end
113
+
114
+ ##
115
+ # Create a new NotificationsApiService client object.
116
+ #
117
+ # @example
118
+ #
119
+ # # Create a client using the default configuration
120
+ # client = ::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Client.new
121
+ #
122
+ # # Create a client using a custom configuration
123
+ # client = ::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Client.new do |config|
124
+ # config.timeout = 10.0
125
+ # end
126
+ #
127
+ # @yield [config] Configure the NotificationsApiService client.
128
+ # @yieldparam config [Client::Configuration]
129
+ #
130
+ def initialize
131
+ # These require statements are intentionally placed here to initialize
132
+ # the gRPC module only when it's required.
133
+ # See https://github.com/googleapis/toolkit/issues/446
134
+ require "gapic/grpc"
135
+ require "google/shopping/merchant/notifications/v1beta/notificationsapi_services_pb"
136
+
137
+ # Create the configuration object
138
+ @config = Configuration.new Client.configure
139
+
140
+ # Yield the configuration if needed
141
+ yield @config if block_given?
142
+
143
+ # Create credentials
144
+ credentials = @config.credentials
145
+ # Use self-signed JWT if the endpoint is unchanged from default,
146
+ # but only if the default endpoint does not have a region prefix.
147
+ enable_self_signed_jwt = @config.endpoint.nil? ||
148
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
149
+ !@config.endpoint.split(".").first.include?("-"))
150
+ credentials ||= Credentials.default scope: @config.scope,
151
+ enable_self_signed_jwt: enable_self_signed_jwt
152
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
153
+ credentials = Credentials.new credentials, scope: @config.scope
154
+ end
155
+ @quota_project_id = @config.quota_project
156
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
157
+
158
+ @notifications_api_service_stub = ::Gapic::ServiceStub.new(
159
+ ::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Stub,
160
+ credentials: credentials,
161
+ endpoint: @config.endpoint,
162
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
163
+ universe_domain: @config.universe_domain,
164
+ channel_args: @config.channel_args,
165
+ interceptors: @config.interceptors,
166
+ channel_pool_config: @config.channel_pool
167
+ )
168
+ end
169
+
170
+ # Service calls
171
+
172
+ ##
173
+ # Gets notification subscriptions for an account.
174
+ #
175
+ # @overload get_notification_subscription(request, options = nil)
176
+ # Pass arguments to `get_notification_subscription` via a request object, either of type
177
+ # {::Google::Shopping::Merchant::Notifications::V1beta::GetNotificationSubscriptionRequest} or an equivalent Hash.
178
+ #
179
+ # @param request [::Google::Shopping::Merchant::Notifications::V1beta::GetNotificationSubscriptionRequest, ::Hash]
180
+ # A request object representing the call parameters. Required. To specify no
181
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
182
+ # @param options [::Gapic::CallOptions, ::Hash]
183
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
184
+ #
185
+ # @overload get_notification_subscription(name: nil)
186
+ # Pass arguments to `get_notification_subscription` via keyword arguments. Note that at
187
+ # least one keyword argument is required. To specify no parameters, or to keep all
188
+ # the default parameter values, pass an empty Hash as a request object (see above).
189
+ #
190
+ # @param name [::String]
191
+ # Required. The `name` of the notification subscription.
192
+ #
193
+ # @yield [response, operation] Access the result along with the RPC operation
194
+ # @yieldparam response [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription]
195
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
196
+ #
197
+ # @return [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription]
198
+ #
199
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
200
+ #
201
+ # @example Basic example
202
+ # require "google/shopping/merchant/notifications/v1beta"
203
+ #
204
+ # # Create a client object. The client can be reused for multiple calls.
205
+ # client = Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Client.new
206
+ #
207
+ # # Create a request. To set request fields, pass in keyword arguments.
208
+ # request = Google::Shopping::Merchant::Notifications::V1beta::GetNotificationSubscriptionRequest.new
209
+ #
210
+ # # Call the get_notification_subscription method.
211
+ # result = client.get_notification_subscription request
212
+ #
213
+ # # The returned object is of type Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription.
214
+ # p result
215
+ #
216
+ def get_notification_subscription request, options = nil
217
+ raise ::ArgumentError, "request must be provided" if request.nil?
218
+
219
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Notifications::V1beta::GetNotificationSubscriptionRequest
220
+
221
+ # Converts hash and nil to an options object
222
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
223
+
224
+ # Customize the options with defaults
225
+ metadata = @config.rpcs.get_notification_subscription.metadata.to_h
226
+
227
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
228
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
229
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
230
+ gapic_version: ::Google::Shopping::Merchant::Notifications::V1beta::VERSION
231
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
232
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
233
+
234
+ header_params = {}
235
+ if request.name
236
+ header_params["name"] = request.name
237
+ end
238
+
239
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
240
+ metadata[:"x-goog-request-params"] ||= request_params_header
241
+
242
+ options.apply_defaults timeout: @config.rpcs.get_notification_subscription.timeout,
243
+ metadata: metadata,
244
+ retry_policy: @config.rpcs.get_notification_subscription.retry_policy
245
+
246
+ options.apply_defaults timeout: @config.timeout,
247
+ metadata: @config.metadata,
248
+ retry_policy: @config.retry_policy
249
+
250
+ @notifications_api_service_stub.call_rpc :get_notification_subscription, request, options: options do |response, operation|
251
+ yield response, operation if block_given?
252
+ return response
253
+ end
254
+ rescue ::GRPC::BadStatus => e
255
+ raise ::Google::Cloud::Error.from_error(e)
256
+ end
257
+
258
+ ##
259
+ # Creates a notification subscription for a merchant. We will allow the
260
+ # following types of notification subscriptions to exist together (per
261
+ # merchant as a subscriber per event type):
262
+ # 1. Subscription for all managed accounts + subscription for self
263
+ # 2. Multiple "partial" subscriptions for managed accounts + subscription
264
+ # for self
265
+ #
266
+ # we will not allow (per merchant as a subscriber per event type):
267
+ # 1. multiple self subscriptions.
268
+ # 2. multiple "all managed accounts" subscriptions.
269
+ # 3. all and partial subscriptions at the same time.
270
+ # 4. multiple partial subscriptions for the same target account
271
+ #
272
+ # @overload create_notification_subscription(request, options = nil)
273
+ # Pass arguments to `create_notification_subscription` via a request object, either of type
274
+ # {::Google::Shopping::Merchant::Notifications::V1beta::CreateNotificationSubscriptionRequest} or an equivalent Hash.
275
+ #
276
+ # @param request [::Google::Shopping::Merchant::Notifications::V1beta::CreateNotificationSubscriptionRequest, ::Hash]
277
+ # A request object representing the call parameters. Required. To specify no
278
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
279
+ # @param options [::Gapic::CallOptions, ::Hash]
280
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
281
+ #
282
+ # @overload create_notification_subscription(parent: nil, notification_subscription: nil)
283
+ # Pass arguments to `create_notification_subscription` via keyword arguments. Note that at
284
+ # least one keyword argument is required. To specify no parameters, or to keep all
285
+ # the default parameter values, pass an empty Hash as a request object (see above).
286
+ #
287
+ # @param parent [::String]
288
+ # Required. The merchant account that owns the new notification subscription.
289
+ # Format: `accounts/{account}`
290
+ # @param notification_subscription [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription, ::Hash]
291
+ # Required. The notification subscription to create.
292
+ #
293
+ # @yield [response, operation] Access the result along with the RPC operation
294
+ # @yieldparam response [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription]
295
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
296
+ #
297
+ # @return [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription]
298
+ #
299
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
300
+ #
301
+ # @example Basic example
302
+ # require "google/shopping/merchant/notifications/v1beta"
303
+ #
304
+ # # Create a client object. The client can be reused for multiple calls.
305
+ # client = Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Client.new
306
+ #
307
+ # # Create a request. To set request fields, pass in keyword arguments.
308
+ # request = Google::Shopping::Merchant::Notifications::V1beta::CreateNotificationSubscriptionRequest.new
309
+ #
310
+ # # Call the create_notification_subscription method.
311
+ # result = client.create_notification_subscription request
312
+ #
313
+ # # The returned object is of type Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription.
314
+ # p result
315
+ #
316
+ def create_notification_subscription request, options = nil
317
+ raise ::ArgumentError, "request must be provided" if request.nil?
318
+
319
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Notifications::V1beta::CreateNotificationSubscriptionRequest
320
+
321
+ # Converts hash and nil to an options object
322
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
323
+
324
+ # Customize the options with defaults
325
+ metadata = @config.rpcs.create_notification_subscription.metadata.to_h
326
+
327
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
328
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
329
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
330
+ gapic_version: ::Google::Shopping::Merchant::Notifications::V1beta::VERSION
331
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
332
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
333
+
334
+ header_params = {}
335
+ if request.parent
336
+ header_params["parent"] = request.parent
337
+ end
338
+
339
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
340
+ metadata[:"x-goog-request-params"] ||= request_params_header
341
+
342
+ options.apply_defaults timeout: @config.rpcs.create_notification_subscription.timeout,
343
+ metadata: metadata,
344
+ retry_policy: @config.rpcs.create_notification_subscription.retry_policy
345
+
346
+ options.apply_defaults timeout: @config.timeout,
347
+ metadata: @config.metadata,
348
+ retry_policy: @config.retry_policy
349
+
350
+ @notifications_api_service_stub.call_rpc :create_notification_subscription, request, options: options do |response, operation|
351
+ yield response, operation if block_given?
352
+ return response
353
+ end
354
+ rescue ::GRPC::BadStatus => e
355
+ raise ::Google::Cloud::Error.from_error(e)
356
+ end
357
+
358
+ ##
359
+ # Updates an existing notification subscription for a merchant.
360
+ #
361
+ # @overload update_notification_subscription(request, options = nil)
362
+ # Pass arguments to `update_notification_subscription` via a request object, either of type
363
+ # {::Google::Shopping::Merchant::Notifications::V1beta::UpdateNotificationSubscriptionRequest} or an equivalent Hash.
364
+ #
365
+ # @param request [::Google::Shopping::Merchant::Notifications::V1beta::UpdateNotificationSubscriptionRequest, ::Hash]
366
+ # A request object representing the call parameters. Required. To specify no
367
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
368
+ # @param options [::Gapic::CallOptions, ::Hash]
369
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
370
+ #
371
+ # @overload update_notification_subscription(notification_subscription: nil, update_mask: nil)
372
+ # Pass arguments to `update_notification_subscription` via keyword arguments. Note that at
373
+ # least one keyword argument is required. To specify no parameters, or to keep all
374
+ # the default parameter values, pass an empty Hash as a request object (see above).
375
+ #
376
+ # @param notification_subscription [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription, ::Hash]
377
+ # Required. The new version of the notification subscription that should be
378
+ # updated.
379
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
380
+ # List of fields being updated.
381
+ #
382
+ # @yield [response, operation] Access the result along with the RPC operation
383
+ # @yieldparam response [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription]
384
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
385
+ #
386
+ # @return [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription]
387
+ #
388
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
389
+ #
390
+ # @example Basic example
391
+ # require "google/shopping/merchant/notifications/v1beta"
392
+ #
393
+ # # Create a client object. The client can be reused for multiple calls.
394
+ # client = Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Client.new
395
+ #
396
+ # # Create a request. To set request fields, pass in keyword arguments.
397
+ # request = Google::Shopping::Merchant::Notifications::V1beta::UpdateNotificationSubscriptionRequest.new
398
+ #
399
+ # # Call the update_notification_subscription method.
400
+ # result = client.update_notification_subscription request
401
+ #
402
+ # # The returned object is of type Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription.
403
+ # p result
404
+ #
405
+ def update_notification_subscription request, options = nil
406
+ raise ::ArgumentError, "request must be provided" if request.nil?
407
+
408
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Notifications::V1beta::UpdateNotificationSubscriptionRequest
409
+
410
+ # Converts hash and nil to an options object
411
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
412
+
413
+ # Customize the options with defaults
414
+ metadata = @config.rpcs.update_notification_subscription.metadata.to_h
415
+
416
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
417
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
418
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
419
+ gapic_version: ::Google::Shopping::Merchant::Notifications::V1beta::VERSION
420
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
421
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
422
+
423
+ header_params = {}
424
+ if request.notification_subscription&.name
425
+ header_params["notification_subscription.name"] = request.notification_subscription.name
426
+ end
427
+
428
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
429
+ metadata[:"x-goog-request-params"] ||= request_params_header
430
+
431
+ options.apply_defaults timeout: @config.rpcs.update_notification_subscription.timeout,
432
+ metadata: metadata,
433
+ retry_policy: @config.rpcs.update_notification_subscription.retry_policy
434
+
435
+ options.apply_defaults timeout: @config.timeout,
436
+ metadata: @config.metadata,
437
+ retry_policy: @config.retry_policy
438
+
439
+ @notifications_api_service_stub.call_rpc :update_notification_subscription, request, options: options do |response, operation|
440
+ yield response, operation if block_given?
441
+ return response
442
+ end
443
+ rescue ::GRPC::BadStatus => 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::V1beta::DeleteNotificationSubscriptionRequest} or an equivalent Hash.
453
+ #
454
+ # @param request [::Google::Shopping::Merchant::Notifications::V1beta::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
+ #
468
+ # @yield [response, operation] Access the result along with the RPC operation
469
+ # @yieldparam response [::Google::Protobuf::Empty]
470
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
471
+ #
472
+ # @return [::Google::Protobuf::Empty]
473
+ #
474
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
475
+ #
476
+ # @example Basic example
477
+ # require "google/shopping/merchant/notifications/v1beta"
478
+ #
479
+ # # Create a client object. The client can be reused for multiple calls.
480
+ # client = Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Client.new
481
+ #
482
+ # # Create a request. To set request fields, pass in keyword arguments.
483
+ # request = Google::Shopping::Merchant::Notifications::V1beta::DeleteNotificationSubscriptionRequest.new
484
+ #
485
+ # # Call the delete_notification_subscription method.
486
+ # result = client.delete_notification_subscription request
487
+ #
488
+ # # The returned object is of type Google::Protobuf::Empty.
489
+ # p result
490
+ #
491
+ def delete_notification_subscription request, options = nil
492
+ raise ::ArgumentError, "request must be provided" if request.nil?
493
+
494
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Notifications::V1beta::DeleteNotificationSubscriptionRequest
495
+
496
+ # Converts hash and nil to an options object
497
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
498
+
499
+ # Customize the options with defaults
500
+ metadata = @config.rpcs.delete_notification_subscription.metadata.to_h
501
+
502
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
503
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
504
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
505
+ gapic_version: ::Google::Shopping::Merchant::Notifications::V1beta::VERSION
506
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
507
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
508
+
509
+ header_params = {}
510
+ if request.name
511
+ header_params["name"] = request.name
512
+ end
513
+
514
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
515
+ metadata[:"x-goog-request-params"] ||= request_params_header
516
+
517
+ options.apply_defaults timeout: @config.rpcs.delete_notification_subscription.timeout,
518
+ metadata: metadata,
519
+ retry_policy: @config.rpcs.delete_notification_subscription.retry_policy
520
+
521
+ options.apply_defaults timeout: @config.timeout,
522
+ metadata: @config.metadata,
523
+ retry_policy: @config.retry_policy
524
+
525
+ @notifications_api_service_stub.call_rpc :delete_notification_subscription, request, options: options do |response, operation|
526
+ yield response, operation if block_given?
527
+ return response
528
+ end
529
+ rescue ::GRPC::BadStatus => e
530
+ raise ::Google::Cloud::Error.from_error(e)
531
+ end
532
+
533
+ ##
534
+ # Gets all the notification subscriptions for a merchant.
535
+ #
536
+ # @overload list_notification_subscriptions(request, options = nil)
537
+ # Pass arguments to `list_notification_subscriptions` via a request object, either of type
538
+ # {::Google::Shopping::Merchant::Notifications::V1beta::ListNotificationSubscriptionsRequest} or an equivalent Hash.
539
+ #
540
+ # @param request [::Google::Shopping::Merchant::Notifications::V1beta::ListNotificationSubscriptionsRequest, ::Hash]
541
+ # A request object representing the call parameters. Required. To specify no
542
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
543
+ # @param options [::Gapic::CallOptions, ::Hash]
544
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
545
+ #
546
+ # @overload list_notification_subscriptions(parent: nil, page_size: nil, page_token: nil)
547
+ # Pass arguments to `list_notification_subscriptions` via keyword arguments. Note that at
548
+ # least one keyword argument is required. To specify no parameters, or to keep all
549
+ # the default parameter values, pass an empty Hash as a request object (see above).
550
+ #
551
+ # @param parent [::String]
552
+ # Required. The merchant account who owns the notification subscriptions.
553
+ # Format: `accounts/{account}`
554
+ # @param page_size [::Integer]
555
+ # The maximum number of notification subscriptions to return in a page.
556
+ # The default value for `page_size` is 100. The
557
+ # maximum value is `200`. Values above `200` will be coerced to `200`.
558
+ # @param page_token [::String]
559
+ # Token (if provided) to retrieve the subsequent page. All other parameters
560
+ # must match the original call that provided the page token.
561
+ #
562
+ # @yield [response, operation] Access the result along with the RPC operation
563
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription>]
564
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
565
+ #
566
+ # @return [::Gapic::PagedEnumerable<::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription>]
567
+ #
568
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
569
+ #
570
+ # @example Basic example
571
+ # require "google/shopping/merchant/notifications/v1beta"
572
+ #
573
+ # # Create a client object. The client can be reused for multiple calls.
574
+ # client = Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Client.new
575
+ #
576
+ # # Create a request. To set request fields, pass in keyword arguments.
577
+ # request = Google::Shopping::Merchant::Notifications::V1beta::ListNotificationSubscriptionsRequest.new
578
+ #
579
+ # # Call the list_notification_subscriptions method.
580
+ # result = client.list_notification_subscriptions request
581
+ #
582
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
583
+ # # over elements, and API calls will be issued to fetch pages as needed.
584
+ # result.each do |item|
585
+ # # Each element is of type ::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription.
586
+ # p item
587
+ # end
588
+ #
589
+ def list_notification_subscriptions request, options = nil
590
+ raise ::ArgumentError, "request must be provided" if request.nil?
591
+
592
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Notifications::V1beta::ListNotificationSubscriptionsRequest
593
+
594
+ # Converts hash and nil to an options object
595
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
596
+
597
+ # Customize the options with defaults
598
+ metadata = @config.rpcs.list_notification_subscriptions.metadata.to_h
599
+
600
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
601
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
602
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
603
+ gapic_version: ::Google::Shopping::Merchant::Notifications::V1beta::VERSION
604
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
605
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
606
+
607
+ header_params = {}
608
+ if request.parent
609
+ header_params["parent"] = request.parent
610
+ end
611
+
612
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
613
+ metadata[:"x-goog-request-params"] ||= request_params_header
614
+
615
+ options.apply_defaults timeout: @config.rpcs.list_notification_subscriptions.timeout,
616
+ metadata: metadata,
617
+ retry_policy: @config.rpcs.list_notification_subscriptions.retry_policy
618
+
619
+ options.apply_defaults timeout: @config.timeout,
620
+ metadata: @config.metadata,
621
+ retry_policy: @config.retry_policy
622
+
623
+ @notifications_api_service_stub.call_rpc :list_notification_subscriptions, request, options: options do |response, operation|
624
+ response = ::Gapic::PagedEnumerable.new @notifications_api_service_stub, :list_notification_subscriptions, request, response, operation, options
625
+ yield response, operation if block_given?
626
+ return response
627
+ end
628
+ rescue ::GRPC::BadStatus => e
629
+ raise ::Google::Cloud::Error.from_error(e)
630
+ end
631
+
632
+ ##
633
+ # Configuration class for the NotificationsApiService API.
634
+ #
635
+ # This class represents the configuration for NotificationsApiService,
636
+ # providing control over timeouts, retry behavior, logging, transport
637
+ # parameters, and other low-level controls. Certain parameters can also be
638
+ # applied individually to specific RPCs. See
639
+ # {::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Client::Configuration::Rpcs}
640
+ # for a list of RPCs that can be configured independently.
641
+ #
642
+ # Configuration can be applied globally to all clients, or to a single client
643
+ # on construction.
644
+ #
645
+ # @example
646
+ #
647
+ # # Modify the global config, setting the timeout for
648
+ # # get_notification_subscription to 20 seconds,
649
+ # # and all remaining timeouts to 10 seconds.
650
+ # ::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Client.configure do |config|
651
+ # config.timeout = 10.0
652
+ # config.rpcs.get_notification_subscription.timeout = 20.0
653
+ # end
654
+ #
655
+ # # Apply the above configuration only to a new client.
656
+ # client = ::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Client.new do |config|
657
+ # config.timeout = 10.0
658
+ # config.rpcs.get_notification_subscription.timeout = 20.0
659
+ # end
660
+ #
661
+ # @!attribute [rw] endpoint
662
+ # A custom service endpoint, as a hostname or hostname:port. The default is
663
+ # nil, indicating to use the default endpoint in the current universe domain.
664
+ # @return [::String,nil]
665
+ # @!attribute [rw] credentials
666
+ # Credentials to send with calls. You may provide any of the following types:
667
+ # * (`String`) The path to a service account key file in JSON format
668
+ # * (`Hash`) A service account key as a Hash
669
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
670
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
671
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
672
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
673
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
674
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
675
+ # * (`nil`) indicating no credentials
676
+ # @return [::Object]
677
+ # @!attribute [rw] scope
678
+ # The OAuth scopes
679
+ # @return [::Array<::String>]
680
+ # @!attribute [rw] lib_name
681
+ # The library name as recorded in instrumentation and logging
682
+ # @return [::String]
683
+ # @!attribute [rw] lib_version
684
+ # The library version as recorded in instrumentation and logging
685
+ # @return [::String]
686
+ # @!attribute [rw] channel_args
687
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
688
+ # `GRPC::Core::Channel` object is provided as the credential.
689
+ # @return [::Hash]
690
+ # @!attribute [rw] interceptors
691
+ # An array of interceptors that are run before calls are executed.
692
+ # @return [::Array<::GRPC::ClientInterceptor>]
693
+ # @!attribute [rw] timeout
694
+ # The call timeout in seconds.
695
+ # @return [::Numeric]
696
+ # @!attribute [rw] metadata
697
+ # Additional gRPC headers to be sent with the call.
698
+ # @return [::Hash{::Symbol=>::String}]
699
+ # @!attribute [rw] retry_policy
700
+ # The retry policy. The value is a hash with the following keys:
701
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
702
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
703
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
704
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
705
+ # trigger a retry.
706
+ # @return [::Hash]
707
+ # @!attribute [rw] quota_project
708
+ # A separate project against which to charge quota.
709
+ # @return [::String]
710
+ # @!attribute [rw] universe_domain
711
+ # The universe domain within which to make requests. This determines the
712
+ # default endpoint URL. The default value of nil uses the environment
713
+ # universe (usually the default "googleapis.com" universe).
714
+ # @return [::String,nil]
715
+ #
716
+ class Configuration
717
+ extend ::Gapic::Config
718
+
719
+ # @private
720
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
721
+ DEFAULT_ENDPOINT = "merchantapi.googleapis.com"
722
+
723
+ config_attr :endpoint, nil, ::String, nil
724
+ config_attr :credentials, nil do |value|
725
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
726
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
727
+ allowed.any? { |klass| klass === value }
728
+ end
729
+ config_attr :scope, nil, ::String, ::Array, nil
730
+ config_attr :lib_name, nil, ::String, nil
731
+ config_attr :lib_version, nil, ::String, nil
732
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
733
+ config_attr :interceptors, nil, ::Array, nil
734
+ config_attr :timeout, nil, ::Numeric, nil
735
+ config_attr :metadata, nil, ::Hash, nil
736
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
737
+ config_attr :quota_project, nil, ::String, nil
738
+ config_attr :universe_domain, nil, ::String, nil
739
+
740
+ # @private
741
+ def initialize parent_config = nil
742
+ @parent_config = parent_config unless parent_config.nil?
743
+
744
+ yield self if block_given?
745
+ end
746
+
747
+ ##
748
+ # Configurations for individual RPCs
749
+ # @return [Rpcs]
750
+ #
751
+ def rpcs
752
+ @rpcs ||= begin
753
+ parent_rpcs = nil
754
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
755
+ Rpcs.new parent_rpcs
756
+ end
757
+ end
758
+
759
+ ##
760
+ # Configuration for the channel pool
761
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
762
+ #
763
+ def channel_pool
764
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
765
+ end
766
+
767
+ ##
768
+ # Configuration RPC class for the NotificationsApiService API.
769
+ #
770
+ # Includes fields providing the configuration for each RPC in this service.
771
+ # Each configuration object is of type `Gapic::Config::Method` and includes
772
+ # the following configuration fields:
773
+ #
774
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
775
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
776
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
777
+ # include the following keys:
778
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
779
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
780
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
781
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
782
+ # trigger a retry.
783
+ #
784
+ class Rpcs
785
+ ##
786
+ # RPC-specific configuration for `get_notification_subscription`
787
+ # @return [::Gapic::Config::Method]
788
+ #
789
+ attr_reader :get_notification_subscription
790
+ ##
791
+ # RPC-specific configuration for `create_notification_subscription`
792
+ # @return [::Gapic::Config::Method]
793
+ #
794
+ attr_reader :create_notification_subscription
795
+ ##
796
+ # RPC-specific configuration for `update_notification_subscription`
797
+ # @return [::Gapic::Config::Method]
798
+ #
799
+ attr_reader :update_notification_subscription
800
+ ##
801
+ # RPC-specific configuration for `delete_notification_subscription`
802
+ # @return [::Gapic::Config::Method]
803
+ #
804
+ attr_reader :delete_notification_subscription
805
+ ##
806
+ # RPC-specific configuration for `list_notification_subscriptions`
807
+ # @return [::Gapic::Config::Method]
808
+ #
809
+ attr_reader :list_notification_subscriptions
810
+
811
+ # @private
812
+ def initialize parent_rpcs = nil
813
+ get_notification_subscription_config = parent_rpcs.get_notification_subscription if parent_rpcs.respond_to? :get_notification_subscription
814
+ @get_notification_subscription = ::Gapic::Config::Method.new get_notification_subscription_config
815
+ create_notification_subscription_config = parent_rpcs.create_notification_subscription if parent_rpcs.respond_to? :create_notification_subscription
816
+ @create_notification_subscription = ::Gapic::Config::Method.new create_notification_subscription_config
817
+ update_notification_subscription_config = parent_rpcs.update_notification_subscription if parent_rpcs.respond_to? :update_notification_subscription
818
+ @update_notification_subscription = ::Gapic::Config::Method.new update_notification_subscription_config
819
+ delete_notification_subscription_config = parent_rpcs.delete_notification_subscription if parent_rpcs.respond_to? :delete_notification_subscription
820
+ @delete_notification_subscription = ::Gapic::Config::Method.new delete_notification_subscription_config
821
+ list_notification_subscriptions_config = parent_rpcs.list_notification_subscriptions if parent_rpcs.respond_to? :list_notification_subscriptions
822
+ @list_notification_subscriptions = ::Gapic::Config::Method.new list_notification_subscriptions_config
823
+
824
+ yield self if block_given?
825
+ end
826
+ end
827
+ end
828
+ end
829
+ end
830
+ end
831
+ end
832
+ end
833
+ end
834
+ end