aws-sdk-lex 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/aws-sdk-lex.rb +47 -0
- data/lib/aws-sdk-lex/client.rb +616 -0
- data/lib/aws-sdk-lex/client_api.rb +168 -0
- data/lib/aws-sdk-lex/customizations.rb +0 -0
- data/lib/aws-sdk-lex/errors.rb +14 -0
- data/lib/aws-sdk-lex/resource.rb +23 -0
- data/lib/aws-sdk-lex/types.rb +595 -0
- metadata +80 -0
@@ -0,0 +1,168 @@
|
|
1
|
+
# WARNING ABOUT GENERATED CODE
|
2
|
+
#
|
3
|
+
# This file is generated. See the contributing guide for more information:
|
4
|
+
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
|
5
|
+
#
|
6
|
+
# WARNING ABOUT GENERATED CODE
|
7
|
+
|
8
|
+
module Aws::Lex
|
9
|
+
# @api private
|
10
|
+
module ClientApi
|
11
|
+
|
12
|
+
include Seahorse::Model
|
13
|
+
|
14
|
+
Accept = Shapes::StringShape.new(name: 'Accept')
|
15
|
+
BadGatewayException = Shapes::StructureShape.new(name: 'BadGatewayException')
|
16
|
+
BadRequestException = Shapes::StructureShape.new(name: 'BadRequestException')
|
17
|
+
BlobStream = Shapes::BlobShape.new(name: 'BlobStream')
|
18
|
+
BotAlias = Shapes::StringShape.new(name: 'BotAlias')
|
19
|
+
BotName = Shapes::StringShape.new(name: 'BotName')
|
20
|
+
Button = Shapes::StructureShape.new(name: 'Button')
|
21
|
+
ButtonTextStringWithLength = Shapes::StringShape.new(name: 'ButtonTextStringWithLength')
|
22
|
+
ButtonValueStringWithLength = Shapes::StringShape.new(name: 'ButtonValueStringWithLength')
|
23
|
+
ConflictException = Shapes::StructureShape.new(name: 'ConflictException')
|
24
|
+
ContentType = Shapes::StringShape.new(name: 'ContentType')
|
25
|
+
DependencyFailedException = Shapes::StructureShape.new(name: 'DependencyFailedException')
|
26
|
+
DialogState = Shapes::StringShape.new(name: 'DialogState')
|
27
|
+
ErrorMessage = Shapes::StringShape.new(name: 'ErrorMessage')
|
28
|
+
GenericAttachment = Shapes::StructureShape.new(name: 'GenericAttachment')
|
29
|
+
HttpContentType = Shapes::StringShape.new(name: 'HttpContentType')
|
30
|
+
IntentName = Shapes::StringShape.new(name: 'IntentName')
|
31
|
+
InternalFailureException = Shapes::StructureShape.new(name: 'InternalFailureException')
|
32
|
+
LimitExceededException = Shapes::StructureShape.new(name: 'LimitExceededException')
|
33
|
+
LoopDetectedException = Shapes::StructureShape.new(name: 'LoopDetectedException')
|
34
|
+
NotAcceptableException = Shapes::StructureShape.new(name: 'NotAcceptableException')
|
35
|
+
NotFoundException = Shapes::StructureShape.new(name: 'NotFoundException')
|
36
|
+
PostContentRequest = Shapes::StructureShape.new(name: 'PostContentRequest')
|
37
|
+
PostContentResponse = Shapes::StructureShape.new(name: 'PostContentResponse')
|
38
|
+
PostTextRequest = Shapes::StructureShape.new(name: 'PostTextRequest')
|
39
|
+
PostTextResponse = Shapes::StructureShape.new(name: 'PostTextResponse')
|
40
|
+
RequestTimeoutException = Shapes::StructureShape.new(name: 'RequestTimeoutException')
|
41
|
+
ResponseCard = Shapes::StructureShape.new(name: 'ResponseCard')
|
42
|
+
String = Shapes::StringShape.new(name: 'String')
|
43
|
+
StringMap = Shapes::MapShape.new(name: 'StringMap')
|
44
|
+
StringUrlWithLength = Shapes::StringShape.new(name: 'StringUrlWithLength')
|
45
|
+
StringWithLength = Shapes::StringShape.new(name: 'StringWithLength')
|
46
|
+
Text = Shapes::StringShape.new(name: 'Text')
|
47
|
+
UnsupportedMediaTypeException = Shapes::StructureShape.new(name: 'UnsupportedMediaTypeException')
|
48
|
+
UserId = Shapes::StringShape.new(name: 'UserId')
|
49
|
+
genericAttachmentList = Shapes::ListShape.new(name: 'genericAttachmentList')
|
50
|
+
listOfButtons = Shapes::ListShape.new(name: 'listOfButtons')
|
51
|
+
|
52
|
+
Button.add_member(:text, Shapes::ShapeRef.new(shape: ButtonTextStringWithLength, required: true, location_name: "text"))
|
53
|
+
Button.add_member(:value, Shapes::ShapeRef.new(shape: ButtonValueStringWithLength, required: true, location_name: "value"))
|
54
|
+
Button.struct_class = Types::Button
|
55
|
+
|
56
|
+
GenericAttachment.add_member(:title, Shapes::ShapeRef.new(shape: StringWithLength, location_name: "title"))
|
57
|
+
GenericAttachment.add_member(:sub_title, Shapes::ShapeRef.new(shape: StringWithLength, location_name: "subTitle"))
|
58
|
+
GenericAttachment.add_member(:attachment_link_url, Shapes::ShapeRef.new(shape: StringUrlWithLength, location_name: "attachmentLinkUrl"))
|
59
|
+
GenericAttachment.add_member(:image_url, Shapes::ShapeRef.new(shape: StringUrlWithLength, location_name: "imageUrl"))
|
60
|
+
GenericAttachment.add_member(:buttons, Shapes::ShapeRef.new(shape: listOfButtons, location_name: "buttons"))
|
61
|
+
GenericAttachment.struct_class = Types::GenericAttachment
|
62
|
+
|
63
|
+
PostContentRequest.add_member(:bot_name, Shapes::ShapeRef.new(shape: BotName, required: true, location: "uri", location_name: "botName"))
|
64
|
+
PostContentRequest.add_member(:bot_alias, Shapes::ShapeRef.new(shape: BotAlias, required: true, location: "uri", location_name: "botAlias"))
|
65
|
+
PostContentRequest.add_member(:user_id, Shapes::ShapeRef.new(shape: UserId, required: true, location: "uri", location_name: "userId"))
|
66
|
+
PostContentRequest.add_member(:session_attributes, Shapes::ShapeRef.new(shape: String, location: "header", location_name: "x-amz-lex-session-attributes", metadata: {"jsonvalue"=>true}))
|
67
|
+
PostContentRequest.add_member(:content_type, Shapes::ShapeRef.new(shape: HttpContentType, required: true, location: "header", location_name: "Content-Type"))
|
68
|
+
PostContentRequest.add_member(:accept, Shapes::ShapeRef.new(shape: Accept, location: "header", location_name: "Accept"))
|
69
|
+
PostContentRequest.add_member(:input_stream, Shapes::ShapeRef.new(shape: BlobStream, required: true, location_name: "inputStream"))
|
70
|
+
PostContentRequest.struct_class = Types::PostContentRequest
|
71
|
+
PostContentRequest[:payload] = :input_stream
|
72
|
+
PostContentRequest[:payload_member] = PostContentRequest.member(:input_stream)
|
73
|
+
|
74
|
+
PostContentResponse.add_member(:content_type, Shapes::ShapeRef.new(shape: HttpContentType, location: "header", location_name: "Content-Type"))
|
75
|
+
PostContentResponse.add_member(:intent_name, Shapes::ShapeRef.new(shape: IntentName, location: "header", location_name: "x-amz-lex-intent-name"))
|
76
|
+
PostContentResponse.add_member(:slots, Shapes::ShapeRef.new(shape: String, location: "header", location_name: "x-amz-lex-slots", metadata: {"jsonvalue"=>true}))
|
77
|
+
PostContentResponse.add_member(:session_attributes, Shapes::ShapeRef.new(shape: String, location: "header", location_name: "x-amz-lex-session-attributes", metadata: {"jsonvalue"=>true}))
|
78
|
+
PostContentResponse.add_member(:message, Shapes::ShapeRef.new(shape: Text, location: "header", location_name: "x-amz-lex-message"))
|
79
|
+
PostContentResponse.add_member(:dialog_state, Shapes::ShapeRef.new(shape: DialogState, location: "header", location_name: "x-amz-lex-dialog-state"))
|
80
|
+
PostContentResponse.add_member(:slot_to_elicit, Shapes::ShapeRef.new(shape: String, location: "header", location_name: "x-amz-lex-slot-to-elicit"))
|
81
|
+
PostContentResponse.add_member(:input_transcript, Shapes::ShapeRef.new(shape: String, location: "header", location_name: "x-amz-lex-input-transcript"))
|
82
|
+
PostContentResponse.add_member(:audio_stream, Shapes::ShapeRef.new(shape: BlobStream, location_name: "audioStream"))
|
83
|
+
PostContentResponse.struct_class = Types::PostContentResponse
|
84
|
+
PostContentResponse[:payload] = :audio_stream
|
85
|
+
PostContentResponse[:payload_member] = PostContentResponse.member(:audio_stream)
|
86
|
+
|
87
|
+
PostTextRequest.add_member(:bot_name, Shapes::ShapeRef.new(shape: BotName, required: true, location: "uri", location_name: "botName"))
|
88
|
+
PostTextRequest.add_member(:bot_alias, Shapes::ShapeRef.new(shape: BotAlias, required: true, location: "uri", location_name: "botAlias"))
|
89
|
+
PostTextRequest.add_member(:user_id, Shapes::ShapeRef.new(shape: UserId, required: true, location: "uri", location_name: "userId"))
|
90
|
+
PostTextRequest.add_member(:session_attributes, Shapes::ShapeRef.new(shape: StringMap, location_name: "sessionAttributes"))
|
91
|
+
PostTextRequest.add_member(:input_text, Shapes::ShapeRef.new(shape: Text, required: true, location_name: "inputText"))
|
92
|
+
PostTextRequest.struct_class = Types::PostTextRequest
|
93
|
+
|
94
|
+
PostTextResponse.add_member(:intent_name, Shapes::ShapeRef.new(shape: IntentName, location_name: "intentName"))
|
95
|
+
PostTextResponse.add_member(:slots, Shapes::ShapeRef.new(shape: StringMap, location_name: "slots"))
|
96
|
+
PostTextResponse.add_member(:session_attributes, Shapes::ShapeRef.new(shape: StringMap, location_name: "sessionAttributes"))
|
97
|
+
PostTextResponse.add_member(:message, Shapes::ShapeRef.new(shape: Text, location_name: "message"))
|
98
|
+
PostTextResponse.add_member(:dialog_state, Shapes::ShapeRef.new(shape: DialogState, location_name: "dialogState"))
|
99
|
+
PostTextResponse.add_member(:slot_to_elicit, Shapes::ShapeRef.new(shape: String, location_name: "slotToElicit"))
|
100
|
+
PostTextResponse.add_member(:response_card, Shapes::ShapeRef.new(shape: ResponseCard, location_name: "responseCard"))
|
101
|
+
PostTextResponse.struct_class = Types::PostTextResponse
|
102
|
+
|
103
|
+
ResponseCard.add_member(:version, Shapes::ShapeRef.new(shape: String, location_name: "version"))
|
104
|
+
ResponseCard.add_member(:content_type, Shapes::ShapeRef.new(shape: ContentType, location_name: "contentType"))
|
105
|
+
ResponseCard.add_member(:generic_attachments, Shapes::ShapeRef.new(shape: genericAttachmentList, location_name: "genericAttachments"))
|
106
|
+
ResponseCard.struct_class = Types::ResponseCard
|
107
|
+
|
108
|
+
StringMap.key = Shapes::ShapeRef.new(shape: String)
|
109
|
+
StringMap.value = Shapes::ShapeRef.new(shape: String)
|
110
|
+
|
111
|
+
genericAttachmentList.member = Shapes::ShapeRef.new(shape: GenericAttachment)
|
112
|
+
|
113
|
+
listOfButtons.member = Shapes::ShapeRef.new(shape: Button)
|
114
|
+
|
115
|
+
|
116
|
+
# @api private
|
117
|
+
API = Seahorse::Model::Api.new.tap do |api|
|
118
|
+
|
119
|
+
api.version = "2016-11-28"
|
120
|
+
|
121
|
+
api.metadata = {
|
122
|
+
"endpointPrefix" => "runtime.lex",
|
123
|
+
"jsonVersion" => "1.1",
|
124
|
+
"protocol" => "rest-json",
|
125
|
+
"serviceFullName" => "Amazon Lex Runtime Service",
|
126
|
+
"signatureVersion" => "v4",
|
127
|
+
"signingName" => "lex",
|
128
|
+
}
|
129
|
+
|
130
|
+
api.add_operation(:post_content, Seahorse::Model::Operation.new.tap do |o|
|
131
|
+
o.name = "PostContent"
|
132
|
+
o.http_method = "POST"
|
133
|
+
o.http_request_uri = "/bot/{botName}/alias/{botAlias}/user/{userId}/content"
|
134
|
+
o['authtype'] = "v4-unsigned-body"
|
135
|
+
o.input = Shapes::ShapeRef.new(shape: PostContentRequest)
|
136
|
+
o.output = Shapes::ShapeRef.new(shape: PostContentResponse)
|
137
|
+
o.errors << Shapes::ShapeRef.new(shape: NotFoundException)
|
138
|
+
o.errors << Shapes::ShapeRef.new(shape: BadRequestException)
|
139
|
+
o.errors << Shapes::ShapeRef.new(shape: LimitExceededException)
|
140
|
+
o.errors << Shapes::ShapeRef.new(shape: InternalFailureException)
|
141
|
+
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
|
142
|
+
o.errors << Shapes::ShapeRef.new(shape: UnsupportedMediaTypeException)
|
143
|
+
o.errors << Shapes::ShapeRef.new(shape: NotAcceptableException)
|
144
|
+
o.errors << Shapes::ShapeRef.new(shape: RequestTimeoutException)
|
145
|
+
o.errors << Shapes::ShapeRef.new(shape: DependencyFailedException)
|
146
|
+
o.errors << Shapes::ShapeRef.new(shape: BadGatewayException)
|
147
|
+
o.errors << Shapes::ShapeRef.new(shape: LoopDetectedException)
|
148
|
+
end)
|
149
|
+
|
150
|
+
api.add_operation(:post_text, Seahorse::Model::Operation.new.tap do |o|
|
151
|
+
o.name = "PostText"
|
152
|
+
o.http_method = "POST"
|
153
|
+
o.http_request_uri = "/bot/{botName}/alias/{botAlias}/user/{userId}/text"
|
154
|
+
o.input = Shapes::ShapeRef.new(shape: PostTextRequest)
|
155
|
+
o.output = Shapes::ShapeRef.new(shape: PostTextResponse)
|
156
|
+
o.errors << Shapes::ShapeRef.new(shape: NotFoundException)
|
157
|
+
o.errors << Shapes::ShapeRef.new(shape: BadRequestException)
|
158
|
+
o.errors << Shapes::ShapeRef.new(shape: LimitExceededException)
|
159
|
+
o.errors << Shapes::ShapeRef.new(shape: InternalFailureException)
|
160
|
+
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
|
161
|
+
o.errors << Shapes::ShapeRef.new(shape: DependencyFailedException)
|
162
|
+
o.errors << Shapes::ShapeRef.new(shape: BadGatewayException)
|
163
|
+
o.errors << Shapes::ShapeRef.new(shape: LoopDetectedException)
|
164
|
+
end)
|
165
|
+
end
|
166
|
+
|
167
|
+
end
|
168
|
+
end
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# WARNING ABOUT GENERATED CODE
|
2
|
+
#
|
3
|
+
# This file is generated. See the contributing guide for more information:
|
4
|
+
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
|
5
|
+
#
|
6
|
+
# WARNING ABOUT GENERATED CODE
|
7
|
+
|
8
|
+
module Aws::Lex
|
9
|
+
module Errors
|
10
|
+
|
11
|
+
extend Aws::Errors::DynamicErrors
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# WARNING ABOUT GENERATED CODE
|
2
|
+
#
|
3
|
+
# This file is generated. See the contributing guide for more information:
|
4
|
+
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
|
5
|
+
#
|
6
|
+
# WARNING ABOUT GENERATED CODE
|
7
|
+
|
8
|
+
module Aws::Lex
|
9
|
+
class Resource
|
10
|
+
|
11
|
+
# @param options ({})
|
12
|
+
# @option options [Client] :client
|
13
|
+
def initialize(options = {})
|
14
|
+
@client = options[:client] || Client.new(options)
|
15
|
+
end
|
16
|
+
|
17
|
+
# @return [Client]
|
18
|
+
def client
|
19
|
+
@client
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,595 @@
|
|
1
|
+
# WARNING ABOUT GENERATED CODE
|
2
|
+
#
|
3
|
+
# This file is generated. See the contributing guide for more information:
|
4
|
+
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
|
5
|
+
#
|
6
|
+
# WARNING ABOUT GENERATED CODE
|
7
|
+
|
8
|
+
module Aws::Lex
|
9
|
+
module Types
|
10
|
+
|
11
|
+
# Represents an option to be shown on the client platform (Facebook,
|
12
|
+
# Slack, etc.)
|
13
|
+
#
|
14
|
+
# @!attribute [rw] text
|
15
|
+
# Text that is visible to the user on the button.
|
16
|
+
# @return [String]
|
17
|
+
#
|
18
|
+
# @!attribute [rw] value
|
19
|
+
# The value sent to Amazon Lex when a user chooses the button. For
|
20
|
+
# example, consider button text "NYC." When the user chooses the
|
21
|
+
# button, the value sent can be "New York City."
|
22
|
+
# @return [String]
|
23
|
+
#
|
24
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/runtime.lex-2016-11-28/Button AWS API Documentation
|
25
|
+
#
|
26
|
+
class Button < Struct.new(
|
27
|
+
:text,
|
28
|
+
:value)
|
29
|
+
include Aws::Structure
|
30
|
+
end
|
31
|
+
|
32
|
+
# Represents an option rendered to the user when a prompt is shown. It
|
33
|
+
# could be an image, a button, a link, or text.
|
34
|
+
#
|
35
|
+
# @!attribute [rw] title
|
36
|
+
# The title of the option.
|
37
|
+
# @return [String]
|
38
|
+
#
|
39
|
+
# @!attribute [rw] sub_title
|
40
|
+
# The subtitle shown below the title.
|
41
|
+
# @return [String]
|
42
|
+
#
|
43
|
+
# @!attribute [rw] attachment_link_url
|
44
|
+
# The URL of an attachment to the response card.
|
45
|
+
# @return [String]
|
46
|
+
#
|
47
|
+
# @!attribute [rw] image_url
|
48
|
+
# The URL of an image that is displayed to the user.
|
49
|
+
# @return [String]
|
50
|
+
#
|
51
|
+
# @!attribute [rw] buttons
|
52
|
+
# The list of options to show to the user.
|
53
|
+
# @return [Array<Types::Button>]
|
54
|
+
#
|
55
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/runtime.lex-2016-11-28/GenericAttachment AWS API Documentation
|
56
|
+
#
|
57
|
+
class GenericAttachment < Struct.new(
|
58
|
+
:title,
|
59
|
+
:sub_title,
|
60
|
+
:attachment_link_url,
|
61
|
+
:image_url,
|
62
|
+
:buttons)
|
63
|
+
include Aws::Structure
|
64
|
+
end
|
65
|
+
|
66
|
+
# @note When making an API call, you may pass PostContentRequest
|
67
|
+
# data as a hash:
|
68
|
+
#
|
69
|
+
# {
|
70
|
+
# bot_name: "BotName", # required
|
71
|
+
# bot_alias: "BotAlias", # required
|
72
|
+
# user_id: "UserId", # required
|
73
|
+
# session_attributes: "String",
|
74
|
+
# content_type: "HttpContentType", # required
|
75
|
+
# accept: "Accept",
|
76
|
+
# input_stream: "data", # required
|
77
|
+
# }
|
78
|
+
#
|
79
|
+
# @!attribute [rw] bot_name
|
80
|
+
# Name of the Amazon Lex bot.
|
81
|
+
# @return [String]
|
82
|
+
#
|
83
|
+
# @!attribute [rw] bot_alias
|
84
|
+
# Alias of the Amazon Lex bot.
|
85
|
+
# @return [String]
|
86
|
+
#
|
87
|
+
# @!attribute [rw] user_id
|
88
|
+
# ID of the client application user. Typically, each of your
|
89
|
+
# application users should have a unique ID. The application developer
|
90
|
+
# decides the user IDs. At runtime, each request must include the user
|
91
|
+
# ID. Note the following considerations:
|
92
|
+
#
|
93
|
+
# * If you want a user to start conversation on one device and
|
94
|
+
# continue the conversation on another device, you might choose a
|
95
|
+
# user-specific identifier, such as the user's login, or Amazon
|
96
|
+
# Cognito user ID (assuming your application is using Amazon
|
97
|
+
# Cognito).
|
98
|
+
#
|
99
|
+
# * If you want the same user to be able to have two independent
|
100
|
+
# conversations on two different devices, you might choose
|
101
|
+
# device-specific identifier, such as device ID, or some globally
|
102
|
+
# unique identifier.
|
103
|
+
# @return [String]
|
104
|
+
#
|
105
|
+
# @!attribute [rw] session_attributes
|
106
|
+
# You pass this value in the `x-amz-lex-session-attributes` HTTP
|
107
|
+
# header. The value must be map (keys and values must be strings) that
|
108
|
+
# is JSON serialized and then base64 encoded.
|
109
|
+
#
|
110
|
+
# A session represents dialog between a user and Amazon Lex. At
|
111
|
+
# runtime, a client application can pass contextual information, in
|
112
|
+
# the request to Amazon Lex. For example,
|
113
|
+
#
|
114
|
+
# * You might use session attributes to track the requestID of user
|
115
|
+
# requests.
|
116
|
+
#
|
117
|
+
# * In Getting Started Exercise 1, the example bot uses the price
|
118
|
+
# session attribute to maintain the price of flowers ordered (for
|
119
|
+
# example, "price":25). The code hook (Lambda function) sets this
|
120
|
+
# attribute based on the type of flowers ordered. For more
|
121
|
+
# information, see [Review the Details of Information Flow][1].
|
122
|
+
#
|
123
|
+
# * In the BookTrip bot exercise, the bot uses the
|
124
|
+
# `currentReservation` session attribute to maintains the slot data
|
125
|
+
# during the in-progress conversation to book a hotel or book a car.
|
126
|
+
# For more information, see [Details of Information Flow][2].
|
127
|
+
#
|
128
|
+
# Amazon Lex passes these session attributes to the Lambda functions
|
129
|
+
# configured for the intent In the your Lambda function, you can use
|
130
|
+
# the session attributes for initialization and customization
|
131
|
+
# (prompts). Some examples are:
|
132
|
+
#
|
133
|
+
# * Initialization - In a pizza ordering bot, if you pass user
|
134
|
+
# location (for example, `"Location : 111 Maple Street"`), then your
|
135
|
+
# Lambda function might use this information to determine the
|
136
|
+
# closest pizzeria to place the order (and perhaps set the
|
137
|
+
# storeAddress slot value as well).
|
138
|
+
#
|
139
|
+
# Personalized prompts - For example, you can configure prompts to
|
140
|
+
# refer to the user by name (for example, "Hey \[firstName\], what
|
141
|
+
# toppings would you like?"). You can pass the user's name as a
|
142
|
+
# session attribute ("firstName": "Joe") so that Amazon Lex can
|
143
|
+
# substitute the placeholder to provide a personalized prompt to the
|
144
|
+
# user ("Hey Joe, what toppings would you like?").
|
145
|
+
#
|
146
|
+
# <note markdown="1"> Amazon Lex does not persist session attributes.
|
147
|
+
#
|
148
|
+
# If you configured a code hook for the intent, Amazon Lex passes the
|
149
|
+
# incoming session attributes to the Lambda function. The Lambda
|
150
|
+
# function must return these session attributes if you want Amazon Lex
|
151
|
+
# to return them to the client.
|
152
|
+
#
|
153
|
+
# If there is no code hook configured for the intent Amazon Lex simply
|
154
|
+
# returns the session attributes to the client application.
|
155
|
+
#
|
156
|
+
# </note>
|
157
|
+
#
|
158
|
+
#
|
159
|
+
#
|
160
|
+
# [1]: http://docs.aws.amazon.com/lex/latest/dg/gs-bp-details-after-lambda.html
|
161
|
+
# [2]: http://docs.aws.amazon.com/lex/latest/dg/book-trip-detail-flow.html
|
162
|
+
# @return [String]
|
163
|
+
#
|
164
|
+
# @!attribute [rw] content_type
|
165
|
+
# You pass this values as the `Content-Type` HTTP header.
|
166
|
+
#
|
167
|
+
# Indicates the audio format or text. The header value must start with
|
168
|
+
# one of the following prefixes:
|
169
|
+
#
|
170
|
+
# * PCM format
|
171
|
+
#
|
172
|
+
# * audio/l16; rate=16000; channels=1
|
173
|
+
#
|
174
|
+
# * audio/x-l16; sample-rate=16000; channel-count=1
|
175
|
+
#
|
176
|
+
# * Opus format
|
177
|
+
#
|
178
|
+
# * audio/x-cbr-opus-with-preamble; preamble-size=0; bit-rate=1;
|
179
|
+
# frame-size-milliseconds=1.1
|
180
|
+
#
|
181
|
+
# ^
|
182
|
+
#
|
183
|
+
# * Text format
|
184
|
+
#
|
185
|
+
# * text/plain; charset=utf-8
|
186
|
+
#
|
187
|
+
# ^
|
188
|
+
# @return [String]
|
189
|
+
#
|
190
|
+
# @!attribute [rw] accept
|
191
|
+
# You pass this value as the `Accept` HTTP header.
|
192
|
+
#
|
193
|
+
# The message Amazon Lex returns in the response can be either text or
|
194
|
+
# speech based on the `Accept` HTTP header value in the request.
|
195
|
+
#
|
196
|
+
# * If the value is `text/plain; charset=utf-8`, Amazon Lex returns
|
197
|
+
# text in the response.
|
198
|
+
#
|
199
|
+
# * If the value begins with `audio/`, Amazon Lex returns speech in
|
200
|
+
# the response. Amazon Lex uses Amazon Polly to generate the speech
|
201
|
+
# (using the configuration you specified in the `Accept` header).
|
202
|
+
# For example, if you specify `audio/mpeg` as the value, Amazon Lex
|
203
|
+
# returns speech in the MPEG format.
|
204
|
+
#
|
205
|
+
# The following are the accepted values:
|
206
|
+
#
|
207
|
+
# * audio/mpeg
|
208
|
+
#
|
209
|
+
# * audio/ogg
|
210
|
+
#
|
211
|
+
# * audio/pcm
|
212
|
+
#
|
213
|
+
# * text/plain; charset=utf-8
|
214
|
+
#
|
215
|
+
# * audio/* (defaults to mpeg)
|
216
|
+
# @return [String]
|
217
|
+
#
|
218
|
+
# @!attribute [rw] input_stream
|
219
|
+
# User input in PCM or Opus audio format or text format as described
|
220
|
+
# in the `Content-Type` HTTP header.
|
221
|
+
# @return [IO]
|
222
|
+
#
|
223
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/runtime.lex-2016-11-28/PostContentRequest AWS API Documentation
|
224
|
+
#
|
225
|
+
class PostContentRequest < Struct.new(
|
226
|
+
:bot_name,
|
227
|
+
:bot_alias,
|
228
|
+
:user_id,
|
229
|
+
:session_attributes,
|
230
|
+
:content_type,
|
231
|
+
:accept,
|
232
|
+
:input_stream)
|
233
|
+
include Aws::Structure
|
234
|
+
end
|
235
|
+
|
236
|
+
# @!attribute [rw] content_type
|
237
|
+
# Content type as specified in the `Accept` HTTP header in the
|
238
|
+
# request.
|
239
|
+
# @return [String]
|
240
|
+
#
|
241
|
+
# @!attribute [rw] intent_name
|
242
|
+
# Current user intent that Amazon Lex is aware of.
|
243
|
+
# @return [String]
|
244
|
+
#
|
245
|
+
# @!attribute [rw] slots
|
246
|
+
# Map of zero or more intent slots (name/value pairs) Amazon Lex
|
247
|
+
# detected from the user input during the conversation.
|
248
|
+
# @return [String]
|
249
|
+
#
|
250
|
+
# @!attribute [rw] session_attributes
|
251
|
+
# Map of key/value pairs representing the session-specific context
|
252
|
+
# information.
|
253
|
+
# @return [String]
|
254
|
+
#
|
255
|
+
# @!attribute [rw] message
|
256
|
+
# Message to convey to the user. It can come from the bot's
|
257
|
+
# configuration or a code hook (Lambda function). If the current
|
258
|
+
# intent is not configured with a code hook or if the code hook
|
259
|
+
# returned `Delegate` as the `dialogAction.type` in its response, then
|
260
|
+
# Amazon Lex decides the next course of action and selects an
|
261
|
+
# appropriate message from the bot configuration based on the current
|
262
|
+
# user interaction context. For example, if Amazon Lex is not able to
|
263
|
+
# understand the user input, it uses a clarification prompt message
|
264
|
+
# (For more information, see the Error Handling section in the Amazon
|
265
|
+
# Lex console). Another example: if the intent requires confirmation
|
266
|
+
# before fulfillment, then Amazon Lex uses the confirmation prompt
|
267
|
+
# message in the intent configuration. If the code hook returns a
|
268
|
+
# message, Amazon Lex passes it as-is in its response to the client.
|
269
|
+
# @return [String]
|
270
|
+
#
|
271
|
+
# @!attribute [rw] dialog_state
|
272
|
+
# Identifies the current state of the user interaction. Amazon Lex
|
273
|
+
# returns one of the following values as `dialogState`. The client can
|
274
|
+
# optionally use this information to customize the user interface.
|
275
|
+
#
|
276
|
+
# * `ElicitIntent` – Amazon Lex wants to elicit the user's intent.
|
277
|
+
# Consider the following examples:
|
278
|
+
#
|
279
|
+
# For example, a user might utter an intent ("I want to order a
|
280
|
+
# pizza"). If Amazon Lex cannot infer the user intent from this
|
281
|
+
# utterance, it will return this dialog state.
|
282
|
+
#
|
283
|
+
# * `ConfirmIntent` – Amazon Lex is expecting a "yes" or "no"
|
284
|
+
# response.
|
285
|
+
#
|
286
|
+
# For example, Amazon Lex wants user confirmation before fulfilling
|
287
|
+
# an intent. Instead of a simple "yes" or "no" response, a user
|
288
|
+
# might respond with additional information. For example, "yes, but
|
289
|
+
# make it a thick crust pizza" or "no, I want to order a drink."
|
290
|
+
# Amazon Lex can process such additional information (in these
|
291
|
+
# examples, update the crust type slot or change the intent from
|
292
|
+
# OrderPizza to OrderDrink).
|
293
|
+
#
|
294
|
+
# * `ElicitSlot` – Amazon Lex is expecting the value of a slot for the
|
295
|
+
# current intent.
|
296
|
+
#
|
297
|
+
# For example, suppose that in the response Amazon Lex sends this
|
298
|
+
# message: "What size pizza would you like?". A user might reply
|
299
|
+
# with the slot value (e.g., "medium"). The user might also
|
300
|
+
# provide additional information in the response (e.g., "medium
|
301
|
+
# thick crust pizza"). Amazon Lex can process such additional
|
302
|
+
# information appropriately.
|
303
|
+
#
|
304
|
+
# * `Fulfilled` – Conveys that the Lambda function has successfully
|
305
|
+
# fulfilled the intent.
|
306
|
+
#
|
307
|
+
# * `ReadyForFulfillment` – Conveys that the client has to fullfill
|
308
|
+
# the request.
|
309
|
+
#
|
310
|
+
# * `Failed` – Conveys that the conversation with the user failed.
|
311
|
+
#
|
312
|
+
# This can happen for various reasons, including that the user does
|
313
|
+
# not provide an appropriate response to prompts from the service
|
314
|
+
# (you can configure how many times Amazon Lex can prompt a user for
|
315
|
+
# specific information), or if the Lambda function fails to fulfill
|
316
|
+
# the intent.
|
317
|
+
# @return [String]
|
318
|
+
#
|
319
|
+
# @!attribute [rw] slot_to_elicit
|
320
|
+
# If the `dialogState` value is `ElicitSlot`, returns the name of the
|
321
|
+
# slot for which Amazon Lex is eliciting a value.
|
322
|
+
# @return [String]
|
323
|
+
#
|
324
|
+
# @!attribute [rw] input_transcript
|
325
|
+
# Transcript of the voice input to the operation.
|
326
|
+
# @return [String]
|
327
|
+
#
|
328
|
+
# @!attribute [rw] audio_stream
|
329
|
+
# The prompt (or statement) to convey to the user. This is based on
|
330
|
+
# the bot configuration and context. For example, if Amazon Lex did
|
331
|
+
# not understand the user intent, it sends the `clarificationPrompt`
|
332
|
+
# configured for the bot. If the intent requires confirmation before
|
333
|
+
# taking the fulfillment action, it sends the `confirmationPrompt`.
|
334
|
+
# Another example: Suppose that the Lambda function successfully
|
335
|
+
# fulfilled the intent, and sent a message to convey to the user. Then
|
336
|
+
# Amazon Lex sends that message in the response.
|
337
|
+
# @return [IO]
|
338
|
+
#
|
339
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/runtime.lex-2016-11-28/PostContentResponse AWS API Documentation
|
340
|
+
#
|
341
|
+
class PostContentResponse < Struct.new(
|
342
|
+
:content_type,
|
343
|
+
:intent_name,
|
344
|
+
:slots,
|
345
|
+
:session_attributes,
|
346
|
+
:message,
|
347
|
+
:dialog_state,
|
348
|
+
:slot_to_elicit,
|
349
|
+
:input_transcript,
|
350
|
+
:audio_stream)
|
351
|
+
include Aws::Structure
|
352
|
+
end
|
353
|
+
|
354
|
+
# @note When making an API call, you may pass PostTextRequest
|
355
|
+
# data as a hash:
|
356
|
+
#
|
357
|
+
# {
|
358
|
+
# bot_name: "BotName", # required
|
359
|
+
# bot_alias: "BotAlias", # required
|
360
|
+
# user_id: "UserId", # required
|
361
|
+
# session_attributes: {
|
362
|
+
# "String" => "String",
|
363
|
+
# },
|
364
|
+
# input_text: "Text", # required
|
365
|
+
# }
|
366
|
+
#
|
367
|
+
# @!attribute [rw] bot_name
|
368
|
+
# The name of the Amazon Lex bot.
|
369
|
+
# @return [String]
|
370
|
+
#
|
371
|
+
# @!attribute [rw] bot_alias
|
372
|
+
# The alias of the Amazon Lex bot.
|
373
|
+
# @return [String]
|
374
|
+
#
|
375
|
+
# @!attribute [rw] user_id
|
376
|
+
# The ID of the client application user. The application developer
|
377
|
+
# decides the user IDs. At runtime, each request must include the user
|
378
|
+
# ID. Typically, each of your application users should have a unique
|
379
|
+
# ID. Note the following considerations:
|
380
|
+
#
|
381
|
+
# * If you want a user to start a conversation on one device and
|
382
|
+
# continue the conversation on another device, you might choose a
|
383
|
+
# user-specific identifier, such as a login or Amazon Cognito user
|
384
|
+
# ID (assuming your application is using Amazon Cognito).
|
385
|
+
#
|
386
|
+
# * If you want the same user to be able to have two independent
|
387
|
+
# conversations on two different devices, you might choose a
|
388
|
+
# device-specific identifier, such as device ID, or some globally
|
389
|
+
# unique identifier.
|
390
|
+
# @return [String]
|
391
|
+
#
|
392
|
+
# @!attribute [rw] session_attributes
|
393
|
+
# By using session attributes, a client application can pass
|
394
|
+
# contextual information in the request to Amazon Lex For example,
|
395
|
+
#
|
396
|
+
# * In Getting Started Exercise 1, the example bot uses the `price`
|
397
|
+
# session attribute to maintain the price of the flowers ordered
|
398
|
+
# (for example, "Price":25). The code hook (the Lambda function)
|
399
|
+
# sets this attribute based on the type of flowers ordered. For more
|
400
|
+
# information, see [Review the Details of Information Flow][1].
|
401
|
+
#
|
402
|
+
# * In the BookTrip bot exercise, the bot uses the
|
403
|
+
# `currentReservation` session attribute to maintain slot data
|
404
|
+
# during the in-progress conversation to book a hotel or book a car.
|
405
|
+
# For more information, see [Details of Information Flow][2].
|
406
|
+
#
|
407
|
+
# * You might use the session attributes (key, value pairs) to track
|
408
|
+
# the requestID of user requests.
|
409
|
+
#
|
410
|
+
# Amazon Lex simply passes these session attributes to the Lambda
|
411
|
+
# functions configured for the intent.
|
412
|
+
#
|
413
|
+
# In your Lambda function, you can also use the session attributes for
|
414
|
+
# initialization and customization (prompts and response cards). Some
|
415
|
+
# examples are:
|
416
|
+
#
|
417
|
+
# * Initialization - In a pizza ordering bot, if you can pass the user
|
418
|
+
# location as a session attribute (for example, `"Location" : "111
|
419
|
+
# Maple street"`), then your Lambda function might use this
|
420
|
+
# information to determine the closest pizzeria to place the order
|
421
|
+
# (perhaps to set the storeAddress slot value).
|
422
|
+
#
|
423
|
+
# * Personalize prompts - For example, you can configure prompts to
|
424
|
+
# refer to the user name. (For example, "Hey \[FirstName\], what
|
425
|
+
# toppings would you like?"). You can pass the user name as a
|
426
|
+
# session attribute (`"FirstName" : "Joe"`) so that Amazon Lex can
|
427
|
+
# substitute the placeholder to provide a personalize prompt to the
|
428
|
+
# user ("Hey Joe, what toppings would you like?").
|
429
|
+
#
|
430
|
+
# <note markdown="1"> Amazon Lex does not persist session attributes.
|
431
|
+
#
|
432
|
+
# If you configure a code hook for the intent, Amazon Lex passes the
|
433
|
+
# incoming session attributes to the Lambda function. If you want
|
434
|
+
# Amazon Lex to return these session attributes back to the client,
|
435
|
+
# the Lambda function must return them.
|
436
|
+
#
|
437
|
+
# If there is no code hook configured for the intent, Amazon Lex
|
438
|
+
# simply returns the session attributes back to the client
|
439
|
+
# application.
|
440
|
+
#
|
441
|
+
# </note>
|
442
|
+
#
|
443
|
+
#
|
444
|
+
#
|
445
|
+
# [1]: http://docs.aws.amazon.com/lex/latest/dg/gs-bp-details-after-lambda.html
|
446
|
+
# [2]: http://docs.aws.amazon.com/lex/latest/dg/book-trip-detail-flow.html
|
447
|
+
# @return [Hash<String,String>]
|
448
|
+
#
|
449
|
+
# @!attribute [rw] input_text
|
450
|
+
# The text that the user entered (Amazon Lex interprets this text).
|
451
|
+
# @return [String]
|
452
|
+
#
|
453
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/runtime.lex-2016-11-28/PostTextRequest AWS API Documentation
|
454
|
+
#
|
455
|
+
class PostTextRequest < Struct.new(
|
456
|
+
:bot_name,
|
457
|
+
:bot_alias,
|
458
|
+
:user_id,
|
459
|
+
:session_attributes,
|
460
|
+
:input_text)
|
461
|
+
include Aws::Structure
|
462
|
+
end
|
463
|
+
|
464
|
+
# @!attribute [rw] intent_name
|
465
|
+
# The current user intent that Amazon Lex is aware of.
|
466
|
+
# @return [String]
|
467
|
+
#
|
468
|
+
# @!attribute [rw] slots
|
469
|
+
# The intent slots (name/value pairs) that Amazon Lex detected so far
|
470
|
+
# from the user input in the conversation.
|
471
|
+
# @return [Hash<String,String>]
|
472
|
+
#
|
473
|
+
# @!attribute [rw] session_attributes
|
474
|
+
# A map of key-value pairs representing the session-specific context
|
475
|
+
# information.
|
476
|
+
# @return [Hash<String,String>]
|
477
|
+
#
|
478
|
+
# @!attribute [rw] message
|
479
|
+
# A message to convey to the user. It can come from the bot's
|
480
|
+
# configuration or a code hook (Lambda function). If the current
|
481
|
+
# intent is not configured with a code hook or the code hook returned
|
482
|
+
# `Delegate` as the `dialogAction.type` in its response, then Amazon
|
483
|
+
# Lex decides the next course of action and selects an appropriate
|
484
|
+
# message from the bot configuration based on the current user
|
485
|
+
# interaction context. For example, if Amazon Lex is not able to
|
486
|
+
# understand the user input, it uses a clarification prompt message
|
487
|
+
# (for more information, see the Error Handling section in the Amazon
|
488
|
+
# Lex console). Another example: if the intent requires confirmation
|
489
|
+
# before fulfillment, then Amazon Lex uses the confirmation prompt
|
490
|
+
# message in the intent configuration. If the code hook returns a
|
491
|
+
# message, Amazon Lex passes it as-is in its response to the client.
|
492
|
+
# @return [String]
|
493
|
+
#
|
494
|
+
# @!attribute [rw] dialog_state
|
495
|
+
# Identifies the current state of the user interaction. Amazon Lex
|
496
|
+
# returns one of the following values as `dialogState`. The client can
|
497
|
+
# optionally use this information to customize the user interface.
|
498
|
+
#
|
499
|
+
# * `ElicitIntent` – Amazon Lex wants to elicit user intent.
|
500
|
+
#
|
501
|
+
# For example, a user might utter an intent ("I want to order a
|
502
|
+
# pizza"). If Amazon Lex cannot infer the user intent from this
|
503
|
+
# utterance, it will return this dialogState.
|
504
|
+
#
|
505
|
+
# * `ConfirmIntent` – Amazon Lex is expecting a "yes" or "no"
|
506
|
+
# response.
|
507
|
+
#
|
508
|
+
# For example, Amazon Lex wants user confirmation before fulfilling
|
509
|
+
# an intent.
|
510
|
+
#
|
511
|
+
# Instead of a simple "yes" or "no," a user might respond with
|
512
|
+
# additional information. For example, "yes, but make it thick
|
513
|
+
# crust pizza" or "no, I want to order a drink". Amazon Lex can
|
514
|
+
# process such additional information (in these examples, update the
|
515
|
+
# crust type slot value, or change intent from OrderPizza to
|
516
|
+
# OrderDrink).
|
517
|
+
#
|
518
|
+
# * `ElicitSlot` – Amazon Lex is expecting a slot value for the
|
519
|
+
# current intent.
|
520
|
+
#
|
521
|
+
# For example, suppose that in the response Amazon Lex sends this
|
522
|
+
# message: "What size pizza would you like?". A user might reply
|
523
|
+
# with the slot value (e.g., "medium"). The user might also
|
524
|
+
# provide additional information in the response (e.g., "medium
|
525
|
+
# thick crust pizza"). Amazon Lex can process such additional
|
526
|
+
# information appropriately.
|
527
|
+
#
|
528
|
+
# * `Fulfilled` – Conveys that the Lambda function configured for the
|
529
|
+
# intent has successfully fulfilled the intent.
|
530
|
+
#
|
531
|
+
# * `ReadyForFulfillment` – Conveys that the client has to fulfill the
|
532
|
+
# intent.
|
533
|
+
#
|
534
|
+
# * `Failed` – Conveys that the conversation with the user failed.
|
535
|
+
#
|
536
|
+
# This can happen for various reasons including that the user did
|
537
|
+
# not provide an appropriate response to prompts from the service
|
538
|
+
# (you can configure how many times Amazon Lex can prompt a user for
|
539
|
+
# specific information), or the Lambda function failed to fulfill
|
540
|
+
# the intent.
|
541
|
+
# @return [String]
|
542
|
+
#
|
543
|
+
# @!attribute [rw] slot_to_elicit
|
544
|
+
# If the `dialogState` value is `ElicitSlot`, returns the name of the
|
545
|
+
# slot for which Amazon Lex is eliciting a value.
|
546
|
+
# @return [String]
|
547
|
+
#
|
548
|
+
# @!attribute [rw] response_card
|
549
|
+
# Represents the options that the user has to respond to the current
|
550
|
+
# prompt. Response Card can come from the bot configuration (in the
|
551
|
+
# Amazon Lex console, choose the settings button next to a slot) or
|
552
|
+
# from a code hook (Lambda function).
|
553
|
+
# @return [Types::ResponseCard]
|
554
|
+
#
|
555
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/runtime.lex-2016-11-28/PostTextResponse AWS API Documentation
|
556
|
+
#
|
557
|
+
class PostTextResponse < Struct.new(
|
558
|
+
:intent_name,
|
559
|
+
:slots,
|
560
|
+
:session_attributes,
|
561
|
+
:message,
|
562
|
+
:dialog_state,
|
563
|
+
:slot_to_elicit,
|
564
|
+
:response_card)
|
565
|
+
include Aws::Structure
|
566
|
+
end
|
567
|
+
|
568
|
+
# If you configure a response card when creating your bots, Amazon Lex
|
569
|
+
# substitutes the session attributes and slot values that are available,
|
570
|
+
# and then returns it. The response card can also come from a Lambda
|
571
|
+
# function ( `dialogCodeHook` and `fulfillmentActivity` on an intent).
|
572
|
+
#
|
573
|
+
# @!attribute [rw] version
|
574
|
+
# The version of the response card format.
|
575
|
+
# @return [String]
|
576
|
+
#
|
577
|
+
# @!attribute [rw] content_type
|
578
|
+
# The content type of the response.
|
579
|
+
# @return [String]
|
580
|
+
#
|
581
|
+
# @!attribute [rw] generic_attachments
|
582
|
+
# An array of attachment objects representing options.
|
583
|
+
# @return [Array<Types::GenericAttachment>]
|
584
|
+
#
|
585
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/runtime.lex-2016-11-28/ResponseCard AWS API Documentation
|
586
|
+
#
|
587
|
+
class ResponseCard < Struct.new(
|
588
|
+
:version,
|
589
|
+
:content_type,
|
590
|
+
:generic_attachments)
|
591
|
+
include Aws::Structure
|
592
|
+
end
|
593
|
+
|
594
|
+
end
|
595
|
+
end
|