@aws-sdk/client-lex-runtime-v2 3.181.0 → 3.183.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist-es/LexRuntimeV2.js +26 -33
- package/dist-es/LexRuntimeV2Client.js +24 -30
- package/dist-es/commands/DeleteSessionCommand.js +21 -28
- package/dist-es/commands/GetSessionCommand.js +21 -28
- package/dist-es/commands/PutSessionCommand.js +21 -28
- package/dist-es/commands/RecognizeTextCommand.js +21 -28
- package/dist-es/commands/RecognizeUtteranceCommand.js +21 -28
- package/dist-es/commands/StartConversationCommand.js +21 -28
- package/dist-es/endpoints.js +8 -8
- package/dist-es/models/LexRuntimeV2ServiceException.js +5 -10
- package/dist-es/models/models_0.js +237 -141
- package/dist-es/protocols/Aws_restJson1.js +1063 -1301
- package/dist-es/runtimeConfig.browser.js +29 -12
- package/dist-es/runtimeConfig.js +33 -19
- package/dist-es/runtimeConfig.native.js +10 -5
- package/dist-es/runtimeConfig.shared.js +8 -11
- package/package.json +38 -38
|
@@ -1,1335 +1,1110 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator, __read } from "tslib";
|
|
2
1
|
import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
|
|
3
2
|
import { decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, limitedParseDouble as __limitedParseDouble, map as __map, resolvedPath as __resolvedPath, throwDefaultError, } from "@aws-sdk/smithy-client";
|
|
4
3
|
import { LexRuntimeV2ServiceException as __BaseException } from "../models/LexRuntimeV2ServiceException";
|
|
5
4
|
import { AccessDeniedException, BadGatewayException, ConflictException, DependencyFailedException, InternalServerException, ResourceNotFoundException, StartConversationRequestEventStream, ThrottlingException, ValidationException, } from "../models/models_0";
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
method: "DELETE",
|
|
25
|
-
headers: headers,
|
|
26
|
-
path: resolvedPath,
|
|
27
|
-
body: body,
|
|
28
|
-
})];
|
|
29
|
-
}
|
|
5
|
+
export const serializeAws_restJson1DeleteSessionCommand = async (input, context) => {
|
|
6
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
7
|
+
const headers = {};
|
|
8
|
+
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
|
|
9
|
+
"/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}";
|
|
10
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
|
|
11
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
|
|
12
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
|
|
13
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
|
|
14
|
+
let body;
|
|
15
|
+
return new __HttpRequest({
|
|
16
|
+
protocol,
|
|
17
|
+
hostname,
|
|
18
|
+
port,
|
|
19
|
+
method: "DELETE",
|
|
20
|
+
headers,
|
|
21
|
+
path: resolvedPath,
|
|
22
|
+
body,
|
|
30
23
|
});
|
|
31
|
-
}
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
method: "GET",
|
|
51
|
-
headers: headers,
|
|
52
|
-
path: resolvedPath,
|
|
53
|
-
body: body,
|
|
54
|
-
})];
|
|
55
|
-
}
|
|
24
|
+
};
|
|
25
|
+
export const serializeAws_restJson1GetSessionCommand = async (input, context) => {
|
|
26
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
27
|
+
const headers = {};
|
|
28
|
+
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
|
|
29
|
+
"/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}";
|
|
30
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
|
|
31
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
|
|
32
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
|
|
33
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
|
|
34
|
+
let body;
|
|
35
|
+
return new __HttpRequest({
|
|
36
|
+
protocol,
|
|
37
|
+
hostname,
|
|
38
|
+
port,
|
|
39
|
+
method: "GET",
|
|
40
|
+
headers,
|
|
41
|
+
path: resolvedPath,
|
|
42
|
+
body,
|
|
56
43
|
});
|
|
57
|
-
}
|
|
58
|
-
export
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
case 1:
|
|
64
|
-
_a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
|
|
65
|
-
headers = map({}, isSerializableHeaderValue, {
|
|
66
|
-
"content-type": "application/json",
|
|
67
|
-
responsecontenttype: input.responseContentType,
|
|
68
|
-
});
|
|
69
|
-
resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
|
|
70
|
-
"/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}";
|
|
71
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "botId", function () { return input.botId; }, "{botId}", false);
|
|
72
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", function () { return input.botAliasId; }, "{botAliasId}", false);
|
|
73
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "localeId", function () { return input.localeId; }, "{localeId}", false);
|
|
74
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", function () { return input.sessionId; }, "{sessionId}", false);
|
|
75
|
-
body = JSON.stringify(__assign(__assign(__assign({}, (input.messages != null && { messages: serializeAws_restJson1Messages(input.messages, context) })), (input.requestAttributes != null && {
|
|
76
|
-
requestAttributes: serializeAws_restJson1StringMap(input.requestAttributes, context),
|
|
77
|
-
})), (input.sessionState != null && {
|
|
78
|
-
sessionState: serializeAws_restJson1SessionState(input.sessionState, context),
|
|
79
|
-
})));
|
|
80
|
-
return [2, new __HttpRequest({
|
|
81
|
-
protocol: protocol,
|
|
82
|
-
hostname: hostname,
|
|
83
|
-
port: port,
|
|
84
|
-
method: "POST",
|
|
85
|
-
headers: headers,
|
|
86
|
-
path: resolvedPath,
|
|
87
|
-
body: body,
|
|
88
|
-
})];
|
|
89
|
-
}
|
|
44
|
+
};
|
|
45
|
+
export const serializeAws_restJson1PutSessionCommand = async (input, context) => {
|
|
46
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
47
|
+
const headers = map({}, isSerializableHeaderValue, {
|
|
48
|
+
"content-type": "application/json",
|
|
49
|
+
responsecontenttype: input.responseContentType,
|
|
90
50
|
});
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "localeId", function () { return input.localeId; }, "{localeId}", false);
|
|
107
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", function () { return input.sessionId; }, "{sessionId}", false);
|
|
108
|
-
body = JSON.stringify(__assign(__assign(__assign({}, (input.requestAttributes != null && {
|
|
109
|
-
requestAttributes: serializeAws_restJson1StringMap(input.requestAttributes, context),
|
|
110
|
-
})), (input.sessionState != null && {
|
|
111
|
-
sessionState: serializeAws_restJson1SessionState(input.sessionState, context),
|
|
112
|
-
})), (input.text != null && { text: input.text })));
|
|
113
|
-
return [2, new __HttpRequest({
|
|
114
|
-
protocol: protocol,
|
|
115
|
-
hostname: hostname,
|
|
116
|
-
port: port,
|
|
117
|
-
method: "POST",
|
|
118
|
-
headers: headers,
|
|
119
|
-
path: resolvedPath,
|
|
120
|
-
body: body,
|
|
121
|
-
})];
|
|
122
|
-
}
|
|
51
|
+
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
|
|
52
|
+
"/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}";
|
|
53
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
|
|
54
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
|
|
55
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
|
|
56
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
|
|
57
|
+
let body;
|
|
58
|
+
body = JSON.stringify({
|
|
59
|
+
...(input.messages != null && { messages: serializeAws_restJson1Messages(input.messages, context) }),
|
|
60
|
+
...(input.requestAttributes != null && {
|
|
61
|
+
requestAttributes: serializeAws_restJson1StringMap(input.requestAttributes, context),
|
|
62
|
+
}),
|
|
63
|
+
...(input.sessionState != null && {
|
|
64
|
+
sessionState: serializeAws_restJson1SessionState(input.sessionState, context),
|
|
65
|
+
}),
|
|
123
66
|
});
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
headers = map({}, isSerializableHeaderValue, {
|
|
133
|
-
"x-amz-content-sha256": "UNSIGNED-PAYLOAD",
|
|
134
|
-
"content-type": input.requestContentType || "application/octet-stream",
|
|
135
|
-
"x-amz-lex-session-state": input.sessionState,
|
|
136
|
-
"x-amz-lex-request-attributes": input.requestAttributes,
|
|
137
|
-
"response-content-type": input.responseContentType,
|
|
138
|
-
});
|
|
139
|
-
resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
|
|
140
|
-
"/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/utterance";
|
|
141
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "botId", function () { return input.botId; }, "{botId}", false);
|
|
142
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", function () { return input.botAliasId; }, "{botAliasId}", false);
|
|
143
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "localeId", function () { return input.localeId; }, "{localeId}", false);
|
|
144
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", function () { return input.sessionId; }, "{sessionId}", false);
|
|
145
|
-
if (input.inputStream !== undefined) {
|
|
146
|
-
body = input.inputStream;
|
|
147
|
-
}
|
|
148
|
-
return [2, new __HttpRequest({
|
|
149
|
-
protocol: protocol,
|
|
150
|
-
hostname: hostname,
|
|
151
|
-
port: port,
|
|
152
|
-
method: "POST",
|
|
153
|
-
headers: headers,
|
|
154
|
-
path: resolvedPath,
|
|
155
|
-
body: body,
|
|
156
|
-
})];
|
|
157
|
-
}
|
|
67
|
+
return new __HttpRequest({
|
|
68
|
+
protocol,
|
|
69
|
+
hostname,
|
|
70
|
+
port,
|
|
71
|
+
method: "POST",
|
|
72
|
+
headers,
|
|
73
|
+
path: resolvedPath,
|
|
74
|
+
body,
|
|
158
75
|
});
|
|
159
|
-
}
|
|
160
|
-
export
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
protocol: protocol,
|
|
181
|
-
hostname: hostname,
|
|
182
|
-
port: port,
|
|
183
|
-
method: "POST",
|
|
184
|
-
headers: headers,
|
|
185
|
-
path: resolvedPath,
|
|
186
|
-
body: body,
|
|
187
|
-
})];
|
|
188
|
-
}
|
|
76
|
+
};
|
|
77
|
+
export const serializeAws_restJson1RecognizeTextCommand = async (input, context) => {
|
|
78
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
79
|
+
const headers = {
|
|
80
|
+
"content-type": "application/json",
|
|
81
|
+
};
|
|
82
|
+
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
|
|
83
|
+
"/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/text";
|
|
84
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
|
|
85
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
|
|
86
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
|
|
87
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
|
|
88
|
+
let body;
|
|
89
|
+
body = JSON.stringify({
|
|
90
|
+
...(input.requestAttributes != null && {
|
|
91
|
+
requestAttributes: serializeAws_restJson1StringMap(input.requestAttributes, context),
|
|
92
|
+
}),
|
|
93
|
+
...(input.sessionState != null && {
|
|
94
|
+
sessionState: serializeAws_restJson1SessionState(input.sessionState, context),
|
|
95
|
+
}),
|
|
96
|
+
...(input.text != null && { text: input.text }),
|
|
189
97
|
});
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
contents = map({
|
|
200
|
-
$metadata: deserializeMetadata(output),
|
|
201
|
-
});
|
|
202
|
-
_a = __expectNonNull;
|
|
203
|
-
_b = __expectObject;
|
|
204
|
-
return [4, parseBody(output.body, context)];
|
|
205
|
-
case 1:
|
|
206
|
-
data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
|
|
207
|
-
if (data.botAliasId != null) {
|
|
208
|
-
contents.botAliasId = __expectString(data.botAliasId);
|
|
209
|
-
}
|
|
210
|
-
if (data.botId != null) {
|
|
211
|
-
contents.botId = __expectString(data.botId);
|
|
212
|
-
}
|
|
213
|
-
if (data.localeId != null) {
|
|
214
|
-
contents.localeId = __expectString(data.localeId);
|
|
215
|
-
}
|
|
216
|
-
if (data.sessionId != null) {
|
|
217
|
-
contents.sessionId = __expectString(data.sessionId);
|
|
218
|
-
}
|
|
219
|
-
return [2, contents];
|
|
220
|
-
}
|
|
98
|
+
return new __HttpRequest({
|
|
99
|
+
protocol,
|
|
100
|
+
hostname,
|
|
101
|
+
port,
|
|
102
|
+
method: "POST",
|
|
103
|
+
headers,
|
|
104
|
+
path: resolvedPath,
|
|
105
|
+
body,
|
|
221
106
|
});
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
return [4, parseErrorBody(output.body, context)];
|
|
232
|
-
case 1:
|
|
233
|
-
parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
|
|
234
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
235
|
-
_b = errorCode;
|
|
236
|
-
switch (_b) {
|
|
237
|
-
case "AccessDeniedException": return [3, 2];
|
|
238
|
-
case "com.amazonaws.lexruntimev2#AccessDeniedException": return [3, 2];
|
|
239
|
-
case "ConflictException": return [3, 4];
|
|
240
|
-
case "com.amazonaws.lexruntimev2#ConflictException": return [3, 4];
|
|
241
|
-
case "InternalServerException": return [3, 6];
|
|
242
|
-
case "com.amazonaws.lexruntimev2#InternalServerException": return [3, 6];
|
|
243
|
-
case "ResourceNotFoundException": return [3, 8];
|
|
244
|
-
case "com.amazonaws.lexruntimev2#ResourceNotFoundException": return [3, 8];
|
|
245
|
-
case "ThrottlingException": return [3, 10];
|
|
246
|
-
case "com.amazonaws.lexruntimev2#ThrottlingException": return [3, 10];
|
|
247
|
-
case "ValidationException": return [3, 12];
|
|
248
|
-
case "com.amazonaws.lexruntimev2#ValidationException": return [3, 12];
|
|
249
|
-
}
|
|
250
|
-
return [3, 14];
|
|
251
|
-
case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
|
|
252
|
-
case 3: throw _d.sent();
|
|
253
|
-
case 4: return [4, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
|
|
254
|
-
case 5: throw _d.sent();
|
|
255
|
-
case 6: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
|
|
256
|
-
case 7: throw _d.sent();
|
|
257
|
-
case 8: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
|
|
258
|
-
case 9: throw _d.sent();
|
|
259
|
-
case 10: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
|
|
260
|
-
case 11: throw _d.sent();
|
|
261
|
-
case 12: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
|
|
262
|
-
case 13: throw _d.sent();
|
|
263
|
-
case 14:
|
|
264
|
-
parsedBody = parsedOutput.body;
|
|
265
|
-
throwDefaultError({
|
|
266
|
-
output: output,
|
|
267
|
-
parsedBody: parsedBody,
|
|
268
|
-
exceptionCtor: __BaseException,
|
|
269
|
-
errorCode: errorCode,
|
|
270
|
-
});
|
|
271
|
-
_d.label = 15;
|
|
272
|
-
case 15: return [2];
|
|
273
|
-
}
|
|
107
|
+
};
|
|
108
|
+
export const serializeAws_restJson1RecognizeUtteranceCommand = async (input, context) => {
|
|
109
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
110
|
+
const headers = map({}, isSerializableHeaderValue, {
|
|
111
|
+
"x-amz-content-sha256": "UNSIGNED-PAYLOAD",
|
|
112
|
+
"content-type": input.requestContentType || "application/octet-stream",
|
|
113
|
+
"x-amz-lex-session-state": input.sessionState,
|
|
114
|
+
"x-amz-lex-request-attributes": input.requestAttributes,
|
|
115
|
+
"response-content-type": input.responseContentType,
|
|
274
116
|
});
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
contents.interpretations = deserializeAws_restJson1Interpretations(data.interpretations, context);
|
|
294
|
-
}
|
|
295
|
-
if (data.messages != null) {
|
|
296
|
-
contents.messages = deserializeAws_restJson1Messages(data.messages, context);
|
|
297
|
-
}
|
|
298
|
-
if (data.sessionId != null) {
|
|
299
|
-
contents.sessionId = __expectString(data.sessionId);
|
|
300
|
-
}
|
|
301
|
-
if (data.sessionState != null) {
|
|
302
|
-
contents.sessionState = deserializeAws_restJson1SessionState(data.sessionState, context);
|
|
303
|
-
}
|
|
304
|
-
return [2, contents];
|
|
305
|
-
}
|
|
117
|
+
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
|
|
118
|
+
"/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/utterance";
|
|
119
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
|
|
120
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
|
|
121
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
|
|
122
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
|
|
123
|
+
let body;
|
|
124
|
+
if (input.inputStream !== undefined) {
|
|
125
|
+
body = input.inputStream;
|
|
126
|
+
}
|
|
127
|
+
return new __HttpRequest({
|
|
128
|
+
protocol,
|
|
129
|
+
hostname,
|
|
130
|
+
port,
|
|
131
|
+
method: "POST",
|
|
132
|
+
headers,
|
|
133
|
+
path: resolvedPath,
|
|
134
|
+
body,
|
|
306
135
|
});
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
switch (_d.label) {
|
|
313
|
-
case 0:
|
|
314
|
-
_a = [__assign({}, output)];
|
|
315
|
-
_c = {};
|
|
316
|
-
return [4, parseErrorBody(output.body, context)];
|
|
317
|
-
case 1:
|
|
318
|
-
parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
|
|
319
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
320
|
-
_b = errorCode;
|
|
321
|
-
switch (_b) {
|
|
322
|
-
case "AccessDeniedException": return [3, 2];
|
|
323
|
-
case "com.amazonaws.lexruntimev2#AccessDeniedException": return [3, 2];
|
|
324
|
-
case "InternalServerException": return [3, 4];
|
|
325
|
-
case "com.amazonaws.lexruntimev2#InternalServerException": return [3, 4];
|
|
326
|
-
case "ResourceNotFoundException": return [3, 6];
|
|
327
|
-
case "com.amazonaws.lexruntimev2#ResourceNotFoundException": return [3, 6];
|
|
328
|
-
case "ThrottlingException": return [3, 8];
|
|
329
|
-
case "com.amazonaws.lexruntimev2#ThrottlingException": return [3, 8];
|
|
330
|
-
case "ValidationException": return [3, 10];
|
|
331
|
-
case "com.amazonaws.lexruntimev2#ValidationException": return [3, 10];
|
|
332
|
-
}
|
|
333
|
-
return [3, 12];
|
|
334
|
-
case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
|
|
335
|
-
case 3: throw _d.sent();
|
|
336
|
-
case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
|
|
337
|
-
case 5: throw _d.sent();
|
|
338
|
-
case 6: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
|
|
339
|
-
case 7: throw _d.sent();
|
|
340
|
-
case 8: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
|
|
341
|
-
case 9: throw _d.sent();
|
|
342
|
-
case 10: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
|
|
343
|
-
case 11: throw _d.sent();
|
|
344
|
-
case 12:
|
|
345
|
-
parsedBody = parsedOutput.body;
|
|
346
|
-
throwDefaultError({
|
|
347
|
-
output: output,
|
|
348
|
-
parsedBody: parsedBody,
|
|
349
|
-
exceptionCtor: __BaseException,
|
|
350
|
-
errorCode: errorCode,
|
|
351
|
-
});
|
|
352
|
-
_d.label = 13;
|
|
353
|
-
case 13: return [2];
|
|
354
|
-
}
|
|
136
|
+
};
|
|
137
|
+
export const serializeAws_restJson1StartConversationCommand = async (input, context) => {
|
|
138
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
139
|
+
const headers = map({}, isSerializableHeaderValue, {
|
|
140
|
+
"x-amz-lex-conversation-mode": input.conversationMode,
|
|
355
141
|
});
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
142
|
+
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
|
|
143
|
+
"/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/conversation";
|
|
144
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
|
|
145
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
|
|
146
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
|
|
147
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
|
|
148
|
+
let body;
|
|
149
|
+
if (input.requestEventStream !== undefined) {
|
|
150
|
+
body = serializeAws_restJson1StartConversationRequestEventStream(input.requestEventStream, context);
|
|
151
|
+
}
|
|
152
|
+
return new __HttpRequest({
|
|
153
|
+
protocol,
|
|
154
|
+
hostname,
|
|
155
|
+
port,
|
|
156
|
+
method: "POST",
|
|
157
|
+
headers,
|
|
158
|
+
path: resolvedPath,
|
|
159
|
+
body,
|
|
374
160
|
});
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
_a = [__assign({}, output)];
|
|
383
|
-
_c = {};
|
|
384
|
-
return [4, parseErrorBody(output.body, context)];
|
|
385
|
-
case 1:
|
|
386
|
-
parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
|
|
387
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
388
|
-
_b = errorCode;
|
|
389
|
-
switch (_b) {
|
|
390
|
-
case "AccessDeniedException": return [3, 2];
|
|
391
|
-
case "com.amazonaws.lexruntimev2#AccessDeniedException": return [3, 2];
|
|
392
|
-
case "BadGatewayException": return [3, 4];
|
|
393
|
-
case "com.amazonaws.lexruntimev2#BadGatewayException": return [3, 4];
|
|
394
|
-
case "ConflictException": return [3, 6];
|
|
395
|
-
case "com.amazonaws.lexruntimev2#ConflictException": return [3, 6];
|
|
396
|
-
case "DependencyFailedException": return [3, 8];
|
|
397
|
-
case "com.amazonaws.lexruntimev2#DependencyFailedException": return [3, 8];
|
|
398
|
-
case "InternalServerException": return [3, 10];
|
|
399
|
-
case "com.amazonaws.lexruntimev2#InternalServerException": return [3, 10];
|
|
400
|
-
case "ResourceNotFoundException": return [3, 12];
|
|
401
|
-
case "com.amazonaws.lexruntimev2#ResourceNotFoundException": return [3, 12];
|
|
402
|
-
case "ThrottlingException": return [3, 14];
|
|
403
|
-
case "com.amazonaws.lexruntimev2#ThrottlingException": return [3, 14];
|
|
404
|
-
case "ValidationException": return [3, 16];
|
|
405
|
-
case "com.amazonaws.lexruntimev2#ValidationException": return [3, 16];
|
|
406
|
-
}
|
|
407
|
-
return [3, 18];
|
|
408
|
-
case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
|
|
409
|
-
case 3: throw _d.sent();
|
|
410
|
-
case 4: return [4, deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context)];
|
|
411
|
-
case 5: throw _d.sent();
|
|
412
|
-
case 6: return [4, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
|
|
413
|
-
case 7: throw _d.sent();
|
|
414
|
-
case 8: return [4, deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context)];
|
|
415
|
-
case 9: throw _d.sent();
|
|
416
|
-
case 10: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
|
|
417
|
-
case 11: throw _d.sent();
|
|
418
|
-
case 12: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
|
|
419
|
-
case 13: throw _d.sent();
|
|
420
|
-
case 14: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
|
|
421
|
-
case 15: throw _d.sent();
|
|
422
|
-
case 16: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
|
|
423
|
-
case 17: throw _d.sent();
|
|
424
|
-
case 18:
|
|
425
|
-
parsedBody = parsedOutput.body;
|
|
426
|
-
throwDefaultError({
|
|
427
|
-
output: output,
|
|
428
|
-
parsedBody: parsedBody,
|
|
429
|
-
exceptionCtor: __BaseException,
|
|
430
|
-
errorCode: errorCode,
|
|
431
|
-
});
|
|
432
|
-
_d.label = 19;
|
|
433
|
-
case 19: return [2];
|
|
434
|
-
}
|
|
161
|
+
};
|
|
162
|
+
export const deserializeAws_restJson1DeleteSessionCommand = async (output, context) => {
|
|
163
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
164
|
+
return deserializeAws_restJson1DeleteSessionCommandError(output, context);
|
|
165
|
+
}
|
|
166
|
+
const contents = map({
|
|
167
|
+
$metadata: deserializeMetadata(output),
|
|
435
168
|
});
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
169
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
170
|
+
if (data.botAliasId != null) {
|
|
171
|
+
contents.botAliasId = __expectString(data.botAliasId);
|
|
172
|
+
}
|
|
173
|
+
if (data.botId != null) {
|
|
174
|
+
contents.botId = __expectString(data.botId);
|
|
175
|
+
}
|
|
176
|
+
if (data.localeId != null) {
|
|
177
|
+
contents.localeId = __expectString(data.localeId);
|
|
178
|
+
}
|
|
179
|
+
if (data.sessionId != null) {
|
|
180
|
+
contents.sessionId = __expectString(data.sessionId);
|
|
181
|
+
}
|
|
182
|
+
return contents;
|
|
183
|
+
};
|
|
184
|
+
const deserializeAws_restJson1DeleteSessionCommandError = async (output, context) => {
|
|
185
|
+
const parsedOutput = {
|
|
186
|
+
...output,
|
|
187
|
+
body: await parseErrorBody(output.body, context),
|
|
188
|
+
};
|
|
189
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
190
|
+
switch (errorCode) {
|
|
191
|
+
case "AccessDeniedException":
|
|
192
|
+
case "com.amazonaws.lexruntimev2#AccessDeniedException":
|
|
193
|
+
throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
|
|
194
|
+
case "ConflictException":
|
|
195
|
+
case "com.amazonaws.lexruntimev2#ConflictException":
|
|
196
|
+
throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
|
|
197
|
+
case "InternalServerException":
|
|
198
|
+
case "com.amazonaws.lexruntimev2#InternalServerException":
|
|
199
|
+
throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
|
|
200
|
+
case "ResourceNotFoundException":
|
|
201
|
+
case "com.amazonaws.lexruntimev2#ResourceNotFoundException":
|
|
202
|
+
throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
|
|
203
|
+
case "ThrottlingException":
|
|
204
|
+
case "com.amazonaws.lexruntimev2#ThrottlingException":
|
|
205
|
+
throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
|
|
206
|
+
case "ValidationException":
|
|
207
|
+
case "com.amazonaws.lexruntimev2#ValidationException":
|
|
208
|
+
throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
|
|
209
|
+
default:
|
|
210
|
+
const parsedBody = parsedOutput.body;
|
|
211
|
+
throwDefaultError({
|
|
212
|
+
output,
|
|
213
|
+
parsedBody,
|
|
214
|
+
exceptionCtor: __BaseException,
|
|
215
|
+
errorCode,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
export const deserializeAws_restJson1GetSessionCommand = async (output, context) => {
|
|
220
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
221
|
+
return deserializeAws_restJson1GetSessionCommandError(output, context);
|
|
222
|
+
}
|
|
223
|
+
const contents = map({
|
|
224
|
+
$metadata: deserializeMetadata(output),
|
|
470
225
|
});
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
case 19: return [2];
|
|
530
|
-
}
|
|
226
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
227
|
+
if (data.interpretations != null) {
|
|
228
|
+
contents.interpretations = deserializeAws_restJson1Interpretations(data.interpretations, context);
|
|
229
|
+
}
|
|
230
|
+
if (data.messages != null) {
|
|
231
|
+
contents.messages = deserializeAws_restJson1Messages(data.messages, context);
|
|
232
|
+
}
|
|
233
|
+
if (data.sessionId != null) {
|
|
234
|
+
contents.sessionId = __expectString(data.sessionId);
|
|
235
|
+
}
|
|
236
|
+
if (data.sessionState != null) {
|
|
237
|
+
contents.sessionState = deserializeAws_restJson1SessionState(data.sessionState, context);
|
|
238
|
+
}
|
|
239
|
+
return contents;
|
|
240
|
+
};
|
|
241
|
+
const deserializeAws_restJson1GetSessionCommandError = async (output, context) => {
|
|
242
|
+
const parsedOutput = {
|
|
243
|
+
...output,
|
|
244
|
+
body: await parseErrorBody(output.body, context),
|
|
245
|
+
};
|
|
246
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
247
|
+
switch (errorCode) {
|
|
248
|
+
case "AccessDeniedException":
|
|
249
|
+
case "com.amazonaws.lexruntimev2#AccessDeniedException":
|
|
250
|
+
throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
|
|
251
|
+
case "InternalServerException":
|
|
252
|
+
case "com.amazonaws.lexruntimev2#InternalServerException":
|
|
253
|
+
throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
|
|
254
|
+
case "ResourceNotFoundException":
|
|
255
|
+
case "com.amazonaws.lexruntimev2#ResourceNotFoundException":
|
|
256
|
+
throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
|
|
257
|
+
case "ThrottlingException":
|
|
258
|
+
case "com.amazonaws.lexruntimev2#ThrottlingException":
|
|
259
|
+
throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
|
|
260
|
+
case "ValidationException":
|
|
261
|
+
case "com.amazonaws.lexruntimev2#ValidationException":
|
|
262
|
+
throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
|
|
263
|
+
default:
|
|
264
|
+
const parsedBody = parsedOutput.body;
|
|
265
|
+
throwDefaultError({
|
|
266
|
+
output,
|
|
267
|
+
parsedBody,
|
|
268
|
+
exceptionCtor: __BaseException,
|
|
269
|
+
errorCode,
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
export const deserializeAws_restJson1PutSessionCommand = async (output, context) => {
|
|
274
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
275
|
+
return deserializeAws_restJson1PutSessionCommandError(output, context);
|
|
276
|
+
}
|
|
277
|
+
const contents = map({
|
|
278
|
+
$metadata: deserializeMetadata(output),
|
|
279
|
+
contentType: [, output.headers["content-type"]],
|
|
280
|
+
messages: [, output.headers["x-amz-lex-messages"]],
|
|
281
|
+
sessionState: [, output.headers["x-amz-lex-session-state"]],
|
|
282
|
+
requestAttributes: [, output.headers["x-amz-lex-request-attributes"]],
|
|
283
|
+
sessionId: [, output.headers["x-amz-lex-session-id"]],
|
|
531
284
|
});
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
285
|
+
const data = output.body;
|
|
286
|
+
contents.audioStream = data;
|
|
287
|
+
return contents;
|
|
288
|
+
};
|
|
289
|
+
const deserializeAws_restJson1PutSessionCommandError = async (output, context) => {
|
|
290
|
+
const parsedOutput = {
|
|
291
|
+
...output,
|
|
292
|
+
body: await parseErrorBody(output.body, context),
|
|
293
|
+
};
|
|
294
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
295
|
+
switch (errorCode) {
|
|
296
|
+
case "AccessDeniedException":
|
|
297
|
+
case "com.amazonaws.lexruntimev2#AccessDeniedException":
|
|
298
|
+
throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
|
|
299
|
+
case "BadGatewayException":
|
|
300
|
+
case "com.amazonaws.lexruntimev2#BadGatewayException":
|
|
301
|
+
throw await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context);
|
|
302
|
+
case "ConflictException":
|
|
303
|
+
case "com.amazonaws.lexruntimev2#ConflictException":
|
|
304
|
+
throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
|
|
305
|
+
case "DependencyFailedException":
|
|
306
|
+
case "com.amazonaws.lexruntimev2#DependencyFailedException":
|
|
307
|
+
throw await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context);
|
|
308
|
+
case "InternalServerException":
|
|
309
|
+
case "com.amazonaws.lexruntimev2#InternalServerException":
|
|
310
|
+
throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
|
|
311
|
+
case "ResourceNotFoundException":
|
|
312
|
+
case "com.amazonaws.lexruntimev2#ResourceNotFoundException":
|
|
313
|
+
throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
|
|
314
|
+
case "ThrottlingException":
|
|
315
|
+
case "com.amazonaws.lexruntimev2#ThrottlingException":
|
|
316
|
+
throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
|
|
317
|
+
case "ValidationException":
|
|
318
|
+
case "com.amazonaws.lexruntimev2#ValidationException":
|
|
319
|
+
throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
|
|
320
|
+
default:
|
|
321
|
+
const parsedBody = parsedOutput.body;
|
|
322
|
+
throwDefaultError({
|
|
323
|
+
output,
|
|
324
|
+
parsedBody,
|
|
325
|
+
exceptionCtor: __BaseException,
|
|
326
|
+
errorCode,
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
export const deserializeAws_restJson1RecognizeTextCommand = async (output, context) => {
|
|
331
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
332
|
+
return deserializeAws_restJson1RecognizeTextCommandError(output, context);
|
|
333
|
+
}
|
|
334
|
+
const contents = map({
|
|
335
|
+
$metadata: deserializeMetadata(output),
|
|
553
336
|
});
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
337
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
338
|
+
if (data.interpretations != null) {
|
|
339
|
+
contents.interpretations = deserializeAws_restJson1Interpretations(data.interpretations, context);
|
|
340
|
+
}
|
|
341
|
+
if (data.messages != null) {
|
|
342
|
+
contents.messages = deserializeAws_restJson1Messages(data.messages, context);
|
|
343
|
+
}
|
|
344
|
+
if (data.requestAttributes != null) {
|
|
345
|
+
contents.requestAttributes = deserializeAws_restJson1StringMap(data.requestAttributes, context);
|
|
346
|
+
}
|
|
347
|
+
if (data.sessionId != null) {
|
|
348
|
+
contents.sessionId = __expectString(data.sessionId);
|
|
349
|
+
}
|
|
350
|
+
if (data.sessionState != null) {
|
|
351
|
+
contents.sessionState = deserializeAws_restJson1SessionState(data.sessionState, context);
|
|
352
|
+
}
|
|
353
|
+
return contents;
|
|
354
|
+
};
|
|
355
|
+
const deserializeAws_restJson1RecognizeTextCommandError = async (output, context) => {
|
|
356
|
+
const parsedOutput = {
|
|
357
|
+
...output,
|
|
358
|
+
body: await parseErrorBody(output.body, context),
|
|
359
|
+
};
|
|
360
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
361
|
+
switch (errorCode) {
|
|
362
|
+
case "AccessDeniedException":
|
|
363
|
+
case "com.amazonaws.lexruntimev2#AccessDeniedException":
|
|
364
|
+
throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
|
|
365
|
+
case "BadGatewayException":
|
|
366
|
+
case "com.amazonaws.lexruntimev2#BadGatewayException":
|
|
367
|
+
throw await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context);
|
|
368
|
+
case "ConflictException":
|
|
369
|
+
case "com.amazonaws.lexruntimev2#ConflictException":
|
|
370
|
+
throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
|
|
371
|
+
case "DependencyFailedException":
|
|
372
|
+
case "com.amazonaws.lexruntimev2#DependencyFailedException":
|
|
373
|
+
throw await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context);
|
|
374
|
+
case "InternalServerException":
|
|
375
|
+
case "com.amazonaws.lexruntimev2#InternalServerException":
|
|
376
|
+
throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
|
|
377
|
+
case "ResourceNotFoundException":
|
|
378
|
+
case "com.amazonaws.lexruntimev2#ResourceNotFoundException":
|
|
379
|
+
throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
|
|
380
|
+
case "ThrottlingException":
|
|
381
|
+
case "com.amazonaws.lexruntimev2#ThrottlingException":
|
|
382
|
+
throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
|
|
383
|
+
case "ValidationException":
|
|
384
|
+
case "com.amazonaws.lexruntimev2#ValidationException":
|
|
385
|
+
throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
|
|
386
|
+
default:
|
|
387
|
+
const parsedBody = parsedOutput.body;
|
|
388
|
+
throwDefaultError({
|
|
389
|
+
output,
|
|
390
|
+
parsedBody,
|
|
391
|
+
exceptionCtor: __BaseException,
|
|
392
|
+
errorCode,
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
export const deserializeAws_restJson1RecognizeUtteranceCommand = async (output, context) => {
|
|
397
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
398
|
+
return deserializeAws_restJson1RecognizeUtteranceCommandError(output, context);
|
|
399
|
+
}
|
|
400
|
+
const contents = map({
|
|
401
|
+
$metadata: deserializeMetadata(output),
|
|
402
|
+
inputMode: [, output.headers["x-amz-lex-input-mode"]],
|
|
403
|
+
contentType: [, output.headers["content-type"]],
|
|
404
|
+
messages: [, output.headers["x-amz-lex-messages"]],
|
|
405
|
+
interpretations: [, output.headers["x-amz-lex-interpretations"]],
|
|
406
|
+
sessionState: [, output.headers["x-amz-lex-session-state"]],
|
|
407
|
+
requestAttributes: [, output.headers["x-amz-lex-request-attributes"]],
|
|
408
|
+
sessionId: [, output.headers["x-amz-lex-session-id"]],
|
|
409
|
+
inputTranscript: [, output.headers["x-amz-lex-input-transcript"]],
|
|
614
410
|
});
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
411
|
+
const data = output.body;
|
|
412
|
+
contents.audioStream = data;
|
|
413
|
+
return contents;
|
|
414
|
+
};
|
|
415
|
+
const deserializeAws_restJson1RecognizeUtteranceCommandError = async (output, context) => {
|
|
416
|
+
const parsedOutput = {
|
|
417
|
+
...output,
|
|
418
|
+
body: await parseErrorBody(output.body, context),
|
|
419
|
+
};
|
|
420
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
421
|
+
switch (errorCode) {
|
|
422
|
+
case "AccessDeniedException":
|
|
423
|
+
case "com.amazonaws.lexruntimev2#AccessDeniedException":
|
|
424
|
+
throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
|
|
425
|
+
case "BadGatewayException":
|
|
426
|
+
case "com.amazonaws.lexruntimev2#BadGatewayException":
|
|
427
|
+
throw await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context);
|
|
428
|
+
case "ConflictException":
|
|
429
|
+
case "com.amazonaws.lexruntimev2#ConflictException":
|
|
430
|
+
throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
|
|
431
|
+
case "DependencyFailedException":
|
|
432
|
+
case "com.amazonaws.lexruntimev2#DependencyFailedException":
|
|
433
|
+
throw await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context);
|
|
434
|
+
case "InternalServerException":
|
|
435
|
+
case "com.amazonaws.lexruntimev2#InternalServerException":
|
|
436
|
+
throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
|
|
437
|
+
case "ResourceNotFoundException":
|
|
438
|
+
case "com.amazonaws.lexruntimev2#ResourceNotFoundException":
|
|
439
|
+
throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
|
|
440
|
+
case "ThrottlingException":
|
|
441
|
+
case "com.amazonaws.lexruntimev2#ThrottlingException":
|
|
442
|
+
throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
|
|
443
|
+
case "ValidationException":
|
|
444
|
+
case "com.amazonaws.lexruntimev2#ValidationException":
|
|
445
|
+
throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
|
|
446
|
+
default:
|
|
447
|
+
const parsedBody = parsedOutput.body;
|
|
448
|
+
throwDefaultError({
|
|
449
|
+
output,
|
|
450
|
+
parsedBody,
|
|
451
|
+
exceptionCtor: __BaseException,
|
|
452
|
+
errorCode,
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
export const deserializeAws_restJson1StartConversationCommand = async (output, context) => {
|
|
457
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
458
|
+
return deserializeAws_restJson1StartConversationCommandError(output, context);
|
|
459
|
+
}
|
|
460
|
+
const contents = map({
|
|
461
|
+
$metadata: deserializeMetadata(output),
|
|
628
462
|
});
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
}
|
|
463
|
+
const data = output.body;
|
|
464
|
+
contents.responseEventStream = deserializeAws_restJson1StartConversationResponseEventStream(data, context);
|
|
465
|
+
return contents;
|
|
466
|
+
};
|
|
467
|
+
const deserializeAws_restJson1StartConversationCommandError = async (output, context) => {
|
|
468
|
+
const parsedOutput = {
|
|
469
|
+
...output,
|
|
470
|
+
body: await parseErrorBody(output.body, context),
|
|
471
|
+
};
|
|
472
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
473
|
+
switch (errorCode) {
|
|
474
|
+
case "AccessDeniedException":
|
|
475
|
+
case "com.amazonaws.lexruntimev2#AccessDeniedException":
|
|
476
|
+
throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
|
|
477
|
+
case "InternalServerException":
|
|
478
|
+
case "com.amazonaws.lexruntimev2#InternalServerException":
|
|
479
|
+
throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
|
|
480
|
+
case "ThrottlingException":
|
|
481
|
+
case "com.amazonaws.lexruntimev2#ThrottlingException":
|
|
482
|
+
throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
|
|
483
|
+
case "ValidationException":
|
|
484
|
+
case "com.amazonaws.lexruntimev2#ValidationException":
|
|
485
|
+
throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
|
|
486
|
+
default:
|
|
487
|
+
const parsedBody = parsedOutput.body;
|
|
488
|
+
throwDefaultError({
|
|
489
|
+
output,
|
|
490
|
+
parsedBody,
|
|
491
|
+
exceptionCtor: __BaseException,
|
|
492
|
+
errorCode,
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
const map = __map;
|
|
497
|
+
const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
|
|
498
|
+
const contents = map({});
|
|
499
|
+
const data = parsedOutput.body;
|
|
500
|
+
if (data.message != null) {
|
|
501
|
+
contents.message = __expectString(data.message);
|
|
502
|
+
}
|
|
503
|
+
const exception = new AccessDeniedException({
|
|
504
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
505
|
+
...contents,
|
|
673
506
|
});
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
return [2, __decorateServiceException(exception, parsedOutput.body)];
|
|
507
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
508
|
+
};
|
|
509
|
+
const deserializeAws_restJson1BadGatewayExceptionResponse = async (parsedOutput, context) => {
|
|
510
|
+
const contents = map({});
|
|
511
|
+
const data = parsedOutput.body;
|
|
512
|
+
if (data.message != null) {
|
|
513
|
+
contents.message = __expectString(data.message);
|
|
514
|
+
}
|
|
515
|
+
const exception = new BadGatewayException({
|
|
516
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
517
|
+
...contents,
|
|
686
518
|
});
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
519
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
520
|
+
};
|
|
521
|
+
const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
|
|
522
|
+
const contents = map({});
|
|
523
|
+
const data = parsedOutput.body;
|
|
524
|
+
if (data.message != null) {
|
|
525
|
+
contents.message = __expectString(data.message);
|
|
526
|
+
}
|
|
527
|
+
const exception = new ConflictException({
|
|
528
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
529
|
+
...contents,
|
|
698
530
|
});
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
531
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
532
|
+
};
|
|
533
|
+
const deserializeAws_restJson1DependencyFailedExceptionResponse = async (parsedOutput, context) => {
|
|
534
|
+
const contents = map({});
|
|
535
|
+
const data = parsedOutput.body;
|
|
536
|
+
if (data.message != null) {
|
|
537
|
+
contents.message = __expectString(data.message);
|
|
538
|
+
}
|
|
539
|
+
const exception = new DependencyFailedException({
|
|
540
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
541
|
+
...contents,
|
|
710
542
|
});
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
543
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
544
|
+
};
|
|
545
|
+
const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
|
|
546
|
+
const contents = map({});
|
|
547
|
+
const data = parsedOutput.body;
|
|
548
|
+
if (data.message != null) {
|
|
549
|
+
contents.message = __expectString(data.message);
|
|
550
|
+
}
|
|
551
|
+
const exception = new InternalServerException({
|
|
552
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
553
|
+
...contents,
|
|
722
554
|
});
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
555
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
556
|
+
};
|
|
557
|
+
const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
|
|
558
|
+
const contents = map({});
|
|
559
|
+
const data = parsedOutput.body;
|
|
560
|
+
if (data.message != null) {
|
|
561
|
+
contents.message = __expectString(data.message);
|
|
562
|
+
}
|
|
563
|
+
const exception = new ResourceNotFoundException({
|
|
564
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
565
|
+
...contents,
|
|
734
566
|
});
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
567
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
568
|
+
};
|
|
569
|
+
const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
|
|
570
|
+
const contents = map({});
|
|
571
|
+
const data = parsedOutput.body;
|
|
572
|
+
if (data.message != null) {
|
|
573
|
+
contents.message = __expectString(data.message);
|
|
574
|
+
}
|
|
575
|
+
const exception = new ThrottlingException({
|
|
576
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
577
|
+
...contents,
|
|
746
578
|
});
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
579
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
580
|
+
};
|
|
581
|
+
const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
|
|
582
|
+
const contents = map({});
|
|
583
|
+
const data = parsedOutput.body;
|
|
584
|
+
if (data.message != null) {
|
|
585
|
+
contents.message = __expectString(data.message);
|
|
586
|
+
}
|
|
587
|
+
const exception = new ValidationException({
|
|
588
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
589
|
+
...contents,
|
|
758
590
|
});
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
591
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
592
|
+
};
|
|
593
|
+
const serializeAws_restJson1StartConversationRequestEventStream = (input, context) => {
|
|
594
|
+
const eventMarshallingVisitor = (event) => StartConversationRequestEventStream.visit(event, {
|
|
595
|
+
ConfigurationEvent: (value) => serializeAws_restJson1ConfigurationEvent_event(value, context),
|
|
596
|
+
AudioInputEvent: (value) => serializeAws_restJson1AudioInputEvent_event(value, context),
|
|
597
|
+
DTMFInputEvent: (value) => serializeAws_restJson1DTMFInputEvent_event(value, context),
|
|
598
|
+
TextInputEvent: (value) => serializeAws_restJson1TextInputEvent_event(value, context),
|
|
599
|
+
PlaybackCompletionEvent: (value) => serializeAws_restJson1PlaybackCompletionEvent_event(value, context),
|
|
600
|
+
DisconnectionEvent: (value) => serializeAws_restJson1DisconnectionEvent_event(value, context),
|
|
601
|
+
_: (value) => value,
|
|
770
602
|
});
|
|
771
|
-
}); };
|
|
772
|
-
var serializeAws_restJson1StartConversationRequestEventStream = function (input, context) {
|
|
773
|
-
var eventMarshallingVisitor = function (event) {
|
|
774
|
-
return StartConversationRequestEventStream.visit(event, {
|
|
775
|
-
ConfigurationEvent: function (value) { return serializeAws_restJson1ConfigurationEvent_event(value, context); },
|
|
776
|
-
AudioInputEvent: function (value) { return serializeAws_restJson1AudioInputEvent_event(value, context); },
|
|
777
|
-
DTMFInputEvent: function (value) { return serializeAws_restJson1DTMFInputEvent_event(value, context); },
|
|
778
|
-
TextInputEvent: function (value) { return serializeAws_restJson1TextInputEvent_event(value, context); },
|
|
779
|
-
PlaybackCompletionEvent: function (value) { return serializeAws_restJson1PlaybackCompletionEvent_event(value, context); },
|
|
780
|
-
DisconnectionEvent: function (value) { return serializeAws_restJson1DisconnectionEvent_event(value, context); },
|
|
781
|
-
_: function (value) { return value; },
|
|
782
|
-
});
|
|
783
|
-
};
|
|
784
603
|
return context.eventStreamMarshaller.serialize(input, eventMarshallingVisitor);
|
|
785
604
|
};
|
|
786
|
-
|
|
787
|
-
|
|
605
|
+
const serializeAws_restJson1AudioInputEvent_event = (input, context) => {
|
|
606
|
+
const headers = {
|
|
788
607
|
":event-type": { type: "string", value: "AudioInputEvent" },
|
|
789
608
|
":message-type": { type: "string", value: "event" },
|
|
790
609
|
":content-type": { type: "string", value: "application/json" },
|
|
791
610
|
};
|
|
792
|
-
|
|
611
|
+
let body = new Uint8Array();
|
|
793
612
|
body = serializeAws_restJson1AudioInputEvent(input, context);
|
|
794
613
|
body = context.utf8Decoder(JSON.stringify(body));
|
|
795
|
-
return { headers
|
|
614
|
+
return { headers, body };
|
|
796
615
|
};
|
|
797
|
-
|
|
798
|
-
|
|
616
|
+
const serializeAws_restJson1ConfigurationEvent_event = (input, context) => {
|
|
617
|
+
const headers = {
|
|
799
618
|
":event-type": { type: "string", value: "ConfigurationEvent" },
|
|
800
619
|
":message-type": { type: "string", value: "event" },
|
|
801
620
|
":content-type": { type: "string", value: "application/json" },
|
|
802
621
|
};
|
|
803
|
-
|
|
622
|
+
let body = new Uint8Array();
|
|
804
623
|
body = serializeAws_restJson1ConfigurationEvent(input, context);
|
|
805
624
|
body = context.utf8Decoder(JSON.stringify(body));
|
|
806
|
-
return { headers
|
|
625
|
+
return { headers, body };
|
|
807
626
|
};
|
|
808
|
-
|
|
809
|
-
|
|
627
|
+
const serializeAws_restJson1DisconnectionEvent_event = (input, context) => {
|
|
628
|
+
const headers = {
|
|
810
629
|
":event-type": { type: "string", value: "DisconnectionEvent" },
|
|
811
630
|
":message-type": { type: "string", value: "event" },
|
|
812
631
|
":content-type": { type: "string", value: "application/json" },
|
|
813
632
|
};
|
|
814
|
-
|
|
633
|
+
let body = new Uint8Array();
|
|
815
634
|
body = serializeAws_restJson1DisconnectionEvent(input, context);
|
|
816
635
|
body = context.utf8Decoder(JSON.stringify(body));
|
|
817
|
-
return { headers
|
|
636
|
+
return { headers, body };
|
|
818
637
|
};
|
|
819
|
-
|
|
820
|
-
|
|
638
|
+
const serializeAws_restJson1DTMFInputEvent_event = (input, context) => {
|
|
639
|
+
const headers = {
|
|
821
640
|
":event-type": { type: "string", value: "DTMFInputEvent" },
|
|
822
641
|
":message-type": { type: "string", value: "event" },
|
|
823
642
|
":content-type": { type: "string", value: "application/json" },
|
|
824
643
|
};
|
|
825
|
-
|
|
644
|
+
let body = new Uint8Array();
|
|
826
645
|
body = serializeAws_restJson1DTMFInputEvent(input, context);
|
|
827
646
|
body = context.utf8Decoder(JSON.stringify(body));
|
|
828
|
-
return { headers
|
|
647
|
+
return { headers, body };
|
|
829
648
|
};
|
|
830
|
-
|
|
831
|
-
|
|
649
|
+
const serializeAws_restJson1PlaybackCompletionEvent_event = (input, context) => {
|
|
650
|
+
const headers = {
|
|
832
651
|
":event-type": { type: "string", value: "PlaybackCompletionEvent" },
|
|
833
652
|
":message-type": { type: "string", value: "event" },
|
|
834
653
|
":content-type": { type: "string", value: "application/json" },
|
|
835
654
|
};
|
|
836
|
-
|
|
655
|
+
let body = new Uint8Array();
|
|
837
656
|
body = serializeAws_restJson1PlaybackCompletionEvent(input, context);
|
|
838
657
|
body = context.utf8Decoder(JSON.stringify(body));
|
|
839
|
-
return { headers
|
|
658
|
+
return { headers, body };
|
|
840
659
|
};
|
|
841
|
-
|
|
842
|
-
|
|
660
|
+
const serializeAws_restJson1TextInputEvent_event = (input, context) => {
|
|
661
|
+
const headers = {
|
|
843
662
|
":event-type": { type: "string", value: "TextInputEvent" },
|
|
844
663
|
":message-type": { type: "string", value: "event" },
|
|
845
664
|
":content-type": { type: "string", value: "application/json" },
|
|
846
665
|
};
|
|
847
|
-
|
|
666
|
+
let body = new Uint8Array();
|
|
848
667
|
body = serializeAws_restJson1TextInputEvent(input, context);
|
|
849
668
|
body = context.utf8Decoder(JSON.stringify(body));
|
|
850
|
-
return { headers
|
|
851
|
-
};
|
|
852
|
-
|
|
853
|
-
return context.eventStreamMarshaller.deserialize(output,
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
if (!(event["PlaybackInterruptionEvent"] != null)) return [3, 2];
|
|
859
|
-
_a = {};
|
|
860
|
-
return [4, deserializeAws_restJson1PlaybackInterruptionEvent_event(event["PlaybackInterruptionEvent"], context)];
|
|
861
|
-
case 1: return [2, (_a.PlaybackInterruptionEvent = _q.sent(),
|
|
862
|
-
_a)];
|
|
863
|
-
case 2:
|
|
864
|
-
if (!(event["TranscriptEvent"] != null)) return [3, 4];
|
|
865
|
-
_b = {};
|
|
866
|
-
return [4, deserializeAws_restJson1TranscriptEvent_event(event["TranscriptEvent"], context)];
|
|
867
|
-
case 3: return [2, (_b.TranscriptEvent = _q.sent(),
|
|
868
|
-
_b)];
|
|
869
|
-
case 4:
|
|
870
|
-
if (!(event["IntentResultEvent"] != null)) return [3, 6];
|
|
871
|
-
_c = {};
|
|
872
|
-
return [4, deserializeAws_restJson1IntentResultEvent_event(event["IntentResultEvent"], context)];
|
|
873
|
-
case 5: return [2, (_c.IntentResultEvent = _q.sent(),
|
|
874
|
-
_c)];
|
|
875
|
-
case 6:
|
|
876
|
-
if (!(event["TextResponseEvent"] != null)) return [3, 8];
|
|
877
|
-
_d = {};
|
|
878
|
-
return [4, deserializeAws_restJson1TextResponseEvent_event(event["TextResponseEvent"], context)];
|
|
879
|
-
case 7: return [2, (_d.TextResponseEvent = _q.sent(),
|
|
880
|
-
_d)];
|
|
881
|
-
case 8:
|
|
882
|
-
if (!(event["AudioResponseEvent"] != null)) return [3, 10];
|
|
883
|
-
_e = {};
|
|
884
|
-
return [4, deserializeAws_restJson1AudioResponseEvent_event(event["AudioResponseEvent"], context)];
|
|
885
|
-
case 9: return [2, (_e.AudioResponseEvent = _q.sent(),
|
|
886
|
-
_e)];
|
|
887
|
-
case 10:
|
|
888
|
-
if (!(event["HeartbeatEvent"] != null)) return [3, 12];
|
|
889
|
-
_f = {};
|
|
890
|
-
return [4, deserializeAws_restJson1HeartbeatEvent_event(event["HeartbeatEvent"], context)];
|
|
891
|
-
case 11: return [2, (_f.HeartbeatEvent = _q.sent(),
|
|
892
|
-
_f)];
|
|
893
|
-
case 12:
|
|
894
|
-
if (!(event["AccessDeniedException"] != null)) return [3, 14];
|
|
895
|
-
_g = {};
|
|
896
|
-
return [4, deserializeAws_restJson1AccessDeniedException_event(event["AccessDeniedException"], context)];
|
|
897
|
-
case 13: return [2, (_g.AccessDeniedException = _q.sent(),
|
|
898
|
-
_g)];
|
|
899
|
-
case 14:
|
|
900
|
-
if (!(event["ResourceNotFoundException"] != null)) return [3, 16];
|
|
901
|
-
_h = {};
|
|
902
|
-
return [4, deserializeAws_restJson1ResourceNotFoundException_event(event["ResourceNotFoundException"], context)];
|
|
903
|
-
case 15: return [2, (_h.ResourceNotFoundException = _q.sent(),
|
|
904
|
-
_h)];
|
|
905
|
-
case 16:
|
|
906
|
-
if (!(event["ValidationException"] != null)) return [3, 18];
|
|
907
|
-
_j = {};
|
|
908
|
-
return [4, deserializeAws_restJson1ValidationException_event(event["ValidationException"], context)];
|
|
909
|
-
case 17: return [2, (_j.ValidationException = _q.sent(),
|
|
910
|
-
_j)];
|
|
911
|
-
case 18:
|
|
912
|
-
if (!(event["ThrottlingException"] != null)) return [3, 20];
|
|
913
|
-
_k = {};
|
|
914
|
-
return [4, deserializeAws_restJson1ThrottlingException_event(event["ThrottlingException"], context)];
|
|
915
|
-
case 19: return [2, (_k.ThrottlingException = _q.sent(),
|
|
916
|
-
_k)];
|
|
917
|
-
case 20:
|
|
918
|
-
if (!(event["InternalServerException"] != null)) return [3, 22];
|
|
919
|
-
_l = {};
|
|
920
|
-
return [4, deserializeAws_restJson1InternalServerException_event(event["InternalServerException"], context)];
|
|
921
|
-
case 21: return [2, (_l.InternalServerException = _q.sent(),
|
|
922
|
-
_l)];
|
|
923
|
-
case 22:
|
|
924
|
-
if (!(event["ConflictException"] != null)) return [3, 24];
|
|
925
|
-
_m = {};
|
|
926
|
-
return [4, deserializeAws_restJson1ConflictException_event(event["ConflictException"], context)];
|
|
927
|
-
case 23: return [2, (_m.ConflictException = _q.sent(),
|
|
928
|
-
_m)];
|
|
929
|
-
case 24:
|
|
930
|
-
if (!(event["DependencyFailedException"] != null)) return [3, 26];
|
|
931
|
-
_o = {};
|
|
932
|
-
return [4, deserializeAws_restJson1DependencyFailedException_event(event["DependencyFailedException"], context)];
|
|
933
|
-
case 25: return [2, (_o.DependencyFailedException = _q.sent(),
|
|
934
|
-
_o)];
|
|
935
|
-
case 26:
|
|
936
|
-
if (!(event["BadGatewayException"] != null)) return [3, 28];
|
|
937
|
-
_p = {};
|
|
938
|
-
return [4, deserializeAws_restJson1BadGatewayException_event(event["BadGatewayException"], context)];
|
|
939
|
-
case 27: return [2, (_p.BadGatewayException = _q.sent(),
|
|
940
|
-
_p)];
|
|
941
|
-
case 28: return [2, { $unknown: output }];
|
|
942
|
-
}
|
|
943
|
-
});
|
|
944
|
-
}); });
|
|
945
|
-
};
|
|
946
|
-
var deserializeAws_restJson1AccessDeniedException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
947
|
-
var parsedOutput, _a;
|
|
948
|
-
var _b;
|
|
949
|
-
return __generator(this, function (_c) {
|
|
950
|
-
switch (_c.label) {
|
|
951
|
-
case 0:
|
|
952
|
-
_a = [__assign({}, output)];
|
|
953
|
-
_b = {};
|
|
954
|
-
return [4, parseBody(output.body, context)];
|
|
955
|
-
case 1:
|
|
956
|
-
parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
|
|
957
|
-
return [2, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
|
|
669
|
+
return { headers, body };
|
|
670
|
+
};
|
|
671
|
+
const deserializeAws_restJson1StartConversationResponseEventStream = (output, context) => {
|
|
672
|
+
return context.eventStreamMarshaller.deserialize(output, async (event) => {
|
|
673
|
+
if (event["PlaybackInterruptionEvent"] != null) {
|
|
674
|
+
return {
|
|
675
|
+
PlaybackInterruptionEvent: await deserializeAws_restJson1PlaybackInterruptionEvent_event(event["PlaybackInterruptionEvent"], context),
|
|
676
|
+
};
|
|
958
677
|
}
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
return __generator(this, function (_a) {
|
|
964
|
-
switch (_a.label) {
|
|
965
|
-
case 0:
|
|
966
|
-
contents = {};
|
|
967
|
-
return [4, parseBody(output.body, context)];
|
|
968
|
-
case 1:
|
|
969
|
-
data = _a.sent();
|
|
970
|
-
Object.assign(contents, deserializeAws_restJson1AudioResponseEvent(data, context));
|
|
971
|
-
return [2, contents];
|
|
678
|
+
if (event["TranscriptEvent"] != null) {
|
|
679
|
+
return {
|
|
680
|
+
TranscriptEvent: await deserializeAws_restJson1TranscriptEvent_event(event["TranscriptEvent"], context),
|
|
681
|
+
};
|
|
972
682
|
}
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
var _b;
|
|
978
|
-
return __generator(this, function (_c) {
|
|
979
|
-
switch (_c.label) {
|
|
980
|
-
case 0:
|
|
981
|
-
_a = [__assign({}, output)];
|
|
982
|
-
_b = {};
|
|
983
|
-
return [4, parseBody(output.body, context)];
|
|
984
|
-
case 1:
|
|
985
|
-
parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
|
|
986
|
-
return [2, deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context)];
|
|
683
|
+
if (event["IntentResultEvent"] != null) {
|
|
684
|
+
return {
|
|
685
|
+
IntentResultEvent: await deserializeAws_restJson1IntentResultEvent_event(event["IntentResultEvent"], context),
|
|
686
|
+
};
|
|
987
687
|
}
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
var _b;
|
|
993
|
-
return __generator(this, function (_c) {
|
|
994
|
-
switch (_c.label) {
|
|
995
|
-
case 0:
|
|
996
|
-
_a = [__assign({}, output)];
|
|
997
|
-
_b = {};
|
|
998
|
-
return [4, parseBody(output.body, context)];
|
|
999
|
-
case 1:
|
|
1000
|
-
parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
|
|
1001
|
-
return [2, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
|
|
688
|
+
if (event["TextResponseEvent"] != null) {
|
|
689
|
+
return {
|
|
690
|
+
TextResponseEvent: await deserializeAws_restJson1TextResponseEvent_event(event["TextResponseEvent"], context),
|
|
691
|
+
};
|
|
1002
692
|
}
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
var _b;
|
|
1008
|
-
return __generator(this, function (_c) {
|
|
1009
|
-
switch (_c.label) {
|
|
1010
|
-
case 0:
|
|
1011
|
-
_a = [__assign({}, output)];
|
|
1012
|
-
_b = {};
|
|
1013
|
-
return [4, parseBody(output.body, context)];
|
|
1014
|
-
case 1:
|
|
1015
|
-
parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
|
|
1016
|
-
return [2, deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context)];
|
|
693
|
+
if (event["AudioResponseEvent"] != null) {
|
|
694
|
+
return {
|
|
695
|
+
AudioResponseEvent: await deserializeAws_restJson1AudioResponseEvent_event(event["AudioResponseEvent"], context),
|
|
696
|
+
};
|
|
1017
697
|
}
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
return __generator(this, function (_a) {
|
|
1023
|
-
switch (_a.label) {
|
|
1024
|
-
case 0:
|
|
1025
|
-
contents = {};
|
|
1026
|
-
return [4, parseBody(output.body, context)];
|
|
1027
|
-
case 1:
|
|
1028
|
-
data = _a.sent();
|
|
1029
|
-
Object.assign(contents, deserializeAws_restJson1HeartbeatEvent(data, context));
|
|
1030
|
-
return [2, contents];
|
|
698
|
+
if (event["HeartbeatEvent"] != null) {
|
|
699
|
+
return {
|
|
700
|
+
HeartbeatEvent: await deserializeAws_restJson1HeartbeatEvent_event(event["HeartbeatEvent"], context),
|
|
701
|
+
};
|
|
1031
702
|
}
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
return __generator(this, function (_a) {
|
|
1037
|
-
switch (_a.label) {
|
|
1038
|
-
case 0:
|
|
1039
|
-
contents = {};
|
|
1040
|
-
return [4, parseBody(output.body, context)];
|
|
1041
|
-
case 1:
|
|
1042
|
-
data = _a.sent();
|
|
1043
|
-
Object.assign(contents, deserializeAws_restJson1IntentResultEvent(data, context));
|
|
1044
|
-
return [2, contents];
|
|
703
|
+
if (event["AccessDeniedException"] != null) {
|
|
704
|
+
return {
|
|
705
|
+
AccessDeniedException: await deserializeAws_restJson1AccessDeniedException_event(event["AccessDeniedException"], context),
|
|
706
|
+
};
|
|
1045
707
|
}
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
var _b;
|
|
1051
|
-
return __generator(this, function (_c) {
|
|
1052
|
-
switch (_c.label) {
|
|
1053
|
-
case 0:
|
|
1054
|
-
_a = [__assign({}, output)];
|
|
1055
|
-
_b = {};
|
|
1056
|
-
return [4, parseBody(output.body, context)];
|
|
1057
|
-
case 1:
|
|
1058
|
-
parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
|
|
1059
|
-
return [2, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
|
|
708
|
+
if (event["ResourceNotFoundException"] != null) {
|
|
709
|
+
return {
|
|
710
|
+
ResourceNotFoundException: await deserializeAws_restJson1ResourceNotFoundException_event(event["ResourceNotFoundException"], context),
|
|
711
|
+
};
|
|
1060
712
|
}
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
return __generator(this, function (_a) {
|
|
1066
|
-
switch (_a.label) {
|
|
1067
|
-
case 0:
|
|
1068
|
-
contents = {};
|
|
1069
|
-
return [4, parseBody(output.body, context)];
|
|
1070
|
-
case 1:
|
|
1071
|
-
data = _a.sent();
|
|
1072
|
-
Object.assign(contents, deserializeAws_restJson1PlaybackInterruptionEvent(data, context));
|
|
1073
|
-
return [2, contents];
|
|
713
|
+
if (event["ValidationException"] != null) {
|
|
714
|
+
return {
|
|
715
|
+
ValidationException: await deserializeAws_restJson1ValidationException_event(event["ValidationException"], context),
|
|
716
|
+
};
|
|
1074
717
|
}
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
var _b;
|
|
1080
|
-
return __generator(this, function (_c) {
|
|
1081
|
-
switch (_c.label) {
|
|
1082
|
-
case 0:
|
|
1083
|
-
_a = [__assign({}, output)];
|
|
1084
|
-
_b = {};
|
|
1085
|
-
return [4, parseBody(output.body, context)];
|
|
1086
|
-
case 1:
|
|
1087
|
-
parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
|
|
1088
|
-
return [2, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
|
|
718
|
+
if (event["ThrottlingException"] != null) {
|
|
719
|
+
return {
|
|
720
|
+
ThrottlingException: await deserializeAws_restJson1ThrottlingException_event(event["ThrottlingException"], context),
|
|
721
|
+
};
|
|
1089
722
|
}
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
return __generator(this, function (_a) {
|
|
1095
|
-
switch (_a.label) {
|
|
1096
|
-
case 0:
|
|
1097
|
-
contents = {};
|
|
1098
|
-
return [4, parseBody(output.body, context)];
|
|
1099
|
-
case 1:
|
|
1100
|
-
data = _a.sent();
|
|
1101
|
-
Object.assign(contents, deserializeAws_restJson1TextResponseEvent(data, context));
|
|
1102
|
-
return [2, contents];
|
|
723
|
+
if (event["InternalServerException"] != null) {
|
|
724
|
+
return {
|
|
725
|
+
InternalServerException: await deserializeAws_restJson1InternalServerException_event(event["InternalServerException"], context),
|
|
726
|
+
};
|
|
1103
727
|
}
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
var _b;
|
|
1109
|
-
return __generator(this, function (_c) {
|
|
1110
|
-
switch (_c.label) {
|
|
1111
|
-
case 0:
|
|
1112
|
-
_a = [__assign({}, output)];
|
|
1113
|
-
_b = {};
|
|
1114
|
-
return [4, parseBody(output.body, context)];
|
|
1115
|
-
case 1:
|
|
1116
|
-
parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
|
|
1117
|
-
return [2, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
|
|
728
|
+
if (event["ConflictException"] != null) {
|
|
729
|
+
return {
|
|
730
|
+
ConflictException: await deserializeAws_restJson1ConflictException_event(event["ConflictException"], context),
|
|
731
|
+
};
|
|
1118
732
|
}
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
return __generator(this, function (_a) {
|
|
1124
|
-
switch (_a.label) {
|
|
1125
|
-
case 0:
|
|
1126
|
-
contents = {};
|
|
1127
|
-
return [4, parseBody(output.body, context)];
|
|
1128
|
-
case 1:
|
|
1129
|
-
data = _a.sent();
|
|
1130
|
-
Object.assign(contents, deserializeAws_restJson1TranscriptEvent(data, context));
|
|
1131
|
-
return [2, contents];
|
|
733
|
+
if (event["DependencyFailedException"] != null) {
|
|
734
|
+
return {
|
|
735
|
+
DependencyFailedException: await deserializeAws_restJson1DependencyFailedException_event(event["DependencyFailedException"], context),
|
|
736
|
+
};
|
|
1132
737
|
}
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
var _b;
|
|
1138
|
-
return __generator(this, function (_c) {
|
|
1139
|
-
switch (_c.label) {
|
|
1140
|
-
case 0:
|
|
1141
|
-
_a = [__assign({}, output)];
|
|
1142
|
-
_b = {};
|
|
1143
|
-
return [4, parseBody(output.body, context)];
|
|
1144
|
-
case 1:
|
|
1145
|
-
parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
|
|
1146
|
-
return [2, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
|
|
738
|
+
if (event["BadGatewayException"] != null) {
|
|
739
|
+
return {
|
|
740
|
+
BadGatewayException: await deserializeAws_restJson1BadGatewayException_event(event["BadGatewayException"], context),
|
|
741
|
+
};
|
|
1147
742
|
}
|
|
743
|
+
return { $unknown: output };
|
|
1148
744
|
});
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
};
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
745
|
+
};
|
|
746
|
+
const deserializeAws_restJson1AccessDeniedException_event = async (output, context) => {
|
|
747
|
+
const parsedOutput = {
|
|
748
|
+
...output,
|
|
749
|
+
body: await parseBody(output.body, context),
|
|
750
|
+
};
|
|
751
|
+
return deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
|
|
752
|
+
};
|
|
753
|
+
const deserializeAws_restJson1AudioResponseEvent_event = async (output, context) => {
|
|
754
|
+
const contents = {};
|
|
755
|
+
const data = await parseBody(output.body, context);
|
|
756
|
+
Object.assign(contents, deserializeAws_restJson1AudioResponseEvent(data, context));
|
|
757
|
+
return contents;
|
|
758
|
+
};
|
|
759
|
+
const deserializeAws_restJson1BadGatewayException_event = async (output, context) => {
|
|
760
|
+
const parsedOutput = {
|
|
761
|
+
...output,
|
|
762
|
+
body: await parseBody(output.body, context),
|
|
763
|
+
};
|
|
764
|
+
return deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context);
|
|
765
|
+
};
|
|
766
|
+
const deserializeAws_restJson1ConflictException_event = async (output, context) => {
|
|
767
|
+
const parsedOutput = {
|
|
768
|
+
...output,
|
|
769
|
+
body: await parseBody(output.body, context),
|
|
770
|
+
};
|
|
771
|
+
return deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
|
|
772
|
+
};
|
|
773
|
+
const deserializeAws_restJson1DependencyFailedException_event = async (output, context) => {
|
|
774
|
+
const parsedOutput = {
|
|
775
|
+
...output,
|
|
776
|
+
body: await parseBody(output.body, context),
|
|
777
|
+
};
|
|
778
|
+
return deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context);
|
|
779
|
+
};
|
|
780
|
+
const deserializeAws_restJson1HeartbeatEvent_event = async (output, context) => {
|
|
781
|
+
const contents = {};
|
|
782
|
+
const data = await parseBody(output.body, context);
|
|
783
|
+
Object.assign(contents, deserializeAws_restJson1HeartbeatEvent(data, context));
|
|
784
|
+
return contents;
|
|
785
|
+
};
|
|
786
|
+
const deserializeAws_restJson1IntentResultEvent_event = async (output, context) => {
|
|
787
|
+
const contents = {};
|
|
788
|
+
const data = await parseBody(output.body, context);
|
|
789
|
+
Object.assign(contents, deserializeAws_restJson1IntentResultEvent(data, context));
|
|
790
|
+
return contents;
|
|
791
|
+
};
|
|
792
|
+
const deserializeAws_restJson1InternalServerException_event = async (output, context) => {
|
|
793
|
+
const parsedOutput = {
|
|
794
|
+
...output,
|
|
795
|
+
body: await parseBody(output.body, context),
|
|
796
|
+
};
|
|
797
|
+
return deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
|
|
798
|
+
};
|
|
799
|
+
const deserializeAws_restJson1PlaybackInterruptionEvent_event = async (output, context) => {
|
|
800
|
+
const contents = {};
|
|
801
|
+
const data = await parseBody(output.body, context);
|
|
802
|
+
Object.assign(contents, deserializeAws_restJson1PlaybackInterruptionEvent(data, context));
|
|
803
|
+
return contents;
|
|
804
|
+
};
|
|
805
|
+
const deserializeAws_restJson1ResourceNotFoundException_event = async (output, context) => {
|
|
806
|
+
const parsedOutput = {
|
|
807
|
+
...output,
|
|
808
|
+
body: await parseBody(output.body, context),
|
|
809
|
+
};
|
|
810
|
+
return deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
|
|
811
|
+
};
|
|
812
|
+
const deserializeAws_restJson1TextResponseEvent_event = async (output, context) => {
|
|
813
|
+
const contents = {};
|
|
814
|
+
const data = await parseBody(output.body, context);
|
|
815
|
+
Object.assign(contents, deserializeAws_restJson1TextResponseEvent(data, context));
|
|
816
|
+
return contents;
|
|
817
|
+
};
|
|
818
|
+
const deserializeAws_restJson1ThrottlingException_event = async (output, context) => {
|
|
819
|
+
const parsedOutput = {
|
|
820
|
+
...output,
|
|
821
|
+
body: await parseBody(output.body, context),
|
|
822
|
+
};
|
|
823
|
+
return deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
|
|
824
|
+
};
|
|
825
|
+
const deserializeAws_restJson1TranscriptEvent_event = async (output, context) => {
|
|
826
|
+
const contents = {};
|
|
827
|
+
const data = await parseBody(output.body, context);
|
|
828
|
+
Object.assign(contents, deserializeAws_restJson1TranscriptEvent(data, context));
|
|
829
|
+
return contents;
|
|
830
|
+
};
|
|
831
|
+
const deserializeAws_restJson1ValidationException_event = async (output, context) => {
|
|
832
|
+
const parsedOutput = {
|
|
833
|
+
...output,
|
|
834
|
+
body: await parseBody(output.body, context),
|
|
835
|
+
};
|
|
836
|
+
return deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
|
|
837
|
+
};
|
|
838
|
+
const serializeAws_restJson1ActiveContext = (input, context) => {
|
|
839
|
+
return {
|
|
840
|
+
...(input.contextAttributes != null && {
|
|
841
|
+
contextAttributes: serializeAws_restJson1ActiveContextParametersMap(input.contextAttributes, context),
|
|
842
|
+
}),
|
|
843
|
+
...(input.name != null && { name: input.name }),
|
|
844
|
+
...(input.timeToLive != null && {
|
|
845
|
+
timeToLive: serializeAws_restJson1ActiveContextTimeToLive(input.timeToLive, context),
|
|
846
|
+
}),
|
|
847
|
+
};
|
|
848
|
+
};
|
|
849
|
+
const serializeAws_restJson1ActiveContextParametersMap = (input, context) => {
|
|
850
|
+
return Object.entries(input).reduce((acc, [key, value]) => {
|
|
1161
851
|
if (value === null) {
|
|
1162
852
|
return acc;
|
|
1163
853
|
}
|
|
1164
|
-
return
|
|
854
|
+
return {
|
|
855
|
+
...acc,
|
|
856
|
+
[key]: value,
|
|
857
|
+
};
|
|
1165
858
|
}, {});
|
|
1166
859
|
};
|
|
1167
|
-
|
|
860
|
+
const serializeAws_restJson1ActiveContextsList = (input, context) => {
|
|
1168
861
|
return input
|
|
1169
|
-
.filter(
|
|
1170
|
-
.map(
|
|
862
|
+
.filter((e) => e != null)
|
|
863
|
+
.map((entry) => {
|
|
1171
864
|
return serializeAws_restJson1ActiveContext(entry, context);
|
|
1172
865
|
});
|
|
1173
866
|
};
|
|
1174
|
-
|
|
1175
|
-
return
|
|
867
|
+
const serializeAws_restJson1ActiveContextTimeToLive = (input, context) => {
|
|
868
|
+
return {
|
|
869
|
+
...(input.timeToLiveInSeconds != null && { timeToLiveInSeconds: input.timeToLiveInSeconds }),
|
|
870
|
+
...(input.turnsToLive != null && { turnsToLive: input.turnsToLive }),
|
|
871
|
+
};
|
|
1176
872
|
};
|
|
1177
|
-
|
|
1178
|
-
return
|
|
873
|
+
const serializeAws_restJson1AudioInputEvent = (input, context) => {
|
|
874
|
+
return {
|
|
875
|
+
...(input.audioChunk != null && { audioChunk: context.base64Encoder(input.audioChunk) }),
|
|
876
|
+
...(input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis }),
|
|
877
|
+
...(input.contentType != null && { contentType: input.contentType }),
|
|
878
|
+
...(input.eventId != null && { eventId: input.eventId }),
|
|
879
|
+
};
|
|
1179
880
|
};
|
|
1180
|
-
|
|
1181
|
-
return
|
|
881
|
+
const serializeAws_restJson1Button = (input, context) => {
|
|
882
|
+
return {
|
|
883
|
+
...(input.text != null && { text: input.text }),
|
|
884
|
+
...(input.value != null && { value: input.value }),
|
|
885
|
+
};
|
|
1182
886
|
};
|
|
1183
|
-
|
|
887
|
+
const serializeAws_restJson1ButtonsList = (input, context) => {
|
|
1184
888
|
return input
|
|
1185
|
-
.filter(
|
|
1186
|
-
.map(
|
|
889
|
+
.filter((e) => e != null)
|
|
890
|
+
.map((entry) => {
|
|
1187
891
|
return serializeAws_restJson1Button(entry, context);
|
|
1188
892
|
});
|
|
1189
893
|
};
|
|
1190
|
-
|
|
1191
|
-
return
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
894
|
+
const serializeAws_restJson1ConfigurationEvent = (input, context) => {
|
|
895
|
+
return {
|
|
896
|
+
...(input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis }),
|
|
897
|
+
...(input.disablePlayback != null && { disablePlayback: input.disablePlayback }),
|
|
898
|
+
...(input.eventId != null && { eventId: input.eventId }),
|
|
899
|
+
...(input.requestAttributes != null && {
|
|
900
|
+
requestAttributes: serializeAws_restJson1StringMap(input.requestAttributes, context),
|
|
901
|
+
}),
|
|
902
|
+
...(input.responseContentType != null && { responseContentType: input.responseContentType }),
|
|
903
|
+
...(input.sessionState != null && {
|
|
904
|
+
sessionState: serializeAws_restJson1SessionState(input.sessionState, context),
|
|
905
|
+
}),
|
|
906
|
+
...(input.welcomeMessages != null && {
|
|
907
|
+
welcomeMessages: serializeAws_restJson1Messages(input.welcomeMessages, context),
|
|
908
|
+
}),
|
|
909
|
+
};
|
|
1198
910
|
};
|
|
1199
|
-
|
|
1200
|
-
return
|
|
1201
|
-
|
|
1202
|
-
|
|
911
|
+
const serializeAws_restJson1DialogAction = (input, context) => {
|
|
912
|
+
return {
|
|
913
|
+
...(input.slotElicitationStyle != null && { slotElicitationStyle: input.slotElicitationStyle }),
|
|
914
|
+
...(input.slotToElicit != null && { slotToElicit: input.slotToElicit }),
|
|
915
|
+
...(input.subSlotToElicit != null && {
|
|
916
|
+
subSlotToElicit: serializeAws_restJson1ElicitSubSlot(input.subSlotToElicit, context),
|
|
917
|
+
}),
|
|
918
|
+
...(input.type != null && { type: input.type }),
|
|
919
|
+
};
|
|
1203
920
|
};
|
|
1204
|
-
|
|
1205
|
-
return
|
|
921
|
+
const serializeAws_restJson1DisconnectionEvent = (input, context) => {
|
|
922
|
+
return {
|
|
923
|
+
...(input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis }),
|
|
924
|
+
...(input.eventId != null && { eventId: input.eventId }),
|
|
925
|
+
};
|
|
1206
926
|
};
|
|
1207
|
-
|
|
1208
|
-
return
|
|
927
|
+
const serializeAws_restJson1DTMFInputEvent = (input, context) => {
|
|
928
|
+
return {
|
|
929
|
+
...(input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis }),
|
|
930
|
+
...(input.eventId != null && { eventId: input.eventId }),
|
|
931
|
+
...(input.inputCharacter != null && { inputCharacter: input.inputCharacter }),
|
|
932
|
+
};
|
|
1209
933
|
};
|
|
1210
|
-
|
|
1211
|
-
return
|
|
1212
|
-
|
|
1213
|
-
|
|
934
|
+
const serializeAws_restJson1ElicitSubSlot = (input, context) => {
|
|
935
|
+
return {
|
|
936
|
+
...(input.name != null && { name: input.name }),
|
|
937
|
+
...(input.subSlotToElicit != null && {
|
|
938
|
+
subSlotToElicit: serializeAws_restJson1ElicitSubSlot(input.subSlotToElicit, context),
|
|
939
|
+
}),
|
|
940
|
+
};
|
|
1214
941
|
};
|
|
1215
|
-
|
|
1216
|
-
return
|
|
942
|
+
const serializeAws_restJson1ImageResponseCard = (input, context) => {
|
|
943
|
+
return {
|
|
944
|
+
...(input.buttons != null && { buttons: serializeAws_restJson1ButtonsList(input.buttons, context) }),
|
|
945
|
+
...(input.imageUrl != null && { imageUrl: input.imageUrl }),
|
|
946
|
+
...(input.subtitle != null && { subtitle: input.subtitle }),
|
|
947
|
+
...(input.title != null && { title: input.title }),
|
|
948
|
+
};
|
|
1217
949
|
};
|
|
1218
|
-
|
|
1219
|
-
return
|
|
950
|
+
const serializeAws_restJson1Intent = (input, context) => {
|
|
951
|
+
return {
|
|
952
|
+
...(input.confirmationState != null && { confirmationState: input.confirmationState }),
|
|
953
|
+
...(input.name != null && { name: input.name }),
|
|
954
|
+
...(input.slots != null && { slots: serializeAws_restJson1Slots(input.slots, context) }),
|
|
955
|
+
...(input.state != null && { state: input.state }),
|
|
956
|
+
};
|
|
1220
957
|
};
|
|
1221
|
-
|
|
1222
|
-
return
|
|
1223
|
-
|
|
1224
|
-
|
|
958
|
+
const serializeAws_restJson1Message = (input, context) => {
|
|
959
|
+
return {
|
|
960
|
+
...(input.content != null && { content: input.content }),
|
|
961
|
+
...(input.contentType != null && { contentType: input.contentType }),
|
|
962
|
+
...(input.imageResponseCard != null && {
|
|
963
|
+
imageResponseCard: serializeAws_restJson1ImageResponseCard(input.imageResponseCard, context),
|
|
964
|
+
}),
|
|
965
|
+
};
|
|
1225
966
|
};
|
|
1226
|
-
|
|
967
|
+
const serializeAws_restJson1Messages = (input, context) => {
|
|
1227
968
|
return input
|
|
1228
|
-
.filter(
|
|
1229
|
-
.map(
|
|
969
|
+
.filter((e) => e != null)
|
|
970
|
+
.map((entry) => {
|
|
1230
971
|
return serializeAws_restJson1Message(entry, context);
|
|
1231
972
|
});
|
|
1232
973
|
};
|
|
1233
|
-
|
|
1234
|
-
return
|
|
974
|
+
const serializeAws_restJson1PlaybackCompletionEvent = (input, context) => {
|
|
975
|
+
return {
|
|
976
|
+
...(input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis }),
|
|
977
|
+
...(input.eventId != null && { eventId: input.eventId }),
|
|
978
|
+
};
|
|
1235
979
|
};
|
|
1236
|
-
|
|
1237
|
-
return
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
980
|
+
const serializeAws_restJson1RuntimeHintDetails = (input, context) => {
|
|
981
|
+
return {
|
|
982
|
+
...(input.runtimeHintValues != null && {
|
|
983
|
+
runtimeHintValues: serializeAws_restJson1RuntimeHintValuesList(input.runtimeHintValues, context),
|
|
984
|
+
}),
|
|
985
|
+
...(input.subSlotHints != null && {
|
|
986
|
+
subSlotHints: serializeAws_restJson1SlotHintsSlotMap(input.subSlotHints, context),
|
|
987
|
+
}),
|
|
988
|
+
};
|
|
1242
989
|
};
|
|
1243
|
-
|
|
1244
|
-
return
|
|
990
|
+
const serializeAws_restJson1RuntimeHints = (input, context) => {
|
|
991
|
+
return {
|
|
992
|
+
...(input.slotHints != null && { slotHints: serializeAws_restJson1SlotHintsIntentMap(input.slotHints, context) }),
|
|
993
|
+
};
|
|
1245
994
|
};
|
|
1246
|
-
|
|
1247
|
-
return
|
|
995
|
+
const serializeAws_restJson1RuntimeHintValue = (input, context) => {
|
|
996
|
+
return {
|
|
997
|
+
...(input.phrase != null && { phrase: input.phrase }),
|
|
998
|
+
};
|
|
1248
999
|
};
|
|
1249
|
-
|
|
1000
|
+
const serializeAws_restJson1RuntimeHintValuesList = (input, context) => {
|
|
1250
1001
|
return input
|
|
1251
|
-
.filter(
|
|
1252
|
-
.map(
|
|
1002
|
+
.filter((e) => e != null)
|
|
1003
|
+
.map((entry) => {
|
|
1253
1004
|
return serializeAws_restJson1RuntimeHintValue(entry, context);
|
|
1254
1005
|
});
|
|
1255
1006
|
};
|
|
1256
|
-
|
|
1257
|
-
return
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1007
|
+
const serializeAws_restJson1SessionState = (input, context) => {
|
|
1008
|
+
return {
|
|
1009
|
+
...(input.activeContexts != null && {
|
|
1010
|
+
activeContexts: serializeAws_restJson1ActiveContextsList(input.activeContexts, context),
|
|
1011
|
+
}),
|
|
1012
|
+
...(input.dialogAction != null && {
|
|
1013
|
+
dialogAction: serializeAws_restJson1DialogAction(input.dialogAction, context),
|
|
1014
|
+
}),
|
|
1015
|
+
...(input.intent != null && { intent: serializeAws_restJson1Intent(input.intent, context) }),
|
|
1016
|
+
...(input.originatingRequestId != null && { originatingRequestId: input.originatingRequestId }),
|
|
1017
|
+
...(input.runtimeHints != null && {
|
|
1018
|
+
runtimeHints: serializeAws_restJson1RuntimeHints(input.runtimeHints, context),
|
|
1019
|
+
}),
|
|
1020
|
+
...(input.sessionAttributes != null && {
|
|
1021
|
+
sessionAttributes: serializeAws_restJson1StringMap(input.sessionAttributes, context),
|
|
1022
|
+
}),
|
|
1023
|
+
};
|
|
1024
|
+
};
|
|
1025
|
+
const serializeAws_restJson1Slot = (input, context) => {
|
|
1026
|
+
return {
|
|
1027
|
+
...(input.shape != null && { shape: input.shape }),
|
|
1028
|
+
...(input.subSlots != null && { subSlots: serializeAws_restJson1Slots(input.subSlots, context) }),
|
|
1029
|
+
...(input.value != null && { value: serializeAws_restJson1Value(input.value, context) }),
|
|
1030
|
+
...(input.values != null && { values: serializeAws_restJson1Values(input.values, context) }),
|
|
1031
|
+
};
|
|
1032
|
+
};
|
|
1033
|
+
const serializeAws_restJson1SlotHintsIntentMap = (input, context) => {
|
|
1034
|
+
return Object.entries(input).reduce((acc, [key, value]) => {
|
|
1274
1035
|
if (value === null) {
|
|
1275
1036
|
return acc;
|
|
1276
1037
|
}
|
|
1277
|
-
return
|
|
1038
|
+
return {
|
|
1039
|
+
...acc,
|
|
1040
|
+
[key]: serializeAws_restJson1SlotHintsSlotMap(value, context),
|
|
1041
|
+
};
|
|
1278
1042
|
}, {});
|
|
1279
1043
|
};
|
|
1280
|
-
|
|
1281
|
-
return Object.entries(input).reduce(
|
|
1282
|
-
var _b;
|
|
1283
|
-
var _c = __read(_a, 2), key = _c[0], value = _c[1];
|
|
1044
|
+
const serializeAws_restJson1SlotHintsSlotMap = (input, context) => {
|
|
1045
|
+
return Object.entries(input).reduce((acc, [key, value]) => {
|
|
1284
1046
|
if (value === null) {
|
|
1285
1047
|
return acc;
|
|
1286
1048
|
}
|
|
1287
|
-
return
|
|
1049
|
+
return {
|
|
1050
|
+
...acc,
|
|
1051
|
+
[key]: serializeAws_restJson1RuntimeHintDetails(value, context),
|
|
1052
|
+
};
|
|
1288
1053
|
}, {});
|
|
1289
1054
|
};
|
|
1290
|
-
|
|
1291
|
-
return Object.entries(input).reduce(
|
|
1292
|
-
var _b;
|
|
1293
|
-
var _c = __read(_a, 2), key = _c[0], value = _c[1];
|
|
1055
|
+
const serializeAws_restJson1Slots = (input, context) => {
|
|
1056
|
+
return Object.entries(input).reduce((acc, [key, value]) => {
|
|
1294
1057
|
if (value === null) {
|
|
1295
1058
|
return acc;
|
|
1296
1059
|
}
|
|
1297
|
-
return
|
|
1060
|
+
return {
|
|
1061
|
+
...acc,
|
|
1062
|
+
[key]: serializeAws_restJson1Slot(value, context),
|
|
1063
|
+
};
|
|
1298
1064
|
}, {});
|
|
1299
1065
|
};
|
|
1300
|
-
|
|
1066
|
+
const serializeAws_restJson1StringList = (input, context) => {
|
|
1301
1067
|
return input
|
|
1302
|
-
.filter(
|
|
1303
|
-
.map(
|
|
1068
|
+
.filter((e) => e != null)
|
|
1069
|
+
.map((entry) => {
|
|
1304
1070
|
return entry;
|
|
1305
1071
|
});
|
|
1306
1072
|
};
|
|
1307
|
-
|
|
1308
|
-
return Object.entries(input).reduce(
|
|
1309
|
-
var _b;
|
|
1310
|
-
var _c = __read(_a, 2), key = _c[0], value = _c[1];
|
|
1073
|
+
const serializeAws_restJson1StringMap = (input, context) => {
|
|
1074
|
+
return Object.entries(input).reduce((acc, [key, value]) => {
|
|
1311
1075
|
if (value === null) {
|
|
1312
1076
|
return acc;
|
|
1313
1077
|
}
|
|
1314
|
-
return
|
|
1078
|
+
return {
|
|
1079
|
+
...acc,
|
|
1080
|
+
[key]: value,
|
|
1081
|
+
};
|
|
1315
1082
|
}, {});
|
|
1316
1083
|
};
|
|
1317
|
-
|
|
1318
|
-
return
|
|
1084
|
+
const serializeAws_restJson1TextInputEvent = (input, context) => {
|
|
1085
|
+
return {
|
|
1086
|
+
...(input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis }),
|
|
1087
|
+
...(input.eventId != null && { eventId: input.eventId }),
|
|
1088
|
+
...(input.text != null && { text: input.text }),
|
|
1089
|
+
};
|
|
1319
1090
|
};
|
|
1320
|
-
|
|
1321
|
-
return
|
|
1322
|
-
|
|
1323
|
-
|
|
1091
|
+
const serializeAws_restJson1Value = (input, context) => {
|
|
1092
|
+
return {
|
|
1093
|
+
...(input.interpretedValue != null && { interpretedValue: input.interpretedValue }),
|
|
1094
|
+
...(input.originalValue != null && { originalValue: input.originalValue }),
|
|
1095
|
+
...(input.resolvedValues != null && {
|
|
1096
|
+
resolvedValues: serializeAws_restJson1StringList(input.resolvedValues, context),
|
|
1097
|
+
}),
|
|
1098
|
+
};
|
|
1324
1099
|
};
|
|
1325
|
-
|
|
1100
|
+
const serializeAws_restJson1Values = (input, context) => {
|
|
1326
1101
|
return input
|
|
1327
|
-
.filter(
|
|
1328
|
-
.map(
|
|
1102
|
+
.filter((e) => e != null)
|
|
1103
|
+
.map((entry) => {
|
|
1329
1104
|
return serializeAws_restJson1Slot(entry, context);
|
|
1330
1105
|
});
|
|
1331
1106
|
};
|
|
1332
|
-
|
|
1107
|
+
const deserializeAws_restJson1ActiveContext = (output, context) => {
|
|
1333
1108
|
return {
|
|
1334
1109
|
contextAttributes: output.contextAttributes != null
|
|
1335
1110
|
? deserializeAws_restJson1ActiveContextParametersMap(output.contextAttributes, context)
|
|
@@ -1340,20 +1115,21 @@ var deserializeAws_restJson1ActiveContext = function (output, context) {
|
|
|
1340
1115
|
: undefined,
|
|
1341
1116
|
};
|
|
1342
1117
|
};
|
|
1343
|
-
|
|
1344
|
-
return Object.entries(output).reduce(
|
|
1345
|
-
var _b;
|
|
1346
|
-
var _c = __read(_a, 2), key = _c[0], value = _c[1];
|
|
1118
|
+
const deserializeAws_restJson1ActiveContextParametersMap = (output, context) => {
|
|
1119
|
+
return Object.entries(output).reduce((acc, [key, value]) => {
|
|
1347
1120
|
if (value === null) {
|
|
1348
1121
|
return acc;
|
|
1349
1122
|
}
|
|
1350
|
-
return
|
|
1123
|
+
return {
|
|
1124
|
+
...acc,
|
|
1125
|
+
[key]: __expectString(value),
|
|
1126
|
+
};
|
|
1351
1127
|
}, {});
|
|
1352
1128
|
};
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
.filter(
|
|
1356
|
-
.map(
|
|
1129
|
+
const deserializeAws_restJson1ActiveContextsList = (output, context) => {
|
|
1130
|
+
const retVal = (output || [])
|
|
1131
|
+
.filter((e) => e != null)
|
|
1132
|
+
.map((entry) => {
|
|
1357
1133
|
if (entry === null) {
|
|
1358
1134
|
return null;
|
|
1359
1135
|
}
|
|
@@ -1361,29 +1137,29 @@ var deserializeAws_restJson1ActiveContextsList = function (output, context) {
|
|
|
1361
1137
|
});
|
|
1362
1138
|
return retVal;
|
|
1363
1139
|
};
|
|
1364
|
-
|
|
1140
|
+
const deserializeAws_restJson1ActiveContextTimeToLive = (output, context) => {
|
|
1365
1141
|
return {
|
|
1366
1142
|
timeToLiveInSeconds: __expectInt32(output.timeToLiveInSeconds),
|
|
1367
1143
|
turnsToLive: __expectInt32(output.turnsToLive),
|
|
1368
1144
|
};
|
|
1369
1145
|
};
|
|
1370
|
-
|
|
1146
|
+
const deserializeAws_restJson1AudioResponseEvent = (output, context) => {
|
|
1371
1147
|
return {
|
|
1372
1148
|
audioChunk: output.audioChunk != null ? context.base64Decoder(output.audioChunk) : undefined,
|
|
1373
1149
|
contentType: __expectString(output.contentType),
|
|
1374
1150
|
eventId: __expectString(output.eventId),
|
|
1375
1151
|
};
|
|
1376
1152
|
};
|
|
1377
|
-
|
|
1153
|
+
const deserializeAws_restJson1Button = (output, context) => {
|
|
1378
1154
|
return {
|
|
1379
1155
|
text: __expectString(output.text),
|
|
1380
1156
|
value: __expectString(output.value),
|
|
1381
1157
|
};
|
|
1382
1158
|
};
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
.filter(
|
|
1386
|
-
.map(
|
|
1159
|
+
const deserializeAws_restJson1ButtonsList = (output, context) => {
|
|
1160
|
+
const retVal = (output || [])
|
|
1161
|
+
.filter((e) => e != null)
|
|
1162
|
+
.map((entry) => {
|
|
1387
1163
|
if (entry === null) {
|
|
1388
1164
|
return null;
|
|
1389
1165
|
}
|
|
@@ -1391,12 +1167,12 @@ var deserializeAws_restJson1ButtonsList = function (output, context) {
|
|
|
1391
1167
|
});
|
|
1392
1168
|
return retVal;
|
|
1393
1169
|
};
|
|
1394
|
-
|
|
1170
|
+
const deserializeAws_restJson1ConfidenceScore = (output, context) => {
|
|
1395
1171
|
return {
|
|
1396
1172
|
score: __limitedParseDouble(output.score),
|
|
1397
1173
|
};
|
|
1398
1174
|
};
|
|
1399
|
-
|
|
1175
|
+
const deserializeAws_restJson1DialogAction = (output, context) => {
|
|
1400
1176
|
return {
|
|
1401
1177
|
slotElicitationStyle: __expectString(output.slotElicitationStyle),
|
|
1402
1178
|
slotToElicit: __expectString(output.slotToElicit),
|
|
@@ -1406,7 +1182,7 @@ var deserializeAws_restJson1DialogAction = function (output, context) {
|
|
|
1406
1182
|
type: __expectString(output.type),
|
|
1407
1183
|
};
|
|
1408
1184
|
};
|
|
1409
|
-
|
|
1185
|
+
const deserializeAws_restJson1ElicitSubSlot = (output, context) => {
|
|
1410
1186
|
return {
|
|
1411
1187
|
name: __expectString(output.name),
|
|
1412
1188
|
subSlotToElicit: output.subSlotToElicit != null
|
|
@@ -1414,12 +1190,12 @@ var deserializeAws_restJson1ElicitSubSlot = function (output, context) {
|
|
|
1414
1190
|
: undefined,
|
|
1415
1191
|
};
|
|
1416
1192
|
};
|
|
1417
|
-
|
|
1193
|
+
const deserializeAws_restJson1HeartbeatEvent = (output, context) => {
|
|
1418
1194
|
return {
|
|
1419
1195
|
eventId: __expectString(output.eventId),
|
|
1420
1196
|
};
|
|
1421
1197
|
};
|
|
1422
|
-
|
|
1198
|
+
const deserializeAws_restJson1ImageResponseCard = (output, context) => {
|
|
1423
1199
|
return {
|
|
1424
1200
|
buttons: output.buttons != null ? deserializeAws_restJson1ButtonsList(output.buttons, context) : undefined,
|
|
1425
1201
|
imageUrl: __expectString(output.imageUrl),
|
|
@@ -1427,7 +1203,7 @@ var deserializeAws_restJson1ImageResponseCard = function (output, context) {
|
|
|
1427
1203
|
title: __expectString(output.title),
|
|
1428
1204
|
};
|
|
1429
1205
|
};
|
|
1430
|
-
|
|
1206
|
+
const deserializeAws_restJson1Intent = (output, context) => {
|
|
1431
1207
|
return {
|
|
1432
1208
|
confirmationState: __expectString(output.confirmationState),
|
|
1433
1209
|
name: __expectString(output.name),
|
|
@@ -1435,7 +1211,7 @@ var deserializeAws_restJson1Intent = function (output, context) {
|
|
|
1435
1211
|
state: __expectString(output.state),
|
|
1436
1212
|
};
|
|
1437
1213
|
};
|
|
1438
|
-
|
|
1214
|
+
const deserializeAws_restJson1IntentResultEvent = (output, context) => {
|
|
1439
1215
|
return {
|
|
1440
1216
|
eventId: __expectString(output.eventId),
|
|
1441
1217
|
inputMode: __expectString(output.inputMode),
|
|
@@ -1449,7 +1225,7 @@ var deserializeAws_restJson1IntentResultEvent = function (output, context) {
|
|
|
1449
1225
|
sessionState: output.sessionState != null ? deserializeAws_restJson1SessionState(output.sessionState, context) : undefined,
|
|
1450
1226
|
};
|
|
1451
1227
|
};
|
|
1452
|
-
|
|
1228
|
+
const deserializeAws_restJson1Interpretation = (output, context) => {
|
|
1453
1229
|
return {
|
|
1454
1230
|
intent: output.intent != null ? deserializeAws_restJson1Intent(output.intent, context) : undefined,
|
|
1455
1231
|
nluConfidence: output.nluConfidence != null ? deserializeAws_restJson1ConfidenceScore(output.nluConfidence, context) : undefined,
|
|
@@ -1458,10 +1234,10 @@ var deserializeAws_restJson1Interpretation = function (output, context) {
|
|
|
1458
1234
|
: undefined,
|
|
1459
1235
|
};
|
|
1460
1236
|
};
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
.filter(
|
|
1464
|
-
.map(
|
|
1237
|
+
const deserializeAws_restJson1Interpretations = (output, context) => {
|
|
1238
|
+
const retVal = (output || [])
|
|
1239
|
+
.filter((e) => e != null)
|
|
1240
|
+
.map((entry) => {
|
|
1465
1241
|
if (entry === null) {
|
|
1466
1242
|
return null;
|
|
1467
1243
|
}
|
|
@@ -1469,7 +1245,7 @@ var deserializeAws_restJson1Interpretations = function (output, context) {
|
|
|
1469
1245
|
});
|
|
1470
1246
|
return retVal;
|
|
1471
1247
|
};
|
|
1472
|
-
|
|
1248
|
+
const deserializeAws_restJson1Message = (output, context) => {
|
|
1473
1249
|
return {
|
|
1474
1250
|
content: __expectString(output.content),
|
|
1475
1251
|
contentType: __expectString(output.contentType),
|
|
@@ -1478,10 +1254,10 @@ var deserializeAws_restJson1Message = function (output, context) {
|
|
|
1478
1254
|
: undefined,
|
|
1479
1255
|
};
|
|
1480
1256
|
};
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
.filter(
|
|
1484
|
-
.map(
|
|
1257
|
+
const deserializeAws_restJson1Messages = (output, context) => {
|
|
1258
|
+
const retVal = (output || [])
|
|
1259
|
+
.filter((e) => e != null)
|
|
1260
|
+
.map((entry) => {
|
|
1485
1261
|
if (entry === null) {
|
|
1486
1262
|
return null;
|
|
1487
1263
|
}
|
|
@@ -1489,14 +1265,14 @@ var deserializeAws_restJson1Messages = function (output, context) {
|
|
|
1489
1265
|
});
|
|
1490
1266
|
return retVal;
|
|
1491
1267
|
};
|
|
1492
|
-
|
|
1268
|
+
const deserializeAws_restJson1PlaybackInterruptionEvent = (output, context) => {
|
|
1493
1269
|
return {
|
|
1494
1270
|
causedByEventId: __expectString(output.causedByEventId),
|
|
1495
1271
|
eventId: __expectString(output.eventId),
|
|
1496
1272
|
eventReason: __expectString(output.eventReason),
|
|
1497
1273
|
};
|
|
1498
1274
|
};
|
|
1499
|
-
|
|
1275
|
+
const deserializeAws_restJson1RuntimeHintDetails = (output, context) => {
|
|
1500
1276
|
return {
|
|
1501
1277
|
runtimeHintValues: output.runtimeHintValues != null
|
|
1502
1278
|
? deserializeAws_restJson1RuntimeHintValuesList(output.runtimeHintValues, context)
|
|
@@ -1504,20 +1280,20 @@ var deserializeAws_restJson1RuntimeHintDetails = function (output, context) {
|
|
|
1504
1280
|
subSlotHints: output.subSlotHints != null ? deserializeAws_restJson1SlotHintsSlotMap(output.subSlotHints, context) : undefined,
|
|
1505
1281
|
};
|
|
1506
1282
|
};
|
|
1507
|
-
|
|
1283
|
+
const deserializeAws_restJson1RuntimeHints = (output, context) => {
|
|
1508
1284
|
return {
|
|
1509
1285
|
slotHints: output.slotHints != null ? deserializeAws_restJson1SlotHintsIntentMap(output.slotHints, context) : undefined,
|
|
1510
1286
|
};
|
|
1511
1287
|
};
|
|
1512
|
-
|
|
1288
|
+
const deserializeAws_restJson1RuntimeHintValue = (output, context) => {
|
|
1513
1289
|
return {
|
|
1514
1290
|
phrase: __expectString(output.phrase),
|
|
1515
1291
|
};
|
|
1516
1292
|
};
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
.filter(
|
|
1520
|
-
.map(
|
|
1293
|
+
const deserializeAws_restJson1RuntimeHintValuesList = (output, context) => {
|
|
1294
|
+
const retVal = (output || [])
|
|
1295
|
+
.filter((e) => e != null)
|
|
1296
|
+
.map((entry) => {
|
|
1521
1297
|
if (entry === null) {
|
|
1522
1298
|
return null;
|
|
1523
1299
|
}
|
|
@@ -1525,7 +1301,7 @@ var deserializeAws_restJson1RuntimeHintValuesList = function (output, context) {
|
|
|
1525
1301
|
});
|
|
1526
1302
|
return retVal;
|
|
1527
1303
|
};
|
|
1528
|
-
|
|
1304
|
+
const deserializeAws_restJson1SentimentResponse = (output, context) => {
|
|
1529
1305
|
return {
|
|
1530
1306
|
sentiment: __expectString(output.sentiment),
|
|
1531
1307
|
sentimentScore: output.sentimentScore != null
|
|
@@ -1533,7 +1309,7 @@ var deserializeAws_restJson1SentimentResponse = function (output, context) {
|
|
|
1533
1309
|
: undefined,
|
|
1534
1310
|
};
|
|
1535
1311
|
};
|
|
1536
|
-
|
|
1312
|
+
const deserializeAws_restJson1SentimentScore = (output, context) => {
|
|
1537
1313
|
return {
|
|
1538
1314
|
mixed: __limitedParseDouble(output.mixed),
|
|
1539
1315
|
negative: __limitedParseDouble(output.negative),
|
|
@@ -1541,7 +1317,7 @@ var deserializeAws_restJson1SentimentScore = function (output, context) {
|
|
|
1541
1317
|
positive: __limitedParseDouble(output.positive),
|
|
1542
1318
|
};
|
|
1543
1319
|
};
|
|
1544
|
-
|
|
1320
|
+
const deserializeAws_restJson1SessionState = (output, context) => {
|
|
1545
1321
|
return {
|
|
1546
1322
|
activeContexts: output.activeContexts != null
|
|
1547
1323
|
? deserializeAws_restJson1ActiveContextsList(output.activeContexts, context)
|
|
@@ -1555,7 +1331,7 @@ var deserializeAws_restJson1SessionState = function (output, context) {
|
|
|
1555
1331
|
: undefined,
|
|
1556
1332
|
};
|
|
1557
1333
|
};
|
|
1558
|
-
|
|
1334
|
+
const deserializeAws_restJson1Slot = (output, context) => {
|
|
1559
1335
|
return {
|
|
1560
1336
|
shape: __expectString(output.shape),
|
|
1561
1337
|
subSlots: output.subSlots != null ? deserializeAws_restJson1Slots(output.subSlots, context) : undefined,
|
|
@@ -1563,40 +1339,43 @@ var deserializeAws_restJson1Slot = function (output, context) {
|
|
|
1563
1339
|
values: output.values != null ? deserializeAws_restJson1Values(output.values, context) : undefined,
|
|
1564
1340
|
};
|
|
1565
1341
|
};
|
|
1566
|
-
|
|
1567
|
-
return Object.entries(output).reduce(
|
|
1568
|
-
var _b;
|
|
1569
|
-
var _c = __read(_a, 2), key = _c[0], value = _c[1];
|
|
1342
|
+
const deserializeAws_restJson1SlotHintsIntentMap = (output, context) => {
|
|
1343
|
+
return Object.entries(output).reduce((acc, [key, value]) => {
|
|
1570
1344
|
if (value === null) {
|
|
1571
1345
|
return acc;
|
|
1572
1346
|
}
|
|
1573
|
-
return
|
|
1347
|
+
return {
|
|
1348
|
+
...acc,
|
|
1349
|
+
[key]: deserializeAws_restJson1SlotHintsSlotMap(value, context),
|
|
1350
|
+
};
|
|
1574
1351
|
}, {});
|
|
1575
1352
|
};
|
|
1576
|
-
|
|
1577
|
-
return Object.entries(output).reduce(
|
|
1578
|
-
var _b;
|
|
1579
|
-
var _c = __read(_a, 2), key = _c[0], value = _c[1];
|
|
1353
|
+
const deserializeAws_restJson1SlotHintsSlotMap = (output, context) => {
|
|
1354
|
+
return Object.entries(output).reduce((acc, [key, value]) => {
|
|
1580
1355
|
if (value === null) {
|
|
1581
1356
|
return acc;
|
|
1582
1357
|
}
|
|
1583
|
-
return
|
|
1358
|
+
return {
|
|
1359
|
+
...acc,
|
|
1360
|
+
[key]: deserializeAws_restJson1RuntimeHintDetails(value, context),
|
|
1361
|
+
};
|
|
1584
1362
|
}, {});
|
|
1585
1363
|
};
|
|
1586
|
-
|
|
1587
|
-
return Object.entries(output).reduce(
|
|
1588
|
-
var _b;
|
|
1589
|
-
var _c = __read(_a, 2), key = _c[0], value = _c[1];
|
|
1364
|
+
const deserializeAws_restJson1Slots = (output, context) => {
|
|
1365
|
+
return Object.entries(output).reduce((acc, [key, value]) => {
|
|
1590
1366
|
if (value === null) {
|
|
1591
1367
|
return acc;
|
|
1592
1368
|
}
|
|
1593
|
-
return
|
|
1369
|
+
return {
|
|
1370
|
+
...acc,
|
|
1371
|
+
[key]: deserializeAws_restJson1Slot(value, context),
|
|
1372
|
+
};
|
|
1594
1373
|
}, {});
|
|
1595
1374
|
};
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
.filter(
|
|
1599
|
-
.map(
|
|
1375
|
+
const deserializeAws_restJson1StringList = (output, context) => {
|
|
1376
|
+
const retVal = (output || [])
|
|
1377
|
+
.filter((e) => e != null)
|
|
1378
|
+
.map((entry) => {
|
|
1600
1379
|
if (entry === null) {
|
|
1601
1380
|
return null;
|
|
1602
1381
|
}
|
|
@@ -1604,39 +1383,40 @@ var deserializeAws_restJson1StringList = function (output, context) {
|
|
|
1604
1383
|
});
|
|
1605
1384
|
return retVal;
|
|
1606
1385
|
};
|
|
1607
|
-
|
|
1608
|
-
return Object.entries(output).reduce(
|
|
1609
|
-
var _b;
|
|
1610
|
-
var _c = __read(_a, 2), key = _c[0], value = _c[1];
|
|
1386
|
+
const deserializeAws_restJson1StringMap = (output, context) => {
|
|
1387
|
+
return Object.entries(output).reduce((acc, [key, value]) => {
|
|
1611
1388
|
if (value === null) {
|
|
1612
1389
|
return acc;
|
|
1613
1390
|
}
|
|
1614
|
-
return
|
|
1391
|
+
return {
|
|
1392
|
+
...acc,
|
|
1393
|
+
[key]: __expectString(value),
|
|
1394
|
+
};
|
|
1615
1395
|
}, {});
|
|
1616
1396
|
};
|
|
1617
|
-
|
|
1397
|
+
const deserializeAws_restJson1TextResponseEvent = (output, context) => {
|
|
1618
1398
|
return {
|
|
1619
1399
|
eventId: __expectString(output.eventId),
|
|
1620
1400
|
messages: output.messages != null ? deserializeAws_restJson1Messages(output.messages, context) : undefined,
|
|
1621
1401
|
};
|
|
1622
1402
|
};
|
|
1623
|
-
|
|
1403
|
+
const deserializeAws_restJson1TranscriptEvent = (output, context) => {
|
|
1624
1404
|
return {
|
|
1625
1405
|
eventId: __expectString(output.eventId),
|
|
1626
1406
|
transcript: __expectString(output.transcript),
|
|
1627
1407
|
};
|
|
1628
1408
|
};
|
|
1629
|
-
|
|
1409
|
+
const deserializeAws_restJson1Value = (output, context) => {
|
|
1630
1410
|
return {
|
|
1631
1411
|
interpretedValue: __expectString(output.interpretedValue),
|
|
1632
1412
|
originalValue: __expectString(output.originalValue),
|
|
1633
1413
|
resolvedValues: output.resolvedValues != null ? deserializeAws_restJson1StringList(output.resolvedValues, context) : undefined,
|
|
1634
1414
|
};
|
|
1635
1415
|
};
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
.filter(
|
|
1639
|
-
.map(
|
|
1416
|
+
const deserializeAws_restJson1Values = (output, context) => {
|
|
1417
|
+
const retVal = (output || [])
|
|
1418
|
+
.filter((e) => e != null)
|
|
1419
|
+
.map((entry) => {
|
|
1640
1420
|
if (entry === null) {
|
|
1641
1421
|
return null;
|
|
1642
1422
|
}
|
|
@@ -1644,57 +1424,39 @@ var deserializeAws_restJson1Values = function (output, context) {
|
|
|
1644
1424
|
});
|
|
1645
1425
|
return retVal;
|
|
1646
1426
|
};
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
});
|
|
1655
|
-
};
|
|
1656
|
-
var collectBody = function (streamBody, context) {
|
|
1657
|
-
if (streamBody === void 0) { streamBody = new Uint8Array(); }
|
|
1427
|
+
const deserializeMetadata = (output) => ({
|
|
1428
|
+
httpStatusCode: output.statusCode,
|
|
1429
|
+
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
|
|
1430
|
+
extendedRequestId: output.headers["x-amz-id-2"],
|
|
1431
|
+
cfId: output.headers["x-amz-cf-id"],
|
|
1432
|
+
});
|
|
1433
|
+
const collectBody = (streamBody = new Uint8Array(), context) => {
|
|
1658
1434
|
if (streamBody instanceof Uint8Array) {
|
|
1659
1435
|
return Promise.resolve(streamBody);
|
|
1660
1436
|
}
|
|
1661
1437
|
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
|
|
1662
1438
|
};
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
}
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
return __generator(this, function (_b) {
|
|
1685
|
-
switch (_b.label) {
|
|
1686
|
-
case 0: return [4, parseBody(errorBody, context)];
|
|
1687
|
-
case 1:
|
|
1688
|
-
value = _b.sent();
|
|
1689
|
-
value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
|
|
1690
|
-
return [2, value];
|
|
1691
|
-
}
|
|
1692
|
-
});
|
|
1693
|
-
}); };
|
|
1694
|
-
var loadRestJsonErrorCode = function (output, data) {
|
|
1695
|
-
var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
|
|
1696
|
-
var sanitizeErrorCode = function (rawValue) {
|
|
1697
|
-
var cleanValue = rawValue;
|
|
1439
|
+
const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
|
|
1440
|
+
const isSerializableHeaderValue = (value) => value !== undefined &&
|
|
1441
|
+
value !== null &&
|
|
1442
|
+
value !== "" &&
|
|
1443
|
+
(!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
|
|
1444
|
+
(!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
|
|
1445
|
+
const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
1446
|
+
if (encoded.length) {
|
|
1447
|
+
return JSON.parse(encoded);
|
|
1448
|
+
}
|
|
1449
|
+
return {};
|
|
1450
|
+
});
|
|
1451
|
+
const parseErrorBody = async (errorBody, context) => {
|
|
1452
|
+
const value = await parseBody(errorBody, context);
|
|
1453
|
+
value.message = value.message ?? value.Message;
|
|
1454
|
+
return value;
|
|
1455
|
+
};
|
|
1456
|
+
const loadRestJsonErrorCode = (output, data) => {
|
|
1457
|
+
const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
1458
|
+
const sanitizeErrorCode = (rawValue) => {
|
|
1459
|
+
let cleanValue = rawValue;
|
|
1698
1460
|
if (typeof cleanValue === "number") {
|
|
1699
1461
|
cleanValue = cleanValue.toString();
|
|
1700
1462
|
}
|
|
@@ -1709,7 +1471,7 @@ var loadRestJsonErrorCode = function (output, data) {
|
|
|
1709
1471
|
}
|
|
1710
1472
|
return cleanValue;
|
|
1711
1473
|
};
|
|
1712
|
-
|
|
1474
|
+
const headerKey = findKey(output.headers, "x-amzn-errortype");
|
|
1713
1475
|
if (headerKey !== undefined) {
|
|
1714
1476
|
return sanitizeErrorCode(output.headers[headerKey]);
|
|
1715
1477
|
}
|