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

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