google-cloud-discovery_engine-v1beta 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/discovery_engine/v1beta/completion_service/client.rb +7 -3
  3. data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/client.rb +7 -3
  4. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/client.rb +925 -0
  5. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/credentials.rb +47 -0
  6. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/paths.rb +176 -0
  7. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest/client.rb +763 -0
  8. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest/service_stub.rb +450 -0
  9. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest.rb +52 -0
  10. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service.rb +55 -0
  11. data/lib/google/cloud/discovery_engine/v1beta/document_service/client.rb +5 -4
  12. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb +5 -4
  13. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/operations.rb +42 -0
  14. data/lib/google/cloud/discovery_engine/v1beta/rest.rb +2 -1
  15. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/operations.rb +42 -0
  16. data/lib/google/cloud/discovery_engine/v1beta/search_service/client.rb +14 -12
  17. data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/client.rb +14 -12
  18. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/client.rb +2 -2
  19. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/client.rb +2 -2
  20. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/operations.rb +42 -0
  21. data/lib/google/cloud/discovery_engine/v1beta/version.rb +1 -1
  22. data/lib/google/cloud/discovery_engine/v1beta.rb +2 -1
  23. data/lib/google/cloud/discoveryengine/v1beta/completion_service_pb.rb +1 -1
  24. data/lib/google/cloud/discoveryengine/v1beta/conversation_pb.rb +53 -0
  25. data/lib/google/cloud/discoveryengine/v1beta/conversational_search_service_pb.rb +61 -0
  26. data/lib/google/cloud/discoveryengine/v1beta/conversational_search_service_services_pb.rb +67 -0
  27. data/lib/google/cloud/discoveryengine/v1beta/search_service_pb.rb +3 -1
  28. data/lib/google/cloud/discoveryengine/v1beta/user_event_pb.rb +1 -1
  29. data/lib/google/cloud/discoveryengine/v1beta/user_event_service_services_pb.rb +1 -1
  30. data/proto_docs/google/cloud/discoveryengine/v1beta/common.rb +1 -2
  31. data/proto_docs/google/cloud/discoveryengine/v1beta/completion_service.rb +13 -2
  32. data/proto_docs/google/cloud/discoveryengine/v1beta/conversation.rb +134 -0
  33. data/proto_docs/google/cloud/discoveryengine/v1beta/conversational_search_service.rb +175 -0
  34. data/proto_docs/google/cloud/discoveryengine/v1beta/document.rb +2 -4
  35. data/proto_docs/google/cloud/discoveryengine/v1beta/document_service.rb +2 -1
  36. data/proto_docs/google/cloud/discoveryengine/v1beta/import_config.rb +17 -17
  37. data/proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb +161 -60
  38. data/proto_docs/google/cloud/discoveryengine/v1beta/user_event.rb +37 -29
  39. data/proto_docs/google/cloud/discoveryengine/v1beta/user_event_service.rb +1 -1
  40. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  41. metadata +15 -2
