@aws-sdk/client-lex-runtime-v2 3.183.0 → 3.185.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.
@@ -1,1110 +1,1335 @@
1
+ import { __assign, __awaiter, __generator, __read } from "tslib";
1
2
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
3
  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";
3
4
  import { LexRuntimeV2ServiceException as __BaseException } from "../models/LexRuntimeV2ServiceException";
4
5
  import { AccessDeniedException, BadGatewayException, ConflictException, DependencyFailedException, InternalServerException, ResourceNotFoundException, StartConversationRequestEventStream, ThrottlingException, ValidationException, } from "../models/models_0";
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,
6
+ export var serializeAws_restJson1DeleteSessionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
7
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
8
+ return __generator(this, function (_c) {
9
+ switch (_c.label) {
10
+ case 0: return [4, context.endpoint()];
11
+ case 1:
12
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
13
+ headers = {};
14
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
15
+ "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}";
16
+ resolvedPath = __resolvedPath(resolvedPath, input, "botId", function () { return input.botId; }, "{botId}", false);
17
+ resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", function () { return input.botAliasId; }, "{botAliasId}", false);
18
+ resolvedPath = __resolvedPath(resolvedPath, input, "localeId", function () { return input.localeId; }, "{localeId}", false);
19
+ resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", function () { return input.sessionId; }, "{sessionId}", false);
20
+ return [2, new __HttpRequest({
21
+ protocol: protocol,
22
+ hostname: hostname,
23
+ port: port,
24
+ method: "DELETE",
25
+ headers: headers,
26
+ path: resolvedPath,
27
+ body: body,
28
+ })];
29
+ }
23
30
  });
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,
31
+ }); };
32
+ export var serializeAws_restJson1GetSessionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
33
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
34
+ return __generator(this, function (_c) {
35
+ switch (_c.label) {
36
+ case 0: return [4, context.endpoint()];
37
+ case 1:
38
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
39
+ headers = {};
40
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
41
+ "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}";
42
+ resolvedPath = __resolvedPath(resolvedPath, input, "botId", function () { return input.botId; }, "{botId}", false);
43
+ resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", function () { return input.botAliasId; }, "{botAliasId}", false);
44
+ resolvedPath = __resolvedPath(resolvedPath, input, "localeId", function () { return input.localeId; }, "{localeId}", false);
45
+ resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", function () { return input.sessionId; }, "{sessionId}", false);
46
+ return [2, new __HttpRequest({
47
+ protocol: protocol,
48
+ hostname: hostname,
49
+ port: port,
50
+ method: "GET",
51
+ headers: headers,
52
+ path: resolvedPath,
53
+ body: body,
54
+ })];
55
+ }
43
56
  });
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,
57
+ }); };
58
+ export var serializeAws_restJson1PutSessionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
59
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
60
+ return __generator(this, function (_c) {
61
+ switch (_c.label) {
62
+ case 0: return [4, context.endpoint()];
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
+ }
50
90
  });
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
- }),
91
+ }); };
92
+ export var serializeAws_restJson1RecognizeTextCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
93
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
94
+ return __generator(this, function (_c) {
95
+ switch (_c.label) {
96
+ case 0: return [4, context.endpoint()];
97
+ case 1:
98
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
99
+ headers = {
100
+ "content-type": "application/json",
101
+ };
102
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
103
+ "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/text";
104
+ resolvedPath = __resolvedPath(resolvedPath, input, "botId", function () { return input.botId; }, "{botId}", false);
105
+ resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", function () { return input.botAliasId; }, "{botAliasId}", false);
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
+ }
66
123
  });
67
- return new __HttpRequest({
68
- protocol,
69
- hostname,
70
- port,
71
- method: "POST",
72
- headers,
73
- path: resolvedPath,
74
- body,
124
+ }); };
125
+ export var serializeAws_restJson1RecognizeUtteranceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
126
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
127
+ return __generator(this, function (_c) {
128
+ switch (_c.label) {
129
+ case 0: return [4, context.endpoint()];
130
+ case 1:
131
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
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
+ }
75
158
  });
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 }),
159
+ }); };
160
+ export var serializeAws_restJson1StartConversationCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
161
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
162
+ return __generator(this, function (_c) {
163
+ switch (_c.label) {
164
+ case 0: return [4, context.endpoint()];
165
+ case 1:
166
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
167
+ headers = map({}, isSerializableHeaderValue, {
168
+ "x-amz-lex-conversation-mode": input.conversationMode,
169
+ });
170
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
171
+ "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/conversation";
172
+ resolvedPath = __resolvedPath(resolvedPath, input, "botId", function () { return input.botId; }, "{botId}", false);
173
+ resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", function () { return input.botAliasId; }, "{botAliasId}", false);
174
+ resolvedPath = __resolvedPath(resolvedPath, input, "localeId", function () { return input.localeId; }, "{localeId}", false);
175
+ resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", function () { return input.sessionId; }, "{sessionId}", false);
176
+ if (input.requestEventStream !== undefined) {
177
+ body = serializeAws_restJson1StartConversationRequestEventStream(input.requestEventStream, context);
178
+ }
179
+ return [2, new __HttpRequest({
180
+ protocol: protocol,
181
+ hostname: hostname,
182
+ port: port,
183
+ method: "POST",
184
+ headers: headers,
185
+ path: resolvedPath,
186
+ body: body,
187
+ })];
188
+ }
97
189
  });
