google-cloud-dialogflow-v2 0.22.0 → 0.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/dialogflow/v2/agents/rest/client.rb +1078 -0
  4. data/lib/google/cloud/dialogflow/v2/agents/rest/operations.rb +813 -0
  5. data/lib/google/cloud/dialogflow/v2/agents/rest/service_stub.rb +652 -0
  6. data/lib/google/cloud/dialogflow/v2/agents/rest.rb +54 -0
  7. data/lib/google/cloud/dialogflow/v2/agents.rb +6 -0
  8. data/lib/google/cloud/dialogflow/v2/answer_records/rest/client.rb +463 -0
  9. data/lib/google/cloud/dialogflow/v2/answer_records/rest/service_stub.rb +182 -0
  10. data/lib/google/cloud/dialogflow/v2/answer_records/rest.rb +54 -0
  11. data/lib/google/cloud/dialogflow/v2/answer_records.rb +6 -0
  12. data/lib/google/cloud/dialogflow/v2/bindings_override.rb +102 -0
  13. data/lib/google/cloud/dialogflow/v2/contexts/rest/client.rb +753 -0
  14. data/lib/google/cloud/dialogflow/v2/contexts/rest/service_stub.rb +536 -0
  15. data/lib/google/cloud/dialogflow/v2/contexts/rest.rb +53 -0
  16. data/lib/google/cloud/dialogflow/v2/contexts.rb +6 -0
  17. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/client.rb +714 -0
  18. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/operations.rb +813 -0
  19. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/service_stub.rb +367 -0
  20. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest.rb +57 -0
  21. data/lib/google/cloud/dialogflow/v2/conversation_datasets.rb +6 -0
  22. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/client.rb +1010 -0
  23. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/operations.rb +813 -0
  24. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/service_stub.rb +642 -0
  25. data/lib/google/cloud/dialogflow/v2/conversation_models/rest.rb +54 -0
  26. data/lib/google/cloud/dialogflow/v2/conversation_models.rb +6 -0
  27. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/client.rb +868 -0
  28. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/operations.rb +813 -0
  29. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/service_stub.rb +518 -0
  30. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest.rb +55 -0
  31. data/lib/google/cloud/dialogflow/v2/conversation_profiles.rb +6 -0
  32. data/lib/google/cloud/dialogflow/v2/conversations/rest/client.rb +819 -0
  33. data/lib/google/cloud/dialogflow/v2/conversations/rest/service_stub.rb +450 -0
  34. data/lib/google/cloud/dialogflow/v2/conversations/rest.rb +54 -0
  35. data/lib/google/cloud/dialogflow/v2/conversations.rb +6 -0
  36. data/lib/google/cloud/dialogflow/v2/documents/rest/client.rb +1013 -0
  37. data/lib/google/cloud/dialogflow/v2/documents/rest/operations.rb +813 -0
  38. data/lib/google/cloud/dialogflow/v2/documents/rest/service_stub.rb +631 -0
  39. data/lib/google/cloud/dialogflow/v2/documents/rest.rb +55 -0
  40. data/lib/google/cloud/dialogflow/v2/documents.rb +6 -0
  41. data/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb +1178 -0
  42. data/lib/google/cloud/dialogflow/v2/entity_types/rest/operations.rb +813 -0
  43. data/lib/google/cloud/dialogflow/v2/entity_types/rest/service_stub.rb +722 -0
  44. data/lib/google/cloud/dialogflow/v2/entity_types/rest.rb +54 -0
  45. data/lib/google/cloud/dialogflow/v2/entity_types.rb +6 -0
  46. data/lib/google/cloud/dialogflow/v2/environments/rest/client.rb +779 -0
  47. data/lib/google/cloud/dialogflow/v2/environments/rest/service_stub.rb +448 -0
  48. data/lib/google/cloud/dialogflow/v2/environments/rest.rb +53 -0
  49. data/lib/google/cloud/dialogflow/v2/environments.rb +6 -0
  50. data/lib/google/cloud/dialogflow/v2/fulfillments/rest/client.rb +444 -0
  51. data/lib/google/cloud/dialogflow/v2/fulfillments/rest/service_stub.rb +182 -0
  52. data/lib/google/cloud/dialogflow/v2/fulfillments/rest.rb +53 -0
  53. data/lib/google/cloud/dialogflow/v2/fulfillments.rb +6 -0
  54. data/lib/google/cloud/dialogflow/v2/intents/rest/client.rb +914 -0
  55. data/lib/google/cloud/dialogflow/v2/intents/rest/operations.rb +813 -0
  56. data/lib/google/cloud/dialogflow/v2/intents/rest/service_stub.rb +532 -0
  57. data/lib/google/cloud/dialogflow/v2/intents/rest.rb +54 -0
  58. data/lib/google/cloud/dialogflow/v2/intents.rb +6 -0
  59. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/client.rb +696 -0
  60. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/service_stub.rb +419 -0
  61. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest.rb +54 -0
  62. data/lib/google/cloud/dialogflow/v2/knowledge_bases.rb +6 -0
  63. data/lib/google/cloud/dialogflow/v2/participants/rest/client.rb +955 -0
  64. data/lib/google/cloud/dialogflow/v2/participants/rest/service_stub.rb +588 -0
  65. data/lib/google/cloud/dialogflow/v2/participants/rest.rb +53 -0
  66. data/lib/google/cloud/dialogflow/v2/participants.rb +6 -0
  67. data/lib/google/cloud/dialogflow/v2/rest.rb +54 -0
  68. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/client.rb +703 -0
  69. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/service_stub.rb +456 -0
  70. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest.rb +54 -0
  71. data/lib/google/cloud/dialogflow/v2/session_entity_types.rb +6 -0
  72. data/lib/google/cloud/dialogflow/v2/sessions/rest/client.rb +437 -0
  73. data/lib/google/cloud/dialogflow/v2/sessions/rest/service_stub.rb +132 -0
  74. data/lib/google/cloud/dialogflow/v2/sessions/rest.rb +56 -0
  75. data/lib/google/cloud/dialogflow/v2/sessions.rb +6 -0
  76. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  77. data/lib/google/cloud/dialogflow/v2/versions/rest/client.rb +686 -0
  78. data/lib/google/cloud/dialogflow/v2/versions/rest/service_stub.rb +382 -0
  79. data/lib/google/cloud/dialogflow/v2/versions/rest.rb +53 -0
  80. data/lib/google/cloud/dialogflow/v2/versions.rb +6 -0
  81. data/lib/google/cloud/dialogflow/v2.rb +5 -0
  82. metadata +66 -5
