google-cloud-retail-v2 0.3.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +8 -8
  3. data/README.md +1 -1
  4. data/lib/google/cloud/retail/v2.rb +2 -0
  5. data/lib/google/cloud/retail/v2/catalog_pb.rb +2 -0
  6. data/lib/google/cloud/retail/v2/catalog_service/client.rb +205 -9
  7. data/lib/google/cloud/retail/v2/catalog_service/paths.rb +21 -0
  8. data/lib/google/cloud/retail/v2/catalog_service_pb.rb +16 -0
  9. data/lib/google/cloud/retail/v2/catalog_service_services_pb.rb +46 -0
  10. data/lib/google/cloud/retail/v2/common_pb.rb +46 -0
  11. data/lib/google/cloud/retail/v2/completion_service.rb +54 -0
  12. data/lib/google/cloud/retail/v2/completion_service/client.rb +546 -0
  13. data/lib/google/cloud/retail/v2/completion_service/credentials.rb +51 -0
  14. data/lib/google/cloud/retail/v2/completion_service/operations.rb +655 -0
  15. data/lib/google/cloud/retail/v2/completion_service/paths.rb +52 -0
  16. data/lib/google/cloud/retail/v2/completion_service_pb.rb +50 -0
  17. data/lib/google/cloud/retail/v2/completion_service_services_pb.rb +61 -0
  18. data/lib/google/cloud/retail/v2/import_config_pb.rb +32 -0
  19. data/lib/google/cloud/retail/v2/prediction_service/client.rb +36 -38
  20. data/lib/google/cloud/retail/v2/product_pb.rb +21 -0
  21. data/lib/google/cloud/retail/v2/product_service/client.rb +634 -9
  22. data/lib/google/cloud/retail/v2/product_service/operations.rb +4 -4
  23. data/lib/google/cloud/retail/v2/product_service_pb.rb +56 -0
  24. data/lib/google/cloud/retail/v2/product_service_services_pb.rb +75 -0
  25. data/lib/google/cloud/retail/v2/search_service.rb +53 -0
  26. data/lib/google/cloud/retail/v2/search_service/client.rb +536 -0
  27. data/lib/google/cloud/retail/v2/search_service/credentials.rb +51 -0
  28. data/lib/google/cloud/retail/v2/search_service/paths.rb +54 -0
  29. data/lib/google/cloud/retail/v2/search_service_pb.rb +131 -0
  30. data/lib/google/cloud/retail/v2/search_service_services_pb.rb +53 -0
  31. data/lib/google/cloud/retail/v2/user_event_pb.rb +11 -0
  32. data/lib/google/cloud/retail/v2/user_event_service/client.rb +3 -6
  33. data/lib/google/cloud/retail/v2/user_event_service/operations.rb +4 -4
  34. data/lib/google/cloud/retail/v2/user_event_service/paths.rb +19 -0
  35. data/lib/google/cloud/retail/v2/version.rb +1 -1
  36. data/proto_docs/google/api/field_behavior.rb +7 -1
  37. data/proto_docs/google/api/httpbody.rb +4 -3
  38. data/proto_docs/google/cloud/retail/v2/catalog.rb +6 -6
  39. data/proto_docs/google/cloud/retail/v2/catalog_service.rb +53 -4
  40. data/proto_docs/google/cloud/retail/v2/common.rb +272 -4
  41. data/proto_docs/google/cloud/retail/v2/completion_service.rb +162 -0
  42. data/proto_docs/google/cloud/retail/v2/import_config.rb +122 -6
  43. data/proto_docs/google/cloud/retail/v2/prediction_service.rb +32 -31
  44. data/proto_docs/google/cloud/retail/v2/product.rb +266 -10
  45. data/proto_docs/google/cloud/retail/v2/product_service.rb +362 -2
  46. data/proto_docs/google/cloud/retail/v2/purge_config.rb +1 -1
  47. data/proto_docs/google/cloud/retail/v2/search_service.rb +681 -0
  48. data/proto_docs/google/cloud/retail/v2/user_event.rb +95 -3
  49. data/proto_docs/google/type/date.rb +53 -0
  50. metadata +29 -7
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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 "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/retail/v2/version"
24
+
25
+ require "google/cloud/retail/v2/completion_service/credentials"
26
+ require "google/cloud/retail/v2/completion_service/paths"
27
+ require "google/cloud/retail/v2/completion_service/operations"
28
+ require "google/cloud/retail/v2/completion_service/client"
29
+
30
+ module Google
31
+ module Cloud
32
+ module Retail
33
+ module V2
34
+ ##
35
+ # Auto-completion service for retail.
36
+ #
37
+ # This feature is only available for users who have Retail Search enabled.
38
+ # Contact Retail Support (retail-search-support@google.com) if you are
39
+ # interested in using Retail Search.
40
+ #
41
+ # To load this service and instantiate a client:
42
+ #
43
+ # require "google/cloud/retail/v2/completion_service"
44
+ # client = ::Google::Cloud::Retail::V2::CompletionService::Client.new
45
+ #
46
+ module CompletionService
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+
53
+ helper_path = ::File.join __dir__, "completion_service", "helpers.rb"
54
+ require "google/cloud/retail/v2/completion_service/helpers" if ::File.file? helper_path
@@ -0,0 +1,546 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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/cloud/retail/v2/completion_service_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Retail
25
+ module V2
26
+ module CompletionService
27
+ ##
28
+ # Client for the CompletionService service.
29
+ #
30
+ # Auto-completion service for retail.
31
+ #
32
+ # This feature is only available for users who have Retail Search enabled.
33
+ # Contact Retail Support (retail-search-support@google.com) if you are
34
+ # interested in using Retail Search.
35
+ #
36
+ class Client
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :completion_service_stub
41
+
42
+ ##
43
+ # Configure the CompletionService Client class.
44
+ #
45
+ # See {::Google::Cloud::Retail::V2::CompletionService::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # ## Example
49
+ #
50
+ # To modify the configuration for all CompletionService clients:
51
+ #
52
+ # ::Google::Cloud::Retail::V2::CompletionService::Client.configure do |config|
53
+ # config.timeout = 10.0
54
+ # end
55
+ #
56
+ # @yield [config] Configure the Client client.
57
+ # @yieldparam config [Client::Configuration]
58
+ #
59
+ # @return [Client::Configuration]
60
+ #
61
+ def self.configure
62
+ @configure ||= begin
63
+ namespace = ["Google", "Cloud", "Retail", "V2"]
64
+ parent_config = while namespace.any?
65
+ parent_name = namespace.join "::"
66
+ parent_const = const_get parent_name
67
+ break parent_const.configure if parent_const.respond_to? :configure
68
+ namespace.pop
69
+ end
70
+ default_config = Client::Configuration.new parent_config
71
+
72
+ default_config.timeout = 60.0
73
+ default_config.retry_policy = {
74
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
75
+ }
76
+
77
+ default_config
78
+ end
79
+ yield @configure if block_given?
80
+ @configure
81
+ end
82
+
83
+ ##
84
+ # Configure the CompletionService Client instance.
85
+ #
86
+ # The configuration is set to the derived mode, meaning that values can be changed,
87
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
88
+ # should be made on {Client.configure}.
89
+ #
90
+ # See {::Google::Cloud::Retail::V2::CompletionService::Client::Configuration}
91
+ # for a description of the configuration fields.
92
+ #
93
+ # @yield [config] Configure the Client client.
94
+ # @yieldparam config [Client::Configuration]
95
+ #
96
+ # @return [Client::Configuration]
97
+ #
98
+ def configure
99
+ yield @config if block_given?
100
+ @config
101
+ end
102
+
103
+ ##
104
+ # Create a new CompletionService client object.
105
+ #
106
+ # ## Examples
107
+ #
108
+ # To create a new CompletionService client with the default
109
+ # configuration:
110
+ #
111
+ # client = ::Google::Cloud::Retail::V2::CompletionService::Client.new
112
+ #
113
+ # To create a new CompletionService client with a custom
114
+ # configuration:
115
+ #
116
+ # client = ::Google::Cloud::Retail::V2::CompletionService::Client.new do |config|
117
+ # config.timeout = 10.0
118
+ # end
119
+ #
120
+ # @yield [config] Configure the CompletionService client.
121
+ # @yieldparam config [Client::Configuration]
122
+ #
123
+ def initialize
124
+ # These require statements are intentionally placed here to initialize
125
+ # the gRPC module only when it's required.
126
+ # See https://github.com/googleapis/toolkit/issues/446
127
+ require "gapic/grpc"
128
+ require "google/cloud/retail/v2/completion_service_services_pb"
129
+
130
+ # Create the configuration object
131
+ @config = Configuration.new Client.configure
132
+
133
+ # Yield the configuration if needed
134
+ yield @config if block_given?
135
+
136
+ # Create credentials
137
+ credentials = @config.credentials
138
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
139
+ # but only if the default endpoint does not have a region prefix.
140
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
141
+ @config.endpoint == Client.configure.endpoint &&
142
+ !@config.endpoint.split(".").first.include?("-")
143
+ credentials ||= Credentials.default scope: @config.scope,
144
+ enable_self_signed_jwt: enable_self_signed_jwt
145
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
146
+ credentials = Credentials.new credentials, scope: @config.scope
147
+ end
148
+ @quota_project_id = @config.quota_project
149
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
150
+
151
+ @operations_client = Operations.new do |config|
152
+ config.credentials = credentials
153
+ config.endpoint = @config.endpoint
154
+ end
155
+
156
+ @completion_service_stub = ::Gapic::ServiceStub.new(
157
+ ::Google::Cloud::Retail::V2::CompletionService::Stub,
158
+ credentials: credentials,
159
+ endpoint: @config.endpoint,
160
+ channel_args: @config.channel_args,
161
+ interceptors: @config.interceptors
162
+ )
163
+ end
164
+
165
+ ##
166
+ # Get the associated client for long-running operations.
167
+ #
168
+ # @return [::Google::Cloud::Retail::V2::CompletionService::Operations]
169
+ #
170
+ attr_reader :operations_client
171
+
172
+ # Service calls
173
+
174
+ ##
175
+ # Completes the specified prefix with keyword suggestions.
176
+ #
177
+ # This feature is only available for users who have Retail Search enabled.
178
+ # Contact Retail Support (retail-search-support@google.com) if you are
179
+ # interested in using Retail Search.
180
+ #
181
+ # @overload complete_query(request, options = nil)
182
+ # Pass arguments to `complete_query` via a request object, either of type
183
+ # {::Google::Cloud::Retail::V2::CompleteQueryRequest} or an equivalent Hash.
184
+ #
185
+ # @param request [::Google::Cloud::Retail::V2::CompleteQueryRequest, ::Hash]
186
+ # A request object representing the call parameters. Required. To specify no
187
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
188
+ # @param options [::Gapic::CallOptions, ::Hash]
189
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
190
+ #
191
+ # @overload complete_query(catalog: nil, query: nil, visitor_id: nil, language_codes: nil, device_type: nil, dataset: nil, max_suggestions: nil)
192
+ # Pass arguments to `complete_query` via keyword arguments. Note that at
193
+ # least one keyword argument is required. To specify no parameters, or to keep all
194
+ # the default parameter values, pass an empty Hash as a request object (see above).
195
+ #
196
+ # @param catalog [::String]
197
+ # Required. Catalog for which the completion is performed.
198
+ #
199
+ # Full resource name of catalog, such as
200
+ # `projects/*/locations/global/catalogs/default_catalog`.
201
+ # @param query [::String]
202
+ # Required. The query used to generate suggestions.
203
+ #
204
+ # The maximum number of allowed characters is 255.
205
+ # @param visitor_id [::String]
206
+ # A unique identifier for tracking visitors. For example, this could be
207
+ # implemented with an HTTP cookie, which should be able to uniquely identify
208
+ # a visitor on a single device. This unique identifier should not change if
209
+ # the visitor logs in or out of the website.
210
+ #
211
+ # The field must be a UTF-8 encoded string with a length limit of 128
212
+ # characters. Otherwise, an INVALID_ARGUMENT error is returned.
213
+ # @param language_codes [::Array<::String>]
214
+ # The list of languages of the query. This is
215
+ # the BCP-47 language code, such as "en-US" or "sr-Latn".
216
+ # For more information, see
217
+ # [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47).
218
+ #
219
+ # The maximum number of allowed characters is 255.
220
+ # Only "en-US" is currently supported.
221
+ # @param device_type [::String]
222
+ # The device type context for completion suggestions.
223
+ # It is useful to apply different suggestions on different device types, e.g.
224
+ # DESKTOP, MOBILE. If it is empty, the suggestions are across all device
225
+ # types.
226
+ #
227
+ # Supported formats:
228
+ #
229
+ # * UNKNOWN_DEVICE_TYPE
230
+ #
231
+ # * DESKTOP
232
+ #
233
+ # * MOBILE
234
+ #
235
+ # * A customized string starts with OTHER_, e.g. OTHER_IPHONE.
236
+ # @param dataset [::String]
237
+ # Determines which dataset to use for fetching completion. "user-data" will
238
+ # use the imported dataset through
239
+ # {::Google::Cloud::Retail::V2::CompletionService::Client#import_completion_data CompletionService.ImportCompletionData}.
240
+ # "cloud-retail" will use the dataset generated by cloud retail based on user
241
+ # events. If leave empty, it will use the "user-data".
242
+ #
243
+ # Current supported values:
244
+ #
245
+ # * user-data
246
+ #
247
+ # * cloud-retail
248
+ # This option is not automatically enabled. Before using cloud-retail,
249
+ # contact retail-search-support@google.com first.
250
+ # @param max_suggestions [::Integer]
251
+ # Completion max suggestions.
252
+ #
253
+ # The maximum allowed max suggestions is 20. The default value is 20.
254
+ #
255
+ # @yield [response, operation] Access the result along with the RPC operation
256
+ # @yieldparam response [::Google::Cloud::Retail::V2::CompleteQueryResponse]
257
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
258
+ #
259
+ # @return [::Google::Cloud::Retail::V2::CompleteQueryResponse]
260
+ #
261
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
262
+ #
263
+ def complete_query request, options = nil
264
+ raise ::ArgumentError, "request must be provided" if request.nil?
265
+
266
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CompleteQueryRequest
267
+
268
+ # Converts hash and nil to an options object
269
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
270
+
271
+ # Customize the options with defaults
272
+ metadata = @config.rpcs.complete_query.metadata.to_h
273
+
274
+ # Set x-goog-api-client and x-goog-user-project headers
275
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
276
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
277
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION
278
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
279
+
280
+ header_params = {
281
+ "catalog" => request.catalog
282
+ }
283
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
284
+ metadata[:"x-goog-request-params"] ||= request_params_header
285
+
286
+ options.apply_defaults timeout: @config.rpcs.complete_query.timeout,
287
+ metadata: metadata,
288
+ retry_policy: @config.rpcs.complete_query.retry_policy
289
+ options.apply_defaults metadata: @config.metadata,
290
+ retry_policy: @config.retry_policy
291
+
292
+ @completion_service_stub.call_rpc :complete_query, request, options: options do |response, operation|
293
+ yield response, operation if block_given?
294
+ return response
295
+ end
296
+ rescue ::GRPC::BadStatus => e
297
+ raise ::Google::Cloud::Error.from_error(e)
298
+ end
299
+
300
+ ##
301
+ # Bulk import of processed completion dataset.
302
+ #
303
+ # Request processing may be synchronous. Partial updating is not supported.
304
+ #
305
+ # This feature is only available for users who have Retail Search enabled.
306
+ # Contact Retail Support (retail-search-support@google.com) if you are
307
+ # interested in using Retail Search.
308
+ #
309
+ # @overload import_completion_data(request, options = nil)
310
+ # Pass arguments to `import_completion_data` via a request object, either of type
311
+ # {::Google::Cloud::Retail::V2::ImportCompletionDataRequest} or an equivalent Hash.
312
+ #
313
+ # @param request [::Google::Cloud::Retail::V2::ImportCompletionDataRequest, ::Hash]
314
+ # A request object representing the call parameters. Required. To specify no
315
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
316
+ # @param options [::Gapic::CallOptions, ::Hash]
317
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
318
+ #
319
+ # @overload import_completion_data(parent: nil, input_config: nil, notification_pubsub_topic: nil)
320
+ # Pass arguments to `import_completion_data` via keyword arguments. Note that at
321
+ # least one keyword argument is required. To specify no parameters, or to keep all
322
+ # the default parameter values, pass an empty Hash as a request object (see above).
323
+ #
324
+ # @param parent [::String]
325
+ # Required. The catalog which the suggestions dataset belongs to.
326
+ #
327
+ # Format: `projects/1234/locations/global/catalogs/default_catalog`.
328
+ # @param input_config [::Google::Cloud::Retail::V2::CompletionDataInputConfig, ::Hash]
329
+ # Required. The desired input location of the data.
330
+ # @param notification_pubsub_topic [::String]
331
+ # Pub/Sub topic for receiving notification. If this field is set,
332
+ # when the import is finished, a notification will be sent to
333
+ # specified Pub/Sub topic. The message data will be JSON string of a
334
+ # {::Google::Longrunning::Operation Operation}.
335
+ # Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
336
+ #
337
+ # @yield [response, operation] Access the result along with the RPC operation
338
+ # @yieldparam response [::Gapic::Operation]
339
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
340
+ #
341
+ # @return [::Gapic::Operation]
342
+ #
343
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
344
+ #
345
+ def import_completion_data request, options = nil
346
+ raise ::ArgumentError, "request must be provided" if request.nil?
347
+
348
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ImportCompletionDataRequest
349
+
350
+ # Converts hash and nil to an options object
351
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
352
+
353
+ # Customize the options with defaults
354
+ metadata = @config.rpcs.import_completion_data.metadata.to_h
355
+
356
+ # Set x-goog-api-client and x-goog-user-project headers
357
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
358
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
359
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION
360
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
361
+
362
+ header_params = {
363
+ "parent" => request.parent
364
+ }
365
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
366
+ metadata[:"x-goog-request-params"] ||= request_params_header
367
+
368
+ options.apply_defaults timeout: @config.rpcs.import_completion_data.timeout,
369
+ metadata: metadata,
370
+ retry_policy: @config.rpcs.import_completion_data.retry_policy
371
+ options.apply_defaults metadata: @config.metadata,
372
+ retry_policy: @config.retry_policy
373
+
374
+ @completion_service_stub.call_rpc :import_completion_data, request, options: options do |response, operation|
375
+ response = ::Gapic::Operation.new response, @operations_client, options: options
376
+ yield response, operation if block_given?
377
+ return response
378
+ end
379
+ rescue ::GRPC::BadStatus => e
380
+ raise ::Google::Cloud::Error.from_error(e)
381
+ end
382
+
383
+ ##
384
+ # Configuration class for the CompletionService API.
385
+ #
386
+ # This class represents the configuration for CompletionService,
387
+ # providing control over timeouts, retry behavior, logging, transport
388
+ # parameters, and other low-level controls. Certain parameters can also be
389
+ # applied individually to specific RPCs. See
390
+ # {::Google::Cloud::Retail::V2::CompletionService::Client::Configuration::Rpcs}
391
+ # for a list of RPCs that can be configured independently.
392
+ #
393
+ # Configuration can be applied globally to all clients, or to a single client
394
+ # on construction.
395
+ #
396
+ # # Examples
397
+ #
398
+ # To modify the global config, setting the timeout for complete_query
399
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
400
+ #
401
+ # ::Google::Cloud::Retail::V2::CompletionService::Client.configure do |config|
402
+ # config.timeout = 10.0
403
+ # config.rpcs.complete_query.timeout = 20.0
404
+ # end
405
+ #
406
+ # To apply the above configuration only to a new client:
407
+ #
408
+ # client = ::Google::Cloud::Retail::V2::CompletionService::Client.new do |config|
409
+ # config.timeout = 10.0
410
+ # config.rpcs.complete_query.timeout = 20.0
411
+ # end
412
+ #
413
+ # @!attribute [rw] endpoint
414
+ # The hostname or hostname:port of the service endpoint.
415
+ # Defaults to `"retail.googleapis.com"`.
416
+ # @return [::String]
417
+ # @!attribute [rw] credentials
418
+ # Credentials to send with calls. You may provide any of the following types:
419
+ # * (`String`) The path to a service account key file in JSON format
420
+ # * (`Hash`) A service account key as a Hash
421
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
422
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
423
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
424
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
425
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
426
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
427
+ # * (`nil`) indicating no credentials
428
+ # @return [::Object]
429
+ # @!attribute [rw] scope
430
+ # The OAuth scopes
431
+ # @return [::Array<::String>]
432
+ # @!attribute [rw] lib_name
433
+ # The library name as recorded in instrumentation and logging
434
+ # @return [::String]
435
+ # @!attribute [rw] lib_version
436
+ # The library version as recorded in instrumentation and logging
437
+ # @return [::String]
438
+ # @!attribute [rw] channel_args
439
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
440
+ # `GRPC::Core::Channel` object is provided as the credential.
441
+ # @return [::Hash]
442
+ # @!attribute [rw] interceptors
443
+ # An array of interceptors that are run before calls are executed.
444
+ # @return [::Array<::GRPC::ClientInterceptor>]
445
+ # @!attribute [rw] timeout
446
+ # The call timeout in seconds.
447
+ # @return [::Numeric]
448
+ # @!attribute [rw] metadata
449
+ # Additional gRPC headers to be sent with the call.
450
+ # @return [::Hash{::Symbol=>::String}]
451
+ # @!attribute [rw] retry_policy
452
+ # The retry policy. The value is a hash with the following keys:
453
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
454
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
455
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
456
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
457
+ # trigger a retry.
458
+ # @return [::Hash]
459
+ # @!attribute [rw] quota_project
460
+ # A separate project against which to charge quota.
461
+ # @return [::String]
462
+ #
463
+ class Configuration
464
+ extend ::Gapic::Config
465
+
466
+ config_attr :endpoint, "retail.googleapis.com", ::String
467
+ config_attr :credentials, nil do |value|
468
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
469
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
470
+ allowed.any? { |klass| klass === value }
471
+ end
472
+ config_attr :scope, nil, ::String, ::Array, nil
473
+ config_attr :lib_name, nil, ::String, nil
474
+ config_attr :lib_version, nil, ::String, nil
475
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
476
+ config_attr :interceptors, nil, ::Array, nil
477
+ config_attr :timeout, nil, ::Numeric, nil
478
+ config_attr :metadata, nil, ::Hash, nil
479
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
480
+ config_attr :quota_project, nil, ::String, nil
481
+
482
+ # @private
483
+ def initialize parent_config = nil
484
+ @parent_config = parent_config unless parent_config.nil?
485
+
486
+ yield self if block_given?
487
+ end
488
+
489
+ ##
490
+ # Configurations for individual RPCs
491
+ # @return [Rpcs]
492
+ #
493
+ def rpcs
494
+ @rpcs ||= begin
495
+ parent_rpcs = nil
496
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
497
+ Rpcs.new parent_rpcs
498
+ end
499
+ end
500
+
501
+ ##
502
+ # Configuration RPC class for the CompletionService API.
503
+ #
504
+ # Includes fields providing the configuration for each RPC in this service.
505
+ # Each configuration object is of type `Gapic::Config::Method` and includes
506
+ # the following configuration fields:
507
+ #
508
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
509
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
510
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
511
+ # include the following keys:
512
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
513
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
514
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
515
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
516
+ # trigger a retry.
517
+ #
518
+ class Rpcs
519
+ ##
520
+ # RPC-specific configuration for `complete_query`
521
+ # @return [::Gapic::Config::Method]
522
+ #
523
+ attr_reader :complete_query
524
+ ##
525
+ # RPC-specific configuration for `import_completion_data`
526
+ # @return [::Gapic::Config::Method]
527
+ #
528
+ attr_reader :import_completion_data
529
+
530
+ # @private
531
+ def initialize parent_rpcs = nil
532
+ complete_query_config = parent_rpcs.complete_query if parent_rpcs.respond_to? :complete_query
533
+ @complete_query = ::Gapic::Config::Method.new complete_query_config
534
+ import_completion_data_config = parent_rpcs.import_completion_data if parent_rpcs.respond_to? :import_completion_data
535
+ @import_completion_data = ::Gapic::Config::Method.new import_completion_data_config
536
+
537
+ yield self if block_given?
538
+ end
539
+ end
540
+ end
541
+ end
542
+ end
543
+ end
544
+ end
545
+ end
546
+ end