line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Paws::LexRuntime::PostContent; |
3
|
1
|
|
|
1
|
|
592
|
use Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
10
|
|
4
|
|
|
|
|
|
|
has Accept => (is => 'ro', isa => 'Str', traits => ['ParamInHeader'], header_name => 'accept' ); |
5
|
|
|
|
|
|
|
has BotAlias => (is => 'ro', isa => 'Str', traits => ['ParamInURI'], uri_name => 'botAlias' , required => 1); |
6
|
|
|
|
|
|
|
has BotName => (is => 'ro', isa => 'Str', traits => ['ParamInURI'], uri_name => 'botName' , required => 1); |
7
|
|
|
|
|
|
|
has ContentType => (is => 'ro', isa => 'Str', traits => ['ParamInHeader'], header_name => 'contentType' , required => 1); |
8
|
|
|
|
|
|
|
has InputStream => (is => 'ro', isa => 'Str', required => 1); |
9
|
|
|
|
|
|
|
has SessionAttributes => (is => 'ro', isa => 'Str', traits => ['ParamInHeader'], header_name => 'sessionAttributes' ); |
10
|
|
|
|
|
|
|
has UserId => (is => 'ro', isa => 'Str', traits => ['ParamInURI'], uri_name => 'userId' , required => 1); |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
6602
|
use MooseX::ClassAttribute; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
13
|
|
|
|
|
|
|
class_has _stream_param => (is => 'ro', default => 'InputStream'); |
14
|
|
|
|
|
|
|
class_has _api_call => (isa => 'Str', is => 'ro', default => 'PostContent'); |
15
|
|
|
|
|
|
|
class_has _api_uri => (isa => 'Str', is => 'ro', default => '/bot/{botName}/alias/{botAlias}/user/{userId}/content'); |
16
|
|
|
|
|
|
|
class_has _api_method => (isa => 'Str', is => 'ro', default => 'POST'); |
17
|
|
|
|
|
|
|
class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::LexRuntime::PostContentResponse'); |
18
|
|
|
|
|
|
|
class_has _result_key => (isa => 'Str', is => 'ro'); |
19
|
|
|
|
|
|
|
1; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
### main pod documentation begin ### |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 NAME |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Paws::LexRuntime::PostContent - Arguments for method PostContent on Paws::LexRuntime |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 DESCRIPTION |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
This class represents the parameters used for calling the method PostContent on the |
30
|
|
|
|
|
|
|
Amazon Lex Runtime Service service. Use the attributes of this class |
31
|
|
|
|
|
|
|
as arguments to method PostContent. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to PostContent. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
As an example: |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$service_obj->PostContent(Att1 => $value1, Att2 => $value2, ...); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Values for attributes that are native types (Int, String, Float, etc) can passed as-is (scalar values). Values for complex Types (objects) can be passed as a HashRef. The keys and values of the hashref will be used to instance the underlying object. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 Accept => Str |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
You pass this value as the C<Accept> HTTP header. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
The message Amazon Lex returns in the response can be either text or |
49
|
|
|
|
|
|
|
speech based on the C<Accept> HTTP header value in the request. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=over |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=item * |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
If the value is C<text/plain; charset=utf-8>, Amazon Lex returns text |
56
|
|
|
|
|
|
|
in the response. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item * |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
If the value begins with C<audio/>, Amazon Lex returns speech in the |
61
|
|
|
|
|
|
|
response. Amazon Lex uses Amazon Polly to generate the speech (using |
62
|
|
|
|
|
|
|
the configuration you specified in the C<Accept> header). For example, |
63
|
|
|
|
|
|
|
if you specify C<audio/mpeg> as the value, Amazon Lex returns speech in |
64
|
|
|
|
|
|
|
the MPEG format. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
The following are the accepted values: |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=over |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item * |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
audio/mpeg |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item * |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
audio/ogg |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item * |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
audio/pcm |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item * |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
text/plain; charset=utf-8 |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item * |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
audio/* (defaults to mpeg) |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=back |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=back |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head2 B<REQUIRED> BotAlias => Str |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Alias of the Amazon Lex bot. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head2 B<REQUIRED> BotName => Str |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Name of the Amazon Lex bot. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head2 B<REQUIRED> ContentType => Str |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
You pass this values as the C<Content-Type> HTTP header. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Indicates the audio format or text. The header value must start with |
114
|
|
|
|
|
|
|
one of the following prefixes: |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=over |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=item * |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
PCM format |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=over |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item * |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
audio/l16; rate=16000; channels=1 |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=item * |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
audio/x-l16; sample-rate=16000; channel-count=1 |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=back |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=item * |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Opus format |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=over |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=item * |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
audio/x-cbr-opus-with-preamble; preamble-size=0; bit-rate=1; |
143
|
|
|
|
|
|
|
frame-size-milliseconds=1.1 |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=back |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=item * |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Text format |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=over |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=item * |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
text/plain; charset=utf-8 |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=back |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=back |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head2 B<REQUIRED> InputStream => Str |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
User input in PCM or Opus audio format or text format as described in |
167
|
|
|
|
|
|
|
the C<Content-Type> HTTP header. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head2 SessionAttributes => Str |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
You pass this value in the C<x-amz-lex-session-attributes> HTTP header. |
174
|
|
|
|
|
|
|
The value must be map (keys and values must be strings) that is JSON |
175
|
|
|
|
|
|
|
serialized and then base64 encoded. |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
A session represents dialog between a user and Amazon Lex. At runtime, |
178
|
|
|
|
|
|
|
a client application can pass contextual information, in the request to |
179
|
|
|
|
|
|
|
Amazon Lex. For example, |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=over |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=item * |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
You might use session attributes to track the requestID of user |
186
|
|
|
|
|
|
|
requests. |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=item * |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
In Getting Started Exercise 1, the example bot uses the price session |
191
|
|
|
|
|
|
|
attribute to maintain the price of flowers ordered (for example, |
192
|
|
|
|
|
|
|
"price":25). The code hook (Lambda function) sets this attribute based |
193
|
|
|
|
|
|
|
on the type of flowers ordered. For more information, see Review the |
194
|
|
|
|
|
|
|
Details of Information Flow. |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=item * |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
In the BookTrip bot exercise, the bot uses the C<currentReservation> |
199
|
|
|
|
|
|
|
session attribute to maintains the slot data during the in-progress |
200
|
|
|
|
|
|
|
conversation to book a hotel or book a car. For more information, see |
201
|
|
|
|
|
|
|
Details of Information Flow. |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=back |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
Amazon Lex passes these session attributes to the Lambda functions |
206
|
|
|
|
|
|
|
configured for the intent In the your Lambda function, you can use the |
207
|
|
|
|
|
|
|
session attributes for initialization and customization (prompts). Some |
208
|
|
|
|
|
|
|
examples are: |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=over |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=item * |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
Initialization - In a pizza ordering bot, if you pass user location |
215
|
|
|
|
|
|
|
(for example, C<"Location : 111 Maple Street">), then your Lambda |
216
|
|
|
|
|
|
|
function might use this information to determine the closest pizzeria |
217
|
|
|
|
|
|
|
to place the order (and perhaps set the storeAddress slot value as |
218
|
|
|
|
|
|
|
well). |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
Personalized prompts - For example, you can configure prompts to refer |
221
|
|
|
|
|
|
|
to the user by name (for example, "Hey [firstName], what toppings would |
222
|
|
|
|
|
|
|
you like?"). You can pass the user's name as a session attribute |
223
|
|
|
|
|
|
|
("firstName": "Joe") so that Amazon Lex can substitute the placeholder |
224
|
|
|
|
|
|
|
to provide a personalized prompt to the user ("Hey Joe, what toppings |
225
|
|
|
|
|
|
|
would you like?"). |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=back |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
Amazon Lex does not persist session attributes. |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
If you configured a code hook for the intent, Amazon Lex passes the |
232
|
|
|
|
|
|
|
incoming session attributes to the Lambda function. The Lambda function |
233
|
|
|
|
|
|
|
must return these session attributes if you want Amazon Lex to return |
234
|
|
|
|
|
|
|
them to the client. |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
If there is no code hook configured for the intent Amazon Lex simply |
237
|
|
|
|
|
|
|
returns the session attributes to the client application. |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=head2 B<REQUIRED> UserId => Str |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
ID of the client application user. Typically, each of your application |
244
|
|
|
|
|
|
|
users should have a unique ID. The application developer decides the |
245
|
|
|
|
|
|
|
user IDs. At runtime, each request must include the user ID. Note the |
246
|
|
|
|
|
|
|
following considerations: |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=over |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=item * |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
If you want a user to start conversation on one device and continue the |
253
|
|
|
|
|
|
|
conversation on another device, you might choose a user-specific |
254
|
|
|
|
|
|
|
identifier, such as the user's login, or Amazon Cognito user ID |
255
|
|
|
|
|
|
|
(assuming your application is using Amazon Cognito). |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
=item * |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
If you want the same user to be able to have two independent |
260
|
|
|
|
|
|
|
conversations on two different devices, you might choose |
261
|
|
|
|
|
|
|
device-specific identifier, such as device ID, or some globally unique |
262
|
|
|
|
|
|
|
identifier. |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
=back |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
=head1 SEE ALSO |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
This class forms part of L<Paws>, documenting arguments for method PostContent in L<Paws::LexRuntime> |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
=head1 BUGS and CONTRIBUTIONS |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
The source code is located here: https://github.com/pplu/aws-sdk-perl |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
Please report bugs to: https://github.com/pplu/aws-sdk-perl/issues |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=cut |
281
|
|
|
|
|
|
|
|