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