@aws-sdk/client-lex-runtime-service 3.186.0 → 3.188.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 +11 -0
- package/dist-cjs/protocols/Aws_restJson1.js +2 -0
- package/dist-cjs/runtimeConfig.browser.js +9 -7
- package/dist-cjs/runtimeConfig.js +9 -7
- 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 +755 -913
- package/dist-es/runtimeConfig.browser.js +28 -12
- package/dist-es/runtimeConfig.js +32 -12
- package/dist-es/runtimeConfig.native.js +8 -5
- package/dist-es/runtimeConfig.shared.js +8 -11
- package/dist-types/LexRuntimeServiceClient.d.ts +6 -1
- package/dist-types/commands/PostContentCommand.d.ts +2 -2
- package/dist-types/commands/PutSessionCommand.d.ts +2 -2
- package/dist-types/protocols/Aws_restJson1.d.ts +3 -3
- package/dist-types/runtimeConfig.browser.d.ts +1 -0
- package/dist-types/runtimeConfig.d.ts +1 -0
- package/dist-types/runtimeConfig.native.d.ts +1 -0
- package/dist-types/ts3.4/LexRuntimeServiceClient.d.ts +2 -0
- package/dist-types/ts3.4/commands/PostContentCommand.d.ts +2 -1
- package/dist-types/ts3.4/commands/PutSessionCommand.d.ts +2 -1
- package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +6 -3
- package/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -0
- package/dist-types/ts3.4/runtimeConfig.d.ts +1 -0
- package/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -0
- package/package.json +35 -33
|
@@ -1,877 +1,735 @@
|
|
|
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, parseErrorBody(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
|
+
context.sdkStreamMixin(data);
|
|
303
|
+
contents.audioStream = data;
|
|
304
|
+
return contents;
|
|
305
|
+
};
|
|
306
|
+
const deserializeAws_restJson1PostContentCommandError = async (output, context) => {
|
|
307
|
+
const parsedOutput = {
|
|
308
|
+
...output,
|
|
309
|
+
body: await parseErrorBody(output.body, context),
|
|
310
|
+
};
|
|
311
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
312
|
+
switch (errorCode) {
|
|
313
|
+
case "BadGatewayException":
|
|
314
|
+
case "com.amazonaws.lexruntimeservice#BadGatewayException":
|
|
315
|
+
throw await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context);
|
|
316
|
+
case "BadRequestException":
|
|
317
|
+
case "com.amazonaws.lexruntimeservice#BadRequestException":
|
|
318
|
+
throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
|
|
319
|
+
case "ConflictException":
|
|
320
|
+
case "com.amazonaws.lexruntimeservice#ConflictException":
|
|
321
|
+
throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
|
|
322
|
+
case "DependencyFailedException":
|
|
323
|
+
case "com.amazonaws.lexruntimeservice#DependencyFailedException":
|
|
324
|
+
throw await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context);
|
|
325
|
+
case "InternalFailureException":
|
|
326
|
+
case "com.amazonaws.lexruntimeservice#InternalFailureException":
|
|
327
|
+
throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
|
|
328
|
+
case "LimitExceededException":
|
|
329
|
+
case "com.amazonaws.lexruntimeservice#LimitExceededException":
|
|
330
|
+
throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
|
|
331
|
+
case "LoopDetectedException":
|
|
332
|
+
case "com.amazonaws.lexruntimeservice#LoopDetectedException":
|
|
333
|
+
throw await deserializeAws_restJson1LoopDetectedExceptionResponse(parsedOutput, context);
|
|
334
|
+
case "NotAcceptableException":
|
|
335
|
+
case "com.amazonaws.lexruntimeservice#NotAcceptableException":
|
|
336
|
+
throw await deserializeAws_restJson1NotAcceptableExceptionResponse(parsedOutput, context);
|
|
337
|
+
case "NotFoundException":
|
|
338
|
+
case "com.amazonaws.lexruntimeservice#NotFoundException":
|
|
339
|
+
throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
|
|
340
|
+
case "RequestTimeoutException":
|
|
341
|
+
case "com.amazonaws.lexruntimeservice#RequestTimeoutException":
|
|
342
|
+
throw await deserializeAws_restJson1RequestTimeoutExceptionResponse(parsedOutput, context);
|
|
343
|
+
case "UnsupportedMediaTypeException":
|
|
344
|
+
case "com.amazonaws.lexruntimeservice#UnsupportedMediaTypeException":
|
|
345
|
+
throw await deserializeAws_restJson1UnsupportedMediaTypeExceptionResponse(parsedOutput, context);
|
|
346
|
+
default:
|
|
347
|
+
const parsedBody = parsedOutput.body;
|
|
348
|
+
throwDefaultError({
|
|
349
|
+
output,
|
|
350
|
+
parsedBody,
|
|
351
|
+
exceptionCtor: __BaseException,
|
|
352
|
+
errorCode,
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
export const deserializeAws_restJson1PostTextCommand = async (output, context) => {
|
|
357
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
358
|
+
return deserializeAws_restJson1PostTextCommandError(output, context);
|
|
359
|
+
}
|
|
360
|
+
const contents = map({
|
|
361
|
+
$metadata: deserializeMetadata(output),
|
|
626
362
|
});
|
|
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
|
-
|
|
363
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
364
|
+
if (data.activeContexts != null) {
|
|
365
|
+
contents.activeContexts = deserializeAws_restJson1ActiveContextsList(data.activeContexts, context);
|
|
366
|
+
}
|
|
367
|
+
if (data.alternativeIntents != null) {
|
|
368
|
+
contents.alternativeIntents = deserializeAws_restJson1IntentList(data.alternativeIntents, context);
|
|
369
|
+
}
|
|
370
|
+
if (data.botVersion != null) {
|
|
371
|
+
contents.botVersion = __expectString(data.botVersion);
|
|
372
|
+
}
|
|
373
|
+
if (data.dialogState != null) {
|
|
374
|
+
contents.dialogState = __expectString(data.dialogState);
|
|
375
|
+
}
|
|
376
|
+
if (data.intentName != null) {
|
|
377
|
+
contents.intentName = __expectString(data.intentName);
|
|
378
|
+
}
|
|
379
|
+
if (data.message != null) {
|
|
380
|
+
contents.message = __expectString(data.message);
|
|
381
|
+
}
|
|
382
|
+
if (data.messageFormat != null) {
|
|
383
|
+
contents.messageFormat = __expectString(data.messageFormat);
|
|
384
|
+
}
|
|
385
|
+
if (data.nluIntentConfidence != null) {
|
|
386
|
+
contents.nluIntentConfidence = deserializeAws_restJson1IntentConfidence(data.nluIntentConfidence, context);
|
|
387
|
+
}
|
|
388
|
+
if (data.responseCard != null) {
|
|
389
|
+
contents.responseCard = deserializeAws_restJson1ResponseCard(data.responseCard, context);
|
|
390
|
+
}
|
|
391
|
+
if (data.sentimentResponse != null) {
|
|
392
|
+
contents.sentimentResponse = deserializeAws_restJson1SentimentResponse(data.sentimentResponse, context);
|
|
393
|
+
}
|
|
394
|
+
if (data.sessionAttributes != null) {
|
|
395
|
+
contents.sessionAttributes = deserializeAws_restJson1StringMap(data.sessionAttributes, context);
|
|
396
|
+
}
|
|
397
|
+
if (data.sessionId != null) {
|
|
398
|
+
contents.sessionId = __expectString(data.sessionId);
|
|
399
|
+
}
|
|
400
|
+
if (data.slotToElicit != null) {
|
|
401
|
+
contents.slotToElicit = __expectString(data.slotToElicit);
|
|
402
|
+
}
|
|
403
|
+
if (data.slots != null) {
|
|
404
|
+
contents.slots = deserializeAws_restJson1StringMap(data.slots, context);
|
|
405
|
+
}
|
|
406
|
+
return contents;
|
|
407
|
+
};
|
|
408
|
+
const deserializeAws_restJson1PostTextCommandError = async (output, context) => {
|
|
409
|
+
const parsedOutput = {
|
|
410
|
+
...output,
|
|
411
|
+
body: await parseErrorBody(output.body, context),
|
|
412
|
+
};
|
|
413
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
414
|
+
switch (errorCode) {
|
|
415
|
+
case "BadGatewayException":
|
|
416
|
+
case "com.amazonaws.lexruntimeservice#BadGatewayException":
|
|
417
|
+
throw await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context);
|
|
418
|
+
case "BadRequestException":
|
|
419
|
+
case "com.amazonaws.lexruntimeservice#BadRequestException":
|
|
420
|
+
throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
|
|
421
|
+
case "ConflictException":
|
|
422
|
+
case "com.amazonaws.lexruntimeservice#ConflictException":
|
|
423
|
+
throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
|
|
424
|
+
case "DependencyFailedException":
|
|
425
|
+
case "com.amazonaws.lexruntimeservice#DependencyFailedException":
|
|
426
|
+
throw await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context);
|
|
427
|
+
case "InternalFailureException":
|
|
428
|
+
case "com.amazonaws.lexruntimeservice#InternalFailureException":
|
|
429
|
+
throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
|
|
430
|
+
case "LimitExceededException":
|
|
431
|
+
case "com.amazonaws.lexruntimeservice#LimitExceededException":
|
|
432
|
+
throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
|
|
433
|
+
case "LoopDetectedException":
|
|
434
|
+
case "com.amazonaws.lexruntimeservice#LoopDetectedException":
|
|
435
|
+
throw await deserializeAws_restJson1LoopDetectedExceptionResponse(parsedOutput, context);
|
|
436
|
+
case "NotFoundException":
|
|
437
|
+
case "com.amazonaws.lexruntimeservice#NotFoundException":
|
|
438
|
+
throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
|
|
439
|
+
default:
|
|
440
|
+
const parsedBody = parsedOutput.body;
|
|
441
|
+
throwDefaultError({
|
|
442
|
+
output,
|
|
443
|
+
parsedBody,
|
|
444
|
+
exceptionCtor: __BaseException,
|
|
445
|
+
errorCode,
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
export const deserializeAws_restJson1PutSessionCommand = async (output, context) => {
|
|
450
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
451
|
+
return deserializeAws_restJson1PutSessionCommandError(output, context);
|
|
452
|
+
}
|
|
453
|
+
const contents = map({
|
|
454
|
+
$metadata: deserializeMetadata(output),
|
|
455
|
+
contentType: [, output.headers["content-type"]],
|
|
456
|
+
intentName: [, output.headers["x-amz-lex-intent-name"]],
|
|
457
|
+
slots: [
|
|
458
|
+
() => void 0 !== output.headers["x-amz-lex-slots"],
|
|
459
|
+
() => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-slots"])).toString("utf8")),
|
|
460
|
+
],
|
|
461
|
+
sessionAttributes: [
|
|
462
|
+
() => void 0 !== output.headers["x-amz-lex-session-attributes"],
|
|
463
|
+
() => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-session-attributes"])).toString("utf8")),
|
|
464
|
+
],
|
|
465
|
+
message: [, output.headers["x-amz-lex-message"]],
|
|
466
|
+
encodedMessage: [, output.headers["x-amz-lex-encoded-message"]],
|
|
467
|
+
messageFormat: [, output.headers["x-amz-lex-message-format"]],
|
|
468
|
+
dialogState: [, output.headers["x-amz-lex-dialog-state"]],
|
|
469
|
+
slotToElicit: [, output.headers["x-amz-lex-slot-to-elicit"]],
|
|
470
|
+
sessionId: [, output.headers["x-amz-lex-session-id"]],
|
|
471
|
+
activeContexts: [
|
|
472
|
+
() => void 0 !== output.headers["x-amz-lex-active-contexts"],
|
|
473
|
+
() => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-active-contexts"])).toString("utf8")),
|
|
474
|
+
],
|
|
475
|
+
});
|
|
476
|
+
const data = output.body;
|
|
477
|
+
context.sdkStreamMixin(data);
|
|
478
|
+
contents.audioStream = data;
|
|
479
|
+
return contents;
|
|
480
|
+
};
|
|
481
|
+
const deserializeAws_restJson1PutSessionCommandError = async (output, context) => {
|
|
482
|
+
const parsedOutput = {
|
|
483
|
+
...output,
|
|
484
|
+
body: await parseErrorBody(output.body, context),
|
|
485
|
+
};
|
|
486
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
487
|
+
switch (errorCode) {
|
|
488
|
+
case "BadGatewayException":
|
|
489
|
+
case "com.amazonaws.lexruntimeservice#BadGatewayException":
|
|
490
|
+
throw await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context);
|
|
491
|
+
case "BadRequestException":
|
|
492
|
+
case "com.amazonaws.lexruntimeservice#BadRequestException":
|
|
493
|
+
throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
|
|
494
|
+
case "ConflictException":
|
|
495
|
+
case "com.amazonaws.lexruntimeservice#ConflictException":
|
|
496
|
+
throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
|
|
497
|
+
case "DependencyFailedException":
|
|
498
|
+
case "com.amazonaws.lexruntimeservice#DependencyFailedException":
|
|
499
|
+
throw await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context);
|
|
500
|
+
case "InternalFailureException":
|
|
501
|
+
case "com.amazonaws.lexruntimeservice#InternalFailureException":
|
|
502
|
+
throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
|
|
503
|
+
case "LimitExceededException":
|
|
504
|
+
case "com.amazonaws.lexruntimeservice#LimitExceededException":
|
|
505
|
+
throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
|
|
506
|
+
case "NotAcceptableException":
|
|
507
|
+
case "com.amazonaws.lexruntimeservice#NotAcceptableException":
|
|
508
|
+
throw await deserializeAws_restJson1NotAcceptableExceptionResponse(parsedOutput, context);
|
|
509
|
+
case "NotFoundException":
|
|
510
|
+
case "com.amazonaws.lexruntimeservice#NotFoundException":
|
|
511
|
+
throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
|
|
512
|
+
default:
|
|
513
|
+
const parsedBody = parsedOutput.body;
|
|
514
|
+
throwDefaultError({
|
|
515
|
+
output,
|
|
516
|
+
parsedBody,
|
|
517
|
+
exceptionCtor: __BaseException,
|
|
518
|
+
errorCode,
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
const map = __map;
|
|
523
|
+
const deserializeAws_restJson1BadGatewayExceptionResponse = async (parsedOutput, context) => {
|
|
524
|
+
const contents = map({});
|
|
525
|
+
const data = parsedOutput.body;
|
|
526
|
+
if (data.Message != null) {
|
|
527
|
+
contents.Message = __expectString(data.Message);
|
|
528
|
+
}
|
|
529
|
+
const exception = new BadGatewayException({
|
|
530
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
531
|
+
...contents,
|
|
687
532
|
});
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
return [2, __decorateServiceException(exception, parsedOutput.body)];
|
|
533
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
534
|
+
};
|
|
535
|
+
const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput, context) => {
|
|
536
|
+
const contents = map({});
|
|
537
|
+
const data = parsedOutput.body;
|
|
538
|
+
if (data.message != null) {
|
|
539
|
+
contents.message = __expectString(data.message);
|
|
540
|
+
}
|
|
541
|
+
const exception = new BadRequestException({
|
|
542
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
543
|
+
...contents,
|
|
700
544
|
});
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
545
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
546
|
+
};
|
|
547
|
+
const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
|
|
548
|
+
const contents = map({});
|
|
549
|
+
const data = parsedOutput.body;
|
|
550
|
+
if (data.message != null) {
|
|
551
|
+
contents.message = __expectString(data.message);
|
|
552
|
+
}
|
|
553
|
+
const exception = new ConflictException({
|
|
554
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
555
|
+
...contents,
|
|
712
556
|
});
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
557
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
558
|
+
};
|
|
559
|
+
const deserializeAws_restJson1DependencyFailedExceptionResponse = async (parsedOutput, context) => {
|
|
560
|
+
const contents = map({});
|
|
561
|
+
const data = parsedOutput.body;
|
|
562
|
+
if (data.Message != null) {
|
|
563
|
+
contents.Message = __expectString(data.Message);
|
|
564
|
+
}
|
|
565
|
+
const exception = new DependencyFailedException({
|
|
566
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
567
|
+
...contents,
|
|
724
568
|
});
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
569
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
570
|
+
};
|
|
571
|
+
const deserializeAws_restJson1InternalFailureExceptionResponse = async (parsedOutput, context) => {
|
|
572
|
+
const contents = map({});
|
|
573
|
+
const data = parsedOutput.body;
|
|
574
|
+
if (data.message != null) {
|
|
575
|
+
contents.message = __expectString(data.message);
|
|
576
|
+
}
|
|
577
|
+
const exception = new InternalFailureException({
|
|
578
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
579
|
+
...contents,
|
|
736
580
|
});
|
|
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)];
|
|
581
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
582
|
+
};
|
|
583
|
+
const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutput, context) => {
|
|
584
|
+
const contents = map({
|
|
585
|
+
retryAfterSeconds: [, parsedOutput.headers["retry-after"]],
|
|
748
586
|
});
|
|
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)];
|
|
587
|
+
const data = parsedOutput.body;
|
|
588
|
+
if (data.message != null) {
|
|
589
|
+
contents.message = __expectString(data.message);
|
|
590
|
+
}
|
|
591
|
+
const exception = new LimitExceededException({
|
|
592
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
593
|
+
...contents,
|
|
762
594
|
});
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
595
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
596
|
+
};
|
|
597
|
+
const deserializeAws_restJson1LoopDetectedExceptionResponse = async (parsedOutput, context) => {
|
|
598
|
+
const contents = map({});
|
|
599
|
+
const data = parsedOutput.body;
|
|
600
|
+
if (data.Message != null) {
|
|
601
|
+
contents.Message = __expectString(data.Message);
|
|
602
|
+
}
|
|
603
|
+
const exception = new LoopDetectedException({
|
|
604
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
605
|
+
...contents,
|
|
774
606
|
});
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
607
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
608
|
+
};
|
|
609
|
+
const deserializeAws_restJson1NotAcceptableExceptionResponse = async (parsedOutput, context) => {
|
|
610
|
+
const contents = map({});
|
|
611
|
+
const data = parsedOutput.body;
|
|
612
|
+
if (data.message != null) {
|
|
613
|
+
contents.message = __expectString(data.message);
|
|
614
|
+
}
|
|
615
|
+
const exception = new NotAcceptableException({
|
|
616
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
617
|
+
...contents,
|
|
786
618
|
});
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
619
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
620
|
+
};
|
|
621
|
+
const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, context) => {
|
|
622
|
+
const contents = map({});
|
|
623
|
+
const data = parsedOutput.body;
|
|
624
|
+
if (data.message != null) {
|
|
625
|
+
contents.message = __expectString(data.message);
|
|
626
|
+
}
|
|
627
|
+
const exception = new NotFoundException({
|
|
628
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
629
|
+
...contents,
|
|
798
630
|
});
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
631
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
632
|
+
};
|
|
633
|
+
const deserializeAws_restJson1RequestTimeoutExceptionResponse = async (parsedOutput, context) => {
|
|
634
|
+
const contents = map({});
|
|
635
|
+
const data = parsedOutput.body;
|
|
636
|
+
if (data.message != null) {
|
|
637
|
+
contents.message = __expectString(data.message);
|
|
638
|
+
}
|
|
639
|
+
const exception = new RequestTimeoutException({
|
|
640
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
641
|
+
...contents,
|
|
810
642
|
});
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
643
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
644
|
+
};
|
|
645
|
+
const deserializeAws_restJson1UnsupportedMediaTypeExceptionResponse = async (parsedOutput, context) => {
|
|
646
|
+
const contents = map({});
|
|
647
|
+
const data = parsedOutput.body;
|
|
648
|
+
if (data.message != null) {
|
|
649
|
+
contents.message = __expectString(data.message);
|
|
650
|
+
}
|
|
651
|
+
const exception = new UnsupportedMediaTypeException({
|
|
652
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
653
|
+
...contents,
|
|
822
654
|
});
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
655
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
656
|
+
};
|
|
657
|
+
const serializeAws_restJson1ActiveContext = (input, context) => {
|
|
658
|
+
return {
|
|
659
|
+
...(input.name != null && { name: input.name }),
|
|
660
|
+
...(input.parameters != null && {
|
|
661
|
+
parameters: serializeAws_restJson1ActiveContextParametersMap(input.parameters, context),
|
|
662
|
+
}),
|
|
663
|
+
...(input.timeToLive != null && {
|
|
664
|
+
timeToLive: serializeAws_restJson1ActiveContextTimeToLive(input.timeToLive, context),
|
|
665
|
+
}),
|
|
666
|
+
};
|
|
830
667
|
};
|
|
831
|
-
|
|
832
|
-
return Object.entries(input).reduce(
|
|
833
|
-
var _b;
|
|
834
|
-
var _c = __read(_a, 2), key = _c[0], value = _c[1];
|
|
668
|
+
const serializeAws_restJson1ActiveContextParametersMap = (input, context) => {
|
|
669
|
+
return Object.entries(input).reduce((acc, [key, value]) => {
|
|
835
670
|
if (value === null) {
|
|
836
671
|
return acc;
|
|
837
672
|
}
|
|
838
|
-
return
|
|
673
|
+
return {
|
|
674
|
+
...acc,
|
|
675
|
+
[key]: value,
|
|
676
|
+
};
|
|
839
677
|
}, {});
|
|
840
678
|
};
|
|
841
|
-
|
|
679
|
+
const serializeAws_restJson1ActiveContextsList = (input, context) => {
|
|
842
680
|
return input
|
|
843
|
-
.filter(
|
|
844
|
-
.map(
|
|
681
|
+
.filter((e) => e != null)
|
|
682
|
+
.map((entry) => {
|
|
845
683
|
return serializeAws_restJson1ActiveContext(entry, context);
|
|
846
684
|
});
|
|
847
685
|
};
|
|
848
|
-
|
|
849
|
-
return
|
|
686
|
+
const serializeAws_restJson1ActiveContextTimeToLive = (input, context) => {
|
|
687
|
+
return {
|
|
688
|
+
...(input.timeToLiveInSeconds != null && { timeToLiveInSeconds: input.timeToLiveInSeconds }),
|
|
689
|
+
...(input.turnsToLive != null && { turnsToLive: input.turnsToLive }),
|
|
690
|
+
};
|
|
850
691
|
};
|
|
851
|
-
|
|
852
|
-
return
|
|
692
|
+
const serializeAws_restJson1DialogAction = (input, context) => {
|
|
693
|
+
return {
|
|
694
|
+
...(input.fulfillmentState != null && { fulfillmentState: input.fulfillmentState }),
|
|
695
|
+
...(input.intentName != null && { intentName: input.intentName }),
|
|
696
|
+
...(input.message != null && { message: input.message }),
|
|
697
|
+
...(input.messageFormat != null && { messageFormat: input.messageFormat }),
|
|
698
|
+
...(input.slotToElicit != null && { slotToElicit: input.slotToElicit }),
|
|
699
|
+
...(input.slots != null && { slots: serializeAws_restJson1StringMap(input.slots, context) }),
|
|
700
|
+
...(input.type != null && { type: input.type }),
|
|
701
|
+
};
|
|
853
702
|
};
|
|
854
|
-
|
|
855
|
-
return
|
|
703
|
+
const serializeAws_restJson1IntentSummary = (input, context) => {
|
|
704
|
+
return {
|
|
705
|
+
...(input.checkpointLabel != null && { checkpointLabel: input.checkpointLabel }),
|
|
706
|
+
...(input.confirmationStatus != null && { confirmationStatus: input.confirmationStatus }),
|
|
707
|
+
...(input.dialogActionType != null && { dialogActionType: input.dialogActionType }),
|
|
708
|
+
...(input.fulfillmentState != null && { fulfillmentState: input.fulfillmentState }),
|
|
709
|
+
...(input.intentName != null && { intentName: input.intentName }),
|
|
710
|
+
...(input.slotToElicit != null && { slotToElicit: input.slotToElicit }),
|
|
711
|
+
...(input.slots != null && { slots: serializeAws_restJson1StringMap(input.slots, context) }),
|
|
712
|
+
};
|
|
856
713
|
};
|
|
857
|
-
|
|
714
|
+
const serializeAws_restJson1IntentSummaryList = (input, context) => {
|
|
858
715
|
return input
|
|
859
|
-
.filter(
|
|
860
|
-
.map(
|
|
716
|
+
.filter((e) => e != null)
|
|
717
|
+
.map((entry) => {
|
|
861
718
|
return serializeAws_restJson1IntentSummary(entry, context);
|
|
862
719
|
});
|
|
863
720
|
};
|
|
864
|
-
|
|
865
|
-
return Object.entries(input).reduce(
|
|
866
|
-
var _b;
|
|
867
|
-
var _c = __read(_a, 2), key = _c[0], value = _c[1];
|
|
721
|
+
const serializeAws_restJson1StringMap = (input, context) => {
|
|
722
|
+
return Object.entries(input).reduce((acc, [key, value]) => {
|
|
868
723
|
if (value === null) {
|
|
869
724
|
return acc;
|
|
870
725
|
}
|
|
871
|
-
return
|
|
726
|
+
return {
|
|
727
|
+
...acc,
|
|
728
|
+
[key]: value,
|
|
729
|
+
};
|
|
872
730
|
}, {});
|
|
873
731
|
};
|
|
874
|
-
|
|
732
|
+
const deserializeAws_restJson1ActiveContext = (output, context) => {
|
|
875
733
|
return {
|
|
876
734
|
name: __expectString(output.name),
|
|
877
735
|
parameters: output.parameters != null
|
|
@@ -882,20 +740,21 @@ var deserializeAws_restJson1ActiveContext = function (output, context) {
|
|
|
882
740
|
: undefined,
|
|
883
741
|
};
|
|
884
742
|
};
|
|
885
|
-
|
|
886
|
-
return Object.entries(output).reduce(
|
|
887
|
-
var _b;
|
|
888
|
-
var _c = __read(_a, 2), key = _c[0], value = _c[1];
|
|
743
|
+
const deserializeAws_restJson1ActiveContextParametersMap = (output, context) => {
|
|
744
|
+
return Object.entries(output).reduce((acc, [key, value]) => {
|
|
889
745
|
if (value === null) {
|
|
890
746
|
return acc;
|
|
891
747
|
}
|
|
892
|
-
return
|
|
748
|
+
return {
|
|
749
|
+
...acc,
|
|
750
|
+
[key]: __expectString(value),
|
|
751
|
+
};
|
|
893
752
|
}, {});
|
|
894
753
|
};
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
.filter(
|
|
898
|
-
.map(
|
|
754
|
+
const deserializeAws_restJson1ActiveContextsList = (output, context) => {
|
|
755
|
+
const retVal = (output || [])
|
|
756
|
+
.filter((e) => e != null)
|
|
757
|
+
.map((entry) => {
|
|
899
758
|
if (entry === null) {
|
|
900
759
|
return null;
|
|
901
760
|
}
|
|
@@ -903,19 +762,19 @@ var deserializeAws_restJson1ActiveContextsList = function (output, context) {
|
|
|
903
762
|
});
|
|
904
763
|
return retVal;
|
|
905
764
|
};
|
|
906
|
-
|
|
765
|
+
const deserializeAws_restJson1ActiveContextTimeToLive = (output, context) => {
|
|
907
766
|
return {
|
|
908
767
|
timeToLiveInSeconds: __expectInt32(output.timeToLiveInSeconds),
|
|
909
768
|
turnsToLive: __expectInt32(output.turnsToLive),
|
|
910
769
|
};
|
|
911
770
|
};
|
|
912
|
-
|
|
771
|
+
const deserializeAws_restJson1Button = (output, context) => {
|
|
913
772
|
return {
|
|
914
773
|
text: __expectString(output.text),
|
|
915
774
|
value: __expectString(output.value),
|
|
916
775
|
};
|
|
917
776
|
};
|
|
918
|
-
|
|
777
|
+
const deserializeAws_restJson1DialogAction = (output, context) => {
|
|
919
778
|
return {
|
|
920
779
|
fulfillmentState: __expectString(output.fulfillmentState),
|
|
921
780
|
intentName: __expectString(output.intentName),
|
|
@@ -926,7 +785,7 @@ var deserializeAws_restJson1DialogAction = function (output, context) {
|
|
|
926
785
|
type: __expectString(output.type),
|
|
927
786
|
};
|
|
928
787
|
};
|
|
929
|
-
|
|
788
|
+
const deserializeAws_restJson1GenericAttachment = (output, context) => {
|
|
930
789
|
return {
|
|
931
790
|
attachmentLinkUrl: __expectString(output.attachmentLinkUrl),
|
|
932
791
|
buttons: output.buttons != null ? deserializeAws_restJson1listOfButtons(output.buttons, context) : undefined,
|
|
@@ -935,10 +794,10 @@ var deserializeAws_restJson1GenericAttachment = function (output, context) {
|
|
|
935
794
|
title: __expectString(output.title),
|
|
936
795
|
};
|
|
937
796
|
};
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
.filter(
|
|
941
|
-
.map(
|
|
797
|
+
const deserializeAws_restJson1genericAttachmentList = (output, context) => {
|
|
798
|
+
const retVal = (output || [])
|
|
799
|
+
.filter((e) => e != null)
|
|
800
|
+
.map((entry) => {
|
|
942
801
|
if (entry === null) {
|
|
943
802
|
return null;
|
|
944
803
|
}
|
|
@@ -946,15 +805,15 @@ var deserializeAws_restJson1genericAttachmentList = function (output, context) {
|
|
|
946
805
|
});
|
|
947
806
|
return retVal;
|
|
948
807
|
};
|
|
949
|
-
|
|
808
|
+
const deserializeAws_restJson1IntentConfidence = (output, context) => {
|
|
950
809
|
return {
|
|
951
810
|
score: __limitedParseDouble(output.score),
|
|
952
811
|
};
|
|
953
812
|
};
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
.filter(
|
|
957
|
-
.map(
|
|
813
|
+
const deserializeAws_restJson1IntentList = (output, context) => {
|
|
814
|
+
const retVal = (output || [])
|
|
815
|
+
.filter((e) => e != null)
|
|
816
|
+
.map((entry) => {
|
|
958
817
|
if (entry === null) {
|
|
959
818
|
return null;
|
|
960
819
|
}
|
|
@@ -962,7 +821,7 @@ var deserializeAws_restJson1IntentList = function (output, context) {
|
|
|
962
821
|
});
|
|
963
822
|
return retVal;
|
|
964
823
|
};
|
|
965
|
-
|
|
824
|
+
const deserializeAws_restJson1IntentSummary = (output, context) => {
|
|
966
825
|
return {
|
|
967
826
|
checkpointLabel: __expectString(output.checkpointLabel),
|
|
968
827
|
confirmationStatus: __expectString(output.confirmationStatus),
|
|
@@ -973,10 +832,10 @@ var deserializeAws_restJson1IntentSummary = function (output, context) {
|
|
|
973
832
|
slots: output.slots != null ? deserializeAws_restJson1StringMap(output.slots, context) : undefined,
|
|
974
833
|
};
|
|
975
834
|
};
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
.filter(
|
|
979
|
-
.map(
|
|
835
|
+
const deserializeAws_restJson1IntentSummaryList = (output, context) => {
|
|
836
|
+
const retVal = (output || [])
|
|
837
|
+
.filter((e) => e != null)
|
|
838
|
+
.map((entry) => {
|
|
980
839
|
if (entry === null) {
|
|
981
840
|
return null;
|
|
982
841
|
}
|
|
@@ -984,10 +843,10 @@ var deserializeAws_restJson1IntentSummaryList = function (output, context) {
|
|
|
984
843
|
});
|
|
985
844
|
return retVal;
|
|
986
845
|
};
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
.filter(
|
|
990
|
-
.map(
|
|
846
|
+
const deserializeAws_restJson1listOfButtons = (output, context) => {
|
|
847
|
+
const retVal = (output || [])
|
|
848
|
+
.filter((e) => e != null)
|
|
849
|
+
.map((entry) => {
|
|
991
850
|
if (entry === null) {
|
|
992
851
|
return null;
|
|
993
852
|
}
|
|
@@ -995,7 +854,7 @@ var deserializeAws_restJson1listOfButtons = function (output, context) {
|
|
|
995
854
|
});
|
|
996
855
|
return retVal;
|
|
997
856
|
};
|
|
998
|
-
|
|
857
|
+
const deserializeAws_restJson1PredictedIntent = (output, context) => {
|
|
999
858
|
return {
|
|
1000
859
|
intentName: __expectString(output.intentName),
|
|
1001
860
|
nluIntentConfidence: output.nluIntentConfidence != null
|
|
@@ -1004,7 +863,7 @@ var deserializeAws_restJson1PredictedIntent = function (output, context) {
|
|
|
1004
863
|
slots: output.slots != null ? deserializeAws_restJson1StringMap(output.slots, context) : undefined,
|
|
1005
864
|
};
|
|
1006
865
|
};
|
|
1007
|
-
|
|
866
|
+
const deserializeAws_restJson1ResponseCard = (output, context) => {
|
|
1008
867
|
return {
|
|
1009
868
|
contentType: __expectString(output.contentType),
|
|
1010
869
|
genericAttachments: output.genericAttachments != null
|
|
@@ -1013,73 +872,56 @@ var deserializeAws_restJson1ResponseCard = function (output, context) {
|
|
|
1013
872
|
version: __expectString(output.version),
|
|
1014
873
|
};
|
|
1015
874
|
};
|
|
1016
|
-
|
|
875
|
+
const deserializeAws_restJson1SentimentResponse = (output, context) => {
|
|
1017
876
|
return {
|
|
1018
877
|
sentimentLabel: __expectString(output.sentimentLabel),
|
|
1019
878
|
sentimentScore: __expectString(output.sentimentScore),
|
|
1020
879
|
};
|
|
1021
880
|
};
|
|
1022
|
-
|
|
1023
|
-
return Object.entries(output).reduce(
|
|
1024
|
-
var _b;
|
|
1025
|
-
var _c = __read(_a, 2), key = _c[0], value = _c[1];
|
|
881
|
+
const deserializeAws_restJson1StringMap = (output, context) => {
|
|
882
|
+
return Object.entries(output).reduce((acc, [key, value]) => {
|
|
1026
883
|
if (value === null) {
|
|
1027
884
|
return acc;
|
|
1028
885
|
}
|
|
1029
|
-
return
|
|
886
|
+
return {
|
|
887
|
+
...acc,
|
|
888
|
+
[key]: __expectString(value),
|
|
889
|
+
};
|
|
1030
890
|
}, {});
|
|
1031
891
|
};
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
});
|
|
1040
|
-
};
|
|
1041
|
-
var collectBody = function (streamBody, context) {
|
|
1042
|
-
if (streamBody === void 0) { streamBody = new Uint8Array(); }
|
|
892
|
+
const deserializeMetadata = (output) => ({
|
|
893
|
+
httpStatusCode: output.statusCode,
|
|
894
|
+
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
|
|
895
|
+
extendedRequestId: output.headers["x-amz-id-2"],
|
|
896
|
+
cfId: output.headers["x-amz-cf-id"],
|
|
897
|
+
});
|
|
898
|
+
const collectBody = (streamBody = new Uint8Array(), context) => {
|
|
1043
899
|
if (streamBody instanceof Uint8Array) {
|
|
1044
900
|
return Promise.resolve(streamBody);
|
|
1045
901
|
}
|
|
1046
902
|
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
|
|
1047
903
|
};
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
});
|
|
904
|
+
const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
|
|
905
|
+
const isSerializableHeaderValue = (value) => value !== undefined &&
|
|
906
|
+
value !== null &&
|
|
907
|
+
value !== "" &&
|
|
908
|
+
(!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
|
|
909
|
+
(!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
|
|
910
|
+
const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
911
|
+
if (encoded.length) {
|
|
912
|
+
return JSON.parse(encoded);
|
|
913
|
+
}
|
|
914
|
+
return {};
|
|
915
|
+
});
|
|
916
|
+
const parseErrorBody = async (errorBody, context) => {
|
|
917
|
+
const value = await parseBody(errorBody, context);
|
|
918
|
+
value.message = value.message ?? value.Message;
|
|
919
|
+
return value;
|
|
1065
920
|
};
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
switch (_b.label) {
|
|
1071
|
-
case 0: return [4, parseBody(errorBody, context)];
|
|
1072
|
-
case 1:
|
|
1073
|
-
value = _b.sent();
|
|
1074
|
-
value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
|
|
1075
|
-
return [2, value];
|
|
1076
|
-
}
|
|
1077
|
-
});
|
|
1078
|
-
}); };
|
|
1079
|
-
var loadRestJsonErrorCode = function (output, data) {
|
|
1080
|
-
var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
|
|
1081
|
-
var sanitizeErrorCode = function (rawValue) {
|
|
1082
|
-
var cleanValue = rawValue;
|
|
921
|
+
const loadRestJsonErrorCode = (output, data) => {
|
|
922
|
+
const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
923
|
+
const sanitizeErrorCode = (rawValue) => {
|
|
924
|
+
let cleanValue = rawValue;
|
|
1083
925
|
if (typeof cleanValue === "number") {
|
|
1084
926
|
cleanValue = cleanValue.toString();
|
|
1085
927
|
}
|
|
@@ -1094,7 +936,7 @@ var loadRestJsonErrorCode = function (output, data) {
|
|
|
1094
936
|
}
|
|
1095
937
|
return cleanValue;
|
|
1096
938
|
};
|
|
1097
|
-
|
|
939
|
+
const headerKey = findKey(output.headers, "x-amzn-errortype");
|
|
1098
940
|
if (headerKey !== undefined) {
|
|
1099
941
|
return sanitizeErrorCode(output.headers[headerKey]);
|
|
1100
942
|
}
|