google-shopping-merchant-reviews-v1beta 0.1.0

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