@@ -0,0 +1,819 @@
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/dialogflow/v2/conversation_pb"
21
+ require "google/cloud/dialogflow/v2/conversations/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Dialogflow
27
+ module V2
28
+ module Conversations
29
+ module Rest
30
+ ##
31
+ # REST client for the Conversations service.
32
+ #
33
+ # Service for managing
34
+ # {::Google::Cloud::Dialogflow::V2::Conversation Conversations}.
35
+ #
36
+ class Client
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :conversations_stub
41
+
42
+ ##
43
+ # Configure the Conversations Client class.
44
+ #
45
+ # See {::Google::Cloud::Dialogflow::V2::Conversations::Rest::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all Conversations clients
51
+ # ::Google::Cloud::Dialogflow::V2::Conversations::Rest::Client.configure do |config|
52
+ # config.timeout = 10.0
53
+ # end
54
+ #
55
+ # @yield [config] Configure the Client client.
56
+ # @yieldparam config [Client::Configuration]
57
+ #
58
+ # @return [Client::Configuration]
59
+ #
60
+ def self.configure
61
+ @configure ||= begin
62
+ namespace = ["Google", "Cloud", "Dialogflow", "V2"]
63
+ parent_config = while namespace.any?
64
+ parent_name = namespace.join "::"
65
+ parent_const = const_get parent_name
66
+ break parent_const.configure if parent_const.respond_to? :configure
67
+ namespace.pop
68
+ end
69
+ default_config = Client::Configuration.new parent_config
70
+
71
+ default_config.timeout = 60.0
72
+ default_config.retry_policy = {
73
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
74
+ }
75
+
76
+ default_config
77
+ end
78
+ yield @configure if block_given?
79
+ @configure
80
+ end
81
+
82
+ ##
83
+ # Configure the Conversations Client instance.
84
+ #
85
+ # The configuration is set to the derived mode, meaning that values can be changed,
86
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
87
+ # should be made on {Client.configure}.
88
+ #
89
+ # See {::Google::Cloud::Dialogflow::V2::Conversations::Rest::Client::Configuration}
90
+ # for a description of the configuration fields.
91
+ #
92
+ # @yield [config] Configure the Client client.
93
+ # @yieldparam config [Client::Configuration]
94
+ #
95
+ # @return [Client::Configuration]
96
+ #
97
+ def configure
98
+ yield @config if block_given?
99
+ @config
100
+ end
101
+
102
+ ##
103
+ # Create a new Conversations REST client object.
104
+ #
105
+ # @example
106
+ #
107
+ # # Create a client using the default configuration
108
+ # client = ::Google::Cloud::Dialogflow::V2::Conversations::Rest::Client.new
109
+ #
110
+ # # Create a client using a custom configuration
111
+ # client = ::Google::Cloud::Dialogflow::V2::Conversations::Rest::Client.new do |config|
112
+ # config.timeout = 10.0
113
+ # end
114
+ #
115
+ # @yield [config] Configure the Conversations client.
116
+ # @yieldparam config [Client::Configuration]
117
+ #
118
+ def initialize
119
+ # Create the configuration object
120
+ @config = Configuration.new Client.configure
121
+
122
+ # Yield the configuration if needed
123
+ yield @config if block_given?
124
+
125
+ # Create credentials
126
+ credentials = @config.credentials
127
+ # Use self-signed JWT if the endpoint is unchanged from default,
128
+ # but only if the default endpoint does not have a region prefix.
129
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
130
+ !@config.endpoint.split(".").first.include?("-")
131
+ credentials ||= Credentials.default scope: @config.scope,
132
+ enable_self_signed_jwt: enable_self_signed_jwt
133
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
134
+ credentials = Credentials.new credentials, scope: @config.scope
135
+ end
136
+
137
+ @quota_project_id = @config.quota_project
138
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
139
+
140
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
141
+ config.credentials = credentials
142
+ config.quota_project = @quota_project_id
143
+ config.endpoint = @config.endpoint
144
+ config.bindings_override = @config.bindings_override
145
+ end
146
+
147
+ @conversations_stub = ::Google::Cloud::Dialogflow::V2::Conversations::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
148
+ end
149
+
150
+ ##
151
+ # Get the associated client for mix-in of the Locations.
152
+ #
153
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
154
+ #
155
+ attr_reader :location_client
156
+
157
+ # Service calls
158
+
159
+ ##
160
+ # Creates a new conversation. Conversations are auto-completed after 24
161
+ # hours.
162
+ #
163
+ # Conversation Lifecycle:
164
+ # There are two stages during a conversation: Automated Agent Stage and
165
+ # Assist Stage.
166
+ #
167
+ # For Automated Agent Stage, there will be a dialogflow agent responding to
168
+ # user queries.
169
+ #
170
+ # For Assist Stage, there's no dialogflow agent responding to user queries.
171
+ # But we will provide suggestions which are generated from conversation.
172
+ #
173
+ # If
174
+ # {::Google::Cloud::Dialogflow::V2::Conversation#conversation_profile Conversation.conversation_profile}
175
+ # is configured for a dialogflow agent, conversation will start from
176
+ # `Automated Agent Stage`, otherwise, it will start from `Assist Stage`. And
177
+ # during `Automated Agent Stage`, once an
178
+ # {::Google::Cloud::Dialogflow::V2::Intent Intent} with
179
+ # {::Google::Cloud::Dialogflow::V2::Intent#live_agent_handoff Intent.live_agent_handoff}
180
+ # is triggered, conversation will transfer to Assist Stage.
181
+ #
182
+ # @overload create_conversation(request, options = nil)
183
+ # Pass arguments to `create_conversation` via a request object, either of type
184
+ # {::Google::Cloud::Dialogflow::V2::CreateConversationRequest} or an equivalent Hash.
185
+ #
186
+ # @param request [::Google::Cloud::Dialogflow::V2::CreateConversationRequest, ::Hash]
187
+ # A request object representing the call parameters. Required. To specify no
188
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
189
+ # @param options [::Gapic::CallOptions, ::Hash]
190
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
191
+ #
192
+ # @overload create_conversation(parent: nil, conversation: nil, conversation_id: nil)
193
+ # Pass arguments to `create_conversation` via keyword arguments. Note that at
194
+ # least one keyword argument is required. To specify no parameters, or to keep all
195
+ # the default parameter values, pass an empty Hash as a request object (see above).
196
+ #
197
+ # @param parent [::String]
198
+ # Required. Resource identifier of the project creating the conversation.
199
+ # Format: `projects/<Project ID>/locations/<Location ID>`.
200
+ # @param conversation [::Google::Cloud::Dialogflow::V2::Conversation, ::Hash]
201
+ # Required. The conversation to create.
202
+ # @param conversation_id [::String]
203
+ # Optional. Identifier of the conversation. Generally it's auto generated by
204
+ # Google. Only set it if you cannot wait for the response to return a
205
+ # auto-generated one to you.
206
+ #
207
+ # The conversation ID must be compliant with the regression fomula
208
+ # "[a-zA-Z][a-zA-Z0-9_-]*" with the characters length in range of [3,64].
209
+ # If the field is provided, the caller is resposible for
210
+ # 1. the uniqueness of the ID, otherwise the request will be rejected.
211
+ # 2. the consistency for whether to use custom ID or not under a project to
212
+ # better ensure uniqueness.
213
+ # @yield [result, operation] Access the result along with the TransportOperation object
214
+ # @yieldparam result [::Google::Cloud::Dialogflow::V2::Conversation]
215
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
216
+ #
217
+ # @return [::Google::Cloud::Dialogflow::V2::Conversation]
218
+ #
219
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
220
+ def create_conversation request, options = nil
221
+ raise ::ArgumentError, "request must be provided" if request.nil?
222
+
223
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::CreateConversationRequest
224
+
225
+ # Converts hash and nil to an options object
226
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
227
+
228
+ # Customize the options with defaults
229
+ call_metadata = @config.rpcs.create_conversation.metadata.to_h
230
+
231
+ # Set x-goog-api-client and x-goog-user-project headers
232
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
233
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
234
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
235
+ transports_version_send: [:rest]
236
+
237
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
238
+
239
+ options.apply_defaults timeout: @config.rpcs.create_conversation.timeout,
240
+ metadata: call_metadata,
241
+ retry_policy: @config.rpcs.create_conversation.retry_policy
242
+
243
+ options.apply_defaults timeout: @config.timeout,
244
+ metadata: @config.metadata,
245
+ retry_policy: @config.retry_policy
246
+
247
+ @conversations_stub.create_conversation request, options do |result, operation|
248
+ yield result, operation if block_given?
249
+ return result
250
+ end
251
+ rescue ::Gapic::Rest::Error => e
252
+ raise ::Google::Cloud::Error.from_error(e)
253
+ end
254
+
255
+ ##
256
+ # Returns the list of all conversations in the specified project.
257
+ #
258
+ # @overload list_conversations(request, options = nil)
259
+ # Pass arguments to `list_conversations` via a request object, either of type
260
+ # {::Google::Cloud::Dialogflow::V2::ListConversationsRequest} or an equivalent Hash.
261
+ #
262
+ # @param request [::Google::Cloud::Dialogflow::V2::ListConversationsRequest, ::Hash]
263
+ # A request object representing the call parameters. Required. To specify no
264
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
265
+ # @param options [::Gapic::CallOptions, ::Hash]
266
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
267
+ #
268
+ # @overload list_conversations(parent: nil, page_size: nil, page_token: nil, filter: nil)
269
+ # Pass arguments to `list_conversations` via keyword arguments. Note that at
270
+ # least one keyword argument is required. To specify no parameters, or to keep all
271
+ # the default parameter values, pass an empty Hash as a request object (see above).
272
+ #
273
+ # @param parent [::String]
274
+ # Required. The project from which to list all conversation.
275
+ # Format: `projects/<Project ID>/locations/<Location ID>`.
276
+ # @param page_size [::Integer]
277
+ # Optional. The maximum number of items to return in a single page. By
278
+ # default 100 and at most 1000.
279
+ # @param page_token [::String]
280
+ # Optional. The next_page_token value returned from a previous list request.
281
+ # @param filter [::String]
282
+ # A filter expression that filters conversations listed in the response. In
283
+ # general, the expression must specify the field name, a comparison operator,
284
+ # and the value to use for filtering:
285
+ # <ul>
286
+ # <li>The value must be a string, a number, or a boolean.</li>
287
+ # <li>The comparison operator must be either `=`,`!=`, `>`, or `<`.</li>
288
+ # <li>To filter on multiple expressions, separate the
289
+ # expressions with `AND` or `OR` (omitting both implies `AND`).</li>
290
+ # <li>For clarity, expressions can be enclosed in parentheses.</li>
291
+ # </ul>
292
+ # Only `lifecycle_state` can be filtered on in this way. For example,
293
+ # the following expression only returns `COMPLETED` conversations:
294
+ #
295
+ # `lifecycle_state = "COMPLETED"`
296
+ #
297
+ # For more information about filtering, see
298
+ # [API Filtering](https://aip.dev/160).
299
+ # @yield [result, operation] Access the result along with the TransportOperation object
300
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Conversation>]
301
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
302
+ #
303
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Conversation>]
304
+ #
305
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
306
+ def list_conversations request, options = nil
307
+ raise ::ArgumentError, "request must be provided" if request.nil?
308
+
309
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ListConversationsRequest
310
+
311
+ # Converts hash and nil to an options object
312
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
313
+
314
+ # Customize the options with defaults
315
+ call_metadata = @config.rpcs.list_conversations.metadata.to_h
316
+
317
+ # Set x-goog-api-client and x-goog-user-project headers
318
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
319
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
320
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
321
+ transports_version_send: [:rest]
322
+
323
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
324
+
325
+ options.apply_defaults timeout: @config.rpcs.list_conversations.timeout,
326
+ metadata: call_metadata,
327
+ retry_policy: @config.rpcs.list_conversations.retry_policy
328
+
329
+ options.apply_defaults timeout: @config.timeout,
330
+ metadata: @config.metadata,
331
+ retry_policy: @config.retry_policy
332
+
333
+ @conversations_stub.list_conversations request, options do |result, operation|
334
+ result = ::Gapic::Rest::PagedEnumerable.new @conversations_stub, :list_conversations, "conversations", request, result, options
335
+ yield result, operation if block_given?
336
+ return result
337
+ end
338
+ rescue ::Gapic::Rest::Error => e
339
+ raise ::Google::Cloud::Error.from_error(e)
340
+ end
341
+
342
+ ##
343
+ # Retrieves the specific conversation.
344
+ #
345
+ # @overload get_conversation(request, options = nil)
346
+ # Pass arguments to `get_conversation` via a request object, either of type
347
+ # {::Google::Cloud::Dialogflow::V2::GetConversationRequest} or an equivalent Hash.
348
+ #
349
+ # @param request [::Google::Cloud::Dialogflow::V2::GetConversationRequest, ::Hash]
350
+ # A request object representing the call parameters. Required. To specify no
351
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
352
+ # @param options [::Gapic::CallOptions, ::Hash]
353
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
354
+ #
355
+ # @overload get_conversation(name: nil)
356
+ # Pass arguments to `get_conversation` via keyword arguments. Note that at
357
+ # least one keyword argument is required. To specify no parameters, or to keep all
358
+ # the default parameter values, pass an empty Hash as a request object (see above).
359
+ #
360
+ # @param name [::String]
361
+ # Required. The name of the conversation. Format:
362
+ # `projects/<Project ID>/locations/<Location ID>/conversations/<Conversation
363
+ # ID>`.
364
+ # @yield [result, operation] Access the result along with the TransportOperation object
365
+ # @yieldparam result [::Google::Cloud::Dialogflow::V2::Conversation]
366
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
367
+ #
368
+ # @return [::Google::Cloud::Dialogflow::V2::Conversation]
369
+ #
370
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
371
+ def get_conversation request, options = nil
372
+ raise ::ArgumentError, "request must be provided" if request.nil?
373
+
374
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GetConversationRequest
375
+
376
+ # Converts hash and nil to an options object
377
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
378
+
379
+ # Customize the options with defaults
380
+ call_metadata = @config.rpcs.get_conversation.metadata.to_h
381
+
382
+ # Set x-goog-api-client and x-goog-user-project headers
383
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
384
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
385
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
386
+ transports_version_send: [:rest]
387
+
388
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
389
+
390
+ options.apply_defaults timeout: @config.rpcs.get_conversation.timeout,
391
+ metadata: call_metadata,
392
+ retry_policy: @config.rpcs.get_conversation.retry_policy
393
+
394
+ options.apply_defaults timeout: @config.timeout,
395
+ metadata: @config.metadata,
396
+ retry_policy: @config.retry_policy
397
+
398
+ @conversations_stub.get_conversation request, options do |result, operation|
399
+ yield result, operation if block_given?
400
+ return result
401
+ end
402
+ rescue ::Gapic::Rest::Error => e
403
+ raise ::Google::Cloud::Error.from_error(e)
404
+ end
405
+
406
+ ##
407
+ # Completes the specified conversation. Finished conversations are purged
408
+ # from the database after 30 days.
409
+ #
410
+ # @overload complete_conversation(request, options = nil)
411
+ # Pass arguments to `complete_conversation` via a request object, either of type
412
+ # {::Google::Cloud::Dialogflow::V2::CompleteConversationRequest} or an equivalent Hash.
413
+ #
414
+ # @param request [::Google::Cloud::Dialogflow::V2::CompleteConversationRequest, ::Hash]
415
+ # A request object representing the call parameters. Required. To specify no
416
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
417
+ # @param options [::Gapic::CallOptions, ::Hash]
418
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
419
+ #
420
+ # @overload complete_conversation(name: nil)
421
+ # Pass arguments to `complete_conversation` via keyword arguments. Note that at
422
+ # least one keyword argument is required. To specify no parameters, or to keep all
423
+ # the default parameter values, pass an empty Hash as a request object (see above).
424
+ #
425
+ # @param name [::String]
426
+ # Required. Resource identifier of the conversation to close.
427
+ # Format: `projects/<Project ID>/locations/<Location
428
+ # ID>/conversations/<Conversation ID>`.
429
+ # @yield [result, operation] Access the result along with the TransportOperation object
430
+ # @yieldparam result [::Google::Cloud::Dialogflow::V2::Conversation]
431
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
432
+ #
433
+ # @return [::Google::Cloud::Dialogflow::V2::Conversation]
434
+ #
435
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
436
+ def complete_conversation request, options = nil
437
+ raise ::ArgumentError, "request must be provided" if request.nil?
438
+
439
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::CompleteConversationRequest
440
+
441
+ # Converts hash and nil to an options object
442
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
443
+
444
+ # Customize the options with defaults
445
+ call_metadata = @config.rpcs.complete_conversation.metadata.to_h
446
+
447
+ # Set x-goog-api-client and x-goog-user-project headers
448
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
449
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
450
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
451
+ transports_version_send: [:rest]
452
+
453
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
454
+
455
+ options.apply_defaults timeout: @config.rpcs.complete_conversation.timeout,
456
+ metadata: call_metadata,
457
+ retry_policy: @config.rpcs.complete_conversation.retry_policy
458
+
459
+ options.apply_defaults timeout: @config.timeout,
460
+ metadata: @config.metadata,
461
+ retry_policy: @config.retry_policy
462
+
463
+ @conversations_stub.complete_conversation request, options do |result, operation|
464
+ yield result, operation if block_given?
465
+ return result
466
+ end
467
+ rescue ::Gapic::Rest::Error => e
468
+ raise ::Google::Cloud::Error.from_error(e)
469
+ end
470
+
471
+ ##
472
+ # Lists messages that belong to a given conversation.
473
+ # `messages` are ordered by `create_time` in descending order. To fetch
474
+ # updates without duplication, send request with filter
475
+ # `create_time_epoch_microseconds >
476
+ # [first item's create_time of previous request]` and empty page_token.
477
+ #
478
+ # @overload list_messages(request, options = nil)
479
+ # Pass arguments to `list_messages` via a request object, either of type
480
+ # {::Google::Cloud::Dialogflow::V2::ListMessagesRequest} or an equivalent Hash.
481
+ #
482
+ # @param request [::Google::Cloud::Dialogflow::V2::ListMessagesRequest, ::Hash]
483
+ # A request object representing the call parameters. Required. To specify no
484
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
485
+ # @param options [::Gapic::CallOptions, ::Hash]
486
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
487
+ #
488
+ # @overload list_messages(parent: nil, filter: nil, page_size: nil, page_token: nil)
489
+ # Pass arguments to `list_messages` via keyword arguments. Note that at
490
+ # least one keyword argument is required. To specify no parameters, or to keep all
491
+ # the default parameter values, pass an empty Hash as a request object (see above).
492
+ #
493
+ # @param parent [::String]
494
+ # Required. The name of the conversation to list messages for.
495
+ # Format: `projects/<Project ID>/locations/<Location
496
+ # ID>/conversations/<Conversation ID>`
497
+ # @param filter [::String]
498
+ # Optional. Filter on message fields. Currently predicates on `create_time`
499
+ # and `create_time_epoch_microseconds` are supported. `create_time` only
500
+ # support milliseconds accuracy. E.g.,
501
+ # `create_time_epoch_microseconds > 1551790877964485` or
502
+ # `create_time > 2017-01-15T01:30:15.01Z`.
503
+ #
504
+ # For more information about filtering, see
505
+ # [API Filtering](https://aip.dev/160).
506
+ # @param page_size [::Integer]
507
+ # Optional. The maximum number of items to return in a single page. By
508
+ # default 100 and at most 1000.
509
+ # @param page_token [::String]
510
+ # Optional. The next_page_token value returned from a previous list request.
511
+ # @yield [result, operation] Access the result along with the TransportOperation object
512
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Message>]
513
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
514
+ #
515
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Message>]
516
+ #
517
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
518
+ def list_messages request, options = nil
519
+ raise ::ArgumentError, "request must be provided" if request.nil?
520
+
521
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ListMessagesRequest
522
+
523
+ # Converts hash and nil to an options object
524
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
525
+
526
+ # Customize the options with defaults
527
+ call_metadata = @config.rpcs.list_messages.metadata.to_h
528
+
529
+ # Set x-goog-api-client and x-goog-user-project headers
530
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
531
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
532
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
533
+ transports_version_send: [:rest]
534
+
535
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
536
+
537
+ options.apply_defaults timeout: @config.rpcs.list_messages.timeout,
538
+ metadata: call_metadata,
539
+ retry_policy: @config.rpcs.list_messages.retry_policy
540
+
541
+ options.apply_defaults timeout: @config.timeout,
542
+ metadata: @config.metadata,
543
+ retry_policy: @config.retry_policy
544
+
545
+ @conversations_stub.list_messages request, options do |result, operation|
546
+ result = ::Gapic::Rest::PagedEnumerable.new @conversations_stub, :list_messages, "messages", request, result, options
547
+ yield result, operation if block_given?
548
+ return result
549
+ end
550
+ rescue ::Gapic::Rest::Error => e
551
+ raise ::Google::Cloud::Error.from_error(e)
552
+ end
553
+
554
+ ##
555
+ # Suggests summary for a conversation based on specific historical messages.
556
+ # The range of the messages to be used for summary can be specified in the
557
+ # request.
558
+ #
559
+ # @overload suggest_conversation_summary(request, options = nil)
560
+ # Pass arguments to `suggest_conversation_summary` via a request object, either of type
561
+ # {::Google::Cloud::Dialogflow::V2::SuggestConversationSummaryRequest} or an equivalent Hash.
562
+ #
563
+ # @param request [::Google::Cloud::Dialogflow::V2::SuggestConversationSummaryRequest, ::Hash]
564
+ # A request object representing the call parameters. Required. To specify no
565
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
566
+ # @param options [::Gapic::CallOptions, ::Hash]
567
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
568
+ #
569
+ # @overload suggest_conversation_summary(conversation: nil, latest_message: nil, context_size: nil, assist_query_params: nil)
570
+ # Pass arguments to `suggest_conversation_summary` via keyword arguments. Note that at
571
+ # least one keyword argument is required. To specify no parameters, or to keep all
572
+ # the default parameter values, pass an empty Hash as a request object (see above).
573
+ #
574
+ # @param conversation [::String]
575
+ # Required. The conversation to fetch suggestion for.
576
+ # Format: `projects/<Project ID>/locations/<Location
577
+ # ID>/conversations/<Conversation ID>`.
578
+ # @param latest_message [::String]
579
+ # The name of the latest conversation message used as context for
580
+ # compiling suggestion. If empty, the latest message of the conversation will
581
+ # be used.
582
+ #
583
+ # Format: `projects/<Project ID>/locations/<Location
584
+ # ID>/conversations/<Conversation ID>/messages/<Message ID>`.
585
+ # @param context_size [::Integer]
586
+ # Max number of messages prior to and including
587
+ # [latest_message] to use as context when compiling the
588
+ # suggestion. By default 500 and at most 1000.
589
+ # @param assist_query_params [::Google::Cloud::Dialogflow::V2::AssistQueryParameters, ::Hash]
590
+ # Parameters for a human assist query.
591
+ # @yield [result, operation] Access the result along with the TransportOperation object
592
+ # @yieldparam result [::Google::Cloud::Dialogflow::V2::SuggestConversationSummaryResponse]
593
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
594
+ #
595
+ # @return [::Google::Cloud::Dialogflow::V2::SuggestConversationSummaryResponse]
596
+ #
597
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
598
+ def suggest_conversation_summary request, options = nil
599
+ raise ::ArgumentError, "request must be provided" if request.nil?
600
+
601
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::SuggestConversationSummaryRequest
602
+
603
+ # Converts hash and nil to an options object
604
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
605
+
606
+ # Customize the options with defaults
607
+ call_metadata = @config.rpcs.suggest_conversation_summary.metadata.to_h
608
+
609
+ # Set x-goog-api-client and x-goog-user-project headers
610
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
611
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
612
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
613
+ transports_version_send: [:rest]
614
+
615
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
616
+
617
+ options.apply_defaults timeout: @config.rpcs.suggest_conversation_summary.timeout,
618
+ metadata: call_metadata,
619
+ retry_policy: @config.rpcs.suggest_conversation_summary.retry_policy
620
+
621
+ options.apply_defaults timeout: @config.timeout,
622
+ metadata: @config.metadata,
623
+ retry_policy: @config.retry_policy
624
+
625
+ @conversations_stub.suggest_conversation_summary request, options do |result, operation|
626
+ yield result, operation if block_given?
627
+ return result
628
+ end
629
+ rescue ::Gapic::Rest::Error => e
630
+ raise ::Google::Cloud::Error.from_error(e)
631
+ end
632
+
633
+ ##
634
+ # Configuration class for the Conversations REST API.
635
+ #
636
+ # This class represents the configuration for Conversations REST,
637
+ # providing control over timeouts, retry behavior, logging, transport
638
+ # parameters, and other low-level controls. Certain parameters can also be
639
+ # applied individually to specific RPCs. See
640
+ # {::Google::Cloud::Dialogflow::V2::Conversations::Rest::Client::Configuration::Rpcs}
641
+ # for a list of RPCs that can be configured independently.
642
+ #
643
+ # Configuration can be applied globally to all clients, or to a single client
644
+ # on construction.
645
+ #
646
+ # @example
647
+ #
648
+ # # Modify the global config, setting the timeout for
649
+ # # create_conversation to 20 seconds,
650
+ # # and all remaining timeouts to 10 seconds.
651
+ # ::Google::Cloud::Dialogflow::V2::Conversations::Rest::Client.configure do |config|
652
+ # config.timeout = 10.0
653
+ # config.rpcs.create_conversation.timeout = 20.0
654
+ # end
655
+ #
656
+ # # Apply the above configuration only to a new client.
657
+ # client = ::Google::Cloud::Dialogflow::V2::Conversations::Rest::Client.new do |config|
658
+ # config.timeout = 10.0
659
+ # config.rpcs.create_conversation.timeout = 20.0
660
+ # end
661
+ #
662
+ # @!attribute [rw] endpoint
663
+ # The hostname or hostname:port of the service endpoint.
664
+ # Defaults to `"dialogflow.googleapis.com"`.
665
+ # @return [::String]
666
+ # @!attribute [rw] credentials
667
+ # Credentials to send with calls. You may provide any of the following types:
668
+ # * (`String`) The path to a service account key file in JSON format
669
+ # * (`Hash`) A service account key as a Hash
670
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
671
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
672
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
673
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
674
+ # * (`nil`) indicating no credentials
675
+ # @return [::Object]
676
+ # @!attribute [rw] scope
677
+ # The OAuth scopes
678
+ # @return [::Array<::String>]
679
+ # @!attribute [rw] lib_name
680
+ # The library name as recorded in instrumentation and logging
681
+ # @return [::String]
682
+ # @!attribute [rw] lib_version
683
+ # The library version as recorded in instrumentation and logging
684
+ # @return [::String]
685
+ # @!attribute [rw] timeout
686
+ # The call timeout in seconds.
687
+ # @return [::Numeric]
688
+ # @!attribute [rw] metadata
689
+ # Additional headers to be sent with the call.
690
+ # @return [::Hash{::Symbol=>::String}]
691
+ # @!attribute [rw] retry_policy
692
+ # The retry policy. The value is a hash with the following keys:
693
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
694
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
695
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
696
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
697
+ # trigger a retry.
698
+ # @return [::Hash]
699
+ # @!attribute [rw] quota_project
700
+ # A separate project against which to charge quota.
701
+ # @return [::String]
702
+ #
703
+ class Configuration
704
+ extend ::Gapic::Config
705
+
706
+ config_attr :endpoint, "dialogflow.googleapis.com", ::String
707
+ config_attr :credentials, nil do |value|
708
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
709
+ allowed.any? { |klass| klass === value }
710
+ end
711
+ config_attr :scope, nil, ::String, ::Array, nil
712
+ config_attr :lib_name, nil, ::String, nil
713
+ config_attr :lib_version, nil, ::String, nil
714
+ config_attr :timeout, nil, ::Numeric, nil
715
+ config_attr :metadata, nil, ::Hash, nil
716
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
717
+ config_attr :quota_project, nil, ::String, nil
718
+
719
+ # @private
720
+ # Overrides for http bindings for the RPCs of this service
721
+ # are only used when this service is used as mixin, and only
722
+ # by the host service.
723
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
724
+ config_attr :bindings_override, {}, ::Hash, nil
725
+
726
+ # @private
727
+ def initialize parent_config = nil
728
+ @parent_config = parent_config unless parent_config.nil?
729
+
730
+ yield self if block_given?
731
+ end
732
+
733
+ ##
734
+ # Configurations for individual RPCs
735
+ # @return [Rpcs]
736
+ #
737
+ def rpcs
738
+ @rpcs ||= begin
739
+ parent_rpcs = nil
740
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
741
+ Rpcs.new parent_rpcs
742
+ end
743
+ end
744
+
745
+ ##
746
+ # Configuration RPC class for the Conversations API.
747
+ #
748
+ # Includes fields providing the configuration for each RPC in this service.
749
+ # Each configuration object is of type `Gapic::Config::Method` and includes
750
+ # the following configuration fields:
751
+ #
752
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
753
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
754
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
755
+ # include the following keys:
756
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
757
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
758
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
759
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
760
+ # trigger a retry.
761
+ #
762
+ class Rpcs
763
+ ##
764
+ # RPC-specific configuration for `create_conversation`
765
+ # @return [::Gapic::Config::Method]
766
+ #
767
+ attr_reader :create_conversation
768
+ ##
769
+ # RPC-specific configuration for `list_conversations`
770
+ # @return [::Gapic::Config::Method]
771
+ #
772
+ attr_reader :list_conversations
773
+ ##
774
+ # RPC-specific configuration for `get_conversation`
775
+ # @return [::Gapic::Config::Method]
776
+ #
777
+ attr_reader :get_conversation
778
+ ##
779
+ # RPC-specific configuration for `complete_conversation`
780
+ # @return [::Gapic::Config::Method]
781
+ #
782
+ attr_reader :complete_conversation
783
+ ##
784
+ # RPC-specific configuration for `list_messages`
785
+ # @return [::Gapic::Config::Method]
786
+ #
787
+ attr_reader :list_messages
788
+ ##
789
+ # RPC-specific configuration for `suggest_conversation_summary`
790
+ # @return [::Gapic::Config::Method]
791
+ #
792
+ attr_reader :suggest_conversation_summary
793
+
794
+ # @private
795
+ def initialize parent_rpcs = nil
796
+ create_conversation_config = parent_rpcs.create_conversation if parent_rpcs.respond_to? :create_conversation
797
+ @create_conversation = ::Gapic::Config::Method.new create_conversation_config
798
+ list_conversations_config = parent_rpcs.list_conversations if parent_rpcs.respond_to? :list_conversations
799
+ @list_conversations = ::Gapic::Config::Method.new list_conversations_config
800
+ get_conversation_config = parent_rpcs.get_conversation if parent_rpcs.respond_to? :get_conversation
801
+ @get_conversation = ::Gapic::Config::Method.new get_conversation_config
802
+ complete_conversation_config = parent_rpcs.complete_conversation if parent_rpcs.respond_to? :complete_conversation
803
+ @complete_conversation = ::Gapic::Config::Method.new complete_conversation_config
804
+ list_messages_config = parent_rpcs.list_messages if parent_rpcs.respond_to? :list_messages
805
+ @list_messages = ::Gapic::Config::Method.new list_messages_config
806
+ suggest_conversation_summary_config = parent_rpcs.suggest_conversation_summary if parent_rpcs.respond_to? :suggest_conversation_summary
807
+ @suggest_conversation_summary = ::Gapic::Config::Method.new suggest_conversation_summary_config
808
+
809
+ yield self if block_given?
810
+ end
811
+ end
812
+ end
813
+ end
814
+ end
815
+ end
816
+ end
817
+ end
818
+ end
819
+ end