@aws-sdk/client-polly 3.183.0 → 3.185.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,881 +1,1139 @@
1
+ import { __assign, __awaiter, __generator } from "tslib";
1
2
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
3
  import { decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, 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";
3
4
  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";
4
5
  import { PollyServiceException as __BaseException } from "../models/PollyServiceException";
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,
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
+ }
19
26
  });
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],
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
+ }
33
57
  });
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,
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
+ }
44
79
  });
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,
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
+ }
60
101
  });
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,
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
+ }
76
126
  });
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],
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
+ }
84
153
  });
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,
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
+ }
95
178
  });
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],
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
+ }
105
206
  });
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,
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
+ }
116
234
  });
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 }),
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
+ }
128
252
  });
129
- return new __HttpRequest({
130
- protocol,
131
- hostname,
132
- port,
133
- method: "PUT",
134
- headers,
135
- path: resolvedPath,
136
- body,
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
+ }
137
289
  });
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 }),
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
+ }
163
315
  });
164
- return new __HttpRequest({
165
- protocol,
166
- hostname,
167
- port,
168
- method: "POST",
169
- headers,
170
- path: resolvedPath,
171
- body,
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
+ }
172
352
  });
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 }),
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
+ }
195
378
  });
196
- return new __HttpRequest({
197
- protocol,
198
- hostname,
199
- port,
200
- method: "POST",
201
- headers,
202
- path: resolvedPath,
203
- body,
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
+ }
204
415
  });
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),
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
+ }
212
438
  });
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),
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
+ }
245
479
  });
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),
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
+ }
284
505
  });
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),
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
+ }
323
542
  });
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),
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
+ }
362
568
  });
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),
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
+ }
401
605
  });
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),
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
+ }
440
623
  });
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),
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
+ }
488
680
  });
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
- ],
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
+ }
559
703
  });
560
- const data = output.body;
561
- contents.AudioStream = data;
562
- return contents;
563
- };
564
- const deserializeAws_restJson1SynthesizeSpeechCommandError = async (output, context) => {
565
- const parsedOutput = {
566
- ...output,
567
- body: await parseErrorBody(output.body, context),
568
- };
569
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
570
- switch (errorCode) {
571
- case "EngineNotSupportedException":
572
- case "com.amazonaws.polly#EngineNotSupportedException":
573
- throw await deserializeAws_restJson1EngineNotSupportedExceptionResponse(parsedOutput, context);
574
- case "InvalidSampleRateException":
575
- case "com.amazonaws.polly#InvalidSampleRateException":
576
- throw await deserializeAws_restJson1InvalidSampleRateExceptionResponse(parsedOutput, context);
577
- case "InvalidSsmlException":
578
- case "com.amazonaws.polly#InvalidSsmlException":
579
- throw await deserializeAws_restJson1InvalidSsmlExceptionResponse(parsedOutput, context);
580
- case "LanguageNotSupportedException":
581
- case "com.amazonaws.polly#LanguageNotSupportedException":
582
- throw await deserializeAws_restJson1LanguageNotSupportedExceptionResponse(parsedOutput, context);
583
- case "LexiconNotFoundException":
584
- case "com.amazonaws.polly#LexiconNotFoundException":
585
- throw await deserializeAws_restJson1LexiconNotFoundExceptionResponse(parsedOutput, context);
586
- case "MarksNotSupportedForFormatException":
587
- case "com.amazonaws.polly#MarksNotSupportedForFormatException":
588
- throw await deserializeAws_restJson1MarksNotSupportedForFormatExceptionResponse(parsedOutput, context);
589
- case "ServiceFailureException":
590
- case "com.amazonaws.polly#ServiceFailureException":
591
- throw await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context);
592
- case "SsmlMarksNotSupportedForTextTypeException":
593
- case "com.amazonaws.polly#SsmlMarksNotSupportedForTextTypeException":
594
- throw await deserializeAws_restJson1SsmlMarksNotSupportedForTextTypeExceptionResponse(parsedOutput, context);
595
- case "TextLengthExceededException":
596
- case "com.amazonaws.polly#TextLengthExceededException":
597
- throw await deserializeAws_restJson1TextLengthExceededExceptionResponse(parsedOutput, context);
598
- default:
599
- const parsedBody = parsedOutput.body;
600
- throwDefaultError({
601
- output,
602
- parsedBody,
603
- exceptionCtor: __BaseException,
604
- errorCode,
605
- });
606
- }
607
- };
608
- const map = __map;
609
- const deserializeAws_restJson1EngineNotSupportedExceptionResponse = async (parsedOutput, context) => {
610
- const contents = map({});
611
- const data = parsedOutput.body;
612
- if (data.message != null) {
613
- contents.message = __expectString(data.message);
614
- }
615
- const exception = new EngineNotSupportedException({
616
- $metadata: deserializeMetadata(parsedOutput),
617
- ...contents,
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
+ }
618
780
  });