98
- return new __HttpRequest({
99
- protocol,
100
- hostname,
101
- port,
102
- method: "POST",
103
- headers,
104
- path: resolvedPath,
105
- body,
190
+ }); };
191
+ export var deserializeAws_restJson1DeleteSessionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
192
+ var contents, data, _a, _b;
193
+ return __generator(this, function (_c) {
194
+ switch (_c.label) {
195
+ case 0:
196
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
197
+ return [2, deserializeAws_restJson1DeleteSessionCommandError(output, context)];
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
+ }
106
221
  });
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,
222
+ }); };
223
+ var deserializeAws_restJson1DeleteSessionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
224
+ var parsedOutput, _a, errorCode, _b, parsedBody;
225
+ var _c;
226
+ return __generator(this, function (_d) {
227
+ switch (_d.label) {
228
+ case 0:
229
+ _a = [__assign({}, output)];
230
+ _c = {};
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
+ }
116
274
  });
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,
275
+ }); };
276
+ export var deserializeAws_restJson1GetSessionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
277
+ var contents, data, _a, _b;
278
+ return __generator(this, function (_c) {
279
+ switch (_c.label) {
280
+ case 0:
281
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
282
+ return [2, deserializeAws_restJson1GetSessionCommandError(output, context)];
283
+ }
284
+ contents = map({
285
+ $metadata: deserializeMetadata(output),
286
+ });
287
+ _a = __expectNonNull;
288
+ _b = __expectObject;
289
+ return [4, parseBody(output.body, context)];
290
+ case 1:
291
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
292
+ if (data.interpretations != null) {
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
+ }
135
306
  });
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,
307
+ }); };
308
+ var deserializeAws_restJson1GetSessionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
309
+ var parsedOutput, _a, errorCode, _b, parsedBody;
310
+ var _c;
311
+ return __generator(this, function (_d) {
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
+ }
141
355
  });
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,
356
+ }); };
357
+ export var deserializeAws_restJson1PutSessionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
358
+ var contents, data;
359
+ return __generator(this, function (_a) {
360
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
361
+ return [2, deserializeAws_restJson1PutSessionCommandError(output, context)];
362
+ }
363
+ contents = map({
364
+ $metadata: deserializeMetadata(output),
365
+ contentType: [, output.headers["content-type"]],
366
+ messages: [, output.headers["x-amz-lex-messages"]],
367
+ sessionState: [, output.headers["x-amz-lex-session-state"]],
368
+ requestAttributes: [, output.headers["x-amz-lex-request-attributes"]],
369
+ sessionId: [, output.headers["x-amz-lex-session-id"]],
370
+ });
371
+ data = output.body;
372
+ contents.audioStream = data;
373
+ return [2, contents];
160
374
  });
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),
375
+ }); };
376
+ var deserializeAws_restJson1PutSessionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
377
+ var parsedOutput, _a, errorCode, _b, parsedBody;
378
+ var _c;
379
+ return __generator(this, function (_d) {
380
+ switch (_d.label) {
381
+ case 0:
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
+ }
168
435
  });
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),
436
+ }); };
437
+ export var deserializeAws_restJson1RecognizeTextCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
438
+ var contents, data, _a, _b;
439
+ return __generator(this, function (_c) {
440
+ switch (_c.label) {
441
+ case 0:
442
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
443
+ return [2, deserializeAws_restJson1RecognizeTextCommandError(output, context)];
444
+ }
445
+ contents = map({
446
+ $metadata: deserializeMetadata(output),
447
+ });
448
+ _a = __expectNonNull;
449
+ _b = __expectObject;
450
+ return [4, parseBody(output.body, context)];
451
+ case 1:
452
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
453
+ if (data.interpretations != null) {
454
+ contents.interpretations = deserializeAws_restJson1Interpretations(data.interpretations, context);
455
+ }
456
+ if (data.messages != null) {
457
+ contents.messages = deserializeAws_restJson1Messages(data.messages, context);
458
+ }
459
+ if (data.requestAttributes != null) {
460
+ contents.requestAttributes = deserializeAws_restJson1StringMap(data.requestAttributes, context);
461
+ }
462
+ if (data.sessionId != null) {
463
+ contents.sessionId = __expectString(data.sessionId);
464
+ }
465
+ if (data.sessionState != null) {
466
+ contents.sessionState = deserializeAws_restJson1SessionState(data.sessionState, context);
467
+ }
468
+ return [2, contents];
469
+ }
225
470
  });
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"]],
471
+ }); };
472
+ var deserializeAws_restJson1RecognizeTextCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
473
+ var parsedOutput, _a, errorCode, _b, parsedBody;
474
+ var _c;
475
+ return __generator(this, function (_d) {
476
+ switch (_d.label) {
477
+ case 0:
478
+ _a = [__assign({}, output)];
479
+ _c = {};
480
+ return [4, parseErrorBody(output.body, context)];
481
+ case 1:
482
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
483
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
484
+ _b = errorCode;
485
+ switch (_b) {
486
+ case "AccessDeniedException": return [3, 2];
487
+ case "com.amazonaws.lexruntimev2#AccessDeniedException": return [3, 2];
488
+ case "BadGatewayException": return [3, 4];
489
+ case "com.amazonaws.lexruntimev2#BadGatewayException": return [3, 4];
490
+ case "ConflictException": return [3, 6];
491
+ case "com.amazonaws.lexruntimev2#ConflictException": return [3, 6];
492
+ case "DependencyFailedException": return [3, 8];
493
+ case "com.amazonaws.lexruntimev2#DependencyFailedException": return [3, 8];
494
+ case "InternalServerException": return [3, 10];
495
+ case "com.amazonaws.lexruntimev2#InternalServerException": return [3, 10];
496
+ case "ResourceNotFoundException": return [3, 12];
497
+ case "com.amazonaws.lexruntimev2#ResourceNotFoundException": return [3, 12];
498
+ case "ThrottlingException": return [3, 14];
499
+ case "com.amazonaws.lexruntimev2#ThrottlingException": return [3, 14];
500
+ case "ValidationException": return [3, 16];
501
+ case "com.amazonaws.lexruntimev2#ValidationException": return [3, 16];
502
+ }
503
+ return [3, 18];
504
+ case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
505
+ case 3: throw _d.sent();
506
+ case 4: return [4, deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context)];
507
+ case 5: throw _d.sent();
508
+ case 6: return [4, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
509
+ case 7: throw _d.sent();
510
+ case 8: return [4, deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context)];
511
+ case 9: throw _d.sent();
512
+ case 10: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
513
+ case 11: throw _d.sent();
514
+ case 12: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
515
+ case 13: throw _d.sent();
516
+ case 14: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
517
+ case 15: throw _d.sent();
518
+ case 16: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
519
+ case 17: throw _d.sent();
520
+ case 18:
521
+ parsedBody = parsedOutput.body;
522
+ throwDefaultError({
523
+ output: output,
524
+ parsedBody: parsedBody,
525
+ exceptionCtor: __BaseException,
526
+ errorCode: errorCode,
527
+ });
528
+ _d.label = 19;
529
+ case 19: return [2];
530
+ }
284
531
  });
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),
532
+ }); };
533
+ export var deserializeAws_restJson1RecognizeUtteranceCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
534
+ var contents, data;
535
+ return __generator(this, function (_a) {
536
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
537
+ return [2, deserializeAws_restJson1RecognizeUtteranceCommandError(output, context)];
538
+ }
539
+ contents = map({
540
+ $metadata: deserializeMetadata(output),
541
+ inputMode: [, output.headers["x-amz-lex-input-mode"]],
542
+ contentType: [, output.headers["content-type"]],
543
+ messages: [, output.headers["x-amz-lex-messages"]],
544
+ interpretations: [, output.headers["x-amz-lex-interpretations"]],
545
+ sessionState: [, output.headers["x-amz-lex-session-state"]],
546
+ requestAttributes: [, output.headers["x-amz-lex-request-attributes"]],
547
+ sessionId: [, output.headers["x-amz-lex-session-id"]],
548
+ inputTranscript: [, output.headers["x-amz-lex-input-transcript"]],
549
+ });
550
+ data = output.body;
551
+ contents.audioStream = data;
552
+ return [2, contents];
336
553
  });
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"]],
554
+ }); };
555
+ var deserializeAws_restJson1RecognizeUtteranceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
556
+ var parsedOutput, _a, errorCode, _b, parsedBody;
557
+ var _c;
558
+ return __generator(this, function (_d) {
559
+ switch (_d.label) {
560
+ case 0:
561
+ _a = [__assign({}, output)];
562
+ _c = {};
563
+ return [4, parseErrorBody(output.body, context)];
564
+ case 1:
565
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
566
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
567
+ _b = errorCode;
568
+ switch (_b) {
569
+ case "AccessDeniedException": return [3, 2];
570
+ case "com.amazonaws.lexruntimev2#AccessDeniedException": return [3, 2];
571
+ case "BadGatewayException": return [3, 4];
572
+ case "com.amazonaws.lexruntimev2#BadGatewayException": return [3, 4];
573
+ case "ConflictException": return [3, 6];
574
+ case "com.amazonaws.lexruntimev2#ConflictException": return [3, 6];
575
+ case "DependencyFailedException": return [3, 8];
576
+ case "com.amazonaws.lexruntimev2#DependencyFailedException": return [3, 8];
577
+ case "InternalServerException": return [3, 10];
578
+ case "com.amazonaws.lexruntimev2#InternalServerException": return [3, 10];
579
+ case "ResourceNotFoundException": return [3, 12];
580
+ case "com.amazonaws.lexruntimev2#ResourceNotFoundException": return [3, 12];
581
+ case "ThrottlingException": return [3, 14];
582
+ case "com.amazonaws.lexruntimev2#ThrottlingException": return [3, 14];
583
+ case "ValidationException": return [3, 16];
584
+ case "com.amazonaws.lexruntimev2#ValidationException": return [3, 16];
585
+ }
586
+ return [3, 18];
587
+ case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
588
+ case 3: throw _d.sent();
589
+ case 4: return [4, deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context)];
590
+ case 5: throw _d.sent();
591
+ case 6: return [4, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
592
+ case 7: throw _d.sent();
593
+ case 8: return [4, deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context)];
594
+ case 9: throw _d.sent();
595
+ case 10: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
596
+ case 11: throw _d.sent();
597
+ case 12: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
598
+ case 13: throw _d.sent();
599
+ case 14: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
600
+ case 15: throw _d.sent();
601
+ case 16: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
602
+ case 17: throw _d.sent();
603
+ case 18:
604
+ parsedBody = parsedOutput.body;
605
+ throwDefaultError({
606
+ output: output,
607
+ parsedBody: parsedBody,
608
+ exceptionCtor: __BaseException,
609
+ errorCode: errorCode,
610
+ });
611
+ _d.label = 19;
612
+ case 19: return [2];
613
+ }
410
614
  });
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),
615
+ }); };
616
+ export var deserializeAws_restJson1StartConversationCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
617
+ var contents, data;
618
+ return __generator(this, function (_a) {
619
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
620
+ return [2, deserializeAws_restJson1StartConversationCommandError(output, context)];
621
+ }
622
+ contents = map({
623
+ $metadata: deserializeMetadata(output),
624
+ });
625
+ data = output.body;
626
+ contents.responseEventStream = deserializeAws_restJson1StartConversationResponseEventStream(data, context);
627
+ return [2, contents];
462
628
  });
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,
629
+ }); };
630
+ var deserializeAws_restJson1StartConversationCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
631
+ var parsedOutput, _a, errorCode, _b, parsedBody;
632
+ var _c;
633
+ return __generator(this, function (_d) {
634
+ switch (_d.label) {
635
+ case 0:
636
+ _a = [__assign({}, output)];
637
+ _c = {};
638
+ return [4, parseErrorBody(output.body, context)];
639
+ case 1:
640
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
641
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
642
+ _b = errorCode;
643
+ switch (_b) {
644
+ case "AccessDeniedException": return [3, 2];
645
+ case "com.amazonaws.lexruntimev2#AccessDeniedException": return [3, 2];
646
+ case "InternalServerException": return [3, 4];
647
+ case "com.amazonaws.lexruntimev2#InternalServerException": return [3, 4];
648
+ case "ThrottlingException": return [3, 6];
649
+ case "com.amazonaws.lexruntimev2#ThrottlingException": return [3, 6];
650
+ case "ValidationException": return [3, 8];
651
+ case "com.amazonaws.lexruntimev2#ValidationException": return [3, 8];
652
+ }
653
+ return [3, 10];
654
+ case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
655
+ case 3: throw _d.sent();
656
+ case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
657
+ case 5: throw _d.sent();
658
+ case 6: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
659
+ case 7: throw _d.sent();
660
+ case 8: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
661
+ case 9: throw _d.sent();
662
+ case 10:
663
+ parsedBody = parsedOutput.body;
664
+ throwDefaultError({
665
+ output: output,
666
+ parsedBody: parsedBody,
667
+ exceptionCtor: __BaseException,
668
+ errorCode: errorCode,
669
+ });
670
+ _d.label = 11;
671
+ case 11: return [2];
672
+ }
506
673
  });
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,
674
+ }); };
675
+ var map = __map;
676
+ var deserializeAws_restJson1AccessDeniedExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
677
+ var contents, data, exception;
678
+ return __generator(this, function (_a) {
679
+ contents = map({});
680
+ data = parsedOutput.body;
681
+ if (data.message != null) {
682
+ contents.message = __expectString(data.message);
683
+ }
684
+ exception = new AccessDeniedException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
685
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
518
686
  });
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,
687
+ }); };
688
+ var deserializeAws_restJson1BadGatewayExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
689
+ var contents, data, exception;
690
+ return __generator(this, function (_a) {
691
+ contents = map({});
692
+ data = parsedOutput.body;
693
+ if (data.message != null) {
694
+ contents.message = __expectString(data.message);
695
+ }
696
+ exception = new BadGatewayException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
697
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
530
698
  });
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,
699
+ }); };
700
+ var deserializeAws_restJson1ConflictExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
701
+ var contents, data, exception;
702
+ return __generator(this, function (_a) {
703
+ contents = map({});
704
+ data = parsedOutput.body;
705
+ if (data.message != null) {
706
+ contents.message = __expectString(data.message);
707
+ }
708
+ exception = new ConflictException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
709
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
542
710
  });
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,
711
+ }); };
712
+ var deserializeAws_restJson1DependencyFailedExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
713
+ var contents, data, exception;
714
+ return __generator(this, function (_a) {
715
+ contents = map({});
716
+ data = parsedOutput.body;
717
+ if (data.message != null) {
718
+ contents.message = __expectString(data.message);
719
+ }
720
+ exception = new DependencyFailedException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
721
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
554
722
  });
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,
723
+ }); };
724
+ var deserializeAws_restJson1InternalServerExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
725
+ var contents, data, exception;
726
+ return __generator(this, function (_a) {
727
+ contents = map({});
728
+ data = parsedOutput.body;
729
+ if (data.message != null) {
730
+ contents.message = __expectString(data.message);
731
+ }
732
+ exception = new InternalServerException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
733
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
566
734
  });
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,
735
+ }); };
736
+ var deserializeAws_restJson1ResourceNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
737
+ var contents, data, exception;
738
+ return __generator(this, function (_a) {
739
+ contents = map({});
740
+ data = parsedOutput.body;
741
+ if (data.message != null) {
742
+ contents.message = __expectString(data.message);
743
+ }
744
+ exception = new ResourceNotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
745
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
578
746
  });
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,
747
+ }); };
748
+ var deserializeAws_restJson1ThrottlingExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
749
+ var contents, data, exception;
750
+ return __generator(this, function (_a) {
751
+ contents = map({});
752
+ data = parsedOutput.body;
753
+ if (data.message != null) {
754
+ contents.message = __expectString(data.message);
755
+ }
756
+ exception = new ThrottlingException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
757
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
590
758
  });
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,
759
+ }); };
760
+ var deserializeAws_restJson1ValidationExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
761
+ var contents, data, exception;
762
+ return __generator(this, function (_a) {
763
+ contents = map({});
764
+ data = parsedOutput.body;
765
+ if (data.message != null) {
766
+ contents.message = __expectString(data.message);
767
+ }
768
+ exception = new ValidationException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
769
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
602
770
  });
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
+ };
603
784
  return context.eventStreamMarshaller.serialize(input, eventMarshallingVisitor);
