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