619
- return __decorateServiceException(exception, parsedOutput.body);
620
- };
621
- const deserializeAws_restJson1InvalidLexiconExceptionResponse = async (parsedOutput, context) => {
622
- const contents = map({});
623
- const data = parsedOutput.body;
624
- if (data.message != null) {
625
- contents.message = __expectString(data.message);
626
- }
627
- const exception = new InvalidLexiconException({
628
- $metadata: deserializeMetadata(parsedOutput),
629
- ...contents,
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];
630
799
  });
631
- return __decorateServiceException(exception, parsedOutput.body);
632
- };
633
- const deserializeAws_restJson1InvalidNextTokenExceptionResponse = async (parsedOutput, context) => {
634
- const contents = map({});
635
- const data = parsedOutput.body;
636
- if (data.message != null) {
637
- contents.message = __expectString(data.message);
638
- }
639
- const exception = new InvalidNextTokenException({
640
- $metadata: deserializeMetadata(parsedOutput),
641
- ...contents,
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
+ }
642
864
  });
643
- return __decorateServiceException(exception, parsedOutput.body);
644
- };
645
- const deserializeAws_restJson1InvalidS3BucketExceptionResponse = async (parsedOutput, context) => {
646
- const contents = map({});
647
- const data = parsedOutput.body;
648
- if (data.message != null) {
649
- contents.message = __expectString(data.message);
650
- }
651
- const exception = new InvalidS3BucketException({
652
- $metadata: deserializeMetadata(parsedOutput),
653
- ...contents,
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)];
654
877
  });
655
- return __decorateServiceException(exception, parsedOutput.body);
656
- };
657
- const deserializeAws_restJson1InvalidS3KeyExceptionResponse = async (parsedOutput, context) => {
658
- const contents = map({});
659
- const data = parsedOutput.body;
660
- if (data.message != null) {
661
- contents.message = __expectString(data.message);
662
- }
663
- const exception = new InvalidS3KeyException({
664
- $metadata: deserializeMetadata(parsedOutput),
665
- ...contents,
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)];
666
889
  });
667
- return __decorateServiceException(exception, parsedOutput.body);
668
- };
669
- const deserializeAws_restJson1InvalidSampleRateExceptionResponse = async (parsedOutput, context) => {
670
- const contents = map({});
671
- const data = parsedOutput.body;
672
- if (data.message != null) {
673
- contents.message = __expectString(data.message);
674
- }
675
- const exception = new InvalidSampleRateException({
676
- $metadata: deserializeMetadata(parsedOutput),
677
- ...contents,
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)];
678
901
  });
679
- return __decorateServiceException(exception, parsedOutput.body);
680
- };
681
- const deserializeAws_restJson1InvalidSnsTopicArnExceptionResponse = async (parsedOutput, context) => {
682
- const contents = map({});
683
- const data = parsedOutput.body;
684
- if (data.message != null) {
685
- contents.message = __expectString(data.message);
686
- }
687
- const exception = new InvalidSnsTopicArnException({
688
- $metadata: deserializeMetadata(parsedOutput),
689
- ...contents,
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)];
690
913
  });
691
- return __decorateServiceException(exception, parsedOutput.body);
692
- };
693
- const deserializeAws_restJson1InvalidSsmlExceptionResponse = async (parsedOutput, context) => {
694
- const contents = map({});
695
- const data = parsedOutput.body;
696
- if (data.message != null) {
697
- contents.message = __expectString(data.message);
698
- }
699
- const exception = new InvalidSsmlException({
700
- $metadata: deserializeMetadata(parsedOutput),
701
- ...contents,
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)];
702
925
  });
