@aws-sdk/client-connectcampaigns 3.131.0 → 3.142.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 (53) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +1 -1
  3. package/dist-cjs/commands/CreateCampaignCommand.js +2 -2
  4. package/dist-cjs/commands/DeleteCampaignCommand.js +1 -1
  5. package/dist-cjs/commands/DeleteConnectInstanceConfigCommand.js +1 -1
  6. package/dist-cjs/commands/DeleteInstanceOnboardingJobCommand.js +1 -1
  7. package/dist-cjs/commands/DescribeCampaignCommand.js +2 -2
  8. package/dist-cjs/commands/GetCampaignStateBatchCommand.js +2 -2
  9. package/dist-cjs/commands/GetCampaignStateCommand.js +2 -2
  10. package/dist-cjs/commands/GetConnectInstanceConfigCommand.js +2 -2
  11. package/dist-cjs/commands/GetInstanceOnboardingJobStatusCommand.js +2 -2
  12. package/dist-cjs/commands/ListCampaignsCommand.js +2 -2
  13. package/dist-cjs/commands/ListTagsForResourceCommand.js +2 -2
  14. package/dist-cjs/commands/PauseCampaignCommand.js +1 -1
  15. package/dist-cjs/commands/PutDialRequestBatchCommand.js +2 -2
  16. package/dist-cjs/commands/ResumeCampaignCommand.js +1 -1
  17. package/dist-cjs/commands/StartCampaignCommand.js +1 -1
  18. package/dist-cjs/commands/StartInstanceOnboardingJobCommand.js +2 -2
  19. package/dist-cjs/commands/StopCampaignCommand.js +1 -1
  20. package/dist-cjs/commands/TagResourceCommand.js +1 -1
  21. package/dist-cjs/commands/UntagResourceCommand.js +1 -1
  22. package/dist-cjs/commands/UpdateCampaignDialerConfigCommand.js +1 -1
  23. package/dist-cjs/commands/UpdateCampaignNameCommand.js +1 -1
  24. package/dist-cjs/commands/UpdateCampaignOutboundCallConfigCommand.js +1 -1
  25. package/dist-cjs/models/models_0.js +210 -305
  26. package/dist-cjs/protocols/Aws_restJson1.js +253 -519
  27. package/dist-es/commands/CreateCampaignCommand.js +3 -3
  28. package/dist-es/commands/DeleteCampaignCommand.js +2 -2
  29. package/dist-es/commands/DeleteConnectInstanceConfigCommand.js +2 -2
  30. package/dist-es/commands/DeleteInstanceOnboardingJobCommand.js +2 -2
  31. package/dist-es/commands/DescribeCampaignCommand.js +3 -3
  32. package/dist-es/commands/GetCampaignStateBatchCommand.js +3 -3
  33. package/dist-es/commands/GetCampaignStateCommand.js +3 -3
  34. package/dist-es/commands/GetConnectInstanceConfigCommand.js +3 -3
  35. package/dist-es/commands/GetInstanceOnboardingJobStatusCommand.js +3 -3
  36. package/dist-es/commands/ListCampaignsCommand.js +3 -3
  37. package/dist-es/commands/ListTagsForResourceCommand.js +3 -3
  38. package/dist-es/commands/PauseCampaignCommand.js +2 -2
  39. package/dist-es/commands/PutDialRequestBatchCommand.js +3 -3
  40. package/dist-es/commands/ResumeCampaignCommand.js +2 -2
  41. package/dist-es/commands/StartCampaignCommand.js +2 -2
  42. package/dist-es/commands/StartInstanceOnboardingJobCommand.js +3 -3
  43. package/dist-es/commands/StopCampaignCommand.js +2 -2
  44. package/dist-es/commands/TagResourceCommand.js +2 -2
  45. package/dist-es/commands/UntagResourceCommand.js +2 -2
  46. package/dist-es/commands/UpdateCampaignDialerConfigCommand.js +2 -2
  47. package/dist-es/commands/UpdateCampaignNameCommand.js +2 -2
  48. package/dist-es/commands/UpdateCampaignOutboundCallConfigCommand.js +2 -2
  49. package/dist-es/models/models_0.js +57 -201
  50. package/dist-es/protocols/Aws_restJson1.js +339 -537
  51. package/dist-types/models/models_0.d.ts +196 -292
  52. package/dist-types/ts3.4/models/models_0.d.ts +98 -194
  53. package/package.json +6 -6
