@aws-sdk/client-chime-sdk-messaging 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.
@@ -9,21 +9,12 @@ const ChimeSDKMessagingServiceException_1 = require("../models/ChimeSDKMessaging
9
9
  const models_0_1 = require("../models/models_0");
10
10
  const serializeAws_restJson1AssociateChannelFlowCommand = async (input, context) => {
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.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
15
- };
14
+ "x-amz-chime-bearer": input.ChimeBearer,
15
+ });
16
16
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/channel-flow";
17
- if (input.ChannelArn !== undefined) {
18
- const labelValue = input.ChannelArn;
19
- if (labelValue.length <= 0) {
20
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
21
- }
22
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
23
- }
24
- else {
25
- throw new Error("No value provided for input HTTP label: ChannelArn.");
26
- }
17
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
27
18
  let body;
28
19
  body = JSON.stringify({
29
20
  ...(input.ChannelFlowArn != null && { ChannelFlowArn: input.ChannelFlowArn }),
@@ -41,24 +32,15 @@ const serializeAws_restJson1AssociateChannelFlowCommand = async (input, context)
41
32
  exports.serializeAws_restJson1AssociateChannelFlowCommand = serializeAws_restJson1AssociateChannelFlowCommand;
42
33
  const serializeAws_restJson1BatchCreateChannelMembershipCommand = async (input, context) => {
43
34
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
44
- const headers = {
35
+ const headers = map({}, isSerializableHeaderValue, {
45
36
  "content-type": "application/json",
46
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
47
- };
37
+ "x-amz-chime-bearer": input.ChimeBearer,
38
+ });
48
39
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/memberships";
49
- if (input.ChannelArn !== undefined) {
50
- const labelValue = input.ChannelArn;
51
- if (labelValue.length <= 0) {
52
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
53
- }
54
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
55
- }
56
- else {
57
- throw new Error("No value provided for input HTTP label: ChannelArn.");
58
- }
59
- const query = {
60
- operation: "batch-create",
61
- };
40
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
41
+ const query = map({
42
+ operation: [, "batch-create"],
43
+ });
62
44
  let body;
63
45
  body = JSON.stringify({
64
46
  ...(input.MemberArns != null && { MemberArns: serializeAws_restJson1MemberArns(input.MemberArns, context) }),
@@ -83,19 +65,10 @@ const serializeAws_restJson1ChannelFlowCallbackCommand = async (input, context)
83
65
  "content-type": "application/json",
84
66
  };
85
67
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}";
86
- if (input.ChannelArn !== undefined) {
87
- const labelValue = input.ChannelArn;
88
- if (labelValue.length <= 0) {
89
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
90
- }
91
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
92
- }
93
- else {
94
- throw new Error("No value provided for input HTTP label: ChannelArn.");
95
- }
96
- const query = {
97
- operation: "channel-flow-callback",
98
- };
68
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
69
+ const query = map({
70
+ operation: [, "channel-flow-callback"],
71
+ });
99
72
  let body;
100
73
  body = JSON.stringify({
101
74
  CallbackId: (_a = input.CallbackId) !== null && _a !== void 0 ? _a : (0, uuid_1.v4)(),
@@ -119,10 +92,10 @@ exports.serializeAws_restJson1ChannelFlowCallbackCommand = serializeAws_restJson
119
92
  const serializeAws_restJson1CreateChannelCommand = async (input, context) => {
120
93
  var _a;
121
94
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
122
- const headers = {
95
+ const headers = map({}, isSerializableHeaderValue, {
123
96
  "content-type": "application/json",
124
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
125
- };
97
+ "x-amz-chime-bearer": input.ChimeBearer,
98
+ });
126
99
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels";
127
100
  let body;
128
101
  body = JSON.stringify({
@@ -152,21 +125,12 @@ const serializeAws_restJson1CreateChannelCommand = async (input, context) => {
152
125
  exports.serializeAws_restJson1CreateChannelCommand = serializeAws_restJson1CreateChannelCommand;
153
126
  const serializeAws_restJson1CreateChannelBanCommand = async (input, context) => {
154
127
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
155
- const headers = {
128
+ const headers = map({}, isSerializableHeaderValue, {
156
129
  "content-type": "application/json",
157
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
158
- };
130
+ "x-amz-chime-bearer": input.ChimeBearer,
131
+ });
159
132
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/bans";
160
- if (input.ChannelArn !== undefined) {
161
- const labelValue = input.ChannelArn;
162
- if (labelValue.length <= 0) {
163
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
164
- }
165
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
166
- }
167
- else {
168
- throw new Error("No value provided for input HTTP label: ChannelArn.");
169
- }
133
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
170
134
  let body;
171
135
  body = JSON.stringify({
172
136
  ...(input.MemberArn != null && { MemberArn: input.MemberArn }),
@@ -209,21 +173,12 @@ const serializeAws_restJson1CreateChannelFlowCommand = async (input, context) =>
209
173
  exports.serializeAws_restJson1CreateChannelFlowCommand = serializeAws_restJson1CreateChannelFlowCommand;
210
174
  const serializeAws_restJson1CreateChannelMembershipCommand = async (input, context) => {
211
175
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
212
- const headers = {
176
+ const headers = map({}, isSerializableHeaderValue, {
213
177
  "content-type": "application/json",
214
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
215
- };
178
+ "x-amz-chime-bearer": input.ChimeBearer,
179
+ });
216
180
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/memberships";
217
- if (input.ChannelArn !== undefined) {
218
- const labelValue = input.ChannelArn;
219
- if (labelValue.length <= 0) {
220
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
221
- }
222
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
223
- }
224
- else {
225
- throw new Error("No value provided for input HTTP label: ChannelArn.");
226
- }
181
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
227
182
  let body;
228
183
  body = JSON.stringify({
229
184
  ...(input.MemberArn != null && { MemberArn: input.MemberArn }),
@@ -242,21 +197,12 @@ const serializeAws_restJson1CreateChannelMembershipCommand = async (input, conte
242
197
  exports.serializeAws_restJson1CreateChannelMembershipCommand = serializeAws_restJson1CreateChannelMembershipCommand;
243
198
  const serializeAws_restJson1CreateChannelModeratorCommand = async (input, context) => {
244
199
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
245
- const headers = {
200
+ const headers = map({}, isSerializableHeaderValue, {
246
201
  "content-type": "application/json",
247
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
248
- };
202
+ "x-amz-chime-bearer": input.ChimeBearer,
203
+ });
249
204
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/moderators";
250
- if (input.ChannelArn !== undefined) {
251
- const labelValue = input.ChannelArn;
252
- if (labelValue.length <= 0) {
253
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
254
- }
255
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
256
- }
257
- else {
258
- throw new Error("No value provided for input HTTP label: ChannelArn.");
259
- }
205
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
260
206
  let body;
261
207
  body = JSON.stringify({
262
208
  ...(input.ChannelModeratorArn != null && { ChannelModeratorArn: input.ChannelModeratorArn }),
@@ -274,20 +220,11 @@ const serializeAws_restJson1CreateChannelModeratorCommand = async (input, contex
274
220
  exports.serializeAws_restJson1CreateChannelModeratorCommand = serializeAws_restJson1CreateChannelModeratorCommand;
275
221
  const serializeAws_restJson1DeleteChannelCommand = async (input, context) => {
276
222
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
277
- const headers = {
278
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
279
- };
223
+ const headers = map({}, isSerializableHeaderValue, {
224
+ "x-amz-chime-bearer": input.ChimeBearer,
225
+ });
280
226
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}";
281
- if (input.ChannelArn !== undefined) {
282
- const labelValue = input.ChannelArn;
283
- if (labelValue.length <= 0) {
284
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
285
- }
286
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
287
- }
288
- else {
289
- throw new Error("No value provided for input HTTP label: ChannelArn.");
290
- }
227
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
291
228
  let body;
292
229
  return new protocol_http_1.HttpRequest({
293
230
  protocol,
@@ -302,30 +239,12 @@ const serializeAws_restJson1DeleteChannelCommand = async (input, context) => {
302
239
  exports.serializeAws_restJson1DeleteChannelCommand = serializeAws_restJson1DeleteChannelCommand;
303
240
  const serializeAws_restJson1DeleteChannelBanCommand = async (input, context) => {
304
241
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
305
- const headers = {
306
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
307
- };
242
+ const headers = map({}, isSerializableHeaderValue, {
243
+ "x-amz-chime-bearer": input.ChimeBearer,
244
+ });
308
245
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/bans/{MemberArn}";
309
- if (input.ChannelArn !== undefined) {
310
- const labelValue = input.ChannelArn;
311
- if (labelValue.length <= 0) {
312
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
313
- }
314
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
315
- }
316
- else {
317
- throw new Error("No value provided for input HTTP label: ChannelArn.");
318
- }
319
- if (input.MemberArn !== undefined) {
320
- const labelValue = input.MemberArn;
321
- if (labelValue.length <= 0) {
322
- throw new Error("Empty value provided for input HTTP label: MemberArn.");
323
- }
324
- resolvedPath = resolvedPath.replace("{MemberArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
325
- }
326
- else {
327
- throw new Error("No value provided for input HTTP label: MemberArn.");
328
- }
246
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
247
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "MemberArn", () => input.MemberArn, "{MemberArn}", false);
329
248
  let body;
330
249
  return new protocol_http_1.HttpRequest({
331
250
  protocol,
@@ -342,16 +261,7 @@ const serializeAws_restJson1DeleteChannelFlowCommand = async (input, context) =>
342
261
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
343
262
  const headers = {};
344
263
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channel-flows/{ChannelFlowArn}";
345
- if (input.ChannelFlowArn !== undefined) {
346
- const labelValue = input.ChannelFlowArn;
347
- if (labelValue.length <= 0) {
348
- throw new Error("Empty value provided for input HTTP label: ChannelFlowArn.");
349
- }
350
- resolvedPath = resolvedPath.replace("{ChannelFlowArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
351
- }
352
- else {
353
- throw new Error("No value provided for input HTTP label: ChannelFlowArn.");
354
- }
264
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelFlowArn", () => input.ChannelFlowArn, "{ChannelFlowArn}", false);
355
265
  let body;
356
266
  return new protocol_http_1.HttpRequest({
357
267
  protocol,
@@ -366,31 +276,13 @@ const serializeAws_restJson1DeleteChannelFlowCommand = async (input, context) =>
366
276
  exports.serializeAws_restJson1DeleteChannelFlowCommand = serializeAws_restJson1DeleteChannelFlowCommand;
367
277
  const serializeAws_restJson1DeleteChannelMembershipCommand = async (input, context) => {
368
278
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
369
- const headers = {
370
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
371
- };
279
+ const headers = map({}, isSerializableHeaderValue, {
280
+ "x-amz-chime-bearer": input.ChimeBearer,
281
+ });
372
282
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
373
283
  "/channels/{ChannelArn}/memberships/{MemberArn}";
374
- if (input.ChannelArn !== undefined) {
375
- const labelValue = input.ChannelArn;
376
- if (labelValue.length <= 0) {
377
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
378
- }
379
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
380
- }
381
- else {
382
- throw new Error("No value provided for input HTTP label: ChannelArn.");
383
- }
384
- if (input.MemberArn !== undefined) {
385
- const labelValue = input.MemberArn;
386
- if (labelValue.length <= 0) {
387
- throw new Error("Empty value provided for input HTTP label: MemberArn.");
388
- }
389
- resolvedPath = resolvedPath.replace("{MemberArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
390
- }
391
- else {
392
- throw new Error("No value provided for input HTTP label: MemberArn.");
393
- }
284
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
285
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "MemberArn", () => input.MemberArn, "{MemberArn}", false);
394
286
  let body;
395
287
  return new protocol_http_1.HttpRequest({
396
288
  protocol,
@@ -405,31 +297,13 @@ const serializeAws_restJson1DeleteChannelMembershipCommand = async (input, conte
405
297
  exports.serializeAws_restJson1DeleteChannelMembershipCommand = serializeAws_restJson1DeleteChannelMembershipCommand;
406
298
  const serializeAws_restJson1DeleteChannelMessageCommand = async (input, context) => {
407
299
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
408
- const headers = {
409
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
410
- };
300
+ const headers = map({}, isSerializableHeaderValue, {
301
+ "x-amz-chime-bearer": input.ChimeBearer,
302
+ });
411
303
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
412
304
  "/channels/{ChannelArn}/messages/{MessageId}";
413
- if (input.ChannelArn !== undefined) {
414
- const labelValue = input.ChannelArn;
415
- if (labelValue.length <= 0) {
416
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
417
- }
418
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
419
- }
420
- else {
421
- throw new Error("No value provided for input HTTP label: ChannelArn.");
422
- }
423
- if (input.MessageId !== undefined) {
424
- const labelValue = input.MessageId;
425
- if (labelValue.length <= 0) {
426
- throw new Error("Empty value provided for input HTTP label: MessageId.");
427
- }
428
- resolvedPath = resolvedPath.replace("{MessageId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
429
- }
430
- else {
431
- throw new Error("No value provided for input HTTP label: MessageId.");
432
- }
305
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
306
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "MessageId", () => input.MessageId, "{MessageId}", false);
433
307
  let body;
434
308
  return new protocol_http_1.HttpRequest({
435
309
  protocol,
@@ -444,31 +318,13 @@ const serializeAws_restJson1DeleteChannelMessageCommand = async (input, context)
444
318
  exports.serializeAws_restJson1DeleteChannelMessageCommand = serializeAws_restJson1DeleteChannelMessageCommand;
445
319
  const serializeAws_restJson1DeleteChannelModeratorCommand = async (input, context) => {
446
320
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
447
- const headers = {
448
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
449
- };
321
+ const headers = map({}, isSerializableHeaderValue, {
322
+ "x-amz-chime-bearer": input.ChimeBearer,
323
+ });
450
324
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
451
325
  "/channels/{ChannelArn}/moderators/{ChannelModeratorArn}";
452
- if (input.ChannelArn !== undefined) {
453
- const labelValue = input.ChannelArn;
454
- if (labelValue.length <= 0) {
455
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
456
- }
457
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
458
- }
459
- else {
460
- throw new Error("No value provided for input HTTP label: ChannelArn.");
461
- }
462
- if (input.ChannelModeratorArn !== undefined) {
463
- const labelValue = input.ChannelModeratorArn;
464
- if (labelValue.length <= 0) {
465
- throw new Error("Empty value provided for input HTTP label: ChannelModeratorArn.");
466
- }
467
- resolvedPath = resolvedPath.replace("{ChannelModeratorArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
468
- }
469
- else {
470
- throw new Error("No value provided for input HTTP label: ChannelModeratorArn.");
471
- }
326
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
327
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelModeratorArn", () => input.ChannelModeratorArn, "{ChannelModeratorArn}", false);
472
328
  let body;
473
329
  return new protocol_http_1.HttpRequest({
474
330
  protocol,
@@ -483,20 +339,11 @@ const serializeAws_restJson1DeleteChannelModeratorCommand = async (input, contex
483
339
  exports.serializeAws_restJson1DeleteChannelModeratorCommand = serializeAws_restJson1DeleteChannelModeratorCommand;
484
340
  const serializeAws_restJson1DescribeChannelCommand = async (input, context) => {
485
341
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
486
- const headers = {
487
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
488
- };
342
+ const headers = map({}, isSerializableHeaderValue, {
343
+ "x-amz-chime-bearer": input.ChimeBearer,
344
+ });
489
345
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}";
490
- if (input.ChannelArn !== undefined) {
491
- const labelValue = input.ChannelArn;
492
- if (labelValue.length <= 0) {
493
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
494
- }
495
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
496
- }
497
- else {
498
- throw new Error("No value provided for input HTTP label: ChannelArn.");
499
- }
346
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
500
347
  let body;
501
348
  return new protocol_http_1.HttpRequest({
502
349
  protocol,
@@ -511,30 +358,12 @@ const serializeAws_restJson1DescribeChannelCommand = async (input, context) => {
511
358
  exports.serializeAws_restJson1DescribeChannelCommand = serializeAws_restJson1DescribeChannelCommand;
512
359
  const serializeAws_restJson1DescribeChannelBanCommand = async (input, context) => {
513
360
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
514
- const headers = {
515
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
516
- };
361
+ const headers = map({}, isSerializableHeaderValue, {
362
+ "x-amz-chime-bearer": input.ChimeBearer,
363
+ });
517
364
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/bans/{MemberArn}";
518
- if (input.ChannelArn !== undefined) {
519
- const labelValue = input.ChannelArn;
520
- if (labelValue.length <= 0) {
521
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
522
- }
523
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
524
- }
525
- else {
526
- throw new Error("No value provided for input HTTP label: ChannelArn.");
527
- }
528
- if (input.MemberArn !== undefined) {
529
- const labelValue = input.MemberArn;
530
- if (labelValue.length <= 0) {
531
- throw new Error("Empty value provided for input HTTP label: MemberArn.");
532
- }
533
- resolvedPath = resolvedPath.replace("{MemberArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
534
- }
535
- else {
536
- throw new Error("No value provided for input HTTP label: MemberArn.");
537
- }
365
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
366
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "MemberArn", () => input.MemberArn, "{MemberArn}", false);
538
367
  let body;
539
368
  return new protocol_http_1.HttpRequest({
540
369
  protocol,
@@ -551,16 +380,7 @@ const serializeAws_restJson1DescribeChannelFlowCommand = async (input, context)
551
380
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
552
381
  const headers = {};
553
382
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channel-flows/{ChannelFlowArn}";
554
- if (input.ChannelFlowArn !== undefined) {
555
- const labelValue = input.ChannelFlowArn;
556
- if (labelValue.length <= 0) {
557
- throw new Error("Empty value provided for input HTTP label: ChannelFlowArn.");
558
- }
559
- resolvedPath = resolvedPath.replace("{ChannelFlowArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
560
- }
561
- else {
562
- throw new Error("No value provided for input HTTP label: ChannelFlowArn.");
563
- }
383
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelFlowArn", () => input.ChannelFlowArn, "{ChannelFlowArn}", false);
564
384
  let body;
565
385
  return new protocol_http_1.HttpRequest({
566
386
  protocol,
@@ -575,31 +395,13 @@ const serializeAws_restJson1DescribeChannelFlowCommand = async (input, context)
575
395
  exports.serializeAws_restJson1DescribeChannelFlowCommand = serializeAws_restJson1DescribeChannelFlowCommand;
576
396
  const serializeAws_restJson1DescribeChannelMembershipCommand = async (input, context) => {
577
397
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
578
- const headers = {
579
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
580
- };
398
+ const headers = map({}, isSerializableHeaderValue, {
399
+ "x-amz-chime-bearer": input.ChimeBearer,
400
+ });
581
401
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
582
402
  "/channels/{ChannelArn}/memberships/{MemberArn}";
583
- if (input.ChannelArn !== undefined) {
584
- const labelValue = input.ChannelArn;
585
- if (labelValue.length <= 0) {
586
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
587
- }
588
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
589
- }
590
- else {
591
- throw new Error("No value provided for input HTTP label: ChannelArn.");
592
- }
593
- if (input.MemberArn !== undefined) {
594
- const labelValue = input.MemberArn;
595
- if (labelValue.length <= 0) {
596
- throw new Error("Empty value provided for input HTTP label: MemberArn.");
597
- }
598
- resolvedPath = resolvedPath.replace("{MemberArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
599
- }
600
- else {
601
- throw new Error("No value provided for input HTTP label: MemberArn.");
602
- }
403
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
404
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "MemberArn", () => input.MemberArn, "{MemberArn}", false);
603
405
  let body;
604
406
  return new protocol_http_1.HttpRequest({
605
407
  protocol,
@@ -614,24 +416,15 @@ const serializeAws_restJson1DescribeChannelMembershipCommand = async (input, con
614
416
  exports.serializeAws_restJson1DescribeChannelMembershipCommand = serializeAws_restJson1DescribeChannelMembershipCommand;
615
417
  const serializeAws_restJson1DescribeChannelMembershipForAppInstanceUserCommand = async (input, context) => {
616
418
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
617
- const headers = {
618
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
619
- };
419
+ const headers = map({}, isSerializableHeaderValue, {
420
+ "x-amz-chime-bearer": input.ChimeBearer,
421
+ });
620
422
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}";
621
- if (input.ChannelArn !== undefined) {
622
- const labelValue = input.ChannelArn;
623
- if (labelValue.length <= 0) {
624
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
625
- }
626
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
627
- }
628
- else {
629
- throw new Error("No value provided for input HTTP label: ChannelArn.");
630
- }
631
- const query = {
632
- scope: "app-instance-user-membership",
633
- ...(input.AppInstanceUserArn !== undefined && { "app-instance-user-arn": input.AppInstanceUserArn }),
634
- };
423
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
424
+ const query = map({
425
+ scope: [, "app-instance-user-membership"],
426
+ "app-instance-user-arn": [, input.AppInstanceUserArn],
427
+ });
635
428
  let body;
636
429
  return new protocol_http_1.HttpRequest({
637
430
  protocol,
@@ -647,24 +440,15 @@ const serializeAws_restJson1DescribeChannelMembershipForAppInstanceUserCommand =
647
440
  exports.serializeAws_restJson1DescribeChannelMembershipForAppInstanceUserCommand = serializeAws_restJson1DescribeChannelMembershipForAppInstanceUserCommand;
648
441
  const serializeAws_restJson1DescribeChannelModeratedByAppInstanceUserCommand = async (input, context) => {
649
442
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
650
- const headers = {
651
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
652
- };
443
+ const headers = map({}, isSerializableHeaderValue, {
444
+ "x-amz-chime-bearer": input.ChimeBearer,
445
+ });
653
446
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}";
654
- if (input.ChannelArn !== undefined) {
655
- const labelValue = input.ChannelArn;
656
- if (labelValue.length <= 0) {
657
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
658
- }
659
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
660
- }
661
- else {
662
- throw new Error("No value provided for input HTTP label: ChannelArn.");
663
- }
664
- const query = {
665
- scope: "app-instance-user-moderated-channel",
666
- ...(input.AppInstanceUserArn !== undefined && { "app-instance-user-arn": input.AppInstanceUserArn }),
667
- };
447
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
448
+ const query = map({
449
+ scope: [, "app-instance-user-moderated-channel"],
450
+ "app-instance-user-arn": [, input.AppInstanceUserArn],
451
+ });
668
452
  let body;
669
453
  return new protocol_http_1.HttpRequest({
670
454
  protocol,
@@ -680,31 +464,13 @@ const serializeAws_restJson1DescribeChannelModeratedByAppInstanceUserCommand = a
680
464
  exports.serializeAws_restJson1DescribeChannelModeratedByAppInstanceUserCommand = serializeAws_restJson1DescribeChannelModeratedByAppInstanceUserCommand;
681
465
  const serializeAws_restJson1DescribeChannelModeratorCommand = async (input, context) => {
682
466
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
683
- const headers = {
684
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
685
- };
467
+ const headers = map({}, isSerializableHeaderValue, {
468
+ "x-amz-chime-bearer": input.ChimeBearer,
469
+ });
686
470
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
687
471
  "/channels/{ChannelArn}/moderators/{ChannelModeratorArn}";
688
- if (input.ChannelArn !== undefined) {
689
- const labelValue = input.ChannelArn;
690
- if (labelValue.length <= 0) {
691
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
692
- }
693
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
694
- }
695
- else {
696
- throw new Error("No value provided for input HTTP label: ChannelArn.");
697
- }
698
- if (input.ChannelModeratorArn !== undefined) {
699
- const labelValue = input.ChannelModeratorArn;
700
- if (labelValue.length <= 0) {
701
- throw new Error("Empty value provided for input HTTP label: ChannelModeratorArn.");
702
- }
703
- resolvedPath = resolvedPath.replace("{ChannelModeratorArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
704
- }
705
- else {
706
- throw new Error("No value provided for input HTTP label: ChannelModeratorArn.");
707
- }
472
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
473
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelModeratorArn", () => input.ChannelModeratorArn, "{ChannelModeratorArn}", false);
708
474
  let body;
709
475
  return new protocol_http_1.HttpRequest({
710
476
  protocol,
@@ -719,31 +485,13 @@ const serializeAws_restJson1DescribeChannelModeratorCommand = async (input, cont
719
485
  exports.serializeAws_restJson1DescribeChannelModeratorCommand = serializeAws_restJson1DescribeChannelModeratorCommand;
720
486
  const serializeAws_restJson1DisassociateChannelFlowCommand = async (input, context) => {
721
487
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
722
- const headers = {
723
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
724
- };
488
+ const headers = map({}, isSerializableHeaderValue, {
489
+ "x-amz-chime-bearer": input.ChimeBearer,
490
+ });
725
491
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
726
492
  "/channels/{ChannelArn}/channel-flow/{ChannelFlowArn}";
727
- if (input.ChannelArn !== undefined) {
728
- const labelValue = input.ChannelArn;
729
- if (labelValue.length <= 0) {
730
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
731
- }
732
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
733
- }
734
- else {
735
- throw new Error("No value provided for input HTTP label: ChannelArn.");
736
- }
737
- if (input.ChannelFlowArn !== undefined) {
738
- const labelValue = input.ChannelFlowArn;
739
- if (labelValue.length <= 0) {
740
- throw new Error("Empty value provided for input HTTP label: ChannelFlowArn.");
741
- }
742
- resolvedPath = resolvedPath.replace("{ChannelFlowArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
743
- }
744
- else {
745
- throw new Error("No value provided for input HTTP label: ChannelFlowArn.");
746
- }
493
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
494
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelFlowArn", () => input.ChannelFlowArn, "{ChannelFlowArn}", false);
747
495
  let body;
748
496
  return new protocol_http_1.HttpRequest({
749
497
  protocol,
@@ -758,31 +506,13 @@ const serializeAws_restJson1DisassociateChannelFlowCommand = async (input, conte
758
506
  exports.serializeAws_restJson1DisassociateChannelFlowCommand = serializeAws_restJson1DisassociateChannelFlowCommand;
759
507
  const serializeAws_restJson1GetChannelMembershipPreferencesCommand = async (input, context) => {
760
508
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
761
- const headers = {
762
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
763
- };
509
+ const headers = map({}, isSerializableHeaderValue, {
510
+ "x-amz-chime-bearer": input.ChimeBearer,
511
+ });
764
512
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
765
513
  "/channels/{ChannelArn}/memberships/{MemberArn}/preferences";
766
- if (input.ChannelArn !== undefined) {
767
- const labelValue = input.ChannelArn;
768
- if (labelValue.length <= 0) {
769
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
770
- }
771
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
772
- }
773
- else {
774
- throw new Error("No value provided for input HTTP label: ChannelArn.");
775
- }
776
- if (input.MemberArn !== undefined) {
777
- const labelValue = input.MemberArn;
778
- if (labelValue.length <= 0) {
779
- throw new Error("Empty value provided for input HTTP label: MemberArn.");
780
- }
781
- resolvedPath = resolvedPath.replace("{MemberArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
782
- }
783
- else {
784
- throw new Error("No value provided for input HTTP label: MemberArn.");
785
- }
514
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
515
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "MemberArn", () => input.MemberArn, "{MemberArn}", false);
786
516
  let body;
787
517
  return new protocol_http_1.HttpRequest({
788
518
  protocol,
@@ -797,31 +527,13 @@ const serializeAws_restJson1GetChannelMembershipPreferencesCommand = async (inpu
797
527
  exports.serializeAws_restJson1GetChannelMembershipPreferencesCommand = serializeAws_restJson1GetChannelMembershipPreferencesCommand;
798
528
  const serializeAws_restJson1GetChannelMessageCommand = async (input, context) => {
799
529
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
800
- const headers = {
801
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
802
- };
530
+ const headers = map({}, isSerializableHeaderValue, {
531
+ "x-amz-chime-bearer": input.ChimeBearer,
532
+ });
803
533
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
804
534
  "/channels/{ChannelArn}/messages/{MessageId}";
805
- if (input.ChannelArn !== undefined) {
806
- const labelValue = input.ChannelArn;
807
- if (labelValue.length <= 0) {
808
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
809
- }
810
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
811
- }
812
- else {
813
- throw new Error("No value provided for input HTTP label: ChannelArn.");
814
- }
815
- if (input.MessageId !== undefined) {
816
- const labelValue = input.MessageId;
817
- if (labelValue.length <= 0) {
818
- throw new Error("Empty value provided for input HTTP label: MessageId.");
819
- }
820
- resolvedPath = resolvedPath.replace("{MessageId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
821
- }
822
- else {
823
- throw new Error("No value provided for input HTTP label: MessageId.");
824
- }
535
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
536
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "MessageId", () => input.MessageId, "{MessageId}", false);
825
537
  let body;
826
538
  return new protocol_http_1.HttpRequest({
827
539
  protocol,
@@ -836,34 +548,16 @@ const serializeAws_restJson1GetChannelMessageCommand = async (input, context) =>
836
548
  exports.serializeAws_restJson1GetChannelMessageCommand = serializeAws_restJson1GetChannelMessageCommand;
837
549
  const serializeAws_restJson1GetChannelMessageStatusCommand = async (input, context) => {
838
550
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
839
- const headers = {
840
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
841
- };
551
+ const headers = map({}, isSerializableHeaderValue, {
552
+ "x-amz-chime-bearer": input.ChimeBearer,
553
+ });
842
554
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
843
555
  "/channels/{ChannelArn}/messages/{MessageId}";
844
- if (input.ChannelArn !== undefined) {
845
- const labelValue = input.ChannelArn;
846
- if (labelValue.length <= 0) {
847
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
848
- }
849
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
850
- }
851
- else {
852
- throw new Error("No value provided for input HTTP label: ChannelArn.");
853
- }
854
- if (input.MessageId !== undefined) {
855
- const labelValue = input.MessageId;
856
- if (labelValue.length <= 0) {
857
- throw new Error("Empty value provided for input HTTP label: MessageId.");
858
- }
859
- resolvedPath = resolvedPath.replace("{MessageId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
860
- }
861
- else {
862
- throw new Error("No value provided for input HTTP label: MessageId.");
863
- }
864
- const query = {
865
- scope: "message-status",
866
- };
556
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
557
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "MessageId", () => input.MessageId, "{MessageId}", false);
558
+ const query = map({
559
+ scope: [, "message-status"],
560
+ });
867
561
  let body;
868
562
  return new protocol_http_1.HttpRequest({
869
563
  protocol,
@@ -898,24 +592,15 @@ const serializeAws_restJson1GetMessagingSessionEndpointCommand = async (input, c
898
592
  exports.serializeAws_restJson1GetMessagingSessionEndpointCommand = serializeAws_restJson1GetMessagingSessionEndpointCommand;
899
593
  const serializeAws_restJson1ListChannelBansCommand = async (input, context) => {
900
594
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
901
- const headers = {
902
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
903
- };
595
+ const headers = map({}, isSerializableHeaderValue, {
596
+ "x-amz-chime-bearer": input.ChimeBearer,
597
+ });
904
598
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/bans";
905
- if (input.ChannelArn !== undefined) {
906
- const labelValue = input.ChannelArn;
907
- if (labelValue.length <= 0) {
908
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
909
- }
910
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
911
- }
912
- else {
913
- throw new Error("No value provided for input HTTP label: ChannelArn.");
914
- }
915
- const query = {
916
- ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }),
917
- ...(input.NextToken !== undefined && { "next-token": input.NextToken }),
918
- };
599
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
600
+ const query = map({
601
+ "max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
602
+ "next-token": [, input.NextToken],
603
+ });
919
604
  let body;
920
605
  return new protocol_http_1.HttpRequest({
921
606
  protocol,
@@ -933,11 +618,11 @@ const serializeAws_restJson1ListChannelFlowsCommand = async (input, context) =>
933
618
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
934
619
  const headers = {};
935
620
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channel-flows";
936
- const query = {
937
- ...(input.AppInstanceArn !== undefined && { "app-instance-arn": input.AppInstanceArn }),
938
- ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }),
939
- ...(input.NextToken !== undefined && { "next-token": input.NextToken }),
940
- };
621
+ const query = map({
622
+ "app-instance-arn": [, input.AppInstanceArn],
623
+ "max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
624
+ "next-token": [, input.NextToken],
625
+ });
941
626
  let body;
942
627
  return new protocol_http_1.HttpRequest({
943
628
  protocol,
@@ -953,25 +638,16 @@ const serializeAws_restJson1ListChannelFlowsCommand = async (input, context) =>
953
638
  exports.serializeAws_restJson1ListChannelFlowsCommand = serializeAws_restJson1ListChannelFlowsCommand;
954
639
  const serializeAws_restJson1ListChannelMembershipsCommand = async (input, context) => {
955
640
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
956
- const headers = {
957
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
958
- };
641
+ const headers = map({}, isSerializableHeaderValue, {
642
+ "x-amz-chime-bearer": input.ChimeBearer,
643
+ });
959
644
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/memberships";
960
- if (input.ChannelArn !== undefined) {
961
- const labelValue = input.ChannelArn;
962
- if (labelValue.length <= 0) {
963
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
964
- }
965
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
966
- }
967
- else {
968
- throw new Error("No value provided for input HTTP label: ChannelArn.");
969
- }
970
- const query = {
971
- ...(input.Type !== undefined && { type: input.Type }),
972
- ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }),
973
- ...(input.NextToken !== undefined && { "next-token": input.NextToken }),
974
- };
645
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
646
+ const query = map({
647
+ type: [, input.Type],
648
+ "max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
649
+ "next-token": [, input.NextToken],
650
+ });
975
651
  let body;
976
652
  return new protocol_http_1.HttpRequest({
977
653
  protocol,
@@ -987,16 +663,16 @@ const serializeAws_restJson1ListChannelMembershipsCommand = async (input, contex
987
663
  exports.serializeAws_restJson1ListChannelMembershipsCommand = serializeAws_restJson1ListChannelMembershipsCommand;
988
664
  const serializeAws_restJson1ListChannelMembershipsForAppInstanceUserCommand = async (input, context) => {
989
665
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
990
- const headers = {
991
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
992
- };
666
+ const headers = map({}, isSerializableHeaderValue, {
667
+ "x-amz-chime-bearer": input.ChimeBearer,
668
+ });
993
669
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels";
994
- const query = {
995
- scope: "app-instance-user-memberships",
996
- ...(input.AppInstanceUserArn !== undefined && { "app-instance-user-arn": input.AppInstanceUserArn }),
997
- ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }),
998
- ...(input.NextToken !== undefined && { "next-token": input.NextToken }),
999
- };
670
+ const query = map({
671
+ scope: [, "app-instance-user-memberships"],
672
+ "app-instance-user-arn": [, input.AppInstanceUserArn],
673
+ "max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
674
+ "next-token": [, input.NextToken],
675
+ });
1000
676
  let body;
1001
677
  return new protocol_http_1.HttpRequest({
1002
678
  protocol,
@@ -1012,29 +688,24 @@ const serializeAws_restJson1ListChannelMembershipsForAppInstanceUserCommand = as
1012
688
  exports.serializeAws_restJson1ListChannelMembershipsForAppInstanceUserCommand = serializeAws_restJson1ListChannelMembershipsForAppInstanceUserCommand;
1013
689
  const serializeAws_restJson1ListChannelMessagesCommand = async (input, context) => {
1014
690
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1015
- const headers = {
1016
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
1017
- };
691
+ const headers = map({}, isSerializableHeaderValue, {
692
+ "x-amz-chime-bearer": input.ChimeBearer,
693
+ });
1018
694
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/messages";
1019
- if (input.ChannelArn !== undefined) {
1020
- const labelValue = input.ChannelArn;
1021
- if (labelValue.length <= 0) {
1022
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
1023
- }
1024
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1025
- }
1026
- else {
1027
- throw new Error("No value provided for input HTTP label: ChannelArn.");
1028
- }
1029
- const query = {
1030
- ...(input.SortOrder !== undefined && { "sort-order": input.SortOrder }),
1031
- ...(input.NotBefore !== undefined && {
1032
- "not-before": (input.NotBefore.toISOString().split(".")[0] + "Z").toString(),
1033
- }),
1034
- ...(input.NotAfter !== undefined && { "not-after": (input.NotAfter.toISOString().split(".")[0] + "Z").toString() }),
1035
- ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }),
1036
- ...(input.NextToken !== undefined && { "next-token": input.NextToken }),
1037
- };
695
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
696
+ const query = map({
697
+ "sort-order": [, input.SortOrder],
698
+ "not-before": [
699
+ () => input.NotBefore !== void 0,
700
+ () => (input.NotBefore.toISOString().split(".")[0] + "Z").toString(),
701
+ ],
702
+ "not-after": [
703
+ () => input.NotAfter !== void 0,
704
+ () => (input.NotAfter.toISOString().split(".")[0] + "Z").toString(),
705
+ ],
706
+ "max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
707
+ "next-token": [, input.NextToken],
708
+ });
1038
709
  let body;
1039
710
  return new protocol_http_1.HttpRequest({
1040
711
  protocol,
@@ -1050,24 +721,15 @@ const serializeAws_restJson1ListChannelMessagesCommand = async (input, context)
1050
721
  exports.serializeAws_restJson1ListChannelMessagesCommand = serializeAws_restJson1ListChannelMessagesCommand;
1051
722
  const serializeAws_restJson1ListChannelModeratorsCommand = async (input, context) => {
1052
723
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1053
- const headers = {
1054
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
1055
- };
724
+ const headers = map({}, isSerializableHeaderValue, {
725
+ "x-amz-chime-bearer": input.ChimeBearer,
726
+ });
1056
727
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/moderators";
1057
- if (input.ChannelArn !== undefined) {
1058
- const labelValue = input.ChannelArn;
1059
- if (labelValue.length <= 0) {
1060
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
1061
- }
1062
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1063
- }
1064
- else {
1065
- throw new Error("No value provided for input HTTP label: ChannelArn.");
1066
- }
1067
- const query = {
1068
- ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }),
1069
- ...(input.NextToken !== undefined && { "next-token": input.NextToken }),
1070
- };
728
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
729
+ const query = map({
730
+ "max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
731
+ "next-token": [, input.NextToken],
732
+ });
1071
733
  let body;
1072
734
  return new protocol_http_1.HttpRequest({
1073
735
  protocol,
@@ -1083,16 +745,16 @@ const serializeAws_restJson1ListChannelModeratorsCommand = async (input, context
1083
745
  exports.serializeAws_restJson1ListChannelModeratorsCommand = serializeAws_restJson1ListChannelModeratorsCommand;
1084
746
  const serializeAws_restJson1ListChannelsCommand = async (input, context) => {
1085
747
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1086
- const headers = {
1087
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
1088
- };
748
+ const headers = map({}, isSerializableHeaderValue, {
749
+ "x-amz-chime-bearer": input.ChimeBearer,
750
+ });
1089
751
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels";
1090
- const query = {
1091
- ...(input.AppInstanceArn !== undefined && { "app-instance-arn": input.AppInstanceArn }),
1092
- ...(input.Privacy !== undefined && { privacy: input.Privacy }),
1093
- ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }),
1094
- ...(input.NextToken !== undefined && { "next-token": input.NextToken }),
1095
- };
752
+ const query = map({
753
+ "app-instance-arn": [, input.AppInstanceArn],
754
+ privacy: [, input.Privacy],
755
+ "max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
756
+ "next-token": [, input.NextToken],
757
+ });
1096
758
  let body;
1097
759
  return new protocol_http_1.HttpRequest({
1098
760
  protocol,
@@ -1110,12 +772,12 @@ const serializeAws_restJson1ListChannelsAssociatedWithChannelFlowCommand = async
1110
772
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1111
773
  const headers = {};
1112
774
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels";
1113
- const query = {
1114
- scope: "channel-flow-associations",
1115
- ...(input.ChannelFlowArn !== undefined && { "channel-flow-arn": input.ChannelFlowArn }),
1116
- ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }),
1117
- ...(input.NextToken !== undefined && { "next-token": input.NextToken }),
1118
- };
775
+ const query = map({
776
+ scope: [, "channel-flow-associations"],
777
+ "channel-flow-arn": [, input.ChannelFlowArn],
778
+ "max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
779
+ "next-token": [, input.NextToken],
780
+ });
1119
781
  let body;
1120
782
  return new protocol_http_1.HttpRequest({
1121
783
  protocol,
@@ -1131,16 +793,16 @@ const serializeAws_restJson1ListChannelsAssociatedWithChannelFlowCommand = async
1131
793
  exports.serializeAws_restJson1ListChannelsAssociatedWithChannelFlowCommand = serializeAws_restJson1ListChannelsAssociatedWithChannelFlowCommand;
1132
794
  const serializeAws_restJson1ListChannelsModeratedByAppInstanceUserCommand = async (input, context) => {
1133
795
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1134
- const headers = {
1135
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
1136
- };
796
+ const headers = map({}, isSerializableHeaderValue, {
797
+ "x-amz-chime-bearer": input.ChimeBearer,
798
+ });
1137
799
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels";
1138
- const query = {
1139
- scope: "app-instance-user-moderated-channels",
1140
- ...(input.AppInstanceUserArn !== undefined && { "app-instance-user-arn": input.AppInstanceUserArn }),
1141
- ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }),
1142
- ...(input.NextToken !== undefined && { "next-token": input.NextToken }),
1143
- };
800
+ const query = map({
801
+ scope: [, "app-instance-user-moderated-channels"],
802
+ "app-instance-user-arn": [, input.AppInstanceUserArn],
803
+ "max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
804
+ "next-token": [, input.NextToken],
805
+ });
1144
806
  let body;
1145
807
  return new protocol_http_1.HttpRequest({
1146
808
  protocol,
@@ -1158,9 +820,9 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
1158
820
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1159
821
  const headers = {};
1160
822
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags";
1161
- const query = {
1162
- ...(input.ResourceARN !== undefined && { arn: input.ResourceARN }),
1163
- };
823
+ const query = map({
824
+ arn: [, input.ResourceARN],
825
+ });
1164
826
  let body;
1165
827
  return new protocol_http_1.HttpRequest({
1166
828
  protocol,
@@ -1176,32 +838,14 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
1176
838
  exports.serializeAws_restJson1ListTagsForResourceCommand = serializeAws_restJson1ListTagsForResourceCommand;
1177
839
  const serializeAws_restJson1PutChannelMembershipPreferencesCommand = async (input, context) => {
1178
840
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1179
- const headers = {
841
+ const headers = map({}, isSerializableHeaderValue, {
1180
842
  "content-type": "application/json",
1181
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
1182
- };
843
+ "x-amz-chime-bearer": input.ChimeBearer,
844
+ });
1183
845
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1184
846
  "/channels/{ChannelArn}/memberships/{MemberArn}/preferences";
1185
- if (input.ChannelArn !== undefined) {
1186
- const labelValue = input.ChannelArn;
1187
- if (labelValue.length <= 0) {
1188
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
1189
- }
1190
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1191
- }
1192
- else {
1193
- throw new Error("No value provided for input HTTP label: ChannelArn.");
1194
- }
1195
- if (input.MemberArn !== undefined) {
1196
- const labelValue = input.MemberArn;
1197
- if (labelValue.length <= 0) {
1198
- throw new Error("Empty value provided for input HTTP label: MemberArn.");
1199
- }
1200
- resolvedPath = resolvedPath.replace("{MemberArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1201
- }
1202
- else {
1203
- throw new Error("No value provided for input HTTP label: MemberArn.");
1204
- }
847
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
848
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "MemberArn", () => input.MemberArn, "{MemberArn}", false);
1205
849
  let body;
1206
850
  body = JSON.stringify({
1207
851
  ...(input.Preferences != null && {
@@ -1221,34 +865,16 @@ const serializeAws_restJson1PutChannelMembershipPreferencesCommand = async (inpu
1221
865
  exports.serializeAws_restJson1PutChannelMembershipPreferencesCommand = serializeAws_restJson1PutChannelMembershipPreferencesCommand;
1222
866
  const serializeAws_restJson1RedactChannelMessageCommand = async (input, context) => {
1223
867
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1224
- const headers = {
1225
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
1226
- };
868
+ const headers = map({}, isSerializableHeaderValue, {
869
+ "x-amz-chime-bearer": input.ChimeBearer,
870
+ });
1227
871
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1228
872
  "/channels/{ChannelArn}/messages/{MessageId}";
1229
- if (input.ChannelArn !== undefined) {
1230
- const labelValue = input.ChannelArn;
1231
- if (labelValue.length <= 0) {
1232
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
1233
- }
1234
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1235
- }
1236
- else {
1237
- throw new Error("No value provided for input HTTP label: ChannelArn.");
1238
- }
1239
- if (input.MessageId !== undefined) {
1240
- const labelValue = input.MessageId;
1241
- if (labelValue.length <= 0) {
1242
- throw new Error("Empty value provided for input HTTP label: MessageId.");
1243
- }
1244
- resolvedPath = resolvedPath.replace("{MessageId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1245
- }
1246
- else {
1247
- throw new Error("No value provided for input HTTP label: MessageId.");
1248
- }
1249
- const query = {
1250
- operation: "redact",
1251
- };
873
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
874
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "MessageId", () => input.MessageId, "{MessageId}", false);
875
+ const query = map({
876
+ operation: [, "redact"],
877
+ });
1252
878
  let body;
1253
879
  return new protocol_http_1.HttpRequest({
1254
880
  protocol,
@@ -1264,16 +890,16 @@ const serializeAws_restJson1RedactChannelMessageCommand = async (input, context)
1264
890
  exports.serializeAws_restJson1RedactChannelMessageCommand = serializeAws_restJson1RedactChannelMessageCommand;
1265
891
  const serializeAws_restJson1SearchChannelsCommand = async (input, context) => {
1266
892
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1267
- const headers = {
893
+ const headers = map({}, isSerializableHeaderValue, {
1268
894
  "content-type": "application/json",
1269
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
1270
- };
895
+ "x-amz-chime-bearer": input.ChimeBearer,
896
+ });
1271
897
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels";
1272
- const query = {
1273
- operation: "search",
1274
- ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }),
1275
- ...(input.NextToken !== undefined && { "next-token": input.NextToken }),
1276
- };
898
+ const query = map({
899
+ operation: [, "search"],
900
+ "max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
901
+ "next-token": [, input.NextToken],
902
+ });
1277
903
  let body;
1278
904
  body = JSON.stringify({
1279
905
  ...(input.Fields != null && { Fields: serializeAws_restJson1SearchFields(input.Fields, context) }),
@@ -1293,21 +919,12 @@ exports.serializeAws_restJson1SearchChannelsCommand = serializeAws_restJson1Sear
1293
919
  const serializeAws_restJson1SendChannelMessageCommand = async (input, context) => {
1294
920
  var _a;
1295
921
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1296
- const headers = {
922
+ const headers = map({}, isSerializableHeaderValue, {
1297
923
  "content-type": "application/json",
1298
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
1299
- };
924
+ "x-amz-chime-bearer": input.ChimeBearer,
925
+ });
1300
926
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/messages";
1301
- if (input.ChannelArn !== undefined) {
1302
- const labelValue = input.ChannelArn;
1303
- if (labelValue.length <= 0) {
1304
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
1305
- }
1306
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1307
- }
1308
- else {
1309
- throw new Error("No value provided for input HTTP label: ChannelArn.");
1310
- }
927
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
1311
928
  let body;
1312
929
  body = JSON.stringify({
1313
930
  ClientRequestToken: (_a = input.ClientRequestToken) !== null && _a !== void 0 ? _a : (0, uuid_1.v4)(),
@@ -1339,9 +956,9 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
1339
956
  "content-type": "application/json",
1340
957
  };
1341
958
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags";
1342
- const query = {
1343
- operation: "tag-resource",
1344
- };
959
+ const query = map({
960
+ operation: [, "tag-resource"],
961
+ });
1345
962
  let body;
1346
963
  body = JSON.stringify({
1347
964
  ...(input.ResourceARN != null && { ResourceARN: input.ResourceARN }),
@@ -1365,9 +982,9 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
1365
982
  "content-type": "application/json",
1366
983
  };
1367
984
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags";
1368
- const query = {
1369
- operation: "untag-resource",
1370
- };
985
+ const query = map({
986
+ operation: [, "untag-resource"],
987
+ });
1371
988
  let body;
1372
989
  body = JSON.stringify({
1373
990
  ...(input.ResourceARN != null && { ResourceARN: input.ResourceARN }),
@@ -1387,21 +1004,12 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
1387
1004
  exports.serializeAws_restJson1UntagResourceCommand = serializeAws_restJson1UntagResourceCommand;
1388
1005
  const serializeAws_restJson1UpdateChannelCommand = async (input, context) => {
1389
1006
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1390
- const headers = {
1007
+ const headers = map({}, isSerializableHeaderValue, {
1391
1008
  "content-type": "application/json",
1392
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
1393
- };
1009
+ "x-amz-chime-bearer": input.ChimeBearer,
1010
+ });
1394
1011
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}";
1395
- if (input.ChannelArn !== undefined) {
1396
- const labelValue = input.ChannelArn;
1397
- if (labelValue.length <= 0) {
1398
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
1399
- }
1400
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1401
- }
1402
- else {
1403
- throw new Error("No value provided for input HTTP label: ChannelArn.");
1404
- }
1012
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
1405
1013
  let body;
1406
1014
  body = JSON.stringify({
1407
1015
  ...(input.Metadata != null && { Metadata: input.Metadata }),
@@ -1425,16 +1033,7 @@ const serializeAws_restJson1UpdateChannelFlowCommand = async (input, context) =>
1425
1033
  "content-type": "application/json",
1426
1034
  };
1427
1035
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channel-flows/{ChannelFlowArn}";
1428
- if (input.ChannelFlowArn !== undefined) {
1429
- const labelValue = input.ChannelFlowArn;
1430
- if (labelValue.length <= 0) {
1431
- throw new Error("Empty value provided for input HTTP label: ChannelFlowArn.");
1432
- }
1433
- resolvedPath = resolvedPath.replace("{ChannelFlowArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1434
- }
1435
- else {
1436
- throw new Error("No value provided for input HTTP label: ChannelFlowArn.");
1437
- }
1036
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelFlowArn", () => input.ChannelFlowArn, "{ChannelFlowArn}", false);
1438
1037
  let body;
1439
1038
  body = JSON.stringify({
1440
1039
  ...(input.Name != null && { Name: input.Name }),
@@ -1453,32 +1052,14 @@ const serializeAws_restJson1UpdateChannelFlowCommand = async (input, context) =>
1453
1052
  exports.serializeAws_restJson1UpdateChannelFlowCommand = serializeAws_restJson1UpdateChannelFlowCommand;
1454
1053
  const serializeAws_restJson1UpdateChannelMessageCommand = async (input, context) => {
1455
1054
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1456
- const headers = {
1055
+ const headers = map({}, isSerializableHeaderValue, {
1457
1056
  "content-type": "application/json",
1458
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
1459
- };
1057
+ "x-amz-chime-bearer": input.ChimeBearer,
1058
+ });
1460
1059
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1461
1060
  "/channels/{ChannelArn}/messages/{MessageId}";
1462
- if (input.ChannelArn !== undefined) {
1463
- const labelValue = input.ChannelArn;
1464
- if (labelValue.length <= 0) {
1465
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
1466
- }
1467
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1468
- }
1469
- else {
1470
- throw new Error("No value provided for input HTTP label: ChannelArn.");
1471
- }
1472
- if (input.MessageId !== undefined) {
1473
- const labelValue = input.MessageId;
1474
- if (labelValue.length <= 0) {
1475
- throw new Error("Empty value provided for input HTTP label: MessageId.");
1476
- }
1477
- resolvedPath = resolvedPath.replace("{MessageId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1478
- }
1479
- else {
1480
- throw new Error("No value provided for input HTTP label: MessageId.");
1481
- }
1061
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
1062
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "MessageId", () => input.MessageId, "{MessageId}", false);
1482
1063
  let body;
1483
1064
  body = JSON.stringify({
1484
1065
  ...(input.Content != null && { Content: input.Content }),
@@ -1497,20 +1078,11 @@ const serializeAws_restJson1UpdateChannelMessageCommand = async (input, context)
1497
1078
  exports.serializeAws_restJson1UpdateChannelMessageCommand = serializeAws_restJson1UpdateChannelMessageCommand;
1498
1079
  const serializeAws_restJson1UpdateChannelReadMarkerCommand = async (input, context) => {
1499
1080
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1500
- const headers = {
1501
- ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer }),
1502
- };
1081
+ const headers = map({}, isSerializableHeaderValue, {
1082
+ "x-amz-chime-bearer": input.ChimeBearer,
1083
+ });
1503
1084
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/readMarker";
1504
- if (input.ChannelArn !== undefined) {
1505
- const labelValue = input.ChannelArn;
1506
- if (labelValue.length <= 0) {
1507
- throw new Error("Empty value provided for input HTTP label: ChannelArn.");
1508
- }
1509
- resolvedPath = resolvedPath.replace("{ChannelArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1510
- }
1511
- else {
1512
- throw new Error("No value provided for input HTTP label: ChannelArn.");
1513
- }
1085
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
1514
1086
  let body;
1515
1087
  return new protocol_http_1.HttpRequest({
1516
1088
  protocol,
@@ -1527,11 +1099,11 @@ const deserializeAws_restJson1AssociateChannelFlowCommand = async (output, conte
1527
1099
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1528
1100
  return deserializeAws_restJson1AssociateChannelFlowCommandError(output, context);
1529
1101
  }
1530
- const contents = {
1102
+ const contents = map({
1531
1103
  $metadata: deserializeMetadata(output),
1532
- };
1104
+ });
1533
1105
  await collectBody(output.body, context);
1534
- return Promise.resolve(contents);
1106
+ return contents;
1535
1107
  };
1536
1108
  exports.deserializeAws_restJson1AssociateChannelFlowCommand = deserializeAws_restJson1AssociateChannelFlowCommand;
1537
1109
  const deserializeAws_restJson1AssociateChannelFlowCommandError = async (output, context) => {
@@ -1539,7 +1111,6 @@ const deserializeAws_restJson1AssociateChannelFlowCommandError = async (output,
1539
1111
  ...output,
1540
1112
  body: await parseBody(output.body, context),
1541
1113
  };
1542
- let response;
1543
1114
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1544
1115
  switch (errorCode) {
1545
1116
  case "BadRequestException":
@@ -1568,33 +1139,29 @@ const deserializeAws_restJson1AssociateChannelFlowCommandError = async (output,
1568
1139
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
1569
1140
  default:
1570
1141
  const parsedBody = parsedOutput.body;
1571
- const $metadata = deserializeMetadata(output);
1572
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1573
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
1574
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1575
- $fault: "client",
1576
- $metadata,
1142
+ (0, smithy_client_1.throwDefaultError)({
1143
+ output,
1144
+ parsedBody,
1145
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
1146
+ errorCode,
1577
1147
  });
1578
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1579
1148
  }
1580
1149
  };
1581
1150
  const deserializeAws_restJson1BatchCreateChannelMembershipCommand = async (output, context) => {
1582
1151
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1583
1152
  return deserializeAws_restJson1BatchCreateChannelMembershipCommandError(output, context);
1584
1153
  }
1585
- const contents = {
1154
+ const contents = map({
1586
1155
  $metadata: deserializeMetadata(output),
1587
- BatchChannelMemberships: undefined,
1588
- Errors: undefined,
1589
- };
1156
+ });
1590
1157
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1591
- if (data.BatchChannelMemberships !== undefined && data.BatchChannelMemberships !== null) {
1158
+ if (data.BatchChannelMemberships != null) {
1592
1159
  contents.BatchChannelMemberships = deserializeAws_restJson1BatchChannelMemberships(data.BatchChannelMemberships, context);
1593
1160
  }
1594
- if (data.Errors !== undefined && data.Errors !== null) {
1161
+ if (data.Errors != null) {
1595
1162
  contents.Errors = deserializeAws_restJson1BatchCreateChannelMembershipErrors(data.Errors, context);
1596
1163
  }
1597
- return Promise.resolve(contents);
1164
+ return contents;
1598
1165
  };
1599
1166
  exports.deserializeAws_restJson1BatchCreateChannelMembershipCommand = deserializeAws_restJson1BatchCreateChannelMembershipCommand;
1600
1167
  const deserializeAws_restJson1BatchCreateChannelMembershipCommandError = async (output, context) => {
@@ -1602,7 +1169,6 @@ const deserializeAws_restJson1BatchCreateChannelMembershipCommandError = async (
1602
1169
  ...output,
1603
1170
  body: await parseBody(output.body, context),
1604
1171
  };
1605
- let response;
1606
1172
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1607
1173
  switch (errorCode) {
1608
1174
  case "BadRequestException":
@@ -1625,33 +1191,29 @@ const deserializeAws_restJson1BatchCreateChannelMembershipCommandError = async (
1625
1191
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
1626
1192
  default:
1627
1193
  const parsedBody = parsedOutput.body;
1628
- const $metadata = deserializeMetadata(output);
1629
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1630
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
1631
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1632
- $fault: "client",
1633
- $metadata,
1194
+ (0, smithy_client_1.throwDefaultError)({
1195
+ output,
1196
+ parsedBody,
1197
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
1198
+ errorCode,
1634
1199
  });
1635
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1636
1200
  }
1637
1201
  };
1638
1202
  const deserializeAws_restJson1ChannelFlowCallbackCommand = async (output, context) => {
1639
1203
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1640
1204
  return deserializeAws_restJson1ChannelFlowCallbackCommandError(output, context);
1641
1205
  }
1642
- const contents = {
1206
+ const contents = map({
1643
1207
  $metadata: deserializeMetadata(output),
1644
- CallbackId: undefined,
1645
- ChannelArn: undefined,
1646
- };
1208
+ });
1647
1209
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1648
- if (data.CallbackId !== undefined && data.CallbackId !== null) {
1210
+ if (data.CallbackId != null) {
1649
1211
  contents.CallbackId = (0, smithy_client_1.expectString)(data.CallbackId);
1650
1212
  }
1651
- if (data.ChannelArn !== undefined && data.ChannelArn !== null) {
1213
+ if (data.ChannelArn != null) {
1652
1214
  contents.ChannelArn = (0, smithy_client_1.expectString)(data.ChannelArn);
1653
1215
  }
1654
- return Promise.resolve(contents);
1216
+ return contents;
1655
1217
  };
1656
1218
  exports.deserializeAws_restJson1ChannelFlowCallbackCommand = deserializeAws_restJson1ChannelFlowCallbackCommand;
1657
1219
  const deserializeAws_restJson1ChannelFlowCallbackCommandError = async (output, context) => {
@@ -1659,7 +1221,6 @@ const deserializeAws_restJson1ChannelFlowCallbackCommandError = async (output, c
1659
1221
  ...output,
1660
1222
  body: await parseBody(output.body, context),
1661
1223
  };
1662
- let response;
1663
1224
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1664
1225
  switch (errorCode) {
1665
1226
  case "BadRequestException":
@@ -1685,29 +1246,26 @@ const deserializeAws_restJson1ChannelFlowCallbackCommandError = async (output, c
1685
1246
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
1686
1247
  default:
1687
1248
  const parsedBody = parsedOutput.body;
1688
- const $metadata = deserializeMetadata(output);
1689
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1690
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
1691
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1692
- $fault: "client",
1693
- $metadata,
1249
+ (0, smithy_client_1.throwDefaultError)({
1250
+ output,
1251
+ parsedBody,
1252
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
1253
+ errorCode,
1694
1254
  });
1695
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1696
1255
  }
1697
1256
  };
1698
1257
  const deserializeAws_restJson1CreateChannelCommand = async (output, context) => {
1699
1258
  if (output.statusCode !== 201 && output.statusCode >= 300) {
1700
1259
  return deserializeAws_restJson1CreateChannelCommandError(output, context);
1701
1260
  }
1702
- const contents = {
1261
+ const contents = map({
1703
1262
  $metadata: deserializeMetadata(output),
1704
- ChannelArn: undefined,
1705
- };
1263
+ });
1706
1264
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1707
- if (data.ChannelArn !== undefined && data.ChannelArn !== null) {
1265
+ if (data.ChannelArn != null) {
1708
1266
  contents.ChannelArn = (0, smithy_client_1.expectString)(data.ChannelArn);
1709
1267
  }
1710
- return Promise.resolve(contents);
1268
+ return contents;
1711
1269
  };
1712
1270
  exports.deserializeAws_restJson1CreateChannelCommand = deserializeAws_restJson1CreateChannelCommand;
1713
1271
  const deserializeAws_restJson1CreateChannelCommandError = async (output, context) => {
@@ -1715,7 +1273,6 @@ const deserializeAws_restJson1CreateChannelCommandError = async (output, context
1715
1273
  ...output,
1716
1274
  body: await parseBody(output.body, context),
1717
1275
  };
1718
- let response;
1719
1276
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1720
1277
  switch (errorCode) {
1721
1278
  case "BadRequestException":
@@ -1744,33 +1301,29 @@ const deserializeAws_restJson1CreateChannelCommandError = async (output, context
1744
1301
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
1745
1302
  default:
1746
1303
  const parsedBody = parsedOutput.body;
1747
- const $metadata = deserializeMetadata(output);
1748
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1749
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
1750
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1751
- $fault: "client",
1752
- $metadata,
1304
+ (0, smithy_client_1.throwDefaultError)({
1305
+ output,
1306
+ parsedBody,
1307
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
1308
+ errorCode,
1753
1309
  });
1754
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1755
1310
  }
1756
1311
  };
1757
1312
  const deserializeAws_restJson1CreateChannelBanCommand = async (output, context) => {
1758
1313
  if (output.statusCode !== 201 && output.statusCode >= 300) {
1759
1314
  return deserializeAws_restJson1CreateChannelBanCommandError(output, context);
1760
1315
  }
1761
- const contents = {
1316
+ const contents = map({
1762
1317
  $metadata: deserializeMetadata(output),
1763
- ChannelArn: undefined,
1764
- Member: undefined,
1765
- };
1318
+ });
1766
1319
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1767
- if (data.ChannelArn !== undefined && data.ChannelArn !== null) {
1320
+ if (data.ChannelArn != null) {
1768
1321
  contents.ChannelArn = (0, smithy_client_1.expectString)(data.ChannelArn);
1769
1322
  }
1770
- if (data.Member !== undefined && data.Member !== null) {
1323
+ if (data.Member != null) {
1771
1324
  contents.Member = deserializeAws_restJson1Identity(data.Member, context);
1772
1325
  }
1773
- return Promise.resolve(contents);
1326
+ return contents;
1774
1327
  };
1775
1328
  exports.deserializeAws_restJson1CreateChannelBanCommand = deserializeAws_restJson1CreateChannelBanCommand;
1776
1329
  const deserializeAws_restJson1CreateChannelBanCommandError = async (output, context) => {
@@ -1778,7 +1331,6 @@ const deserializeAws_restJson1CreateChannelBanCommandError = async (output, cont
1778
1331
  ...output,
1779
1332
  body: await parseBody(output.body, context),
1780
1333
  };
1781
- let response;
1782
1334
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1783
1335
  switch (errorCode) {
1784
1336
  case "BadRequestException":
@@ -1807,29 +1359,26 @@ const deserializeAws_restJson1CreateChannelBanCommandError = async (output, cont
1807
1359
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
1808
1360
  default:
1809
1361
  const parsedBody = parsedOutput.body;
1810
- const $metadata = deserializeMetadata(output);
1811
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1812
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
1813
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1814
- $fault: "client",
1815
- $metadata,
1362
+ (0, smithy_client_1.throwDefaultError)({
1363
+ output,
1364
+ parsedBody,
1365
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
1366
+ errorCode,
1816
1367
  });
1817
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1818
1368
  }
1819
1369
  };
1820
1370
  const deserializeAws_restJson1CreateChannelFlowCommand = async (output, context) => {
1821
1371
  if (output.statusCode !== 201 && output.statusCode >= 300) {
1822
1372
  return deserializeAws_restJson1CreateChannelFlowCommandError(output, context);
1823
1373
  }
1824
- const contents = {
1374
+ const contents = map({
1825
1375
  $metadata: deserializeMetadata(output),
1826
- ChannelFlowArn: undefined,
1827
- };
1376
+ });
1828
1377
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1829
- if (data.ChannelFlowArn !== undefined && data.ChannelFlowArn !== null) {
1378
+ if (data.ChannelFlowArn != null) {
1830
1379
  contents.ChannelFlowArn = (0, smithy_client_1.expectString)(data.ChannelFlowArn);
1831
1380
  }
1832
- return Promise.resolve(contents);
1381
+ return contents;
1833
1382
  };
1834
1383
  exports.deserializeAws_restJson1CreateChannelFlowCommand = deserializeAws_restJson1CreateChannelFlowCommand;
1835
1384
  const deserializeAws_restJson1CreateChannelFlowCommandError = async (output, context) => {
@@ -1837,7 +1386,6 @@ const deserializeAws_restJson1CreateChannelFlowCommandError = async (output, con
1837
1386
  ...output,
1838
1387
  body: await parseBody(output.body, context),
1839
1388
  };
1840
- let response;
1841
1389
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1842
1390
  switch (errorCode) {
1843
1391
  case "BadRequestException":
@@ -1866,33 +1414,29 @@ const deserializeAws_restJson1CreateChannelFlowCommandError = async (output, con
1866
1414
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
1867
1415
  default:
1868
1416
  const parsedBody = parsedOutput.body;
1869
- const $metadata = deserializeMetadata(output);
1870
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1871
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
1872
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1873
- $fault: "client",
1874
- $metadata,
1417
+ (0, smithy_client_1.throwDefaultError)({
1418
+ output,
1419
+ parsedBody,
1420
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
1421
+ errorCode,
1875
1422
  });
1876
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1877
1423
  }
1878
1424
  };
1879
1425
  const deserializeAws_restJson1CreateChannelMembershipCommand = async (output, context) => {
1880
1426
  if (output.statusCode !== 201 && output.statusCode >= 300) {
1881
1427
  return deserializeAws_restJson1CreateChannelMembershipCommandError(output, context);
1882
1428
  }
1883
- const contents = {
1429
+ const contents = map({
1884
1430
  $metadata: deserializeMetadata(output),
1885
- ChannelArn: undefined,
1886
- Member: undefined,
1887
- };
1431
+ });
1888
1432
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1889
- if (data.ChannelArn !== undefined && data.ChannelArn !== null) {
1433
+ if (data.ChannelArn != null) {
1890
1434
  contents.ChannelArn = (0, smithy_client_1.expectString)(data.ChannelArn);
1891
1435
  }
1892
- if (data.Member !== undefined && data.Member !== null) {
1436
+ if (data.Member != null) {
1893
1437
  contents.Member = deserializeAws_restJson1Identity(data.Member, context);
1894
1438
  }
1895
- return Promise.resolve(contents);
1439
+ return contents;
1896
1440
  };
1897
1441
  exports.deserializeAws_restJson1CreateChannelMembershipCommand = deserializeAws_restJson1CreateChannelMembershipCommand;
1898
1442
  const deserializeAws_restJson1CreateChannelMembershipCommandError = async (output, context) => {
@@ -1900,7 +1444,6 @@ const deserializeAws_restJson1CreateChannelMembershipCommandError = async (outpu
1900
1444
  ...output,
1901
1445
  body: await parseBody(output.body, context),
1902
1446
  };
1903
- let response;
1904
1447
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1905
1448
  switch (errorCode) {
1906
1449
  case "BadRequestException":
@@ -1929,33 +1472,29 @@ const deserializeAws_restJson1CreateChannelMembershipCommandError = async (outpu
1929
1472
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
1930
1473
  default:
1931
1474
  const parsedBody = parsedOutput.body;
1932
- const $metadata = deserializeMetadata(output);
1933
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1934
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
1935
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1936
- $fault: "client",
1937
- $metadata,
1475
+ (0, smithy_client_1.throwDefaultError)({
1476
+ output,
1477
+ parsedBody,
1478
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
1479
+ errorCode,
1938
1480
  });
1939
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1940
1481
  }
1941
1482
  };
1942
1483
  const deserializeAws_restJson1CreateChannelModeratorCommand = async (output, context) => {
1943
1484
  if (output.statusCode !== 201 && output.statusCode >= 300) {
1944
1485
  return deserializeAws_restJson1CreateChannelModeratorCommandError(output, context);
1945
1486
  }
1946
- const contents = {
1487
+ const contents = map({
1947
1488
  $metadata: deserializeMetadata(output),
1948
- ChannelArn: undefined,
1949
- ChannelModerator: undefined,
1950
- };
1489
+ });
1951
1490
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1952
- if (data.ChannelArn !== undefined && data.ChannelArn !== null) {
1491
+ if (data.ChannelArn != null) {
1953
1492
  contents.ChannelArn = (0, smithy_client_1.expectString)(data.ChannelArn);
1954
1493
  }
1955
- if (data.ChannelModerator !== undefined && data.ChannelModerator !== null) {
1494
+ if (data.ChannelModerator != null) {
1956
1495
  contents.ChannelModerator = deserializeAws_restJson1Identity(data.ChannelModerator, context);
1957
1496
  }
1958
- return Promise.resolve(contents);
1497
+ return contents;
1959
1498
  };
1960
1499
  exports.deserializeAws_restJson1CreateChannelModeratorCommand = deserializeAws_restJson1CreateChannelModeratorCommand;
1961
1500
  const deserializeAws_restJson1CreateChannelModeratorCommandError = async (output, context) => {
@@ -1963,7 +1502,6 @@ const deserializeAws_restJson1CreateChannelModeratorCommandError = async (output
1963
1502
  ...output,
1964
1503
  body: await parseBody(output.body, context),
1965
1504
  };
1966
- let response;
1967
1505
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1968
1506
  switch (errorCode) {
1969
1507
  case "BadRequestException":
@@ -1992,25 +1530,23 @@ const deserializeAws_restJson1CreateChannelModeratorCommandError = async (output
1992
1530
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
1993
1531
  default:
1994
1532
  const parsedBody = parsedOutput.body;
1995
- const $metadata = deserializeMetadata(output);
1996
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1997
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
1998
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1999
- $fault: "client",
2000
- $metadata,
1533
+ (0, smithy_client_1.throwDefaultError)({
1534
+ output,
1535
+ parsedBody,
1536
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
1537
+ errorCode,
2001
1538
  });
2002
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2003
1539
  }
2004
1540
  };
2005
1541
  const deserializeAws_restJson1DeleteChannelCommand = async (output, context) => {
2006
1542
  if (output.statusCode !== 204 && output.statusCode >= 300) {
2007
1543
  return deserializeAws_restJson1DeleteChannelCommandError(output, context);
2008
1544
  }
2009
- const contents = {
1545
+ const contents = map({
2010
1546
  $metadata: deserializeMetadata(output),
2011
- };
1547
+ });
2012
1548
  await collectBody(output.body, context);
2013
- return Promise.resolve(contents);
1549
+ return contents;
2014
1550
  };
2015
1551
  exports.deserializeAws_restJson1DeleteChannelCommand = deserializeAws_restJson1DeleteChannelCommand;
2016
1552
  const deserializeAws_restJson1DeleteChannelCommandError = async (output, context) => {
@@ -2018,7 +1554,6 @@ const deserializeAws_restJson1DeleteChannelCommandError = async (output, context
2018
1554
  ...output,
2019
1555
  body: await parseBody(output.body, context),
2020
1556
  };
2021
- let response;
2022
1557
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2023
1558
  switch (errorCode) {
2024
1559
  case "BadRequestException":
@@ -2041,25 +1576,23 @@ const deserializeAws_restJson1DeleteChannelCommandError = async (output, context
2041
1576
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
2042
1577
  default:
2043
1578
  const parsedBody = parsedOutput.body;
2044
- const $metadata = deserializeMetadata(output);
2045
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2046
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
2047
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2048
- $fault: "client",
2049
- $metadata,
1579
+ (0, smithy_client_1.throwDefaultError)({
1580
+ output,
1581
+ parsedBody,
1582
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
1583
+ errorCode,
2050
1584
  });
2051
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2052
1585
  }
2053
1586
  };
2054
1587
  const deserializeAws_restJson1DeleteChannelBanCommand = async (output, context) => {
2055
1588
  if (output.statusCode !== 204 && output.statusCode >= 300) {
2056
1589
  return deserializeAws_restJson1DeleteChannelBanCommandError(output, context);
2057
1590
  }
2058
- const contents = {
1591
+ const contents = map({
2059
1592
  $metadata: deserializeMetadata(output),
2060
- };
1593
+ });
2061
1594
  await collectBody(output.body, context);
2062
- return Promise.resolve(contents);
1595
+ return contents;
2063
1596
  };
2064
1597
  exports.deserializeAws_restJson1DeleteChannelBanCommand = deserializeAws_restJson1DeleteChannelBanCommand;
2065
1598
  const deserializeAws_restJson1DeleteChannelBanCommandError = async (output, context) => {
@@ -2067,7 +1600,6 @@ const deserializeAws_restJson1DeleteChannelBanCommandError = async (output, cont
2067
1600
  ...output,
2068
1601
  body: await parseBody(output.body, context),
2069
1602
  };
2070
- let response;
2071
1603
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2072
1604
  switch (errorCode) {
2073
1605
  case "BadRequestException":
@@ -2090,25 +1622,23 @@ const deserializeAws_restJson1DeleteChannelBanCommandError = async (output, cont
2090
1622
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
2091
1623
  default:
2092
1624
  const parsedBody = parsedOutput.body;
2093
- const $metadata = deserializeMetadata(output);
2094
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2095
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
2096
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2097
- $fault: "client",
2098
- $metadata,
1625
+ (0, smithy_client_1.throwDefaultError)({
1626
+ output,
1627
+ parsedBody,
1628
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
1629
+ errorCode,
2099
1630
  });
2100
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2101
1631
  }
2102
1632
  };
2103
1633
  const deserializeAws_restJson1DeleteChannelFlowCommand = async (output, context) => {
2104
1634
  if (output.statusCode !== 204 && output.statusCode >= 300) {
2105
1635
  return deserializeAws_restJson1DeleteChannelFlowCommandError(output, context);
2106
1636
  }
2107
- const contents = {
1637
+ const contents = map({
2108
1638
  $metadata: deserializeMetadata(output),
2109
- };
1639
+ });
2110
1640
  await collectBody(output.body, context);
2111
- return Promise.resolve(contents);
1641
+ return contents;
2112
1642
  };
2113
1643
  exports.deserializeAws_restJson1DeleteChannelFlowCommand = deserializeAws_restJson1DeleteChannelFlowCommand;
2114
1644
  const deserializeAws_restJson1DeleteChannelFlowCommandError = async (output, context) => {
@@ -2116,7 +1646,6 @@ const deserializeAws_restJson1DeleteChannelFlowCommandError = async (output, con
2116
1646
  ...output,
2117
1647
  body: await parseBody(output.body, context),
2118
1648
  };
2119
- let response;
2120
1649
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2121
1650
  switch (errorCode) {
2122
1651
  case "BadRequestException":
@@ -2142,25 +1671,23 @@ const deserializeAws_restJson1DeleteChannelFlowCommandError = async (output, con
2142
1671
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
2143
1672
  default:
2144
1673
  const parsedBody = parsedOutput.body;
2145
- const $metadata = deserializeMetadata(output);
2146
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2147
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
2148
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2149
- $fault: "client",
2150
- $metadata,
1674
+ (0, smithy_client_1.throwDefaultError)({
1675
+ output,
1676
+ parsedBody,
1677
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
1678
+ errorCode,
2151
1679
  });
2152
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2153
1680
  }
2154
1681
  };
2155
1682
  const deserializeAws_restJson1DeleteChannelMembershipCommand = async (output, context) => {
2156
1683
  if (output.statusCode !== 204 && output.statusCode >= 300) {
2157
1684
  return deserializeAws_restJson1DeleteChannelMembershipCommandError(output, context);
2158
1685
  }
2159
- const contents = {
1686
+ const contents = map({
2160
1687
  $metadata: deserializeMetadata(output),
2161
- };
1688
+ });
2162
1689
  await collectBody(output.body, context);
2163
- return Promise.resolve(contents);
1690
+ return contents;
2164
1691
  };
2165
1692
  exports.deserializeAws_restJson1DeleteChannelMembershipCommand = deserializeAws_restJson1DeleteChannelMembershipCommand;
2166
1693
  const deserializeAws_restJson1DeleteChannelMembershipCommandError = async (output, context) => {
@@ -2168,7 +1695,6 @@ const deserializeAws_restJson1DeleteChannelMembershipCommandError = async (outpu
2168
1695
  ...output,
2169
1696
  body: await parseBody(output.body, context),
2170
1697
  };
2171
- let response;
2172
1698
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2173
1699
  switch (errorCode) {
2174
1700
  case "BadRequestException":
@@ -2194,25 +1720,23 @@ const deserializeAws_restJson1DeleteChannelMembershipCommandError = async (outpu
2194
1720
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
2195
1721
  default:
2196
1722
  const parsedBody = parsedOutput.body;
2197
- const $metadata = deserializeMetadata(output);
2198
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2199
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
2200
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2201
- $fault: "client",
2202
- $metadata,
1723
+ (0, smithy_client_1.throwDefaultError)({
1724
+ output,
1725
+ parsedBody,
1726
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
1727
+ errorCode,
2203
1728
  });
2204
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2205
1729
  }
2206
1730
  };
2207
1731
  const deserializeAws_restJson1DeleteChannelMessageCommand = async (output, context) => {
2208
1732
  if (output.statusCode !== 204 && output.statusCode >= 300) {
2209
1733
  return deserializeAws_restJson1DeleteChannelMessageCommandError(output, context);
2210
1734
  }
2211
- const contents = {
1735
+ const contents = map({
2212
1736
  $metadata: deserializeMetadata(output),
2213
- };
1737
+ });
2214
1738
  await collectBody(output.body, context);
2215
- return Promise.resolve(contents);
1739
+ return contents;
2216
1740
  };
2217
1741
  exports.deserializeAws_restJson1DeleteChannelMessageCommand = deserializeAws_restJson1DeleteChannelMessageCommand;
2218
1742
  const deserializeAws_restJson1DeleteChannelMessageCommandError = async (output, context) => {
@@ -2220,7 +1744,6 @@ const deserializeAws_restJson1DeleteChannelMessageCommandError = async (output,
2220
1744
  ...output,
2221
1745
  body: await parseBody(output.body, context),
2222
1746
  };
2223
- let response;
2224
1747
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2225
1748
  switch (errorCode) {
2226
1749
  case "BadRequestException":
@@ -2243,25 +1766,23 @@ const deserializeAws_restJson1DeleteChannelMessageCommandError = async (output,
2243
1766
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
2244
1767
  default:
2245
1768
  const parsedBody = parsedOutput.body;
2246
- const $metadata = deserializeMetadata(output);
2247
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2248
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
2249
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2250
- $fault: "client",
2251
- $metadata,
1769
+ (0, smithy_client_1.throwDefaultError)({
1770
+ output,
1771
+ parsedBody,
1772
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
1773
+ errorCode,
2252
1774
  });
2253
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2254
1775
  }
2255
1776
  };
2256
1777
  const deserializeAws_restJson1DeleteChannelModeratorCommand = async (output, context) => {
2257
1778
  if (output.statusCode !== 204 && output.statusCode >= 300) {
2258
1779
  return deserializeAws_restJson1DeleteChannelModeratorCommandError(output, context);
2259
1780
  }
2260
- const contents = {
1781
+ const contents = map({
2261
1782
  $metadata: deserializeMetadata(output),
2262
- };
1783
+ });
2263
1784
  await collectBody(output.body, context);
2264
- return Promise.resolve(contents);
1785
+ return contents;
2265
1786
  };
2266
1787
  exports.deserializeAws_restJson1DeleteChannelModeratorCommand = deserializeAws_restJson1DeleteChannelModeratorCommand;
2267
1788
  const deserializeAws_restJson1DeleteChannelModeratorCommandError = async (output, context) => {
@@ -2269,7 +1790,6 @@ const deserializeAws_restJson1DeleteChannelModeratorCommandError = async (output
2269
1790
  ...output,
2270
1791
  body: await parseBody(output.body, context),
2271
1792
  };
2272
- let response;
2273
1793
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2274
1794
  switch (errorCode) {
2275
1795
  case "BadRequestException":
@@ -2292,29 +1812,26 @@ const deserializeAws_restJson1DeleteChannelModeratorCommandError = async (output
2292
1812
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
2293
1813
  default:
2294
1814
  const parsedBody = parsedOutput.body;
2295
- const $metadata = deserializeMetadata(output);
2296
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2297
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
2298
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2299
- $fault: "client",
2300
- $metadata,
1815
+ (0, smithy_client_1.throwDefaultError)({
1816
+ output,
1817
+ parsedBody,
1818
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
1819
+ errorCode,
2301
1820
  });
2302
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2303
1821
  }
2304
1822
  };
2305
1823
  const deserializeAws_restJson1DescribeChannelCommand = async (output, context) => {
2306
1824
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2307
1825
  return deserializeAws_restJson1DescribeChannelCommandError(output, context);
2308
1826
  }
2309
- const contents = {
1827
+ const contents = map({
2310
1828
  $metadata: deserializeMetadata(output),
2311
- Channel: undefined,
2312
- };
1829
+ });
2313
1830
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2314
- if (data.Channel !== undefined && data.Channel !== null) {
1831
+ if (data.Channel != null) {
2315
1832
  contents.Channel = deserializeAws_restJson1Channel(data.Channel, context);
2316
1833
  }
2317
- return Promise.resolve(contents);
1834
+ return contents;
2318
1835
  };
2319
1836
  exports.deserializeAws_restJson1DescribeChannelCommand = deserializeAws_restJson1DescribeChannelCommand;
2320
1837
  const deserializeAws_restJson1DescribeChannelCommandError = async (output, context) => {
@@ -2322,7 +1839,6 @@ const deserializeAws_restJson1DescribeChannelCommandError = async (output, conte
2322
1839
  ...output,
2323
1840
  body: await parseBody(output.body, context),
2324
1841
  };
2325
- let response;
2326
1842
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2327
1843
  switch (errorCode) {
2328
1844
  case "BadRequestException":
@@ -2345,29 +1861,26 @@ const deserializeAws_restJson1DescribeChannelCommandError = async (output, conte
2345
1861
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
2346
1862
  default:
2347
1863
  const parsedBody = parsedOutput.body;
2348
- const $metadata = deserializeMetadata(output);
2349
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2350
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
2351
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2352
- $fault: "client",
2353
- $metadata,
1864
+ (0, smithy_client_1.throwDefaultError)({
1865
+ output,
1866
+ parsedBody,
1867
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
1868
+ errorCode,
2354
1869
  });
2355
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2356
1870
  }
2357
1871
  };
2358
1872
  const deserializeAws_restJson1DescribeChannelBanCommand = async (output, context) => {
2359
1873
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2360
1874
  return deserializeAws_restJson1DescribeChannelBanCommandError(output, context);
2361
1875
  }
2362
- const contents = {
1876
+ const contents = map({
2363
1877
  $metadata: deserializeMetadata(output),
2364
- ChannelBan: undefined,
2365
- };
1878
+ });
2366
1879
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2367
- if (data.ChannelBan !== undefined && data.ChannelBan !== null) {
1880
+ if (data.ChannelBan != null) {
2368
1881
  contents.ChannelBan = deserializeAws_restJson1ChannelBan(data.ChannelBan, context);
2369
1882
  }
2370
- return Promise.resolve(contents);
1883
+ return contents;
2371
1884
  };
2372
1885
  exports.deserializeAws_restJson1DescribeChannelBanCommand = deserializeAws_restJson1DescribeChannelBanCommand;
2373
1886
  const deserializeAws_restJson1DescribeChannelBanCommandError = async (output, context) => {
@@ -2375,7 +1888,6 @@ const deserializeAws_restJson1DescribeChannelBanCommandError = async (output, co
2375
1888
  ...output,
2376
1889
  body: await parseBody(output.body, context),
2377
1890
  };
2378
- let response;
2379
1891
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2380
1892
  switch (errorCode) {
2381
1893
  case "BadRequestException":
@@ -2401,29 +1913,26 @@ const deserializeAws_restJson1DescribeChannelBanCommandError = async (output, co
2401
1913
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
2402
1914
  default:
2403
1915
  const parsedBody = parsedOutput.body;
2404
- const $metadata = deserializeMetadata(output);
2405
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2406
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
2407
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2408
- $fault: "client",
2409
- $metadata,
1916
+ (0, smithy_client_1.throwDefaultError)({
1917
+ output,
1918
+ parsedBody,
1919
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
1920
+ errorCode,
2410
1921
  });
2411
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2412
1922
  }
2413
1923
  };
2414
1924
  const deserializeAws_restJson1DescribeChannelFlowCommand = async (output, context) => {
2415
1925
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2416
1926
  return deserializeAws_restJson1DescribeChannelFlowCommandError(output, context);
2417
1927
  }
2418
- const contents = {
1928
+ const contents = map({
2419
1929
  $metadata: deserializeMetadata(output),
2420
- ChannelFlow: undefined,
2421
- };
1930
+ });
2422
1931
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2423
- if (data.ChannelFlow !== undefined && data.ChannelFlow !== null) {
1932
+ if (data.ChannelFlow != null) {
2424
1933
  contents.ChannelFlow = deserializeAws_restJson1ChannelFlow(data.ChannelFlow, context);
2425
1934
  }
2426
- return Promise.resolve(contents);
1935
+ return contents;
2427
1936
  };
2428
1937
  exports.deserializeAws_restJson1DescribeChannelFlowCommand = deserializeAws_restJson1DescribeChannelFlowCommand;
2429
1938
  const deserializeAws_restJson1DescribeChannelFlowCommandError = async (output, context) => {
@@ -2431,7 +1940,6 @@ const deserializeAws_restJson1DescribeChannelFlowCommandError = async (output, c
2431
1940
  ...output,
2432
1941
  body: await parseBody(output.body, context),
2433
1942
  };
2434
- let response;
2435
1943
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2436
1944
  switch (errorCode) {
2437
1945
  case "BadRequestException":
@@ -2454,29 +1962,26 @@ const deserializeAws_restJson1DescribeChannelFlowCommandError = async (output, c
2454
1962
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
2455
1963
  default:
2456
1964
  const parsedBody = parsedOutput.body;
2457
- const $metadata = deserializeMetadata(output);
2458
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2459
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
2460
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2461
- $fault: "client",
2462
- $metadata,
1965
+ (0, smithy_client_1.throwDefaultError)({
1966
+ output,
1967
+ parsedBody,
1968
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
1969
+ errorCode,
2463
1970
  });
2464
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2465
1971
  }
2466
1972
  };
2467
1973
  const deserializeAws_restJson1DescribeChannelMembershipCommand = async (output, context) => {
2468
1974
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2469
1975
  return deserializeAws_restJson1DescribeChannelMembershipCommandError(output, context);
2470
1976
  }
2471
- const contents = {
1977
+ const contents = map({
2472
1978
  $metadata: deserializeMetadata(output),
2473
- ChannelMembership: undefined,
2474
- };
1979
+ });
2475
1980
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2476
- if (data.ChannelMembership !== undefined && data.ChannelMembership !== null) {
1981
+ if (data.ChannelMembership != null) {
2477
1982
  contents.ChannelMembership = deserializeAws_restJson1ChannelMembership(data.ChannelMembership, context);
2478
1983
  }
2479
- return Promise.resolve(contents);
1984
+ return contents;
2480
1985
  };
2481
1986
  exports.deserializeAws_restJson1DescribeChannelMembershipCommand = deserializeAws_restJson1DescribeChannelMembershipCommand;
2482
1987
  const deserializeAws_restJson1DescribeChannelMembershipCommandError = async (output, context) => {
@@ -2484,7 +1989,6 @@ const deserializeAws_restJson1DescribeChannelMembershipCommandError = async (out
2484
1989
  ...output,
2485
1990
  body: await parseBody(output.body, context),
2486
1991
  };
2487
- let response;
2488
1992
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2489
1993
  switch (errorCode) {
2490
1994
  case "BadRequestException":
@@ -2510,29 +2014,26 @@ const deserializeAws_restJson1DescribeChannelMembershipCommandError = async (out
2510
2014
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
2511
2015
  default:
2512
2016
  const parsedBody = parsedOutput.body;
2513
- const $metadata = deserializeMetadata(output);
2514
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2515
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
2516
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2517
- $fault: "client",
2518
- $metadata,
2017
+ (0, smithy_client_1.throwDefaultError)({
2018
+ output,
2019
+ parsedBody,
2020
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
2021
+ errorCode,
2519
2022
  });
2520
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2521
2023
  }
2522
2024
  };
2523
2025
  const deserializeAws_restJson1DescribeChannelMembershipForAppInstanceUserCommand = async (output, context) => {
2524
2026
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2525
2027
  return deserializeAws_restJson1DescribeChannelMembershipForAppInstanceUserCommandError(output, context);
2526
2028
  }
2527
- const contents = {
2029
+ const contents = map({
2528
2030
  $metadata: deserializeMetadata(output),
2529
- ChannelMembership: undefined,
2530
- };
2031
+ });
2531
2032
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2532
- if (data.ChannelMembership !== undefined && data.ChannelMembership !== null) {
2033
+ if (data.ChannelMembership != null) {
2533
2034
  contents.ChannelMembership = deserializeAws_restJson1ChannelMembershipForAppInstanceUserSummary(data.ChannelMembership, context);
2534
2035
  }
2535
- return Promise.resolve(contents);
2036
+ return contents;
2536
2037
  };
2537
2038
  exports.deserializeAws_restJson1DescribeChannelMembershipForAppInstanceUserCommand = deserializeAws_restJson1DescribeChannelMembershipForAppInstanceUserCommand;
2538
2039
  const deserializeAws_restJson1DescribeChannelMembershipForAppInstanceUserCommandError = async (output, context) => {
@@ -2540,7 +2041,6 @@ const deserializeAws_restJson1DescribeChannelMembershipForAppInstanceUserCommand
2540
2041
  ...output,
2541
2042
  body: await parseBody(output.body, context),
2542
2043
  };
2543
- let response;
2544
2044
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2545
2045
  switch (errorCode) {
2546
2046
  case "BadRequestException":
@@ -2563,29 +2063,26 @@ const deserializeAws_restJson1DescribeChannelMembershipForAppInstanceUserCommand
2563
2063
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
2564
2064
  default:
2565
2065
  const parsedBody = parsedOutput.body;
2566
- const $metadata = deserializeMetadata(output);
2567
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2568
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
2569
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2570
- $fault: "client",
2571
- $metadata,
2066
+ (0, smithy_client_1.throwDefaultError)({
2067
+ output,
2068
+ parsedBody,
2069
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
2070
+ errorCode,
2572
2071
  });
2573
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2574
2072
  }
2575
2073
  };
2576
2074
  const deserializeAws_restJson1DescribeChannelModeratedByAppInstanceUserCommand = async (output, context) => {
2577
2075
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2578
2076
  return deserializeAws_restJson1DescribeChannelModeratedByAppInstanceUserCommandError(output, context);
2579
2077
  }
2580
- const contents = {
2078
+ const contents = map({
2581
2079
  $metadata: deserializeMetadata(output),
2582
- Channel: undefined,
2583
- };
2080
+ });
2584
2081
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2585
- if (data.Channel !== undefined && data.Channel !== null) {
2082
+ if (data.Channel != null) {
2586
2083
  contents.Channel = deserializeAws_restJson1ChannelModeratedByAppInstanceUserSummary(data.Channel, context);
2587
2084
  }
2588
- return Promise.resolve(contents);
2085
+ return contents;
2589
2086
  };
2590
2087
  exports.deserializeAws_restJson1DescribeChannelModeratedByAppInstanceUserCommand = deserializeAws_restJson1DescribeChannelModeratedByAppInstanceUserCommand;
2591
2088
  const deserializeAws_restJson1DescribeChannelModeratedByAppInstanceUserCommandError = async (output, context) => {
@@ -2593,7 +2090,6 @@ const deserializeAws_restJson1DescribeChannelModeratedByAppInstanceUserCommandEr
2593
2090
  ...output,
2594
2091
  body: await parseBody(output.body, context),
2595
2092
  };
2596
- let response;
2597
2093
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2598
2094
  switch (errorCode) {
2599
2095
  case "BadRequestException":
@@ -2616,29 +2112,26 @@ const deserializeAws_restJson1DescribeChannelModeratedByAppInstanceUserCommandEr
2616
2112
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
2617
2113
  default:
2618
2114
  const parsedBody = parsedOutput.body;
2619
- const $metadata = deserializeMetadata(output);
2620
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2621
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
2622
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2623
- $fault: "client",
2624
- $metadata,
2115
+ (0, smithy_client_1.throwDefaultError)({
2116
+ output,
2117
+ parsedBody,
2118
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
2119
+ errorCode,
2625
2120
  });
2626
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2627
2121
  }
2628
2122
  };
2629
2123
  const deserializeAws_restJson1DescribeChannelModeratorCommand = async (output, context) => {
2630
2124
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2631
2125
  return deserializeAws_restJson1DescribeChannelModeratorCommandError(output, context);
2632
2126
  }
2633
- const contents = {
2127
+ const contents = map({
2634
2128
  $metadata: deserializeMetadata(output),
2635
- ChannelModerator: undefined,
2636
- };
2129
+ });
2637
2130
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2638
- if (data.ChannelModerator !== undefined && data.ChannelModerator !== null) {
2131
+ if (data.ChannelModerator != null) {
2639
2132
  contents.ChannelModerator = deserializeAws_restJson1ChannelModerator(data.ChannelModerator, context);
2640
2133
  }
2641
- return Promise.resolve(contents);
2134
+ return contents;
2642
2135
  };
2643
2136
  exports.deserializeAws_restJson1DescribeChannelModeratorCommand = deserializeAws_restJson1DescribeChannelModeratorCommand;
2644
2137
  const deserializeAws_restJson1DescribeChannelModeratorCommandError = async (output, context) => {
@@ -2646,7 +2139,6 @@ const deserializeAws_restJson1DescribeChannelModeratorCommandError = async (outp
2646
2139
  ...output,
2647
2140
  body: await parseBody(output.body, context),
2648
2141
  };
2649
- let response;
2650
2142
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2651
2143
  switch (errorCode) {
2652
2144
  case "BadRequestException":
@@ -2672,25 +2164,23 @@ const deserializeAws_restJson1DescribeChannelModeratorCommandError = async (outp
2672
2164
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
2673
2165
  default:
2674
2166
  const parsedBody = parsedOutput.body;
2675
- const $metadata = deserializeMetadata(output);
2676
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2677
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
2678
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2679
- $fault: "client",
2680
- $metadata,
2167
+ (0, smithy_client_1.throwDefaultError)({
2168
+ output,
2169
+ parsedBody,
2170
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
2171
+ errorCode,
2681
2172
  });
2682
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2683
2173
  }
2684
2174
  };
2685
2175
  const deserializeAws_restJson1DisassociateChannelFlowCommand = async (output, context) => {
2686
2176
  if (output.statusCode !== 204 && output.statusCode >= 300) {
2687
2177
  return deserializeAws_restJson1DisassociateChannelFlowCommandError(output, context);
2688
2178
  }
2689
- const contents = {
2179
+ const contents = map({
2690
2180
  $metadata: deserializeMetadata(output),
2691
- };
2181
+ });
2692
2182
  await collectBody(output.body, context);
2693
- return Promise.resolve(contents);
2183
+ return contents;
2694
2184
  };
2695
2185
  exports.deserializeAws_restJson1DisassociateChannelFlowCommand = deserializeAws_restJson1DisassociateChannelFlowCommand;
2696
2186
  const deserializeAws_restJson1DisassociateChannelFlowCommandError = async (output, context) => {
@@ -2698,7 +2188,6 @@ const deserializeAws_restJson1DisassociateChannelFlowCommandError = async (outpu
2698
2188
  ...output,
2699
2189
  body: await parseBody(output.body, context),
2700
2190
  };
2701
- let response;
2702
2191
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2703
2192
  switch (errorCode) {
2704
2193
  case "BadRequestException":
@@ -2727,37 +2216,32 @@ const deserializeAws_restJson1DisassociateChannelFlowCommandError = async (outpu
2727
2216
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
2728
2217
  default:
2729
2218
  const parsedBody = parsedOutput.body;
2730
- const $metadata = deserializeMetadata(output);
2731
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2732
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
2733
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2734
- $fault: "client",
2735
- $metadata,
2219
+ (0, smithy_client_1.throwDefaultError)({
2220
+ output,
2221
+ parsedBody,
2222
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
2223
+ errorCode,
2736
2224
  });
2737
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2738
2225
  }
2739
2226
  };
2740
2227
  const deserializeAws_restJson1GetChannelMembershipPreferencesCommand = async (output, context) => {
2741
2228
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2742
2229
  return deserializeAws_restJson1GetChannelMembershipPreferencesCommandError(output, context);
2743
2230
  }
2744
- const contents = {
2231
+ const contents = map({
2745
2232
  $metadata: deserializeMetadata(output),
2746
- ChannelArn: undefined,
2747
- Member: undefined,
2748
- Preferences: undefined,
2749
- };
2233
+ });
2750
2234
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2751
- if (data.ChannelArn !== undefined && data.ChannelArn !== null) {
2235
+ if (data.ChannelArn != null) {
2752
2236
  contents.ChannelArn = (0, smithy_client_1.expectString)(data.ChannelArn);
2753
2237
  }
2754
- if (data.Member !== undefined && data.Member !== null) {
2238
+ if (data.Member != null) {
2755
2239
  contents.Member = deserializeAws_restJson1Identity(data.Member, context);
2756
2240
  }
2757
- if (data.Preferences !== undefined && data.Preferences !== null) {
2241
+ if (data.Preferences != null) {
2758
2242
  contents.Preferences = deserializeAws_restJson1ChannelMembershipPreferences(data.Preferences, context);
2759
2243
  }
2760
- return Promise.resolve(contents);
2244
+ return contents;
2761
2245
  };
2762
2246
  exports.deserializeAws_restJson1GetChannelMembershipPreferencesCommand = deserializeAws_restJson1GetChannelMembershipPreferencesCommand;
2763
2247
  const deserializeAws_restJson1GetChannelMembershipPreferencesCommandError = async (output, context) => {
@@ -2765,7 +2249,6 @@ const deserializeAws_restJson1GetChannelMembershipPreferencesCommandError = asyn
2765
2249
  ...output,
2766
2250
  body: await parseBody(output.body, context),
2767
2251
  };
2768
- let response;
2769
2252
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2770
2253
  switch (errorCode) {
2771
2254
  case "BadRequestException":
@@ -2788,29 +2271,26 @@ const deserializeAws_restJson1GetChannelMembershipPreferencesCommandError = asyn
2788
2271
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
2789
2272
  default:
2790
2273
  const parsedBody = parsedOutput.body;
2791
- const $metadata = deserializeMetadata(output);
2792
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2793
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
2794
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2795
- $fault: "client",
2796
- $metadata,
2274
+ (0, smithy_client_1.throwDefaultError)({
2275
+ output,
2276
+ parsedBody,
2277
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
2278
+ errorCode,
2797
2279
  });
2798
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2799
2280
  }
2800
2281
  };
2801
2282
  const deserializeAws_restJson1GetChannelMessageCommand = async (output, context) => {
2802
2283
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2803
2284
  return deserializeAws_restJson1GetChannelMessageCommandError(output, context);
2804
2285
  }
2805
- const contents = {
2286
+ const contents = map({
2806
2287
  $metadata: deserializeMetadata(output),
2807
- ChannelMessage: undefined,
2808
- };
2288
+ });
2809
2289
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2810
- if (data.ChannelMessage !== undefined && data.ChannelMessage !== null) {
2290
+ if (data.ChannelMessage != null) {
2811
2291
  contents.ChannelMessage = deserializeAws_restJson1ChannelMessage(data.ChannelMessage, context);
2812
2292
  }
2813
- return Promise.resolve(contents);
2293
+ return contents;
2814
2294
  };
2815
2295
  exports.deserializeAws_restJson1GetChannelMessageCommand = deserializeAws_restJson1GetChannelMessageCommand;
2816
2296
  const deserializeAws_restJson1GetChannelMessageCommandError = async (output, context) => {
@@ -2818,7 +2298,6 @@ const deserializeAws_restJson1GetChannelMessageCommandError = async (output, con
2818
2298
  ...output,
2819
2299
  body: await parseBody(output.body, context),
2820
2300
  };
2821
- let response;
2822
2301
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2823
2302
  switch (errorCode) {
2824
2303
  case "BadRequestException":
@@ -2844,29 +2323,26 @@ const deserializeAws_restJson1GetChannelMessageCommandError = async (output, con
2844
2323
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
2845
2324
  default:
2846
2325
  const parsedBody = parsedOutput.body;
2847
- const $metadata = deserializeMetadata(output);
2848
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2849
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
2850
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2851
- $fault: "client",
2852
- $metadata,
2326
+ (0, smithy_client_1.throwDefaultError)({
2327
+ output,
2328
+ parsedBody,
2329
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
2330
+ errorCode,
2853
2331
  });
2854
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2855
2332
  }
2856
2333
  };
2857
2334
  const deserializeAws_restJson1GetChannelMessageStatusCommand = async (output, context) => {
2858
2335
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2859
2336
  return deserializeAws_restJson1GetChannelMessageStatusCommandError(output, context);
2860
2337
  }
2861
- const contents = {
2338
+ const contents = map({
2862
2339
  $metadata: deserializeMetadata(output),
2863
- Status: undefined,
2864
- };
2340
+ });
2865
2341
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2866
- if (data.Status !== undefined && data.Status !== null) {
2342
+ if (data.Status != null) {
2867
2343
  contents.Status = deserializeAws_restJson1ChannelMessageStatusStructure(data.Status, context);
2868
2344
  }
2869
- return Promise.resolve(contents);
2345
+ return contents;
2870
2346
  };
2871
2347
  exports.deserializeAws_restJson1GetChannelMessageStatusCommand = deserializeAws_restJson1GetChannelMessageStatusCommand;
2872
2348
  const deserializeAws_restJson1GetChannelMessageStatusCommandError = async (output, context) => {
@@ -2874,7 +2350,6 @@ const deserializeAws_restJson1GetChannelMessageStatusCommandError = async (outpu
2874
2350
  ...output,
2875
2351
  body: await parseBody(output.body, context),
2876
2352
  };
2877
- let response;
2878
2353
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2879
2354
  switch (errorCode) {
2880
2355
  case "BadRequestException":
@@ -2897,29 +2372,26 @@ const deserializeAws_restJson1GetChannelMessageStatusCommandError = async (outpu
2897
2372
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
2898
2373
  default:
2899
2374
  const parsedBody = parsedOutput.body;
2900
- const $metadata = deserializeMetadata(output);
2901
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2902
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
2903
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2904
- $fault: "client",
2905
- $metadata,
2375
+ (0, smithy_client_1.throwDefaultError)({
2376
+ output,
2377
+ parsedBody,
2378
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
2379
+ errorCode,
2906
2380
  });
2907
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2908
2381
  }
2909
2382
  };
2910
2383
  const deserializeAws_restJson1GetMessagingSessionEndpointCommand = async (output, context) => {
2911
2384
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2912
2385
  return deserializeAws_restJson1GetMessagingSessionEndpointCommandError(output, context);
2913
2386
  }
2914
- const contents = {
2387
+ const contents = map({
2915
2388
  $metadata: deserializeMetadata(output),
2916
- Endpoint: undefined,
2917
- };
2389
+ });
2918
2390
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2919
- if (data.Endpoint !== undefined && data.Endpoint !== null) {
2391
+ if (data.Endpoint != null) {
2920
2392
  contents.Endpoint = deserializeAws_restJson1MessagingSessionEndpoint(data.Endpoint, context);
2921
2393
  }
2922
- return Promise.resolve(contents);
2394
+ return contents;
2923
2395
  };
2924
2396
  exports.deserializeAws_restJson1GetMessagingSessionEndpointCommand = deserializeAws_restJson1GetMessagingSessionEndpointCommand;
2925
2397
  const deserializeAws_restJson1GetMessagingSessionEndpointCommandError = async (output, context) => {
@@ -2927,7 +2399,6 @@ const deserializeAws_restJson1GetMessagingSessionEndpointCommandError = async (o
2927
2399
  ...output,
2928
2400
  body: await parseBody(output.body, context),
2929
2401
  };
2930
- let response;
2931
2402
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2932
2403
  switch (errorCode) {
2933
2404
  case "ForbiddenException":
@@ -2947,37 +2418,32 @@ const deserializeAws_restJson1GetMessagingSessionEndpointCommandError = async (o
2947
2418
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
2948
2419
  default:
2949
2420
  const parsedBody = parsedOutput.body;
2950
- const $metadata = deserializeMetadata(output);
2951
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2952
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
2953
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2954
- $fault: "client",
2955
- $metadata,
2421
+ (0, smithy_client_1.throwDefaultError)({
2422
+ output,
2423
+ parsedBody,
2424
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
2425
+ errorCode,
2956
2426
  });
2957
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2958
2427
  }
2959
2428
  };
2960
2429
  const deserializeAws_restJson1ListChannelBansCommand = async (output, context) => {
2961
2430
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2962
2431
  return deserializeAws_restJson1ListChannelBansCommandError(output, context);
2963
2432
  }
2964
- const contents = {
2433
+ const contents = map({
2965
2434
  $metadata: deserializeMetadata(output),
2966
- ChannelArn: undefined,
2967
- ChannelBans: undefined,
2968
- NextToken: undefined,
2969
- };
2435
+ });
2970
2436
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2971
- if (data.ChannelArn !== undefined && data.ChannelArn !== null) {
2437
+ if (data.ChannelArn != null) {
2972
2438
  contents.ChannelArn = (0, smithy_client_1.expectString)(data.ChannelArn);
2973
2439
  }
2974
- if (data.ChannelBans !== undefined && data.ChannelBans !== null) {
2440
+ if (data.ChannelBans != null) {
2975
2441
  contents.ChannelBans = deserializeAws_restJson1ChannelBanSummaryList(data.ChannelBans, context);
2976
2442
  }
2977
- if (data.NextToken !== undefined && data.NextToken !== null) {
2443
+ if (data.NextToken != null) {
2978
2444
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2979
2445
  }
2980
- return Promise.resolve(contents);
2446
+ return contents;
2981
2447
  };
2982
2448
  exports.deserializeAws_restJson1ListChannelBansCommand = deserializeAws_restJson1ListChannelBansCommand;
2983
2449
  const deserializeAws_restJson1ListChannelBansCommandError = async (output, context) => {
@@ -2985,7 +2451,6 @@ const deserializeAws_restJson1ListChannelBansCommandError = async (output, conte
2985
2451
  ...output,
2986
2452
  body: await parseBody(output.body, context),
2987
2453
  };
2988
- let response;
2989
2454
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2990
2455
  switch (errorCode) {
2991
2456
  case "BadRequestException":
@@ -3008,33 +2473,29 @@ const deserializeAws_restJson1ListChannelBansCommandError = async (output, conte
3008
2473
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
3009
2474
  default:
3010
2475
  const parsedBody = parsedOutput.body;
3011
- const $metadata = deserializeMetadata(output);
3012
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3013
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
3014
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3015
- $fault: "client",
3016
- $metadata,
2476
+ (0, smithy_client_1.throwDefaultError)({
2477
+ output,
2478
+ parsedBody,
2479
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
2480
+ errorCode,
3017
2481
  });
3018
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3019
2482
  }
3020
2483
  };
3021
2484
  const deserializeAws_restJson1ListChannelFlowsCommand = async (output, context) => {
3022
2485
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3023
2486
  return deserializeAws_restJson1ListChannelFlowsCommandError(output, context);
3024
2487
  }
3025
- const contents = {
2488
+ const contents = map({
3026
2489
  $metadata: deserializeMetadata(output),
3027
- ChannelFlows: undefined,
3028
- NextToken: undefined,
3029
- };
2490
+ });
3030
2491
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3031
- if (data.ChannelFlows !== undefined && data.ChannelFlows !== null) {
2492
+ if (data.ChannelFlows != null) {
3032
2493
  contents.ChannelFlows = deserializeAws_restJson1ChannelFlowSummaryList(data.ChannelFlows, context);
3033
2494
  }
3034
- if (data.NextToken !== undefined && data.NextToken !== null) {
2495
+ if (data.NextToken != null) {
3035
2496
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
3036
2497
  }
3037
- return Promise.resolve(contents);
2498
+ return contents;
3038
2499
  };
3039
2500
  exports.deserializeAws_restJson1ListChannelFlowsCommand = deserializeAws_restJson1ListChannelFlowsCommand;
3040
2501
  const deserializeAws_restJson1ListChannelFlowsCommandError = async (output, context) => {
@@ -3042,7 +2503,6 @@ const deserializeAws_restJson1ListChannelFlowsCommandError = async (output, cont
3042
2503
  ...output,
3043
2504
  body: await parseBody(output.body, context),
3044
2505
  };
3045
- let response;
3046
2506
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3047
2507
  switch (errorCode) {
3048
2508
  case "BadRequestException":
@@ -3065,37 +2525,32 @@ const deserializeAws_restJson1ListChannelFlowsCommandError = async (output, cont
3065
2525
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
3066
2526
  default:
3067
2527
  const parsedBody = parsedOutput.body;
3068
- const $metadata = deserializeMetadata(output);
3069
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3070
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
3071
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3072
- $fault: "client",
3073
- $metadata,
2528
+ (0, smithy_client_1.throwDefaultError)({
2529
+ output,
2530
+ parsedBody,
2531
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
2532
+ errorCode,
3074
2533
  });
3075
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3076
2534
  }
3077
2535
  };
3078
2536
  const deserializeAws_restJson1ListChannelMembershipsCommand = async (output, context) => {
3079
2537
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3080
2538
  return deserializeAws_restJson1ListChannelMembershipsCommandError(output, context);
3081
2539
  }
3082
- const contents = {
2540
+ const contents = map({
3083
2541
  $metadata: deserializeMetadata(output),
3084
- ChannelArn: undefined,
3085
- ChannelMemberships: undefined,
3086
- NextToken: undefined,
3087
- };
2542
+ });
3088
2543
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3089
- if (data.ChannelArn !== undefined && data.ChannelArn !== null) {
2544
+ if (data.ChannelArn != null) {
3090
2545
  contents.ChannelArn = (0, smithy_client_1.expectString)(data.ChannelArn);
3091
2546
  }
3092
- if (data.ChannelMemberships !== undefined && data.ChannelMemberships !== null) {
2547
+ if (data.ChannelMemberships != null) {
3093
2548
  contents.ChannelMemberships = deserializeAws_restJson1ChannelMembershipSummaryList(data.ChannelMemberships, context);
3094
2549
  }
3095
- if (data.NextToken !== undefined && data.NextToken !== null) {
2550
+ if (data.NextToken != null) {
3096
2551
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
3097
2552
  }
3098
- return Promise.resolve(contents);
2553
+ return contents;
3099
2554
  };
3100
2555
  exports.deserializeAws_restJson1ListChannelMembershipsCommand = deserializeAws_restJson1ListChannelMembershipsCommand;
3101
2556
  const deserializeAws_restJson1ListChannelMembershipsCommandError = async (output, context) => {
@@ -3103,7 +2558,6 @@ const deserializeAws_restJson1ListChannelMembershipsCommandError = async (output
3103
2558
  ...output,
3104
2559
  body: await parseBody(output.body, context),
3105
2560
  };
3106
- let response;
3107
2561
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3108
2562
  switch (errorCode) {
3109
2563
  case "BadRequestException":
@@ -3126,33 +2580,29 @@ const deserializeAws_restJson1ListChannelMembershipsCommandError = async (output
3126
2580
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
3127
2581
  default:
3128
2582
  const parsedBody = parsedOutput.body;
3129
- const $metadata = deserializeMetadata(output);
3130
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3131
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
3132
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3133
- $fault: "client",
3134
- $metadata,
2583
+ (0, smithy_client_1.throwDefaultError)({
2584
+ output,
2585
+ parsedBody,
2586
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
2587
+ errorCode,
3135
2588
  });
3136
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3137
2589
  }
3138
2590
  };
3139
2591
  const deserializeAws_restJson1ListChannelMembershipsForAppInstanceUserCommand = async (output, context) => {
3140
2592
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3141
2593
  return deserializeAws_restJson1ListChannelMembershipsForAppInstanceUserCommandError(output, context);
3142
2594
  }
3143
- const contents = {
2595
+ const contents = map({
3144
2596
  $metadata: deserializeMetadata(output),
3145
- ChannelMemberships: undefined,
3146
- NextToken: undefined,
3147
- };
2597
+ });
3148
2598
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3149
- if (data.ChannelMemberships !== undefined && data.ChannelMemberships !== null) {
2599
+ if (data.ChannelMemberships != null) {
3150
2600
  contents.ChannelMemberships = deserializeAws_restJson1ChannelMembershipForAppInstanceUserSummaryList(data.ChannelMemberships, context);
3151
2601
  }
3152
- if (data.NextToken !== undefined && data.NextToken !== null) {
2602
+ if (data.NextToken != null) {
3153
2603
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
3154
2604
  }
3155
- return Promise.resolve(contents);
2605
+ return contents;
3156
2606
  };
3157
2607
  exports.deserializeAws_restJson1ListChannelMembershipsForAppInstanceUserCommand = deserializeAws_restJson1ListChannelMembershipsForAppInstanceUserCommand;
3158
2608
  const deserializeAws_restJson1ListChannelMembershipsForAppInstanceUserCommandError = async (output, context) => {
@@ -3160,7 +2610,6 @@ const deserializeAws_restJson1ListChannelMembershipsForAppInstanceUserCommandErr
3160
2610
  ...output,
3161
2611
  body: await parseBody(output.body, context),
3162
2612
  };
3163
- let response;
3164
2613
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3165
2614
  switch (errorCode) {
3166
2615
  case "BadRequestException":
@@ -3183,37 +2632,32 @@ const deserializeAws_restJson1ListChannelMembershipsForAppInstanceUserCommandErr
3183
2632
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
3184
2633
  default:
3185
2634
  const parsedBody = parsedOutput.body;
3186
- const $metadata = deserializeMetadata(output);
3187
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3188
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
3189
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3190
- $fault: "client",
3191
- $metadata,
2635
+ (0, smithy_client_1.throwDefaultError)({
2636
+ output,
2637
+ parsedBody,
2638
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
2639
+ errorCode,
3192
2640
  });
3193
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3194
2641
  }
3195
2642
  };
3196
2643
  const deserializeAws_restJson1ListChannelMessagesCommand = async (output, context) => {
3197
2644
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3198
2645
  return deserializeAws_restJson1ListChannelMessagesCommandError(output, context);
3199
2646
  }
3200
- const contents = {
2647
+ const contents = map({
3201
2648
  $metadata: deserializeMetadata(output),
3202
- ChannelArn: undefined,
3203
- ChannelMessages: undefined,
3204
- NextToken: undefined,
3205
- };
2649
+ });
3206
2650
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3207
- if (data.ChannelArn !== undefined && data.ChannelArn !== null) {
2651
+ if (data.ChannelArn != null) {
3208
2652
  contents.ChannelArn = (0, smithy_client_1.expectString)(data.ChannelArn);
3209
2653
  }
3210
- if (data.ChannelMessages !== undefined && data.ChannelMessages !== null) {
2654
+ if (data.ChannelMessages != null) {
3211
2655
  contents.ChannelMessages = deserializeAws_restJson1ChannelMessageSummaryList(data.ChannelMessages, context);
3212
2656
  }
3213
- if (data.NextToken !== undefined && data.NextToken !== null) {
2657
+ if (data.NextToken != null) {
3214
2658
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
3215
2659
  }
3216
- return Promise.resolve(contents);
2660
+ return contents;
3217
2661
  };
3218
2662
  exports.deserializeAws_restJson1ListChannelMessagesCommand = deserializeAws_restJson1ListChannelMessagesCommand;
3219
2663
  const deserializeAws_restJson1ListChannelMessagesCommandError = async (output, context) => {
@@ -3221,7 +2665,6 @@ const deserializeAws_restJson1ListChannelMessagesCommandError = async (output, c
3221
2665
  ...output,
3222
2666
  body: await parseBody(output.body, context),
3223
2667
  };
3224
- let response;
3225
2668
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3226
2669
  switch (errorCode) {
3227
2670
  case "BadRequestException":
@@ -3244,37 +2687,32 @@ const deserializeAws_restJson1ListChannelMessagesCommandError = async (output, c
3244
2687
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
3245
2688
  default:
3246
2689
  const parsedBody = parsedOutput.body;
3247
- const $metadata = deserializeMetadata(output);
3248
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3249
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
3250
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3251
- $fault: "client",
3252
- $metadata,
2690
+ (0, smithy_client_1.throwDefaultError)({
2691
+ output,
2692
+ parsedBody,
2693
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
2694
+ errorCode,
3253
2695
  });
3254
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3255
2696
  }
3256
2697
  };
3257
2698
  const deserializeAws_restJson1ListChannelModeratorsCommand = async (output, context) => {
3258
2699
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3259
2700
  return deserializeAws_restJson1ListChannelModeratorsCommandError(output, context);
3260
2701
  }
3261
- const contents = {
2702
+ const contents = map({
3262
2703
  $metadata: deserializeMetadata(output),
3263
- ChannelArn: undefined,
3264
- ChannelModerators: undefined,
3265
- NextToken: undefined,
3266
- };
2704
+ });
3267
2705
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3268
- if (data.ChannelArn !== undefined && data.ChannelArn !== null) {
2706
+ if (data.ChannelArn != null) {
3269
2707
  contents.ChannelArn = (0, smithy_client_1.expectString)(data.ChannelArn);
3270
2708
  }
3271
- if (data.ChannelModerators !== undefined && data.ChannelModerators !== null) {
2709
+ if (data.ChannelModerators != null) {
3272
2710
  contents.ChannelModerators = deserializeAws_restJson1ChannelModeratorSummaryList(data.ChannelModerators, context);
3273
2711
  }
3274
- if (data.NextToken !== undefined && data.NextToken !== null) {
2712
+ if (data.NextToken != null) {
3275
2713
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
3276
2714
  }
3277
- return Promise.resolve(contents);
2715
+ return contents;
3278
2716
  };
3279
2717
  exports.deserializeAws_restJson1ListChannelModeratorsCommand = deserializeAws_restJson1ListChannelModeratorsCommand;
3280
2718
  const deserializeAws_restJson1ListChannelModeratorsCommandError = async (output, context) => {
@@ -3282,7 +2720,6 @@ const deserializeAws_restJson1ListChannelModeratorsCommandError = async (output,
3282
2720
  ...output,
3283
2721
  body: await parseBody(output.body, context),
3284
2722
  };
3285
- let response;
3286
2723
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3287
2724
  switch (errorCode) {
3288
2725
  case "BadRequestException":
@@ -3305,33 +2742,29 @@ const deserializeAws_restJson1ListChannelModeratorsCommandError = async (output,
3305
2742
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
3306
2743
  default:
3307
2744
  const parsedBody = parsedOutput.body;
3308
- const $metadata = deserializeMetadata(output);
3309
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3310
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
3311
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3312
- $fault: "client",
3313
- $metadata,
2745
+ (0, smithy_client_1.throwDefaultError)({
2746
+ output,
2747
+ parsedBody,
2748
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
2749
+ errorCode,
3314
2750
  });
3315
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3316
2751
  }
3317
2752
  };
3318
2753
  const deserializeAws_restJson1ListChannelsCommand = async (output, context) => {
3319
2754
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3320
2755
  return deserializeAws_restJson1ListChannelsCommandError(output, context);
3321
2756
  }
3322
- const contents = {
2757
+ const contents = map({
3323
2758
  $metadata: deserializeMetadata(output),
3324
- Channels: undefined,
3325
- NextToken: undefined,
3326
- };
2759
+ });
3327
2760
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3328
- if (data.Channels !== undefined && data.Channels !== null) {
2761
+ if (data.Channels != null) {
3329
2762
  contents.Channels = deserializeAws_restJson1ChannelSummaryList(data.Channels, context);
3330
2763
  }
3331
- if (data.NextToken !== undefined && data.NextToken !== null) {
2764
+ if (data.NextToken != null) {
3332
2765
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
3333
2766
  }
3334
- return Promise.resolve(contents);
2767
+ return contents;
3335
2768
  };
3336
2769
  exports.deserializeAws_restJson1ListChannelsCommand = deserializeAws_restJson1ListChannelsCommand;
3337
2770
  const deserializeAws_restJson1ListChannelsCommandError = async (output, context) => {
@@ -3339,7 +2772,6 @@ const deserializeAws_restJson1ListChannelsCommandError = async (output, context)
3339
2772
  ...output,
3340
2773
  body: await parseBody(output.body, context),
3341
2774
  };
3342
- let response;
3343
2775
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3344
2776
  switch (errorCode) {
3345
2777
  case "BadRequestException":
@@ -3362,33 +2794,29 @@ const deserializeAws_restJson1ListChannelsCommandError = async (output, context)
3362
2794
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
3363
2795
  default:
3364
2796
  const parsedBody = parsedOutput.body;
3365
- const $metadata = deserializeMetadata(output);
3366
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3367
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
3368
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3369
- $fault: "client",
3370
- $metadata,
2797
+ (0, smithy_client_1.throwDefaultError)({
2798
+ output,
2799
+ parsedBody,
2800
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
2801
+ errorCode,
3371
2802
  });
3372
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3373
2803
  }
3374
2804
  };
3375
2805
  const deserializeAws_restJson1ListChannelsAssociatedWithChannelFlowCommand = async (output, context) => {
3376
2806
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3377
2807
  return deserializeAws_restJson1ListChannelsAssociatedWithChannelFlowCommandError(output, context);
3378
2808
  }
3379
- const contents = {
2809
+ const contents = map({
3380
2810
  $metadata: deserializeMetadata(output),
3381
- Channels: undefined,
3382
- NextToken: undefined,
3383
- };
2811
+ });
3384
2812
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3385
- if (data.Channels !== undefined && data.Channels !== null) {
2813
+ if (data.Channels != null) {
3386
2814
  contents.Channels = deserializeAws_restJson1ChannelAssociatedWithFlowSummaryList(data.Channels, context);
3387
2815
  }
3388
- if (data.NextToken !== undefined && data.NextToken !== null) {
2816
+ if (data.NextToken != null) {
3389
2817
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
3390
2818
  }
3391
- return Promise.resolve(contents);
2819
+ return contents;
3392
2820
  };
3393
2821
  exports.deserializeAws_restJson1ListChannelsAssociatedWithChannelFlowCommand = deserializeAws_restJson1ListChannelsAssociatedWithChannelFlowCommand;
3394
2822
  const deserializeAws_restJson1ListChannelsAssociatedWithChannelFlowCommandError = async (output, context) => {
@@ -3396,7 +2824,6 @@ const deserializeAws_restJson1ListChannelsAssociatedWithChannelFlowCommandError
3396
2824
  ...output,
3397
2825
  body: await parseBody(output.body, context),
3398
2826
  };
3399
- let response;
3400
2827
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3401
2828
  switch (errorCode) {
3402
2829
  case "BadRequestException":
@@ -3419,33 +2846,29 @@ const deserializeAws_restJson1ListChannelsAssociatedWithChannelFlowCommandError
3419
2846
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
3420
2847
  default:
3421
2848
  const parsedBody = parsedOutput.body;
3422
- const $metadata = deserializeMetadata(output);
3423
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3424
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
3425
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3426
- $fault: "client",
3427
- $metadata,
2849
+ (0, smithy_client_1.throwDefaultError)({
2850
+ output,
2851
+ parsedBody,
2852
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
2853
+ errorCode,
3428
2854
  });
3429
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3430
2855
  }
3431
2856
  };
3432
2857
  const deserializeAws_restJson1ListChannelsModeratedByAppInstanceUserCommand = async (output, context) => {
3433
2858
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3434
2859
  return deserializeAws_restJson1ListChannelsModeratedByAppInstanceUserCommandError(output, context);
3435
2860
  }
3436
- const contents = {
2861
+ const contents = map({
3437
2862
  $metadata: deserializeMetadata(output),
3438
- Channels: undefined,
3439
- NextToken: undefined,
3440
- };
2863
+ });
3441
2864
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3442
- if (data.Channels !== undefined && data.Channels !== null) {
2865
+ if (data.Channels != null) {
3443
2866
  contents.Channels = deserializeAws_restJson1ChannelModeratedByAppInstanceUserSummaryList(data.Channels, context);
3444
2867
  }
3445
- if (data.NextToken !== undefined && data.NextToken !== null) {
2868
+ if (data.NextToken != null) {
3446
2869
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
3447
2870
  }
3448
- return Promise.resolve(contents);
2871
+ return contents;
3449
2872
  };
3450
2873
  exports.deserializeAws_restJson1ListChannelsModeratedByAppInstanceUserCommand = deserializeAws_restJson1ListChannelsModeratedByAppInstanceUserCommand;
3451
2874
  const deserializeAws_restJson1ListChannelsModeratedByAppInstanceUserCommandError = async (output, context) => {
@@ -3453,7 +2876,6 @@ const deserializeAws_restJson1ListChannelsModeratedByAppInstanceUserCommandError
3453
2876
  ...output,
3454
2877
  body: await parseBody(output.body, context),
3455
2878
  };
3456
- let response;
3457
2879
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3458
2880
  switch (errorCode) {
3459
2881
  case "BadRequestException":
@@ -3476,29 +2898,26 @@ const deserializeAws_restJson1ListChannelsModeratedByAppInstanceUserCommandError
3476
2898
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
3477
2899
  default:
3478
2900
  const parsedBody = parsedOutput.body;
3479
- const $metadata = deserializeMetadata(output);
3480
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3481
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
3482
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3483
- $fault: "client",
3484
- $metadata,
2901
+ (0, smithy_client_1.throwDefaultError)({
2902
+ output,
2903
+ parsedBody,
2904
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
2905
+ errorCode,
3485
2906
  });
3486
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3487
2907
  }
3488
2908
  };
3489
2909
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
3490
2910
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3491
2911
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
3492
2912
  }
3493
- const contents = {
2913
+ const contents = map({
3494
2914
  $metadata: deserializeMetadata(output),
3495
- Tags: undefined,
3496
- };
2915
+ });
3497
2916
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3498
- if (data.Tags !== undefined && data.Tags !== null) {
2917
+ if (data.Tags != null) {
3499
2918
  contents.Tags = deserializeAws_restJson1TagList(data.Tags, context);
3500
2919
  }
3501
- return Promise.resolve(contents);
2920
+ return contents;
3502
2921
  };
3503
2922
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
3504
2923
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -3506,7 +2925,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
3506
2925
  ...output,
3507
2926
  body: await parseBody(output.body, context),
3508
2927
  };
3509
- let response;
3510
2928
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3511
2929
  switch (errorCode) {
3512
2930
  case "BadRequestException":
@@ -3529,37 +2947,32 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
3529
2947
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
3530
2948
  default:
3531
2949
  const parsedBody = parsedOutput.body;
3532
- const $metadata = deserializeMetadata(output);
3533
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3534
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
3535
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3536
- $fault: "client",
3537
- $metadata,
2950
+ (0, smithy_client_1.throwDefaultError)({
2951
+ output,
2952
+ parsedBody,
2953
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
2954
+ errorCode,
3538
2955
  });
3539
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3540
2956
  }
3541
2957
  };
3542
2958
  const deserializeAws_restJson1PutChannelMembershipPreferencesCommand = async (output, context) => {
3543
2959
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3544
2960
  return deserializeAws_restJson1PutChannelMembershipPreferencesCommandError(output, context);
3545
2961
  }
3546
- const contents = {
2962
+ const contents = map({
3547
2963
  $metadata: deserializeMetadata(output),
3548
- ChannelArn: undefined,
3549
- Member: undefined,
3550
- Preferences: undefined,
3551
- };
2964
+ });
3552
2965
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3553
- if (data.ChannelArn !== undefined && data.ChannelArn !== null) {
2966
+ if (data.ChannelArn != null) {
3554
2967
  contents.ChannelArn = (0, smithy_client_1.expectString)(data.ChannelArn);
3555
2968
  }
3556
- if (data.Member !== undefined && data.Member !== null) {
2969
+ if (data.Member != null) {
3557
2970
  contents.Member = deserializeAws_restJson1Identity(data.Member, context);
3558
2971
  }
3559
- if (data.Preferences !== undefined && data.Preferences !== null) {
2972
+ if (data.Preferences != null) {
3560
2973
  contents.Preferences = deserializeAws_restJson1ChannelMembershipPreferences(data.Preferences, context);
3561
2974
  }
3562
- return Promise.resolve(contents);
2975
+ return contents;
3563
2976
  };
3564
2977
  exports.deserializeAws_restJson1PutChannelMembershipPreferencesCommand = deserializeAws_restJson1PutChannelMembershipPreferencesCommand;
3565
2978
  const deserializeAws_restJson1PutChannelMembershipPreferencesCommandError = async (output, context) => {
@@ -3567,7 +2980,6 @@ const deserializeAws_restJson1PutChannelMembershipPreferencesCommandError = asyn
3567
2980
  ...output,
3568
2981
  body: await parseBody(output.body, context),
3569
2982
  };
3570
- let response;
3571
2983
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3572
2984
  switch (errorCode) {
3573
2985
  case "BadRequestException":
@@ -3593,33 +3005,29 @@ const deserializeAws_restJson1PutChannelMembershipPreferencesCommandError = asyn
3593
3005
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
3594
3006
  default:
3595
3007
  const parsedBody = parsedOutput.body;
3596
- const $metadata = deserializeMetadata(output);
3597
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3598
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
3599
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3600
- $fault: "client",
3601
- $metadata,
3008
+ (0, smithy_client_1.throwDefaultError)({
3009
+ output,
3010
+ parsedBody,
3011
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
3012
+ errorCode,
3602
3013
  });
3603
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3604
3014
  }
3605
3015
  };
3606
3016
  const deserializeAws_restJson1RedactChannelMessageCommand = async (output, context) => {
3607
3017
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3608
3018
  return deserializeAws_restJson1RedactChannelMessageCommandError(output, context);
3609
3019
  }
3610
- const contents = {
3020
+ const contents = map({
3611
3021
  $metadata: deserializeMetadata(output),
3612
- ChannelArn: undefined,
3613
- MessageId: undefined,
3614
- };
3022
+ });
3615
3023
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3616
- if (data.ChannelArn !== undefined && data.ChannelArn !== null) {
3024
+ if (data.ChannelArn != null) {
3617
3025
  contents.ChannelArn = (0, smithy_client_1.expectString)(data.ChannelArn);
3618
3026
  }
3619
- if (data.MessageId !== undefined && data.MessageId !== null) {
3027
+ if (data.MessageId != null) {
3620
3028
  contents.MessageId = (0, smithy_client_1.expectString)(data.MessageId);
3621
3029
  }
3622
- return Promise.resolve(contents);
3030
+ return contents;
3623
3031
  };
3624
3032
  exports.deserializeAws_restJson1RedactChannelMessageCommand = deserializeAws_restJson1RedactChannelMessageCommand;
3625
3033
  const deserializeAws_restJson1RedactChannelMessageCommandError = async (output, context) => {
@@ -3627,7 +3035,6 @@ const deserializeAws_restJson1RedactChannelMessageCommandError = async (output,
3627
3035
  ...output,
3628
3036
  body: await parseBody(output.body, context),
3629
3037
  };
3630
- let response;
3631
3038
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3632
3039
  switch (errorCode) {
3633
3040
  case "BadRequestException":
@@ -3653,33 +3060,29 @@ const deserializeAws_restJson1RedactChannelMessageCommandError = async (output,
3653
3060
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
3654
3061
  default:
3655
3062
  const parsedBody = parsedOutput.body;
3656
- const $metadata = deserializeMetadata(output);
3657
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3658
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
3659
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3660
- $fault: "client",
3661
- $metadata,
3063
+ (0, smithy_client_1.throwDefaultError)({
3064
+ output,
3065
+ parsedBody,
3066
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
3067
+ errorCode,
3662
3068
  });
3663
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3664
3069
  }
3665
3070
  };
3666
3071
  const deserializeAws_restJson1SearchChannelsCommand = async (output, context) => {
3667
3072
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3668
3073
  return deserializeAws_restJson1SearchChannelsCommandError(output, context);
3669
3074
  }
3670
- const contents = {
3075
+ const contents = map({
3671
3076
  $metadata: deserializeMetadata(output),
3672
- Channels: undefined,
3673
- NextToken: undefined,
3674
- };
3077
+ });
3675
3078
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3676
- if (data.Channels !== undefined && data.Channels !== null) {
3079
+ if (data.Channels != null) {
3677
3080
  contents.Channels = deserializeAws_restJson1ChannelSummaryList(data.Channels, context);
3678
3081
  }
3679
- if (data.NextToken !== undefined && data.NextToken !== null) {
3082
+ if (data.NextToken != null) {
3680
3083
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
3681
3084
  }
3682
- return Promise.resolve(contents);
3085
+ return contents;
3683
3086
  };
3684
3087
  exports.deserializeAws_restJson1SearchChannelsCommand = deserializeAws_restJson1SearchChannelsCommand;
3685
3088
  const deserializeAws_restJson1SearchChannelsCommandError = async (output, context) => {
@@ -3687,7 +3090,6 @@ const deserializeAws_restJson1SearchChannelsCommandError = async (output, contex
3687
3090
  ...output,
3688
3091
  body: await parseBody(output.body, context),
3689
3092
  };
3690
- let response;
3691
3093
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3692
3094
  switch (errorCode) {
3693
3095
  case "BadRequestException":
@@ -3710,37 +3112,32 @@ const deserializeAws_restJson1SearchChannelsCommandError = async (output, contex
3710
3112
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
3711
3113
  default:
3712
3114
  const parsedBody = parsedOutput.body;
3713
- const $metadata = deserializeMetadata(output);
3714
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3715
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
3716
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3717
- $fault: "client",
3718
- $metadata,
3115
+ (0, smithy_client_1.throwDefaultError)({
3116
+ output,
3117
+ parsedBody,
3118
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
3119
+ errorCode,
3719
3120
  });
3720
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3721
3121
  }
3722
3122
  };
3723
3123
  const deserializeAws_restJson1SendChannelMessageCommand = async (output, context) => {
3724
3124
  if (output.statusCode !== 201 && output.statusCode >= 300) {
3725
3125
  return deserializeAws_restJson1SendChannelMessageCommandError(output, context);
3726
3126
  }
3727
- const contents = {
3127
+ const contents = map({
3728
3128
  $metadata: deserializeMetadata(output),
3729
- ChannelArn: undefined,
3730
- MessageId: undefined,
3731
- Status: undefined,
3732
- };
3129
+ });
3733
3130
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3734
- if (data.ChannelArn !== undefined && data.ChannelArn !== null) {
3131
+ if (data.ChannelArn != null) {
3735
3132
  contents.ChannelArn = (0, smithy_client_1.expectString)(data.ChannelArn);
3736
3133
  }
3737
- if (data.MessageId !== undefined && data.MessageId !== null) {
3134
+ if (data.MessageId != null) {
3738
3135
  contents.MessageId = (0, smithy_client_1.expectString)(data.MessageId);
3739
3136
  }
3740
- if (data.Status !== undefined && data.Status !== null) {
3137
+ if (data.Status != null) {
3741
3138
  contents.Status = deserializeAws_restJson1ChannelMessageStatusStructure(data.Status, context);
3742
3139
  }
3743
- return Promise.resolve(contents);
3140
+ return contents;
3744
3141
  };
3745
3142
  exports.deserializeAws_restJson1SendChannelMessageCommand = deserializeAws_restJson1SendChannelMessageCommand;
3746
3143
  const deserializeAws_restJson1SendChannelMessageCommandError = async (output, context) => {
@@ -3748,7 +3145,6 @@ const deserializeAws_restJson1SendChannelMessageCommandError = async (output, co
3748
3145
  ...output,
3749
3146
  body: await parseBody(output.body, context),
3750
3147
  };
3751
- let response;
3752
3148
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3753
3149
  switch (errorCode) {
3754
3150
  case "BadRequestException":
@@ -3774,25 +3170,23 @@ const deserializeAws_restJson1SendChannelMessageCommandError = async (output, co
3774
3170
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
3775
3171
  default:
3776
3172
  const parsedBody = parsedOutput.body;
3777
- const $metadata = deserializeMetadata(output);
3778
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3779
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
3780
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3781
- $fault: "client",
3782
- $metadata,
3173
+ (0, smithy_client_1.throwDefaultError)({
3174
+ output,
3175
+ parsedBody,
3176
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
3177
+ errorCode,
3783
3178
  });
3784
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3785
3179
  }
3786
3180
  };
3787
3181
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
3788
3182
  if (output.statusCode !== 204 && output.statusCode >= 300) {
3789
3183
  return deserializeAws_restJson1TagResourceCommandError(output, context);
3790
3184
  }
3791
- const contents = {
3185
+ const contents = map({
3792
3186
  $metadata: deserializeMetadata(output),
3793
- };
3187
+ });
3794
3188
  await collectBody(output.body, context);
3795
- return Promise.resolve(contents);
3189
+ return contents;
3796
3190
  };
3797
3191
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
3798
3192
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -3800,7 +3194,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
3800
3194
  ...output,
3801
3195
  body: await parseBody(output.body, context),
3802
3196
  };
3803
- let response;
3804
3197
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3805
3198
  switch (errorCode) {
3806
3199
  case "BadRequestException":
@@ -3826,25 +3219,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
3826
3219
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
3827
3220
  default:
3828
3221
  const parsedBody = parsedOutput.body;
3829
- const $metadata = deserializeMetadata(output);
3830
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3831
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
3832
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3833
- $fault: "client",
3834
- $metadata,
3222
+ (0, smithy_client_1.throwDefaultError)({
3223
+ output,
3224
+ parsedBody,
3225
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
3226
+ errorCode,
3835
3227
  });
3836
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3837
3228
  }
3838
3229
  };
3839
3230
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
3840
3231
  if (output.statusCode !== 204 && output.statusCode >= 300) {
3841
3232
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
3842
3233
  }
3843
- const contents = {
3234
+ const contents = map({
3844
3235
  $metadata: deserializeMetadata(output),
3845
- };
3236
+ });
3846
3237
  await collectBody(output.body, context);
3847
- return Promise.resolve(contents);
3238
+ return contents;
3848
3239
  };
3849
3240
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
3850
3241
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -3852,7 +3243,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
3852
3243
  ...output,
3853
3244
  body: await parseBody(output.body, context),
3854
3245
  };
3855
- let response;
3856
3246
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3857
3247
  switch (errorCode) {
3858
3248
  case "BadRequestException":
@@ -3875,29 +3265,26 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
3875
3265
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
3876
3266
  default:
3877
3267
  const parsedBody = parsedOutput.body;
3878
- const $metadata = deserializeMetadata(output);
3879
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3880
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
3881
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3882
- $fault: "client",
3883
- $metadata,
3268
+ (0, smithy_client_1.throwDefaultError)({
3269
+ output,
3270
+ parsedBody,
3271
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
3272
+ errorCode,
3884
3273
  });
3885
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3886
3274
  }
3887
3275
  };
3888
3276
  const deserializeAws_restJson1UpdateChannelCommand = async (output, context) => {
3889
3277
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3890
3278
  return deserializeAws_restJson1UpdateChannelCommandError(output, context);
3891
3279
  }
3892
- const contents = {
3280
+ const contents = map({
3893
3281
  $metadata: deserializeMetadata(output),
3894
- ChannelArn: undefined,
3895
- };
3282
+ });
3896
3283
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3897
- if (data.ChannelArn !== undefined && data.ChannelArn !== null) {
3284
+ if (data.ChannelArn != null) {
3898
3285
  contents.ChannelArn = (0, smithy_client_1.expectString)(data.ChannelArn);
3899
3286
  }
3900
- return Promise.resolve(contents);
3287
+ return contents;
3901
3288
  };
3902
3289
  exports.deserializeAws_restJson1UpdateChannelCommand = deserializeAws_restJson1UpdateChannelCommand;
3903
3290
  const deserializeAws_restJson1UpdateChannelCommandError = async (output, context) => {
@@ -3905,7 +3292,6 @@ const deserializeAws_restJson1UpdateChannelCommandError = async (output, context
3905
3292
  ...output,
3906
3293
  body: await parseBody(output.body, context),
3907
3294
  };
3908
- let response;
3909
3295
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3910
3296
  switch (errorCode) {
3911
3297
  case "BadRequestException":
@@ -3931,29 +3317,26 @@ const deserializeAws_restJson1UpdateChannelCommandError = async (output, context
3931
3317
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
3932
3318
  default:
3933
3319
  const parsedBody = parsedOutput.body;
3934
- const $metadata = deserializeMetadata(output);
3935
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3936
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
3937
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3938
- $fault: "client",
3939
- $metadata,
3320
+ (0, smithy_client_1.throwDefaultError)({
3321
+ output,
3322
+ parsedBody,
3323
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
3324
+ errorCode,
3940
3325
  });
3941
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3942
3326
  }
3943
3327
  };
3944
3328
  const deserializeAws_restJson1UpdateChannelFlowCommand = async (output, context) => {
3945
3329
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3946
3330
  return deserializeAws_restJson1UpdateChannelFlowCommandError(output, context);
3947
3331
  }
3948
- const contents = {
3332
+ const contents = map({
3949
3333
  $metadata: deserializeMetadata(output),
3950
- ChannelFlowArn: undefined,
3951
- };
3334
+ });
3952
3335
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3953
- if (data.ChannelFlowArn !== undefined && data.ChannelFlowArn !== null) {
3336
+ if (data.ChannelFlowArn != null) {
3954
3337
  contents.ChannelFlowArn = (0, smithy_client_1.expectString)(data.ChannelFlowArn);
3955
3338
  }
3956
- return Promise.resolve(contents);
3339
+ return contents;
3957
3340
  };
3958
3341
  exports.deserializeAws_restJson1UpdateChannelFlowCommand = deserializeAws_restJson1UpdateChannelFlowCommand;
3959
3342
  const deserializeAws_restJson1UpdateChannelFlowCommandError = async (output, context) => {
@@ -3961,7 +3344,6 @@ const deserializeAws_restJson1UpdateChannelFlowCommandError = async (output, con
3961
3344
  ...output,
3962
3345
  body: await parseBody(output.body, context),
3963
3346
  };
3964
- let response;
3965
3347
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3966
3348
  switch (errorCode) {
3967
3349
  case "BadRequestException":
@@ -3987,37 +3369,32 @@ const deserializeAws_restJson1UpdateChannelFlowCommandError = async (output, con
3987
3369
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
3988
3370
  default:
3989
3371
  const parsedBody = parsedOutput.body;
3990
- const $metadata = deserializeMetadata(output);
3991
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3992
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
3993
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3994
- $fault: "client",
3995
- $metadata,
3372
+ (0, smithy_client_1.throwDefaultError)({
3373
+ output,
3374
+ parsedBody,
3375
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
3376
+ errorCode,
3996
3377
  });
3997
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3998
3378
  }
3999
3379
  };
4000
3380
  const deserializeAws_restJson1UpdateChannelMessageCommand = async (output, context) => {
4001
3381
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4002
3382
  return deserializeAws_restJson1UpdateChannelMessageCommandError(output, context);
4003
3383
  }
4004
- const contents = {
3384
+ const contents = map({
4005
3385
  $metadata: deserializeMetadata(output),
4006
- ChannelArn: undefined,
4007
- MessageId: undefined,
4008
- Status: undefined,
4009
- };
3386
+ });
4010
3387
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4011
- if (data.ChannelArn !== undefined && data.ChannelArn !== null) {
3388
+ if (data.ChannelArn != null) {
4012
3389
  contents.ChannelArn = (0, smithy_client_1.expectString)(data.ChannelArn);
4013
3390
  }
4014
- if (data.MessageId !== undefined && data.MessageId !== null) {
3391
+ if (data.MessageId != null) {
4015
3392
  contents.MessageId = (0, smithy_client_1.expectString)(data.MessageId);
4016
3393
  }
4017
- if (data.Status !== undefined && data.Status !== null) {
3394
+ if (data.Status != null) {
4018
3395
  contents.Status = deserializeAws_restJson1ChannelMessageStatusStructure(data.Status, context);
4019
3396
  }
4020
- return Promise.resolve(contents);
3397
+ return contents;
4021
3398
  };
4022
3399
  exports.deserializeAws_restJson1UpdateChannelMessageCommand = deserializeAws_restJson1UpdateChannelMessageCommand;
4023
3400
  const deserializeAws_restJson1UpdateChannelMessageCommandError = async (output, context) => {
@@ -4025,7 +3402,6 @@ const deserializeAws_restJson1UpdateChannelMessageCommandError = async (output,
4025
3402
  ...output,
4026
3403
  body: await parseBody(output.body, context),
4027
3404
  };
4028
- let response;
4029
3405
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4030
3406
  switch (errorCode) {
4031
3407
  case "BadRequestException":
@@ -4051,29 +3427,26 @@ const deserializeAws_restJson1UpdateChannelMessageCommandError = async (output,
4051
3427
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
4052
3428
  default:
4053
3429
  const parsedBody = parsedOutput.body;
4054
- const $metadata = deserializeMetadata(output);
4055
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4056
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
4057
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4058
- $fault: "client",
4059
- $metadata,
3430
+ (0, smithy_client_1.throwDefaultError)({
3431
+ output,
3432
+ parsedBody,
3433
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
3434
+ errorCode,
4060
3435
  });
4061
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4062
3436
  }
4063
3437
  };
4064
3438
  const deserializeAws_restJson1UpdateChannelReadMarkerCommand = async (output, context) => {
4065
3439
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4066
3440
  return deserializeAws_restJson1UpdateChannelReadMarkerCommandError(output, context);
4067
3441
  }
4068
- const contents = {
3442
+ const contents = map({
4069
3443
  $metadata: deserializeMetadata(output),
4070
- ChannelArn: undefined,
4071
- };
3444
+ });
4072
3445
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4073
- if (data.ChannelArn !== undefined && data.ChannelArn !== null) {
3446
+ if (data.ChannelArn != null) {
4074
3447
  contents.ChannelArn = (0, smithy_client_1.expectString)(data.ChannelArn);
4075
3448
  }
4076
- return Promise.resolve(contents);
3449
+ return contents;
4077
3450
  };
4078
3451
  exports.deserializeAws_restJson1UpdateChannelReadMarkerCommand = deserializeAws_restJson1UpdateChannelReadMarkerCommand;
4079
3452
  const deserializeAws_restJson1UpdateChannelReadMarkerCommandError = async (output, context) => {
@@ -4081,7 +3454,6 @@ const deserializeAws_restJson1UpdateChannelReadMarkerCommandError = async (outpu
4081
3454
  ...output,
4082
3455
  body: await parseBody(output.body, context),
4083
3456
  };
4084
- let response;
4085
3457
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4086
3458
  switch (errorCode) {
4087
3459
  case "BadRequestException":
@@ -4107,23 +3479,22 @@ const deserializeAws_restJson1UpdateChannelReadMarkerCommandError = async (outpu
4107
3479
  throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
4108
3480
  default:
4109
3481
  const parsedBody = parsedOutput.body;
4110
- const $metadata = deserializeMetadata(output);
4111
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4112
- response = new ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException({
4113
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4114
- $fault: "client",
4115
- $metadata,
3482
+ (0, smithy_client_1.throwDefaultError)({
3483
+ output,
3484
+ parsedBody,
3485
+ exceptionCtor: ChimeSDKMessagingServiceException_1.ChimeSDKMessagingServiceException,
3486
+ errorCode,
4116
3487
  });
4117
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4118
3488
  }
4119
3489
  };
3490
+ const map = smithy_client_1.map;
4120
3491
  const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput, context) => {
4121
- const contents = {};
3492
+ const contents = map({});
4122
3493
  const data = parsedOutput.body;
4123
- if (data.Code !== undefined && data.Code !== null) {
3494
+ if (data.Code != null) {
4124
3495
  contents.Code = (0, smithy_client_1.expectString)(data.Code);
4125
3496
  }
4126
- if (data.Message !== undefined && data.Message !== null) {
3497
+ if (data.Message != null) {
4127
3498
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
4128
3499
  }
4129
3500
  const exception = new models_0_1.BadRequestException({
@@ -4133,12 +3504,12 @@ const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput,
4133
3504
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4134
3505
  };
4135
3506
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
4136
- const contents = {};
3507
+ const contents = map({});
4137
3508
  const data = parsedOutput.body;
4138
- if (data.Code !== undefined && data.Code !== null) {
3509
+ if (data.Code != null) {
4139
3510
  contents.Code = (0, smithy_client_1.expectString)(data.Code);
4140
3511
  }
4141
- if (data.Message !== undefined && data.Message !== null) {
3512
+ if (data.Message != null) {
4142
3513
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
4143
3514
  }
4144
3515
  const exception = new models_0_1.ConflictException({
@@ -4148,12 +3519,12 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
4148
3519
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4149
3520
  };
4150
3521
  const deserializeAws_restJson1ForbiddenExceptionResponse = async (parsedOutput, context) => {
4151
- const contents = {};
3522
+ const contents = map({});
4152
3523
  const data = parsedOutput.body;
4153
- if (data.Code !== undefined && data.Code !== null) {
3524
+ if (data.Code != null) {
4154
3525
  contents.Code = (0, smithy_client_1.expectString)(data.Code);
4155
3526
  }
4156
- if (data.Message !== undefined && data.Message !== null) {
3527
+ if (data.Message != null) {
4157
3528
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
4158
3529
  }
4159
3530
  const exception = new models_0_1.ForbiddenException({
@@ -4163,12 +3534,12 @@ const deserializeAws_restJson1ForbiddenExceptionResponse = async (parsedOutput,
4163
3534
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4164
3535
  };
4165
3536
  const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, context) => {
4166
- const contents = {};
3537
+ const contents = map({});
4167
3538
  const data = parsedOutput.body;
4168
- if (data.Code !== undefined && data.Code !== null) {
3539
+ if (data.Code != null) {
4169
3540
  contents.Code = (0, smithy_client_1.expectString)(data.Code);
4170
3541
  }
4171
- if (data.Message !== undefined && data.Message !== null) {
3542
+ if (data.Message != null) {
4172
3543
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
4173
3544
  }
4174
3545
  const exception = new models_0_1.NotFoundException({
@@ -4178,12 +3549,12 @@ const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, c
4178
3549
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4179
3550
  };
4180
3551
  const deserializeAws_restJson1ResourceLimitExceededExceptionResponse = async (parsedOutput, context) => {
4181
- const contents = {};
3552
+ const contents = map({});
4182
3553
  const data = parsedOutput.body;
4183
- if (data.Code !== undefined && data.Code !== null) {
3554
+ if (data.Code != null) {
4184
3555
  contents.Code = (0, smithy_client_1.expectString)(data.Code);
4185
3556
  }
4186
- if (data.Message !== undefined && data.Message !== null) {
3557
+ if (data.Message != null) {
4187
3558
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
4188
3559
  }
4189
3560
  const exception = new models_0_1.ResourceLimitExceededException({
@@ -4193,12 +3564,12 @@ const deserializeAws_restJson1ResourceLimitExceededExceptionResponse = async (pa
4193
3564
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4194
3565
  };
4195
3566
  const deserializeAws_restJson1ServiceFailureExceptionResponse = async (parsedOutput, context) => {
4196
- const contents = {};
3567
+ const contents = map({});
4197
3568
  const data = parsedOutput.body;
4198
- if (data.Code !== undefined && data.Code !== null) {
3569
+ if (data.Code != null) {
4199
3570
  contents.Code = (0, smithy_client_1.expectString)(data.Code);
4200
3571
  }
4201
- if (data.Message !== undefined && data.Message !== null) {
3572
+ if (data.Message != null) {
4202
3573
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
4203
3574
  }
4204
3575
  const exception = new models_0_1.ServiceFailureException({
@@ -4208,12 +3579,12 @@ const deserializeAws_restJson1ServiceFailureExceptionResponse = async (parsedOut
4208
3579
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4209
3580
  };
4210
3581
  const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async (parsedOutput, context) => {
4211
- const contents = {};
3582
+ const contents = map({});
4212
3583
  const data = parsedOutput.body;
4213
- if (data.Code !== undefined && data.Code !== null) {
3584
+ if (data.Code != null) {
4214
3585
  contents.Code = (0, smithy_client_1.expectString)(data.Code);
4215
3586
  }
4216
- if (data.Message !== undefined && data.Message !== null) {
3587
+ if (data.Message != null) {
4217
3588
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
4218
3589
  }
4219
3590
  const exception = new models_0_1.ServiceUnavailableException({
@@ -4223,12 +3594,12 @@ const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async (parse
4223
3594
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4224
3595
  };
4225
3596
  const deserializeAws_restJson1ThrottledClientExceptionResponse = async (parsedOutput, context) => {
4226
- const contents = {};
3597
+ const contents = map({});
4227
3598
  const data = parsedOutput.body;
4228
- if (data.Code !== undefined && data.Code !== null) {
3599
+ if (data.Code != null) {
4229
3600
  contents.Code = (0, smithy_client_1.expectString)(data.Code);
4230
3601
  }
4231
- if (data.Message !== undefined && data.Message !== null) {
3602
+ if (data.Message != null) {
4232
3603
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
4233
3604
  }
4234
3605
  const exception = new models_0_1.ThrottledClientException({
@@ -4238,12 +3609,12 @@ const deserializeAws_restJson1ThrottledClientExceptionResponse = async (parsedOu
4238
3609
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4239
3610
  };
4240
3611
  const deserializeAws_restJson1UnauthorizedClientExceptionResponse = async (parsedOutput, context) => {
4241
- const contents = {};
3612
+ const contents = map({});
4242
3613
  const data = parsedOutput.body;
4243
- if (data.Code !== undefined && data.Code !== null) {
3614
+ if (data.Code != null) {
4244
3615
  contents.Code = (0, smithy_client_1.expectString)(data.Code);
4245
3616
  }
4246
- if (data.Message !== undefined && data.Message !== null) {
3617
+ if (data.Message != null) {
4247
3618
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
4248
3619
  }
4249
3620
  const exception = new models_0_1.UnauthorizedClientException({
@@ -4256,9 +3627,6 @@ const serializeAws_restJson1ChannelMemberArns = (input, context) => {
4256
3627
  return input
4257
3628
  .filter((e) => e != null)
4258
3629
  .map((entry) => {
4259
- if (entry === null) {
4260
- return null;
4261
- }
4262
3630
  return entry;
4263
3631
  });
4264
3632
  };
@@ -4286,9 +3654,6 @@ const serializeAws_restJson1ChannelModeratorArns = (input, context) => {
4286
3654
  return input
4287
3655
  .filter((e) => e != null)
4288
3656
  .map((entry) => {
4289
- if (entry === null) {
4290
- return null;
4291
- }
4292
3657
  return entry;
4293
3658
  });
4294
3659
  };
@@ -4302,9 +3667,6 @@ const serializeAws_restJson1MemberArns = (input, context) => {
4302
3667
  return input
4303
3668
  .filter((e) => e != null)
4304
3669
  .map((entry) => {
4305
- if (entry === null) {
4306
- return null;
4307
- }
4308
3670
  return entry;
4309
3671
  });
4310
3672
  };
@@ -4323,9 +3685,6 @@ const serializeAws_restJson1MessageAttributeStringValues = (input, context) => {
4323
3685
  return input
4324
3686
  .filter((e) => e != null)
4325
3687
  .map((entry) => {
4326
- if (entry === null) {
4327
- return null;
4328
- }
4329
3688
  return entry;
4330
3689
  });
4331
3690
  };
@@ -4355,9 +3714,6 @@ const serializeAws_restJson1ProcessorList = (input, context) => {
4355
3714
  return input
4356
3715
  .filter((e) => e != null)
4357
3716
  .map((entry) => {
4358
- if (entry === null) {
4359
- return null;
4360
- }
4361
3717
  return serializeAws_restJson1Processor(entry, context);
4362
3718
  });
4363
3719
  };
@@ -4385,9 +3741,6 @@ const serializeAws_restJson1SearchFields = (input, context) => {
4385
3741
  return input
4386
3742
  .filter((e) => e != null)
4387
3743
  .map((entry) => {
4388
- if (entry === null) {
4389
- return null;
4390
- }
4391
3744
  return serializeAws_restJson1SearchField(entry, context);
4392
3745
  });
4393
3746
  };
@@ -4395,9 +3748,6 @@ const serializeAws_restJson1SearchFieldValues = (input, context) => {
4395
3748
  return input
4396
3749
  .filter((e) => e != null)
4397
3750
  .map((entry) => {
4398
- if (entry === null) {
4399
- return null;
4400
- }
4401
3751
  return entry;
4402
3752
  });
4403
3753
  };
@@ -4411,9 +3761,6 @@ const serializeAws_restJson1TagKeyList = (input, context) => {
4411
3761
  return input
4412
3762
  .filter((e) => e != null)
4413
3763
  .map((entry) => {
4414
- if (entry === null) {
4415
- return null;
4416
- }
4417
3764
  return entry;
4418
3765
  });
4419
3766
  };
@@ -4421,9 +3768,6 @@ const serializeAws_restJson1TagList = (input, context) => {
4421
3768
  return input
4422
3769
  .filter((e) => e != null)
4423
3770
  .map((entry) => {
4424
- if (entry === null) {
4425
- return null;
4426
- }
4427
3771
  return serializeAws_restJson1Tag(entry, context);
4428
3772
  });
4429
3773
  };