@aws-sdk/client-polly 3.185.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist-cjs/protocols/Aws_restJson1.js +1 -0
  3. package/dist-cjs/runtimeConfig.browser.js +9 -7
  4. package/dist-cjs/runtimeConfig.js +9 -7
  5. package/dist-es/Polly.js +38 -45
  6. package/dist-es/PollyClient.js +22 -28
  7. package/dist-es/commands/DeleteLexiconCommand.js +21 -28
  8. package/dist-es/commands/DescribeVoicesCommand.js +21 -28
  9. package/dist-es/commands/GetLexiconCommand.js +21 -28
  10. package/dist-es/commands/GetSpeechSynthesisTaskCommand.js +21 -28
  11. package/dist-es/commands/ListLexiconsCommand.js +21 -28
  12. package/dist-es/commands/ListSpeechSynthesisTasksCommand.js +21 -28
  13. package/dist-es/commands/PutLexiconCommand.js +21 -28
  14. package/dist-es/commands/StartSpeechSynthesisTaskCommand.js +21 -28
  15. package/dist-es/commands/SynthesizeSpeechCommand.js +21 -28
  16. package/dist-es/endpoints.js +8 -8
  17. package/dist-es/models/PollyServiceException.js +5 -10
  18. package/dist-es/models/models_0.js +303 -255
  19. package/dist-es/pagination/ListSpeechSynthesisTasksPaginator.js +25 -68
  20. package/dist-es/protocols/Aws_restJson1.js +879 -1154
  21. package/dist-es/runtimeConfig.browser.js +28 -12
  22. package/dist-es/runtimeConfig.js +32 -12
  23. package/dist-es/runtimeConfig.native.js +8 -5
  24. package/dist-es/runtimeConfig.shared.js +8 -11
  25. package/dist-types/PollyClient.d.ts +6 -1
  26. package/dist-types/commands/SynthesizeSpeechCommand.d.ts +2 -2
  27. package/dist-types/protocols/Aws_restJson1.d.ts +2 -2
  28. package/dist-types/runtimeConfig.browser.d.ts +1 -0
  29. package/dist-types/runtimeConfig.d.ts +1 -0
  30. package/dist-types/runtimeConfig.native.d.ts +1 -0
  31. package/dist-types/ts3.4/PollyClient.d.ts +2 -0
  32. package/dist-types/ts3.4/commands/SynthesizeSpeechCommand.d.ts +2 -1
  33. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +5 -2
  34. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -0
  35. package/dist-types/ts3.4/runtimeConfig.d.ts +1 -0
  36. package/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -0
  37. package/package.json +35 -33
@@ -1,1139 +1,882 @@
1
- import { __assign, __awaiter, __generator } 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, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, map as __map, parseEpochTimestamp as __parseEpochTimestamp, resolvedPath as __resolvedPath, strictParseInt32 as __strictParseInt32, throwDefaultError, } from "@aws-sdk/smithy-client";
4
3
  import { EngineNotSupportedException, InvalidLexiconException, InvalidNextTokenException, InvalidS3BucketException, InvalidS3KeyException, InvalidSampleRateException, InvalidSnsTopicArnException, InvalidSsmlException, InvalidTaskIdException, LanguageNotSupportedException, LexiconNotFoundException, LexiconSizeExceededException, MarksNotSupportedForFormatException, MaxLexemeLengthExceededException, MaxLexiconsNumberExceededException, ServiceFailureException, SsmlMarksNotSupportedForTextTypeException, SynthesisTaskNotFoundException, TextLengthExceededException, UnsupportedPlsAlphabetException, UnsupportedPlsLanguageException, } from "../models/models_0";
5
4
  import { PollyServiceException as __BaseException } from "../models/PollyServiceException";
