google-shopping-merchant-lfp-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 (59) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +154 -8
  5. data/lib/google/shopping/merchant/lfp/v1/lfp_inventory_service/client.rb +471 -0
  6. data/lib/google/shopping/merchant/lfp/v1/lfp_inventory_service/credentials.rb +49 -0
  7. data/lib/google/shopping/merchant/lfp/v1/lfp_inventory_service/paths.rb +70 -0
  8. data/lib/google/shopping/merchant/lfp/v1/lfp_inventory_service/rest/client.rb +438 -0
  9. data/lib/google/shopping/merchant/lfp/v1/lfp_inventory_service/rest/service_stub.rb +145 -0
  10. data/lib/google/shopping/merchant/lfp/v1/lfp_inventory_service/rest.rb +56 -0
  11. data/lib/google/shopping/merchant/lfp/v1/lfp_inventory_service.rb +59 -0
  12. data/lib/google/shopping/merchant/lfp/v1/lfp_merchant_state_service/client.rb +471 -0
  13. data/lib/google/shopping/merchant/lfp/v1/lfp_merchant_state_service/credentials.rb +49 -0
  14. data/lib/google/shopping/merchant/lfp/v1/lfp_merchant_state_service/paths.rb +52 -0
  15. data/lib/google/shopping/merchant/lfp/v1/lfp_merchant_state_service/rest/client.rb +438 -0
  16. data/lib/google/shopping/merchant/lfp/v1/lfp_merchant_state_service/rest/service_stub.rb +144 -0
  17. data/lib/google/shopping/merchant/lfp/v1/lfp_merchant_state_service/rest.rb +59 -0
  18. data/lib/google/shopping/merchant/lfp/v1/lfp_merchant_state_service.rb +62 -0
  19. data/lib/google/shopping/merchant/lfp/v1/lfp_sale_service/client.rb +469 -0
  20. data/lib/google/shopping/merchant/lfp/v1/lfp_sale_service/credentials.rb +49 -0
  21. data/lib/google/shopping/merchant/lfp/v1/lfp_sale_service/paths.rb +52 -0
  22. data/lib/google/shopping/merchant/lfp/v1/lfp_sale_service/rest/client.rb +436 -0
  23. data/lib/google/shopping/merchant/lfp/v1/lfp_sale_service/rest/service_stub.rb +145 -0
  24. data/lib/google/shopping/merchant/lfp/v1/lfp_sale_service/rest.rb +56 -0
  25. data/lib/google/shopping/merchant/lfp/v1/lfp_sale_service.rb +59 -0
  26. data/lib/google/shopping/merchant/lfp/v1/lfp_store_service/client.rb +771 -0
  27. data/lib/google/shopping/merchant/lfp/v1/lfp_store_service/credentials.rb +49 -0
  28. data/lib/google/shopping/merchant/lfp/v1/lfp_store_service/paths.rb +68 -0
  29. data/lib/google/shopping/merchant/lfp/v1/lfp_store_service/rest/client.rb +717 -0
  30. data/lib/google/shopping/merchant/lfp/v1/lfp_store_service/rest/service_stub.rb +328 -0
  31. data/lib/google/shopping/merchant/lfp/v1/lfp_store_service/rest.rb +56 -0
  32. data/lib/google/shopping/merchant/lfp/v1/lfp_store_service.rb +59 -0
  33. data/lib/google/shopping/merchant/lfp/v1/lfpinventory_pb.rb +54 -0
  34. data/lib/google/shopping/merchant/lfp/v1/lfpinventory_services_pb.rb +51 -0
  35. data/lib/google/shopping/merchant/lfp/v1/lfpmerchantstate_pb.rb +56 -0
  36. data/lib/google/shopping/merchant/lfp/v1/lfpmerchantstate_services_pb.rb +52 -0
  37. data/lib/google/shopping/merchant/lfp/v1/lfpsale_pb.rb +55 -0
  38. data/lib/google/shopping/merchant/lfp/v1/lfpsale_services_pb.rb +49 -0
  39. data/lib/google/shopping/merchant/lfp/v1/lfpstore_pb.rb +56 -0
  40. data/lib/google/shopping/merchant/lfp/v1/lfpstore_services_pb.rb +57 -0
  41. data/lib/google/shopping/merchant/lfp/v1/rest.rb +42 -0
  42. data/lib/google/shopping/merchant/lfp/v1/version.rb +7 -2
  43. data/lib/google/shopping/merchant/lfp/v1.rb +50 -0
  44. data/lib/google-shopping-merchant-lfp-v1.rb +21 -0
  45. data/proto_docs/README.md +4 -0
  46. data/proto_docs/google/api/client.rb +473 -0
  47. data/proto_docs/google/api/field_behavior.rb +85 -0
  48. data/proto_docs/google/api/field_info.rb +88 -0
  49. data/proto_docs/google/api/launch_stage.rb +71 -0
  50. data/proto_docs/google/api/resource.rb +227 -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/merchant/lfp/v1/lfpinventory.rb +113 -0
  55. data/proto_docs/google/shopping/merchant/lfp/v1/lfpmerchantstate.rb +181 -0
  56. data/proto_docs/google/shopping/merchant/lfp/v1/lfpsale.rb +96 -0
  57. data/proto_docs/google/shopping/merchant/lfp/v1/lfpstore.rb +185 -0
  58. data/proto_docs/google/shopping/type/types.rb +210 -0
  59. metadata +117 -9