604
785
  };
605
- const serializeAws_restJson1AudioInputEvent_event = (input, context) => {
606
- const headers = {
786
+ var serializeAws_restJson1AudioInputEvent_event = function (input, context) {
787
+ var headers = {
607
788
  ":event-type": { type: "string", value: "AudioInputEvent" },
608
789
  ":message-type": { type: "string", value: "event" },
609
790
  ":content-type": { type: "string", value: "application/json" },
610
791
  };
611
- let body = new Uint8Array();
792
+ var body = new Uint8Array();
612
793
  body = serializeAws_restJson1AudioInputEvent(input, context);
613
794
  body = context.utf8Decoder(JSON.stringify(body));
614
- return { headers, body };
795
+ return { headers: headers, body: body };
615
796
  };
616
- const serializeAws_restJson1ConfigurationEvent_event = (input, context) => {
617
- const headers = {
797
+ var serializeAws_restJson1ConfigurationEvent_event = function (input, context) {
798
+ var headers = {
618
799
  ":event-type": { type: "string", value: "ConfigurationEvent" },
619
800
  ":message-type": { type: "string", value: "event" },
620
801
  ":content-type": { type: "string", value: "application/json" },
621
802
  };
622
- let body = new Uint8Array();
803
+ var body = new Uint8Array();
623
804
  body = serializeAws_restJson1ConfigurationEvent(input, context);
624
805
  body = context.utf8Decoder(JSON.stringify(body));
625
- return { headers, body };
806
+ return { headers: headers, body: body };
626
807
  };
627
- const serializeAws_restJson1DisconnectionEvent_event = (input, context) => {
628
- const headers = {
808
+ var serializeAws_restJson1DisconnectionEvent_event = function (input, context) {
809
+ var headers = {
629
810
  ":event-type": { type: "string", value: "DisconnectionEvent" },
630
811
  ":message-type": { type: "string", value: "event" },
631
812
  ":content-type": { type: "string", value: "application/json" },
632
813
  };
633
- let body = new Uint8Array();
814
+ var body = new Uint8Array();
634
815
  body = serializeAws_restJson1DisconnectionEvent(input, context);
635
816
  body = context.utf8Decoder(JSON.stringify(body));
636
- return { headers, body };
817
+ return { headers: headers, body: body };
637
818
  };
638
- const serializeAws_restJson1DTMFInputEvent_event = (input, context) => {
639
- const headers = {
819
+ var serializeAws_restJson1DTMFInputEvent_event = function (input, context) {
820
+ var headers = {
640
821
  ":event-type": { type: "string", value: "DTMFInputEvent" },
641
822
  ":message-type": { type: "string", value: "event" },
642
823
  ":content-type": { type: "string", value: "application/json" },
643
824
  };
644
- let body = new Uint8Array();
825
+ var body = new Uint8Array();
645
826
  body = serializeAws_restJson1DTMFInputEvent(input, context);
646
827
  body = context.utf8Decoder(JSON.stringify(body));
647
- return { headers, body };
828
+ return { headers: headers, body: body };
648
829
  };
649
- const serializeAws_restJson1PlaybackCompletionEvent_event = (input, context) => {
650
- const headers = {
830
+ var serializeAws_restJson1PlaybackCompletionEvent_event = function (input, context) {
831
+ var headers = {
651
832
  ":event-type": { type: "string", value: "PlaybackCompletionEvent" },
652
833
  ":message-type": { type: "string", value: "event" },
653
834
  ":content-type": { type: "string", value: "application/json" },
654
835
  };
655
- let body = new Uint8Array();
836
+ var body = new Uint8Array();
656
837
  body = serializeAws_restJson1PlaybackCompletionEvent(input, context);
657
838
  body = context.utf8Decoder(JSON.stringify(body));
658
- return { headers, body };
839
+ return { headers: headers, body: body };
659
840
  };
660
- const serializeAws_restJson1TextInputEvent_event = (input, context) => {
661
- const headers = {
841
+ var serializeAws_restJson1TextInputEvent_event = function (input, context) {
842
+ var headers = {
662
843
  ":event-type": { type: "string", value: "TextInputEvent" },
663
844
  ":message-type": { type: "string", value: "event" },
664
845
  ":content-type": { type: "string", value: "application/json" },
665
846
  };
666
- let body = new Uint8Array();
847
+ var body = new Uint8Array();
667
848
  body = serializeAws_restJson1TextInputEvent(input, context);
668
849
  body = context.utf8Decoder(JSON.stringify(body));
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
- };
850
+ return { headers: headers, body: body };
851
+ };
852
+ var deserializeAws_restJson1StartConversationResponseEventStream = function (output, context) {
853
+ return context.eventStreamMarshaller.deserialize(output, function (event) { return __awaiter(void 0, void 0, void 0, function () {
854
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
855
+ return __generator(this, function (_q) {
856
+ switch (_q.label) {
857
+ case 0:
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)];
677
958
  }
678
- if (event["TranscriptEvent"] != null) {
679
- return {
680
- TranscriptEvent: await deserializeAws_restJson1TranscriptEvent_event(event["TranscriptEvent"], context),
681
- };
959
+ });
960
+ }); };
961
+ var deserializeAws_restJson1AudioResponseEvent_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
962
+ var contents, data;
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];
682
972
  }
683
- if (event["IntentResultEvent"] != null) {
684
- return {
685
- IntentResultEvent: await deserializeAws_restJson1IntentResultEvent_event(event["IntentResultEvent"], context),
686
- };
973
+ });
974
+ }); };
975
+ var deserializeAws_restJson1BadGatewayException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
976
+ var parsedOutput, _a;
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)];
687
987
  }
688
- if (event["TextResponseEvent"] != null) {
689
- return {
690
- TextResponseEvent: await deserializeAws_restJson1TextResponseEvent_event(event["TextResponseEvent"], context),
691
- };
988
+ });
989
+ }); };
990
+ var deserializeAws_restJson1ConflictException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
991
+ var parsedOutput, _a;
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)];
692
1002
  }