@@ -38,16 +38,7 @@ const serializeAws_restJson1DeleteCampaignCommand = async (input, context) => {
38
38
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
39
39
  const headers = {};
40
40
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/campaigns/{id}";
41
- if (input.id !== undefined) {
42
- const labelValue = input.id;
43
- if (labelValue.length <= 0) {
44
- throw new Error("Empty value provided for input HTTP label: id.");
45
- }
46
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
47
- }
48
- else {
49
- throw new Error("No value provided for input HTTP label: id.");
50
- }
41
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
51
42
  let body;
52
43
  return new protocol_http_1.HttpRequest({
53
44
  protocol,
@@ -65,16 +56,7 @@ const serializeAws_restJson1DeleteConnectInstanceConfigCommand = async (input, c
65
56
  const headers = {};
66
57
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
67
58
  "/connect-instance/{connectInstanceId}/config";
68
- if (input.connectInstanceId !== undefined) {
69
- const labelValue = input.connectInstanceId;
70
- if (labelValue.length <= 0) {
71
- throw new Error("Empty value provided for input HTTP label: connectInstanceId.");
72
- }
73
- resolvedPath = resolvedPath.replace("{connectInstanceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
74
- }
75
- else {
76
- throw new Error("No value provided for input HTTP label: connectInstanceId.");
77
- }
59
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "connectInstanceId", () => input.connectInstanceId, "{connectInstanceId}", false);
78
60
  let body;
79
61
  return new protocol_http_1.HttpRequest({
80
62
  protocol,
@@ -92,16 +74,7 @@ const serializeAws_restJson1DeleteInstanceOnboardingJobCommand = async (input, c
92
74
  const headers = {};
93
75
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
94
76
  "/connect-instance/{connectInstanceId}/onboarding";
95
- if (input.connectInstanceId !== undefined) {
96
- const labelValue = input.connectInstanceId;
97
- if (labelValue.length <= 0) {
98
- throw new Error("Empty value provided for input HTTP label: connectInstanceId.");
99
- }
100
- resolvedPath = resolvedPath.replace("{connectInstanceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
101
- }
102
- else {
103
- throw new Error("No value provided for input HTTP label: connectInstanceId.");
104
- }
77
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "connectInstanceId", () => input.connectInstanceId, "{connectInstanceId}", false);
105
78
  let body;
106
79
  return new protocol_http_1.HttpRequest({
107
80
  protocol,
@@ -118,16 +91,7 @@ const serializeAws_restJson1DescribeCampaignCommand = async (input, context) =>
118
91
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
119
92
  const headers = {};
120
93
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/campaigns/{id}";
121
- if (input.id !== undefined) {
122
- const labelValue = input.id;
123
- if (labelValue.length <= 0) {
124
- throw new Error("Empty value provided for input HTTP label: id.");
125
- }
126
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
127
- }
128
- else {
129
- throw new Error("No value provided for input HTTP label: id.");
130
- }
94
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
131
95
  let body;
132
96
  return new protocol_http_1.HttpRequest({
133
97
  protocol,
@@ -144,16 +108,7 @@ const serializeAws_restJson1GetCampaignStateCommand = async (input, context) =>
144
108
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
145
109
  const headers = {};
146
110
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/campaigns/{id}/state";
147
- if (input.id !== undefined) {
148
- const labelValue = input.id;
149
- if (labelValue.length <= 0) {
150
- throw new Error("Empty value provided for input HTTP label: id.");
151
- }
152
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
153
- }
154
- else {
155
- throw new Error("No value provided for input HTTP label: id.");
156
- }
111
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
157
112
  let body;
158
113
  return new protocol_http_1.HttpRequest({
159
114
  protocol,
@@ -192,16 +147,7 @@ const serializeAws_restJson1GetConnectInstanceConfigCommand = async (input, cont
192
147
  const headers = {};
193
148
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
194
149
  "/connect-instance/{connectInstanceId}/config";
195
- if (input.connectInstanceId !== undefined) {
196
- const labelValue = input.connectInstanceId;
197
- if (labelValue.length <= 0) {
198
- throw new Error("Empty value provided for input HTTP label: connectInstanceId.");
199
- }
200
- resolvedPath = resolvedPath.replace("{connectInstanceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
201
- }
202
- else {
203
- throw new Error("No value provided for input HTTP label: connectInstanceId.");
204
- }
150
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "connectInstanceId", () => input.connectInstanceId, "{connectInstanceId}", false);
205
151
  let body;
206
152
  return new protocol_http_1.HttpRequest({
207
153
  protocol,
@@ -219,16 +165,7 @@ const serializeAws_restJson1GetInstanceOnboardingJobStatusCommand = async (input
219
165
  const headers = {};
220
166
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
221
167
  "/connect-instance/{connectInstanceId}/onboarding";
222
- if (input.connectInstanceId !== undefined) {
223
- const labelValue = input.connectInstanceId;
224
- if (labelValue.length <= 0) {
225
- throw new Error("Empty value provided for input HTTP label: connectInstanceId.");
226
- }
227
- resolvedPath = resolvedPath.replace("{connectInstanceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
228
- }
229
- else {
230
- throw new Error("No value provided for input HTTP label: connectInstanceId.");
231
- }
168
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "connectInstanceId", () => input.connectInstanceId, "{connectInstanceId}", false);
232
169
  let body;
233
170
  return new protocol_http_1.HttpRequest({
234
171
  protocol,
@@ -268,16 +205,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
268
205
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
269
206
  const headers = {};
270
207
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{arn}";
271
- if (input.arn !== undefined) {
272
- const labelValue = input.arn;
273
- if (labelValue.length <= 0) {
274
- throw new Error("Empty value provided for input HTTP label: arn.");
275
- }
276
- resolvedPath = resolvedPath.replace("{arn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
277
- }
278
- else {
279
- throw new Error("No value provided for input HTTP label: arn.");
280
- }
208
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "arn", () => input.arn, "{arn}", false);
281
209
  let body;
282
210
  return new protocol_http_1.HttpRequest({
283
211
  protocol,
@@ -294,16 +222,7 @@ const serializeAws_restJson1PauseCampaignCommand = async (input, context) => {
294
222
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
295
223
  const headers = {};
296
224
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/campaigns/{id}/pause";
297
- if (input.id !== undefined) {
298
- const labelValue = input.id;
299
- if (labelValue.length <= 0) {
300
- throw new Error("Empty value provided for input HTTP label: id.");
301
- }
302
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
303
- }
304
- else {
305
- throw new Error("No value provided for input HTTP label: id.");
306
- }
225
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
307
226
  let body;
308
227
  return new protocol_http_1.HttpRequest({
309
228
  protocol,
@@ -322,16 +241,7 @@ const serializeAws_restJson1PutDialRequestBatchCommand = async (input, context)
322
241
  "content-type": "application/json",
323
242
  };
324
243
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/campaigns/{id}/dial-requests";
325
- if (input.id !== undefined) {
326
- const labelValue = input.id;
327
- if (labelValue.length <= 0) {
328
- throw new Error("Empty value provided for input HTTP label: id.");
329
- }
330
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
331
- }
332
- else {
333
- throw new Error("No value provided for input HTTP label: id.");
334
- }
244
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
335
245
  let body;
336
246
  body = JSON.stringify({
337
247
  ...(input.dialRequests != null && {
@@ -353,16 +263,7 @@ const serializeAws_restJson1ResumeCampaignCommand = async (input, context) => {
353
263
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
354
264
  const headers = {};
355
265
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/campaigns/{id}/resume";
356
- if (input.id !== undefined) {
357
- const labelValue = input.id;
358
- if (labelValue.length <= 0) {
359
- throw new Error("Empty value provided for input HTTP label: id.");
360
- }
361
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
362
- }
363
- else {
364
- throw new Error("No value provided for input HTTP label: id.");
365
- }
266
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
366
267
  let body;
367
268
  return new protocol_http_1.HttpRequest({
368
269
  protocol,
@@ -379,16 +280,7 @@ const serializeAws_restJson1StartCampaignCommand = async (input, context) => {
379
280
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
380
281
  const headers = {};
381
282
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/campaigns/{id}/start";
382
- if (input.id !== undefined) {
383
- const labelValue = input.id;
384
- if (labelValue.length <= 0) {
385
- throw new Error("Empty value provided for input HTTP label: id.");
386
- }
387
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
388
- }
389
- else {
390
- throw new Error("No value provided for input HTTP label: id.");
391
- }
283
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
392
284
  let body;
393
285
  return new protocol_http_1.HttpRequest({
394
286
  protocol,
@@ -408,16 +300,7 @@ const serializeAws_restJson1StartInstanceOnboardingJobCommand = async (input, co
408
300
  };
409
301
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
410
302
  "/connect-instance/{connectInstanceId}/onboarding";
411
- if (input.connectInstanceId !== undefined) {
412
- const labelValue = input.connectInstanceId;
413
- if (labelValue.length <= 0) {
414
- throw new Error("Empty value provided for input HTTP label: connectInstanceId.");
415
- }
416
- resolvedPath = resolvedPath.replace("{connectInstanceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
417
- }
418
- else {
419
- throw new Error("No value provided for input HTTP label: connectInstanceId.");
420
- }
303
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "connectInstanceId", () => input.connectInstanceId, "{connectInstanceId}", false);
421
304
  let body;
422
305
  body = JSON.stringify({
423
306
  ...(input.encryptionConfig != null && {
@@ -439,16 +322,7 @@ const serializeAws_restJson1StopCampaignCommand = async (input, context) => {
439
322
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
440
323
  const headers = {};
441
324
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/campaigns/{id}/stop";
442
- if (input.id !== undefined) {
443
- const labelValue = input.id;
444
- if (labelValue.length <= 0) {
445
- throw new Error("Empty value provided for input HTTP label: id.");
446
- }
447
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
448
- }
449
- else {
450
- throw new Error("No value provided for input HTTP label: id.");
451
- }
325
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
452
326
  let body;
453
327
  return new protocol_http_1.HttpRequest({
454
328
  protocol,
@@ -467,16 +341,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
467
341
  "content-type": "application/json",
468
342
  };
469
343
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{arn}";
470
- if (input.arn !== undefined) {
471
- const labelValue = input.arn;
472
- if (labelValue.length <= 0) {
473
- throw new Error("Empty value provided for input HTTP label: arn.");
474
- }
475
- resolvedPath = resolvedPath.replace("{arn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
476
- }
477
- else {
478
- throw new Error("No value provided for input HTTP label: arn.");
479
- }
344
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "arn", () => input.arn, "{arn}", false);
480
345
  let body;
481
346
  body = JSON.stringify({
482
347
  ...(input.tags != null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
@@ -496,19 +361,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
496
361
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
497
362
  const headers = {};
498
363
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{arn}";
499
- if (input.arn !== undefined) {
500
- const labelValue = input.arn;
501
- if (labelValue.length <= 0) {
502
- throw new Error("Empty value provided for input HTTP label: arn.");
503
- }
504
- resolvedPath = resolvedPath.replace("{arn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
505
- }
506
- else {
507
- throw new Error("No value provided for input HTTP label: arn.");
508
- }
509
- const query = {
510
- ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }),
511
- };
364
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "arn", () => input.arn, "{arn}", false);
365
+ const query = map({
366
+ tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys || []).map((_entry) => _entry)],
367
+ });
512
368
  let body;
513
369
  return new protocol_http_1.HttpRequest({
514
370
  protocol,
@@ -528,16 +384,7 @@ const serializeAws_restJson1UpdateCampaignDialerConfigCommand = async (input, co
528
384
  "content-type": "application/json",
529
385
  };
530
386
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/campaigns/{id}/dialer-config";
531
- if (input.id !== undefined) {
532
- const labelValue = input.id;
533
- if (labelValue.length <= 0) {
534
- throw new Error("Empty value provided for input HTTP label: id.");
535
- }
536
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
537
- }
538
- else {
539
- throw new Error("No value provided for input HTTP label: id.");
540
- }
387
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
541
388
  let body;
542
389
  body = JSON.stringify({
543
390
  ...(input.dialerConfig != null && {
@@ -561,16 +408,7 @@ const serializeAws_restJson1UpdateCampaignNameCommand = async (input, context) =
561
408
  "content-type": "application/json",
562
409
  };
563
410
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/campaigns/{id}/name";
564
- if (input.id !== undefined) {
565
- const labelValue = input.id;
566
- if (labelValue.length <= 0) {
567
- throw new Error("Empty value provided for input HTTP label: id.");
568
- }
569
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
570
- }
571
- else {
572
- throw new Error("No value provided for input HTTP label: id.");
573
- }
411
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
574
412
  let body;
575
413
  body = JSON.stringify({
576
414
  ...(input.name != null && { name: input.name }),
@@ -592,16 +430,7 @@ const serializeAws_restJson1UpdateCampaignOutboundCallConfigCommand = async (inp
592
430
  "content-type": "application/json",
593
431
  };
594
432
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/campaigns/{id}/outbound-call-config";
595
- if (input.id !== undefined) {
596
- const labelValue = input.id;
597
- if (labelValue.length <= 0) {
598
- throw new Error("Empty value provided for input HTTP label: id.");
599
- }
600
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
601
- }
602
- else {
603
- throw new Error("No value provided for input HTTP label: id.");
604
- }
433
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
605
434
  let body;
606
435
  body = JSON.stringify({
607
436
  ...(input.answerMachineDetectionConfig != null && {
@@ -625,23 +454,20 @@ const deserializeAws_restJson1CreateCampaignCommand = async (output, context) =>
625
454
  if (output.statusCode !== 200 && output.statusCode >= 300) {
626
455
  return deserializeAws_restJson1CreateCampaignCommandError(output, context);
627
456
  }
628
- const contents = {
457
+ const contents = map({
629
458
  $metadata: deserializeMetadata(output),
630
- arn: undefined,
631
- id: undefined,
632
- tags: undefined,
633
- };
459
+ });
634
460
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
635
- if (data.arn !== undefined && data.arn !== null) {
461
+ if (data.arn != null) {
636
462
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
637
463
  }
638
- if (data.id !== undefined && data.id !== null) {
464
+ if (data.id != null) {
639
465
  contents.id = (0, smithy_client_1.expectString)(data.id);
640
466
  }
641
- if (data.tags !== undefined && data.tags !== null) {
467
+ if (data.tags != null) {
642
468
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
643
469
  }
644
- return Promise.resolve(contents);
470
+ return contents;
645
471
  };
646
472
  exports.deserializeAws_restJson1CreateCampaignCommand = deserializeAws_restJson1CreateCampaignCommand;
647
473
  const deserializeAws_restJson1CreateCampaignCommandError = async (output, context) => {
@@ -649,7 +475,6 @@ const deserializeAws_restJson1CreateCampaignCommandError = async (output, contex
649
475
  ...output,
650
476
  body: await parseBody(output.body, context),
651
477
  };
652
- let response;
653
478
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
654
479
  switch (errorCode) {
655
480
  case "AccessDeniedException":
@@ -675,25 +500,23 @@ const deserializeAws_restJson1CreateCampaignCommandError = async (output, contex
675
500
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
676
501
  default:
677
502
  const parsedBody = parsedOutput.body;
678
- const $metadata = deserializeMetadata(output);
679
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
680
- response = new ConnectCampaignsServiceException_1.ConnectCampaignsServiceException({
681
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
682
- $fault: "client",
683
- $metadata,
503
+ (0, smithy_client_1.throwDefaultError)({
504
+ output,
505
+ parsedBody,
506
+ exceptionCtor: ConnectCampaignsServiceException_1.ConnectCampaignsServiceException,
507
+ errorCode,
684
508
  });
685
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
686
509
  }
687
510
  };
688
511
  const deserializeAws_restJson1DeleteCampaignCommand = async (output, context) => {
689
512
  if (output.statusCode !== 200 && output.statusCode >= 300) {
690
513
  return deserializeAws_restJson1DeleteCampaignCommandError(output, context);
691
514
  }
692
- const contents = {
515
+ const contents = map({
693
516
  $metadata: deserializeMetadata(output),
694
- };
517
+ });
695
518
  await collectBody(output.body, context);
696
- return Promise.resolve(contents);
519
+ return contents;
697
520
  };
698
521
  exports.deserializeAws_restJson1DeleteCampaignCommand = deserializeAws_restJson1DeleteCampaignCommand;
699
522
  const deserializeAws_restJson1DeleteCampaignCommandError = async (output, context) => {
@@ -701,7 +524,6 @@ const deserializeAws_restJson1DeleteCampaignCommandError = async (output, contex
701
524
  ...output,
702
525
  body: await parseBody(output.body, context),
703
526
  };
704
- let response;
705
527
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
706
528
  switch (errorCode) {
707
529
  case "AccessDeniedException":
@@ -718,25 +540,23 @@ const deserializeAws_restJson1DeleteCampaignCommandError = async (output, contex
718
540
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
719
541
  default:
720
542
  const parsedBody = parsedOutput.body;
721
- const $metadata = deserializeMetadata(output);
722
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
723
- response = new ConnectCampaignsServiceException_1.ConnectCampaignsServiceException({
724
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
725
- $fault: "client",
726
- $metadata,
543
+ (0, smithy_client_1.throwDefaultError)({
544
+ output,
545
+ parsedBody,
546
+ exceptionCtor: ConnectCampaignsServiceException_1.ConnectCampaignsServiceException,
547
+ errorCode,
727
548
  });
728
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
729
549
  }
730
550
  };
731
551
  const deserializeAws_restJson1DeleteConnectInstanceConfigCommand = async (output, context) => {
732
552
  if (output.statusCode !== 200 && output.statusCode >= 300) {
733
553
  return deserializeAws_restJson1DeleteConnectInstanceConfigCommandError(output, context);
734
554
  }
735
- const contents = {
555
+ const contents = map({
736
556
  $metadata: deserializeMetadata(output),
737
- };
557
+ });
738
558
  await collectBody(output.body, context);
739
- return Promise.resolve(contents);
559
+ return contents;
740
560
  };
741
561
  exports.deserializeAws_restJson1DeleteConnectInstanceConfigCommand = deserializeAws_restJson1DeleteConnectInstanceConfigCommand;
742
562
  const deserializeAws_restJson1DeleteConnectInstanceConfigCommandError = async (output, context) => {
@@ -744,7 +564,6 @@ const deserializeAws_restJson1DeleteConnectInstanceConfigCommandError = async (o
744
564
  ...output,
745
565
  body: await parseBody(output.body, context),
746
566
  };
747
- let response;
748
567
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
749
568
  switch (errorCode) {
750
569
  case "AccessDeniedException":
@@ -767,25 +586,23 @@ const deserializeAws_restJson1DeleteConnectInstanceConfigCommandError = async (o
767
586
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
768
587
  default:
769
588
  const parsedBody = parsedOutput.body;
770
- const $metadata = deserializeMetadata(output);
771
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
772
- response = new ConnectCampaignsServiceException_1.ConnectCampaignsServiceException({
773
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
774
- $fault: "client",
775
- $metadata,
589
+ (0, smithy_client_1.throwDefaultError)({
590
+ output,
591
+ parsedBody,
592
+ exceptionCtor: ConnectCampaignsServiceException_1.ConnectCampaignsServiceException,
593
+ errorCode,
776
594
  });
777
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
778
595
  }
779
596
  };
780
597
  const deserializeAws_restJson1DeleteInstanceOnboardingJobCommand = async (output, context) => {
781
598
  if (output.statusCode !== 200 && output.statusCode >= 300) {
782
599
  return deserializeAws_restJson1DeleteInstanceOnboardingJobCommandError(output, context);
783
600
  }
784
- const contents = {
601
+ const contents = map({
785
602
  $metadata: deserializeMetadata(output),
786
- };
603
+ });
787
604
  await collectBody(output.body, context);
788
- return Promise.resolve(contents);
605
+ return contents;
789
606
  };
790
607
  exports.deserializeAws_restJson1DeleteInstanceOnboardingJobCommand = deserializeAws_restJson1DeleteInstanceOnboardingJobCommand;
791
608
  const deserializeAws_restJson1DeleteInstanceOnboardingJobCommandError = async (output, context) => {
@@ -793,7 +610,6 @@ const deserializeAws_restJson1DeleteInstanceOnboardingJobCommandError = async (o
793
610
  ...output,
794
611
  body: await parseBody(output.body, context),
795
612
  };
796
- let response;
797
613
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
798
614
  switch (errorCode) {
799
615
  case "AccessDeniedException":
@@ -813,29 +629,26 @@ const deserializeAws_restJson1DeleteInstanceOnboardingJobCommandError = async (o
813
629
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
814
630
  default:
815
631
  const parsedBody = parsedOutput.body;
816
- const $metadata = deserializeMetadata(output);
817
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
818
- response = new ConnectCampaignsServiceException_1.ConnectCampaignsServiceException({
819
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
820
- $fault: "client",
821
- $metadata,
632
+ (0, smithy_client_1.throwDefaultError)({
633
+ output,
634
+ parsedBody,
635
+ exceptionCtor: ConnectCampaignsServiceException_1.ConnectCampaignsServiceException,
636
+ errorCode,
822
637
  });
823
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
824
638
  }
825
639
  };
826
640
  const deserializeAws_restJson1DescribeCampaignCommand = async (output, context) => {
827
641
  if (output.statusCode !== 200 && output.statusCode >= 300) {
828
642
  return deserializeAws_restJson1DescribeCampaignCommandError(output, context);
829
643
  }
830
- const contents = {
644
+ const contents = map({
831
645
  $metadata: deserializeMetadata(output),
832
- campaign: undefined,
833
- };
646
+ });
834
647
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
835
- if (data.campaign !== undefined && data.campaign !== null) {
648
+ if (data.campaign != null) {
836
649
  contents.campaign = deserializeAws_restJson1Campaign(data.campaign, context);
837
650
  }
838
- return Promise.resolve(contents);
651
+ return contents;
839
652
  };
840
653
  exports.deserializeAws_restJson1DescribeCampaignCommand = deserializeAws_restJson1DescribeCampaignCommand;
841
654
  const deserializeAws_restJson1DescribeCampaignCommandError = async (output, context) => {
@@ -843,7 +656,6 @@ const deserializeAws_restJson1DescribeCampaignCommandError = async (output, cont
843
656
  ...output,
844
657
  body: await parseBody(output.body, context),
845
658
  };
846
- let response;
847
659
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
848
660
  switch (errorCode) {
849
661
  case "AccessDeniedException":
@@ -860,29 +672,26 @@ const deserializeAws_restJson1DescribeCampaignCommandError = async (output, cont
860
672
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
861
673
  default:
862
674
  const parsedBody = parsedOutput.body;
863
- const $metadata = deserializeMetadata(output);
864
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
865
- response = new ConnectCampaignsServiceException_1.ConnectCampaignsServiceException({
866
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
867
- $fault: "client",
868
- $metadata,
675
+ (0, smithy_client_1.throwDefaultError)({
676
+ output,
677
+ parsedBody,
678
+ exceptionCtor: ConnectCampaignsServiceException_1.ConnectCampaignsServiceException,
679
+ errorCode,
869
680
  });
870
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
871
681
  }
872
682
  };
873
683
  const deserializeAws_restJson1GetCampaignStateCommand = async (output, context) => {
874
684
  if (output.statusCode !== 200 && output.statusCode >= 300) {
875
685
  return deserializeAws_restJson1GetCampaignStateCommandError(output, context);
876
686
  }
877
- const contents = {
687
+ const contents = map({
878
688
  $metadata: deserializeMetadata(output),
879
- state: undefined,
880
- };
689
+ });
881
690
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
882
- if (data.state !== undefined && data.state !== null) {
691
+ if (data.state != null) {
883
692
  contents.state = (0, smithy_client_1.expectString)(data.state);
884
693
  }
885
- return Promise.resolve(contents);
694
+ return contents;
886
695
  };
887
696
  exports.deserializeAws_restJson1GetCampaignStateCommand = deserializeAws_restJson1GetCampaignStateCommand;
888
697
  const deserializeAws_restJson1GetCampaignStateCommandError = async (output, context) => {
@@ -890,7 +699,6 @@ const deserializeAws_restJson1GetCampaignStateCommandError = async (output, cont
890
699
  ...output,
891
700
  body: await parseBody(output.body, context),
892
701
  };
893
- let response;
894
702
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
895
703
  switch (errorCode) {
896
704
  case "AccessDeniedException":
@@ -907,33 +715,29 @@ const deserializeAws_restJson1GetCampaignStateCommandError = async (output, cont
907
715
  throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
908
716
  default:
909
717
  const parsedBody = parsedOutput.body;
910
- const $metadata = deserializeMetadata(output);
911
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
912
- response = new ConnectCampaignsServiceException_1.ConnectCampaignsServiceException({
913
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
914
- $fault: "client",
915
- $metadata,
718
+ (0, smithy_client_1.throwDefaultError)({
719
+ output,
720
+ parsedBody,
721
+ exceptionCtor: ConnectCampaignsServiceException_1.ConnectCampaignsServiceException,
722
+ errorCode,
916
723
  });
917
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
918
724
  }
919
725
  };
920
726
  const deserializeAws_restJson1GetCampaignStateBatchCommand = async (output, context) => {
921
727
  if (output.statusCode !== 200 && output.statusCode >= 300) {
922
728
  return deserializeAws_restJson1GetCampaignStateBatchCommandError(output, context);
923
729
  }
924
- const contents = {
730
+ const contents = map({
925
731
  $metadata: deserializeMetadata(output),
926
- failedRequests: undefined,
927
- successfulRequests: undefined,
928
- };
732
+ });
929
733
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
930
- if (data.failedRequests !== undefined && data.failedRequests !== null) {
734
+ if (data.failedRequests != null) {
931
735
  contents.failedRequests = deserializeAws_restJson1FailedCampaignStateResponseList(data.failedRequests, context);
932
736
  }
933
- if (data.successfulRequests !== undefined && data.successfulRequests !== null) {
737
+ if (data.successfulRequests != null) {
934
738
  contents.successfulRequests = deserializeAws_restJson1SuccessfulCampaignStateResponseList(data.successfulRequests, context);
935
739
  }
936
- return Promise.resolve(contents);
740
+ return contents;
937
741
  };
938
742
  exports.deserializeAws_restJson1GetCampaignStateBatchCommand = deserializeAws_restJson1GetCampaignStateBatchCommand;
939
743
  const deserializeAws_restJson1GetCampaignStateBatchCommandError = async (output, context) => {
@@ -941,7 +745,6 @@ const deserializeAws_restJson1GetCampaignStateBatchCommandError = async (output,
941
745
  ...output,
942
746
  body: await parseBody(output.body, context),
943
747
  };
944
- let response;
945
748
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
946
749
  switch (errorCode) {
947
750
  case "AccessDeniedException":
@@ -958,29 +761,26 @@ const deserializeAws_restJson1GetCampaignStateBatchCommandError = async (output,
958
761
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
959
762
  default:
960
763
  const parsedBody = parsedOutput.body;
961
- const $metadata = deserializeMetadata(output);
962
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
963
- response = new ConnectCampaignsServiceException_1.ConnectCampaignsServiceException({
964
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
965
- $fault: "client",
966
- $metadata,
764
+ (0, smithy_client_1.throwDefaultError)({
765
+ output,
766
+ parsedBody,
767
+ exceptionCtor: ConnectCampaignsServiceException_1.ConnectCampaignsServiceException,
768
+ errorCode,
967
769
  });
968
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
969
770
  }
970
771
  };
971
772
  const deserializeAws_restJson1GetConnectInstanceConfigCommand = async (output, context) => {
972
773
  if (output.statusCode !== 200 && output.statusCode >= 300) {
973
774
  return deserializeAws_restJson1GetConnectInstanceConfigCommandError(output, context);
974
775
  }
975
- const contents = {
776
+ const contents = map({
976
777
  $metadata: deserializeMetadata(output),
977
- connectInstanceConfig: undefined,
978
- };
778
+ });
979
779
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
980
- if (data.connectInstanceConfig !== undefined && data.connectInstanceConfig !== null) {
780
+ if (data.connectInstanceConfig != null) {
981
781
  contents.connectInstanceConfig = deserializeAws_restJson1InstanceConfig(data.connectInstanceConfig, context);
982
782
  }
983
- return Promise.resolve(contents);
783
+ return contents;
984
784
  };
985
785
  exports.deserializeAws_restJson1GetConnectInstanceConfigCommand = deserializeAws_restJson1GetConnectInstanceConfigCommand;
986
786
  const deserializeAws_restJson1GetConnectInstanceConfigCommandError = async (output, context) => {
@@ -988,7 +788,6 @@ const deserializeAws_restJson1GetConnectInstanceConfigCommandError = async (outp
988
788
  ...output,
989
789
  body: await parseBody(output.body, context),
990
790
  };
991
- let response;
992
791
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
993
792
  switch (errorCode) {
994
793
  case "AccessDeniedException":
@@ -1005,29 +804,26 @@ const deserializeAws_restJson1GetConnectInstanceConfigCommandError = async (outp
1005
804
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1006
805
  default:
1007
806
  const parsedBody = parsedOutput.body;
1008
- const $metadata = deserializeMetadata(output);
1009
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1010
- response = new ConnectCampaignsServiceException_1.ConnectCampaignsServiceException({
1011
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1012
- $fault: "client",
1013
- $metadata,
807
+ (0, smithy_client_1.throwDefaultError)({
808
+ output,
809
+ parsedBody,
810
+ exceptionCtor: ConnectCampaignsServiceException_1.ConnectCampaignsServiceException,
811
+ errorCode,
1014
812
  });
1015
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1016
813
  }
1017
814
  };
1018
815
  const deserializeAws_restJson1GetInstanceOnboardingJobStatusCommand = async (output, context) => {
1019
816
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1020
817
  return deserializeAws_restJson1GetInstanceOnboardingJobStatusCommandError(output, context);
1021
818
  }
1022
- const contents = {
819
+ const contents = map({
1023
820
  $metadata: deserializeMetadata(output),
1024
- connectInstanceOnboardingJobStatus: undefined,
1025
- };
821
+ });
1026
822
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1027
- if (data.connectInstanceOnboardingJobStatus !== undefined && data.connectInstanceOnboardingJobStatus !== null) {
823
+ if (data.connectInstanceOnboardingJobStatus != null) {
1028
824
  contents.connectInstanceOnboardingJobStatus = deserializeAws_restJson1InstanceOnboardingJobStatus(data.connectInstanceOnboardingJobStatus, context);
1029
825
  }
1030
- return Promise.resolve(contents);
826
+ return contents;
1031
827
  };
1032
828
  exports.deserializeAws_restJson1GetInstanceOnboardingJobStatusCommand = deserializeAws_restJson1GetInstanceOnboardingJobStatusCommand;
1033
829
  const deserializeAws_restJson1GetInstanceOnboardingJobStatusCommandError = async (output, context) => {
@@ -1035,7 +831,6 @@ const deserializeAws_restJson1GetInstanceOnboardingJobStatusCommandError = async
1035
831
  ...output,
1036
832
  body: await parseBody(output.body, context),
1037
833
  };
1038
- let response;
1039
834
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1040
835
  switch (errorCode) {
1041
836
  case "AccessDeniedException":
@@ -1052,33 +847,29 @@ const deserializeAws_restJson1GetInstanceOnboardingJobStatusCommandError = async
1052
847
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1053
848
  default:
1054
849
  const parsedBody = parsedOutput.body;
1055
- const $metadata = deserializeMetadata(output);
1056
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1057
- response = new ConnectCampaignsServiceException_1.ConnectCampaignsServiceException({
1058
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1059
- $fault: "client",
1060
- $metadata,
850
+ (0, smithy_client_1.throwDefaultError)({
851
+ output,
852
+ parsedBody,
853
+ exceptionCtor: ConnectCampaignsServiceException_1.ConnectCampaignsServiceException,
854
+ errorCode,
1061
855
  });
1062
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1063
856
  }
1064
857
  };
1065
858
  const deserializeAws_restJson1ListCampaignsCommand = async (output, context) => {
1066
859
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1067
860
  return deserializeAws_restJson1ListCampaignsCommandError(output, context);
1068
861
  }
1069
- const contents = {
862
+ const contents = map({
1070
863
  $metadata: deserializeMetadata(output),
1071
- campaignSummaryList: undefined,
1072
- nextToken: undefined,
1073
- };
864
+ });
1074
865
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1075
- if (data.campaignSummaryList !== undefined && data.campaignSummaryList !== null) {
866
+ if (data.campaignSummaryList != null) {
1076
867
  contents.campaignSummaryList = deserializeAws_restJson1CampaignSummaryList(data.campaignSummaryList, context);
1077
868
  }
1078
- if (data.nextToken !== undefined && data.nextToken !== null) {
869
+ if (data.nextToken != null) {
1079
870
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1080
871
  }
1081
- return Promise.resolve(contents);
872
+ return contents;
1082
873
  };
1083
874
  exports.deserializeAws_restJson1ListCampaignsCommand = deserializeAws_restJson1ListCampaignsCommand;
1084
875
  const deserializeAws_restJson1ListCampaignsCommandError = async (output, context) => {
@@ -1086,7 +877,6 @@ const deserializeAws_restJson1ListCampaignsCommandError = async (output, context
1086
877
  ...output,
1087
878
  body: await parseBody(output.body, context),
1088
879
  };
1089
- let response;
1090
880
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1091
881
  switch (errorCode) {
1092
882
  case "AccessDeniedException":
@@ -1100,29 +890,26 @@ const deserializeAws_restJson1ListCampaignsCommandError = async (output, context
1100
890
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1101
891
  default:
1102
892
  const parsedBody = parsedOutput.body;
1103
- const $metadata = deserializeMetadata(output);
1104
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1105
- response = new ConnectCampaignsServiceException_1.ConnectCampaignsServiceException({
1106
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1107
- $fault: "client",
1108
- $metadata,
893
+ (0, smithy_client_1.throwDefaultError)({
894
+ output,
895
+ parsedBody,
896
+ exceptionCtor: ConnectCampaignsServiceException_1.ConnectCampaignsServiceException,
897
+ errorCode,
1109
898
  });
1110
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1111
899
  }
1112
900
  };
1113
901
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
1114
902
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1115
903
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
1116
904
  }
1117
- const contents = {
905
+ const contents = map({
1118
906
  $metadata: deserializeMetadata(output),
1119
- tags: undefined,
1120
- };
907
+ });
1121
908
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1122
- if (data.tags !== undefined && data.tags !== null) {
909
+ if (data.tags != null) {
1123
910
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
1124
911
  }
1125
- return Promise.resolve(contents);
912
+ return contents;
1126
913
  };
1127
914
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
1128
915
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -1130,7 +917,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1130
917
  ...output,
1131
918
  body: await parseBody(output.body, context),
1132
919
  };
1133
- let response;
1134
920
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1135
921
  switch (errorCode) {
1136
922
  case "AccessDeniedException":
@@ -1150,25 +936,23 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1150
936
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1151
937
  default:
1152
938
  const parsedBody = parsedOutput.body;
1153
- const $metadata = deserializeMetadata(output);
1154
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1155
- response = new ConnectCampaignsServiceException_1.ConnectCampaignsServiceException({
1156
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1157
- $fault: "client",
1158
- $metadata,
939
+ (0, smithy_client_1.throwDefaultError)({
940
+ output,
941
+ parsedBody,
942
+ exceptionCtor: ConnectCampaignsServiceException_1.ConnectCampaignsServiceException,
943
+ errorCode,
1159
944
  });
1160
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1161
945
  }
1162
946
  };
1163
947
  const deserializeAws_restJson1PauseCampaignCommand = async (output, context) => {
1164
948
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1165
949
  return deserializeAws_restJson1PauseCampaignCommandError(output, context);
1166
950
  }
1167
- const contents = {
951
+ const contents = map({
1168
952
  $metadata: deserializeMetadata(output),
1169
- };
953
+ });
1170
954
  await collectBody(output.body, context);
1171
- return Promise.resolve(contents);
955
+ return contents;
1172
956
  };
1173
957
  exports.deserializeAws_restJson1PauseCampaignCommand = deserializeAws_restJson1PauseCampaignCommand;
1174
958
  const deserializeAws_restJson1PauseCampaignCommandError = async (output, context) => {
@@ -1176,7 +960,6 @@ const deserializeAws_restJson1PauseCampaignCommandError = async (output, context
1176
960
  ...output,
1177
961
  body: await parseBody(output.body, context),
1178
962
  };
1179
- let response;
1180
963
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1181
964
  switch (errorCode) {
1182
965
  case "AccessDeniedException":
@@ -1199,33 +982,29 @@ const deserializeAws_restJson1PauseCampaignCommandError = async (output, context
1199
982
  throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1200
983
  default:
1201
984
  const parsedBody = parsedOutput.body;
1202
- const $metadata = deserializeMetadata(output);
1203
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1204
- response = new ConnectCampaignsServiceException_1.ConnectCampaignsServiceException({
1205
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1206
- $fault: "client",
1207
- $metadata,
985
+ (0, smithy_client_1.throwDefaultError)({
986
+ output,
987
+ parsedBody,
988
+ exceptionCtor: ConnectCampaignsServiceException_1.ConnectCampaignsServiceException,
989
+ errorCode,
1208
990
  });
1209
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1210
991
  }
1211
992
  };
1212
993
  const deserializeAws_restJson1PutDialRequestBatchCommand = async (output, context) => {
1213
994
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1214
995
  return deserializeAws_restJson1PutDialRequestBatchCommandError(output, context);
1215
996
  }
1216
- const contents = {
997
+ const contents = map({
1217
998
  $metadata: deserializeMetadata(output),
1218
- failedRequests: undefined,
1219
- successfulRequests: undefined,
1220
- };
999
+ });
1221
1000
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1222
- if (data.failedRequests !== undefined && data.failedRequests !== null) {
1001
+ if (data.failedRequests != null) {
1223
1002
  contents.failedRequests = deserializeAws_restJson1FailedRequestList(data.failedRequests, context);
1224
1003
  }
1225
- if (data.successfulRequests !== undefined && data.successfulRequests !== null) {
1004
+ if (data.successfulRequests != null) {
1226
1005
  contents.successfulRequests = deserializeAws_restJson1SuccessfulRequestList(data.successfulRequests, context);
1227
1006
  }
1228
- return Promise.resolve(contents);
1007
+ return contents;
1229
1008
  };
1230
1009
  exports.deserializeAws_restJson1PutDialRequestBatchCommand = deserializeAws_restJson1PutDialRequestBatchCommand;
1231
1010
  const deserializeAws_restJson1PutDialRequestBatchCommandError = async (output, context) => {
@@ -1233,7 +1012,6 @@ const deserializeAws_restJson1PutDialRequestBatchCommandError = async (output, c
1233
1012
  ...output,
1234
1013
  body: await parseBody(output.body, context),
1235
1014
  };
1236
- let response;
1237
1015
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1238
1016
  switch (errorCode) {
1239
1017
  case "AccessDeniedException":
@@ -1259,25 +1037,23 @@ const deserializeAws_restJson1PutDialRequestBatchCommandError = async (output, c
1259
1037
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1260
1038
  default:
1261
1039
  const parsedBody = parsedOutput.body;
1262
- const $metadata = deserializeMetadata(output);
1263
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1264
- response = new ConnectCampaignsServiceException_1.ConnectCampaignsServiceException({
1265
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1266
- $fault: "client",
1267
- $metadata,
1040
+ (0, smithy_client_1.throwDefaultError)({
1041
+ output,
1042
+ parsedBody,
1043
+ exceptionCtor: ConnectCampaignsServiceException_1.ConnectCampaignsServiceException,
1044
+ errorCode,
1268
1045
  });
1269
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1270
1046
  }
1271
1047
  };
1272
1048
  const deserializeAws_restJson1ResumeCampaignCommand = async (output, context) => {
1273
1049
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1274
1050
  return deserializeAws_restJson1ResumeCampaignCommandError(output, context);
1275
1051
  }
1276
- const contents = {
1052
+ const contents = map({
1277
1053
  $metadata: deserializeMetadata(output),
1278
- };
1054
+ });
1279
1055
  await collectBody(output.body, context);
1280
- return Promise.resolve(contents);
1056
+ return contents;
1281
1057
  };
1282
1058
  exports.deserializeAws_restJson1ResumeCampaignCommand = deserializeAws_restJson1ResumeCampaignCommand;
1283
1059
  const deserializeAws_restJson1ResumeCampaignCommandError = async (output, context) => {
@@ -1285,7 +1061,6 @@ const deserializeAws_restJson1ResumeCampaignCommandError = async (output, contex
1285
1061
  ...output,
1286
1062
  body: await parseBody(output.body, context),
1287
1063
  };
1288
- let response;
1289
1064
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1290
1065
  switch (errorCode) {
1291
1066
  case "AccessDeniedException":
@@ -1308,25 +1083,23 @@ const deserializeAws_restJson1ResumeCampaignCommandError = async (output, contex
1308
1083
  throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1309
1084
  default:
1310
1085
  const parsedBody = parsedOutput.body;
1311
- const $metadata = deserializeMetadata(output);
1312
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1313
- response = new ConnectCampaignsServiceException_1.ConnectCampaignsServiceException({
1314
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1315
- $fault: "client",
1316
- $metadata,
1086
+ (0, smithy_client_1.throwDefaultError)({
1087
+ output,
1088
+ parsedBody,
1089
+ exceptionCtor: ConnectCampaignsServiceException_1.ConnectCampaignsServiceException,
1090
+ errorCode,
1317
1091
  });
1318
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1319
1092
  }
1320
1093
  };
1321
1094
  const deserializeAws_restJson1StartCampaignCommand = async (output, context) => {
1322
1095
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1323
1096
  return deserializeAws_restJson1StartCampaignCommandError(output, context);
1324
1097
  }
1325
- const contents = {
1098
+ const contents = map({
1326
1099
  $metadata: deserializeMetadata(output),
1327
- };
1100
+ });
1328
1101
  await collectBody(output.body, context);
1329
- return Promise.resolve(contents);
1102
+ return contents;
1330
1103
  };
1331
1104
  exports.deserializeAws_restJson1StartCampaignCommand = deserializeAws_restJson1StartCampaignCommand;
1332
1105
  const deserializeAws_restJson1StartCampaignCommandError = async (output, context) => {
@@ -1334,7 +1107,6 @@ const deserializeAws_restJson1StartCampaignCommandError = async (output, context
1334
1107
  ...output,
1335
1108
  body: await parseBody(output.body, context),
1336
1109
  };
1337
- let response;
1338
1110
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1339
1111
  switch (errorCode) {
1340
1112
  case "AccessDeniedException":
@@ -1357,29 +1129,26 @@ const deserializeAws_restJson1StartCampaignCommandError = async (output, context
1357
1129
  throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1358
1130
  default:
1359
1131
  const parsedBody = parsedOutput.body;
1360
- const $metadata = deserializeMetadata(output);
1361
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1362
- response = new ConnectCampaignsServiceException_1.ConnectCampaignsServiceException({
1363
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1364
- $fault: "client",
1365
- $metadata,
1132
+ (0, smithy_client_1.throwDefaultError)({
1133
+ output,
1134
+ parsedBody,
1135
+ exceptionCtor: ConnectCampaignsServiceException_1.ConnectCampaignsServiceException,
1136
+ errorCode,
1366
1137
  });
1367
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1368
1138
  }
1369
1139
  };
1370
1140
  const deserializeAws_restJson1StartInstanceOnboardingJobCommand = async (output, context) => {
1371
1141
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1372
1142
  return deserializeAws_restJson1StartInstanceOnboardingJobCommandError(output, context);
1373
1143
  }
1374
- const contents = {
1144
+ const contents = map({
1375
1145
  $metadata: deserializeMetadata(output),
1376
- connectInstanceOnboardingJobStatus: undefined,
1377
- };
1146
+ });
1378
1147
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1379
- if (data.connectInstanceOnboardingJobStatus !== undefined && data.connectInstanceOnboardingJobStatus !== null) {
1148
+ if (data.connectInstanceOnboardingJobStatus != null) {
1380
1149
  contents.connectInstanceOnboardingJobStatus = deserializeAws_restJson1InstanceOnboardingJobStatus(data.connectInstanceOnboardingJobStatus, context);
1381
1150
  }
1382
- return Promise.resolve(contents);
1151
+ return contents;
1383
1152
  };
1384
1153
  exports.deserializeAws_restJson1StartInstanceOnboardingJobCommand = deserializeAws_restJson1StartInstanceOnboardingJobCommand;
1385
1154
  const deserializeAws_restJson1StartInstanceOnboardingJobCommandError = async (output, context) => {
@@ -1387,7 +1156,6 @@ const deserializeAws_restJson1StartInstanceOnboardingJobCommandError = async (ou
1387
1156
  ...output,
1388
1157
  body: await parseBody(output.body, context),
1389
1158
  };
1390
- let response;
1391
1159
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1392
1160
  switch (errorCode) {
1393
1161
  case "AccessDeniedException":
@@ -1410,25 +1178,23 @@ const deserializeAws_restJson1StartInstanceOnboardingJobCommandError = async (ou
1410
1178
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1411
1179
  default:
1412
1180
  const parsedBody = parsedOutput.body;
1413
- const $metadata = deserializeMetadata(output);
1414
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1415
- response = new ConnectCampaignsServiceException_1.ConnectCampaignsServiceException({
1416
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1417
- $fault: "client",
1418
- $metadata,
1181
+ (0, smithy_client_1.throwDefaultError)({
1182
+ output,
1183
+ parsedBody,
1184
+ exceptionCtor: ConnectCampaignsServiceException_1.ConnectCampaignsServiceException,
1185
+ errorCode,
1419
1186
  });
1420
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1421
1187
  }
1422
1188
  };
1423
1189
  const deserializeAws_restJson1StopCampaignCommand = async (output, context) => {
1424
1190
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1425
1191
  return deserializeAws_restJson1StopCampaignCommandError(output, context);
1426
1192
  }
1427
- const contents = {
1193
+ const contents = map({
1428
1194
  $metadata: deserializeMetadata(output),
1429
- };
1195
+ });
1430
1196
  await collectBody(output.body, context);
1431
- return Promise.resolve(contents);
1197
+ return contents;
1432
1198
  };
1433
1199
  exports.deserializeAws_restJson1StopCampaignCommand = deserializeAws_restJson1StopCampaignCommand;
1434
1200
  const deserializeAws_restJson1StopCampaignCommandError = async (output, context) => {
@@ -1436,7 +1202,6 @@ const deserializeAws_restJson1StopCampaignCommandError = async (output, context)
1436
1202
  ...output,
1437
1203
  body: await parseBody(output.body, context),
1438
1204
  };
1439
- let response;
1440
1205
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1441
1206
  switch (errorCode) {
1442
1207
  case "AccessDeniedException":
@@ -1459,25 +1224,23 @@ const deserializeAws_restJson1StopCampaignCommandError = async (output, context)
1459
1224
  throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1460
1225
  default:
1461
1226
  const parsedBody = parsedOutput.body;
1462
- const $metadata = deserializeMetadata(output);
1463
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1464
- response = new ConnectCampaignsServiceException_1.ConnectCampaignsServiceException({
1465
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1466
- $fault: "client",
1467
- $metadata,
1227
+ (0, smithy_client_1.throwDefaultError)({
1228
+ output,
1229
+ parsedBody,
1230
+ exceptionCtor: ConnectCampaignsServiceException_1.ConnectCampaignsServiceException,
1231
+ errorCode,
1468
1232
  });
1469
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1470
1233
  }
1471
1234
  };
1472
1235
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
1473
1236
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1474
1237
  return deserializeAws_restJson1TagResourceCommandError(output, context);
1475
1238
  }
1476
- const contents = {
1239
+ const contents = map({
1477
1240
  $metadata: deserializeMetadata(output),
1478
- };
1241
+ });
1479
1242
  await collectBody(output.body, context);
1480
- return Promise.resolve(contents);
1243
+ return contents;
1481
1244
  };
1482
1245
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
1483
1246
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -1485,7 +1248,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1485
1248
  ...output,
1486
1249
  body: await parseBody(output.body, context),
1487
1250
  };
1488
- let response;
1489
1251
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1490
1252
  switch (errorCode) {
1491
1253
  case "AccessDeniedException":
@@ -1505,25 +1267,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1505
1267
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1506
1268
  default:
1507
1269
  const parsedBody = parsedOutput.body;
1508
- const $metadata = deserializeMetadata(output);
1509
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1510
- response = new ConnectCampaignsServiceException_1.ConnectCampaignsServiceException({
1511
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1512
- $fault: "client",
1513
- $metadata,
1270
+ (0, smithy_client_1.throwDefaultError)({
1271
+ output,
1272
+ parsedBody,
1273
+ exceptionCtor: ConnectCampaignsServiceException_1.ConnectCampaignsServiceException,
1274
+ errorCode,
1514
1275
  });
1515
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1516
1276
  }
1517
1277
  };
1518
1278
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
1519
1279
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1520
1280
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
1521
1281
  }
1522
- const contents = {
1282
+ const contents = map({
1523
1283
  $metadata: deserializeMetadata(output),
1524
- };
1284
+ });
1525
1285
  await collectBody(output.body, context);
1526
- return Promise.resolve(contents);
1286
+ return contents;
1527
1287
  };
1528
1288
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
1529
1289
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -1531,7 +1291,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1531
1291
  ...output,
1532
1292
  body: await parseBody(output.body, context),
1533
1293
  };
1534
- let response;
1535
1294
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1536
1295
  switch (errorCode) {
1537
1296
  case "AccessDeniedException":
@@ -1551,25 +1310,23 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1551
1310
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1552
1311
  default:
1553
1312
  const parsedBody = parsedOutput.body;
1554
- const $metadata = deserializeMetadata(output);
1555
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1556
- response = new ConnectCampaignsServiceException_1.ConnectCampaignsServiceException({
1557
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1558
- $fault: "client",
1559
- $metadata,
1313
+ (0, smithy_client_1.throwDefaultError)({
1314
+ output,
1315
+ parsedBody,
1316
+ exceptionCtor: ConnectCampaignsServiceException_1.ConnectCampaignsServiceException,
1317
+ errorCode,
1560
1318
  });
1561
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1562
1319
  }
1563
1320
  };
1564
1321
  const deserializeAws_restJson1UpdateCampaignDialerConfigCommand = async (output, context) => {
1565
1322
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1566
1323
  return deserializeAws_restJson1UpdateCampaignDialerConfigCommandError(output, context);
1567
1324
  }
1568
- const contents = {
1325
+ const contents = map({
1569
1326
  $metadata: deserializeMetadata(output),
1570
- };
1327
+ });
1571
1328
  await collectBody(output.body, context);
1572
- return Promise.resolve(contents);
1329
+ return contents;
1573
1330
  };
1574
1331
  exports.deserializeAws_restJson1UpdateCampaignDialerConfigCommand = deserializeAws_restJson1UpdateCampaignDialerConfigCommand;
1575
1332
  const deserializeAws_restJson1UpdateCampaignDialerConfigCommandError = async (output, context) => {
@@ -1577,7 +1334,6 @@ const deserializeAws_restJson1UpdateCampaignDialerConfigCommandError = async (ou
1577
1334
  ...output,
1578
1335
  body: await parseBody(output.body, context),
1579
1336
  };
1580
- let response;
1581
1337
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1582
1338
  switch (errorCode) {
1583
1339
  case "AccessDeniedException":
@@ -1597,25 +1353,23 @@ const deserializeAws_restJson1UpdateCampaignDialerConfigCommandError = async (ou
1597
1353
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1598
1354
  default:
1599
1355
  const parsedBody = parsedOutput.body;
1600
- const $metadata = deserializeMetadata(output);
1601
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1602
- response = new ConnectCampaignsServiceException_1.ConnectCampaignsServiceException({
1603
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1604
- $fault: "client",
1605
- $metadata,
1356
+ (0, smithy_client_1.throwDefaultError)({
1357
+ output,
1358
+ parsedBody,
1359
+ exceptionCtor: ConnectCampaignsServiceException_1.ConnectCampaignsServiceException,
1360
+ errorCode,
1606
1361
  });
1607
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1608
1362
  }
1609
1363
  };
1610
1364
  const deserializeAws_restJson1UpdateCampaignNameCommand = async (output, context) => {
1611
1365
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1612
1366
  return deserializeAws_restJson1UpdateCampaignNameCommandError(output, context);
1613
1367
  }
1614
- const contents = {
1368
+ const contents = map({
1615
1369
  $metadata: deserializeMetadata(output),
1616
- };
1370
+ });
1617
1371
  await collectBody(output.body, context);
1618
- return Promise.resolve(contents);
1372
+ return contents;
1619
1373
  };
1620
1374
  exports.deserializeAws_restJson1UpdateCampaignNameCommand = deserializeAws_restJson1UpdateCampaignNameCommand;
1621
1375
  const deserializeAws_restJson1UpdateCampaignNameCommandError = async (output, context) => {
@@ -1623,7 +1377,6 @@ const deserializeAws_restJson1UpdateCampaignNameCommandError = async (output, co
1623
1377
  ...output,
1624
1378
  body: await parseBody(output.body, context),
1625
1379
  };
1626
- let response;
1627
1380
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1628
1381
  switch (errorCode) {
1629
1382
  case "AccessDeniedException":
@@ -1643,25 +1396,23 @@ const deserializeAws_restJson1UpdateCampaignNameCommandError = async (output, co
1643
1396
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1644
1397
  default:
1645
1398
  const parsedBody = parsedOutput.body;
1646
- const $metadata = deserializeMetadata(output);
1647
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1648
- response = new ConnectCampaignsServiceException_1.ConnectCampaignsServiceException({
1649
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1650
- $fault: "client",
1651
- $metadata,
1399
+ (0, smithy_client_1.throwDefaultError)({
1400
+ output,
1401
+ parsedBody,
1402
+ exceptionCtor: ConnectCampaignsServiceException_1.ConnectCampaignsServiceException,
1403
+ errorCode,
1652
1404
  });
1653
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1654
1405
  }
1655
1406
  };
1656
1407
  const deserializeAws_restJson1UpdateCampaignOutboundCallConfigCommand = async (output, context) => {
1657
1408
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1658
1409
  return deserializeAws_restJson1UpdateCampaignOutboundCallConfigCommandError(output, context);
1659
1410
  }
1660
- const contents = {
1411
+ const contents = map({
1661
1412
  $metadata: deserializeMetadata(output),
1662
- };
1413
+ });
1663
1414
  await collectBody(output.body, context);
1664
- return Promise.resolve(contents);
1415
+ return contents;
1665
1416
  };
1666
1417
  exports.deserializeAws_restJson1UpdateCampaignOutboundCallConfigCommand = deserializeAws_restJson1UpdateCampaignOutboundCallConfigCommand;
1667
1418
  const deserializeAws_restJson1UpdateCampaignOutboundCallConfigCommandError = async (output, context) => {
@@ -1669,7 +1420,6 @@ const deserializeAws_restJson1UpdateCampaignOutboundCallConfigCommandError = asy
1669
1420
  ...output,
1670
1421
  body: await parseBody(output.body, context),
1671
1422
  };
1672
- let response;
1673
1423
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1674
1424
  switch (errorCode) {
1675
1425
  case "AccessDeniedException":
@@ -1692,23 +1442,21 @@ const deserializeAws_restJson1UpdateCampaignOutboundCallConfigCommandError = asy
1692
1442
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1693
1443
  default:
1694
1444
  const parsedBody = parsedOutput.body;
1695
- const $metadata = deserializeMetadata(output);
1696
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1697
- response = new ConnectCampaignsServiceException_1.ConnectCampaignsServiceException({
1698
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1699
- $fault: "client",
1700
- $metadata,
1445
+ (0, smithy_client_1.throwDefaultError)({
1446
+ output,
1447
+ parsedBody,
1448
+ exceptionCtor: ConnectCampaignsServiceException_1.ConnectCampaignsServiceException,
1449
+ errorCode,
1701
1450
  });
1702
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1703
1451
  }
1704
1452
  };
1453
+ const map = smithy_client_1.map;
1705
1454
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
1706
- const contents = {};
1707
- if (parsedOutput.headers["x-amzn-errortype"] !== undefined) {
1708
- contents.xAmzErrorType = parsedOutput.headers["x-amzn-errortype"];
1709
- }
1455
+ const contents = map({
1456
+ xAmzErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1457
+ });
1710
1458
  const data = parsedOutput.body;
1711
- if (data.message !== undefined && data.message !== null) {
1459
+ if (data.message != null) {
1712
1460
  contents.message = (0, smithy_client_1.expectString)(data.message);
1713
1461
  }
1714
1462
  const exception = new models_0_1.AccessDeniedException({
@@ -1718,12 +1466,11 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
1718
1466
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1719
1467
  };
1720
1468
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
1721
- const contents = {};
1722
- if (parsedOutput.headers["x-amzn-errortype"] !== undefined) {
1723
- contents.xAmzErrorType = parsedOutput.headers["x-amzn-errortype"];
1724
- }
1469
+ const contents = map({
1470
+ xAmzErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1471
+ });
1725
1472
  const data = parsedOutput.body;
1726
- if (data.message !== undefined && data.message !== null) {
1473
+ if (data.message != null) {
1727
1474
  contents.message = (0, smithy_client_1.expectString)(data.message);
1728
1475
  }
1729
1476
  const exception = new models_0_1.ConflictException({
@@ -1733,12 +1480,11 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
1733
1480
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1734
1481
  };
1735
1482
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
1736
- const contents = {};
1737
- if (parsedOutput.headers["x-amzn-errortype"] !== undefined) {
1738
- contents.xAmzErrorType = parsedOutput.headers["x-amzn-errortype"];
1739
- }
1483
+ const contents = map({
1484
+ xAmzErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1485
+ });
1740
1486
  const data = parsedOutput.body;
1741
- if (data.message !== undefined && data.message !== null) {
1487
+ if (data.message != null) {
1742
1488
  contents.message = (0, smithy_client_1.expectString)(data.message);
1743
1489
  }
1744
1490
  const exception = new models_0_1.InternalServerException({
@@ -1748,15 +1494,14 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
1748
1494
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1749
1495
  };
1750
1496
  const deserializeAws_restJson1InvalidCampaignStateExceptionResponse = async (parsedOutput, context) => {
1751
- const contents = {};
1752
- if (parsedOutput.headers["x-amzn-errortype"] !== undefined) {
1753
- contents.xAmzErrorType = parsedOutput.headers["x-amzn-errortype"];
1754
- }
1497
+ const contents = map({
1498
+ xAmzErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1499
+ });
1755
1500
  const data = parsedOutput.body;
1756
- if (data.message !== undefined && data.message !== null) {
1501
+ if (data.message != null) {
1757
1502
  contents.message = (0, smithy_client_1.expectString)(data.message);
1758
1503
  }
1759
- if (data.state !== undefined && data.state !== null) {
1504
+ if (data.state != null) {
1760
1505
  contents.state = (0, smithy_client_1.expectString)(data.state);
1761
1506
  }
1762
1507
  const exception = new models_0_1.InvalidCampaignStateException({
@@ -1766,12 +1511,11 @@ const deserializeAws_restJson1InvalidCampaignStateExceptionResponse = async (par
1766
1511
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1767
1512
  };
1768
1513
  const deserializeAws_restJson1InvalidStateExceptionResponse = async (parsedOutput, context) => {
1769
- const contents = {};
1770
- if (parsedOutput.headers["x-amzn-errortype"] !== undefined) {
1771
- contents.xAmzErrorType = parsedOutput.headers["x-amzn-errortype"];
1772
- }
1514
+ const contents = map({
1515
+ xAmzErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1516
+ });
1773
1517
  const data = parsedOutput.body;
1774
- if (data.message !== undefined && data.message !== null) {
1518
+ if (data.message != null) {
1775
1519
  contents.message = (0, smithy_client_1.expectString)(data.message);
1776
1520
  }
1777
1521
  const exception = new models_0_1.InvalidStateException({
@@ -1781,12 +1525,11 @@ const deserializeAws_restJson1InvalidStateExceptionResponse = async (parsedOutpu
1781
1525
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1782
1526
  };
1783
1527
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1784
- const contents = {};
1785
- if (parsedOutput.headers["x-amzn-errortype"] !== undefined) {
1786
- contents.xAmzErrorType = parsedOutput.headers["x-amzn-errortype"];
1787
- }
1528
+ const contents = map({
1529
+ xAmzErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1530
+ });
1788
1531
  const data = parsedOutput.body;
1789
- if (data.message !== undefined && data.message !== null) {
1532
+ if (data.message != null) {
1790
1533
  contents.message = (0, smithy_client_1.expectString)(data.message);
1791
1534
  }
1792
1535
  const exception = new models_0_1.ResourceNotFoundException({
@@ -1796,12 +1539,11 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
1796
1539
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1797
1540
  };
1798
1541
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
1799
- const contents = {};
1800
- if (parsedOutput.headers["x-amzn-errortype"] !== undefined) {
1801
- contents.xAmzErrorType = parsedOutput.headers["x-amzn-errortype"];
1802
- }
1542
+ const contents = map({
1543
+ xAmzErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1544
+ });
1803
1545
  const data = parsedOutput.body;
1804
- if (data.message !== undefined && data.message !== null) {
1546
+ if (data.message != null) {
1805
1547
  contents.message = (0, smithy_client_1.expectString)(data.message);
1806
1548
  }
1807
1549
  const exception = new models_0_1.ServiceQuotaExceededException({
@@ -1811,12 +1553,11 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
1811
1553
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1812
1554
  };
1813
1555
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
1814
- const contents = {};
1815
- if (parsedOutput.headers["x-amzn-errortype"] !== undefined) {
1816
- contents.xAmzErrorType = parsedOutput.headers["x-amzn-errortype"];
1817
- }
1556
+ const contents = map({
1557
+ xAmzErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1558
+ });
1818
1559
  const data = parsedOutput.body;
1819
- if (data.message !== undefined && data.message !== null) {
1560
+ if (data.message != null) {
1820
1561
  contents.message = (0, smithy_client_1.expectString)(data.message);
1821
1562
  }
1822
1563
  const exception = new models_0_1.ThrottlingException({
@@ -1826,12 +1567,11 @@ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput,
1826
1567
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1827
1568
  };
1828
1569
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
1829
- const contents = {};
1830
- if (parsedOutput.headers["x-amzn-errortype"] !== undefined) {
1831
- contents.xAmzErrorType = parsedOutput.headers["x-amzn-errortype"];
1832
- }
1570
+ const contents = map({
1571
+ xAmzErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1572
+ });
1833
1573
  const data = parsedOutput.body;
1834
- if (data.message !== undefined && data.message !== null) {
1574
+ if (data.message != null) {
1835
1575
  contents.message = (0, smithy_client_1.expectString)(data.message);
1836
1576
  }
1837
1577
  const exception = new models_0_1.ValidationException({
@@ -1869,9 +1609,6 @@ const serializeAws_restJson1CampaignIdList = (input, context) => {
1869
1609
  return input
1870
1610
  .filter((e) => e != null)
1871
1611
  .map((entry) => {
1872
- if (entry === null) {
1873
- return null;
1874
- }
1875
1612
  return entry;
1876
1613
  });
1877
1614
  };
@@ -1898,9 +1635,6 @@ const serializeAws_restJson1DialRequestList = (input, context) => {
1898
1635
  return input
1899
1636
  .filter((e) => e != null)
1900
1637
  .map((entry) => {
1901
- if (entry === null) {
1902
- return null;
1903
- }
1904
1638
  return serializeAws_restJson1DialRequest(entry, context);
1905
1639
  });
1906
1640
  };
@@ -1988,12 +1722,12 @@ const deserializeAws_restJson1CampaignSummaryList = (output, context) => {
1988
1722
  return retVal;
1989
1723
  };
1990
1724
  const deserializeAws_restJson1DialerConfig = (output, context) => {
1991
- if (output.predictiveDialerConfig !== undefined && output.predictiveDialerConfig !== null) {
1725
+ if (output.predictiveDialerConfig != null) {
1992
1726
  return {
1993
1727
  predictiveDialerConfig: deserializeAws_restJson1PredictiveDialerConfig(output.predictiveDialerConfig, context),
1994
1728
  };
1995
1729
  }
1996
- if (output.progressiveDialerConfig !== undefined && output.progressiveDialerConfig !== null) {
1730
+ if (output.progressiveDialerConfig != null) {
1997
1731
  return {
1998
1732
  progressiveDialerConfig: deserializeAws_restJson1ProgressiveDialerConfig(output.progressiveDialerConfig, context),
1999
1733
  };