google-shopping-merchant-conversions-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/conversions/v1beta/conversion_sources_service/client.rb +928 -0
  6. data/lib/google/shopping/merchant/conversions/v1beta/conversion_sources_service/credentials.rb +49 -0
  7. data/lib/google/shopping/merchant/conversions/v1beta/conversion_sources_service/paths.rb +66 -0
  8. data/lib/google/shopping/merchant/conversions/v1beta/conversion_sources_service/rest/client.rb +860 -0
  9. data/lib/google/shopping/merchant/conversions/v1beta/conversion_sources_service/rest/service_stub.rb +428 -0
  10. data/lib/google/shopping/merchant/conversions/v1beta/conversion_sources_service/rest.rb +54 -0
  11. data/lib/google/shopping/merchant/conversions/v1beta/conversion_sources_service.rb +57 -0
  12. data/lib/google/shopping/merchant/conversions/v1beta/conversionsources_pb.rb +68 -0
  13. data/lib/google/shopping/merchant/conversions/v1beta/conversionsources_services_pb.rb +62 -0
  14. data/lib/google/shopping/merchant/conversions/v1beta/rest.rb +39 -0
  15. data/lib/google/shopping/merchant/conversions/v1beta/version.rb +7 -2
  16. data/lib/google/shopping/merchant/conversions/v1beta.rb +47 -0
  17. data/lib/google-shopping-merchant-conversions-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/protobuf/timestamp.rb +127 -0
  27. data/proto_docs/google/shopping/merchant/conversions/v1beta/conversionsources.rb +286 -0
  28. metadata +67 -10