693
- if (event["AudioResponseEvent"] != null) {
694
- return {
695
- AudioResponseEvent: await deserializeAws_restJson1AudioResponseEvent_event(event["AudioResponseEvent"], context),
696
- };
1003
+ });
1004
+ }); };
1005
+ var deserializeAws_restJson1DependencyFailedException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1006
+ var parsedOutput, _a;
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)];
697
1017
  }
698
- if (event["HeartbeatEvent"] != null) {
699
- return {
700
- HeartbeatEvent: await deserializeAws_restJson1HeartbeatEvent_event(event["HeartbeatEvent"], context),
701
- };
1018
+ });
1019
+ }); };
1020
+ var deserializeAws_restJson1HeartbeatEvent_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1021
+ var contents, data;
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];
702
1031
  }
703
- if (event["AccessDeniedException"] != null) {
704
- return {
705
- AccessDeniedException: await deserializeAws_restJson1AccessDeniedException_event(event["AccessDeniedException"], context),
706
- };
1032
+ });
1033
+ }); };
1034
+ var deserializeAws_restJson1IntentResultEvent_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1035
+ var contents, data;
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];
707
1045
  }
708
- if (event["ResourceNotFoundException"] != null) {
709
- return {
710
- ResourceNotFoundException: await deserializeAws_restJson1ResourceNotFoundException_event(event["ResourceNotFoundException"], context),
711
- };
1046
+ });
1047
+ }); };
1048
+ var deserializeAws_restJson1InternalServerException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1049
+ var parsedOutput, _a;
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)];
712
1060
  }
713
- if (event["ValidationException"] != null) {
714
- return {
715
- ValidationException: await deserializeAws_restJson1ValidationException_event(event["ValidationException"], context),
716
- };
1061
+ });
1062
+ }); };
1063
+ var deserializeAws_restJson1PlaybackInterruptionEvent_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1064
+ var contents, data;
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];
717
1074
  }
718
- if (event["ThrottlingException"] != null) {
719
- return {
720
- ThrottlingException: await deserializeAws_restJson1ThrottlingException_event(event["ThrottlingException"], context),
721
- };
1075
+ });
1076
+ }); };
1077
+ var deserializeAws_restJson1ResourceNotFoundException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1078
+ var parsedOutput, _a;
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)];
722
1089
  }
723
- if (event["InternalServerException"] != null) {
724
- return {
725
- InternalServerException: await deserializeAws_restJson1InternalServerException_event(event["InternalServerException"], context),
726
- };
1090
+ });
1091
+ }); };
1092
+ var deserializeAws_restJson1TextResponseEvent_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1093
+ var contents, data;
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];
727
1103
  }
728
- if (event["ConflictException"] != null) {
729
- return {
730
- ConflictException: await deserializeAws_restJson1ConflictException_event(event["ConflictException"], context),
731
- };
1104
+ });
1105
+ }); };
1106
+ var deserializeAws_restJson1ThrottlingException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1107
+ var parsedOutput, _a;
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)];
732
1118
  }
733
- if (event["DependencyFailedException"] != null) {
734
- return {
735
- DependencyFailedException: await deserializeAws_restJson1DependencyFailedException_event(event["DependencyFailedException"], context),
736
- };
1119
+ });
1120
+ }); };
1121
+ var deserializeAws_restJson1TranscriptEvent_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1122
+ var contents, data;
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];
737
1132
  }
738
- if (event["BadGatewayException"] != null) {
739
- return {
740
- BadGatewayException: await deserializeAws_restJson1BadGatewayException_event(event["BadGatewayException"], context),
741
- };
1133
+ });
1134
+ }); };
1135
+ var deserializeAws_restJson1ValidationException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1136
+ var parsedOutput, _a;
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)];
742
1147
  }
743
- return { $unknown: output };
744
1148
  });
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]) => {
1149
+ }); };
1150
+ var serializeAws_restJson1ActiveContext = function (input, context) {
1151
+ return __assign(__assign(__assign({}, (input.contextAttributes != null && {
1152
+ contextAttributes: serializeAws_restJson1ActiveContextParametersMap(input.contextAttributes, context),
1153
+ })), (input.name != null && { name: input.name })), (input.timeToLive != null && {
1154
+ timeToLive: serializeAws_restJson1ActiveContextTimeToLive(input.timeToLive, context),
1155
+ }));
1156
+ };
1157
+ var serializeAws_restJson1ActiveContextParametersMap = function (input, context) {
1158
+ return Object.entries(input).reduce(function (acc, _a) {
1159
+ var _b;
1160
+ var _c = __read(_a, 2), key = _c[0], value = _c[1];
851
1161
  if (value === null) {
852
1162
  return acc;
853
1163
  }
854
- return {
855
- ...acc,
856
- [key]: value,
857
- };
1164
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));
858
1165
  }, {});
859
1166
  };
