@aws-sdk/client-connectcampaigns 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, expectBoolean as __expectBoolean, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, expectUnion as __expectUnion, limitedParseDouble as __limitedParseDouble, map as __map, resolvedPath as __resolvedPath, serializeFloat as __serializeFloat, throwDefaultError, } from "@aws-sdk/smithy-client";
2
+ import { _json, decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, expectUnion as __expectUnion, limitedParseDouble as __limitedParseDouble, map, resolvedPath as __resolvedPath, serializeFloat as __serializeFloat, take, withBaseException, } from "@aws-sdk/smithy-client";
3
3
  import { ConnectCampaignsServiceException as __BaseException } from "../models/ConnectCampaignsServiceException";
4
4
  import { AccessDeniedException, ConflictException, DialerConfig, InternalServerException, InvalidCampaignStateException, InvalidStateException, ResourceNotFoundException, ServiceQuotaExceededException, ThrottlingException, ValidationException, } from "../models/models_0";
5
5
  export const se_CreateCampaignCommand = async (input, context) => {
@@ -9,15 +9,13 @@ export const se_CreateCampaignCommand = async (input, context) => {
9
9
  };
10
10
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/campaigns";
11
11
  let body;
12
- body = JSON.stringify({
13
- ...(input.connectInstanceId != null && { connectInstanceId: input.connectInstanceId }),
14
- ...(input.dialerConfig != null && { dialerConfig: se_DialerConfig(input.dialerConfig, context) }),
15
- ...(input.name != null && { name: input.name }),
16
- ...(input.outboundCallConfig != null && {
17
- outboundCallConfig: se_OutboundCallConfig(input.outboundCallConfig, context),
18
- }),
19
- ...(input.tags != null && { tags: se_TagMap(input.tags, context) }),
20
- });
12
+ body = JSON.stringify(take(input, {
13
+ connectInstanceId: [],
14
+ dialerConfig: (_) => se_DialerConfig(_, context),
15
+ name: [],
16
+ outboundCallConfig: (_) => _json(_),
17
+ tags: (_) => _json(_),
18
+ }));
21
19
  return new __HttpRequest({
22
20
  protocol,
23
21
  hostname,
@@ -117,9 +115,9 @@ export const se_GetCampaignStateBatchCommand = async (input, context) => {
117
115
  };
118
116
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/campaigns-state";
119
117
  let body;
120
- body = JSON.stringify({
121
- ...(input.campaignIds != null && { campaignIds: se_CampaignIdList(input.campaignIds, context) }),
122
- });
118
+ body = JSON.stringify(take(input, {
119
+ campaignIds: (_) => _json(_),
120
+ }));
123
121
  return new __HttpRequest({
124
122
  protocol,
125
123
  hostname,
@@ -171,11 +169,11 @@ export const se_ListCampaignsCommand = async (input, context) => {
171
169
  };
172
170
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/campaigns-summary";
173
171
  let body;
174
- body = JSON.stringify({
175
- ...(input.filters != null && { filters: se_CampaignFilters(input.filters, context) }),
176
- ...(input.maxResults != null && { maxResults: input.maxResults }),
177
- ...(input.nextToken != null && { nextToken: input.nextToken }),
178
- });
172
+ body = JSON.stringify(take(input, {
173
+ filters: (_) => _json(_),
174
+ maxResults: [],
175
+ nextToken: [],
176
+ }));
179
177
  return new __HttpRequest({
180
178
  protocol,
181
179
  hostname,
@@ -226,9 +224,9 @@ export const se_PutDialRequestBatchCommand = async (input, context) => {
226
224
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/campaigns/{id}/dial-requests";
227
225
  resolvedPath = __resolvedPath(resolvedPath, input, "id", () => input.id, "{id}", false);
228
226
  let body;
229
- body = JSON.stringify({
230
- ...(input.dialRequests != null && { dialRequests: se_DialRequestList(input.dialRequests, context) }),
231
- });
227
+ body = JSON.stringify(take(input, {
228
+ dialRequests: (_) => se_DialRequestList(_, context),
229
+ }));
232
230
  return new __HttpRequest({
233
231
  protocol,
234
232
  hostname,
@@ -280,9 +278,9 @@ export const se_StartInstanceOnboardingJobCommand = async (input, context) => {
280
278
  "/connect-instance/{connectInstanceId}/onboarding";
281
279
  resolvedPath = __resolvedPath(resolvedPath, input, "connectInstanceId", () => input.connectInstanceId, "{connectInstanceId}", false);
282
280
  let body;
283
- body = JSON.stringify({
284
- ...(input.encryptionConfig != null && { encryptionConfig: se_EncryptionConfig(input.encryptionConfig, context) }),
285
- });
281
+ body = JSON.stringify(take(input, {
282
+ encryptionConfig: (_) => _json(_),
283
+ }));
286
284
  return new __HttpRequest({
287
285
  protocol,
288
286
  hostname,
@@ -317,9 +315,9 @@ export const se_TagResourceCommand = async (input, context) => {
317
315
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{arn}";
318
316
  resolvedPath = __resolvedPath(resolvedPath, input, "arn", () => input.arn, "{arn}", false);
319
317
  let body;
320
- body = JSON.stringify({
321
- ...(input.tags != null && { tags: se_TagMap(input.tags, context) }),
322
- });
318
+ body = JSON.stringify(take(input, {
319
+ tags: (_) => _json(_),
320
+ }));
323
321
  return new __HttpRequest({
324
322
  protocol,
325
323
  hostname,
@@ -361,9 +359,9 @@ export const se_UpdateCampaignDialerConfigCommand = async (input, context) => {
361
359
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/campaigns/{id}/dialer-config";
362
360
  resolvedPath = __resolvedPath(resolvedPath, input, "id", () => input.id, "{id}", false);
363
361
  let body;
364
- body = JSON.stringify({
365
- ...(input.dialerConfig != null && { dialerConfig: se_DialerConfig(input.dialerConfig, context) }),
366
- });
362
+ body = JSON.stringify(take(input, {
363
+ dialerConfig: (_) => se_DialerConfig(_, context),
364
+ }));
367
365
  return new __HttpRequest({
368
366
  protocol,
369
367
  hostname,
@@ -382,9 +380,9 @@ export const se_UpdateCampaignNameCommand = async (input, context) => {
382
380
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/campaigns/{id}/name";
383
381
  resolvedPath = __resolvedPath(resolvedPath, input, "id", () => input.id, "{id}", false);
384
382
  let body;
385
- body = JSON.stringify({
386
- ...(input.name != null && { name: input.name }),
387
- });
383
+ body = JSON.stringify(take(input, {
384
+ name: [],
385
+ }));
388
386
  return new __HttpRequest({
389
387
  protocol,
390
388
  hostname,
@@ -403,13 +401,11 @@ export const se_UpdateCampaignOutboundCallConfigCommand = async (input, context)
403
401
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/campaigns/{id}/outbound-call-config";
404
402
  resolvedPath = __resolvedPath(resolvedPath, input, "id", () => input.id, "{id}", false);
405
403
  let body;
406
- body = JSON.stringify({
407
- ...(input.answerMachineDetectionConfig != null && {
408
- answerMachineDetectionConfig: se_AnswerMachineDetectionConfig(input.answerMachineDetectionConfig, context),
409
- }),
410
- ...(input.connectContactFlowId != null && { connectContactFlowId: input.connectContactFlowId }),
411
- ...(input.connectSourcePhoneNumber != null && { connectSourcePhoneNumber: input.connectSourcePhoneNumber }),
412
- });
404
+ body = JSON.stringify(take(input, {
405
+ answerMachineDetectionConfig: (_) => _json(_),
406
+ connectContactFlowId: [],
407
+ connectSourcePhoneNumber: [],
408
+ }));
413
409
  return new __HttpRequest({
414
410
  protocol,
415
411
  hostname,
@@ -428,15 +424,12 @@ export const de_CreateCampaignCommand = async (output, context) => {
428
424
  $metadata: deserializeMetadata(output),
429
425
  });
430
426
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
431
- if (data.arn != null) {
432
- contents.arn = __expectString(data.arn);
433
- }
434
- if (data.id != null) {
435
- contents.id = __expectString(data.id);
436
- }
437
- if (data.tags != null) {
438
- contents.tags = de_TagMap(data.tags, context);
439
- }
427
+ const doc = take(data, {
428
+ arn: __expectString,
429
+ id: __expectString,
430
+ tags: _json,
431
+ });
432
+ Object.assign(contents, doc);
440
433
  return contents;
441
434
  };
442
435
  const de_CreateCampaignCommandError = async (output, context) => {
@@ -469,10 +462,9 @@ const de_CreateCampaignCommandError = async (output, context) => {
469
462
  throw await de_ValidationExceptionRes(parsedOutput, context);
470
463
  default:
471
464
  const parsedBody = parsedOutput.body;
472
- throwDefaultError({
465
+ return throwDefaultError({
473
466
  output,
474
467
  parsedBody,
475
- exceptionCtor: __BaseException,
476
468
  errorCode,
477
469
  });
478
470
  }
@@ -508,10 +500,9 @@ const de_DeleteCampaignCommandError = async (output, context) => {
508
500
  throw await de_ValidationExceptionRes(parsedOutput, context);
509
501
  default:
510
502
  const parsedBody = parsedOutput.body;
511
- throwDefaultError({
503
+ return throwDefaultError({
512
504
  output,
513
505
  parsedBody,
514
- exceptionCtor: __BaseException,
515
506
  errorCode,
516
507
  });
517
508
  }
@@ -553,10 +544,9 @@ const de_DeleteConnectInstanceConfigCommandError = async (output, context) => {
553
544
  throw await de_ValidationExceptionRes(parsedOutput, context);
554
545
  default:
555
546
  const parsedBody = parsedOutput.body;
556
- throwDefaultError({
547
+ return throwDefaultError({
557
548
  output,
558
549
  parsedBody,
559
- exceptionCtor: __BaseException,
560
550
  errorCode,
561
551
  });
562
552
  }
@@ -595,10 +585,9 @@ const de_DeleteInstanceOnboardingJobCommandError = async (output, context) => {
595
585
  throw await de_ValidationExceptionRes(parsedOutput, context);
596
586
  default:
597
587
  const parsedBody = parsedOutput.body;
598
- throwDefaultError({
588
+ return throwDefaultError({
599
589
  output,
600
590
  parsedBody,
601
- exceptionCtor: __BaseException,
602
591
  errorCode,
603
592
  });
604
593
  }
@@ -611,9 +600,10 @@ export const de_DescribeCampaignCommand = async (output, context) => {
611
600
  $metadata: deserializeMetadata(output),
612
601
  });
613
602
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
614
- if (data.campaign != null) {
615
- contents.campaign = de_Campaign(data.campaign, context);
616
- }
603
+ const doc = take(data, {
604
+ campaign: (_) => de_Campaign(_, context),
605
+ });
606
+ Object.assign(contents, doc);
617
607
  return contents;
618
608
  };
619
609
  const de_DescribeCampaignCommandError = async (output, context) => {
@@ -637,10 +627,9 @@ const de_DescribeCampaignCommandError = async (output, context) => {
637
627
  throw await de_ValidationExceptionRes(parsedOutput, context);
638
628
  default:
639
629
  const parsedBody = parsedOutput.body;
640
- throwDefaultError({
630
+ return throwDefaultError({
641
631
  output,
642
632
  parsedBody,
643
- exceptionCtor: __BaseException,
644
633
  errorCode,
645
634
  });
646
635
  }
@@ -653,9 +642,10 @@ export const de_GetCampaignStateCommand = async (output, context) => {
653
642
  $metadata: deserializeMetadata(output),
654
643
  });
655
644
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
656
- if (data.state != null) {
657
- contents.state = __expectString(data.state);
658
- }
645
+ const doc = take(data, {
646
+ state: __expectString,
647
+ });
648
+ Object.assign(contents, doc);
659
649
  return contents;
660
650
  };
661
651
  const de_GetCampaignStateCommandError = async (output, context) => {
@@ -682,10 +672,9 @@ const de_GetCampaignStateCommandError = async (output, context) => {
682
672
  throw await de_ValidationExceptionRes(parsedOutput, context);
683
673
  default:
684
674
  const parsedBody = parsedOutput.body;
685
- throwDefaultError({
675
+ return throwDefaultError({
686
676
  output,
687
677
  parsedBody,
688
- exceptionCtor: __BaseException,
689
678
  errorCode,
690
679
  });
691
680
  }
@@ -698,12 +687,11 @@ export const de_GetCampaignStateBatchCommand = async (output, context) => {
698
687
  $metadata: deserializeMetadata(output),
699
688
  });
700
689
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
701
- if (data.failedRequests != null) {
702
- contents.failedRequests = de_FailedCampaignStateResponseList(data.failedRequests, context);
703
- }
704
- if (data.successfulRequests != null) {
705
- contents.successfulRequests = de_SuccessfulCampaignStateResponseList(data.successfulRequests, context);
706
- }
690
+ const doc = take(data, {
691
+ failedRequests: _json,
692
+ successfulRequests: _json,
693
+ });
694
+ Object.assign(contents, doc);
707
695
  return contents;
708
696
  };
709
697
  const de_GetCampaignStateBatchCommandError = async (output, context) => {
@@ -727,10 +715,9 @@ const de_GetCampaignStateBatchCommandError = async (output, context) => {
727
715
  throw await de_ValidationExceptionRes(parsedOutput, context);
728
716
  default:
729
717
  const parsedBody = parsedOutput.body;
730
- throwDefaultError({
718
+ return throwDefaultError({
731
719
  output,
732
720
  parsedBody,
733
- exceptionCtor: __BaseException,
734
721
  errorCode,
735
722
  });
736
723
  }
@@ -743,9 +730,10 @@ export const de_GetConnectInstanceConfigCommand = async (output, context) => {
743
730
  $metadata: deserializeMetadata(output),
744
731
  });
745
732
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
746
- if (data.connectInstanceConfig != null) {
747
- contents.connectInstanceConfig = de_InstanceConfig(data.connectInstanceConfig, context);
748
- }
733
+ const doc = take(data, {
734
+ connectInstanceConfig: _json,
735
+ });
736
+ Object.assign(contents, doc);
749
737
  return contents;
750
738
  };
751
739
  const de_GetConnectInstanceConfigCommandError = async (output, context) => {
@@ -769,10 +757,9 @@ const de_GetConnectInstanceConfigCommandError = async (output, context) => {
769
757
  throw await de_ValidationExceptionRes(parsedOutput, context);
770
758
  default:
771
759
  const parsedBody = parsedOutput.body;
772
- throwDefaultError({
760
+ return throwDefaultError({
773
761
  output,
774
762
  parsedBody,
775
- exceptionCtor: __BaseException,
776
763
  errorCode,
777
764
  });
778
765
  }
@@ -785,9 +772,10 @@ export const de_GetInstanceOnboardingJobStatusCommand = async (output, context)
785
772
  $metadata: deserializeMetadata(output),
786
773
  });
787
774
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
788
- if (data.connectInstanceOnboardingJobStatus != null) {
789
- contents.connectInstanceOnboardingJobStatus = de_InstanceOnboardingJobStatus(data.connectInstanceOnboardingJobStatus, context);
790
- }
775
+ const doc = take(data, {
776
+ connectInstanceOnboardingJobStatus: _json,
777
+ });
778
+ Object.assign(contents, doc);
791
779
  return contents;
792
780
  };
793
781
  const de_GetInstanceOnboardingJobStatusCommandError = async (output, context) => {
@@ -811,10 +799,9 @@ const de_GetInstanceOnboardingJobStatusCommandError = async (output, context) =>
811
799
  throw await de_ValidationExceptionRes(parsedOutput, context);
812
800
  default:
813
801
  const parsedBody = parsedOutput.body;
814
- throwDefaultError({
802
+ return throwDefaultError({
815
803
  output,
816
804
  parsedBody,
817
- exceptionCtor: __BaseException,
818
805
  errorCode,
819
806
  });
820
807
  }
@@ -827,12 +814,11 @@ export const de_ListCampaignsCommand = async (output, context) => {
827
814
  $metadata: deserializeMetadata(output),
828
815
  });
829
816
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
830
- if (data.campaignSummaryList != null) {
831
- contents.campaignSummaryList = de_CampaignSummaryList(data.campaignSummaryList, context);
832
- }
833
- if (data.nextToken != null) {
834
- contents.nextToken = __expectString(data.nextToken);
835
- }
817
+ const doc = take(data, {
818
+ campaignSummaryList: _json,
819
+ nextToken: __expectString,
820
+ });
821
+ Object.assign(contents, doc);
836
822
  return contents;
837
823
  };
838
824
  const de_ListCampaignsCommandError = async (output, context) => {
@@ -853,10 +839,9 @@ const de_ListCampaignsCommandError = async (output, context) => {
853
839
  throw await de_ValidationExceptionRes(parsedOutput, context);
854
840
  default:
855
841
  const parsedBody = parsedOutput.body;
856
- throwDefaultError({
842
+ return throwDefaultError({
857
843
  output,
858
844
  parsedBody,
859
- exceptionCtor: __BaseException,
860
845
  errorCode,
861
846
  });
862
847
  }
@@ -869,9 +854,10 @@ export const de_ListTagsForResourceCommand = async (output, context) => {
869
854
  $metadata: deserializeMetadata(output),
870
855
  });
871
856
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
872
- if (data.tags != null) {
873
- contents.tags = de_TagMap(data.tags, context);
874
- }
857
+ const doc = take(data, {
858
+ tags: _json,
859
+ });
860
+ Object.assign(contents, doc);
875
861
  return contents;
876
862
  };
877
863
  const de_ListTagsForResourceCommandError = async (output, context) => {
@@ -898,10 +884,9 @@ const de_ListTagsForResourceCommandError = async (output, context) => {
898
884
  throw await de_ValidationExceptionRes(parsedOutput, context);
899
885
  default:
900
886
  const parsedBody = parsedOutput.body;
901
- throwDefaultError({
887
+ return throwDefaultError({
902
888
  output,
903
889
  parsedBody,
904
- exceptionCtor: __BaseException,
905
890
  errorCode,
906
891
  });
907
892
  }
@@ -946,10 +931,9 @@ const de_PauseCampaignCommandError = async (output, context) => {
946
931
  throw await de_ValidationExceptionRes(parsedOutput, context);
947
932
  default:
948
933
  const parsedBody = parsedOutput.body;
949
- throwDefaultError({
934
+ return throwDefaultError({
950
935
  output,
951
936
  parsedBody,
952
- exceptionCtor: __BaseException,
953
937
  errorCode,
954
938
  });
955
939
  }
@@ -962,12 +946,11 @@ export const de_PutDialRequestBatchCommand = async (output, context) => {
962
946
  $metadata: deserializeMetadata(output),
963
947
  });
964
948
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
965
- if (data.failedRequests != null) {
966
- contents.failedRequests = de_FailedRequestList(data.failedRequests, context);
967
- }
968
- if (data.successfulRequests != null) {
969
- contents.successfulRequests = de_SuccessfulRequestList(data.successfulRequests, context);
970
- }
949
+ const doc = take(data, {
950
+ failedRequests: _json,
951
+ successfulRequests: _json,
952
+ });
953
+ Object.assign(contents, doc);
971
954
  return contents;
972
955
  };
973
956
  const de_PutDialRequestBatchCommandError = async (output, context) => {
@@ -1000,10 +983,9 @@ const de_PutDialRequestBatchCommandError = async (output, context) => {
1000
983
  throw await de_ValidationExceptionRes(parsedOutput, context);
1001
984
  default:
1002
985
  const parsedBody = parsedOutput.body;
1003
- throwDefaultError({
986
+ return throwDefaultError({
1004
987
  output,
1005
988
  parsedBody,
1006
- exceptionCtor: __BaseException,
1007
989
  errorCode,
1008
990
  });
1009
991
  }
@@ -1048,10 +1030,9 @@ const de_ResumeCampaignCommandError = async (output, context) => {
1048
1030
  throw await de_ValidationExceptionRes(parsedOutput, context);
1049
1031
  default:
1050
1032
  const parsedBody = parsedOutput.body;
1051
- throwDefaultError({
1033
+ return throwDefaultError({
1052
1034
  output,
1053
1035
  parsedBody,
1054
- exceptionCtor: __BaseException,
1055
1036
  errorCode,
1056
1037
  });
1057
1038
  }
@@ -1096,10 +1077,9 @@ const de_StartCampaignCommandError = async (output, context) => {
1096
1077
  throw await de_ValidationExceptionRes(parsedOutput, context);
1097
1078
  default:
1098
1079
  const parsedBody = parsedOutput.body;
1099
- throwDefaultError({
1080
+ return throwDefaultError({
1100
1081
  output,
1101
1082
  parsedBody,
1102
- exceptionCtor: __BaseException,
1103
1083
  errorCode,
1104
1084
  });
1105
1085
  }
@@ -1112,9 +1092,10 @@ export const de_StartInstanceOnboardingJobCommand = async (output, context) => {
1112
1092
  $metadata: deserializeMetadata(output),
1113
1093
  });
1114
1094
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1115
- if (data.connectInstanceOnboardingJobStatus != null) {
1116
- contents.connectInstanceOnboardingJobStatus = de_InstanceOnboardingJobStatus(data.connectInstanceOnboardingJobStatus, context);
1117
- }
1095
+ const doc = take(data, {
1096
+ connectInstanceOnboardingJobStatus: _json,
1097
+ });
1098
+ Object.assign(contents, doc);
1118
1099
  return contents;
1119
1100
  };
1120
1101
  const de_StartInstanceOnboardingJobCommandError = async (output, context) => {
@@ -1144,10 +1125,9 @@ const de_StartInstanceOnboardingJobCommandError = async (output, context) => {
1144
1125
  throw await de_ValidationExceptionRes(parsedOutput, context);
1145
1126
  default:
1146
1127
  const parsedBody = parsedOutput.body;
1147
- throwDefaultError({
1128
+ return throwDefaultError({
1148
1129
  output,
1149
1130
  parsedBody,
1150
- exceptionCtor: __BaseException,
1151
1131
  errorCode,
1152
1132
  });
1153
1133
  }
@@ -1192,10 +1172,9 @@ const de_StopCampaignCommandError = async (output, context) => {
1192
1172
  throw await de_ValidationExceptionRes(parsedOutput, context);
1193
1173
  default:
1194
1174
  const parsedBody = parsedOutput.body;
1195
- throwDefaultError({
1175
+ return throwDefaultError({
1196
1176
  output,
1197
1177
  parsedBody,
1198
- exceptionCtor: __BaseException,
1199
1178
  errorCode,
1200
1179
  });
1201
1180
  }
@@ -1234,10 +1213,9 @@ const de_TagResourceCommandError = async (output, context) => {
1234
1213
  throw await de_ValidationExceptionRes(parsedOutput, context);
1235
1214
  default:
1236
1215
  const parsedBody = parsedOutput.body;
1237
- throwDefaultError({
1216
+ return throwDefaultError({
1238
1217
  output,
1239
1218
  parsedBody,
1240
- exceptionCtor: __BaseException,
1241
1219
  errorCode,
1242
1220
  });
1243
1221
  }
@@ -1276,10 +1254,9 @@ const de_UntagResourceCommandError = async (output, context) => {
1276
1254
  throw await de_ValidationExceptionRes(parsedOutput, context);
1277
1255
  default:
1278
1256
  const parsedBody = parsedOutput.body;
1279
- throwDefaultError({
1257
+ return throwDefaultError({
1280
1258
  output,
1281
1259
  parsedBody,
1282
- exceptionCtor: __BaseException,
1283
1260
  errorCode,
1284
1261
  });
1285
1262
  }
@@ -1318,10 +1295,9 @@ const de_UpdateCampaignDialerConfigCommandError = async (output, context) => {
1318
1295
  throw await de_ValidationExceptionRes(parsedOutput, context);
1319
1296
  default:
1320
1297
  const parsedBody = parsedOutput.body;
1321
- throwDefaultError({
1298
+ return throwDefaultError({
1322
1299
  output,
1323
1300
  parsedBody,
1324
- exceptionCtor: __BaseException,
1325
1301
  errorCode,
1326
1302
  });
1327
1303
  }
@@ -1360,10 +1336,9 @@ const de_UpdateCampaignNameCommandError = async (output, context) => {
1360
1336
  throw await de_ValidationExceptionRes(parsedOutput, context);
1361
1337
  default:
1362
1338
  const parsedBody = parsedOutput.body;
1363
- throwDefaultError({
1339
+ return throwDefaultError({
1364
1340
  output,
1365
1341
  parsedBody,
1366
- exceptionCtor: __BaseException,
1367
1342
  errorCode,
1368
1343
  });
1369
1344
  }
@@ -1405,23 +1380,23 @@ const de_UpdateCampaignOutboundCallConfigCommandError = async (output, context)
1405
1380
  throw await de_ValidationExceptionRes(parsedOutput, context);
1406
1381
  default:
1407
1382
  const parsedBody = parsedOutput.body;
1408
- throwDefaultError({
1383
+ return throwDefaultError({
1409
1384
  output,
1410
1385
  parsedBody,
1411
- exceptionCtor: __BaseException,
1412
1386
  errorCode,
1413
1387
  });
1414
1388
  }
1415
1389
  };
1416
- const map = __map;
1390
+ const throwDefaultError = withBaseException(__BaseException);
1417
1391
  const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
1418
1392
  const contents = map({
1419
1393
  xAmzErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1420
1394
  });
1421
1395
  const data = parsedOutput.body;
1422
- if (data.message != null) {
1423
- contents.message = __expectString(data.message);
1424
- }
1396
+ const doc = take(data, {
1397
+ message: __expectString,
1398
+ });
1399
+ Object.assign(contents, doc);
1425
1400
  const exception = new AccessDeniedException({
1426
1401
  $metadata: deserializeMetadata(parsedOutput),
1427
1402
  ...contents,
@@ -1433,9 +1408,10 @@ const de_ConflictExceptionRes = async (parsedOutput, context) => {
1433
1408
  xAmzErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1434
1409
  });
1435
1410
  const data = parsedOutput.body;
1436
- if (data.message != null) {
1437
- contents.message = __expectString(data.message);
1438
- }
1411
+ const doc = take(data, {
1412
+ message: __expectString,
1413
+ });
1414
+ Object.assign(contents, doc);
1439
1415
  const exception = new ConflictException({
1440
1416
  $metadata: deserializeMetadata(parsedOutput),
1441
1417
  ...contents,
@@ -1447,9 +1423,10 @@ const de_InternalServerExceptionRes = async (parsedOutput, context) => {
1447
1423
  xAmzErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1448
1424
  });
1449
1425
  const data = parsedOutput.body;
1450
- if (data.message != null) {
1451
- contents.message = __expectString(data.message);
1452
- }
1426
+ const doc = take(data, {
1427
+ message: __expectString,
1428
+ });
1429
+ Object.assign(contents, doc);
1453
1430
  const exception = new InternalServerException({
1454
1431
  $metadata: deserializeMetadata(parsedOutput),
1455
1432
  ...contents,
@@ -1461,12 +1438,11 @@ const de_InvalidCampaignStateExceptionRes = async (parsedOutput, context) => {
1461
1438
  xAmzErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1462
1439
  });
1463
1440
  const data = parsedOutput.body;
1464
- if (data.message != null) {
1465
- contents.message = __expectString(data.message);
1466
- }
1467
- if (data.state != null) {
1468
- contents.state = __expectString(data.state);
1469
- }
1441
+ const doc = take(data, {
1442
+ message: __expectString,
1443
+ state: __expectString,
1444
+ });
1445
+ Object.assign(contents, doc);
1470
1446
  const exception = new InvalidCampaignStateException({
1471
1447
  $metadata: deserializeMetadata(parsedOutput),
1472
1448
  ...contents,
@@ -1478,9 +1454,10 @@ const de_InvalidStateExceptionRes = async (parsedOutput, context) => {
1478
1454
  xAmzErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1479
1455
  });
1480
1456
  const data = parsedOutput.body;
1481
- if (data.message != null) {
1482
- contents.message = __expectString(data.message);
1483
- }
1457
+ const doc = take(data, {
1458
+ message: __expectString,
1459
+ });
1460
+ Object.assign(contents, doc);
1484
1461
  const exception = new InvalidStateException({
1485
1462
  $metadata: deserializeMetadata(parsedOutput),
1486
1463
  ...contents,
@@ -1492,9 +1469,10 @@ const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
1492
1469
  xAmzErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1493
1470
  });
1494
1471
  const data = parsedOutput.body;
1495
- if (data.message != null) {
1496
- contents.message = __expectString(data.message);
1497
- }
1472
+ const doc = take(data, {
1473
+ message: __expectString,
1474
+ });
1475
+ Object.assign(contents, doc);
1498
1476
  const exception = new ResourceNotFoundException({
1499
1477
  $metadata: deserializeMetadata(parsedOutput),
1500
1478
  ...contents,
@@ -1506,9 +1484,10 @@ const de_ServiceQuotaExceededExceptionRes = async (parsedOutput, context) => {
1506
1484
  xAmzErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1507
1485
  });
1508
1486
  const data = parsedOutput.body;
1509
- if (data.message != null) {
1510
- contents.message = __expectString(data.message);
1511
- }
1487
+ const doc = take(data, {
1488
+ message: __expectString,
1489
+ });
1490
+ Object.assign(contents, doc);
1512
1491
  const exception = new ServiceQuotaExceededException({
1513
1492
  $metadata: deserializeMetadata(parsedOutput),
1514
1493
  ...contents,
@@ -1520,9 +1499,10 @@ const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
1520
1499
  xAmzErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1521
1500
  });
1522
1501
  const data = parsedOutput.body;
1523
- if (data.message != null) {
1524
- contents.message = __expectString(data.message);
1525
- }
1502
+ const doc = take(data, {
1503
+ message: __expectString,
1504
+ });
1505
+ Object.assign(contents, doc);
1526
1506
  const exception = new ThrottlingException({
1527
1507
  $metadata: deserializeMetadata(parsedOutput),
1528
1508
  ...contents,
@@ -1534,43 +1514,16 @@ const de_ValidationExceptionRes = async (parsedOutput, context) => {
1534
1514
  xAmzErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1535
1515
  });
1536
1516
  const data = parsedOutput.body;
1537
- if (data.message != null) {
1538
- contents.message = __expectString(data.message);
1539
- }
1517
+ const doc = take(data, {
1518
+ message: __expectString,
1519
+ });
1520
+ Object.assign(contents, doc);
1540
1521
  const exception = new ValidationException({
1541
1522
  $metadata: deserializeMetadata(parsedOutput),
1542
1523
  ...contents,
1543
1524
  });
1544
1525
  return __decorateServiceException(exception, parsedOutput.body);
1545
1526
  };
1546
- const se_AnswerMachineDetectionConfig = (input, context) => {
1547
- return {
1548
- ...(input.enableAnswerMachineDetection != null && {
1549
- enableAnswerMachineDetection: input.enableAnswerMachineDetection,
1550
- }),
1551
- };
1552
- };
1553
- const se_Attributes = (input, context) => {
1554
- return Object.entries(input).reduce((acc, [key, value]) => {
1555
- if (value === null) {
1556
- return acc;
1557
- }
1558
- acc[key] = value;
1559
- return acc;
1560
- }, {});
1561
- };
1562
- const se_CampaignFilters = (input, context) => {
1563
- return {
1564
- ...(input.instanceIdFilter != null && { instanceIdFilter: se_InstanceIdFilter(input.instanceIdFilter, context) }),
1565
- };
1566
- };
1567
- const se_CampaignIdList = (input, context) => {
1568
- return input
1569
- .filter((e) => e != null)
1570
- .map((entry) => {
1571
- return entry;
1572
- });
1573
- };
1574
1527
  const se_DialerConfig = (input, context) => {
1575
1528
  return DialerConfig.visit(input, {
1576
1529
  predictiveDialerConfig: (value) => ({ predictiveDialerConfig: se_PredictiveDialerConfig(value, context) }),
@@ -1579,12 +1532,12 @@ const se_DialerConfig = (input, context) => {
1579
1532
  });
1580
1533
  };
1581
1534
  const se_DialRequest = (input, context) => {
1582
- return {
1583
- ...(input.attributes != null && { attributes: se_Attributes(input.attributes, context) }),
1584
- ...(input.clientToken != null && { clientToken: input.clientToken }),
1585
- ...(input.expirationTime != null && { expirationTime: input.expirationTime.toISOString().split(".")[0] + "Z" }),
1586
- ...(input.phoneNumber != null && { phoneNumber: input.phoneNumber }),
1587
- };
1535
+ return take(input, {
1536
+ attributes: _json,
1537
+ clientToken: [],
1538
+ expirationTime: (_) => _.toISOString().split(".")[0] + "Z",
1539
+ phoneNumber: [],
1540
+ });
1588
1541
  };
1589
1542
  const se_DialRequestList = (input, context) => {
1590
1543
  return input
@@ -1593,82 +1546,26 @@ const se_DialRequestList = (input, context) => {
1593
1546
  return se_DialRequest(entry, context);
1594
1547
  });
1595
1548
  };
1596
- const se_EncryptionConfig = (input, context) => {
1597
- return {
1598
- ...(input.enabled != null && { enabled: input.enabled }),
1599
- ...(input.encryptionType != null && { encryptionType: input.encryptionType }),
1600
- ...(input.keyArn != null && { keyArn: input.keyArn }),
1601
- };
1602
- };
1603
- const se_InstanceIdFilter = (input, context) => {
1604
- return {
1605
- ...(input.operator != null && { operator: input.operator }),
1606
- ...(input.value != null && { value: input.value }),
1607
- };
1608
- };
1609
- const se_OutboundCallConfig = (input, context) => {
1610
- return {
1611
- ...(input.answerMachineDetectionConfig != null && {
1612
- answerMachineDetectionConfig: se_AnswerMachineDetectionConfig(input.answerMachineDetectionConfig, context),
1613
- }),
1614
- ...(input.connectContactFlowId != null && { connectContactFlowId: input.connectContactFlowId }),
1615
- ...(input.connectQueueId != null && { connectQueueId: input.connectQueueId }),
1616
- ...(input.connectSourcePhoneNumber != null && { connectSourcePhoneNumber: input.connectSourcePhoneNumber }),
1617
- };
1618
- };
1619
1549
  const se_PredictiveDialerConfig = (input, context) => {
1620
- return {
1621
- ...(input.bandwidthAllocation != null && { bandwidthAllocation: __serializeFloat(input.bandwidthAllocation) }),
1622
- };
1550
+ return take(input, {
1551
+ bandwidthAllocation: __serializeFloat,
1552
+ });
1623
1553
  };
1624
1554
  const se_ProgressiveDialerConfig = (input, context) => {
1625
- return {
1626
- ...(input.bandwidthAllocation != null && { bandwidthAllocation: __serializeFloat(input.bandwidthAllocation) }),
1627
- };
1628
- };
1629
- const se_TagMap = (input, context) => {
1630
- return Object.entries(input).reduce((acc, [key, value]) => {
1631
- if (value === null) {
1632
- return acc;
1633
- }
1634
- acc[key] = value;
1635
- return acc;
1636
- }, {});
1637
- };
1638
- const de_AnswerMachineDetectionConfig = (output, context) => {
1639
- return {
1640
- enableAnswerMachineDetection: __expectBoolean(output.enableAnswerMachineDetection),
1641
- };
1555
+ return take(input, {
1556
+ bandwidthAllocation: __serializeFloat,
1557
+ });
1642
1558
  };
1643
1559
  const de_Campaign = (output, context) => {
1644
- return {
1645
- arn: __expectString(output.arn),
1646
- connectInstanceId: __expectString(output.connectInstanceId),
1647
- dialerConfig: output.dialerConfig != null ? de_DialerConfig(__expectUnion(output.dialerConfig), context) : undefined,
1648
- id: __expectString(output.id),
1649
- name: __expectString(output.name),
1650
- outboundCallConfig: output.outboundCallConfig != null ? de_OutboundCallConfig(output.outboundCallConfig, context) : undefined,
1651
- tags: output.tags != null ? de_TagMap(output.tags, context) : undefined,
1652
- };
1653
- };
1654
- const de_CampaignSummary = (output, context) => {
1655
- return {
1656
- arn: __expectString(output.arn),
1657
- connectInstanceId: __expectString(output.connectInstanceId),
1658
- id: __expectString(output.id),
1659
- name: __expectString(output.name),
1660
- };
1661
- };
1662
- const de_CampaignSummaryList = (output, context) => {
1663
- const retVal = (output || [])
1664
- .filter((e) => e != null)
1665
- .map((entry) => {
1666
- if (entry === null) {
1667
- return null;
1668
- }
1669
- return de_CampaignSummary(entry, context);
1560
+ return take(output, {
1561
+ arn: __expectString,
1562
+ connectInstanceId: __expectString,
1563
+ dialerConfig: (_) => de_DialerConfig(__expectUnion(_), context),
1564
+ id: __expectString,
1565
+ name: __expectString,
1566
+ outboundCallConfig: _json,
1567
+ tags: _json,
1670
1568
  });
1671
- return retVal;
1672
1569
  };
1673
1570
  const de_DialerConfig = (output, context) => {
1674
1571
  if (output.predictiveDialerConfig != null) {
@@ -1683,124 +1580,15 @@ const de_DialerConfig = (output, context) => {
1683
1580
  }
1684
1581
  return { $unknown: Object.entries(output)[0] };
1685
1582
  };
1686
- const de_EncryptionConfig = (output, context) => {
1687
- return {
1688
- enabled: __expectBoolean(output.enabled),
1689
- encryptionType: __expectString(output.encryptionType),
1690
- keyArn: __expectString(output.keyArn),
1691
- };
1692
- };
1693
- const de_FailedCampaignStateResponse = (output, context) => {
1694
- return {
1695
- campaignId: __expectString(output.campaignId),
1696
- failureCode: __expectString(output.failureCode),
1697
- };
1698
- };
1699
- const de_FailedCampaignStateResponseList = (output, context) => {
1700
- const retVal = (output || [])
1701
- .filter((e) => e != null)
1702
- .map((entry) => {
1703
- if (entry === null) {
1704
- return null;
1705
- }
1706
- return de_FailedCampaignStateResponse(entry, context);
1707
- });
1708
- return retVal;
1709
- };
1710
- const de_FailedRequest = (output, context) => {
1711
- return {
1712
- clientToken: __expectString(output.clientToken),
1713
- failureCode: __expectString(output.failureCode),
1714
- id: __expectString(output.id),
1715
- };
1716
- };
1717
- const de_FailedRequestList = (output, context) => {
1718
- const retVal = (output || [])
1719
- .filter((e) => e != null)
1720
- .map((entry) => {
1721
- if (entry === null) {
1722
- return null;
1723
- }
1724
- return de_FailedRequest(entry, context);
1725
- });
1726
- return retVal;
1727
- };
1728
- const de_InstanceConfig = (output, context) => {
1729
- return {
1730
- connectInstanceId: __expectString(output.connectInstanceId),
1731
- encryptionConfig: output.encryptionConfig != null ? de_EncryptionConfig(output.encryptionConfig, context) : undefined,
1732
- serviceLinkedRoleArn: __expectString(output.serviceLinkedRoleArn),
1733
- };
1734
- };
1735
- const de_InstanceOnboardingJobStatus = (output, context) => {
1736
- return {
1737
- connectInstanceId: __expectString(output.connectInstanceId),
1738
- failureCode: __expectString(output.failureCode),
1739
- status: __expectString(output.status),
1740
- };
1741
- };
1742
- const de_OutboundCallConfig = (output, context) => {
1743
- return {
1744
- answerMachineDetectionConfig: output.answerMachineDetectionConfig != null
1745
- ? de_AnswerMachineDetectionConfig(output.answerMachineDetectionConfig, context)
1746
- : undefined,
1747
- connectContactFlowId: __expectString(output.connectContactFlowId),
1748
- connectQueueId: __expectString(output.connectQueueId),
1749
- connectSourcePhoneNumber: __expectString(output.connectSourcePhoneNumber),
1750
- };
1751
- };
1752
1583
  const de_PredictiveDialerConfig = (output, context) => {
1753
- return {
1754
- bandwidthAllocation: __limitedParseDouble(output.bandwidthAllocation),
1755
- };
1756
- };
1757
- const de_ProgressiveDialerConfig = (output, context) => {
1758
- return {
1759
- bandwidthAllocation: __limitedParseDouble(output.bandwidthAllocation),
1760
- };
1761
- };
1762
- const de_SuccessfulCampaignStateResponse = (output, context) => {
1763
- return {
1764
- campaignId: __expectString(output.campaignId),
1765
- state: __expectString(output.state),
1766
- };
1767
- };
1768
- const de_SuccessfulCampaignStateResponseList = (output, context) => {
1769
- const retVal = (output || [])
1770
- .filter((e) => e != null)
1771
- .map((entry) => {
1772
- if (entry === null) {
1773
- return null;
1774
- }
1775
- return de_SuccessfulCampaignStateResponse(entry, context);
1584
+ return take(output, {
1585
+ bandwidthAllocation: __limitedParseDouble,
1776
1586
  });
1777
- return retVal;
1778
1587
  };
1779
- const de_SuccessfulRequest = (output, context) => {
1780
- return {
1781
- clientToken: __expectString(output.clientToken),
1782
- id: __expectString(output.id),
1783
- };
1784
- };
1785
- const de_SuccessfulRequestList = (output, context) => {
1786
- const retVal = (output || [])
1787
- .filter((e) => e != null)
1788
- .map((entry) => {
1789
- if (entry === null) {
1790
- return null;
1791
- }
1792
- return de_SuccessfulRequest(entry, context);
1588
+ const de_ProgressiveDialerConfig = (output, context) => {
1589
+ return take(output, {
1590
+ bandwidthAllocation: __limitedParseDouble,
1793
1591
  });
1794
- return retVal;
1795
- };
1796
- const de_TagMap = (output, context) => {
1797
- return Object.entries(output).reduce((acc, [key, value]) => {
1798
- if (value === null) {
1799
- return acc;
1800
- }
1801
- acc[key] = __expectString(value);
1802
- return acc;
1803
- }, {});
1804
1592
  };
1805
1593
  const deserializeMetadata = (output) => ({
1806
1594
  httpStatusCode: output.statusCode,