google-cloud-discovery_engine-v1 0.1.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/google/cloud/discovery_engine/v1/completion_service/client.rb +33 -4
- data/lib/google/cloud/discovery_engine/v1/completion_service/rest/client.rb +39 -3
- data/lib/google/cloud/discovery_engine/v1/conversational_search_service/client.rb +968 -0
- data/lib/google/cloud/discovery_engine/v1/conversational_search_service/credentials.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1/conversational_search_service/paths.rb +176 -0
- data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/client.rb +897 -0
- data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/service_stub.rb +450 -0
- data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest.rb +52 -0
- data/lib/google/cloud/discovery_engine/v1/conversational_search_service.rb +55 -0
- data/lib/google/cloud/discovery_engine/v1/document_service/client.rb +33 -9
- data/lib/google/cloud/discovery_engine/v1/document_service/operations.rb +10 -1
- data/lib/google/cloud/discovery_engine/v1/document_service/rest/client.rb +153 -8
- data/lib/google/cloud/discovery_engine/v1/document_service/rest/operations.rb +117 -0
- data/lib/google/cloud/discovery_engine/v1/rest.rb +2 -1
- data/lib/google/cloud/discovery_engine/v1/schema_service/client.rb +24 -1
- data/lib/google/cloud/discovery_engine/v1/schema_service/operations.rb +10 -1
- data/lib/google/cloud/discovery_engine/v1/schema_service/rest/client.rb +119 -0
- data/lib/google/cloud/discovery_engine/v1/schema_service/rest/operations.rb +117 -0
- data/lib/google/cloud/discovery_engine/v1/search_service/client.rb +55 -10
- data/lib/google/cloud/discovery_engine/v1/search_service/rest/client.rb +67 -12
- data/lib/google/cloud/discovery_engine/v1/user_event_service/client.rb +29 -6
- data/lib/google/cloud/discovery_engine/v1/user_event_service/operations.rb +10 -1
- data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/client.rb +74 -5
- data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/operations.rb +117 -0
- data/lib/google/cloud/discovery_engine/v1/version.rb +1 -1
- data/lib/google/cloud/discovery_engine/v1.rb +2 -1
- data/lib/google/cloud/discoveryengine/v1/common_pb.rb +2 -1
- data/lib/google/cloud/discoveryengine/v1/completion_service_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1/conversation_pb.rb +54 -0
- data/lib/google/cloud/discoveryengine/v1/conversational_search_service_pb.rb +61 -0
- data/lib/google/cloud/discoveryengine/v1/conversational_search_service_services_pb.rb +67 -0
- data/lib/google/cloud/discoveryengine/v1/import_config_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1/search_service_pb.rb +13 -1
- data/lib/google/cloud/discoveryengine/v1/user_event_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1/user_event_service_services_pb.rb +1 -1
- data/proto_docs/google/api/field_behavior.rb +14 -0
- data/proto_docs/google/cloud/discoveryengine/v1/common.rb +19 -2
- data/proto_docs/google/cloud/discoveryengine/v1/completion_service.rb +15 -2
- data/proto_docs/google/cloud/discoveryengine/v1/conversation.rb +113 -0
- data/proto_docs/google/cloud/discoveryengine/v1/conversational_search_service.rb +206 -0
- data/proto_docs/google/cloud/discoveryengine/v1/document.rb +8 -5
- data/proto_docs/google/cloud/discoveryengine/v1/document_service.rb +4 -3
- data/proto_docs/google/cloud/discoveryengine/v1/import_config.rb +23 -19
- data/proto_docs/google/cloud/discoveryengine/v1/search_service.rb +455 -19
- data/proto_docs/google/cloud/discoveryengine/v1/user_event.rb +44 -32
- data/proto_docs/google/cloud/discoveryengine/v1/user_event_service.rb +1 -1
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- metadata +38 -5
@@ -0,0 +1,968 @@
|
|
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/location"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module DiscoveryEngine
|
26
|
+
module V1
|
27
|
+
module ConversationalSearchService
|
28
|
+
##
|
29
|
+
# Client for the ConversationalSearchService service.
|
30
|
+
#
|
31
|
+
# Service for conversational search.
|
32
|
+
#
|
33
|
+
class Client
|
34
|
+
include Paths
|
35
|
+
|
36
|
+
# @private
|
37
|
+
attr_reader :conversational_search_service_stub
|
38
|
+
|
39
|
+
##
|
40
|
+
# Configure the ConversationalSearchService Client class.
|
41
|
+
#
|
42
|
+
# See {::Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client::Configuration}
|
43
|
+
# for a description of the configuration fields.
|
44
|
+
#
|
45
|
+
# @example
|
46
|
+
#
|
47
|
+
# # Modify the configuration for all ConversationalSearchService clients
|
48
|
+
# ::Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client.configure do |config|
|
49
|
+
# config.timeout = 10.0
|
50
|
+
# end
|
51
|
+
#
|
52
|
+
# @yield [config] Configure the Client client.
|
53
|
+
# @yieldparam config [Client::Configuration]
|
54
|
+
#
|
55
|
+
# @return [Client::Configuration]
|
56
|
+
#
|
57
|
+
def self.configure
|
58
|
+
@configure ||= begin
|
59
|
+
namespace = ["Google", "Cloud", "DiscoveryEngine", "V1"]
|
60
|
+
parent_config = while namespace.any?
|
61
|
+
parent_name = namespace.join "::"
|
62
|
+
parent_const = const_get parent_name
|
63
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
64
|
+
namespace.pop
|
65
|
+
end
|
66
|
+
default_config = Client::Configuration.new parent_config
|
67
|
+
|
68
|
+
default_config.timeout = 30.0
|
69
|
+
default_config.retry_policy = {
|
70
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
71
|
+
}
|
72
|
+
|
73
|
+
default_config
|
74
|
+
end
|
75
|
+
yield @configure if block_given?
|
76
|
+
@configure
|
77
|
+
end
|
78
|
+
|
79
|
+
##
|
80
|
+
# Configure the ConversationalSearchService Client instance.
|
81
|
+
#
|
82
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
83
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
84
|
+
# should be made on {Client.configure}.
|
85
|
+
#
|
86
|
+
# See {::Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client::Configuration}
|
87
|
+
# for a description of the configuration fields.
|
88
|
+
#
|
89
|
+
# @yield [config] Configure the Client client.
|
90
|
+
# @yieldparam config [Client::Configuration]
|
91
|
+
#
|
92
|
+
# @return [Client::Configuration]
|
93
|
+
#
|
94
|
+
def configure
|
95
|
+
yield @config if block_given?
|
96
|
+
@config
|
97
|
+
end
|
98
|
+
|
99
|
+
##
|
100
|
+
# Create a new ConversationalSearchService client object.
|
101
|
+
#
|
102
|
+
# @example
|
103
|
+
#
|
104
|
+
# # Create a client using the default configuration
|
105
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client.new
|
106
|
+
#
|
107
|
+
# # Create a client using a custom configuration
|
108
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client.new do |config|
|
109
|
+
# config.timeout = 10.0
|
110
|
+
# end
|
111
|
+
#
|
112
|
+
# @yield [config] Configure the ConversationalSearchService client.
|
113
|
+
# @yieldparam config [Client::Configuration]
|
114
|
+
#
|
115
|
+
def initialize
|
116
|
+
# These require statements are intentionally placed here to initialize
|
117
|
+
# the gRPC module only when it's required.
|
118
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
119
|
+
require "gapic/grpc"
|
120
|
+
require "google/cloud/discoveryengine/v1/conversational_search_service_services_pb"
|
121
|
+
|
122
|
+
# Create the configuration object
|
123
|
+
@config = Configuration.new Client.configure
|
124
|
+
|
125
|
+
# Yield the configuration if needed
|
126
|
+
yield @config if block_given?
|
127
|
+
|
128
|
+
# Create credentials
|
129
|
+
credentials = @config.credentials
|
130
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
131
|
+
# but only if the default endpoint does not have a region prefix.
|
132
|
+
enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
133
|
+
!@config.endpoint.split(".").first.include?("-")
|
134
|
+
credentials ||= Credentials.default scope: @config.scope,
|
135
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
136
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
137
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
138
|
+
end
|
139
|
+
@quota_project_id = @config.quota_project
|
140
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
141
|
+
|
142
|
+
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
143
|
+
config.credentials = credentials
|
144
|
+
config.quota_project = @quota_project_id
|
145
|
+
config.endpoint = @config.endpoint
|
146
|
+
end
|
147
|
+
|
148
|
+
@conversational_search_service_stub = ::Gapic::ServiceStub.new(
|
149
|
+
::Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Stub,
|
150
|
+
credentials: credentials,
|
151
|
+
endpoint: @config.endpoint,
|
152
|
+
channel_args: @config.channel_args,
|
153
|
+
interceptors: @config.interceptors,
|
154
|
+
channel_pool_config: @config.channel_pool
|
155
|
+
)
|
156
|
+
end
|
157
|
+
|
158
|
+
##
|
159
|
+
# Get the associated client for mix-in of the Locations.
|
160
|
+
#
|
161
|
+
# @return [Google::Cloud::Location::Locations::Client]
|
162
|
+
#
|
163
|
+
attr_reader :location_client
|
164
|
+
|
165
|
+
# Service calls
|
166
|
+
|
167
|
+
##
|
168
|
+
# Converses a conversation.
|
169
|
+
#
|
170
|
+
# @overload converse_conversation(request, options = nil)
|
171
|
+
# Pass arguments to `converse_conversation` via a request object, either of type
|
172
|
+
# {::Google::Cloud::DiscoveryEngine::V1::ConverseConversationRequest} or an equivalent Hash.
|
173
|
+
#
|
174
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1::ConverseConversationRequest, ::Hash]
|
175
|
+
# A request object representing the call parameters. Required. To specify no
|
176
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
177
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
178
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
179
|
+
#
|
180
|
+
# @overload converse_conversation(name: nil, query: nil, serving_config: nil, conversation: nil, safe_search: nil, user_labels: nil, summary_spec: nil)
|
181
|
+
# Pass arguments to `converse_conversation` via keyword arguments. Note that at
|
182
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
183
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
184
|
+
#
|
185
|
+
# @param name [::String]
|
186
|
+
# Required. The resource name of the Conversation to get. Format:
|
187
|
+
# `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/{conversation_id}`.
|
188
|
+
# Use
|
189
|
+
# `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/-`
|
190
|
+
# to activate auto session mode, which automatically creates a new
|
191
|
+
# conversation inside a ConverseConversation session.
|
192
|
+
# @param query [::Google::Cloud::DiscoveryEngine::V1::TextInput, ::Hash]
|
193
|
+
# Required. Current user input.
|
194
|
+
# @param serving_config [::String]
|
195
|
+
# The resource name of the Serving Config to use. Format:
|
196
|
+
# `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/servingConfigs/{serving_config_id}`
|
197
|
+
# If this is not set, the default serving config will be used.
|
198
|
+
# @param conversation [::Google::Cloud::DiscoveryEngine::V1::Conversation, ::Hash]
|
199
|
+
# The conversation to be used by auto session only. The name field will be
|
200
|
+
# ignored as we automatically assign new name for the conversation in auto
|
201
|
+
# session.
|
202
|
+
# @param safe_search [::Boolean]
|
203
|
+
# Whether to turn on safe search.
|
204
|
+
# @param user_labels [::Hash{::String => ::String}]
|
205
|
+
# The user labels applied to a resource must meet the following requirements:
|
206
|
+
#
|
207
|
+
# * Each resource can have multiple labels, up to a maximum of 64.
|
208
|
+
# * Each label must be a key-value pair.
|
209
|
+
# * Keys have a minimum length of 1 character and a maximum length of 63
|
210
|
+
# characters and cannot be empty. Values can be empty and have a maximum
|
211
|
+
# length of 63 characters.
|
212
|
+
# * Keys and values can contain only lowercase letters, numeric characters,
|
213
|
+
# underscores, and dashes. All characters must use UTF-8 encoding, and
|
214
|
+
# international characters are allowed.
|
215
|
+
# * The key portion of a label must be unique. However, you can use the same
|
216
|
+
# key with multiple resources.
|
217
|
+
# * Keys must start with a lowercase letter or international character.
|
218
|
+
#
|
219
|
+
# See [Google Cloud
|
220
|
+
# Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
|
221
|
+
# for more details.
|
222
|
+
# @param summary_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::ContentSearchSpec::SummarySpec, ::Hash]
|
223
|
+
# A specification for configuring the summary returned in the response.
|
224
|
+
#
|
225
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
226
|
+
# @yieldparam response [::Google::Cloud::DiscoveryEngine::V1::ConverseConversationResponse]
|
227
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
228
|
+
#
|
229
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1::ConverseConversationResponse]
|
230
|
+
#
|
231
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
232
|
+
#
|
233
|
+
# @example Basic example
|
234
|
+
# require "google/cloud/discovery_engine/v1"
|
235
|
+
#
|
236
|
+
# # Create a client object. The client can be reused for multiple calls.
|
237
|
+
# client = Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client.new
|
238
|
+
#
|
239
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
240
|
+
# request = Google::Cloud::DiscoveryEngine::V1::ConverseConversationRequest.new
|
241
|
+
#
|
242
|
+
# # Call the converse_conversation method.
|
243
|
+
# result = client.converse_conversation request
|
244
|
+
#
|
245
|
+
# # The returned object is of type Google::Cloud::DiscoveryEngine::V1::ConverseConversationResponse.
|
246
|
+
# p result
|
247
|
+
#
|
248
|
+
def converse_conversation request, options = nil
|
249
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
250
|
+
|
251
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::ConverseConversationRequest
|
252
|
+
|
253
|
+
# Converts hash and nil to an options object
|
254
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
255
|
+
|
256
|
+
# Customize the options with defaults
|
257
|
+
metadata = @config.rpcs.converse_conversation.metadata.to_h
|
258
|
+
|
259
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
260
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
261
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
262
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
|
263
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
264
|
+
|
265
|
+
header_params = {}
|
266
|
+
if request.name
|
267
|
+
header_params["name"] = request.name
|
268
|
+
end
|
269
|
+
|
270
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
271
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
272
|
+
|
273
|
+
options.apply_defaults timeout: @config.rpcs.converse_conversation.timeout,
|
274
|
+
metadata: metadata,
|
275
|
+
retry_policy: @config.rpcs.converse_conversation.retry_policy
|
276
|
+
|
277
|
+
options.apply_defaults timeout: @config.timeout,
|
278
|
+
metadata: @config.metadata,
|
279
|
+
retry_policy: @config.retry_policy
|
280
|
+
|
281
|
+
@conversational_search_service_stub.call_rpc :converse_conversation, request, options: options do |response, operation|
|
282
|
+
yield response, operation if block_given?
|
283
|
+
return response
|
284
|
+
end
|
285
|
+
rescue ::GRPC::BadStatus => e
|
286
|
+
raise ::Google::Cloud::Error.from_error(e)
|
287
|
+
end
|
288
|
+
|
289
|
+
##
|
290
|
+
# Creates a Conversation.
|
291
|
+
#
|
292
|
+
# If the {::Google::Cloud::DiscoveryEngine::V1::Conversation Conversation} to
|
293
|
+
# create already exists, an ALREADY_EXISTS error is returned.
|
294
|
+
#
|
295
|
+
# @overload create_conversation(request, options = nil)
|
296
|
+
# Pass arguments to `create_conversation` via a request object, either of type
|
297
|
+
# {::Google::Cloud::DiscoveryEngine::V1::CreateConversationRequest} or an equivalent Hash.
|
298
|
+
#
|
299
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1::CreateConversationRequest, ::Hash]
|
300
|
+
# A request object representing the call parameters. Required. To specify no
|
301
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
302
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
303
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
304
|
+
#
|
305
|
+
# @overload create_conversation(parent: nil, conversation: nil)
|
306
|
+
# Pass arguments to `create_conversation` via keyword arguments. Note that at
|
307
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
308
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
309
|
+
#
|
310
|
+
# @param parent [::String]
|
311
|
+
# Required. Full resource name of parent data store. Format:
|
312
|
+
# `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}`
|
313
|
+
# @param conversation [::Google::Cloud::DiscoveryEngine::V1::Conversation, ::Hash]
|
314
|
+
# Required. The conversation to create.
|
315
|
+
#
|
316
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
317
|
+
# @yieldparam response [::Google::Cloud::DiscoveryEngine::V1::Conversation]
|
318
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
319
|
+
#
|
320
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1::Conversation]
|
321
|
+
#
|
322
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
323
|
+
#
|
324
|
+
# @example Basic example
|
325
|
+
# require "google/cloud/discovery_engine/v1"
|
326
|
+
#
|
327
|
+
# # Create a client object. The client can be reused for multiple calls.
|
328
|
+
# client = Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client.new
|
329
|
+
#
|
330
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
331
|
+
# request = Google::Cloud::DiscoveryEngine::V1::CreateConversationRequest.new
|
332
|
+
#
|
333
|
+
# # Call the create_conversation method.
|
334
|
+
# result = client.create_conversation request
|
335
|
+
#
|
336
|
+
# # The returned object is of type Google::Cloud::DiscoveryEngine::V1::Conversation.
|
337
|
+
# p result
|
338
|
+
#
|
339
|
+
def create_conversation request, options = nil
|
340
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
341
|
+
|
342
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::CreateConversationRequest
|
343
|
+
|
344
|
+
# Converts hash and nil to an options object
|
345
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
346
|
+
|
347
|
+
# Customize the options with defaults
|
348
|
+
metadata = @config.rpcs.create_conversation.metadata.to_h
|
349
|
+
|
350
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
351
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
352
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
353
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
|
354
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
355
|
+
|
356
|
+
header_params = {}
|
357
|
+
if request.parent
|
358
|
+
header_params["parent"] = request.parent
|
359
|
+
end
|
360
|
+
|
361
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
362
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
363
|
+
|
364
|
+
options.apply_defaults timeout: @config.rpcs.create_conversation.timeout,
|
365
|
+
metadata: metadata,
|
366
|
+
retry_policy: @config.rpcs.create_conversation.retry_policy
|
367
|
+
|
368
|
+
options.apply_defaults timeout: @config.timeout,
|
369
|
+
metadata: @config.metadata,
|
370
|
+
retry_policy: @config.retry_policy
|
371
|
+
|
372
|
+
@conversational_search_service_stub.call_rpc :create_conversation, request, options: options do |response, operation|
|
373
|
+
yield response, operation if block_given?
|
374
|
+
return response
|
375
|
+
end
|
376
|
+
rescue ::GRPC::BadStatus => e
|
377
|
+
raise ::Google::Cloud::Error.from_error(e)
|
378
|
+
end
|
379
|
+
|
380
|
+
##
|
381
|
+
# Deletes a Conversation.
|
382
|
+
#
|
383
|
+
# If the {::Google::Cloud::DiscoveryEngine::V1::Conversation Conversation} to
|
384
|
+
# delete does not exist, a NOT_FOUND error is returned.
|
385
|
+
#
|
386
|
+
# @overload delete_conversation(request, options = nil)
|
387
|
+
# Pass arguments to `delete_conversation` via a request object, either of type
|
388
|
+
# {::Google::Cloud::DiscoveryEngine::V1::DeleteConversationRequest} or an equivalent Hash.
|
389
|
+
#
|
390
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1::DeleteConversationRequest, ::Hash]
|
391
|
+
# A request object representing the call parameters. Required. To specify no
|
392
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
393
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
394
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
395
|
+
#
|
396
|
+
# @overload delete_conversation(name: nil)
|
397
|
+
# Pass arguments to `delete_conversation` via keyword arguments. Note that at
|
398
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
399
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
400
|
+
#
|
401
|
+
# @param name [::String]
|
402
|
+
# Required. The resource name of the Conversation to delete. Format:
|
403
|
+
# `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/{conversation_id}`
|
404
|
+
#
|
405
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
406
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
407
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
408
|
+
#
|
409
|
+
# @return [::Google::Protobuf::Empty]
|
410
|
+
#
|
411
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
412
|
+
#
|
413
|
+
# @example Basic example
|
414
|
+
# require "google/cloud/discovery_engine/v1"
|
415
|
+
#
|
416
|
+
# # Create a client object. The client can be reused for multiple calls.
|
417
|
+
# client = Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client.new
|
418
|
+
#
|
419
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
420
|
+
# request = Google::Cloud::DiscoveryEngine::V1::DeleteConversationRequest.new
|
421
|
+
#
|
422
|
+
# # Call the delete_conversation method.
|
423
|
+
# result = client.delete_conversation request
|
424
|
+
#
|
425
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
426
|
+
# p result
|
427
|
+
#
|
428
|
+
def delete_conversation request, options = nil
|
429
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
430
|
+
|
431
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::DeleteConversationRequest
|
432
|
+
|
433
|
+
# Converts hash and nil to an options object
|
434
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
435
|
+
|
436
|
+
# Customize the options with defaults
|
437
|
+
metadata = @config.rpcs.delete_conversation.metadata.to_h
|
438
|
+
|
439
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
440
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
441
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
442
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
|
443
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
444
|
+
|
445
|
+
header_params = {}
|
446
|
+
if request.name
|
447
|
+
header_params["name"] = request.name
|
448
|
+
end
|
449
|
+
|
450
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
451
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
452
|
+
|
453
|
+
options.apply_defaults timeout: @config.rpcs.delete_conversation.timeout,
|
454
|
+
metadata: metadata,
|
455
|
+
retry_policy: @config.rpcs.delete_conversation.retry_policy
|
456
|
+
|
457
|
+
options.apply_defaults timeout: @config.timeout,
|
458
|
+
metadata: @config.metadata,
|
459
|
+
retry_policy: @config.retry_policy
|
460
|
+
|
461
|
+
@conversational_search_service_stub.call_rpc :delete_conversation, request, options: options do |response, operation|
|
462
|
+
yield response, operation if block_given?
|
463
|
+
return response
|
464
|
+
end
|
465
|
+
rescue ::GRPC::BadStatus => e
|
466
|
+
raise ::Google::Cloud::Error.from_error(e)
|
467
|
+
end
|
468
|
+
|
469
|
+
##
|
470
|
+
# Updates a Conversation.
|
471
|
+
#
|
472
|
+
# {::Google::Cloud::DiscoveryEngine::V1::Conversation Conversation} action type
|
473
|
+
# cannot be changed. If the
|
474
|
+
# {::Google::Cloud::DiscoveryEngine::V1::Conversation Conversation} to update does
|
475
|
+
# not exist, a NOT_FOUND error is returned.
|
476
|
+
#
|
477
|
+
# @overload update_conversation(request, options = nil)
|
478
|
+
# Pass arguments to `update_conversation` via a request object, either of type
|
479
|
+
# {::Google::Cloud::DiscoveryEngine::V1::UpdateConversationRequest} or an equivalent Hash.
|
480
|
+
#
|
481
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1::UpdateConversationRequest, ::Hash]
|
482
|
+
# A request object representing the call parameters. Required. To specify no
|
483
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
484
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
485
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
486
|
+
#
|
487
|
+
# @overload update_conversation(conversation: nil, update_mask: nil)
|
488
|
+
# Pass arguments to `update_conversation` via keyword arguments. Note that at
|
489
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
490
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
491
|
+
#
|
492
|
+
# @param conversation [::Google::Cloud::DiscoveryEngine::V1::Conversation, ::Hash]
|
493
|
+
# Required. The Conversation to update.
|
494
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
495
|
+
# Indicates which fields in the provided
|
496
|
+
# {::Google::Cloud::DiscoveryEngine::V1::Conversation Conversation} to update. The
|
497
|
+
# following are NOT supported:
|
498
|
+
#
|
499
|
+
# * [conversation.name][]
|
500
|
+
#
|
501
|
+
# If not set or empty, all supported fields are updated.
|
502
|
+
#
|
503
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
504
|
+
# @yieldparam response [::Google::Cloud::DiscoveryEngine::V1::Conversation]
|
505
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
506
|
+
#
|
507
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1::Conversation]
|
508
|
+
#
|
509
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
510
|
+
#
|
511
|
+
# @example Basic example
|
512
|
+
# require "google/cloud/discovery_engine/v1"
|
513
|
+
#
|
514
|
+
# # Create a client object. The client can be reused for multiple calls.
|
515
|
+
# client = Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client.new
|
516
|
+
#
|
517
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
518
|
+
# request = Google::Cloud::DiscoveryEngine::V1::UpdateConversationRequest.new
|
519
|
+
#
|
520
|
+
# # Call the update_conversation method.
|
521
|
+
# result = client.update_conversation request
|
522
|
+
#
|
523
|
+
# # The returned object is of type Google::Cloud::DiscoveryEngine::V1::Conversation.
|
524
|
+
# p result
|
525
|
+
#
|
526
|
+
def update_conversation request, options = nil
|
527
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
528
|
+
|
529
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::UpdateConversationRequest
|
530
|
+
|
531
|
+
# Converts hash and nil to an options object
|
532
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
533
|
+
|
534
|
+
# Customize the options with defaults
|
535
|
+
metadata = @config.rpcs.update_conversation.metadata.to_h
|
536
|
+
|
537
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
538
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
539
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
540
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
|
541
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
542
|
+
|
543
|
+
header_params = {}
|
544
|
+
if request.conversation&.name
|
545
|
+
header_params["conversation.name"] = request.conversation.name
|
546
|
+
end
|
547
|
+
|
548
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
549
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
550
|
+
|
551
|
+
options.apply_defaults timeout: @config.rpcs.update_conversation.timeout,
|
552
|
+
metadata: metadata,
|
553
|
+
retry_policy: @config.rpcs.update_conversation.retry_policy
|
554
|
+
|
555
|
+
options.apply_defaults timeout: @config.timeout,
|
556
|
+
metadata: @config.metadata,
|
557
|
+
retry_policy: @config.retry_policy
|
558
|
+
|
559
|
+
@conversational_search_service_stub.call_rpc :update_conversation, request, options: options do |response, operation|
|
560
|
+
yield response, operation if block_given?
|
561
|
+
return response
|
562
|
+
end
|
563
|
+
rescue ::GRPC::BadStatus => e
|
564
|
+
raise ::Google::Cloud::Error.from_error(e)
|
565
|
+
end
|
566
|
+
|
567
|
+
##
|
568
|
+
# Gets a Conversation.
|
569
|
+
#
|
570
|
+
# @overload get_conversation(request, options = nil)
|
571
|
+
# Pass arguments to `get_conversation` via a request object, either of type
|
572
|
+
# {::Google::Cloud::DiscoveryEngine::V1::GetConversationRequest} or an equivalent Hash.
|
573
|
+
#
|
574
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1::GetConversationRequest, ::Hash]
|
575
|
+
# A request object representing the call parameters. Required. To specify no
|
576
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
577
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
578
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
579
|
+
#
|
580
|
+
# @overload get_conversation(name: nil)
|
581
|
+
# Pass arguments to `get_conversation` via keyword arguments. Note that at
|
582
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
583
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
584
|
+
#
|
585
|
+
# @param name [::String]
|
586
|
+
# Required. The resource name of the Conversation to get. Format:
|
587
|
+
# `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/{conversation_id}`
|
588
|
+
#
|
589
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
590
|
+
# @yieldparam response [::Google::Cloud::DiscoveryEngine::V1::Conversation]
|
591
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
592
|
+
#
|
593
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1::Conversation]
|
594
|
+
#
|
595
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
596
|
+
#
|
597
|
+
# @example Basic example
|
598
|
+
# require "google/cloud/discovery_engine/v1"
|
599
|
+
#
|
600
|
+
# # Create a client object. The client can be reused for multiple calls.
|
601
|
+
# client = Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client.new
|
602
|
+
#
|
603
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
604
|
+
# request = Google::Cloud::DiscoveryEngine::V1::GetConversationRequest.new
|
605
|
+
#
|
606
|
+
# # Call the get_conversation method.
|
607
|
+
# result = client.get_conversation request
|
608
|
+
#
|
609
|
+
# # The returned object is of type Google::Cloud::DiscoveryEngine::V1::Conversation.
|
610
|
+
# p result
|
611
|
+
#
|
612
|
+
def get_conversation request, options = nil
|
613
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
614
|
+
|
615
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::GetConversationRequest
|
616
|
+
|
617
|
+
# Converts hash and nil to an options object
|
618
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
619
|
+
|
620
|
+
# Customize the options with defaults
|
621
|
+
metadata = @config.rpcs.get_conversation.metadata.to_h
|
622
|
+
|
623
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
624
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
625
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
626
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
|
627
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
628
|
+
|
629
|
+
header_params = {}
|
630
|
+
if request.name
|
631
|
+
header_params["name"] = request.name
|
632
|
+
end
|
633
|
+
|
634
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
635
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
636
|
+
|
637
|
+
options.apply_defaults timeout: @config.rpcs.get_conversation.timeout,
|
638
|
+
metadata: metadata,
|
639
|
+
retry_policy: @config.rpcs.get_conversation.retry_policy
|
640
|
+
|
641
|
+
options.apply_defaults timeout: @config.timeout,
|
642
|
+
metadata: @config.metadata,
|
643
|
+
retry_policy: @config.retry_policy
|
644
|
+
|
645
|
+
@conversational_search_service_stub.call_rpc :get_conversation, request, options: options do |response, operation|
|
646
|
+
yield response, operation if block_given?
|
647
|
+
return response
|
648
|
+
end
|
649
|
+
rescue ::GRPC::BadStatus => e
|
650
|
+
raise ::Google::Cloud::Error.from_error(e)
|
651
|
+
end
|
652
|
+
|
653
|
+
##
|
654
|
+
# Lists all Conversations by their parent
|
655
|
+
# [DataStore][google.cloud.discoveryengine.v1.DataStore].
|
656
|
+
#
|
657
|
+
# @overload list_conversations(request, options = nil)
|
658
|
+
# Pass arguments to `list_conversations` via a request object, either of type
|
659
|
+
# {::Google::Cloud::DiscoveryEngine::V1::ListConversationsRequest} or an equivalent Hash.
|
660
|
+
#
|
661
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1::ListConversationsRequest, ::Hash]
|
662
|
+
# A request object representing the call parameters. Required. To specify no
|
663
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
664
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
665
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
666
|
+
#
|
667
|
+
# @overload list_conversations(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
|
668
|
+
# Pass arguments to `list_conversations` via keyword arguments. Note that at
|
669
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
670
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
671
|
+
#
|
672
|
+
# @param parent [::String]
|
673
|
+
# Required. The data store resource name. Format:
|
674
|
+
# `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}`
|
675
|
+
# @param page_size [::Integer]
|
676
|
+
# Maximum number of results to return. If unspecified, defaults
|
677
|
+
# to 50. Max allowed value is 1000.
|
678
|
+
# @param page_token [::String]
|
679
|
+
# A page token, received from a previous `ListConversations` call.
|
680
|
+
# Provide this to retrieve the subsequent page.
|
681
|
+
# @param filter [::String]
|
682
|
+
# A filter to apply on the list results. The supported features are:
|
683
|
+
# user_pseudo_id, state.
|
684
|
+
#
|
685
|
+
# Example:
|
686
|
+
# "user_pseudo_id = some_id"
|
687
|
+
# @param order_by [::String]
|
688
|
+
# A comma-separated list of fields to order by, sorted in ascending order.
|
689
|
+
# Use "desc" after a field name for descending.
|
690
|
+
# Supported fields:
|
691
|
+
# * `update_time`
|
692
|
+
# * `create_time`
|
693
|
+
# * `conversation_name`
|
694
|
+
#
|
695
|
+
# Example:
|
696
|
+
# "update_time desc"
|
697
|
+
# "create_time"
|
698
|
+
#
|
699
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
700
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1::Conversation>]
|
701
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
702
|
+
#
|
703
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1::Conversation>]
|
704
|
+
#
|
705
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
706
|
+
#
|
707
|
+
# @example Basic example
|
708
|
+
# require "google/cloud/discovery_engine/v1"
|
709
|
+
#
|
710
|
+
# # Create a client object. The client can be reused for multiple calls.
|
711
|
+
# client = Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client.new
|
712
|
+
#
|
713
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
714
|
+
# request = Google::Cloud::DiscoveryEngine::V1::ListConversationsRequest.new
|
715
|
+
#
|
716
|
+
# # Call the list_conversations method.
|
717
|
+
# result = client.list_conversations request
|
718
|
+
#
|
719
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
720
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
721
|
+
# result.each do |item|
|
722
|
+
# # Each element is of type ::Google::Cloud::DiscoveryEngine::V1::Conversation.
|
723
|
+
# p item
|
724
|
+
# end
|
725
|
+
#
|
726
|
+
def list_conversations request, options = nil
|
727
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
728
|
+
|
729
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::ListConversationsRequest
|
730
|
+
|
731
|
+
# Converts hash and nil to an options object
|
732
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
733
|
+
|
734
|
+
# Customize the options with defaults
|
735
|
+
metadata = @config.rpcs.list_conversations.metadata.to_h
|
736
|
+
|
737
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
738
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
739
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
740
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
|
741
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
742
|
+
|
743
|
+
header_params = {}
|
744
|
+
if request.parent
|
745
|
+
header_params["parent"] = request.parent
|
746
|
+
end
|
747
|
+
|
748
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
749
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
750
|
+
|
751
|
+
options.apply_defaults timeout: @config.rpcs.list_conversations.timeout,
|
752
|
+
metadata: metadata,
|
753
|
+
retry_policy: @config.rpcs.list_conversations.retry_policy
|
754
|
+
|
755
|
+
options.apply_defaults timeout: @config.timeout,
|
756
|
+
metadata: @config.metadata,
|
757
|
+
retry_policy: @config.retry_policy
|
758
|
+
|
759
|
+
@conversational_search_service_stub.call_rpc :list_conversations, request, options: options do |response, operation|
|
760
|
+
response = ::Gapic::PagedEnumerable.new @conversational_search_service_stub, :list_conversations, request, response, operation, options
|
761
|
+
yield response, operation if block_given?
|
762
|
+
return response
|
763
|
+
end
|
764
|
+
rescue ::GRPC::BadStatus => e
|
765
|
+
raise ::Google::Cloud::Error.from_error(e)
|
766
|
+
end
|
767
|
+
|
768
|
+
##
|
769
|
+
# Configuration class for the ConversationalSearchService API.
|
770
|
+
#
|
771
|
+
# This class represents the configuration for ConversationalSearchService,
|
772
|
+
# providing control over timeouts, retry behavior, logging, transport
|
773
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
774
|
+
# applied individually to specific RPCs. See
|
775
|
+
# {::Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client::Configuration::Rpcs}
|
776
|
+
# for a list of RPCs that can be configured independently.
|
777
|
+
#
|
778
|
+
# Configuration can be applied globally to all clients, or to a single client
|
779
|
+
# on construction.
|
780
|
+
#
|
781
|
+
# @example
|
782
|
+
#
|
783
|
+
# # Modify the global config, setting the timeout for
|
784
|
+
# # converse_conversation to 20 seconds,
|
785
|
+
# # and all remaining timeouts to 10 seconds.
|
786
|
+
# ::Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client.configure do |config|
|
787
|
+
# config.timeout = 10.0
|
788
|
+
# config.rpcs.converse_conversation.timeout = 20.0
|
789
|
+
# end
|
790
|
+
#
|
791
|
+
# # Apply the above configuration only to a new client.
|
792
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client.new do |config|
|
793
|
+
# config.timeout = 10.0
|
794
|
+
# config.rpcs.converse_conversation.timeout = 20.0
|
795
|
+
# end
|
796
|
+
#
|
797
|
+
# @!attribute [rw] endpoint
|
798
|
+
# The hostname or hostname:port of the service endpoint.
|
799
|
+
# Defaults to `"discoveryengine.googleapis.com"`.
|
800
|
+
# @return [::String]
|
801
|
+
# @!attribute [rw] credentials
|
802
|
+
# Credentials to send with calls. You may provide any of the following types:
|
803
|
+
# * (`String`) The path to a service account key file in JSON format
|
804
|
+
# * (`Hash`) A service account key as a Hash
|
805
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
806
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
807
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
808
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
809
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
810
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
811
|
+
# * (`nil`) indicating no credentials
|
812
|
+
# @return [::Object]
|
813
|
+
# @!attribute [rw] scope
|
814
|
+
# The OAuth scopes
|
815
|
+
# @return [::Array<::String>]
|
816
|
+
# @!attribute [rw] lib_name
|
817
|
+
# The library name as recorded in instrumentation and logging
|
818
|
+
# @return [::String]
|
819
|
+
# @!attribute [rw] lib_version
|
820
|
+
# The library version as recorded in instrumentation and logging
|
821
|
+
# @return [::String]
|
822
|
+
# @!attribute [rw] channel_args
|
823
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
824
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
825
|
+
# @return [::Hash]
|
826
|
+
# @!attribute [rw] interceptors
|
827
|
+
# An array of interceptors that are run before calls are executed.
|
828
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
829
|
+
# @!attribute [rw] timeout
|
830
|
+
# The call timeout in seconds.
|
831
|
+
# @return [::Numeric]
|
832
|
+
# @!attribute [rw] metadata
|
833
|
+
# Additional gRPC headers to be sent with the call.
|
834
|
+
# @return [::Hash{::Symbol=>::String}]
|
835
|
+
# @!attribute [rw] retry_policy
|
836
|
+
# The retry policy. The value is a hash with the following keys:
|
837
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
838
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
839
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
840
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
841
|
+
# trigger a retry.
|
842
|
+
# @return [::Hash]
|
843
|
+
# @!attribute [rw] quota_project
|
844
|
+
# A separate project against which to charge quota.
|
845
|
+
# @return [::String]
|
846
|
+
#
|
847
|
+
class Configuration
|
848
|
+
extend ::Gapic::Config
|
849
|
+
|
850
|
+
DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
|
851
|
+
|
852
|
+
config_attr :endpoint, DEFAULT_ENDPOINT, ::String
|
853
|
+
config_attr :credentials, nil do |value|
|
854
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
855
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
856
|
+
allowed.any? { |klass| klass === value }
|
857
|
+
end
|
858
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
859
|
+
config_attr :lib_name, nil, ::String, nil
|
860
|
+
config_attr :lib_version, nil, ::String, nil
|
861
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
862
|
+
config_attr :interceptors, nil, ::Array, nil
|
863
|
+
config_attr :timeout, nil, ::Numeric, nil
|
864
|
+
config_attr :metadata, nil, ::Hash, nil
|
865
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
866
|
+
config_attr :quota_project, nil, ::String, nil
|
867
|
+
|
868
|
+
# @private
|
869
|
+
def initialize parent_config = nil
|
870
|
+
@parent_config = parent_config unless parent_config.nil?
|
871
|
+
|
872
|
+
yield self if block_given?
|
873
|
+
end
|
874
|
+
|
875
|
+
##
|
876
|
+
# Configurations for individual RPCs
|
877
|
+
# @return [Rpcs]
|
878
|
+
#
|
879
|
+
def rpcs
|
880
|
+
@rpcs ||= begin
|
881
|
+
parent_rpcs = nil
|
882
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
883
|
+
Rpcs.new parent_rpcs
|
884
|
+
end
|
885
|
+
end
|
886
|
+
|
887
|
+
##
|
888
|
+
# Configuration for the channel pool
|
889
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
890
|
+
#
|
891
|
+
def channel_pool
|
892
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
893
|
+
end
|
894
|
+
|
895
|
+
##
|
896
|
+
# Configuration RPC class for the ConversationalSearchService API.
|
897
|
+
#
|
898
|
+
# Includes fields providing the configuration for each RPC in this service.
|
899
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
900
|
+
# the following configuration fields:
|
901
|
+
#
|
902
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
903
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
904
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
905
|
+
# include the following keys:
|
906
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
907
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
908
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
909
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
910
|
+
# trigger a retry.
|
911
|
+
#
|
912
|
+
class Rpcs
|
913
|
+
##
|
914
|
+
# RPC-specific configuration for `converse_conversation`
|
915
|
+
# @return [::Gapic::Config::Method]
|
916
|
+
#
|
917
|
+
attr_reader :converse_conversation
|
918
|
+
##
|
919
|
+
# RPC-specific configuration for `create_conversation`
|
920
|
+
# @return [::Gapic::Config::Method]
|
921
|
+
#
|
922
|
+
attr_reader :create_conversation
|
923
|
+
##
|
924
|
+
# RPC-specific configuration for `delete_conversation`
|
925
|
+
# @return [::Gapic::Config::Method]
|
926
|
+
#
|
927
|
+
attr_reader :delete_conversation
|
928
|
+
##
|
929
|
+
# RPC-specific configuration for `update_conversation`
|
930
|
+
# @return [::Gapic::Config::Method]
|
931
|
+
#
|
932
|
+
attr_reader :update_conversation
|
933
|
+
##
|
934
|
+
# RPC-specific configuration for `get_conversation`
|
935
|
+
# @return [::Gapic::Config::Method]
|
936
|
+
#
|
937
|
+
attr_reader :get_conversation
|
938
|
+
##
|
939
|
+
# RPC-specific configuration for `list_conversations`
|
940
|
+
# @return [::Gapic::Config::Method]
|
941
|
+
#
|
942
|
+
attr_reader :list_conversations
|
943
|
+
|
944
|
+
# @private
|
945
|
+
def initialize parent_rpcs = nil
|
946
|
+
converse_conversation_config = parent_rpcs.converse_conversation if parent_rpcs.respond_to? :converse_conversation
|
947
|
+
@converse_conversation = ::Gapic::Config::Method.new converse_conversation_config
|
948
|
+
create_conversation_config = parent_rpcs.create_conversation if parent_rpcs.respond_to? :create_conversation
|
949
|
+
@create_conversation = ::Gapic::Config::Method.new create_conversation_config
|
950
|
+
delete_conversation_config = parent_rpcs.delete_conversation if parent_rpcs.respond_to? :delete_conversation
|
951
|
+
@delete_conversation = ::Gapic::Config::Method.new delete_conversation_config
|
952
|
+
update_conversation_config = parent_rpcs.update_conversation if parent_rpcs.respond_to? :update_conversation
|
953
|
+
@update_conversation = ::Gapic::Config::Method.new update_conversation_config
|
954
|
+
get_conversation_config = parent_rpcs.get_conversation if parent_rpcs.respond_to? :get_conversation
|
955
|
+
@get_conversation = ::Gapic::Config::Method.new get_conversation_config
|
956
|
+
list_conversations_config = parent_rpcs.list_conversations if parent_rpcs.respond_to? :list_conversations
|
957
|
+
@list_conversations = ::Gapic::Config::Method.new list_conversations_config
|
958
|
+
|
959
|
+
yield self if block_given?
|
960
|
+
end
|
961
|
+
end
|
962
|
+
end
|
963
|
+
end
|
964
|
+
end
|
965
|
+
end
|
966
|
+
end
|
967
|
+
end
|
968
|
+
end
|