google-shopping-css-v1 0.a → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) 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/css/v1/account_labels_service/client.rb +736 -0
  6. data/lib/google/shopping/css/v1/account_labels_service/credentials.rb +47 -0
  7. data/lib/google/shopping/css/v1/account_labels_service/paths.rb +64 -0
  8. data/lib/google/shopping/css/v1/account_labels_service/rest/client.rb +682 -0
  9. data/lib/google/shopping/css/v1/account_labels_service/rest/service_stub.rb +307 -0
  10. data/lib/google/shopping/css/v1/account_labels_service/rest.rb +52 -0
  11. data/lib/google/shopping/css/v1/account_labels_service.rb +55 -0
  12. data/lib/google/shopping/css/v1/accounts_labels_pb.rb +54 -0
  13. data/lib/google/shopping/css/v1/accounts_labels_services_pb.rb +51 -0
  14. data/lib/google/shopping/css/v1/accounts_pb.rb +52 -0
  15. data/lib/google/shopping/css/v1/accounts_service/client.rb +659 -0
  16. data/lib/google/shopping/css/v1/accounts_service/credentials.rb +47 -0
  17. data/lib/google/shopping/css/v1/accounts_service/paths.rb +47 -0
  18. data/lib/google/shopping/css/v1/accounts_service/rest/client.rb +612 -0
  19. data/lib/google/shopping/css/v1/accounts_service/rest/service_stub.rb +247 -0
  20. data/lib/google/shopping/css/v1/accounts_service/rest.rb +52 -0
  21. data/lib/google/shopping/css/v1/accounts_service.rb +55 -0
  22. data/lib/google/shopping/css/v1/accounts_services_pb.rb +50 -0
  23. data/lib/google/shopping/css/v1/css_product_common_pb.rb +55 -0
  24. data/lib/google/shopping/css/v1/css_product_inputs_pb.rb +56 -0
  25. data/lib/google/shopping/css/v1/css_product_inputs_service/client.rb +546 -0
  26. data/lib/google/shopping/css/v1/css_product_inputs_service/credentials.rb +47 -0
  27. data/lib/google/shopping/css/v1/css_product_inputs_service/paths.rb +64 -0
  28. data/lib/google/shopping/css/v1/css_product_inputs_service/rest/client.rb +506 -0
  29. data/lib/google/shopping/css/v1/css_product_inputs_service/rest/service_stub.rb +188 -0
  30. data/lib/google/shopping/css/v1/css_product_inputs_service/rest.rb +53 -0
  31. data/lib/google/shopping/css/v1/css_product_inputs_service.rb +56 -0
  32. data/lib/google/shopping/css/v1/css_product_inputs_services_pb.rb +56 -0
  33. data/lib/google/shopping/css/v1/css_products_pb.rb +54 -0
  34. data/lib/google/shopping/css/v1/css_products_service/client.rb +554 -0
  35. data/lib/google/shopping/css/v1/css_products_service/credentials.rb +47 -0
  36. data/lib/google/shopping/css/v1/css_products_service/paths.rb +64 -0
  37. data/lib/google/shopping/css/v1/css_products_service/rest/client.rb +514 -0
  38. data/lib/google/shopping/css/v1/css_products_service/rest/service_stub.rb +187 -0
  39. data/lib/google/shopping/css/v1/css_products_service/rest.rb +53 -0
  40. data/lib/google/shopping/css/v1/css_products_service.rb +56 -0
  41. data/lib/google/shopping/css/v1/css_products_services_pb.rb +56 -0
  42. data/lib/google/shopping/css/v1/rest.rb +40 -0
  43. data/lib/google/shopping/css/v1/version.rb +8 -3
  44. data/lib/google/shopping/css/v1.rb +48 -0
  45. data/lib/google-shopping-css-v1.rb +21 -0
  46. data/proto_docs/README.md +4 -0
  47. data/proto_docs/google/api/client.rb +399 -0
  48. data/proto_docs/google/api/field_behavior.rb +85 -0
  49. data/proto_docs/google/api/launch_stage.rb +71 -0
  50. data/proto_docs/google/api/resource.rb +222 -0
  51. data/proto_docs/google/protobuf/duration.rb +98 -0
  52. data/proto_docs/google/protobuf/empty.rb +34 -0
  53. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  54. data/proto_docs/google/shopping/css/v1/accounts.rb +168 -0
  55. data/proto_docs/google/shopping/css/v1/accounts_labels.rb +131 -0
  56. data/proto_docs/google/shopping/css/v1/css_product_common.rb +352 -0
  57. data/proto_docs/google/shopping/css/v1/css_product_inputs.rb +130 -0
  58. data/proto_docs/google/shopping/css/v1/css_products.rb +109 -0
  59. data/proto_docs/google/shopping/type/types.rb +210 -0
  60. metadata +123 -13
