@aws-sdk/client-connectparticipant 3.137.0 → 3.145.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,36 @@
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.145.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.144.0...v3.145.0) (2022-08-08)
7
+
8
+ **Note:** Version bump only for package @aws-sdk/client-connectparticipant
9
+
10
+
11
+
12
+
13
+
14
+ # [3.142.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.141.0...v3.142.0) (2022-08-02)
15
+
16
+
17
+ ### Features
18
+
19
+ * **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))
20
+
21
+
22
+
23
+
24
+
25
+ # [3.141.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.140.0...v3.141.0) (2022-08-01)
26
+
27
+
28
+ ### Features
29
+
30
+ * **clients:** update client endpoints as of 2022-08-01 ([aaf49f2](https://github.com/aws/aws-sdk-js-v3/commit/aaf49f21b371412e6ea7e00890b71a7b31991b66))
31
+
32
+
33
+
34
+
35
+
6
36
  # [3.137.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.136.1...v3.137.0) (2022-07-26)
7
37
 
8
38
 
package/README.md CHANGED
@@ -170,7 +170,7 @@ try {
170
170
  const data = await client.send(command);
171
171
  // process data.
172
172
  } catch (error) {
173
- const { requestId, cfId, extendedRequestId } = error.$metadata;
173
+ const { requestId, cfId, extendedRequestId } = error.$$metadata;
174
174
  console.log({ requestId, cfId, extendedRequestId });
175
175
  /**
176
176
  * The keys within exceptions are also parsed.
@@ -9,10 +9,10 @@ const models_0_1 = require("../models/models_0");
9
9
  const serializeAws_restJson1CompleteAttachmentUploadCommand = async (input, context) => {
10
10
  var _a;
11
11
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
12
- const headers = {
12
+ const headers = map({}, isSerializableHeaderValue, {
13
13
  "content-type": "application/json",
14
- ...(isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken }),
15
- };
14
+ "x-amz-bearer": input.ConnectionToken,
15
+ });
16
16
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/participant/complete-attachment-upload";
17
17
  let body;
18
18
  body = JSON.stringify({
@@ -34,10 +34,10 @@ const serializeAws_restJson1CompleteAttachmentUploadCommand = async (input, cont
34
34
  exports.serializeAws_restJson1CompleteAttachmentUploadCommand = serializeAws_restJson1CompleteAttachmentUploadCommand;
35
35
  const serializeAws_restJson1CreateParticipantConnectionCommand = async (input, context) => {
36
36
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
37
- const headers = {
37
+ const headers = map({}, isSerializableHeaderValue, {
38
38
  "content-type": "application/json",
39
- ...(isSerializableHeaderValue(input.ParticipantToken) && { "x-amz-bearer": input.ParticipantToken }),
40
- };
39
+ "x-amz-bearer": input.ParticipantToken,
40
+ });
41
41
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/participant/connection";
42
42
  let body;
43
43
  body = JSON.stringify({
@@ -58,10 +58,10 @@ exports.serializeAws_restJson1CreateParticipantConnectionCommand = serializeAws_
58
58
  const serializeAws_restJson1DisconnectParticipantCommand = async (input, context) => {
59
59
  var _a;
60
60
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
61
- const headers = {
61
+ const headers = map({}, isSerializableHeaderValue, {
62
62
  "content-type": "application/json",
63
- ...(isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken }),
64
- };
63
+ "x-amz-bearer": input.ConnectionToken,
64
+ });
65
65
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/participant/disconnect";
66
66
  let body;
67
67
  body = JSON.stringify({
@@ -80,10 +80,10 @@ const serializeAws_restJson1DisconnectParticipantCommand = async (input, context
80
80
  exports.serializeAws_restJson1DisconnectParticipantCommand = serializeAws_restJson1DisconnectParticipantCommand;
81
81
  const serializeAws_restJson1GetAttachmentCommand = async (input, context) => {
82
82
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
83
- const headers = {
83
+ const headers = map({}, isSerializableHeaderValue, {
84
84
  "content-type": "application/json",
85
- ...(isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken }),
86
- };
85
+ "x-amz-bearer": input.ConnectionToken,
86
+ });
87
87
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/participant/attachment";
88
88
  let body;
89
89
  body = JSON.stringify({
@@ -102,10 +102,10 @@ const serializeAws_restJson1GetAttachmentCommand = async (input, context) => {
102
102
  exports.serializeAws_restJson1GetAttachmentCommand = serializeAws_restJson1GetAttachmentCommand;
103
103
  const serializeAws_restJson1GetTranscriptCommand = async (input, context) => {
104
104
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
105
- const headers = {
105
+ const headers = map({}, isSerializableHeaderValue, {
106
106
  "content-type": "application/json",
107
- ...(isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken }),
108
- };
107
+ "x-amz-bearer": input.ConnectionToken,
108
+ });
109
109
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/participant/transcript";
110
110
  let body;
111
111
  body = JSON.stringify({
@@ -132,10 +132,10 @@ exports.serializeAws_restJson1GetTranscriptCommand = serializeAws_restJson1GetTr
132
132
  const serializeAws_restJson1SendEventCommand = async (input, context) => {
133
133
  var _a;
134
134
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
135
- const headers = {
135
+ const headers = map({}, isSerializableHeaderValue, {
136
136
  "content-type": "application/json",
137
- ...(isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken }),
138
- };
137
+ "x-amz-bearer": input.ConnectionToken,
138
+ });
139
139
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/participant/event";
140
140
  let body;
141
141
  body = JSON.stringify({
@@ -157,10 +157,10 @@ exports.serializeAws_restJson1SendEventCommand = serializeAws_restJson1SendEvent
157
157
  const serializeAws_restJson1SendMessageCommand = async (input, context) => {
158
158
  var _a;
159
159
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
160
- const headers = {
160
+ const headers = map({}, isSerializableHeaderValue, {
161
161
  "content-type": "application/json",
162
- ...(isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken }),
163
- };
162
+ "x-amz-bearer": input.ConnectionToken,
163
+ });
164
164
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/participant/message";
165
165
  let body;
166
166
  body = JSON.stringify({
@@ -182,10 +182,10 @@ exports.serializeAws_restJson1SendMessageCommand = serializeAws_restJson1SendMes
182
182
  const serializeAws_restJson1StartAttachmentUploadCommand = async (input, context) => {
183
183
  var _a;
184
184
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
185
- const headers = {
185
+ const headers = map({}, isSerializableHeaderValue, {
186
186
  "content-type": "application/json",
187
- ...(isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken }),
188
- };
187
+ "x-amz-bearer": input.ConnectionToken,
188
+ });
189
189
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/participant/start-attachment-upload";
190
190
  let body;
191
191
  body = JSON.stringify({
@@ -209,11 +209,11 @@ const deserializeAws_restJson1CompleteAttachmentUploadCommand = async (output, c
209
209
  if (output.statusCode !== 200 && output.statusCode >= 300) {
210
210
  return deserializeAws_restJson1CompleteAttachmentUploadCommandError(output, context);
211
211
  }
212
- const contents = {
212
+ const contents = map({
213
213
  $metadata: deserializeMetadata(output),
214
- };
214
+ });
215
215
  await collectBody(output.body, context);
216
- return Promise.resolve(contents);
216
+ return contents;
217
217
  };
218
218
  exports.deserializeAws_restJson1CompleteAttachmentUploadCommand = deserializeAws_restJson1CompleteAttachmentUploadCommand;
219
219
  const deserializeAws_restJson1CompleteAttachmentUploadCommandError = async (output, context) => {
@@ -221,7 +221,6 @@ const deserializeAws_restJson1CompleteAttachmentUploadCommandError = async (outp
221
221
  ...output,
222
222
  body: await parseBody(output.body, context),
223
223
  };
224
- let response;
225
224
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
226
225
  switch (errorCode) {
227
226
  case "AccessDeniedException":
@@ -244,33 +243,29 @@ const deserializeAws_restJson1CompleteAttachmentUploadCommandError = async (outp
244
243
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
245
244
  default:
246
245
  const parsedBody = parsedOutput.body;
247
- const $metadata = deserializeMetadata(output);
248
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
249
- response = new ConnectParticipantServiceException_1.ConnectParticipantServiceException({
250
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
251
- $fault: "client",
252
- $metadata,
246
+ (0, smithy_client_1.throwDefaultError)({
247
+ output,
248
+ parsedBody,
249
+ exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
250
+ errorCode,
253
251
  });
254
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
255
252
  }
256
253
  };
257
254
  const deserializeAws_restJson1CreateParticipantConnectionCommand = async (output, context) => {
258
255
  if (output.statusCode !== 200 && output.statusCode >= 300) {
259
256
  return deserializeAws_restJson1CreateParticipantConnectionCommandError(output, context);
260
257
  }
261
- const contents = {
258
+ const contents = map({
262
259
  $metadata: deserializeMetadata(output),
263
- ConnectionCredentials: undefined,
264
- Websocket: undefined,
265
- };
260
+ });
266
261
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
267
- if (data.ConnectionCredentials !== undefined && data.ConnectionCredentials !== null) {
262
+ if (data.ConnectionCredentials != null) {
268
263
  contents.ConnectionCredentials = deserializeAws_restJson1ConnectionCredentials(data.ConnectionCredentials, context);
269
264
  }
270
- if (data.Websocket !== undefined && data.Websocket !== null) {
265
+ if (data.Websocket != null) {
271
266
  contents.Websocket = deserializeAws_restJson1Websocket(data.Websocket, context);
272
267
  }
273
- return Promise.resolve(contents);
268
+ return contents;
274
269
  };
275
270
  exports.deserializeAws_restJson1CreateParticipantConnectionCommand = deserializeAws_restJson1CreateParticipantConnectionCommand;
276
271
  const deserializeAws_restJson1CreateParticipantConnectionCommandError = async (output, context) => {
@@ -278,7 +273,6 @@ const deserializeAws_restJson1CreateParticipantConnectionCommandError = async (o
278
273
  ...output,
279
274
  body: await parseBody(output.body, context),
280
275
  };
281
- let response;
282
276
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
283
277
  switch (errorCode) {
284
278
  case "AccessDeniedException":
@@ -295,25 +289,23 @@ const deserializeAws_restJson1CreateParticipantConnectionCommandError = async (o
295
289
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
296
290
  default:
297
291
  const parsedBody = parsedOutput.body;
298
- const $metadata = deserializeMetadata(output);
299
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
300
- response = new ConnectParticipantServiceException_1.ConnectParticipantServiceException({
301
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
302
- $fault: "client",
303
- $metadata,
292
+ (0, smithy_client_1.throwDefaultError)({
293
+ output,
294
+ parsedBody,
295
+ exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
296
+ errorCode,
304
297
  });
305
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
306
298
  }
307
299
  };
308
300
  const deserializeAws_restJson1DisconnectParticipantCommand = async (output, context) => {
309
301
  if (output.statusCode !== 200 && output.statusCode >= 300) {
310
302
  return deserializeAws_restJson1DisconnectParticipantCommandError(output, context);
311
303
  }
312
- const contents = {
304
+ const contents = map({
313
305
  $metadata: deserializeMetadata(output),
314
- };
306
+ });
315
307
  await collectBody(output.body, context);
316
- return Promise.resolve(contents);
308
+ return contents;
317
309
  };
318
310
  exports.deserializeAws_restJson1DisconnectParticipantCommand = deserializeAws_restJson1DisconnectParticipantCommand;
319
311
  const deserializeAws_restJson1DisconnectParticipantCommandError = async (output, context) => {
@@ -321,7 +313,6 @@ const deserializeAws_restJson1DisconnectParticipantCommandError = async (output,
321
313
  ...output,
322
314
  body: await parseBody(output.body, context),
323
315
  };
324
- let response;
325
316
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
326
317
  switch (errorCode) {
327
318
  case "AccessDeniedException":
@@ -338,33 +329,29 @@ const deserializeAws_restJson1DisconnectParticipantCommandError = async (output,
338
329
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
339
330
  default:
340
331
  const parsedBody = parsedOutput.body;
341
- const $metadata = deserializeMetadata(output);
342
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
343
- response = new ConnectParticipantServiceException_1.ConnectParticipantServiceException({
344
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
345
- $fault: "client",
346
- $metadata,
332
+ (0, smithy_client_1.throwDefaultError)({
333
+ output,
334
+ parsedBody,
335
+ exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
336
+ errorCode,
347
337
  });
348
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
349
338
  }
350
339
  };
351
340
  const deserializeAws_restJson1GetAttachmentCommand = async (output, context) => {
352
341
  if (output.statusCode !== 200 && output.statusCode >= 300) {
353
342
  return deserializeAws_restJson1GetAttachmentCommandError(output, context);
354
343
  }
355
- const contents = {
344
+ const contents = map({
356
345
  $metadata: deserializeMetadata(output),
357
- Url: undefined,
358
- UrlExpiry: undefined,
359
- };
346
+ });
360
347
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
361
- if (data.Url !== undefined && data.Url !== null) {
348
+ if (data.Url != null) {
362
349
  contents.Url = (0, smithy_client_1.expectString)(data.Url);
363
350
  }
364
- if (data.UrlExpiry !== undefined && data.UrlExpiry !== null) {
351
+ if (data.UrlExpiry != null) {
365
352
  contents.UrlExpiry = (0, smithy_client_1.expectString)(data.UrlExpiry);
366
353
  }
367
- return Promise.resolve(contents);
354
+ return contents;
368
355
  };
369
356
  exports.deserializeAws_restJson1GetAttachmentCommand = deserializeAws_restJson1GetAttachmentCommand;
370
357
  const deserializeAws_restJson1GetAttachmentCommandError = async (output, context) => {
@@ -372,7 +359,6 @@ const deserializeAws_restJson1GetAttachmentCommandError = async (output, context
372
359
  ...output,
373
360
  body: await parseBody(output.body, context),
374
361
  };
375
- let response;
376
362
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
377
363
  switch (errorCode) {
378
364
  case "AccessDeniedException":
@@ -389,37 +375,32 @@ const deserializeAws_restJson1GetAttachmentCommandError = async (output, context
389
375
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
390
376
  default:
391
377
  const parsedBody = parsedOutput.body;
392
- const $metadata = deserializeMetadata(output);
393
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
394
- response = new ConnectParticipantServiceException_1.ConnectParticipantServiceException({
395
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
396
- $fault: "client",
397
- $metadata,
378
+ (0, smithy_client_1.throwDefaultError)({
379
+ output,
380
+ parsedBody,
381
+ exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
382
+ errorCode,
398
383
  });
399
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
400
384
  }
401
385
  };
402
386
  const deserializeAws_restJson1GetTranscriptCommand = async (output, context) => {
403
387
  if (output.statusCode !== 200 && output.statusCode >= 300) {
404
388
  return deserializeAws_restJson1GetTranscriptCommandError(output, context);
405
389
  }
406
- const contents = {
390
+ const contents = map({
407
391
  $metadata: deserializeMetadata(output),
408
- InitialContactId: undefined,
409
- NextToken: undefined,
410
- Transcript: undefined,
411
- };
392
+ });
412
393
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
413
- if (data.InitialContactId !== undefined && data.InitialContactId !== null) {
394
+ if (data.InitialContactId != null) {
414
395
  contents.InitialContactId = (0, smithy_client_1.expectString)(data.InitialContactId);
415
396
  }
416
- if (data.NextToken !== undefined && data.NextToken !== null) {
397
+ if (data.NextToken != null) {
417
398
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
418
399
  }
419
- if (data.Transcript !== undefined && data.Transcript !== null) {
400
+ if (data.Transcript != null) {
420
401
  contents.Transcript = deserializeAws_restJson1Transcript(data.Transcript, context);
421
402
  }
422
- return Promise.resolve(contents);
403
+ return contents;
423
404
  };
424
405
  exports.deserializeAws_restJson1GetTranscriptCommand = deserializeAws_restJson1GetTranscriptCommand;
425
406
  const deserializeAws_restJson1GetTranscriptCommandError = async (output, context) => {
@@ -427,7 +408,6 @@ const deserializeAws_restJson1GetTranscriptCommandError = async (output, context
427
408
  ...output,
428
409
  body: await parseBody(output.body, context),
429
410
  };
430
- let response;
431
411
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
432
412
  switch (errorCode) {
433
413
  case "AccessDeniedException":
@@ -444,33 +424,29 @@ const deserializeAws_restJson1GetTranscriptCommandError = async (output, context
444
424
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
445
425
  default:
446
426
  const parsedBody = parsedOutput.body;
447
- const $metadata = deserializeMetadata(output);
448
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
449
- response = new ConnectParticipantServiceException_1.ConnectParticipantServiceException({
450
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
451
- $fault: "client",
452
- $metadata,
427
+ (0, smithy_client_1.throwDefaultError)({
428
+ output,
429
+ parsedBody,
430
+ exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
431
+ errorCode,
453
432
  });
454
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
455
433
  }
456
434
  };
457
435
  const deserializeAws_restJson1SendEventCommand = async (output, context) => {
458
436
  if (output.statusCode !== 200 && output.statusCode >= 300) {
459
437
  return deserializeAws_restJson1SendEventCommandError(output, context);
460
438
  }
461
- const contents = {
439
+ const contents = map({
462
440
  $metadata: deserializeMetadata(output),
463
- AbsoluteTime: undefined,
464
- Id: undefined,
465
- };
441
+ });
466
442
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
467
- if (data.AbsoluteTime !== undefined && data.AbsoluteTime !== null) {
443
+ if (data.AbsoluteTime != null) {
468
444
  contents.AbsoluteTime = (0, smithy_client_1.expectString)(data.AbsoluteTime);
469
445
  }
470
- if (data.Id !== undefined && data.Id !== null) {
446
+ if (data.Id != null) {
471
447
  contents.Id = (0, smithy_client_1.expectString)(data.Id);
472
448
  }
473
- return Promise.resolve(contents);
449
+ return contents;
474
450
  };
475
451
  exports.deserializeAws_restJson1SendEventCommand = deserializeAws_restJson1SendEventCommand;
476
452
  const deserializeAws_restJson1SendEventCommandError = async (output, context) => {
@@ -478,7 +454,6 @@ const deserializeAws_restJson1SendEventCommandError = async (output, context) =>
478
454
  ...output,
479
455
  body: await parseBody(output.body, context),
480
456
  };
481
- let response;
482
457
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
483
458
  switch (errorCode) {
484
459
  case "AccessDeniedException":
@@ -495,33 +470,29 @@ const deserializeAws_restJson1SendEventCommandError = async (output, context) =>
495
470
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
496
471
  default:
497
472
  const parsedBody = parsedOutput.body;
498
- const $metadata = deserializeMetadata(output);
499
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
500
- response = new ConnectParticipantServiceException_1.ConnectParticipantServiceException({
501
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
502
- $fault: "client",
503
- $metadata,
473
+ (0, smithy_client_1.throwDefaultError)({
474
+ output,
475
+ parsedBody,
476
+ exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
477
+ errorCode,
504
478
  });
505
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
506
479
  }
507
480
  };
508
481
  const deserializeAws_restJson1SendMessageCommand = async (output, context) => {
509
482
  if (output.statusCode !== 200 && output.statusCode >= 300) {
510
483
  return deserializeAws_restJson1SendMessageCommandError(output, context);
511
484
  }
512
- const contents = {
485
+ const contents = map({
513
486
  $metadata: deserializeMetadata(output),
514
- AbsoluteTime: undefined,
515
- Id: undefined,
516
- };
487
+ });
517
488
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
518
- if (data.AbsoluteTime !== undefined && data.AbsoluteTime !== null) {
489
+ if (data.AbsoluteTime != null) {
519
490
  contents.AbsoluteTime = (0, smithy_client_1.expectString)(data.AbsoluteTime);
520
491
  }
521
- if (data.Id !== undefined && data.Id !== null) {
492
+ if (data.Id != null) {
522
493
  contents.Id = (0, smithy_client_1.expectString)(data.Id);
523
494
  }
524
- return Promise.resolve(contents);
495
+ return contents;
525
496
  };
526
497
  exports.deserializeAws_restJson1SendMessageCommand = deserializeAws_restJson1SendMessageCommand;
527
498
  const deserializeAws_restJson1SendMessageCommandError = async (output, context) => {
@@ -529,7 +500,6 @@ const deserializeAws_restJson1SendMessageCommandError = async (output, context)
529
500
  ...output,
530
501
  body: await parseBody(output.body, context),
531
502
  };
532
- let response;
533
503
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
534
504
  switch (errorCode) {
535
505
  case "AccessDeniedException":
@@ -546,33 +516,29 @@ const deserializeAws_restJson1SendMessageCommandError = async (output, context)
546
516
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
547
517
  default:
548
518
  const parsedBody = parsedOutput.body;
549
- const $metadata = deserializeMetadata(output);
550
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
551
- response = new ConnectParticipantServiceException_1.ConnectParticipantServiceException({
552
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
553
- $fault: "client",
554
- $metadata,
519
+ (0, smithy_client_1.throwDefaultError)({
520
+ output,
521
+ parsedBody,
522
+ exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
523
+ errorCode,
555
524
  });
556
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
557
525
  }
558
526
  };
559
527
  const deserializeAws_restJson1StartAttachmentUploadCommand = async (output, context) => {
560
528
  if (output.statusCode !== 200 && output.statusCode >= 300) {
561
529
  return deserializeAws_restJson1StartAttachmentUploadCommandError(output, context);
562
530
  }
563
- const contents = {
531
+ const contents = map({
564
532
  $metadata: deserializeMetadata(output),
565
- AttachmentId: undefined,
566
- UploadMetadata: undefined,
567
- };
533
+ });
568
534
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
569
- if (data.AttachmentId !== undefined && data.AttachmentId !== null) {
535
+ if (data.AttachmentId != null) {
570
536
  contents.AttachmentId = (0, smithy_client_1.expectString)(data.AttachmentId);
571
537
  }
572
- if (data.UploadMetadata !== undefined && data.UploadMetadata !== null) {
538
+ if (data.UploadMetadata != null) {
573
539
  contents.UploadMetadata = deserializeAws_restJson1UploadMetadata(data.UploadMetadata, context);
574
540
  }
575
- return Promise.resolve(contents);
541
+ return contents;
576
542
  };
577
543
  exports.deserializeAws_restJson1StartAttachmentUploadCommand = deserializeAws_restJson1StartAttachmentUploadCommand;
578
544
  const deserializeAws_restJson1StartAttachmentUploadCommandError = async (output, context) => {
@@ -580,7 +546,6 @@ const deserializeAws_restJson1StartAttachmentUploadCommandError = async (output,
580
546
  ...output,
581
547
  body: await parseBody(output.body, context),
582
548
  };
583
- let response;
584
549
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
585
550
  switch (errorCode) {
586
551
  case "AccessDeniedException":
@@ -600,20 +565,19 @@ const deserializeAws_restJson1StartAttachmentUploadCommandError = async (output,
600
565
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
601
566
  default:
602
567
  const parsedBody = parsedOutput.body;
603
- const $metadata = deserializeMetadata(output);
604
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
605
- response = new ConnectParticipantServiceException_1.ConnectParticipantServiceException({
606
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
607
- $fault: "client",
608
- $metadata,
568
+ (0, smithy_client_1.throwDefaultError)({
569
+ output,
570
+ parsedBody,
571
+ exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
572
+ errorCode,
609
573
  });
610
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
611
574
  }
612
575
  };
576
+ const map = smithy_client_1.map;
613
577
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
614
- const contents = {};
578
+ const contents = map({});
615
579
  const data = parsedOutput.body;
616
- if (data.Message !== undefined && data.Message !== null) {
580
+ if (data.Message != null) {
617
581
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
618
582
  }
619
583
  const exception = new models_0_1.AccessDeniedException({
@@ -623,9 +587,9 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
623
587
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
624
588
  };
625
589
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
626
- const contents = {};
590
+ const contents = map({});
627
591
  const data = parsedOutput.body;
628
- if (data.Message !== undefined && data.Message !== null) {
592
+ if (data.Message != null) {
629
593
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
630
594
  }
631
595
  const exception = new models_0_1.ConflictException({
@@ -635,9 +599,9 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
635
599
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
636
600
  };
637
601
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
638
- const contents = {};
602
+ const contents = map({});
639
603
  const data = parsedOutput.body;
640
- if (data.Message !== undefined && data.Message !== null) {
604
+ if (data.Message != null) {
641
605
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
642
606
  }
643
607
  const exception = new models_0_1.InternalServerException({
@@ -647,9 +611,9 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
647
611
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
648
612
  };
649
613
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
650
- const contents = {};
614
+ const contents = map({});
651
615
  const data = parsedOutput.body;
652
- if (data.Message !== undefined && data.Message !== null) {
616
+ if (data.Message != null) {
653
617
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
654
618
  }
655
619
  const exception = new models_0_1.ServiceQuotaExceededException({
@@ -659,9 +623,9 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
659
623
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
660
624
  };
661
625
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
662
- const contents = {};
626
+ const contents = map({});
663
627
  const data = parsedOutput.body;
664
- if (data.Message !== undefined && data.Message !== null) {
628
+ if (data.Message != null) {
665
629
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
666
630
  }
667
631
  const exception = new models_0_1.ThrottlingException({
@@ -671,9 +635,9 @@ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput,
671
635
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
672
636
  };
673
637
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
674
- const contents = {};
638
+ const contents = map({});
675
639
  const data = parsedOutput.body;
676
- if (data.Message !== undefined && data.Message !== null) {
640
+ if (data.Message != null) {
677
641
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
678
642
  }
679
643
  const exception = new models_0_1.ValidationException({
@@ -686,9 +650,6 @@ const serializeAws_restJson1AttachmentIdList = (input, context) => {
686
650
  return input
687
651
  .filter((e) => e != null)
688
652
  .map((entry) => {
689
- if (entry === null) {
690
- return null;
691
- }
692
653
  return entry;
693
654
  });
694
655
  };
@@ -696,9 +657,6 @@ const serializeAws_restJson1ConnectionTypeList = (input, context) => {
696
657
  return input
697
658
  .filter((e) => e != null)
698
659
  .map((entry) => {
699
- if (entry === null) {
700
- return null;
701
- }
702
660
  return entry;
703
661
  });
704
662
  };