703
- return __decorateServiceException(exception, parsedOutput.body);
704
- };
705
- const deserializeAws_restJson1InvalidTaskIdExceptionResponse = async (parsedOutput, context) => {
706
- const contents = map({});
707
- const data = parsedOutput.body;
708
- if (data.message != null) {
709
- contents.message = __expectString(data.message);
710
- }
711
- const exception = new InvalidTaskIdException({
712
- $metadata: deserializeMetadata(parsedOutput),
713
- ...contents,
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)];
714
937
  });
715
- return __decorateServiceException(exception, parsedOutput.body);
716
- };
717
- const deserializeAws_restJson1LanguageNotSupportedExceptionResponse = async (parsedOutput, context) => {
718
- const contents = map({});
719
- const data = parsedOutput.body;
720
- if (data.message != null) {
721
- contents.message = __expectString(data.message);
722
- }
723
- const exception = new LanguageNotSupportedException({
724
- $metadata: deserializeMetadata(parsedOutput),
725
- ...contents,
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)];
726
949
  });
727
- return __decorateServiceException(exception, parsedOutput.body);
728
- };
729
- const deserializeAws_restJson1LexiconNotFoundExceptionResponse = async (parsedOutput, context) => {
730
- const contents = map({});
731
- const data = parsedOutput.body;
732
- if (data.message != null) {
733
- contents.message = __expectString(data.message);
734
- }
735
- const exception = new LexiconNotFoundException({
736
- $metadata: deserializeMetadata(parsedOutput),
737
- ...contents,
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)];
738
961
  });
739
- return __decorateServiceException(exception, parsedOutput.body);
740
- };
741
- const deserializeAws_restJson1LexiconSizeExceededExceptionResponse = async (parsedOutput, context) => {
742
- const contents = map({});
743
- const data = parsedOutput.body;
744
- if (data.message != null) {
745
- contents.message = __expectString(data.message);
746
- }
747
- const exception = new LexiconSizeExceededException({
748
- $metadata: deserializeMetadata(parsedOutput),
749
- ...contents,
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)];
750
973
  });
751
- return __decorateServiceException(exception, parsedOutput.body);
752
- };
753
- const deserializeAws_restJson1MarksNotSupportedForFormatExceptionResponse = async (parsedOutput, context) => {
754
- const contents = map({});
755
- const data = parsedOutput.body;
756
- if (data.message != null) {
757
- contents.message = __expectString(data.message);
758
- }
759
- const exception = new MarksNotSupportedForFormatException({
760
- $metadata: deserializeMetadata(parsedOutput),
761
- ...contents,
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)];
762
985
  });
763
- return __decorateServiceException(exception, parsedOutput.body);
764
- };
765
- const deserializeAws_restJson1MaxLexemeLengthExceededExceptionResponse = async (parsedOutput, context) => {
766
- const contents = map({});
767
- const data = parsedOutput.body;
768
- if (data.message != null) {
769
- contents.message = __expectString(data.message);
770
- }
771
- const exception = new MaxLexemeLengthExceededException({
772
- $metadata: deserializeMetadata(parsedOutput),
773
- ...contents,
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)];
774
997
  });
775
- return __decorateServiceException(exception, parsedOutput.body);
776
- };
777
- const deserializeAws_restJson1MaxLexiconsNumberExceededExceptionResponse = async (parsedOutput, context) => {
778
- const contents = map({});
779
- const data = parsedOutput.body;
780
- if (data.message != null) {
781
- contents.message = __expectString(data.message);
782
- }
783
- const exception = new MaxLexiconsNumberExceededException({
784
- $metadata: deserializeMetadata(parsedOutput),
785
- ...contents,
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)];
786
1009
  });
787
- return __decorateServiceException(exception, parsedOutput.body);
788
- };
789
- const deserializeAws_restJson1ServiceFailureExceptionResponse = async (parsedOutput, context) => {
790
- const contents = map({});
791
- const data = parsedOutput.body;
792
- if (data.message != null) {
793
- contents.message = __expectString(data.message);
794
- }
795
- const exception = new ServiceFailureException({
796
- $metadata: deserializeMetadata(parsedOutput),
797
- ...contents,
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)];
798
1021
  });