860
- const serializeAws_restJson1ActiveContextsList = (input, context) => {
1167
+ var serializeAws_restJson1ActiveContextsList = function (input, context) {
861
1168
  return input
862
- .filter((e) => e != null)
863
- .map((entry) => {
1169
+ .filter(function (e) { return e != null; })
1170
+ .map(function (entry) {
864
1171
  return serializeAws_restJson1ActiveContext(entry, context);
865
1172
  });
866
1173
  };
867
- const serializeAws_restJson1ActiveContextTimeToLive = (input, context) => {
868
- return {
869
- ...(input.timeToLiveInSeconds != null && { timeToLiveInSeconds: input.timeToLiveInSeconds }),
870
- ...(input.turnsToLive != null && { turnsToLive: input.turnsToLive }),
871
- };
1174
+ var serializeAws_restJson1ActiveContextTimeToLive = function (input, context) {
1175
+ return __assign(__assign({}, (input.timeToLiveInSeconds != null && { timeToLiveInSeconds: input.timeToLiveInSeconds })), (input.turnsToLive != null && { turnsToLive: input.turnsToLive }));
872
1176
  };
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
- };
1177
+ var serializeAws_restJson1AudioInputEvent = function (input, context) {
1178
+ return __assign(__assign(__assign(__assign({}, (input.audioChunk != null && { audioChunk: context.base64Encoder(input.audioChunk) })), (input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis })), (input.contentType != null && { contentType: input.contentType })), (input.eventId != null && { eventId: input.eventId }));
880
1179
  };
881
- const serializeAws_restJson1Button = (input, context) => {
882
- return {
883
- ...(input.text != null && { text: input.text }),
884
- ...(input.value != null && { value: input.value }),
885
- };
1180
+ var serializeAws_restJson1Button = function (input, context) {
1181
+ return __assign(__assign({}, (input.text != null && { text: input.text })), (input.value != null && { value: input.value }));
886
1182
  };
887
- const serializeAws_restJson1ButtonsList = (input, context) => {
1183
+ var serializeAws_restJson1ButtonsList = function (input, context) {
888
1184
  return input
889
- .filter((e) => e != null)
890
- .map((entry) => {
1185
+ .filter(function (e) { return e != null; })
1186
+ .map(function (entry) {
891
1187
  return serializeAws_restJson1Button(entry, context);
892
1188
  });
893
1189
  };
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
- };
1190
+ var serializeAws_restJson1ConfigurationEvent = function (input, context) {
1191
+ return __assign(__assign(__assign(__assign(__assign(__assign(__assign({}, (input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis })), (input.disablePlayback != null && { disablePlayback: input.disablePlayback })), (input.eventId != null && { eventId: input.eventId })), (input.requestAttributes != null && {
1192
+ requestAttributes: serializeAws_restJson1StringMap(input.requestAttributes, context),
1193
+ })), (input.responseContentType != null && { responseContentType: input.responseContentType })), (input.sessionState != null && {
1194
+ sessionState: serializeAws_restJson1SessionState(input.sessionState, context),
1195
+ })), (input.welcomeMessages != null && {
1196
+ welcomeMessages: serializeAws_restJson1Messages(input.welcomeMessages, context),
1197
+ }));
910
1198
  };
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
- };
1199
+ var serializeAws_restJson1DialogAction = function (input, context) {
1200
+ return __assign(__assign(__assign(__assign({}, (input.slotElicitationStyle != null && { slotElicitationStyle: input.slotElicitationStyle })), (input.slotToElicit != null && { slotToElicit: input.slotToElicit })), (input.subSlotToElicit != null && {
1201
+ subSlotToElicit: serializeAws_restJson1ElicitSubSlot(input.subSlotToElicit, context),
1202
+ })), (input.type != null && { type: input.type }));
920
1203
  };
921
- const serializeAws_restJson1DisconnectionEvent = (input, context) => {
922
- return {
923
- ...(input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis }),
924
- ...(input.eventId != null && { eventId: input.eventId }),
925
- };
1204
+ var serializeAws_restJson1DisconnectionEvent = function (input, context) {
1205
+ return __assign(__assign({}, (input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis })), (input.eventId != null && { eventId: input.eventId }));
926
1206
  };
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
- };
1207
+ var serializeAws_restJson1DTMFInputEvent = function (input, context) {
1208
+ return __assign(__assign(__assign({}, (input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis })), (input.eventId != null && { eventId: input.eventId })), (input.inputCharacter != null && { inputCharacter: input.inputCharacter }));
933
1209
  };
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
- };
1210
+ var serializeAws_restJson1ElicitSubSlot = function (input, context) {
1211
+ return __assign(__assign({}, (input.name != null && { name: input.name })), (input.subSlotToElicit != null && {
1212
+ subSlotToElicit: serializeAws_restJson1ElicitSubSlot(input.subSlotToElicit, context),
1213
+ }));
941
1214
  };
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
- };
1215
+ var serializeAws_restJson1ImageResponseCard = function (input, context) {
1216
+ return __assign(__assign(__assign(__assign({}, (input.buttons != null && { buttons: serializeAws_restJson1ButtonsList(input.buttons, context) })), (input.imageUrl != null && { imageUrl: input.imageUrl })), (input.subtitle != null && { subtitle: input.subtitle })), (input.title != null && { title: input.title }));
949
1217
  };
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
- };
1218
+ var serializeAws_restJson1Intent = function (input, context) {
1219
+ return __assign(__assign(__assign(__assign({}, (input.confirmationState != null && { confirmationState: input.confirmationState })), (input.name != null && { name: input.name })), (input.slots != null && { slots: serializeAws_restJson1Slots(input.slots, context) })), (input.state != null && { state: input.state }));
957
1220
  };
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
- };
1221
+ var serializeAws_restJson1Message = function (input, context) {
1222
+ return __assign(__assign(__assign({}, (input.content != null && { content: input.content })), (input.contentType != null && { contentType: input.contentType })), (input.imageResponseCard != null && {
1223
+ imageResponseCard: serializeAws_restJson1ImageResponseCard(input.imageResponseCard, context),
1224
+ }));
966
1225
  };
