@aws-sdk/client-cognito-sync 3.141.0 → 3.142.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,16 +10,7 @@ const serializeAws_restJson1BulkPublishCommand = async (input, context) => {
10
10
  const headers = {};
11
11
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
12
12
  "/identitypools/{IdentityPoolId}/bulkpublish";
13
- if (input.IdentityPoolId !== undefined) {
14
- const labelValue = input.IdentityPoolId;
15
- if (labelValue.length <= 0) {
16
- throw new Error("Empty value provided for input HTTP label: IdentityPoolId.");
17
- }
18
- resolvedPath = resolvedPath.replace("{IdentityPoolId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
19
- }
20
- else {
21
- throw new Error("No value provided for input HTTP label: IdentityPoolId.");
22
- }
13
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
23
14
  let body;
24
15
  return new protocol_http_1.HttpRequest({
25
16
  protocol,
@@ -37,36 +28,9 @@ const serializeAws_restJson1DeleteDatasetCommand = async (input, context) => {
37
28
  const headers = {};
38
29
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
39
30
  "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}";
40
- if (input.IdentityPoolId !== undefined) {
41
- const labelValue = input.IdentityPoolId;
42
- if (labelValue.length <= 0) {
43
- throw new Error("Empty value provided for input HTTP label: IdentityPoolId.");
44
- }
45
- resolvedPath = resolvedPath.replace("{IdentityPoolId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
46
- }
47
- else {
48
- throw new Error("No value provided for input HTTP label: IdentityPoolId.");
49
- }
50
- if (input.IdentityId !== undefined) {
51
- const labelValue = input.IdentityId;
52
- if (labelValue.length <= 0) {
53
- throw new Error("Empty value provided for input HTTP label: IdentityId.");
54
- }
55
- resolvedPath = resolvedPath.replace("{IdentityId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
56
- }
57
- else {
58
- throw new Error("No value provided for input HTTP label: IdentityId.");
59
- }
60
- if (input.DatasetName !== undefined) {
61
- const labelValue = input.DatasetName;
62
- if (labelValue.length <= 0) {
63
- throw new Error("Empty value provided for input HTTP label: DatasetName.");
64
- }
65
- resolvedPath = resolvedPath.replace("{DatasetName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
66
- }
67
- else {
68
- throw new Error("No value provided for input HTTP label: DatasetName.");
69
- }
31
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
32
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityId", () => input.IdentityId, "{IdentityId}", false);
33
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DatasetName", () => input.DatasetName, "{DatasetName}", false);
70
34
  let body;
71
35
  return new protocol_http_1.HttpRequest({
72
36
  protocol,
@@ -84,36 +48,9 @@ const serializeAws_restJson1DescribeDatasetCommand = async (input, context) => {
84
48
  const headers = {};
85
49
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
86
50
  "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}";
87
- if (input.IdentityPoolId !== undefined) {
88
- const labelValue = input.IdentityPoolId;
89
- if (labelValue.length <= 0) {
90
- throw new Error("Empty value provided for input HTTP label: IdentityPoolId.");
91
- }
92
- resolvedPath = resolvedPath.replace("{IdentityPoolId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
93
- }
94
- else {
95
- throw new Error("No value provided for input HTTP label: IdentityPoolId.");
96
- }
97
- if (input.IdentityId !== undefined) {
98
- const labelValue = input.IdentityId;
99
- if (labelValue.length <= 0) {
100
- throw new Error("Empty value provided for input HTTP label: IdentityId.");
101
- }
102
- resolvedPath = resolvedPath.replace("{IdentityId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
103
- }
104
- else {
105
- throw new Error("No value provided for input HTTP label: IdentityId.");
106
- }
107
- if (input.DatasetName !== undefined) {
108
- const labelValue = input.DatasetName;
109
- if (labelValue.length <= 0) {
110
- throw new Error("Empty value provided for input HTTP label: DatasetName.");
111
- }
112
- resolvedPath = resolvedPath.replace("{DatasetName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
113
- }
114
- else {
115
- throw new Error("No value provided for input HTTP label: DatasetName.");
116
- }
51
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
52
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityId", () => input.IdentityId, "{IdentityId}", false);
53
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DatasetName", () => input.DatasetName, "{DatasetName}", false);
117
54
  let body;
118
55
  return new protocol_http_1.HttpRequest({
119
56
  protocol,
@@ -130,16 +67,7 @@ const serializeAws_restJson1DescribeIdentityPoolUsageCommand = async (input, con
130
67
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
131
68
  const headers = {};
132
69
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/identitypools/{IdentityPoolId}";
133
- if (input.IdentityPoolId !== undefined) {
134
- const labelValue = input.IdentityPoolId;
135
- if (labelValue.length <= 0) {
136
- throw new Error("Empty value provided for input HTTP label: IdentityPoolId.");
137
- }
138
- resolvedPath = resolvedPath.replace("{IdentityPoolId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
139
- }
140
- else {
141
- throw new Error("No value provided for input HTTP label: IdentityPoolId.");
142
- }
70
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
143
71
  let body;
144
72
  return new protocol_http_1.HttpRequest({
145
73
  protocol,
@@ -157,26 +85,8 @@ const serializeAws_restJson1DescribeIdentityUsageCommand = async (input, context
157
85
  const headers = {};
158
86
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
159
87
  "/identitypools/{IdentityPoolId}/identities/{IdentityId}";
160
- if (input.IdentityPoolId !== undefined) {
161
- const labelValue = input.IdentityPoolId;
162
- if (labelValue.length <= 0) {
163
- throw new Error("Empty value provided for input HTTP label: IdentityPoolId.");
164
- }
165
- resolvedPath = resolvedPath.replace("{IdentityPoolId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
166
- }
167
- else {
168
- throw new Error("No value provided for input HTTP label: IdentityPoolId.");
169
- }
170
- if (input.IdentityId !== undefined) {
171
- const labelValue = input.IdentityId;
172
- if (labelValue.length <= 0) {
173
- throw new Error("Empty value provided for input HTTP label: IdentityId.");
174
- }
175
- resolvedPath = resolvedPath.replace("{IdentityId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
176
- }
177
- else {
178
- throw new Error("No value provided for input HTTP label: IdentityId.");
179
- }
88
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
89
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityId", () => input.IdentityId, "{IdentityId}", false);
180
90
  let body;
181
91
  return new protocol_http_1.HttpRequest({
182
92
  protocol,
@@ -194,16 +104,7 @@ const serializeAws_restJson1GetBulkPublishDetailsCommand = async (input, context
194
104
  const headers = {};
195
105
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
196
106
  "/identitypools/{IdentityPoolId}/getBulkPublishDetails";
197
- if (input.IdentityPoolId !== undefined) {
198
- const labelValue = input.IdentityPoolId;
199
- if (labelValue.length <= 0) {
200
- throw new Error("Empty value provided for input HTTP label: IdentityPoolId.");
201
- }
202
- resolvedPath = resolvedPath.replace("{IdentityPoolId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
203
- }
204
- else {
205
- throw new Error("No value provided for input HTTP label: IdentityPoolId.");
206
- }
107
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
207
108
  let body;
208
109
  return new protocol_http_1.HttpRequest({
209
110
  protocol,
@@ -220,16 +121,7 @@ const serializeAws_restJson1GetCognitoEventsCommand = async (input, context) =>
220
121
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
221
122
  const headers = {};
222
123
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/identitypools/{IdentityPoolId}/events";
223
- if (input.IdentityPoolId !== undefined) {
224
- const labelValue = input.IdentityPoolId;
225
- if (labelValue.length <= 0) {
226
- throw new Error("Empty value provided for input HTTP label: IdentityPoolId.");
227
- }
228
- resolvedPath = resolvedPath.replace("{IdentityPoolId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
229
- }
230
- else {
231
- throw new Error("No value provided for input HTTP label: IdentityPoolId.");
232
- }
124
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
233
125
  let body;
234
126
  return new protocol_http_1.HttpRequest({
235
127
  protocol,
@@ -247,16 +139,7 @@ const serializeAws_restJson1GetIdentityPoolConfigurationCommand = async (input,
247
139
  const headers = {};
248
140
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
249
141
  "/identitypools/{IdentityPoolId}/configuration";
250
- if (input.IdentityPoolId !== undefined) {
251
- const labelValue = input.IdentityPoolId;
252
- if (labelValue.length <= 0) {
253
- throw new Error("Empty value provided for input HTTP label: IdentityPoolId.");
254
- }
255
- resolvedPath = resolvedPath.replace("{IdentityPoolId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
256
- }
257
- else {
258
- throw new Error("No value provided for input HTTP label: IdentityPoolId.");
259
- }
142
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
260
143
  let body;
261
144
  return new protocol_http_1.HttpRequest({
262
145
  protocol,
@@ -274,30 +157,12 @@ const serializeAws_restJson1ListDatasetsCommand = async (input, context) => {
274
157
  const headers = {};
275
158
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
276
159
  "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets";
277
- if (input.IdentityPoolId !== undefined) {
278
- const labelValue = input.IdentityPoolId;
279
- if (labelValue.length <= 0) {
280
- throw new Error("Empty value provided for input HTTP label: IdentityPoolId.");
281
- }
282
- resolvedPath = resolvedPath.replace("{IdentityPoolId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
283
- }
284
- else {
285
- throw new Error("No value provided for input HTTP label: IdentityPoolId.");
286
- }
287
- if (input.IdentityId !== undefined) {
288
- const labelValue = input.IdentityId;
289
- if (labelValue.length <= 0) {
290
- throw new Error("Empty value provided for input HTTP label: IdentityId.");
291
- }
292
- resolvedPath = resolvedPath.replace("{IdentityId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
293
- }
294
- else {
295
- throw new Error("No value provided for input HTTP label: IdentityId.");
296
- }
297
- const query = {
298
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
299
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
300
- };
160
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
161
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityId", () => input.IdentityId, "{IdentityId}", false);
162
+ const query = map({
163
+ nextToken: [, input.NextToken],
164
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
165
+ });
301
166
  let body;
302
167
  return new protocol_http_1.HttpRequest({
303
168
  protocol,
@@ -315,10 +180,10 @@ const serializeAws_restJson1ListIdentityPoolUsageCommand = async (input, context
315
180
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
316
181
  const headers = {};
317
182
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/identitypools";
318
- const query = {
319
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
320
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
321
- };
183
+ const query = map({
184
+ nextToken: [, input.NextToken],
185
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
186
+ });
322
187
  let body;
323
188
  return new protocol_http_1.HttpRequest({
324
189
  protocol,
@@ -337,42 +202,15 @@ const serializeAws_restJson1ListRecordsCommand = async (input, context) => {
337
202
  const headers = {};
338
203
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
339
204
  "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}/records";
340
- if (input.IdentityPoolId !== undefined) {
341
- const labelValue = input.IdentityPoolId;
342
- if (labelValue.length <= 0) {
343
- throw new Error("Empty value provided for input HTTP label: IdentityPoolId.");
344
- }
345
- resolvedPath = resolvedPath.replace("{IdentityPoolId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
346
- }
347
- else {
348
- throw new Error("No value provided for input HTTP label: IdentityPoolId.");
349
- }
350
- if (input.IdentityId !== undefined) {
351
- const labelValue = input.IdentityId;
352
- if (labelValue.length <= 0) {
353
- throw new Error("Empty value provided for input HTTP label: IdentityId.");
354
- }
355
- resolvedPath = resolvedPath.replace("{IdentityId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
356
- }
357
- else {
358
- throw new Error("No value provided for input HTTP label: IdentityId.");
359
- }
360
- if (input.DatasetName !== undefined) {
361
- const labelValue = input.DatasetName;
362
- if (labelValue.length <= 0) {
363
- throw new Error("Empty value provided for input HTTP label: DatasetName.");
364
- }
365
- resolvedPath = resolvedPath.replace("{DatasetName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
366
- }
367
- else {
368
- throw new Error("No value provided for input HTTP label: DatasetName.");
369
- }
370
- const query = {
371
- ...(input.LastSyncCount !== undefined && { lastSyncCount: input.LastSyncCount.toString() }),
372
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
373
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
374
- ...(input.SyncSessionToken !== undefined && { syncSessionToken: input.SyncSessionToken }),
375
- };
205
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
206
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityId", () => input.IdentityId, "{IdentityId}", false);
207
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DatasetName", () => input.DatasetName, "{DatasetName}", false);
208
+ const query = map({
209
+ lastSyncCount: [() => input.LastSyncCount !== void 0, () => input.LastSyncCount.toString()],
210
+ nextToken: [, input.NextToken],
211
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
212
+ syncSessionToken: [, input.SyncSessionToken],
213
+ });
376
214
  let body;
377
215
  return new protocol_http_1.HttpRequest({
378
216
  protocol,
@@ -393,26 +231,8 @@ const serializeAws_restJson1RegisterDeviceCommand = async (input, context) => {
393
231
  };
394
232
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
395
233
  "/identitypools/{IdentityPoolId}/identity/{IdentityId}/device";
396
- if (input.IdentityPoolId !== undefined) {
397
- const labelValue = input.IdentityPoolId;
398
- if (labelValue.length <= 0) {
399
- throw new Error("Empty value provided for input HTTP label: IdentityPoolId.");
400
- }
401
- resolvedPath = resolvedPath.replace("{IdentityPoolId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
402
- }
403
- else {
404
- throw new Error("No value provided for input HTTP label: IdentityPoolId.");
405
- }
406
- if (input.IdentityId !== undefined) {
407
- const labelValue = input.IdentityId;
408
- if (labelValue.length <= 0) {
409
- throw new Error("Empty value provided for input HTTP label: IdentityId.");
410
- }
411
- resolvedPath = resolvedPath.replace("{IdentityId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
412
- }
413
- else {
414
- throw new Error("No value provided for input HTTP label: IdentityId.");
415
- }
234
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
235
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityId", () => input.IdentityId, "{IdentityId}", false);
416
236
  let body;
417
237
  body = JSON.stringify({
418
238
  ...(input.Platform != null && { Platform: input.Platform }),
@@ -435,16 +255,7 @@ const serializeAws_restJson1SetCognitoEventsCommand = async (input, context) =>
435
255
  "content-type": "application/json",
436
256
  };
437
257
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/identitypools/{IdentityPoolId}/events";
438
- if (input.IdentityPoolId !== undefined) {
439
- const labelValue = input.IdentityPoolId;
440
- if (labelValue.length <= 0) {
441
- throw new Error("Empty value provided for input HTTP label: IdentityPoolId.");
442
- }
443
- resolvedPath = resolvedPath.replace("{IdentityPoolId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
444
- }
445
- else {
446
- throw new Error("No value provided for input HTTP label: IdentityPoolId.");
447
- }
258
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
448
259
  let body;
449
260
  body = JSON.stringify({
450
261
  ...(input.Events != null && { Events: serializeAws_restJson1Events(input.Events, context) }),
@@ -467,16 +278,7 @@ const serializeAws_restJson1SetIdentityPoolConfigurationCommand = async (input,
467
278
  };
468
279
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
469
280
  "/identitypools/{IdentityPoolId}/configuration";
470
- if (input.IdentityPoolId !== undefined) {
471
- const labelValue = input.IdentityPoolId;
472
- if (labelValue.length <= 0) {
473
- throw new Error("Empty value provided for input HTTP label: IdentityPoolId.");
474
- }
475
- resolvedPath = resolvedPath.replace("{IdentityPoolId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
476
- }
477
- else {
478
- throw new Error("No value provided for input HTTP label: IdentityPoolId.");
479
- }
281
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
480
282
  let body;
481
283
  body = JSON.stringify({
482
284
  ...(input.CognitoStreams != null && {
@@ -500,46 +302,10 @@ const serializeAws_restJson1SubscribeToDatasetCommand = async (input, context) =
500
302
  const headers = {};
501
303
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
502
304
  "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}/subscriptions/{DeviceId}";
503
- if (input.IdentityPoolId !== undefined) {
504
- const labelValue = input.IdentityPoolId;
505
- if (labelValue.length <= 0) {
506
- throw new Error("Empty value provided for input HTTP label: IdentityPoolId.");
507
- }
508
- resolvedPath = resolvedPath.replace("{IdentityPoolId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
509
- }
510
- else {
511
- throw new Error("No value provided for input HTTP label: IdentityPoolId.");
512
- }
513
- if (input.IdentityId !== undefined) {
514
- const labelValue = input.IdentityId;
515
- if (labelValue.length <= 0) {
516
- throw new Error("Empty value provided for input HTTP label: IdentityId.");
517
- }
518
- resolvedPath = resolvedPath.replace("{IdentityId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
519
- }
520
- else {
521
- throw new Error("No value provided for input HTTP label: IdentityId.");
522
- }
523
- if (input.DatasetName !== undefined) {
524
- const labelValue = input.DatasetName;
525
- if (labelValue.length <= 0) {
526
- throw new Error("Empty value provided for input HTTP label: DatasetName.");
527
- }
528
- resolvedPath = resolvedPath.replace("{DatasetName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
529
- }
530
- else {
531
- throw new Error("No value provided for input HTTP label: DatasetName.");
532
- }
533
- if (input.DeviceId !== undefined) {
534
- const labelValue = input.DeviceId;
535
- if (labelValue.length <= 0) {
536
- throw new Error("Empty value provided for input HTTP label: DeviceId.");
537
- }
538
- resolvedPath = resolvedPath.replace("{DeviceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
539
- }
540
- else {
541
- throw new Error("No value provided for input HTTP label: DeviceId.");
542
- }
305
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
306
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityId", () => input.IdentityId, "{IdentityId}", false);
307
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DatasetName", () => input.DatasetName, "{DatasetName}", false);
308
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DeviceId", () => input.DeviceId, "{DeviceId}", false);
543
309
  let body;
544
310
  return new protocol_http_1.HttpRequest({
545
311
  protocol,
@@ -557,46 +323,10 @@ const serializeAws_restJson1UnsubscribeFromDatasetCommand = async (input, contex
557
323
  const headers = {};
558
324
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
559
325
  "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}/subscriptions/{DeviceId}";
560
- if (input.IdentityPoolId !== undefined) {
561
- const labelValue = input.IdentityPoolId;
562
- if (labelValue.length <= 0) {
563
- throw new Error("Empty value provided for input HTTP label: IdentityPoolId.");
564
- }
565
- resolvedPath = resolvedPath.replace("{IdentityPoolId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
566
- }
567
- else {
568
- throw new Error("No value provided for input HTTP label: IdentityPoolId.");
569
- }
570
- if (input.IdentityId !== undefined) {
571
- const labelValue = input.IdentityId;
572
- if (labelValue.length <= 0) {
573
- throw new Error("Empty value provided for input HTTP label: IdentityId.");
574
- }
575
- resolvedPath = resolvedPath.replace("{IdentityId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
576
- }
577
- else {
578
- throw new Error("No value provided for input HTTP label: IdentityId.");
579
- }
580
- if (input.DatasetName !== undefined) {
581
- const labelValue = input.DatasetName;
582
- if (labelValue.length <= 0) {
583
- throw new Error("Empty value provided for input HTTP label: DatasetName.");
584
- }
585
- resolvedPath = resolvedPath.replace("{DatasetName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
586
- }
587
- else {
588
- throw new Error("No value provided for input HTTP label: DatasetName.");
589
- }
590
- if (input.DeviceId !== undefined) {
591
- const labelValue = input.DeviceId;
592
- if (labelValue.length <= 0) {
593
- throw new Error("Empty value provided for input HTTP label: DeviceId.");
594
- }
595
- resolvedPath = resolvedPath.replace("{DeviceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
596
- }
597
- else {
598
- throw new Error("No value provided for input HTTP label: DeviceId.");
599
- }
326
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
327
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityId", () => input.IdentityId, "{IdentityId}", false);
328
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DatasetName", () => input.DatasetName, "{DatasetName}", false);
329
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DeviceId", () => input.DeviceId, "{DeviceId}", false);
600
330
  let body;
601
331
  return new protocol_http_1.HttpRequest({
602
332
  protocol,
@@ -611,42 +341,15 @@ const serializeAws_restJson1UnsubscribeFromDatasetCommand = async (input, contex
611
341
  exports.serializeAws_restJson1UnsubscribeFromDatasetCommand = serializeAws_restJson1UnsubscribeFromDatasetCommand;
612
342
  const serializeAws_restJson1UpdateRecordsCommand = async (input, context) => {
613
343
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
614
- const headers = {
344
+ const headers = map({}, isSerializableHeaderValue, {
615
345
  "content-type": "application/json",
616
- ...(isSerializableHeaderValue(input.ClientContext) && { "x-amz-client-context": input.ClientContext }),
617
- };
346
+ "x-amz-client-context": input.ClientContext,
347
+ });
618
348
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
619
349
  "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}";
620
- if (input.IdentityPoolId !== undefined) {
621
- const labelValue = input.IdentityPoolId;
622
- if (labelValue.length <= 0) {
623
- throw new Error("Empty value provided for input HTTP label: IdentityPoolId.");
624
- }
625
- resolvedPath = resolvedPath.replace("{IdentityPoolId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
626
- }
627
- else {
628
- throw new Error("No value provided for input HTTP label: IdentityPoolId.");
629
- }
630
- if (input.IdentityId !== undefined) {
631
- const labelValue = input.IdentityId;
632
- if (labelValue.length <= 0) {
633
- throw new Error("Empty value provided for input HTTP label: IdentityId.");
634
- }
635
- resolvedPath = resolvedPath.replace("{IdentityId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
636
- }
637
- else {
638
- throw new Error("No value provided for input HTTP label: IdentityId.");
639
- }
640
- if (input.DatasetName !== undefined) {
641
- const labelValue = input.DatasetName;
642
- if (labelValue.length <= 0) {
643
- throw new Error("Empty value provided for input HTTP label: DatasetName.");
644
- }
645
- resolvedPath = resolvedPath.replace("{DatasetName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
646
- }
647
- else {
648
- throw new Error("No value provided for input HTTP label: DatasetName.");
649
- }
350
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
351
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IdentityId", () => input.IdentityId, "{IdentityId}", false);
352
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DatasetName", () => input.DatasetName, "{DatasetName}", false);
650
353
  let body;
651
354
  body = JSON.stringify({
652
355
  ...(input.DeviceId != null && { DeviceId: input.DeviceId }),
@@ -670,15 +373,14 @@ const deserializeAws_restJson1BulkPublishCommand = async (output, context) => {
670
373
  if (output.statusCode !== 200 && output.statusCode >= 300) {
671
374
  return deserializeAws_restJson1BulkPublishCommandError(output, context);
672
375
  }
673
- const contents = {
376
+ const contents = map({
674
377
  $metadata: deserializeMetadata(output),
675
- IdentityPoolId: undefined,
676
- };
378
+ });
677
379
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
678
- if (data.IdentityPoolId !== undefined && data.IdentityPoolId !== null) {
380
+ if (data.IdentityPoolId != null) {
679
381
  contents.IdentityPoolId = (0, smithy_client_1.expectString)(data.IdentityPoolId);
680
382
  }
681
- return Promise.resolve(contents);
383
+ return contents;
682
384
  };
683
385
  exports.deserializeAws_restJson1BulkPublishCommand = deserializeAws_restJson1BulkPublishCommand;
684
386
  const deserializeAws_restJson1BulkPublishCommandError = async (output, context) => {
@@ -686,7 +388,6 @@ const deserializeAws_restJson1BulkPublishCommandError = async (output, context)
686
388
  ...output,
687
389
  body: await parseBody(output.body, context),
688
390
  };
689
- let response;
690
391
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
691
392
  switch (errorCode) {
692
393
  case "AlreadyStreamedException":
@@ -709,29 +410,26 @@ const deserializeAws_restJson1BulkPublishCommandError = async (output, context)
709
410
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
710
411
  default:
711
412
  const parsedBody = parsedOutput.body;
712
- const $metadata = deserializeMetadata(output);
713
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
714
- response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
715
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
716
- $fault: "client",
717
- $metadata,
413
+ (0, smithy_client_1.throwDefaultError)({
414
+ output,
415
+ parsedBody,
416
+ exceptionCtor: CognitoSyncServiceException_1.CognitoSyncServiceException,
417
+ errorCode,
718
418
  });
719
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
720
419
  }
721
420
  };
722
421
  const deserializeAws_restJson1DeleteDatasetCommand = async (output, context) => {
723
422
  if (output.statusCode !== 200 && output.statusCode >= 300) {
724
423
  return deserializeAws_restJson1DeleteDatasetCommandError(output, context);
725
424
  }
726
- const contents = {
425
+ const contents = map({
727
426
  $metadata: deserializeMetadata(output),
728
- Dataset: undefined,
729
- };
427
+ });
730
428
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
731
- if (data.Dataset !== undefined && data.Dataset !== null) {
429
+ if (data.Dataset != null) {
732
430
  contents.Dataset = deserializeAws_restJson1Dataset(data.Dataset, context);
733
431
  }
734
- return Promise.resolve(contents);
432
+ return contents;
735
433
  };
736
434
  exports.deserializeAws_restJson1DeleteDatasetCommand = deserializeAws_restJson1DeleteDatasetCommand;
737
435
  const deserializeAws_restJson1DeleteDatasetCommandError = async (output, context) => {
@@ -739,7 +437,6 @@ const deserializeAws_restJson1DeleteDatasetCommandError = async (output, context
739
437
  ...output,
740
438
  body: await parseBody(output.body, context),
741
439
  };
742
- let response;
743
440
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
744
441
  switch (errorCode) {
745
442
  case "InternalErrorException":
@@ -762,29 +459,26 @@ const deserializeAws_restJson1DeleteDatasetCommandError = async (output, context
762
459
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
763
460
  default:
764
461
  const parsedBody = parsedOutput.body;
765
- const $metadata = deserializeMetadata(output);
766
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
767
- response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
768
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
769
- $fault: "client",
770
- $metadata,
462
+ (0, smithy_client_1.throwDefaultError)({
463
+ output,
464
+ parsedBody,
465
+ exceptionCtor: CognitoSyncServiceException_1.CognitoSyncServiceException,
466
+ errorCode,
771
467
  });
772
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
773
468
  }
774
469
  };
775
470
  const deserializeAws_restJson1DescribeDatasetCommand = async (output, context) => {
776
471
  if (output.statusCode !== 200 && output.statusCode >= 300) {
777
472
  return deserializeAws_restJson1DescribeDatasetCommandError(output, context);
778
473
  }
779
- const contents = {
474
+ const contents = map({
780
475
  $metadata: deserializeMetadata(output),
781
- Dataset: undefined,
782
- };
476
+ });
783
477
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
784
- if (data.Dataset !== undefined && data.Dataset !== null) {
478
+ if (data.Dataset != null) {
785
479
  contents.Dataset = deserializeAws_restJson1Dataset(data.Dataset, context);
786
480
  }
787
- return Promise.resolve(contents);
481
+ return contents;
788
482
  };
789
483
  exports.deserializeAws_restJson1DescribeDatasetCommand = deserializeAws_restJson1DescribeDatasetCommand;
790
484
  const deserializeAws_restJson1DescribeDatasetCommandError = async (output, context) => {
@@ -792,7 +486,6 @@ const deserializeAws_restJson1DescribeDatasetCommandError = async (output, conte
792
486
  ...output,
793
487
  body: await parseBody(output.body, context),
794
488
  };
795
- let response;
796
489
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
797
490
  switch (errorCode) {
798
491
  case "InternalErrorException":
@@ -812,29 +505,26 @@ const deserializeAws_restJson1DescribeDatasetCommandError = async (output, conte
812
505
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
813
506
  default:
814
507
  const parsedBody = parsedOutput.body;
815
- const $metadata = deserializeMetadata(output);
816
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
817
- response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
818
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
819
- $fault: "client",
820
- $metadata,
508
+ (0, smithy_client_1.throwDefaultError)({
509
+ output,
510
+ parsedBody,
511
+ exceptionCtor: CognitoSyncServiceException_1.CognitoSyncServiceException,
512
+ errorCode,
821
513
  });
822
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
823
514
  }
824
515
  };
825
516
  const deserializeAws_restJson1DescribeIdentityPoolUsageCommand = async (output, context) => {
826
517
  if (output.statusCode !== 200 && output.statusCode >= 300) {
827
518
  return deserializeAws_restJson1DescribeIdentityPoolUsageCommandError(output, context);
828
519
  }
829
- const contents = {
520
+ const contents = map({
830
521
  $metadata: deserializeMetadata(output),
831
- IdentityPoolUsage: undefined,
832
- };
522
+ });
833
523
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
834
- if (data.IdentityPoolUsage !== undefined && data.IdentityPoolUsage !== null) {
524
+ if (data.IdentityPoolUsage != null) {
835
525
  contents.IdentityPoolUsage = deserializeAws_restJson1IdentityPoolUsage(data.IdentityPoolUsage, context);
836
526
  }
837
- return Promise.resolve(contents);
527
+ return contents;
838
528
  };
839
529
  exports.deserializeAws_restJson1DescribeIdentityPoolUsageCommand = deserializeAws_restJson1DescribeIdentityPoolUsageCommand;
840
530
  const deserializeAws_restJson1DescribeIdentityPoolUsageCommandError = async (output, context) => {
@@ -842,7 +532,6 @@ const deserializeAws_restJson1DescribeIdentityPoolUsageCommandError = async (out
842
532
  ...output,
843
533
  body: await parseBody(output.body, context),
844
534
  };
845
- let response;
846
535
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
847
536
  switch (errorCode) {
848
537
  case "InternalErrorException":
@@ -862,29 +551,26 @@ const deserializeAws_restJson1DescribeIdentityPoolUsageCommandError = async (out
862
551
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
863
552
  default:
864
553
  const parsedBody = parsedOutput.body;
865
- const $metadata = deserializeMetadata(output);
866
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
867
- response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
868
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
869
- $fault: "client",
870
- $metadata,
554
+ (0, smithy_client_1.throwDefaultError)({
555
+ output,
556
+ parsedBody,
557
+ exceptionCtor: CognitoSyncServiceException_1.CognitoSyncServiceException,
558
+ errorCode,
871
559
  });
872
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
873
560
  }
874
561
  };
875
562
  const deserializeAws_restJson1DescribeIdentityUsageCommand = async (output, context) => {
876
563
  if (output.statusCode !== 200 && output.statusCode >= 300) {
877
564
  return deserializeAws_restJson1DescribeIdentityUsageCommandError(output, context);
878
565
  }
879
- const contents = {
566
+ const contents = map({
880
567
  $metadata: deserializeMetadata(output),
881
- IdentityUsage: undefined,
882
- };
568
+ });
883
569
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
884
- if (data.IdentityUsage !== undefined && data.IdentityUsage !== null) {
570
+ if (data.IdentityUsage != null) {
885
571
  contents.IdentityUsage = deserializeAws_restJson1IdentityUsage(data.IdentityUsage, context);
886
572
  }
887
- return Promise.resolve(contents);
573
+ return contents;
888
574
  };
889
575
  exports.deserializeAws_restJson1DescribeIdentityUsageCommand = deserializeAws_restJson1DescribeIdentityUsageCommand;
890
576
  const deserializeAws_restJson1DescribeIdentityUsageCommandError = async (output, context) => {
@@ -892,7 +578,6 @@ const deserializeAws_restJson1DescribeIdentityUsageCommandError = async (output,
892
578
  ...output,
893
579
  body: await parseBody(output.body, context),
894
580
  };
895
- let response;
896
581
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
897
582
  switch (errorCode) {
898
583
  case "InternalErrorException":
@@ -912,45 +597,38 @@ const deserializeAws_restJson1DescribeIdentityUsageCommandError = async (output,
912
597
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
913
598
  default:
914
599
  const parsedBody = parsedOutput.body;
915
- const $metadata = deserializeMetadata(output);
916
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
917
- response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
918
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
919
- $fault: "client",
920
- $metadata,
600
+ (0, smithy_client_1.throwDefaultError)({
601
+ output,
602
+ parsedBody,
603
+ exceptionCtor: CognitoSyncServiceException_1.CognitoSyncServiceException,
604
+ errorCode,
921
605
  });
922
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
923
606
  }
924
607
  };
925
608
  const deserializeAws_restJson1GetBulkPublishDetailsCommand = async (output, context) => {
926
609
  if (output.statusCode !== 200 && output.statusCode >= 300) {
927
610
  return deserializeAws_restJson1GetBulkPublishDetailsCommandError(output, context);
928
611
  }
929
- const contents = {
612
+ const contents = map({
930
613
  $metadata: deserializeMetadata(output),
931
- BulkPublishCompleteTime: undefined,
932
- BulkPublishStartTime: undefined,
933
- BulkPublishStatus: undefined,
934
- FailureMessage: undefined,
935
- IdentityPoolId: undefined,
936
- };
614
+ });
937
615
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
938
- if (data.BulkPublishCompleteTime !== undefined && data.BulkPublishCompleteTime !== null) {
616
+ if (data.BulkPublishCompleteTime != null) {
939
617
  contents.BulkPublishCompleteTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.BulkPublishCompleteTime)));
940
618
  }
941
- if (data.BulkPublishStartTime !== undefined && data.BulkPublishStartTime !== null) {
619
+ if (data.BulkPublishStartTime != null) {
942
620
  contents.BulkPublishStartTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.BulkPublishStartTime)));
943
621
  }
944
- if (data.BulkPublishStatus !== undefined && data.BulkPublishStatus !== null) {
622
+ if (data.BulkPublishStatus != null) {
945
623
  contents.BulkPublishStatus = (0, smithy_client_1.expectString)(data.BulkPublishStatus);
946
624
  }
947
- if (data.FailureMessage !== undefined && data.FailureMessage !== null) {
625
+ if (data.FailureMessage != null) {
948
626
  contents.FailureMessage = (0, smithy_client_1.expectString)(data.FailureMessage);
949
627
  }
950
- if (data.IdentityPoolId !== undefined && data.IdentityPoolId !== null) {
628
+ if (data.IdentityPoolId != null) {
951
629
  contents.IdentityPoolId = (0, smithy_client_1.expectString)(data.IdentityPoolId);
952
630
  }
953
- return Promise.resolve(contents);
631
+ return contents;
954
632
  };
955
633
  exports.deserializeAws_restJson1GetBulkPublishDetailsCommand = deserializeAws_restJson1GetBulkPublishDetailsCommand;
956
634
  const deserializeAws_restJson1GetBulkPublishDetailsCommandError = async (output, context) => {
@@ -958,7 +636,6 @@ const deserializeAws_restJson1GetBulkPublishDetailsCommandError = async (output,
958
636
  ...output,
959
637
  body: await parseBody(output.body, context),
960
638
  };
961
- let response;
962
639
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
963
640
  switch (errorCode) {
964
641
  case "InternalErrorException":
@@ -975,29 +652,26 @@ const deserializeAws_restJson1GetBulkPublishDetailsCommandError = async (output,
975
652
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
976
653
  default:
977
654
  const parsedBody = parsedOutput.body;
978
- const $metadata = deserializeMetadata(output);
979
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
980
- response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
981
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
982
- $fault: "client",
983
- $metadata,
655
+ (0, smithy_client_1.throwDefaultError)({
656
+ output,
657
+ parsedBody,
658
+ exceptionCtor: CognitoSyncServiceException_1.CognitoSyncServiceException,
659
+ errorCode,
984
660
  });
985
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
986
661
  }
987
662
  };
988
663
  const deserializeAws_restJson1GetCognitoEventsCommand = async (output, context) => {
989
664
  if (output.statusCode !== 200 && output.statusCode >= 300) {
990
665
  return deserializeAws_restJson1GetCognitoEventsCommandError(output, context);
991
666
  }
992
- const contents = {
667
+ const contents = map({
993
668
  $metadata: deserializeMetadata(output),
994
- Events: undefined,
995
- };
669
+ });
996
670
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
997
- if (data.Events !== undefined && data.Events !== null) {
671
+ if (data.Events != null) {
998
672
  contents.Events = deserializeAws_restJson1Events(data.Events, context);
999
673
  }
1000
- return Promise.resolve(contents);
674
+ return contents;
1001
675
  };
1002
676
  exports.deserializeAws_restJson1GetCognitoEventsCommand = deserializeAws_restJson1GetCognitoEventsCommand;
1003
677
  const deserializeAws_restJson1GetCognitoEventsCommandError = async (output, context) => {
@@ -1005,7 +679,6 @@ const deserializeAws_restJson1GetCognitoEventsCommandError = async (output, cont
1005
679
  ...output,
1006
680
  body: await parseBody(output.body, context),
1007
681
  };
1008
- let response;
1009
682
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1010
683
  switch (errorCode) {
1011
684
  case "InternalErrorException":
@@ -1025,37 +698,32 @@ const deserializeAws_restJson1GetCognitoEventsCommandError = async (output, cont
1025
698
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1026
699
  default:
1027
700
  const parsedBody = parsedOutput.body;
1028
- const $metadata = deserializeMetadata(output);
1029
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1030
- response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
1031
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1032
- $fault: "client",
1033
- $metadata,
701
+ (0, smithy_client_1.throwDefaultError)({
702
+ output,
703
+ parsedBody,
704
+ exceptionCtor: CognitoSyncServiceException_1.CognitoSyncServiceException,
705
+ errorCode,
1034
706
  });
1035
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1036
707
  }
1037
708
  };
1038
709
  const deserializeAws_restJson1GetIdentityPoolConfigurationCommand = async (output, context) => {
1039
710
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1040
711
  return deserializeAws_restJson1GetIdentityPoolConfigurationCommandError(output, context);
1041
712
  }
1042
- const contents = {
713
+ const contents = map({
1043
714
  $metadata: deserializeMetadata(output),
1044
- CognitoStreams: undefined,
1045
- IdentityPoolId: undefined,
1046
- PushSync: undefined,
1047
- };
715
+ });
1048
716
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1049
- if (data.CognitoStreams !== undefined && data.CognitoStreams !== null) {
717
+ if (data.CognitoStreams != null) {
1050
718
  contents.CognitoStreams = deserializeAws_restJson1CognitoStreams(data.CognitoStreams, context);
1051
719
  }
1052
- if (data.IdentityPoolId !== undefined && data.IdentityPoolId !== null) {
720
+ if (data.IdentityPoolId != null) {
1053
721
  contents.IdentityPoolId = (0, smithy_client_1.expectString)(data.IdentityPoolId);
1054
722
  }
1055
- if (data.PushSync !== undefined && data.PushSync !== null) {
723
+ if (data.PushSync != null) {
1056
724
  contents.PushSync = deserializeAws_restJson1PushSync(data.PushSync, context);
1057
725
  }
1058
- return Promise.resolve(contents);
726
+ return contents;
1059
727
  };
1060
728
  exports.deserializeAws_restJson1GetIdentityPoolConfigurationCommand = deserializeAws_restJson1GetIdentityPoolConfigurationCommand;
1061
729
  const deserializeAws_restJson1GetIdentityPoolConfigurationCommandError = async (output, context) => {
@@ -1063,7 +731,6 @@ const deserializeAws_restJson1GetIdentityPoolConfigurationCommandError = async (
1063
731
  ...output,
1064
732
  body: await parseBody(output.body, context),
1065
733
  };
1066
- let response;
1067
734
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1068
735
  switch (errorCode) {
1069
736
  case "InternalErrorException":
@@ -1083,37 +750,32 @@ const deserializeAws_restJson1GetIdentityPoolConfigurationCommandError = async (
1083
750
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1084
751
  default:
1085
752
  const parsedBody = parsedOutput.body;
1086
- const $metadata = deserializeMetadata(output);
1087
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1088
- response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
1089
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1090
- $fault: "client",
1091
- $metadata,
753
+ (0, smithy_client_1.throwDefaultError)({
754
+ output,
755
+ parsedBody,
756
+ exceptionCtor: CognitoSyncServiceException_1.CognitoSyncServiceException,
757
+ errorCode,
1092
758
  });
1093
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1094
759
  }
1095
760
  };
1096
761
  const deserializeAws_restJson1ListDatasetsCommand = async (output, context) => {
1097
762
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1098
763
  return deserializeAws_restJson1ListDatasetsCommandError(output, context);
1099
764
  }
1100
- const contents = {
765
+ const contents = map({
1101
766
  $metadata: deserializeMetadata(output),
1102
- Count: undefined,
1103
- Datasets: undefined,
1104
- NextToken: undefined,
1105
- };
767
+ });
1106
768
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1107
- if (data.Count !== undefined && data.Count !== null) {
769
+ if (data.Count != null) {
1108
770
  contents.Count = (0, smithy_client_1.expectInt32)(data.Count);
1109
771
  }
1110
- if (data.Datasets !== undefined && data.Datasets !== null) {
772
+ if (data.Datasets != null) {
1111
773
  contents.Datasets = deserializeAws_restJson1DatasetList(data.Datasets, context);
1112
774
  }
1113
- if (data.NextToken !== undefined && data.NextToken !== null) {
775
+ if (data.NextToken != null) {
1114
776
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1115
777
  }
1116
- return Promise.resolve(contents);
778
+ return contents;
1117
779
  };
1118
780
  exports.deserializeAws_restJson1ListDatasetsCommand = deserializeAws_restJson1ListDatasetsCommand;
1119
781
  const deserializeAws_restJson1ListDatasetsCommandError = async (output, context) => {
@@ -1121,7 +783,6 @@ const deserializeAws_restJson1ListDatasetsCommandError = async (output, context)
1121
783
  ...output,
1122
784
  body: await parseBody(output.body, context),
1123
785
  };
1124
- let response;
1125
786
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1126
787
  switch (errorCode) {
1127
788
  case "InternalErrorException":
@@ -1138,41 +799,35 @@ const deserializeAws_restJson1ListDatasetsCommandError = async (output, context)
1138
799
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1139
800
  default:
1140
801
  const parsedBody = parsedOutput.body;
1141
- const $metadata = deserializeMetadata(output);
1142
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1143
- response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
1144
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1145
- $fault: "client",
1146
- $metadata,
802
+ (0, smithy_client_1.throwDefaultError)({
803
+ output,
804
+ parsedBody,
805
+ exceptionCtor: CognitoSyncServiceException_1.CognitoSyncServiceException,
806
+ errorCode,
1147
807
  });
1148
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1149
808
  }
1150
809
  };
1151
810
  const deserializeAws_restJson1ListIdentityPoolUsageCommand = async (output, context) => {
1152
811
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1153
812
  return deserializeAws_restJson1ListIdentityPoolUsageCommandError(output, context);
1154
813
  }
1155
- const contents = {
814
+ const contents = map({
1156
815
  $metadata: deserializeMetadata(output),
1157
- Count: undefined,
1158
- IdentityPoolUsages: undefined,
1159
- MaxResults: undefined,
1160
- NextToken: undefined,
1161
- };
816
+ });
1162
817
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1163
- if (data.Count !== undefined && data.Count !== null) {
818
+ if (data.Count != null) {
1164
819
  contents.Count = (0, smithy_client_1.expectInt32)(data.Count);
1165
820
  }
1166
- if (data.IdentityPoolUsages !== undefined && data.IdentityPoolUsages !== null) {
821
+ if (data.IdentityPoolUsages != null) {
1167
822
  contents.IdentityPoolUsages = deserializeAws_restJson1IdentityPoolUsageList(data.IdentityPoolUsages, context);
1168
823
  }
1169
- if (data.MaxResults !== undefined && data.MaxResults !== null) {
824
+ if (data.MaxResults != null) {
1170
825
  contents.MaxResults = (0, smithy_client_1.expectInt32)(data.MaxResults);
1171
826
  }
1172
- if (data.NextToken !== undefined && data.NextToken !== null) {
827
+ if (data.NextToken != null) {
1173
828
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1174
829
  }
1175
- return Promise.resolve(contents);
830
+ return contents;
1176
831
  };
1177
832
  exports.deserializeAws_restJson1ListIdentityPoolUsageCommand = deserializeAws_restJson1ListIdentityPoolUsageCommand;
1178
833
  const deserializeAws_restJson1ListIdentityPoolUsageCommandError = async (output, context) => {
@@ -1180,7 +835,6 @@ const deserializeAws_restJson1ListIdentityPoolUsageCommandError = async (output,
1180
835
  ...output,
1181
836
  body: await parseBody(output.body, context),
1182
837
  };
1183
- let response;
1184
838
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1185
839
  switch (errorCode) {
1186
840
  case "InternalErrorException":
@@ -1197,61 +851,50 @@ const deserializeAws_restJson1ListIdentityPoolUsageCommandError = async (output,
1197
851
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1198
852
  default:
1199
853
  const parsedBody = parsedOutput.body;
1200
- const $metadata = deserializeMetadata(output);
1201
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1202
- response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
1203
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1204
- $fault: "client",
1205
- $metadata,
854
+ (0, smithy_client_1.throwDefaultError)({
855
+ output,
856
+ parsedBody,
857
+ exceptionCtor: CognitoSyncServiceException_1.CognitoSyncServiceException,
858
+ errorCode,
1206
859
  });
1207
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1208
860
  }
1209
861
  };
1210
862
  const deserializeAws_restJson1ListRecordsCommand = async (output, context) => {
1211
863
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1212
864
  return deserializeAws_restJson1ListRecordsCommandError(output, context);
1213
865
  }
1214
- const contents = {
866
+ const contents = map({
1215
867
  $metadata: deserializeMetadata(output),
1216
- Count: undefined,
1217
- DatasetDeletedAfterRequestedSyncCount: undefined,
1218
- DatasetExists: undefined,
1219
- DatasetSyncCount: undefined,
1220
- LastModifiedBy: undefined,
1221
- MergedDatasetNames: undefined,
1222
- NextToken: undefined,
1223
- Records: undefined,
1224
- SyncSessionToken: undefined,
1225
- };
868
+ });
1226
869
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1227
- if (data.Count !== undefined && data.Count !== null) {
870
+ if (data.Count != null) {
1228
871
  contents.Count = (0, smithy_client_1.expectInt32)(data.Count);
1229
872
  }
1230
- if (data.DatasetDeletedAfterRequestedSyncCount !== undefined && data.DatasetDeletedAfterRequestedSyncCount !== null) {
873
+ if (data.DatasetDeletedAfterRequestedSyncCount != null) {
1231
874
  contents.DatasetDeletedAfterRequestedSyncCount = (0, smithy_client_1.expectBoolean)(data.DatasetDeletedAfterRequestedSyncCount);
1232
875
  }
1233
- if (data.DatasetExists !== undefined && data.DatasetExists !== null) {
876
+ if (data.DatasetExists != null) {
1234
877
  contents.DatasetExists = (0, smithy_client_1.expectBoolean)(data.DatasetExists);
1235
878
  }
1236
- if (data.DatasetSyncCount !== undefined && data.DatasetSyncCount !== null) {
879
+ if (data.DatasetSyncCount != null) {
1237
880
  contents.DatasetSyncCount = (0, smithy_client_1.expectLong)(data.DatasetSyncCount);
1238
881
  }
1239
- if (data.LastModifiedBy !== undefined && data.LastModifiedBy !== null) {
882
+ if (data.LastModifiedBy != null) {
1240
883
  contents.LastModifiedBy = (0, smithy_client_1.expectString)(data.LastModifiedBy);
1241
884
  }
1242
- if (data.MergedDatasetNames !== undefined && data.MergedDatasetNames !== null) {
885
+ if (data.MergedDatasetNames != null) {
1243
886
  contents.MergedDatasetNames = deserializeAws_restJson1MergedDatasetNameList(data.MergedDatasetNames, context);
1244
887
  }
1245
- if (data.NextToken !== undefined && data.NextToken !== null) {
888
+ if (data.NextToken != null) {
1246
889
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1247
890
  }
1248
- if (data.Records !== undefined && data.Records !== null) {
891
+ if (data.Records != null) {
1249
892
  contents.Records = deserializeAws_restJson1RecordList(data.Records, context);
1250
893
  }
1251
- if (data.SyncSessionToken !== undefined && data.SyncSessionToken !== null) {
894
+ if (data.SyncSessionToken != null) {
1252
895
  contents.SyncSessionToken = (0, smithy_client_1.expectString)(data.SyncSessionToken);
1253
896
  }
1254
- return Promise.resolve(contents);
897
+ return contents;
1255
898
  };
1256
899
  exports.deserializeAws_restJson1ListRecordsCommand = deserializeAws_restJson1ListRecordsCommand;
1257
900
  const deserializeAws_restJson1ListRecordsCommandError = async (output, context) => {
@@ -1259,7 +902,6 @@ const deserializeAws_restJson1ListRecordsCommandError = async (output, context)
1259
902
  ...output,
1260
903
  body: await parseBody(output.body, context),
1261
904
  };
1262
- let response;
1263
905
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1264
906
  switch (errorCode) {
1265
907
  case "InternalErrorException":
@@ -1276,29 +918,26 @@ const deserializeAws_restJson1ListRecordsCommandError = async (output, context)
1276
918
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1277
919
  default:
1278
920
  const parsedBody = parsedOutput.body;
1279
- const $metadata = deserializeMetadata(output);
1280
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1281
- response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
1282
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1283
- $fault: "client",
1284
- $metadata,
921
+ (0, smithy_client_1.throwDefaultError)({
922
+ output,
923
+ parsedBody,
924
+ exceptionCtor: CognitoSyncServiceException_1.CognitoSyncServiceException,
925
+ errorCode,
1285
926
  });
1286
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1287
927
  }
1288
928
  };
1289
929
  const deserializeAws_restJson1RegisterDeviceCommand = async (output, context) => {
1290
930
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1291
931
  return deserializeAws_restJson1RegisterDeviceCommandError(output, context);
1292
932
  }
1293
- const contents = {
933
+ const contents = map({
1294
934
  $metadata: deserializeMetadata(output),
1295
- DeviceId: undefined,
1296
- };
935
+ });
1297
936
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1298
- if (data.DeviceId !== undefined && data.DeviceId !== null) {
937
+ if (data.DeviceId != null) {
1299
938
  contents.DeviceId = (0, smithy_client_1.expectString)(data.DeviceId);
1300
939
  }
1301
- return Promise.resolve(contents);
940
+ return contents;
1302
941
  };
1303
942
  exports.deserializeAws_restJson1RegisterDeviceCommand = deserializeAws_restJson1RegisterDeviceCommand;
1304
943
  const deserializeAws_restJson1RegisterDeviceCommandError = async (output, context) => {
@@ -1306,7 +945,6 @@ const deserializeAws_restJson1RegisterDeviceCommandError = async (output, contex
1306
945
  ...output,
1307
946
  body: await parseBody(output.body, context),
1308
947
  };
1309
- let response;
1310
948
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1311
949
  switch (errorCode) {
1312
950
  case "InternalErrorException":
@@ -1329,25 +967,23 @@ const deserializeAws_restJson1RegisterDeviceCommandError = async (output, contex
1329
967
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1330
968
  default:
1331
969
  const parsedBody = parsedOutput.body;
1332
- const $metadata = deserializeMetadata(output);
1333
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1334
- response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
1335
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1336
- $fault: "client",
1337
- $metadata,
970
+ (0, smithy_client_1.throwDefaultError)({
971
+ output,
972
+ parsedBody,
973
+ exceptionCtor: CognitoSyncServiceException_1.CognitoSyncServiceException,
974
+ errorCode,
1338
975
  });
1339
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1340
976
  }
1341
977
  };
1342
978
  const deserializeAws_restJson1SetCognitoEventsCommand = async (output, context) => {
1343
979
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1344
980
  return deserializeAws_restJson1SetCognitoEventsCommandError(output, context);
1345
981
  }
1346
- const contents = {
982
+ const contents = map({
1347
983
  $metadata: deserializeMetadata(output),
1348
- };
984
+ });
1349
985
  await collectBody(output.body, context);
1350
- return Promise.resolve(contents);
986
+ return contents;
1351
987
  };
1352
988
  exports.deserializeAws_restJson1SetCognitoEventsCommand = deserializeAws_restJson1SetCognitoEventsCommand;
1353
989
  const deserializeAws_restJson1SetCognitoEventsCommandError = async (output, context) => {
@@ -1355,7 +991,6 @@ const deserializeAws_restJson1SetCognitoEventsCommandError = async (output, cont
1355
991
  ...output,
1356
992
  body: await parseBody(output.body, context),
1357
993
  };
1358
- let response;
1359
994
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1360
995
  switch (errorCode) {
1361
996
  case "InternalErrorException":
@@ -1375,37 +1010,32 @@ const deserializeAws_restJson1SetCognitoEventsCommandError = async (output, cont
1375
1010
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1376
1011
  default:
1377
1012
  const parsedBody = parsedOutput.body;
1378
- const $metadata = deserializeMetadata(output);
1379
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1380
- response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
1381
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1382
- $fault: "client",
1383
- $metadata,
1013
+ (0, smithy_client_1.throwDefaultError)({
1014
+ output,
1015
+ parsedBody,
1016
+ exceptionCtor: CognitoSyncServiceException_1.CognitoSyncServiceException,
1017
+ errorCode,
1384
1018
  });
1385
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1386
1019
  }
1387
1020
  };
1388
1021
  const deserializeAws_restJson1SetIdentityPoolConfigurationCommand = async (output, context) => {
1389
1022
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1390
1023
  return deserializeAws_restJson1SetIdentityPoolConfigurationCommandError(output, context);
1391
1024
  }
1392
- const contents = {
1025
+ const contents = map({
1393
1026
  $metadata: deserializeMetadata(output),
1394
- CognitoStreams: undefined,
1395
- IdentityPoolId: undefined,
1396
- PushSync: undefined,
1397
- };
1027
+ });
1398
1028
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1399
- if (data.CognitoStreams !== undefined && data.CognitoStreams !== null) {
1029
+ if (data.CognitoStreams != null) {
1400
1030
  contents.CognitoStreams = deserializeAws_restJson1CognitoStreams(data.CognitoStreams, context);
1401
1031
  }
1402
- if (data.IdentityPoolId !== undefined && data.IdentityPoolId !== null) {
1032
+ if (data.IdentityPoolId != null) {
1403
1033
  contents.IdentityPoolId = (0, smithy_client_1.expectString)(data.IdentityPoolId);
1404
1034
  }
1405
- if (data.PushSync !== undefined && data.PushSync !== null) {
1035
+ if (data.PushSync != null) {
1406
1036
  contents.PushSync = deserializeAws_restJson1PushSync(data.PushSync, context);
1407
1037
  }
1408
- return Promise.resolve(contents);
1038
+ return contents;
1409
1039
  };
1410
1040
  exports.deserializeAws_restJson1SetIdentityPoolConfigurationCommand = deserializeAws_restJson1SetIdentityPoolConfigurationCommand;
1411
1041
  const deserializeAws_restJson1SetIdentityPoolConfigurationCommandError = async (output, context) => {
@@ -1413,7 +1043,6 @@ const deserializeAws_restJson1SetIdentityPoolConfigurationCommandError = async (
1413
1043
  ...output,
1414
1044
  body: await parseBody(output.body, context),
1415
1045
  };
1416
- let response;
1417
1046
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1418
1047
  switch (errorCode) {
1419
1048
  case "ConcurrentModificationException":
@@ -1436,25 +1065,23 @@ const deserializeAws_restJson1SetIdentityPoolConfigurationCommandError = async (
1436
1065
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1437
1066
  default:
1438
1067
  const parsedBody = parsedOutput.body;
1439
- const $metadata = deserializeMetadata(output);
1440
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1441
- response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
1442
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1443
- $fault: "client",
1444
- $metadata,
1068
+ (0, smithy_client_1.throwDefaultError)({
1069
+ output,
1070
+ parsedBody,
1071
+ exceptionCtor: CognitoSyncServiceException_1.CognitoSyncServiceException,
1072
+ errorCode,
1445
1073
  });
1446
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1447
1074
  }
1448
1075
  };
1449
1076
  const deserializeAws_restJson1SubscribeToDatasetCommand = async (output, context) => {
1450
1077
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1451
1078
  return deserializeAws_restJson1SubscribeToDatasetCommandError(output, context);
1452
1079
  }
1453
- const contents = {
1080
+ const contents = map({
1454
1081
  $metadata: deserializeMetadata(output),
1455
- };
1082
+ });
1456
1083
  await collectBody(output.body, context);
1457
- return Promise.resolve(contents);
1084
+ return contents;
1458
1085
  };
1459
1086
  exports.deserializeAws_restJson1SubscribeToDatasetCommand = deserializeAws_restJson1SubscribeToDatasetCommand;
1460
1087
  const deserializeAws_restJson1SubscribeToDatasetCommandError = async (output, context) => {
@@ -1462,7 +1089,6 @@ const deserializeAws_restJson1SubscribeToDatasetCommandError = async (output, co
1462
1089
  ...output,
1463
1090
  body: await parseBody(output.body, context),
1464
1091
  };
1465
- let response;
1466
1092
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1467
1093
  switch (errorCode) {
1468
1094
  case "InternalErrorException":
@@ -1485,25 +1111,23 @@ const deserializeAws_restJson1SubscribeToDatasetCommandError = async (output, co
1485
1111
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1486
1112
  default:
1487
1113
  const parsedBody = parsedOutput.body;
1488
- const $metadata = deserializeMetadata(output);
1489
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1490
- response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
1491
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1492
- $fault: "client",
1493
- $metadata,
1114
+ (0, smithy_client_1.throwDefaultError)({
1115
+ output,
1116
+ parsedBody,
1117
+ exceptionCtor: CognitoSyncServiceException_1.CognitoSyncServiceException,
1118
+ errorCode,
1494
1119
  });
1495
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1496
1120
  }
1497
1121
  };
1498
1122
  const deserializeAws_restJson1UnsubscribeFromDatasetCommand = async (output, context) => {
1499
1123
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1500
1124
  return deserializeAws_restJson1UnsubscribeFromDatasetCommandError(output, context);
1501
1125
  }
1502
- const contents = {
1126
+ const contents = map({
1503
1127
  $metadata: deserializeMetadata(output),
1504
- };
1128
+ });
1505
1129
  await collectBody(output.body, context);
1506
- return Promise.resolve(contents);
1130
+ return contents;
1507
1131
  };
1508
1132
  exports.deserializeAws_restJson1UnsubscribeFromDatasetCommand = deserializeAws_restJson1UnsubscribeFromDatasetCommand;
1509
1133
  const deserializeAws_restJson1UnsubscribeFromDatasetCommandError = async (output, context) => {
@@ -1511,7 +1135,6 @@ const deserializeAws_restJson1UnsubscribeFromDatasetCommandError = async (output
1511
1135
  ...output,
1512
1136
  body: await parseBody(output.body, context),
1513
1137
  };
1514
- let response;
1515
1138
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1516
1139
  switch (errorCode) {
1517
1140
  case "InternalErrorException":
@@ -1534,29 +1157,26 @@ const deserializeAws_restJson1UnsubscribeFromDatasetCommandError = async (output
1534
1157
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1535
1158
  default:
1536
1159
  const parsedBody = parsedOutput.body;
1537
- const $metadata = deserializeMetadata(output);
1538
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1539
- response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
1540
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1541
- $fault: "client",
1542
- $metadata,
1160
+ (0, smithy_client_1.throwDefaultError)({
1161
+ output,
1162
+ parsedBody,
1163
+ exceptionCtor: CognitoSyncServiceException_1.CognitoSyncServiceException,
1164
+ errorCode,
1543
1165
  });
1544
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1545
1166
  }
1546
1167
  };
1547
1168
  const deserializeAws_restJson1UpdateRecordsCommand = async (output, context) => {
1548
1169
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1549
1170
  return deserializeAws_restJson1UpdateRecordsCommandError(output, context);
1550
1171
  }
1551
- const contents = {
1172
+ const contents = map({
1552
1173
  $metadata: deserializeMetadata(output),
1553
- Records: undefined,
1554
- };
1174
+ });
1555
1175
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1556
- if (data.Records !== undefined && data.Records !== null) {
1176
+ if (data.Records != null) {
1557
1177
  contents.Records = deserializeAws_restJson1RecordList(data.Records, context);
1558
1178
  }
1559
- return Promise.resolve(contents);
1179
+ return contents;
1560
1180
  };
1561
1181
  exports.deserializeAws_restJson1UpdateRecordsCommand = deserializeAws_restJson1UpdateRecordsCommand;
1562
1182
  const deserializeAws_restJson1UpdateRecordsCommandError = async (output, context) => {
@@ -1564,7 +1184,6 @@ const deserializeAws_restJson1UpdateRecordsCommandError = async (output, context
1564
1184
  ...output,
1565
1185
  body: await parseBody(output.body, context),
1566
1186
  };
1567
- let response;
1568
1187
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1569
1188
  switch (errorCode) {
1570
1189
  case "InternalErrorException":
@@ -1596,20 +1215,19 @@ const deserializeAws_restJson1UpdateRecordsCommandError = async (output, context
1596
1215
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1597
1216
  default:
1598
1217
  const parsedBody = parsedOutput.body;
1599
- const $metadata = deserializeMetadata(output);
1600
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1601
- response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
1602
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1603
- $fault: "client",
1604
- $metadata,
1218
+ (0, smithy_client_1.throwDefaultError)({
1219
+ output,
1220
+ parsedBody,
1221
+ exceptionCtor: CognitoSyncServiceException_1.CognitoSyncServiceException,
1222
+ errorCode,
1605
1223
  });
1606
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1607
1224
  }
1608
1225
  };
1226
+ const map = smithy_client_1.map;
1609
1227
  const deserializeAws_restJson1AlreadyStreamedExceptionResponse = async (parsedOutput, context) => {
1610
- const contents = {};
1228
+ const contents = map({});
1611
1229
  const data = parsedOutput.body;
1612
- if (data.message !== undefined && data.message !== null) {
1230
+ if (data.message != null) {
1613
1231
  contents.message = (0, smithy_client_1.expectString)(data.message);
1614
1232
  }
1615
1233
  const exception = new models_0_1.AlreadyStreamedException({
@@ -1619,9 +1237,9 @@ const deserializeAws_restJson1AlreadyStreamedExceptionResponse = async (parsedOu
1619
1237
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1620
1238
  };
1621
1239
  const deserializeAws_restJson1ConcurrentModificationExceptionResponse = async (parsedOutput, context) => {
1622
- const contents = {};
1240
+ const contents = map({});
1623
1241
  const data = parsedOutput.body;
1624
- if (data.message !== undefined && data.message !== null) {
1242
+ if (data.message != null) {
1625
1243
  contents.message = (0, smithy_client_1.expectString)(data.message);
1626
1244
  }
1627
1245
  const exception = new models_0_1.ConcurrentModificationException({
@@ -1631,9 +1249,9 @@ const deserializeAws_restJson1ConcurrentModificationExceptionResponse = async (p
1631
1249
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1632
1250
  };
1633
1251
  const deserializeAws_restJson1DuplicateRequestExceptionResponse = async (parsedOutput, context) => {
1634
- const contents = {};
1252
+ const contents = map({});
1635
1253
  const data = parsedOutput.body;
1636
- if (data.message !== undefined && data.message !== null) {
1254
+ if (data.message != null) {
1637
1255
  contents.message = (0, smithy_client_1.expectString)(data.message);
1638
1256
  }
1639
1257
  const exception = new models_0_1.DuplicateRequestException({
@@ -1643,9 +1261,9 @@ const deserializeAws_restJson1DuplicateRequestExceptionResponse = async (parsedO
1643
1261
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1644
1262
  };
1645
1263
  const deserializeAws_restJson1InternalErrorExceptionResponse = async (parsedOutput, context) => {
1646
- const contents = {};
1264
+ const contents = map({});
1647
1265
  const data = parsedOutput.body;
1648
- if (data.message !== undefined && data.message !== null) {
1266
+ if (data.message != null) {
1649
1267
  contents.message = (0, smithy_client_1.expectString)(data.message);
1650
1268
  }
1651
1269
  const exception = new models_0_1.InternalErrorException({
@@ -1655,9 +1273,9 @@ const deserializeAws_restJson1InternalErrorExceptionResponse = async (parsedOutp
1655
1273
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1656
1274
  };
1657
1275
  const deserializeAws_restJson1InvalidConfigurationExceptionResponse = async (parsedOutput, context) => {
1658
- const contents = {};
1276
+ const contents = map({});
1659
1277
  const data = parsedOutput.body;
1660
- if (data.message !== undefined && data.message !== null) {
1278
+ if (data.message != null) {
1661
1279
  contents.message = (0, smithy_client_1.expectString)(data.message);
1662
1280
  }
1663
1281
  const exception = new models_0_1.InvalidConfigurationException({
@@ -1667,9 +1285,9 @@ const deserializeAws_restJson1InvalidConfigurationExceptionResponse = async (par
1667
1285
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1668
1286
  };
1669
1287
  const deserializeAws_restJson1InvalidLambdaFunctionOutputExceptionResponse = async (parsedOutput, context) => {
1670
- const contents = {};
1288
+ const contents = map({});
1671
1289
  const data = parsedOutput.body;
1672
- if (data.message !== undefined && data.message !== null) {
1290
+ if (data.message != null) {
1673
1291
  contents.message = (0, smithy_client_1.expectString)(data.message);
1674
1292
  }
1675
1293
  const exception = new models_0_1.InvalidLambdaFunctionOutputException({
@@ -1679,9 +1297,9 @@ const deserializeAws_restJson1InvalidLambdaFunctionOutputExceptionResponse = asy
1679
1297
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1680
1298
  };
1681
1299
  const deserializeAws_restJson1InvalidParameterExceptionResponse = async (parsedOutput, context) => {
1682
- const contents = {};
1300
+ const contents = map({});
1683
1301
  const data = parsedOutput.body;
1684
- if (data.message !== undefined && data.message !== null) {
1302
+ if (data.message != null) {
1685
1303
  contents.message = (0, smithy_client_1.expectString)(data.message);
1686
1304
  }
1687
1305
  const exception = new models_0_1.InvalidParameterException({
@@ -1691,9 +1309,9 @@ const deserializeAws_restJson1InvalidParameterExceptionResponse = async (parsedO
1691
1309
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1692
1310
  };
1693
1311
  const deserializeAws_restJson1LambdaThrottledExceptionResponse = async (parsedOutput, context) => {
1694
- const contents = {};
1312
+ const contents = map({});
1695
1313
  const data = parsedOutput.body;
1696
- if (data.message !== undefined && data.message !== null) {
1314
+ if (data.message != null) {
1697
1315
  contents.message = (0, smithy_client_1.expectString)(data.message);
1698
1316
  }
1699
1317
  const exception = new models_0_1.LambdaThrottledException({
@@ -1703,9 +1321,9 @@ const deserializeAws_restJson1LambdaThrottledExceptionResponse = async (parsedOu
1703
1321
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1704
1322
  };
1705
1323
  const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutput, context) => {
1706
- const contents = {};
1324
+ const contents = map({});
1707
1325
  const data = parsedOutput.body;
1708
- if (data.message !== undefined && data.message !== null) {
1326
+ if (data.message != null) {
1709
1327
  contents.message = (0, smithy_client_1.expectString)(data.message);
1710
1328
  }
1711
1329
  const exception = new models_0_1.LimitExceededException({
@@ -1715,9 +1333,9 @@ const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutp
1715
1333
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1716
1334
  };
1717
1335
  const deserializeAws_restJson1NotAuthorizedExceptionResponse = async (parsedOutput, context) => {
1718
- const contents = {};
1336
+ const contents = map({});
1719
1337
  const data = parsedOutput.body;
1720
- if (data.message !== undefined && data.message !== null) {
1338
+ if (data.message != null) {
1721
1339
  contents.message = (0, smithy_client_1.expectString)(data.message);
1722
1340
  }
1723
1341
  const exception = new models_0_1.NotAuthorizedException({
@@ -1727,9 +1345,9 @@ const deserializeAws_restJson1NotAuthorizedExceptionResponse = async (parsedOutp
1727
1345
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1728
1346
  };
1729
1347
  const deserializeAws_restJson1ResourceConflictExceptionResponse = async (parsedOutput, context) => {
1730
- const contents = {};
1348
+ const contents = map({});
1731
1349
  const data = parsedOutput.body;
1732
- if (data.message !== undefined && data.message !== null) {
1350
+ if (data.message != null) {
1733
1351
  contents.message = (0, smithy_client_1.expectString)(data.message);
1734
1352
  }
1735
1353
  const exception = new models_0_1.ResourceConflictException({
@@ -1739,9 +1357,9 @@ const deserializeAws_restJson1ResourceConflictExceptionResponse = async (parsedO
1739
1357
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1740
1358
  };
1741
1359
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1742
- const contents = {};
1360
+ const contents = map({});
1743
1361
  const data = parsedOutput.body;
1744
- if (data.message !== undefined && data.message !== null) {
1362
+ if (data.message != null) {
1745
1363
  contents.message = (0, smithy_client_1.expectString)(data.message);
1746
1364
  }
1747
1365
  const exception = new models_0_1.ResourceNotFoundException({
@@ -1751,9 +1369,9 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
1751
1369
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1752
1370
  };
1753
1371
  const deserializeAws_restJson1TooManyRequestsExceptionResponse = async (parsedOutput, context) => {
1754
- const contents = {};
1372
+ const contents = map({});
1755
1373
  const data = parsedOutput.body;
1756
- if (data.message !== undefined && data.message !== null) {
1374
+ if (data.message != null) {
1757
1375
  contents.message = (0, smithy_client_1.expectString)(data.message);
1758
1376
  }
1759
1377
  const exception = new models_0_1.TooManyRequestsException({
@@ -1766,9 +1384,6 @@ const serializeAws_restJson1ApplicationArnList = (input, context) => {
1766
1384
  return input
1767
1385
  .filter((e) => e != null)
1768
1386
  .map((entry) => {
1769
- if (entry === null) {
1770
- return null;
1771
- }
1772
1387
  return entry;
1773
1388
  });
1774
1389
  };
@@ -1813,9 +1428,6 @@ const serializeAws_restJson1RecordPatchList = (input, context) => {
1813
1428
  return input
1814
1429
  .filter((e) => e != null)
1815
1430
  .map((entry) => {
1816
- if (entry === null) {
1817
- return null;
1818
- }
1819
1431
  return serializeAws_restJson1RecordPatch(entry, context);
1820
1432
  });
1821
1433
  };