799
- return __decorateServiceException(exception, parsedOutput.body);
800
- };
801
- const deserializeAws_restJson1SsmlMarksNotSupportedForTextTypeExceptionResponse = async (parsedOutput, context) => {
802
- const contents = map({});
803
- const data = parsedOutput.body;
804
- if (data.message != null) {
805
- contents.message = __expectString(data.message);
806
- }
807
- const exception = new SsmlMarksNotSupportedForTextTypeException({
808
- $metadata: deserializeMetadata(parsedOutput),
809
- ...contents,
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)];
810
1033
  });
811
- return __decorateServiceException(exception, parsedOutput.body);
812
- };
813
- const deserializeAws_restJson1SynthesisTaskNotFoundExceptionResponse = async (parsedOutput, context) => {
814
- const contents = map({});
815
- const data = parsedOutput.body;
816
- if (data.message != null) {
817
- contents.message = __expectString(data.message);
818
- }
819
- const exception = new SynthesisTaskNotFoundException({
820
- $metadata: deserializeMetadata(parsedOutput),
821
- ...contents,
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)];
822
1045
  });
823
- return __decorateServiceException(exception, parsedOutput.body);
824
- };
825
- const deserializeAws_restJson1TextLengthExceededExceptionResponse = async (parsedOutput, context) => {
826
- const contents = map({});
827
- const data = parsedOutput.body;
828
- if (data.message != null) {
829
- contents.message = __expectString(data.message);
830
- }
831
- const exception = new TextLengthExceededException({
832
- $metadata: deserializeMetadata(parsedOutput),
833
- ...contents,
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)];
834
1057
  });
835
- return __decorateServiceException(exception, parsedOutput.body);
836
- };
837
- const deserializeAws_restJson1UnsupportedPlsAlphabetExceptionResponse = async (parsedOutput, context) => {
838
- const contents = map({});
839
- const data = parsedOutput.body;
840
- if (data.message != null) {
841
- contents.message = __expectString(data.message);
842
- }
843
- const exception = new UnsupportedPlsAlphabetException({
844
- $metadata: deserializeMetadata(parsedOutput),
845
- ...contents,
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)];
846
1069
  });
847
- return __decorateServiceException(exception, parsedOutput.body);
848
- };
849
- const deserializeAws_restJson1UnsupportedPlsLanguageExceptionResponse = async (parsedOutput, context) => {
850
- const contents = map({});
851
- const data = parsedOutput.body;
852
- if (data.message != null) {
853
- contents.message = __expectString(data.message);
854
- }
855
- const exception = new UnsupportedPlsLanguageException({
856
- $metadata: deserializeMetadata(parsedOutput),
857
- ...contents,
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)];
858
1081
  });
