@aws-sdk/client-polly 3.312.0 → 3.316.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,5 +1,5 @@
1
1
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
- import { decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, map as __map, parseEpochTimestamp as __parseEpochTimestamp, resolvedPath as __resolvedPath, strictParseInt32 as __strictParseInt32, throwDefaultError, } from "@aws-sdk/smithy-client";
2
+ import { _json, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, map, parseEpochTimestamp as __parseEpochTimestamp, resolvedPath as __resolvedPath, strictParseInt32 as __strictParseInt32, take, withBaseException, } from "@aws-sdk/smithy-client";
3
3
  import { EngineNotSupportedException, InvalidLexiconException, InvalidNextTokenException, InvalidS3BucketException, InvalidS3KeyException, InvalidSampleRateException, InvalidSnsTopicArnException, InvalidSsmlException, InvalidTaskIdException, LanguageNotSupportedException, LexiconNotFoundException, LexiconSizeExceededException, MarksNotSupportedForFormatException, MaxLexemeLengthExceededException, MaxLexiconsNumberExceededException, ServiceFailureException, SsmlMarksNotSupportedForTextTypeException, SynthesisTaskNotFoundException, TextLengthExceededException, UnsupportedPlsAlphabetException, UnsupportedPlsLanguageException, } from "../models/models_0";
4
4
  import { PollyServiceException as __BaseException } from "../models/PollyServiceException";
