@aws-sdk/client-polly 3.35.0 → 3.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist-cjs/Polly.js +0 -9
  3. package/dist-cjs/PollyClient.js +0 -14
  4. package/dist-cjs/commands/DeleteLexiconCommand.js +0 -28
  5. package/dist-cjs/commands/DescribeVoicesCommand.js +0 -43
  6. package/dist-cjs/commands/GetLexiconCommand.js +0 -26
  7. package/dist-cjs/commands/GetSpeechSynthesisTaskCommand.js +0 -28
  8. package/dist-cjs/commands/ListLexiconsCommand.js +0 -25
  9. package/dist-cjs/commands/ListSpeechSynthesisTasksCommand.js +0 -27
  10. package/dist-cjs/commands/PutLexiconCommand.js +0 -30
  11. package/dist-cjs/commands/StartSpeechSynthesisTaskCommand.js +0 -34
  12. package/dist-cjs/commands/SynthesizeSpeechCommand.js +0 -29
  13. package/dist-cjs/commands/index.js +12 -0
  14. package/dist-cjs/endpoints.js +1 -2
  15. package/dist-cjs/index.js +4 -14
  16. package/dist-cjs/models/index.js +0 -1
  17. package/dist-cjs/models/models_0.js +0 -133
  18. package/dist-cjs/pagination/Interfaces.js +0 -1
  19. package/dist-cjs/pagination/ListSpeechSynthesisTasksPaginator.js +0 -11
  20. package/dist-cjs/pagination/index.js +5 -0
  21. package/dist-cjs/protocols/Aws_restJson1.js +0 -6
  22. package/dist-cjs/runtimeConfig.browser.js +1 -6
  23. package/dist-cjs/runtimeConfig.js +2 -7
  24. package/dist-cjs/runtimeConfig.native.js +0 -4
  25. package/dist-cjs/runtimeConfig.shared.js +0 -4
  26. package/dist-es/Polly.js +0 -1
  27. package/dist-es/PollyClient.js +0 -1
  28. package/dist-es/commands/DeleteLexiconCommand.js +0 -1
  29. package/dist-es/commands/DescribeVoicesCommand.js +0 -1
  30. package/dist-es/commands/GetLexiconCommand.js +0 -1
  31. package/dist-es/commands/GetSpeechSynthesisTaskCommand.js +0 -1
  32. package/dist-es/commands/ListLexiconsCommand.js +0 -1
  33. package/dist-es/commands/ListSpeechSynthesisTasksCommand.js +0 -1
  34. package/dist-es/commands/PutLexiconCommand.js +0 -1
  35. package/dist-es/commands/StartSpeechSynthesisTaskCommand.js +0 -1
  36. package/dist-es/commands/SynthesizeSpeechCommand.js +0 -1
  37. package/dist-es/commands/index.js +9 -0
  38. package/dist-es/endpoints.js +1 -2
  39. package/dist-es/index.js +4 -14
  40. package/dist-es/models/index.js +0 -1
  41. package/dist-es/models/models_0.js +0 -1
  42. package/dist-es/pagination/Interfaces.js +0 -1
  43. package/dist-es/pagination/ListSpeechSynthesisTasksPaginator.js +0 -1
  44. package/dist-es/pagination/index.js +2 -0
  45. package/dist-es/protocols/Aws_restJson1.js +0 -1
  46. package/dist-es/runtimeConfig.browser.js +1 -2
  47. package/dist-es/runtimeConfig.js +2 -3
  48. package/dist-es/runtimeConfig.native.js +0 -1
  49. package/dist-es/runtimeConfig.shared.js +0 -1
  50. package/dist-types/commands/index.d.ts +9 -0
  51. package/dist-types/index.d.ts +4 -13
  52. package/dist-types/pagination/index.d.ts +2 -0
  53. package/dist-types/ts3.4/Polly.d.ts +10 -80
  54. package/dist-types/ts3.4/PollyClient.d.ts +24 -94
  55. package/dist-types/ts3.4/commands/DeleteLexiconCommand.d.ts +2 -23
  56. package/dist-types/ts3.4/commands/DescribeVoicesCommand.d.ts +2 -38
  57. package/dist-types/ts3.4/commands/GetLexiconCommand.d.ts +2 -21
  58. package/dist-types/ts3.4/commands/GetSpeechSynthesisTaskCommand.d.ts +2 -23
  59. package/dist-types/ts3.4/commands/ListLexiconsCommand.d.ts +2 -20
  60. package/dist-types/ts3.4/commands/ListSpeechSynthesisTasksCommand.d.ts +2 -22
  61. package/dist-types/ts3.4/commands/PutLexiconCommand.d.ts +2 -25
  62. package/dist-types/ts3.4/commands/StartSpeechSynthesisTaskCommand.d.ts +2 -29
  63. package/dist-types/ts3.4/commands/SynthesizeSpeechCommand.d.ts +2 -24
  64. package/dist-types/ts3.4/commands/index.d.ts +9 -0
  65. package/dist-types/ts3.4/index.d.ts +4 -13
  66. package/dist-types/ts3.4/models/models_0.d.ts +150 -642
  67. package/dist-types/ts3.4/pagination/index.d.ts +2 -0
  68. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -3
  69. package/dist-types/ts3.4/runtimeConfig.d.ts +1 -3
  70. package/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -3
  71. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +1 -3
  72. package/package.json +33 -30
  73. package/dist-cjs/Polly.js.map +0 -1
  74. package/dist-cjs/PollyClient.js.map +0 -1
  75. package/dist-cjs/commands/DeleteLexiconCommand.js.map +0 -1
  76. package/dist-cjs/commands/DescribeVoicesCommand.js.map +0 -1
  77. package/dist-cjs/commands/GetLexiconCommand.js.map +0 -1
  78. package/dist-cjs/commands/GetSpeechSynthesisTaskCommand.js.map +0 -1
  79. package/dist-cjs/commands/ListLexiconsCommand.js.map +0 -1
  80. package/dist-cjs/commands/ListSpeechSynthesisTasksCommand.js.map +0 -1
  81. package/dist-cjs/commands/PutLexiconCommand.js.map +0 -1
  82. package/dist-cjs/commands/StartSpeechSynthesisTaskCommand.js.map +0 -1
  83. package/dist-cjs/commands/SynthesizeSpeechCommand.js.map +0 -1
  84. package/dist-cjs/endpoints.js.map +0 -1
  85. package/dist-cjs/index.js.map +0 -1
  86. package/dist-cjs/models/index.js.map +0 -1
  87. package/dist-cjs/models/models_0.js.map +0 -1
  88. package/dist-cjs/pagination/Interfaces.js.map +0 -1
  89. package/dist-cjs/pagination/ListSpeechSynthesisTasksPaginator.js.map +0 -1
  90. package/dist-cjs/protocols/Aws_restJson1.js.map +0 -1
  91. package/dist-cjs/runtimeConfig.browser.js.map +0 -1
  92. package/dist-cjs/runtimeConfig.js.map +0 -1
  93. package/dist-cjs/runtimeConfig.native.js.map +0 -1
  94. package/dist-cjs/runtimeConfig.shared.js.map +0 -1
  95. package/dist-es/Polly.js.map +0 -1
  96. package/dist-es/PollyClient.js.map +0 -1
  97. package/dist-es/commands/DeleteLexiconCommand.js.map +0 -1
  98. package/dist-es/commands/DescribeVoicesCommand.js.map +0 -1
  99. package/dist-es/commands/GetLexiconCommand.js.map +0 -1
  100. package/dist-es/commands/GetSpeechSynthesisTaskCommand.js.map +0 -1
  101. package/dist-es/commands/ListLexiconsCommand.js.map +0 -1
  102. package/dist-es/commands/ListSpeechSynthesisTasksCommand.js.map +0 -1
  103. package/dist-es/commands/PutLexiconCommand.js.map +0 -1
  104. package/dist-es/commands/StartSpeechSynthesisTaskCommand.js.map +0 -1
  105. package/dist-es/commands/SynthesizeSpeechCommand.js.map +0 -1
  106. package/dist-es/endpoints.js.map +0 -1
  107. package/dist-es/index.js.map +0 -1
  108. package/dist-es/models/index.js.map +0 -1
  109. package/dist-es/models/models_0.js.map +0 -1
  110. package/dist-es/pagination/Interfaces.js.map +0 -1
  111. package/dist-es/pagination/ListSpeechSynthesisTasksPaginator.js.map +0 -1
  112. package/dist-es/protocols/Aws_restJson1.js.map +0 -1
  113. package/dist-es/runtimeConfig.browser.js.map +0 -1
  114. package/dist-es/runtimeConfig.js.map +0 -1
  115. package/dist-es/runtimeConfig.native.js.map +0 -1
  116. package/dist-es/runtimeConfig.shared.js.map +0 -1
  117. package/jest.config.js +0 -4
  118. package/src/Polly.ts +0 -368
  119. package/src/PollyClient.ts +0 -277
  120. package/src/commands/DeleteLexiconCommand.ts +0 -98
  121. package/src/commands/DescribeVoicesCommand.ts +0 -113
  122. package/src/commands/GetLexiconCommand.ts +0 -96
  123. package/src/commands/GetSpeechSynthesisTaskCommand.ts +0 -98
  124. package/src/commands/ListLexiconsCommand.ts +0 -95
  125. package/src/commands/ListSpeechSynthesisTasksCommand.ts +0 -97
  126. package/src/commands/PutLexiconCommand.ts +0 -100
  127. package/src/commands/StartSpeechSynthesisTaskCommand.ts +0 -104
  128. package/src/commands/SynthesizeSpeechCommand.ts +0 -99
  129. package/src/endpoints.ts +0 -82
  130. package/src/index.ts +0 -14
  131. package/src/models/index.ts +0 -1
  132. package/src/models/models_0.ts +0 -1374
  133. package/src/pagination/Interfaces.ts +0 -8
  134. package/src/pagination/ListSpeechSynthesisTasksPaginator.ts +0 -59
  135. package/src/protocols/Aws_restJson1.ts +0 -1712
  136. package/src/runtimeConfig.browser.ts +0 -41
  137. package/src/runtimeConfig.native.ts +0 -17
  138. package/src/runtimeConfig.shared.ts +0 -17
  139. package/src/runtimeConfig.ts +0 -46
  140. package/tsconfig.es.json +0 -10
  141. package/tsconfig.json +0 -33
  142. package/tsconfig.types.json +0 -9
