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