@@ -0,0 +1,771 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2025 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/shopping/merchant/lfp/v1/lfpstore_pb"
21
+
22
+ module Google
23
+ module Shopping
24
+ module Merchant
25
+ module Lfp
26
+ module V1
27
+ module LfpStoreService
28
+ ##
29
+ # Client for the LfpStoreService service.
30
+ #
31
+ # Service for a [LFP
32
+ # partner](https://support.google.com/merchants/answer/7676652) to submit local
33
+ # stores for a merchant.
34
+ #
35
+ class Client
36
+ # @private
37
+ API_VERSION = ""
38
+
39
+ # @private
40
+ DEFAULT_ENDPOINT_TEMPLATE = "merchantapi.$UNIVERSE_DOMAIN$"
41
+
42
+ include Paths
43
+
44
+ # @private
45
+ attr_reader :lfp_store_service_stub
46
+
47
+ ##
48
+ # Configure the LfpStoreService Client class.
49
+ #
50
+ # See {::Google::Shopping::Merchant::Lfp::V1::LfpStoreService::Client::Configuration}
51
+ # for a description of the configuration fields.
52
+ #
53
+ # @example
54
+ #
55
+ # # Modify the configuration for all LfpStoreService clients
56
+ # ::Google::Shopping::Merchant::Lfp::V1::LfpStoreService::Client.configure do |config|
57
+ # config.timeout = 10.0
58
+ # end
59
+ #
60
+ # @yield [config] Configure the Client client.
61
+ # @yieldparam config [Client::Configuration]
62
+ #
63
+ # @return [Client::Configuration]
64
+ #
65
+ def self.configure
66
+ @configure ||= begin
67
+ namespace = ["Google", "Shopping", "Merchant", "Lfp", "V1"]
68
+ parent_config = while namespace.any?
69
+ parent_name = namespace.join "::"
70
+ parent_const = const_get parent_name
71
+ break parent_const.configure if parent_const.respond_to? :configure
72
+ namespace.pop
73
+ end
74
+ default_config = Client::Configuration.new parent_config
75
+
76
+ default_config.timeout = 60.0
77
+ default_config.retry_policy = {
78
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
79
+ }
80
+
81
+ default_config
82
+ end
83
+ yield @configure if block_given?
84
+ @configure
85
+ end
86
+
87
+ ##
88
+ # Configure the LfpStoreService Client instance.
89
+ #
90
+ # The configuration is set to the derived mode, meaning that values can be changed,
91
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
92
+ # should be made on {Client.configure}.
93
+ #
94
+ # See {::Google::Shopping::Merchant::Lfp::V1::LfpStoreService::Client::Configuration}
95
+ # for a description of the configuration fields.
96
+ #
97
+ # @yield [config] Configure the Client client.
98
+ # @yieldparam config [Client::Configuration]
99
+ #
100
+ # @return [Client::Configuration]
101
+ #
102
+ def configure
103
+ yield @config if block_given?
104
+ @config
105
+ end
106
+
107
+ ##
108
+ # The effective universe domain
109
+ #
110
+ # @return [String]
111
+ #
112
+ def universe_domain
113
+ @lfp_store_service_stub.universe_domain
114
+ end
115
+
116
+ ##
117
+ # Create a new LfpStoreService client object.
118
+ #
119
+ # @example
120
+ #
121
+ # # Create a client using the default configuration
122
+ # client = ::Google::Shopping::Merchant::Lfp::V1::LfpStoreService::Client.new
123
+ #
124
+ # # Create a client using a custom configuration
125
+ # client = ::Google::Shopping::Merchant::Lfp::V1::LfpStoreService::Client.new do |config|
126
+ # config.timeout = 10.0
127
+ # end
128
+ #
129
+ # @yield [config] Configure the LfpStoreService client.
130
+ # @yieldparam config [Client::Configuration]
131
+ #
132
+ def initialize
133
+ # These require statements are intentionally placed here to initialize
134
+ # the gRPC module only when it's required.
135
+ # See https://github.com/googleapis/toolkit/issues/446
136
+ require "gapic/grpc"
137
+ require "google/shopping/merchant/lfp/v1/lfpstore_services_pb"
138
+
139
+ # Create the configuration object
140
+ @config = Configuration.new Client.configure
141
+
142
+ # Yield the configuration if needed
143
+ yield @config if block_given?
144
+
145
+ # Create credentials
146
+ credentials = @config.credentials
147
+ # Use self-signed JWT if the endpoint is unchanged from default,
148
+ # but only if the default endpoint does not have a region prefix.
149
+ enable_self_signed_jwt = @config.endpoint.nil? ||
150
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
151
+ !@config.endpoint.split(".").first.include?("-"))
152
+ credentials ||= Credentials.default scope: @config.scope,
153
+ enable_self_signed_jwt: enable_self_signed_jwt
154
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
155
+ credentials = Credentials.new credentials, scope: @config.scope
156
+ end
157
+ @quota_project_id = @config.quota_project
158
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
159
+
160
+ @lfp_store_service_stub = ::Gapic::ServiceStub.new(
161
+ ::Google::Shopping::Merchant::Lfp::V1::LfpStoreService::Stub,
162
+ credentials: credentials,
163
+ endpoint: @config.endpoint,
164
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
165
+ universe_domain: @config.universe_domain,
166
+ channel_args: @config.channel_args,
167
+ interceptors: @config.interceptors,
168
+ channel_pool_config: @config.channel_pool,
169
+ logger: @config.logger
170
+ )
171
+
172
+ @lfp_store_service_stub.stub_logger&.info do |entry|
173
+ entry.set_system_name
174
+ entry.set_service
175
+ entry.message = "Created client for #{entry.service}"
176
+ entry.set_credentials_fields credentials
177
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
178
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
179
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
180
+ end
181
+ end
182
+
183
+ ##
184
+ # The logger used for request/response debug logging.
185
+ #
186
+ # @return [Logger]
187
+ #
188
+ def logger
189
+ @lfp_store_service_stub.logger
190
+ end
191
+
192
+ # Service calls
193
+
194
+ ##
195
+ # Retrieves information about a store.
196
+ #
197
+ # @overload get_lfp_store(request, options = nil)
198
+ # Pass arguments to `get_lfp_store` via a request object, either of type
199
+ # {::Google::Shopping::Merchant::Lfp::V1::GetLfpStoreRequest} or an equivalent Hash.
200
+ #
201
+ # @param request [::Google::Shopping::Merchant::Lfp::V1::GetLfpStoreRequest, ::Hash]
202
+ # A request object representing the call parameters. Required. To specify no
203
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
204
+ # @param options [::Gapic::CallOptions, ::Hash]
205
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
206
+ #
207
+ # @overload get_lfp_store(name: nil)
208
+ # Pass arguments to `get_lfp_store` via keyword arguments. Note that at
209
+ # least one keyword argument is required. To specify no parameters, or to keep all
210
+ # the default parameter values, pass an empty Hash as a request object (see above).
211
+ #
212
+ # @param name [::String]
213
+ # Required. The name of the store to retrieve.
214
+ # Format: `accounts/{account}/lfpStores/{target_merchant}~{store_code}`
215
+ #
216
+ # @yield [response, operation] Access the result along with the RPC operation
217
+ # @yieldparam response [::Google::Shopping::Merchant::Lfp::V1::LfpStore]
218
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
219
+ #
220
+ # @return [::Google::Shopping::Merchant::Lfp::V1::LfpStore]
221
+ #
222
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
223
+ #
224
+ # @example Basic example
225
+ # require "google/shopping/merchant/lfp/v1"
226
+ #
227
+ # # Create a client object. The client can be reused for multiple calls.
228
+ # client = Google::Shopping::Merchant::Lfp::V1::LfpStoreService::Client.new
229
+ #
230
+ # # Create a request. To set request fields, pass in keyword arguments.
231
+ # request = Google::Shopping::Merchant::Lfp::V1::GetLfpStoreRequest.new
232
+ #
233
+ # # Call the get_lfp_store method.
234
+ # result = client.get_lfp_store request
235
+ #
236
+ # # The returned object is of type Google::Shopping::Merchant::Lfp::V1::LfpStore.
237
+ # p result
238
+ #
239
+ def get_lfp_store request, options = nil
240
+ raise ::ArgumentError, "request must be provided" if request.nil?
241
+
242
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Lfp::V1::GetLfpStoreRequest
243
+
244
+ # Converts hash and nil to an options object
245
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
246
+
247
+ # Customize the options with defaults
248
+ metadata = @config.rpcs.get_lfp_store.metadata.to_h
249
+
250
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
251
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
252
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
253
+ gapic_version: ::Google::Shopping::Merchant::Lfp::V1::VERSION
254
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
255
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
256
+
257
+ header_params = {}
258
+ if request.name
259
+ header_params["name"] = request.name
260
+ end
261
+
262
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
263
+ metadata[:"x-goog-request-params"] ||= request_params_header
264
+
265
+ options.apply_defaults timeout: @config.rpcs.get_lfp_store.timeout,
266
+ metadata: metadata,
267
+ retry_policy: @config.rpcs.get_lfp_store.retry_policy
268
+
269
+ options.apply_defaults timeout: @config.timeout,
270
+ metadata: @config.metadata,
271
+ retry_policy: @config.retry_policy
272
+
273
+ @lfp_store_service_stub.call_rpc :get_lfp_store, request, options: options do |response, operation|
274
+ yield response, operation if block_given?
275
+ end
276
+ rescue ::GRPC::BadStatus => e
277
+ raise ::Google::Cloud::Error.from_error(e)
278
+ end
279
+
280
+ ##
281
+ # Inserts a store for the target merchant. If the store with the same store
282
+ # code already exists, it will be replaced.
283
+ #
284
+ # @overload insert_lfp_store(request, options = nil)
285
+ # Pass arguments to `insert_lfp_store` via a request object, either of type
286
+ # {::Google::Shopping::Merchant::Lfp::V1::InsertLfpStoreRequest} or an equivalent Hash.
287
+ #
288
+ # @param request [::Google::Shopping::Merchant::Lfp::V1::InsertLfpStoreRequest, ::Hash]
289
+ # A request object representing the call parameters. Required. To specify no
290
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
291
+ # @param options [::Gapic::CallOptions, ::Hash]
292
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
293
+ #
294
+ # @overload insert_lfp_store(parent: nil, lfp_store: nil)
295
+ # Pass arguments to `insert_lfp_store` via keyword arguments. Note that at
296
+ # least one keyword argument is required. To specify no parameters, or to keep all
297
+ # the default parameter values, pass an empty Hash as a request object (see above).
298
+ #
299
+ # @param parent [::String]
300
+ # Required. The LFP provider account
301
+ # Format: `accounts/{account}`
302
+ # @param lfp_store [::Google::Shopping::Merchant::Lfp::V1::LfpStore, ::Hash]
303
+ # Required. The store to insert.
304
+ #
305
+ # @yield [response, operation] Access the result along with the RPC operation
306
+ # @yieldparam response [::Google::Shopping::Merchant::Lfp::V1::LfpStore]
307
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
308
+ #
309
+ # @return [::Google::Shopping::Merchant::Lfp::V1::LfpStore]
310
+ #
311
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
312
+ #
313
+ # @example Basic example
314
+ # require "google/shopping/merchant/lfp/v1"
315
+ #
316
+ # # Create a client object. The client can be reused for multiple calls.
317
+ # client = Google::Shopping::Merchant::Lfp::V1::LfpStoreService::Client.new
318
+ #
319
+ # # Create a request. To set request fields, pass in keyword arguments.
320
+ # request = Google::Shopping::Merchant::Lfp::V1::InsertLfpStoreRequest.new
321
+ #
322
+ # # Call the insert_lfp_store method.
323
+ # result = client.insert_lfp_store request
324
+ #
325
+ # # The returned object is of type Google::Shopping::Merchant::Lfp::V1::LfpStore.
326
+ # p result
327
+ #
328
+ def insert_lfp_store request, options = nil
329
+ raise ::ArgumentError, "request must be provided" if request.nil?
330
+
331
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Lfp::V1::InsertLfpStoreRequest
332
+
333
+ # Converts hash and nil to an options object
334
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
335
+
336
+ # Customize the options with defaults
337
+ metadata = @config.rpcs.insert_lfp_store.metadata.to_h
338
+
339
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
340
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
341
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
342
+ gapic_version: ::Google::Shopping::Merchant::Lfp::V1::VERSION
343
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
344
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
345
+
346
+ header_params = {}
347
+ if request.parent
348
+ header_params["parent"] = request.parent
349
+ end
350
+
351
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
352
+ metadata[:"x-goog-request-params"] ||= request_params_header
353
+
354
+ options.apply_defaults timeout: @config.rpcs.insert_lfp_store.timeout,
355
+ metadata: metadata,
356
+ retry_policy: @config.rpcs.insert_lfp_store.retry_policy
357
+
358
+ options.apply_defaults timeout: @config.timeout,
359
+ metadata: @config.metadata,
360
+ retry_policy: @config.retry_policy
361
+
362
+ @lfp_store_service_stub.call_rpc :insert_lfp_store, request, options: options do |response, operation|
363
+ yield response, operation if block_given?
364
+ end
365
+ rescue ::GRPC::BadStatus => e
366
+ raise ::Google::Cloud::Error.from_error(e)
367
+ end
368
+
369
+ ##
370
+ # Deletes a store for a target merchant.
371
+ #
372
+ # @overload delete_lfp_store(request, options = nil)
373
+ # Pass arguments to `delete_lfp_store` via a request object, either of type
374
+ # {::Google::Shopping::Merchant::Lfp::V1::DeleteLfpStoreRequest} or an equivalent Hash.
375
+ #
376
+ # @param request [::Google::Shopping::Merchant::Lfp::V1::DeleteLfpStoreRequest, ::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 delete_lfp_store(name: nil)
383
+ # Pass arguments to `delete_lfp_store` 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 name [::String]
388
+ # Required. The name of the store to delete for the target merchant account.
389
+ # Format: `accounts/{account}/lfpStores/{target_merchant}~{store_code}`
390
+ #
391
+ # @yield [response, operation] Access the result along with the RPC operation
392
+ # @yieldparam response [::Google::Protobuf::Empty]
393
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
394
+ #
395
+ # @return [::Google::Protobuf::Empty]
396
+ #
397
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
398
+ #
399
+ # @example Basic example
400
+ # require "google/shopping/merchant/lfp/v1"
401
+ #
402
+ # # Create a client object. The client can be reused for multiple calls.
403
+ # client = Google::Shopping::Merchant::Lfp::V1::LfpStoreService::Client.new
404
+ #
405
+ # # Create a request. To set request fields, pass in keyword arguments.
406
+ # request = Google::Shopping::Merchant::Lfp::V1::DeleteLfpStoreRequest.new
407
+ #
408
+ # # Call the delete_lfp_store method.
409
+ # result = client.delete_lfp_store request
410
+ #
411
+ # # The returned object is of type Google::Protobuf::Empty.
412
+ # p result
413
+ #
414
+ def delete_lfp_store request, options = nil
415
+ raise ::ArgumentError, "request must be provided" if request.nil?
416
+
417
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Lfp::V1::DeleteLfpStoreRequest
418
+
419
+ # Converts hash and nil to an options object
420
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
421
+
422
+ # Customize the options with defaults
423
+ metadata = @config.rpcs.delete_lfp_store.metadata.to_h
424
+
425
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
426
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
427
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
428
+ gapic_version: ::Google::Shopping::Merchant::Lfp::V1::VERSION
429
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
430
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
431
+
432
+ header_params = {}
433
+ if request.name
434
+ header_params["name"] = request.name
435
+ end
436
+
437
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
438
+ metadata[:"x-goog-request-params"] ||= request_params_header
439
+
440
+ options.apply_defaults timeout: @config.rpcs.delete_lfp_store.timeout,
441
+ metadata: metadata,
442
+ retry_policy: @config.rpcs.delete_lfp_store.retry_policy
443
+
444
+ options.apply_defaults timeout: @config.timeout,
445
+ metadata: @config.metadata,
446
+ retry_policy: @config.retry_policy
447
+
448
+ @lfp_store_service_stub.call_rpc :delete_lfp_store, request, options: options do |response, operation|
449
+ yield response, operation if block_given?
450
+ end
451
+ rescue ::GRPC::BadStatus => e
452
+ raise ::Google::Cloud::Error.from_error(e)
453
+ end
454
+
455
+ ##
456
+ # Lists the stores of the target merchant, specified by the filter in
457
+ # `ListLfpStoresRequest`.
458
+ #
459
+ # @overload list_lfp_stores(request, options = nil)
460
+ # Pass arguments to `list_lfp_stores` via a request object, either of type
461
+ # {::Google::Shopping::Merchant::Lfp::V1::ListLfpStoresRequest} or an equivalent Hash.
462
+ #
463
+ # @param request [::Google::Shopping::Merchant::Lfp::V1::ListLfpStoresRequest, ::Hash]
464
+ # A request object representing the call parameters. Required. To specify no
465
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
466
+ # @param options [::Gapic::CallOptions, ::Hash]
467
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
468
+ #
469
+ # @overload list_lfp_stores(parent: nil, target_account: nil, page_size: nil, page_token: nil)
470
+ # Pass arguments to `list_lfp_stores` via keyword arguments. Note that at
471
+ # least one keyword argument is required. To specify no parameters, or to keep all
472
+ # the default parameter values, pass an empty Hash as a request object (see above).
473
+ #
474
+ # @param parent [::String]
475
+ # Required. The LFP partner.
476
+ # Format: `accounts/{account}`
477
+ # @param target_account [::Integer]
478
+ # Required. The Merchant Center id of the merchant to list stores for.
479
+ # @param page_size [::Integer]
480
+ # Optional. The maximum number of `LfpStore` resources for the given account
481
+ # to return. The service returns fewer than this value if the number of
482
+ # stores for the given account is less than the `pageSize`. The default value
483
+ # is 250. The maximum value is 1000; If a value higher than the maximum is
484
+ # specified, then the `pageSize` will default to the maximum.
485
+ # @param page_token [::String]
486
+ # Optional. A page token, received from a previous `ListLfpStoresRequest`
487
+ # call. Provide the page token to retrieve the subsequent page. When
488
+ # paginating, all other parameters provided to `ListLfpStoresRequest` must
489
+ # match the call that provided the page token. The token returned as
490
+ # {::Google::Shopping::Merchant::Lfp::V1::ListLfpStoresResponse#next_page_token nextPageToken}
491
+ # in the response to the previous request.
492
+ #
493
+ # @yield [response, operation] Access the result along with the RPC operation
494
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Shopping::Merchant::Lfp::V1::LfpStore>]
495
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
496
+ #
497
+ # @return [::Gapic::PagedEnumerable<::Google::Shopping::Merchant::Lfp::V1::LfpStore>]
498
+ #
499
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
500
+ #
501
+ # @example Basic example
502
+ # require "google/shopping/merchant/lfp/v1"
503
+ #
504
+ # # Create a client object. The client can be reused for multiple calls.
505
+ # client = Google::Shopping::Merchant::Lfp::V1::LfpStoreService::Client.new
506
+ #
507
+ # # Create a request. To set request fields, pass in keyword arguments.
508
+ # request = Google::Shopping::Merchant::Lfp::V1::ListLfpStoresRequest.new
509
+ #
510
+ # # Call the list_lfp_stores method.
511
+ # result = client.list_lfp_stores request
512
+ #
513
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
514
+ # # over elements, and API calls will be issued to fetch pages as needed.
515
+ # result.each do |item|
516
+ # # Each element is of type ::Google::Shopping::Merchant::Lfp::V1::LfpStore.
517
+ # p item
518
+ # end
519
+ #
520
+ def list_lfp_stores request, options = nil
521
+ raise ::ArgumentError, "request must be provided" if request.nil?
522
+
523
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Lfp::V1::ListLfpStoresRequest
524
+
525
+ # Converts hash and nil to an options object
526
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
527
+
528
+ # Customize the options with defaults
529
+ metadata = @config.rpcs.list_lfp_stores.metadata.to_h
530
+
531
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
532
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
533
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
534
+ gapic_version: ::Google::Shopping::Merchant::Lfp::V1::VERSION
535
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
536
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
537
+
538
+ header_params = {}
539
+ if request.parent
540
+ header_params["parent"] = request.parent
541
+ end
542
+
543
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
544
+ metadata[:"x-goog-request-params"] ||= request_params_header
545
+
546
+ options.apply_defaults timeout: @config.rpcs.list_lfp_stores.timeout,
547
+ metadata: metadata,
548
+ retry_policy: @config.rpcs.list_lfp_stores.retry_policy
549
+
550
+ options.apply_defaults timeout: @config.timeout,
551
+ metadata: @config.metadata,
552
+ retry_policy: @config.retry_policy
553
+
554
+ @lfp_store_service_stub.call_rpc :list_lfp_stores, request, options: options do |response, operation|
555
+ response = ::Gapic::PagedEnumerable.new @lfp_store_service_stub, :list_lfp_stores, request, response, operation, options
556
+ yield response, operation if block_given?
557
+ throw :response, response
558
+ end
559
+ rescue ::GRPC::BadStatus => e
560
+ raise ::Google::Cloud::Error.from_error(e)
561
+ end
562
+
563
+ ##
564
+ # Configuration class for the LfpStoreService API.
565
+ #
566
+ # This class represents the configuration for LfpStoreService,
567
+ # providing control over timeouts, retry behavior, logging, transport
568
+ # parameters, and other low-level controls. Certain parameters can also be
569
+ # applied individually to specific RPCs. See
570
+ # {::Google::Shopping::Merchant::Lfp::V1::LfpStoreService::Client::Configuration::Rpcs}
571
+ # for a list of RPCs that can be configured independently.
572
+ #
573
+ # Configuration can be applied globally to all clients, or to a single client
574
+ # on construction.
575
+ #
576
+ # @example
577
+ #
578
+ # # Modify the global config, setting the timeout for
579
+ # # get_lfp_store to 20 seconds,
580
+ # # and all remaining timeouts to 10 seconds.
581
+ # ::Google::Shopping::Merchant::Lfp::V1::LfpStoreService::Client.configure do |config|
582
+ # config.timeout = 10.0
583
+ # config.rpcs.get_lfp_store.timeout = 20.0
584
+ # end
585
+ #
586
+ # # Apply the above configuration only to a new client.
587
+ # client = ::Google::Shopping::Merchant::Lfp::V1::LfpStoreService::Client.new do |config|
588
+ # config.timeout = 10.0
589
+ # config.rpcs.get_lfp_store.timeout = 20.0
590
+ # end
591
+ #
592
+ # @!attribute [rw] endpoint
593
+ # A custom service endpoint, as a hostname or hostname:port. The default is
594
+ # nil, indicating to use the default endpoint in the current universe domain.
595
+ # @return [::String,nil]
596
+ # @!attribute [rw] credentials
597
+ # Credentials to send with calls. You may provide any of the following types:
598
+ # * (`String`) The path to a service account key file in JSON format
599
+ # * (`Hash`) A service account key as a Hash
600
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
601
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
602
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
603
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
604
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
605
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
606
+ # * (`nil`) indicating no credentials
607
+ #
608
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
609
+ # external source for authentication to Google Cloud, you must validate it before
610
+ # providing it to a Google API client library. Providing an unvalidated credential
611
+ # configuration to Google APIs can compromise the security of your systems and data.
612
+ # For more information, refer to [Validate credential configurations from external
613
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
614
+ # @return [::Object]
615
+ # @!attribute [rw] scope
616
+ # The OAuth scopes
617
+ # @return [::Array<::String>]
618
+ # @!attribute [rw] lib_name
619
+ # The library name as recorded in instrumentation and logging
620
+ # @return [::String]
621
+ # @!attribute [rw] lib_version
622
+ # The library version as recorded in instrumentation and logging
623
+ # @return [::String]
624
+ # @!attribute [rw] channel_args
625
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
626
+ # `GRPC::Core::Channel` object is provided as the credential.
627
+ # @return [::Hash]
628
+ # @!attribute [rw] interceptors
629
+ # An array of interceptors that are run before calls are executed.
630
+ # @return [::Array<::GRPC::ClientInterceptor>]
631
+ # @!attribute [rw] timeout
632
+ # The call timeout in seconds.
633
+ # @return [::Numeric]
634
+ # @!attribute [rw] metadata
635
+ # Additional gRPC headers to be sent with the call.
636
+ # @return [::Hash{::Symbol=>::String}]
637
+ # @!attribute [rw] retry_policy
638
+ # The retry policy. The value is a hash with the following keys:
639
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
640
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
641
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
642
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
643
+ # trigger a retry.
644
+ # @return [::Hash]
645
+ # @!attribute [rw] quota_project
646
+ # A separate project against which to charge quota.
647
+ # @return [::String]
648
+ # @!attribute [rw] universe_domain
649
+ # The universe domain within which to make requests. This determines the
650
+ # default endpoint URL. The default value of nil uses the environment
651
+ # universe (usually the default "googleapis.com" universe).
652
+ # @return [::String,nil]
653
+ # @!attribute [rw] logger
654
+ # A custom logger to use for request/response debug logging, or the value
655
+ # `:default` (the default) to construct a default logger, or `nil` to
656
+ # explicitly disable logging.
657
+ # @return [::Logger,:default,nil]
658
+ #
659
+ class Configuration
660
+ extend ::Gapic::Config
661
+
662
+ # @private
663
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
664
+ DEFAULT_ENDPOINT = "merchantapi.googleapis.com"
665
+
666
+ config_attr :endpoint, nil, ::String, nil
667
+ config_attr :credentials, nil do |value|
668
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
669
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
670
+ allowed.any? { |klass| klass === value }
671
+ end
672
+ config_attr :scope, nil, ::String, ::Array, nil
673
+ config_attr :lib_name, nil, ::String, nil
674
+ config_attr :lib_version, nil, ::String, nil
675
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
676
+ config_attr :interceptors, nil, ::Array, nil
677
+ config_attr :timeout, nil, ::Numeric, nil
678
+ config_attr :metadata, nil, ::Hash, nil
679
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
680
+ config_attr :quota_project, nil, ::String, nil
681
+ config_attr :universe_domain, nil, ::String, nil
682
+ config_attr :logger, :default, ::Logger, nil, :default
683
+
684
+ # @private
685
+ def initialize parent_config = nil
686
+ @parent_config = parent_config unless parent_config.nil?
687
+
688
+ yield self if block_given?
689
+ end
690
+
691
+ ##
692
+ # Configurations for individual RPCs
693
+ # @return [Rpcs]
694
+ #
695
+ def rpcs
696
+ @rpcs ||= begin
697
+ parent_rpcs = nil
698
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
699
+ Rpcs.new parent_rpcs
700
+ end
701
+ end
702
+
703
+ ##
704
+ # Configuration for the channel pool
705
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
706
+ #
707
+ def channel_pool
708
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
709
+ end
710
+
711
+ ##
712
+ # Configuration RPC class for the LfpStoreService API.
713
+ #
714
+ # Includes fields providing the configuration for each RPC in this service.
715
+ # Each configuration object is of type `Gapic::Config::Method` and includes
716
+ # the following configuration fields:
717
+ #
718
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
719
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
720
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
721
+ # include the following keys:
722
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
723
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
724
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
725
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
726
+ # trigger a retry.
727
+ #
728
+ class Rpcs
729
+ ##
730
+ # RPC-specific configuration for `get_lfp_store`
731
+ # @return [::Gapic::Config::Method]
732
+ #
733
+ attr_reader :get_lfp_store
734
+ ##
735
+ # RPC-specific configuration for `insert_lfp_store`
736
+ # @return [::Gapic::Config::Method]
737
+ #
738
+ attr_reader :insert_lfp_store
739
+ ##
740
+ # RPC-specific configuration for `delete_lfp_store`
741
+ # @return [::Gapic::Config::Method]
742
+ #
743
+ attr_reader :delete_lfp_store
744
+ ##
745
+ # RPC-specific configuration for `list_lfp_stores`
746
+ # @return [::Gapic::Config::Method]
747
+ #
748
+ attr_reader :list_lfp_stores
749
+
750
+ # @private
751
+ def initialize parent_rpcs = nil
752
+ get_lfp_store_config = parent_rpcs.get_lfp_store if parent_rpcs.respond_to? :get_lfp_store
753
+ @get_lfp_store = ::Gapic::Config::Method.new get_lfp_store_config
754
+ insert_lfp_store_config = parent_rpcs.insert_lfp_store if parent_rpcs.respond_to? :insert_lfp_store
755
+ @insert_lfp_store = ::Gapic::Config::Method.new insert_lfp_store_config
756
+ delete_lfp_store_config = parent_rpcs.delete_lfp_store if parent_rpcs.respond_to? :delete_lfp_store
757
+ @delete_lfp_store = ::Gapic::Config::Method.new delete_lfp_store_config
758
+ list_lfp_stores_config = parent_rpcs.list_lfp_stores if parent_rpcs.respond_to? :list_lfp_stores
759
+ @list_lfp_stores = ::Gapic::Config::Method.new list_lfp_stores_config
760
+
761
+ yield self if block_given?
762
+ end
763
+ end
764
+ end
765
+ end
766
+ end
767
+ end
768
+ end
769
+ end
770
+ end
771
+ end