google-cloud-discovery_engine-v1beta 0.a → 0.2.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 (101) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +149 -0
  4. data/README.md +144 -8
  5. data/lib/google/cloud/discovery_engine/v1beta/completion_service/client.rb +429 -0
  6. data/lib/google/cloud/discovery_engine/v1beta/completion_service/credentials.rb +47 -0
  7. data/lib/google/cloud/discovery_engine/v1beta/completion_service/paths.rb +78 -0
  8. data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/client.rb +386 -0
  9. data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/service_stub.rb +114 -0
  10. data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest.rb +52 -0
  11. data/lib/google/cloud/discovery_engine/v1beta/completion_service.rb +55 -0
  12. data/lib/google/cloud/discovery_engine/v1beta/document_service/client.rb +1159 -0
  13. data/lib/google/cloud/discovery_engine/v1beta/document_service/credentials.rb +47 -0
  14. data/lib/google/cloud/discovery_engine/v1beta/document_service/operations.rb +768 -0
  15. data/lib/google/cloud/discovery_engine/v1beta/document_service/paths.rb +135 -0
  16. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb +960 -0
  17. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/operations.rb +919 -0
  18. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/service_stub.rb +518 -0
  19. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest.rb +55 -0
  20. data/lib/google/cloud/discovery_engine/v1beta/document_service.rb +58 -0
  21. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/client.rb +486 -0
  22. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/credentials.rb +47 -0
  23. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/paths.rb +135 -0
  24. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest/client.rb +443 -0
  25. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest/service_stub.rb +116 -0
  26. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest.rb +52 -0
  27. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service.rb +55 -0
  28. data/lib/google/cloud/discovery_engine/v1beta/rest.rb +42 -0
  29. data/lib/google/cloud/discovery_engine/v1beta/schema_service/client.rb +840 -0
  30. data/lib/google/cloud/discovery_engine/v1beta/schema_service/credentials.rb +47 -0
  31. data/lib/google/cloud/discovery_engine/v1beta/schema_service/operations.rb +768 -0
  32. data/lib/google/cloud/discovery_engine/v1beta/schema_service/paths.rb +127 -0
  33. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/client.rb +680 -0
  34. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/operations.rb +919 -0
  35. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/service_stub.rb +382 -0
  36. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest.rb +53 -0
  37. data/lib/google/cloud/discovery_engine/v1beta/schema_service.rb +56 -0
  38. data/lib/google/cloud/discovery_engine/v1beta/search_service/client.rb +511 -0
  39. data/lib/google/cloud/discovery_engine/v1beta/search_service/credentials.rb +47 -0
  40. data/lib/google/cloud/discovery_engine/v1beta/search_service/paths.rb +131 -0
  41. data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/client.rb +463 -0
  42. data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/service_stub.rb +116 -0
  43. data/lib/google/cloud/discovery_engine/v1beta/search_service/rest.rb +52 -0
  44. data/lib/google/cloud/discovery_engine/v1beta/search_service.rb +55 -0
  45. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/client.rb +638 -0
  46. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/credentials.rb +47 -0
  47. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/operations.rb +768 -0
  48. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/paths.rb +131 -0
  49. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/client.rb +542 -0
  50. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/operations.rb +919 -0
  51. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/service_stub.rb +250 -0
  52. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest.rb +53 -0
  53. data/lib/google/cloud/discovery_engine/v1beta/user_event_service.rb +56 -0
  54. data/lib/google/cloud/discovery_engine/v1beta/version.rb +7 -2
  55. data/lib/google/cloud/discovery_engine/v1beta.rb +50 -0
  56. data/lib/google/cloud/discoveryengine/v1beta/common_pb.rb +46 -0
  57. data/lib/google/cloud/discoveryengine/v1beta/completion_service_pb.rb +49 -0
  58. data/lib/google/cloud/discoveryengine/v1beta/completion_service_services_pb.rb +45 -0
  59. data/lib/google/cloud/discoveryengine/v1beta/document_pb.rb +48 -0
  60. data/lib/google/cloud/discoveryengine/v1beta/document_service_pb.rb +58 -0
  61. data/lib/google/cloud/discoveryengine/v1beta/document_service_services_pb.rb +81 -0
  62. data/lib/google/cloud/discoveryengine/v1beta/import_config_pb.rb +66 -0
  63. data/lib/google/cloud/discoveryengine/v1beta/purge_config_pb.rb +49 -0
  64. data/lib/google/cloud/discoveryengine/v1beta/recommendation_service_pb.rb +55 -0
  65. data/lib/google/cloud/discoveryengine/v1beta/recommendation_service_services_pb.rb +45 -0
  66. data/lib/google/cloud/discoveryengine/v1beta/schema_pb.rb +47 -0
  67. data/lib/google/cloud/discoveryengine/v1beta/schema_service_pb.rb +61 -0
  68. data/lib/google/cloud/discoveryengine/v1beta/schema_service_services_pb.rb +53 -0
  69. data/lib/google/cloud/discoveryengine/v1beta/search_service_pb.rb +71 -0
  70. data/lib/google/cloud/discoveryengine/v1beta/search_service_services_pb.rb +45 -0
  71. data/lib/google/cloud/discoveryengine/v1beta/user_event_pb.rb +58 -0
  72. data/lib/google/cloud/discoveryengine/v1beta/user_event_service_pb.rb +53 -0
  73. data/lib/google/cloud/discoveryengine/v1beta/user_event_service_services_pb.rb +59 -0
  74. data/lib/google-cloud-discovery_engine-v1beta.rb +21 -0
  75. data/proto_docs/README.md +4 -0
  76. data/proto_docs/google/api/client.rb +381 -0
  77. data/proto_docs/google/api/field_behavior.rb +71 -0
  78. data/proto_docs/google/api/httpbody.rb +80 -0
  79. data/proto_docs/google/api/launch_stage.rb +71 -0
  80. data/proto_docs/google/api/resource.rb +222 -0
  81. data/proto_docs/google/cloud/discoveryengine/v1beta/common.rb +107 -0
  82. data/proto_docs/google/cloud/discoveryengine/v1beta/completion_service.rb +98 -0
  83. data/proto_docs/google/cloud/discoveryengine/v1beta/document.rb +107 -0
  84. data/proto_docs/google/cloud/discoveryengine/v1beta/document_service.rb +181 -0
  85. data/proto_docs/google/cloud/discoveryengine/v1beta/import_config.rb +340 -0
  86. data/proto_docs/google/cloud/discoveryengine/v1beta/purge_config.rb +84 -0
  87. data/proto_docs/google/cloud/discoveryengine/v1beta/recommendation_service.rb +210 -0
  88. data/proto_docs/google/cloud/discoveryengine/v1beta/schema.rb +45 -0
  89. data/proto_docs/google/cloud/discoveryengine/v1beta/schema_service.rb +180 -0
  90. data/proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb +603 -0
  91. data/proto_docs/google/cloud/discoveryengine/v1beta/user_event.rb +473 -0
  92. data/proto_docs/google/cloud/discoveryengine/v1beta/user_event_service.rb +64 -0
  93. data/proto_docs/google/longrunning/operations.rb +164 -0
  94. data/proto_docs/google/protobuf/any.rb +144 -0
  95. data/proto_docs/google/protobuf/duration.rb +98 -0
  96. data/proto_docs/google/protobuf/empty.rb +34 -0
  97. data/proto_docs/google/protobuf/struct.rb +96 -0
  98. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  99. data/proto_docs/google/rpc/status.rb +48 -0
  100. data/proto_docs/google/type/date.rb +53 -0
  101. metadata +254 -12
