@aws-sdk/client-lex-runtime-service 3.180.0 → 3.183.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist-cjs/protocols/Aws_restJson1.js +11 -5
- package/dist-es/LexRuntimeService.js +22 -29
- package/dist-es/LexRuntimeServiceClient.js +22 -28
- package/dist-es/commands/DeleteSessionCommand.js +21 -28
- package/dist-es/commands/GetSessionCommand.js +21 -28
- package/dist-es/commands/PostContentCommand.js +21 -28
- package/dist-es/commands/PostTextCommand.js +21 -28
- package/dist-es/commands/PutSessionCommand.js +21 -28
- package/dist-es/endpoints.js +8 -8
- package/dist-es/models/LexRuntimeServiceServiceException.js +5 -10
- package/dist-es/models/models_0.js +223 -152
- package/dist-es/protocols/Aws_restJson1.js +753 -900
- package/dist-es/runtimeConfig.browser.js +26 -12
- package/dist-es/runtimeConfig.js +30 -12
- package/dist-es/runtimeConfig.native.js +8 -5
- package/dist-es/runtimeConfig.shared.js +8 -11
- package/package.json +33 -33
|
@@ -1,877 +1,733 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator, __read } from "tslib";
|
|
2
1
|
import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
|
|
3
2
|
import { decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, LazyJsonString as __LazyJsonString, limitedParseDouble as __limitedParseDouble, map as __map, resolvedPath as __resolvedPath, throwDefaultError, } from "@aws-sdk/smithy-client";
|
|
4
3
|
import { LexRuntimeServiceServiceException as __BaseException } from "../models/LexRuntimeServiceServiceException";
|
|
5
4
|
import { BadGatewayException, BadRequestException, ConflictException, DependencyFailedException, InternalFailureException, LimitExceededException, LoopDetectedException, NotAcceptableException, NotFoundException, RequestTimeoutException, UnsupportedMediaTypeException, } from "../models/models_0";
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
method: "DELETE",
|
|
24
|
-
headers: headers,
|
|
25
|
-
path: resolvedPath,
|
|
26
|
-
body: body,
|
|
27
|
-
})];
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}); };
|
|
31
|
-
export var serializeAws_restJson1GetSessionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
32
|
-
var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
|
|
33
|
-
return __generator(this, function (_c) {
|
|
34
|
-
switch (_c.label) {
|
|
35
|
-
case 0: return [4, context.endpoint()];
|
|
36
|
-
case 1:
|
|
37
|
-
_a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
|
|
38
|
-
headers = {};
|
|
39
|
-
resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
|
|
40
|
-
"/bot/{botName}/alias/{botAlias}/user/{userId}/session";
|
|
41
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "botName", function () { return input.botName; }, "{botName}", false);
|
|
42
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "botAlias", function () { return input.botAlias; }, "{botAlias}", false);
|
|
43
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "userId", function () { return input.userId; }, "{userId}", false);
|
|
44
|
-
query = map({
|
|
45
|
-
checkpointLabelFilter: [, input.checkpointLabelFilter],
|
|
46
|
-
});
|
|
47
|
-
return [2, new __HttpRequest({
|
|
48
|
-
protocol: protocol,
|
|
49
|
-
hostname: hostname,
|
|
50
|
-
port: port,
|
|
51
|
-
method: "GET",
|
|
52
|
-
headers: headers,
|
|
53
|
-
path: resolvedPath,
|
|
54
|
-
query: query,
|
|
55
|
-
body: body,
|
|
56
|
-
})];
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}); };
|
|
60
|
-
export var serializeAws_restJson1PostContentCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
61
|
-
var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
|
|
62
|
-
return __generator(this, function (_c) {
|
|
63
|
-
switch (_c.label) {
|
|
64
|
-
case 0: return [4, context.endpoint()];
|
|
65
|
-
case 1:
|
|
66
|
-
_a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
|
|
67
|
-
headers = map({}, isSerializableHeaderValue, {
|
|
68
|
-
"x-amz-content-sha256": "UNSIGNED-PAYLOAD",
|
|
69
|
-
"content-type": input.contentType || "application/octet-stream",
|
|
70
|
-
"x-amz-lex-session-attributes": [
|
|
71
|
-
function () { return isSerializableHeaderValue(input.sessionAttributes); },
|
|
72
|
-
function () { return context.base64Encoder(Buffer.from(__LazyJsonString.fromObject(input.sessionAttributes))); },
|
|
73
|
-
],
|
|
74
|
-
"x-amz-lex-request-attributes": [
|
|
75
|
-
function () { return isSerializableHeaderValue(input.requestAttributes); },
|
|
76
|
-
function () { return context.base64Encoder(Buffer.from(__LazyJsonString.fromObject(input.requestAttributes))); },
|
|
77
|
-
],
|
|
78
|
-
accept: input.accept,
|
|
79
|
-
"x-amz-lex-active-contexts": [
|
|
80
|
-
function () { return isSerializableHeaderValue(input.activeContexts); },
|
|
81
|
-
function () { return context.base64Encoder(Buffer.from(__LazyJsonString.fromObject(input.activeContexts))); },
|
|
82
|
-
],
|
|
83
|
-
});
|
|
84
|
-
resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
|
|
85
|
-
"/bot/{botName}/alias/{botAlias}/user/{userId}/content";
|
|
86
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "botName", function () { return input.botName; }, "{botName}", false);
|
|
87
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "botAlias", function () { return input.botAlias; }, "{botAlias}", false);
|
|
88
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "userId", function () { return input.userId; }, "{userId}", false);
|
|
89
|
-
if (input.inputStream !== undefined) {
|
|
90
|
-
body = input.inputStream;
|
|
91
|
-
}
|
|
92
|
-
return [2, new __HttpRequest({
|
|
93
|
-
protocol: protocol,
|
|
94
|
-
hostname: hostname,
|
|
95
|
-
port: port,
|
|
96
|
-
method: "POST",
|
|
97
|
-
headers: headers,
|
|
98
|
-
path: resolvedPath,
|
|
99
|
-
body: body,
|
|
100
|
-
})];
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}); };
|
|
104
|
-
export var serializeAws_restJson1PostTextCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
105
|
-
var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
|
|
106
|
-
return __generator(this, function (_c) {
|
|
107
|
-
switch (_c.label) {
|
|
108
|
-
case 0: return [4, context.endpoint()];
|
|
109
|
-
case 1:
|
|
110
|
-
_a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
|
|
111
|
-
headers = {
|
|
112
|
-
"content-type": "application/json",
|
|
113
|
-
};
|
|
114
|
-
resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
|
|
115
|
-
"/bot/{botName}/alias/{botAlias}/user/{userId}/text";
|
|
116
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "botName", function () { return input.botName; }, "{botName}", false);
|
|
117
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "botAlias", function () { return input.botAlias; }, "{botAlias}", false);
|
|
118
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "userId", function () { return input.userId; }, "{userId}", false);
|
|
119
|
-
body = JSON.stringify(__assign(__assign(__assign(__assign({}, (input.activeContexts != null && {
|
|
120
|
-
activeContexts: serializeAws_restJson1ActiveContextsList(input.activeContexts, context),
|
|
121
|
-
})), (input.inputText != null && { inputText: input.inputText })), (input.requestAttributes != null && {
|
|
122
|
-
requestAttributes: serializeAws_restJson1StringMap(input.requestAttributes, context),
|
|
123
|
-
})), (input.sessionAttributes != null && {
|
|
124
|
-
sessionAttributes: serializeAws_restJson1StringMap(input.sessionAttributes, context),
|
|
125
|
-
})));
|
|
126
|
-
return [2, new __HttpRequest({
|
|
127
|
-
protocol: protocol,
|
|
128
|
-
hostname: hostname,
|
|
129
|
-
port: port,
|
|
130
|
-
method: "POST",
|
|
131
|
-
headers: headers,
|
|
132
|
-
path: resolvedPath,
|
|
133
|
-
body: body,
|
|
134
|
-
})];
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
}); };
|
|
138
|
-
export var serializeAws_restJson1PutSessionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
139
|
-
var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
|
|
140
|
-
return __generator(this, function (_c) {
|
|
141
|
-
switch (_c.label) {
|
|
142
|
-
case 0: return [4, context.endpoint()];
|
|
143
|
-
case 1:
|
|
144
|
-
_a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
|
|
145
|
-
headers = map({}, isSerializableHeaderValue, {
|
|
146
|
-
"content-type": "application/json",
|
|
147
|
-
accept: input.accept,
|
|
148
|
-
});
|
|
149
|
-
resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
|
|
150
|
-
"/bot/{botName}/alias/{botAlias}/user/{userId}/session";
|
|
151
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "botName", function () { return input.botName; }, "{botName}", false);
|
|
152
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "botAlias", function () { return input.botAlias; }, "{botAlias}", false);
|
|
153
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "userId", function () { return input.userId; }, "{userId}", false);
|
|
154
|
-
body = JSON.stringify(__assign(__assign(__assign(__assign({}, (input.activeContexts != null && {
|
|
155
|
-
activeContexts: serializeAws_restJson1ActiveContextsList(input.activeContexts, context),
|
|
156
|
-
})), (input.dialogAction != null && {
|
|
157
|
-
dialogAction: serializeAws_restJson1DialogAction(input.dialogAction, context),
|
|
158
|
-
})), (input.recentIntentSummaryView != null && {
|
|
159
|
-
recentIntentSummaryView: serializeAws_restJson1IntentSummaryList(input.recentIntentSummaryView, context),
|
|
160
|
-
})), (input.sessionAttributes != null && {
|
|
161
|
-
sessionAttributes: serializeAws_restJson1StringMap(input.sessionAttributes, context),
|
|
162
|
-
})));
|
|
163
|
-
return [2, new __HttpRequest({
|
|
164
|
-
protocol: protocol,
|
|
165
|
-
hostname: hostname,
|
|
166
|
-
port: port,
|
|
167
|
-
method: "POST",
|
|
168
|
-
headers: headers,
|
|
169
|
-
path: resolvedPath,
|
|
170
|
-
body: body,
|
|
171
|
-
})];
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
}); };
|
|
175
|
-
export var deserializeAws_restJson1DeleteSessionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
176
|
-
var contents, data, _a, _b;
|
|
177
|
-
return __generator(this, function (_c) {
|
|
178
|
-
switch (_c.label) {
|
|
179
|
-
case 0:
|
|
180
|
-
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
181
|
-
return [2, deserializeAws_restJson1DeleteSessionCommandError(output, context)];
|
|
182
|
-
}
|
|
183
|
-
contents = map({
|
|
184
|
-
$metadata: deserializeMetadata(output),
|
|
185
|
-
});
|
|
186
|
-
_a = __expectNonNull;
|
|
187
|
-
_b = __expectObject;
|
|
188
|
-
return [4, parseBody(output.body, context)];
|
|
189
|
-
case 1:
|
|
190
|
-
data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
|
|
191
|
-
if (data.botAlias != null) {
|
|
192
|
-
contents.botAlias = __expectString(data.botAlias);
|
|
193
|
-
}
|
|
194
|
-
if (data.botName != null) {
|
|
195
|
-
contents.botName = __expectString(data.botName);
|
|
196
|
-
}
|
|
197
|
-
if (data.sessionId != null) {
|
|
198
|
-
contents.sessionId = __expectString(data.sessionId);
|
|
199
|
-
}
|
|
200
|
-
if (data.userId != null) {
|
|
201
|
-
contents.userId = __expectString(data.userId);
|
|
202
|
-
}
|
|
203
|
-
return [2, contents];
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
}); };
|
|
207
|
-
var deserializeAws_restJson1DeleteSessionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
208
|
-
var parsedOutput, _a, errorCode, _b, parsedBody;
|
|
209
|
-
var _c;
|
|
210
|
-
return __generator(this, function (_d) {
|
|
211
|
-
switch (_d.label) {
|
|
212
|
-
case 0:
|
|
213
|
-
_a = [__assign({}, output)];
|
|
214
|
-
_c = {};
|
|
215
|
-
return [4, parseBody(output.body, context)];
|
|
216
|
-
case 1:
|
|
217
|
-
parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
|
|
218
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
219
|
-
_b = errorCode;
|
|
220
|
-
switch (_b) {
|
|
221
|
-
case "BadRequestException": return [3, 2];
|
|
222
|
-
case "com.amazonaws.lexruntimeservice#BadRequestException": return [3, 2];
|
|
223
|
-
case "ConflictException": return [3, 4];
|
|
224
|
-
case "com.amazonaws.lexruntimeservice#ConflictException": return [3, 4];
|
|
225
|
-
case "InternalFailureException": return [3, 6];
|
|
226
|
-
case "com.amazonaws.lexruntimeservice#InternalFailureException": return [3, 6];
|
|
227
|
-
case "LimitExceededException": return [3, 8];
|
|
228
|
-
case "com.amazonaws.lexruntimeservice#LimitExceededException": return [3, 8];
|
|
229
|
-
case "NotFoundException": return [3, 10];
|
|
230
|
-
case "com.amazonaws.lexruntimeservice#NotFoundException": return [3, 10];
|
|
231
|
-
}
|
|
232
|
-
return [3, 12];
|
|
233
|
-
case 2: return [4, deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)];
|
|
234
|
-
case 3: throw _d.sent();
|
|
235
|
-
case 4: return [4, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
|
|
236
|
-
case 5: throw _d.sent();
|
|
237
|
-
case 6: return [4, deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)];
|
|
238
|
-
case 7: throw _d.sent();
|
|
239
|
-
case 8: return [4, deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)];
|
|
240
|
-
case 9: throw _d.sent();
|
|
241
|
-
case 10: return [4, deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)];
|
|
242
|
-
case 11: throw _d.sent();
|
|
243
|
-
case 12:
|
|
244
|
-
parsedBody = parsedOutput.body;
|
|
245
|
-
throwDefaultError({
|
|
246
|
-
output: output,
|
|
247
|
-
parsedBody: parsedBody,
|
|
248
|
-
exceptionCtor: __BaseException,
|
|
249
|
-
errorCode: errorCode,
|
|
250
|
-
});
|
|
251
|
-
_d.label = 13;
|
|
252
|
-
case 13: return [2];
|
|
253
|
-
}
|
|
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
|
+
"/bot/{botName}/alias/{botAlias}/user/{userId}/session";
|
|
10
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "botName", () => input.botName, "{botName}", false);
|
|
11
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "botAlias", () => input.botAlias, "{botAlias}", false);
|
|
12
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "userId", () => input.userId, "{userId}", false);
|
|
13
|
+
let body;
|
|
14
|
+
return new __HttpRequest({
|
|
15
|
+
protocol,
|
|
16
|
+
hostname,
|
|
17
|
+
port,
|
|
18
|
+
method: "DELETE",
|
|
19
|
+
headers,
|
|
20
|
+
path: resolvedPath,
|
|
21
|
+
body,
|
|
254
22
|
});
|
|
255
|
-
}
|
|
256
|
-
export
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}
|
|
278
|
-
if (data.recentIntentSummaryView != null) {
|
|
279
|
-
contents.recentIntentSummaryView = deserializeAws_restJson1IntentSummaryList(data.recentIntentSummaryView, context);
|
|
280
|
-
}
|
|
281
|
-
if (data.sessionAttributes != null) {
|
|
282
|
-
contents.sessionAttributes = deserializeAws_restJson1StringMap(data.sessionAttributes, context);
|
|
283
|
-
}
|
|
284
|
-
if (data.sessionId != null) {
|
|
285
|
-
contents.sessionId = __expectString(data.sessionId);
|
|
286
|
-
}
|
|
287
|
-
return [2, contents];
|
|
288
|
-
}
|
|
23
|
+
};
|
|
24
|
+
export const serializeAws_restJson1GetSessionCommand = async (input, context) => {
|
|
25
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
26
|
+
const headers = {};
|
|
27
|
+
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
|
|
28
|
+
"/bot/{botName}/alias/{botAlias}/user/{userId}/session";
|
|
29
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "botName", () => input.botName, "{botName}", false);
|
|
30
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "botAlias", () => input.botAlias, "{botAlias}", false);
|
|
31
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "userId", () => input.userId, "{userId}", false);
|
|
32
|
+
const query = map({
|
|
33
|
+
checkpointLabelFilter: [, input.checkpointLabelFilter],
|
|
34
|
+
});
|
|
35
|
+
let body;
|
|
36
|
+
return new __HttpRequest({
|
|
37
|
+
protocol,
|
|
38
|
+
hostname,
|
|
39
|
+
port,
|
|
40
|
+
method: "GET",
|
|
41
|
+
headers,
|
|
42
|
+
path: resolvedPath,
|
|
43
|
+
query,
|
|
44
|
+
body,
|
|
289
45
|
});
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
parsedBody: parsedBody,
|
|
328
|
-
exceptionCtor: __BaseException,
|
|
329
|
-
errorCode: errorCode,
|
|
330
|
-
});
|
|
331
|
-
_d.label = 11;
|
|
332
|
-
case 11: return [2];
|
|
333
|
-
}
|
|
46
|
+
};
|
|
47
|
+
export const serializeAws_restJson1PostContentCommand = async (input, context) => {
|
|
48
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
49
|
+
const headers = map({}, isSerializableHeaderValue, {
|
|
50
|
+
"x-amz-content-sha256": "UNSIGNED-PAYLOAD",
|
|
51
|
+
"content-type": input.contentType || "application/octet-stream",
|
|
52
|
+
"x-amz-lex-session-attributes": [
|
|
53
|
+
() => isSerializableHeaderValue(input.sessionAttributes),
|
|
54
|
+
() => context.base64Encoder(Buffer.from(__LazyJsonString.fromObject(input.sessionAttributes))),
|
|
55
|
+
],
|
|
56
|
+
"x-amz-lex-request-attributes": [
|
|
57
|
+
() => isSerializableHeaderValue(input.requestAttributes),
|
|
58
|
+
() => context.base64Encoder(Buffer.from(__LazyJsonString.fromObject(input.requestAttributes))),
|
|
59
|
+
],
|
|
60
|
+
accept: input.accept,
|
|
61
|
+
"x-amz-lex-active-contexts": [
|
|
62
|
+
() => isSerializableHeaderValue(input.activeContexts),
|
|
63
|
+
() => context.base64Encoder(Buffer.from(__LazyJsonString.fromObject(input.activeContexts))),
|
|
64
|
+
],
|
|
65
|
+
});
|
|
66
|
+
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
|
|
67
|
+
"/bot/{botName}/alias/{botAlias}/user/{userId}/content";
|
|
68
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "botName", () => input.botName, "{botName}", false);
|
|
69
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "botAlias", () => input.botAlias, "{botAlias}", false);
|
|
70
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "userId", () => input.userId, "{userId}", false);
|
|
71
|
+
let body;
|
|
72
|
+
if (input.inputStream !== undefined) {
|
|
73
|
+
body = input.inputStream;
|
|
74
|
+
}
|
|
75
|
+
return new __HttpRequest({
|
|
76
|
+
protocol,
|
|
77
|
+
hostname,
|
|
78
|
+
port,
|
|
79
|
+
method: "POST",
|
|
80
|
+
headers,
|
|
81
|
+
path: resolvedPath,
|
|
82
|
+
body,
|
|
334
83
|
});
|
|
335
|
-
}
|
|
336
|
-
export
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
return new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-session-attributes"])).toString("utf8"));
|
|
368
|
-
},
|
|
369
|
-
],
|
|
370
|
-
sentimentResponse: [, output.headers["x-amz-lex-sentiment"]],
|
|
371
|
-
message: [, output.headers["x-amz-lex-message"]],
|
|
372
|
-
encodedMessage: [, output.headers["x-amz-lex-encoded-message"]],
|
|
373
|
-
messageFormat: [, output.headers["x-amz-lex-message-format"]],
|
|
374
|
-
dialogState: [, output.headers["x-amz-lex-dialog-state"]],
|
|
375
|
-
slotToElicit: [, output.headers["x-amz-lex-slot-to-elicit"]],
|
|
376
|
-
inputTranscript: [, output.headers["x-amz-lex-input-transcript"]],
|
|
377
|
-
encodedInputTranscript: [, output.headers["x-amz-lex-encoded-input-transcript"]],
|
|
378
|
-
botVersion: [, output.headers["x-amz-lex-bot-version"]],
|
|
379
|
-
sessionId: [, output.headers["x-amz-lex-session-id"]],
|
|
380
|
-
activeContexts: [
|
|
381
|
-
function () { return void 0 !== output.headers["x-amz-lex-active-contexts"]; },
|
|
382
|
-
function () {
|
|
383
|
-
return new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-active-contexts"])).toString("utf8"));
|
|
384
|
-
},
|
|
385
|
-
],
|
|
386
|
-
});
|
|
387
|
-
data = output.body;
|
|
388
|
-
contents.audioStream = data;
|
|
389
|
-
return [2, contents];
|
|
84
|
+
};
|
|
85
|
+
export const serializeAws_restJson1PostTextCommand = async (input, context) => {
|
|
86
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
87
|
+
const headers = {
|
|
88
|
+
"content-type": "application/json",
|
|
89
|
+
};
|
|
90
|
+
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
|
|
91
|
+
"/bot/{botName}/alias/{botAlias}/user/{userId}/text";
|
|
92
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "botName", () => input.botName, "{botName}", false);
|
|
93
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "botAlias", () => input.botAlias, "{botAlias}", false);
|
|
94
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "userId", () => input.userId, "{userId}", false);
|
|
95
|
+
let body;
|
|
96
|
+
body = JSON.stringify({
|
|
97
|
+
...(input.activeContexts != null && {
|
|
98
|
+
activeContexts: serializeAws_restJson1ActiveContextsList(input.activeContexts, context),
|
|
99
|
+
}),
|
|
100
|
+
...(input.inputText != null && { inputText: input.inputText }),
|
|
101
|
+
...(input.requestAttributes != null && {
|
|
102
|
+
requestAttributes: serializeAws_restJson1StringMap(input.requestAttributes, context),
|
|
103
|
+
}),
|
|
104
|
+
...(input.sessionAttributes != null && {
|
|
105
|
+
sessionAttributes: serializeAws_restJson1StringMap(input.sessionAttributes, context),
|
|
106
|
+
}),
|
|
107
|
+
});
|
|
108
|
+
return new __HttpRequest({
|
|
109
|
+
protocol,
|
|
110
|
+
hostname,
|
|
111
|
+
port,
|
|
112
|
+
method: "POST",
|
|
113
|
+
headers,
|
|
114
|
+
path: resolvedPath,
|
|
115
|
+
body,
|
|
390
116
|
});
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
case "UnsupportedMediaTypeException": return [3, 22];
|
|
427
|
-
case "com.amazonaws.lexruntimeservice#UnsupportedMediaTypeException": return [3, 22];
|
|
428
|
-
}
|
|
429
|
-
return [3, 24];
|
|
430
|
-
case 2: return [4, deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context)];
|
|
431
|
-
case 3: throw _d.sent();
|
|
432
|
-
case 4: return [4, deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)];
|
|
433
|
-
case 5: throw _d.sent();
|
|
434
|
-
case 6: return [4, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
|
|
435
|
-
case 7: throw _d.sent();
|
|
436
|
-
case 8: return [4, deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context)];
|
|
437
|
-
case 9: throw _d.sent();
|
|
438
|
-
case 10: return [4, deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)];
|
|
439
|
-
case 11: throw _d.sent();
|
|
440
|
-
case 12: return [4, deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)];
|
|
441
|
-
case 13: throw _d.sent();
|
|
442
|
-
case 14: return [4, deserializeAws_restJson1LoopDetectedExceptionResponse(parsedOutput, context)];
|
|
443
|
-
case 15: throw _d.sent();
|
|
444
|
-
case 16: return [4, deserializeAws_restJson1NotAcceptableExceptionResponse(parsedOutput, context)];
|
|
445
|
-
case 17: throw _d.sent();
|
|
446
|
-
case 18: return [4, deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)];
|
|
447
|
-
case 19: throw _d.sent();
|
|
448
|
-
case 20: return [4, deserializeAws_restJson1RequestTimeoutExceptionResponse(parsedOutput, context)];
|
|
449
|
-
case 21: throw _d.sent();
|
|
450
|
-
case 22: return [4, deserializeAws_restJson1UnsupportedMediaTypeExceptionResponse(parsedOutput, context)];
|
|
451
|
-
case 23: throw _d.sent();
|
|
452
|
-
case 24:
|
|
453
|
-
parsedBody = parsedOutput.body;
|
|
454
|
-
throwDefaultError({
|
|
455
|
-
output: output,
|
|
456
|
-
parsedBody: parsedBody,
|
|
457
|
-
exceptionCtor: __BaseException,
|
|
458
|
-
errorCode: errorCode,
|
|
459
|
-
});
|
|
460
|
-
_d.label = 25;
|
|
461
|
-
case 25: return [2];
|
|
462
|
-
}
|
|
117
|
+
};
|
|
118
|
+
export const serializeAws_restJson1PutSessionCommand = async (input, context) => {
|
|
119
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
120
|
+
const headers = map({}, isSerializableHeaderValue, {
|
|
121
|
+
"content-type": "application/json",
|
|
122
|
+
accept: input.accept,
|
|
123
|
+
});
|
|
124
|
+
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
|
|
125
|
+
"/bot/{botName}/alias/{botAlias}/user/{userId}/session";
|
|
126
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "botName", () => input.botName, "{botName}", false);
|
|
127
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "botAlias", () => input.botAlias, "{botAlias}", false);
|
|
128
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "userId", () => input.userId, "{userId}", false);
|
|
129
|
+
let body;
|
|
130
|
+
body = JSON.stringify({
|
|
131
|
+
...(input.activeContexts != null && {
|
|
132
|
+
activeContexts: serializeAws_restJson1ActiveContextsList(input.activeContexts, context),
|
|
133
|
+
}),
|
|
134
|
+
...(input.dialogAction != null && {
|
|
135
|
+
dialogAction: serializeAws_restJson1DialogAction(input.dialogAction, context),
|
|
136
|
+
}),
|
|
137
|
+
...(input.recentIntentSummaryView != null && {
|
|
138
|
+
recentIntentSummaryView: serializeAws_restJson1IntentSummaryList(input.recentIntentSummaryView, context),
|
|
139
|
+
}),
|
|
140
|
+
...(input.sessionAttributes != null && {
|
|
141
|
+
sessionAttributes: serializeAws_restJson1StringMap(input.sessionAttributes, context),
|
|
142
|
+
}),
|
|
143
|
+
});
|
|
144
|
+
return new __HttpRequest({
|
|
145
|
+
protocol,
|
|
146
|
+
hostname,
|
|
147
|
+
port,
|
|
148
|
+
method: "POST",
|
|
149
|
+
headers,
|
|
150
|
+
path: resolvedPath,
|
|
151
|
+
body,
|
|
463
152
|
});
|
|
464
|
-
}
|
|
465
|
-
export
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
return [2, deserializeAws_restJson1PostTextCommandError(output, context)];
|
|
472
|
-
}
|
|
473
|
-
contents = map({
|
|
474
|
-
$metadata: deserializeMetadata(output),
|
|
475
|
-
});
|
|
476
|
-
_a = __expectNonNull;
|
|
477
|
-
_b = __expectObject;
|
|
478
|
-
return [4, parseBody(output.body, context)];
|
|
479
|
-
case 1:
|
|
480
|
-
data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
|
|
481
|
-
if (data.activeContexts != null) {
|
|
482
|
-
contents.activeContexts = deserializeAws_restJson1ActiveContextsList(data.activeContexts, context);
|
|
483
|
-
}
|
|
484
|
-
if (data.alternativeIntents != null) {
|
|
485
|
-
contents.alternativeIntents = deserializeAws_restJson1IntentList(data.alternativeIntents, context);
|
|
486
|
-
}
|
|
487
|
-
if (data.botVersion != null) {
|
|
488
|
-
contents.botVersion = __expectString(data.botVersion);
|
|
489
|
-
}
|
|
490
|
-
if (data.dialogState != null) {
|
|
491
|
-
contents.dialogState = __expectString(data.dialogState);
|
|
492
|
-
}
|
|
493
|
-
if (data.intentName != null) {
|
|
494
|
-
contents.intentName = __expectString(data.intentName);
|
|
495
|
-
}
|
|
496
|
-
if (data.message != null) {
|
|
497
|
-
contents.message = __expectString(data.message);
|
|
498
|
-
}
|
|
499
|
-
if (data.messageFormat != null) {
|
|
500
|
-
contents.messageFormat = __expectString(data.messageFormat);
|
|
501
|
-
}
|
|
502
|
-
if (data.nluIntentConfidence != null) {
|
|
503
|
-
contents.nluIntentConfidence = deserializeAws_restJson1IntentConfidence(data.nluIntentConfidence, context);
|
|
504
|
-
}
|
|
505
|
-
if (data.responseCard != null) {
|
|
506
|
-
contents.responseCard = deserializeAws_restJson1ResponseCard(data.responseCard, context);
|
|
507
|
-
}
|
|
508
|
-
if (data.sentimentResponse != null) {
|
|
509
|
-
contents.sentimentResponse = deserializeAws_restJson1SentimentResponse(data.sentimentResponse, context);
|
|
510
|
-
}
|
|
511
|
-
if (data.sessionAttributes != null) {
|
|
512
|
-
contents.sessionAttributes = deserializeAws_restJson1StringMap(data.sessionAttributes, context);
|
|
513
|
-
}
|
|
514
|
-
if (data.sessionId != null) {
|
|
515
|
-
contents.sessionId = __expectString(data.sessionId);
|
|
516
|
-
}
|
|
517
|
-
if (data.slotToElicit != null) {
|
|
518
|
-
contents.slotToElicit = __expectString(data.slotToElicit);
|
|
519
|
-
}
|
|
520
|
-
if (data.slots != null) {
|
|
521
|
-
contents.slots = deserializeAws_restJson1StringMap(data.slots, context);
|
|
522
|
-
}
|
|
523
|
-
return [2, contents];
|
|
524
|
-
}
|
|
153
|
+
};
|
|
154
|
+
export const deserializeAws_restJson1DeleteSessionCommand = async (output, context) => {
|
|
155
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
156
|
+
return deserializeAws_restJson1DeleteSessionCommandError(output, context);
|
|
157
|
+
}
|
|
158
|
+
const contents = map({
|
|
159
|
+
$metadata: deserializeMetadata(output),
|
|
525
160
|
});
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
parsedBody: parsedBody,
|
|
580
|
-
exceptionCtor: __BaseException,
|
|
581
|
-
errorCode: errorCode,
|
|
582
|
-
});
|
|
583
|
-
_d.label = 19;
|
|
584
|
-
case 19: return [2];
|
|
585
|
-
}
|
|
161
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
162
|
+
if (data.botAlias != null) {
|
|
163
|
+
contents.botAlias = __expectString(data.botAlias);
|
|
164
|
+
}
|
|
165
|
+
if (data.botName != null) {
|
|
166
|
+
contents.botName = __expectString(data.botName);
|
|
167
|
+
}
|
|
168
|
+
if (data.sessionId != null) {
|
|
169
|
+
contents.sessionId = __expectString(data.sessionId);
|
|
170
|
+
}
|
|
171
|
+
if (data.userId != null) {
|
|
172
|
+
contents.userId = __expectString(data.userId);
|
|
173
|
+
}
|
|
174
|
+
return contents;
|
|
175
|
+
};
|
|
176
|
+
const deserializeAws_restJson1DeleteSessionCommandError = async (output, context) => {
|
|
177
|
+
const parsedOutput = {
|
|
178
|
+
...output,
|
|
179
|
+
body: await parseErrorBody(output.body, context),
|
|
180
|
+
};
|
|
181
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
182
|
+
switch (errorCode) {
|
|
183
|
+
case "BadRequestException":
|
|
184
|
+
case "com.amazonaws.lexruntimeservice#BadRequestException":
|
|
185
|
+
throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
|
|
186
|
+
case "ConflictException":
|
|
187
|
+
case "com.amazonaws.lexruntimeservice#ConflictException":
|
|
188
|
+
throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
|
|
189
|
+
case "InternalFailureException":
|
|
190
|
+
case "com.amazonaws.lexruntimeservice#InternalFailureException":
|
|
191
|
+
throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
|
|
192
|
+
case "LimitExceededException":
|
|
193
|
+
case "com.amazonaws.lexruntimeservice#LimitExceededException":
|
|
194
|
+
throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
|
|
195
|
+
case "NotFoundException":
|
|
196
|
+
case "com.amazonaws.lexruntimeservice#NotFoundException":
|
|
197
|
+
throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
|
|
198
|
+
default:
|
|
199
|
+
const parsedBody = parsedOutput.body;
|
|
200
|
+
throwDefaultError({
|
|
201
|
+
output,
|
|
202
|
+
parsedBody,
|
|
203
|
+
exceptionCtor: __BaseException,
|
|
204
|
+
errorCode,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
export const deserializeAws_restJson1GetSessionCommand = async (output, context) => {
|
|
209
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
210
|
+
return deserializeAws_restJson1GetSessionCommandError(output, context);
|
|
211
|
+
}
|
|
212
|
+
const contents = map({
|
|
213
|
+
$metadata: deserializeMetadata(output),
|
|
586
214
|
});
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
215
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
216
|
+
if (data.activeContexts != null) {
|
|
217
|
+
contents.activeContexts = deserializeAws_restJson1ActiveContextsList(data.activeContexts, context);
|
|
218
|
+
}
|
|
219
|
+
if (data.dialogAction != null) {
|
|
220
|
+
contents.dialogAction = deserializeAws_restJson1DialogAction(data.dialogAction, context);
|
|
221
|
+
}
|
|
222
|
+
if (data.recentIntentSummaryView != null) {
|
|
223
|
+
contents.recentIntentSummaryView = deserializeAws_restJson1IntentSummaryList(data.recentIntentSummaryView, context);
|
|
224
|
+
}
|
|
225
|
+
if (data.sessionAttributes != null) {
|
|
226
|
+
contents.sessionAttributes = deserializeAws_restJson1StringMap(data.sessionAttributes, context);
|
|
227
|
+
}
|
|
228
|
+
if (data.sessionId != null) {
|
|
229
|
+
contents.sessionId = __expectString(data.sessionId);
|
|
230
|
+
}
|
|
231
|
+
return contents;
|
|
232
|
+
};
|
|
233
|
+
const deserializeAws_restJson1GetSessionCommandError = async (output, context) => {
|
|
234
|
+
const parsedOutput = {
|
|
235
|
+
...output,
|
|
236
|
+
body: await parseErrorBody(output.body, context),
|
|
237
|
+
};
|
|
238
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
239
|
+
switch (errorCode) {
|
|
240
|
+
case "BadRequestException":
|
|
241
|
+
case "com.amazonaws.lexruntimeservice#BadRequestException":
|
|
242
|
+
throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
|
|
243
|
+
case "InternalFailureException":
|
|
244
|
+
case "com.amazonaws.lexruntimeservice#InternalFailureException":
|
|
245
|
+
throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
|
|
246
|
+
case "LimitExceededException":
|
|
247
|
+
case "com.amazonaws.lexruntimeservice#LimitExceededException":
|
|
248
|
+
throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
|
|
249
|
+
case "NotFoundException":
|
|
250
|
+
case "com.amazonaws.lexruntimeservice#NotFoundException":
|
|
251
|
+
throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
|
|
252
|
+
default:
|
|
253
|
+
const parsedBody = parsedOutput.body;
|
|
254
|
+
throwDefaultError({
|
|
255
|
+
output,
|
|
256
|
+
parsedBody,
|
|
257
|
+
exceptionCtor: __BaseException,
|
|
258
|
+
errorCode,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
export const deserializeAws_restJson1PostContentCommand = async (output, context) => {
|
|
263
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
264
|
+
return deserializeAws_restJson1PostContentCommandError(output, context);
|
|
265
|
+
}
|
|
266
|
+
const contents = map({
|
|
267
|
+
$metadata: deserializeMetadata(output),
|
|
268
|
+
contentType: [, output.headers["content-type"]],
|
|
269
|
+
intentName: [, output.headers["x-amz-lex-intent-name"]],
|
|
270
|
+
nluIntentConfidence: [
|
|
271
|
+
() => void 0 !== output.headers["x-amz-lex-nlu-intent-confidence"],
|
|
272
|
+
() => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-nlu-intent-confidence"])).toString("utf8")),
|
|
273
|
+
],
|
|
274
|
+
alternativeIntents: [
|
|
275
|
+
() => void 0 !== output.headers["x-amz-lex-alternative-intents"],
|
|
276
|
+
() => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-alternative-intents"])).toString("utf8")),
|
|
277
|
+
],
|
|
278
|
+
slots: [
|
|
279
|
+
() => void 0 !== output.headers["x-amz-lex-slots"],
|
|
280
|
+
() => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-slots"])).toString("utf8")),
|
|
281
|
+
],
|
|
282
|
+
sessionAttributes: [
|
|
283
|
+
() => void 0 !== output.headers["x-amz-lex-session-attributes"],
|
|
284
|
+
() => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-session-attributes"])).toString("utf8")),
|
|
285
|
+
],
|
|
286
|
+
sentimentResponse: [, output.headers["x-amz-lex-sentiment"]],
|
|
287
|
+
message: [, output.headers["x-amz-lex-message"]],
|
|
288
|
+
encodedMessage: [, output.headers["x-amz-lex-encoded-message"]],
|
|
289
|
+
messageFormat: [, output.headers["x-amz-lex-message-format"]],
|
|
290
|
+
dialogState: [, output.headers["x-amz-lex-dialog-state"]],
|
|
291
|
+
slotToElicit: [, output.headers["x-amz-lex-slot-to-elicit"]],
|
|
292
|
+
inputTranscript: [, output.headers["x-amz-lex-input-transcript"]],
|
|
293
|
+
encodedInputTranscript: [, output.headers["x-amz-lex-encoded-input-transcript"]],
|
|
294
|
+
botVersion: [, output.headers["x-amz-lex-bot-version"]],
|
|
295
|
+
sessionId: [, output.headers["x-amz-lex-session-id"]],
|
|
296
|
+
activeContexts: [
|
|
297
|
+
() => void 0 !== output.headers["x-amz-lex-active-contexts"],
|
|
298
|
+
() => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-active-contexts"])).toString("utf8")),
|
|
299
|
+
],
|
|
300
|
+
});
|
|
301
|
+
const data = output.body;
|
|
302
|
+
contents.audioStream = data;
|
|
303
|
+
return contents;
|
|
304
|
+
};
|
|
305
|
+
const deserializeAws_restJson1PostContentCommandError = async (output, context) => {
|
|
306
|
+
const parsedOutput = {
|
|
307
|
+
...output,
|
|
308
|
+
body: await parseErrorBody(output.body, context),
|
|
309
|
+
};
|
|
310
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
311
|
+
switch (errorCode) {
|
|
312
|
+
case "BadGatewayException":
|
|
313
|
+
case "com.amazonaws.lexruntimeservice#BadGatewayException":
|
|
314
|
+
throw await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context);
|
|
315
|
+
case "BadRequestException":
|
|
316
|
+
case "com.amazonaws.lexruntimeservice#BadRequestException":
|
|
317
|
+
throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
|
|
318
|
+
case "ConflictException":
|
|
319
|
+
case "com.amazonaws.lexruntimeservice#ConflictException":
|
|
320
|
+
throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
|
|
321
|
+
case "DependencyFailedException":
|
|
322
|
+
case "com.amazonaws.lexruntimeservice#DependencyFailedException":
|
|
323
|
+
throw await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context);
|
|
324
|
+
case "InternalFailureException":
|
|
325
|
+
case "com.amazonaws.lexruntimeservice#InternalFailureException":
|
|
326
|
+
throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
|
|
327
|
+
case "LimitExceededException":
|
|
328
|
+
case "com.amazonaws.lexruntimeservice#LimitExceededException":
|
|
329
|
+
throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
|
|
330
|
+
case "LoopDetectedException":
|
|
331
|
+
case "com.amazonaws.lexruntimeservice#LoopDetectedException":
|
|
332
|
+
throw await deserializeAws_restJson1LoopDetectedExceptionResponse(parsedOutput, context);
|
|
333
|
+
case "NotAcceptableException":
|
|
334
|
+
case "com.amazonaws.lexruntimeservice#NotAcceptableException":
|
|
335
|
+
throw await deserializeAws_restJson1NotAcceptableExceptionResponse(parsedOutput, context);
|
|
336
|
+
case "NotFoundException":
|
|
337
|
+
case "com.amazonaws.lexruntimeservice#NotFoundException":
|
|
338
|
+
throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
|
|
339
|
+
case "RequestTimeoutException":
|
|
340
|
+
case "com.amazonaws.lexruntimeservice#RequestTimeoutException":
|
|
341
|
+
throw await deserializeAws_restJson1RequestTimeoutExceptionResponse(parsedOutput, context);
|
|
342
|
+
case "UnsupportedMediaTypeException":
|
|
343
|
+
case "com.amazonaws.lexruntimeservice#UnsupportedMediaTypeException":
|
|
344
|
+
throw await deserializeAws_restJson1UnsupportedMediaTypeExceptionResponse(parsedOutput, context);
|
|
345
|
+
default:
|
|
346
|
+
const parsedBody = parsedOutput.body;
|
|
347
|
+
throwDefaultError({
|
|
348
|
+
output,
|
|
349
|
+
parsedBody,
|
|
350
|
+
exceptionCtor: __BaseException,
|
|
351
|
+
errorCode,
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
export const deserializeAws_restJson1PostTextCommand = async (output, context) => {
|
|
356
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
357
|
+
return deserializeAws_restJson1PostTextCommandError(output, context);
|
|
358
|
+
}
|
|
359
|
+
const contents = map({
|
|
360
|
+
$metadata: deserializeMetadata(output),
|
|
626
361
|
});
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
362
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
363
|
+
if (data.activeContexts != null) {
|
|
364
|
+
contents.activeContexts = deserializeAws_restJson1ActiveContextsList(data.activeContexts, context);
|
|
365
|
+
}
|
|
366
|
+
if (data.alternativeIntents != null) {
|
|
367
|
+
contents.alternativeIntents = deserializeAws_restJson1IntentList(data.alternativeIntents, context);
|
|
368
|
+
}
|
|
369
|
+
if (data.botVersion != null) {
|
|
370
|
+
contents.botVersion = __expectString(data.botVersion);
|
|
371
|
+
}
|
|
372
|
+
if (data.dialogState != null) {
|
|
373
|
+
contents.dialogState = __expectString(data.dialogState);
|
|
374
|
+
}
|
|
375
|
+
if (data.intentName != null) {
|
|
376
|
+
contents.intentName = __expectString(data.intentName);
|
|
377
|
+
}
|
|
378
|
+
if (data.message != null) {
|
|
379
|
+
contents.message = __expectString(data.message);
|
|
380
|
+
}
|
|
381
|
+
if (data.messageFormat != null) {
|
|
382
|
+
contents.messageFormat = __expectString(data.messageFormat);
|
|
383
|
+
}
|
|
384
|
+
if (data.nluIntentConfidence != null) {
|
|
385
|
+
contents.nluIntentConfidence = deserializeAws_restJson1IntentConfidence(data.nluIntentConfidence, context);
|
|
386
|
+
}
|
|
387
|
+
if (data.responseCard != null) {
|
|
388
|
+
contents.responseCard = deserializeAws_restJson1ResponseCard(data.responseCard, context);
|
|
389
|
+
}
|
|
390
|
+
if (data.sentimentResponse != null) {
|
|
391
|
+
contents.sentimentResponse = deserializeAws_restJson1SentimentResponse(data.sentimentResponse, context);
|
|
392
|
+
}
|
|
393
|
+
if (data.sessionAttributes != null) {
|
|
394
|
+
contents.sessionAttributes = deserializeAws_restJson1StringMap(data.sessionAttributes, context);
|
|
395
|
+
}
|
|
396
|
+
if (data.sessionId != null) {
|
|
397
|
+
contents.sessionId = __expectString(data.sessionId);
|
|
398
|
+
}
|
|
399
|
+
if (data.slotToElicit != null) {
|
|
400
|
+
contents.slotToElicit = __expectString(data.slotToElicit);
|
|
401
|
+
}
|
|
402
|
+
if (data.slots != null) {
|
|
403
|
+
contents.slots = deserializeAws_restJson1StringMap(data.slots, context);
|
|
404
|
+
}
|
|
405
|
+
return contents;
|
|
406
|
+
};
|
|
407
|
+
const deserializeAws_restJson1PostTextCommandError = async (output, context) => {
|
|
408
|
+
const parsedOutput = {
|
|
409
|
+
...output,
|
|
410
|
+
body: await parseErrorBody(output.body, context),
|
|
411
|
+
};
|
|
412
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
413
|
+
switch (errorCode) {
|
|
414
|
+
case "BadGatewayException":
|
|
415
|
+
case "com.amazonaws.lexruntimeservice#BadGatewayException":
|
|
416
|
+
throw await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context);
|
|
417
|
+
case "BadRequestException":
|
|
418
|
+
case "com.amazonaws.lexruntimeservice#BadRequestException":
|
|
419
|
+
throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
|
|
420
|
+
case "ConflictException":
|
|
421
|
+
case "com.amazonaws.lexruntimeservice#ConflictException":
|
|
422
|
+
throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
|
|
423
|
+
case "DependencyFailedException":
|
|
424
|
+
case "com.amazonaws.lexruntimeservice#DependencyFailedException":
|
|
425
|
+
throw await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context);
|
|
426
|
+
case "InternalFailureException":
|
|
427
|
+
case "com.amazonaws.lexruntimeservice#InternalFailureException":
|
|
428
|
+
throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
|
|
429
|
+
case "LimitExceededException":
|
|
430
|
+
case "com.amazonaws.lexruntimeservice#LimitExceededException":
|
|
431
|
+
throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
|
|
432
|
+
case "LoopDetectedException":
|
|
433
|
+
case "com.amazonaws.lexruntimeservice#LoopDetectedException":
|
|
434
|
+
throw await deserializeAws_restJson1LoopDetectedExceptionResponse(parsedOutput, context);
|
|
435
|
+
case "NotFoundException":
|
|
436
|
+
case "com.amazonaws.lexruntimeservice#NotFoundException":
|
|
437
|
+
throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
|
|
438
|
+
default:
|
|
439
|
+
const parsedBody = parsedOutput.body;
|
|
440
|
+
throwDefaultError({
|
|
441
|
+
output,
|
|
442
|
+
parsedBody,
|
|
443
|
+
exceptionCtor: __BaseException,
|
|
444
|
+
errorCode,
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
export const deserializeAws_restJson1PutSessionCommand = async (output, context) => {
|
|
449
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
450
|
+
return deserializeAws_restJson1PutSessionCommandError(output, context);
|
|
451
|
+
}
|
|
452
|
+
const contents = map({
|
|
453
|
+
$metadata: deserializeMetadata(output),
|
|
454
|
+
contentType: [, output.headers["content-type"]],
|
|
455
|
+
intentName: [, output.headers["x-amz-lex-intent-name"]],
|
|
456
|
+
slots: [
|
|
457
|
+
() => void 0 !== output.headers["x-amz-lex-slots"],
|
|
458
|
+
() => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-slots"])).toString("utf8")),
|
|
459
|
+
],
|
|
460
|
+
sessionAttributes: [
|
|
461
|
+
() => void 0 !== output.headers["x-amz-lex-session-attributes"],
|
|
462
|
+
() => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-session-attributes"])).toString("utf8")),
|
|
463
|
+
],
|
|
464
|
+
message: [, output.headers["x-amz-lex-message"]],
|
|
465
|
+
encodedMessage: [, output.headers["x-amz-lex-encoded-message"]],
|
|
466
|
+
messageFormat: [, output.headers["x-amz-lex-message-format"]],
|
|
467
|
+
dialogState: [, output.headers["x-amz-lex-dialog-state"]],
|
|
468
|
+
slotToElicit: [, output.headers["x-amz-lex-slot-to-elicit"]],
|
|
469
|
+
sessionId: [, output.headers["x-amz-lex-session-id"]],
|
|
470
|
+
activeContexts: [
|
|
471
|
+
() => void 0 !== output.headers["x-amz-lex-active-contexts"],
|
|
472
|
+
() => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-active-contexts"])).toString("utf8")),
|
|
473
|
+
],
|
|
474
|
+
});
|
|
475
|
+
const data = output.body;
|
|
476
|
+
contents.audioStream = data;
|
|
477
|
+
return contents;
|
|
478
|
+
};
|
|
479
|
+
const deserializeAws_restJson1PutSessionCommandError = async (output, context) => {
|
|
480
|
+
const parsedOutput = {
|
|
481
|
+
...output,
|
|
482
|
+
body: await parseErrorBody(output.body, context),
|
|
483
|
+
};
|
|
484
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
485
|
+
switch (errorCode) {
|
|
486
|
+
case "BadGatewayException":
|
|
487
|
+
case "com.amazonaws.lexruntimeservice#BadGatewayException":
|
|
488
|
+
throw await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context);
|
|
489
|
+
case "BadRequestException":
|
|
490
|
+
case "com.amazonaws.lexruntimeservice#BadRequestException":
|
|
491
|
+
throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
|
|
492
|
+
case "ConflictException":
|
|
493
|
+
case "com.amazonaws.lexruntimeservice#ConflictException":
|
|
494
|
+
throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
|
|
495
|
+
case "DependencyFailedException":
|
|
496
|
+
case "com.amazonaws.lexruntimeservice#DependencyFailedException":
|
|
497
|
+
throw await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context);
|
|
498
|
+
case "InternalFailureException":
|
|
499
|
+
case "com.amazonaws.lexruntimeservice#InternalFailureException":
|
|
500
|
+
throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
|
|
501
|
+
case "LimitExceededException":
|
|
502
|
+
case "com.amazonaws.lexruntimeservice#LimitExceededException":
|
|
503
|
+
throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
|
|
504
|
+
case "NotAcceptableException":
|
|
505
|
+
case "com.amazonaws.lexruntimeservice#NotAcceptableException":
|
|
506
|
+
throw await deserializeAws_restJson1NotAcceptableExceptionResponse(parsedOutput, context);
|
|
507
|
+
case "NotFoundException":
|
|
508
|
+
case "com.amazonaws.lexruntimeservice#NotFoundException":
|
|
509
|
+
throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
|
|
510
|
+
default:
|
|
511
|
+
const parsedBody = parsedOutput.body;
|
|
512
|
+
throwDefaultError({
|
|
513
|
+
output,
|
|
514
|
+
parsedBody,
|
|
515
|
+
exceptionCtor: __BaseException,
|
|
516
|
+
errorCode,
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
};
|
|
520
|
+
const map = __map;
|
|
521
|
+
const deserializeAws_restJson1BadGatewayExceptionResponse = 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 BadGatewayException({
|
|
528
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
529
|
+
...contents,
|
|
687
530
|
});
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
return [2, __decorateServiceException(exception, parsedOutput.body)];
|
|
531
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
532
|
+
};
|
|
533
|
+
const deserializeAws_restJson1BadRequestExceptionResponse = 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 BadRequestException({
|
|
540
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
541
|
+
...contents,
|
|
700
542
|
});
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
543
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
544
|
+
};
|
|
545
|
+
const deserializeAws_restJson1ConflictExceptionResponse = 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 ConflictException({
|
|
552
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
553
|
+
...contents,
|
|
712
554
|
});
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
555
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
556
|
+
};
|
|
557
|
+
const deserializeAws_restJson1DependencyFailedExceptionResponse = 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 DependencyFailedException({
|
|
564
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
565
|
+
...contents,
|
|
724
566
|
});
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
567
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
568
|
+
};
|
|
569
|
+
const deserializeAws_restJson1InternalFailureExceptionResponse = 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 InternalFailureException({
|
|
576
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
577
|
+
...contents,
|
|
736
578
|
});
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
data = parsedOutput.body;
|
|
743
|
-
if (data.message != null) {
|
|
744
|
-
contents.message = __expectString(data.message);
|
|
745
|
-
}
|
|
746
|
-
exception = new InternalFailureException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
|
|
747
|
-
return [2, __decorateServiceException(exception, parsedOutput.body)];
|
|
579
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
580
|
+
};
|
|
581
|
+
const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutput, context) => {
|
|
582
|
+
const contents = map({
|
|
583
|
+
retryAfterSeconds: [, parsedOutput.headers["retry-after"]],
|
|
748
584
|
});
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
data = parsedOutput.body;
|
|
757
|
-
if (data.message != null) {
|
|
758
|
-
contents.message = __expectString(data.message);
|
|
759
|
-
}
|
|
760
|
-
exception = new LimitExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
|
|
761
|
-
return [2, __decorateServiceException(exception, parsedOutput.body)];
|
|
585
|
+
const data = parsedOutput.body;
|
|
586
|
+
if (data.message != null) {
|
|
587
|
+
contents.message = __expectString(data.message);
|
|
588
|
+
}
|
|
589
|
+
const exception = new LimitExceededException({
|
|
590
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
591
|
+
...contents,
|
|
762
592
|
});
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
593
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
594
|
+
};
|
|
595
|
+
const deserializeAws_restJson1LoopDetectedExceptionResponse = async (parsedOutput, context) => {
|
|
596
|
+
const contents = map({});
|
|
597
|
+
const data = parsedOutput.body;
|
|
598
|
+
if (data.Message != null) {
|
|
599
|
+
contents.Message = __expectString(data.Message);
|
|
600
|
+
}
|
|
601
|
+
const exception = new LoopDetectedException({
|
|
602
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
603
|
+
...contents,
|
|
774
604
|
});
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
605
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
606
|
+
};
|
|
607
|
+
const deserializeAws_restJson1NotAcceptableExceptionResponse = async (parsedOutput, context) => {
|
|
608
|
+
const contents = map({});
|
|
609
|
+
const data = parsedOutput.body;
|
|
610
|
+
if (data.message != null) {
|
|
611
|
+
contents.message = __expectString(data.message);
|
|
612
|
+
}
|
|
613
|
+
const exception = new NotAcceptableException({
|
|
614
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
615
|
+
...contents,
|
|
786
616
|
});
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
617
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
618
|
+
};
|
|
619
|
+
const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, context) => {
|
|
620
|
+
const contents = map({});
|
|
621
|
+
const data = parsedOutput.body;
|
|
622
|
+
if (data.message != null) {
|
|
623
|
+
contents.message = __expectString(data.message);
|
|
624
|
+
}
|
|
625
|
+
const exception = new NotFoundException({
|
|
626
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
627
|
+
...contents,
|
|
798
628
|
});
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
629
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
630
|
+
};
|
|
631
|
+
const deserializeAws_restJson1RequestTimeoutExceptionResponse = async (parsedOutput, context) => {
|
|
632
|
+
const contents = map({});
|
|
633
|
+
const data = parsedOutput.body;
|
|
634
|
+
if (data.message != null) {
|
|
635
|
+
contents.message = __expectString(data.message);
|
|
636
|
+
}
|
|
637
|
+
const exception = new RequestTimeoutException({
|
|
638
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
639
|
+
...contents,
|
|
810
640
|
});
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
641
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
642
|
+
};
|
|
643
|
+
const deserializeAws_restJson1UnsupportedMediaTypeExceptionResponse = async (parsedOutput, context) => {
|
|
644
|
+
const contents = map({});
|
|
645
|
+
const data = parsedOutput.body;
|
|
646
|
+
if (data.message != null) {
|
|
647
|
+
contents.message = __expectString(data.message);
|
|
648
|
+
}
|
|
649
|
+
const exception = new UnsupportedMediaTypeException({
|
|
650
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
651
|
+
...contents,
|
|
822
652
|
});
|
|
823
|
-
|
|
824
|
-
var serializeAws_restJson1ActiveContext = function (input, context) {
|
|
825
|
-
return __assign(__assign(__assign({}, (input.name != null && { name: input.name })), (input.parameters != null && {
|
|
826
|
-
parameters: serializeAws_restJson1ActiveContextParametersMap(input.parameters, context),
|
|
827
|
-
})), (input.timeToLive != null && {
|
|
828
|
-
timeToLive: serializeAws_restJson1ActiveContextTimeToLive(input.timeToLive, context),
|
|
829
|
-
}));
|
|
653
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
830
654
|
};
|
|
831
|
-
|
|
832
|
-
return
|
|
833
|
-
|
|
834
|
-
|
|
655
|
+
const serializeAws_restJson1ActiveContext = (input, context) => {
|
|
656
|
+
return {
|
|
657
|
+
...(input.name != null && { name: input.name }),
|
|
658
|
+
...(input.parameters != null && {
|
|
659
|
+
parameters: serializeAws_restJson1ActiveContextParametersMap(input.parameters, context),
|
|
660
|
+
}),
|
|
661
|
+
...(input.timeToLive != null && {
|
|
662
|
+
timeToLive: serializeAws_restJson1ActiveContextTimeToLive(input.timeToLive, context),
|
|
663
|
+
}),
|
|
664
|
+
};
|
|
665
|
+
};
|
|
666
|
+
const serializeAws_restJson1ActiveContextParametersMap = (input, context) => {
|
|
667
|
+
return Object.entries(input).reduce((acc, [key, value]) => {
|
|
835
668
|
if (value === null) {
|
|
836
669
|
return acc;
|
|
837
670
|
}
|
|
838
|
-
return
|
|
671
|
+
return {
|
|
672
|
+
...acc,
|
|
673
|
+
[key]: value,
|
|
674
|
+
};
|
|
839
675
|
}, {});
|
|
840
676
|
};
|
|
841
|
-
|
|
677
|
+
const serializeAws_restJson1ActiveContextsList = (input, context) => {
|
|
842
678
|
return input
|
|
843
|
-
.filter(
|
|
844
|
-
.map(
|
|
679
|
+
.filter((e) => e != null)
|
|
680
|
+
.map((entry) => {
|
|
845
681
|
return serializeAws_restJson1ActiveContext(entry, context);
|
|
846
682
|
});
|
|
847
683
|
};
|
|
848
|
-
|
|
849
|
-
return
|
|
684
|
+
const serializeAws_restJson1ActiveContextTimeToLive = (input, context) => {
|
|
685
|
+
return {
|
|
686
|
+
...(input.timeToLiveInSeconds != null && { timeToLiveInSeconds: input.timeToLiveInSeconds }),
|
|
687
|
+
...(input.turnsToLive != null && { turnsToLive: input.turnsToLive }),
|
|
688
|
+
};
|
|
850
689
|
};
|
|
851
|
-
|
|
852
|
-
return
|
|
690
|
+
const serializeAws_restJson1DialogAction = (input, context) => {
|
|
691
|
+
return {
|
|
692
|
+
...(input.fulfillmentState != null && { fulfillmentState: input.fulfillmentState }),
|
|
693
|
+
...(input.intentName != null && { intentName: input.intentName }),
|
|
694
|
+
...(input.message != null && { message: input.message }),
|
|
695
|
+
...(input.messageFormat != null && { messageFormat: input.messageFormat }),
|
|
696
|
+
...(input.slotToElicit != null && { slotToElicit: input.slotToElicit }),
|
|
697
|
+
...(input.slots != null && { slots: serializeAws_restJson1StringMap(input.slots, context) }),
|
|
698
|
+
...(input.type != null && { type: input.type }),
|
|
699
|
+
};
|
|
853
700
|
};
|
|
854
|
-
|
|
855
|
-
return
|
|
701
|
+
const serializeAws_restJson1IntentSummary = (input, context) => {
|
|
702
|
+
return {
|
|
703
|
+
...(input.checkpointLabel != null && { checkpointLabel: input.checkpointLabel }),
|
|
704
|
+
...(input.confirmationStatus != null && { confirmationStatus: input.confirmationStatus }),
|
|
705
|
+
...(input.dialogActionType != null && { dialogActionType: input.dialogActionType }),
|
|
706
|
+
...(input.fulfillmentState != null && { fulfillmentState: input.fulfillmentState }),
|
|
707
|
+
...(input.intentName != null && { intentName: input.intentName }),
|
|
708
|
+
...(input.slotToElicit != null && { slotToElicit: input.slotToElicit }),
|
|
709
|
+
...(input.slots != null && { slots: serializeAws_restJson1StringMap(input.slots, context) }),
|
|
710
|
+
};
|
|
856
711
|
};
|
|
857
|
-
|
|
712
|
+
const serializeAws_restJson1IntentSummaryList = (input, context) => {
|
|
858
713
|
return input
|
|
859
|
-
.filter(
|
|
860
|
-
.map(
|
|
714
|
+
.filter((e) => e != null)
|
|
715
|
+
.map((entry) => {
|
|
861
716
|
return serializeAws_restJson1IntentSummary(entry, context);
|
|
862
717
|
});
|
|
863
718
|
};
|
|
864
|
-
|
|
865
|
-
return Object.entries(input).reduce(
|
|
866
|
-
var _b;
|
|
867
|
-
var _c = __read(_a, 2), key = _c[0], value = _c[1];
|
|
719
|
+
const serializeAws_restJson1StringMap = (input, context) => {
|
|
720
|
+
return Object.entries(input).reduce((acc, [key, value]) => {
|
|
868
721
|
if (value === null) {
|
|
869
722
|
return acc;
|
|
870
723
|
}
|
|
871
|
-
return
|
|
724
|
+
return {
|
|
725
|
+
...acc,
|
|
726
|
+
[key]: value,
|
|
727
|
+
};
|
|
872
728
|
}, {});
|
|
873
729
|
};
|
|
874
|
-
|
|
730
|
+
const deserializeAws_restJson1ActiveContext = (output, context) => {
|
|
875
731
|
return {
|
|
876
732
|
name: __expectString(output.name),
|
|
877
733
|
parameters: output.parameters != null
|
|
@@ -882,20 +738,21 @@ var deserializeAws_restJson1ActiveContext = function (output, context) {
|
|
|
882
738
|
: undefined,
|
|
883
739
|
};
|
|
884
740
|
};
|
|
885
|
-
|
|
886
|
-
return Object.entries(output).reduce(
|
|
887
|
-
var _b;
|
|
888
|
-
var _c = __read(_a, 2), key = _c[0], value = _c[1];
|
|
741
|
+
const deserializeAws_restJson1ActiveContextParametersMap = (output, context) => {
|
|
742
|
+
return Object.entries(output).reduce((acc, [key, value]) => {
|
|
889
743
|
if (value === null) {
|
|
890
744
|
return acc;
|
|
891
745
|
}
|
|
892
|
-
return
|
|
746
|
+
return {
|
|
747
|
+
...acc,
|
|
748
|
+
[key]: __expectString(value),
|
|
749
|
+
};
|
|
893
750
|
}, {});
|
|
894
751
|
};
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
.filter(
|
|
898
|
-
.map(
|
|
752
|
+
const deserializeAws_restJson1ActiveContextsList = (output, context) => {
|
|
753
|
+
const retVal = (output || [])
|
|
754
|
+
.filter((e) => e != null)
|
|
755
|
+
.map((entry) => {
|
|
899
756
|
if (entry === null) {
|
|
900
757
|
return null;
|
|
901
758
|
}
|
|
@@ -903,19 +760,19 @@ var deserializeAws_restJson1ActiveContextsList = function (output, context) {
|
|
|
903
760
|
});
|
|
904
761
|
return retVal;
|
|
905
762
|
};
|
|
906
|
-
|
|
763
|
+
const deserializeAws_restJson1ActiveContextTimeToLive = (output, context) => {
|
|
907
764
|
return {
|
|
908
765
|
timeToLiveInSeconds: __expectInt32(output.timeToLiveInSeconds),
|
|
909
766
|
turnsToLive: __expectInt32(output.turnsToLive),
|
|
910
767
|
};
|
|
911
768
|
};
|
|
912
|
-
|
|
769
|
+
const deserializeAws_restJson1Button = (output, context) => {
|
|
913
770
|
return {
|
|
914
771
|
text: __expectString(output.text),
|
|
915
772
|
value: __expectString(output.value),
|
|
916
773
|
};
|
|
917
774
|
};
|
|
918
|
-
|
|
775
|
+
const deserializeAws_restJson1DialogAction = (output, context) => {
|
|
919
776
|
return {
|
|
920
777
|
fulfillmentState: __expectString(output.fulfillmentState),
|
|
921
778
|
intentName: __expectString(output.intentName),
|
|
@@ -926,7 +783,7 @@ var deserializeAws_restJson1DialogAction = function (output, context) {
|
|
|
926
783
|
type: __expectString(output.type),
|
|
927
784
|
};
|
|
928
785
|
};
|
|
929
|
-
|
|
786
|
+
const deserializeAws_restJson1GenericAttachment = (output, context) => {
|
|
930
787
|
return {
|
|
931
788
|
attachmentLinkUrl: __expectString(output.attachmentLinkUrl),
|
|
932
789
|
buttons: output.buttons != null ? deserializeAws_restJson1listOfButtons(output.buttons, context) : undefined,
|
|
@@ -935,10 +792,10 @@ var deserializeAws_restJson1GenericAttachment = function (output, context) {
|
|
|
935
792
|
title: __expectString(output.title),
|
|
936
793
|
};
|
|
937
794
|
};
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
.filter(
|
|
941
|
-
.map(
|
|
795
|
+
const deserializeAws_restJson1genericAttachmentList = (output, context) => {
|
|
796
|
+
const retVal = (output || [])
|
|
797
|
+
.filter((e) => e != null)
|
|
798
|
+
.map((entry) => {
|
|
942
799
|
if (entry === null) {
|
|
943
800
|
return null;
|
|
944
801
|
}
|
|
@@ -946,15 +803,15 @@ var deserializeAws_restJson1genericAttachmentList = function (output, context) {
|
|
|
946
803
|
});
|
|
947
804
|
return retVal;
|
|
948
805
|
};
|
|
949
|
-
|
|
806
|
+
const deserializeAws_restJson1IntentConfidence = (output, context) => {
|
|
950
807
|
return {
|
|
951
808
|
score: __limitedParseDouble(output.score),
|
|
952
809
|
};
|
|
953
810
|
};
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
.filter(
|
|
957
|
-
.map(
|
|
811
|
+
const deserializeAws_restJson1IntentList = (output, context) => {
|
|
812
|
+
const retVal = (output || [])
|
|
813
|
+
.filter((e) => e != null)
|
|
814
|
+
.map((entry) => {
|
|
958
815
|
if (entry === null) {
|
|
959
816
|
return null;
|
|
960
817
|
}
|
|
@@ -962,7 +819,7 @@ var deserializeAws_restJson1IntentList = function (output, context) {
|
|
|
962
819
|
});
|
|
963
820
|
return retVal;
|
|
964
821
|
};
|
|
965
|
-
|
|
822
|
+
const deserializeAws_restJson1IntentSummary = (output, context) => {
|
|
966
823
|
return {
|
|
967
824
|
checkpointLabel: __expectString(output.checkpointLabel),
|
|
968
825
|
confirmationStatus: __expectString(output.confirmationStatus),
|
|
@@ -973,10 +830,10 @@ var deserializeAws_restJson1IntentSummary = function (output, context) {
|
|
|
973
830
|
slots: output.slots != null ? deserializeAws_restJson1StringMap(output.slots, context) : undefined,
|
|
974
831
|
};
|
|
975
832
|
};
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
.filter(
|
|
979
|
-
.map(
|
|
833
|
+
const deserializeAws_restJson1IntentSummaryList = (output, context) => {
|
|
834
|
+
const retVal = (output || [])
|
|
835
|
+
.filter((e) => e != null)
|
|
836
|
+
.map((entry) => {
|
|
980
837
|
if (entry === null) {
|
|
981
838
|
return null;
|
|
982
839
|
}
|
|
@@ -984,10 +841,10 @@ var deserializeAws_restJson1IntentSummaryList = function (output, context) {
|
|
|
984
841
|
});
|
|
985
842
|
return retVal;
|
|
986
843
|
};
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
.filter(
|
|
990
|
-
.map(
|
|
844
|
+
const deserializeAws_restJson1listOfButtons = (output, context) => {
|
|
845
|
+
const retVal = (output || [])
|
|
846
|
+
.filter((e) => e != null)
|
|
847
|
+
.map((entry) => {
|
|
991
848
|
if (entry === null) {
|
|
992
849
|
return null;
|
|
993
850
|
}
|
|
@@ -995,7 +852,7 @@ var deserializeAws_restJson1listOfButtons = function (output, context) {
|
|
|
995
852
|
});
|
|
996
853
|
return retVal;
|
|
997
854
|
};
|
|
998
|
-
|
|
855
|
+
const deserializeAws_restJson1PredictedIntent = (output, context) => {
|
|
999
856
|
return {
|
|
1000
857
|
intentName: __expectString(output.intentName),
|
|
1001
858
|
nluIntentConfidence: output.nluIntentConfidence != null
|
|
@@ -1004,7 +861,7 @@ var deserializeAws_restJson1PredictedIntent = function (output, context) {
|
|
|
1004
861
|
slots: output.slots != null ? deserializeAws_restJson1StringMap(output.slots, context) : undefined,
|
|
1005
862
|
};
|
|
1006
863
|
};
|
|
1007
|
-
|
|
864
|
+
const deserializeAws_restJson1ResponseCard = (output, context) => {
|
|
1008
865
|
return {
|
|
1009
866
|
contentType: __expectString(output.contentType),
|
|
1010
867
|
genericAttachments: output.genericAttachments != null
|
|
@@ -1013,60 +870,56 @@ var deserializeAws_restJson1ResponseCard = function (output, context) {
|
|
|
1013
870
|
version: __expectString(output.version),
|
|
1014
871
|
};
|
|
1015
872
|
};
|
|
1016
|
-
|
|
873
|
+
const deserializeAws_restJson1SentimentResponse = (output, context) => {
|
|
1017
874
|
return {
|
|
1018
875
|
sentimentLabel: __expectString(output.sentimentLabel),
|
|
1019
876
|
sentimentScore: __expectString(output.sentimentScore),
|
|
1020
877
|
};
|
|
1021
878
|
};
|
|
1022
|
-
|
|
1023
|
-
return Object.entries(output).reduce(
|
|
1024
|
-
var _b;
|
|
1025
|
-
var _c = __read(_a, 2), key = _c[0], value = _c[1];
|
|
879
|
+
const deserializeAws_restJson1StringMap = (output, context) => {
|
|
880
|
+
return Object.entries(output).reduce((acc, [key, value]) => {
|
|
1026
881
|
if (value === null) {
|
|
1027
882
|
return acc;
|
|
1028
883
|
}
|
|
1029
|
-
return
|
|
884
|
+
return {
|
|
885
|
+
...acc,
|
|
886
|
+
[key]: __expectString(value),
|
|
887
|
+
};
|
|
1030
888
|
}, {});
|
|
1031
889
|
};
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
});
|
|
1040
|
-
};
|
|
1041
|
-
var collectBody = function (streamBody, context) {
|
|
1042
|
-
if (streamBody === void 0) { streamBody = new Uint8Array(); }
|
|
890
|
+
const deserializeMetadata = (output) => ({
|
|
891
|
+
httpStatusCode: output.statusCode,
|
|
892
|
+
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
|
|
893
|
+
extendedRequestId: output.headers["x-amz-id-2"],
|
|
894
|
+
cfId: output.headers["x-amz-cf-id"],
|
|
895
|
+
});
|
|
896
|
+
const collectBody = (streamBody = new Uint8Array(), context) => {
|
|
1043
897
|
if (streamBody instanceof Uint8Array) {
|
|
1044
898
|
return Promise.resolve(streamBody);
|
|
1045
899
|
}
|
|
1046
900
|
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
|
|
1047
901
|
};
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
});
|
|
902
|
+
const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
|
|
903
|
+
const isSerializableHeaderValue = (value) => value !== undefined &&
|
|
904
|
+
value !== null &&
|
|
905
|
+
value !== "" &&
|
|
906
|
+
(!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
|
|
907
|
+
(!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
|
|
908
|
+
const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
909
|
+
if (encoded.length) {
|
|
910
|
+
return JSON.parse(encoded);
|
|
911
|
+
}
|
|
912
|
+
return {};
|
|
913
|
+
});
|
|
914
|
+
const parseErrorBody = async (errorBody, context) => {
|
|
915
|
+
const value = await parseBody(errorBody, context);
|
|
916
|
+
value.message = value.message ?? value.Message;
|
|
917
|
+
return value;
|
|
1065
918
|
};
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
919
|
+
const loadRestJsonErrorCode = (output, data) => {
|
|
920
|
+
const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
921
|
+
const sanitizeErrorCode = (rawValue) => {
|
|
922
|
+
let cleanValue = rawValue;
|
|
1070
923
|
if (typeof cleanValue === "number") {
|
|
1071
924
|
cleanValue = cleanValue.toString();
|
|
1072
925
|
}
|
|
@@ -1081,7 +934,7 @@ var loadRestJsonErrorCode = function (output, data) {
|
|
|
1081
934
|
}
|
|
1082
935
|
return cleanValue;
|
|
1083
936
|
};
|
|
1084
|
-
|
|
937
|
+
const headerKey = findKey(output.headers, "x-amzn-errortype");
|
|
1085
938
|
if (headerKey !== undefined) {
|
|
1086
939
|
return sanitizeErrorCode(output.headers[headerKey]);
|
|
1087
940
|
}
|