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

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