967
- const serializeAws_restJson1Messages = (input, context) => {
1226
+ var serializeAws_restJson1Messages = function (input, context) {
968
1227
  return input
969
- .filter((e) => e != null)
970
- .map((entry) => {
1228
+ .filter(function (e) { return e != null; })
1229
+ .map(function (entry) {
971
1230
  return serializeAws_restJson1Message(entry, context);
972
1231
  });
973
1232
  };
974
- const serializeAws_restJson1PlaybackCompletionEvent = (input, context) => {
975
- return {
976
- ...(input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis }),
977
- ...(input.eventId != null && { eventId: input.eventId }),
978
- };
1233
+ var serializeAws_restJson1PlaybackCompletionEvent = function (input, context) {
1234
+ return __assign(__assign({}, (input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis })), (input.eventId != null && { eventId: input.eventId }));
979
1235
  };
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
- };
1236
+ var serializeAws_restJson1RuntimeHintDetails = function (input, context) {
1237
+ return __assign(__assign({}, (input.runtimeHintValues != null && {
1238
+ runtimeHintValues: serializeAws_restJson1RuntimeHintValuesList(input.runtimeHintValues, context),
1239
+ })), (input.subSlotHints != null && {
1240
+ subSlotHints: serializeAws_restJson1SlotHintsSlotMap(input.subSlotHints, context),
1241
+ }));
989
1242
  };
990
- const serializeAws_restJson1RuntimeHints = (input, context) => {
991
- return {
992
- ...(input.slotHints != null && { slotHints: serializeAws_restJson1SlotHintsIntentMap(input.slotHints, context) }),
993
- };
1243
+ var serializeAws_restJson1RuntimeHints = function (input, context) {
1244
+ return __assign({}, (input.slotHints != null && { slotHints: serializeAws_restJson1SlotHintsIntentMap(input.slotHints, context) }));
994
1245
  };
995
- const serializeAws_restJson1RuntimeHintValue = (input, context) => {
996
- return {
997
- ...(input.phrase != null && { phrase: input.phrase }),
998
- };
1246
+ var serializeAws_restJson1RuntimeHintValue = function (input, context) {
1247
+ return __assign({}, (input.phrase != null && { phrase: input.phrase }));
999
1248
  };
1000
- const serializeAws_restJson1RuntimeHintValuesList = (input, context) => {
1249
+ var serializeAws_restJson1RuntimeHintValuesList = function (input, context) {
1001
1250
  return input
1002
- .filter((e) => e != null)
1003
- .map((entry) => {
1251
+ .filter(function (e) { return e != null; })
1252
+ .map(function (entry) {
1004
1253
  return serializeAws_restJson1RuntimeHintValue(entry, context);
1005
1254
  });
1006
1255
  };
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]) => {
1256
+ var serializeAws_restJson1SessionState = function (input, context) {
1257
+ return __assign(__assign(__assign(__assign(__assign(__assign({}, (input.activeContexts != null && {
1258
+ activeContexts: serializeAws_restJson1ActiveContextsList(input.activeContexts, context),
1259
+ })), (input.dialogAction != null && {
1260
+ dialogAction: serializeAws_restJson1DialogAction(input.dialogAction, context),
1261
+ })), (input.intent != null && { intent: serializeAws_restJson1Intent(input.intent, context) })), (input.originatingRequestId != null && { originatingRequestId: input.originatingRequestId })), (input.runtimeHints != null && {
1262
+ runtimeHints: serializeAws_restJson1RuntimeHints(input.runtimeHints, context),
1263
+ })), (input.sessionAttributes != null && {
1264
+ sessionAttributes: serializeAws_restJson1StringMap(input.sessionAttributes, context),
1265
+ }));
1266
+ };
1267
+ var serializeAws_restJson1Slot = function (input, context) {
1268
+ return __assign(__assign(__assign(__assign({}, (input.shape != null && { shape: input.shape })), (input.subSlots != null && { subSlots: serializeAws_restJson1Slots(input.subSlots, context) })), (input.value != null && { value: serializeAws_restJson1Value(input.value, context) })), (input.values != null && { values: serializeAws_restJson1Values(input.values, context) }));
1269
+ };
1270
+ var serializeAws_restJson1SlotHintsIntentMap = function (input, context) {
1271
+ return Object.entries(input).reduce(function (acc, _a) {
1272
+ var _b;
1273
+ var _c = __read(_a, 2), key = _c[0], value = _c[1];
1035
1274
  if (value === null) {
1036
1275
  return acc;
1037
1276
  }
1038
- return {
1039
- ...acc,
1040
- [key]: serializeAws_restJson1SlotHintsSlotMap(value, context),
1041
- };
1277
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = serializeAws_restJson1SlotHintsSlotMap(value, context), _b));
1042
1278
  }, {});
1043
1279
  };
1044
- const serializeAws_restJson1SlotHintsSlotMap = (input, context) => {
1045
- return Object.entries(input).reduce((acc, [key, value]) => {
1280
+ var serializeAws_restJson1SlotHintsSlotMap = function (input, context) {
1281
+ return Object.entries(input).reduce(function (acc, _a) {
1282
+ var _b;
1283
+ var _c = __read(_a, 2), key = _c[0], value = _c[1];
1046
1284
  if (value === null) {
1047
1285
  return acc;
1048
1286
  }
1049
- return {
1050
- ...acc,
1051
- [key]: serializeAws_restJson1RuntimeHintDetails(value, context),
1052
- };
1287
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = serializeAws_restJson1RuntimeHintDetails(value, context), _b));
1053
1288
  }, {});
1054
1289
  };
1055
- const serializeAws_restJson1Slots = (input, context) => {
1056
- return Object.entries(input).reduce((acc, [key, value]) => {
1290
+ var serializeAws_restJson1Slots = function (input, context) {
1291
+ return Object.entries(input).reduce(function (acc, _a) {
1292
+ var _b;
1293
+ var _c = __read(_a, 2), key = _c[0], value = _c[1];
1057
1294
  if (value === null) {
1058
1295
  return acc;
1059
1296
  }
1060
- return {
1061
- ...acc,
1062
- [key]: serializeAws_restJson1Slot(value, context),
1063
- };
1297
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = serializeAws_restJson1Slot(value, context), _b));
1064
1298
  }, {});
1065
1299
  };
1066
- const serializeAws_restJson1StringList = (input, context) => {
1300
+ var serializeAws_restJson1StringList = function (input, context) {
1067
1301
  return input
1068
- .filter((e) => e != null)
1069
- .map((entry) => {
1302
+ .filter(function (e) { return e != null; })
1303
+ .map(function (entry) {
1070
1304
  return entry;
1071
1305
  });
1072
1306
  };
1073
- const serializeAws_restJson1StringMap = (input, context) => {
1074
- return Object.entries(input).reduce((acc, [key, value]) => {
1307
+ var serializeAws_restJson1StringMap = function (input, context) {
1308
+ return Object.entries(input).reduce(function (acc, _a) {
1309
+ var _b;
1310
+ var _c = __read(_a, 2), key = _c[0], value = _c[1];
1075
1311
  if (value === null) {
1076
1312
  return acc;
1077
1313
  }
1078
- return {
1079
- ...acc,
1080
- [key]: value,
1081
- };
1314
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));
1082
1315
  }, {});
1083
1316
  };
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
- };
1317
+ var serializeAws_restJson1TextInputEvent = function (input, context) {
1318
+ return __assign(__assign(__assign({}, (input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis })), (input.eventId != null && { eventId: input.eventId })), (input.text != null && { text: input.text }));
1090
1319
  };
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
- };
1320
+ var serializeAws_restJson1Value = function (input, context) {
1321
+ return __assign(__assign(__assign({}, (input.interpretedValue != null && { interpretedValue: input.interpretedValue })), (input.originalValue != null && { originalValue: input.originalValue })), (input.resolvedValues != null && {
1322
+ resolvedValues: serializeAws_restJson1StringList(input.resolvedValues, context),
1323
+ }));
1099
1324
  };
1100
- const serializeAws_restJson1Values = (input, context) => {
1325
+ var serializeAws_restJson1Values = function (input, context) {
1101
1326
  return input
1102
- .filter((e) => e != null)
1103
- .map((entry) => {
1327
+ .filter(function (e) { return e != null; })
1328
+ .map(function (entry) {
1104
1329
  return serializeAws_restJson1Slot(entry, context);
1105
1330
  });
1106
1331
  };
1107
- const deserializeAws_restJson1ActiveContext = (output, context) => {
1332
+ var deserializeAws_restJson1ActiveContext = function (output, context) {
1108
1333
  return {
1109
1334
  contextAttributes: output.contextAttributes != null
1110
1335
  ? deserializeAws_restJson1ActiveContextParametersMap(output.contextAttributes, context)
@@ -1115,21 +1340,20 @@ const deserializeAws_restJson1ActiveContext = (output, context) => {
1115
1340
  : undefined,
1116
1341
  };
1117
1342
  };
1118
- const deserializeAws_restJson1ActiveContextParametersMap = (output, context) => {
1119
- return Object.entries(output).reduce((acc, [key, value]) => {
1343
+ var deserializeAws_restJson1ActiveContextParametersMap = function (output, context) {
1344
+ return Object.entries(output).reduce(function (acc, _a) {
1345
+ var _b;
1346
+ var _c = __read(_a, 2), key = _c[0], value = _c[1];
1120
1347
  if (value === null) {
1121
1348
  return acc;
1122
1349
  }
1123
- return {
1124
- ...acc,
1125
- [key]: __expectString(value),
1126
- };
1350
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = __expectString(value), _b));
1127
1351
  }, {});
1128
1352
  };
1129
- const deserializeAws_restJson1ActiveContextsList = (output, context) => {
1130
- const retVal = (output || [])
1131
- .filter((e) => e != null)
1132
- .map((entry) => {
1353
+ var deserializeAws_restJson1ActiveContextsList = function (output, context) {
1354
+ var retVal = (output || [])
1355
+ .filter(function (e) { return e != null; })
1356
+ .map(function (entry) {
1133
1357
  if (entry === null) {
1134
1358
  return null;
1135
1359
  }
@@ -1137,29 +1361,29 @@ const deserializeAws_restJson1ActiveContextsList = (output, context) => {
1137
1361
  });
1138
1362
  return retVal;
1139
1363
  };
1140
- const deserializeAws_restJson1ActiveContextTimeToLive = (output, context) => {
1364
+ var deserializeAws_restJson1ActiveContextTimeToLive = function (output, context) {
1141
1365
  return {
1142
1366
  timeToLiveInSeconds: __expectInt32(output.timeToLiveInSeconds),
1143
1367
  turnsToLive: __expectInt32(output.turnsToLive),
1144
1368
  };
1145
1369
  };
1146
- const deserializeAws_restJson1AudioResponseEvent = (output, context) => {
1370
+ var deserializeAws_restJson1AudioResponseEvent = function (output, context) {
1147
1371
  return {
1148
1372
  audioChunk: output.audioChunk != null ? context.base64Decoder(output.audioChunk) : undefined,
1149
1373
  contentType: __expectString(output.contentType),
1150
1374
  eventId: __expectString(output.eventId),
1151
1375
  };
1152
1376
  };
1153
- const deserializeAws_restJson1Button = (output, context) => {
1377
+ var deserializeAws_restJson1Button = function (output, context) {
1154
1378
  return {
1155
1379
  text: __expectString(output.text),
1156
1380
  value: __expectString(output.value),
1157
1381
  };
1158
1382
  };
1159
- const deserializeAws_restJson1ButtonsList = (output, context) => {
1160
- const retVal = (output || [])
1161
- .filter((e) => e != null)
1162
- .map((entry) => {
1383
+ var deserializeAws_restJson1ButtonsList = function (output, context) {
1384
+ var retVal = (output || [])
1385
+ .filter(function (e) { return e != null; })
1386
+ .map(function (entry) {
1163
1387
  if (entry === null) {
1164
1388
  return null;
1165
1389
  }
@@ -1167,12 +1391,12 @@ const deserializeAws_restJson1ButtonsList = (output, context) => {
1167
1391
  });
1168
1392
  return retVal;
1169
1393
  };
1170
- const deserializeAws_restJson1ConfidenceScore = (output, context) => {
1394
+ var deserializeAws_restJson1ConfidenceScore = function (output, context) {
1171
1395
  return {
1172
1396
  score: __limitedParseDouble(output.score),
1173
1397
  };
1174
1398
  };
1175
- const deserializeAws_restJson1DialogAction = (output, context) => {
1399
+ var deserializeAws_restJson1DialogAction = function (output, context) {
1176
1400
  return {
1177
1401
  slotElicitationStyle: __expectString(output.slotElicitationStyle),
1178
1402
  slotToElicit: __expectString(output.slotToElicit),
@@ -1182,7 +1406,7 @@ const deserializeAws_restJson1DialogAction = (output, context) => {
1182
1406
  type: __expectString(output.type),
1183
1407
  };
1184
1408
  };
1185
- const deserializeAws_restJson1ElicitSubSlot = (output, context) => {
1409
+ var deserializeAws_restJson1ElicitSubSlot = function (output, context) {
1186
1410
  return {
1187
1411
  name: __expectString(output.name),
1188
1412
  subSlotToElicit: output.subSlotToElicit != null
@@ -1190,12 +1414,12 @@ const deserializeAws_restJson1ElicitSubSlot = (output, context) => {
1190
1414
  : undefined,
1191
1415
  };
1192
1416
  };
1193
- const deserializeAws_restJson1HeartbeatEvent = (output, context) => {
1417
+ var deserializeAws_restJson1HeartbeatEvent = function (output, context) {
1194
1418
  return {
1195
1419
  eventId: __expectString(output.eventId),
1196
1420
  };
1197
1421
  };
1198
- const deserializeAws_restJson1ImageResponseCard = (output, context) => {
1422
+ var deserializeAws_restJson1ImageResponseCard = function (output, context) {
1199
1423
  return {
1200
1424
  buttons: output.buttons != null ? deserializeAws_restJson1ButtonsList(output.buttons, context) : undefined,
1201
1425
  imageUrl: __expectString(output.imageUrl),
@@ -1203,7 +1427,7 @@ const deserializeAws_restJson1ImageResponseCard = (output, context) => {
1203
1427
  title: __expectString(output.title),
1204
1428
  };
1205
1429
  };
1206
- const deserializeAws_restJson1Intent = (output, context) => {
1430
+ var deserializeAws_restJson1Intent = function (output, context) {
1207
1431
  return {
1208
1432
  confirmationState: __expectString(output.confirmationState),
1209
1433
  name: __expectString(output.name),
@@ -1211,7 +1435,7 @@ const deserializeAws_restJson1Intent = (output, context) => {
1211
1435
  state: __expectString(output.state),
1212
1436
  };
1213
1437
  };
1214
- const deserializeAws_restJson1IntentResultEvent = (output, context) => {
1438
+ var deserializeAws_restJson1IntentResultEvent = function (output, context) {
1215
1439
  return {
1216
1440
  eventId: __expectString(output.eventId),
1217
1441
  inputMode: __expectString(output.inputMode),
@@ -1225,7 +1449,7 @@ const deserializeAws_restJson1IntentResultEvent = (output, context) => {
1225
1449
  sessionState: output.sessionState != null ? deserializeAws_restJson1SessionState(output.sessionState, context) : undefined,
1226
1450
  };
1227
1451
  };
1228
- const deserializeAws_restJson1Interpretation = (output, context) => {
1452
+ var deserializeAws_restJson1Interpretation = function (output, context) {
1229
1453
  return {
1230
1454
  intent: output.intent != null ? deserializeAws_restJson1Intent(output.intent, context) : undefined,
1231
1455
  nluConfidence: output.nluConfidence != null ? deserializeAws_restJson1ConfidenceScore(output.nluConfidence, context) : undefined,
@@ -1234,10 +1458,10 @@ const deserializeAws_restJson1Interpretation = (output, context) => {
1234
1458
  : undefined,
1235
1459
  };
1236
1460
  };
1237
- const deserializeAws_restJson1Interpretations = (output, context) => {
1238
- const retVal = (output || [])
1239
- .filter((e) => e != null)
1240
- .map((entry) => {
1461
+ var deserializeAws_restJson1Interpretations = function (output, context) {
1462
+ var retVal = (output || [])
1463
+ .filter(function (e) { return e != null; })
1464
+ .map(function (entry) {
1241
1465
  if (entry === null) {
1242
1466
  return null;
1243
1467
  }
@@ -1245,7 +1469,7 @@ const deserializeAws_restJson1Interpretations = (output, context) => {
1245
1469
  });
1246
1470
  return retVal;
1247
1471
  };
1248
- const deserializeAws_restJson1Message = (output, context) => {
1472
+ var deserializeAws_restJson1Message = function (output, context) {
1249
1473
  return {
1250
1474
  content: __expectString(output.content),
1251
1475
  contentType: __expectString(output.contentType),
@@ -1254,10 +1478,10 @@ const deserializeAws_restJson1Message = (output, context) => {
1254
1478
  : undefined,
1255
1479
  };
1256
1480
  };
1257
- const deserializeAws_restJson1Messages = (output, context) => {
1258
- const retVal = (output || [])
1259
- .filter((e) => e != null)
1260
- .map((entry) => {
1481
+ var deserializeAws_restJson1Messages = function (output, context) {
1482
+ var retVal = (output || [])
1483
+ .filter(function (e) { return e != null; })
1484
+ .map(function (entry) {
1261
1485
  if (entry === null) {
1262
1486
  return null;
1263
1487
  }
@@ -1265,14 +1489,14 @@ const deserializeAws_restJson1Messages = (output, context) => {
1265
1489
  });
1266
1490
  return retVal;
1267
1491
  };
1268
- const deserializeAws_restJson1PlaybackInterruptionEvent = (output, context) => {
1492
+ var deserializeAws_restJson1PlaybackInterruptionEvent = function (output, context) {
1269
1493
  return {
1270
1494
  causedByEventId: __expectString(output.causedByEventId),
1271
1495
  eventId: __expectString(output.eventId),
1272
1496
  eventReason: __expectString(output.eventReason),
1273
1497
  };
1274
1498
  };
1275
- const deserializeAws_restJson1RuntimeHintDetails = (output, context) => {
1499
+ var deserializeAws_restJson1RuntimeHintDetails = function (output, context) {
1276
1500
  return {
1277
1501
  runtimeHintValues: output.runtimeHintValues != null
1278
1502
  ? deserializeAws_restJson1RuntimeHintValuesList(output.runtimeHintValues, context)
@@ -1280,20 +1504,20 @@ const deserializeAws_restJson1RuntimeHintDetails = (output, context) => {
1280
1504
  subSlotHints: output.subSlotHints != null ? deserializeAws_restJson1SlotHintsSlotMap(output.subSlotHints, context) : undefined,
1281
1505
  };
1282
1506
  };
1283
- const deserializeAws_restJson1RuntimeHints = (output, context) => {
1507
+ var deserializeAws_restJson1RuntimeHints = function (output, context) {
1284
1508
  return {
1285
1509
  slotHints: output.slotHints != null ? deserializeAws_restJson1SlotHintsIntentMap(output.slotHints, context) : undefined,
1286
1510
  };
1287
1511
  };
1288
- const deserializeAws_restJson1RuntimeHintValue = (output, context) => {
1512
+ var deserializeAws_restJson1RuntimeHintValue = function (output, context) {
1289
1513
  return {
1290
1514
  phrase: __expectString(output.phrase),
1291
1515
  };
1292
1516
  };
1293
- const deserializeAws_restJson1RuntimeHintValuesList = (output, context) => {
1294
- const retVal = (output || [])
1295
- .filter((e) => e != null)
1296
- .map((entry) => {
1517
+ var deserializeAws_restJson1RuntimeHintValuesList = function (output, context) {
1518
+ var retVal = (output || [])
1519
+ .filter(function (e) { return e != null; })
1520
+ .map(function (entry) {
1297
1521
  if (entry === null) {
1298
1522
  return null;
1299
1523
  }
@@ -1301,7 +1525,7 @@ const deserializeAws_restJson1RuntimeHintValuesList = (output, context) => {
1301
1525
  });
1302
1526
  return retVal;
1303
1527
  };
1304
- const deserializeAws_restJson1SentimentResponse = (output, context) => {
1528
+ var deserializeAws_restJson1SentimentResponse = function (output, context) {
1305
1529
  return {
1306
1530
  sentiment: __expectString(output.sentiment),
1307
1531
  sentimentScore: output.sentimentScore != null
@@ -1309,7 +1533,7 @@ const deserializeAws_restJson1SentimentResponse = (output, context) => {
1309
1533
  : undefined,
1310
1534
  };
1311
1535
  };
1312
- const deserializeAws_restJson1SentimentScore = (output, context) => {
1536
+ var deserializeAws_restJson1SentimentScore = function (output, context) {
1313
1537
  return {
1314
1538
  mixed: __limitedParseDouble(output.mixed),
1315
1539
  negative: __limitedParseDouble(output.negative),
@@ -1317,7 +1541,7 @@ const deserializeAws_restJson1SentimentScore = (output, context) => {
1317
1541
  positive: __limitedParseDouble(output.positive),
1318
1542
  };
1319
1543
  };
1320
- const deserializeAws_restJson1SessionState = (output, context) => {
1544
+ var deserializeAws_restJson1SessionState = function (output, context) {
1321
1545
  return {
1322
1546
  activeContexts: output.activeContexts != null
1323
1547
  ? deserializeAws_restJson1ActiveContextsList(output.activeContexts, context)
@@ -1331,7 +1555,7 @@ const deserializeAws_restJson1SessionState = (output, context) => {
1331
1555
  : undefined,
1332
1556
  };
1333
1557
  };
1334
- const deserializeAws_restJson1Slot = (output, context) => {
1558
+ var deserializeAws_restJson1Slot = function (output, context) {
1335
1559
  return {
1336
1560
  shape: __expectString(output.shape),
1337
1561
  subSlots: output.subSlots != null ? deserializeAws_restJson1Slots(output.subSlots, context) : undefined,
@@ -1339,43 +1563,40 @@ const deserializeAws_restJson1Slot = (output, context) => {
1339
1563
  values: output.values != null ? deserializeAws_restJson1Values(output.values, context) : undefined,
1340
1564
  };
1341
1565
  };
1342
- const deserializeAws_restJson1SlotHintsIntentMap = (output, context) => {
1343
- return Object.entries(output).reduce((acc, [key, value]) => {
1566
+ var deserializeAws_restJson1SlotHintsIntentMap = function (output, context) {
1567
+ return Object.entries(output).reduce(function (acc, _a) {
1568
+ var _b;
1569
+ var _c = __read(_a, 2), key = _c[0], value = _c[1];
1344
1570
  if (value === null) {
1345
1571
  return acc;
1346
1572
  }
1347
- return {
1348
- ...acc,
1349
- [key]: deserializeAws_restJson1SlotHintsSlotMap(value, context),
1350
- };
1573
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = deserializeAws_restJson1SlotHintsSlotMap(value, context), _b));
1351
1574
  }, {});
1352
1575
  };
1353
- const deserializeAws_restJson1SlotHintsSlotMap = (output, context) => {
1354
- return Object.entries(output).reduce((acc, [key, value]) => {
1576
+ var deserializeAws_restJson1SlotHintsSlotMap = function (output, context) {
1577
+ return Object.entries(output).reduce(function (acc, _a) {
1578
+ var _b;
1579
+ var _c = __read(_a, 2), key = _c[0], value = _c[1];
1355
1580
  if (value === null) {
1356
1581
  return acc;
1357
1582
  }
1358
- return {
1359
- ...acc,
1360
- [key]: deserializeAws_restJson1RuntimeHintDetails(value, context),
1361
- };
1583
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = deserializeAws_restJson1RuntimeHintDetails(value, context), _b));
1362
1584
  }, {});
1363
1585
  };
1364
- const deserializeAws_restJson1Slots = (output, context) => {
1365
- return Object.entries(output).reduce((acc, [key, value]) => {
1586
+ var deserializeAws_restJson1Slots = function (output, context) {
1587
+ return Object.entries(output).reduce(function (acc, _a) {
1588
+ var _b;
1589
+ var _c = __read(_a, 2), key = _c[0], value = _c[1];
1366
1590
  if (value === null) {
1367
1591
  return acc;
1368
1592
  }
1369
- return {
1370
- ...acc,
1371
- [key]: deserializeAws_restJson1Slot(value, context),
1372
- };
1593
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = deserializeAws_restJson1Slot(value, context), _b));
1373
1594
  }, {});
1374
1595
  };
1375
- const deserializeAws_restJson1StringList = (output, context) => {
1376
- const retVal = (output || [])
1377
- .filter((e) => e != null)
1378
- .map((entry) => {
1596
+ var deserializeAws_restJson1StringList = function (output, context) {
1597
+ var retVal = (output || [])
1598
+ .filter(function (e) { return e != null; })
1599
+ .map(function (entry) {
1379
1600
  if (entry === null) {
1380
1601
  return null;
1381
1602
  }
@@ -1383,40 +1604,39 @@ const deserializeAws_restJson1StringList = (output, context) => {
1383
1604
  });
1384
1605
  return retVal;
1385
1606
  };
1386
- const deserializeAws_restJson1StringMap = (output, context) => {
1387
- return Object.entries(output).reduce((acc, [key, value]) => {
1607
+ var deserializeAws_restJson1StringMap = function (output, context) {
1608
+ return Object.entries(output).reduce(function (acc, _a) {
1609
+ var _b;
1610
+ var _c = __read(_a, 2), key = _c[0], value = _c[1];
1388
1611
  if (value === null) {
1389
1612
  return acc;
1390
1613
  }
1391
- return {
1392
- ...acc,
1393
- [key]: __expectString(value),
1394
- };
1614
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = __expectString(value), _b));
1395
1615
  }, {});
1396
1616
  };
1397
- const deserializeAws_restJson1TextResponseEvent = (output, context) => {
1617
+ var deserializeAws_restJson1TextResponseEvent = function (output, context) {
1398
1618
  return {
1399
1619
  eventId: __expectString(output.eventId),
1400
1620
  messages: output.messages != null ? deserializeAws_restJson1Messages(output.messages, context) : undefined,
1401
1621
  };
1402
1622
  };
1403
- const deserializeAws_restJson1TranscriptEvent = (output, context) => {
1623
+ var deserializeAws_restJson1TranscriptEvent = function (output, context) {
1404
1624
  return {
1405
1625
  eventId: __expectString(output.eventId),
1406
1626
  transcript: __expectString(output.transcript),
1407
1627
  };
1408
1628
  };
1409
- const deserializeAws_restJson1Value = (output, context) => {
1629
+ var deserializeAws_restJson1Value = function (output, context) {
1410
1630
  return {
1411
1631
  interpretedValue: __expectString(output.interpretedValue),
1412
1632
  originalValue: __expectString(output.originalValue),
1413
1633
  resolvedValues: output.resolvedValues != null ? deserializeAws_restJson1StringList(output.resolvedValues, context) : undefined,
1414
1634
  };
1415
1635
  };
1416
- const deserializeAws_restJson1Values = (output, context) => {
1417
- const retVal = (output || [])
1418
- .filter((e) => e != null)
1419
- .map((entry) => {
1636
+ var deserializeAws_restJson1Values = function (output, context) {
1637
+ var retVal = (output || [])
1638
+ .filter(function (e) { return e != null; })
1639
+ .map(function (entry) {
1420
1640
  if (entry === null) {
1421
1641
  return null;
1422
1642
  }
@@ -1424,39 +1644,57 @@ const deserializeAws_restJson1Values = (output, context) => {
1424
1644
  });
1425
1645
  return retVal;
1426
1646
  };
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) => {
1647
+ var deserializeMetadata = function (output) {
1648
+ var _a, _b;
1649
+ return ({
1650
+ httpStatusCode: output.statusCode,
1651
+ requestId: (_b = (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"]) !== null && _b !== void 0 ? _b : output.headers["x-amz-request-id"],
1652
+ extendedRequestId: output.headers["x-amz-id-2"],
1653
+ cfId: output.headers["x-amz-cf-id"],
1654
+ });
1655
+ };
1656
+ var collectBody = function (streamBody, context) {
1657
+ if (streamBody === void 0) { streamBody = new Uint8Array(); }
1434
1658
  if (streamBody instanceof Uint8Array) {
1435
1659
  return Promise.resolve(streamBody);
1436
1660
  }
1437
1661
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
1438
1662
  };
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;
1663
+ var collectBodyString = function (streamBody, context) {
1664
+ return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
1665
+ };
1666
+ var isSerializableHeaderValue = function (value) {
1667
+ return value !== undefined &&
1668
+ value !== null &&
1669
+ value !== "" &&
1670
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
1671
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
1672
+ };
1673
+ var parseBody = function (streamBody, context) {
1674
+ return collectBodyString(streamBody, context).then(function (encoded) {
1675
+ if (encoded.length) {
1676
+ return JSON.parse(encoded);
1677
+ }
1678
+ return {};
1679
+ });
1680
+ };
1681
+ var parseErrorBody = function (errorBody, context) { return __awaiter(void 0, void 0, void 0, function () {
1682
+ var value;
1683
+ var _a;
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;
1460
1698
  if (typeof cleanValue === "number") {
1461
1699
  cleanValue = cleanValue.toString();
1462
1700
  }
@@ -1471,7 +1709,7 @@ const loadRestJsonErrorCode = (output, data) => {
1471
1709
  }
1472
1710
  return cleanValue;
1473
1711
  };
1474
- const headerKey = findKey(output.headers, "x-amzn-errortype");
1712
+ var headerKey = findKey(output.headers, "x-amzn-errortype");
1475
1713
  if (headerKey !== undefined) {
1476
1714
  return sanitizeErrorCode(output.headers[headerKey]);
1477
1715
  }