aws-sdk-lexruntimev2 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,949 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ require 'seahorse/client/plugins/content_length.rb'
11
+ require 'aws-sdk-core/plugins/credentials_configuration.rb'
12
+ require 'aws-sdk-core/plugins/logging.rb'
13
+ require 'aws-sdk-core/plugins/param_converter.rb'
14
+ require 'aws-sdk-core/plugins/param_validator.rb'
15
+ require 'aws-sdk-core/plugins/user_agent.rb'
16
+ require 'aws-sdk-core/plugins/helpful_socket_errors.rb'
17
+ require 'aws-sdk-core/plugins/retry_errors.rb'
18
+ require 'aws-sdk-core/plugins/global_configuration.rb'
19
+ require 'aws-sdk-core/plugins/regional_endpoint.rb'
20
+ require 'aws-sdk-core/plugins/endpoint_discovery.rb'
21
+ require 'aws-sdk-core/plugins/endpoint_pattern.rb'
22
+ require 'aws-sdk-core/plugins/response_paging.rb'
23
+ require 'aws-sdk-core/plugins/stub_responses.rb'
24
+ require 'aws-sdk-core/plugins/idempotency_token.rb'
25
+ require 'aws-sdk-core/plugins/jsonvalue_converter.rb'
26
+ require 'aws-sdk-core/plugins/client_metrics_plugin.rb'
27
+ require 'aws-sdk-core/plugins/client_metrics_send_plugin.rb'
28
+ require 'aws-sdk-core/plugins/transfer_encoding.rb'
29
+ require 'aws-sdk-core/plugins/http_checksum.rb'
30
+ require 'aws-sdk-core/plugins/signature_v4.rb'
31
+ require 'aws-sdk-core/plugins/protocols/rest_json.rb'
32
+ require 'aws-sdk-core/plugins/event_stream_configuration.rb'
33
+
34
+ Aws::Plugins::GlobalConfiguration.add_identifier(:lexruntimev2)
35
+
36
+ module Aws::LexRuntimeV2
37
+ # An API client for LexRuntimeV2. To construct a client, you need to configure a `:region` and `:credentials`.
38
+ #
39
+ # client = Aws::LexRuntimeV2::Client.new(
40
+ # region: region_name,
41
+ # credentials: credentials,
42
+ # # ...
43
+ # )
44
+ #
45
+ # For details on configuring region and credentials see
46
+ # the [developer guide](/sdk-for-ruby/v3/developer-guide/setup-config.html).
47
+ #
48
+ # See {#initialize} for a full list of supported configuration options.
49
+ class Client < Seahorse::Client::Base
50
+
51
+ include Aws::ClientStubs
52
+
53
+ @identifier = :lexruntimev2
54
+
55
+ set_api(ClientApi::API)
56
+
57
+ add_plugin(Seahorse::Client::Plugins::ContentLength)
58
+ add_plugin(Aws::Plugins::CredentialsConfiguration)
59
+ add_plugin(Aws::Plugins::Logging)
60
+ add_plugin(Aws::Plugins::ParamConverter)
61
+ add_plugin(Aws::Plugins::ParamValidator)
62
+ add_plugin(Aws::Plugins::UserAgent)
63
+ add_plugin(Aws::Plugins::HelpfulSocketErrors)
64
+ add_plugin(Aws::Plugins::RetryErrors)
65
+ add_plugin(Aws::Plugins::GlobalConfiguration)
66
+ add_plugin(Aws::Plugins::RegionalEndpoint)
67
+ add_plugin(Aws::Plugins::EndpointDiscovery)
68
+ add_plugin(Aws::Plugins::EndpointPattern)
69
+ add_plugin(Aws::Plugins::ResponsePaging)
70
+ add_plugin(Aws::Plugins::StubResponses)
71
+ add_plugin(Aws::Plugins::IdempotencyToken)
72
+ add_plugin(Aws::Plugins::JsonvalueConverter)
73
+ add_plugin(Aws::Plugins::ClientMetricsPlugin)
74
+ add_plugin(Aws::Plugins::ClientMetricsSendPlugin)
75
+ add_plugin(Aws::Plugins::TransferEncoding)
76
+ add_plugin(Aws::Plugins::HttpChecksum)
77
+ add_plugin(Aws::Plugins::SignatureV4)
78
+ add_plugin(Aws::Plugins::Protocols::RestJson)
79
+ add_plugin(Aws::Plugins::EventStreamConfiguration)
80
+
81
+ # @overload initialize(options)
82
+ # @param [Hash] options
83
+ # @option options [required, Aws::CredentialProvider] :credentials
84
+ # Your AWS credentials. This can be an instance of any one of the
85
+ # following classes:
86
+ #
87
+ # * `Aws::Credentials` - Used for configuring static, non-refreshing
88
+ # credentials.
89
+ #
90
+ # * `Aws::SharedCredentials` - Used for loading static credentials from a
91
+ # shared file, such as `~/.aws/config`.
92
+ #
93
+ # * `Aws::AssumeRoleCredentials` - Used when you need to assume a role.
94
+ #
95
+ # * `Aws::AssumeRoleWebIdentityCredentials` - Used when you need to
96
+ # assume a role after providing credentials via the web.
97
+ #
98
+ # * `Aws::SSOCredentials` - Used for loading credentials from AWS SSO using an
99
+ # access token generated from `aws login`.
100
+ #
101
+ # * `Aws::ProcessCredentials` - Used for loading credentials from a
102
+ # process that outputs to stdout.
103
+ #
104
+ # * `Aws::InstanceProfileCredentials` - Used for loading credentials
105
+ # from an EC2 IMDS on an EC2 instance.
106
+ #
107
+ # * `Aws::ECSCredentials` - Used for loading credentials from
108
+ # instances running in ECS.
109
+ #
110
+ # * `Aws::CognitoIdentityCredentials` - Used for loading credentials
111
+ # from the Cognito Identity service.
112
+ #
113
+ # When `:credentials` are not configured directly, the following
114
+ # locations will be searched for credentials:
115
+ #
116
+ # * `Aws.config[:credentials]`
117
+ # * The `:access_key_id`, `:secret_access_key`, and `:session_token` options.
118
+ # * ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
119
+ # * `~/.aws/credentials`
120
+ # * `~/.aws/config`
121
+ # * EC2/ECS IMDS instance profile - When used by default, the timeouts
122
+ # are very aggressive. Construct and pass an instance of
123
+ # `Aws::InstanceProfileCredentails` or `Aws::ECSCredentials` to
124
+ # enable retries and extended timeouts.
125
+ #
126
+ # @option options [required, String] :region
127
+ # The AWS region to connect to. The configured `:region` is
128
+ # used to determine the service `:endpoint`. When not passed,
129
+ # a default `:region` is searched for in the following locations:
130
+ #
131
+ # * `Aws.config[:region]`
132
+ # * `ENV['AWS_REGION']`
133
+ # * `ENV['AMAZON_REGION']`
134
+ # * `ENV['AWS_DEFAULT_REGION']`
135
+ # * `~/.aws/credentials`
136
+ # * `~/.aws/config`
137
+ #
138
+ # @option options [String] :access_key_id
139
+ #
140
+ # @option options [Boolean] :active_endpoint_cache (false)
141
+ # When set to `true`, a thread polling for endpoints will be running in
142
+ # the background every 60 secs (default). Defaults to `false`.
143
+ #
144
+ # @option options [Boolean] :adaptive_retry_wait_to_fill (true)
145
+ # Used only in `adaptive` retry mode. When true, the request will sleep
146
+ # until there is sufficent client side capacity to retry the request.
147
+ # When false, the request will raise a `RetryCapacityNotAvailableError` and will
148
+ # not retry instead of sleeping.
149
+ #
150
+ # @option options [Boolean] :client_side_monitoring (false)
151
+ # When `true`, client-side metrics will be collected for all API requests from
152
+ # this client.
153
+ #
154
+ # @option options [String] :client_side_monitoring_client_id ("")
155
+ # Allows you to provide an identifier for this client which will be attached to
156
+ # all generated client side metrics. Defaults to an empty string.
157
+ #
158
+ # @option options [String] :client_side_monitoring_host ("127.0.0.1")
159
+ # Allows you to specify the DNS hostname or IPv4 or IPv6 address that the client
160
+ # side monitoring agent is running on, where client metrics will be published via UDP.
161
+ #
162
+ # @option options [Integer] :client_side_monitoring_port (31000)
163
+ # Required for publishing client metrics. The port that the client side monitoring
164
+ # agent is running on, where client metrics will be published via UDP.
165
+ #
166
+ # @option options [Aws::ClientSideMonitoring::Publisher] :client_side_monitoring_publisher (Aws::ClientSideMonitoring::Publisher)
167
+ # Allows you to provide a custom client-side monitoring publisher class. By default,
168
+ # will use the Client Side Monitoring Agent Publisher.
169
+ #
170
+ # @option options [Boolean] :convert_params (true)
171
+ # When `true`, an attempt is made to coerce request parameters into
172
+ # the required types.
173
+ #
174
+ # @option options [Boolean] :correct_clock_skew (true)
175
+ # Used only in `standard` and adaptive retry modes. Specifies whether to apply
176
+ # a clock skew correction and retry requests with skewed client clocks.
177
+ #
178
+ # @option options [Boolean] :disable_host_prefix_injection (false)
179
+ # Set to true to disable SDK automatically adding host prefix
180
+ # to default service endpoint when available.
181
+ #
182
+ # @option options [String] :endpoint
183
+ # The client endpoint is normally constructed from the `:region`
184
+ # option. You should only configure an `:endpoint` when connecting
185
+ # to test or custom endpoints. This should be a valid HTTP(S) URI.
186
+ #
187
+ # @option options [Integer] :endpoint_cache_max_entries (1000)
188
+ # Used for the maximum size limit of the LRU cache storing endpoints data
189
+ # for endpoint discovery enabled operations. Defaults to 1000.
190
+ #
191
+ # @option options [Integer] :endpoint_cache_max_threads (10)
192
+ # Used for the maximum threads in use for polling endpoints to be cached, defaults to 10.
193
+ #
194
+ # @option options [Integer] :endpoint_cache_poll_interval (60)
195
+ # When :endpoint_discovery and :active_endpoint_cache is enabled,
196
+ # Use this option to config the time interval in seconds for making
197
+ # requests fetching endpoints information. Defaults to 60 sec.
198
+ #
199
+ # @option options [Boolean] :endpoint_discovery (false)
200
+ # When set to `true`, endpoint discovery will be enabled for operations when available.
201
+ #
202
+ # @option options [Proc] :event_stream_handler
203
+ # When an EventStream or Proc object is provided, it will be used as callback for each chunk of event stream response received along the way.
204
+ #
205
+ # @option options [Proc] :input_event_stream_handler
206
+ # When an EventStream or Proc object is provided, it can be used for sending events for the event stream.
207
+ #
208
+ # @option options [Aws::Log::Formatter] :log_formatter (Aws::Log::Formatter.default)
209
+ # The log formatter.
210
+ #
211
+ # @option options [Symbol] :log_level (:info)
212
+ # The log level to send messages to the `:logger` at.
213
+ #
214
+ # @option options [Logger] :logger
215
+ # The Logger instance to send log messages to. If this option
216
+ # is not set, logging will be disabled.
217
+ #
218
+ # @option options [Integer] :max_attempts (3)
219
+ # An integer representing the maximum number attempts that will be made for
220
+ # a single request, including the initial attempt. For example,
221
+ # setting this value to 5 will result in a request being retried up to
222
+ # 4 times. Used in `standard` and `adaptive` retry modes.
223
+ #
224
+ # @option options [Proc] :output_event_stream_handler
225
+ # When an EventStream or Proc object is provided, it will be used as callback for each chunk of event stream response received along the way.
226
+ #
227
+ # @option options [String] :profile ("default")
228
+ # Used when loading credentials from the shared credentials file
229
+ # at HOME/.aws/credentials. When not specified, 'default' is used.
230
+ #
231
+ # @option options [Proc] :retry_backoff
232
+ # A proc or lambda used for backoff. Defaults to 2**retries * retry_base_delay.
233
+ # This option is only used in the `legacy` retry mode.
234
+ #
235
+ # @option options [Float] :retry_base_delay (0.3)
236
+ # The base delay in seconds used by the default backoff function. This option
237
+ # is only used in the `legacy` retry mode.
238
+ #
239
+ # @option options [Symbol] :retry_jitter (:none)
240
+ # A delay randomiser function used by the default backoff function.
241
+ # Some predefined functions can be referenced by name - :none, :equal, :full,
242
+ # otherwise a Proc that takes and returns a number. This option is only used
243
+ # in the `legacy` retry mode.
244
+ #
245
+ # @see https://www.awsarchitectureblog.com/2015/03/backoff.html
246
+ #
247
+ # @option options [Integer] :retry_limit (3)
248
+ # The maximum number of times to retry failed requests. Only
249
+ # ~ 500 level server errors and certain ~ 400 level client errors
250
+ # are retried. Generally, these are throttling errors, data
251
+ # checksum errors, networking errors, timeout errors, auth errors,
252
+ # endpoint discovery, and errors from expired credentials.
253
+ # This option is only used in the `legacy` retry mode.
254
+ #
255
+ # @option options [Integer] :retry_max_delay (0)
256
+ # The maximum number of seconds to delay between retries (0 for no limit)
257
+ # used by the default backoff function. This option is only used in the
258
+ # `legacy` retry mode.
259
+ #
260
+ # @option options [String] :retry_mode ("legacy")
261
+ # Specifies which retry algorithm to use. Values are:
262
+ #
263
+ # * `legacy` - The pre-existing retry behavior. This is default value if
264
+ # no retry mode is provided.
265
+ #
266
+ # * `standard` - A standardized set of retry rules across the AWS SDKs.
267
+ # This includes support for retry quotas, which limit the number of
268
+ # unsuccessful retries a client can make.
269
+ #
270
+ # * `adaptive` - An experimental retry mode that includes all the
271
+ # functionality of `standard` mode along with automatic client side
272
+ # throttling. This is a provisional mode that may change behavior
273
+ # in the future.
274
+ #
275
+ #
276
+ # @option options [String] :secret_access_key
277
+ #
278
+ # @option options [String] :session_token
279
+ #
280
+ # @option options [Boolean] :stub_responses (false)
281
+ # Causes the client to return stubbed responses. By default
282
+ # fake responses are generated and returned. You can specify
283
+ # the response data to return or errors to raise by calling
284
+ # {ClientStubs#stub_responses}. See {ClientStubs} for more information.
285
+ #
286
+ # ** Please note ** When response stubbing is enabled, no HTTP
287
+ # requests are made, and retries are disabled.
288
+ #
289
+ # @option options [Boolean] :validate_params (true)
290
+ # When `true`, request parameters are validated before
291
+ # sending the request.
292
+ #
293
+ # @option options [URI::HTTP,String] :http_proxy A proxy to send
294
+ # requests through. Formatted like 'http://proxy.com:123'.
295
+ #
296
+ # @option options [Float] :http_open_timeout (15) The number of
297
+ # seconds to wait when opening a HTTP session before raising a
298
+ # `Timeout::Error`.
299
+ #
300
+ # @option options [Integer] :http_read_timeout (60) The default
301
+ # number of seconds to wait for response data. This value can
302
+ # safely be set per-request on the session.
303
+ #
304
+ # @option options [Float] :http_idle_timeout (5) The number of
305
+ # seconds a connection is allowed to sit idle before it is
306
+ # considered stale. Stale connections are closed and removed
307
+ # from the pool before making a request.
308
+ #
309
+ # @option options [Float] :http_continue_timeout (1) The number of
310
+ # seconds to wait for a 100-continue response before sending the
311
+ # request body. This option has no effect unless the request has
312
+ # "Expect" header set to "100-continue". Defaults to `nil` which
313
+ # disables this behaviour. This value can safely be set per
314
+ # request on the session.
315
+ #
316
+ # @option options [Boolean] :http_wire_trace (false) When `true`,
317
+ # HTTP debug output will be sent to the `:logger`.
318
+ #
319
+ # @option options [Boolean] :ssl_verify_peer (true) When `true`,
320
+ # SSL peer certificates are verified when establishing a
321
+ # connection.
322
+ #
323
+ # @option options [String] :ssl_ca_bundle Full path to the SSL
324
+ # certificate authority bundle file that should be used when
325
+ # verifying peer certificates. If you do not pass
326
+ # `:ssl_ca_bundle` or `:ssl_ca_directory` the the system default
327
+ # will be used if available.
328
+ #
329
+ # @option options [String] :ssl_ca_directory Full path of the
330
+ # directory that contains the unbundled SSL certificate
331
+ # authority files for verifying peer certificates. If you do
332
+ # not pass `:ssl_ca_bundle` or `:ssl_ca_directory` the the
333
+ # system default will be used if available.
334
+ #
335
+ def initialize(*args)
336
+ super
337
+ end
338
+
339
+ # @!group API Operations
340
+
341
+ # Removes session information for a specified bot, alias, and user ID.
342
+ #
343
+ # You can use this operation to restart a conversation with a bot. When
344
+ # you remove a session, the entire history of the session is removed so
345
+ # that you can start again.
346
+ #
347
+ # You don't need to delete a session. Sessions have a time limit and
348
+ # will expire. Set the session time limit when you create the bot. The
349
+ # default is 5 minutes, but you can specify anything between 1 minute
350
+ # and 24 hours.
351
+ #
352
+ # If you specify a bot or alias ID that doesn't exist, you receive a
353
+ # `BadRequestException.`
354
+ #
355
+ # If the locale doesn't exist in the bot, or if the locale hasn't been
356
+ # enables for the alias, you receive a `BadRequestException`.
357
+ #
358
+ # @option params [required, String] :bot_id
359
+ # The identifier of the bot that contains the session data.
360
+ #
361
+ # @option params [required, String] :bot_alias_id
362
+ # The alias identifier in use for the bot that contains the session
363
+ # data.
364
+ #
365
+ # @option params [required, String] :locale_id
366
+ # The locale where the session is in use.
367
+ #
368
+ # @option params [required, String] :session_id
369
+ # The identifier of the session to delete.
370
+ #
371
+ # @return [Types::DeleteSessionResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
372
+ #
373
+ # * {Types::DeleteSessionResponse#bot_id #bot_id} => String
374
+ # * {Types::DeleteSessionResponse#bot_alias_id #bot_alias_id} => String
375
+ # * {Types::DeleteSessionResponse#locale_id #locale_id} => String
376
+ # * {Types::DeleteSessionResponse#session_id #session_id} => String
377
+ #
378
+ # @example Request syntax with placeholder values
379
+ #
380
+ # resp = client.delete_session({
381
+ # bot_id: "BotIdentifier", # required
382
+ # bot_alias_id: "BotAliasIdentifier", # required
383
+ # locale_id: "LocaleId", # required
384
+ # session_id: "SessionId", # required
385
+ # })
386
+ #
387
+ # @example Response structure
388
+ #
389
+ # resp.bot_id #=> String
390
+ # resp.bot_alias_id #=> String
391
+ # resp.locale_id #=> String
392
+ # resp.session_id #=> String
393
+ #
394
+ # @see http://docs.aws.amazon.com/goto/WebAPI/runtime.lex.v2-2020-08-07/DeleteSession AWS API Documentation
395
+ #
396
+ # @overload delete_session(params = {})
397
+ # @param [Hash] params ({})
398
+ def delete_session(params = {}, options = {})
399
+ req = build_request(:delete_session, params)
400
+ req.send_request(options)
401
+ end
402
+
403
+ # Returns session information for a specified bot, alias, and user.
404
+ #
405
+ # For example, you can use this operation to retrieve session
406
+ # information for a user that has left a long-running session in use.
407
+ #
408
+ # If the bot, alias, or session identifier doesn't exist, Amazon Lex
409
+ # returns a `BadRequestException`. If the locale doesn't exist or is
410
+ # not enabled for the alias, you receive a `BadRequestException`.
411
+ #
412
+ # @option params [required, String] :bot_id
413
+ # The identifier of the bot that contains the session data.
414
+ #
415
+ # @option params [required, String] :bot_alias_id
416
+ # The alias identifier in use for the bot that contains the session
417
+ # data.
418
+ #
419
+ # @option params [required, String] :locale_id
420
+ # The locale where the session is in use.
421
+ #
422
+ # @option params [required, String] :session_id
423
+ # The identifier of the session to return.
424
+ #
425
+ # @return [Types::GetSessionResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
426
+ #
427
+ # * {Types::GetSessionResponse#session_id #session_id} => String
428
+ # * {Types::GetSessionResponse#messages #messages} => Array&lt;Types::Message&gt;
429
+ # * {Types::GetSessionResponse#interpretations #interpretations} => Array&lt;Types::Interpretation&gt;
430
+ # * {Types::GetSessionResponse#session_state #session_state} => Types::SessionState
431
+ #
432
+ # @example Request syntax with placeholder values
433
+ #
434
+ # resp = client.get_session({
435
+ # bot_id: "BotIdentifier", # required
436
+ # bot_alias_id: "BotAliasIdentifier", # required
437
+ # locale_id: "LocaleId", # required
438
+ # session_id: "SessionId", # required
439
+ # })
440
+ #
441
+ # @example Response structure
442
+ #
443
+ # resp.session_id #=> String
444
+ # resp.messages #=> Array
445
+ # resp.messages[0].content #=> String
446
+ # resp.messages[0].content_type #=> String, one of "CustomPayload", "ImageResponseCard", "PlainText", "SSML"
447
+ # resp.messages[0].image_response_card.title #=> String
448
+ # resp.messages[0].image_response_card.subtitle #=> String
449
+ # resp.messages[0].image_response_card.image_url #=> String
450
+ # resp.messages[0].image_response_card.buttons #=> Array
451
+ # resp.messages[0].image_response_card.buttons[0].text #=> String
452
+ # resp.messages[0].image_response_card.buttons[0].value #=> String
453
+ # resp.interpretations #=> Array
454
+ # resp.interpretations[0].nlu_confidence.score #=> Float
455
+ # resp.interpretations[0].sentiment_response.sentiment #=> String, one of "MIXED", "NEGATIVE", "NEUTRAL", "POSITIVE"
456
+ # resp.interpretations[0].sentiment_response.sentiment_score.positive #=> Float
457
+ # resp.interpretations[0].sentiment_response.sentiment_score.negative #=> Float
458
+ # resp.interpretations[0].sentiment_response.sentiment_score.neutral #=> Float
459
+ # resp.interpretations[0].sentiment_response.sentiment_score.mixed #=> Float
460
+ # resp.interpretations[0].intent.name #=> String
461
+ # resp.interpretations[0].intent.slots #=> Hash
462
+ # resp.interpretations[0].intent.slots["NonEmptyString"].value.original_value #=> String
463
+ # resp.interpretations[0].intent.slots["NonEmptyString"].value.interpreted_value #=> String
464
+ # resp.interpretations[0].intent.slots["NonEmptyString"].value.resolved_values #=> Array
465
+ # resp.interpretations[0].intent.slots["NonEmptyString"].value.resolved_values[0] #=> String
466
+ # resp.interpretations[0].intent.state #=> String, one of "Failed", "Fulfilled", "InProgress", "ReadyForFulfillment", "Waiting"
467
+ # resp.interpretations[0].intent.confirmation_state #=> String, one of "Confirmed", "Denied", "None"
468
+ # resp.session_state.dialog_action.type #=> String, one of "Close", "ConfirmIntent", "Delegate", "ElicitIntent", "ElicitSlot"
469
+ # resp.session_state.dialog_action.slot_to_elicit #=> String
470
+ # resp.session_state.intent.name #=> String
471
+ # resp.session_state.intent.slots #=> Hash
472
+ # resp.session_state.intent.slots["NonEmptyString"].value.original_value #=> String
473
+ # resp.session_state.intent.slots["NonEmptyString"].value.interpreted_value #=> String
474
+ # resp.session_state.intent.slots["NonEmptyString"].value.resolved_values #=> Array
475
+ # resp.session_state.intent.slots["NonEmptyString"].value.resolved_values[0] #=> String
476
+ # resp.session_state.intent.state #=> String, one of "Failed", "Fulfilled", "InProgress", "ReadyForFulfillment", "Waiting"
477
+ # resp.session_state.intent.confirmation_state #=> String, one of "Confirmed", "Denied", "None"
478
+ # resp.session_state.active_contexts #=> Array
479
+ # resp.session_state.active_contexts[0].name #=> String
480
+ # resp.session_state.active_contexts[0].time_to_live.time_to_live_in_seconds #=> Integer
481
+ # resp.session_state.active_contexts[0].time_to_live.turns_to_live #=> Integer
482
+ # resp.session_state.active_contexts[0].context_attributes #=> Hash
483
+ # resp.session_state.active_contexts[0].context_attributes["ParameterName"] #=> String
484
+ # resp.session_state.session_attributes #=> Hash
485
+ # resp.session_state.session_attributes["NonEmptyString"] #=> String
486
+ # resp.session_state.originating_request_id #=> String
487
+ #
488
+ # @see http://docs.aws.amazon.com/goto/WebAPI/runtime.lex.v2-2020-08-07/GetSession AWS API Documentation
489
+ #
490
+ # @overload get_session(params = {})
491
+ # @param [Hash] params ({})
492
+ def get_session(params = {}, options = {})
493
+ req = build_request(:get_session, params)
494
+ req.send_request(options)
495
+ end
496
+
497
+ # Creates a new session or modifies an existing session with an Amazon
498
+ # Lex bot. Use this operation to enable your application to set the
499
+ # state of the bot.
500
+ #
501
+ # @option params [required, String] :bot_id
502
+ # The identifier of the bot that receives the session data.
503
+ #
504
+ # @option params [required, String] :bot_alias_id
505
+ # The alias identifier of the bot that receives the session data.
506
+ #
507
+ # @option params [required, String] :locale_id
508
+ # The locale where the session is in use.
509
+ #
510
+ # @option params [required, String] :session_id
511
+ # The identifier of the session that receives the session data.
512
+ #
513
+ # @option params [Array<Types::Message>] :messages
514
+ # A list of messages to send to the user. Messages are sent in the order
515
+ # that they are defined in the list.
516
+ #
517
+ # @option params [required, Types::SessionState] :session_state
518
+ # Sets the state of the session with the user. You can use this to set
519
+ # the current intent, attributes, context, and dialog action. Use the
520
+ # dialog action to determine the next step that Amazon Lex should use in
521
+ # the conversation with the user.
522
+ #
523
+ # @option params [Hash<String,String>] :request_attributes
524
+ # Request-specific information passed between Amazon Lex and the client
525
+ # application.
526
+ #
527
+ # The namespace `x-amz-lex:` is reserved for special attributes. Don't
528
+ # create any request attributes with the prefix `x-amz-lex:`.
529
+ #
530
+ # @option params [String] :response_content_type
531
+ # The message that Amazon Lex returns in the response can be either text
532
+ # or speech depending on the value of this parameter.
533
+ #
534
+ # * If the value is `text/plain; charset=utf-8`, Amazon Lex returns text
535
+ # in the response.
536
+ #
537
+ # ^
538
+ #
539
+ # @return [Types::PutSessionResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
540
+ #
541
+ # * {Types::PutSessionResponse#content_type #content_type} => String
542
+ # * {Types::PutSessionResponse#messages #messages} => String
543
+ # * {Types::PutSessionResponse#session_state #session_state} => String
544
+ # * {Types::PutSessionResponse#request_attributes #request_attributes} => String
545
+ # * {Types::PutSessionResponse#session_id #session_id} => String
546
+ # * {Types::PutSessionResponse#audio_stream #audio_stream} => IO
547
+ #
548
+ # @example Request syntax with placeholder values
549
+ #
550
+ # resp = client.put_session({
551
+ # bot_id: "BotIdentifier", # required
552
+ # bot_alias_id: "BotAliasIdentifier", # required
553
+ # locale_id: "LocaleId", # required
554
+ # session_id: "SessionId", # required
555
+ # messages: [
556
+ # {
557
+ # content: "Text",
558
+ # content_type: "CustomPayload", # accepts CustomPayload, ImageResponseCard, PlainText, SSML
559
+ # image_response_card: {
560
+ # title: "AttachmentTitle", # required
561
+ # subtitle: "AttachmentTitle",
562
+ # image_url: "AttachmentUrl",
563
+ # buttons: [
564
+ # {
565
+ # text: "ButtonText", # required
566
+ # value: "ButtonValue", # required
567
+ # },
568
+ # ],
569
+ # },
570
+ # },
571
+ # ],
572
+ # session_state: { # required
573
+ # dialog_action: {
574
+ # type: "Close", # required, accepts Close, ConfirmIntent, Delegate, ElicitIntent, ElicitSlot
575
+ # slot_to_elicit: "NonEmptyString",
576
+ # },
577
+ # intent: {
578
+ # name: "NonEmptyString", # required
579
+ # slots: {
580
+ # "NonEmptyString" => {
581
+ # value: {
582
+ # original_value: "NonEmptyString",
583
+ # interpreted_value: "NonEmptyString", # required
584
+ # resolved_values: ["NonEmptyString"],
585
+ # },
586
+ # },
587
+ # },
588
+ # state: "Failed", # accepts Failed, Fulfilled, InProgress, ReadyForFulfillment, Waiting
589
+ # confirmation_state: "Confirmed", # accepts Confirmed, Denied, None
590
+ # },
591
+ # active_contexts: [
592
+ # {
593
+ # name: "ActiveContextName", # required
594
+ # time_to_live: { # required
595
+ # time_to_live_in_seconds: 1, # required
596
+ # turns_to_live: 1, # required
597
+ # },
598
+ # context_attributes: {
599
+ # "ParameterName" => "Text",
600
+ # },
601
+ # },
602
+ # ],
603
+ # session_attributes: {
604
+ # "NonEmptyString" => "String",
605
+ # },
606
+ # originating_request_id: "NonEmptyString",
607
+ # },
608
+ # request_attributes: {
609
+ # "NonEmptyString" => "String",
610
+ # },
611
+ # response_content_type: "NonEmptyString",
612
+ # })
613
+ #
614
+ # @example Response structure
615
+ #
616
+ # resp.content_type #=> String
617
+ # resp.messages #=> String
618
+ # resp.session_state #=> String
619
+ # resp.request_attributes #=> String
620
+ # resp.session_id #=> String
621
+ # resp.audio_stream #=> IO
622
+ #
623
+ # @see http://docs.aws.amazon.com/goto/WebAPI/runtime.lex.v2-2020-08-07/PutSession AWS API Documentation
624
+ #
625
+ # @overload put_session(params = {})
626
+ # @param [Hash] params ({})
627
+ def put_session(params = {}, options = {}, &block)
628
+ req = build_request(:put_session, params)
629
+ req.send_request(options, &block)
630
+ end
631
+
632
+ # Sends user input to Amazon Lex. Client applications use this API to
633
+ # send requests to Amazon Lex at runtime. Amazon Lex then interprets the
634
+ # user input using the machine learning model that it build for the bot.
635
+ #
636
+ # In response, Amazon Lex returns the next message to convey to the user
637
+ # and an optional response card to display.
638
+ #
639
+ # @option params [required, String] :bot_id
640
+ # The identifier of the bot that processes the request.
641
+ #
642
+ # @option params [required, String] :bot_alias_id
643
+ # The alias identifier in use for the bot that processes the request.
644
+ #
645
+ # @option params [required, String] :locale_id
646
+ # The locale where the session is in use.
647
+ #
648
+ # @option params [required, String] :session_id
649
+ # The identifier of the user session that is having the conversation.
650
+ #
651
+ # @option params [required, String] :text
652
+ # The text that the user entered. Amazon Lex interprets this text.
653
+ #
654
+ # @option params [Types::SessionState] :session_state
655
+ # The current state of the dialog between the user and the bot.
656
+ #
657
+ # @option params [Hash<String,String>] :request_attributes
658
+ # Request-specific information passed between the client application and
659
+ # Amazon Lex
660
+ #
661
+ # The namespace `x-amz-lex:` is reserved for special attributes. Don't
662
+ # create any request attributes with the prefix `x-amz-lex:`.
663
+ #
664
+ # @return [Types::RecognizeTextResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
665
+ #
666
+ # * {Types::RecognizeTextResponse#messages #messages} => Array&lt;Types::Message&gt;
667
+ # * {Types::RecognizeTextResponse#session_state #session_state} => Types::SessionState
668
+ # * {Types::RecognizeTextResponse#interpretations #interpretations} => Array&lt;Types::Interpretation&gt;
669
+ # * {Types::RecognizeTextResponse#request_attributes #request_attributes} => Hash&lt;String,String&gt;
670
+ # * {Types::RecognizeTextResponse#session_id #session_id} => String
671
+ #
672
+ # @example Request syntax with placeholder values
673
+ #
674
+ # resp = client.recognize_text({
675
+ # bot_id: "BotIdentifier", # required
676
+ # bot_alias_id: "BotAliasIdentifier", # required
677
+ # locale_id: "LocaleId", # required
678
+ # session_id: "SessionId", # required
679
+ # text: "Text", # required
680
+ # session_state: {
681
+ # dialog_action: {
682
+ # type: "Close", # required, accepts Close, ConfirmIntent, Delegate, ElicitIntent, ElicitSlot
683
+ # slot_to_elicit: "NonEmptyString",
684
+ # },
685
+ # intent: {
686
+ # name: "NonEmptyString", # required
687
+ # slots: {
688
+ # "NonEmptyString" => {
689
+ # value: {
690
+ # original_value: "NonEmptyString",
691
+ # interpreted_value: "NonEmptyString", # required
692
+ # resolved_values: ["NonEmptyString"],
693
+ # },
694
+ # },
695
+ # },
696
+ # state: "Failed", # accepts Failed, Fulfilled, InProgress, ReadyForFulfillment, Waiting
697
+ # confirmation_state: "Confirmed", # accepts Confirmed, Denied, None
698
+ # },
699
+ # active_contexts: [
700
+ # {
701
+ # name: "ActiveContextName", # required
702
+ # time_to_live: { # required
703
+ # time_to_live_in_seconds: 1, # required
704
+ # turns_to_live: 1, # required
705
+ # },
706
+ # context_attributes: {
707
+ # "ParameterName" => "Text",
708
+ # },
709
+ # },
710
+ # ],
711
+ # session_attributes: {
712
+ # "NonEmptyString" => "String",
713
+ # },
714
+ # originating_request_id: "NonEmptyString",
715
+ # },
716
+ # request_attributes: {
717
+ # "NonEmptyString" => "String",
718
+ # },
719
+ # })
720
+ #
721
+ # @example Response structure
722
+ #
723
+ # resp.messages #=> Array
724
+ # resp.messages[0].content #=> String
725
+ # resp.messages[0].content_type #=> String, one of "CustomPayload", "ImageResponseCard", "PlainText", "SSML"
726
+ # resp.messages[0].image_response_card.title #=> String
727
+ # resp.messages[0].image_response_card.subtitle #=> String
728
+ # resp.messages[0].image_response_card.image_url #=> String
729
+ # resp.messages[0].image_response_card.buttons #=> Array
730
+ # resp.messages[0].image_response_card.buttons[0].text #=> String
731
+ # resp.messages[0].image_response_card.buttons[0].value #=> String
732
+ # resp.session_state.dialog_action.type #=> String, one of "Close", "ConfirmIntent", "Delegate", "ElicitIntent", "ElicitSlot"
733
+ # resp.session_state.dialog_action.slot_to_elicit #=> String
734
+ # resp.session_state.intent.name #=> String
735
+ # resp.session_state.intent.slots #=> Hash
736
+ # resp.session_state.intent.slots["NonEmptyString"].value.original_value #=> String
737
+ # resp.session_state.intent.slots["NonEmptyString"].value.interpreted_value #=> String
738
+ # resp.session_state.intent.slots["NonEmptyString"].value.resolved_values #=> Array
739
+ # resp.session_state.intent.slots["NonEmptyString"].value.resolved_values[0] #=> String
740
+ # resp.session_state.intent.state #=> String, one of "Failed", "Fulfilled", "InProgress", "ReadyForFulfillment", "Waiting"
741
+ # resp.session_state.intent.confirmation_state #=> String, one of "Confirmed", "Denied", "None"
742
+ # resp.session_state.active_contexts #=> Array
743
+ # resp.session_state.active_contexts[0].name #=> String
744
+ # resp.session_state.active_contexts[0].time_to_live.time_to_live_in_seconds #=> Integer
745
+ # resp.session_state.active_contexts[0].time_to_live.turns_to_live #=> Integer
746
+ # resp.session_state.active_contexts[0].context_attributes #=> Hash
747
+ # resp.session_state.active_contexts[0].context_attributes["ParameterName"] #=> String
748
+ # resp.session_state.session_attributes #=> Hash
749
+ # resp.session_state.session_attributes["NonEmptyString"] #=> String
750
+ # resp.session_state.originating_request_id #=> String
751
+ # resp.interpretations #=> Array
752
+ # resp.interpretations[0].nlu_confidence.score #=> Float
753
+ # resp.interpretations[0].sentiment_response.sentiment #=> String, one of "MIXED", "NEGATIVE", "NEUTRAL", "POSITIVE"
754
+ # resp.interpretations[0].sentiment_response.sentiment_score.positive #=> Float
755
+ # resp.interpretations[0].sentiment_response.sentiment_score.negative #=> Float
756
+ # resp.interpretations[0].sentiment_response.sentiment_score.neutral #=> Float
757
+ # resp.interpretations[0].sentiment_response.sentiment_score.mixed #=> Float
758
+ # resp.interpretations[0].intent.name #=> String
759
+ # resp.interpretations[0].intent.slots #=> Hash
760
+ # resp.interpretations[0].intent.slots["NonEmptyString"].value.original_value #=> String
761
+ # resp.interpretations[0].intent.slots["NonEmptyString"].value.interpreted_value #=> String
762
+ # resp.interpretations[0].intent.slots["NonEmptyString"].value.resolved_values #=> Array
763
+ # resp.interpretations[0].intent.slots["NonEmptyString"].value.resolved_values[0] #=> String
764
+ # resp.interpretations[0].intent.state #=> String, one of "Failed", "Fulfilled", "InProgress", "ReadyForFulfillment", "Waiting"
765
+ # resp.interpretations[0].intent.confirmation_state #=> String, one of "Confirmed", "Denied", "None"
766
+ # resp.request_attributes #=> Hash
767
+ # resp.request_attributes["NonEmptyString"] #=> String
768
+ # resp.session_id #=> String
769
+ #
770
+ # @see http://docs.aws.amazon.com/goto/WebAPI/runtime.lex.v2-2020-08-07/RecognizeText AWS API Documentation
771
+ #
772
+ # @overload recognize_text(params = {})
773
+ # @param [Hash] params ({})
774
+ def recognize_text(params = {}, options = {})
775
+ req = build_request(:recognize_text, params)
776
+ req.send_request(options)
777
+ end
778
+
779
+ # Sends user input to Amazon Lex. You can send text or speech. Clients
780
+ # use this API to send text and audio requests to Amazon Lex at runtime.
781
+ # Amazon Lex interprets the user input using the machine learning model
782
+ # built for the bot.
783
+ #
784
+ # @option params [required, String] :bot_id
785
+ # The identifier of the bot that should receive the request.
786
+ #
787
+ # @option params [required, String] :bot_alias_id
788
+ # The alias identifier in use for the bot that should receive the
789
+ # request.
790
+ #
791
+ # @option params [required, String] :locale_id
792
+ # The locale where the session is in use.
793
+ #
794
+ # @option params [required, String] :session_id
795
+ # The identifier of the session in use.
796
+ #
797
+ # @option params [String] :session_state
798
+ # Sets the state of the session with the user. You can use this to set
799
+ # the current intent, attributes, context, and dialog action. Use the
800
+ # dialog action to determine the next step that Amazon Lex should use in
801
+ # the conversation with the user.
802
+ #
803
+ # @option params [String] :request_attributes
804
+ # Request-specific information passed between the client application and
805
+ # Amazon Lex
806
+ #
807
+ # The namespace `x-amz-lex:` is reserved for special attributes. Don't
808
+ # create any request attributes for prefix `x-amz-lex:`.
809
+ #
810
+ # @option params [required, String] :request_content_type
811
+ # Indicates the format for audio input or that the content is text. The
812
+ # header must start with one of the following prefixes:
813
+ #
814
+ # * PCM format, audio data must be in little-endian byte order.
815
+ #
816
+ # * audio/l16; rate=16000; channels=1
817
+ #
818
+ # * audio/x-l16; sample-rate=16000; channel-count=1
819
+ #
820
+ # * audio/lpcm; sample-rate=8000; sample-size-bits=16;
821
+ # channel-count=1; is-big-endian=false
822
+ #
823
+ # * Opus format
824
+ #
825
+ # * audio/x-cbr-opus-with-preamble;preamble-size=0;bit-rate=256000;frame-size-milliseconds=4
826
+ #
827
+ # ^
828
+ #
829
+ # * Text format
830
+ #
831
+ # * text/plain; charset=utf-8
832
+ #
833
+ # ^
834
+ #
835
+ # @option params [String] :response_content_type
836
+ # The message that Amazon Lex returns in the response can be either text
837
+ # or speech based on the `responseContentType` value.
838
+ #
839
+ # * If the value is `text/plain;charset=utf-8`, Amazon Lex returns text
840
+ # in the response.
841
+ #
842
+ # * If the value begins with `audio/`, Amazon Lex returns speech in the
843
+ # response. Amazon Lex uses Amazon Polly to generate the speech using
844
+ # the configuration that you specified in the `requestContentType`
845
+ # parameter. For example, if you specify `audio/mpeg` as the value,
846
+ # Amazon Lex returns speech in the MPEG format.
847
+ #
848
+ # * If the value is `audio/pcm`, the speech returned is `audio/pcm` at
849
+ # 16 KHz in 16-bit, little-endian format.
850
+ #
851
+ # * The following are the accepted values:
852
+ #
853
+ # * audio/mpeg
854
+ #
855
+ # * audio/ogg
856
+ #
857
+ # * audio/pcm (16 KHz)
858
+ #
859
+ # * audio/* (defaults to mpeg)
860
+ #
861
+ # * text/plain; charset=utf-8
862
+ #
863
+ # @option params [String, IO] :input_stream
864
+ # User input in PCM or Opus audio format or text format as described in
865
+ # the `requestContentType` parameter.
866
+ #
867
+ # @return [Types::RecognizeUtteranceResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
868
+ #
869
+ # * {Types::RecognizeUtteranceResponse#input_mode #input_mode} => String
870
+ # * {Types::RecognizeUtteranceResponse#content_type #content_type} => String
871
+ # * {Types::RecognizeUtteranceResponse#messages #messages} => String
872
+ # * {Types::RecognizeUtteranceResponse#interpretations #interpretations} => String
873
+ # * {Types::RecognizeUtteranceResponse#session_state #session_state} => String
874
+ # * {Types::RecognizeUtteranceResponse#request_attributes #request_attributes} => String
875
+ # * {Types::RecognizeUtteranceResponse#session_id #session_id} => String
876
+ # * {Types::RecognizeUtteranceResponse#input_transcript #input_transcript} => String
877
+ # * {Types::RecognizeUtteranceResponse#audio_stream #audio_stream} => IO
878
+ #
879
+ # @example Request syntax with placeholder values
880
+ #
881
+ # resp = client.recognize_utterance({
882
+ # bot_id: "BotIdentifier", # required
883
+ # bot_alias_id: "BotAliasIdentifier", # required
884
+ # locale_id: "LocaleId", # required
885
+ # session_id: "SessionId", # required
886
+ # session_state: "SensitiveNonEmptyString",
887
+ # request_attributes: "SensitiveNonEmptyString",
888
+ # request_content_type: "NonEmptyString", # required
889
+ # response_content_type: "NonEmptyString",
890
+ # input_stream: "data",
891
+ # })
892
+ #
893
+ # @example Response structure
894
+ #
895
+ # resp.input_mode #=> String
896
+ # resp.content_type #=> String
897
+ # resp.messages #=> String
898
+ # resp.interpretations #=> String
899
+ # resp.session_state #=> String
900
+ # resp.request_attributes #=> String
901
+ # resp.session_id #=> String
902
+ # resp.input_transcript #=> String
903
+ # resp.audio_stream #=> IO
904
+ #
905
+ # @see http://docs.aws.amazon.com/goto/WebAPI/runtime.lex.v2-2020-08-07/RecognizeUtterance AWS API Documentation
906
+ #
907
+ # @overload recognize_utterance(params = {})
908
+ # @param [Hash] params ({})
909
+ def recognize_utterance(params = {}, options = {}, &block)
910
+ req = build_request(:recognize_utterance, params)
911
+ req.send_request(options, &block)
912
+ end
913
+
914
+ # @!endgroup
915
+
916
+ # @param params ({})
917
+ # @api private
918
+ def build_request(operation_name, params = {})
919
+ handlers = @handlers.for(operation_name)
920
+ context = Seahorse::Client::RequestContext.new(
921
+ operation_name: operation_name,
922
+ operation: config.api.operation(operation_name),
923
+ client: self,
924
+ params: params,
925
+ config: config)
926
+ context[:gem_name] = 'aws-sdk-lexruntimev2'
927
+ context[:gem_version] = '1.0.0'
928
+ Seahorse::Client::Request.new(handlers, context)
929
+ end
930
+
931
+ # @api private
932
+ # @deprecated
933
+ def waiter_names
934
+ []
935
+ end
936
+
937
+ class << self
938
+
939
+ # @api private
940
+ attr_reader :identifier
941
+
942
+ # @api private
943
+ def errors_module
944
+ Errors
945
+ end
946
+
947
+ end
948
+ end
949
+ end