@@ -0,0 +1,763 @@
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/conversational_search_service_pb"
21
+ require "google/cloud/discovery_engine/v1beta/conversational_search_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module DiscoveryEngine
26
+ module V1beta
27
+ module ConversationalSearchService
28
+ module Rest
29
+ ##
30
+ # REST client for the ConversationalSearchService service.
31
+ #
32
+ # Service for conversational search.
33
+ #
34
+ class Client
35
+ include Paths
36
+
37
+ # @private
38
+ attr_reader :conversational_search_service_stub
39
+
40
+ ##
41
+ # Configure the ConversationalSearchService Client class.
42
+ #
43
+ # See {::Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Rest::Client::Configuration}
44
+ # for a description of the configuration fields.
45
+ #
46
+ # @example
47
+ #
48
+ # # Modify the configuration for all ConversationalSearchService clients
49
+ # ::Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Rest::Client.configure do |config|
50
+ # config.timeout = 10.0
51
+ # end
52
+ #
53
+ # @yield [config] Configure the Client client.
54
+ # @yieldparam config [Client::Configuration]
55
+ #
56
+ # @return [Client::Configuration]
57
+ #
58
+ def self.configure
59
+ @configure ||= begin
60
+ namespace = ["Google", "Cloud", "DiscoveryEngine", "V1beta"]
61
+ parent_config = while namespace.any?
62
+ parent_name = namespace.join "::"
63
+ parent_const = const_get parent_name
64
+ break parent_const.configure if parent_const.respond_to? :configure
65
+ namespace.pop
66
+ end
67
+ default_config = Client::Configuration.new parent_config
68
+
69
+ default_config.timeout = 30.0
70
+ default_config.retry_policy = {
71
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
72
+ }
73
+
74
+ default_config
75
+ end
76
+ yield @configure if block_given?
77
+ @configure
78
+ end
79
+
80
+ ##
81
+ # Configure the ConversationalSearchService Client instance.
82
+ #
83
+ # The configuration is set to the derived mode, meaning that values can be changed,
84
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
85
+ # should be made on {Client.configure}.
86
+ #
87
+ # See {::Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Rest::Client::Configuration}
88
+ # for a description of the configuration fields.
89
+ #
90
+ # @yield [config] Configure the Client client.
91
+ # @yieldparam config [Client::Configuration]
92
+ #
93
+ # @return [Client::Configuration]
94
+ #
95
+ def configure
96
+ yield @config if block_given?
97
+ @config
98
+ end
99
+
100
+ ##
101
+ # Create a new ConversationalSearchService REST client object.
102
+ #
103
+ # @example
104
+ #
105
+ # # Create a client using the default configuration
106
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Rest::Client.new
107
+ #
108
+ # # Create a client using a custom configuration
109
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Rest::Client.new do |config|
110
+ # config.timeout = 10.0
111
+ # end
112
+ #
113
+ # @yield [config] Configure the ConversationalSearchService client.
114
+ # @yieldparam config [Client::Configuration]
115
+ #
116
+ def initialize
117
+ # Create the configuration object
118
+ @config = Configuration.new Client.configure
119
+
120
+ # Yield the configuration if needed
121
+ yield @config if block_given?
122
+
123
+ # Create credentials
124
+ credentials = @config.credentials
125
+ # Use self-signed JWT if the endpoint is unchanged from default,
126
+ # but only if the default endpoint does not have a region prefix.
127
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
128
+ !@config.endpoint.split(".").first.include?("-")
129
+ credentials ||= Credentials.default scope: @config.scope,
130
+ enable_self_signed_jwt: enable_self_signed_jwt
131
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
132
+ credentials = Credentials.new credentials, scope: @config.scope
133
+ end
134
+
135
+ @quota_project_id = @config.quota_project
136
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
137
+
138
+ @conversational_search_service_stub = ::Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
139
+ end
140
+
141
+ # Service calls
142
+
143
+ ##
144
+ # Converses a conversation.
145
+ #
146
+ # @overload converse_conversation(request, options = nil)
147
+ # Pass arguments to `converse_conversation` via a request object, either of type
148
+ # {::Google::Cloud::DiscoveryEngine::V1beta::ConverseConversationRequest} or an equivalent Hash.
149
+ #
150
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::ConverseConversationRequest, ::Hash]
151
+ # A request object representing the call parameters. Required. To specify no
152
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
153
+ # @param options [::Gapic::CallOptions, ::Hash]
154
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
155
+ #
156
+ # @overload converse_conversation(name: nil, query: nil, serving_config: nil, conversation: nil, safe_search: nil)
157
+ # Pass arguments to `converse_conversation` via keyword arguments. Note that at
158
+ # least one keyword argument is required. To specify no parameters, or to keep all
159
+ # the default parameter values, pass an empty Hash as a request object (see above).
160
+ #
161
+ # @param name [::String]
162
+ # Required. The resource name of the Conversation to get. Format:
163
+ # `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/{conversation_id}`.
164
+ # Use
165
+ # `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/-`
166
+ # to activate auto session mode, which automatically creates a new
167
+ # conversation inside a ConverseConversation session.
168
+ # @param query [::Google::Cloud::DiscoveryEngine::V1beta::TextInput, ::Hash]
169
+ # Required. Current user input.
170
+ # @param serving_config [::String]
171
+ # The resource name of the Serving Config to use. Format:
172
+ # `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/servingConfigs/{serving_config_id}`
173
+ # If this is not set, the default serving config will be used.
174
+ # @param conversation [::Google::Cloud::DiscoveryEngine::V1beta::Conversation, ::Hash]
175
+ # The conversation to be used by auto session only. The name field will be
176
+ # ignored as we automatically assign new name for the conversation in auto
177
+ # session.
178
+ # @param safe_search [::Boolean]
179
+ # Whether to turn on safe search.
180
+ # @yield [result, operation] Access the result along with the TransportOperation object
181
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::ConverseConversationResponse]
182
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
183
+ #
184
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::ConverseConversationResponse]
185
+ #
186
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
187
+ def converse_conversation request, options = nil
188
+ raise ::ArgumentError, "request must be provided" if request.nil?
189
+
190
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::ConverseConversationRequest
191
+
192
+ # Converts hash and nil to an options object
193
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
194
+
195
+ # Customize the options with defaults
196
+ call_metadata = @config.rpcs.converse_conversation.metadata.to_h
197
+
198
+ # Set x-goog-api-client and x-goog-user-project headers
199
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
200
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
201
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
202
+ transports_version_send: [:rest]
203
+
204
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
205
+
206
+ options.apply_defaults timeout: @config.rpcs.converse_conversation.timeout,
207
+ metadata: call_metadata,
208
+ retry_policy: @config.rpcs.converse_conversation.retry_policy
209
+
210
+ options.apply_defaults timeout: @config.timeout,
211
+ metadata: @config.metadata,
212
+ retry_policy: @config.retry_policy
213
+
214
+ @conversational_search_service_stub.converse_conversation request, options do |result, operation|
215
+ yield result, operation if block_given?
216
+ return result
217
+ end
218
+ rescue ::Gapic::Rest::Error => e
219
+ raise ::Google::Cloud::Error.from_error(e)
220
+ end
221
+
222
+ ##
223
+ # Creates a Conversation.
224
+ #
225
+ # If the {::Google::Cloud::DiscoveryEngine::V1beta::Conversation Conversation} to
226
+ # create already exists, an ALREADY_EXISTS error is returned.
227
+ #
228
+ # @overload create_conversation(request, options = nil)
229
+ # Pass arguments to `create_conversation` via a request object, either of type
230
+ # {::Google::Cloud::DiscoveryEngine::V1beta::CreateConversationRequest} or an equivalent Hash.
231
+ #
232
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::CreateConversationRequest, ::Hash]
233
+ # A request object representing the call parameters. Required. To specify no
234
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
235
+ # @param options [::Gapic::CallOptions, ::Hash]
236
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
237
+ #
238
+ # @overload create_conversation(parent: nil, conversation: nil)
239
+ # Pass arguments to `create_conversation` via keyword arguments. Note that at
240
+ # least one keyword argument is required. To specify no parameters, or to keep all
241
+ # the default parameter values, pass an empty Hash as a request object (see above).
242
+ #
243
+ # @param parent [::String]
244
+ # Required. Full resource name of parent data store. Format:
245
+ # `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}`
246
+ # @param conversation [::Google::Cloud::DiscoveryEngine::V1beta::Conversation, ::Hash]
247
+ # Required. The conversation to create.
248
+ # @yield [result, operation] Access the result along with the TransportOperation object
249
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::Conversation]
250
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
251
+ #
252
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::Conversation]
253
+ #
254
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
255
+ def create_conversation request, options = nil
256
+ raise ::ArgumentError, "request must be provided" if request.nil?
257
+
258
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::CreateConversationRequest
259
+
260
+ # Converts hash and nil to an options object
261
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
262
+
263
+ # Customize the options with defaults
264
+ call_metadata = @config.rpcs.create_conversation.metadata.to_h
265
+
266
+ # Set x-goog-api-client and x-goog-user-project headers
267
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
268
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
269
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
270
+ transports_version_send: [:rest]
271
+
272
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
273
+
274
+ options.apply_defaults timeout: @config.rpcs.create_conversation.timeout,
275
+ metadata: call_metadata,
276
+ retry_policy: @config.rpcs.create_conversation.retry_policy
277
+
278
+ options.apply_defaults timeout: @config.timeout,
279
+ metadata: @config.metadata,
280
+ retry_policy: @config.retry_policy
281
+
282
+ @conversational_search_service_stub.create_conversation request, options do |result, operation|
283
+ yield result, operation if block_given?
284
+ return result
285
+ end
286
+ rescue ::Gapic::Rest::Error => e
287
+ raise ::Google::Cloud::Error.from_error(e)
288
+ end
289
+
290
+ ##
291
+ # Deletes a Conversation.
292
+ #
293
+ # If the {::Google::Cloud::DiscoveryEngine::V1beta::Conversation Conversation} to
294
+ # delete does not exist, a NOT_FOUND error is returned.
295
+ #
296
+ # @overload delete_conversation(request, options = nil)
297
+ # Pass arguments to `delete_conversation` via a request object, either of type
298
+ # {::Google::Cloud::DiscoveryEngine::V1beta::DeleteConversationRequest} or an equivalent Hash.
299
+ #
300
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::DeleteConversationRequest, ::Hash]
301
+ # A request object representing the call parameters. Required. To specify no
302
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
303
+ # @param options [::Gapic::CallOptions, ::Hash]
304
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
305
+ #
306
+ # @overload delete_conversation(name: nil)
307
+ # Pass arguments to `delete_conversation` via keyword arguments. Note that at
308
+ # least one keyword argument is required. To specify no parameters, or to keep all
309
+ # the default parameter values, pass an empty Hash as a request object (see above).
310
+ #
311
+ # @param name [::String]
312
+ # Required. The resource name of the Conversation to delete. Format:
313
+ # `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/{conversation_id}`
314
+ # @yield [result, operation] Access the result along with the TransportOperation object
315
+ # @yieldparam result [::Google::Protobuf::Empty]
316
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
317
+ #
318
+ # @return [::Google::Protobuf::Empty]
319
+ #
320
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
321
+ def delete_conversation request, options = nil
322
+ raise ::ArgumentError, "request must be provided" if request.nil?
323
+
324
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::DeleteConversationRequest
325
+
326
+ # Converts hash and nil to an options object
327
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
328
+
329
+ # Customize the options with defaults
330
+ call_metadata = @config.rpcs.delete_conversation.metadata.to_h
331
+
332
+ # Set x-goog-api-client and x-goog-user-project headers
333
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
334
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
335
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
336
+ transports_version_send: [:rest]
337
+
338
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
339
+
340
+ options.apply_defaults timeout: @config.rpcs.delete_conversation.timeout,
341
+ metadata: call_metadata,
342
+ retry_policy: @config.rpcs.delete_conversation.retry_policy
343
+
344
+ options.apply_defaults timeout: @config.timeout,
345
+ metadata: @config.metadata,
346
+ retry_policy: @config.retry_policy
347
+
348
+ @conversational_search_service_stub.delete_conversation request, options do |result, operation|
349
+ yield result, operation if block_given?
350
+ return result
351
+ end
352
+ rescue ::Gapic::Rest::Error => e
353
+ raise ::Google::Cloud::Error.from_error(e)
354
+ end
355
+
356
+ ##
357
+ # Updates a Conversation.
358
+ #
359
+ # {::Google::Cloud::DiscoveryEngine::V1beta::Conversation Conversation} action
360
+ # type cannot be changed. If the
361
+ # {::Google::Cloud::DiscoveryEngine::V1beta::Conversation Conversation} to update
362
+ # does not exist, a NOT_FOUND error is returned.
363
+ #
364
+ # @overload update_conversation(request, options = nil)
365
+ # Pass arguments to `update_conversation` via a request object, either of type
366
+ # {::Google::Cloud::DiscoveryEngine::V1beta::UpdateConversationRequest} or an equivalent Hash.
367
+ #
368
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::UpdateConversationRequest, ::Hash]
369
+ # A request object representing the call parameters. Required. To specify no
370
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
371
+ # @param options [::Gapic::CallOptions, ::Hash]
372
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
373
+ #
374
+ # @overload update_conversation(conversation: nil, update_mask: nil)
375
+ # Pass arguments to `update_conversation` via keyword arguments. Note that at
376
+ # least one keyword argument is required. To specify no parameters, or to keep all
377
+ # the default parameter values, pass an empty Hash as a request object (see above).
378
+ #
379
+ # @param conversation [::Google::Cloud::DiscoveryEngine::V1beta::Conversation, ::Hash]
380
+ # Required. The Conversation to update.
381
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
382
+ # Indicates which fields in the provided
383
+ # {::Google::Cloud::DiscoveryEngine::V1beta::Conversation Conversation} to update.
384
+ # The following are NOT supported:
385
+ #
386
+ # * [conversation.name][]
387
+ #
388
+ # If not set or empty, all supported fields are updated.
389
+ # @yield [result, operation] Access the result along with the TransportOperation object
390
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::Conversation]
391
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
392
+ #
393
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::Conversation]
394
+ #
395
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
396
+ def update_conversation request, options = nil
397
+ raise ::ArgumentError, "request must be provided" if request.nil?
398
+
399
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::UpdateConversationRequest
400
+
401
+ # Converts hash and nil to an options object
402
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
403
+
404
+ # Customize the options with defaults
405
+ call_metadata = @config.rpcs.update_conversation.metadata.to_h
406
+
407
+ # Set x-goog-api-client and x-goog-user-project headers
408
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
409
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
410
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
411
+ transports_version_send: [:rest]
412
+
413
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
414
+
415
+ options.apply_defaults timeout: @config.rpcs.update_conversation.timeout,
416
+ metadata: call_metadata,
417
+ retry_policy: @config.rpcs.update_conversation.retry_policy
418
+
419
+ options.apply_defaults timeout: @config.timeout,
420
+ metadata: @config.metadata,
421
+ retry_policy: @config.retry_policy
422
+
423
+ @conversational_search_service_stub.update_conversation request, options do |result, operation|
424
+ yield result, operation if block_given?
425
+ return result
426
+ end
427
+ rescue ::Gapic::Rest::Error => e
428
+ raise ::Google::Cloud::Error.from_error(e)
429
+ end
430
+
431
+ ##
432
+ # Gets a Conversation.
433
+ #
434
+ # @overload get_conversation(request, options = nil)
435
+ # Pass arguments to `get_conversation` via a request object, either of type
436
+ # {::Google::Cloud::DiscoveryEngine::V1beta::GetConversationRequest} or an equivalent Hash.
437
+ #
438
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::GetConversationRequest, ::Hash]
439
+ # A request object representing the call parameters. Required. To specify no
440
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
441
+ # @param options [::Gapic::CallOptions, ::Hash]
442
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
443
+ #
444
+ # @overload get_conversation(name: nil)
445
+ # Pass arguments to `get_conversation` via keyword arguments. Note that at
446
+ # least one keyword argument is required. To specify no parameters, or to keep all
447
+ # the default parameter values, pass an empty Hash as a request object (see above).
448
+ #
449
+ # @param name [::String]
450
+ # Required. The resource name of the Conversation to get. Format:
451
+ # `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/{conversation_id}`
452
+ # @yield [result, operation] Access the result along with the TransportOperation object
453
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::Conversation]
454
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
455
+ #
456
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::Conversation]
457
+ #
458
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
459
+ def get_conversation request, options = nil
460
+ raise ::ArgumentError, "request must be provided" if request.nil?
461
+
462
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::GetConversationRequest
463
+
464
+ # Converts hash and nil to an options object
465
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
466
+
467
+ # Customize the options with defaults
468
+ call_metadata = @config.rpcs.get_conversation.metadata.to_h
469
+
470
+ # Set x-goog-api-client and x-goog-user-project headers
471
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
472
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
473
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
474
+ transports_version_send: [:rest]
475
+
476
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
477
+
478
+ options.apply_defaults timeout: @config.rpcs.get_conversation.timeout,
479
+ metadata: call_metadata,
480
+ retry_policy: @config.rpcs.get_conversation.retry_policy
481
+
482
+ options.apply_defaults timeout: @config.timeout,
483
+ metadata: @config.metadata,
484
+ retry_policy: @config.retry_policy
485
+
486
+ @conversational_search_service_stub.get_conversation request, options do |result, operation|
487
+ yield result, operation if block_given?
488
+ return result
489
+ end
490
+ rescue ::Gapic::Rest::Error => e
491
+ raise ::Google::Cloud::Error.from_error(e)
492
+ end
493
+
494
+ ##
495
+ # Lists all Conversations by their parent
496
+ # [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
497
+ #
498
+ # @overload list_conversations(request, options = nil)
499
+ # Pass arguments to `list_conversations` via a request object, either of type
500
+ # {::Google::Cloud::DiscoveryEngine::V1beta::ListConversationsRequest} or an equivalent Hash.
501
+ #
502
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::ListConversationsRequest, ::Hash]
503
+ # A request object representing the call parameters. Required. To specify no
504
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
505
+ # @param options [::Gapic::CallOptions, ::Hash]
506
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
507
+ #
508
+ # @overload list_conversations(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
509
+ # Pass arguments to `list_conversations` via keyword arguments. Note that at
510
+ # least one keyword argument is required. To specify no parameters, or to keep all
511
+ # the default parameter values, pass an empty Hash as a request object (see above).
512
+ #
513
+ # @param parent [::String]
514
+ # Required. The data store resource name. Format:
515
+ # `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}`
516
+ # @param page_size [::Integer]
517
+ # Maximum number of results to return. If unspecified, defaults
518
+ # to 50. Max allowed value is 1000.
519
+ # @param page_token [::String]
520
+ # A page token, received from a previous `ListConversations` call.
521
+ # Provide this to retrieve the subsequent page.
522
+ # @param filter [::String]
523
+ # A filter to apply on the list results. The supported features are:
524
+ # user_pseudo_id, state.
525
+ #
526
+ # Example:
527
+ # "user_pseudo_id = some_id"
528
+ # @param order_by [::String]
529
+ # A comma-separated list of fields to order by, sorted in ascending order.
530
+ # Use "desc" after a field name for descending.
531
+ # Supported fields:
532
+ # * `update_time`
533
+ # * `create_time`
534
+ # * `conversation_name`
535
+ #
536
+ # Example:
537
+ # "update_time desc"
538
+ # "create_time"
539
+ # @yield [result, operation] Access the result along with the TransportOperation object
540
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::Conversation>]
541
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
542
+ #
543
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::Conversation>]
544
+ #
545
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
546
+ def list_conversations request, options = nil
547
+ raise ::ArgumentError, "request must be provided" if request.nil?
548
+
549
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::ListConversationsRequest
550
+
551
+ # Converts hash and nil to an options object
552
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
553
+
554
+ # Customize the options with defaults
555
+ call_metadata = @config.rpcs.list_conversations.metadata.to_h
556
+
557
+ # Set x-goog-api-client and x-goog-user-project headers
558
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
559
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
560
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
561
+ transports_version_send: [:rest]
562
+
563
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
564
+
565
+ options.apply_defaults timeout: @config.rpcs.list_conversations.timeout,
566
+ metadata: call_metadata,
567
+ retry_policy: @config.rpcs.list_conversations.retry_policy
568
+
569
+ options.apply_defaults timeout: @config.timeout,
570
+ metadata: @config.metadata,
571
+ retry_policy: @config.retry_policy
572
+
573
+ @conversational_search_service_stub.list_conversations request, options do |result, operation|
574
+ result = ::Gapic::Rest::PagedEnumerable.new @conversational_search_service_stub, :list_conversations, "conversations", request, result, options
575
+ yield result, operation if block_given?
576
+ return result
577
+ end
578
+ rescue ::Gapic::Rest::Error => e
579
+ raise ::Google::Cloud::Error.from_error(e)
580
+ end
581
+
582
+ ##
583
+ # Configuration class for the ConversationalSearchService REST API.
584
+ #
585
+ # This class represents the configuration for ConversationalSearchService REST,
586
+ # providing control over timeouts, retry behavior, logging, transport
587
+ # parameters, and other low-level controls. Certain parameters can also be
588
+ # applied individually to specific RPCs. See
589
+ # {::Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Rest::Client::Configuration::Rpcs}
590
+ # for a list of RPCs that can be configured independently.
591
+ #
592
+ # Configuration can be applied globally to all clients, or to a single client
593
+ # on construction.
594
+ #
595
+ # @example
596
+ #
597
+ # # Modify the global config, setting the timeout for
598
+ # # converse_conversation to 20 seconds,
599
+ # # and all remaining timeouts to 10 seconds.
600
+ # ::Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Rest::Client.configure do |config|
601
+ # config.timeout = 10.0
602
+ # config.rpcs.converse_conversation.timeout = 20.0
603
+ # end
604
+ #
605
+ # # Apply the above configuration only to a new client.
606
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Rest::Client.new do |config|
607
+ # config.timeout = 10.0
608
+ # config.rpcs.converse_conversation.timeout = 20.0
609
+ # end
610
+ #
611
+ # @!attribute [rw] endpoint
612
+ # The hostname or hostname:port of the service endpoint.
613
+ # Defaults to `"discoveryengine.googleapis.com"`.
614
+ # @return [::String]
615
+ # @!attribute [rw] credentials
616
+ # Credentials to send with calls. You may provide any of the following types:
617
+ # * (`String`) The path to a service account key file in JSON format
618
+ # * (`Hash`) A service account key as a Hash
619
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
620
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
621
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
622
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
623
+ # * (`nil`) indicating no credentials
624
+ # @return [::Object]
625
+ # @!attribute [rw] scope
626
+ # The OAuth scopes
627
+ # @return [::Array<::String>]
628
+ # @!attribute [rw] lib_name
629
+ # The library name as recorded in instrumentation and logging
630
+ # @return [::String]
631
+ # @!attribute [rw] lib_version
632
+ # The library version as recorded in instrumentation and logging
633
+ # @return [::String]
634
+ # @!attribute [rw] timeout
635
+ # The call timeout in seconds.
636
+ # @return [::Numeric]
637
+ # @!attribute [rw] metadata
638
+ # Additional headers to be sent with the call.
639
+ # @return [::Hash{::Symbol=>::String}]
640
+ # @!attribute [rw] retry_policy
641
+ # The retry policy. The value is a hash with the following keys:
642
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
643
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
644
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
645
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
646
+ # trigger a retry.
647
+ # @return [::Hash]
648
+ # @!attribute [rw] quota_project
649
+ # A separate project against which to charge quota.
650
+ # @return [::String]
651
+ #
652
+ class Configuration
653
+ extend ::Gapic::Config
654
+
655
+ DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
656
+
657
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
658
+ config_attr :credentials, nil do |value|
659
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
660
+ allowed.any? { |klass| klass === value }
661
+ end
662
+ config_attr :scope, nil, ::String, ::Array, nil
663
+ config_attr :lib_name, nil, ::String, nil
664
+ config_attr :lib_version, nil, ::String, nil
665
+ config_attr :timeout, nil, ::Numeric, nil
666
+ config_attr :metadata, nil, ::Hash, nil
667
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
668
+ config_attr :quota_project, nil, ::String, nil
669
+
670
+ # @private
671
+ def initialize parent_config = nil
672
+ @parent_config = parent_config unless parent_config.nil?
673
+
674
+ yield self if block_given?
675
+ end
676
+
677
+ ##
678
+ # Configurations for individual RPCs
679
+ # @return [Rpcs]
680
+ #
681
+ def rpcs
682
+ @rpcs ||= begin
683
+ parent_rpcs = nil
684
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
685
+ Rpcs.new parent_rpcs
686
+ end
687
+ end
688
+
689
+ ##
690
+ # Configuration RPC class for the ConversationalSearchService API.
691
+ #
692
+ # Includes fields providing the configuration for each RPC in this service.
693
+ # Each configuration object is of type `Gapic::Config::Method` and includes
694
+ # the following configuration fields:
695
+ #
696
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
697
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
698
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
699
+ # include the following keys:
700
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
701
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
702
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
703
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
704
+ # trigger a retry.
705
+ #
706
+ class Rpcs
707
+ ##
708
+ # RPC-specific configuration for `converse_conversation`
709
+ # @return [::Gapic::Config::Method]
710
+ #
711
+ attr_reader :converse_conversation
712
+ ##
713
+ # RPC-specific configuration for `create_conversation`
714
+ # @return [::Gapic::Config::Method]
715
+ #
716
+ attr_reader :create_conversation
717
+ ##
718
+ # RPC-specific configuration for `delete_conversation`
719
+ # @return [::Gapic::Config::Method]
720
+ #
721
+ attr_reader :delete_conversation
722
+ ##
723
+ # RPC-specific configuration for `update_conversation`
724
+ # @return [::Gapic::Config::Method]
725
+ #
726
+ attr_reader :update_conversation
727
+ ##
728
+ # RPC-specific configuration for `get_conversation`
729
+ # @return [::Gapic::Config::Method]
730
+ #
731
+ attr_reader :get_conversation
732
+ ##
733
+ # RPC-specific configuration for `list_conversations`
734
+ # @return [::Gapic::Config::Method]
735
+ #
736
+ attr_reader :list_conversations
737
+
738
+ # @private
739
+ def initialize parent_rpcs = nil
740
+ converse_conversation_config = parent_rpcs.converse_conversation if parent_rpcs.respond_to? :converse_conversation
741
+ @converse_conversation = ::Gapic::Config::Method.new converse_conversation_config
742
+ create_conversation_config = parent_rpcs.create_conversation if parent_rpcs.respond_to? :create_conversation
743
+ @create_conversation = ::Gapic::Config::Method.new create_conversation_config
744
+ delete_conversation_config = parent_rpcs.delete_conversation if parent_rpcs.respond_to? :delete_conversation
745
+ @delete_conversation = ::Gapic::Config::Method.new delete_conversation_config
746
+ update_conversation_config = parent_rpcs.update_conversation if parent_rpcs.respond_to? :update_conversation
747
+ @update_conversation = ::Gapic::Config::Method.new update_conversation_config
748
+ get_conversation_config = parent_rpcs.get_conversation if parent_rpcs.respond_to? :get_conversation
749
+ @get_conversation = ::Gapic::Config::Method.new get_conversation_config
750
+ list_conversations_config = parent_rpcs.list_conversations if parent_rpcs.respond_to? :list_conversations
751
+ @list_conversations = ::Gapic::Config::Method.new list_conversations_config
752
+
753
+ yield self if block_given?
754
+ end
755
+ end
756
+ end
757
+ end
758
+ end
759
+ end
760
+ end
761
+ end
762
+ end
763
+ end