@aws-sdk/client-ivschat 3.141.0 → 3.150.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.
@@ -179,16 +179,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
179
179
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
180
180
  const headers = {};
181
181
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
182
- if (input.resourceArn !== undefined) {
183
- const labelValue = input.resourceArn;
184
- if (labelValue.length <= 0) {
185
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
186
- }
187
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
188
- }
189
- else {
190
- throw new Error("No value provided for input HTTP label: resourceArn.");
191
- }
182
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
192
183
  let body;
193
184
  return new protocol_http_1.HttpRequest({
194
185
  protocol,
@@ -230,16 +221,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
230
221
  "content-type": "application/json",
231
222
  };
232
223
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
233
- if (input.resourceArn !== undefined) {
234
- const labelValue = input.resourceArn;
235
- if (labelValue.length <= 0) {
236
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
237
- }
238
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
239
- }
240
- else {
241
- throw new Error("No value provided for input HTTP label: resourceArn.");
242
- }
224
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
243
225
  let body;
244
226
  body = JSON.stringify({
245
227
  ...(input.tags != null && { tags: serializeAws_restJson1Tags(input.tags, context) }),
@@ -259,19 +241,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
259
241
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
260
242
  const headers = {};
261
243
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
262
- if (input.resourceArn !== undefined) {
263
- const labelValue = input.resourceArn;
264
- if (labelValue.length <= 0) {
265
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
266
- }
267
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
268
- }
269
- else {
270
- throw new Error("No value provided for input HTTP label: resourceArn.");
271
- }
272
- const query = {
273
- ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }),
274
- };
244
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
245
+ const query = map({
246
+ tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys || []).map((_entry) => _entry)],
247
+ });
275
248
  let body;
276
249
  return new protocol_http_1.HttpRequest({
277
250
  protocol,
@@ -318,23 +291,20 @@ const deserializeAws_restJson1CreateChatTokenCommand = async (output, context) =
318
291
  if (output.statusCode !== 200 && output.statusCode >= 300) {
319
292
  return deserializeAws_restJson1CreateChatTokenCommandError(output, context);
320
293
  }
321
- const contents = {
294
+ const contents = map({
322
295
  $metadata: deserializeMetadata(output),
323
- sessionExpirationTime: undefined,
324
- token: undefined,
325
- tokenExpirationTime: undefined,
326
- };
296
+ });
327
297
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
328
- if (data.sessionExpirationTime !== undefined && data.sessionExpirationTime !== null) {
298
+ if (data.sessionExpirationTime != null) {
329
299
  contents.sessionExpirationTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.sessionExpirationTime));
330
300
  }
331
- if (data.token !== undefined && data.token !== null) {
301
+ if (data.token != null) {
332
302
  contents.token = (0, smithy_client_1.expectString)(data.token);
333
303
  }
334
- if (data.tokenExpirationTime !== undefined && data.tokenExpirationTime !== null) {
304
+ if (data.tokenExpirationTime != null) {
335
305
  contents.tokenExpirationTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.tokenExpirationTime));
336
306
  }
337
- return Promise.resolve(contents);
307
+ return contents;
338
308
  };
339
309
  exports.deserializeAws_restJson1CreateChatTokenCommand = deserializeAws_restJson1CreateChatTokenCommand;