@@ -0,0 +1,928 @@
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/conversions/v1beta/conversionsources_pb"
21
+
22
+ module Google
23
+ module Shopping
24
+ module Merchant
25
+ module Conversions
26
+ module V1beta
27
+ module ConversionSourcesService
28
+ ##
29
+ # Client for the ConversionSourcesService service.
30
+ #
31
+ # Service for managing conversion sources for a merchant account.
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 :conversion_sources_service_stub
44
+
45
+ ##
46
+ # Configure the ConversionSourcesService Client class.
47
+ #
48
+ # See {::Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Client::Configuration}
49
+ # for a description of the configuration fields.
50
+ #
51
+ # @example
52
+ #
53
+ # # Modify the configuration for all ConversionSourcesService clients
54
+ # ::Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::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", "Conversions", "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 ConversionSourcesService 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::Conversions::V1beta::ConversionSourcesService::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
+ @conversion_sources_service_stub.universe_domain
112
+ end
113
+
114
+ ##
115
+ # Create a new ConversionSourcesService client object.
116
+ #
117
+ # @example
118
+ #
119
+ # # Create a client using the default configuration
120
+ # client = ::Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Client.new
121
+ #
122
+ # # Create a client using a custom configuration
123
+ # client = ::Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Client.new do |config|
124
+ # config.timeout = 10.0
125
+ # end
126
+ #
127
+ # @yield [config] Configure the ConversionSourcesService 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/conversions/v1beta/conversionsources_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
+ @conversion_sources_service_stub = ::Gapic::ServiceStub.new(
159
+ ::Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::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
+ # Creates a new conversion source.
174
+ #
175
+ # @overload create_conversion_source(request, options = nil)
176
+ # Pass arguments to `create_conversion_source` via a request object, either of type
177
+ # {::Google::Shopping::Merchant::Conversions::V1beta::CreateConversionSourceRequest} or an equivalent Hash.
178
+ #
179
+ # @param request [::Google::Shopping::Merchant::Conversions::V1beta::CreateConversionSourceRequest, ::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 create_conversion_source(parent: nil, conversion_source: nil)
186
+ # Pass arguments to `create_conversion_source` 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 parent [::String]
191
+ # Required. The merchant account that will own the new conversion source.
192
+ # Format: accounts/\\{account}
193
+ # @param conversion_source [::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource, ::Hash]
194
+ # Required. The conversion source description. A new ID will be automatically
195
+ # assigned to it upon creation.
196
+ #
197
+ # @yield [response, operation] Access the result along with the RPC operation
198
+ # @yieldparam response [::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource]
199
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
200
+ #
201
+ # @return [::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource]
202
+ #
203
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
204
+ #
205
+ # @example Basic example
206
+ # require "google/shopping/merchant/conversions/v1beta"
207
+ #
208
+ # # Create a client object. The client can be reused for multiple calls.
209
+ # client = Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Client.new
210
+ #
211
+ # # Create a request. To set request fields, pass in keyword arguments.
212
+ # request = Google::Shopping::Merchant::Conversions::V1beta::CreateConversionSourceRequest.new
213
+ #
214
+ # # Call the create_conversion_source method.
215
+ # result = client.create_conversion_source request
216
+ #
217
+ # # The returned object is of type Google::Shopping::Merchant::Conversions::V1beta::ConversionSource.
218
+ # p result
219
+ #
220
+ def create_conversion_source request, options = nil
221
+ raise ::ArgumentError, "request must be provided" if request.nil?
222
+
223
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Conversions::V1beta::CreateConversionSourceRequest
224
+
225
+ # Converts hash and nil to an options object
226
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
227
+
228
+ # Customize the options with defaults
229
+ metadata = @config.rpcs.create_conversion_source.metadata.to_h
230
+
231
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
232
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
233
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
234
+ gapic_version: ::Google::Shopping::Merchant::Conversions::V1beta::VERSION
235
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
236
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
237
+
238
+ header_params = {}
239
+ if request.parent
240
+ header_params["parent"] = request.parent
241
+ end
242
+
243
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
244
+ metadata[:"x-goog-request-params"] ||= request_params_header
245
+
246
+ options.apply_defaults timeout: @config.rpcs.create_conversion_source.timeout,
247
+ metadata: metadata,
248
+ retry_policy: @config.rpcs.create_conversion_source.retry_policy
249
+
250
+ options.apply_defaults timeout: @config.timeout,
251
+ metadata: @config.metadata,
252
+ retry_policy: @config.retry_policy
253
+
254
+ @conversion_sources_service_stub.call_rpc :create_conversion_source, request, options: options do |response, operation|
255
+ yield response, operation if block_given?
256
+ return response
257
+ end
258
+ rescue ::GRPC::BadStatus => e
259
+ raise ::Google::Cloud::Error.from_error(e)
260
+ end
261
+
262
+ ##
263
+ # Updates information of an existing conversion source. Available only for
264
+ # Merchant Center Destination conversion sources.
265
+ #
266
+ # @overload update_conversion_source(request, options = nil)
267
+ # Pass arguments to `update_conversion_source` via a request object, either of type
268
+ # {::Google::Shopping::Merchant::Conversions::V1beta::UpdateConversionSourceRequest} or an equivalent Hash.
269
+ #
270
+ # @param request [::Google::Shopping::Merchant::Conversions::V1beta::UpdateConversionSourceRequest, ::Hash]
271
+ # A request object representing the call parameters. Required. To specify no
272
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
273
+ # @param options [::Gapic::CallOptions, ::Hash]
274
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
275
+ #
276
+ # @overload update_conversion_source(conversion_source: nil, update_mask: nil)
277
+ # Pass arguments to `update_conversion_source` via keyword arguments. Note that at
278
+ # least one keyword argument is required. To specify no parameters, or to keep all
279
+ # the default parameter values, pass an empty Hash as a request object (see above).
280
+ #
281
+ # @param conversion_source [::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource, ::Hash]
282
+ # Required. The new version of the conversion source data.
283
+ # Format: accounts/\\{account}/conversionSources/\\{conversion_source}
284
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
285
+ # Required. List of fields being updated.
286
+ #
287
+ # @yield [response, operation] Access the result along with the RPC operation
288
+ # @yieldparam response [::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource]
289
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
290
+ #
291
+ # @return [::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource]
292
+ #
293
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
294
+ #
295
+ # @example Basic example
296
+ # require "google/shopping/merchant/conversions/v1beta"
297
+ #
298
+ # # Create a client object. The client can be reused for multiple calls.
299
+ # client = Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Client.new
300
+ #
301
+ # # Create a request. To set request fields, pass in keyword arguments.
302
+ # request = Google::Shopping::Merchant::Conversions::V1beta::UpdateConversionSourceRequest.new
303
+ #
304
+ # # Call the update_conversion_source method.
305
+ # result = client.update_conversion_source request
306
+ #
307
+ # # The returned object is of type Google::Shopping::Merchant::Conversions::V1beta::ConversionSource.
308
+ # p result
309
+ #
310
+ def update_conversion_source request, options = nil
311
+ raise ::ArgumentError, "request must be provided" if request.nil?
312
+
313
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Conversions::V1beta::UpdateConversionSourceRequest
314
+
315
+ # Converts hash and nil to an options object
316
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
317
+
318
+ # Customize the options with defaults
319
+ metadata = @config.rpcs.update_conversion_source.metadata.to_h
320
+
321
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
322
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
323
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
324
+ gapic_version: ::Google::Shopping::Merchant::Conversions::V1beta::VERSION
325
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
326
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
327
+
328
+ header_params = {}
329
+ if request.conversion_source&.name
330
+ header_params["conversion_source.name"] = request.conversion_source.name
331
+ end
332
+
333
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
334
+ metadata[:"x-goog-request-params"] ||= request_params_header
335
+
336
+ options.apply_defaults timeout: @config.rpcs.update_conversion_source.timeout,
337
+ metadata: metadata,
338
+ retry_policy: @config.rpcs.update_conversion_source.retry_policy
339
+
340
+ options.apply_defaults timeout: @config.timeout,
341
+ metadata: @config.metadata,
342
+ retry_policy: @config.retry_policy
343
+
344
+ @conversion_sources_service_stub.call_rpc :update_conversion_source, request, options: options do |response, operation|
345
+ yield response, operation if block_given?
346
+ return response
347
+ end
348
+ rescue ::GRPC::BadStatus => e
349
+ raise ::Google::Cloud::Error.from_error(e)
350
+ end
351
+
352
+ ##
353
+ # Archives an existing conversion source. If the conversion source is a
354
+ # Merchant Center Destination, it will be recoverable for 30 days. If the
355
+ # conversion source is a Google Analytics Link, it will be deleted
356
+ # immediately and can be restored by creating a new one.
357
+ #
358
+ # @overload delete_conversion_source(request, options = nil)
359
+ # Pass arguments to `delete_conversion_source` via a request object, either of type
360
+ # {::Google::Shopping::Merchant::Conversions::V1beta::DeleteConversionSourceRequest} or an equivalent Hash.
361
+ #
362
+ # @param request [::Google::Shopping::Merchant::Conversions::V1beta::DeleteConversionSourceRequest, ::Hash]
363
+ # A request object representing the call parameters. Required. To specify no
364
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
365
+ # @param options [::Gapic::CallOptions, ::Hash]
366
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
367
+ #
368
+ # @overload delete_conversion_source(name: nil)
369
+ # Pass arguments to `delete_conversion_source` via keyword arguments. Note that at
370
+ # least one keyword argument is required. To specify no parameters, or to keep all
371
+ # the default parameter values, pass an empty Hash as a request object (see above).
372
+ #
373
+ # @param name [::String]
374
+ # Required. The name of the conversion source to be deleted.
375
+ # Format: accounts/\\{account}/conversionSources/\\{conversion_source}
376
+ #
377
+ # @yield [response, operation] Access the result along with the RPC operation
378
+ # @yieldparam response [::Google::Protobuf::Empty]
379
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
380
+ #
381
+ # @return [::Google::Protobuf::Empty]
382
+ #
383
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
384
+ #
385
+ # @example Basic example
386
+ # require "google/shopping/merchant/conversions/v1beta"
387
+ #
388
+ # # Create a client object. The client can be reused for multiple calls.
389
+ # client = Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Client.new
390
+ #
391
+ # # Create a request. To set request fields, pass in keyword arguments.
392
+ # request = Google::Shopping::Merchant::Conversions::V1beta::DeleteConversionSourceRequest.new
393
+ #
394
+ # # Call the delete_conversion_source method.
395
+ # result = client.delete_conversion_source request
396
+ #
397
+ # # The returned object is of type Google::Protobuf::Empty.
398
+ # p result
399
+ #
400
+ def delete_conversion_source request, options = nil
401
+ raise ::ArgumentError, "request must be provided" if request.nil?
402
+
403
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Conversions::V1beta::DeleteConversionSourceRequest
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.delete_conversion_source.metadata.to_h
410
+
411
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Conversions::V1beta::VERSION
415
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
416
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
417
+
418
+ header_params = {}
419
+ if request.name
420
+ header_params["name"] = request.name
421
+ end
422
+
423
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
424
+ metadata[:"x-goog-request-params"] ||= request_params_header
425
+
426
+ options.apply_defaults timeout: @config.rpcs.delete_conversion_source.timeout,
427
+ metadata: metadata,
428
+ retry_policy: @config.rpcs.delete_conversion_source.retry_policy
429
+
430
+ options.apply_defaults timeout: @config.timeout,
431
+ metadata: @config.metadata,
432
+ retry_policy: @config.retry_policy
433
+
434
+ @conversion_sources_service_stub.call_rpc :delete_conversion_source, request, options: options do |response, operation|
435
+ yield response, operation if block_given?
436
+ return response
437
+ end
438
+ rescue ::GRPC::BadStatus => e
439
+ raise ::Google::Cloud::Error.from_error(e)
440
+ end
441
+
442
+ ##
443
+ # Re-enables an archived conversion source. Only Available for Merchant
444
+ # Center Destination conversion sources.
445
+ #
446
+ # @overload undelete_conversion_source(request, options = nil)
447
+ # Pass arguments to `undelete_conversion_source` via a request object, either of type
448
+ # {::Google::Shopping::Merchant::Conversions::V1beta::UndeleteConversionSourceRequest} or an equivalent Hash.
449
+ #
450
+ # @param request [::Google::Shopping::Merchant::Conversions::V1beta::UndeleteConversionSourceRequest, ::Hash]
451
+ # A request object representing the call parameters. Required. To specify no
452
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
453
+ # @param options [::Gapic::CallOptions, ::Hash]
454
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
455
+ #
456
+ # @overload undelete_conversion_source(name: nil)
457
+ # Pass arguments to `undelete_conversion_source` via keyword arguments. Note that at
458
+ # least one keyword argument is required. To specify no parameters, or to keep all
459
+ # the default parameter values, pass an empty Hash as a request object (see above).
460
+ #
461
+ # @param name [::String]
462
+ # Required. The name of the conversion source to be undeleted.
463
+ # Format: accounts/\\{account}/conversionSources/\\{conversion_source}
464
+ #
465
+ # @yield [response, operation] Access the result along with the RPC operation
466
+ # @yieldparam response [::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource]
467
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
468
+ #
469
+ # @return [::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource]
470
+ #
471
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
472
+ #
473
+ # @example Basic example
474
+ # require "google/shopping/merchant/conversions/v1beta"
475
+ #
476
+ # # Create a client object. The client can be reused for multiple calls.
477
+ # client = Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Client.new
478
+ #
479
+ # # Create a request. To set request fields, pass in keyword arguments.
480
+ # request = Google::Shopping::Merchant::Conversions::V1beta::UndeleteConversionSourceRequest.new
481
+ #
482
+ # # Call the undelete_conversion_source method.
483
+ # result = client.undelete_conversion_source request
484
+ #
485
+ # # The returned object is of type Google::Shopping::Merchant::Conversions::V1beta::ConversionSource.
486
+ # p result
487
+ #
488
+ def undelete_conversion_source request, options = nil
489
+ raise ::ArgumentError, "request must be provided" if request.nil?
490
+
491
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Conversions::V1beta::UndeleteConversionSourceRequest
492
+
493
+ # Converts hash and nil to an options object
494
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
495
+
496
+ # Customize the options with defaults
497
+ metadata = @config.rpcs.undelete_conversion_source.metadata.to_h
498
+
499
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
500
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
501
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
502
+ gapic_version: ::Google::Shopping::Merchant::Conversions::V1beta::VERSION
503
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
504
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
505
+
506
+ header_params = {}
507
+ if request.name
508
+ header_params["name"] = request.name
509
+ end
510
+
511
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
512
+ metadata[:"x-goog-request-params"] ||= request_params_header
513
+
514
+ options.apply_defaults timeout: @config.rpcs.undelete_conversion_source.timeout,
515
+ metadata: metadata,
516
+ retry_policy: @config.rpcs.undelete_conversion_source.retry_policy
517
+
518
+ options.apply_defaults timeout: @config.timeout,
519
+ metadata: @config.metadata,
520
+ retry_policy: @config.retry_policy
521
+
522
+ @conversion_sources_service_stub.call_rpc :undelete_conversion_source, request, options: options do |response, operation|
523
+ yield response, operation if block_given?
524
+ return response
525
+ end
526
+ rescue ::GRPC::BadStatus => e
527
+ raise ::Google::Cloud::Error.from_error(e)
528
+ end
529
+
530
+ ##
531
+ # Fetches a conversion source.
532
+ #
533
+ # @overload get_conversion_source(request, options = nil)
534
+ # Pass arguments to `get_conversion_source` via a request object, either of type
535
+ # {::Google::Shopping::Merchant::Conversions::V1beta::GetConversionSourceRequest} or an equivalent Hash.
536
+ #
537
+ # @param request [::Google::Shopping::Merchant::Conversions::V1beta::GetConversionSourceRequest, ::Hash]
538
+ # A request object representing the call parameters. Required. To specify no
539
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
540
+ # @param options [::Gapic::CallOptions, ::Hash]
541
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
542
+ #
543
+ # @overload get_conversion_source(name: nil)
544
+ # Pass arguments to `get_conversion_source` via keyword arguments. Note that at
545
+ # least one keyword argument is required. To specify no parameters, or to keep all
546
+ # the default parameter values, pass an empty Hash as a request object (see above).
547
+ #
548
+ # @param name [::String]
549
+ # Required. The name of the conversion source to be fetched.
550
+ # Format: accounts/\\{account}/conversionsources/\\{conversion_source}
551
+ #
552
+ # @yield [response, operation] Access the result along with the RPC operation
553
+ # @yieldparam response [::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource]
554
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
555
+ #
556
+ # @return [::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource]
557
+ #
558
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
559
+ #
560
+ # @example Basic example
561
+ # require "google/shopping/merchant/conversions/v1beta"
562
+ #
563
+ # # Create a client object. The client can be reused for multiple calls.
564
+ # client = Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Client.new
565
+ #
566
+ # # Create a request. To set request fields, pass in keyword arguments.
567
+ # request = Google::Shopping::Merchant::Conversions::V1beta::GetConversionSourceRequest.new
568
+ #
569
+ # # Call the get_conversion_source method.
570
+ # result = client.get_conversion_source request
571
+ #
572
+ # # The returned object is of type Google::Shopping::Merchant::Conversions::V1beta::ConversionSource.
573
+ # p result
574
+ #
575
+ def get_conversion_source request, options = nil
576
+ raise ::ArgumentError, "request must be provided" if request.nil?
577
+
578
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Conversions::V1beta::GetConversionSourceRequest
579
+
580
+ # Converts hash and nil to an options object
581
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
582
+
583
+ # Customize the options with defaults
584
+ metadata = @config.rpcs.get_conversion_source.metadata.to_h
585
+
586
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
587
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
588
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
589
+ gapic_version: ::Google::Shopping::Merchant::Conversions::V1beta::VERSION
590
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
591
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
592
+
593
+ header_params = {}
594
+ if request.name
595
+ header_params["name"] = request.name
596
+ end
597
+
598
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
599
+ metadata[:"x-goog-request-params"] ||= request_params_header
600
+
601
+ options.apply_defaults timeout: @config.rpcs.get_conversion_source.timeout,
602
+ metadata: metadata,
603
+ retry_policy: @config.rpcs.get_conversion_source.retry_policy
604
+
605
+ options.apply_defaults timeout: @config.timeout,
606
+ metadata: @config.metadata,
607
+ retry_policy: @config.retry_policy
608
+
609
+ @conversion_sources_service_stub.call_rpc :get_conversion_source, request, options: options do |response, operation|
610
+ yield response, operation if block_given?
611
+ return response
612
+ end
613
+ rescue ::GRPC::BadStatus => e
614
+ raise ::Google::Cloud::Error.from_error(e)
615
+ end
616
+
617
+ ##
618
+ # Retrieves the list of conversion sources the caller has access to.
619
+ #
620
+ # @overload list_conversion_sources(request, options = nil)
621
+ # Pass arguments to `list_conversion_sources` via a request object, either of type
622
+ # {::Google::Shopping::Merchant::Conversions::V1beta::ListConversionSourcesRequest} or an equivalent Hash.
623
+ #
624
+ # @param request [::Google::Shopping::Merchant::Conversions::V1beta::ListConversionSourcesRequest, ::Hash]
625
+ # A request object representing the call parameters. Required. To specify no
626
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
627
+ # @param options [::Gapic::CallOptions, ::Hash]
628
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
629
+ #
630
+ # @overload list_conversion_sources(parent: nil, page_size: nil, page_token: nil, show_deleted: nil)
631
+ # Pass arguments to `list_conversion_sources` via keyword arguments. Note that at
632
+ # least one keyword argument is required. To specify no parameters, or to keep all
633
+ # the default parameter values, pass an empty Hash as a request object (see above).
634
+ #
635
+ # @param parent [::String]
636
+ # Required. The merchant account who owns the collection of conversion
637
+ # sources. Format: accounts/\\{account}
638
+ # @param page_size [::Integer]
639
+ # Optional. The maximum number of conversion sources to return in a page.
640
+ # If no `page_size` is specified, `100` is used as the default value. The
641
+ # maximum value is `200`. Values above `200` will be coerced to `200`.
642
+ # Regardless of pagination, at most `200` conversion sources are returned
643
+ # in total.
644
+ # @param page_token [::String]
645
+ # Optional. Page token.
646
+ # @param show_deleted [::Boolean]
647
+ # Optional. Show deleted (archived) option.
648
+ #
649
+ # @yield [response, operation] Access the result along with the RPC operation
650
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource>]
651
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
652
+ #
653
+ # @return [::Gapic::PagedEnumerable<::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource>]
654
+ #
655
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
656
+ #
657
+ # @example Basic example
658
+ # require "google/shopping/merchant/conversions/v1beta"
659
+ #
660
+ # # Create a client object. The client can be reused for multiple calls.
661
+ # client = Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Client.new
662
+ #
663
+ # # Create a request. To set request fields, pass in keyword arguments.
664
+ # request = Google::Shopping::Merchant::Conversions::V1beta::ListConversionSourcesRequest.new
665
+ #
666
+ # # Call the list_conversion_sources method.
667
+ # result = client.list_conversion_sources request
668
+ #
669
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
670
+ # # over elements, and API calls will be issued to fetch pages as needed.
671
+ # result.each do |item|
672
+ # # Each element is of type ::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource.
673
+ # p item
674
+ # end
675
+ #
676
+ def list_conversion_sources request, options = nil
677
+ raise ::ArgumentError, "request must be provided" if request.nil?
678
+
679
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Conversions::V1beta::ListConversionSourcesRequest
680
+
681
+ # Converts hash and nil to an options object
682
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
683
+
684
+ # Customize the options with defaults
685
+ metadata = @config.rpcs.list_conversion_sources.metadata.to_h
686
+
687
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
688
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
689
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
690
+ gapic_version: ::Google::Shopping::Merchant::Conversions::V1beta::VERSION
691
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
692
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
693
+
694
+ header_params = {}
695
+ if request.parent
696
+ header_params["parent"] = request.parent
697
+ end
698
+
699
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
700
+ metadata[:"x-goog-request-params"] ||= request_params_header
701
+
702
+ options.apply_defaults timeout: @config.rpcs.list_conversion_sources.timeout,
703
+ metadata: metadata,
704
+ retry_policy: @config.rpcs.list_conversion_sources.retry_policy
705
+
706
+ options.apply_defaults timeout: @config.timeout,
707
+ metadata: @config.metadata,
708
+ retry_policy: @config.retry_policy
709
+
710
+ @conversion_sources_service_stub.call_rpc :list_conversion_sources, request, options: options do |response, operation|
711
+ response = ::Gapic::PagedEnumerable.new @conversion_sources_service_stub, :list_conversion_sources, request, response, operation, options
712
+ yield response, operation if block_given?
713
+ return response
714
+ end
715
+ rescue ::GRPC::BadStatus => e
716
+ raise ::Google::Cloud::Error.from_error(e)
717
+ end
718
+
719
+ ##
720
+ # Configuration class for the ConversionSourcesService API.
721
+ #
722
+ # This class represents the configuration for ConversionSourcesService,
723
+ # providing control over timeouts, retry behavior, logging, transport
724
+ # parameters, and other low-level controls. Certain parameters can also be
725
+ # applied individually to specific RPCs. See
726
+ # {::Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Client::Configuration::Rpcs}
727
+ # for a list of RPCs that can be configured independently.
728
+ #
729
+ # Configuration can be applied globally to all clients, or to a single client
730
+ # on construction.
731
+ #
732
+ # @example
733
+ #
734
+ # # Modify the global config, setting the timeout for
735
+ # # create_conversion_source to 20 seconds,
736
+ # # and all remaining timeouts to 10 seconds.
737
+ # ::Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Client.configure do |config|
738
+ # config.timeout = 10.0
739
+ # config.rpcs.create_conversion_source.timeout = 20.0
740
+ # end
741
+ #
742
+ # # Apply the above configuration only to a new client.
743
+ # client = ::Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Client.new do |config|
744
+ # config.timeout = 10.0
745
+ # config.rpcs.create_conversion_source.timeout = 20.0
746
+ # end
747
+ #
748
+ # @!attribute [rw] endpoint
749
+ # A custom service endpoint, as a hostname or hostname:port. The default is
750
+ # nil, indicating to use the default endpoint in the current universe domain.
751
+ # @return [::String,nil]
752
+ # @!attribute [rw] credentials
753
+ # Credentials to send with calls. You may provide any of the following types:
754
+ # * (`String`) The path to a service account key file in JSON format
755
+ # * (`Hash`) A service account key as a Hash
756
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
757
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
758
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
759
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
760
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
761
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
762
+ # * (`nil`) indicating no credentials
763
+ # @return [::Object]
764
+ # @!attribute [rw] scope
765
+ # The OAuth scopes
766
+ # @return [::Array<::String>]
767
+ # @!attribute [rw] lib_name
768
+ # The library name as recorded in instrumentation and logging
769
+ # @return [::String]
770
+ # @!attribute [rw] lib_version
771
+ # The library version as recorded in instrumentation and logging
772
+ # @return [::String]
773
+ # @!attribute [rw] channel_args
774
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
775
+ # `GRPC::Core::Channel` object is provided as the credential.
776
+ # @return [::Hash]
777
+ # @!attribute [rw] interceptors
778
+ # An array of interceptors that are run before calls are executed.
779
+ # @return [::Array<::GRPC::ClientInterceptor>]
780
+ # @!attribute [rw] timeout
781
+ # The call timeout in seconds.
782
+ # @return [::Numeric]
783
+ # @!attribute [rw] metadata
784
+ # Additional gRPC headers to be sent with the call.
785
+ # @return [::Hash{::Symbol=>::String}]
786
+ # @!attribute [rw] retry_policy
787
+ # The retry policy. The value is a hash with the following keys:
788
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
789
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
790
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
791
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
792
+ # trigger a retry.
793
+ # @return [::Hash]
794
+ # @!attribute [rw] quota_project
795
+ # A separate project against which to charge quota.
796
+ # @return [::String]
797
+ # @!attribute [rw] universe_domain
798
+ # The universe domain within which to make requests. This determines the
799
+ # default endpoint URL. The default value of nil uses the environment
800
+ # universe (usually the default "googleapis.com" universe).
801
+ # @return [::String,nil]
802
+ #
803
+ class Configuration
804
+ extend ::Gapic::Config
805
+
806
+ # @private
807
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
808
+ DEFAULT_ENDPOINT = "merchantapi.googleapis.com"
809
+
810
+ config_attr :endpoint, nil, ::String, nil
811
+ config_attr :credentials, nil do |value|
812
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
813
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
814
+ allowed.any? { |klass| klass === value }
815
+ end
816
+ config_attr :scope, nil, ::String, ::Array, nil
817
+ config_attr :lib_name, nil, ::String, nil
818
+ config_attr :lib_version, nil, ::String, nil
819
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
820
+ config_attr :interceptors, nil, ::Array, nil
821
+ config_attr :timeout, nil, ::Numeric, nil
822
+ config_attr :metadata, nil, ::Hash, nil
823
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
824
+ config_attr :quota_project, nil, ::String, nil
825
+ config_attr :universe_domain, nil, ::String, nil
826
+
827
+ # @private
828
+ def initialize parent_config = nil
829
+ @parent_config = parent_config unless parent_config.nil?
830
+
831
+ yield self if block_given?
832
+ end
833
+
834
+ ##
835
+ # Configurations for individual RPCs
836
+ # @return [Rpcs]
837
+ #
838
+ def rpcs
839
+ @rpcs ||= begin
840
+ parent_rpcs = nil
841
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
842
+ Rpcs.new parent_rpcs
843
+ end
844
+ end
845
+
846
+ ##
847
+ # Configuration for the channel pool
848
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
849
+ #
850
+ def channel_pool
851
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
852
+ end
853
+
854
+ ##
855
+ # Configuration RPC class for the ConversionSourcesService API.
856
+ #
857
+ # Includes fields providing the configuration for each RPC in this service.
858
+ # Each configuration object is of type `Gapic::Config::Method` and includes
859
+ # the following configuration fields:
860
+ #
861
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
862
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
863
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
864
+ # include the following keys:
865
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
866
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
867
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
868
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
869
+ # trigger a retry.
870
+ #
871
+ class Rpcs
872
+ ##
873
+ # RPC-specific configuration for `create_conversion_source`
874
+ # @return [::Gapic::Config::Method]
875
+ #
876
+ attr_reader :create_conversion_source
877
+ ##
878
+ # RPC-specific configuration for `update_conversion_source`
879
+ # @return [::Gapic::Config::Method]
880
+ #
881
+ attr_reader :update_conversion_source
882
+ ##
883
+ # RPC-specific configuration for `delete_conversion_source`
884
+ # @return [::Gapic::Config::Method]
885
+ #
886
+ attr_reader :delete_conversion_source
887
+ ##
888
+ # RPC-specific configuration for `undelete_conversion_source`
889
+ # @return [::Gapic::Config::Method]
890
+ #
891
+ attr_reader :undelete_conversion_source
892
+ ##
893
+ # RPC-specific configuration for `get_conversion_source`
894
+ # @return [::Gapic::Config::Method]
895
+ #
896
+ attr_reader :get_conversion_source
897
+ ##
898
+ # RPC-specific configuration for `list_conversion_sources`
899
+ # @return [::Gapic::Config::Method]
900
+ #
901
+ attr_reader :list_conversion_sources
902
+
903
+ # @private
904
+ def initialize parent_rpcs = nil
905
+ create_conversion_source_config = parent_rpcs.create_conversion_source if parent_rpcs.respond_to? :create_conversion_source
906
+ @create_conversion_source = ::Gapic::Config::Method.new create_conversion_source_config
907
+ update_conversion_source_config = parent_rpcs.update_conversion_source if parent_rpcs.respond_to? :update_conversion_source
908
+ @update_conversion_source = ::Gapic::Config::Method.new update_conversion_source_config
909
+ delete_conversion_source_config = parent_rpcs.delete_conversion_source if parent_rpcs.respond_to? :delete_conversion_source
910
+ @delete_conversion_source = ::Gapic::Config::Method.new delete_conversion_source_config
911
+ undelete_conversion_source_config = parent_rpcs.undelete_conversion_source if parent_rpcs.respond_to? :undelete_conversion_source
912
+ @undelete_conversion_source = ::Gapic::Config::Method.new undelete_conversion_source_config
913
+ get_conversion_source_config = parent_rpcs.get_conversion_source if parent_rpcs.respond_to? :get_conversion_source
914
+ @get_conversion_source = ::Gapic::Config::Method.new get_conversion_source_config
915
+ list_conversion_sources_config = parent_rpcs.list_conversion_sources if parent_rpcs.respond_to? :list_conversion_sources
916
+ @list_conversion_sources = ::Gapic::Config::Method.new list_conversion_sources_config
917
+
918
+ yield self if block_given?
919
+ end
920
+ end
921
+ end
922
+ end
923
+ end
924
+ end
925
+ end
926
+ end
927
+ end
928
+ end