@@ -0,0 +1,429 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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/discoveryengine/v1beta/completion_service_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module DiscoveryEngine
25
+ module V1beta
26
+ module CompletionService
27
+ ##
28
+ # Client for the CompletionService service.
29
+ #
30
+ # Service for Auto-Completion.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :completion_service_stub
37
+
38
+ ##
39
+ # Configure the CompletionService Client class.
40
+ #
41
+ # See {::Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # @example
45
+ #
46
+ # # Modify the configuration for all CompletionService clients
47
+ # ::Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Client.configure do |config|
48
+ # config.timeout = 10.0
49
+ # end
50
+ #
51
+ # @yield [config] Configure the Client client.
52
+ # @yieldparam config [Client::Configuration]
53
+ #
54
+ # @return [Client::Configuration]
55
+ #
56
+ def self.configure
57
+ @configure ||= begin
58
+ namespace = ["Google", "Cloud", "DiscoveryEngine", "V1beta"]
59
+ parent_config = while namespace.any?
60
+ parent_name = namespace.join "::"
61
+ parent_const = const_get parent_name
62
+ break parent_const.configure if parent_const.respond_to? :configure
63
+ namespace.pop
64
+ end
65
+ default_config = Client::Configuration.new parent_config
66
+
67
+ default_config.timeout = 5.0
68
+ default_config.retry_policy = {
69
+ initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14]
70
+ }
71
+
72
+ default_config
73
+ end
74
+ yield @configure if block_given?
75
+ @configure
76
+ end
77
+
78
+ ##
79
+ # Configure the CompletionService Client instance.
80
+ #
81
+ # The configuration is set to the derived mode, meaning that values can be changed,
82
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
83
+ # should be made on {Client.configure}.
84
+ #
85
+ # See {::Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Client::Configuration}
86
+ # for a description of the configuration fields.
87
+ #
88
+ # @yield [config] Configure the Client client.
89
+ # @yieldparam config [Client::Configuration]
90
+ #
91
+ # @return [Client::Configuration]
92
+ #
93
+ def configure
94
+ yield @config if block_given?
95
+ @config
96
+ end
97
+
98
+ ##
99
+ # Create a new CompletionService client object.
100
+ #
101
+ # @example
102
+ #
103
+ # # Create a client using the default configuration
104
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Client.new
105
+ #
106
+ # # Create a client using a custom configuration
107
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Client.new do |config|
108
+ # config.timeout = 10.0
109
+ # end
110
+ #
111
+ # @yield [config] Configure the CompletionService client.
112
+ # @yieldparam config [Client::Configuration]
113
+ #
114
+ def initialize
115
+ # These require statements are intentionally placed here to initialize
116
+ # the gRPC module only when it's required.
117
+ # See https://github.com/googleapis/toolkit/issues/446
118
+ require "gapic/grpc"
119
+ require "google/cloud/discoveryengine/v1beta/completion_service_services_pb"
120
+
121
+ # Create the configuration object
122
+ @config = Configuration.new Client.configure
123
+
124
+ # Yield the configuration if needed
125
+ yield @config if block_given?
126
+
127
+ # Create credentials
128
+ credentials = @config.credentials
129
+ # Use self-signed JWT if the endpoint is unchanged from default,
130
+ # but only if the default endpoint does not have a region prefix.
131
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
132
+ !@config.endpoint.split(".").first.include?("-")
133
+ credentials ||= Credentials.default scope: @config.scope,
134
+ enable_self_signed_jwt: enable_self_signed_jwt
135
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
136
+ credentials = Credentials.new credentials, scope: @config.scope
137
+ end
138
+ @quota_project_id = @config.quota_project
139
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
140
+
141
+ @completion_service_stub = ::Gapic::ServiceStub.new(
142
+ ::Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Stub,
143
+ credentials: credentials,
144
+ endpoint: @config.endpoint,
145
+ channel_args: @config.channel_args,
146
+ interceptors: @config.interceptors
147
+ )
148
+ end
149
+
150
+ # Service calls
151
+
152
+ ##
153
+ # Completes the specified user input with keyword suggestions.
154
+ #
155
+ # @overload complete_query(request, options = nil)
156
+ # Pass arguments to `complete_query` via a request object, either of type
157
+ # {::Google::Cloud::DiscoveryEngine::V1beta::CompleteQueryRequest} or an equivalent Hash.
158
+ #
159
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::CompleteQueryRequest, ::Hash]
160
+ # A request object representing the call parameters. Required. To specify no
161
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
162
+ # @param options [::Gapic::CallOptions, ::Hash]
163
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
164
+ #
165
+ # @overload complete_query(data_store: nil, query: nil, query_model: nil, user_pseudo_id: nil)
166
+ # Pass arguments to `complete_query` via keyword arguments. Note that at
167
+ # least one keyword argument is required. To specify no parameters, or to keep all
168
+ # the default parameter values, pass an empty Hash as a request object (see above).
169
+ #
170
+ # @param data_store [::String]
171
+ # Required. The parent data store resource name for which the completion is
172
+ # performed, such as
173
+ # `projects/*/locations/global/collections/default_collection/dataStores/default_data_store`.
174
+ # @param query [::String]
175
+ # Required. The typeahead input used to fetch suggestions. Maximum length is
176
+ # 128 characters.
177
+ # @param query_model [::String]
178
+ # Selects data model of query suggestions for serving. Currently supported
179
+ # values:
180
+ #
181
+ # * `document` - Using suggestions generated from user-imported documents.
182
+ # * `search-history` - Using suggestions generated from the past history of
183
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Client#search SearchService.Search}
184
+ # API calls. Do not use it when there is no traffic for Search API.
185
+ # * `user-event` - Using suggestions generated from user-imported search
186
+ # events.
187
+ #
188
+ # Default values:
189
+ #
190
+ # * `document` is the default model for regular dataStores.
191
+ # * `search-history` is the default model for
192
+ # [IndustryVertical.SITE_SEARCH][google.cloud.discoveryengine.v1beta.IndustryVertical.SITE_SEARCH]
193
+ # dataStores.
194
+ # @param user_pseudo_id [::String]
195
+ # A unique identifier for tracking visitors. For example, this could be
196
+ # implemented with an HTTP cookie, which should be able to uniquely identify
197
+ # a visitor on a single device. This unique identifier should not change if
198
+ # the visitor logs in or out of the website.
199
+ #
200
+ # This field should NOT have a fixed value such as `unknown_visitor`.
201
+ #
202
+ # This should be the same identifier as
203
+ # {::Google::Cloud::DiscoveryEngine::V1beta::UserEvent#user_pseudo_id UserEvent.user_pseudo_id}
204
+ # and
205
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#user_pseudo_id SearchRequest.user_pseudo_id}.
206
+ #
207
+ # The field must be a UTF-8 encoded string with a length limit of 128
208
+ # characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
209
+ #
210
+ # @yield [response, operation] Access the result along with the RPC operation
211
+ # @yieldparam response [::Google::Cloud::DiscoveryEngine::V1beta::CompleteQueryResponse]
212
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
213
+ #
214
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::CompleteQueryResponse]
215
+ #
216
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
217
+ #
218
+ # @example Basic example
219
+ # require "google/cloud/discovery_engine/v1beta"
220
+ #
221
+ # # Create a client object. The client can be reused for multiple calls.
222
+ # client = Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Client.new
223
+ #
224
+ # # Create a request. To set request fields, pass in keyword arguments.
225
+ # request = Google::Cloud::DiscoveryEngine::V1beta::CompleteQueryRequest.new
226
+ #
227
+ # # Call the complete_query method.
228
+ # result = client.complete_query request
229
+ #
230
+ # # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::CompleteQueryResponse.
231
+ # p result
232
+ #
233
+ def complete_query request, options = nil
234
+ raise ::ArgumentError, "request must be provided" if request.nil?
235
+
236
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::CompleteQueryRequest
237
+
238
+ # Converts hash and nil to an options object
239
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
240
+
241
+ # Customize the options with defaults
242
+ metadata = @config.rpcs.complete_query.metadata.to_h
243
+
244
+ # Set x-goog-api-client and x-goog-user-project headers
245
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
246
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
247
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION
248
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
249
+
250
+ header_params = {}
251
+ if request.data_store
252
+ header_params["data_store"] = request.data_store
253
+ end
254
+
255
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
256
+ metadata[:"x-goog-request-params"] ||= request_params_header
257
+
258
+ options.apply_defaults timeout: @config.rpcs.complete_query.timeout,
259
+ metadata: metadata,
260
+ retry_policy: @config.rpcs.complete_query.retry_policy
261
+
262
+ options.apply_defaults timeout: @config.timeout,
263
+ metadata: @config.metadata,
264
+ retry_policy: @config.retry_policy
265
+
266
+ @completion_service_stub.call_rpc :complete_query, request, options: options do |response, operation|
267
+ yield response, operation if block_given?
268
+ return response
269
+ end
270
+ rescue ::GRPC::BadStatus => e
271
+ raise ::Google::Cloud::Error.from_error(e)
272
+ end
273
+
274
+ ##
275
+ # Configuration class for the CompletionService API.
276
+ #
277
+ # This class represents the configuration for CompletionService,
278
+ # providing control over timeouts, retry behavior, logging, transport
279
+ # parameters, and other low-level controls. Certain parameters can also be
280
+ # applied individually to specific RPCs. See
281
+ # {::Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Client::Configuration::Rpcs}
282
+ # for a list of RPCs that can be configured independently.
283
+ #
284
+ # Configuration can be applied globally to all clients, or to a single client
285
+ # on construction.
286
+ #
287
+ # @example
288
+ #
289
+ # # Modify the global config, setting the timeout for
290
+ # # complete_query to 20 seconds,
291
+ # # and all remaining timeouts to 10 seconds.
292
+ # ::Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Client.configure do |config|
293
+ # config.timeout = 10.0
294
+ # config.rpcs.complete_query.timeout = 20.0
295
+ # end
296
+ #
297
+ # # Apply the above configuration only to a new client.
298
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Client.new do |config|
299
+ # config.timeout = 10.0
300
+ # config.rpcs.complete_query.timeout = 20.0
301
+ # end
302
+ #
303
+ # @!attribute [rw] endpoint
304
+ # The hostname or hostname:port of the service endpoint.
305
+ # Defaults to `"discoveryengine.googleapis.com"`.
306
+ # @return [::String]
307
+ # @!attribute [rw] credentials
308
+ # Credentials to send with calls. You may provide any of the following types:
309
+ # * (`String`) The path to a service account key file in JSON format
310
+ # * (`Hash`) A service account key as a Hash
311
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
312
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
313
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
314
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
315
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
316
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
317
+ # * (`nil`) indicating no credentials
318
+ # @return [::Object]
319
+ # @!attribute [rw] scope
320
+ # The OAuth scopes
321
+ # @return [::Array<::String>]
322
+ # @!attribute [rw] lib_name
323
+ # The library name as recorded in instrumentation and logging
324
+ # @return [::String]
325
+ # @!attribute [rw] lib_version
326
+ # The library version as recorded in instrumentation and logging
327
+ # @return [::String]
328
+ # @!attribute [rw] channel_args
329
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
330
+ # `GRPC::Core::Channel` object is provided as the credential.
331
+ # @return [::Hash]
332
+ # @!attribute [rw] interceptors
333
+ # An array of interceptors that are run before calls are executed.
334
+ # @return [::Array<::GRPC::ClientInterceptor>]
335
+ # @!attribute [rw] timeout
336
+ # The call timeout in seconds.
337
+ # @return [::Numeric]
338
+ # @!attribute [rw] metadata
339
+ # Additional gRPC headers to be sent with the call.
340
+ # @return [::Hash{::Symbol=>::String}]
341
+ # @!attribute [rw] retry_policy
342
+ # The retry policy. The value is a hash with the following keys:
343
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
344
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
345
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
346
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
347
+ # trigger a retry.
348
+ # @return [::Hash]
349
+ # @!attribute [rw] quota_project
350
+ # A separate project against which to charge quota.
351
+ # @return [::String]
352
+ #
353
+ class Configuration
354
+ extend ::Gapic::Config
355
+
356
+ config_attr :endpoint, "discoveryengine.googleapis.com", ::String
357
+ config_attr :credentials, nil do |value|
358
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
359
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
360
+ allowed.any? { |klass| klass === value }
361
+ end
362
+ config_attr :scope, nil, ::String, ::Array, nil
363
+ config_attr :lib_name, nil, ::String, nil
364
+ config_attr :lib_version, nil, ::String, nil
365
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
366
+ config_attr :interceptors, nil, ::Array, nil
367
+ config_attr :timeout, nil, ::Numeric, nil
368
+ config_attr :metadata, nil, ::Hash, nil
369
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
370
+ config_attr :quota_project, nil, ::String, nil
371
+
372
+ # @private
373
+ def initialize parent_config = nil
374
+ @parent_config = parent_config unless parent_config.nil?
375
+
376
+ yield self if block_given?
377
+ end
378
+
379
+ ##
380
+ # Configurations for individual RPCs
381
+ # @return [Rpcs]
382
+ #
383
+ def rpcs
384
+ @rpcs ||= begin
385
+ parent_rpcs = nil
386
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
387
+ Rpcs.new parent_rpcs
388
+ end
389
+ end
390
+
391
+ ##
392
+ # Configuration RPC class for the CompletionService API.
393
+ #
394
+ # Includes fields providing the configuration for each RPC in this service.
395
+ # Each configuration object is of type `Gapic::Config::Method` and includes
396
+ # the following configuration fields:
397
+ #
398
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
399
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
400
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
401
+ # include the following keys:
402
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
403
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
404
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
405
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
406
+ # trigger a retry.
407
+ #
408
+ class Rpcs
409
+ ##
410
+ # RPC-specific configuration for `complete_query`
411
+ # @return [::Gapic::Config::Method]
412
+ #
413
+ attr_reader :complete_query
414
+
415
+ # @private
416
+ def initialize parent_rpcs = nil
417
+ complete_query_config = parent_rpcs.complete_query if parent_rpcs.respond_to? :complete_query
418
+ @complete_query = ::Gapic::Config::Method.new complete_query_config
419
+
420
+ yield self if block_given?
421
+ end
422
+ end
423
+ end
424
+ end
425
+ end
426
+ end
427
+ end
428
+ end
429
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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 "googleauth"
20
+
21
+ module Google
22
+ module Cloud
23
+ module DiscoveryEngine
24
+ module V1beta
25
+ module CompletionService
26
+ # Credentials for the CompletionService API.
27
+ class Credentials < ::Google::Auth::Credentials
28
+ self.scope = [
29
+ "https://www.googleapis.com/auth/cloud-platform"
30
+ ]
31
+ self.env_vars = [
32
+ "GOOGLE_CLOUD_CREDENTIALS",
33
+ "GOOGLE_CLOUD_KEYFILE",
34
+ "GCLOUD_KEYFILE",
35
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
36
+ "GOOGLE_CLOUD_KEYFILE_JSON",
37
+ "GCLOUD_KEYFILE_JSON"
38
+ ]
39
+ self.paths = [
40
+ "~/.config/google_cloud/application_default_credentials.json"
41
+ ]
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,78 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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
+
20
+ module Google
21
+ module Cloud
22
+ module DiscoveryEngine
23
+ module V1beta
24
+ module CompletionService
25
+ # Path helper methods for the CompletionService API.
26
+ module Paths
27
+ ##
28
+ # Create a fully-qualified DataStore resource string.
29
+ #
30
+ # @overload data_store_path(project:, location:, data_store:)
31
+ # The resource will be in the following format:
32
+ #
33
+ # `projects/{project}/locations/{location}/dataStores/{data_store}`
34
+ #
35
+ # @param project [String]
36
+ # @param location [String]
37
+ # @param data_store [String]
38
+ #
39
+ # @overload data_store_path(project:, location:, collection:, data_store:)
40
+ # The resource will be in the following format:
41
+ #
42
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`
43
+ #
44
+ # @param project [String]
45
+ # @param location [String]
46
+ # @param collection [String]
47
+ # @param data_store [String]
48
+ #
49
+ # @return [::String]
50
+ def data_store_path **args
51
+ resources = {
52
+ "data_store:location:project" => (proc do |project:, location:, data_store:|
53
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
54
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
55
+
56
+ "projects/#{project}/locations/#{location}/dataStores/#{data_store}"
57
+ end),
58
+ "collection:data_store:location:project" => (proc do |project:, location:, collection:, data_store:|
59
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
60
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
61
+ raise ::ArgumentError, "collection cannot contain /" if collection.to_s.include? "/"
62
+
63
+ "projects/#{project}/locations/#{location}/collections/#{collection}/dataStores/#{data_store}"
64
+ end)
65
+ }
66
+
67
+ resource = resources[args.keys.sort.join(":")]
68
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
69
+ resource.call(**args)
70
+ end
71
+
72
+ extend self
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end