6
- export var serializeAws_restJson1DeleteLexiconCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
7
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
8
- return __generator(this, function (_c) {
9
- switch (_c.label) {
10
- case 0: return [4, context.endpoint()];
11
- case 1:
12
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
13
- headers = {};
14
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/v1/lexicons/{Name}";
15
- resolvedPath = __resolvedPath(resolvedPath, input, "Name", function () { return input.Name; }, "{Name}", false);
16
- return [2, new __HttpRequest({
17
- protocol: protocol,
18
- hostname: hostname,
19
- port: port,
20
- method: "DELETE",
21
- headers: headers,
22
- path: resolvedPath,
23
- body: body,
24
- })];
25
- }
26
- });
27
- }); };
28
- export var serializeAws_restJson1DescribeVoicesCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
29
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
30
- return __generator(this, function (_c) {
31
- switch (_c.label) {
32
- case 0: return [4, context.endpoint()];
33
- case 1:
34
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
35
- headers = {};
36
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/v1/voices";
37
- query = map({
38
- Engine: [, input.Engine],
39
- LanguageCode: [, input.LanguageCode],
40
- IncludeAdditionalLanguageCodes: [
41
- function () { return input.IncludeAdditionalLanguageCodes !== void 0; },
42
- function () { return input.IncludeAdditionalLanguageCodes.toString(); },
43
- ],
44
- NextToken: [, input.NextToken],
45
- });
46
- return [2, new __HttpRequest({
47
- protocol: protocol,
48
- hostname: hostname,
49
- port: port,
50
- method: "GET",
51
- headers: headers,
52
- path: resolvedPath,
53
- query: query,
54
- body: body,
55
- })];
56
- }
5
+ export const serializeAws_restJson1DeleteLexiconCommand = 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 || ""}` + "/v1/lexicons/{Name}";
9
+ resolvedPath = __resolvedPath(resolvedPath, input, "Name", () => input.Name, "{Name}", false);
10
+ let body;
11
+ return new __HttpRequest({
12
+ protocol,
13
+ hostname,
14
+ port,
15
+ method: "DELETE",
16
+ headers,
17
+ path: resolvedPath,
18
+ body,
57
19
  });
58
- }); };
59
- export var serializeAws_restJson1GetLexiconCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
60
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
61
- return __generator(this, function (_c) {
62
- switch (_c.label) {
63
- case 0: return [4, context.endpoint()];
64
- case 1:
65
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
66
- headers = {};
67
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/v1/lexicons/{Name}";
68
- resolvedPath = __resolvedPath(resolvedPath, input, "Name", function () { return input.Name; }, "{Name}", false);
69
- return [2, new __HttpRequest({
70
- protocol: protocol,
71
- hostname: hostname,
72
- port: port,
73
- method: "GET",
74
- headers: headers,
75
- path: resolvedPath,
76
- body: body,
77
- })];
78
- }
79
- });
80
- }); };
81
- export var serializeAws_restJson1GetSpeechSynthesisTaskCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
82
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
83
- return __generator(this, function (_c) {
84
- switch (_c.label) {
85
- case 0: return [4, context.endpoint()];
86
- case 1:
87
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
88
- headers = {};
89
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/v1/synthesisTasks/{TaskId}";
90
- resolvedPath = __resolvedPath(resolvedPath, input, "TaskId", function () { return input.TaskId; }, "{TaskId}", false);
91
- return [2, new __HttpRequest({
92
- protocol: protocol,
93
- hostname: hostname,
94
- port: port,
95
- method: "GET",
96
- headers: headers,
97
- path: resolvedPath,
98
- body: body,
99
- })];
100
- }
20
+ };
21
+ export const serializeAws_restJson1DescribeVoicesCommand = async (input, context) => {
22
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
23
+ const headers = {};
24
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/voices";
25
+ const query = map({
26
+ Engine: [, input.Engine],
27
+ LanguageCode: [, input.LanguageCode],
28
+ IncludeAdditionalLanguageCodes: [
29
+ () => input.IncludeAdditionalLanguageCodes !== void 0,
30
+ () => input.IncludeAdditionalLanguageCodes.toString(),
31
+ ],
32
+ NextToken: [, input.NextToken],
101
33
  });
102
- }); };
103
- export var serializeAws_restJson1ListLexiconsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
104
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
105
- return __generator(this, function (_c) {
106
- switch (_c.label) {
107
- case 0: return [4, context.endpoint()];
108
- case 1:
109
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
110
- headers = {};
111
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/v1/lexicons";
112
- query = map({
113
- NextToken: [, input.NextToken],
114
- });
115
- return [2, new __HttpRequest({
116
- protocol: protocol,
117
- hostname: hostname,
118
- port: port,
119
- method: "GET",
120
- headers: headers,
121
- path: resolvedPath,
122
- query: query,
123
- body: body,
124
- })];
125
- }
34
+ let body;
35
+ return new __HttpRequest({
36
+ protocol,
37
+ hostname,
38
+ port,
39
+ method: "GET",
40
+ headers,
41
+ path: resolvedPath,
42
+ query,
43
+ body,
126
44
  });
127
- }); };
128
- export var serializeAws_restJson1ListSpeechSynthesisTasksCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
129
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
130
- return __generator(this, function (_c) {
131
- switch (_c.label) {
132
- case 0: return [4, context.endpoint()];
133
- case 1:
134
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
135
- headers = {};
136
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/v1/synthesisTasks";
137
- query = map({
138
- MaxResults: [function () { return input.MaxResults !== void 0; }, function () { return input.MaxResults.toString(); }],
139
- NextToken: [, input.NextToken],
140
- Status: [, input.Status],
141
- });
142
- return [2, new __HttpRequest({
143
- protocol: protocol,
144
- hostname: hostname,
145
- port: port,
146
- method: "GET",
147
- headers: headers,
148
- path: resolvedPath,
149
- query: query,
150
- body: body,
151
- })];
152
- }
153
- });
154
- }); };
155
- export var serializeAws_restJson1PutLexiconCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
156
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
157
- return __generator(this, function (_c) {
158
- switch (_c.label) {
159
- case 0: return [4, context.endpoint()];
160
- case 1:
161
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
162
- headers = {
163
- "content-type": "application/json",
164
- };
165
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/v1/lexicons/{Name}";
166
- resolvedPath = __resolvedPath(resolvedPath, input, "Name", function () { return input.Name; }, "{Name}", false);
167
- body = JSON.stringify(__assign({}, (input.Content != null && { Content: input.Content })));
168
- return [2, new __HttpRequest({
169
- protocol: protocol,
170
- hostname: hostname,
171
- port: port,
172
- method: "PUT",
173
- headers: headers,
174
- path: resolvedPath,
175
- body: body,
176
- })];
177
- }
45
+ };
46
+ export const serializeAws_restJson1GetLexiconCommand = async (input, context) => {
47
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
48
+ const headers = {};
49
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/lexicons/{Name}";
50
+ resolvedPath = __resolvedPath(resolvedPath, input, "Name", () => input.Name, "{Name}", false);
51
+ let body;
52
+ return new __HttpRequest({
53
+ protocol,
54
+ hostname,
55
+ port,
56
+ method: "GET",
57
+ headers,
58
+ path: resolvedPath,
59
+ body,
178
60
  });
179
- }); };
180
- export var serializeAws_restJson1StartSpeechSynthesisTaskCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
181
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
182
- return __generator(this, function (_c) {
183
- switch (_c.label) {
184
- case 0: return [4, context.endpoint()];
185
- case 1:
186
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
187
- headers = {
188
- "content-type": "application/json",
189
- };
190
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/v1/synthesisTasks";
191
- body = JSON.stringify(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, (input.Engine != null && { Engine: input.Engine })), (input.LanguageCode != null && { LanguageCode: input.LanguageCode })), (input.LexiconNames != null && {
192
- LexiconNames: serializeAws_restJson1LexiconNameList(input.LexiconNames, context),
193
- })), (input.OutputFormat != null && { OutputFormat: input.OutputFormat })), (input.OutputS3BucketName != null && { OutputS3BucketName: input.OutputS3BucketName })), (input.OutputS3KeyPrefix != null && { OutputS3KeyPrefix: input.OutputS3KeyPrefix })), (input.SampleRate != null && { SampleRate: input.SampleRate })), (input.SnsTopicArn != null && { SnsTopicArn: input.SnsTopicArn })), (input.SpeechMarkTypes != null && {
194
- SpeechMarkTypes: serializeAws_restJson1SpeechMarkTypeList(input.SpeechMarkTypes, context),
195
- })), (input.Text != null && { Text: input.Text })), (input.TextType != null && { TextType: input.TextType })), (input.VoiceId != null && { VoiceId: input.VoiceId })));
196
- return [2, new __HttpRequest({
197
- protocol: protocol,
198
- hostname: hostname,
199
- port: port,
200
- method: "POST",
201
- headers: headers,
202
- path: resolvedPath,
203
- body: body,
204
- })];
205
- }
61
+ };
62
+ export const serializeAws_restJson1GetSpeechSynthesisTaskCommand = async (input, context) => {
63
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
64
+ const headers = {};
65
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/synthesisTasks/{TaskId}";
66
+ resolvedPath = __resolvedPath(resolvedPath, input, "TaskId", () => input.TaskId, "{TaskId}", false);
67
+ let body;
68
+ return new __HttpRequest({
69
+ protocol,
70
+ hostname,
71
+ port,
72
+ method: "GET",
73
+ headers,
74
+ path: resolvedPath,
75
+ body,
206
76
  });
207
- }); };
208
- export var serializeAws_restJson1SynthesizeSpeechCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
209
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
210
- return __generator(this, function (_c) {
211
- switch (_c.label) {
212
- case 0: return [4, context.endpoint()];
213
- case 1:
214
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
215
- headers = {
216
- "content-type": "application/json",
217
- };
218
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/v1/speech";
219
- body = JSON.stringify(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, (input.Engine != null && { Engine: input.Engine })), (input.LanguageCode != null && { LanguageCode: input.LanguageCode })), (input.LexiconNames != null && {
220
- LexiconNames: serializeAws_restJson1LexiconNameList(input.LexiconNames, context),
221
- })), (input.OutputFormat != null && { OutputFormat: input.OutputFormat })), (input.SampleRate != null && { SampleRate: input.SampleRate })), (input.SpeechMarkTypes != null && {
222
- SpeechMarkTypes: serializeAws_restJson1SpeechMarkTypeList(input.SpeechMarkTypes, context),
223
- })), (input.Text != null && { Text: input.Text })), (input.TextType != null && { TextType: input.TextType })), (input.VoiceId != null && { VoiceId: input.VoiceId })));
224
- return [2, new __HttpRequest({
225
- protocol: protocol,
226
- hostname: hostname,
227
- port: port,
228
- method: "POST",
229
- headers: headers,
230
- path: resolvedPath,
231
- body: body,
232
- })];
233
- }
77
+ };
78
+ export const serializeAws_restJson1ListLexiconsCommand = async (input, context) => {
79
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
80
+ const headers = {};
81
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/lexicons";
82
+ const query = map({
83
+ NextToken: [, input.NextToken],
234
84
  });
235
- }); };
236
- export var deserializeAws_restJson1DeleteLexiconCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
237
- var contents;
238
- return __generator(this, function (_a) {
239
- switch (_a.label) {
240
- case 0:
241
- if (output.statusCode !== 200 && output.statusCode >= 300) {
242
- return [2, deserializeAws_restJson1DeleteLexiconCommandError(output, context)];
243
- }
244
- contents = map({
245
- $metadata: deserializeMetadata(output),
246
- });
247
- return [4, collectBody(output.body, context)];
248
- case 1:
249
- _a.sent();
250
- return [2, contents];
251
- }
85
+ let body;
86
+ return new __HttpRequest({
87
+ protocol,
88
+ hostname,
89
+ port,
90
+ method: "GET",
91
+ headers,
92
+ path: resolvedPath,
93
+ query,
94
+ body,
252
95
  });
253
- }); };
254
- var deserializeAws_restJson1DeleteLexiconCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
255
- var parsedOutput, _a, errorCode, _b, parsedBody;
256
- var _c;
257
- return __generator(this, function (_d) {
258
- switch (_d.label) {
259
- case 0:
260
- _a = [__assign({}, output)];
261
- _c = {};
262
- return [4, parseErrorBody(output.body, context)];
263
- case 1:
264
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
265
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
266
- _b = errorCode;
267
- switch (_b) {
268
- case "LexiconNotFoundException": return [3, 2];
269
- case "com.amazonaws.polly#LexiconNotFoundException": return [3, 2];
270
- case "ServiceFailureException": return [3, 4];
271
- case "com.amazonaws.polly#ServiceFailureException": return [3, 4];
272
- }
273
- return [3, 6];
274
- case 2: return [4, deserializeAws_restJson1LexiconNotFoundExceptionResponse(parsedOutput, context)];
275
- case 3: throw _d.sent();
276
- case 4: return [4, deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context)];
277
- case 5: throw _d.sent();
278
- case 6:
279
- parsedBody = parsedOutput.body;
280
- throwDefaultError({
281
- output: output,
282
- parsedBody: parsedBody,
283
- exceptionCtor: __BaseException,
284
- errorCode: errorCode,
285
- });
286
- _d.label = 7;
287
- case 7: return [2];
288
- }
96
+ };
97
+ export const serializeAws_restJson1ListSpeechSynthesisTasksCommand = async (input, context) => {
98
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
99
+ const headers = {};
100
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/synthesisTasks";
101
+ const query = map({
102
+ MaxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
103
+ NextToken: [, input.NextToken],
104
+ Status: [, input.Status],
289
105
  });
290
- }); };
291
- export var deserializeAws_restJson1DescribeVoicesCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
292
- var contents, data, _a, _b;
293
- return __generator(this, function (_c) {
294
- switch (_c.label) {
295
- case 0:
296
- if (output.statusCode !== 200 && output.statusCode >= 300) {
297
- return [2, deserializeAws_restJson1DescribeVoicesCommandError(output, context)];
298
- }
299
- contents = map({
300
- $metadata: deserializeMetadata(output),
301
- });
302
- _a = __expectNonNull;
303
- _b = __expectObject;
304
- return [4, parseBody(output.body, context)];
305
- case 1:
306
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
307
- if (data.NextToken != null) {
308
- contents.NextToken = __expectString(data.NextToken);
309
- }
310
- if (data.Voices != null) {
311
- contents.Voices = deserializeAws_restJson1VoiceList(data.Voices, context);
312
- }
313
- return [2, contents];
314
- }
106
+ let body;
107
+ return new __HttpRequest({
108
+ protocol,
109
+ hostname,
110
+ port,
111
+ method: "GET",
112
+ headers,
113
+ path: resolvedPath,
114
+ query,
115
+ body,
315
116
  });
316
- }); };
317
- var deserializeAws_restJson1DescribeVoicesCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
318
- var parsedOutput, _a, errorCode, _b, parsedBody;
319
- var _c;
320
- return __generator(this, function (_d) {
321
- switch (_d.label) {
322
- case 0:
323
- _a = [__assign({}, output)];
324
- _c = {};
325
- return [4, parseErrorBody(output.body, context)];
326
- case 1:
327
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
328
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
329
- _b = errorCode;
330
- switch (_b) {
331
- case "InvalidNextTokenException": return [3, 2];
332
- case "com.amazonaws.polly#InvalidNextTokenException": return [3, 2];
333
- case "ServiceFailureException": return [3, 4];
334
- case "com.amazonaws.polly#ServiceFailureException": return [3, 4];
335
- }
336
- return [3, 6];
337
- case 2: return [4, deserializeAws_restJson1InvalidNextTokenExceptionResponse(parsedOutput, context)];
338
- case 3: throw _d.sent();
339
- case 4: return [4, deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context)];
340
- case 5: throw _d.sent();
341
- case 6:
342
- parsedBody = parsedOutput.body;
343
- throwDefaultError({
344
- output: output,
345
- parsedBody: parsedBody,
346
- exceptionCtor: __BaseException,
347
- errorCode: errorCode,
348
- });
349
- _d.label = 7;
350
- case 7: return [2];
351
- }
117
+ };
118
+ export const serializeAws_restJson1PutLexiconCommand = async (input, context) => {
119
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
120
+ const headers = {
121
+ "content-type": "application/json",
122
+ };
123
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/lexicons/{Name}";
124
+ resolvedPath = __resolvedPath(resolvedPath, input, "Name", () => input.Name, "{Name}", false);
125
+ let body;
126
+ body = JSON.stringify({
127
+ ...(input.Content != null && { Content: input.Content }),
352
128
  });
353
- }); };
354
- export var deserializeAws_restJson1GetLexiconCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
355
- var contents, data, _a, _b;
356
- return __generator(this, function (_c) {
357
- switch (_c.label) {
358
- case 0:
359
- if (output.statusCode !== 200 && output.statusCode >= 300) {
360
- return [2, deserializeAws_restJson1GetLexiconCommandError(output, context)];
361
- }
362
- contents = map({
363
- $metadata: deserializeMetadata(output),
364
- });
365
- _a = __expectNonNull;
366
- _b = __expectObject;
367
- return [4, parseBody(output.body, context)];
368
- case 1:
369
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
370
- if (data.Lexicon != null) {
371
- contents.Lexicon = deserializeAws_restJson1Lexicon(data.Lexicon, context);
372
- }
373
- if (data.LexiconAttributes != null) {
374
- contents.LexiconAttributes = deserializeAws_restJson1LexiconAttributes(data.LexiconAttributes, context);
375
- }
376
- return [2, contents];
377
- }
129
+ return new __HttpRequest({
130
+ protocol,
131
+ hostname,
132
+ port,
133
+ method: "PUT",
134
+ headers,
135
+ path: resolvedPath,
136
+ body,
378
137
  });
379
- }); };
380
- var deserializeAws_restJson1GetLexiconCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
381
- var parsedOutput, _a, errorCode, _b, parsedBody;
382
- var _c;
383
- return __generator(this, function (_d) {
384
- switch (_d.label) {
385
- case 0:
386
- _a = [__assign({}, output)];
387
- _c = {};
388
- return [4, parseErrorBody(output.body, context)];
389
- case 1:
390
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
391
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
392
- _b = errorCode;
393
- switch (_b) {
394
- case "LexiconNotFoundException": return [3, 2];
395
- case "com.amazonaws.polly#LexiconNotFoundException": return [3, 2];
396
- case "ServiceFailureException": return [3, 4];
397
- case "com.amazonaws.polly#ServiceFailureException": return [3, 4];
398
- }
399
- return [3, 6];
400
- case 2: return [4, deserializeAws_restJson1LexiconNotFoundExceptionResponse(parsedOutput, context)];
401
- case 3: throw _d.sent();
402
- case 4: return [4, deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context)];
403
- case 5: throw _d.sent();
404
- case 6:
405
- parsedBody = parsedOutput.body;
406
- throwDefaultError({
407
- output: output,
408
- parsedBody: parsedBody,
409
- exceptionCtor: __BaseException,
410
- errorCode: errorCode,
411
- });
412
- _d.label = 7;
413
- case 7: return [2];
414
- }
138
+ };
139
+ export const serializeAws_restJson1StartSpeechSynthesisTaskCommand = async (input, context) => {
140
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
141
+ const headers = {
142
+ "content-type": "application/json",
143
+ };
144
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/synthesisTasks";
145
+ let body;
146
+ body = JSON.stringify({
147
+ ...(input.Engine != null && { Engine: input.Engine }),
148
+ ...(input.LanguageCode != null && { LanguageCode: input.LanguageCode }),
149
+ ...(input.LexiconNames != null && {
150
+ LexiconNames: serializeAws_restJson1LexiconNameList(input.LexiconNames, context),
151
+ }),
152
+ ...(input.OutputFormat != null && { OutputFormat: input.OutputFormat }),
153
+ ...(input.OutputS3BucketName != null && { OutputS3BucketName: input.OutputS3BucketName }),
154
+ ...(input.OutputS3KeyPrefix != null && { OutputS3KeyPrefix: input.OutputS3KeyPrefix }),
155
+ ...(input.SampleRate != null && { SampleRate: input.SampleRate }),
156
+ ...(input.SnsTopicArn != null && { SnsTopicArn: input.SnsTopicArn }),
157
+ ...(input.SpeechMarkTypes != null && {
158
+ SpeechMarkTypes: serializeAws_restJson1SpeechMarkTypeList(input.SpeechMarkTypes, context),
159
+ }),
160
+ ...(input.Text != null && { Text: input.Text }),
161
+ ...(input.TextType != null && { TextType: input.TextType }),
162
+ ...(input.VoiceId != null && { VoiceId: input.VoiceId }),
415
163
  });
416
- }); };
417
- export var deserializeAws_restJson1GetSpeechSynthesisTaskCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
418
- var contents, data, _a, _b;
419
- return __generator(this, function (_c) {
420
- switch (_c.label) {
421
- case 0:
422
- if (output.statusCode !== 200 && output.statusCode >= 300) {
423
- return [2, deserializeAws_restJson1GetSpeechSynthesisTaskCommandError(output, context)];
424
- }
425
- contents = map({
426
- $metadata: deserializeMetadata(output),
427
- });
428
- _a = __expectNonNull;
429
- _b = __expectObject;
430
- return [4, parseBody(output.body, context)];
431
- case 1:
432
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
433
- if (data.SynthesisTask != null) {
434
- contents.SynthesisTask = deserializeAws_restJson1SynthesisTask(data.SynthesisTask, context);
435
- }
436
- return [2, contents];
437
- }
164
+ return new __HttpRequest({
165
+ protocol,
166
+ hostname,
167
+ port,
168
+ method: "POST",
169
+ headers,
170
+ path: resolvedPath,
171
+ body,
438
172
  });
439
- }); };
440
- var deserializeAws_restJson1GetSpeechSynthesisTaskCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
441
- var parsedOutput, _a, errorCode, _b, parsedBody;
442
- var _c;
443
- return __generator(this, function (_d) {
444
- switch (_d.label) {
445
- case 0:
446
- _a = [__assign({}, output)];
447
- _c = {};
448
- return [4, parseErrorBody(output.body, context)];
449
- case 1:
450
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
451
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
452
- _b = errorCode;
453
- switch (_b) {
454
- case "InvalidTaskIdException": return [3, 2];
455
- case "com.amazonaws.polly#InvalidTaskIdException": return [3, 2];
456
- case "ServiceFailureException": return [3, 4];
457
- case "com.amazonaws.polly#ServiceFailureException": return [3, 4];
458
- case "SynthesisTaskNotFoundException": return [3, 6];
459
- case "com.amazonaws.polly#SynthesisTaskNotFoundException": return [3, 6];
460
- }
461
- return [3, 8];
462
- case 2: return [4, deserializeAws_restJson1InvalidTaskIdExceptionResponse(parsedOutput, context)];
463
- case 3: throw _d.sent();
464
- case 4: return [4, deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context)];
465
- case 5: throw _d.sent();
466
- case 6: return [4, deserializeAws_restJson1SynthesisTaskNotFoundExceptionResponse(parsedOutput, context)];
467
- case 7: throw _d.sent();
468
- case 8:
469
- parsedBody = parsedOutput.body;
470
- throwDefaultError({
471
- output: output,
472
- parsedBody: parsedBody,
473
- exceptionCtor: __BaseException,
474
- errorCode: errorCode,
475
- });
476
- _d.label = 9;
477
- case 9: return [2];
478
- }
173
+ };
174
+ export const serializeAws_restJson1SynthesizeSpeechCommand = async (input, context) => {
175
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
176
+ const headers = {
177
+ "content-type": "application/json",
178
+ };
179
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/speech";
180
+ let body;
181
+ body = JSON.stringify({
182
+ ...(input.Engine != null && { Engine: input.Engine }),
183
+ ...(input.LanguageCode != null && { LanguageCode: input.LanguageCode }),
184
+ ...(input.LexiconNames != null && {
185
+ LexiconNames: serializeAws_restJson1LexiconNameList(input.LexiconNames, context),
186
+ }),
187
+ ...(input.OutputFormat != null && { OutputFormat: input.OutputFormat }),
188
+ ...(input.SampleRate != null && { SampleRate: input.SampleRate }),
189
+ ...(input.SpeechMarkTypes != null && {
190
+ SpeechMarkTypes: serializeAws_restJson1SpeechMarkTypeList(input.SpeechMarkTypes, context),
191
+ }),
192
+ ...(input.Text != null && { Text: input.Text }),
193
+ ...(input.TextType != null && { TextType: input.TextType }),
194
+ ...(input.VoiceId != null && { VoiceId: input.VoiceId }),
479
195
  });
480
- }); };
481
- export var deserializeAws_restJson1ListLexiconsCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
482
- var contents, data, _a, _b;
483
- return __generator(this, function (_c) {
484
- switch (_c.label) {
485
- case 0:
486
- if (output.statusCode !== 200 && output.statusCode >= 300) {
487
- return [2, deserializeAws_restJson1ListLexiconsCommandError(output, context)];
488
- }
489
- contents = map({
490
- $metadata: deserializeMetadata(output),
491
- });
492
- _a = __expectNonNull;
493
- _b = __expectObject;
494
- return [4, parseBody(output.body, context)];
495
- case 1:
496
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
497
- if (data.Lexicons != null) {
498
- contents.Lexicons = deserializeAws_restJson1LexiconDescriptionList(data.Lexicons, context);
499
- }
500
- if (data.NextToken != null) {
501
- contents.NextToken = __expectString(data.NextToken);
502
- }
503
- return [2, contents];
504
- }
196
+ return new __HttpRequest({
197
+ protocol,
198
+ hostname,
199
+ port,
200
+ method: "POST",
201
+ headers,
202
+ path: resolvedPath,
203
+ body,
505
204
  });
506
- }); };
507
- var deserializeAws_restJson1ListLexiconsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
508
- var parsedOutput, _a, errorCode, _b, parsedBody;
509
- var _c;
510
- return __generator(this, function (_d) {
511
- switch (_d.label) {
512
- case 0:
513
- _a = [__assign({}, output)];
514
- _c = {};
515
- return [4, parseErrorBody(output.body, context)];
516
- case 1:
517
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
518
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
519
- _b = errorCode;
520
- switch (_b) {
521
- case "InvalidNextTokenException": return [3, 2];
522
- case "com.amazonaws.polly#InvalidNextTokenException": return [3, 2];
523
- case "ServiceFailureException": return [3, 4];
524
- case "com.amazonaws.polly#ServiceFailureException": return [3, 4];
525
- }
526
- return [3, 6];
527
- case 2: return [4, deserializeAws_restJson1InvalidNextTokenExceptionResponse(parsedOutput, context)];
528
- case 3: throw _d.sent();
529
- case 4: return [4, deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context)];
530
- case 5: throw _d.sent();
531
- case 6:
532
- parsedBody = parsedOutput.body;
533
- throwDefaultError({
534
- output: output,
535
- parsedBody: parsedBody,
536
- exceptionCtor: __BaseException,
537
- errorCode: errorCode,
538
- });
539
- _d.label = 7;
540
- case 7: return [2];
541
- }
205
+ };
206
+ export const deserializeAws_restJson1DeleteLexiconCommand = async (output, context) => {
207
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
208
+ return deserializeAws_restJson1DeleteLexiconCommandError(output, context);
209
+ }
210
+ const contents = map({
211
+ $metadata: deserializeMetadata(output),
542
212
  });
543
- }); };
544
- export var deserializeAws_restJson1ListSpeechSynthesisTasksCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
545
- var contents, data, _a, _b;
546
- return __generator(this, function (_c) {
547
- switch (_c.label) {
548
- case 0:
549
- if (output.statusCode !== 200 && output.statusCode >= 300) {
550
- return [2, deserializeAws_restJson1ListSpeechSynthesisTasksCommandError(output, context)];
551
- }
552
- contents = map({
553
- $metadata: deserializeMetadata(output),
554
- });
555
- _a = __expectNonNull;
556
- _b = __expectObject;
557
- return [4, parseBody(output.body, context)];
558
- case 1:
559
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
560
- if (data.NextToken != null) {
561
- contents.NextToken = __expectString(data.NextToken);
562
- }
563
- if (data.SynthesisTasks != null) {
564
- contents.SynthesisTasks = deserializeAws_restJson1SynthesisTasks(data.SynthesisTasks, context);
565
- }
566
- return [2, contents];
567
- }
213
+ await collectBody(output.body, context);
214
+ return contents;
215
+ };
216
+ const deserializeAws_restJson1DeleteLexiconCommandError = async (output, context) => {
217
+ const parsedOutput = {
218
+ ...output,
219
+ body: await parseErrorBody(output.body, context),
220
+ };
221
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
222
+ switch (errorCode) {
223
+ case "LexiconNotFoundException":
224
+ case "com.amazonaws.polly#LexiconNotFoundException":
225
+ throw await deserializeAws_restJson1LexiconNotFoundExceptionResponse(parsedOutput, context);
226
+ case "ServiceFailureException":
227
+ case "com.amazonaws.polly#ServiceFailureException":
228
+ throw await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context);
229
+ default:
230
+ const parsedBody = parsedOutput.body;
231
+ throwDefaultError({
232
+ output,
233
+ parsedBody,
234
+ exceptionCtor: __BaseException,
235
+ errorCode,
236
+ });
237
+ }
238
+ };
239
+ export const deserializeAws_restJson1DescribeVoicesCommand = async (output, context) => {
240
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
241
+ return deserializeAws_restJson1DescribeVoicesCommandError(output, context);
242
+ }
243
+ const contents = map({
244
+ $metadata: deserializeMetadata(output),
568
245
  });
569
- }); };
570
- var deserializeAws_restJson1ListSpeechSynthesisTasksCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
571
- var parsedOutput, _a, errorCode, _b, parsedBody;
572
- var _c;
573
- return __generator(this, function (_d) {
574
- switch (_d.label) {
575
- case 0:
576
- _a = [__assign({}, output)];
577
- _c = {};
578
- return [4, parseErrorBody(output.body, context)];
579
- case 1:
580
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
581
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
582
- _b = errorCode;
583
- switch (_b) {
584
- case "InvalidNextTokenException": return [3, 2];
585
- case "com.amazonaws.polly#InvalidNextTokenException": return [3, 2];
586
- case "ServiceFailureException": return [3, 4];
587
- case "com.amazonaws.polly#ServiceFailureException": return [3, 4];
588
- }
589
- return [3, 6];
590
- case 2: return [4, deserializeAws_restJson1InvalidNextTokenExceptionResponse(parsedOutput, context)];
591
- case 3: throw _d.sent();
592
- case 4: return [4, deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context)];
593
- case 5: throw _d.sent();
594
- case 6:
595
- parsedBody = parsedOutput.body;
596
- throwDefaultError({
597
- output: output,
598
- parsedBody: parsedBody,
599
- exceptionCtor: __BaseException,
600
- errorCode: errorCode,
601
- });
602
- _d.label = 7;
603
- case 7: return [2];
604
- }
246
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
247
+ if (data.NextToken != null) {
248
+ contents.NextToken = __expectString(data.NextToken);
249
+ }
250
+ if (data.Voices != null) {
251
+ contents.Voices = deserializeAws_restJson1VoiceList(data.Voices, context);
252
+ }
253
+ return contents;
254
+ };
255
+ const deserializeAws_restJson1DescribeVoicesCommandError = async (output, context) => {
256
+ const parsedOutput = {
257
+ ...output,
258
+ body: await parseErrorBody(output.body, context),
259
+ };
260
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
261
+ switch (errorCode) {
262
+ case "InvalidNextTokenException":
263
+ case "com.amazonaws.polly#InvalidNextTokenException":
264
+ throw await deserializeAws_restJson1InvalidNextTokenExceptionResponse(parsedOutput, context);
265
+ case "ServiceFailureException":
266
+ case "com.amazonaws.polly#ServiceFailureException":
267
+ throw await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context);
268
+ default:
269
+ const parsedBody = parsedOutput.body;
270
+ throwDefaultError({
271
+ output,
272
+ parsedBody,
273
+ exceptionCtor: __BaseException,
274
+ errorCode,
275
+ });
276
+ }
277
+ };
278
+ export const deserializeAws_restJson1GetLexiconCommand = async (output, context) => {
279
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
280
+ return deserializeAws_restJson1GetLexiconCommandError(output, context);
281
+ }
282
+ const contents = map({
283
+ $metadata: deserializeMetadata(output),
605
284
  });
606
- }); };
607
- export var deserializeAws_restJson1PutLexiconCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
608
- var contents;
609
- return __generator(this, function (_a) {
610
- switch (_a.label) {
611
- case 0:
612
- if (output.statusCode !== 200 && output.statusCode >= 300) {
613
- return [2, deserializeAws_restJson1PutLexiconCommandError(output, context)];
614
- }
615
- contents = map({
616
- $metadata: deserializeMetadata(output),
617
- });
618
- return [4, collectBody(output.body, context)];
619
- case 1:
620
- _a.sent();
621
- return [2, contents];
622
- }
285
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
286
+ if (data.Lexicon != null) {
287
+ contents.Lexicon = deserializeAws_restJson1Lexicon(data.Lexicon, context);
288
+ }
289
+ if (data.LexiconAttributes != null) {
290
+ contents.LexiconAttributes = deserializeAws_restJson1LexiconAttributes(data.LexiconAttributes, context);
291
+ }
292
+ return contents;
293
+ };
294
+ const deserializeAws_restJson1GetLexiconCommandError = async (output, context) => {
295
+ const parsedOutput = {
296
+ ...output,
297
+ body: await parseErrorBody(output.body, context),
298
+ };
299
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
300
+ switch (errorCode) {
301
+ case "LexiconNotFoundException":
302
+ case "com.amazonaws.polly#LexiconNotFoundException":
303
+ throw await deserializeAws_restJson1LexiconNotFoundExceptionResponse(parsedOutput, context);
304
+ case "ServiceFailureException":
305
+ case "com.amazonaws.polly#ServiceFailureException":
306
+ throw await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context);
307
+ default:
308
+ const parsedBody = parsedOutput.body;
309
+ throwDefaultError({
310
+ output,
311
+ parsedBody,
312
+ exceptionCtor: __BaseException,
313
+ errorCode,
314
+ });
315
+ }
316
+ };
317
+ export const deserializeAws_restJson1GetSpeechSynthesisTaskCommand = async (output, context) => {
318
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
319
+ return deserializeAws_restJson1GetSpeechSynthesisTaskCommandError(output, context);
320
+ }
321
+ const contents = map({
322
+ $metadata: deserializeMetadata(output),
623
323
  });
624
- }); };
625
- var deserializeAws_restJson1PutLexiconCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
626
- var parsedOutput, _a, errorCode, _b, parsedBody;
627
- var _c;
628
- return __generator(this, function (_d) {
629
- switch (_d.label) {
630
- case 0:
631
- _a = [__assign({}, output)];
632
- _c = {};
633
- return [4, parseErrorBody(output.body, context)];
634
- case 1:
635
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
636
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
637
- _b = errorCode;
638
- switch (_b) {
639
- case "InvalidLexiconException": return [3, 2];
640
- case "com.amazonaws.polly#InvalidLexiconException": return [3, 2];
641
- case "LexiconSizeExceededException": return [3, 4];
642
- case "com.amazonaws.polly#LexiconSizeExceededException": return [3, 4];
643
- case "MaxLexemeLengthExceededException": return [3, 6];
644
- case "com.amazonaws.polly#MaxLexemeLengthExceededException": return [3, 6];
645
- case "MaxLexiconsNumberExceededException": return [3, 8];
646
- case "com.amazonaws.polly#MaxLexiconsNumberExceededException": return [3, 8];
647
- case "ServiceFailureException": return [3, 10];
648
- case "com.amazonaws.polly#ServiceFailureException": return [3, 10];
649
- case "UnsupportedPlsAlphabetException": return [3, 12];
650
- case "com.amazonaws.polly#UnsupportedPlsAlphabetException": return [3, 12];
651
- case "UnsupportedPlsLanguageException": return [3, 14];
652
- case "com.amazonaws.polly#UnsupportedPlsLanguageException": return [3, 14];
653
- }
654
- return [3, 16];
655
- case 2: return [4, deserializeAws_restJson1InvalidLexiconExceptionResponse(parsedOutput, context)];
656
- case 3: throw _d.sent();
657
- case 4: return [4, deserializeAws_restJson1LexiconSizeExceededExceptionResponse(parsedOutput, context)];
658
- case 5: throw _d.sent();
659
- case 6: return [4, deserializeAws_restJson1MaxLexemeLengthExceededExceptionResponse(parsedOutput, context)];
660
- case 7: throw _d.sent();
661
- case 8: return [4, deserializeAws_restJson1MaxLexiconsNumberExceededExceptionResponse(parsedOutput, context)];
662
- case 9: throw _d.sent();
663
- case 10: return [4, deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context)];
664
- case 11: throw _d.sent();
665
- case 12: return [4, deserializeAws_restJson1UnsupportedPlsAlphabetExceptionResponse(parsedOutput, context)];
666
- case 13: throw _d.sent();
667
- case 14: return [4, deserializeAws_restJson1UnsupportedPlsLanguageExceptionResponse(parsedOutput, context)];
668
- case 15: throw _d.sent();
669
- case 16:
670
- parsedBody = parsedOutput.body;
671
- throwDefaultError({
672
- output: output,
673
- parsedBody: parsedBody,
674
- exceptionCtor: __BaseException,
675
- errorCode: errorCode,
676
- });
677
- _d.label = 17;
678
- case 17: return [2];
679
- }
324
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
325
+ if (data.SynthesisTask != null) {
326
+ contents.SynthesisTask = deserializeAws_restJson1SynthesisTask(data.SynthesisTask, context);
327
+ }
328
+ return contents;
329
+ };
330
+ const deserializeAws_restJson1GetSpeechSynthesisTaskCommandError = async (output, context) => {
331
+ const parsedOutput = {
332
+ ...output,
333
+ body: await parseErrorBody(output.body, context),
334
+ };
335
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
336
+ switch (errorCode) {
337
+ case "InvalidTaskIdException":
338
+ case "com.amazonaws.polly#InvalidTaskIdException":
339
+ throw await deserializeAws_restJson1InvalidTaskIdExceptionResponse(parsedOutput, context);
340
+ case "ServiceFailureException":
341
+ case "com.amazonaws.polly#ServiceFailureException":
342
+ throw await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context);
343
+ case "SynthesisTaskNotFoundException":
344
+ case "com.amazonaws.polly#SynthesisTaskNotFoundException":
345
+ throw await deserializeAws_restJson1SynthesisTaskNotFoundExceptionResponse(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_restJson1ListLexiconsCommand = async (output, context) => {
357
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
358
+ return deserializeAws_restJson1ListLexiconsCommandError(output, context);
359
+ }
360
+ const contents = map({
361
+ $metadata: deserializeMetadata(output),
680
362
  });
681
- }); };
682
- export var deserializeAws_restJson1StartSpeechSynthesisTaskCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
683
- var contents, data, _a, _b;
684
- return __generator(this, function (_c) {
685
- switch (_c.label) {
686
- case 0:
687
- if (output.statusCode !== 200 && output.statusCode >= 300) {
688
- return [2, deserializeAws_restJson1StartSpeechSynthesisTaskCommandError(output, context)];
689
- }
690
- contents = map({
691
- $metadata: deserializeMetadata(output),
692
- });
693
- _a = __expectNonNull;
694
- _b = __expectObject;
695
- return [4, parseBody(output.body, context)];
696
- case 1:
697
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
698
- if (data.SynthesisTask != null) {
699
- contents.SynthesisTask = deserializeAws_restJson1SynthesisTask(data.SynthesisTask, context);
700
- }
701
- return [2, contents];
702
- }
363
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
364
+ if (data.Lexicons != null) {
365
+ contents.Lexicons = deserializeAws_restJson1LexiconDescriptionList(data.Lexicons, context);
366
+ }
367
+ if (data.NextToken != null) {
368
+ contents.NextToken = __expectString(data.NextToken);
369
+ }
370
+ return contents;
371
+ };
372
+ const deserializeAws_restJson1ListLexiconsCommandError = async (output, context) => {
373
+ const parsedOutput = {
374
+ ...output,
375
+ body: await parseErrorBody(output.body, context),
376
+ };
377
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
378
+ switch (errorCode) {
379
+ case "InvalidNextTokenException":
380
+ case "com.amazonaws.polly#InvalidNextTokenException":
381
+ throw await deserializeAws_restJson1InvalidNextTokenExceptionResponse(parsedOutput, context);
382
+ case "ServiceFailureException":
383
+ case "com.amazonaws.polly#ServiceFailureException":
384
+ throw await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context);
385
+ default:
386
+ const parsedBody = parsedOutput.body;
387
+ throwDefaultError({
388
+ output,
389
+ parsedBody,
390
+ exceptionCtor: __BaseException,
391
+ errorCode,
392
+ });
393
+ }
394
+ };
395
+ export const deserializeAws_restJson1ListSpeechSynthesisTasksCommand = async (output, context) => {
396
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
397
+ return deserializeAws_restJson1ListSpeechSynthesisTasksCommandError(output, context);
398
+ }
399
+ const contents = map({
400
+ $metadata: deserializeMetadata(output),
703
401
  });
704
- }); };
705
- var deserializeAws_restJson1StartSpeechSynthesisTaskCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
706
- var parsedOutput, _a, errorCode, _b, parsedBody;
707
- var _c;
708
- return __generator(this, function (_d) {
709
- switch (_d.label) {
710
- case 0:
711
- _a = [__assign({}, output)];
712
- _c = {};
713
- return [4, parseErrorBody(output.body, context)];
714
- case 1:
715
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
716
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
717
- _b = errorCode;
718
- switch (_b) {
719
- case "EngineNotSupportedException": return [3, 2];
720
- case "com.amazonaws.polly#EngineNotSupportedException": return [3, 2];
721
- case "InvalidS3BucketException": return [3, 4];
722
- case "com.amazonaws.polly#InvalidS3BucketException": return [3, 4];
723
- case "InvalidS3KeyException": return [3, 6];
724
- case "com.amazonaws.polly#InvalidS3KeyException": return [3, 6];
725
- case "InvalidSampleRateException": return [3, 8];
726
- case "com.amazonaws.polly#InvalidSampleRateException": return [3, 8];
727
- case "InvalidSnsTopicArnException": return [3, 10];
728
- case "com.amazonaws.polly#InvalidSnsTopicArnException": return [3, 10];
729
- case "InvalidSsmlException": return [3, 12];
730
- case "com.amazonaws.polly#InvalidSsmlException": return [3, 12];
731
- case "LanguageNotSupportedException": return [3, 14];
732
- case "com.amazonaws.polly#LanguageNotSupportedException": return [3, 14];
733
- case "LexiconNotFoundException": return [3, 16];
734
- case "com.amazonaws.polly#LexiconNotFoundException": return [3, 16];
735
- case "MarksNotSupportedForFormatException": return [3, 18];
736
- case "com.amazonaws.polly#MarksNotSupportedForFormatException": return [3, 18];
737
- case "ServiceFailureException": return [3, 20];
738
- case "com.amazonaws.polly#ServiceFailureException": return [3, 20];
739
- case "SsmlMarksNotSupportedForTextTypeException": return [3, 22];
740
- case "com.amazonaws.polly#SsmlMarksNotSupportedForTextTypeException": return [3, 22];
741
- case "TextLengthExceededException": return [3, 24];
742
- case "com.amazonaws.polly#TextLengthExceededException": return [3, 24];
743
- }
744
- return [3, 26];
745
- case 2: return [4, deserializeAws_restJson1EngineNotSupportedExceptionResponse(parsedOutput, context)];
746
- case 3: throw _d.sent();
747
- case 4: return [4, deserializeAws_restJson1InvalidS3BucketExceptionResponse(parsedOutput, context)];
748
- case 5: throw _d.sent();
749
- case 6: return [4, deserializeAws_restJson1InvalidS3KeyExceptionResponse(parsedOutput, context)];
750
- case 7: throw _d.sent();
751
- case 8: return [4, deserializeAws_restJson1InvalidSampleRateExceptionResponse(parsedOutput, context)];
752
- case 9: throw _d.sent();
753
- case 10: return [4, deserializeAws_restJson1InvalidSnsTopicArnExceptionResponse(parsedOutput, context)];
754
- case 11: throw _d.sent();
755
- case 12: return [4, deserializeAws_restJson1InvalidSsmlExceptionResponse(parsedOutput, context)];
756
- case 13: throw _d.sent();
757
- case 14: return [4, deserializeAws_restJson1LanguageNotSupportedExceptionResponse(parsedOutput, context)];
758
- case 15: throw _d.sent();
759
- case 16: return [4, deserializeAws_restJson1LexiconNotFoundExceptionResponse(parsedOutput, context)];
760
- case 17: throw _d.sent();
761
- case 18: return [4, deserializeAws_restJson1MarksNotSupportedForFormatExceptionResponse(parsedOutput, context)];
762
- case 19: throw _d.sent();
763
- case 20: return [4, deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context)];
764
- case 21: throw _d.sent();
765
- case 22: return [4, deserializeAws_restJson1SsmlMarksNotSupportedForTextTypeExceptionResponse(parsedOutput, context)];
766
- case 23: throw _d.sent();
767
- case 24: return [4, deserializeAws_restJson1TextLengthExceededExceptionResponse(parsedOutput, context)];
768
- case 25: throw _d.sent();
769
- case 26:
770
- parsedBody = parsedOutput.body;
771
- throwDefaultError({
772
- output: output,
773
- parsedBody: parsedBody,
774
- exceptionCtor: __BaseException,
775
- errorCode: errorCode,
776
- });
777
- _d.label = 27;
778
- case 27: return [2];
779
- }
402
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
403
+ if (data.NextToken != null) {
404
+ contents.NextToken = __expectString(data.NextToken);
405
+ }
406
+ if (data.SynthesisTasks != null) {
407
+ contents.SynthesisTasks = deserializeAws_restJson1SynthesisTasks(data.SynthesisTasks, context);
408
+ }
409
+ return contents;
410
+ };
411
+ const deserializeAws_restJson1ListSpeechSynthesisTasksCommandError = async (output, context) => {
412
+ const parsedOutput = {
413
+ ...output,
414
+ body: await parseErrorBody(output.body, context),
415
+ };
416
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
417
+ switch (errorCode) {
418
+ case "InvalidNextTokenException":
419
+ case "com.amazonaws.polly#InvalidNextTokenException":
420
+ throw await deserializeAws_restJson1InvalidNextTokenExceptionResponse(parsedOutput, context);
421
+ case "ServiceFailureException":
422
+ case "com.amazonaws.polly#ServiceFailureException":
423
+ throw await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context);
424
+ default:
425
+ const parsedBody = parsedOutput.body;
426
+ throwDefaultError({
427
+ output,
428
+ parsedBody,
429
+ exceptionCtor: __BaseException,
430
+ errorCode,
431
+ });
432
+ }
433
+ };
434
+ export const deserializeAws_restJson1PutLexiconCommand = async (output, context) => {
435
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
436
+ return deserializeAws_restJson1PutLexiconCommandError(output, context);
437
+ }
438
+ const contents = map({
439
+ $metadata: deserializeMetadata(output),
780
440
  });
781
- }); };
782
- export var deserializeAws_restJson1SynthesizeSpeechCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
783
- var contents, data;
784
- return __generator(this, function (_a) {
785
- if (output.statusCode !== 200 && output.statusCode >= 300) {
786
- return [2, deserializeAws_restJson1SynthesizeSpeechCommandError(output, context)];
787
- }
788
- contents = map({
789
- $metadata: deserializeMetadata(output),
790
- ContentType: [, output.headers["content-type"]],
791
- RequestCharacters: [
792
- function () { return void 0 !== output.headers["x-amzn-requestcharacters"]; },
793
- function () { return __strictParseInt32(output.headers["x-amzn-requestcharacters"]); },
794
- ],
795
- });
796
- data = output.body;
797
- contents.AudioStream = data;
798
- return [2, contents];
441
+ await collectBody(output.body, context);
442
+ return contents;
443
+ };
444
+ const deserializeAws_restJson1PutLexiconCommandError = async (output, context) => {
445
+ const parsedOutput = {
446
+ ...output,
447
+ body: await parseErrorBody(output.body, context),
448
+ };
449
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
450
+ switch (errorCode) {
451
+ case "InvalidLexiconException":
452
+ case "com.amazonaws.polly#InvalidLexiconException":
453
+ throw await deserializeAws_restJson1InvalidLexiconExceptionResponse(parsedOutput, context);
454
+ case "LexiconSizeExceededException":
455
+ case "com.amazonaws.polly#LexiconSizeExceededException":
456
+ throw await deserializeAws_restJson1LexiconSizeExceededExceptionResponse(parsedOutput, context);
457
+ case "MaxLexemeLengthExceededException":
458
+ case "com.amazonaws.polly#MaxLexemeLengthExceededException":
459
+ throw await deserializeAws_restJson1MaxLexemeLengthExceededExceptionResponse(parsedOutput, context);
460
+ case "MaxLexiconsNumberExceededException":
461
+ case "com.amazonaws.polly#MaxLexiconsNumberExceededException":
462
+ throw await deserializeAws_restJson1MaxLexiconsNumberExceededExceptionResponse(parsedOutput, context);
463
+ case "ServiceFailureException":
464
+ case "com.amazonaws.polly#ServiceFailureException":
465
+ throw await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context);
466
+ case "UnsupportedPlsAlphabetException":
467
+ case "com.amazonaws.polly#UnsupportedPlsAlphabetException":
468
+ throw await deserializeAws_restJson1UnsupportedPlsAlphabetExceptionResponse(parsedOutput, context);
469
+ case "UnsupportedPlsLanguageException":
470
+ case "com.amazonaws.polly#UnsupportedPlsLanguageException":
471
+ throw await deserializeAws_restJson1UnsupportedPlsLanguageExceptionResponse(parsedOutput, context);
472
+ default:
473
+ const parsedBody = parsedOutput.body;
474
+ throwDefaultError({
475
+ output,
476
+ parsedBody,
477
+ exceptionCtor: __BaseException,
478
+ errorCode,
479
+ });
480
+ }
481
+ };
482
+ export const deserializeAws_restJson1StartSpeechSynthesisTaskCommand = async (output, context) => {
483
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
484
+ return deserializeAws_restJson1StartSpeechSynthesisTaskCommandError(output, context);
485
+ }
486
+ const contents = map({
487
+ $metadata: deserializeMetadata(output),
799
488
  });
800
- }); };
801
- var deserializeAws_restJson1SynthesizeSpeechCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
802
- var parsedOutput, _a, errorCode, _b, parsedBody;
803
- var _c;
804
- return __generator(this, function (_d) {
805
- switch (_d.label) {
806
- case 0:
807
- _a = [__assign({}, output)];
808
- _c = {};
809
- return [4, parseErrorBody(output.body, context)];
810
- case 1:
811
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
812
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
813
- _b = errorCode;
814
- switch (_b) {
815
- case "EngineNotSupportedException": return [3, 2];
816
- case "com.amazonaws.polly#EngineNotSupportedException": return [3, 2];
817
- case "InvalidSampleRateException": return [3, 4];
818
- case "com.amazonaws.polly#InvalidSampleRateException": return [3, 4];
819
- case "InvalidSsmlException": return [3, 6];
820
- case "com.amazonaws.polly#InvalidSsmlException": return [3, 6];
821
- case "LanguageNotSupportedException": return [3, 8];
822
- case "com.amazonaws.polly#LanguageNotSupportedException": return [3, 8];
823
- case "LexiconNotFoundException": return [3, 10];
824
- case "com.amazonaws.polly#LexiconNotFoundException": return [3, 10];
825
- case "MarksNotSupportedForFormatException": return [3, 12];
826
- case "com.amazonaws.polly#MarksNotSupportedForFormatException": return [3, 12];
827
- case "ServiceFailureException": return [3, 14];
828
- case "com.amazonaws.polly#ServiceFailureException": return [3, 14];
829
- case "SsmlMarksNotSupportedForTextTypeException": return [3, 16];
830
- case "com.amazonaws.polly#SsmlMarksNotSupportedForTextTypeException": return [3, 16];
831
- case "TextLengthExceededException": return [3, 18];
832
- case "com.amazonaws.polly#TextLengthExceededException": return [3, 18];
833
- }
834
- return [3, 20];
835
- case 2: return [4, deserializeAws_restJson1EngineNotSupportedExceptionResponse(parsedOutput, context)];
836
- case 3: throw _d.sent();
837
- case 4: return [4, deserializeAws_restJson1InvalidSampleRateExceptionResponse(parsedOutput, context)];
838
- case 5: throw _d.sent();
839
- case 6: return [4, deserializeAws_restJson1InvalidSsmlExceptionResponse(parsedOutput, context)];
840
- case 7: throw _d.sent();
841
- case 8: return [4, deserializeAws_restJson1LanguageNotSupportedExceptionResponse(parsedOutput, context)];
842
- case 9: throw _d.sent();
843
- case 10: return [4, deserializeAws_restJson1LexiconNotFoundExceptionResponse(parsedOutput, context)];
844
- case 11: throw _d.sent();
845
- case 12: return [4, deserializeAws_restJson1MarksNotSupportedForFormatExceptionResponse(parsedOutput, context)];
846
- case 13: throw _d.sent();
847
- case 14: return [4, deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context)];
848
- case 15: throw _d.sent();
849
- case 16: return [4, deserializeAws_restJson1SsmlMarksNotSupportedForTextTypeExceptionResponse(parsedOutput, context)];
850
- case 17: throw _d.sent();
851
- case 18: return [4, deserializeAws_restJson1TextLengthExceededExceptionResponse(parsedOutput, context)];
852
- case 19: throw _d.sent();
853
- case 20:
854
- parsedBody = parsedOutput.body;
855
- throwDefaultError({
856
- output: output,
857
- parsedBody: parsedBody,
858
- exceptionCtor: __BaseException,
859
- errorCode: errorCode,
860
- });
861
- _d.label = 21;
862
- case 21: return [2];
863
- }
489
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
490
+ if (data.SynthesisTask != null) {
491
+ contents.SynthesisTask = deserializeAws_restJson1SynthesisTask(data.SynthesisTask, context);
492
+ }
493
+ return contents;
494
+ };
495
+ const deserializeAws_restJson1StartSpeechSynthesisTaskCommandError = async (output, context) => {
496
+ const parsedOutput = {
497
+ ...output,
498
+ body: await parseErrorBody(output.body, context),
499
+ };
500
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
501
+ switch (errorCode) {
502
+ case "EngineNotSupportedException":
503
+ case "com.amazonaws.polly#EngineNotSupportedException":
504
+ throw await deserializeAws_restJson1EngineNotSupportedExceptionResponse(parsedOutput, context);
505
+ case "InvalidS3BucketException":
506
+ case "com.amazonaws.polly#InvalidS3BucketException":
507
+ throw await deserializeAws_restJson1InvalidS3BucketExceptionResponse(parsedOutput, context);
508
+ case "InvalidS3KeyException":
509
+ case "com.amazonaws.polly#InvalidS3KeyException":
510
+ throw await deserializeAws_restJson1InvalidS3KeyExceptionResponse(parsedOutput, context);
511
+ case "InvalidSampleRateException":
512
+ case "com.amazonaws.polly#InvalidSampleRateException":
513
+ throw await deserializeAws_restJson1InvalidSampleRateExceptionResponse(parsedOutput, context);
514
+ case "InvalidSnsTopicArnException":
515
+ case "com.amazonaws.polly#InvalidSnsTopicArnException":
516
+ throw await deserializeAws_restJson1InvalidSnsTopicArnExceptionResponse(parsedOutput, context);
517
+ case "InvalidSsmlException":
518
+ case "com.amazonaws.polly#InvalidSsmlException":
519
+ throw await deserializeAws_restJson1InvalidSsmlExceptionResponse(parsedOutput, context);
520
+ case "LanguageNotSupportedException":
521
+ case "com.amazonaws.polly#LanguageNotSupportedException":
522
+ throw await deserializeAws_restJson1LanguageNotSupportedExceptionResponse(parsedOutput, context);
523
+ case "LexiconNotFoundException":
524
+ case "com.amazonaws.polly#LexiconNotFoundException":
525
+ throw await deserializeAws_restJson1LexiconNotFoundExceptionResponse(parsedOutput, context);
526
+ case "MarksNotSupportedForFormatException":
527
+ case "com.amazonaws.polly#MarksNotSupportedForFormatException":
528
+ throw await deserializeAws_restJson1MarksNotSupportedForFormatExceptionResponse(parsedOutput, context);
529
+ case "ServiceFailureException":
530
+ case "com.amazonaws.polly#ServiceFailureException":
531
+ throw await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context);
532
+ case "SsmlMarksNotSupportedForTextTypeException":
533
+ case "com.amazonaws.polly#SsmlMarksNotSupportedForTextTypeException":
534
+ throw await deserializeAws_restJson1SsmlMarksNotSupportedForTextTypeExceptionResponse(parsedOutput, context);
535
+ case "TextLengthExceededException":
536
+ case "com.amazonaws.polly#TextLengthExceededException":
537
+ throw await deserializeAws_restJson1TextLengthExceededExceptionResponse(parsedOutput, context);
538
+ default:
539
+ const parsedBody = parsedOutput.body;
540
+ throwDefaultError({
541
+ output,
542
+ parsedBody,
543
+ exceptionCtor: __BaseException,
544
+ errorCode,
545
+ });
546
+ }
547
+ };
548
+ export const deserializeAws_restJson1SynthesizeSpeechCommand = async (output, context) => {
549
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
550
+ return deserializeAws_restJson1SynthesizeSpeechCommandError(output, context);
551
+ }
552
+ const contents = map({
553
+ $metadata: deserializeMetadata(output),
554
+ ContentType: [, output.headers["content-type"]],
555
+ RequestCharacters: [
556
+ () => void 0 !== output.headers["x-amzn-requestcharacters"],
557
+ () => __strictParseInt32(output.headers["x-amzn-requestcharacters"]),
558
+ ],
864
559
  });
865
- }); };
866
- var map = __map;
867
- var deserializeAws_restJson1EngineNotSupportedExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
868
- var contents, data, exception;
869
- return __generator(this, function (_a) {
870
- contents = map({});
871
- data = parsedOutput.body;
872
- if (data.message != null) {
873
- contents.message = __expectString(data.message);
874
- }
875
- exception = new EngineNotSupportedException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
876
- return [2, __decorateServiceException(exception, parsedOutput.body)];
560
+ const data = output.body;
561
+ context.sdkStreamMixin(data);
562
+ contents.AudioStream = data;
563
+ return contents;
564
+ };
565
+ const deserializeAws_restJson1SynthesizeSpeechCommandError = async (output, context) => {
566
+ const parsedOutput = {
567
+ ...output,
568
+ body: await parseErrorBody(output.body, context),
569
+ };
570
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
571
+ switch (errorCode) {
572
+ case "EngineNotSupportedException":
573
+ case "com.amazonaws.polly#EngineNotSupportedException":
574
+ throw await deserializeAws_restJson1EngineNotSupportedExceptionResponse(parsedOutput, context);
575
+ case "InvalidSampleRateException":
576
+ case "com.amazonaws.polly#InvalidSampleRateException":
577
+ throw await deserializeAws_restJson1InvalidSampleRateExceptionResponse(parsedOutput, context);
578
+ case "InvalidSsmlException":
579
+ case "com.amazonaws.polly#InvalidSsmlException":
580
+ throw await deserializeAws_restJson1InvalidSsmlExceptionResponse(parsedOutput, context);
581
+ case "LanguageNotSupportedException":
582
+ case "com.amazonaws.polly#LanguageNotSupportedException":
583
+ throw await deserializeAws_restJson1LanguageNotSupportedExceptionResponse(parsedOutput, context);
584
+ case "LexiconNotFoundException":
585
+ case "com.amazonaws.polly#LexiconNotFoundException":
586
+ throw await deserializeAws_restJson1LexiconNotFoundExceptionResponse(parsedOutput, context);
587
+ case "MarksNotSupportedForFormatException":
588
+ case "com.amazonaws.polly#MarksNotSupportedForFormatException":
589
+ throw await deserializeAws_restJson1MarksNotSupportedForFormatExceptionResponse(parsedOutput, context);
590
+ case "ServiceFailureException":
591
+ case "com.amazonaws.polly#ServiceFailureException":
592
+ throw await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context);
593
+ case "SsmlMarksNotSupportedForTextTypeException":
594
+ case "com.amazonaws.polly#SsmlMarksNotSupportedForTextTypeException":
595
+ throw await deserializeAws_restJson1SsmlMarksNotSupportedForTextTypeExceptionResponse(parsedOutput, context);
596
+ case "TextLengthExceededException":
597
+ case "com.amazonaws.polly#TextLengthExceededException":
598
+ throw await deserializeAws_restJson1TextLengthExceededExceptionResponse(parsedOutput, context);
599
+ default:
600
+ const parsedBody = parsedOutput.body;
601
+ throwDefaultError({
602
+ output,
603
+ parsedBody,
604
+ exceptionCtor: __BaseException,
605
+ errorCode,
606
+ });
607
+ }
608
+ };
609
+ const map = __map;
610
+ const deserializeAws_restJson1EngineNotSupportedExceptionResponse = async (parsedOutput, context) => {
611
+ const contents = map({});
612
+ const data = parsedOutput.body;
613
+ if (data.message != null) {
614
+ contents.message = __expectString(data.message);
615
+ }
616
+ const exception = new EngineNotSupportedException({
617
+ $metadata: deserializeMetadata(parsedOutput),
618
+ ...contents,
877
619
  });
878
- }); };
879
- var deserializeAws_restJson1InvalidLexiconExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
880
- var contents, data, exception;
881
- return __generator(this, function (_a) {
882
- contents = map({});
883
- data = parsedOutput.body;
884
- if (data.message != null) {
885
- contents.message = __expectString(data.message);
886
- }
887
- exception = new InvalidLexiconException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
888
- return [2, __decorateServiceException(exception, parsedOutput.body)];
620
+ return __decorateServiceException(exception, parsedOutput.body);
621
+ };
622
+ const deserializeAws_restJson1InvalidLexiconExceptionResponse = async (parsedOutput, context) => {
623
+ const contents = map({});
624
+ const data = parsedOutput.body;
625
+ if (data.message != null) {
626
+ contents.message = __expectString(data.message);
627
+ }
628
+ const exception = new InvalidLexiconException({
629
+ $metadata: deserializeMetadata(parsedOutput),
630
+ ...contents,
889
631
  });
890
- }); };
891
- var deserializeAws_restJson1InvalidNextTokenExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
892
- var contents, data, exception;
893
- return __generator(this, function (_a) {
894
- contents = map({});
895
- data = parsedOutput.body;
896
- if (data.message != null) {
897
- contents.message = __expectString(data.message);
898
- }
899
- exception = new InvalidNextTokenException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
900
- return [2, __decorateServiceException(exception, parsedOutput.body)];
632
+ return __decorateServiceException(exception, parsedOutput.body);
633
+ };
634
+ const deserializeAws_restJson1InvalidNextTokenExceptionResponse = async (parsedOutput, context) => {
635
+ const contents = map({});
636
+ const data = parsedOutput.body;
637
+ if (data.message != null) {
638
+ contents.message = __expectString(data.message);
639
+ }
640
+ const exception = new InvalidNextTokenException({
641
+ $metadata: deserializeMetadata(parsedOutput),
642
+ ...contents,
901
643
  });
902
- }); };
903
- var deserializeAws_restJson1InvalidS3BucketExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
904
- var contents, data, exception;
905
- return __generator(this, function (_a) {
906
- contents = map({});
907
- data = parsedOutput.body;
908
- if (data.message != null) {
909
- contents.message = __expectString(data.message);
910
- }
911
- exception = new InvalidS3BucketException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
912
- return [2, __decorateServiceException(exception, parsedOutput.body)];
644
+ return __decorateServiceException(exception, parsedOutput.body);
645
+ };
646
+ const deserializeAws_restJson1InvalidS3BucketExceptionResponse = async (parsedOutput, context) => {
647
+ const contents = map({});
648
+ const data = parsedOutput.body;
649
+ if (data.message != null) {
650
+ contents.message = __expectString(data.message);
651
+ }
652
+ const exception = new InvalidS3BucketException({
653
+ $metadata: deserializeMetadata(parsedOutput),
654
+ ...contents,
913
655
  });
914
- }); };
915
- var deserializeAws_restJson1InvalidS3KeyExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
916
- var contents, data, exception;
917
- return __generator(this, function (_a) {
918
- contents = map({});
919
- data = parsedOutput.body;
920
- if (data.message != null) {
921
- contents.message = __expectString(data.message);
922
- }
923
- exception = new InvalidS3KeyException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
924
- return [2, __decorateServiceException(exception, parsedOutput.body)];
656
+ return __decorateServiceException(exception, parsedOutput.body);
657
+ };
658
+ const deserializeAws_restJson1InvalidS3KeyExceptionResponse = async (parsedOutput, context) => {
659
+ const contents = map({});
660
+ const data = parsedOutput.body;
661
+ if (data.message != null) {
662
+ contents.message = __expectString(data.message);
663
+ }
664
+ const exception = new InvalidS3KeyException({
665
+ $metadata: deserializeMetadata(parsedOutput),
666
+ ...contents,
925
667
  });
926
- }); };
927
- var deserializeAws_restJson1InvalidSampleRateExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
928
- var contents, data, exception;
929
- return __generator(this, function (_a) {
930
- contents = map({});
931
- data = parsedOutput.body;
932
- if (data.message != null) {
933
- contents.message = __expectString(data.message);
934
- }
935
- exception = new InvalidSampleRateException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
936
- return [2, __decorateServiceException(exception, parsedOutput.body)];
668
+ return __decorateServiceException(exception, parsedOutput.body);
669
+ };
670
+ const deserializeAws_restJson1InvalidSampleRateExceptionResponse = async (parsedOutput, context) => {
671
+ const contents = map({});
672
+ const data = parsedOutput.body;
673
+ if (data.message != null) {
674
+ contents.message = __expectString(data.message);
675
+ }
676
+ const exception = new InvalidSampleRateException({
677
+ $metadata: deserializeMetadata(parsedOutput),
678
+ ...contents,
937
679
  });
938
- }); };
939
- var deserializeAws_restJson1InvalidSnsTopicArnExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
940
- var contents, data, exception;
941
- return __generator(this, function (_a) {
942
- contents = map({});
943
- data = parsedOutput.body;
944
- if (data.message != null) {
945
- contents.message = __expectString(data.message);
946
- }
947
- exception = new InvalidSnsTopicArnException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
948
- return [2, __decorateServiceException(exception, parsedOutput.body)];
680
+ return __decorateServiceException(exception, parsedOutput.body);
681
+ };
682
+ const deserializeAws_restJson1InvalidSnsTopicArnExceptionResponse = async (parsedOutput, context) => {
683
+ const contents = map({});
684
+ const data = parsedOutput.body;
685
+ if (data.message != null) {
686
+ contents.message = __expectString(data.message);
687
+ }
688
+ const exception = new InvalidSnsTopicArnException({
689
+ $metadata: deserializeMetadata(parsedOutput),
690
+ ...contents,
949
691
  });
950
- }); };
951
- var deserializeAws_restJson1InvalidSsmlExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
952
- var contents, data, exception;
953
- return __generator(this, function (_a) {
954
- contents = map({});
955
- data = parsedOutput.body;
956
- if (data.message != null) {
957
- contents.message = __expectString(data.message);
958
- }
959
- exception = new InvalidSsmlException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
960
- return [2, __decorateServiceException(exception, parsedOutput.body)];
692
+ return __decorateServiceException(exception, parsedOutput.body);
693
+ };
694
+ const deserializeAws_restJson1InvalidSsmlExceptionResponse = async (parsedOutput, context) => {
695
+ const contents = map({});
696
+ const data = parsedOutput.body;
697
+ if (data.message != null) {
698
+ contents.message = __expectString(data.message);
699
+ }
700
+ const exception = new InvalidSsmlException({
701
+ $metadata: deserializeMetadata(parsedOutput),
702
+ ...contents,
961
703
  });
962
- }); };
963
- var deserializeAws_restJson1InvalidTaskIdExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
964
- var contents, data, exception;
965
- return __generator(this, function (_a) {
966
- contents = map({});
967
- data = parsedOutput.body;
968
- if (data.message != null) {
969
- contents.message = __expectString(data.message);
970
- }
971
- exception = new InvalidTaskIdException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
972
- return [2, __decorateServiceException(exception, parsedOutput.body)];
704
+ return __decorateServiceException(exception, parsedOutput.body);
705
+ };
706
+ const deserializeAws_restJson1InvalidTaskIdExceptionResponse = async (parsedOutput, context) => {
707
+ const contents = map({});
708
+ const data = parsedOutput.body;
709
+ if (data.message != null) {
710
+ contents.message = __expectString(data.message);
711
+ }
712
+ const exception = new InvalidTaskIdException({
713
+ $metadata: deserializeMetadata(parsedOutput),
714
+ ...contents,
973
715
  });
974
- }); };
975
- var deserializeAws_restJson1LanguageNotSupportedExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
976
- var contents, data, exception;
977
- return __generator(this, function (_a) {
978
- contents = map({});
979
- data = parsedOutput.body;
980
- if (data.message != null) {
981
- contents.message = __expectString(data.message);
982
- }
983
- exception = new LanguageNotSupportedException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
984
- return [2, __decorateServiceException(exception, parsedOutput.body)];
716
+ return __decorateServiceException(exception, parsedOutput.body);
717
+ };
718
+ const deserializeAws_restJson1LanguageNotSupportedExceptionResponse = async (parsedOutput, context) => {
719
+ const contents = map({});
720
+ const data = parsedOutput.body;
721
+ if (data.message != null) {
722
+ contents.message = __expectString(data.message);
723
+ }
724
+ const exception = new LanguageNotSupportedException({
725
+ $metadata: deserializeMetadata(parsedOutput),
726
+ ...contents,
985
727
  });
986
- }); };
987
- var deserializeAws_restJson1LexiconNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
988
- var contents, data, exception;
989
- return __generator(this, function (_a) {
990
- contents = map({});
991
- data = parsedOutput.body;
992
- if (data.message != null) {
993
- contents.message = __expectString(data.message);
994
- }
995
- exception = new LexiconNotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
996
- return [2, __decorateServiceException(exception, parsedOutput.body)];
728
+ return __decorateServiceException(exception, parsedOutput.body);
729
+ };
730
+ const deserializeAws_restJson1LexiconNotFoundExceptionResponse = async (parsedOutput, context) => {
731
+ const contents = map({});
732
+ const data = parsedOutput.body;
733
+ if (data.message != null) {
734
+ contents.message = __expectString(data.message);
735
+ }
736
+ const exception = new LexiconNotFoundException({
737
+ $metadata: deserializeMetadata(parsedOutput),
738
+ ...contents,
997
739
  });
998
- }); };
999
- var deserializeAws_restJson1LexiconSizeExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1000
- var contents, data, exception;
1001
- return __generator(this, function (_a) {
1002
- contents = map({});
1003
- data = parsedOutput.body;
1004
- if (data.message != null) {
1005
- contents.message = __expectString(data.message);
1006
- }
1007
- exception = new LexiconSizeExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1008
- return [2, __decorateServiceException(exception, parsedOutput.body)];
740
+ return __decorateServiceException(exception, parsedOutput.body);
741
+ };
742
+ const deserializeAws_restJson1LexiconSizeExceededExceptionResponse = async (parsedOutput, context) => {
743
+ const contents = map({});
744
+ const data = parsedOutput.body;
745
+ if (data.message != null) {
746
+ contents.message = __expectString(data.message);
747
+ }
748
+ const exception = new LexiconSizeExceededException({
749
+ $metadata: deserializeMetadata(parsedOutput),
750
+ ...contents,
1009
751
  });
1010
- }); };
1011
- var deserializeAws_restJson1MarksNotSupportedForFormatExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1012
- var contents, data, exception;
1013
- return __generator(this, function (_a) {
1014
- contents = map({});
1015
- data = parsedOutput.body;
1016
- if (data.message != null) {
1017
- contents.message = __expectString(data.message);
1018
- }
1019
- exception = new MarksNotSupportedForFormatException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1020
- return [2, __decorateServiceException(exception, parsedOutput.body)];
752
+ return __decorateServiceException(exception, parsedOutput.body);
753
+ };
754
+ const deserializeAws_restJson1MarksNotSupportedForFormatExceptionResponse = async (parsedOutput, context) => {
755
+ const contents = map({});
756
+ const data = parsedOutput.body;
757
+ if (data.message != null) {
758
+ contents.message = __expectString(data.message);
759
+ }
760
+ const exception = new MarksNotSupportedForFormatException({
761
+ $metadata: deserializeMetadata(parsedOutput),
762
+ ...contents,
1021
763
  });
1022
- }); };
1023
- var deserializeAws_restJson1MaxLexemeLengthExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1024
- var contents, data, exception;
1025
- return __generator(this, function (_a) {
1026
- contents = map({});
1027
- data = parsedOutput.body;
1028
- if (data.message != null) {
1029
- contents.message = __expectString(data.message);
1030
- }
1031
- exception = new MaxLexemeLengthExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1032
- return [2, __decorateServiceException(exception, parsedOutput.body)];
764
+ return __decorateServiceException(exception, parsedOutput.body);
765
+ };
766
+ const deserializeAws_restJson1MaxLexemeLengthExceededExceptionResponse = async (parsedOutput, context) => {
767
+ const contents = map({});
768
+ const data = parsedOutput.body;
769
+ if (data.message != null) {
770
+ contents.message = __expectString(data.message);
771
+ }
772
+ const exception = new MaxLexemeLengthExceededException({
773
+ $metadata: deserializeMetadata(parsedOutput),
774
+ ...contents,
1033
775
  });
1034
- }); };
1035
- var deserializeAws_restJson1MaxLexiconsNumberExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1036
- var contents, data, exception;
1037
- return __generator(this, function (_a) {
1038
- contents = map({});
1039
- data = parsedOutput.body;
1040
- if (data.message != null) {
1041
- contents.message = __expectString(data.message);
1042
- }
1043
- exception = new MaxLexiconsNumberExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1044
- return [2, __decorateServiceException(exception, parsedOutput.body)];
776
+ return __decorateServiceException(exception, parsedOutput.body);
777
+ };
778
+ const deserializeAws_restJson1MaxLexiconsNumberExceededExceptionResponse = async (parsedOutput, context) => {
779
+ const contents = map({});
780
+ const data = parsedOutput.body;
781
+ if (data.message != null) {
782
+ contents.message = __expectString(data.message);
783
+ }
784
+ const exception = new MaxLexiconsNumberExceededException({
785
+ $metadata: deserializeMetadata(parsedOutput),
786
+ ...contents,
1045
787
  });
1046
- }); };
1047
- var deserializeAws_restJson1ServiceFailureExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1048
- var contents, data, exception;
1049
- return __generator(this, function (_a) {
1050
- contents = map({});
1051
- data = parsedOutput.body;
1052
- if (data.message != null) {
1053
- contents.message = __expectString(data.message);
1054
- }
1055
- exception = new ServiceFailureException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1056
- return [2, __decorateServiceException(exception, parsedOutput.body)];
788
+ return __decorateServiceException(exception, parsedOutput.body);
789
+ };
790
+ const deserializeAws_restJson1ServiceFailureExceptionResponse = async (parsedOutput, context) => {
791
+ const contents = map({});
792
+ const data = parsedOutput.body;
793
+ if (data.message != null) {
794
+ contents.message = __expectString(data.message);
795
+ }
796
+ const exception = new ServiceFailureException({
797
+ $metadata: deserializeMetadata(parsedOutput),
798
+ ...contents,
1057
799
  });
1058
- }); };
1059
- var deserializeAws_restJson1SsmlMarksNotSupportedForTextTypeExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1060
- var contents, data, exception;
1061
- return __generator(this, function (_a) {
1062
- contents = map({});
1063
- data = parsedOutput.body;
1064
- if (data.message != null) {
1065
- contents.message = __expectString(data.message);
1066
- }
1067
- exception = new SsmlMarksNotSupportedForTextTypeException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1068
- return [2, __decorateServiceException(exception, parsedOutput.body)];
800
+ return __decorateServiceException(exception, parsedOutput.body);
801
+ };
802
+ const deserializeAws_restJson1SsmlMarksNotSupportedForTextTypeExceptionResponse = async (parsedOutput, context) => {
803
+ const contents = map({});
804
+ const data = parsedOutput.body;
805
+ if (data.message != null) {
806
+ contents.message = __expectString(data.message);
807
+ }
808
+ const exception = new SsmlMarksNotSupportedForTextTypeException({
809
+ $metadata: deserializeMetadata(parsedOutput),
810
+ ...contents,
1069
811
  });
1070
- }); };
1071
- var deserializeAws_restJson1SynthesisTaskNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1072
- var contents, data, exception;
1073
- return __generator(this, function (_a) {
1074
- contents = map({});
1075
- data = parsedOutput.body;
1076
- if (data.message != null) {
1077
- contents.message = __expectString(data.message);
1078
- }
1079
- exception = new SynthesisTaskNotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1080
- return [2, __decorateServiceException(exception, parsedOutput.body)];
812
+ return __decorateServiceException(exception, parsedOutput.body);
813
+ };
814
+ const deserializeAws_restJson1SynthesisTaskNotFoundExceptionResponse = async (parsedOutput, context) => {
815
+ const contents = map({});
816
+ const data = parsedOutput.body;
817
+ if (data.message != null) {
818
+ contents.message = __expectString(data.message);
819
+ }
820
+ const exception = new SynthesisTaskNotFoundException({
821
+ $metadata: deserializeMetadata(parsedOutput),
822
+ ...contents,
1081
823
  });
1082
- }); };
1083
- var deserializeAws_restJson1TextLengthExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1084
- var contents, data, exception;
1085
- return __generator(this, function (_a) {
1086
- contents = map({});
1087
- data = parsedOutput.body;
1088
- if (data.message != null) {
1089
- contents.message = __expectString(data.message);
1090
- }
1091
- exception = new TextLengthExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1092
- return [2, __decorateServiceException(exception, parsedOutput.body)];
824
+ return __decorateServiceException(exception, parsedOutput.body);
825
+ };
826
+ const deserializeAws_restJson1TextLengthExceededExceptionResponse = async (parsedOutput, context) => {
827
+ const contents = map({});
828
+ const data = parsedOutput.body;
829
+ if (data.message != null) {
830
+ contents.message = __expectString(data.message);
831
+ }
832
+ const exception = new TextLengthExceededException({
833
+ $metadata: deserializeMetadata(parsedOutput),
834
+ ...contents,
1093
835
  });
1094
- }); };
1095
- var deserializeAws_restJson1UnsupportedPlsAlphabetExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1096
- var contents, data, exception;
1097
- return __generator(this, function (_a) {
1098
- contents = map({});
1099
- data = parsedOutput.body;
1100
- if (data.message != null) {
1101
- contents.message = __expectString(data.message);
1102
- }
1103
- exception = new UnsupportedPlsAlphabetException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1104
- return [2, __decorateServiceException(exception, parsedOutput.body)];
836
+ return __decorateServiceException(exception, parsedOutput.body);
837
+ };
838
+ const deserializeAws_restJson1UnsupportedPlsAlphabetExceptionResponse = async (parsedOutput, context) => {
839
+ const contents = map({});
840
+ const data = parsedOutput.body;
841
+ if (data.message != null) {
842
+ contents.message = __expectString(data.message);
843
+ }
844
+ const exception = new UnsupportedPlsAlphabetException({
845
+ $metadata: deserializeMetadata(parsedOutput),
846
+ ...contents,
1105
847
  });
1106
- }); };
1107
- var deserializeAws_restJson1UnsupportedPlsLanguageExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1108
- var contents, data, exception;
1109
- return __generator(this, function (_a) {
1110
- contents = map({});
1111
- data = parsedOutput.body;
1112
- if (data.message != null) {
1113
- contents.message = __expectString(data.message);
1114
- }
1115
- exception = new UnsupportedPlsLanguageException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1116
- return [2, __decorateServiceException(exception, parsedOutput.body)];
848
+ return __decorateServiceException(exception, parsedOutput.body);
849
+ };
850
+ const deserializeAws_restJson1UnsupportedPlsLanguageExceptionResponse = async (parsedOutput, context) => {
851
+ const contents = map({});
852
+ const data = parsedOutput.body;
853
+ if (data.message != null) {
854
+ contents.message = __expectString(data.message);
855
+ }
856
+ const exception = new UnsupportedPlsLanguageException({
857
+ $metadata: deserializeMetadata(parsedOutput),
858
+ ...contents,
1117
859
  });
1118
- }); };
1119
- var serializeAws_restJson1LexiconNameList = function (input, context) {
860
+ return __decorateServiceException(exception, parsedOutput.body);
861
+ };
862
+ const serializeAws_restJson1LexiconNameList = (input, context) => {
1120
863
  return input
1121
- .filter(function (e) { return e != null; })
1122
- .map(function (entry) {
864
+ .filter((e) => e != null)
865
+ .map((entry) => {
1123
866
  return entry;
1124
867
  });
1125
868
  };
1126
- var serializeAws_restJson1SpeechMarkTypeList = function (input, context) {
869
+ const serializeAws_restJson1SpeechMarkTypeList = (input, context) => {
1127
870
  return input
1128
- .filter(function (e) { return e != null; })
1129
- .map(function (entry) {
871
+ .filter((e) => e != null)
872
+ .map((entry) => {
1130
873
  return entry;
1131
874
  });
1132
875
  };
1133
- var deserializeAws_restJson1EngineList = function (output, context) {
1134
- var retVal = (output || [])
1135
- .filter(function (e) { return e != null; })
1136
- .map(function (entry) {
876
+ const deserializeAws_restJson1EngineList = (output, context) => {
877
+ const retVal = (output || [])
878
+ .filter((e) => e != null)
879
+ .map((entry) => {
1137
880
  if (entry === null) {
1138
881
  return null;
1139
882
  }
@@ -1141,10 +884,10 @@ var deserializeAws_restJson1EngineList = function (output, context) {
1141
884
  });
1142
885
  return retVal;
1143
886
  };
1144
- var deserializeAws_restJson1LanguageCodeList = function (output, context) {
1145
- var retVal = (output || [])
1146
- .filter(function (e) { return e != null; })
1147
- .map(function (entry) {
887
+ const deserializeAws_restJson1LanguageCodeList = (output, context) => {
888
+ const retVal = (output || [])
889
+ .filter((e) => e != null)
890
+ .map((entry) => {
1148
891
  if (entry === null) {
1149
892
  return null;
1150
893
  }
@@ -1152,13 +895,13 @@ var deserializeAws_restJson1LanguageCodeList = function (output, context) {
1152
895
  });
1153
896
  return retVal;
1154
897
  };
1155
- var deserializeAws_restJson1Lexicon = function (output, context) {
898
+ const deserializeAws_restJson1Lexicon = (output, context) => {
1156
899
  return {
1157
900
  Content: __expectString(output.Content),
1158
901
  Name: __expectString(output.Name),
1159
902
  };
1160
903
  };
1161
- var deserializeAws_restJson1LexiconAttributes = function (output, context) {
904
+ const deserializeAws_restJson1LexiconAttributes = (output, context) => {
1162
905
  return {
1163
906
  Alphabet: __expectString(output.Alphabet),
1164
907
  LanguageCode: __expectString(output.LanguageCode),
@@ -1170,16 +913,16 @@ var deserializeAws_restJson1LexiconAttributes = function (output, context) {
1170
913
  Size: __expectInt32(output.Size),
1171
914
  };
1172
915
  };
1173
- var deserializeAws_restJson1LexiconDescription = function (output, context) {
916
+ const deserializeAws_restJson1LexiconDescription = (output, context) => {
1174
917
  return {
1175
918
  Attributes: output.Attributes != null ? deserializeAws_restJson1LexiconAttributes(output.Attributes, context) : undefined,
1176
919
  Name: __expectString(output.Name),
1177
920
  };
1178
921
  };
1179
- var deserializeAws_restJson1LexiconDescriptionList = function (output, context) {
1180
- var retVal = (output || [])
1181
- .filter(function (e) { return e != null; })
1182
- .map(function (entry) {
922
+ const deserializeAws_restJson1LexiconDescriptionList = (output, context) => {
923
+ const retVal = (output || [])
924
+ .filter((e) => e != null)
925
+ .map((entry) => {
1183
926
  if (entry === null) {
1184
927
  return null;
1185
928
  }
@@ -1187,10 +930,10 @@ var deserializeAws_restJson1LexiconDescriptionList = function (output, context)
1187
930
  });
1188
931
  return retVal;
1189
932
  };
1190
- var deserializeAws_restJson1LexiconNameList = function (output, context) {
1191
- var retVal = (output || [])
1192
- .filter(function (e) { return e != null; })
1193
- .map(function (entry) {
933
+ const deserializeAws_restJson1LexiconNameList = (output, context) => {
934
+ const retVal = (output || [])
935
+ .filter((e) => e != null)
936
+ .map((entry) => {
1194
937
  if (entry === null) {
1195
938
  return null;
1196
939
  }
@@ -1198,10 +941,10 @@ var deserializeAws_restJson1LexiconNameList = function (output, context) {
1198
941
  });
1199
942
  return retVal;
1200
943
  };
1201
- var deserializeAws_restJson1SpeechMarkTypeList = function (output, context) {
1202
- var retVal = (output || [])
1203
- .filter(function (e) { return e != null; })
1204
- .map(function (entry) {
944
+ const deserializeAws_restJson1SpeechMarkTypeList = (output, context) => {
945
+ const retVal = (output || [])
946
+ .filter((e) => e != null)
947
+ .map((entry) => {
1205
948
  if (entry === null) {
1206
949
  return null;
1207
950
  }
@@ -1209,7 +952,7 @@ var deserializeAws_restJson1SpeechMarkTypeList = function (output, context) {
1209
952
  });
1210
953
  return retVal;
1211
954
  };
1212
- var deserializeAws_restJson1SynthesisTask = function (output, context) {
955
+ const deserializeAws_restJson1SynthesisTask = (output, context) => {
1213
956
  return {
1214
957
  CreationTime: output.CreationTime != null
1215
958
  ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.CreationTime)))
@@ -1232,10 +975,10 @@ var deserializeAws_restJson1SynthesisTask = function (output, context) {
1232
975
  VoiceId: __expectString(output.VoiceId),
1233
976
  };
1234
977
  };
1235
- var deserializeAws_restJson1SynthesisTasks = function (output, context) {
1236
- var retVal = (output || [])
1237
- .filter(function (e) { return e != null; })
1238
- .map(function (entry) {
978
+ const deserializeAws_restJson1SynthesisTasks = (output, context) => {
979
+ const retVal = (output || [])
980
+ .filter((e) => e != null)
981
+ .map((entry) => {
1239
982
  if (entry === null) {
1240
983
  return null;
1241
984
  }
@@ -1243,7 +986,7 @@ var deserializeAws_restJson1SynthesisTasks = function (output, context) {
1243
986
  });
1244
987
  return retVal;
1245
988
  };
1246
- var deserializeAws_restJson1Voice = function (output, context) {
989
+ const deserializeAws_restJson1Voice = (output, context) => {
1247
990
  return {
1248
991
  AdditionalLanguageCodes: output.AdditionalLanguageCodes != null
1249
992
  ? deserializeAws_restJson1LanguageCodeList(output.AdditionalLanguageCodes, context)
@@ -1258,10 +1001,10 @@ var deserializeAws_restJson1Voice = function (output, context) {
1258
1001
  : undefined,
1259
1002
  };
1260
1003
  };
1261
- var deserializeAws_restJson1VoiceList = function (output, context) {
1262
- var retVal = (output || [])
1263
- .filter(function (e) { return e != null; })
1264
- .map(function (entry) {
1004
+ const deserializeAws_restJson1VoiceList = (output, context) => {
1005
+ const retVal = (output || [])
1006
+ .filter((e) => e != null)
1007
+ .map((entry) => {
1265
1008
  if (entry === null) {
1266
1009
  return null;
1267
1010
  }
@@ -1269,57 +1012,39 @@ var deserializeAws_restJson1VoiceList = function (output, context) {
1269
1012
  });
1270
1013
  return retVal;
1271
1014
  };
1272
- var deserializeMetadata = function (output) {
1273
- var _a, _b;
1274
- return ({
1275
- httpStatusCode: output.statusCode,
1276
- requestId: (_b = (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"]) !== null && _b !== void 0 ? _b : output.headers["x-amz-request-id"],
1277
- extendedRequestId: output.headers["x-amz-id-2"],
1278
- cfId: output.headers["x-amz-cf-id"],
1279
- });
1280
- };
1281
- var collectBody = function (streamBody, context) {
1282
- if (streamBody === void 0) { streamBody = new Uint8Array(); }
1015
+ const deserializeMetadata = (output) => ({
1016
+ httpStatusCode: output.statusCode,
1017
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
1018
+ extendedRequestId: output.headers["x-amz-id-2"],
1019
+ cfId: output.headers["x-amz-cf-id"],
1020
+ });
1021
+ const collectBody = (streamBody = new Uint8Array(), context) => {
1283
1022
  if (streamBody instanceof Uint8Array) {
1284
1023
  return Promise.resolve(streamBody);
1285
1024
  }
1286
1025
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
1287
1026
  };
1288
- var collectBodyString = function (streamBody, context) {
1289
- return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
1290
- };
1291
- var isSerializableHeaderValue = function (value) {
1292
- return value !== undefined &&
1293
- value !== null &&
1294
- value !== "" &&
1295
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
1296
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
1297
- };
1298
- var parseBody = function (streamBody, context) {
1299
- return collectBodyString(streamBody, context).then(function (encoded) {
1300
- if (encoded.length) {
1301
- return JSON.parse(encoded);
1302
- }
1303
- return {};
1304
- });
1027
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
1028
+ const isSerializableHeaderValue = (value) => value !== undefined &&
1029
+ value !== null &&
1030
+ value !== "" &&
1031
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
1032
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
1033
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
1034
+ if (encoded.length) {
1035
+ return JSON.parse(encoded);
1036
+ }
1037
+ return {};
1038
+ });
1039
+ const parseErrorBody = async (errorBody, context) => {
1040
+ const value = await parseBody(errorBody, context);
1041
+ value.message = value.message ?? value.Message;
1042
+ return value;
1305
1043
  };
1306
- var parseErrorBody = function (errorBody, context) { return __awaiter(void 0, void 0, void 0, function () {
1307
- var value;
1308
- var _a;
1309
- return __generator(this, function (_b) {
1310
- switch (_b.label) {
1311
- case 0: return [4, parseBody(errorBody, context)];
1312
- case 1:
1313
- value = _b.sent();
1314
- value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
1315
- return [2, value];
1316
- }
1317
- });
1318
- }); };
1319
- var loadRestJsonErrorCode = function (output, data) {
1320
- var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
1321
- var sanitizeErrorCode = function (rawValue) {
1322
- var cleanValue = rawValue;
1044
+ const loadRestJsonErrorCode = (output, data) => {
1045
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
1046
+ const sanitizeErrorCode = (rawValue) => {
1047
+ let cleanValue = rawValue;
1323
1048
  if (typeof cleanValue === "number") {
1324
1049
  cleanValue = cleanValue.toString();
1325
1050
  }
@@ -1334,7 +1059,7 @@ var loadRestJsonErrorCode = function (output, data) {
1334
1059
  }
1335
1060
  return cleanValue;
1336
1061
  };
1337
- var headerKey = findKey(output.headers, "x-amzn-errortype");
1062
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
1338
1063
  if (headerKey !== undefined) {
1339
1064
  return sanitizeErrorCode(output.headers[headerKey]);
1340
1065
  }