@@ -0,0 +1,659 @@
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/css/v1/accounts_pb"
21
+
22
+ module Google
23
+ module Shopping
24
+ module Css
25
+ module V1
26
+ module AccountsService
27
+ ##
28
+ # Client for the AccountsService service.
29
+ #
30
+ # Service for managing CSS/MC account information.
31
+ #
32
+ class Client
33
+ # @private
34
+ API_VERSION = ""
35
+
36
+ # @private
37
+ DEFAULT_ENDPOINT_TEMPLATE = "css.$UNIVERSE_DOMAIN$"
38
+
39
+ include Paths
40
+
41
+ # @private
42
+ attr_reader :accounts_service_stub
43
+
44
+ ##
45
+ # Configure the AccountsService Client class.
46
+ #
47
+ # See {::Google::Shopping::Css::V1::AccountsService::Client::Configuration}
48
+ # for a description of the configuration fields.
49
+ #
50
+ # @example
51
+ #
52
+ # # Modify the configuration for all AccountsService clients
53
+ # ::Google::Shopping::Css::V1::AccountsService::Client.configure do |config|
54
+ # config.timeout = 10.0
55
+ # end
56
+ #
57
+ # @yield [config] Configure the Client client.
58
+ # @yieldparam config [Client::Configuration]
59
+ #
60
+ # @return [Client::Configuration]
61
+ #
62
+ def self.configure
63
+ @configure ||= begin
64
+ namespace = ["Google", "Shopping", "Css", "V1"]
65
+ parent_config = while namespace.any?
66
+ parent_name = namespace.join "::"
67
+ parent_const = const_get parent_name
68
+ break parent_const.configure if parent_const.respond_to? :configure
69
+ namespace.pop
70
+ end
71
+ default_config = Client::Configuration.new parent_config
72
+
73
+ default_config.rpcs.list_child_accounts.timeout = 60.0
74
+ default_config.rpcs.list_child_accounts.retry_policy = {
75
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
76
+ }
77
+
78
+ default_config.rpcs.get_account.timeout = 60.0
79
+ default_config.rpcs.get_account.retry_policy = {
80
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
81
+ }
82
+
83
+ default_config.rpcs.update_labels.timeout = 60.0
84
+
85
+ default_config
86
+ end
87
+ yield @configure if block_given?
88
+ @configure
89
+ end
90
+
91
+ ##
92
+ # Configure the AccountsService Client instance.
93
+ #
94
+ # The configuration is set to the derived mode, meaning that values can be changed,
95
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
96
+ # should be made on {Client.configure}.
97
+ #
98
+ # See {::Google::Shopping::Css::V1::AccountsService::Client::Configuration}
99
+ # for a description of the configuration fields.
100
+ #
101
+ # @yield [config] Configure the Client client.
102
+ # @yieldparam config [Client::Configuration]
103
+ #
104
+ # @return [Client::Configuration]
105
+ #
106
+ def configure
107
+ yield @config if block_given?
108
+ @config
109
+ end
110
+
111
+ ##
112
+ # The effective universe domain
113
+ #
114
+ # @return [String]
115
+ #
116
+ def universe_domain
117
+ @accounts_service_stub.universe_domain
118
+ end
119
+
120
+ ##
121
+ # Create a new AccountsService client object.
122
+ #
123
+ # @example
124
+ #
125
+ # # Create a client using the default configuration
126
+ # client = ::Google::Shopping::Css::V1::AccountsService::Client.new
127
+ #
128
+ # # Create a client using a custom configuration
129
+ # client = ::Google::Shopping::Css::V1::AccountsService::Client.new do |config|
130
+ # config.timeout = 10.0
131
+ # end
132
+ #
133
+ # @yield [config] Configure the AccountsService client.
134
+ # @yieldparam config [Client::Configuration]
135
+ #
136
+ def initialize
137
+ # These require statements are intentionally placed here to initialize
138
+ # the gRPC module only when it's required.
139
+ # See https://github.com/googleapis/toolkit/issues/446
140
+ require "gapic/grpc"
141
+ require "google/shopping/css/v1/accounts_services_pb"
142
+
143
+ # Create the configuration object
144
+ @config = Configuration.new Client.configure
145
+
146
+ # Yield the configuration if needed
147
+ yield @config if block_given?
148
+
149
+ # Create credentials
150
+ credentials = @config.credentials
151
+ # Use self-signed JWT if the endpoint is unchanged from default,
152
+ # but only if the default endpoint does not have a region prefix.
153
+ enable_self_signed_jwt = @config.endpoint.nil? ||
154
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
155
+ !@config.endpoint.split(".").first.include?("-"))
156
+ credentials ||= Credentials.default scope: @config.scope,
157
+ enable_self_signed_jwt: enable_self_signed_jwt
158
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
159
+ credentials = Credentials.new credentials, scope: @config.scope
160
+ end
161
+ @quota_project_id = @config.quota_project
162
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
163
+
164
+ @accounts_service_stub = ::Gapic::ServiceStub.new(
165
+ ::Google::Shopping::Css::V1::AccountsService::Stub,
166
+ credentials: credentials,
167
+ endpoint: @config.endpoint,
168
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
169
+ universe_domain: @config.universe_domain,
170
+ channel_args: @config.channel_args,
171
+ interceptors: @config.interceptors,
172
+ channel_pool_config: @config.channel_pool
173
+ )
174
+ end
175
+
176
+ # Service calls
177
+
178
+ ##
179
+ # Lists all the accounts under the specified CSS account ID, and
180
+ # optionally filters by label ID and account name.
181
+ #
182
+ # @overload list_child_accounts(request, options = nil)
183
+ # Pass arguments to `list_child_accounts` via a request object, either of type
184
+ # {::Google::Shopping::Css::V1::ListChildAccountsRequest} or an equivalent Hash.
185
+ #
186
+ # @param request [::Google::Shopping::Css::V1::ListChildAccountsRequest, ::Hash]
187
+ # A request object representing the call parameters. Required. To specify no
188
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
189
+ # @param options [::Gapic::CallOptions, ::Hash]
190
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
191
+ #
192
+ # @overload list_child_accounts(parent: nil, label_id: nil, full_name: nil, page_size: nil, page_token: nil)
193
+ # Pass arguments to `list_child_accounts` via keyword arguments. Note that at
194
+ # least one keyword argument is required. To specify no parameters, or to keep all
195
+ # the default parameter values, pass an empty Hash as a request object (see above).
196
+ #
197
+ # @param parent [::String]
198
+ # Required. The parent account. Must be a CSS group or domain.
199
+ # Format: accounts/\\{account}
200
+ # @param label_id [::Integer]
201
+ # If set, only the MC accounts with the given label ID will be returned.
202
+ # @param full_name [::String]
203
+ # If set, only the MC accounts with the given name (case sensitive) will be
204
+ # returned.
205
+ # @param page_size [::Integer]
206
+ # Optional. The maximum number of accounts to return. The service may return
207
+ # fewer than this value. If unspecified, at most 50 accounts will be
208
+ # returned. The maximum value is 1000; values above 1000 will be coerced to
209
+ # 1000.
210
+ # @param page_token [::String]
211
+ # Optional. A page token, received from a previous `ListChildAccounts` call.
212
+ # Provide this to retrieve the subsequent page.
213
+ #
214
+ # When paginating, all other parameters provided to `ListChildAccounts` must
215
+ # match the call that provided the page token.
216
+ #
217
+ # @yield [response, operation] Access the result along with the RPC operation
218
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Shopping::Css::V1::Account>]
219
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
220
+ #
221
+ # @return [::Gapic::PagedEnumerable<::Google::Shopping::Css::V1::Account>]
222
+ #
223
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
224
+ #
225
+ # @example Basic example
226
+ # require "google/shopping/css/v1"
227
+ #
228
+ # # Create a client object. The client can be reused for multiple calls.
229
+ # client = Google::Shopping::Css::V1::AccountsService::Client.new
230
+ #
231
+ # # Create a request. To set request fields, pass in keyword arguments.
232
+ # request = Google::Shopping::Css::V1::ListChildAccountsRequest.new
233
+ #
234
+ # # Call the list_child_accounts method.
235
+ # result = client.list_child_accounts request
236
+ #
237
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
238
+ # # over elements, and API calls will be issued to fetch pages as needed.
239
+ # result.each do |item|
240
+ # # Each element is of type ::Google::Shopping::Css::V1::Account.
241
+ # p item
242
+ # end
243
+ #
244
+ def list_child_accounts request, options = nil
245
+ raise ::ArgumentError, "request must be provided" if request.nil?
246
+
247
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Css::V1::ListChildAccountsRequest
248
+
249
+ # Converts hash and nil to an options object
250
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
251
+
252
+ # Customize the options with defaults
253
+ metadata = @config.rpcs.list_child_accounts.metadata.to_h
254
+
255
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
256
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
257
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
258
+ gapic_version: ::Google::Shopping::Css::V1::VERSION
259
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
260
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
261
+
262
+ header_params = {}
263
+ if request.parent
264
+ header_params["parent"] = request.parent
265
+ end
266
+
267
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
268
+ metadata[:"x-goog-request-params"] ||= request_params_header
269
+
270
+ options.apply_defaults timeout: @config.rpcs.list_child_accounts.timeout,
271
+ metadata: metadata,
272
+ retry_policy: @config.rpcs.list_child_accounts.retry_policy
273
+
274
+ options.apply_defaults timeout: @config.timeout,
275
+ metadata: @config.metadata,
276
+ retry_policy: @config.retry_policy
277
+
278
+ @accounts_service_stub.call_rpc :list_child_accounts, request, options: options do |response, operation|
279
+ response = ::Gapic::PagedEnumerable.new @accounts_service_stub, :list_child_accounts, request, response, operation, options
280
+ yield response, operation if block_given?
281
+ return response
282
+ end
283
+ rescue ::GRPC::BadStatus => e
284
+ raise ::Google::Cloud::Error.from_error(e)
285
+ end
286
+
287
+ ##
288
+ # Retrieves a single CSS/MC account by ID.
289
+ #
290
+ # @overload get_account(request, options = nil)
291
+ # Pass arguments to `get_account` via a request object, either of type
292
+ # {::Google::Shopping::Css::V1::GetAccountRequest} or an equivalent Hash.
293
+ #
294
+ # @param request [::Google::Shopping::Css::V1::GetAccountRequest, ::Hash]
295
+ # A request object representing the call parameters. Required. To specify no
296
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
297
+ # @param options [::Gapic::CallOptions, ::Hash]
298
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
299
+ #
300
+ # @overload get_account(name: nil, parent: nil)
301
+ # Pass arguments to `get_account` via keyword arguments. Note that at
302
+ # least one keyword argument is required. To specify no parameters, or to keep all
303
+ # the default parameter values, pass an empty Hash as a request object (see above).
304
+ #
305
+ # @param name [::String]
306
+ # Required. The name of the managed CSS/MC account.
307
+ # Format: accounts/\\{account}
308
+ # @param parent [::String]
309
+ # Optional. Only required when retrieving MC account information.
310
+ # The CSS domain that is the parent resource of the MC account.
311
+ # Format: accounts/\\{account}
312
+ #
313
+ # @yield [response, operation] Access the result along with the RPC operation
314
+ # @yieldparam response [::Google::Shopping::Css::V1::Account]
315
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
316
+ #
317
+ # @return [::Google::Shopping::Css::V1::Account]
318
+ #
319
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
320
+ #
321
+ # @example Basic example
322
+ # require "google/shopping/css/v1"
323
+ #
324
+ # # Create a client object. The client can be reused for multiple calls.
325
+ # client = Google::Shopping::Css::V1::AccountsService::Client.new
326
+ #
327
+ # # Create a request. To set request fields, pass in keyword arguments.
328
+ # request = Google::Shopping::Css::V1::GetAccountRequest.new
329
+ #
330
+ # # Call the get_account method.
331
+ # result = client.get_account request
332
+ #
333
+ # # The returned object is of type Google::Shopping::Css::V1::Account.
334
+ # p result
335
+ #
336
+ def get_account request, options = nil
337
+ raise ::ArgumentError, "request must be provided" if request.nil?
338
+
339
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Css::V1::GetAccountRequest
340
+
341
+ # Converts hash and nil to an options object
342
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
343
+
344
+ # Customize the options with defaults
345
+ metadata = @config.rpcs.get_account.metadata.to_h
346
+
347
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
348
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
349
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
350
+ gapic_version: ::Google::Shopping::Css::V1::VERSION
351
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
352
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
353
+
354
+ header_params = {}
355
+ if request.name
356
+ header_params["name"] = request.name
357
+ end
358
+
359
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
360
+ metadata[:"x-goog-request-params"] ||= request_params_header
361
+
362
+ options.apply_defaults timeout: @config.rpcs.get_account.timeout,
363
+ metadata: metadata,
364
+ retry_policy: @config.rpcs.get_account.retry_policy
365
+
366
+ options.apply_defaults timeout: @config.timeout,
367
+ metadata: @config.metadata,
368
+ retry_policy: @config.retry_policy
369
+
370
+ @accounts_service_stub.call_rpc :get_account, request, options: options do |response, operation|
371
+ yield response, operation if block_given?
372
+ return response
373
+ end
374
+ rescue ::GRPC::BadStatus => e
375
+ raise ::Google::Cloud::Error.from_error(e)
376
+ end
377
+
378
+ ##
379
+ # Updates labels assigned to CSS/MC accounts by a CSS domain.
380
+ #
381
+ # @overload update_labels(request, options = nil)
382
+ # Pass arguments to `update_labels` via a request object, either of type
383
+ # {::Google::Shopping::Css::V1::UpdateAccountLabelsRequest} or an equivalent Hash.
384
+ #
385
+ # @param request [::Google::Shopping::Css::V1::UpdateAccountLabelsRequest, ::Hash]
386
+ # A request object representing the call parameters. Required. To specify no
387
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
388
+ # @param options [::Gapic::CallOptions, ::Hash]
389
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
390
+ #
391
+ # @overload update_labels(name: nil, label_ids: nil, parent: nil)
392
+ # Pass arguments to `update_labels` via keyword arguments. Note that at
393
+ # least one keyword argument is required. To specify no parameters, or to keep all
394
+ # the default parameter values, pass an empty Hash as a request object (see above).
395
+ #
396
+ # @param name [::String]
397
+ # Required. The label resource name.
398
+ # Format: accounts/\\{account}
399
+ # @param label_ids [::Array<::Integer>]
400
+ # The list of label IDs to overwrite the existing account label IDs.
401
+ # If the list is empty, all currently assigned label IDs will be deleted.
402
+ # @param parent [::String]
403
+ # Optional. Only required when updating MC account labels.
404
+ # The CSS domain that is the parent resource of the MC account.
405
+ # Format: accounts/\\{account}
406
+ #
407
+ # @yield [response, operation] Access the result along with the RPC operation
408
+ # @yieldparam response [::Google::Shopping::Css::V1::Account]
409
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
410
+ #
411
+ # @return [::Google::Shopping::Css::V1::Account]
412
+ #
413
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
414
+ #
415
+ # @example Basic example
416
+ # require "google/shopping/css/v1"
417
+ #
418
+ # # Create a client object. The client can be reused for multiple calls.
419
+ # client = Google::Shopping::Css::V1::AccountsService::Client.new
420
+ #
421
+ # # Create a request. To set request fields, pass in keyword arguments.
422
+ # request = Google::Shopping::Css::V1::UpdateAccountLabelsRequest.new
423
+ #
424
+ # # Call the update_labels method.
425
+ # result = client.update_labels request
426
+ #
427
+ # # The returned object is of type Google::Shopping::Css::V1::Account.
428
+ # p result
429
+ #
430
+ def update_labels request, options = nil
431
+ raise ::ArgumentError, "request must be provided" if request.nil?
432
+
433
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Css::V1::UpdateAccountLabelsRequest
434
+
435
+ # Converts hash and nil to an options object
436
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
437
+
438
+ # Customize the options with defaults
439
+ metadata = @config.rpcs.update_labels.metadata.to_h
440
+
441
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
442
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
443
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
444
+ gapic_version: ::Google::Shopping::Css::V1::VERSION
445
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
446
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
447
+
448
+ header_params = {}
449
+ if request.name
450
+ header_params["name"] = request.name
451
+ end
452
+
453
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
454
+ metadata[:"x-goog-request-params"] ||= request_params_header
455
+
456
+ options.apply_defaults timeout: @config.rpcs.update_labels.timeout,
457
+ metadata: metadata,
458
+ retry_policy: @config.rpcs.update_labels.retry_policy
459
+
460
+ options.apply_defaults timeout: @config.timeout,
461
+ metadata: @config.metadata,
462
+ retry_policy: @config.retry_policy
463
+
464
+ @accounts_service_stub.call_rpc :update_labels, request, options: options do |response, operation|
465
+ yield response, operation if block_given?
466
+ return response
467
+ end
468
+ rescue ::GRPC::BadStatus => e
469
+ raise ::Google::Cloud::Error.from_error(e)
470
+ end
471
+
472
+ ##
473
+ # Configuration class for the AccountsService API.
474
+ #
475
+ # This class represents the configuration for AccountsService,
476
+ # providing control over timeouts, retry behavior, logging, transport
477
+ # parameters, and other low-level controls. Certain parameters can also be
478
+ # applied individually to specific RPCs. See
479
+ # {::Google::Shopping::Css::V1::AccountsService::Client::Configuration::Rpcs}
480
+ # for a list of RPCs that can be configured independently.
481
+ #
482
+ # Configuration can be applied globally to all clients, or to a single client
483
+ # on construction.
484
+ #
485
+ # @example
486
+ #
487
+ # # Modify the global config, setting the timeout for
488
+ # # list_child_accounts to 20 seconds,
489
+ # # and all remaining timeouts to 10 seconds.
490
+ # ::Google::Shopping::Css::V1::AccountsService::Client.configure do |config|
491
+ # config.timeout = 10.0
492
+ # config.rpcs.list_child_accounts.timeout = 20.0
493
+ # end
494
+ #
495
+ # # Apply the above configuration only to a new client.
496
+ # client = ::Google::Shopping::Css::V1::AccountsService::Client.new do |config|
497
+ # config.timeout = 10.0
498
+ # config.rpcs.list_child_accounts.timeout = 20.0
499
+ # end
500
+ #
501
+ # @!attribute [rw] endpoint
502
+ # A custom service endpoint, as a hostname or hostname:port. The default is
503
+ # nil, indicating to use the default endpoint in the current universe domain.
504
+ # @return [::String,nil]
505
+ # @!attribute [rw] credentials
506
+ # Credentials to send with calls. You may provide any of the following types:
507
+ # * (`String`) The path to a service account key file in JSON format
508
+ # * (`Hash`) A service account key as a Hash
509
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
510
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
511
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
512
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
513
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
514
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
515
+ # * (`nil`) indicating no credentials
516
+ # @return [::Object]
517
+ # @!attribute [rw] scope
518
+ # The OAuth scopes
519
+ # @return [::Array<::String>]
520
+ # @!attribute [rw] lib_name
521
+ # The library name as recorded in instrumentation and logging
522
+ # @return [::String]
523
+ # @!attribute [rw] lib_version
524
+ # The library version as recorded in instrumentation and logging
525
+ # @return [::String]
526
+ # @!attribute [rw] channel_args
527
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
528
+ # `GRPC::Core::Channel` object is provided as the credential.
529
+ # @return [::Hash]
530
+ # @!attribute [rw] interceptors
531
+ # An array of interceptors that are run before calls are executed.
532
+ # @return [::Array<::GRPC::ClientInterceptor>]
533
+ # @!attribute [rw] timeout
534
+ # The call timeout in seconds.
535
+ # @return [::Numeric]
536
+ # @!attribute [rw] metadata
537
+ # Additional gRPC headers to be sent with the call.
538
+ # @return [::Hash{::Symbol=>::String}]
539
+ # @!attribute [rw] retry_policy
540
+ # The retry policy. The value is a hash with the following keys:
541
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
542
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
543
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
544
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
545
+ # trigger a retry.
546
+ # @return [::Hash]
547
+ # @!attribute [rw] quota_project
548
+ # A separate project against which to charge quota.
549
+ # @return [::String]
550
+ # @!attribute [rw] universe_domain
551
+ # The universe domain within which to make requests. This determines the
552
+ # default endpoint URL. The default value of nil uses the environment
553
+ # universe (usually the default "googleapis.com" universe).
554
+ # @return [::String,nil]
555
+ #
556
+ class Configuration
557
+ extend ::Gapic::Config
558
+
559
+ # @private
560
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
561
+ DEFAULT_ENDPOINT = "css.googleapis.com"
562
+
563
+ config_attr :endpoint, nil, ::String, nil
564
+ config_attr :credentials, nil do |value|
565
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
566
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
567
+ allowed.any? { |klass| klass === value }
568
+ end
569
+ config_attr :scope, nil, ::String, ::Array, nil
570
+ config_attr :lib_name, nil, ::String, nil
571
+ config_attr :lib_version, nil, ::String, nil
572
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
573
+ config_attr :interceptors, nil, ::Array, nil
574
+ config_attr :timeout, nil, ::Numeric, nil
575
+ config_attr :metadata, nil, ::Hash, nil
576
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
577
+ config_attr :quota_project, nil, ::String, nil
578
+ config_attr :universe_domain, nil, ::String, nil
579
+
580
+ # @private
581
+ def initialize parent_config = nil
582
+ @parent_config = parent_config unless parent_config.nil?
583
+
584
+ yield self if block_given?
585
+ end
586
+
587
+ ##
588
+ # Configurations for individual RPCs
589
+ # @return [Rpcs]
590
+ #
591
+ def rpcs
592
+ @rpcs ||= begin
593
+ parent_rpcs = nil
594
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
595
+ Rpcs.new parent_rpcs
596
+ end
597
+ end
598
+
599
+ ##
600
+ # Configuration for the channel pool
601
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
602
+ #
603
+ def channel_pool
604
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
605
+ end
606
+
607
+ ##
608
+ # Configuration RPC class for the AccountsService API.
609
+ #
610
+ # Includes fields providing the configuration for each RPC in this service.
611
+ # Each configuration object is of type `Gapic::Config::Method` and includes
612
+ # the following configuration fields:
613
+ #
614
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
615
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
616
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
617
+ # include the following keys:
618
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
619
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
620
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
621
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
622
+ # trigger a retry.
623
+ #
624
+ class Rpcs
625
+ ##
626
+ # RPC-specific configuration for `list_child_accounts`
627
+ # @return [::Gapic::Config::Method]
628
+ #
629
+ attr_reader :list_child_accounts
630
+ ##
631
+ # RPC-specific configuration for `get_account`
632
+ # @return [::Gapic::Config::Method]
633
+ #
634
+ attr_reader :get_account
635
+ ##
636
+ # RPC-specific configuration for `update_labels`
637
+ # @return [::Gapic::Config::Method]
638
+ #
639
+ attr_reader :update_labels
640
+
641
+ # @private
642
+ def initialize parent_rpcs = nil
643
+ list_child_accounts_config = parent_rpcs.list_child_accounts if parent_rpcs.respond_to? :list_child_accounts
644
+ @list_child_accounts = ::Gapic::Config::Method.new list_child_accounts_config
645
+ get_account_config = parent_rpcs.get_account if parent_rpcs.respond_to? :get_account
646
+ @get_account = ::Gapic::Config::Method.new get_account_config
647
+ update_labels_config = parent_rpcs.update_labels if parent_rpcs.respond_to? :update_labels
648
+ @update_labels = ::Gapic::Config::Method.new update_labels_config
649
+
650
+ yield self if block_given?
651
+ end
652
+ end
653
+ end
654
+ end
655
+ end
656
+ end
657
+ end
658
+ end
659
+ end