@@ -1,1712 +0,0 @@
1
- import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
2
- import {
3
- expectInt32 as __expectInt32,
4
- expectNonNull as __expectNonNull,
5
- expectNumber as __expectNumber,
6
- expectObject as __expectObject,
7
- expectString as __expectString,
8
- extendedEncodeURIComponent as __extendedEncodeURIComponent,
9
- parseEpochTimestamp as __parseEpochTimestamp,
10
- strictParseInt32 as __strictParseInt32,
11
- } from "@aws-sdk/smithy-client";
12
- import {
13
- Endpoint as __Endpoint,
14
- MetadataBearer as __MetadataBearer,
15
- ResponseMetadata as __ResponseMetadata,
16
- SerdeContext as __SerdeContext,
17
- SmithyException as __SmithyException,
18
- } from "@aws-sdk/types";
19
-
20
- import { DeleteLexiconCommandInput, DeleteLexiconCommandOutput } from "../commands/DeleteLexiconCommand";
21
- import { DescribeVoicesCommandInput, DescribeVoicesCommandOutput } from "../commands/DescribeVoicesCommand";
22
- import { GetLexiconCommandInput, GetLexiconCommandOutput } from "../commands/GetLexiconCommand";
23
- import {
24
- GetSpeechSynthesisTaskCommandInput,
25
- GetSpeechSynthesisTaskCommandOutput,
26
- } from "../commands/GetSpeechSynthesisTaskCommand";
27
- import { ListLexiconsCommandInput, ListLexiconsCommandOutput } from "../commands/ListLexiconsCommand";
28
- import {
29
- ListSpeechSynthesisTasksCommandInput,
30
- ListSpeechSynthesisTasksCommandOutput,
31
- } from "../commands/ListSpeechSynthesisTasksCommand";
32
- import { PutLexiconCommandInput, PutLexiconCommandOutput } from "../commands/PutLexiconCommand";
33
- import {
34
- StartSpeechSynthesisTaskCommandInput,
35
- StartSpeechSynthesisTaskCommandOutput,
36
- } from "../commands/StartSpeechSynthesisTaskCommand";
37
- import { SynthesizeSpeechCommandInput, SynthesizeSpeechCommandOutput } from "../commands/SynthesizeSpeechCommand";
38
- import {
39
- Engine,
40
- EngineNotSupportedException,
41
- InvalidLexiconException,
42
- InvalidNextTokenException,
43
- InvalidS3BucketException,
44
- InvalidS3KeyException,
45
- InvalidSampleRateException,
46
- InvalidSnsTopicArnException,
47
- InvalidSsmlException,
48
- InvalidTaskIdException,
49
- LanguageCode,
50
- LanguageNotSupportedException,
51
- Lexicon,
52
- LexiconAttributes,
53
- LexiconDescription,
54
- LexiconNotFoundException,
55
- LexiconSizeExceededException,
56
- MarksNotSupportedForFormatException,
57
- MaxLexemeLengthExceededException,
58
- MaxLexiconsNumberExceededException,
59
- ServiceFailureException,
60
- SpeechMarkType,
61
- SsmlMarksNotSupportedForTextTypeException,
62
- SynthesisTask,
63
- SynthesisTaskNotFoundException,
64
- TextLengthExceededException,
65
- UnsupportedPlsAlphabetException,
66
- UnsupportedPlsLanguageException,
67
- Voice,
68
- } from "../models/models_0";
69
-
70
- export const serializeAws_restJson1DeleteLexiconCommand = async (
71
- input: DeleteLexiconCommandInput,
72
- context: __SerdeContext
73
- ): Promise<__HttpRequest> => {
74
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
75
- const headers: any = {};
76
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/lexicons/{Name}";
77
- if (input.Name !== undefined) {
78
- const labelValue: string = input.Name;
79
- if (labelValue.length <= 0) {
80
- throw new Error("Empty value provided for input HTTP label: Name.");
81
- }
82
- resolvedPath = resolvedPath.replace("{Name}", __extendedEncodeURIComponent(labelValue));
83
- } else {
84
- throw new Error("No value provided for input HTTP label: Name.");
85
- }
86
- let body: any;
87
- return new __HttpRequest({
88
- protocol,
89
- hostname,
90
- port,
91
- method: "DELETE",
92
- headers,
93
- path: resolvedPath,
94
- body,
95
- });
96
- };
97
-
98
- export const serializeAws_restJson1DescribeVoicesCommand = async (
99
- input: DescribeVoicesCommandInput,
100
- context: __SerdeContext
101
- ): Promise<__HttpRequest> => {
102
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
103
- const headers: any = {};
104
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/voices";
105
- const query: any = {
106
- ...(input.Engine !== undefined && { Engine: input.Engine }),
107
- ...(input.LanguageCode !== undefined && { LanguageCode: input.LanguageCode }),
108
- ...(input.IncludeAdditionalLanguageCodes !== undefined && {
109
- IncludeAdditionalLanguageCodes: input.IncludeAdditionalLanguageCodes.toString(),
110
- }),
111
- ...(input.NextToken !== undefined && { NextToken: input.NextToken }),
112
- };
113
- let body: any;
114
- return new __HttpRequest({
115
- protocol,
116
- hostname,
117
- port,
118
- method: "GET",
119
- headers,
120
- path: resolvedPath,
121
- query,
122
- body,
123
- });
124
- };
125
-
126
- export const serializeAws_restJson1GetLexiconCommand = async (
127
- input: GetLexiconCommandInput,
128
- context: __SerdeContext
129
- ): Promise<__HttpRequest> => {
130
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
131
- const headers: any = {};
132
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/lexicons/{Name}";
133
- if (input.Name !== undefined) {
134
- const labelValue: string = input.Name;
135
- if (labelValue.length <= 0) {
136
- throw new Error("Empty value provided for input HTTP label: Name.");
137
- }
138
- resolvedPath = resolvedPath.replace("{Name}", __extendedEncodeURIComponent(labelValue));
139
- } else {
140
- throw new Error("No value provided for input HTTP label: Name.");
141
- }
142
- let body: any;
143
- return new __HttpRequest({
144
- protocol,
145
- hostname,
146
- port,
147
- method: "GET",
148
- headers,
149
- path: resolvedPath,
150
- body,
151
- });
152
- };
153
-
154
- export const serializeAws_restJson1GetSpeechSynthesisTaskCommand = async (
155
- input: GetSpeechSynthesisTaskCommandInput,
156
- context: __SerdeContext
157
- ): Promise<__HttpRequest> => {
158
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
159
- const headers: any = {};
160
- let resolvedPath =
161
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/synthesisTasks/{TaskId}";
162
- if (input.TaskId !== undefined) {
163
- const labelValue: string = input.TaskId;
164
- if (labelValue.length <= 0) {
165
- throw new Error("Empty value provided for input HTTP label: TaskId.");
166
- }
167
- resolvedPath = resolvedPath.replace("{TaskId}", __extendedEncodeURIComponent(labelValue));
168
- } else {
169
- throw new Error("No value provided for input HTTP label: TaskId.");
170
- }
171
- let body: any;
172
- return new __HttpRequest({
173
- protocol,
174
- hostname,
175
- port,
176
- method: "GET",
177
- headers,
178
- path: resolvedPath,
179
- body,
180
- });
181
- };
182
-
183
- export const serializeAws_restJson1ListLexiconsCommand = async (
184
- input: ListLexiconsCommandInput,
185
- context: __SerdeContext
186
- ): Promise<__HttpRequest> => {
187
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
188
- const headers: any = {};
189
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/lexicons";
190
- const query: any = {
191
- ...(input.NextToken !== undefined && { NextToken: input.NextToken }),
192
- };
193
- let body: any;
194
- return new __HttpRequest({
195
- protocol,
196
- hostname,
197
- port,
198
- method: "GET",
199
- headers,
200
- path: resolvedPath,
201
- query,
202
- body,
203
- });
204
- };
205
-
206
- export const serializeAws_restJson1ListSpeechSynthesisTasksCommand = async (
207
- input: ListSpeechSynthesisTasksCommandInput,
208
- context: __SerdeContext
209
- ): Promise<__HttpRequest> => {
210
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
211
- const headers: any = {};
212
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/synthesisTasks";
213
- const query: any = {
214
- ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }),
215
- ...(input.NextToken !== undefined && { NextToken: input.NextToken }),
216
- ...(input.Status !== undefined && { Status: input.Status }),
217
- };
218
- let body: any;
219
- return new __HttpRequest({
220
- protocol,
221
- hostname,
222
- port,
223
- method: "GET",
224
- headers,
225
- path: resolvedPath,
226
- query,
227
- body,
228
- });
229
- };
230
-
231
- export const serializeAws_restJson1PutLexiconCommand = async (
232
- input: PutLexiconCommandInput,
233
- context: __SerdeContext
234
- ): Promise<__HttpRequest> => {
235
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
236
- const headers: any = {
237
- "content-type": "application/json",
238
- };
239
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/lexicons/{Name}";
240
- if (input.Name !== undefined) {
241
- const labelValue: string = input.Name;
242
- if (labelValue.length <= 0) {
243
- throw new Error("Empty value provided for input HTTP label: Name.");
244
- }
245
- resolvedPath = resolvedPath.replace("{Name}", __extendedEncodeURIComponent(labelValue));
246
- } else {
247
- throw new Error("No value provided for input HTTP label: Name.");
248
- }
249
- let body: any;
250
- body = JSON.stringify({
251
- ...(input.Content !== undefined && input.Content !== null && { Content: input.Content }),
252
- });
253
- return new __HttpRequest({
254
- protocol,
255
- hostname,
256
- port,
257
- method: "PUT",
258
- headers,
259
- path: resolvedPath,
260
- body,
261
- });
262
- };
263
-
264
- export const serializeAws_restJson1StartSpeechSynthesisTaskCommand = async (
265
- input: StartSpeechSynthesisTaskCommandInput,
266
- context: __SerdeContext
267
- ): Promise<__HttpRequest> => {
268
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
269
- const headers: any = {
270
- "content-type": "application/json",
271
- };
272
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/synthesisTasks";
273
- let body: any;
274
- body = JSON.stringify({
275
- ...(input.Engine !== undefined && input.Engine !== null && { Engine: input.Engine }),
276
- ...(input.LanguageCode !== undefined && input.LanguageCode !== null && { LanguageCode: input.LanguageCode }),
277
- ...(input.LexiconNames !== undefined &&
278
- input.LexiconNames !== null && {
279
- LexiconNames: serializeAws_restJson1LexiconNameList(input.LexiconNames, context),
280
- }),
281
- ...(input.OutputFormat !== undefined && input.OutputFormat !== null && { OutputFormat: input.OutputFormat }),
282
- ...(input.OutputS3BucketName !== undefined &&
283
- input.OutputS3BucketName !== null && { OutputS3BucketName: input.OutputS3BucketName }),
284
- ...(input.OutputS3KeyPrefix !== undefined &&
285
- input.OutputS3KeyPrefix !== null && { OutputS3KeyPrefix: input.OutputS3KeyPrefix }),
286
- ...(input.SampleRate !== undefined && input.SampleRate !== null && { SampleRate: input.SampleRate }),
287
- ...(input.SnsTopicArn !== undefined && input.SnsTopicArn !== null && { SnsTopicArn: input.SnsTopicArn }),
288
- ...(input.SpeechMarkTypes !== undefined &&
289
- input.SpeechMarkTypes !== null && {
290
- SpeechMarkTypes: serializeAws_restJson1SpeechMarkTypeList(input.SpeechMarkTypes, context),
291
- }),
292
- ...(input.Text !== undefined && input.Text !== null && { Text: input.Text }),
293
- ...(input.TextType !== undefined && input.TextType !== null && { TextType: input.TextType }),
294
- ...(input.VoiceId !== undefined && input.VoiceId !== null && { VoiceId: input.VoiceId }),
295
- });
296
- return new __HttpRequest({
297
- protocol,
298
- hostname,
299
- port,
300
- method: "POST",
301
- headers,
302
- path: resolvedPath,
303
- body,
304
- });
305
- };
306
-
307
- export const serializeAws_restJson1SynthesizeSpeechCommand = async (
308
- input: SynthesizeSpeechCommandInput,
309
- context: __SerdeContext
310
- ): Promise<__HttpRequest> => {
311
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
312
- const headers: any = {
313
- "content-type": "application/json",
314
- };
315
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/speech";
316
- let body: any;
317
- body = JSON.stringify({
318
- ...(input.Engine !== undefined && input.Engine !== null && { Engine: input.Engine }),
319
- ...(input.LanguageCode !== undefined && input.LanguageCode !== null && { LanguageCode: input.LanguageCode }),
320
- ...(input.LexiconNames !== undefined &&
321
- input.LexiconNames !== null && {
322
- LexiconNames: serializeAws_restJson1LexiconNameList(input.LexiconNames, context),
323
- }),
324
- ...(input.OutputFormat !== undefined && input.OutputFormat !== null && { OutputFormat: input.OutputFormat }),
325
- ...(input.SampleRate !== undefined && input.SampleRate !== null && { SampleRate: input.SampleRate }),
326
- ...(input.SpeechMarkTypes !== undefined &&
327
- input.SpeechMarkTypes !== null && {
328
- SpeechMarkTypes: serializeAws_restJson1SpeechMarkTypeList(input.SpeechMarkTypes, context),
329
- }),
330
- ...(input.Text !== undefined && input.Text !== null && { Text: input.Text }),
331
- ...(input.TextType !== undefined && input.TextType !== null && { TextType: input.TextType }),
332
- ...(input.VoiceId !== undefined && input.VoiceId !== null && { VoiceId: input.VoiceId }),
333
- });
334
- return new __HttpRequest({
335
- protocol,
336
- hostname,
337
- port,
338
- method: "POST",
339
- headers,
340
- path: resolvedPath,
341
- body,
342
- });
343
- };
344
-
345
- export const deserializeAws_restJson1DeleteLexiconCommand = async (
346
- output: __HttpResponse,
347
- context: __SerdeContext
348
- ): Promise<DeleteLexiconCommandOutput> => {
349
- if (output.statusCode !== 200 && output.statusCode >= 300) {
350
- return deserializeAws_restJson1DeleteLexiconCommandError(output, context);
351
- }
352
- const contents: DeleteLexiconCommandOutput = {
353
- $metadata: deserializeMetadata(output),
354
- };
355
- await collectBody(output.body, context);
356
- return Promise.resolve(contents);
357
- };
358
-
359
- const deserializeAws_restJson1DeleteLexiconCommandError = async (
360
- output: __HttpResponse,
361
- context: __SerdeContext
362
- ): Promise<DeleteLexiconCommandOutput> => {
363
- const parsedOutput: any = {
364
- ...output,
365
- body: await parseBody(output.body, context),
366
- };
367
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
368
- let errorCode = "UnknownError";
369
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
370
- switch (errorCode) {
371
- case "LexiconNotFoundException":
372
- case "com.amazonaws.polly#LexiconNotFoundException":
373
- response = {
374
- ...(await deserializeAws_restJson1LexiconNotFoundExceptionResponse(parsedOutput, context)),
375
- name: errorCode,
376
- $metadata: deserializeMetadata(output),
377
- };
378
- break;
379
- case "ServiceFailureException":
380
- case "com.amazonaws.polly#ServiceFailureException":
381
- response = {
382
- ...(await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context)),
383
- name: errorCode,
384
- $metadata: deserializeMetadata(output),
385
- };
386
- break;
387
- default:
388
- const parsedBody = parsedOutput.body;
389
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
390
- response = {
391
- ...parsedBody,
392
- name: `${errorCode}`,
393
- message: parsedBody.message || parsedBody.Message || errorCode,
394
- $fault: "client",
395
- $metadata: deserializeMetadata(output),
396
- } as any;
397
- }
398
- const message = response.message || response.Message || errorCode;
399
- response.message = message;
400
- delete response.Message;
401
- return Promise.reject(Object.assign(new Error(message), response));
402
- };
403
-
404
- export const deserializeAws_restJson1DescribeVoicesCommand = async (
405
- output: __HttpResponse,
406
- context: __SerdeContext
407
- ): Promise<DescribeVoicesCommandOutput> => {
408
- if (output.statusCode !== 200 && output.statusCode >= 300) {
409
- return deserializeAws_restJson1DescribeVoicesCommandError(output, context);
410
- }
411
- const contents: DescribeVoicesCommandOutput = {
412
- $metadata: deserializeMetadata(output),
413
- NextToken: undefined,
414
- Voices: undefined,
415
- };
416
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
417
- if (data.NextToken !== undefined && data.NextToken !== null) {
418
- contents.NextToken = __expectString(data.NextToken);
419
- }
420
- if (data.Voices !== undefined && data.Voices !== null) {
421
- contents.Voices = deserializeAws_restJson1VoiceList(data.Voices, context);
422
- }
423
- return Promise.resolve(contents);
424
- };
425
-
426
- const deserializeAws_restJson1DescribeVoicesCommandError = async (
427
- output: __HttpResponse,
428
- context: __SerdeContext
429
- ): Promise<DescribeVoicesCommandOutput> => {
430
- const parsedOutput: any = {
431
- ...output,
432
- body: await parseBody(output.body, context),
433
- };
434
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
435
- let errorCode = "UnknownError";
436
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
437
- switch (errorCode) {
438
- case "InvalidNextTokenException":
439
- case "com.amazonaws.polly#InvalidNextTokenException":
440
- response = {
441
- ...(await deserializeAws_restJson1InvalidNextTokenExceptionResponse(parsedOutput, context)),
442
- name: errorCode,
443
- $metadata: deserializeMetadata(output),
444
- };
445
- break;
446
- case "ServiceFailureException":
447
- case "com.amazonaws.polly#ServiceFailureException":
448
- response = {
449
- ...(await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context)),
450
- name: errorCode,
451
- $metadata: deserializeMetadata(output),
452
- };
453
- break;
454
- default:
455
- const parsedBody = parsedOutput.body;
456
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
457
- response = {
458
- ...parsedBody,
459
- name: `${errorCode}`,
460
- message: parsedBody.message || parsedBody.Message || errorCode,
461
- $fault: "client",
462
- $metadata: deserializeMetadata(output),
463
- } as any;
464
- }
465
- const message = response.message || response.Message || errorCode;
466
- response.message = message;
467
- delete response.Message;
468
- return Promise.reject(Object.assign(new Error(message), response));
469
- };
470
-
471
- export const deserializeAws_restJson1GetLexiconCommand = async (
472
- output: __HttpResponse,
473
- context: __SerdeContext
474
- ): Promise<GetLexiconCommandOutput> => {
475
- if (output.statusCode !== 200 && output.statusCode >= 300) {
476
- return deserializeAws_restJson1GetLexiconCommandError(output, context);
477
- }
478
- const contents: GetLexiconCommandOutput = {
479
- $metadata: deserializeMetadata(output),
480
- Lexicon: undefined,
481
- LexiconAttributes: undefined,
482
- };
483
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
484
- if (data.Lexicon !== undefined && data.Lexicon !== null) {
485
- contents.Lexicon = deserializeAws_restJson1Lexicon(data.Lexicon, context);
486
- }
487
- if (data.LexiconAttributes !== undefined && data.LexiconAttributes !== null) {
488
- contents.LexiconAttributes = deserializeAws_restJson1LexiconAttributes(data.LexiconAttributes, context);
489
- }
490
- return Promise.resolve(contents);
491
- };
492
-
493
- const deserializeAws_restJson1GetLexiconCommandError = async (
494
- output: __HttpResponse,
495
- context: __SerdeContext
496
- ): Promise<GetLexiconCommandOutput> => {
497
- const parsedOutput: any = {
498
- ...output,
499
- body: await parseBody(output.body, context),
500
- };
501
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
502
- let errorCode = "UnknownError";
503
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
504
- switch (errorCode) {
505
- case "LexiconNotFoundException":
506
- case "com.amazonaws.polly#LexiconNotFoundException":
507
- response = {
508
- ...(await deserializeAws_restJson1LexiconNotFoundExceptionResponse(parsedOutput, context)),
509
- name: errorCode,
510
- $metadata: deserializeMetadata(output),
511
- };
512
- break;
513
- case "ServiceFailureException":
514
- case "com.amazonaws.polly#ServiceFailureException":
515
- response = {
516
- ...(await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context)),
517
- name: errorCode,
518
- $metadata: deserializeMetadata(output),
519
- };
520
- break;
521
- default:
522
- const parsedBody = parsedOutput.body;
523
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
524
- response = {
525
- ...parsedBody,
526
- name: `${errorCode}`,
527
- message: parsedBody.message || parsedBody.Message || errorCode,
528
- $fault: "client",
529
- $metadata: deserializeMetadata(output),
530
- } as any;
531
- }
532
- const message = response.message || response.Message || errorCode;
533
- response.message = message;
534
- delete response.Message;
535
- return Promise.reject(Object.assign(new Error(message), response));
536
- };
537
-
538
- export const deserializeAws_restJson1GetSpeechSynthesisTaskCommand = async (
539
- output: __HttpResponse,
540
- context: __SerdeContext
541
- ): Promise<GetSpeechSynthesisTaskCommandOutput> => {
542
- if (output.statusCode !== 200 && output.statusCode >= 300) {
543
- return deserializeAws_restJson1GetSpeechSynthesisTaskCommandError(output, context);
544
- }
545
- const contents: GetSpeechSynthesisTaskCommandOutput = {
546
- $metadata: deserializeMetadata(output),
547
- SynthesisTask: undefined,
548
- };
549
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
550
- if (data.SynthesisTask !== undefined && data.SynthesisTask !== null) {
551
- contents.SynthesisTask = deserializeAws_restJson1SynthesisTask(data.SynthesisTask, context);
552
- }
553
- return Promise.resolve(contents);
554
- };
555
-
556
- const deserializeAws_restJson1GetSpeechSynthesisTaskCommandError = async (
557
- output: __HttpResponse,
558
- context: __SerdeContext
559
- ): Promise<GetSpeechSynthesisTaskCommandOutput> => {
560
- const parsedOutput: any = {
561
- ...output,
562
- body: await parseBody(output.body, context),
563
- };
564
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
565
- let errorCode = "UnknownError";
566
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
567
- switch (errorCode) {
568
- case "InvalidTaskIdException":
569
- case "com.amazonaws.polly#InvalidTaskIdException":
570
- response = {
571
- ...(await deserializeAws_restJson1InvalidTaskIdExceptionResponse(parsedOutput, context)),
572
- name: errorCode,
573
- $metadata: deserializeMetadata(output),
574
- };
575
- break;
576
- case "ServiceFailureException":
577
- case "com.amazonaws.polly#ServiceFailureException":
578
- response = {
579
- ...(await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context)),
580
- name: errorCode,
581
- $metadata: deserializeMetadata(output),
582
- };
583
- break;
584
- case "SynthesisTaskNotFoundException":
585
- case "com.amazonaws.polly#SynthesisTaskNotFoundException":
586
- response = {
587
- ...(await deserializeAws_restJson1SynthesisTaskNotFoundExceptionResponse(parsedOutput, context)),
588
- name: errorCode,
589
- $metadata: deserializeMetadata(output),
590
- };
591
- break;
592
- default:
593
- const parsedBody = parsedOutput.body;
594
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
595
- response = {
596
- ...parsedBody,
597
- name: `${errorCode}`,
598
- message: parsedBody.message || parsedBody.Message || errorCode,
599
- $fault: "client",
600
- $metadata: deserializeMetadata(output),
601
- } as any;
602
- }
603
- const message = response.message || response.Message || errorCode;
604
- response.message = message;
605
- delete response.Message;
606
- return Promise.reject(Object.assign(new Error(message), response));
607
- };
608
-
609
- export const deserializeAws_restJson1ListLexiconsCommand = async (
610
- output: __HttpResponse,
611
- context: __SerdeContext
612
- ): Promise<ListLexiconsCommandOutput> => {
613
- if (output.statusCode !== 200 && output.statusCode >= 300) {
614
- return deserializeAws_restJson1ListLexiconsCommandError(output, context);
615
- }
616
- const contents: ListLexiconsCommandOutput = {
617
- $metadata: deserializeMetadata(output),
618
- Lexicons: undefined,
619
- NextToken: undefined,
620
- };
621
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
622
- if (data.Lexicons !== undefined && data.Lexicons !== null) {
623
- contents.Lexicons = deserializeAws_restJson1LexiconDescriptionList(data.Lexicons, context);
624
- }
625
- if (data.NextToken !== undefined && data.NextToken !== null) {
626
- contents.NextToken = __expectString(data.NextToken);
627
- }
628
- return Promise.resolve(contents);
629
- };
630
-
631
- const deserializeAws_restJson1ListLexiconsCommandError = async (
632
- output: __HttpResponse,
633
- context: __SerdeContext
634
- ): Promise<ListLexiconsCommandOutput> => {
635
- const parsedOutput: any = {
636
- ...output,
637
- body: await parseBody(output.body, context),
638
- };
639
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
640
- let errorCode = "UnknownError";
641
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
642
- switch (errorCode) {
643
- case "InvalidNextTokenException":
644
- case "com.amazonaws.polly#InvalidNextTokenException":
645
- response = {
646
- ...(await deserializeAws_restJson1InvalidNextTokenExceptionResponse(parsedOutput, context)),
647
- name: errorCode,
648
- $metadata: deserializeMetadata(output),
649
- };
650
- break;
651
- case "ServiceFailureException":
652
- case "com.amazonaws.polly#ServiceFailureException":
653
- response = {
654
- ...(await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context)),
655
- name: errorCode,
656
- $metadata: deserializeMetadata(output),
657
- };
658
- break;
659
- default:
660
- const parsedBody = parsedOutput.body;
661
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
662
- response = {
663
- ...parsedBody,
664
- name: `${errorCode}`,
665
- message: parsedBody.message || parsedBody.Message || errorCode,
666
- $fault: "client",
667
- $metadata: deserializeMetadata(output),
668
- } as any;
669
- }
670
- const message = response.message || response.Message || errorCode;
671
- response.message = message;
672
- delete response.Message;
673
- return Promise.reject(Object.assign(new Error(message), response));
674
- };
675
-
676
- export const deserializeAws_restJson1ListSpeechSynthesisTasksCommand = async (
677
- output: __HttpResponse,
678
- context: __SerdeContext
679
- ): Promise<ListSpeechSynthesisTasksCommandOutput> => {
680
- if (output.statusCode !== 200 && output.statusCode >= 300) {
681
- return deserializeAws_restJson1ListSpeechSynthesisTasksCommandError(output, context);
682
- }
683
- const contents: ListSpeechSynthesisTasksCommandOutput = {
684
- $metadata: deserializeMetadata(output),
685
- NextToken: undefined,
686
- SynthesisTasks: undefined,
687
- };
688
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
689
- if (data.NextToken !== undefined && data.NextToken !== null) {
690
- contents.NextToken = __expectString(data.NextToken);
691
- }
692
- if (data.SynthesisTasks !== undefined && data.SynthesisTasks !== null) {
693
- contents.SynthesisTasks = deserializeAws_restJson1SynthesisTasks(data.SynthesisTasks, context);
694
- }
695
- return Promise.resolve(contents);
696
- };
697
-
698
- const deserializeAws_restJson1ListSpeechSynthesisTasksCommandError = async (
699
- output: __HttpResponse,
700
- context: __SerdeContext
701
- ): Promise<ListSpeechSynthesisTasksCommandOutput> => {
702
- const parsedOutput: any = {
703
- ...output,
704
- body: await parseBody(output.body, context),
705
- };
706
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
707
- let errorCode = "UnknownError";
708
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
709
- switch (errorCode) {
710
- case "InvalidNextTokenException":
711
- case "com.amazonaws.polly#InvalidNextTokenException":
712
- response = {
713
- ...(await deserializeAws_restJson1InvalidNextTokenExceptionResponse(parsedOutput, context)),
714
- name: errorCode,
715
- $metadata: deserializeMetadata(output),
716
- };
717
- break;
718
- case "ServiceFailureException":
719
- case "com.amazonaws.polly#ServiceFailureException":
720
- response = {
721
- ...(await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context)),
722
- name: errorCode,
723
- $metadata: deserializeMetadata(output),
724
- };
725
- break;
726
- default:
727
- const parsedBody = parsedOutput.body;
728
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
729
- response = {
730
- ...parsedBody,
731
- name: `${errorCode}`,
732
- message: parsedBody.message || parsedBody.Message || errorCode,
733
- $fault: "client",
734
- $metadata: deserializeMetadata(output),
735
- } as any;
736
- }
737
- const message = response.message || response.Message || errorCode;
738
- response.message = message;
739
- delete response.Message;
740
- return Promise.reject(Object.assign(new Error(message), response));
741
- };
742
-
743
- export const deserializeAws_restJson1PutLexiconCommand = async (
744
- output: __HttpResponse,
745
- context: __SerdeContext
746
- ): Promise<PutLexiconCommandOutput> => {
747
- if (output.statusCode !== 200 && output.statusCode >= 300) {
748
- return deserializeAws_restJson1PutLexiconCommandError(output, context);
749
- }
750
- const contents: PutLexiconCommandOutput = {
751
- $metadata: deserializeMetadata(output),
752
- };
753
- await collectBody(output.body, context);
754
- return Promise.resolve(contents);
755
- };
756
-
757
- const deserializeAws_restJson1PutLexiconCommandError = async (
758
- output: __HttpResponse,
759
- context: __SerdeContext
760
- ): Promise<PutLexiconCommandOutput> => {
761
- const parsedOutput: any = {
762
- ...output,
763
- body: await parseBody(output.body, context),
764
- };
765
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
766
- let errorCode = "UnknownError";
767
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
768
- switch (errorCode) {
769
- case "InvalidLexiconException":
770
- case "com.amazonaws.polly#InvalidLexiconException":
771
- response = {
772
- ...(await deserializeAws_restJson1InvalidLexiconExceptionResponse(parsedOutput, context)),
773
- name: errorCode,
774
- $metadata: deserializeMetadata(output),
775
- };
776
- break;
777
- case "LexiconSizeExceededException":
778
- case "com.amazonaws.polly#LexiconSizeExceededException":
779
- response = {
780
- ...(await deserializeAws_restJson1LexiconSizeExceededExceptionResponse(parsedOutput, context)),
781
- name: errorCode,
782
- $metadata: deserializeMetadata(output),
783
- };
784
- break;
785
- case "MaxLexemeLengthExceededException":
786
- case "com.amazonaws.polly#MaxLexemeLengthExceededException":
787
- response = {
788
- ...(await deserializeAws_restJson1MaxLexemeLengthExceededExceptionResponse(parsedOutput, context)),
789
- name: errorCode,
790
- $metadata: deserializeMetadata(output),
791
- };
792
- break;
793
- case "MaxLexiconsNumberExceededException":
794
- case "com.amazonaws.polly#MaxLexiconsNumberExceededException":
795
- response = {
796
- ...(await deserializeAws_restJson1MaxLexiconsNumberExceededExceptionResponse(parsedOutput, context)),
797
- name: errorCode,
798
- $metadata: deserializeMetadata(output),
799
- };
800
- break;
801
- case "ServiceFailureException":
802
- case "com.amazonaws.polly#ServiceFailureException":
803
- response = {
804
- ...(await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context)),
805
- name: errorCode,
806
- $metadata: deserializeMetadata(output),
807
- };
808
- break;
809
- case "UnsupportedPlsAlphabetException":
810
- case "com.amazonaws.polly#UnsupportedPlsAlphabetException":
811
- response = {
812
- ...(await deserializeAws_restJson1UnsupportedPlsAlphabetExceptionResponse(parsedOutput, context)),
813
- name: errorCode,
814
- $metadata: deserializeMetadata(output),
815
- };
816
- break;
817
- case "UnsupportedPlsLanguageException":
818
- case "com.amazonaws.polly#UnsupportedPlsLanguageException":
819
- response = {
820
- ...(await deserializeAws_restJson1UnsupportedPlsLanguageExceptionResponse(parsedOutput, context)),
821
- name: errorCode,
822
- $metadata: deserializeMetadata(output),
823
- };
824
- break;
825
- default:
826
- const parsedBody = parsedOutput.body;
827
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
828
- response = {
829
- ...parsedBody,
830
- name: `${errorCode}`,
831
- message: parsedBody.message || parsedBody.Message || errorCode,
832
- $fault: "client",
833
- $metadata: deserializeMetadata(output),
834
- } as any;
835
- }
836
- const message = response.message || response.Message || errorCode;
837
- response.message = message;
838
- delete response.Message;
839
- return Promise.reject(Object.assign(new Error(message), response));
840
- };
841
-
842
- export const deserializeAws_restJson1StartSpeechSynthesisTaskCommand = async (
843
- output: __HttpResponse,
844
- context: __SerdeContext
845
- ): Promise<StartSpeechSynthesisTaskCommandOutput> => {
846
- if (output.statusCode !== 200 && output.statusCode >= 300) {
847
- return deserializeAws_restJson1StartSpeechSynthesisTaskCommandError(output, context);
848
- }
849
- const contents: StartSpeechSynthesisTaskCommandOutput = {
850
- $metadata: deserializeMetadata(output),
851
- SynthesisTask: undefined,
852
- };
853
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
854
- if (data.SynthesisTask !== undefined && data.SynthesisTask !== null) {
855
- contents.SynthesisTask = deserializeAws_restJson1SynthesisTask(data.SynthesisTask, context);
856
- }
857
- return Promise.resolve(contents);
858
- };
859
-
860
- const deserializeAws_restJson1StartSpeechSynthesisTaskCommandError = async (
861
- output: __HttpResponse,
862
- context: __SerdeContext
863
- ): Promise<StartSpeechSynthesisTaskCommandOutput> => {
864
- const parsedOutput: any = {
865
- ...output,
866
- body: await parseBody(output.body, context),
867
- };
868
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
869
- let errorCode = "UnknownError";
870
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
871
- switch (errorCode) {
872
- case "EngineNotSupportedException":
873
- case "com.amazonaws.polly#EngineNotSupportedException":
874
- response = {
875
- ...(await deserializeAws_restJson1EngineNotSupportedExceptionResponse(parsedOutput, context)),
876
- name: errorCode,
877
- $metadata: deserializeMetadata(output),
878
- };
879
- break;
880
- case "InvalidS3BucketException":
881
- case "com.amazonaws.polly#InvalidS3BucketException":
882
- response = {
883
- ...(await deserializeAws_restJson1InvalidS3BucketExceptionResponse(parsedOutput, context)),
884
- name: errorCode,
885
- $metadata: deserializeMetadata(output),
886
- };
887
- break;
888
- case "InvalidS3KeyException":
889
- case "com.amazonaws.polly#InvalidS3KeyException":
890
- response = {
891
- ...(await deserializeAws_restJson1InvalidS3KeyExceptionResponse(parsedOutput, context)),
892
- name: errorCode,
893
- $metadata: deserializeMetadata(output),
894
- };
895
- break;
896
- case "InvalidSampleRateException":
897
- case "com.amazonaws.polly#InvalidSampleRateException":
898
- response = {
899
- ...(await deserializeAws_restJson1InvalidSampleRateExceptionResponse(parsedOutput, context)),
900
- name: errorCode,
901
- $metadata: deserializeMetadata(output),
902
- };
903
- break;
904
- case "InvalidSnsTopicArnException":
905
- case "com.amazonaws.polly#InvalidSnsTopicArnException":
906
- response = {
907
- ...(await deserializeAws_restJson1InvalidSnsTopicArnExceptionResponse(parsedOutput, context)),
908
- name: errorCode,
909
- $metadata: deserializeMetadata(output),
910
- };
911
- break;
912
- case "InvalidSsmlException":
913
- case "com.amazonaws.polly#InvalidSsmlException":
914
- response = {
915
- ...(await deserializeAws_restJson1InvalidSsmlExceptionResponse(parsedOutput, context)),
916
- name: errorCode,
917
- $metadata: deserializeMetadata(output),
918
- };
919
- break;
920
- case "LanguageNotSupportedException":
921
- case "com.amazonaws.polly#LanguageNotSupportedException":
922
- response = {
923
- ...(await deserializeAws_restJson1LanguageNotSupportedExceptionResponse(parsedOutput, context)),
924
- name: errorCode,
925
- $metadata: deserializeMetadata(output),
926
- };
927
- break;
928
- case "LexiconNotFoundException":
929
- case "com.amazonaws.polly#LexiconNotFoundException":
930
- response = {
931
- ...(await deserializeAws_restJson1LexiconNotFoundExceptionResponse(parsedOutput, context)),
932
- name: errorCode,
933
- $metadata: deserializeMetadata(output),
934
- };
935
- break;
936
- case "MarksNotSupportedForFormatException":
937
- case "com.amazonaws.polly#MarksNotSupportedForFormatException":
938
- response = {
939
- ...(await deserializeAws_restJson1MarksNotSupportedForFormatExceptionResponse(parsedOutput, context)),
940
- name: errorCode,
941
- $metadata: deserializeMetadata(output),
942
- };
943
- break;
944
- case "ServiceFailureException":
945
- case "com.amazonaws.polly#ServiceFailureException":
946
- response = {
947
- ...(await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context)),
948
- name: errorCode,
949
- $metadata: deserializeMetadata(output),
950
- };
951
- break;
952
- case "SsmlMarksNotSupportedForTextTypeException":
953
- case "com.amazonaws.polly#SsmlMarksNotSupportedForTextTypeException":
954
- response = {
955
- ...(await deserializeAws_restJson1SsmlMarksNotSupportedForTextTypeExceptionResponse(parsedOutput, context)),
956
- name: errorCode,
957
- $metadata: deserializeMetadata(output),
958
- };
959
- break;
960
- case "TextLengthExceededException":
961
- case "com.amazonaws.polly#TextLengthExceededException":
962
- response = {
963
- ...(await deserializeAws_restJson1TextLengthExceededExceptionResponse(parsedOutput, context)),
964
- name: errorCode,
965
- $metadata: deserializeMetadata(output),
966
- };
967
- break;
968
- default:
969
- const parsedBody = parsedOutput.body;
970
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
971
- response = {
972
- ...parsedBody,
973
- name: `${errorCode}`,
974
- message: parsedBody.message || parsedBody.Message || errorCode,
975
- $fault: "client",
976
- $metadata: deserializeMetadata(output),
977
- } as any;
978
- }
979
- const message = response.message || response.Message || errorCode;
980
- response.message = message;
981
- delete response.Message;
982
- return Promise.reject(Object.assign(new Error(message), response));
983
- };
984
-
985
- export const deserializeAws_restJson1SynthesizeSpeechCommand = async (
986
- output: __HttpResponse,
987
- context: __SerdeContext
988
- ): Promise<SynthesizeSpeechCommandOutput> => {
989
- if (output.statusCode !== 200 && output.statusCode >= 300) {
990
- return deserializeAws_restJson1SynthesizeSpeechCommandError(output, context);
991
- }
992
- const contents: SynthesizeSpeechCommandOutput = {
993
- $metadata: deserializeMetadata(output),
994
- AudioStream: undefined,
995
- ContentType: undefined,
996
- RequestCharacters: undefined,
997
- };
998
- if (output.headers["content-type"] !== undefined) {
999
- contents.ContentType = output.headers["content-type"];
1000
- }
1001
- if (output.headers["x-amzn-requestcharacters"] !== undefined) {
1002
- contents.RequestCharacters = __strictParseInt32(output.headers["x-amzn-requestcharacters"]);
1003
- }
1004
- const data: any = output.body;
1005
- contents.AudioStream = data;
1006
- return Promise.resolve(contents);
1007
- };
1008
-
1009
- const deserializeAws_restJson1SynthesizeSpeechCommandError = async (
1010
- output: __HttpResponse,
1011
- context: __SerdeContext
1012
- ): Promise<SynthesizeSpeechCommandOutput> => {
1013
- const parsedOutput: any = {
1014
- ...output,
1015
- body: await parseBody(output.body, context),
1016
- };
1017
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1018
- let errorCode = "UnknownError";
1019
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1020
- switch (errorCode) {
1021
- case "EngineNotSupportedException":
1022
- case "com.amazonaws.polly#EngineNotSupportedException":
1023
- response = {
1024
- ...(await deserializeAws_restJson1EngineNotSupportedExceptionResponse(parsedOutput, context)),
1025
- name: errorCode,
1026
- $metadata: deserializeMetadata(output),
1027
- };
1028
- break;
1029
- case "InvalidSampleRateException":
1030
- case "com.amazonaws.polly#InvalidSampleRateException":
1031
- response = {
1032
- ...(await deserializeAws_restJson1InvalidSampleRateExceptionResponse(parsedOutput, context)),
1033
- name: errorCode,
1034
- $metadata: deserializeMetadata(output),
1035
- };
1036
- break;
1037
- case "InvalidSsmlException":
1038
- case "com.amazonaws.polly#InvalidSsmlException":
1039
- response = {
1040
- ...(await deserializeAws_restJson1InvalidSsmlExceptionResponse(parsedOutput, context)),
1041
- name: errorCode,
1042
- $metadata: deserializeMetadata(output),
1043
- };
1044
- break;
1045
- case "LanguageNotSupportedException":
1046
- case "com.amazonaws.polly#LanguageNotSupportedException":
1047
- response = {
1048
- ...(await deserializeAws_restJson1LanguageNotSupportedExceptionResponse(parsedOutput, context)),
1049
- name: errorCode,
1050
- $metadata: deserializeMetadata(output),
1051
- };
1052
- break;
1053
- case "LexiconNotFoundException":
1054
- case "com.amazonaws.polly#LexiconNotFoundException":
1055
- response = {
1056
- ...(await deserializeAws_restJson1LexiconNotFoundExceptionResponse(parsedOutput, context)),
1057
- name: errorCode,
1058
- $metadata: deserializeMetadata(output),
1059
- };
1060
- break;
1061
- case "MarksNotSupportedForFormatException":
1062
- case "com.amazonaws.polly#MarksNotSupportedForFormatException":
1063
- response = {
1064
- ...(await deserializeAws_restJson1MarksNotSupportedForFormatExceptionResponse(parsedOutput, context)),
1065
- name: errorCode,
1066
- $metadata: deserializeMetadata(output),
1067
- };
1068
- break;
1069
- case "ServiceFailureException":
1070
- case "com.amazonaws.polly#ServiceFailureException":
1071
- response = {
1072
- ...(await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context)),
1073
- name: errorCode,
1074
- $metadata: deserializeMetadata(output),
1075
- };
1076
- break;
1077
- case "SsmlMarksNotSupportedForTextTypeException":
1078
- case "com.amazonaws.polly#SsmlMarksNotSupportedForTextTypeException":
1079
- response = {
1080
- ...(await deserializeAws_restJson1SsmlMarksNotSupportedForTextTypeExceptionResponse(parsedOutput, context)),
1081
- name: errorCode,
1082
- $metadata: deserializeMetadata(output),
1083
- };
1084
- break;
1085
- case "TextLengthExceededException":
1086
- case "com.amazonaws.polly#TextLengthExceededException":
1087
- response = {
1088
- ...(await deserializeAws_restJson1TextLengthExceededExceptionResponse(parsedOutput, context)),
1089
- name: errorCode,
1090
- $metadata: deserializeMetadata(output),
1091
- };
1092
- break;
1093
- default:
1094
- const parsedBody = parsedOutput.body;
1095
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1096
- response = {
1097
- ...parsedBody,
1098
- name: `${errorCode}`,
1099
- message: parsedBody.message || parsedBody.Message || errorCode,
1100
- $fault: "client",
1101
- $metadata: deserializeMetadata(output),
1102
- } as any;
1103
- }
1104
- const message = response.message || response.Message || errorCode;
1105
- response.message = message;
1106
- delete response.Message;
1107
- return Promise.reject(Object.assign(new Error(message), response));
1108
- };
1109
-
1110
- const deserializeAws_restJson1EngineNotSupportedExceptionResponse = async (
1111
- parsedOutput: any,
1112
- context: __SerdeContext
1113
- ): Promise<EngineNotSupportedException> => {
1114
- const contents: EngineNotSupportedException = {
1115
- name: "EngineNotSupportedException",
1116
- $fault: "client",
1117
- $metadata: deserializeMetadata(parsedOutput),
1118
- message: undefined,
1119
- };
1120
- const data: any = parsedOutput.body;
1121
- if (data.message !== undefined && data.message !== null) {
1122
- contents.message = __expectString(data.message);
1123
- }
1124
- return contents;
1125
- };
1126
-
1127
- const deserializeAws_restJson1InvalidLexiconExceptionResponse = async (
1128
- parsedOutput: any,
1129
- context: __SerdeContext
1130
- ): Promise<InvalidLexiconException> => {
1131
- const contents: InvalidLexiconException = {
1132
- name: "InvalidLexiconException",
1133
- $fault: "client",
1134
- $metadata: deserializeMetadata(parsedOutput),
1135
- message: undefined,
1136
- };
1137
- const data: any = parsedOutput.body;
1138
- if (data.message !== undefined && data.message !== null) {
1139
- contents.message = __expectString(data.message);
1140
- }
1141
- return contents;
1142
- };
1143
-
1144
- const deserializeAws_restJson1InvalidNextTokenExceptionResponse = async (
1145
- parsedOutput: any,
1146
- context: __SerdeContext
1147
- ): Promise<InvalidNextTokenException> => {
1148
- const contents: InvalidNextTokenException = {
1149
- name: "InvalidNextTokenException",
1150
- $fault: "client",
1151
- $metadata: deserializeMetadata(parsedOutput),
1152
- message: undefined,
1153
- };
1154
- const data: any = parsedOutput.body;
1155
- if (data.message !== undefined && data.message !== null) {
1156
- contents.message = __expectString(data.message);
1157
- }
1158
- return contents;
1159
- };
1160
-
1161
- const deserializeAws_restJson1InvalidS3BucketExceptionResponse = async (
1162
- parsedOutput: any,
1163
- context: __SerdeContext
1164
- ): Promise<InvalidS3BucketException> => {
1165
- const contents: InvalidS3BucketException = {
1166
- name: "InvalidS3BucketException",
1167
- $fault: "client",
1168
- $metadata: deserializeMetadata(parsedOutput),
1169
- message: undefined,
1170
- };
1171
- const data: any = parsedOutput.body;
1172
- if (data.message !== undefined && data.message !== null) {
1173
- contents.message = __expectString(data.message);
1174
- }
1175
- return contents;
1176
- };
1177
-
1178
- const deserializeAws_restJson1InvalidS3KeyExceptionResponse = async (
1179
- parsedOutput: any,
1180
- context: __SerdeContext
1181
- ): Promise<InvalidS3KeyException> => {
1182
- const contents: InvalidS3KeyException = {
1183
- name: "InvalidS3KeyException",
1184
- $fault: "client",
1185
- $metadata: deserializeMetadata(parsedOutput),
1186
- message: undefined,
1187
- };
1188
- const data: any = parsedOutput.body;
1189
- if (data.message !== undefined && data.message !== null) {
1190
- contents.message = __expectString(data.message);
1191
- }
1192
- return contents;
1193
- };
1194
-
1195
- const deserializeAws_restJson1InvalidSampleRateExceptionResponse = async (
1196
- parsedOutput: any,
1197
- context: __SerdeContext
1198
- ): Promise<InvalidSampleRateException> => {
1199
- const contents: InvalidSampleRateException = {
1200
- name: "InvalidSampleRateException",
1201
- $fault: "client",
1202
- $metadata: deserializeMetadata(parsedOutput),
1203
- message: undefined,
1204
- };
1205
- const data: any = parsedOutput.body;
1206
- if (data.message !== undefined && data.message !== null) {
1207
- contents.message = __expectString(data.message);
1208
- }
1209
- return contents;
1210
- };
1211
-
1212
- const deserializeAws_restJson1InvalidSnsTopicArnExceptionResponse = async (
1213
- parsedOutput: any,
1214
- context: __SerdeContext
1215
- ): Promise<InvalidSnsTopicArnException> => {
1216
- const contents: InvalidSnsTopicArnException = {
1217
- name: "InvalidSnsTopicArnException",
1218
- $fault: "client",
1219
- $metadata: deserializeMetadata(parsedOutput),
1220
- message: undefined,
1221
- };
1222
- const data: any = parsedOutput.body;
1223
- if (data.message !== undefined && data.message !== null) {
1224
- contents.message = __expectString(data.message);
1225
- }
1226
- return contents;
1227
- };
1228
-
1229
- const deserializeAws_restJson1InvalidSsmlExceptionResponse = async (
1230
- parsedOutput: any,
1231
- context: __SerdeContext
1232
- ): Promise<InvalidSsmlException> => {
1233
- const contents: InvalidSsmlException = {
1234
- name: "InvalidSsmlException",
1235
- $fault: "client",
1236
- $metadata: deserializeMetadata(parsedOutput),
1237
- message: undefined,
1238
- };
1239
- const data: any = parsedOutput.body;
1240
- if (data.message !== undefined && data.message !== null) {
1241
- contents.message = __expectString(data.message);
1242
- }
1243
- return contents;
1244
- };
1245
-
1246
- const deserializeAws_restJson1InvalidTaskIdExceptionResponse = async (
1247
- parsedOutput: any,
1248
- context: __SerdeContext
1249
- ): Promise<InvalidTaskIdException> => {
1250
- const contents: InvalidTaskIdException = {
1251
- name: "InvalidTaskIdException",
1252
- $fault: "client",
1253
- $metadata: deserializeMetadata(parsedOutput),
1254
- message: undefined,
1255
- };
1256
- const data: any = parsedOutput.body;
1257
- if (data.message !== undefined && data.message !== null) {
1258
- contents.message = __expectString(data.message);
1259
- }
1260
- return contents;
1261
- };
1262
-
1263
- const deserializeAws_restJson1LanguageNotSupportedExceptionResponse = async (
1264
- parsedOutput: any,
1265
- context: __SerdeContext
1266
- ): Promise<LanguageNotSupportedException> => {
1267
- const contents: LanguageNotSupportedException = {
1268
- name: "LanguageNotSupportedException",
1269
- $fault: "client",
1270
- $metadata: deserializeMetadata(parsedOutput),
1271
- message: undefined,
1272
- };
1273
- const data: any = parsedOutput.body;
1274
- if (data.message !== undefined && data.message !== null) {
1275
- contents.message = __expectString(data.message);
1276
- }
1277
- return contents;
1278
- };
1279
-
1280
- const deserializeAws_restJson1LexiconNotFoundExceptionResponse = async (
1281
- parsedOutput: any,
1282
- context: __SerdeContext
1283
- ): Promise<LexiconNotFoundException> => {
1284
- const contents: LexiconNotFoundException = {
1285
- name: "LexiconNotFoundException",
1286
- $fault: "client",
1287
- $metadata: deserializeMetadata(parsedOutput),
1288
- message: undefined,
1289
- };
1290
- const data: any = parsedOutput.body;
1291
- if (data.message !== undefined && data.message !== null) {
1292
- contents.message = __expectString(data.message);
1293
- }
1294
- return contents;
1295
- };
1296
-
1297
- const deserializeAws_restJson1LexiconSizeExceededExceptionResponse = async (
1298
- parsedOutput: any,
1299
- context: __SerdeContext
1300
- ): Promise<LexiconSizeExceededException> => {
1301
- const contents: LexiconSizeExceededException = {
1302
- name: "LexiconSizeExceededException",
1303
- $fault: "client",
1304
- $metadata: deserializeMetadata(parsedOutput),
1305
- message: undefined,
1306
- };
1307
- const data: any = parsedOutput.body;
1308
- if (data.message !== undefined && data.message !== null) {
1309
- contents.message = __expectString(data.message);
1310
- }
1311
- return contents;
1312
- };
1313
-
1314
- const deserializeAws_restJson1MarksNotSupportedForFormatExceptionResponse = async (
1315
- parsedOutput: any,
1316
- context: __SerdeContext
1317
- ): Promise<MarksNotSupportedForFormatException> => {
1318
- const contents: MarksNotSupportedForFormatException = {
1319
- name: "MarksNotSupportedForFormatException",
1320
- $fault: "client",
1321
- $metadata: deserializeMetadata(parsedOutput),
1322
- message: undefined,
1323
- };
1324
- const data: any = parsedOutput.body;
1325
- if (data.message !== undefined && data.message !== null) {
1326
- contents.message = __expectString(data.message);
1327
- }
1328
- return contents;
1329
- };
1330
-
1331
- const deserializeAws_restJson1MaxLexemeLengthExceededExceptionResponse = async (
1332
- parsedOutput: any,
1333
- context: __SerdeContext
1334
- ): Promise<MaxLexemeLengthExceededException> => {
1335
- const contents: MaxLexemeLengthExceededException = {
1336
- name: "MaxLexemeLengthExceededException",
1337
- $fault: "client",
1338
- $metadata: deserializeMetadata(parsedOutput),
1339
- message: undefined,
1340
- };
1341
- const data: any = parsedOutput.body;
1342
- if (data.message !== undefined && data.message !== null) {
1343
- contents.message = __expectString(data.message);
1344
- }
1345
- return contents;
1346
- };
1347
-
1348
- const deserializeAws_restJson1MaxLexiconsNumberExceededExceptionResponse = async (
1349
- parsedOutput: any,
1350
- context: __SerdeContext
1351
- ): Promise<MaxLexiconsNumberExceededException> => {
1352
- const contents: MaxLexiconsNumberExceededException = {
1353
- name: "MaxLexiconsNumberExceededException",
1354
- $fault: "client",
1355
- $metadata: deserializeMetadata(parsedOutput),
1356
- message: undefined,
1357
- };
1358
- const data: any = parsedOutput.body;
1359
- if (data.message !== undefined && data.message !== null) {
1360
- contents.message = __expectString(data.message);
1361
- }
1362
- return contents;
1363
- };
1364
-
1365
- const deserializeAws_restJson1ServiceFailureExceptionResponse = async (
1366
- parsedOutput: any,
1367
- context: __SerdeContext
1368
- ): Promise<ServiceFailureException> => {
1369
- const contents: ServiceFailureException = {
1370
- name: "ServiceFailureException",
1371
- $fault: "server",
1372
- $metadata: deserializeMetadata(parsedOutput),
1373
- message: undefined,
1374
- };
1375
- const data: any = parsedOutput.body;
1376
- if (data.message !== undefined && data.message !== null) {
1377
- contents.message = __expectString(data.message);
1378
- }
1379
- return contents;
1380
- };
1381
-
1382
- const deserializeAws_restJson1SsmlMarksNotSupportedForTextTypeExceptionResponse = async (
1383
- parsedOutput: any,
1384
- context: __SerdeContext
1385
- ): Promise<SsmlMarksNotSupportedForTextTypeException> => {
1386
- const contents: SsmlMarksNotSupportedForTextTypeException = {
1387
- name: "SsmlMarksNotSupportedForTextTypeException",
1388
- $fault: "client",
1389
- $metadata: deserializeMetadata(parsedOutput),
1390
- message: undefined,
1391
- };
1392
- const data: any = parsedOutput.body;
1393
- if (data.message !== undefined && data.message !== null) {
1394
- contents.message = __expectString(data.message);
1395
- }
1396
- return contents;
1397
- };
1398
-
1399
- const deserializeAws_restJson1SynthesisTaskNotFoundExceptionResponse = async (
1400
- parsedOutput: any,
1401
- context: __SerdeContext
1402
- ): Promise<SynthesisTaskNotFoundException> => {
1403
- const contents: SynthesisTaskNotFoundException = {
1404
- name: "SynthesisTaskNotFoundException",
1405
- $fault: "client",
1406
- $metadata: deserializeMetadata(parsedOutput),
1407
- message: undefined,
1408
- };
1409
- const data: any = parsedOutput.body;
1410
- if (data.message !== undefined && data.message !== null) {
1411
- contents.message = __expectString(data.message);
1412
- }
1413
- return contents;
1414
- };
1415
-
1416
- const deserializeAws_restJson1TextLengthExceededExceptionResponse = async (
1417
- parsedOutput: any,
1418
- context: __SerdeContext
1419
- ): Promise<TextLengthExceededException> => {
1420
- const contents: TextLengthExceededException = {
1421
- name: "TextLengthExceededException",
1422
- $fault: "client",
1423
- $metadata: deserializeMetadata(parsedOutput),
1424
- message: undefined,
1425
- };
1426
- const data: any = parsedOutput.body;
1427
- if (data.message !== undefined && data.message !== null) {
1428
- contents.message = __expectString(data.message);
1429
- }
1430
- return contents;
1431
- };
1432
-
1433
- const deserializeAws_restJson1UnsupportedPlsAlphabetExceptionResponse = async (
1434
- parsedOutput: any,
1435
- context: __SerdeContext
1436
- ): Promise<UnsupportedPlsAlphabetException> => {
1437
- const contents: UnsupportedPlsAlphabetException = {
1438
- name: "UnsupportedPlsAlphabetException",
1439
- $fault: "client",
1440
- $metadata: deserializeMetadata(parsedOutput),
1441
- message: undefined,
1442
- };
1443
- const data: any = parsedOutput.body;
1444
- if (data.message !== undefined && data.message !== null) {
1445
- contents.message = __expectString(data.message);
1446
- }
1447
- return contents;
1448
- };
1449
-
1450
- const deserializeAws_restJson1UnsupportedPlsLanguageExceptionResponse = async (
1451
- parsedOutput: any,
1452
- context: __SerdeContext
1453
- ): Promise<UnsupportedPlsLanguageException> => {
1454
- const contents: UnsupportedPlsLanguageException = {
1455
- name: "UnsupportedPlsLanguageException",
1456
- $fault: "client",
1457
- $metadata: deserializeMetadata(parsedOutput),
1458
- message: undefined,
1459
- };
1460
- const data: any = parsedOutput.body;
1461
- if (data.message !== undefined && data.message !== null) {
1462
- contents.message = __expectString(data.message);
1463
- }
1464
- return contents;
1465
- };
1466
-
1467
- const serializeAws_restJson1LexiconNameList = (input: string[], context: __SerdeContext): any => {
1468
- return input
1469
- .filter((e: any) => e != null)
1470
- .map((entry) => {
1471
- if (entry === null) {
1472
- return null as any;
1473
- }
1474
- return entry;
1475
- });
1476
- };
1477
-
1478
- const serializeAws_restJson1SpeechMarkTypeList = (input: (SpeechMarkType | string)[], context: __SerdeContext): any => {
1479
- return input
1480
- .filter((e: any) => e != null)
1481
- .map((entry) => {
1482
- if (entry === null) {
1483
- return null as any;
1484
- }
1485
- return entry;
1486
- });
1487
- };
1488
-
1489
- const deserializeAws_restJson1EngineList = (output: any, context: __SerdeContext): (Engine | string)[] => {
1490
- return (output || [])
1491
- .filter((e: any) => e != null)
1492
- .map((entry: any) => {
1493
- if (entry === null) {
1494
- return null as any;
1495
- }
1496
- return __expectString(entry) as any;
1497
- });
1498
- };
1499
-
1500
- const deserializeAws_restJson1LanguageCodeList = (output: any, context: __SerdeContext): (LanguageCode | string)[] => {
1501
- return (output || [])
1502
- .filter((e: any) => e != null)
1503
- .map((entry: any) => {
1504
- if (entry === null) {
1505
- return null as any;
1506
- }
1507
- return __expectString(entry) as any;
1508
- });
1509
- };
1510
-
1511
- const deserializeAws_restJson1Lexicon = (output: any, context: __SerdeContext): Lexicon => {
1512
- return {
1513
- Content: __expectString(output.Content),
1514
- Name: __expectString(output.Name),
1515
- } as any;
1516
- };
1517
-
1518
- const deserializeAws_restJson1LexiconAttributes = (output: any, context: __SerdeContext): LexiconAttributes => {
1519
- return {
1520
- Alphabet: __expectString(output.Alphabet),
1521
- LanguageCode: __expectString(output.LanguageCode),
1522
- LastModified:
1523
- output.LastModified !== undefined && output.LastModified !== null
1524
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.LastModified)))
1525
- : undefined,
1526
- LexemesCount: __expectInt32(output.LexemesCount),
1527
- LexiconArn: __expectString(output.LexiconArn),
1528
- Size: __expectInt32(output.Size),
1529
- } as any;
1530
- };
1531
-
1532
- const deserializeAws_restJson1LexiconDescription = (output: any, context: __SerdeContext): LexiconDescription => {
1533
- return {
1534
- Attributes:
1535
- output.Attributes !== undefined && output.Attributes !== null
1536
- ? deserializeAws_restJson1LexiconAttributes(output.Attributes, context)
1537
- : undefined,
1538
- Name: __expectString(output.Name),
1539
- } as any;
1540
- };
1541
-
1542
- const deserializeAws_restJson1LexiconDescriptionList = (output: any, context: __SerdeContext): LexiconDescription[] => {
1543
- return (output || [])
1544
- .filter((e: any) => e != null)
1545
- .map((entry: any) => {
1546
- if (entry === null) {
1547
- return null as any;
1548
- }
1549
- return deserializeAws_restJson1LexiconDescription(entry, context);
1550
- });
1551
- };
1552
-
1553
- const deserializeAws_restJson1LexiconNameList = (output: any, context: __SerdeContext): string[] => {
1554
- return (output || [])
1555
- .filter((e: any) => e != null)
1556
- .map((entry: any) => {
1557
- if (entry === null) {
1558
- return null as any;
1559
- }
1560
- return __expectString(entry) as any;
1561
- });
1562
- };
1563
-
1564
- const deserializeAws_restJson1SpeechMarkTypeList = (
1565
- output: any,
1566
- context: __SerdeContext
1567
- ): (SpeechMarkType | string)[] => {
1568
- return (output || [])
1569
- .filter((e: any) => e != null)
1570
- .map((entry: any) => {
1571
- if (entry === null) {
1572
- return null as any;
1573
- }
1574
- return __expectString(entry) as any;
1575
- });
1576
- };
1577
-
1578
- const deserializeAws_restJson1SynthesisTask = (output: any, context: __SerdeContext): SynthesisTask => {
1579
- return {
1580
- CreationTime:
1581
- output.CreationTime !== undefined && output.CreationTime !== null
1582
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.CreationTime)))
1583
- : undefined,
1584
- Engine: __expectString(output.Engine),
1585
- LanguageCode: __expectString(output.LanguageCode),
1586
- LexiconNames:
1587
- output.LexiconNames !== undefined && output.LexiconNames !== null
1588
- ? deserializeAws_restJson1LexiconNameList(output.LexiconNames, context)
1589
- : undefined,
1590
- OutputFormat: __expectString(output.OutputFormat),
1591
- OutputUri: __expectString(output.OutputUri),
1592
- RequestCharacters: __expectInt32(output.RequestCharacters),
1593
- SampleRate: __expectString(output.SampleRate),
1594
- SnsTopicArn: __expectString(output.SnsTopicArn),
1595
- SpeechMarkTypes:
1596
- output.SpeechMarkTypes !== undefined && output.SpeechMarkTypes !== null
1597
- ? deserializeAws_restJson1SpeechMarkTypeList(output.SpeechMarkTypes, context)
1598
- : undefined,
1599
- TaskId: __expectString(output.TaskId),
1600
- TaskStatus: __expectString(output.TaskStatus),
1601
- TaskStatusReason: __expectString(output.TaskStatusReason),
1602
- TextType: __expectString(output.TextType),
1603
- VoiceId: __expectString(output.VoiceId),
1604
- } as any;
1605
- };
1606
-
1607
- const deserializeAws_restJson1SynthesisTasks = (output: any, context: __SerdeContext): SynthesisTask[] => {
1608
- return (output || [])
1609
- .filter((e: any) => e != null)
1610
- .map((entry: any) => {
1611
- if (entry === null) {
1612
- return null as any;
1613
- }
1614
- return deserializeAws_restJson1SynthesisTask(entry, context);
1615
- });
1616
- };
1617
-
1618
- const deserializeAws_restJson1Voice = (output: any, context: __SerdeContext): Voice => {
1619
- return {
1620
- AdditionalLanguageCodes:
1621
- output.AdditionalLanguageCodes !== undefined && output.AdditionalLanguageCodes !== null
1622
- ? deserializeAws_restJson1LanguageCodeList(output.AdditionalLanguageCodes, context)
1623
- : undefined,
1624
- Gender: __expectString(output.Gender),
1625
- Id: __expectString(output.Id),
1626
- LanguageCode: __expectString(output.LanguageCode),
1627
- LanguageName: __expectString(output.LanguageName),
1628
- Name: __expectString(output.Name),
1629
- SupportedEngines:
1630
- output.SupportedEngines !== undefined && output.SupportedEngines !== null
1631
- ? deserializeAws_restJson1EngineList(output.SupportedEngines, context)
1632
- : undefined,
1633
- } as any;
1634
- };
1635
-
1636
- const deserializeAws_restJson1VoiceList = (output: any, context: __SerdeContext): Voice[] => {
1637
- return (output || [])
1638
- .filter((e: any) => e != null)
1639
- .map((entry: any) => {
1640
- if (entry === null) {
1641
- return null as any;
1642
- }
1643
- return deserializeAws_restJson1Voice(entry, context);
1644
- });
1645
- };
1646
-
1647
- const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
1648
- httpStatusCode: output.statusCode,
1649
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
1650
- extendedRequestId: output.headers["x-amz-id-2"],
1651
- cfId: output.headers["x-amz-cf-id"],
1652
- });
1653
-
1654
- // Collect low-level response body stream to Uint8Array.
1655
- const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
1656
- if (streamBody instanceof Uint8Array) {
1657
- return Promise.resolve(streamBody);
1658
- }
1659
- return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
1660
- };
1661
-
1662
- // Encode Uint8Array data into string with utf-8.
1663
- const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
1664
- collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
1665
-
1666
- const isSerializableHeaderValue = (value: any): boolean =>
1667
- value !== undefined &&
1668
- value !== null &&
1669
- value !== "" &&
1670
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
1671
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
1672
-
1673
- const parseBody = (streamBody: any, context: __SerdeContext): any =>
1674
- collectBodyString(streamBody, context).then((encoded) => {
1675
- if (encoded.length) {
1676
- return JSON.parse(encoded);
1677
- }
1678
- return {};
1679
- });
1680
-
1681
- /**
1682
- * Load an error code for the aws.rest-json-1.1 protocol.
1683
- */
1684
- const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => {
1685
- const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
1686
-
1687
- const sanitizeErrorCode = (rawValue: string): string => {
1688
- let cleanValue = rawValue;
1689
- if (cleanValue.indexOf(":") >= 0) {
1690
- cleanValue = cleanValue.split(":")[0];
1691
- }
1692
- if (cleanValue.indexOf("#") >= 0) {
1693
- cleanValue = cleanValue.split("#")[1];
1694
- }
1695
- return cleanValue;
1696
- };
1697
-
1698
- const headerKey = findKey(output.headers, "x-amzn-errortype");
1699
- if (headerKey !== undefined) {
1700
- return sanitizeErrorCode(output.headers[headerKey]);
1701
- }
1702
-
1703
- if (data.code !== undefined) {
1704
- return sanitizeErrorCode(data.code);
1705
- }
1706
-
1707
- if (data["__type"] !== undefined) {
1708
- return sanitizeErrorCode(data["__type"]);
1709
- }
1710
-
1711
- return "";
1712
- };