@aws-sdk/client-workdocs 3.141.0 → 3.150.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,31 +8,13 @@ const models_0_1 = require("../models/models_0");
8
8
  const WorkDocsServiceException_1 = require("../models/WorkDocsServiceException");
9
9
  const serializeAws_restJson1AbortDocumentVersionUploadCommand = async (input, context) => {
10
10
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
11
- const headers = {
12
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
13
- };
11
+ const headers = map({}, isSerializableHeaderValue, {
12
+ authentication: input.AuthenticationToken,
13
+ });
14
14
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
15
15
  "/api/v1/documents/{DocumentId}/versions/{VersionId}";
16
- if (input.DocumentId !== undefined) {
17
- const labelValue = input.DocumentId;
18
- if (labelValue.length <= 0) {
19
- throw new Error("Empty value provided for input HTTP label: DocumentId.");
20
- }
21
- resolvedPath = resolvedPath.replace("{DocumentId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
22
- }
23
- else {
24
- throw new Error("No value provided for input HTTP label: DocumentId.");
25
- }
26
- if (input.VersionId !== undefined) {
27
- const labelValue = input.VersionId;
28
- if (labelValue.length <= 0) {
29
- throw new Error("Empty value provided for input HTTP label: VersionId.");
30
- }
31
- resolvedPath = resolvedPath.replace("{VersionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
32
- }
33
- else {
34
- throw new Error("No value provided for input HTTP label: VersionId.");
35
- }
16
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DocumentId", () => input.DocumentId, "{DocumentId}", false);
17
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "VersionId", () => input.VersionId, "{VersionId}", false);
36
18
  let body;
37
19
  return new protocol_http_1.HttpRequest({
38
20
  protocol,
@@ -47,20 +29,11 @@ const serializeAws_restJson1AbortDocumentVersionUploadCommand = async (input, co
47
29
  exports.serializeAws_restJson1AbortDocumentVersionUploadCommand = serializeAws_restJson1AbortDocumentVersionUploadCommand;
48
30
  const serializeAws_restJson1ActivateUserCommand = async (input, context) => {
49
31
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
50
- const headers = {
51
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
52
- };
32
+ const headers = map({}, isSerializableHeaderValue, {
33
+ authentication: input.AuthenticationToken,
34
+ });
53
35
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/users/{UserId}/activation";
54
- if (input.UserId !== undefined) {
55
- const labelValue = input.UserId;
56
- if (labelValue.length <= 0) {
57
- throw new Error("Empty value provided for input HTTP label: UserId.");
58
- }
59
- resolvedPath = resolvedPath.replace("{UserId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
60
- }
61
- else {
62
- throw new Error("No value provided for input HTTP label: UserId.");
63
- }
36
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "UserId", () => input.UserId, "{UserId}", false);
64
37
  let body;
65
38
  return new protocol_http_1.HttpRequest({
66
39
  protocol,
@@ -75,22 +48,13 @@ const serializeAws_restJson1ActivateUserCommand = async (input, context) => {
75
48
  exports.serializeAws_restJson1ActivateUserCommand = serializeAws_restJson1ActivateUserCommand;
76
49
  const serializeAws_restJson1AddResourcePermissionsCommand = async (input, context) => {
77
50
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
78
- const headers = {
51
+ const headers = map({}, isSerializableHeaderValue, {
79
52
  "content-type": "application/json",
80
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
81
- };
53
+ authentication: input.AuthenticationToken,
54
+ });
82
55
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
83
56
  "/api/v1/resources/{ResourceId}/permissions";
84
- if (input.ResourceId !== undefined) {
85
- const labelValue = input.ResourceId;
86
- if (labelValue.length <= 0) {
87
- throw new Error("Empty value provided for input HTTP label: ResourceId.");
88
- }
89
- resolvedPath = resolvedPath.replace("{ResourceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
90
- }
91
- else {
92
- throw new Error("No value provided for input HTTP label: ResourceId.");
93
- }
57
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceId", () => input.ResourceId, "{ResourceId}", false);
94
58
  let body;
95
59
  body = JSON.stringify({
96
60
  ...(input.NotificationOptions != null && {
@@ -113,32 +77,14 @@ const serializeAws_restJson1AddResourcePermissionsCommand = async (input, contex
113
77
  exports.serializeAws_restJson1AddResourcePermissionsCommand = serializeAws_restJson1AddResourcePermissionsCommand;
114
78
  const serializeAws_restJson1CreateCommentCommand = async (input, context) => {
115
79
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
116
- const headers = {
80
+ const headers = map({}, isSerializableHeaderValue, {
117
81
  "content-type": "application/json",
118
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
119
- };
82
+ authentication: input.AuthenticationToken,
83
+ });
120
84
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
121
85
  "/api/v1/documents/{DocumentId}/versions/{VersionId}/comment";
122
- if (input.DocumentId !== undefined) {
123
- const labelValue = input.DocumentId;
124
- if (labelValue.length <= 0) {
125
- throw new Error("Empty value provided for input HTTP label: DocumentId.");
126
- }
127
- resolvedPath = resolvedPath.replace("{DocumentId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
128
- }
129
- else {
130
- throw new Error("No value provided for input HTTP label: DocumentId.");
131
- }
132
- if (input.VersionId !== undefined) {
133
- const labelValue = input.VersionId;
134
- if (labelValue.length <= 0) {
135
- throw new Error("Empty value provided for input HTTP label: VersionId.");
136
- }
137
- resolvedPath = resolvedPath.replace("{VersionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
138
- }
139
- else {
140
- throw new Error("No value provided for input HTTP label: VersionId.");
141
- }
86
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DocumentId", () => input.DocumentId, "{DocumentId}", false);
87
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "VersionId", () => input.VersionId, "{VersionId}", false);
142
88
  let body;
143
89
  body = JSON.stringify({
144
90
  ...(input.NotifyCollaborators != null && { NotifyCollaborators: input.NotifyCollaborators }),
@@ -160,25 +106,16 @@ const serializeAws_restJson1CreateCommentCommand = async (input, context) => {
160
106
  exports.serializeAws_restJson1CreateCommentCommand = serializeAws_restJson1CreateCommentCommand;
161
107
  const serializeAws_restJson1CreateCustomMetadataCommand = async (input, context) => {
162
108
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
163
- const headers = {
109
+ const headers = map({}, isSerializableHeaderValue, {
164
110
  "content-type": "application/json",
165
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
166
- };
111
+ authentication: input.AuthenticationToken,
112
+ });
167
113
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
168
114
  "/api/v1/resources/{ResourceId}/customMetadata";
169
- if (input.ResourceId !== undefined) {
170
- const labelValue = input.ResourceId;
171
- if (labelValue.length <= 0) {
172
- throw new Error("Empty value provided for input HTTP label: ResourceId.");
173
- }
174
- resolvedPath = resolvedPath.replace("{ResourceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
175
- }
176
- else {
177
- throw new Error("No value provided for input HTTP label: ResourceId.");
178
- }
179
- const query = {
180
- ...(input.VersionId !== undefined && { versionid: input.VersionId }),
181
- };
115
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceId", () => input.ResourceId, "{ResourceId}", false);
116
+ const query = map({
117
+ versionid: [, input.VersionId],
118
+ });
182
119
  let body;
183
120
  body = JSON.stringify({
184
121
  ...(input.CustomMetadata != null && {
@@ -199,10 +136,10 @@ const serializeAws_restJson1CreateCustomMetadataCommand = async (input, context)
199
136
  exports.serializeAws_restJson1CreateCustomMetadataCommand = serializeAws_restJson1CreateCustomMetadataCommand;
200
137
  const serializeAws_restJson1CreateFolderCommand = async (input, context) => {
201
138
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
202
- const headers = {
139
+ const headers = map({}, isSerializableHeaderValue, {
203
140
  "content-type": "application/json",
204
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
205
- };
141
+ authentication: input.AuthenticationToken,
142
+ });
206
143
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/folders";
207
144
  let body;
208
145
  body = JSON.stringify({
@@ -222,21 +159,12 @@ const serializeAws_restJson1CreateFolderCommand = async (input, context) => {
222
159
  exports.serializeAws_restJson1CreateFolderCommand = serializeAws_restJson1CreateFolderCommand;
223
160
  const serializeAws_restJson1CreateLabelsCommand = async (input, context) => {
224
161
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
225
- const headers = {
162
+ const headers = map({}, isSerializableHeaderValue, {
226
163
  "content-type": "application/json",
227
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
228
- };
164
+ authentication: input.AuthenticationToken,
165
+ });
229
166
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/resources/{ResourceId}/labels";
230
- if (input.ResourceId !== undefined) {
231
- const labelValue = input.ResourceId;
232
- if (labelValue.length <= 0) {
233
- throw new Error("Empty value provided for input HTTP label: ResourceId.");
234
- }
235
- resolvedPath = resolvedPath.replace("{ResourceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
236
- }
237
- else {
238
- throw new Error("No value provided for input HTTP label: ResourceId.");
239
- }
167
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceId", () => input.ResourceId, "{ResourceId}", false);
240
168
  let body;
241
169
  body = JSON.stringify({
242
170
  ...(input.Labels != null && { Labels: serializeAws_restJson1SharedLabels(input.Labels, context) }),
@@ -259,16 +187,7 @@ const serializeAws_restJson1CreateNotificationSubscriptionCommand = async (input
259
187
  };
260
188
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
261
189
  "/api/v1/organizations/{OrganizationId}/subscriptions";
262
- if (input.OrganizationId !== undefined) {
263
- const labelValue = input.OrganizationId;
264
- if (labelValue.length <= 0) {
265
- throw new Error("Empty value provided for input HTTP label: OrganizationId.");
266
- }
267
- resolvedPath = resolvedPath.replace("{OrganizationId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
268
- }
269
- else {
270
- throw new Error("No value provided for input HTTP label: OrganizationId.");
271
- }
190
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "OrganizationId", () => input.OrganizationId, "{OrganizationId}", false);
272
191
  let body;
273
192
  body = JSON.stringify({
274
193
  ...(input.Endpoint != null && { Endpoint: input.Endpoint }),
@@ -288,10 +207,10 @@ const serializeAws_restJson1CreateNotificationSubscriptionCommand = async (input
288
207
  exports.serializeAws_restJson1CreateNotificationSubscriptionCommand = serializeAws_restJson1CreateNotificationSubscriptionCommand;
289
208
  const serializeAws_restJson1CreateUserCommand = async (input, context) => {
290
209
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
291
- const headers = {
210
+ const headers = map({}, isSerializableHeaderValue, {
292
211
  "content-type": "application/json",
293
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
294
- };
212
+ authentication: input.AuthenticationToken,
213
+ });
295
214
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/users";
296
215
  let body;
297
216
  body = JSON.stringify({
@@ -319,20 +238,11 @@ const serializeAws_restJson1CreateUserCommand = async (input, context) => {
319
238
  exports.serializeAws_restJson1CreateUserCommand = serializeAws_restJson1CreateUserCommand;
320
239
  const serializeAws_restJson1DeactivateUserCommand = async (input, context) => {
321
240
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
322
- const headers = {
323
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
324
- };
241
+ const headers = map({}, isSerializableHeaderValue, {
242
+ authentication: input.AuthenticationToken,
243
+ });
325
244
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/users/{UserId}/activation";
326
- if (input.UserId !== undefined) {
327
- const labelValue = input.UserId;
328
- if (labelValue.length <= 0) {
329
- throw new Error("Empty value provided for input HTTP label: UserId.");
330
- }
331
- resolvedPath = resolvedPath.replace("{UserId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
332
- }
333
- else {
334
- throw new Error("No value provided for input HTTP label: UserId.");
335
- }
245
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "UserId", () => input.UserId, "{UserId}", false);
336
246
  let body;
337
247
  return new protocol_http_1.HttpRequest({
338
248
  protocol,
@@ -347,41 +257,14 @@ const serializeAws_restJson1DeactivateUserCommand = async (input, context) => {
347
257
  exports.serializeAws_restJson1DeactivateUserCommand = serializeAws_restJson1DeactivateUserCommand;
348
258
  const serializeAws_restJson1DeleteCommentCommand = async (input, context) => {
349
259
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
350
- const headers = {
351
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
352
- };
260
+ const headers = map({}, isSerializableHeaderValue, {
261
+ authentication: input.AuthenticationToken,
262
+ });
353
263
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
354
264
  "/api/v1/documents/{DocumentId}/versions/{VersionId}/comment/{CommentId}";
355
- if (input.DocumentId !== undefined) {
356
- const labelValue = input.DocumentId;
357
- if (labelValue.length <= 0) {
358
- throw new Error("Empty value provided for input HTTP label: DocumentId.");
359
- }
360
- resolvedPath = resolvedPath.replace("{DocumentId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
361
- }
362
- else {
363
- throw new Error("No value provided for input HTTP label: DocumentId.");
364
- }
365
- if (input.VersionId !== undefined) {
366
- const labelValue = input.VersionId;
367
- if (labelValue.length <= 0) {
368
- throw new Error("Empty value provided for input HTTP label: VersionId.");
369
- }
370
- resolvedPath = resolvedPath.replace("{VersionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
371
- }
372
- else {
373
- throw new Error("No value provided for input HTTP label: VersionId.");
374
- }
375
- if (input.CommentId !== undefined) {
376
- const labelValue = input.CommentId;
377
- if (labelValue.length <= 0) {
378
- throw new Error("Empty value provided for input HTTP label: CommentId.");
379
- }
380
- resolvedPath = resolvedPath.replace("{CommentId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
381
- }
382
- else {
383
- throw new Error("No value provided for input HTTP label: CommentId.");
384
- }
265
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DocumentId", () => input.DocumentId, "{DocumentId}", false);
266
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "VersionId", () => input.VersionId, "{VersionId}", false);
267
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "CommentId", () => input.CommentId, "{CommentId}", false);
385
268
  let body;
386
269
  return new protocol_http_1.HttpRequest({
387
270
  protocol,
@@ -396,26 +279,17 @@ const serializeAws_restJson1DeleteCommentCommand = async (input, context) => {
396
279
  exports.serializeAws_restJson1DeleteCommentCommand = serializeAws_restJson1DeleteCommentCommand;
397
280
  const serializeAws_restJson1DeleteCustomMetadataCommand = async (input, context) => {
398
281
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
399
- const headers = {
400
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
401
- };
282
+ const headers = map({}, isSerializableHeaderValue, {
283
+ authentication: input.AuthenticationToken,
284
+ });
402
285
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
403
286
  "/api/v1/resources/{ResourceId}/customMetadata";
404
- if (input.ResourceId !== undefined) {
405
- const labelValue = input.ResourceId;
406
- if (labelValue.length <= 0) {
407
- throw new Error("Empty value provided for input HTTP label: ResourceId.");
408
- }
409
- resolvedPath = resolvedPath.replace("{ResourceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
410
- }
411
- else {
412
- throw new Error("No value provided for input HTTP label: ResourceId.");
413
- }
414
- const query = {
415
- ...(input.VersionId !== undefined && { versionId: input.VersionId }),
416
- ...(input.Keys !== undefined && { keys: (input.Keys || []).map((_entry) => _entry) }),
417
- ...(input.DeleteAll !== undefined && { deleteAll: input.DeleteAll.toString() }),
418
- };
287
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceId", () => input.ResourceId, "{ResourceId}", false);
288
+ const query = map({
289
+ versionId: [, input.VersionId],
290
+ keys: [() => input.Keys !== void 0, () => (input.Keys || []).map((_entry) => _entry)],
291
+ deleteAll: [() => input.DeleteAll !== void 0, () => input.DeleteAll.toString()],
292
+ });
419
293
  let body;
420
294
  return new protocol_http_1.HttpRequest({
421
295
  protocol,
@@ -431,20 +305,11 @@ const serializeAws_restJson1DeleteCustomMetadataCommand = async (input, context)
431
305
  exports.serializeAws_restJson1DeleteCustomMetadataCommand = serializeAws_restJson1DeleteCustomMetadataCommand;
432
306
  const serializeAws_restJson1DeleteDocumentCommand = async (input, context) => {
433
307
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
434
- const headers = {
435
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
436
- };
308
+ const headers = map({}, isSerializableHeaderValue, {
309
+ authentication: input.AuthenticationToken,
310
+ });
437
311
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/documents/{DocumentId}";
438
- if (input.DocumentId !== undefined) {
439
- const labelValue = input.DocumentId;
440
- if (labelValue.length <= 0) {
441
- throw new Error("Empty value provided for input HTTP label: DocumentId.");
442
- }
443
- resolvedPath = resolvedPath.replace("{DocumentId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
444
- }
445
- else {
446
- throw new Error("No value provided for input HTTP label: DocumentId.");
447
- }
312
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DocumentId", () => input.DocumentId, "{DocumentId}", false);
448
313
  let body;
449
314
  return new protocol_http_1.HttpRequest({
450
315
  protocol,
@@ -459,20 +324,11 @@ const serializeAws_restJson1DeleteDocumentCommand = async (input, context) => {
459
324
  exports.serializeAws_restJson1DeleteDocumentCommand = serializeAws_restJson1DeleteDocumentCommand;
460
325
  const serializeAws_restJson1DeleteFolderCommand = async (input, context) => {
461
326
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
462
- const headers = {
463
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
464
- };
327
+ const headers = map({}, isSerializableHeaderValue, {
328
+ authentication: input.AuthenticationToken,
329
+ });
465
330
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/folders/{FolderId}";
466
- if (input.FolderId !== undefined) {
467
- const labelValue = input.FolderId;
468
- if (labelValue.length <= 0) {
469
- throw new Error("Empty value provided for input HTTP label: FolderId.");
470
- }
471
- resolvedPath = resolvedPath.replace("{FolderId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
472
- }
473
- else {
474
- throw new Error("No value provided for input HTTP label: FolderId.");
475
- }
331
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FolderId", () => input.FolderId, "{FolderId}", false);
476
332
  let body;
477
333
  return new protocol_http_1.HttpRequest({
478
334
  protocol,
@@ -487,20 +343,11 @@ const serializeAws_restJson1DeleteFolderCommand = async (input, context) => {
487
343
  exports.serializeAws_restJson1DeleteFolderCommand = serializeAws_restJson1DeleteFolderCommand;
488
344
  const serializeAws_restJson1DeleteFolderContentsCommand = async (input, context) => {
489
345
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
490
- const headers = {
491
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
492
- };
346
+ const headers = map({}, isSerializableHeaderValue, {
347
+ authentication: input.AuthenticationToken,
348
+ });
493
349
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/folders/{FolderId}/contents";
494
- if (input.FolderId !== undefined) {
495
- const labelValue = input.FolderId;
496
- if (labelValue.length <= 0) {
497
- throw new Error("Empty value provided for input HTTP label: FolderId.");
498
- }
499
- resolvedPath = resolvedPath.replace("{FolderId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
500
- }
501
- else {
502
- throw new Error("No value provided for input HTTP label: FolderId.");
503
- }
350
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FolderId", () => input.FolderId, "{FolderId}", false);
504
351
  let body;
505
352
  return new protocol_http_1.HttpRequest({
506
353
  protocol,
@@ -515,24 +362,15 @@ const serializeAws_restJson1DeleteFolderContentsCommand = async (input, context)
515
362
  exports.serializeAws_restJson1DeleteFolderContentsCommand = serializeAws_restJson1DeleteFolderContentsCommand;
516
363
  const serializeAws_restJson1DeleteLabelsCommand = async (input, context) => {
517
364
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
518
- const headers = {
519
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
520
- };
365
+ const headers = map({}, isSerializableHeaderValue, {
366
+ authentication: input.AuthenticationToken,
367
+ });
521
368
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/resources/{ResourceId}/labels";
522
- if (input.ResourceId !== undefined) {
523
- const labelValue = input.ResourceId;
524
- if (labelValue.length <= 0) {
525
- throw new Error("Empty value provided for input HTTP label: ResourceId.");
526
- }
527
- resolvedPath = resolvedPath.replace("{ResourceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
528
- }
529
- else {
530
- throw new Error("No value provided for input HTTP label: ResourceId.");
531
- }
532
- const query = {
533
- ...(input.Labels !== undefined && { labels: (input.Labels || []).map((_entry) => _entry) }),
534
- ...(input.DeleteAll !== undefined && { deleteAll: input.DeleteAll.toString() }),
535
- };
369
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceId", () => input.ResourceId, "{ResourceId}", false);
370
+ const query = map({
371
+ labels: [() => input.Labels !== void 0, () => (input.Labels || []).map((_entry) => _entry)],
372
+ deleteAll: [() => input.DeleteAll !== void 0, () => input.DeleteAll.toString()],
373
+ });
536
374
  let body;
537
375
  return new protocol_http_1.HttpRequest({
538
376
  protocol,
@@ -551,26 +389,8 @@ const serializeAws_restJson1DeleteNotificationSubscriptionCommand = async (input
551
389
  const headers = {};
552
390
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
553
391
  "/api/v1/organizations/{OrganizationId}/subscriptions/{SubscriptionId}";
554
- if (input.SubscriptionId !== undefined) {
555
- const labelValue = input.SubscriptionId;
556
- if (labelValue.length <= 0) {
557
- throw new Error("Empty value provided for input HTTP label: SubscriptionId.");
558
- }
559
- resolvedPath = resolvedPath.replace("{SubscriptionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
560
- }
561
- else {
562
- throw new Error("No value provided for input HTTP label: SubscriptionId.");
563
- }
564
- if (input.OrganizationId !== undefined) {
565
- const labelValue = input.OrganizationId;
566
- if (labelValue.length <= 0) {
567
- throw new Error("Empty value provided for input HTTP label: OrganizationId.");
568
- }
569
- resolvedPath = resolvedPath.replace("{OrganizationId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
570
- }
571
- else {
572
- throw new Error("No value provided for input HTTP label: OrganizationId.");
573
- }
392
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SubscriptionId", () => input.SubscriptionId, "{SubscriptionId}", false);
393
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "OrganizationId", () => input.OrganizationId, "{OrganizationId}", false);
574
394
  let body;
575
395
  return new protocol_http_1.HttpRequest({
576
396
  protocol,
@@ -585,20 +405,11 @@ const serializeAws_restJson1DeleteNotificationSubscriptionCommand = async (input
585
405
  exports.serializeAws_restJson1DeleteNotificationSubscriptionCommand = serializeAws_restJson1DeleteNotificationSubscriptionCommand;
586
406
  const serializeAws_restJson1DeleteUserCommand = async (input, context) => {
587
407
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
588
- const headers = {
589
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
590
- };
408
+ const headers = map({}, isSerializableHeaderValue, {
409
+ authentication: input.AuthenticationToken,
410
+ });
591
411
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/users/{UserId}";
592
- if (input.UserId !== undefined) {
593
- const labelValue = input.UserId;
594
- if (labelValue.length <= 0) {
595
- throw new Error("Empty value provided for input HTTP label: UserId.");
596
- }
597
- resolvedPath = resolvedPath.replace("{UserId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
598
- }
599
- else {
600
- throw new Error("No value provided for input HTTP label: UserId.");
601
- }
412
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "UserId", () => input.UserId, "{UserId}", false);
602
413
  let body;
603
414
  return new protocol_http_1.HttpRequest({
604
415
  protocol,
@@ -613,23 +424,27 @@ const serializeAws_restJson1DeleteUserCommand = async (input, context) => {
613
424
  exports.serializeAws_restJson1DeleteUserCommand = serializeAws_restJson1DeleteUserCommand;
614
425
  const serializeAws_restJson1DescribeActivitiesCommand = async (input, context) => {
615
426
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
616
- const headers = {
617
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
618
- };
427
+ const headers = map({}, isSerializableHeaderValue, {
428
+ authentication: input.AuthenticationToken,
429
+ });
619
430
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/activities";
620
- const query = {
621
- ...(input.StartTime !== undefined && { startTime: (input.StartTime.toISOString().split(".")[0] + "Z").toString() }),
622
- ...(input.EndTime !== undefined && { endTime: (input.EndTime.toISOString().split(".")[0] + "Z").toString() }),
623
- ...(input.OrganizationId !== undefined && { organizationId: input.OrganizationId }),
624
- ...(input.ActivityTypes !== undefined && { activityTypes: input.ActivityTypes }),
625
- ...(input.ResourceId !== undefined && { resourceId: input.ResourceId }),
626
- ...(input.UserId !== undefined && { userId: input.UserId }),
627
- ...(input.IncludeIndirectActivities !== undefined && {
628
- includeIndirectActivities: input.IncludeIndirectActivities.toString(),
629
- }),
630
- ...(input.Limit !== undefined && { limit: input.Limit.toString() }),
631
- ...(input.Marker !== undefined && { marker: input.Marker }),
632
- };
431
+ const query = map({
432
+ startTime: [
433
+ () => input.StartTime !== void 0,
434
+ () => (input.StartTime.toISOString().split(".")[0] + "Z").toString(),
435
+ ],
436
+ endTime: [() => input.EndTime !== void 0, () => (input.EndTime.toISOString().split(".")[0] + "Z").toString()],
437
+ organizationId: [, input.OrganizationId],
438
+ activityTypes: [, input.ActivityTypes],
439
+ resourceId: [, input.ResourceId],
440
+ userId: [, input.UserId],
441
+ includeIndirectActivities: [
442
+ () => input.IncludeIndirectActivities !== void 0,
443
+ () => input.IncludeIndirectActivities.toString(),
444
+ ],
445
+ limit: [() => input.Limit !== void 0, () => input.Limit.toString()],
446
+ marker: [, input.Marker],
447
+ });
633
448
  let body;
634
449
  return new protocol_http_1.HttpRequest({
635
450
  protocol,
@@ -645,35 +460,17 @@ const serializeAws_restJson1DescribeActivitiesCommand = async (input, context) =
645
460
  exports.serializeAws_restJson1DescribeActivitiesCommand = serializeAws_restJson1DescribeActivitiesCommand;
646
461
  const serializeAws_restJson1DescribeCommentsCommand = async (input, context) => {
647
462
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
648
- const headers = {
649
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
650
- };
463
+ const headers = map({}, isSerializableHeaderValue, {
464
+ authentication: input.AuthenticationToken,
465
+ });
651
466
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
652
467
  "/api/v1/documents/{DocumentId}/versions/{VersionId}/comments";
653
- if (input.DocumentId !== undefined) {
654
- const labelValue = input.DocumentId;
655
- if (labelValue.length <= 0) {
656
- throw new Error("Empty value provided for input HTTP label: DocumentId.");
657
- }
658
- resolvedPath = resolvedPath.replace("{DocumentId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
659
- }
660
- else {
661
- throw new Error("No value provided for input HTTP label: DocumentId.");
662
- }
663
- if (input.VersionId !== undefined) {
664
- const labelValue = input.VersionId;
665
- if (labelValue.length <= 0) {
666
- throw new Error("Empty value provided for input HTTP label: VersionId.");
667
- }
668
- resolvedPath = resolvedPath.replace("{VersionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
669
- }
670
- else {
671
- throw new Error("No value provided for input HTTP label: VersionId.");
672
- }
673
- const query = {
674
- ...(input.Limit !== undefined && { limit: input.Limit.toString() }),
675
- ...(input.Marker !== undefined && { marker: input.Marker }),
676
- };
468
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DocumentId", () => input.DocumentId, "{DocumentId}", false);
469
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "VersionId", () => input.VersionId, "{VersionId}", false);
470
+ const query = map({
471
+ limit: [() => input.Limit !== void 0, () => input.Limit.toString()],
472
+ marker: [, input.Marker],
473
+ });
677
474
  let body;
678
475
  return new protocol_http_1.HttpRequest({
679
476
  protocol,
@@ -689,26 +486,17 @@ const serializeAws_restJson1DescribeCommentsCommand = async (input, context) =>
689
486
  exports.serializeAws_restJson1DescribeCommentsCommand = serializeAws_restJson1DescribeCommentsCommand;
690
487
  const serializeAws_restJson1DescribeDocumentVersionsCommand = async (input, context) => {
691
488
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
692
- const headers = {
693
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
694
- };
489
+ const headers = map({}, isSerializableHeaderValue, {
490
+ authentication: input.AuthenticationToken,
491
+ });
695
492
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/documents/{DocumentId}/versions";
696
- if (input.DocumentId !== undefined) {
697
- const labelValue = input.DocumentId;
698
- if (labelValue.length <= 0) {
699
- throw new Error("Empty value provided for input HTTP label: DocumentId.");
700
- }
701
- resolvedPath = resolvedPath.replace("{DocumentId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
702
- }
703
- else {
704
- throw new Error("No value provided for input HTTP label: DocumentId.");
705
- }
706
- const query = {
707
- ...(input.Marker !== undefined && { marker: input.Marker }),
708
- ...(input.Limit !== undefined && { limit: input.Limit.toString() }),
709
- ...(input.Include !== undefined && { include: input.Include }),
710
- ...(input.Fields !== undefined && { fields: input.Fields }),
711
- };
493
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DocumentId", () => input.DocumentId, "{DocumentId}", false);
494
+ const query = map({
495
+ marker: [, input.Marker],
496
+ limit: [() => input.Limit !== void 0, () => input.Limit.toString()],
497
+ include: [, input.Include],
498
+ fields: [, input.Fields],
499
+ });
712
500
  let body;
713
501
  return new protocol_http_1.HttpRequest({
714
502
  protocol,
@@ -724,28 +512,19 @@ const serializeAws_restJson1DescribeDocumentVersionsCommand = async (input, cont
724
512
  exports.serializeAws_restJson1DescribeDocumentVersionsCommand = serializeAws_restJson1DescribeDocumentVersionsCommand;
725
513
  const serializeAws_restJson1DescribeFolderContentsCommand = async (input, context) => {
726
514
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
727
- const headers = {
728
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
729
- };
515
+ const headers = map({}, isSerializableHeaderValue, {
516
+ authentication: input.AuthenticationToken,
517
+ });
730
518
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/folders/{FolderId}/contents";
731
- if (input.FolderId !== undefined) {
732
- const labelValue = input.FolderId;
733
- if (labelValue.length <= 0) {
734
- throw new Error("Empty value provided for input HTTP label: FolderId.");
735
- }
736
- resolvedPath = resolvedPath.replace("{FolderId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
737
- }
738
- else {
739
- throw new Error("No value provided for input HTTP label: FolderId.");
740
- }
741
- const query = {
742
- ...(input.Sort !== undefined && { sort: input.Sort }),
743
- ...(input.Order !== undefined && { order: input.Order }),
744
- ...(input.Limit !== undefined && { limit: input.Limit.toString() }),
745
- ...(input.Marker !== undefined && { marker: input.Marker }),
746
- ...(input.Type !== undefined && { type: input.Type }),
747
- ...(input.Include !== undefined && { include: input.Include }),
748
- };
519
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FolderId", () => input.FolderId, "{FolderId}", false);
520
+ const query = map({
521
+ sort: [, input.Sort],
522
+ order: [, input.Order],
523
+ limit: [() => input.Limit !== void 0, () => input.Limit.toString()],
524
+ marker: [, input.Marker],
525
+ type: [, input.Type],
526
+ include: [, input.Include],
527
+ });
749
528
  let body;
750
529
  return new protocol_http_1.HttpRequest({
751
530
  protocol,
@@ -761,16 +540,16 @@ const serializeAws_restJson1DescribeFolderContentsCommand = async (input, contex
761
540
  exports.serializeAws_restJson1DescribeFolderContentsCommand = serializeAws_restJson1DescribeFolderContentsCommand;
762
541
  const serializeAws_restJson1DescribeGroupsCommand = async (input, context) => {
763
542
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
764
- const headers = {
765
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
766
- };
543
+ const headers = map({}, isSerializableHeaderValue, {
544
+ authentication: input.AuthenticationToken,
545
+ });
767
546
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/groups";
768
- const query = {
769
- ...(input.SearchQuery !== undefined && { searchQuery: input.SearchQuery }),
770
- ...(input.OrganizationId !== undefined && { organizationId: input.OrganizationId }),
771
- ...(input.Marker !== undefined && { marker: input.Marker }),
772
- ...(input.Limit !== undefined && { limit: input.Limit.toString() }),
773
- };
547
+ const query = map({
548
+ searchQuery: [, input.SearchQuery],
549
+ organizationId: [, input.OrganizationId],
550
+ marker: [, input.Marker],
551
+ limit: [() => input.Limit !== void 0, () => input.Limit.toString()],
552
+ });
774
553
  let body;
775
554
  return new protocol_http_1.HttpRequest({
776
555
  protocol,
@@ -789,20 +568,11 @@ const serializeAws_restJson1DescribeNotificationSubscriptionsCommand = async (in
789
568
  const headers = {};
790
569
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
791
570
  "/api/v1/organizations/{OrganizationId}/subscriptions";
792
- if (input.OrganizationId !== undefined) {
793
- const labelValue = input.OrganizationId;
794
- if (labelValue.length <= 0) {
795
- throw new Error("Empty value provided for input HTTP label: OrganizationId.");
796
- }
797
- resolvedPath = resolvedPath.replace("{OrganizationId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
798
- }
799
- else {
800
- throw new Error("No value provided for input HTTP label: OrganizationId.");
801
- }
802
- const query = {
803
- ...(input.Marker !== undefined && { marker: input.Marker }),
804
- ...(input.Limit !== undefined && { limit: input.Limit.toString() }),
805
- };
571
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "OrganizationId", () => input.OrganizationId, "{OrganizationId}", false);
572
+ const query = map({
573
+ marker: [, input.Marker],
574
+ limit: [() => input.Limit !== void 0, () => input.Limit.toString()],
575
+ });
806
576
  let body;
807
577
  return new protocol_http_1.HttpRequest({
808
578
  protocol,
@@ -818,26 +588,17 @@ const serializeAws_restJson1DescribeNotificationSubscriptionsCommand = async (in
818
588
  exports.serializeAws_restJson1DescribeNotificationSubscriptionsCommand = serializeAws_restJson1DescribeNotificationSubscriptionsCommand;
819
589
  const serializeAws_restJson1DescribeResourcePermissionsCommand = async (input, context) => {
820
590
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
821
- const headers = {
822
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
823
- };
591
+ const headers = map({}, isSerializableHeaderValue, {
592
+ authentication: input.AuthenticationToken,
593
+ });
824
594
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
825
595
  "/api/v1/resources/{ResourceId}/permissions";
826
- if (input.ResourceId !== undefined) {
827
- const labelValue = input.ResourceId;
828
- if (labelValue.length <= 0) {
829
- throw new Error("Empty value provided for input HTTP label: ResourceId.");
830
- }
831
- resolvedPath = resolvedPath.replace("{ResourceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
832
- }
833
- else {
834
- throw new Error("No value provided for input HTTP label: ResourceId.");
835
- }
836
- const query = {
837
- ...(input.PrincipalId !== undefined && { principalId: input.PrincipalId }),
838
- ...(input.Limit !== undefined && { limit: input.Limit.toString() }),
839
- ...(input.Marker !== undefined && { marker: input.Marker }),
840
- };
596
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceId", () => input.ResourceId, "{ResourceId}", false);
597
+ const query = map({
598
+ principalId: [, input.PrincipalId],
599
+ limit: [() => input.Limit !== void 0, () => input.Limit.toString()],
600
+ marker: [, input.Marker],
601
+ });
841
602
  let body;
842
603
  return new protocol_http_1.HttpRequest({
843
604
  protocol,
@@ -853,14 +614,14 @@ const serializeAws_restJson1DescribeResourcePermissionsCommand = async (input, c
853
614
  exports.serializeAws_restJson1DescribeResourcePermissionsCommand = serializeAws_restJson1DescribeResourcePermissionsCommand;
854
615
  const serializeAws_restJson1DescribeRootFoldersCommand = async (input, context) => {
855
616
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
856
- const headers = {
857
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
858
- };
617
+ const headers = map({}, isSerializableHeaderValue, {
618
+ authentication: input.AuthenticationToken,
619
+ });
859
620
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/me/root";
860
- const query = {
861
- ...(input.Limit !== undefined && { limit: input.Limit.toString() }),
862
- ...(input.Marker !== undefined && { marker: input.Marker }),
863
- };
621
+ const query = map({
622
+ limit: [() => input.Limit !== void 0, () => input.Limit.toString()],
623
+ marker: [, input.Marker],
624
+ });
864
625
  let body;
865
626
  return new protocol_http_1.HttpRequest({
866
627
  protocol,
@@ -876,21 +637,21 @@ const serializeAws_restJson1DescribeRootFoldersCommand = async (input, context)
876
637
  exports.serializeAws_restJson1DescribeRootFoldersCommand = serializeAws_restJson1DescribeRootFoldersCommand;
877
638
  const serializeAws_restJson1DescribeUsersCommand = async (input, context) => {
878
639
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
879
- const headers = {
880
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
881
- };
640
+ const headers = map({}, isSerializableHeaderValue, {
641
+ authentication: input.AuthenticationToken,
642
+ });
882
643
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/users";
883
- const query = {
884
- ...(input.OrganizationId !== undefined && { organizationId: input.OrganizationId }),
885
- ...(input.UserIds !== undefined && { userIds: input.UserIds }),
886
- ...(input.Query !== undefined && { query: input.Query }),
887
- ...(input.Include !== undefined && { include: input.Include }),
888
- ...(input.Order !== undefined && { order: input.Order }),
889
- ...(input.Sort !== undefined && { sort: input.Sort }),
890
- ...(input.Marker !== undefined && { marker: input.Marker }),
891
- ...(input.Limit !== undefined && { limit: input.Limit.toString() }),
892
- ...(input.Fields !== undefined && { fields: input.Fields }),
893
- };
644
+ const query = map({
645
+ organizationId: [, input.OrganizationId],
646
+ userIds: [, input.UserIds],
647
+ query: [, input.Query],
648
+ include: [, input.Include],
649
+ order: [, input.Order],
650
+ sort: [, input.Sort],
651
+ marker: [, input.Marker],
652
+ limit: [() => input.Limit !== void 0, () => input.Limit.toString()],
653
+ fields: [, input.Fields],
654
+ });
894
655
  let body;
895
656
  return new protocol_http_1.HttpRequest({
896
657
  protocol,
@@ -906,9 +667,9 @@ const serializeAws_restJson1DescribeUsersCommand = async (input, context) => {
906
667
  exports.serializeAws_restJson1DescribeUsersCommand = serializeAws_restJson1DescribeUsersCommand;
907
668
  const serializeAws_restJson1GetCurrentUserCommand = async (input, context) => {
908
669
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
909
- const headers = {
910
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
911
- };
670
+ const headers = map({}, isSerializableHeaderValue, {
671
+ authentication: input.AuthenticationToken,
672
+ });
912
673
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/me";
913
674
  let body;
914
675
  return new protocol_http_1.HttpRequest({
@@ -924,23 +685,17 @@ const serializeAws_restJson1GetCurrentUserCommand = async (input, context) => {
924
685
  exports.serializeAws_restJson1GetCurrentUserCommand = serializeAws_restJson1GetCurrentUserCommand;
925
686
  const serializeAws_restJson1GetDocumentCommand = async (input, context) => {
926
687
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
927
- const headers = {
928
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
929
- };
688
+ const headers = map({}, isSerializableHeaderValue, {
689
+ authentication: input.AuthenticationToken,
690
+ });
930
691
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/documents/{DocumentId}";
931
- if (input.DocumentId !== undefined) {
932
- const labelValue = input.DocumentId;
933
- if (labelValue.length <= 0) {
934
- throw new Error("Empty value provided for input HTTP label: DocumentId.");
935
- }
936
- resolvedPath = resolvedPath.replace("{DocumentId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
937
- }
938
- else {
939
- throw new Error("No value provided for input HTTP label: DocumentId.");
940
- }
941
- const query = {
942
- ...(input.IncludeCustomMetadata !== undefined && { includeCustomMetadata: input.IncludeCustomMetadata.toString() }),
943
- };
692
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DocumentId", () => input.DocumentId, "{DocumentId}", false);
693
+ const query = map({
694
+ includeCustomMetadata: [
695
+ () => input.IncludeCustomMetadata !== void 0,
696
+ () => input.IncludeCustomMetadata.toString(),
697
+ ],
698
+ });
944
699
  let body;
945
700
  return new protocol_http_1.HttpRequest({
946
701
  protocol,
@@ -956,25 +711,16 @@ const serializeAws_restJson1GetDocumentCommand = async (input, context) => {
956
711
  exports.serializeAws_restJson1GetDocumentCommand = serializeAws_restJson1GetDocumentCommand;
957
712
  const serializeAws_restJson1GetDocumentPathCommand = async (input, context) => {
958
713
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
959
- const headers = {
960
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
961
- };
714
+ const headers = map({}, isSerializableHeaderValue, {
715
+ authentication: input.AuthenticationToken,
716
+ });
962
717
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/documents/{DocumentId}/path";
963
- if (input.DocumentId !== undefined) {
964
- const labelValue = input.DocumentId;
965
- if (labelValue.length <= 0) {
966
- throw new Error("Empty value provided for input HTTP label: DocumentId.");
967
- }
968
- resolvedPath = resolvedPath.replace("{DocumentId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
969
- }
970
- else {
971
- throw new Error("No value provided for input HTTP label: DocumentId.");
972
- }
973
- const query = {
974
- ...(input.Limit !== undefined && { limit: input.Limit.toString() }),
975
- ...(input.Fields !== undefined && { fields: input.Fields }),
976
- ...(input.Marker !== undefined && { marker: input.Marker }),
977
- };
718
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DocumentId", () => input.DocumentId, "{DocumentId}", false);
719
+ const query = map({
720
+ limit: [() => input.Limit !== void 0, () => input.Limit.toString()],
721
+ fields: [, input.Fields],
722
+ marker: [, input.Marker],
723
+ });
978
724
  let body;
979
725
  return new protocol_http_1.HttpRequest({
980
726
  protocol,
@@ -990,35 +736,20 @@ const serializeAws_restJson1GetDocumentPathCommand = async (input, context) => {
990
736
  exports.serializeAws_restJson1GetDocumentPathCommand = serializeAws_restJson1GetDocumentPathCommand;
991
737
  const serializeAws_restJson1GetDocumentVersionCommand = async (input, context) => {
992
738
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
993
- const headers = {
994
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
995
- };
739
+ const headers = map({}, isSerializableHeaderValue, {
740
+ authentication: input.AuthenticationToken,
741
+ });
996
742
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
997
743
  "/api/v1/documents/{DocumentId}/versions/{VersionId}";
998
- if (input.DocumentId !== undefined) {
999
- const labelValue = input.DocumentId;
1000
- if (labelValue.length <= 0) {
1001
- throw new Error("Empty value provided for input HTTP label: DocumentId.");
1002
- }
1003
- resolvedPath = resolvedPath.replace("{DocumentId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1004
- }
1005
- else {
1006
- throw new Error("No value provided for input HTTP label: DocumentId.");
1007
- }
1008
- if (input.VersionId !== undefined) {
1009
- const labelValue = input.VersionId;
1010
- if (labelValue.length <= 0) {
1011
- throw new Error("Empty value provided for input HTTP label: VersionId.");
1012
- }
1013
- resolvedPath = resolvedPath.replace("{VersionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1014
- }
1015
- else {
1016
- throw new Error("No value provided for input HTTP label: VersionId.");
1017
- }
1018
- const query = {
1019
- ...(input.Fields !== undefined && { fields: input.Fields }),
1020
- ...(input.IncludeCustomMetadata !== undefined && { includeCustomMetadata: input.IncludeCustomMetadata.toString() }),
1021
- };
744
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DocumentId", () => input.DocumentId, "{DocumentId}", false);
745
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "VersionId", () => input.VersionId, "{VersionId}", false);
746
+ const query = map({
747
+ fields: [, input.Fields],
748
+ includeCustomMetadata: [
749
+ () => input.IncludeCustomMetadata !== void 0,
750
+ () => input.IncludeCustomMetadata.toString(),
751
+ ],
752
+ });
1022
753
  let body;
1023
754
  return new protocol_http_1.HttpRequest({
1024
755
  protocol,
@@ -1034,23 +765,17 @@ const serializeAws_restJson1GetDocumentVersionCommand = async (input, context) =
1034
765
  exports.serializeAws_restJson1GetDocumentVersionCommand = serializeAws_restJson1GetDocumentVersionCommand;
1035
766
  const serializeAws_restJson1GetFolderCommand = async (input, context) => {
1036
767
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1037
- const headers = {
1038
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
1039
- };
768
+ const headers = map({}, isSerializableHeaderValue, {
769
+ authentication: input.AuthenticationToken,
770
+ });
1040
771
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/folders/{FolderId}";
1041
- if (input.FolderId !== undefined) {
1042
- const labelValue = input.FolderId;
1043
- if (labelValue.length <= 0) {
1044
- throw new Error("Empty value provided for input HTTP label: FolderId.");
1045
- }
1046
- resolvedPath = resolvedPath.replace("{FolderId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1047
- }
1048
- else {
1049
- throw new Error("No value provided for input HTTP label: FolderId.");
1050
- }
1051
- const query = {
1052
- ...(input.IncludeCustomMetadata !== undefined && { includeCustomMetadata: input.IncludeCustomMetadata.toString() }),
1053
- };
772
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FolderId", () => input.FolderId, "{FolderId}", false);
773
+ const query = map({
774
+ includeCustomMetadata: [
775
+ () => input.IncludeCustomMetadata !== void 0,
776
+ () => input.IncludeCustomMetadata.toString(),
777
+ ],
778
+ });
1054
779
  let body;
1055
780
  return new protocol_http_1.HttpRequest({
1056
781
  protocol,
@@ -1066,25 +791,16 @@ const serializeAws_restJson1GetFolderCommand = async (input, context) => {
1066
791
  exports.serializeAws_restJson1GetFolderCommand = serializeAws_restJson1GetFolderCommand;
1067
792
  const serializeAws_restJson1GetFolderPathCommand = async (input, context) => {
1068
793
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1069
- const headers = {
1070
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
1071
- };
794
+ const headers = map({}, isSerializableHeaderValue, {
795
+ authentication: input.AuthenticationToken,
796
+ });
1072
797
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/folders/{FolderId}/path";
1073
- if (input.FolderId !== undefined) {
1074
- const labelValue = input.FolderId;
1075
- if (labelValue.length <= 0) {
1076
- throw new Error("Empty value provided for input HTTP label: FolderId.");
1077
- }
1078
- resolvedPath = resolvedPath.replace("{FolderId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1079
- }
1080
- else {
1081
- throw new Error("No value provided for input HTTP label: FolderId.");
1082
- }
1083
- const query = {
1084
- ...(input.Limit !== undefined && { limit: input.Limit.toString() }),
1085
- ...(input.Fields !== undefined && { fields: input.Fields }),
1086
- ...(input.Marker !== undefined && { marker: input.Marker }),
1087
- };
798
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FolderId", () => input.FolderId, "{FolderId}", false);
799
+ const query = map({
800
+ limit: [() => input.Limit !== void 0, () => input.Limit.toString()],
801
+ fields: [, input.Fields],
802
+ marker: [, input.Marker],
803
+ });
1088
804
  let body;
1089
805
  return new protocol_http_1.HttpRequest({
1090
806
  protocol,
@@ -1100,16 +816,16 @@ const serializeAws_restJson1GetFolderPathCommand = async (input, context) => {
1100
816
  exports.serializeAws_restJson1GetFolderPathCommand = serializeAws_restJson1GetFolderPathCommand;
1101
817
  const serializeAws_restJson1GetResourcesCommand = async (input, context) => {
1102
818
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1103
- const headers = {
1104
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
1105
- };
819
+ const headers = map({}, isSerializableHeaderValue, {
820
+ authentication: input.AuthenticationToken,
821
+ });
1106
822
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/resources";
1107
- const query = {
1108
- ...(input.UserId !== undefined && { userId: input.UserId }),
1109
- ...(input.CollectionType !== undefined && { collectionType: input.CollectionType }),
1110
- ...(input.Limit !== undefined && { limit: input.Limit.toString() }),
1111
- ...(input.Marker !== undefined && { marker: input.Marker }),
1112
- };
823
+ const query = map({
824
+ userId: [, input.UserId],
825
+ collectionType: [, input.CollectionType],
826
+ limit: [() => input.Limit !== void 0, () => input.Limit.toString()],
827
+ marker: [, input.Marker],
828
+ });
1113
829
  let body;
1114
830
  return new protocol_http_1.HttpRequest({
1115
831
  protocol,
@@ -1125,10 +841,10 @@ const serializeAws_restJson1GetResourcesCommand = async (input, context) => {
1125
841
  exports.serializeAws_restJson1GetResourcesCommand = serializeAws_restJson1GetResourcesCommand;
1126
842
  const serializeAws_restJson1InitiateDocumentVersionUploadCommand = async (input, context) => {
1127
843
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1128
- const headers = {
844
+ const headers = map({}, isSerializableHeaderValue, {
1129
845
  "content-type": "application/json",
1130
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
1131
- };
846
+ authentication: input.AuthenticationToken,
847
+ });
1132
848
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/documents";
1133
849
  let body;
1134
850
  body = JSON.stringify({
@@ -1157,21 +873,12 @@ const serializeAws_restJson1InitiateDocumentVersionUploadCommand = async (input,
1157
873
  exports.serializeAws_restJson1InitiateDocumentVersionUploadCommand = serializeAws_restJson1InitiateDocumentVersionUploadCommand;
1158
874
  const serializeAws_restJson1RemoveAllResourcePermissionsCommand = async (input, context) => {
1159
875
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1160
- const headers = {
1161
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
1162
- };
876
+ const headers = map({}, isSerializableHeaderValue, {
877
+ authentication: input.AuthenticationToken,
878
+ });
1163
879
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1164
880
  "/api/v1/resources/{ResourceId}/permissions";
1165
- if (input.ResourceId !== undefined) {
1166
- const labelValue = input.ResourceId;
1167
- if (labelValue.length <= 0) {
1168
- throw new Error("Empty value provided for input HTTP label: ResourceId.");
1169
- }
1170
- resolvedPath = resolvedPath.replace("{ResourceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1171
- }
1172
- else {
1173
- throw new Error("No value provided for input HTTP label: ResourceId.");
1174
- }
881
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceId", () => input.ResourceId, "{ResourceId}", false);
1175
882
  let body;
1176
883
  return new protocol_http_1.HttpRequest({
1177
884
  protocol,
@@ -1186,34 +893,16 @@ const serializeAws_restJson1RemoveAllResourcePermissionsCommand = async (input,
1186
893
  exports.serializeAws_restJson1RemoveAllResourcePermissionsCommand = serializeAws_restJson1RemoveAllResourcePermissionsCommand;
1187
894
  const serializeAws_restJson1RemoveResourcePermissionCommand = async (input, context) => {
1188
895
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1189
- const headers = {
1190
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
1191
- };
896
+ const headers = map({}, isSerializableHeaderValue, {
897
+ authentication: input.AuthenticationToken,
898
+ });
1192
899
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1193
900
  "/api/v1/resources/{ResourceId}/permissions/{PrincipalId}";
1194
- if (input.ResourceId !== undefined) {
1195
- const labelValue = input.ResourceId;
1196
- if (labelValue.length <= 0) {
1197
- throw new Error("Empty value provided for input HTTP label: ResourceId.");
1198
- }
1199
- resolvedPath = resolvedPath.replace("{ResourceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1200
- }
1201
- else {
1202
- throw new Error("No value provided for input HTTP label: ResourceId.");
1203
- }
1204
- if (input.PrincipalId !== undefined) {
1205
- const labelValue = input.PrincipalId;
1206
- if (labelValue.length <= 0) {
1207
- throw new Error("Empty value provided for input HTTP label: PrincipalId.");
1208
- }
1209
- resolvedPath = resolvedPath.replace("{PrincipalId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1210
- }
1211
- else {
1212
- throw new Error("No value provided for input HTTP label: PrincipalId.");
1213
- }
1214
- const query = {
1215
- ...(input.PrincipalType !== undefined && { type: input.PrincipalType }),
1216
- };
901
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceId", () => input.ResourceId, "{ResourceId}", false);
902
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "PrincipalId", () => input.PrincipalId, "{PrincipalId}", false);
903
+ const query = map({
904
+ type: [, input.PrincipalType],
905
+ });
1217
906
  let body;
1218
907
  return new protocol_http_1.HttpRequest({
1219
908
  protocol,
@@ -1229,21 +918,12 @@ const serializeAws_restJson1RemoveResourcePermissionCommand = async (input, cont
1229
918
  exports.serializeAws_restJson1RemoveResourcePermissionCommand = serializeAws_restJson1RemoveResourcePermissionCommand;
1230
919
  const serializeAws_restJson1UpdateDocumentCommand = async (input, context) => {
1231
920
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1232
- const headers = {
921
+ const headers = map({}, isSerializableHeaderValue, {
1233
922
  "content-type": "application/json",
1234
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
1235
- };
923
+ authentication: input.AuthenticationToken,
924
+ });
1236
925
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/documents/{DocumentId}";
1237
- if (input.DocumentId !== undefined) {
1238
- const labelValue = input.DocumentId;
1239
- if (labelValue.length <= 0) {
1240
- throw new Error("Empty value provided for input HTTP label: DocumentId.");
1241
- }
1242
- resolvedPath = resolvedPath.replace("{DocumentId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1243
- }
1244
- else {
1245
- throw new Error("No value provided for input HTTP label: DocumentId.");
1246
- }
926
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DocumentId", () => input.DocumentId, "{DocumentId}", false);
1247
927
  let body;
1248
928
  body = JSON.stringify({
1249
929
  ...(input.Name != null && { Name: input.Name }),
@@ -1263,32 +943,14 @@ const serializeAws_restJson1UpdateDocumentCommand = async (input, context) => {
1263
943
  exports.serializeAws_restJson1UpdateDocumentCommand = serializeAws_restJson1UpdateDocumentCommand;
1264
944
  const serializeAws_restJson1UpdateDocumentVersionCommand = async (input, context) => {
1265
945
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1266
- const headers = {
946
+ const headers = map({}, isSerializableHeaderValue, {
1267
947
  "content-type": "application/json",
1268
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
1269
- };
948
+ authentication: input.AuthenticationToken,
949
+ });
1270
950
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1271
951
  "/api/v1/documents/{DocumentId}/versions/{VersionId}";
1272
- if (input.DocumentId !== undefined) {
1273
- const labelValue = input.DocumentId;
1274
- if (labelValue.length <= 0) {
1275
- throw new Error("Empty value provided for input HTTP label: DocumentId.");
1276
- }
1277
- resolvedPath = resolvedPath.replace("{DocumentId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1278
- }
1279
- else {
1280
- throw new Error("No value provided for input HTTP label: DocumentId.");
1281
- }
1282
- if (input.VersionId !== undefined) {
1283
- const labelValue = input.VersionId;
1284
- if (labelValue.length <= 0) {
1285
- throw new Error("Empty value provided for input HTTP label: VersionId.");
1286
- }
1287
- resolvedPath = resolvedPath.replace("{VersionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1288
- }
1289
- else {
1290
- throw new Error("No value provided for input HTTP label: VersionId.");
1291
- }
952
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DocumentId", () => input.DocumentId, "{DocumentId}", false);
953
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "VersionId", () => input.VersionId, "{VersionId}", false);
1292
954
  let body;
1293
955
  body = JSON.stringify({
1294
956
  ...(input.VersionStatus != null && { VersionStatus: input.VersionStatus }),
@@ -1306,21 +968,12 @@ const serializeAws_restJson1UpdateDocumentVersionCommand = async (input, context
1306
968
  exports.serializeAws_restJson1UpdateDocumentVersionCommand = serializeAws_restJson1UpdateDocumentVersionCommand;
1307
969
  const serializeAws_restJson1UpdateFolderCommand = async (input, context) => {
1308
970
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1309
- const headers = {
971
+ const headers = map({}, isSerializableHeaderValue, {
1310
972
  "content-type": "application/json",
1311
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
1312
- };
973
+ authentication: input.AuthenticationToken,
974
+ });
1313
975
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/folders/{FolderId}";
1314
- if (input.FolderId !== undefined) {
1315
- const labelValue = input.FolderId;
1316
- if (labelValue.length <= 0) {
1317
- throw new Error("Empty value provided for input HTTP label: FolderId.");
1318
- }
1319
- resolvedPath = resolvedPath.replace("{FolderId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1320
- }
1321
- else {
1322
- throw new Error("No value provided for input HTTP label: FolderId.");
1323
- }
976
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FolderId", () => input.FolderId, "{FolderId}", false);
1324
977
  let body;
1325
978
  body = JSON.stringify({
1326
979
  ...(input.Name != null && { Name: input.Name }),
@@ -1340,21 +993,12 @@ const serializeAws_restJson1UpdateFolderCommand = async (input, context) => {
1340
993
  exports.serializeAws_restJson1UpdateFolderCommand = serializeAws_restJson1UpdateFolderCommand;
1341
994
  const serializeAws_restJson1UpdateUserCommand = async (input, context) => {
1342
995
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1343
- const headers = {
996
+ const headers = map({}, isSerializableHeaderValue, {
1344
997
  "content-type": "application/json",
1345
- ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken }),
1346
- };
998
+ authentication: input.AuthenticationToken,
999
+ });
1347
1000
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/users/{UserId}";
1348
- if (input.UserId !== undefined) {
1349
- const labelValue = input.UserId;
1350
- if (labelValue.length <= 0) {
1351
- throw new Error("Empty value provided for input HTTP label: UserId.");
1352
- }
1353
- resolvedPath = resolvedPath.replace("{UserId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1354
- }
1355
- else {
1356
- throw new Error("No value provided for input HTTP label: UserId.");
1357
- }
1001
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "UserId", () => input.UserId, "{UserId}", false);
1358
1002
  let body;
1359
1003
  body = JSON.stringify({
1360
1004
  ...(input.GivenName != null && { GivenName: input.GivenName }),
@@ -1382,11 +1026,11 @@ const deserializeAws_restJson1AbortDocumentVersionUploadCommand = async (output,
1382
1026
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1383
1027
  return deserializeAws_restJson1AbortDocumentVersionUploadCommandError(output, context);
1384
1028
  }
1385
- const contents = {
1029
+ const contents = map({
1386
1030
  $metadata: deserializeMetadata(output),
1387
- };
1031
+ });
1388
1032
  await collectBody(output.body, context);
1389
- return Promise.resolve(contents);
1033
+ return contents;
1390
1034
  };
1391
1035
  exports.deserializeAws_restJson1AbortDocumentVersionUploadCommand = deserializeAws_restJson1AbortDocumentVersionUploadCommand;
1392
1036
  const deserializeAws_restJson1AbortDocumentVersionUploadCommandError = async (output, context) => {
@@ -1394,7 +1038,6 @@ const deserializeAws_restJson1AbortDocumentVersionUploadCommandError = async (ou
1394
1038
  ...output,
1395
1039
  body: await parseBody(output.body, context),
1396
1040
  };
1397
- let response;
1398
1041
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1399
1042
  switch (errorCode) {
1400
1043
  case "EntityNotExistsException":
@@ -1417,29 +1060,26 @@ const deserializeAws_restJson1AbortDocumentVersionUploadCommandError = async (ou
1417
1060
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
1418
1061
  default:
1419
1062
  const parsedBody = parsedOutput.body;
1420
- const $metadata = deserializeMetadata(output);
1421
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1422
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
1423
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1424
- $fault: "client",
1425
- $metadata,
1063
+ (0, smithy_client_1.throwDefaultError)({
1064
+ output,
1065
+ parsedBody,
1066
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
1067
+ errorCode,
1426
1068
  });
1427
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1428
1069
  }
1429
1070
  };
1430
1071
  const deserializeAws_restJson1ActivateUserCommand = async (output, context) => {
1431
1072
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1432
1073
  return deserializeAws_restJson1ActivateUserCommandError(output, context);
1433
1074
  }
1434
- const contents = {
1075
+ const contents = map({
1435
1076
  $metadata: deserializeMetadata(output),
1436
- User: undefined,
1437
- };
1077
+ });
1438
1078
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1439
- if (data.User !== undefined && data.User !== null) {
1079
+ if (data.User != null) {
1440
1080
  contents.User = deserializeAws_restJson1User(data.User, context);
1441
1081
  }
1442
- return Promise.resolve(contents);
1082
+ return contents;
1443
1083
  };
1444
1084
  exports.deserializeAws_restJson1ActivateUserCommand = deserializeAws_restJson1ActivateUserCommand;
1445
1085
  const deserializeAws_restJson1ActivateUserCommandError = async (output, context) => {
@@ -1447,7 +1087,6 @@ const deserializeAws_restJson1ActivateUserCommandError = async (output, context)
1447
1087
  ...output,
1448
1088
  body: await parseBody(output.body, context),
1449
1089
  };
1450
- let response;
1451
1090
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1452
1091
  switch (errorCode) {
1453
1092
  case "EntityNotExistsException":
@@ -1467,29 +1106,26 @@ const deserializeAws_restJson1ActivateUserCommandError = async (output, context)
1467
1106
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
1468
1107
  default:
1469
1108
  const parsedBody = parsedOutput.body;
1470
- const $metadata = deserializeMetadata(output);
1471
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1472
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
1473
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1474
- $fault: "client",
1475
- $metadata,
1109
+ (0, smithy_client_1.throwDefaultError)({
1110
+ output,
1111
+ parsedBody,
1112
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
1113
+ errorCode,
1476
1114
  });
1477
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1478
1115
  }
1479
1116
  };
1480
1117
  const deserializeAws_restJson1AddResourcePermissionsCommand = async (output, context) => {
1481
1118
  if (output.statusCode !== 201 && output.statusCode >= 300) {
1482
1119
  return deserializeAws_restJson1AddResourcePermissionsCommandError(output, context);
1483
1120
  }
1484
- const contents = {
1121
+ const contents = map({
1485
1122
  $metadata: deserializeMetadata(output),
1486
- ShareResults: undefined,
1487
- };
1123
+ });
1488
1124
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1489
- if (data.ShareResults !== undefined && data.ShareResults !== null) {
1125
+ if (data.ShareResults != null) {
1490
1126
  contents.ShareResults = deserializeAws_restJson1ShareResultsList(data.ShareResults, context);
1491
1127
  }
1492
- return Promise.resolve(contents);
1128
+ return contents;
1493
1129
  };
1494
1130
  exports.deserializeAws_restJson1AddResourcePermissionsCommand = deserializeAws_restJson1AddResourcePermissionsCommand;
1495
1131
  const deserializeAws_restJson1AddResourcePermissionsCommandError = async (output, context) => {
@@ -1497,7 +1133,6 @@ const deserializeAws_restJson1AddResourcePermissionsCommandError = async (output
1497
1133
  ...output,
1498
1134
  body: await parseBody(output.body, context),
1499
1135
  };
1500
- let response;
1501
1136
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1502
1137
  switch (errorCode) {
1503
1138
  case "FailedDependencyException":
@@ -1514,29 +1149,26 @@ const deserializeAws_restJson1AddResourcePermissionsCommandError = async (output
1514
1149
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
1515
1150
  default:
1516
1151
  const parsedBody = parsedOutput.body;
1517
- const $metadata = deserializeMetadata(output);
1518
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1519
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
1520
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1521
- $fault: "client",
1522
- $metadata,
1152
+ (0, smithy_client_1.throwDefaultError)({
1153
+ output,
1154
+ parsedBody,
1155
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
1156
+ errorCode,
1523
1157
  });
1524
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1525
1158
  }
1526
1159
  };
1527
1160
  const deserializeAws_restJson1CreateCommentCommand = async (output, context) => {
1528
1161
  if (output.statusCode !== 201 && output.statusCode >= 300) {
1529
1162
  return deserializeAws_restJson1CreateCommentCommandError(output, context);
1530
1163
  }
1531
- const contents = {
1164
+ const contents = map({
1532
1165
  $metadata: deserializeMetadata(output),
1533
- Comment: undefined,
1534
- };
1166
+ });
1535
1167
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1536
- if (data.Comment !== undefined && data.Comment !== null) {
1168
+ if (data.Comment != null) {
1537
1169
  contents.Comment = deserializeAws_restJson1Comment(data.Comment, context);
1538
1170
  }
1539
- return Promise.resolve(contents);
1171
+ return contents;
1540
1172
  };
1541
1173
  exports.deserializeAws_restJson1CreateCommentCommand = deserializeAws_restJson1CreateCommentCommand;
1542
1174
  const deserializeAws_restJson1CreateCommentCommandError = async (output, context) => {
@@ -1544,7 +1176,6 @@ const deserializeAws_restJson1CreateCommentCommandError = async (output, context
1544
1176
  ...output,
1545
1177
  body: await parseBody(output.body, context),
1546
1178
  };
1547
- let response;
1548
1179
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1549
1180
  switch (errorCode) {
1550
1181
  case "DocumentLockedForCommentsException":
@@ -1573,25 +1204,23 @@ const deserializeAws_restJson1CreateCommentCommandError = async (output, context
1573
1204
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
1574
1205
  default:
1575
1206
  const parsedBody = parsedOutput.body;
1576
- const $metadata = deserializeMetadata(output);
1577
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1578
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
1579
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1580
- $fault: "client",
1581
- $metadata,
1207
+ (0, smithy_client_1.throwDefaultError)({
1208
+ output,
1209
+ parsedBody,
1210
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
1211
+ errorCode,
1582
1212
  });
1583
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1584
1213
  }
1585
1214
  };
1586
1215
  const deserializeAws_restJson1CreateCustomMetadataCommand = async (output, context) => {
1587
1216
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1588
1217
  return deserializeAws_restJson1CreateCustomMetadataCommandError(output, context);
1589
1218
  }
1590
- const contents = {
1219
+ const contents = map({
1591
1220
  $metadata: deserializeMetadata(output),
1592
- };
1221
+ });
1593
1222
  await collectBody(output.body, context);
1594
- return Promise.resolve(contents);
1223
+ return contents;
1595
1224
  };
1596
1225
  exports.deserializeAws_restJson1CreateCustomMetadataCommand = deserializeAws_restJson1CreateCustomMetadataCommand;
1597
1226
  const deserializeAws_restJson1CreateCustomMetadataCommandError = async (output, context) => {
@@ -1599,7 +1228,6 @@ const deserializeAws_restJson1CreateCustomMetadataCommandError = async (output,
1599
1228
  ...output,
1600
1229
  body: await parseBody(output.body, context),
1601
1230
  };
1602
- let response;
1603
1231
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1604
1232
  switch (errorCode) {
1605
1233
  case "CustomMetadataLimitExceededException":
@@ -1625,29 +1253,26 @@ const deserializeAws_restJson1CreateCustomMetadataCommandError = async (output,
1625
1253
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
1626
1254
  default:
1627
1255
  const parsedBody = parsedOutput.body;
1628
- const $metadata = deserializeMetadata(output);
1629
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1630
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
1631
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1632
- $fault: "client",
1633
- $metadata,
1256
+ (0, smithy_client_1.throwDefaultError)({
1257
+ output,
1258
+ parsedBody,
1259
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
1260
+ errorCode,
1634
1261
  });
1635
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1636
1262
  }
1637
1263
  };
1638
1264
  const deserializeAws_restJson1CreateFolderCommand = async (output, context) => {
1639
1265
  if (output.statusCode !== 201 && output.statusCode >= 300) {
1640
1266
  return deserializeAws_restJson1CreateFolderCommandError(output, context);
1641
1267
  }
1642
- const contents = {
1268
+ const contents = map({
1643
1269
  $metadata: deserializeMetadata(output),
1644
- Metadata: undefined,
1645
- };
1270
+ });
1646
1271
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1647
- if (data.Metadata !== undefined && data.Metadata !== null) {
1272
+ if (data.Metadata != null) {
1648
1273
  contents.Metadata = deserializeAws_restJson1FolderMetadata(data.Metadata, context);
1649
1274
  }
1650
- return Promise.resolve(contents);
1275
+ return contents;
1651
1276
  };
1652
1277
  exports.deserializeAws_restJson1CreateFolderCommand = deserializeAws_restJson1CreateFolderCommand;
1653
1278
  const deserializeAws_restJson1CreateFolderCommandError = async (output, context) => {
@@ -1655,7 +1280,6 @@ const deserializeAws_restJson1CreateFolderCommandError = async (output, context)
1655
1280
  ...output,
1656
1281
  body: await parseBody(output.body, context),
1657
1282
  };
1658
- let response;
1659
1283
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1660
1284
  switch (errorCode) {
1661
1285
  case "ConflictingOperationException":
@@ -1687,25 +1311,23 @@ const deserializeAws_restJson1CreateFolderCommandError = async (output, context)
1687
1311
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
1688
1312
  default:
1689
1313
  const parsedBody = parsedOutput.body;
1690
- const $metadata = deserializeMetadata(output);
1691
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1692
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
1693
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1694
- $fault: "client",
1695
- $metadata,
1314
+ (0, smithy_client_1.throwDefaultError)({
1315
+ output,
1316
+ parsedBody,
1317
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
1318
+ errorCode,
1696
1319
  });
1697
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1698
1320
  }
1699
1321
  };
1700
1322
  const deserializeAws_restJson1CreateLabelsCommand = async (output, context) => {
1701
1323
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1702
1324
  return deserializeAws_restJson1CreateLabelsCommandError(output, context);
1703
1325
  }
1704
- const contents = {
1326
+ const contents = map({
1705
1327
  $metadata: deserializeMetadata(output),
1706
- };
1328
+ });
1707
1329
  await collectBody(output.body, context);
1708
- return Promise.resolve(contents);
1330
+ return contents;
1709
1331
  };
1710
1332
  exports.deserializeAws_restJson1CreateLabelsCommand = deserializeAws_restJson1CreateLabelsCommand;
1711
1333
  const deserializeAws_restJson1CreateLabelsCommandError = async (output, context) => {
@@ -1713,7 +1335,6 @@ const deserializeAws_restJson1CreateLabelsCommandError = async (output, context)
1713
1335
  ...output,
1714
1336
  body: await parseBody(output.body, context),
1715
1337
  };
1716
- let response;
1717
1338
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1718
1339
  switch (errorCode) {
1719
1340
  case "EntityNotExistsException":
@@ -1736,29 +1357,26 @@ const deserializeAws_restJson1CreateLabelsCommandError = async (output, context)
1736
1357
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
1737
1358
  default:
1738
1359
  const parsedBody = parsedOutput.body;
1739
- const $metadata = deserializeMetadata(output);
1740
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1741
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
1742
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1743
- $fault: "client",
1744
- $metadata,
1360
+ (0, smithy_client_1.throwDefaultError)({
1361
+ output,
1362
+ parsedBody,
1363
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
1364
+ errorCode,
1745
1365
  });
1746
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1747
1366
  }
1748
1367
  };
1749
1368
  const deserializeAws_restJson1CreateNotificationSubscriptionCommand = async (output, context) => {
1750
1369
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1751
1370
  return deserializeAws_restJson1CreateNotificationSubscriptionCommandError(output, context);
1752
1371
  }
1753
- const contents = {
1372
+ const contents = map({
1754
1373
  $metadata: deserializeMetadata(output),
1755
- Subscription: undefined,
1756
- };
1374
+ });
1757
1375
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1758
- if (data.Subscription !== undefined && data.Subscription !== null) {
1376
+ if (data.Subscription != null) {
1759
1377
  contents.Subscription = deserializeAws_restJson1Subscription(data.Subscription, context);
1760
1378
  }
1761
- return Promise.resolve(contents);
1379
+ return contents;
1762
1380
  };
1763
1381
  exports.deserializeAws_restJson1CreateNotificationSubscriptionCommand = deserializeAws_restJson1CreateNotificationSubscriptionCommand;
1764
1382
  const deserializeAws_restJson1CreateNotificationSubscriptionCommandError = async (output, context) => {
@@ -1766,7 +1384,6 @@ const deserializeAws_restJson1CreateNotificationSubscriptionCommandError = async
1766
1384
  ...output,
1767
1385
  body: await parseBody(output.body, context),
1768
1386
  };
1769
- let response;
1770
1387
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1771
1388
  switch (errorCode) {
1772
1389
  case "ServiceUnavailableException":
@@ -1780,29 +1397,26 @@ const deserializeAws_restJson1CreateNotificationSubscriptionCommandError = async
1780
1397
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
1781
1398
  default:
1782
1399
  const parsedBody = parsedOutput.body;
1783
- const $metadata = deserializeMetadata(output);
1784
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1785
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
1786
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1787
- $fault: "client",
1788
- $metadata,
1400
+ (0, smithy_client_1.throwDefaultError)({
1401
+ output,
1402
+ parsedBody,
1403
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
1404
+ errorCode,
1789
1405
  });
1790
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1791
1406
  }
1792
1407
  };
1793
1408
  const deserializeAws_restJson1CreateUserCommand = async (output, context) => {
1794
1409
  if (output.statusCode !== 201 && output.statusCode >= 300) {
1795
1410
  return deserializeAws_restJson1CreateUserCommandError(output, context);
1796
1411
  }
1797
- const contents = {
1412
+ const contents = map({
1798
1413
  $metadata: deserializeMetadata(output),
1799
- User: undefined,
1800
- };
1414
+ });
1801
1415
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1802
- if (data.User !== undefined && data.User !== null) {
1416
+ if (data.User != null) {
1803
1417
  contents.User = deserializeAws_restJson1User(data.User, context);
1804
1418
  }
1805
- return Promise.resolve(contents);
1419
+ return contents;
1806
1420
  };
1807
1421
  exports.deserializeAws_restJson1CreateUserCommand = deserializeAws_restJson1CreateUserCommand;
1808
1422
  const deserializeAws_restJson1CreateUserCommandError = async (output, context) => {
@@ -1810,7 +1424,6 @@ const deserializeAws_restJson1CreateUserCommandError = async (output, context) =
1810
1424
  ...output,
1811
1425
  body: await parseBody(output.body, context),
1812
1426
  };
1813
- let response;
1814
1427
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1815
1428
  switch (errorCode) {
1816
1429
  case "EntityAlreadyExistsException":
@@ -1830,25 +1443,23 @@ const deserializeAws_restJson1CreateUserCommandError = async (output, context) =
1830
1443
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
1831
1444
  default:
1832
1445
  const parsedBody = parsedOutput.body;
1833
- const $metadata = deserializeMetadata(output);
1834
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1835
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
1836
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1837
- $fault: "client",
1838
- $metadata,
1446
+ (0, smithy_client_1.throwDefaultError)({
1447
+ output,
1448
+ parsedBody,
1449
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
1450
+ errorCode,
1839
1451
  });
1840
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1841
1452
  }
1842
1453
  };
1843
1454
  const deserializeAws_restJson1DeactivateUserCommand = async (output, context) => {
1844
1455
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1845
1456
  return deserializeAws_restJson1DeactivateUserCommandError(output, context);
1846
1457
  }
1847
- const contents = {
1458
+ const contents = map({
1848
1459
  $metadata: deserializeMetadata(output),
1849
- };
1460
+ });
1850
1461
  await collectBody(output.body, context);
1851
- return Promise.resolve(contents);
1462
+ return contents;
1852
1463
  };
1853
1464
  exports.deserializeAws_restJson1DeactivateUserCommand = deserializeAws_restJson1DeactivateUserCommand;
1854
1465
  const deserializeAws_restJson1DeactivateUserCommandError = async (output, context) => {
@@ -1856,7 +1467,6 @@ const deserializeAws_restJson1DeactivateUserCommandError = async (output, contex
1856
1467
  ...output,
1857
1468
  body: await parseBody(output.body, context),
1858
1469
  };
1859
- let response;
1860
1470
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1861
1471
  switch (errorCode) {
1862
1472
  case "EntityNotExistsException":
@@ -1876,25 +1486,23 @@ const deserializeAws_restJson1DeactivateUserCommandError = async (output, contex
1876
1486
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
1877
1487
  default:
1878
1488
  const parsedBody = parsedOutput.body;
1879
- const $metadata = deserializeMetadata(output);
1880
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1881
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
1882
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1883
- $fault: "client",
1884
- $metadata,
1489
+ (0, smithy_client_1.throwDefaultError)({
1490
+ output,
1491
+ parsedBody,
1492
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
1493
+ errorCode,
1885
1494
  });
1886
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1887
1495
  }
1888
1496
  };
1889
1497
  const deserializeAws_restJson1DeleteCommentCommand = async (output, context) => {
1890
1498
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1891
1499
  return deserializeAws_restJson1DeleteCommentCommandError(output, context);
1892
1500
  }
1893
- const contents = {
1501
+ const contents = map({
1894
1502
  $metadata: deserializeMetadata(output),
1895
- };
1503
+ });
1896
1504
  await collectBody(output.body, context);
1897
- return Promise.resolve(contents);
1505
+ return contents;
1898
1506
  };
1899
1507
  exports.deserializeAws_restJson1DeleteCommentCommand = deserializeAws_restJson1DeleteCommentCommand;
1900
1508
  const deserializeAws_restJson1DeleteCommentCommandError = async (output, context) => {
@@ -1902,7 +1510,6 @@ const deserializeAws_restJson1DeleteCommentCommandError = async (output, context
1902
1510
  ...output,
1903
1511
  body: await parseBody(output.body, context),
1904
1512
  };
1905
- let response;
1906
1513
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1907
1514
  switch (errorCode) {
1908
1515
  case "DocumentLockedForCommentsException":
@@ -1928,25 +1535,23 @@ const deserializeAws_restJson1DeleteCommentCommandError = async (output, context
1928
1535
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
1929
1536
  default:
1930
1537
  const parsedBody = parsedOutput.body;
1931
- const $metadata = deserializeMetadata(output);
1932
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1933
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
1934
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1935
- $fault: "client",
1936
- $metadata,
1538
+ (0, smithy_client_1.throwDefaultError)({
1539
+ output,
1540
+ parsedBody,
1541
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
1542
+ errorCode,
1937
1543
  });
1938
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1939
1544
  }
1940
1545
  };
1941
1546
  const deserializeAws_restJson1DeleteCustomMetadataCommand = async (output, context) => {
1942
1547
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1943
1548
  return deserializeAws_restJson1DeleteCustomMetadataCommandError(output, context);
1944
1549
  }
1945
- const contents = {
1550
+ const contents = map({
1946
1551
  $metadata: deserializeMetadata(output),
1947
- };
1552
+ });
1948
1553
  await collectBody(output.body, context);
1949
- return Promise.resolve(contents);
1554
+ return contents;
1950
1555
  };
1951
1556
  exports.deserializeAws_restJson1DeleteCustomMetadataCommand = deserializeAws_restJson1DeleteCustomMetadataCommand;
1952
1557
  const deserializeAws_restJson1DeleteCustomMetadataCommandError = async (output, context) => {
@@ -1954,7 +1559,6 @@ const deserializeAws_restJson1DeleteCustomMetadataCommandError = async (output,
1954
1559
  ...output,
1955
1560
  body: await parseBody(output.body, context),
1956
1561
  };
1957
- let response;
1958
1562
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1959
1563
  switch (errorCode) {
1960
1564
  case "EntityNotExistsException":
@@ -1977,25 +1581,23 @@ const deserializeAws_restJson1DeleteCustomMetadataCommandError = async (output,
1977
1581
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
1978
1582
  default:
1979
1583
  const parsedBody = parsedOutput.body;
1980
- const $metadata = deserializeMetadata(output);
1981
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1982
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
1983
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1984
- $fault: "client",
1985
- $metadata,
1584
+ (0, smithy_client_1.throwDefaultError)({
1585
+ output,
1586
+ parsedBody,
1587
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
1588
+ errorCode,
1986
1589
  });
1987
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1988
1590
  }
1989
1591
  };
1990
1592
  const deserializeAws_restJson1DeleteDocumentCommand = async (output, context) => {
1991
1593
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1992
1594
  return deserializeAws_restJson1DeleteDocumentCommandError(output, context);
1993
1595
  }
1994
- const contents = {
1596
+ const contents = map({
1995
1597
  $metadata: deserializeMetadata(output),
1996
- };
1598
+ });
1997
1599
  await collectBody(output.body, context);
1998
- return Promise.resolve(contents);
1600
+ return contents;
1999
1601
  };
2000
1602
  exports.deserializeAws_restJson1DeleteDocumentCommand = deserializeAws_restJson1DeleteDocumentCommand;
2001
1603
  const deserializeAws_restJson1DeleteDocumentCommandError = async (output, context) => {
@@ -2003,7 +1605,6 @@ const deserializeAws_restJson1DeleteDocumentCommandError = async (output, contex
2003
1605
  ...output,
2004
1606
  body: await parseBody(output.body, context),
2005
1607
  };
2006
- let response;
2007
1608
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2008
1609
  switch (errorCode) {
2009
1610
  case "ConcurrentModificationException":
@@ -2032,25 +1633,23 @@ const deserializeAws_restJson1DeleteDocumentCommandError = async (output, contex
2032
1633
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
2033
1634
  default:
2034
1635
  const parsedBody = parsedOutput.body;
2035
- const $metadata = deserializeMetadata(output);
2036
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2037
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
2038
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2039
- $fault: "client",
2040
- $metadata,
1636
+ (0, smithy_client_1.throwDefaultError)({
1637
+ output,
1638
+ parsedBody,
1639
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
1640
+ errorCode,
2041
1641
  });
2042
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2043
1642
  }
2044
1643
  };
2045
1644
  const deserializeAws_restJson1DeleteFolderCommand = async (output, context) => {
2046
1645
  if (output.statusCode !== 204 && output.statusCode >= 300) {
2047
1646
  return deserializeAws_restJson1DeleteFolderCommandError(output, context);
2048
1647
  }
2049
- const contents = {
1648
+ const contents = map({
2050
1649
  $metadata: deserializeMetadata(output),
2051
- };
1650
+ });
2052
1651
  await collectBody(output.body, context);
2053
- return Promise.resolve(contents);
1652
+ return contents;
2054
1653
  };
2055
1654
  exports.deserializeAws_restJson1DeleteFolderCommand = deserializeAws_restJson1DeleteFolderCommand;
2056
1655
  const deserializeAws_restJson1DeleteFolderCommandError = async (output, context) => {
@@ -2058,7 +1657,6 @@ const deserializeAws_restJson1DeleteFolderCommandError = async (output, context)
2058
1657
  ...output,
2059
1658
  body: await parseBody(output.body, context),
2060
1659
  };
2061
- let response;
2062
1660
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2063
1661
  switch (errorCode) {
2064
1662
  case "ConcurrentModificationException":
@@ -2087,25 +1685,23 @@ const deserializeAws_restJson1DeleteFolderCommandError = async (output, context)
2087
1685
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
2088
1686
  default:
2089
1687
  const parsedBody = parsedOutput.body;
2090
- const $metadata = deserializeMetadata(output);
2091
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2092
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
2093
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2094
- $fault: "client",
2095
- $metadata,
1688
+ (0, smithy_client_1.throwDefaultError)({
1689
+ output,
1690
+ parsedBody,
1691
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
1692
+ errorCode,
2096
1693
  });
2097
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2098
1694
  }
2099
1695
  };
2100
1696
  const deserializeAws_restJson1DeleteFolderContentsCommand = async (output, context) => {
2101
1697
  if (output.statusCode !== 204 && output.statusCode >= 300) {
2102
1698
  return deserializeAws_restJson1DeleteFolderContentsCommandError(output, context);
2103
1699
  }
2104
- const contents = {
1700
+ const contents = map({
2105
1701
  $metadata: deserializeMetadata(output),
2106
- };
1702
+ });
2107
1703
  await collectBody(output.body, context);
2108
- return Promise.resolve(contents);
1704
+ return contents;
2109
1705
  };
2110
1706
  exports.deserializeAws_restJson1DeleteFolderContentsCommand = deserializeAws_restJson1DeleteFolderContentsCommand;
2111
1707
  const deserializeAws_restJson1DeleteFolderContentsCommandError = async (output, context) => {
@@ -2113,7 +1709,6 @@ const deserializeAws_restJson1DeleteFolderContentsCommandError = async (output,
2113
1709
  ...output,
2114
1710
  body: await parseBody(output.body, context),
2115
1711
  };
2116
- let response;
2117
1712
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2118
1713
  switch (errorCode) {
2119
1714
  case "ConflictingOperationException":
@@ -2139,25 +1734,23 @@ const deserializeAws_restJson1DeleteFolderContentsCommandError = async (output,
2139
1734
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
2140
1735
  default:
2141
1736
  const parsedBody = parsedOutput.body;
2142
- const $metadata = deserializeMetadata(output);
2143
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2144
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
2145
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2146
- $fault: "client",
2147
- $metadata,
1737
+ (0, smithy_client_1.throwDefaultError)({
1738
+ output,
1739
+ parsedBody,
1740
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
1741
+ errorCode,
2148
1742
  });
2149
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2150
1743
  }
2151
1744
  };
2152
1745
  const deserializeAws_restJson1DeleteLabelsCommand = async (output, context) => {
2153
1746
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2154
1747
  return deserializeAws_restJson1DeleteLabelsCommandError(output, context);
2155
1748
  }
2156
- const contents = {
1749
+ const contents = map({
2157
1750
  $metadata: deserializeMetadata(output),
2158
- };
1751
+ });
2159
1752
  await collectBody(output.body, context);
2160
- return Promise.resolve(contents);
1753
+ return contents;
2161
1754
  };
2162
1755
  exports.deserializeAws_restJson1DeleteLabelsCommand = deserializeAws_restJson1DeleteLabelsCommand;
2163
1756
  const deserializeAws_restJson1DeleteLabelsCommandError = async (output, context) => {
@@ -2165,7 +1758,6 @@ const deserializeAws_restJson1DeleteLabelsCommandError = async (output, context)
2165
1758
  ...output,
2166
1759
  body: await parseBody(output.body, context),
2167
1760
  };
2168
- let response;
2169
1761
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2170
1762
  switch (errorCode) {
2171
1763
  case "EntityNotExistsException":
@@ -2185,25 +1777,23 @@ const deserializeAws_restJson1DeleteLabelsCommandError = async (output, context)
2185
1777
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
2186
1778
  default:
2187
1779
  const parsedBody = parsedOutput.body;
2188
- const $metadata = deserializeMetadata(output);
2189
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2190
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
2191
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2192
- $fault: "client",
2193
- $metadata,
1780
+ (0, smithy_client_1.throwDefaultError)({
1781
+ output,
1782
+ parsedBody,
1783
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
1784
+ errorCode,
2194
1785
  });
2195
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2196
1786
  }
2197
1787
  };
2198
1788
  const deserializeAws_restJson1DeleteNotificationSubscriptionCommand = async (output, context) => {
2199
1789
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2200
1790
  return deserializeAws_restJson1DeleteNotificationSubscriptionCommandError(output, context);
2201
1791
  }
2202
- const contents = {
1792
+ const contents = map({
2203
1793
  $metadata: deserializeMetadata(output),
2204
- };
1794
+ });
2205
1795
  await collectBody(output.body, context);
2206
- return Promise.resolve(contents);
1796
+ return contents;
2207
1797
  };
2208
1798
  exports.deserializeAws_restJson1DeleteNotificationSubscriptionCommand = deserializeAws_restJson1DeleteNotificationSubscriptionCommand;
2209
1799
  const deserializeAws_restJson1DeleteNotificationSubscriptionCommandError = async (output, context) => {
@@ -2211,7 +1801,6 @@ const deserializeAws_restJson1DeleteNotificationSubscriptionCommandError = async
2211
1801
  ...output,
2212
1802
  body: await parseBody(output.body, context),
2213
1803
  };
2214
- let response;
2215
1804
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2216
1805
  switch (errorCode) {
2217
1806
  case "EntityNotExistsException":
@@ -2228,25 +1817,23 @@ const deserializeAws_restJson1DeleteNotificationSubscriptionCommandError = async
2228
1817
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
2229
1818
  default:
2230
1819
  const parsedBody = parsedOutput.body;
2231
- const $metadata = deserializeMetadata(output);
2232
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2233
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
2234
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2235
- $fault: "client",
2236
- $metadata,
1820
+ (0, smithy_client_1.throwDefaultError)({
1821
+ output,
1822
+ parsedBody,
1823
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
1824
+ errorCode,
2237
1825
  });
2238
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2239
1826
  }
2240
1827
  };
2241
1828
  const deserializeAws_restJson1DeleteUserCommand = async (output, context) => {
2242
1829
  if (output.statusCode !== 204 && output.statusCode >= 300) {
2243
1830
  return deserializeAws_restJson1DeleteUserCommandError(output, context);
2244
1831
  }
2245
- const contents = {
1832
+ const contents = map({
2246
1833
  $metadata: deserializeMetadata(output),
2247
- };
1834
+ });
2248
1835
  await collectBody(output.body, context);
2249
- return Promise.resolve(contents);
1836
+ return contents;
2250
1837
  };
2251
1838
  exports.deserializeAws_restJson1DeleteUserCommand = deserializeAws_restJson1DeleteUserCommand;
2252
1839
  const deserializeAws_restJson1DeleteUserCommandError = async (output, context) => {
@@ -2254,7 +1841,6 @@ const deserializeAws_restJson1DeleteUserCommandError = async (output, context) =
2254
1841
  ...output,
2255
1842
  body: await parseBody(output.body, context),
2256
1843
  };
2257
- let response;
2258
1844
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2259
1845
  switch (errorCode) {
2260
1846
  case "EntityNotExistsException":
@@ -2274,33 +1860,29 @@ const deserializeAws_restJson1DeleteUserCommandError = async (output, context) =
2274
1860
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
2275
1861
  default:
2276
1862
  const parsedBody = parsedOutput.body;
2277
- const $metadata = deserializeMetadata(output);
2278
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2279
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
2280
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2281
- $fault: "client",
2282
- $metadata,
1863
+ (0, smithy_client_1.throwDefaultError)({
1864
+ output,
1865
+ parsedBody,
1866
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
1867
+ errorCode,
2283
1868
  });
2284
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2285
1869
  }
2286
1870
  };
2287
1871
  const deserializeAws_restJson1DescribeActivitiesCommand = async (output, context) => {
2288
1872
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2289
1873
  return deserializeAws_restJson1DescribeActivitiesCommandError(output, context);
2290
1874
  }
2291
- const contents = {
1875
+ const contents = map({
2292
1876
  $metadata: deserializeMetadata(output),
2293
- Marker: undefined,
2294
- UserActivities: undefined,
2295
- };
1877
+ });
2296
1878
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2297
- if (data.Marker !== undefined && data.Marker !== null) {
1879
+ if (data.Marker != null) {
2298
1880
  contents.Marker = (0, smithy_client_1.expectString)(data.Marker);
2299
1881
  }
2300
- if (data.UserActivities !== undefined && data.UserActivities !== null) {
1882
+ if (data.UserActivities != null) {
2301
1883
  contents.UserActivities = deserializeAws_restJson1UserActivities(data.UserActivities, context);
2302
1884
  }
2303
- return Promise.resolve(contents);
1885
+ return contents;
2304
1886
  };
2305
1887
  exports.deserializeAws_restJson1DescribeActivitiesCommand = deserializeAws_restJson1DescribeActivitiesCommand;
2306
1888
  const deserializeAws_restJson1DescribeActivitiesCommandError = async (output, context) => {
@@ -2308,7 +1890,6 @@ const deserializeAws_restJson1DescribeActivitiesCommandError = async (output, co
2308
1890
  ...output,
2309
1891
  body: await parseBody(output.body, context),
2310
1892
  };
2311
- let response;
2312
1893
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2313
1894
  switch (errorCode) {
2314
1895
  case "FailedDependencyException":
@@ -2328,33 +1909,29 @@ const deserializeAws_restJson1DescribeActivitiesCommandError = async (output, co
2328
1909
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
2329
1910
  default:
2330
1911
  const parsedBody = parsedOutput.body;
2331
- const $metadata = deserializeMetadata(output);
2332
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2333
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
2334
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2335
- $fault: "client",
2336
- $metadata,
1912
+ (0, smithy_client_1.throwDefaultError)({
1913
+ output,
1914
+ parsedBody,
1915
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
1916
+ errorCode,
2337
1917
  });
2338
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2339
1918
  }
2340
1919
  };
2341
1920
  const deserializeAws_restJson1DescribeCommentsCommand = async (output, context) => {
2342
1921
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2343
1922
  return deserializeAws_restJson1DescribeCommentsCommandError(output, context);
2344
1923
  }
2345
- const contents = {
1924
+ const contents = map({
2346
1925
  $metadata: deserializeMetadata(output),
2347
- Comments: undefined,
2348
- Marker: undefined,
2349
- };
1926
+ });
2350
1927
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2351
- if (data.Comments !== undefined && data.Comments !== null) {
1928
+ if (data.Comments != null) {
2352
1929
  contents.Comments = deserializeAws_restJson1CommentList(data.Comments, context);
2353
1930
  }
2354
- if (data.Marker !== undefined && data.Marker !== null) {
1931
+ if (data.Marker != null) {
2355
1932
  contents.Marker = (0, smithy_client_1.expectString)(data.Marker);
2356
1933
  }
2357
- return Promise.resolve(contents);
1934
+ return contents;
2358
1935
  };
2359
1936
  exports.deserializeAws_restJson1DescribeCommentsCommand = deserializeAws_restJson1DescribeCommentsCommand;
2360
1937
  const deserializeAws_restJson1DescribeCommentsCommandError = async (output, context) => {
@@ -2362,7 +1939,6 @@ const deserializeAws_restJson1DescribeCommentsCommandError = async (output, cont
2362
1939
  ...output,
2363
1940
  body: await parseBody(output.body, context),
2364
1941
  };
2365
- let response;
2366
1942
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2367
1943
  switch (errorCode) {
2368
1944
  case "EntityNotExistsException":
@@ -2385,33 +1961,29 @@ const deserializeAws_restJson1DescribeCommentsCommandError = async (output, cont
2385
1961
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
2386
1962
  default:
2387
1963
  const parsedBody = parsedOutput.body;
2388
- const $metadata = deserializeMetadata(output);
2389
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2390
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
2391
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2392
- $fault: "client",
2393
- $metadata,
1964
+ (0, smithy_client_1.throwDefaultError)({
1965
+ output,
1966
+ parsedBody,
1967
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
1968
+ errorCode,
2394
1969
  });
2395
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2396
1970
  }
2397
1971
  };
2398
1972
  const deserializeAws_restJson1DescribeDocumentVersionsCommand = async (output, context) => {
2399
1973
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2400
1974
  return deserializeAws_restJson1DescribeDocumentVersionsCommandError(output, context);
2401
1975
  }
2402
- const contents = {
1976
+ const contents = map({
2403
1977
  $metadata: deserializeMetadata(output),
2404
- DocumentVersions: undefined,
2405
- Marker: undefined,
2406
- };
1978
+ });
2407
1979
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2408
- if (data.DocumentVersions !== undefined && data.DocumentVersions !== null) {
1980
+ if (data.DocumentVersions != null) {
2409
1981
  contents.DocumentVersions = deserializeAws_restJson1DocumentVersionMetadataList(data.DocumentVersions, context);
2410
1982
  }
2411
- if (data.Marker !== undefined && data.Marker !== null) {
1983
+ if (data.Marker != null) {
2412
1984
  contents.Marker = (0, smithy_client_1.expectString)(data.Marker);
2413
1985
  }
2414
- return Promise.resolve(contents);
1986
+ return contents;
2415
1987
  };
2416
1988
  exports.deserializeAws_restJson1DescribeDocumentVersionsCommand = deserializeAws_restJson1DescribeDocumentVersionsCommand;
2417
1989
  const deserializeAws_restJson1DescribeDocumentVersionsCommandError = async (output, context) => {
@@ -2419,7 +1991,6 @@ const deserializeAws_restJson1DescribeDocumentVersionsCommandError = async (outp
2419
1991
  ...output,
2420
1992
  body: await parseBody(output.body, context),
2421
1993
  };
2422
- let response;
2423
1994
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2424
1995
  switch (errorCode) {
2425
1996
  case "EntityNotExistsException":
@@ -2445,37 +2016,32 @@ const deserializeAws_restJson1DescribeDocumentVersionsCommandError = async (outp
2445
2016
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
2446
2017
  default:
2447
2018
  const parsedBody = parsedOutput.body;
2448
- const $metadata = deserializeMetadata(output);
2449
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2450
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
2451
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2452
- $fault: "client",
2453
- $metadata,
2019
+ (0, smithy_client_1.throwDefaultError)({
2020
+ output,
2021
+ parsedBody,
2022
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
2023
+ errorCode,
2454
2024
  });
2455
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2456
2025
  }
2457
2026
  };
2458
2027
  const deserializeAws_restJson1DescribeFolderContentsCommand = async (output, context) => {
2459
2028
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2460
2029
  return deserializeAws_restJson1DescribeFolderContentsCommandError(output, context);
2461
2030
  }
2462
- const contents = {
2031
+ const contents = map({
2463
2032
  $metadata: deserializeMetadata(output),
2464
- Documents: undefined,
2465
- Folders: undefined,
2466
- Marker: undefined,
2467
- };
2033
+ });
2468
2034
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2469
- if (data.Documents !== undefined && data.Documents !== null) {
2035
+ if (data.Documents != null) {
2470
2036
  contents.Documents = deserializeAws_restJson1DocumentMetadataList(data.Documents, context);
2471
2037
  }
2472
- if (data.Folders !== undefined && data.Folders !== null) {
2038
+ if (data.Folders != null) {
2473
2039
  contents.Folders = deserializeAws_restJson1FolderMetadataList(data.Folders, context);
2474
2040
  }
2475
- if (data.Marker !== undefined && data.Marker !== null) {
2041
+ if (data.Marker != null) {
2476
2042
  contents.Marker = (0, smithy_client_1.expectString)(data.Marker);
2477
2043
  }
2478
- return Promise.resolve(contents);
2044
+ return contents;
2479
2045
  };
2480
2046
  exports.deserializeAws_restJson1DescribeFolderContentsCommand = deserializeAws_restJson1DescribeFolderContentsCommand;
2481
2047
  const deserializeAws_restJson1DescribeFolderContentsCommandError = async (output, context) => {
@@ -2483,7 +2049,6 @@ const deserializeAws_restJson1DescribeFolderContentsCommandError = async (output
2483
2049
  ...output,
2484
2050
  body: await parseBody(output.body, context),
2485
2051
  };
2486
- let response;
2487
2052
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2488
2053
  switch (errorCode) {
2489
2054
  case "EntityNotExistsException":
@@ -2506,33 +2071,29 @@ const deserializeAws_restJson1DescribeFolderContentsCommandError = async (output
2506
2071
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
2507
2072
  default:
2508
2073
  const parsedBody = parsedOutput.body;
2509
- const $metadata = deserializeMetadata(output);
2510
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2511
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
2512
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2513
- $fault: "client",
2514
- $metadata,
2074
+ (0, smithy_client_1.throwDefaultError)({
2075
+ output,
2076
+ parsedBody,
2077
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
2078
+ errorCode,
2515
2079
  });
2516
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2517
2080
  }
2518
2081
  };
2519
2082
  const deserializeAws_restJson1DescribeGroupsCommand = async (output, context) => {
2520
2083
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2521
2084
  return deserializeAws_restJson1DescribeGroupsCommandError(output, context);
2522
2085
  }
2523
- const contents = {
2086
+ const contents = map({
2524
2087
  $metadata: deserializeMetadata(output),
2525
- Groups: undefined,
2526
- Marker: undefined,
2527
- };
2088
+ });
2528
2089
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2529
- if (data.Groups !== undefined && data.Groups !== null) {
2090
+ if (data.Groups != null) {
2530
2091
  contents.Groups = deserializeAws_restJson1GroupMetadataList(data.Groups, context);
2531
2092
  }
2532
- if (data.Marker !== undefined && data.Marker !== null) {
2093
+ if (data.Marker != null) {
2533
2094
  contents.Marker = (0, smithy_client_1.expectString)(data.Marker);
2534
2095
  }
2535
- return Promise.resolve(contents);
2096
+ return contents;
2536
2097
  };
2537
2098
  exports.deserializeAws_restJson1DescribeGroupsCommand = deserializeAws_restJson1DescribeGroupsCommand;
2538
2099
  const deserializeAws_restJson1DescribeGroupsCommandError = async (output, context) => {
@@ -2540,7 +2101,6 @@ const deserializeAws_restJson1DescribeGroupsCommandError = async (output, contex
2540
2101
  ...output,
2541
2102
  body: await parseBody(output.body, context),
2542
2103
  };
2543
- let response;
2544
2104
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2545
2105
  switch (errorCode) {
2546
2106
  case "FailedDependencyException":
@@ -2557,33 +2117,29 @@ const deserializeAws_restJson1DescribeGroupsCommandError = async (output, contex
2557
2117
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
2558
2118
  default:
2559
2119
  const parsedBody = parsedOutput.body;
2560
- const $metadata = deserializeMetadata(output);
2561
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2562
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
2563
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2564
- $fault: "client",
2565
- $metadata,
2120
+ (0, smithy_client_1.throwDefaultError)({
2121
+ output,
2122
+ parsedBody,
2123
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
2124
+ errorCode,
2566
2125
  });
2567
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2568
2126
  }
2569
2127
  };
2570
2128
  const deserializeAws_restJson1DescribeNotificationSubscriptionsCommand = async (output, context) => {
2571
2129
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2572
2130
  return deserializeAws_restJson1DescribeNotificationSubscriptionsCommandError(output, context);
2573
2131
  }
2574
- const contents = {
2132
+ const contents = map({
2575
2133
  $metadata: deserializeMetadata(output),
2576
- Marker: undefined,
2577
- Subscriptions: undefined,
2578
- };
2134
+ });
2579
2135
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2580
- if (data.Marker !== undefined && data.Marker !== null) {
2136
+ if (data.Marker != null) {
2581
2137
  contents.Marker = (0, smithy_client_1.expectString)(data.Marker);
2582
2138
  }
2583
- if (data.Subscriptions !== undefined && data.Subscriptions !== null) {
2139
+ if (data.Subscriptions != null) {
2584
2140
  contents.Subscriptions = deserializeAws_restJson1SubscriptionList(data.Subscriptions, context);
2585
2141
  }
2586
- return Promise.resolve(contents);
2142
+ return contents;
2587
2143
  };
2588
2144
  exports.deserializeAws_restJson1DescribeNotificationSubscriptionsCommand = deserializeAws_restJson1DescribeNotificationSubscriptionsCommand;
2589
2145
  const deserializeAws_restJson1DescribeNotificationSubscriptionsCommandError = async (output, context) => {
@@ -2591,7 +2147,6 @@ const deserializeAws_restJson1DescribeNotificationSubscriptionsCommandError = as
2591
2147
  ...output,
2592
2148
  body: await parseBody(output.body, context),
2593
2149
  };
2594
- let response;
2595
2150
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2596
2151
  switch (errorCode) {
2597
2152
  case "EntityNotExistsException":
@@ -2605,33 +2160,29 @@ const deserializeAws_restJson1DescribeNotificationSubscriptionsCommandError = as
2605
2160
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
2606
2161
  default:
2607
2162
  const parsedBody = parsedOutput.body;
2608
- const $metadata = deserializeMetadata(output);
2609
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2610
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
2611
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2612
- $fault: "client",
2613
- $metadata,
2163
+ (0, smithy_client_1.throwDefaultError)({
2164
+ output,
2165
+ parsedBody,
2166
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
2167
+ errorCode,
2614
2168
  });
2615
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2616
2169
  }
2617
2170
  };
2618
2171
  const deserializeAws_restJson1DescribeResourcePermissionsCommand = async (output, context) => {
2619
2172
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2620
2173
  return deserializeAws_restJson1DescribeResourcePermissionsCommandError(output, context);
2621
2174
  }
2622
- const contents = {
2175
+ const contents = map({
2623
2176
  $metadata: deserializeMetadata(output),
2624
- Marker: undefined,
2625
- Principals: undefined,
2626
- };
2177
+ });
2627
2178
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2628
- if (data.Marker !== undefined && data.Marker !== null) {
2179
+ if (data.Marker != null) {
2629
2180
  contents.Marker = (0, smithy_client_1.expectString)(data.Marker);
2630
2181
  }
2631
- if (data.Principals !== undefined && data.Principals !== null) {
2182
+ if (data.Principals != null) {
2632
2183
  contents.Principals = deserializeAws_restJson1PrincipalList(data.Principals, context);
2633
2184
  }
2634
- return Promise.resolve(contents);
2185
+ return contents;
2635
2186
  };
2636
2187
  exports.deserializeAws_restJson1DescribeResourcePermissionsCommand = deserializeAws_restJson1DescribeResourcePermissionsCommand;
2637
2188
  const deserializeAws_restJson1DescribeResourcePermissionsCommandError = async (output, context) => {
@@ -2639,7 +2190,6 @@ const deserializeAws_restJson1DescribeResourcePermissionsCommandError = async (o
2639
2190
  ...output,
2640
2191
  body: await parseBody(output.body, context),
2641
2192
  };
2642
- let response;
2643
2193
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2644
2194
  switch (errorCode) {
2645
2195
  case "FailedDependencyException":
@@ -2656,33 +2206,29 @@ const deserializeAws_restJson1DescribeResourcePermissionsCommandError = async (o
2656
2206
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
2657
2207
  default:
2658
2208
  const parsedBody = parsedOutput.body;
2659
- const $metadata = deserializeMetadata(output);
2660
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2661
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
2662
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2663
- $fault: "client",
2664
- $metadata,
2209
+ (0, smithy_client_1.throwDefaultError)({
2210
+ output,
2211
+ parsedBody,
2212
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
2213
+ errorCode,
2665
2214
  });
2666
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2667
2215
  }
2668
2216
  };
2669
2217
  const deserializeAws_restJson1DescribeRootFoldersCommand = async (output, context) => {
2670
2218
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2671
2219
  return deserializeAws_restJson1DescribeRootFoldersCommandError(output, context);
2672
2220
  }
2673
- const contents = {
2221
+ const contents = map({
2674
2222
  $metadata: deserializeMetadata(output),
2675
- Folders: undefined,
2676
- Marker: undefined,
2677
- };
2223
+ });
2678
2224
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2679
- if (data.Folders !== undefined && data.Folders !== null) {
2225
+ if (data.Folders != null) {
2680
2226
  contents.Folders = deserializeAws_restJson1FolderMetadataList(data.Folders, context);
2681
2227
  }
2682
- if (data.Marker !== undefined && data.Marker !== null) {
2228
+ if (data.Marker != null) {
2683
2229
  contents.Marker = (0, smithy_client_1.expectString)(data.Marker);
2684
2230
  }
2685
- return Promise.resolve(contents);
2231
+ return contents;
2686
2232
  };
2687
2233
  exports.deserializeAws_restJson1DescribeRootFoldersCommand = deserializeAws_restJson1DescribeRootFoldersCommand;
2688
2234
  const deserializeAws_restJson1DescribeRootFoldersCommandError = async (output, context) => {
@@ -2690,7 +2236,6 @@ const deserializeAws_restJson1DescribeRootFoldersCommandError = async (output, c
2690
2236
  ...output,
2691
2237
  body: await parseBody(output.body, context),
2692
2238
  };
2693
- let response;
2694
2239
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2695
2240
  switch (errorCode) {
2696
2241
  case "FailedDependencyException":
@@ -2710,37 +2255,32 @@ const deserializeAws_restJson1DescribeRootFoldersCommandError = async (output, c
2710
2255
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
2711
2256
  default:
2712
2257
  const parsedBody = parsedOutput.body;
2713
- const $metadata = deserializeMetadata(output);
2714
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2715
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
2716
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2717
- $fault: "client",
2718
- $metadata,
2258
+ (0, smithy_client_1.throwDefaultError)({
2259
+ output,
2260
+ parsedBody,
2261
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
2262
+ errorCode,
2719
2263
  });
2720
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2721
2264
  }
2722
2265
  };
2723
2266
  const deserializeAws_restJson1DescribeUsersCommand = async (output, context) => {
2724
2267
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2725
2268
  return deserializeAws_restJson1DescribeUsersCommandError(output, context);
2726
2269
  }
2727
- const contents = {
2270
+ const contents = map({
2728
2271
  $metadata: deserializeMetadata(output),
2729
- Marker: undefined,
2730
- TotalNumberOfUsers: undefined,
2731
- Users: undefined,
2732
- };
2272
+ });
2733
2273
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2734
- if (data.Marker !== undefined && data.Marker !== null) {
2274
+ if (data.Marker != null) {
2735
2275
  contents.Marker = (0, smithy_client_1.expectString)(data.Marker);
2736
2276
  }
2737
- if (data.TotalNumberOfUsers !== undefined && data.TotalNumberOfUsers !== null) {
2277
+ if (data.TotalNumberOfUsers != null) {
2738
2278
  contents.TotalNumberOfUsers = (0, smithy_client_1.expectLong)(data.TotalNumberOfUsers);
2739
2279
  }
2740
- if (data.Users !== undefined && data.Users !== null) {
2280
+ if (data.Users != null) {
2741
2281
  contents.Users = deserializeAws_restJson1OrganizationUserList(data.Users, context);
2742
2282
  }
2743
- return Promise.resolve(contents);
2283
+ return contents;
2744
2284
  };
2745
2285
  exports.deserializeAws_restJson1DescribeUsersCommand = deserializeAws_restJson1DescribeUsersCommand;
2746
2286
  const deserializeAws_restJson1DescribeUsersCommandError = async (output, context) => {
@@ -2748,7 +2288,6 @@ const deserializeAws_restJson1DescribeUsersCommandError = async (output, context
2748
2288
  ...output,
2749
2289
  body: await parseBody(output.body, context),
2750
2290
  };
2751
- let response;
2752
2291
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2753
2292
  switch (errorCode) {
2754
2293
  case "EntityNotExistsException":
@@ -2774,29 +2313,26 @@ const deserializeAws_restJson1DescribeUsersCommandError = async (output, context
2774
2313
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
2775
2314
  default:
2776
2315
  const parsedBody = parsedOutput.body;
2777
- const $metadata = deserializeMetadata(output);
2778
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2779
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
2780
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2781
- $fault: "client",
2782
- $metadata,
2316
+ (0, smithy_client_1.throwDefaultError)({
2317
+ output,
2318
+ parsedBody,
2319
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
2320
+ errorCode,
2783
2321
  });
2784
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2785
2322
  }
2786
2323
  };
2787
2324
  const deserializeAws_restJson1GetCurrentUserCommand = async (output, context) => {
2788
2325
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2789
2326
  return deserializeAws_restJson1GetCurrentUserCommandError(output, context);
2790
2327
  }
2791
- const contents = {
2328
+ const contents = map({
2792
2329
  $metadata: deserializeMetadata(output),
2793
- User: undefined,
2794
- };
2330
+ });
2795
2331
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2796
- if (data.User !== undefined && data.User !== null) {
2332
+ if (data.User != null) {
2797
2333
  contents.User = deserializeAws_restJson1User(data.User, context);
2798
2334
  }
2799
- return Promise.resolve(contents);
2335
+ return contents;
2800
2336
  };
2801
2337
  exports.deserializeAws_restJson1GetCurrentUserCommand = deserializeAws_restJson1GetCurrentUserCommand;
2802
2338
  const deserializeAws_restJson1GetCurrentUserCommandError = async (output, context) => {
@@ -2804,7 +2340,6 @@ const deserializeAws_restJson1GetCurrentUserCommandError = async (output, contex
2804
2340
  ...output,
2805
2341
  body: await parseBody(output.body, context),
2806
2342
  };
2807
- let response;
2808
2343
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2809
2344
  switch (errorCode) {
2810
2345
  case "EntityNotExistsException":
@@ -2824,33 +2359,29 @@ const deserializeAws_restJson1GetCurrentUserCommandError = async (output, contex
2824
2359
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
2825
2360
  default:
2826
2361
  const parsedBody = parsedOutput.body;
2827
- const $metadata = deserializeMetadata(output);
2828
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2829
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
2830
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2831
- $fault: "client",
2832
- $metadata,
2362
+ (0, smithy_client_1.throwDefaultError)({
2363
+ output,
2364
+ parsedBody,
2365
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
2366
+ errorCode,
2833
2367
  });
2834
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2835
2368
  }
2836
2369
  };
2837
2370
  const deserializeAws_restJson1GetDocumentCommand = async (output, context) => {
2838
2371
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2839
2372
  return deserializeAws_restJson1GetDocumentCommandError(output, context);
2840
2373
  }
2841
- const contents = {
2374
+ const contents = map({
2842
2375
  $metadata: deserializeMetadata(output),
2843
- CustomMetadata: undefined,
2844
- Metadata: undefined,
2845
- };
2376
+ });
2846
2377
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2847
- if (data.CustomMetadata !== undefined && data.CustomMetadata !== null) {
2378
+ if (data.CustomMetadata != null) {
2848
2379
  contents.CustomMetadata = deserializeAws_restJson1CustomMetadataMap(data.CustomMetadata, context);
2849
2380
  }
2850
- if (data.Metadata !== undefined && data.Metadata !== null) {
2381
+ if (data.Metadata != null) {
2851
2382
  contents.Metadata = deserializeAws_restJson1DocumentMetadata(data.Metadata, context);
2852
2383
  }
2853
- return Promise.resolve(contents);
2384
+ return contents;
2854
2385
  };
2855
2386
  exports.deserializeAws_restJson1GetDocumentCommand = deserializeAws_restJson1GetDocumentCommand;
2856
2387
  const deserializeAws_restJson1GetDocumentCommandError = async (output, context) => {
@@ -2858,7 +2389,6 @@ const deserializeAws_restJson1GetDocumentCommandError = async (output, context)
2858
2389
  ...output,
2859
2390
  body: await parseBody(output.body, context),
2860
2391
  };
2861
- let response;
2862
2392
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2863
2393
  switch (errorCode) {
2864
2394
  case "EntityNotExistsException":
@@ -2884,29 +2414,26 @@ const deserializeAws_restJson1GetDocumentCommandError = async (output, context)
2884
2414
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
2885
2415
  default:
2886
2416
  const parsedBody = parsedOutput.body;
2887
- const $metadata = deserializeMetadata(output);
2888
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2889
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
2890
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2891
- $fault: "client",
2892
- $metadata,
2417
+ (0, smithy_client_1.throwDefaultError)({
2418
+ output,
2419
+ parsedBody,
2420
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
2421
+ errorCode,
2893
2422
  });
2894
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2895
2423
  }
2896
2424
  };
2897
2425
  const deserializeAws_restJson1GetDocumentPathCommand = async (output, context) => {
2898
2426
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2899
2427
  return deserializeAws_restJson1GetDocumentPathCommandError(output, context);
2900
2428
  }
2901
- const contents = {
2429
+ const contents = map({
2902
2430
  $metadata: deserializeMetadata(output),
2903
- Path: undefined,
2904
- };
2431
+ });
2905
2432
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2906
- if (data.Path !== undefined && data.Path !== null) {
2433
+ if (data.Path != null) {
2907
2434
  contents.Path = deserializeAws_restJson1ResourcePath(data.Path, context);
2908
2435
  }
2909
- return Promise.resolve(contents);
2436
+ return contents;
2910
2437
  };
2911
2438
  exports.deserializeAws_restJson1GetDocumentPathCommand = deserializeAws_restJson1GetDocumentPathCommand;
2912
2439
  const deserializeAws_restJson1GetDocumentPathCommandError = async (output, context) => {
@@ -2914,7 +2441,6 @@ const deserializeAws_restJson1GetDocumentPathCommandError = async (output, conte
2914
2441
  ...output,
2915
2442
  body: await parseBody(output.body, context),
2916
2443
  };
2917
- let response;
2918
2444
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2919
2445
  switch (errorCode) {
2920
2446
  case "EntityNotExistsException":
@@ -2934,33 +2460,29 @@ const deserializeAws_restJson1GetDocumentPathCommandError = async (output, conte
2934
2460
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
2935
2461
  default:
2936
2462
  const parsedBody = parsedOutput.body;
2937
- const $metadata = deserializeMetadata(output);
2938
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2939
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
2940
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2941
- $fault: "client",
2942
- $metadata,
2463
+ (0, smithy_client_1.throwDefaultError)({
2464
+ output,
2465
+ parsedBody,
2466
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
2467
+ errorCode,
2943
2468
  });
2944
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2945
2469
  }
2946
2470
  };
2947
2471
  const deserializeAws_restJson1GetDocumentVersionCommand = async (output, context) => {
2948
2472
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2949
2473
  return deserializeAws_restJson1GetDocumentVersionCommandError(output, context);
2950
2474
  }
2951
- const contents = {
2475
+ const contents = map({
2952
2476
  $metadata: deserializeMetadata(output),
2953
- CustomMetadata: undefined,
2954
- Metadata: undefined,
2955
- };
2477
+ });
2956
2478
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2957
- if (data.CustomMetadata !== undefined && data.CustomMetadata !== null) {
2479
+ if (data.CustomMetadata != null) {
2958
2480
  contents.CustomMetadata = deserializeAws_restJson1CustomMetadataMap(data.CustomMetadata, context);
2959
2481
  }
2960
- if (data.Metadata !== undefined && data.Metadata !== null) {
2482
+ if (data.Metadata != null) {
2961
2483
  contents.Metadata = deserializeAws_restJson1DocumentVersionMetadata(data.Metadata, context);
2962
2484
  }
2963
- return Promise.resolve(contents);
2485
+ return contents;
2964
2486
  };
2965
2487
  exports.deserializeAws_restJson1GetDocumentVersionCommand = deserializeAws_restJson1GetDocumentVersionCommand;
2966
2488
  const deserializeAws_restJson1GetDocumentVersionCommandError = async (output, context) => {
@@ -2968,7 +2490,6 @@ const deserializeAws_restJson1GetDocumentVersionCommandError = async (output, co
2968
2490
  ...output,
2969
2491
  body: await parseBody(output.body, context),
2970
2492
  };
2971
- let response;
2972
2493
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2973
2494
  switch (errorCode) {
2974
2495
  case "EntityNotExistsException":
@@ -2994,33 +2515,29 @@ const deserializeAws_restJson1GetDocumentVersionCommandError = async (output, co
2994
2515
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
2995
2516
  default:
2996
2517
  const parsedBody = parsedOutput.body;
2997
- const $metadata = deserializeMetadata(output);
2998
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2999
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
3000
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3001
- $fault: "client",
3002
- $metadata,
2518
+ (0, smithy_client_1.throwDefaultError)({
2519
+ output,
2520
+ parsedBody,
2521
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
2522
+ errorCode,
3003
2523
  });
3004
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3005
2524
  }
3006
2525
  };
3007
2526
  const deserializeAws_restJson1GetFolderCommand = async (output, context) => {
3008
2527
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3009
2528
  return deserializeAws_restJson1GetFolderCommandError(output, context);
3010
2529
  }
3011
- const contents = {
2530
+ const contents = map({
3012
2531
  $metadata: deserializeMetadata(output),
3013
- CustomMetadata: undefined,
3014
- Metadata: undefined,
3015
- };
2532
+ });
3016
2533
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3017
- if (data.CustomMetadata !== undefined && data.CustomMetadata !== null) {
2534
+ if (data.CustomMetadata != null) {
3018
2535
  contents.CustomMetadata = deserializeAws_restJson1CustomMetadataMap(data.CustomMetadata, context);
3019
2536
  }
3020
- if (data.Metadata !== undefined && data.Metadata !== null) {
2537
+ if (data.Metadata != null) {
3021
2538
  contents.Metadata = deserializeAws_restJson1FolderMetadata(data.Metadata, context);
3022
2539
  }
3023
- return Promise.resolve(contents);
2540
+ return contents;
3024
2541
  };
3025
2542
  exports.deserializeAws_restJson1GetFolderCommand = deserializeAws_restJson1GetFolderCommand;
3026
2543
  const deserializeAws_restJson1GetFolderCommandError = async (output, context) => {
@@ -3028,7 +2545,6 @@ const deserializeAws_restJson1GetFolderCommandError = async (output, context) =>
3028
2545
  ...output,
3029
2546
  body: await parseBody(output.body, context),
3030
2547
  };
3031
- let response;
3032
2548
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3033
2549
  switch (errorCode) {
3034
2550
  case "EntityNotExistsException":
@@ -3054,29 +2570,26 @@ const deserializeAws_restJson1GetFolderCommandError = async (output, context) =>
3054
2570
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
3055
2571
  default:
3056
2572
  const parsedBody = parsedOutput.body;
3057
- const $metadata = deserializeMetadata(output);
3058
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3059
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
3060
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3061
- $fault: "client",
3062
- $metadata,
2573
+ (0, smithy_client_1.throwDefaultError)({
2574
+ output,
2575
+ parsedBody,
2576
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
2577
+ errorCode,
3063
2578
  });
3064
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3065
2579
  }
3066
2580
  };
3067
2581
  const deserializeAws_restJson1GetFolderPathCommand = async (output, context) => {
3068
2582
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3069
2583
  return deserializeAws_restJson1GetFolderPathCommandError(output, context);
3070
2584
  }
3071
- const contents = {
2585
+ const contents = map({
3072
2586
  $metadata: deserializeMetadata(output),
3073
- Path: undefined,
3074
- };
2587
+ });
3075
2588
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3076
- if (data.Path !== undefined && data.Path !== null) {
2589
+ if (data.Path != null) {
3077
2590
  contents.Path = deserializeAws_restJson1ResourcePath(data.Path, context);
3078
2591
  }
3079
- return Promise.resolve(contents);
2592
+ return contents;
3080
2593
  };
3081
2594
  exports.deserializeAws_restJson1GetFolderPathCommand = deserializeAws_restJson1GetFolderPathCommand;
3082
2595
  const deserializeAws_restJson1GetFolderPathCommandError = async (output, context) => {
@@ -3084,7 +2597,6 @@ const deserializeAws_restJson1GetFolderPathCommandError = async (output, context
3084
2597
  ...output,
3085
2598
  body: await parseBody(output.body, context),
3086
2599
  };
3087
- let response;
3088
2600
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3089
2601
  switch (errorCode) {
3090
2602
  case "EntityNotExistsException":
@@ -3104,37 +2616,32 @@ const deserializeAws_restJson1GetFolderPathCommandError = async (output, context
3104
2616
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
3105
2617
  default:
3106
2618
  const parsedBody = parsedOutput.body;
3107
- const $metadata = deserializeMetadata(output);
3108
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3109
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
3110
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3111
- $fault: "client",
3112
- $metadata,
2619
+ (0, smithy_client_1.throwDefaultError)({
2620
+ output,
2621
+ parsedBody,
2622
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
2623
+ errorCode,
3113
2624
  });
3114
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3115
2625
  }
3116
2626
  };
3117
2627
  const deserializeAws_restJson1GetResourcesCommand = async (output, context) => {
3118
2628
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3119
2629
  return deserializeAws_restJson1GetResourcesCommandError(output, context);
3120
2630
  }
3121
- const contents = {
2631
+ const contents = map({
3122
2632
  $metadata: deserializeMetadata(output),
3123
- Documents: undefined,
3124
- Folders: undefined,
3125
- Marker: undefined,
3126
- };
2633
+ });
3127
2634
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3128
- if (data.Documents !== undefined && data.Documents !== null) {
2635
+ if (data.Documents != null) {
3129
2636
  contents.Documents = deserializeAws_restJson1DocumentMetadataList(data.Documents, context);
3130
2637
  }
3131
- if (data.Folders !== undefined && data.Folders !== null) {
2638
+ if (data.Folders != null) {
3132
2639
  contents.Folders = deserializeAws_restJson1FolderMetadataList(data.Folders, context);
3133
2640
  }
3134
- if (data.Marker !== undefined && data.Marker !== null) {
2641
+ if (data.Marker != null) {
3135
2642
  contents.Marker = (0, smithy_client_1.expectString)(data.Marker);
3136
2643
  }
3137
- return Promise.resolve(contents);
2644
+ return contents;
3138
2645
  };
3139
2646
  exports.deserializeAws_restJson1GetResourcesCommand = deserializeAws_restJson1GetResourcesCommand;
3140
2647
  const deserializeAws_restJson1GetResourcesCommandError = async (output, context) => {
@@ -3142,7 +2649,6 @@ const deserializeAws_restJson1GetResourcesCommandError = async (output, context)
3142
2649
  ...output,
3143
2650
  body: await parseBody(output.body, context),
3144
2651
  };
3145
- let response;
3146
2652
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3147
2653
  switch (errorCode) {
3148
2654
  case "FailedDependencyException":
@@ -3162,33 +2668,29 @@ const deserializeAws_restJson1GetResourcesCommandError = async (output, context)
3162
2668
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
3163
2669
  default:
3164
2670
  const parsedBody = parsedOutput.body;
3165
- const $metadata = deserializeMetadata(output);
3166
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3167
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
3168
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3169
- $fault: "client",
3170
- $metadata,
2671
+ (0, smithy_client_1.throwDefaultError)({
2672
+ output,
2673
+ parsedBody,
2674
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
2675
+ errorCode,
3171
2676
  });
3172
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3173
2677
  }
3174
2678
  };
3175
2679
  const deserializeAws_restJson1InitiateDocumentVersionUploadCommand = async (output, context) => {
3176
2680
  if (output.statusCode !== 201 && output.statusCode >= 300) {
3177
2681
  return deserializeAws_restJson1InitiateDocumentVersionUploadCommandError(output, context);
3178
2682
  }
3179
- const contents = {
2683
+ const contents = map({
3180
2684
  $metadata: deserializeMetadata(output),
3181
- Metadata: undefined,
3182
- UploadMetadata: undefined,
3183
- };
2685
+ });
3184
2686
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3185
- if (data.Metadata !== undefined && data.Metadata !== null) {
2687
+ if (data.Metadata != null) {
3186
2688
  contents.Metadata = deserializeAws_restJson1DocumentMetadata(data.Metadata, context);
3187
2689
  }
3188
- if (data.UploadMetadata !== undefined && data.UploadMetadata !== null) {
2690
+ if (data.UploadMetadata != null) {
3189
2691
  contents.UploadMetadata = deserializeAws_restJson1UploadMetadata(data.UploadMetadata, context);
3190
2692
  }
3191
- return Promise.resolve(contents);
2693
+ return contents;
3192
2694
  };
3193
2695
  exports.deserializeAws_restJson1InitiateDocumentVersionUploadCommand = deserializeAws_restJson1InitiateDocumentVersionUploadCommand;
3194
2696
  const deserializeAws_restJson1InitiateDocumentVersionUploadCommandError = async (output, context) => {
@@ -3196,7 +2698,6 @@ const deserializeAws_restJson1InitiateDocumentVersionUploadCommandError = async
3196
2698
  ...output,
3197
2699
  body: await parseBody(output.body, context),
3198
2700
  };
3199
- let response;
3200
2701
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3201
2702
  switch (errorCode) {
3202
2703
  case "DraftUploadOutOfSyncException":
@@ -3234,25 +2735,23 @@ const deserializeAws_restJson1InitiateDocumentVersionUploadCommandError = async
3234
2735
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
3235
2736
  default:
3236
2737
  const parsedBody = parsedOutput.body;
3237
- const $metadata = deserializeMetadata(output);
3238
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3239
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
3240
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3241
- $fault: "client",
3242
- $metadata,
2738
+ (0, smithy_client_1.throwDefaultError)({
2739
+ output,
2740
+ parsedBody,
2741
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
2742
+ errorCode,
3243
2743
  });
3244
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3245
2744
  }
3246
2745
  };
3247
2746
  const deserializeAws_restJson1RemoveAllResourcePermissionsCommand = async (output, context) => {
3248
2747
  if (output.statusCode !== 204 && output.statusCode >= 300) {
3249
2748
  return deserializeAws_restJson1RemoveAllResourcePermissionsCommandError(output, context);
3250
2749
  }
3251
- const contents = {
2750
+ const contents = map({
3252
2751
  $metadata: deserializeMetadata(output),
3253
- };
2752
+ });
3254
2753
  await collectBody(output.body, context);
3255
- return Promise.resolve(contents);
2754
+ return contents;
3256
2755
  };
3257
2756
  exports.deserializeAws_restJson1RemoveAllResourcePermissionsCommand = deserializeAws_restJson1RemoveAllResourcePermissionsCommand;
3258
2757
  const deserializeAws_restJson1RemoveAllResourcePermissionsCommandError = async (output, context) => {
@@ -3260,7 +2759,6 @@ const deserializeAws_restJson1RemoveAllResourcePermissionsCommandError = async (
3260
2759
  ...output,
3261
2760
  body: await parseBody(output.body, context),
3262
2761
  };
3263
- let response;
3264
2762
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3265
2763
  switch (errorCode) {
3266
2764
  case "FailedDependencyException":
@@ -3277,25 +2775,23 @@ const deserializeAws_restJson1RemoveAllResourcePermissionsCommandError = async (
3277
2775
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
3278
2776
  default:
3279
2777
  const parsedBody = parsedOutput.body;
3280
- const $metadata = deserializeMetadata(output);
3281
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3282
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
3283
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3284
- $fault: "client",
3285
- $metadata,
2778
+ (0, smithy_client_1.throwDefaultError)({
2779
+ output,
2780
+ parsedBody,
2781
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
2782
+ errorCode,
3286
2783
  });
3287
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3288
2784
  }
3289
2785
  };
3290
2786
  const deserializeAws_restJson1RemoveResourcePermissionCommand = async (output, context) => {
3291
2787
  if (output.statusCode !== 204 && output.statusCode >= 300) {
3292
2788
  return deserializeAws_restJson1RemoveResourcePermissionCommandError(output, context);
3293
2789
  }
3294
- const contents = {
2790
+ const contents = map({
3295
2791
  $metadata: deserializeMetadata(output),
3296
- };
2792
+ });
3297
2793
  await collectBody(output.body, context);
3298
- return Promise.resolve(contents);
2794
+ return contents;
3299
2795
  };
3300
2796
  exports.deserializeAws_restJson1RemoveResourcePermissionCommand = deserializeAws_restJson1RemoveResourcePermissionCommand;
3301
2797
  const deserializeAws_restJson1RemoveResourcePermissionCommandError = async (output, context) => {
@@ -3303,7 +2799,6 @@ const deserializeAws_restJson1RemoveResourcePermissionCommandError = async (outp
3303
2799
  ...output,
3304
2800
  body: await parseBody(output.body, context),
3305
2801
  };
3306
- let response;
3307
2802
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3308
2803
  switch (errorCode) {
3309
2804
  case "FailedDependencyException":
@@ -3320,25 +2815,23 @@ const deserializeAws_restJson1RemoveResourcePermissionCommandError = async (outp
3320
2815
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
3321
2816
  default:
3322
2817
  const parsedBody = parsedOutput.body;
3323
- const $metadata = deserializeMetadata(output);
3324
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3325
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
3326
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3327
- $fault: "client",
3328
- $metadata,
2818
+ (0, smithy_client_1.throwDefaultError)({
2819
+ output,
2820
+ parsedBody,
2821
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
2822
+ errorCode,
3329
2823
  });
3330
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3331
2824
  }
3332
2825
  };
3333
2826
  const deserializeAws_restJson1UpdateDocumentCommand = async (output, context) => {
3334
2827
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3335
2828
  return deserializeAws_restJson1UpdateDocumentCommandError(output, context);
3336
2829
  }
3337
- const contents = {
2830
+ const contents = map({
3338
2831
  $metadata: deserializeMetadata(output),
3339
- };
2832
+ });
3340
2833
  await collectBody(output.body, context);
3341
- return Promise.resolve(contents);
2834
+ return contents;
3342
2835
  };
3343
2836
  exports.deserializeAws_restJson1UpdateDocumentCommand = deserializeAws_restJson1UpdateDocumentCommand;
3344
2837
  const deserializeAws_restJson1UpdateDocumentCommandError = async (output, context) => {
@@ -3346,7 +2839,6 @@ const deserializeAws_restJson1UpdateDocumentCommandError = async (output, contex
3346
2839
  ...output,
3347
2840
  body: await parseBody(output.body, context),
3348
2841
  };
3349
- let response;
3350
2842
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3351
2843
  switch (errorCode) {
3352
2844
  case "ConcurrentModificationException":
@@ -3381,25 +2873,23 @@ const deserializeAws_restJson1UpdateDocumentCommandError = async (output, contex
3381
2873
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
3382
2874
  default:
3383
2875
  const parsedBody = parsedOutput.body;
3384
- const $metadata = deserializeMetadata(output);
3385
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3386
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
3387
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3388
- $fault: "client",
3389
- $metadata,
2876
+ (0, smithy_client_1.throwDefaultError)({
2877
+ output,
2878
+ parsedBody,
2879
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
2880
+ errorCode,
3390
2881
  });
3391
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3392
2882
  }
3393
2883
  };
3394
2884
  const deserializeAws_restJson1UpdateDocumentVersionCommand = async (output, context) => {
3395
2885
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3396
2886
  return deserializeAws_restJson1UpdateDocumentVersionCommandError(output, context);
3397
2887
  }
3398
- const contents = {
2888
+ const contents = map({
3399
2889
  $metadata: deserializeMetadata(output),
3400
- };
2890
+ });
3401
2891
  await collectBody(output.body, context);
3402
- return Promise.resolve(contents);
2892
+ return contents;
3403
2893
  };
3404
2894
  exports.deserializeAws_restJson1UpdateDocumentVersionCommand = deserializeAws_restJson1UpdateDocumentVersionCommand;
3405
2895
  const deserializeAws_restJson1UpdateDocumentVersionCommandError = async (output, context) => {
@@ -3407,7 +2897,6 @@ const deserializeAws_restJson1UpdateDocumentVersionCommandError = async (output,
3407
2897
  ...output,
3408
2898
  body: await parseBody(output.body, context),
3409
2899
  };
3410
- let response;
3411
2900
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3412
2901
  switch (errorCode) {
3413
2902
  case "ConcurrentModificationException":
@@ -3436,25 +2925,23 @@ const deserializeAws_restJson1UpdateDocumentVersionCommandError = async (output,
3436
2925
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
3437
2926
  default:
3438
2927
  const parsedBody = parsedOutput.body;
3439
- const $metadata = deserializeMetadata(output);
3440
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3441
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
3442
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3443
- $fault: "client",
3444
- $metadata,
2928
+ (0, smithy_client_1.throwDefaultError)({
2929
+ output,
2930
+ parsedBody,
2931
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
2932
+ errorCode,
3445
2933
  });
3446
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3447
2934
  }
3448
2935
  };
3449
2936
  const deserializeAws_restJson1UpdateFolderCommand = async (output, context) => {
3450
2937
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3451
2938
  return deserializeAws_restJson1UpdateFolderCommandError(output, context);
3452
2939
  }
3453
- const contents = {
2940
+ const contents = map({
3454
2941
  $metadata: deserializeMetadata(output),
3455
- };
2942
+ });
3456
2943
  await collectBody(output.body, context);
3457
- return Promise.resolve(contents);
2944
+ return contents;
3458
2945
  };
3459
2946
  exports.deserializeAws_restJson1UpdateFolderCommand = deserializeAws_restJson1UpdateFolderCommand;
3460
2947
  const deserializeAws_restJson1UpdateFolderCommandError = async (output, context) => {
@@ -3462,7 +2949,6 @@ const deserializeAws_restJson1UpdateFolderCommandError = async (output, context)
3462
2949
  ...output,
3463
2950
  body: await parseBody(output.body, context),
3464
2951
  };
3465
- let response;
3466
2952
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3467
2953
  switch (errorCode) {
3468
2954
  case "ConcurrentModificationException":
@@ -3497,29 +2983,26 @@ const deserializeAws_restJson1UpdateFolderCommandError = async (output, context)
3497
2983
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
3498
2984
  default:
3499
2985
  const parsedBody = parsedOutput.body;
3500
- const $metadata = deserializeMetadata(output);
3501
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3502
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
3503
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3504
- $fault: "client",
3505
- $metadata,
2986
+ (0, smithy_client_1.throwDefaultError)({
2987
+ output,
2988
+ parsedBody,
2989
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
2990
+ errorCode,
3506
2991
  });
3507
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3508
2992
  }
3509
2993
  };
3510
2994
  const deserializeAws_restJson1UpdateUserCommand = async (output, context) => {
3511
2995
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3512
2996
  return deserializeAws_restJson1UpdateUserCommandError(output, context);
3513
2997
  }
3514
- const contents = {
2998
+ const contents = map({
3515
2999
  $metadata: deserializeMetadata(output),
3516
- User: undefined,
3517
- };
3000
+ });
3518
3001
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3519
- if (data.User !== undefined && data.User !== null) {
3002
+ if (data.User != null) {
3520
3003
  contents.User = deserializeAws_restJson1User(data.User, context);
3521
3004
  }
3522
- return Promise.resolve(contents);
3005
+ return contents;
3523
3006
  };
3524
3007
  exports.deserializeAws_restJson1UpdateUserCommand = deserializeAws_restJson1UpdateUserCommand;
3525
3008
  const deserializeAws_restJson1UpdateUserCommandError = async (output, context) => {
@@ -3527,7 +3010,6 @@ const deserializeAws_restJson1UpdateUserCommandError = async (output, context) =
3527
3010
  ...output,
3528
3011
  body: await parseBody(output.body, context),
3529
3012
  };
3530
- let response;
3531
3013
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3532
3014
  switch (errorCode) {
3533
3015
  case "DeactivatingLastSystemUserException":
@@ -3556,20 +3038,19 @@ const deserializeAws_restJson1UpdateUserCommandError = async (output, context) =
3556
3038
  throw await deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse(parsedOutput, context);
3557
3039
  default:
3558
3040
  const parsedBody = parsedOutput.body;
3559
- const $metadata = deserializeMetadata(output);
3560
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3561
- response = new WorkDocsServiceException_1.WorkDocsServiceException({
3562
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3563
- $fault: "client",
3564
- $metadata,
3041
+ (0, smithy_client_1.throwDefaultError)({
3042
+ output,
3043
+ parsedBody,
3044
+ exceptionCtor: WorkDocsServiceException_1.WorkDocsServiceException,
3045
+ errorCode,
3565
3046
  });
3566
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3567
3047
  }
3568
3048
  };
3049
+ const map = smithy_client_1.map;
3569
3050
  const deserializeAws_restJson1ConcurrentModificationExceptionResponse = async (parsedOutput, context) => {
3570
- const contents = {};
3051
+ const contents = map({});
3571
3052
  const data = parsedOutput.body;
3572
- if (data.Message !== undefined && data.Message !== null) {
3053
+ if (data.Message != null) {
3573
3054
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3574
3055
  }
3575
3056
  const exception = new models_0_1.ConcurrentModificationException({
@@ -3579,9 +3060,9 @@ const deserializeAws_restJson1ConcurrentModificationExceptionResponse = async (p
3579
3060
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3580
3061
  };
3581
3062
  const deserializeAws_restJson1ConflictingOperationExceptionResponse = async (parsedOutput, context) => {
3582
- const contents = {};
3063
+ const contents = map({});
3583
3064
  const data = parsedOutput.body;
3584
- if (data.Message !== undefined && data.Message !== null) {
3065
+ if (data.Message != null) {
3585
3066
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3586
3067
  }
3587
3068
  const exception = new models_0_1.ConflictingOperationException({
@@ -3591,9 +3072,9 @@ const deserializeAws_restJson1ConflictingOperationExceptionResponse = async (par
3591
3072
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3592
3073
  };
3593
3074
  const deserializeAws_restJson1CustomMetadataLimitExceededExceptionResponse = async (parsedOutput, context) => {
3594
- const contents = {};
3075
+ const contents = map({});
3595
3076
  const data = parsedOutput.body;
3596
- if (data.Message !== undefined && data.Message !== null) {
3077
+ if (data.Message != null) {
3597
3078
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3598
3079
  }
3599
3080
  const exception = new models_0_1.CustomMetadataLimitExceededException({
@@ -3603,12 +3084,12 @@ const deserializeAws_restJson1CustomMetadataLimitExceededExceptionResponse = asy
3603
3084
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3604
3085
  };
3605
3086
  const deserializeAws_restJson1DeactivatingLastSystemUserExceptionResponse = async (parsedOutput, context) => {
3606
- const contents = {};
3087
+ const contents = map({});
3607
3088
  const data = parsedOutput.body;
3608
- if (data.Code !== undefined && data.Code !== null) {
3089
+ if (data.Code != null) {
3609
3090
  contents.Code = (0, smithy_client_1.expectString)(data.Code);
3610
3091
  }
3611
- if (data.Message !== undefined && data.Message !== null) {
3092
+ if (data.Message != null) {
3612
3093
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3613
3094
  }
3614
3095
  const exception = new models_0_1.DeactivatingLastSystemUserException({
@@ -3618,9 +3099,9 @@ const deserializeAws_restJson1DeactivatingLastSystemUserExceptionResponse = asyn
3618
3099
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3619
3100
  };
3620
3101
  const deserializeAws_restJson1DocumentLockedForCommentsExceptionResponse = async (parsedOutput, context) => {
3621
- const contents = {};
3102
+ const contents = map({});
3622
3103
  const data = parsedOutput.body;
3623
- if (data.Message !== undefined && data.Message !== null) {
3104
+ if (data.Message != null) {
3624
3105
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3625
3106
  }
3626
3107
  const exception = new models_0_1.DocumentLockedForCommentsException({
@@ -3630,9 +3111,9 @@ const deserializeAws_restJson1DocumentLockedForCommentsExceptionResponse = async
3630
3111
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3631
3112
  };
3632
3113
  const deserializeAws_restJson1DraftUploadOutOfSyncExceptionResponse = async (parsedOutput, context) => {
3633
- const contents = {};
3114
+ const contents = map({});
3634
3115
  const data = parsedOutput.body;
3635
- if (data.Message !== undefined && data.Message !== null) {
3116
+ if (data.Message != null) {
3636
3117
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3637
3118
  }
3638
3119
  const exception = new models_0_1.DraftUploadOutOfSyncException({
@@ -3642,9 +3123,9 @@ const deserializeAws_restJson1DraftUploadOutOfSyncExceptionResponse = async (par
3642
3123
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3643
3124
  };
3644
3125
  const deserializeAws_restJson1EntityAlreadyExistsExceptionResponse = async (parsedOutput, context) => {
3645
- const contents = {};
3126
+ const contents = map({});
3646
3127
  const data = parsedOutput.body;
3647
- if (data.Message !== undefined && data.Message !== null) {
3128
+ if (data.Message != null) {
3648
3129
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3649
3130
  }
3650
3131
  const exception = new models_0_1.EntityAlreadyExistsException({
@@ -3654,12 +3135,12 @@ const deserializeAws_restJson1EntityAlreadyExistsExceptionResponse = async (pars
3654
3135
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3655
3136
  };
3656
3137
  const deserializeAws_restJson1EntityNotExistsExceptionResponse = async (parsedOutput, context) => {
3657
- const contents = {};
3138
+ const contents = map({});
3658
3139
  const data = parsedOutput.body;
3659
- if (data.EntityIds !== undefined && data.EntityIds !== null) {
3140
+ if (data.EntityIds != null) {
3660
3141
  contents.EntityIds = deserializeAws_restJson1EntityIdList(data.EntityIds, context);
3661
3142
  }
3662
- if (data.Message !== undefined && data.Message !== null) {
3143
+ if (data.Message != null) {
3663
3144
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3664
3145
  }
3665
3146
  const exception = new models_0_1.EntityNotExistsException({
@@ -3669,9 +3150,9 @@ const deserializeAws_restJson1EntityNotExistsExceptionResponse = async (parsedOu
3669
3150
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3670
3151
  };
3671
3152
  const deserializeAws_restJson1FailedDependencyExceptionResponse = async (parsedOutput, context) => {
3672
- const contents = {};
3153
+ const contents = map({});
3673
3154
  const data = parsedOutput.body;
3674
- if (data.Message !== undefined && data.Message !== null) {
3155
+ if (data.Message != null) {
3675
3156
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3676
3157
  }
3677
3158
  const exception = new models_0_1.FailedDependencyException({
@@ -3681,9 +3162,9 @@ const deserializeAws_restJson1FailedDependencyExceptionResponse = async (parsedO
3681
3162
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3682
3163
  };
3683
3164
  const deserializeAws_restJson1IllegalUserStateExceptionResponse = async (parsedOutput, context) => {
3684
- const contents = {};
3165
+ const contents = map({});
3685
3166
  const data = parsedOutput.body;
3686
- if (data.Message !== undefined && data.Message !== null) {
3167
+ if (data.Message != null) {
3687
3168
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3688
3169
  }
3689
3170
  const exception = new models_0_1.IllegalUserStateException({
@@ -3693,9 +3174,9 @@ const deserializeAws_restJson1IllegalUserStateExceptionResponse = async (parsedO
3693
3174
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3694
3175
  };
3695
3176
  const deserializeAws_restJson1InvalidArgumentExceptionResponse = async (parsedOutput, context) => {
3696
- const contents = {};
3177
+ const contents = map({});
3697
3178
  const data = parsedOutput.body;
3698
- if (data.Message !== undefined && data.Message !== null) {
3179
+ if (data.Message != null) {
3699
3180
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3700
3181
  }
3701
3182
  const exception = new models_0_1.InvalidArgumentException({
@@ -3705,9 +3186,9 @@ const deserializeAws_restJson1InvalidArgumentExceptionResponse = async (parsedOu
3705
3186
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3706
3187
  };
3707
3188
  const deserializeAws_restJson1InvalidCommentOperationExceptionResponse = async (parsedOutput, context) => {
3708
- const contents = {};
3189
+ const contents = map({});
3709
3190
  const data = parsedOutput.body;
3710
- if (data.Message !== undefined && data.Message !== null) {
3191
+ if (data.Message != null) {
3711
3192
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3712
3193
  }
3713
3194
  const exception = new models_0_1.InvalidCommentOperationException({
@@ -3717,9 +3198,9 @@ const deserializeAws_restJson1InvalidCommentOperationExceptionResponse = async (
3717
3198
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3718
3199
  };
3719
3200
  const deserializeAws_restJson1InvalidOperationExceptionResponse = async (parsedOutput, context) => {
3720
- const contents = {};
3201
+ const contents = map({});
3721
3202
  const data = parsedOutput.body;
3722
- if (data.Message !== undefined && data.Message !== null) {
3203
+ if (data.Message != null) {
3723
3204
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3724
3205
  }
3725
3206
  const exception = new models_0_1.InvalidOperationException({
@@ -3729,9 +3210,9 @@ const deserializeAws_restJson1InvalidOperationExceptionResponse = async (parsedO
3729
3210
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3730
3211
  };
3731
3212
  const deserializeAws_restJson1InvalidPasswordExceptionResponse = async (parsedOutput, context) => {
3732
- const contents = {};
3213
+ const contents = map({});
3733
3214
  const data = parsedOutput.body;
3734
- if (data.Message !== undefined && data.Message !== null) {
3215
+ if (data.Message != null) {
3735
3216
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3736
3217
  }
3737
3218
  const exception = new models_0_1.InvalidPasswordException({
@@ -3741,9 +3222,9 @@ const deserializeAws_restJson1InvalidPasswordExceptionResponse = async (parsedOu
3741
3222
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3742
3223
  };
3743
3224
  const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutput, context) => {
3744
- const contents = {};
3225
+ const contents = map({});
3745
3226
  const data = parsedOutput.body;
3746
- if (data.Message !== undefined && data.Message !== null) {
3227
+ if (data.Message != null) {
3747
3228
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3748
3229
  }
3749
3230
  const exception = new models_0_1.LimitExceededException({
@@ -3753,9 +3234,9 @@ const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutp
3753
3234
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3754
3235
  };
3755
3236
  const deserializeAws_restJson1ProhibitedStateExceptionResponse = async (parsedOutput, context) => {
3756
- const contents = {};
3237
+ const contents = map({});
3757
3238
  const data = parsedOutput.body;
3758
- if (data.Message !== undefined && data.Message !== null) {
3239
+ if (data.Message != null) {
3759
3240
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3760
3241
  }
3761
3242
  const exception = new models_0_1.ProhibitedStateException({
@@ -3765,9 +3246,9 @@ const deserializeAws_restJson1ProhibitedStateExceptionResponse = async (parsedOu
3765
3246
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3766
3247
  };
3767
3248
  const deserializeAws_restJson1RequestedEntityTooLargeExceptionResponse = async (parsedOutput, context) => {
3768
- const contents = {};
3249
+ const contents = map({});
3769
3250
  const data = parsedOutput.body;
3770
- if (data.Message !== undefined && data.Message !== null) {
3251
+ if (data.Message != null) {
3771
3252
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3772
3253
  }
3773
3254
  const exception = new models_0_1.RequestedEntityTooLargeException({
@@ -3777,9 +3258,9 @@ const deserializeAws_restJson1RequestedEntityTooLargeExceptionResponse = async (
3777
3258
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3778
3259
  };
3779
3260
  const deserializeAws_restJson1ResourceAlreadyCheckedOutExceptionResponse = async (parsedOutput, context) => {
3780
- const contents = {};
3261
+ const contents = map({});
3781
3262
  const data = parsedOutput.body;
3782
- if (data.Message !== undefined && data.Message !== null) {
3263
+ if (data.Message != null) {
3783
3264
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3784
3265
  }
3785
3266
  const exception = new models_0_1.ResourceAlreadyCheckedOutException({
@@ -3789,9 +3270,9 @@ const deserializeAws_restJson1ResourceAlreadyCheckedOutExceptionResponse = async
3789
3270
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3790
3271
  };
3791
3272
  const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async (parsedOutput, context) => {
3792
- const contents = {};
3273
+ const contents = map({});
3793
3274
  const data = parsedOutput.body;
3794
- if (data.Message !== undefined && data.Message !== null) {
3275
+ if (data.Message != null) {
3795
3276
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3796
3277
  }
3797
3278
  const exception = new models_0_1.ServiceUnavailableException({
@@ -3801,9 +3282,9 @@ const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async (parse
3801
3282
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3802
3283
  };
3803
3284
  const deserializeAws_restJson1StorageLimitExceededExceptionResponse = async (parsedOutput, context) => {
3804
- const contents = {};
3285
+ const contents = map({});
3805
3286
  const data = parsedOutput.body;
3806
- if (data.Message !== undefined && data.Message !== null) {
3287
+ if (data.Message != null) {
3807
3288
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3808
3289
  }
3809
3290
  const exception = new models_0_1.StorageLimitExceededException({
@@ -3813,9 +3294,9 @@ const deserializeAws_restJson1StorageLimitExceededExceptionResponse = async (par
3813
3294
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3814
3295
  };
3815
3296
  const deserializeAws_restJson1StorageLimitWillExceedExceptionResponse = async (parsedOutput, context) => {
3816
- const contents = {};
3297
+ const contents = map({});
3817
3298
  const data = parsedOutput.body;
3818
- if (data.Message !== undefined && data.Message !== null) {
3299
+ if (data.Message != null) {
3819
3300
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3820
3301
  }
3821
3302
  const exception = new models_0_1.StorageLimitWillExceedException({
@@ -3825,9 +3306,9 @@ const deserializeAws_restJson1StorageLimitWillExceedExceptionResponse = async (p
3825
3306
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3826
3307
  };
3827
3308
  const deserializeAws_restJson1TooManyLabelsExceptionResponse = async (parsedOutput, context) => {
3828
- const contents = {};
3309
+ const contents = map({});
3829
3310
  const data = parsedOutput.body;
3830
- if (data.Message !== undefined && data.Message !== null) {
3311
+ if (data.Message != null) {
3831
3312
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3832
3313
  }
3833
3314
  const exception = new models_0_1.TooManyLabelsException({
@@ -3837,9 +3318,9 @@ const deserializeAws_restJson1TooManyLabelsExceptionResponse = async (parsedOutp
3837
3318
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3838
3319
  };
3839
3320
  const deserializeAws_restJson1TooManySubscriptionsExceptionResponse = async (parsedOutput, context) => {
3840
- const contents = {};
3321
+ const contents = map({});
3841
3322
  const data = parsedOutput.body;
3842
- if (data.Message !== undefined && data.Message !== null) {
3323
+ if (data.Message != null) {
3843
3324
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3844
3325
  }
3845
3326
  const exception = new models_0_1.TooManySubscriptionsException({
@@ -3849,12 +3330,12 @@ const deserializeAws_restJson1TooManySubscriptionsExceptionResponse = async (par
3849
3330
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3850
3331
  };
3851
3332
  const deserializeAws_restJson1UnauthorizedOperationExceptionResponse = async (parsedOutput, context) => {
3852
- const contents = {};
3333
+ const contents = map({});
3853
3334
  const data = parsedOutput.body;
3854
- if (data.Code !== undefined && data.Code !== null) {
3335
+ if (data.Code != null) {
3855
3336
  contents.Code = (0, smithy_client_1.expectString)(data.Code);
3856
3337
  }
3857
- if (data.Message !== undefined && data.Message !== null) {
3338
+ if (data.Message != null) {
3858
3339
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3859
3340
  }
3860
3341
  const exception = new models_0_1.UnauthorizedOperationException({
@@ -3864,9 +3345,9 @@ const deserializeAws_restJson1UnauthorizedOperationExceptionResponse = async (pa
3864
3345
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3865
3346
  };
3866
3347
  const deserializeAws_restJson1UnauthorizedResourceAccessExceptionResponse = async (parsedOutput, context) => {
3867
- const contents = {};
3348
+ const contents = map({});
3868
3349
  const data = parsedOutput.body;
3869
- if (data.Message !== undefined && data.Message !== null) {
3350
+ if (data.Message != null) {
3870
3351
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3871
3352
  }
3872
3353
  const exception = new models_0_1.UnauthorizedResourceAccessException({
@@ -3896,9 +3377,6 @@ const serializeAws_restJson1SharedLabels = (input, context) => {
3896
3377
  return input
3897
3378
  .filter((e) => e != null)
3898
3379
  .map((entry) => {
3899
- if (entry === null) {
3900
- return null;
3901
- }
3902
3380
  return entry;
3903
3381
  });
3904
3382
  };
@@ -3913,9 +3391,6 @@ const serializeAws_restJson1SharePrincipalList = (input, context) => {
3913
3391
  return input
3914
3392
  .filter((e) => e != null)
3915
3393
  .map((entry) => {
3916
- if (entry === null) {
3917
- return null;
3918
- }
3919
3394
  return serializeAws_restJson1SharePrincipal(entry, context);
3920
3395
  });
3921
3396
  };