@aws-sdk/client-pinpoint-sms-voice 3.141.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.142.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.141.0...v3.142.0) (2022-08-02)
7
+
8
+
9
+ ### Features
10
+
11
+ * **codegen:** general data mapping function ([#3830](https://github.com/aws/aws-sdk-js-v3/issues/3830)) ([9417eae](https://github.com/aws/aws-sdk-js-v3/commit/9417eae722806799fb4c15c07921574268c1165c))
12
+
13
+
14
+
15
+
16
+
6
17
  # [3.141.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.140.0...v3.141.0) (2022-08-01)
7
18
 
8
19
 
@@ -33,16 +33,7 @@ const serializeAws_restJson1CreateConfigurationSetEventDestinationCommand = asyn
33
33
  };
34
34
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
35
35
  "/v1/sms-voice/configuration-sets/{ConfigurationSetName}/event-destinations";
36
- if (input.ConfigurationSetName !== undefined) {
37
- const labelValue = input.ConfigurationSetName;
38
- if (labelValue.length <= 0) {
39
- throw new Error("Empty value provided for input HTTP label: ConfigurationSetName.");
40
- }
41
- resolvedPath = resolvedPath.replace("{ConfigurationSetName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
42
- }
43
- else {
44
- throw new Error("No value provided for input HTTP label: ConfigurationSetName.");
45
- }
36
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConfigurationSetName", () => input.ConfigurationSetName, "{ConfigurationSetName}", false);
46
37
  let body;
47
38
  body = JSON.stringify({
48
39
  ...(input.EventDestination != null && {
@@ -66,16 +57,7 @@ const serializeAws_restJson1DeleteConfigurationSetCommand = async (input, contex
66
57
  const headers = {};
67
58
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
68
59
  "/v1/sms-voice/configuration-sets/{ConfigurationSetName}";
69
- if (input.ConfigurationSetName !== undefined) {
70
- const labelValue = input.ConfigurationSetName;
71
- if (labelValue.length <= 0) {
72
- throw new Error("Empty value provided for input HTTP label: ConfigurationSetName.");
73
- }
74
- resolvedPath = resolvedPath.replace("{ConfigurationSetName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
75
- }
76
- else {
77
- throw new Error("No value provided for input HTTP label: ConfigurationSetName.");
78
- }
60
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConfigurationSetName", () => input.ConfigurationSetName, "{ConfigurationSetName}", false);
79
61
  let body;
80
62
  return new protocol_http_1.HttpRequest({
81
63
  protocol,
@@ -93,26 +75,8 @@ const serializeAws_restJson1DeleteConfigurationSetEventDestinationCommand = asyn
93
75
  const headers = {};
94
76
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
95
77
  "/v1/sms-voice/configuration-sets/{ConfigurationSetName}/event-destinations/{EventDestinationName}";
96
- if (input.ConfigurationSetName !== undefined) {
97
- const labelValue = input.ConfigurationSetName;
98
- if (labelValue.length <= 0) {
99
- throw new Error("Empty value provided for input HTTP label: ConfigurationSetName.");
100
- }
101
- resolvedPath = resolvedPath.replace("{ConfigurationSetName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
102
- }
103
- else {
104
- throw new Error("No value provided for input HTTP label: ConfigurationSetName.");
105
- }
106
- if (input.EventDestinationName !== undefined) {
107
- const labelValue = input.EventDestinationName;
108
- if (labelValue.length <= 0) {
109
- throw new Error("Empty value provided for input HTTP label: EventDestinationName.");
110
- }
111
- resolvedPath = resolvedPath.replace("{EventDestinationName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
112
- }
113
- else {
114
- throw new Error("No value provided for input HTTP label: EventDestinationName.");
115
- }
78
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConfigurationSetName", () => input.ConfigurationSetName, "{ConfigurationSetName}", false);
79
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "EventDestinationName", () => input.EventDestinationName, "{EventDestinationName}", false);
116
80
  let body;
117
81
  return new protocol_http_1.HttpRequest({
118
82
  protocol,
@@ -130,16 +94,7 @@ const serializeAws_restJson1GetConfigurationSetEventDestinationsCommand = async
130
94
  const headers = {};
131
95
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
132
96
  "/v1/sms-voice/configuration-sets/{ConfigurationSetName}/event-destinations";
133
- if (input.ConfigurationSetName !== undefined) {
134
- const labelValue = input.ConfigurationSetName;
135
- if (labelValue.length <= 0) {
136
- throw new Error("Empty value provided for input HTTP label: ConfigurationSetName.");
137
- }
138
- resolvedPath = resolvedPath.replace("{ConfigurationSetName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
139
- }
140
- else {
141
- throw new Error("No value provided for input HTTP label: ConfigurationSetName.");
142
- }
97
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConfigurationSetName", () => input.ConfigurationSetName, "{ConfigurationSetName}", false);
143
98
  let body;
144
99
  return new protocol_http_1.HttpRequest({
145
100
  protocol,
@@ -156,10 +111,10 @@ const serializeAws_restJson1ListConfigurationSetsCommand = async (input, context
156
111
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
157
112
  const headers = {};
158
113
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/sms-voice/configuration-sets";
159
- const query = {
160
- ...(input.NextToken !== undefined && { NextToken: input.NextToken }),
161
- ...(input.PageSize !== undefined && { PageSize: input.PageSize }),
162
- };
114
+ const query = map({
115
+ NextToken: [, input.NextToken],
116
+ PageSize: [, input.PageSize],
117
+ });
163
118
  let body;
164
119
  return new protocol_http_1.HttpRequest({
165
120
  protocol,
@@ -205,26 +160,8 @@ const serializeAws_restJson1UpdateConfigurationSetEventDestinationCommand = asyn
205
160
  };
206
161
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
207
162
  "/v1/sms-voice/configuration-sets/{ConfigurationSetName}/event-destinations/{EventDestinationName}";
208
- if (input.ConfigurationSetName !== undefined) {
209
- const labelValue = input.ConfigurationSetName;
210
- if (labelValue.length <= 0) {
211
- throw new Error("Empty value provided for input HTTP label: ConfigurationSetName.");
212
- }
213
- resolvedPath = resolvedPath.replace("{ConfigurationSetName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
214
- }
215
- else {
216
- throw new Error("No value provided for input HTTP label: ConfigurationSetName.");
217
- }
218
- if (input.EventDestinationName !== undefined) {
219
- const labelValue = input.EventDestinationName;
220
- if (labelValue.length <= 0) {
221
- throw new Error("Empty value provided for input HTTP label: EventDestinationName.");
222
- }
223
- resolvedPath = resolvedPath.replace("{EventDestinationName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
224
- }
225
- else {
226
- throw new Error("No value provided for input HTTP label: EventDestinationName.");
227
- }
163
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConfigurationSetName", () => input.ConfigurationSetName, "{ConfigurationSetName}", false);
164
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "EventDestinationName", () => input.EventDestinationName, "{EventDestinationName}", false);
228
165
  let body;
229
166
  body = JSON.stringify({
230
167
  ...(input.EventDestination != null && {
@@ -246,11 +183,11 @@ const deserializeAws_restJson1CreateConfigurationSetCommand = async (output, con
246
183
  if (output.statusCode !== 200 && output.statusCode >= 300) {
247
184
  return deserializeAws_restJson1CreateConfigurationSetCommandError(output, context);
248
185
  }
249
- const contents = {
186
+ const contents = map({
250
187
  $metadata: deserializeMetadata(output),
251
- };
188
+ });
252
189
  await collectBody(output.body, context);
253
- return Promise.resolve(contents);
190
+ return contents;
254
191
  };
255
192
  exports.deserializeAws_restJson1CreateConfigurationSetCommand = deserializeAws_restJson1CreateConfigurationSetCommand;
256
193
  const deserializeAws_restJson1CreateConfigurationSetCommandError = async (output, context) => {
@@ -258,7 +195,6 @@ const deserializeAws_restJson1CreateConfigurationSetCommandError = async (output
258
195
  ...output,
259
196
  body: await parseBody(output.body, context),
260
197
  };
261
- let response;
262
198
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
263
199
  switch (errorCode) {
264
200
  case "AlreadyExistsException":
@@ -278,25 +214,23 @@ const deserializeAws_restJson1CreateConfigurationSetCommandError = async (output
278
214
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
279
215
  default:
280
216
  const parsedBody = parsedOutput.body;
281
- const $metadata = deserializeMetadata(output);
282
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
283
- response = new PinpointSMSVoiceServiceException_1.PinpointSMSVoiceServiceException({
284
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
285
- $fault: "client",
286
- $metadata,
217
+ (0, smithy_client_1.throwDefaultError)({
218
+ output,
219
+ parsedBody,
220
+ exceptionCtor: PinpointSMSVoiceServiceException_1.PinpointSMSVoiceServiceException,
221
+ errorCode,
287
222
  });
288
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
289
223
  }
290
224
  };
291
225
  const deserializeAws_restJson1CreateConfigurationSetEventDestinationCommand = async (output, context) => {
292
226
  if (output.statusCode !== 200 && output.statusCode >= 300) {
293
227
  return deserializeAws_restJson1CreateConfigurationSetEventDestinationCommandError(output, context);
294
228
  }
295
- const contents = {
229
+ const contents = map({
296
230
  $metadata: deserializeMetadata(output),
297
- };
231
+ });
298
232
  await collectBody(output.body, context);
299
- return Promise.resolve(contents);
233
+ return contents;
300
234
  };
301
235
  exports.deserializeAws_restJson1CreateConfigurationSetEventDestinationCommand = deserializeAws_restJson1CreateConfigurationSetEventDestinationCommand;
302
236
  const deserializeAws_restJson1CreateConfigurationSetEventDestinationCommandError = async (output, context) => {
@@ -304,7 +238,6 @@ const deserializeAws_restJson1CreateConfigurationSetEventDestinationCommandError
304
238
  ...output,
305
239
  body: await parseBody(output.body, context),
306
240
  };
307
- let response;
308
241
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
309
242
  switch (errorCode) {
310
243
  case "AlreadyExistsException":
@@ -327,25 +260,23 @@ const deserializeAws_restJson1CreateConfigurationSetEventDestinationCommandError
327
260
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
328
261
  default:
329
262
  const parsedBody = parsedOutput.body;
330
- const $metadata = deserializeMetadata(output);
331
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
332
- response = new PinpointSMSVoiceServiceException_1.PinpointSMSVoiceServiceException({
333
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
334
- $fault: "client",
335
- $metadata,
263
+ (0, smithy_client_1.throwDefaultError)({
264
+ output,
265
+ parsedBody,
266
+ exceptionCtor: PinpointSMSVoiceServiceException_1.PinpointSMSVoiceServiceException,
267
+ errorCode,
336
268
  });
337
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
338
269
  }
339
270
  };
340
271
  const deserializeAws_restJson1DeleteConfigurationSetCommand = async (output, context) => {
341
272
  if (output.statusCode !== 200 && output.statusCode >= 300) {
342
273
  return deserializeAws_restJson1DeleteConfigurationSetCommandError(output, context);
343
274
  }
344
- const contents = {
275
+ const contents = map({
345
276
  $metadata: deserializeMetadata(output),
346
- };
277
+ });
347
278
  await collectBody(output.body, context);
348
- return Promise.resolve(contents);
279
+ return contents;
349
280
  };
350
281
  exports.deserializeAws_restJson1DeleteConfigurationSetCommand = deserializeAws_restJson1DeleteConfigurationSetCommand;
351
282
  const deserializeAws_restJson1DeleteConfigurationSetCommandError = async (output, context) => {
@@ -353,7 +284,6 @@ const deserializeAws_restJson1DeleteConfigurationSetCommandError = async (output
353
284
  ...output,
354
285
  body: await parseBody(output.body, context),
355
286
  };
356
- let response;
357
287
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
358
288
  switch (errorCode) {
359
289
  case "BadRequestException":
@@ -370,25 +300,23 @@ const deserializeAws_restJson1DeleteConfigurationSetCommandError = async (output
370
300
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
371
301
  default:
372
302
  const parsedBody = parsedOutput.body;
373
- const $metadata = deserializeMetadata(output);
374
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
375
- response = new PinpointSMSVoiceServiceException_1.PinpointSMSVoiceServiceException({
376
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
377
- $fault: "client",
378
- $metadata,
303
+ (0, smithy_client_1.throwDefaultError)({
304
+ output,
305
+ parsedBody,
306
+ exceptionCtor: PinpointSMSVoiceServiceException_1.PinpointSMSVoiceServiceException,
307
+ errorCode,
379
308
  });
380
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
381
309
  }
382
310
  };
383
311
  const deserializeAws_restJson1DeleteConfigurationSetEventDestinationCommand = async (output, context) => {
384
312
  if (output.statusCode !== 200 && output.statusCode >= 300) {
385
313
  return deserializeAws_restJson1DeleteConfigurationSetEventDestinationCommandError(output, context);
386
314
  }
387
- const contents = {
315
+ const contents = map({
388
316
  $metadata: deserializeMetadata(output),
389
- };
317
+ });
390
318
  await collectBody(output.body, context);
391
- return Promise.resolve(contents);
319
+ return contents;
392
320
  };
393
321
  exports.deserializeAws_restJson1DeleteConfigurationSetEventDestinationCommand = deserializeAws_restJson1DeleteConfigurationSetEventDestinationCommand;
394
322
  const deserializeAws_restJson1DeleteConfigurationSetEventDestinationCommandError = async (output, context) => {
@@ -396,7 +324,6 @@ const deserializeAws_restJson1DeleteConfigurationSetEventDestinationCommandError
396
324
  ...output,
397
325
  body: await parseBody(output.body, context),
398
326
  };
399
- let response;
400
327
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
401
328
  switch (errorCode) {
402
329
  case "BadRequestException":
@@ -413,29 +340,26 @@ const deserializeAws_restJson1DeleteConfigurationSetEventDestinationCommandError
413
340
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
414
341
  default:
415
342
  const parsedBody = parsedOutput.body;
416
- const $metadata = deserializeMetadata(output);
417
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
418
- response = new PinpointSMSVoiceServiceException_1.PinpointSMSVoiceServiceException({
419
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
420
- $fault: "client",
421
- $metadata,
343
+ (0, smithy_client_1.throwDefaultError)({
344
+ output,
345
+ parsedBody,
346
+ exceptionCtor: PinpointSMSVoiceServiceException_1.PinpointSMSVoiceServiceException,
347
+ errorCode,
422
348
  });
423
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
424
349
  }
425
350
  };
426
351
  const deserializeAws_restJson1GetConfigurationSetEventDestinationsCommand = async (output, context) => {
427
352
  if (output.statusCode !== 200 && output.statusCode >= 300) {
428
353
  return deserializeAws_restJson1GetConfigurationSetEventDestinationsCommandError(output, context);
429
354
  }
430
- const contents = {
355
+ const contents = map({
431
356
  $metadata: deserializeMetadata(output),
432
- EventDestinations: undefined,
433
- };
357
+ });
434
358
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
435
- if (data.EventDestinations !== undefined && data.EventDestinations !== null) {
359
+ if (data.EventDestinations != null) {
436
360
  contents.EventDestinations = deserializeAws_restJson1EventDestinations(data.EventDestinations, context);
437
361
  }
438
- return Promise.resolve(contents);
362
+ return contents;
439
363
  };
440
364
  exports.deserializeAws_restJson1GetConfigurationSetEventDestinationsCommand = deserializeAws_restJson1GetConfigurationSetEventDestinationsCommand;
441
365
  const deserializeAws_restJson1GetConfigurationSetEventDestinationsCommandError = async (output, context) => {
@@ -443,7 +367,6 @@ const deserializeAws_restJson1GetConfigurationSetEventDestinationsCommandError =
443
367
  ...output,
444
368
  body: await parseBody(output.body, context),
445
369
  };
446
- let response;
447
370
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
448
371
  switch (errorCode) {
449
372
  case "BadRequestException":
@@ -460,33 +383,29 @@ const deserializeAws_restJson1GetConfigurationSetEventDestinationsCommandError =
460
383
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
461
384
  default:
462
385
  const parsedBody = parsedOutput.body;
463
- const $metadata = deserializeMetadata(output);
464
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
465
- response = new PinpointSMSVoiceServiceException_1.PinpointSMSVoiceServiceException({
466
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
467
- $fault: "client",
468
- $metadata,
386
+ (0, smithy_client_1.throwDefaultError)({
387
+ output,
388
+ parsedBody,
389
+ exceptionCtor: PinpointSMSVoiceServiceException_1.PinpointSMSVoiceServiceException,
390
+ errorCode,
469
391
  });
470
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
471
392
  }
472
393
  };
473
394
  const deserializeAws_restJson1ListConfigurationSetsCommand = async (output, context) => {
474
395
  if (output.statusCode !== 200 && output.statusCode >= 300) {
475
396
  return deserializeAws_restJson1ListConfigurationSetsCommandError(output, context);
476
397
  }
477
- const contents = {
398
+ const contents = map({
478
399
  $metadata: deserializeMetadata(output),
479
- ConfigurationSets: undefined,
480
- NextToken: undefined,
481
- };
400
+ });
482
401
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
483
- if (data.ConfigurationSets !== undefined && data.ConfigurationSets !== null) {
402
+ if (data.ConfigurationSets != null) {
484
403
  contents.ConfigurationSets = deserializeAws_restJson1ConfigurationSets(data.ConfigurationSets, context);
485
404
  }
486
- if (data.NextToken !== undefined && data.NextToken !== null) {
405
+ if (data.NextToken != null) {
487
406
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
488
407
  }
489
- return Promise.resolve(contents);
408
+ return contents;
490
409
  };
491
410
  exports.deserializeAws_restJson1ListConfigurationSetsCommand = deserializeAws_restJson1ListConfigurationSetsCommand;
492
411
  const deserializeAws_restJson1ListConfigurationSetsCommandError = async (output, context) => {
@@ -494,7 +413,6 @@ const deserializeAws_restJson1ListConfigurationSetsCommandError = async (output,
494
413
  ...output,
495
414
  body: await parseBody(output.body, context),
496
415
  };
497
- let response;
498
416
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
499
417
  switch (errorCode) {
500
418
  case "BadRequestException":
@@ -508,29 +426,26 @@ const deserializeAws_restJson1ListConfigurationSetsCommandError = async (output,
508
426
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
509
427
  default:
510
428
  const parsedBody = parsedOutput.body;
511
- const $metadata = deserializeMetadata(output);
512
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
513
- response = new PinpointSMSVoiceServiceException_1.PinpointSMSVoiceServiceException({
514
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
515
- $fault: "client",
516
- $metadata,
429
+ (0, smithy_client_1.throwDefaultError)({
430
+ output,
431
+ parsedBody,
432
+ exceptionCtor: PinpointSMSVoiceServiceException_1.PinpointSMSVoiceServiceException,
433
+ errorCode,
517
434
  });
518
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
519
435
  }
520
436
  };
521
437
  const deserializeAws_restJson1SendVoiceMessageCommand = async (output, context) => {
522
438
  if (output.statusCode !== 200 && output.statusCode >= 300) {
523
439
  return deserializeAws_restJson1SendVoiceMessageCommandError(output, context);
524
440
  }
525
- const contents = {
441
+ const contents = map({
526
442
  $metadata: deserializeMetadata(output),
527
- MessageId: undefined,
528
- };
443
+ });
529
444
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
530
- if (data.MessageId !== undefined && data.MessageId !== null) {
445
+ if (data.MessageId != null) {
531
446
  contents.MessageId = (0, smithy_client_1.expectString)(data.MessageId);
532
447
  }
533
- return Promise.resolve(contents);
448
+ return contents;
534
449
  };
535
450
  exports.deserializeAws_restJson1SendVoiceMessageCommand = deserializeAws_restJson1SendVoiceMessageCommand;
536
451
  const deserializeAws_restJson1SendVoiceMessageCommandError = async (output, context) => {
@@ -538,7 +453,6 @@ const deserializeAws_restJson1SendVoiceMessageCommandError = async (output, cont
538
453
  ...output,
539
454
  body: await parseBody(output.body, context),
540
455
  };
541
- let response;
542
456
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
543
457
  switch (errorCode) {
544
458
  case "BadRequestException":
@@ -552,25 +466,23 @@ const deserializeAws_restJson1SendVoiceMessageCommandError = async (output, cont
552
466
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
553
467
  default:
554
468
  const parsedBody = parsedOutput.body;
555
- const $metadata = deserializeMetadata(output);
556
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
557
- response = new PinpointSMSVoiceServiceException_1.PinpointSMSVoiceServiceException({
558
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
559
- $fault: "client",
560
- $metadata,
469
+ (0, smithy_client_1.throwDefaultError)({
470
+ output,
471
+ parsedBody,
472
+ exceptionCtor: PinpointSMSVoiceServiceException_1.PinpointSMSVoiceServiceException,
473
+ errorCode,
561
474
  });
562
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
563
475
  }
564
476
  };
565
477
  const deserializeAws_restJson1UpdateConfigurationSetEventDestinationCommand = async (output, context) => {
566
478
  if (output.statusCode !== 200 && output.statusCode >= 300) {
567
479
  return deserializeAws_restJson1UpdateConfigurationSetEventDestinationCommandError(output, context);
568
480
  }
569
- const contents = {
481
+ const contents = map({
570
482
  $metadata: deserializeMetadata(output),
571
- };
483
+ });
572
484
  await collectBody(output.body, context);
573
- return Promise.resolve(contents);
485
+ return contents;
574
486
  };
575
487
  exports.deserializeAws_restJson1UpdateConfigurationSetEventDestinationCommand = deserializeAws_restJson1UpdateConfigurationSetEventDestinationCommand;
576
488
  const deserializeAws_restJson1UpdateConfigurationSetEventDestinationCommandError = async (output, context) => {
@@ -578,7 +490,6 @@ const deserializeAws_restJson1UpdateConfigurationSetEventDestinationCommandError
578
490
  ...output,
579
491
  body: await parseBody(output.body, context),
580
492
  };
581
- let response;
582
493
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
583
494
  switch (errorCode) {
584
495
  case "BadRequestException":
@@ -595,20 +506,19 @@ const deserializeAws_restJson1UpdateConfigurationSetEventDestinationCommandError
595
506
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
596
507
  default:
597
508
  const parsedBody = parsedOutput.body;
598
- const $metadata = deserializeMetadata(output);
599
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
600
- response = new PinpointSMSVoiceServiceException_1.PinpointSMSVoiceServiceException({
601
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
602
- $fault: "client",
603
- $metadata,
509
+ (0, smithy_client_1.throwDefaultError)({
510
+ output,
511
+ parsedBody,
512
+ exceptionCtor: PinpointSMSVoiceServiceException_1.PinpointSMSVoiceServiceException,
513
+ errorCode,
604
514
  });
605
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
606
515
  }
607
516
  };
517
+ const map = smithy_client_1.map;
608
518
  const deserializeAws_restJson1AlreadyExistsExceptionResponse = async (parsedOutput, context) => {
609
- const contents = {};
519
+ const contents = map({});
610
520
  const data = parsedOutput.body;
611
- if (data.Message !== undefined && data.Message !== null) {
521
+ if (data.Message != null) {
612
522
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
613
523
  }
614
524
  const exception = new models_0_1.AlreadyExistsException({
@@ -618,9 +528,9 @@ const deserializeAws_restJson1AlreadyExistsExceptionResponse = async (parsedOutp
618
528
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
619
529
  };
620
530
  const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput, context) => {
621
- const contents = {};
531
+ const contents = map({});
622
532
  const data = parsedOutput.body;
623
- if (data.Message !== undefined && data.Message !== null) {
533
+ if (data.Message != null) {
624
534
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
625
535
  }
626
536
  const exception = new models_0_1.BadRequestException({
@@ -630,9 +540,9 @@ const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput,
630
540
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
631
541
  };
632
542
  const deserializeAws_restJson1InternalServiceErrorExceptionResponse = async (parsedOutput, context) => {
633
- const contents = {};
543
+ const contents = map({});
634
544
  const data = parsedOutput.body;
635
- if (data.Message !== undefined && data.Message !== null) {
545
+ if (data.Message != null) {
636
546
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
637
547
  }
638
548
  const exception = new models_0_1.InternalServiceErrorException({
@@ -642,9 +552,9 @@ const deserializeAws_restJson1InternalServiceErrorExceptionResponse = async (par
642
552
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
643
553
  };
644
554
  const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutput, context) => {
645
- const contents = {};
555
+ const contents = map({});
646
556
  const data = parsedOutput.body;
647
- if (data.Message !== undefined && data.Message !== null) {
557
+ if (data.Message != null) {
648
558
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
649
559
  }
650
560
  const exception = new models_0_1.LimitExceededException({
@@ -654,9 +564,9 @@ const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutp
654
564
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
655
565
  };
656
566
  const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, context) => {
657
- const contents = {};
567
+ const contents = map({});
658
568
  const data = parsedOutput.body;
659
- if (data.Message !== undefined && data.Message !== null) {
569
+ if (data.Message != null) {
660
570
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
661
571
  }
662
572
  const exception = new models_0_1.NotFoundException({
@@ -666,9 +576,9 @@ const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, c
666
576
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
667
577
  };
668
578
  const deserializeAws_restJson1TooManyRequestsExceptionResponse = async (parsedOutput, context) => {
669
- const contents = {};
579
+ const contents = map({});
670
580
  const data = parsedOutput.body;
671
- if (data.Message !== undefined && data.Message !== null) {
581
+ if (data.Message != null) {
672
582
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
673
583
  }
674
584
  const exception = new models_0_1.TooManyRequestsException({
@@ -709,9 +619,6 @@ const serializeAws_restJson1EventTypes = (input, context) => {
709
619
  return input
710
620
  .filter((e) => e != null)
711
621
  .map((entry) => {
712
- if (entry === null) {
713
- return null;
714
- }
715
622
  return entry;
716
623
  });
717
624
  };
@@ -1,6 +1,6 @@
1
1
  import { __assign, __awaiter, __generator } from "tslib";
2
2
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
3
- import { decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, extendedEncodeURIComponent as __extendedEncodeURIComponent, } from "@aws-sdk/smithy-client";
3
+ import { decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map as __map, resolvedPath as __resolvedPath, throwDefaultError, } from "@aws-sdk/smithy-client";
4
4
  import { AlreadyExistsException, BadRequestException, InternalServiceErrorException, LimitExceededException, NotFoundException, TooManyRequestsException, } from "../models/models_0";
5
5
  import { PinpointSMSVoiceServiceException as __BaseException } from "../models/PinpointSMSVoiceServiceException";
6
6
  export var serializeAws_restJson1CreateConfigurationSetCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
@@ -28,7 +28,7 @@ export var serializeAws_restJson1CreateConfigurationSetCommand = function (input
28
28
  });
29
29
  }); };
30
30
  export var serializeAws_restJson1CreateConfigurationSetEventDestinationCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
31
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
31
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
32
32
  return __generator(this, function (_c) {
33
33
  switch (_c.label) {
34
34
  case 0: return [4, context.endpoint()];
@@ -39,16 +39,7 @@ export var serializeAws_restJson1CreateConfigurationSetEventDestinationCommand =
39
39
  };
40
40
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
41
41
  "/v1/sms-voice/configuration-sets/{ConfigurationSetName}/event-destinations";
42
- if (input.ConfigurationSetName !== undefined) {
43
- labelValue = input.ConfigurationSetName;
44
- if (labelValue.length <= 0) {
45
- throw new Error("Empty value provided for input HTTP label: ConfigurationSetName.");
46
- }
47
- resolvedPath = resolvedPath.replace("{ConfigurationSetName}", __extendedEncodeURIComponent(labelValue));
48
- }
49
- else {
50
- throw new Error("No value provided for input HTTP label: ConfigurationSetName.");
51
- }
42
+ resolvedPath = __resolvedPath(resolvedPath, input, "ConfigurationSetName", function () { return input.ConfigurationSetName; }, "{ConfigurationSetName}", false);
52
43
  body = JSON.stringify(__assign(__assign({}, (input.EventDestination != null && {
53
44
  EventDestination: serializeAws_restJson1EventDestinationDefinition(input.EventDestination, context),
54
45
  })), (input.EventDestinationName != null && { EventDestinationName: input.EventDestinationName })));
@@ -65,7 +56,7 @@ export var serializeAws_restJson1CreateConfigurationSetEventDestinationCommand =
65
56
  });
66
57
  }); };
67
58
  export var serializeAws_restJson1DeleteConfigurationSetCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
68
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
59
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
69
60
  return __generator(this, function (_c) {
70
61
  switch (_c.label) {
71
62
  case 0: return [4, context.endpoint()];
@@ -74,16 +65,7 @@ export var serializeAws_restJson1DeleteConfigurationSetCommand = function (input
74
65
  headers = {};
75
66
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
76
67
  "/v1/sms-voice/configuration-sets/{ConfigurationSetName}";
77
- if (input.ConfigurationSetName !== undefined) {
78
- labelValue = input.ConfigurationSetName;
79
- if (labelValue.length <= 0) {
80
- throw new Error("Empty value provided for input HTTP label: ConfigurationSetName.");
81
- }
82
- resolvedPath = resolvedPath.replace("{ConfigurationSetName}", __extendedEncodeURIComponent(labelValue));
83
- }
84
- else {
85
- throw new Error("No value provided for input HTTP label: ConfigurationSetName.");
86
- }
68
+ resolvedPath = __resolvedPath(resolvedPath, input, "ConfigurationSetName", function () { return input.ConfigurationSetName; }, "{ConfigurationSetName}", false);
87
69
  return [2, new __HttpRequest({
88
70
  protocol: protocol,
89
71
  hostname: hostname,
@@ -97,7 +79,7 @@ export var serializeAws_restJson1DeleteConfigurationSetCommand = function (input
97
79
  });
98
80
  }); };
99
81
  export var serializeAws_restJson1DeleteConfigurationSetEventDestinationCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
100
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, labelValue, body;
82
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
101
83
  return __generator(this, function (_c) {
102
84
  switch (_c.label) {
103
85
  case 0: return [4, context.endpoint()];
@@ -106,26 +88,8 @@ export var serializeAws_restJson1DeleteConfigurationSetEventDestinationCommand =
106
88
  headers = {};
107
89
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
108
90
  "/v1/sms-voice/configuration-sets/{ConfigurationSetName}/event-destinations/{EventDestinationName}";
109
- if (input.ConfigurationSetName !== undefined) {
110
- labelValue = input.ConfigurationSetName;
111
- if (labelValue.length <= 0) {
112
- throw new Error("Empty value provided for input HTTP label: ConfigurationSetName.");
113
- }
114
- resolvedPath = resolvedPath.replace("{ConfigurationSetName}", __extendedEncodeURIComponent(labelValue));
115
- }
116
- else {
117
- throw new Error("No value provided for input HTTP label: ConfigurationSetName.");
118
- }
119
- if (input.EventDestinationName !== undefined) {
120
- labelValue = input.EventDestinationName;
121
- if (labelValue.length <= 0) {
122
- throw new Error("Empty value provided for input HTTP label: EventDestinationName.");
123
- }
124
- resolvedPath = resolvedPath.replace("{EventDestinationName}", __extendedEncodeURIComponent(labelValue));
125
- }
126
- else {
127
- throw new Error("No value provided for input HTTP label: EventDestinationName.");
128
- }
91
+ resolvedPath = __resolvedPath(resolvedPath, input, "ConfigurationSetName", function () { return input.ConfigurationSetName; }, "{ConfigurationSetName}", false);
92
+ resolvedPath = __resolvedPath(resolvedPath, input, "EventDestinationName", function () { return input.EventDestinationName; }, "{EventDestinationName}", false);
129
93
  return [2, new __HttpRequest({
130
94
  protocol: protocol,
131
95
  hostname: hostname,
@@ -139,7 +103,7 @@ export var serializeAws_restJson1DeleteConfigurationSetEventDestinationCommand =
139
103
  });
140
104
  }); };
141
105
  export var serializeAws_restJson1GetConfigurationSetEventDestinationsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
142
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
106
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
143
107
  return __generator(this, function (_c) {
144
108
  switch (_c.label) {
145
109
  case 0: return [4, context.endpoint()];
@@ -148,16 +112,7 @@ export var serializeAws_restJson1GetConfigurationSetEventDestinationsCommand = f
148
112
  headers = {};
149
113
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
150
114
  "/v1/sms-voice/configuration-sets/{ConfigurationSetName}/event-destinations";
151
- if (input.ConfigurationSetName !== undefined) {
152
- labelValue = input.ConfigurationSetName;
153
- if (labelValue.length <= 0) {
154
- throw new Error("Empty value provided for input HTTP label: ConfigurationSetName.");
155
- }
156
- resolvedPath = resolvedPath.replace("{ConfigurationSetName}", __extendedEncodeURIComponent(labelValue));
157
- }
158
- else {
159
- throw new Error("No value provided for input HTTP label: ConfigurationSetName.");
160
- }
115
+ resolvedPath = __resolvedPath(resolvedPath, input, "ConfigurationSetName", function () { return input.ConfigurationSetName; }, "{ConfigurationSetName}", false);
161
116
  return [2, new __HttpRequest({
162
117
  protocol: protocol,
163
118
  hostname: hostname,
@@ -179,7 +134,10 @@ export var serializeAws_restJson1ListConfigurationSetsCommand = function (input,
179
134
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
180
135
  headers = {};
181
136
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/v1/sms-voice/configuration-sets";
182
- query = __assign(__assign({}, (input.NextToken !== undefined && { NextToken: input.NextToken })), (input.PageSize !== undefined && { PageSize: input.PageSize }));
137
+ query = map({
138
+ NextToken: [, input.NextToken],
139
+ PageSize: [, input.PageSize],
140
+ });
183
141
  return [2, new __HttpRequest({
184
142
  protocol: protocol,
185
143
  hostname: hostname,
@@ -218,7 +176,7 @@ export var serializeAws_restJson1SendVoiceMessageCommand = function (input, cont
218
176
  });
219
177
  }); };
220
178
  export var serializeAws_restJson1UpdateConfigurationSetEventDestinationCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
221
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, labelValue, body;
179
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
222
180
  return __generator(this, function (_c) {
223
181
  switch (_c.label) {
224
182
  case 0: return [4, context.endpoint()];
@@ -229,26 +187,8 @@ export var serializeAws_restJson1UpdateConfigurationSetEventDestinationCommand =
229
187
  };
230
188
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
231
189
  "/v1/sms-voice/configuration-sets/{ConfigurationSetName}/event-destinations/{EventDestinationName}";
232
- if (input.ConfigurationSetName !== undefined) {
233
- labelValue = input.ConfigurationSetName;
234
- if (labelValue.length <= 0) {
235
- throw new Error("Empty value provided for input HTTP label: ConfigurationSetName.");
236
- }
237
- resolvedPath = resolvedPath.replace("{ConfigurationSetName}", __extendedEncodeURIComponent(labelValue));
238
- }
239
- else {
240
- throw new Error("No value provided for input HTTP label: ConfigurationSetName.");
241
- }
242
- if (input.EventDestinationName !== undefined) {
243
- labelValue = input.EventDestinationName;
244
- if (labelValue.length <= 0) {
245
- throw new Error("Empty value provided for input HTTP label: EventDestinationName.");
246
- }
247
- resolvedPath = resolvedPath.replace("{EventDestinationName}", __extendedEncodeURIComponent(labelValue));
248
- }
249
- else {
250
- throw new Error("No value provided for input HTTP label: EventDestinationName.");
251
- }
190
+ resolvedPath = __resolvedPath(resolvedPath, input, "ConfigurationSetName", function () { return input.ConfigurationSetName; }, "{ConfigurationSetName}", false);
191
+ resolvedPath = __resolvedPath(resolvedPath, input, "EventDestinationName", function () { return input.EventDestinationName; }, "{EventDestinationName}", false);
252
192
  body = JSON.stringify(__assign({}, (input.EventDestination != null && {
253
193
  EventDestination: serializeAws_restJson1EventDestinationDefinition(input.EventDestination, context),
254
194
  })));
@@ -272,18 +212,18 @@ export var deserializeAws_restJson1CreateConfigurationSetCommand = function (out
272
212
  if (output.statusCode !== 200 && output.statusCode >= 300) {
273
213
  return [2, deserializeAws_restJson1CreateConfigurationSetCommandError(output, context)];
274
214
  }
275
- contents = {
215
+ contents = map({
276
216
  $metadata: deserializeMetadata(output),
277
- };
217
+ });
278
218
  return [4, collectBody(output.body, context)];
279
219
  case 1:
280
220
  _a.sent();
281
- return [2, Promise.resolve(contents)];
221
+ return [2, contents];
282
222
  }
283
223
  });
284
224
  }); };
285
225
  var deserializeAws_restJson1CreateConfigurationSetCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
286
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
226
+ var parsedOutput, _a, errorCode, _b, parsedBody;
287
227
  var _c;
288
228
  return __generator(this, function (_d) {
289
229
  switch (_d.label) {
@@ -320,14 +260,14 @@ var deserializeAws_restJson1CreateConfigurationSetCommandError = function (outpu
320
260
  case 11: throw _d.sent();
321
261
  case 12:
322
262
  parsedBody = parsedOutput.body;
323
- $metadata = deserializeMetadata(output);
324
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
325
- response = new __BaseException({
326
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
327
- $fault: "client",
328
- $metadata: $metadata,
263
+ throwDefaultError({
264
+ output: output,
265
+ parsedBody: parsedBody,
266
+ exceptionCtor: __BaseException,
267
+ errorCode: errorCode,
329
268
  });
330
- throw __decorateServiceException(response, parsedBody);
269
+ _d.label = 13;
270
+ case 13: return [2];
331
271
  }
332
272
  });
333
273
  }); };
@@ -339,18 +279,18 @@ export var deserializeAws_restJson1CreateConfigurationSetEventDestinationCommand
339
279
  if (output.statusCode !== 200 && output.statusCode >= 300) {
340
280
  return [2, deserializeAws_restJson1CreateConfigurationSetEventDestinationCommandError(output, context)];
341
281
  }
342
- contents = {
282
+ contents = map({
343
283
  $metadata: deserializeMetadata(output),
344
- };
284
+ });
345
285
  return [4, collectBody(output.body, context)];
346
286
  case 1:
347
287
  _a.sent();
348
- return [2, Promise.resolve(contents)];
288
+ return [2, contents];
349
289
  }
350
290
  });
351
291
  }); };
352
292
  var deserializeAws_restJson1CreateConfigurationSetEventDestinationCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
353
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
293
+ var parsedOutput, _a, errorCode, _b, parsedBody;
354
294
  var _c;
355
295
  return __generator(this, function (_d) {
356
296
  switch (_d.label) {
@@ -391,14 +331,14 @@ var deserializeAws_restJson1CreateConfigurationSetEventDestinationCommandError =
391
331
  case 13: throw _d.sent();
392
332
  case 14:
393
333
  parsedBody = parsedOutput.body;
394
- $metadata = deserializeMetadata(output);
395
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
396
- response = new __BaseException({
397
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
398
- $fault: "client",
399
- $metadata: $metadata,
334
+ throwDefaultError({
335
+ output: output,
336
+ parsedBody: parsedBody,
337
+ exceptionCtor: __BaseException,
338
+ errorCode: errorCode,
400
339
  });
401
- throw __decorateServiceException(response, parsedBody);
340
+ _d.label = 15;
341
+ case 15: return [2];
402
342
  }
403
343
  });
404
344
  }); };
@@ -410,18 +350,18 @@ export var deserializeAws_restJson1DeleteConfigurationSetCommand = function (out
410
350
  if (output.statusCode !== 200 && output.statusCode >= 300) {
411
351
  return [2, deserializeAws_restJson1DeleteConfigurationSetCommandError(output, context)];
412
352
  }
413
- contents = {
353
+ contents = map({
414
354
  $metadata: deserializeMetadata(output),
415
- };
355
+ });
416
356
  return [4, collectBody(output.body, context)];
417
357
  case 1:
418
358
  _a.sent();
419
- return [2, Promise.resolve(contents)];
359
+ return [2, contents];
420
360
  }
421
361
  });
422
362
  }); };
423
363
  var deserializeAws_restJson1DeleteConfigurationSetCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
424
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
364
+ var parsedOutput, _a, errorCode, _b, parsedBody;
425
365
  var _c;
426
366
  return __generator(this, function (_d) {
427
367
  switch (_d.label) {
@@ -454,14 +394,14 @@ var deserializeAws_restJson1DeleteConfigurationSetCommandError = function (outpu
454
394
  case 9: throw _d.sent();
455
395
  case 10:
456
396
  parsedBody = parsedOutput.body;
457
- $metadata = deserializeMetadata(output);
458
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
459
- response = new __BaseException({
460
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
461
- $fault: "client",
462
- $metadata: $metadata,
397
+ throwDefaultError({
398
+ output: output,
399
+ parsedBody: parsedBody,
400
+ exceptionCtor: __BaseException,
401
+ errorCode: errorCode,
463
402
  });
464
- throw __decorateServiceException(response, parsedBody);
403
+ _d.label = 11;
404
+ case 11: return [2];
465
405
  }
466
406
  });
467
407
  }); };
@@ -473,18 +413,18 @@ export var deserializeAws_restJson1DeleteConfigurationSetEventDestinationCommand
473
413
  if (output.statusCode !== 200 && output.statusCode >= 300) {
474
414
  return [2, deserializeAws_restJson1DeleteConfigurationSetEventDestinationCommandError(output, context)];
475
415
  }
476
- contents = {
416
+ contents = map({
477
417
  $metadata: deserializeMetadata(output),
478
- };
418
+ });
479
419
  return [4, collectBody(output.body, context)];
480
420
  case 1:
481
421
  _a.sent();
482
- return [2, Promise.resolve(contents)];
422
+ return [2, contents];
483
423
  }
484
424
  });
485
425
  }); };
486
426
  var deserializeAws_restJson1DeleteConfigurationSetEventDestinationCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
487
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
427
+ var parsedOutput, _a, errorCode, _b, parsedBody;
488
428
  var _c;
489
429
  return __generator(this, function (_d) {
490
430
  switch (_d.label) {
@@ -517,14 +457,14 @@ var deserializeAws_restJson1DeleteConfigurationSetEventDestinationCommandError =
517
457
  case 9: throw _d.sent();
518
458
  case 10:
519
459
  parsedBody = parsedOutput.body;
520
- $metadata = deserializeMetadata(output);
521
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
522
- response = new __BaseException({
523
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
524
- $fault: "client",
525
- $metadata: $metadata,
460
+ throwDefaultError({
461
+ output: output,
462
+ parsedBody: parsedBody,
463
+ exceptionCtor: __BaseException,
464
+ errorCode: errorCode,
526
465
  });
527
- throw __decorateServiceException(response, parsedBody);
466
+ _d.label = 11;
467
+ case 11: return [2];
528
468
  }
529
469
  });
530
470
  }); };
@@ -536,24 +476,23 @@ export var deserializeAws_restJson1GetConfigurationSetEventDestinationsCommand =
536
476
  if (output.statusCode !== 200 && output.statusCode >= 300) {
537
477
  return [2, deserializeAws_restJson1GetConfigurationSetEventDestinationsCommandError(output, context)];
538
478
  }
539
- contents = {
479
+ contents = map({
540
480
  $metadata: deserializeMetadata(output),
541
- EventDestinations: undefined,
542
- };
481
+ });
543
482
  _a = __expectNonNull;
544
483
  _b = __expectObject;
545
484
  return [4, parseBody(output.body, context)];
546
485
  case 1:
547
486
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
548
- if (data.EventDestinations !== undefined && data.EventDestinations !== null) {
487
+ if (data.EventDestinations != null) {
549
488
  contents.EventDestinations = deserializeAws_restJson1EventDestinations(data.EventDestinations, context);
550
489
  }
551
- return [2, Promise.resolve(contents)];
490
+ return [2, contents];
552
491
  }
553
492
  });
554
493
  }); };
555
494
  var deserializeAws_restJson1GetConfigurationSetEventDestinationsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
556
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
495
+ var parsedOutput, _a, errorCode, _b, parsedBody;
557
496
  var _c;
558
497
  return __generator(this, function (_d) {
559
498
  switch (_d.label) {
@@ -586,14 +525,14 @@ var deserializeAws_restJson1GetConfigurationSetEventDestinationsCommandError = f
586
525
  case 9: throw _d.sent();
587
526
  case 10:
588
527
  parsedBody = parsedOutput.body;
589
- $metadata = deserializeMetadata(output);
590
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
591
- response = new __BaseException({
592
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
593
- $fault: "client",
594
- $metadata: $metadata,
528
+ throwDefaultError({
529
+ output: output,
530
+ parsedBody: parsedBody,
531
+ exceptionCtor: __BaseException,
532
+ errorCode: errorCode,
595
533
  });
596
- throw __decorateServiceException(response, parsedBody);
534
+ _d.label = 11;
535
+ case 11: return [2];
597
536
  }
598
537
  });
599
538
  }); };
@@ -605,28 +544,26 @@ export var deserializeAws_restJson1ListConfigurationSetsCommand = function (outp
605
544
  if (output.statusCode !== 200 && output.statusCode >= 300) {
606
545
  return [2, deserializeAws_restJson1ListConfigurationSetsCommandError(output, context)];
607
546
  }
608
- contents = {
547
+ contents = map({
609
548
  $metadata: deserializeMetadata(output),
610
- ConfigurationSets: undefined,
611
- NextToken: undefined,
612
- };
549
+ });
613
550
  _a = __expectNonNull;
614
551
  _b = __expectObject;
615
552
  return [4, parseBody(output.body, context)];
616
553
  case 1:
617
554
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
618
- if (data.ConfigurationSets !== undefined && data.ConfigurationSets !== null) {
555
+ if (data.ConfigurationSets != null) {
619
556
  contents.ConfigurationSets = deserializeAws_restJson1ConfigurationSets(data.ConfigurationSets, context);
620
557
  }
621
- if (data.NextToken !== undefined && data.NextToken !== null) {
558
+ if (data.NextToken != null) {
622
559
  contents.NextToken = __expectString(data.NextToken);
623
560
  }
624
- return [2, Promise.resolve(contents)];
561
+ return [2, contents];
625
562
  }
626
563
  });
627
564
  }); };
628
565
  var deserializeAws_restJson1ListConfigurationSetsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
629
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
566
+ var parsedOutput, _a, errorCode, _b, parsedBody;
630
567
  var _c;
631
568
  return __generator(this, function (_d) {
632
569
  switch (_d.label) {
@@ -655,14 +592,14 @@ var deserializeAws_restJson1ListConfigurationSetsCommandError = function (output
655
592
  case 7: throw _d.sent();
656
593
  case 8:
657
594
  parsedBody = parsedOutput.body;
658
- $metadata = deserializeMetadata(output);
659
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
660
- response = new __BaseException({
661
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
662
- $fault: "client",
663
- $metadata: $metadata,
595
+ throwDefaultError({
596
+ output: output,
597
+ parsedBody: parsedBody,
598
+ exceptionCtor: __BaseException,
599
+ errorCode: errorCode,
664
600
  });
665
- throw __decorateServiceException(response, parsedBody);
601
+ _d.label = 9;
602
+ case 9: return [2];
666
603
  }
667
604
  });
668
605
  }); };
@@ -674,24 +611,23 @@ export var deserializeAws_restJson1SendVoiceMessageCommand = function (output, c
674
611
  if (output.statusCode !== 200 && output.statusCode >= 300) {
675
612
  return [2, deserializeAws_restJson1SendVoiceMessageCommandError(output, context)];
676
613
  }
677
- contents = {
614
+ contents = map({
678
615
  $metadata: deserializeMetadata(output),
679
- MessageId: undefined,
680
- };
616
+ });
681
617
  _a = __expectNonNull;
682
618
  _b = __expectObject;
683
619
  return [4, parseBody(output.body, context)];
684
620
  case 1:
685
621
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
686
- if (data.MessageId !== undefined && data.MessageId !== null) {
622
+ if (data.MessageId != null) {
687
623
  contents.MessageId = __expectString(data.MessageId);
688
624
  }
689
- return [2, Promise.resolve(contents)];
625
+ return [2, contents];
690
626
  }
691
627
  });
692
628
  }); };
693
629
  var deserializeAws_restJson1SendVoiceMessageCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
694
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
630
+ var parsedOutput, _a, errorCode, _b, parsedBody;
695
631
  var _c;
696
632
  return __generator(this, function (_d) {
697
633
  switch (_d.label) {
@@ -720,14 +656,14 @@ var deserializeAws_restJson1SendVoiceMessageCommandError = function (output, con
720
656
  case 7: throw _d.sent();
721
657
  case 8:
722
658
  parsedBody = parsedOutput.body;
723
- $metadata = deserializeMetadata(output);
724
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
725
- response = new __BaseException({
726
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
727
- $fault: "client",
728
- $metadata: $metadata,
659
+ throwDefaultError({
660
+ output: output,
661
+ parsedBody: parsedBody,
662
+ exceptionCtor: __BaseException,
663
+ errorCode: errorCode,
729
664
  });
730
- throw __decorateServiceException(response, parsedBody);
665
+ _d.label = 9;
666
+ case 9: return [2];
731
667
  }
732
668
  });
733
669
  }); };
@@ -739,18 +675,18 @@ export var deserializeAws_restJson1UpdateConfigurationSetEventDestinationCommand
739
675
  if (output.statusCode !== 200 && output.statusCode >= 300) {
740
676
  return [2, deserializeAws_restJson1UpdateConfigurationSetEventDestinationCommandError(output, context)];
741
677
  }
742
- contents = {
678
+ contents = map({
743
679
  $metadata: deserializeMetadata(output),
744
- };
680
+ });
745
681
  return [4, collectBody(output.body, context)];
746
682
  case 1:
747
683
  _a.sent();
748
- return [2, Promise.resolve(contents)];
684
+ return [2, contents];
749
685
  }
750
686
  });
751
687
  }); };
752
688
  var deserializeAws_restJson1UpdateConfigurationSetEventDestinationCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
753
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
689
+ var parsedOutput, _a, errorCode, _b, parsedBody;
754
690
  var _c;
755
691
  return __generator(this, function (_d) {
756
692
  switch (_d.label) {
@@ -783,23 +719,24 @@ var deserializeAws_restJson1UpdateConfigurationSetEventDestinationCommandError =
783
719
  case 9: throw _d.sent();
784
720
  case 10:
785
721
  parsedBody = parsedOutput.body;
786
- $metadata = deserializeMetadata(output);
787
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
788
- response = new __BaseException({
789
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
790
- $fault: "client",
791
- $metadata: $metadata,
722
+ throwDefaultError({
723
+ output: output,
724
+ parsedBody: parsedBody,
725
+ exceptionCtor: __BaseException,
726
+ errorCode: errorCode,
792
727
  });
793
- throw __decorateServiceException(response, parsedBody);
728
+ _d.label = 11;
729
+ case 11: return [2];
794
730
  }
795
731
  });
796
732
  }); };
733
+ var map = __map;
797
734
  var deserializeAws_restJson1AlreadyExistsExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
798
735
  var contents, data, exception;
799
736
  return __generator(this, function (_a) {
800
- contents = {};
737
+ contents = map({});
801
738
  data = parsedOutput.body;
802
- if (data.Message !== undefined && data.Message !== null) {
739
+ if (data.Message != null) {
803
740
  contents.Message = __expectString(data.Message);
804
741
  }
805
742
  exception = new AlreadyExistsException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -809,9 +746,9 @@ var deserializeAws_restJson1AlreadyExistsExceptionResponse = function (parsedOut
809
746
  var deserializeAws_restJson1BadRequestExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
810
747
  var contents, data, exception;
811
748
  return __generator(this, function (_a) {
812
- contents = {};
749
+ contents = map({});
813
750
  data = parsedOutput.body;
814
- if (data.Message !== undefined && data.Message !== null) {
751
+ if (data.Message != null) {
815
752
  contents.Message = __expectString(data.Message);
816
753
  }
817
754
  exception = new BadRequestException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -821,9 +758,9 @@ var deserializeAws_restJson1BadRequestExceptionResponse = function (parsedOutput
821
758
  var deserializeAws_restJson1InternalServiceErrorExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
822
759
  var contents, data, exception;
823
760
  return __generator(this, function (_a) {
824
- contents = {};
761
+ contents = map({});
825
762
  data = parsedOutput.body;
826
- if (data.Message !== undefined && data.Message !== null) {
763
+ if (data.Message != null) {
827
764
  contents.Message = __expectString(data.Message);
828
765
  }
829
766
  exception = new InternalServiceErrorException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -833,9 +770,9 @@ var deserializeAws_restJson1InternalServiceErrorExceptionResponse = function (pa
833
770
  var deserializeAws_restJson1LimitExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
834
771
  var contents, data, exception;
835
772
  return __generator(this, function (_a) {
836
- contents = {};
773
+ contents = map({});
837
774
  data = parsedOutput.body;
838
- if (data.Message !== undefined && data.Message !== null) {
775
+ if (data.Message != null) {
839
776
  contents.Message = __expectString(data.Message);
840
777
  }
841
778
  exception = new LimitExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -845,9 +782,9 @@ var deserializeAws_restJson1LimitExceededExceptionResponse = function (parsedOut
845
782
  var deserializeAws_restJson1NotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
846
783
  var contents, data, exception;
847
784
  return __generator(this, function (_a) {
848
- contents = {};
785
+ contents = map({});
849
786
  data = parsedOutput.body;
850
- if (data.Message !== undefined && data.Message !== null) {
787
+ if (data.Message != null) {
851
788
  contents.Message = __expectString(data.Message);
852
789
  }
853
790
  exception = new NotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -857,9 +794,9 @@ var deserializeAws_restJson1NotFoundExceptionResponse = function (parsedOutput,
857
794
  var deserializeAws_restJson1TooManyRequestsExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
858
795
  var contents, data, exception;
859
796
  return __generator(this, function (_a) {
860
- contents = {};
797
+ contents = map({});
861
798
  data = parsedOutput.body;
862
- if (data.Message !== undefined && data.Message !== null) {
799
+ if (data.Message != null) {
863
800
  contents.Message = __expectString(data.Message);
864
801
  }
865
802
  exception = new TooManyRequestsException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -887,9 +824,6 @@ var serializeAws_restJson1EventTypes = function (input, context) {
887
824
  return input
888
825
  .filter(function (e) { return e != null; })
889
826
  .map(function (entry) {
890
- if (entry === null) {
891
- return null;
892
- }
893
827
  return entry;
894
828
  });
895
829
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-pinpoint-sms-voice",
3
3
  "description": "AWS SDK for JavaScript Pinpoint Sms Voice Client for Node.js, Browser and React Native",
4
- "version": "3.141.0",
4
+ "version": "3.142.0",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -18,9 +18,9 @@
18
18
  "dependencies": {
19
19
  "@aws-crypto/sha256-browser": "2.0.0",
20
20
  "@aws-crypto/sha256-js": "2.0.0",
21
- "@aws-sdk/client-sts": "3.141.0",
21
+ "@aws-sdk/client-sts": "3.142.0",
22
22
  "@aws-sdk/config-resolver": "3.130.0",
23
- "@aws-sdk/credential-provider-node": "3.141.0",
23
+ "@aws-sdk/credential-provider-node": "3.142.0",
24
24
  "@aws-sdk/fetch-http-handler": "3.131.0",
25
25
  "@aws-sdk/hash-node": "3.127.0",
26
26
  "@aws-sdk/invalid-dependency": "3.127.0",
@@ -36,15 +36,15 @@
36
36
  "@aws-sdk/node-config-provider": "3.127.0",
37
37
  "@aws-sdk/node-http-handler": "3.127.0",
38
38
  "@aws-sdk/protocol-http": "3.127.0",
39
- "@aws-sdk/smithy-client": "3.137.0",
39
+ "@aws-sdk/smithy-client": "3.142.0",
40
40
  "@aws-sdk/types": "3.127.0",
41
41
  "@aws-sdk/url-parser": "3.127.0",
42
42
  "@aws-sdk/util-base64-browser": "3.109.0",
43
43
  "@aws-sdk/util-base64-node": "3.55.0",
44
44
  "@aws-sdk/util-body-length-browser": "3.55.0",
45
45
  "@aws-sdk/util-body-length-node": "3.55.0",
46
- "@aws-sdk/util-defaults-mode-browser": "3.137.0",
47
- "@aws-sdk/util-defaults-mode-node": "3.137.0",
46
+ "@aws-sdk/util-defaults-mode-browser": "3.142.0",
47
+ "@aws-sdk/util-defaults-mode-node": "3.142.0",
48
48
  "@aws-sdk/util-user-agent-browser": "3.127.0",
49
49
  "@aws-sdk/util-user-agent-node": "3.127.0",
50
50
  "@aws-sdk/util-utf8-browser": "3.109.0",