859
- return __decorateServiceException(exception, parsedOutput.body);
860
- };
861
- const serializeAws_restJson1LexiconNameList = (input, context) => {
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)];
1093
+ });
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)];
1105
+ });
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)];
1117
+ });
1118
+ }); };
1119
+ var serializeAws_restJson1LexiconNameList = function (input, context) {
862
1120
  return input
863
- .filter((e) => e != null)
864
- .map((entry) => {
1121
+ .filter(function (e) { return e != null; })
1122
+ .map(function (entry) {
865
1123
  return entry;
866
1124
  });
867
1125
  };
868
- const serializeAws_restJson1SpeechMarkTypeList = (input, context) => {
1126
+ var serializeAws_restJson1SpeechMarkTypeList = function (input, context) {
869
1127
  return input
870
- .filter((e) => e != null)
871
- .map((entry) => {
1128
+ .filter(function (e) { return e != null; })
1129
+ .map(function (entry) {
872
1130
  return entry;
873
1131
  });
874
1132
  };
875
- const deserializeAws_restJson1EngineList = (output, context) => {
876
- const retVal = (output || [])
877
- .filter((e) => e != null)
878
- .map((entry) => {
1133
+ var deserializeAws_restJson1EngineList = function (output, context) {
1134
+ var retVal = (output || [])
1135
+ .filter(function (e) { return e != null; })
1136
+ .map(function (entry) {
879
1137
  if (entry === null) {
880
1138
  return null;
881
1139
  }
@@ -883,10 +1141,10 @@ const deserializeAws_restJson1EngineList = (output, context) => {
883
1141
  });
884
1142
  return retVal;
885
1143
  };
886
- const deserializeAws_restJson1LanguageCodeList = (output, context) => {
887
- const retVal = (output || [])
888
- .filter((e) => e != null)
889
- .map((entry) => {
1144
+ var deserializeAws_restJson1LanguageCodeList = function (output, context) {
1145
+ var retVal = (output || [])
1146
+ .filter(function (e) { return e != null; })
1147
+ .map(function (entry) {
890
1148
  if (entry === null) {
891
1149
  return null;
892
1150
  }
@@ -894,13 +1152,13 @@ const deserializeAws_restJson1LanguageCodeList = (output, context) => {
894
1152
  });
895
1153
  return retVal;
896
1154
  };
897
- const deserializeAws_restJson1Lexicon = (output, context) => {
1155
+ var deserializeAws_restJson1Lexicon = function (output, context) {
898
1156
  return {
899
1157
  Content: __expectString(output.Content),
900
1158
  Name: __expectString(output.Name),
901
1159
  };
902
1160
  };
903
- const deserializeAws_restJson1LexiconAttributes = (output, context) => {
1161
+ var deserializeAws_restJson1LexiconAttributes = function (output, context) {
904
1162
  return {
905
1163
  Alphabet: __expectString(output.Alphabet),
906
1164
  LanguageCode: __expectString(output.LanguageCode),
@@ -912,16 +1170,16 @@ const deserializeAws_restJson1LexiconAttributes = (output, context) => {
912
1170
  Size: __expectInt32(output.Size),
913
1171
  };
914
1172
  };
915
- const deserializeAws_restJson1LexiconDescription = (output, context) => {
1173
+ var deserializeAws_restJson1LexiconDescription = function (output, context) {
916
1174
  return {
917
1175
  Attributes: output.Attributes != null ? deserializeAws_restJson1LexiconAttributes(output.Attributes, context) : undefined,
918
1176
  Name: __expectString(output.Name),
919
1177
  };
920
1178
  };
921
- const deserializeAws_restJson1LexiconDescriptionList = (output, context) => {
922
- const retVal = (output || [])
923
- .filter((e) => e != null)
924
- .map((entry) => {
1179
+ var deserializeAws_restJson1LexiconDescriptionList = function (output, context) {
1180
+ var retVal = (output || [])
1181
+ .filter(function (e) { return e != null; })
1182
+ .map(function (entry) {
925
1183
  if (entry === null) {
926
1184
  return null;
927
1185
  }
@@ -929,10 +1187,10 @@ const deserializeAws_restJson1LexiconDescriptionList = (output, context) => {
929
1187
  });
930
1188
  return retVal;
931
1189
  };
932
- const deserializeAws_restJson1LexiconNameList = (output, context) => {
933
- const retVal = (output || [])
934
- .filter((e) => e != null)
935
- .map((entry) => {
1190
+ var deserializeAws_restJson1LexiconNameList = function (output, context) {
1191
+ var retVal = (output || [])
1192
+ .filter(function (e) { return e != null; })
1193
+ .map(function (entry) {
936
1194
  if (entry === null) {
937
1195
  return null;
938
1196
  }
@@ -940,10 +1198,10 @@ const deserializeAws_restJson1LexiconNameList = (output, context) => {
940
1198
  });
941
1199
  return retVal;
942
1200
  };
943
- const deserializeAws_restJson1SpeechMarkTypeList = (output, context) => {
944
- const retVal = (output || [])
945
- .filter((e) => e != null)
946
- .map((entry) => {
1201
+ var deserializeAws_restJson1SpeechMarkTypeList = function (output, context) {
1202
+ var retVal = (output || [])
1203
+ .filter(function (e) { return e != null; })
1204
+ .map(function (entry) {
947
1205
  if (entry === null) {
948
1206
  return null;
949
1207
  }
@@ -951,7 +1209,7 @@ const deserializeAws_restJson1SpeechMarkTypeList = (output, context) => {
951
1209
  });
952
1210
  return retVal;
953
1211
  };
954
- const deserializeAws_restJson1SynthesisTask = (output, context) => {
1212
+ var deserializeAws_restJson1SynthesisTask = function (output, context) {
955
1213
  return {
956
1214
  CreationTime: output.CreationTime != null
957
1215
  ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.CreationTime)))
@@ -974,10 +1232,10 @@ const deserializeAws_restJson1SynthesisTask = (output, context) => {
974
1232
  VoiceId: __expectString(output.VoiceId),
975
1233
  };
976
1234
  };
977
- const deserializeAws_restJson1SynthesisTasks = (output, context) => {
978
- const retVal = (output || [])
979
- .filter((e) => e != null)
980
- .map((entry) => {
1235
+ var deserializeAws_restJson1SynthesisTasks = function (output, context) {
1236
+ var retVal = (output || [])
1237
+ .filter(function (e) { return e != null; })
1238
+ .map(function (entry) {
981
1239
  if (entry === null) {
982
1240
  return null;
983
1241
  }
@@ -985,7 +1243,7 @@ const deserializeAws_restJson1SynthesisTasks = (output, context) => {
985
1243
  });
986
1244
  return retVal;
987
1245
  };
988
- const deserializeAws_restJson1Voice = (output, context) => {
1246
+ var deserializeAws_restJson1Voice = function (output, context) {
989
1247
  return {
990
1248
  AdditionalLanguageCodes: output.AdditionalLanguageCodes != null
991
1249
  ? deserializeAws_restJson1LanguageCodeList(output.AdditionalLanguageCodes, context)
@@ -1000,10 +1258,10 @@ const deserializeAws_restJson1Voice = (output, context) => {
1000
1258
  : undefined,
1001
1259
  };
1002
1260
  };
1003
- const deserializeAws_restJson1VoiceList = (output, context) => {
1004
- const retVal = (output || [])
1005
- .filter((e) => e != null)
1006
- .map((entry) => {
1261
+ var deserializeAws_restJson1VoiceList = function (output, context) {
1262
+ var retVal = (output || [])
1263
+ .filter(function (e) { return e != null; })
1264
+ .map(function (entry) {
1007
1265
  if (entry === null) {
1008
1266
  return null;
1009
1267
  }
@@ -1011,39 +1269,57 @@ const deserializeAws_restJson1VoiceList = (output, context) => {
1011
1269
  });
1012
1270
  return retVal;
1013
1271
  };
1014
- const deserializeMetadata = (output) => ({
1015
- httpStatusCode: output.statusCode,
1016
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
1017
- extendedRequestId: output.headers["x-amz-id-2"],
1018
- cfId: output.headers["x-amz-cf-id"],
1019
- });
1020
- const collectBody = (streamBody = new Uint8Array(), context) => {
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(); }
1021
1283
  if (streamBody instanceof Uint8Array) {
1022
1284
  return Promise.resolve(streamBody);
1023
1285
  }
1024
1286
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
1025
1287
  };
1026
- const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
1027
- const isSerializableHeaderValue = (value) => value !== undefined &&
1028
- value !== null &&
1029
- value !== "" &&
1030
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
1031
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
1032
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
1033
- if (encoded.length) {
1034
- return JSON.parse(encoded);
1035
- }
1036
- return {};
1037
- });
1038
- const parseErrorBody = async (errorBody, context) => {
1039
- const value = await parseBody(errorBody, context);
1040
- value.message = value.message ?? value.Message;
1041
- return value;
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);
1042
1297
  };
1043
- const loadRestJsonErrorCode = (output, data) => {
1044
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
1045
- const sanitizeErrorCode = (rawValue) => {
1046
- let cleanValue = rawValue;
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
+ });
1305
+ };
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;
1047
1323
  if (typeof cleanValue === "number") {
1048
1324
  cleanValue = cleanValue.toString();
1049
1325
  }
@@ -1058,7 +1334,7 @@ const loadRestJsonErrorCode = (output, data) => {
1058
1334
  }
1059
1335
  return cleanValue;
1060
1336
  };
1061
- const headerKey = findKey(output.headers, "x-amzn-errortype");
1337
+ var headerKey = findKey(output.headers, "x-amzn-errortype");
1062
1338
  if (headerKey !== undefined) {
1063
1339
  return sanitizeErrorCode(output.headers[headerKey]);
1064
1340
  }