5
5
  export const se_DeleteLexiconCommand = async (input, context) => {
@@ -123,9 +123,9 @@ export const se_PutLexiconCommand = async (input, context) => {
123
123
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/lexicons/{Name}";
124
124
  resolvedPath = __resolvedPath(resolvedPath, input, "Name", () => input.Name, "{Name}", false);
125
125
  let body;
126
- body = JSON.stringify({
127
- ...(input.Content != null && { Content: input.Content }),
128
- });
126
+ body = JSON.stringify(take(input, {
127
+ Content: [],
128
+ }));
129
129
  return new __HttpRequest({
130
130
  protocol,
131
131
  hostname,
@@ -143,20 +143,20 @@ export const se_StartSpeechSynthesisTaskCommand = async (input, context) => {
143
143
  };
144
144
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/synthesisTasks";
145
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 && { LexiconNames: se_LexiconNameList(input.LexiconNames, context) }),
150
- ...(input.OutputFormat != null && { OutputFormat: input.OutputFormat }),
151
- ...(input.OutputS3BucketName != null && { OutputS3BucketName: input.OutputS3BucketName }),
152
- ...(input.OutputS3KeyPrefix != null && { OutputS3KeyPrefix: input.OutputS3KeyPrefix }),
153
- ...(input.SampleRate != null && { SampleRate: input.SampleRate }),
154
- ...(input.SnsTopicArn != null && { SnsTopicArn: input.SnsTopicArn }),
155
- ...(input.SpeechMarkTypes != null && { SpeechMarkTypes: se_SpeechMarkTypeList(input.SpeechMarkTypes, context) }),
156
- ...(input.Text != null && { Text: input.Text }),
157
- ...(input.TextType != null && { TextType: input.TextType }),
158
- ...(input.VoiceId != null && { VoiceId: input.VoiceId }),
159
- });
146
+ body = JSON.stringify(take(input, {
147
+ Engine: [],
148
+ LanguageCode: [],
149
+ LexiconNames: (_) => _json(_),
150
+ OutputFormat: [],
151
+ OutputS3BucketName: [],
152
+ OutputS3KeyPrefix: [],
153
+ SampleRate: [],
154
+ SnsTopicArn: [],
155
+ SpeechMarkTypes: (_) => _json(_),
156
+ Text: [],
157
+ TextType: [],
158
+ VoiceId: [],
159
+ }));
160
160
  return new __HttpRequest({
161
161
  protocol,
162
162
  hostname,
@@ -174,17 +174,17 @@ export const se_SynthesizeSpeechCommand = async (input, context) => {
174
174
  };
175
175
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/speech";
176
176
  let body;
177
- body = JSON.stringify({
178
- ...(input.Engine != null && { Engine: input.Engine }),
179
- ...(input.LanguageCode != null && { LanguageCode: input.LanguageCode }),
180
- ...(input.LexiconNames != null && { LexiconNames: se_LexiconNameList(input.LexiconNames, context) }),
181
- ...(input.OutputFormat != null && { OutputFormat: input.OutputFormat }),
182
- ...(input.SampleRate != null && { SampleRate: input.SampleRate }),
183
- ...(input.SpeechMarkTypes != null && { SpeechMarkTypes: se_SpeechMarkTypeList(input.SpeechMarkTypes, context) }),
184
- ...(input.Text != null && { Text: input.Text }),
185
- ...(input.TextType != null && { TextType: input.TextType }),
186
- ...(input.VoiceId != null && { VoiceId: input.VoiceId }),
187
- });
177
+ body = JSON.stringify(take(input, {
178
+ Engine: [],
179
+ LanguageCode: [],
180
+ LexiconNames: (_) => _json(_),
181
+ OutputFormat: [],
182
+ SampleRate: [],
183
+ SpeechMarkTypes: (_) => _json(_),
184
+ Text: [],
185
+ TextType: [],
186
+ VoiceId: [],
187
+ }));
188
188
  return new __HttpRequest({
189
189
  protocol,
190
190
  hostname,
@@ -220,10 +220,9 @@ const de_DeleteLexiconCommandError = async (output, context) => {
220
220
  throw await de_ServiceFailureExceptionRes(parsedOutput, context);
221
221
  default:
222
222
  const parsedBody = parsedOutput.body;
223
- throwDefaultError({
223
+ return throwDefaultError({
224
224
  output,
225
225
  parsedBody,
226
- exceptionCtor: __BaseException,
227
226
  errorCode,
228
227
  });
229
228
  }
@@ -236,12 +235,11 @@ export const de_DescribeVoicesCommand = async (output, context) => {
236
235
  $metadata: deserializeMetadata(output),
237
236
  });
238
237
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
239
- if (data.NextToken != null) {
240
- contents.NextToken = __expectString(data.NextToken);
241
- }
242
- if (data.Voices != null) {
243
- contents.Voices = de_VoiceList(data.Voices, context);
244
- }
238
+ const doc = take(data, {
239
+ NextToken: __expectString,
240
+ Voices: _json,
241
+ });
242
+ Object.assign(contents, doc);
245
243
  return contents;
246
244
  };
247
245
  const de_DescribeVoicesCommandError = async (output, context) => {
@@ -259,10 +257,9 @@ const de_DescribeVoicesCommandError = async (output, context) => {
259
257
  throw await de_ServiceFailureExceptionRes(parsedOutput, context);
260
258
  default:
261
259
  const parsedBody = parsedOutput.body;
262
- throwDefaultError({
260
+ return throwDefaultError({
263
261
  output,
264
262
  parsedBody,
265
- exceptionCtor: __BaseException,
266
263
  errorCode,
267
264
  });
268
265
  }
@@ -275,12 +272,11 @@ export const de_GetLexiconCommand = async (output, context) => {
275
272
  $metadata: deserializeMetadata(output),
276
273
  });
277
274
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
278
- if (data.Lexicon != null) {
279
- contents.Lexicon = de_Lexicon(data.Lexicon, context);
280
- }
281
- if (data.LexiconAttributes != null) {
282
- contents.LexiconAttributes = de_LexiconAttributes(data.LexiconAttributes, context);
283
- }
275
+ const doc = take(data, {
276
+ Lexicon: _json,
277
+ LexiconAttributes: (_) => de_LexiconAttributes(_, context),
278
+ });
279
+ Object.assign(contents, doc);
284
280
  return contents;
285
281
  };
286
282
  const de_GetLexiconCommandError = async (output, context) => {
@@ -298,10 +294,9 @@ const de_GetLexiconCommandError = async (output, context) => {
298
294
  throw await de_ServiceFailureExceptionRes(parsedOutput, context);
299
295
  default:
300
296
  const parsedBody = parsedOutput.body;
301
- throwDefaultError({
297
+ return throwDefaultError({
302
298
  output,
303
299
  parsedBody,
304
- exceptionCtor: __BaseException,
305
300
  errorCode,
306
301
  });
307
302
  }
@@ -314,9 +309,10 @@ export const de_GetSpeechSynthesisTaskCommand = async (output, context) => {
314
309
  $metadata: deserializeMetadata(output),
315
310
  });
316
311
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
317
- if (data.SynthesisTask != null) {
318
- contents.SynthesisTask = de_SynthesisTask(data.SynthesisTask, context);
319
- }
312
+ const doc = take(data, {
313
+ SynthesisTask: (_) => de_SynthesisTask(_, context),
314
+ });
315
+ Object.assign(contents, doc);
320
316
  return contents;
321
317
  };
322
318
  const de_GetSpeechSynthesisTaskCommandError = async (output, context) => {
@@ -337,10 +333,9 @@ const de_GetSpeechSynthesisTaskCommandError = async (output, context) => {
337
333
  throw await de_SynthesisTaskNotFoundExceptionRes(parsedOutput, context);
338
334
  default:
339
335
  const parsedBody = parsedOutput.body;
340
- throwDefaultError({
336
+ return throwDefaultError({
341
337
  output,
342
338
  parsedBody,
343
- exceptionCtor: __BaseException,
344
339
  errorCode,
345
340
  });
346
341
  }
@@ -353,12 +348,11 @@ export const de_ListLexiconsCommand = async (output, context) => {
353
348
  $metadata: deserializeMetadata(output),
354
349
  });
355
350
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
356
- if (data.Lexicons != null) {
357
- contents.Lexicons = de_LexiconDescriptionList(data.Lexicons, context);
358
- }
359
- if (data.NextToken != null) {
360
- contents.NextToken = __expectString(data.NextToken);
361
- }
351
+ const doc = take(data, {
352
+ Lexicons: (_) => de_LexiconDescriptionList(_, context),
353
+ NextToken: __expectString,
354
+ });
355
+ Object.assign(contents, doc);
362
356
  return contents;
363
357
  };
364
358
  const de_ListLexiconsCommandError = async (output, context) => {
@@ -376,10 +370,9 @@ const de_ListLexiconsCommandError = async (output, context) => {
376
370
  throw await de_ServiceFailureExceptionRes(parsedOutput, context);
377
371
  default:
378
372
  const parsedBody = parsedOutput.body;
379
- throwDefaultError({
373
+ return throwDefaultError({
380
374
  output,
381
375
  parsedBody,
382
- exceptionCtor: __BaseException,
383
376
  errorCode,
384
377
  });
385
378
  }
@@ -392,12 +385,11 @@ export const de_ListSpeechSynthesisTasksCommand = async (output, context) => {
392
385
  $metadata: deserializeMetadata(output),
393
386
  });
394
387
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
395
- if (data.NextToken != null) {
396
- contents.NextToken = __expectString(data.NextToken);
397
- }
398
- if (data.SynthesisTasks != null) {
399
- contents.SynthesisTasks = de_SynthesisTasks(data.SynthesisTasks, context);
400
- }
388
+ const doc = take(data, {
389
+ NextToken: __expectString,
390
+ SynthesisTasks: (_) => de_SynthesisTasks(_, context),
391
+ });
392
+ Object.assign(contents, doc);
401
393
  return contents;
402
394
  };
403
395
  const de_ListSpeechSynthesisTasksCommandError = async (output, context) => {
@@ -415,10 +407,9 @@ const de_ListSpeechSynthesisTasksCommandError = async (output, context) => {
415
407
  throw await de_ServiceFailureExceptionRes(parsedOutput, context);
416
408
  default:
417
409
  const parsedBody = parsedOutput.body;
418
- throwDefaultError({
410
+ return throwDefaultError({
419
411
  output,
420
412
  parsedBody,
421
- exceptionCtor: __BaseException,
422
413
  errorCode,
423
414
  });
424
415
  }
@@ -463,10 +454,9 @@ const de_PutLexiconCommandError = async (output, context) => {
463
454
  throw await de_UnsupportedPlsLanguageExceptionRes(parsedOutput, context);
464
455
  default:
465
456
  const parsedBody = parsedOutput.body;
466
- throwDefaultError({
457
+ return throwDefaultError({
467
458
  output,
468
459
  parsedBody,
469
- exceptionCtor: __BaseException,
470
460
  errorCode,
471
461
  });
472
462
  }
@@ -479,9 +469,10 @@ export const de_StartSpeechSynthesisTaskCommand = async (output, context) => {
479
469
  $metadata: deserializeMetadata(output),
480
470
  });
481
471
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
482
- if (data.SynthesisTask != null) {
483
- contents.SynthesisTask = de_SynthesisTask(data.SynthesisTask, context);
484
- }
472
+ const doc = take(data, {
473
+ SynthesisTask: (_) => de_SynthesisTask(_, context),
474
+ });
475
+ Object.assign(contents, doc);
485
476
  return contents;
486
477
  };
487
478
  const de_StartSpeechSynthesisTaskCommandError = async (output, context) => {
@@ -529,10 +520,9 @@ const de_StartSpeechSynthesisTaskCommandError = async (output, context) => {
529
520
  throw await de_TextLengthExceededExceptionRes(parsedOutput, context);
530
521
  default:
531
522
  const parsedBody = parsedOutput.body;
532
- throwDefaultError({
523
+ return throwDefaultError({
533
524
  output,
534
525
  parsedBody,
535
- exceptionCtor: __BaseException,
536
526
  errorCode,
537
527
  });
538
528
  }
@@ -590,21 +580,21 @@ const de_SynthesizeSpeechCommandError = async (output, context) => {
590
580
  throw await de_TextLengthExceededExceptionRes(parsedOutput, context);
591
581
  default:
592
582
  const parsedBody = parsedOutput.body;
593
- throwDefaultError({
583
+ return throwDefaultError({
594
584
  output,
595
585
  parsedBody,
596
- exceptionCtor: __BaseException,
597
586
  errorCode,
598
587
  });
599
588
  }
600
589
  };
601
- const map = __map;
590
+ const throwDefaultError = withBaseException(__BaseException);
602
591
  const de_EngineNotSupportedExceptionRes = async (parsedOutput, context) => {
603
592
  const contents = map({});
604
593
  const data = parsedOutput.body;
605
- if (data.message != null) {
606
- contents.message = __expectString(data.message);
607
- }
594
+ const doc = take(data, {
595
+ message: __expectString,
596
+ });
597
+ Object.assign(contents, doc);
608
598
  const exception = new EngineNotSupportedException({
609
599
  $metadata: deserializeMetadata(parsedOutput),
610
600
  ...contents,
@@ -614,9 +604,10 @@ const de_EngineNotSupportedExceptionRes = async (parsedOutput, context) => {
614
604
  const de_InvalidLexiconExceptionRes = async (parsedOutput, context) => {
615
605
  const contents = map({});
616
606
  const data = parsedOutput.body;
617
- if (data.message != null) {
618
- contents.message = __expectString(data.message);
619
- }
607
+ const doc = take(data, {
608
+ message: __expectString,
609
+ });
610
+ Object.assign(contents, doc);
620
611
  const exception = new InvalidLexiconException({
621
612
  $metadata: deserializeMetadata(parsedOutput),
622
613
  ...contents,
@@ -626,9 +617,10 @@ const de_InvalidLexiconExceptionRes = async (parsedOutput, context) => {
626
617
  const de_InvalidNextTokenExceptionRes = async (parsedOutput, context) => {
627
618
  const contents = map({});
628
619
  const data = parsedOutput.body;
629
- if (data.message != null) {
630
- contents.message = __expectString(data.message);
631
- }
620
+ const doc = take(data, {
621
+ message: __expectString,
622
+ });
623
+ Object.assign(contents, doc);
632
624
  const exception = new InvalidNextTokenException({
633
625
  $metadata: deserializeMetadata(parsedOutput),
634
626
  ...contents,
@@ -638,9 +630,10 @@ const de_InvalidNextTokenExceptionRes = async (parsedOutput, context) => {
638
630
  const de_InvalidS3BucketExceptionRes = async (parsedOutput, context) => {
639
631
  const contents = map({});
640
632
  const data = parsedOutput.body;
641
- if (data.message != null) {
642
- contents.message = __expectString(data.message);
643
- }
633
+ const doc = take(data, {
634
+ message: __expectString,
635
+ });
636
+ Object.assign(contents, doc);
644
637
  const exception = new InvalidS3BucketException({
645
638
  $metadata: deserializeMetadata(parsedOutput),
646
639
  ...contents,
@@ -650,9 +643,10 @@ const de_InvalidS3BucketExceptionRes = async (parsedOutput, context) => {
650
643
  const de_InvalidS3KeyExceptionRes = async (parsedOutput, context) => {
651
644
  const contents = map({});
652
645
  const data = parsedOutput.body;
653
- if (data.message != null) {
654
- contents.message = __expectString(data.message);
655
- }
646
+ const doc = take(data, {
647
+ message: __expectString,
648
+ });
649
+ Object.assign(contents, doc);
656
650
  const exception = new InvalidS3KeyException({
657
651
  $metadata: deserializeMetadata(parsedOutput),
658
652
  ...contents,
@@ -662,9 +656,10 @@ const de_InvalidS3KeyExceptionRes = async (parsedOutput, context) => {
662
656
  const de_InvalidSampleRateExceptionRes = async (parsedOutput, context) => {
663
657
  const contents = map({});
664
658
  const data = parsedOutput.body;
665
- if (data.message != null) {
666
- contents.message = __expectString(data.message);
667
- }
659
+ const doc = take(data, {
660
+ message: __expectString,
661
+ });
662
+ Object.assign(contents, doc);
668
663
  const exception = new InvalidSampleRateException({
669
664
  $metadata: deserializeMetadata(parsedOutput),
670
665
  ...contents,
@@ -674,9 +669,10 @@ const de_InvalidSampleRateExceptionRes = async (parsedOutput, context) => {
674
669
  const de_InvalidSnsTopicArnExceptionRes = async (parsedOutput, context) => {
675
670
  const contents = map({});
676
671
  const data = parsedOutput.body;
677
- if (data.message != null) {
678
- contents.message = __expectString(data.message);
679
- }
672
+ const doc = take(data, {
673
+ message: __expectString,
674
+ });
675
+ Object.assign(contents, doc);
680
676
  const exception = new InvalidSnsTopicArnException({
681
677
  $metadata: deserializeMetadata(parsedOutput),
682
678
  ...contents,
@@ -686,9 +682,10 @@ const de_InvalidSnsTopicArnExceptionRes = async (parsedOutput, context) => {
686
682
  const de_InvalidSsmlExceptionRes = async (parsedOutput, context) => {
687
683
  const contents = map({});
688
684
  const data = parsedOutput.body;
689
- if (data.message != null) {
690
- contents.message = __expectString(data.message);
691
- }
685
+ const doc = take(data, {
686
+ message: __expectString,
687
+ });
688
+ Object.assign(contents, doc);
692
689
  const exception = new InvalidSsmlException({
693
690
  $metadata: deserializeMetadata(parsedOutput),
694
691
  ...contents,
@@ -698,9 +695,10 @@ const de_InvalidSsmlExceptionRes = async (parsedOutput, context) => {
698
695
  const de_InvalidTaskIdExceptionRes = async (parsedOutput, context) => {
699
696
  const contents = map({});
700
697
  const data = parsedOutput.body;
701
- if (data.message != null) {
702
- contents.message = __expectString(data.message);
703
- }
698
+ const doc = take(data, {
699
+ message: __expectString,
700
+ });
701
+ Object.assign(contents, doc);
704
702
  const exception = new InvalidTaskIdException({
705
703
  $metadata: deserializeMetadata(parsedOutput),
706
704
  ...contents,
@@ -710,9 +708,10 @@ const de_InvalidTaskIdExceptionRes = async (parsedOutput, context) => {
710
708
  const de_LanguageNotSupportedExceptionRes = async (parsedOutput, context) => {
711
709
  const contents = map({});
712
710
  const data = parsedOutput.body;
713
- if (data.message != null) {
714
- contents.message = __expectString(data.message);
715
- }
711
+ const doc = take(data, {
712
+ message: __expectString,
713
+ });
714
+ Object.assign(contents, doc);
716
715
  const exception = new LanguageNotSupportedException({
717
716
  $metadata: deserializeMetadata(parsedOutput),
718
717
  ...contents,
@@ -722,9 +721,10 @@ const de_LanguageNotSupportedExceptionRes = async (parsedOutput, context) => {
722
721
  const de_LexiconNotFoundExceptionRes = async (parsedOutput, context) => {
723
722
  const contents = map({});
724
723
  const data = parsedOutput.body;
725
- if (data.message != null) {
726
- contents.message = __expectString(data.message);
727
- }
724
+ const doc = take(data, {
725
+ message: __expectString,
726
+ });
727
+ Object.assign(contents, doc);
728
728
  const exception = new LexiconNotFoundException({
729
729
  $metadata: deserializeMetadata(parsedOutput),
730
730
  ...contents,
@@ -734,9 +734,10 @@ const de_LexiconNotFoundExceptionRes = async (parsedOutput, context) => {
734
734
  const de_LexiconSizeExceededExceptionRes = async (parsedOutput, context) => {
735
735
  const contents = map({});
736
736
  const data = parsedOutput.body;
737
- if (data.message != null) {
738
- contents.message = __expectString(data.message);
739
- }
737
+ const doc = take(data, {
738
+ message: __expectString,
739
+ });
740
+ Object.assign(contents, doc);
740
741
  const exception = new LexiconSizeExceededException({
741
742
  $metadata: deserializeMetadata(parsedOutput),
742
743
  ...contents,
@@ -746,9 +747,10 @@ const de_LexiconSizeExceededExceptionRes = async (parsedOutput, context) => {
746
747
  const de_MarksNotSupportedForFormatExceptionRes = async (parsedOutput, context) => {
747
748
  const contents = map({});
748
749
  const data = parsedOutput.body;
749
- if (data.message != null) {
750
- contents.message = __expectString(data.message);
751
- }
750
+ const doc = take(data, {
751
+ message: __expectString,
752
+ });
753
+ Object.assign(contents, doc);
752
754
  const exception = new MarksNotSupportedForFormatException({
753
755
  $metadata: deserializeMetadata(parsedOutput),
754
756
  ...contents,
@@ -758,9 +760,10 @@ const de_MarksNotSupportedForFormatExceptionRes = async (parsedOutput, context)
758
760
  const de_MaxLexemeLengthExceededExceptionRes = async (parsedOutput, context) => {
759
761
  const contents = map({});
760
762
  const data = parsedOutput.body;
761
- if (data.message != null) {
762
- contents.message = __expectString(data.message);
763
- }
763
+ const doc = take(data, {
764
+ message: __expectString,
765
+ });
766
+ Object.assign(contents, doc);
764
767
  const exception = new MaxLexemeLengthExceededException({
765
768
  $metadata: deserializeMetadata(parsedOutput),
766
769
  ...contents,
@@ -770,9 +773,10 @@ const de_MaxLexemeLengthExceededExceptionRes = async (parsedOutput, context) =>
770
773
  const de_MaxLexiconsNumberExceededExceptionRes = async (parsedOutput, context) => {
771
774
  const contents = map({});
772
775
  const data = parsedOutput.body;
773
- if (data.message != null) {
774
- contents.message = __expectString(data.message);
775
- }
776
+ const doc = take(data, {
777
+ message: __expectString,
778
+ });
779
+ Object.assign(contents, doc);
776
780
  const exception = new MaxLexiconsNumberExceededException({
777
781
  $metadata: deserializeMetadata(parsedOutput),
778
782
  ...contents,
@@ -782,9 +786,10 @@ const de_MaxLexiconsNumberExceededExceptionRes = async (parsedOutput, context) =
782
786
  const de_ServiceFailureExceptionRes = async (parsedOutput, context) => {
783
787
  const contents = map({});
784
788
  const data = parsedOutput.body;
785
- if (data.message != null) {
786
- contents.message = __expectString(data.message);
787
- }
789
+ const doc = take(data, {
790
+ message: __expectString,
791
+ });
792
+ Object.assign(contents, doc);
788
793
  const exception = new ServiceFailureException({
789
794
  $metadata: deserializeMetadata(parsedOutput),
790
795
  ...contents,
@@ -794,9 +799,10 @@ const de_ServiceFailureExceptionRes = async (parsedOutput, context) => {
794
799
  const de_SsmlMarksNotSupportedForTextTypeExceptionRes = async (parsedOutput, context) => {
795
800
  const contents = map({});
796
801
  const data = parsedOutput.body;
797
- if (data.message != null) {
798
- contents.message = __expectString(data.message);
799
- }
802
+ const doc = take(data, {
803
+ message: __expectString,
804
+ });
805
+ Object.assign(contents, doc);
800
806
  const exception = new SsmlMarksNotSupportedForTextTypeException({
801
807
  $metadata: deserializeMetadata(parsedOutput),
802
808
  ...contents,
@@ -806,9 +812,10 @@ const de_SsmlMarksNotSupportedForTextTypeExceptionRes = async (parsedOutput, con
806
812
  const de_SynthesisTaskNotFoundExceptionRes = async (parsedOutput, context) => {
807
813
  const contents = map({});
808
814
  const data = parsedOutput.body;
809
- if (data.message != null) {
810
- contents.message = __expectString(data.message);
811
- }
815
+ const doc = take(data, {
816
+ message: __expectString,
817
+ });
818
+ Object.assign(contents, doc);
812
819
  const exception = new SynthesisTaskNotFoundException({
813
820
  $metadata: deserializeMetadata(parsedOutput),
814
821
  ...contents,
@@ -818,9 +825,10 @@ const de_SynthesisTaskNotFoundExceptionRes = async (parsedOutput, context) => {
818
825
  const de_TextLengthExceededExceptionRes = async (parsedOutput, context) => {
819
826
  const contents = map({});
820
827
  const data = parsedOutput.body;
821
- if (data.message != null) {
822
- contents.message = __expectString(data.message);
823
- }
828
+ const doc = take(data, {
829
+ message: __expectString,
830
+ });
831
+ Object.assign(contents, doc);
824
832
  const exception = new TextLengthExceededException({
825
833
  $metadata: deserializeMetadata(parsedOutput),
826
834
  ...contents,
@@ -830,9 +838,10 @@ const de_TextLengthExceededExceptionRes = async (parsedOutput, context) => {
830
838
  const de_UnsupportedPlsAlphabetExceptionRes = async (parsedOutput, context) => {
831
839
  const contents = map({});
832
840
  const data = parsedOutput.body;
833
- if (data.message != null) {
834
- contents.message = __expectString(data.message);
835
- }
841
+ const doc = take(data, {
842
+ message: __expectString,
843
+ });
844
+ Object.assign(contents, doc);
836
845
  const exception = new UnsupportedPlsAlphabetException({
837
846
  $metadata: deserializeMetadata(parsedOutput),
838
847
  ...contents,
@@ -842,162 +851,67 @@ const de_UnsupportedPlsAlphabetExceptionRes = async (parsedOutput, context) => {
842
851
  const de_UnsupportedPlsLanguageExceptionRes = async (parsedOutput, context) => {
843
852
  const contents = map({});
844
853
  const data = parsedOutput.body;
845
- if (data.message != null) {
846
- contents.message = __expectString(data.message);
847
- }
854
+ const doc = take(data, {
855
+ message: __expectString,
856
+ });
857
+ Object.assign(contents, doc);
848
858
  const exception = new UnsupportedPlsLanguageException({
849
859
  $metadata: deserializeMetadata(parsedOutput),
850
860
  ...contents,
851
861
  });
852
862
  return __decorateServiceException(exception, parsedOutput.body);
853
863
  };
854
- const se_LexiconNameList = (input, context) => {
855
- return input
856
- .filter((e) => e != null)
857
- .map((entry) => {
858
- return entry;
859
- });
860
- };
861
- const se_SpeechMarkTypeList = (input, context) => {
862
- return input
863
- .filter((e) => e != null)
864
- .map((entry) => {
865
- return entry;
866
- });
867
- };
868
- const de_EngineList = (output, context) => {
869
- const retVal = (output || [])
870
- .filter((e) => e != null)
871
- .map((entry) => {
872
- if (entry === null) {
873
- return null;
874
- }
875
- return __expectString(entry);
876
- });
877
- return retVal;
878
- };
879
- const de_LanguageCodeList = (output, context) => {
880
- const retVal = (output || [])
881
- .filter((e) => e != null)
882
- .map((entry) => {
883
- if (entry === null) {
884
- return null;
885
- }
886
- return __expectString(entry);
887
- });
888
- return retVal;
889
- };
890
- const de_Lexicon = (output, context) => {
891
- return {
892
- Content: __expectString(output.Content),
893
- Name: __expectString(output.Name),
894
- };
895
- };
896
864
  const de_LexiconAttributes = (output, context) => {
897
- return {
898
- Alphabet: __expectString(output.Alphabet),
899
- LanguageCode: __expectString(output.LanguageCode),
900
- LastModified: output.LastModified != null
901
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.LastModified)))
902
- : undefined,
903
- LexemesCount: __expectInt32(output.LexemesCount),
904
- LexiconArn: __expectString(output.LexiconArn),
905
- Size: __expectInt32(output.Size),
906
- };
865
+ return take(output, {
866
+ Alphabet: __expectString,
867
+ LanguageCode: __expectString,
868
+ LastModified: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
869
+ LexemesCount: __expectInt32,
870
+ LexiconArn: __expectString,
871
+ Size: __expectInt32,
872
+ });
907
873
  };
908
874
  const de_LexiconDescription = (output, context) => {
909
- return {
910
- Attributes: output.Attributes != null ? de_LexiconAttributes(output.Attributes, context) : undefined,
911
- Name: __expectString(output.Name),
912
- };
875
+ return take(output, {
876
+ Attributes: (_) => de_LexiconAttributes(_, context),
877
+ Name: __expectString,
878
+ });
913
879
  };
914
880
  const de_LexiconDescriptionList = (output, context) => {
915
881
  const retVal = (output || [])
916
882
  .filter((e) => e != null)
917
883
  .map((entry) => {
918
- if (entry === null) {
919
- return null;
920
- }
921
884
  return de_LexiconDescription(entry, context);
922
885
  });
923
886
  return retVal;
924
887
  };
925
- const de_LexiconNameList = (output, context) => {
926
- const retVal = (output || [])
927
- .filter((e) => e != null)
928
- .map((entry) => {
929
- if (entry === null) {
930
- return null;
931
- }
932
- return __expectString(entry);
933
- });
934
- return retVal;
935
- };
936
- const de_SpeechMarkTypeList = (output, context) => {
937
- const retVal = (output || [])
938
- .filter((e) => e != null)
939
- .map((entry) => {
940
- if (entry === null) {
941
- return null;
942
- }
943
- return __expectString(entry);
944
- });
945
- return retVal;
946
- };
947
888
  const de_SynthesisTask = (output, context) => {
948
- return {
949
- CreationTime: output.CreationTime != null
950
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.CreationTime)))
951
- : undefined,
952
- Engine: __expectString(output.Engine),
953
- LanguageCode: __expectString(output.LanguageCode),
954
- LexiconNames: output.LexiconNames != null ? de_LexiconNameList(output.LexiconNames, context) : undefined,
955
- OutputFormat: __expectString(output.OutputFormat),
956
- OutputUri: __expectString(output.OutputUri),
957
- RequestCharacters: __expectInt32(output.RequestCharacters),
958
- SampleRate: __expectString(output.SampleRate),
959
- SnsTopicArn: __expectString(output.SnsTopicArn),
960
- SpeechMarkTypes: output.SpeechMarkTypes != null ? de_SpeechMarkTypeList(output.SpeechMarkTypes, context) : undefined,
961
- TaskId: __expectString(output.TaskId),
962
- TaskStatus: __expectString(output.TaskStatus),
963
- TaskStatusReason: __expectString(output.TaskStatusReason),
964
- TextType: __expectString(output.TextType),
965
- VoiceId: __expectString(output.VoiceId),
966
- };
889
+ return take(output, {
890
+ CreationTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
891
+ Engine: __expectString,
892
+ LanguageCode: __expectString,
893
+ LexiconNames: _json,
894
+ OutputFormat: __expectString,
895
+ OutputUri: __expectString,
896
+ RequestCharacters: __expectInt32,
897
+ SampleRate: __expectString,
898
+ SnsTopicArn: __expectString,
899
+ SpeechMarkTypes: _json,
900
+ TaskId: __expectString,
901
+ TaskStatus: __expectString,
902
+ TaskStatusReason: __expectString,
903
+ TextType: __expectString,
904
+ VoiceId: __expectString,
905
+ });
967
906
  };
968
907
  const de_SynthesisTasks = (output, context) => {
969
908
  const retVal = (output || [])
970
909
  .filter((e) => e != null)
971
910
  .map((entry) => {
972
- if (entry === null) {
973
- return null;
974
- }
975
911
  return de_SynthesisTask(entry, context);
976
912
  });
977
913
  return retVal;
978
914
  };
979
- const de_Voice = (output, context) => {
980
- return {
981
- AdditionalLanguageCodes: output.AdditionalLanguageCodes != null ? de_LanguageCodeList(output.AdditionalLanguageCodes, context) : undefined,
982
- Gender: __expectString(output.Gender),
983
- Id: __expectString(output.Id),
984
- LanguageCode: __expectString(output.LanguageCode),
985
- LanguageName: __expectString(output.LanguageName),
986
- Name: __expectString(output.Name),
987
- SupportedEngines: output.SupportedEngines != null ? de_EngineList(output.SupportedEngines, context) : undefined,
988
- };
989
- };
990
- const de_VoiceList = (output, context) => {
991
- const retVal = (output || [])
992
- .filter((e) => e != null)
993
- .map((entry) => {
994
- if (entry === null) {
995
- return null;
996
- }
997
- return de_Voice(entry, context);
998
- });
999
- return retVal;
1000
- };
1001
915
  const deserializeMetadata = (output) => ({
1002
916
  httpStatusCode: output.statusCode,
1003
917
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],