340
310
  const deserializeAws_restJson1CreateChatTokenCommandError = async (output, context) => {
@@ -342,7 +312,6 @@ const deserializeAws_restJson1CreateChatTokenCommandError = async (output, conte
342
312
  ...output,
343
313
  body: await parseBody(output.body, context),
344
314
  };
345
- let response;
346
315
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
347
316
  switch (errorCode) {
348
317
  case "AccessDeniedException":
@@ -359,61 +328,50 @@ const deserializeAws_restJson1CreateChatTokenCommandError = async (output, conte
359
328
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
360
329
  default:
361
330
  const parsedBody = parsedOutput.body;
362
- const $metadata = deserializeMetadata(output);
363
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
364
- response = new IvschatServiceException_1.IvschatServiceException({
365
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
366
- $fault: "client",
367
- $metadata,
331
+ (0, smithy_client_1.throwDefaultError)({
332
+ output,
333
+ parsedBody,
334
+ exceptionCtor: IvschatServiceException_1.IvschatServiceException,
335
+ errorCode,
368
336
  });
369
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
370
337
  }
371
338
  };
372
339
  const deserializeAws_restJson1CreateRoomCommand = async (output, context) => {
373
340
  if (output.statusCode !== 200 && output.statusCode >= 300) {
374
341
  return deserializeAws_restJson1CreateRoomCommandError(output, context);
375
342
  }
376
- const contents = {
343
+ const contents = map({
377
344
  $metadata: deserializeMetadata(output),
378
- arn: undefined,
379
- createTime: undefined,
380
- id: undefined,
381
- maximumMessageLength: undefined,
382
- maximumMessageRatePerSecond: undefined,
383
- messageReviewHandler: undefined,
384
- name: undefined,
385
- tags: undefined,
386
- updateTime: undefined,
387
- };
345
+ });
388
346
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
389
- if (data.arn !== undefined && data.arn !== null) {
347
+ if (data.arn != null) {
390
348
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
391
349
  }
392
- if (data.createTime !== undefined && data.createTime !== null) {
350
+ if (data.createTime != null) {
393
351
  contents.createTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.createTime));
394
352
  }
395
- if (data.id !== undefined && data.id !== null) {
353
+ if (data.id != null) {
396
354
  contents.id = (0, smithy_client_1.expectString)(data.id);
397
355
  }
398
- if (data.maximumMessageLength !== undefined && data.maximumMessageLength !== null) {
356
+ if (data.maximumMessageLength != null) {
399
357
  contents.maximumMessageLength = (0, smithy_client_1.expectInt32)(data.maximumMessageLength);
400
358
  }
401
- if (data.maximumMessageRatePerSecond !== undefined && data.maximumMessageRatePerSecond !== null) {
359
+ if (data.maximumMessageRatePerSecond != null) {
402
360
  contents.maximumMessageRatePerSecond = (0, smithy_client_1.expectInt32)(data.maximumMessageRatePerSecond);
403
361
  }
404
- if (data.messageReviewHandler !== undefined && data.messageReviewHandler !== null) {
362
+ if (data.messageReviewHandler != null) {
405
363
  contents.messageReviewHandler = deserializeAws_restJson1MessageReviewHandler(data.messageReviewHandler, context);
406
364
  }
407
- if (data.name !== undefined && data.name !== null) {
365
+ if (data.name != null) {
408
366
  contents.name = (0, smithy_client_1.expectString)(data.name);
409
367
  }
410
- if (data.tags !== undefined && data.tags !== null) {
368
+ if (data.tags != null) {
411
369
  contents.tags = deserializeAws_restJson1Tags(data.tags, context);
412
370
  }
413
- if (data.updateTime !== undefined && data.updateTime !== null) {
371
+ if (data.updateTime != null) {
414
372
  contents.updateTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.updateTime));
415
373
  }
416
- return Promise.resolve(contents);
374
+ return contents;
417
375
  };
418
376
  exports.deserializeAws_restJson1CreateRoomCommand = deserializeAws_restJson1CreateRoomCommand;
419
377
  const deserializeAws_restJson1CreateRoomCommandError = async (output, context) => {
@@ -421,7 +379,6 @@ const deserializeAws_restJson1CreateRoomCommandError = async (output, context) =
421
379
  ...output,
422
380
  body: await parseBody(output.body, context),
423
381
  };
424
- let response;
425
382
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
426
383
  switch (errorCode) {
427
384
  case "AccessDeniedException":
@@ -444,29 +401,26 @@ const deserializeAws_restJson1CreateRoomCommandError = async (output, context) =
444
401
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
445
402
  default:
446
403
  const parsedBody = parsedOutput.body;
447
- const $metadata = deserializeMetadata(output);
448
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
449
- response = new IvschatServiceException_1.IvschatServiceException({
450
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
451
- $fault: "client",
452
- $metadata,
404
+ (0, smithy_client_1.throwDefaultError)({
405
+ output,
406
+ parsedBody,
407
+ exceptionCtor: IvschatServiceException_1.IvschatServiceException,
408
+ errorCode,
453
409
  });
454
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
455
410
  }
456
411
  };
457
412
  const deserializeAws_restJson1DeleteMessageCommand = async (output, context) => {
458
413
  if (output.statusCode !== 200 && output.statusCode >= 300) {
459
414
  return deserializeAws_restJson1DeleteMessageCommandError(output, context);
460
415
  }
461
- const contents = {
416
+ const contents = map({
462
417
  $metadata: deserializeMetadata(output),
463
- id: undefined,
464
- };
418
+ });
465
419
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
466
- if (data.id !== undefined && data.id !== null) {
420
+ if (data.id != null) {
467
421
  contents.id = (0, smithy_client_1.expectString)(data.id);
468
422
  }
469
- return Promise.resolve(contents);
423
+ return contents;
470
424
  };
471
425
  exports.deserializeAws_restJson1DeleteMessageCommand = deserializeAws_restJson1DeleteMessageCommand;
472
426
  const deserializeAws_restJson1DeleteMessageCommandError = async (output, context) => {
@@ -474,7 +428,6 @@ const deserializeAws_restJson1DeleteMessageCommandError = async (output, context
474
428
  ...output,
475
429
  body: await parseBody(output.body, context),
476
430
  };
477
- let response;
478
431
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
479
432
  switch (errorCode) {
480
433
  case "AccessDeniedException":
@@ -491,25 +444,23 @@ const deserializeAws_restJson1DeleteMessageCommandError = async (output, context
491
444
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
492
445
  default:
493
446
  const parsedBody = parsedOutput.body;
494
- const $metadata = deserializeMetadata(output);
495
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
496
- response = new IvschatServiceException_1.IvschatServiceException({
497
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
498
- $fault: "client",
499
- $metadata,
447
+ (0, smithy_client_1.throwDefaultError)({
448
+ output,
449
+ parsedBody,
450
+ exceptionCtor: IvschatServiceException_1.IvschatServiceException,
451
+ errorCode,
500
452
  });
501
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
502
453
  }
503
454
  };
504
455
  const deserializeAws_restJson1DeleteRoomCommand = async (output, context) => {
505
456
  if (output.statusCode !== 204 && output.statusCode >= 300) {
506
457
  return deserializeAws_restJson1DeleteRoomCommandError(output, context);
507
458
  }
508
- const contents = {
459
+ const contents = map({
509
460
  $metadata: deserializeMetadata(output),
510
- };
461
+ });
511
462
  await collectBody(output.body, context);
512
- return Promise.resolve(contents);
463
+ return contents;
513
464
  };
514
465
  exports.deserializeAws_restJson1DeleteRoomCommand = deserializeAws_restJson1DeleteRoomCommand;
515
466
  const deserializeAws_restJson1DeleteRoomCommandError = async (output, context) => {
@@ -517,7 +468,6 @@ const deserializeAws_restJson1DeleteRoomCommandError = async (output, context) =
517
468
  ...output,
518
469
  body: await parseBody(output.body, context),
519
470
  };
520
- let response;
521
471
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
522
472
  switch (errorCode) {
523
473
  case "AccessDeniedException":
@@ -534,25 +484,23 @@ const deserializeAws_restJson1DeleteRoomCommandError = async (output, context) =
534
484
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
535
485
  default:
536
486
  const parsedBody = parsedOutput.body;
537
- const $metadata = deserializeMetadata(output);
538
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
539
- response = new IvschatServiceException_1.IvschatServiceException({
540
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
541
- $fault: "client",
542
- $metadata,
487
+ (0, smithy_client_1.throwDefaultError)({
488
+ output,
489
+ parsedBody,
490
+ exceptionCtor: IvschatServiceException_1.IvschatServiceException,
491
+ errorCode,
543
492
  });
544
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
545
493
  }
546
494
  };
547
495
  const deserializeAws_restJson1DisconnectUserCommand = async (output, context) => {
548
496
  if (output.statusCode !== 200 && output.statusCode >= 300) {
549
497
  return deserializeAws_restJson1DisconnectUserCommandError(output, context);
550
498
  }
551
- const contents = {
499
+ const contents = map({
552
500
  $metadata: deserializeMetadata(output),
553
- };
501
+ });
554
502
  await collectBody(output.body, context);
555
- return Promise.resolve(contents);
503
+ return contents;
556
504
  };
557
505
  exports.deserializeAws_restJson1DisconnectUserCommand = deserializeAws_restJson1DisconnectUserCommand;
558
506
  const deserializeAws_restJson1DisconnectUserCommandError = async (output, context) => {
@@ -560,7 +508,6 @@ const deserializeAws_restJson1DisconnectUserCommandError = async (output, contex
560
508
  ...output,
561
509
  body: await parseBody(output.body, context),
562
510
  };
563
- let response;
564
511
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
565
512
  switch (errorCode) {
566
513
  case "AccessDeniedException":
@@ -577,61 +524,50 @@ const deserializeAws_restJson1DisconnectUserCommandError = async (output, contex
577
524
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
578
525
  default:
579
526
  const parsedBody = parsedOutput.body;
580
- const $metadata = deserializeMetadata(output);
581
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
582
- response = new IvschatServiceException_1.IvschatServiceException({
583
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
584
- $fault: "client",
585
- $metadata,
527
+ (0, smithy_client_1.throwDefaultError)({
528
+ output,
529
+ parsedBody,
530
+ exceptionCtor: IvschatServiceException_1.IvschatServiceException,
531
+ errorCode,
586
532
  });
587
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
588
533
  }
589
534
  };
590
535
  const deserializeAws_restJson1GetRoomCommand = async (output, context) => {
591
536
  if (output.statusCode !== 200 && output.statusCode >= 300) {
592
537
  return deserializeAws_restJson1GetRoomCommandError(output, context);
593
538
  }
594
- const contents = {
539
+ const contents = map({
595
540
  $metadata: deserializeMetadata(output),
596
- arn: undefined,
597
- createTime: undefined,
598
- id: undefined,
599
- maximumMessageLength: undefined,
600
- maximumMessageRatePerSecond: undefined,
601
- messageReviewHandler: undefined,
602
- name: undefined,
603
- tags: undefined,
604
- updateTime: undefined,
605
- };
541
+ });
606
542
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
607
- if (data.arn !== undefined && data.arn !== null) {
543
+ if (data.arn != null) {
608
544
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
609
545
  }
610
- if (data.createTime !== undefined && data.createTime !== null) {
546
+ if (data.createTime != null) {
611
547
  contents.createTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.createTime));
612
548
  }
613
- if (data.id !== undefined && data.id !== null) {
549
+ if (data.id != null) {
614
550
  contents.id = (0, smithy_client_1.expectString)(data.id);
615
551
  }
616
- if (data.maximumMessageLength !== undefined && data.maximumMessageLength !== null) {
552
+ if (data.maximumMessageLength != null) {
617
553
  contents.maximumMessageLength = (0, smithy_client_1.expectInt32)(data.maximumMessageLength);
618
554
  }
619
- if (data.maximumMessageRatePerSecond !== undefined && data.maximumMessageRatePerSecond !== null) {
555
+ if (data.maximumMessageRatePerSecond != null) {
620
556
  contents.maximumMessageRatePerSecond = (0, smithy_client_1.expectInt32)(data.maximumMessageRatePerSecond);
621
557
  }
622
- if (data.messageReviewHandler !== undefined && data.messageReviewHandler !== null) {
558
+ if (data.messageReviewHandler != null) {
623
559
  contents.messageReviewHandler = deserializeAws_restJson1MessageReviewHandler(data.messageReviewHandler, context);
624
560
  }
625
- if (data.name !== undefined && data.name !== null) {
561
+ if (data.name != null) {
626
562
  contents.name = (0, smithy_client_1.expectString)(data.name);
627
563
  }
628
- if (data.tags !== undefined && data.tags !== null) {
564
+ if (data.tags != null) {
629
565
  contents.tags = deserializeAws_restJson1Tags(data.tags, context);
630
566
  }
631
- if (data.updateTime !== undefined && data.updateTime !== null) {
567
+ if (data.updateTime != null) {
632
568
  contents.updateTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.updateTime));
633
569
  }
634
- return Promise.resolve(contents);
570
+ return contents;
635
571
  };
636
572
  exports.deserializeAws_restJson1GetRoomCommand = deserializeAws_restJson1GetRoomCommand;
637
573
  const deserializeAws_restJson1GetRoomCommandError = async (output, context) => {
@@ -639,7 +575,6 @@ const deserializeAws_restJson1GetRoomCommandError = async (output, context) => {
639
575
  ...output,
640
576
  body: await parseBody(output.body, context),
641
577
  };
642
- let response;
643
578
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
644
579
  switch (errorCode) {
645
580
  case "AccessDeniedException":
@@ -653,33 +588,29 @@ const deserializeAws_restJson1GetRoomCommandError = async (output, context) => {
653
588
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
654
589
  default:
655
590
  const parsedBody = parsedOutput.body;
656
- const $metadata = deserializeMetadata(output);
657
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
658
- response = new IvschatServiceException_1.IvschatServiceException({
659
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
660
- $fault: "client",
661
- $metadata,
591
+ (0, smithy_client_1.throwDefaultError)({
592
+ output,
593
+ parsedBody,
594
+ exceptionCtor: IvschatServiceException_1.IvschatServiceException,
595
+ errorCode,
662
596
  });
663
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
664
597
  }
665
598
  };
666
599
  const deserializeAws_restJson1ListRoomsCommand = async (output, context) => {
667
600
  if (output.statusCode !== 200 && output.statusCode >= 300) {
668
601
  return deserializeAws_restJson1ListRoomsCommandError(output, context);
669
602
  }
670
- const contents = {
603
+ const contents = map({
671
604
  $metadata: deserializeMetadata(output),
672
- nextToken: undefined,
673
- rooms: undefined,
674
- };
605
+ });
675
606
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
676
- if (data.nextToken !== undefined && data.nextToken !== null) {
607
+ if (data.nextToken != null) {
677
608
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
678
609
  }
679
- if (data.rooms !== undefined && data.rooms !== null) {
610
+ if (data.rooms != null) {
680
611
  contents.rooms = deserializeAws_restJson1RoomList(data.rooms, context);
681
612
  }
682
- return Promise.resolve(contents);
613
+ return contents;
683
614
  };
684
615
  exports.deserializeAws_restJson1ListRoomsCommand = deserializeAws_restJson1ListRoomsCommand;
685
616
  const deserializeAws_restJson1ListRoomsCommandError = async (output, context) => {
@@ -687,7 +618,6 @@ const deserializeAws_restJson1ListRoomsCommandError = async (output, context) =>
687
618
  ...output,
688
619
  body: await parseBody(output.body, context),
689
620
  };
690
- let response;
691
621
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
692
622
  switch (errorCode) {
693
623
  case "AccessDeniedException":
@@ -701,29 +631,26 @@ const deserializeAws_restJson1ListRoomsCommandError = async (output, context) =>
701
631
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
702
632
  default:
703
633
  const parsedBody = parsedOutput.body;
704
- const $metadata = deserializeMetadata(output);
705
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
706
- response = new IvschatServiceException_1.IvschatServiceException({
707
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
708
- $fault: "client",
709
- $metadata,
634
+ (0, smithy_client_1.throwDefaultError)({
635
+ output,
636
+ parsedBody,
637
+ exceptionCtor: IvschatServiceException_1.IvschatServiceException,
638
+ errorCode,
710
639
  });
711
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
712
640
  }
713
641
  };
714
642
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
715
643
  if (output.statusCode !== 200 && output.statusCode >= 300) {
716
644
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
717
645
  }
718
- const contents = {
646
+ const contents = map({
719
647
  $metadata: deserializeMetadata(output),
720
- tags: undefined,
721
- };
648
+ });
722
649
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
723
- if (data.tags !== undefined && data.tags !== null) {
650
+ if (data.tags != null) {
724
651
  contents.tags = deserializeAws_restJson1Tags(data.tags, context);
725
652
  }
726
- return Promise.resolve(contents);
653
+ return contents;
727
654
  };
728
655
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
729
656
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -731,7 +658,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
731
658
  ...output,
732
659
  body: await parseBody(output.body, context),
733
660
  };
734
- let response;
735
661
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
736
662
  switch (errorCode) {
737
663
  case "InternalServerException":
@@ -745,29 +671,26 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
745
671
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
746
672
  default:
747
673
  const parsedBody = parsedOutput.body;
748
- const $metadata = deserializeMetadata(output);
749
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
750
- response = new IvschatServiceException_1.IvschatServiceException({
751
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
752
- $fault: "client",
753
- $metadata,
674
+ (0, smithy_client_1.throwDefaultError)({
675
+ output,
676
+ parsedBody,
677
+ exceptionCtor: IvschatServiceException_1.IvschatServiceException,
678
+ errorCode,
754
679
  });
755
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
756
680
  }
757
681
  };
758
682
  const deserializeAws_restJson1SendEventCommand = async (output, context) => {
759
683
  if (output.statusCode !== 200 && output.statusCode >= 300) {
760
684
  return deserializeAws_restJson1SendEventCommandError(output, context);
761
685
  }
762
- const contents = {
686
+ const contents = map({
763
687
  $metadata: deserializeMetadata(output),
764
- id: undefined,
765
- };
688
+ });
766
689
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
767
- if (data.id !== undefined && data.id !== null) {
690
+ if (data.id != null) {
768
691
  contents.id = (0, smithy_client_1.expectString)(data.id);
769
692
  }
770
- return Promise.resolve(contents);
693
+ return contents;
771
694
  };
772
695
  exports.deserializeAws_restJson1SendEventCommand = deserializeAws_restJson1SendEventCommand;
773
696
  const deserializeAws_restJson1SendEventCommandError = async (output, context) => {
@@ -775,7 +698,6 @@ const deserializeAws_restJson1SendEventCommandError = async (output, context) =>
775
698
  ...output,
776
699
  body: await parseBody(output.body, context),
777
700
  };
778
- let response;
779
701
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
780
702
  switch (errorCode) {
781
703
  case "AccessDeniedException":
@@ -792,25 +714,23 @@ const deserializeAws_restJson1SendEventCommandError = async (output, context) =>
792
714
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
793
715
  default:
794
716
  const parsedBody = parsedOutput.body;
795
- const $metadata = deserializeMetadata(output);
796
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
797
- response = new IvschatServiceException_1.IvschatServiceException({
798
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
799
- $fault: "client",
800
- $metadata,
717
+ (0, smithy_client_1.throwDefaultError)({
718
+ output,
719
+ parsedBody,
720
+ exceptionCtor: IvschatServiceException_1.IvschatServiceException,
721
+ errorCode,
801
722
  });
802
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
803
723
  }
804
724
  };
805
725
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
806
726
  if (output.statusCode !== 200 && output.statusCode >= 300) {
807
727
  return deserializeAws_restJson1TagResourceCommandError(output, context);
808
728
  }
809
- const contents = {
729
+ const contents = map({
810
730
  $metadata: deserializeMetadata(output),
811
- };
731
+ });
812
732
  await collectBody(output.body, context);
813
- return Promise.resolve(contents);
733
+ return contents;
814
734
  };
815
735
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
816
736
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -818,7 +738,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
818
738
  ...output,
819
739
  body: await parseBody(output.body, context),
820
740
  };
821
- let response;
822
741
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
823
742
  switch (errorCode) {
824
743
  case "InternalServerException":
@@ -832,25 +751,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
832
751
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
833
752
  default:
834
753
  const parsedBody = parsedOutput.body;
835
- const $metadata = deserializeMetadata(output);
836
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
837
- response = new IvschatServiceException_1.IvschatServiceException({
838
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
839
- $fault: "client",
840
- $metadata,
754
+ (0, smithy_client_1.throwDefaultError)({
755
+ output,
756
+ parsedBody,
757
+ exceptionCtor: IvschatServiceException_1.IvschatServiceException,
758
+ errorCode,
841
759
  });
842
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
843
760
  }
844
761
  };
845
762
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
846
763
  if (output.statusCode !== 200 && output.statusCode >= 300) {
847
764
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
848
765
  }
849
- const contents = {
766
+ const contents = map({
850
767
  $metadata: deserializeMetadata(output),
851
- };
768
+ });
852
769
  await collectBody(output.body, context);
853
- return Promise.resolve(contents);
770
+ return contents;
854
771
  };
855
772
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
856
773
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -858,7 +775,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
858
775
  ...output,
859
776
  body: await parseBody(output.body, context),
860
777
  };
861
- let response;
862
778
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
863
779
  switch (errorCode) {
864
780
  case "InternalServerException":
@@ -872,61 +788,50 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
872
788
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
873
789
  default:
874
790
  const parsedBody = parsedOutput.body;
875
- const $metadata = deserializeMetadata(output);
876
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
877
- response = new IvschatServiceException_1.IvschatServiceException({
878
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
879
- $fault: "client",
880
- $metadata,
791
+ (0, smithy_client_1.throwDefaultError)({
792
+ output,
793
+ parsedBody,
794
+ exceptionCtor: IvschatServiceException_1.IvschatServiceException,
795
+ errorCode,
881
796
  });
882
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
883
797
  }
884
798
  };
885
799
  const deserializeAws_restJson1UpdateRoomCommand = async (output, context) => {
886
800
  if (output.statusCode !== 200 && output.statusCode >= 300) {
887
801
  return deserializeAws_restJson1UpdateRoomCommandError(output, context);
888
802
  }
889
- const contents = {
803
+ const contents = map({
890
804
  $metadata: deserializeMetadata(output),
891
- arn: undefined,
892
- createTime: undefined,
893
- id: undefined,
894
- maximumMessageLength: undefined,
895
- maximumMessageRatePerSecond: undefined,
896
- messageReviewHandler: undefined,
897
- name: undefined,
898
- tags: undefined,
899
- updateTime: undefined,
900
- };
805
+ });
901
806
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
902
- if (data.arn !== undefined && data.arn !== null) {
807
+ if (data.arn != null) {
903
808
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
904
809
  }
905
- if (data.createTime !== undefined && data.createTime !== null) {
810
+ if (data.createTime != null) {
906
811
  contents.createTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.createTime));
907
812
  }
908
- if (data.id !== undefined && data.id !== null) {
813
+ if (data.id != null) {
909
814
  contents.id = (0, smithy_client_1.expectString)(data.id);
910
815
  }
911
- if (data.maximumMessageLength !== undefined && data.maximumMessageLength !== null) {
816
+ if (data.maximumMessageLength != null) {
912
817
  contents.maximumMessageLength = (0, smithy_client_1.expectInt32)(data.maximumMessageLength);
913
818
  }
914
- if (data.maximumMessageRatePerSecond !== undefined && data.maximumMessageRatePerSecond !== null) {
819
+ if (data.maximumMessageRatePerSecond != null) {
915
820
  contents.maximumMessageRatePerSecond = (0, smithy_client_1.expectInt32)(data.maximumMessageRatePerSecond);
916
821
  }
917
- if (data.messageReviewHandler !== undefined && data.messageReviewHandler !== null) {
822
+ if (data.messageReviewHandler != null) {
918
823
  contents.messageReviewHandler = deserializeAws_restJson1MessageReviewHandler(data.messageReviewHandler, context);
919
824
  }
920
- if (data.name !== undefined && data.name !== null) {
825
+ if (data.name != null) {
921
826
  contents.name = (0, smithy_client_1.expectString)(data.name);
922
827
  }
923
- if (data.tags !== undefined && data.tags !== null) {
828
+ if (data.tags != null) {
924
829
  contents.tags = deserializeAws_restJson1Tags(data.tags, context);
925
830
  }
926
- if (data.updateTime !== undefined && data.updateTime !== null) {
831
+ if (data.updateTime != null) {
927
832
  contents.updateTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.updateTime));
928
833
  }
929
- return Promise.resolve(contents);
834
+ return contents;
930
835
  };
931
836
  exports.deserializeAws_restJson1UpdateRoomCommand = deserializeAws_restJson1UpdateRoomCommand;
932
837
  const deserializeAws_restJson1UpdateRoomCommandError = async (output, context) => {
@@ -934,7 +839,6 @@ const deserializeAws_restJson1UpdateRoomCommandError = async (output, context) =
934
839
  ...output,
935
840
  body: await parseBody(output.body, context),
936
841
  };
937
- let response;
938
842
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
939
843
  switch (errorCode) {
940
844
  case "AccessDeniedException":
@@ -951,20 +855,19 @@ const deserializeAws_restJson1UpdateRoomCommandError = async (output, context) =
951
855
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
952
856
  default:
953
857
  const parsedBody = parsedOutput.body;
954
- const $metadata = deserializeMetadata(output);
955
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
956
- response = new IvschatServiceException_1.IvschatServiceException({
957
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
958
- $fault: "client",
959
- $metadata,
858
+ (0, smithy_client_1.throwDefaultError)({
859
+ output,
860
+ parsedBody,
861
+ exceptionCtor: IvschatServiceException_1.IvschatServiceException,
862
+ errorCode,
960
863
  });
961
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
962
864
  }
963
865
  };
866
+ const map = smithy_client_1.map;
964
867
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
965
- const contents = {};
868
+ const contents = map({});
966
869
  const data = parsedOutput.body;
967
- if (data.message !== undefined && data.message !== null) {
870
+ if (data.message != null) {
968
871
  contents.message = (0, smithy_client_1.expectString)(data.message);
969
872
  }
970
873
  const exception = new models_0_1.AccessDeniedException({
@@ -974,15 +877,15 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
974
877
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
975
878
  };
976
879
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
977
- const contents = {};
880
+ const contents = map({});
978
881
  const data = parsedOutput.body;
979
- if (data.message !== undefined && data.message !== null) {
882
+ if (data.message != null) {
980
883
  contents.message = (0, smithy_client_1.expectString)(data.message);
981
884
  }
982
- if (data.resourceId !== undefined && data.resourceId !== null) {
885
+ if (data.resourceId != null) {
983
886
  contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
984
887
  }
985
- if (data.resourceType !== undefined && data.resourceType !== null) {
888
+ if (data.resourceType != null) {
986
889
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
987
890
  }
988
891
  const exception = new models_0_1.ConflictException({
@@ -992,9 +895,9 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
992
895
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
993
896
  };
994
897
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
995
- const contents = {};
898
+ const contents = map({});
996
899
  const data = parsedOutput.body;
997
- if (data.message !== undefined && data.message !== null) {
900
+ if (data.message != null) {
998
901
  contents.message = (0, smithy_client_1.expectString)(data.message);
999
902
  }
1000
903
  const exception = new models_0_1.InternalServerException({
@@ -1004,9 +907,9 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
1004
907
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1005
908
  };
1006
909
  const deserializeAws_restJson1PendingVerificationResponse = async (parsedOutput, context) => {
1007
- const contents = {};
910
+ const contents = map({});
1008
911
  const data = parsedOutput.body;
1009
- if (data.message !== undefined && data.message !== null) {
912
+ if (data.message != null) {
1010
913
  contents.message = (0, smithy_client_1.expectString)(data.message);
1011
914
  }
1012
915
  const exception = new models_0_1.PendingVerification({
@@ -1016,15 +919,15 @@ const deserializeAws_restJson1PendingVerificationResponse = async (parsedOutput,
1016
919
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1017
920
  };
1018
921
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1019
- const contents = {};
922
+ const contents = map({});
1020
923
  const data = parsedOutput.body;
1021
- if (data.message !== undefined && data.message !== null) {
924
+ if (data.message != null) {
1022
925
  contents.message = (0, smithy_client_1.expectString)(data.message);
1023
926
  }
1024
- if (data.resourceId !== undefined && data.resourceId !== null) {
927
+ if (data.resourceId != null) {
1025
928
  contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
1026
929
  }
1027
- if (data.resourceType !== undefined && data.resourceType !== null) {
930
+ if (data.resourceType != null) {
1028
931
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
1029
932
  }
1030
933
  const exception = new models_0_1.ResourceNotFoundException({
@@ -1034,18 +937,18 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
1034
937
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1035
938
  };
1036
939
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
1037
- const contents = {};
940
+ const contents = map({});
1038
941
  const data = parsedOutput.body;
1039
- if (data.limit !== undefined && data.limit !== null) {
942
+ if (data.limit != null) {
1040
943
  contents.limit = (0, smithy_client_1.expectInt32)(data.limit);
1041
944
  }
1042
- if (data.message !== undefined && data.message !== null) {
945
+ if (data.message != null) {
1043
946
  contents.message = (0, smithy_client_1.expectString)(data.message);
1044
947
  }
1045
- if (data.resourceId !== undefined && data.resourceId !== null) {
948
+ if (data.resourceId != null) {
1046
949
  contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
1047
950
  }
1048
- if (data.resourceType !== undefined && data.resourceType !== null) {
951
+ if (data.resourceType != null) {
1049
952
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
1050
953
  }
1051
954
  const exception = new models_0_1.ServiceQuotaExceededException({
@@ -1055,18 +958,18 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
1055
958
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1056
959
  };
1057
960
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
1058
- const contents = {};
961
+ const contents = map({});
1059
962
  const data = parsedOutput.body;
1060
- if (data.limit !== undefined && data.limit !== null) {
963
+ if (data.limit != null) {
1061
964
  contents.limit = (0, smithy_client_1.expectInt32)(data.limit);
1062
965
  }
1063
- if (data.message !== undefined && data.message !== null) {
966
+ if (data.message != null) {
1064
967
  contents.message = (0, smithy_client_1.expectString)(data.message);
1065
968
  }
1066
- if (data.resourceId !== undefined && data.resourceId !== null) {
969
+ if (data.resourceId != null) {
1067
970
  contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
1068
971
  }
1069
- if (data.resourceType !== undefined && data.resourceType !== null) {
972
+ if (data.resourceType != null) {
1070
973
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
1071
974
  }
1072
975
  const exception = new models_0_1.ThrottlingException({
@@ -1076,15 +979,15 @@ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput,
1076
979
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1077
980
  };
1078
981
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
1079
- const contents = {};
982
+ const contents = map({});
1080
983
  const data = parsedOutput.body;
1081
- if (data.fieldList !== undefined && data.fieldList !== null) {
984
+ if (data.fieldList != null) {
1082
985
  contents.fieldList = deserializeAws_restJson1ValidationExceptionFieldList(data.fieldList, context);
1083
986
  }
1084
- if (data.message !== undefined && data.message !== null) {
987
+ if (data.message != null) {
1085
988
  contents.message = (0, smithy_client_1.expectString)(data.message);
1086
989
  }
1087
- if (data.reason !== undefined && data.reason !== null) {
990
+ if (data.reason != null) {
1088
991
  contents.reason = (0, smithy_client_1.expectString)(data.reason);
1089
992
  }
1090
993
  const exception = new models_0_1.ValidationException({
@@ -1108,9 +1011,6 @@ const serializeAws_restJson1ChatTokenCapabilities = (input, context) => {
1108
1011
  return input
1109
1012
  .filter((e) => e != null)
1110
1013
  .map((entry) => {
1111
- if (entry === null) {
1112
- return null;
1113
- }
1114
1014
  return entry;
1115
1015
  });
1116
1016
  };