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