@aws-sdk/client-wisdom 3.131.0 → 3.142.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +1 -1
  3. package/dist-cjs/commands/CreateAssistantAssociationCommand.js +2 -2
  4. package/dist-cjs/commands/CreateAssistantCommand.js +2 -2
  5. package/dist-cjs/commands/CreateContentCommand.js +2 -2
  6. package/dist-cjs/commands/CreateKnowledgeBaseCommand.js +2 -2
  7. package/dist-cjs/commands/CreateSessionCommand.js +2 -2
  8. package/dist-cjs/commands/DeleteAssistantAssociationCommand.js +2 -2
  9. package/dist-cjs/commands/DeleteAssistantCommand.js +2 -2
  10. package/dist-cjs/commands/DeleteContentCommand.js +2 -2
  11. package/dist-cjs/commands/DeleteKnowledgeBaseCommand.js +2 -2
  12. package/dist-cjs/commands/GetAssistantAssociationCommand.js +2 -2
  13. package/dist-cjs/commands/GetAssistantCommand.js +2 -2
  14. package/dist-cjs/commands/GetContentCommand.js +2 -2
  15. package/dist-cjs/commands/GetContentSummaryCommand.js +2 -2
  16. package/dist-cjs/commands/GetKnowledgeBaseCommand.js +2 -2
  17. package/dist-cjs/commands/GetRecommendationsCommand.js +2 -2
  18. package/dist-cjs/commands/GetSessionCommand.js +2 -2
  19. package/dist-cjs/commands/ListAssistantAssociationsCommand.js +2 -2
  20. package/dist-cjs/commands/ListAssistantsCommand.js +2 -2
  21. package/dist-cjs/commands/ListContentsCommand.js +2 -2
  22. package/dist-cjs/commands/ListKnowledgeBasesCommand.js +2 -2
  23. package/dist-cjs/commands/ListTagsForResourceCommand.js +2 -2
  24. package/dist-cjs/commands/NotifyRecommendationsReceivedCommand.js +2 -2
  25. package/dist-cjs/commands/QueryAssistantCommand.js +2 -2
  26. package/dist-cjs/commands/RemoveKnowledgeBaseTemplateUriCommand.js +2 -2
  27. package/dist-cjs/commands/SearchContentCommand.js +2 -2
  28. package/dist-cjs/commands/SearchSessionsCommand.js +2 -2
  29. package/dist-cjs/commands/StartContentUploadCommand.js +2 -2
  30. package/dist-cjs/commands/TagResourceCommand.js +2 -2
  31. package/dist-cjs/commands/UntagResourceCommand.js +2 -2
  32. package/dist-cjs/commands/UpdateContentCommand.js +2 -2
  33. package/dist-cjs/commands/UpdateKnowledgeBaseTemplateUriCommand.js +2 -2
  34. package/dist-cjs/models/models_0.js +428 -600
  35. package/dist-cjs/protocols/Aws_restJson1.js +371 -832
  36. package/dist-es/commands/CreateAssistantAssociationCommand.js +3 -3
  37. package/dist-es/commands/CreateAssistantCommand.js +3 -3
  38. package/dist-es/commands/CreateContentCommand.js +3 -3
  39. package/dist-es/commands/CreateKnowledgeBaseCommand.js +3 -3
  40. package/dist-es/commands/CreateSessionCommand.js +3 -3
  41. package/dist-es/commands/DeleteAssistantAssociationCommand.js +3 -3
  42. package/dist-es/commands/DeleteAssistantCommand.js +3 -3
  43. package/dist-es/commands/DeleteContentCommand.js +3 -3
  44. package/dist-es/commands/DeleteKnowledgeBaseCommand.js +3 -3
  45. package/dist-es/commands/GetAssistantAssociationCommand.js +3 -3
  46. package/dist-es/commands/GetAssistantCommand.js +3 -3
  47. package/dist-es/commands/GetContentCommand.js +3 -3
  48. package/dist-es/commands/GetContentSummaryCommand.js +3 -3
  49. package/dist-es/commands/GetKnowledgeBaseCommand.js +3 -3
  50. package/dist-es/commands/GetRecommendationsCommand.js +3 -3
  51. package/dist-es/commands/GetSessionCommand.js +3 -3
  52. package/dist-es/commands/ListAssistantAssociationsCommand.js +3 -3
  53. package/dist-es/commands/ListAssistantsCommand.js +3 -3
  54. package/dist-es/commands/ListContentsCommand.js +3 -3
  55. package/dist-es/commands/ListKnowledgeBasesCommand.js +3 -3
  56. package/dist-es/commands/ListTagsForResourceCommand.js +3 -3
  57. package/dist-es/commands/NotifyRecommendationsReceivedCommand.js +3 -3
  58. package/dist-es/commands/QueryAssistantCommand.js +3 -3
  59. package/dist-es/commands/RemoveKnowledgeBaseTemplateUriCommand.js +3 -3
  60. package/dist-es/commands/SearchContentCommand.js +3 -3
  61. package/dist-es/commands/SearchSessionsCommand.js +3 -3
  62. package/dist-es/commands/StartContentUploadCommand.js +3 -3
  63. package/dist-es/commands/TagResourceCommand.js +3 -3
  64. package/dist-es/commands/UntagResourceCommand.js +3 -3
  65. package/dist-es/commands/UpdateContentCommand.js +3 -3
  66. package/dist-es/commands/UpdateKnowledgeBaseTemplateUriCommand.js +3 -3
  67. package/dist-es/models/models_0.js +137 -400
  68. package/dist-es/protocols/Aws_restJson1.js +492 -837
  69. package/dist-types/models/models_0.d.ts +364 -538
  70. package/dist-types/ts3.4/models/models_0.d.ts +182 -356
  71. package/package.json +6 -6
@@ -43,16 +43,7 @@ const serializeAws_restJson1CreateAssistantAssociationCommand = async (input, co
43
43
  "content-type": "application/json",
44
44
  };
45
45
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/assistants/{assistantId}/associations";
46
- if (input.assistantId !== undefined) {
47
- const labelValue = input.assistantId;
48
- if (labelValue.length <= 0) {
49
- throw new Error("Empty value provided for input HTTP label: assistantId.");
50
- }
51
- resolvedPath = resolvedPath.replace("{assistantId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
52
- }
53
- else {
54
- throw new Error("No value provided for input HTTP label: assistantId.");
55
- }
46
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "assistantId", () => input.assistantId, "{assistantId}", false);
56
47
  let body;
57
48
  body = JSON.stringify({
58
49
  ...(input.association != null && {
@@ -81,16 +72,7 @@ const serializeAws_restJson1CreateContentCommand = async (input, context) => {
81
72
  };
82
73
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
83
74
  "/knowledgeBases/{knowledgeBaseId}/contents";
84
- if (input.knowledgeBaseId !== undefined) {
85
- const labelValue = input.knowledgeBaseId;
86
- if (labelValue.length <= 0) {
87
- throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
88
- }
89
- resolvedPath = resolvedPath.replace("{knowledgeBaseId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
90
- }
91
- else {
92
- throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
93
- }
75
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "knowledgeBaseId", () => input.knowledgeBaseId, "{knowledgeBaseId}", false);
94
76
  let body;
95
77
  body = JSON.stringify({
96
78
  clientToken: (_a = input.clientToken) !== null && _a !== void 0 ? _a : (0, uuid_1.v4)(),
@@ -154,16 +136,7 @@ const serializeAws_restJson1CreateSessionCommand = async (input, context) => {
154
136
  "content-type": "application/json",
155
137
  };
156
138
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/assistants/{assistantId}/sessions";
157
- if (input.assistantId !== undefined) {
158
- const labelValue = input.assistantId;
159
- if (labelValue.length <= 0) {
160
- throw new Error("Empty value provided for input HTTP label: assistantId.");
161
- }
162
- resolvedPath = resolvedPath.replace("{assistantId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
163
- }
164
- else {
165
- throw new Error("No value provided for input HTTP label: assistantId.");
166
- }
139
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "assistantId", () => input.assistantId, "{assistantId}", false);
167
140
  let body;
168
141
  body = JSON.stringify({
169
142
  clientToken: (_a = input.clientToken) !== null && _a !== void 0 ? _a : (0, uuid_1.v4)(),
@@ -186,16 +159,7 @@ const serializeAws_restJson1DeleteAssistantCommand = async (input, context) => {
186
159
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
187
160
  const headers = {};
188
161
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/assistants/{assistantId}";
189
- if (input.assistantId !== undefined) {
190
- const labelValue = input.assistantId;
191
- if (labelValue.length <= 0) {
192
- throw new Error("Empty value provided for input HTTP label: assistantId.");
193
- }
194
- resolvedPath = resolvedPath.replace("{assistantId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
195
- }
196
- else {
197
- throw new Error("No value provided for input HTTP label: assistantId.");
198
- }
162
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "assistantId", () => input.assistantId, "{assistantId}", false);
199
163
  let body;
200
164
  return new protocol_http_1.HttpRequest({
201
165
  protocol,
@@ -213,26 +177,8 @@ const serializeAws_restJson1DeleteAssistantAssociationCommand = async (input, co
213
177
  const headers = {};
214
178
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
215
179
  "/assistants/{assistantId}/associations/{assistantAssociationId}";
216
- if (input.assistantAssociationId !== undefined) {
217
- const labelValue = input.assistantAssociationId;
218
- if (labelValue.length <= 0) {
219
- throw new Error("Empty value provided for input HTTP label: assistantAssociationId.");
220
- }
221
- resolvedPath = resolvedPath.replace("{assistantAssociationId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
222
- }
223
- else {
224
- throw new Error("No value provided for input HTTP label: assistantAssociationId.");
225
- }
226
- if (input.assistantId !== undefined) {
227
- const labelValue = input.assistantId;
228
- if (labelValue.length <= 0) {
229
- throw new Error("Empty value provided for input HTTP label: assistantId.");
230
- }
231
- resolvedPath = resolvedPath.replace("{assistantId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
232
- }
233
- else {
234
- throw new Error("No value provided for input HTTP label: assistantId.");
235
- }
180
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "assistantAssociationId", () => input.assistantAssociationId, "{assistantAssociationId}", false);
181
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "assistantId", () => input.assistantId, "{assistantId}", false);
236
182
  let body;
237
183
  return new protocol_http_1.HttpRequest({
238
184
  protocol,
@@ -250,26 +196,8 @@ const serializeAws_restJson1DeleteContentCommand = async (input, context) => {
250
196
  const headers = {};
251
197
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
252
198
  "/knowledgeBases/{knowledgeBaseId}/contents/{contentId}";
253
- if (input.knowledgeBaseId !== undefined) {
254
- const labelValue = input.knowledgeBaseId;
255
- if (labelValue.length <= 0) {
256
- throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
257
- }
258
- resolvedPath = resolvedPath.replace("{knowledgeBaseId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
259
- }
260
- else {
261
- throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
262
- }
263
- if (input.contentId !== undefined) {
264
- const labelValue = input.contentId;
265
- if (labelValue.length <= 0) {
266
- throw new Error("Empty value provided for input HTTP label: contentId.");
267
- }
268
- resolvedPath = resolvedPath.replace("{contentId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
269
- }
270
- else {
271
- throw new Error("No value provided for input HTTP label: contentId.");
272
- }
199
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "knowledgeBaseId", () => input.knowledgeBaseId, "{knowledgeBaseId}", false);
200
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "contentId", () => input.contentId, "{contentId}", false);
273
201
  let body;
274
202
  return new protocol_http_1.HttpRequest({
275
203
  protocol,
@@ -286,16 +214,7 @@ const serializeAws_restJson1DeleteKnowledgeBaseCommand = async (input, context)
286
214
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
287
215
  const headers = {};
288
216
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/knowledgeBases/{knowledgeBaseId}";
289
- if (input.knowledgeBaseId !== undefined) {
290
- const labelValue = input.knowledgeBaseId;
291
- if (labelValue.length <= 0) {
292
- throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
293
- }
294
- resolvedPath = resolvedPath.replace("{knowledgeBaseId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
295
- }
296
- else {
297
- throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
298
- }
217
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "knowledgeBaseId", () => input.knowledgeBaseId, "{knowledgeBaseId}", false);
299
218
  let body;
300
219
  return new protocol_http_1.HttpRequest({
301
220
  protocol,
@@ -312,16 +231,7 @@ const serializeAws_restJson1GetAssistantCommand = async (input, context) => {
312
231
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
313
232
  const headers = {};
314
233
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/assistants/{assistantId}";
315
- if (input.assistantId !== undefined) {
316
- const labelValue = input.assistantId;
317
- if (labelValue.length <= 0) {
318
- throw new Error("Empty value provided for input HTTP label: assistantId.");
319
- }
320
- resolvedPath = resolvedPath.replace("{assistantId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
321
- }
322
- else {
323
- throw new Error("No value provided for input HTTP label: assistantId.");
324
- }
234
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "assistantId", () => input.assistantId, "{assistantId}", false);
325
235
  let body;
326
236
  return new protocol_http_1.HttpRequest({
327
237
  protocol,
@@ -339,26 +249,8 @@ const serializeAws_restJson1GetAssistantAssociationCommand = async (input, conte
339
249
  const headers = {};
340
250
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
341
251
  "/assistants/{assistantId}/associations/{assistantAssociationId}";
342
- if (input.assistantAssociationId !== undefined) {
343
- const labelValue = input.assistantAssociationId;
344
- if (labelValue.length <= 0) {
345
- throw new Error("Empty value provided for input HTTP label: assistantAssociationId.");
346
- }
347
- resolvedPath = resolvedPath.replace("{assistantAssociationId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
348
- }
349
- else {
350
- throw new Error("No value provided for input HTTP label: assistantAssociationId.");
351
- }
352
- if (input.assistantId !== undefined) {
353
- const labelValue = input.assistantId;
354
- if (labelValue.length <= 0) {
355
- throw new Error("Empty value provided for input HTTP label: assistantId.");
356
- }
357
- resolvedPath = resolvedPath.replace("{assistantId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
358
- }
359
- else {
360
- throw new Error("No value provided for input HTTP label: assistantId.");
361
- }
252
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "assistantAssociationId", () => input.assistantAssociationId, "{assistantAssociationId}", false);
253
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "assistantId", () => input.assistantId, "{assistantId}", false);
362
254
  let body;
363
255
  return new protocol_http_1.HttpRequest({
364
256
  protocol,
@@ -376,26 +268,8 @@ const serializeAws_restJson1GetContentCommand = async (input, context) => {
376
268
  const headers = {};
377
269
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
378
270
  "/knowledgeBases/{knowledgeBaseId}/contents/{contentId}";
379
- if (input.contentId !== undefined) {
380
- const labelValue = input.contentId;
381
- if (labelValue.length <= 0) {
382
- throw new Error("Empty value provided for input HTTP label: contentId.");
383
- }
384
- resolvedPath = resolvedPath.replace("{contentId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
385
- }
386
- else {
387
- throw new Error("No value provided for input HTTP label: contentId.");
388
- }
389
- if (input.knowledgeBaseId !== undefined) {
390
- const labelValue = input.knowledgeBaseId;
391
- if (labelValue.length <= 0) {
392
- throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
393
- }
394
- resolvedPath = resolvedPath.replace("{knowledgeBaseId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
395
- }
396
- else {
397
- throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
398
- }
271
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "contentId", () => input.contentId, "{contentId}", false);
272
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "knowledgeBaseId", () => input.knowledgeBaseId, "{knowledgeBaseId}", false);
399
273
  let body;
400
274
  return new protocol_http_1.HttpRequest({
401
275
  protocol,
@@ -413,26 +287,8 @@ const serializeAws_restJson1GetContentSummaryCommand = async (input, context) =>
413
287
  const headers = {};
414
288
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
415
289
  "/knowledgeBases/{knowledgeBaseId}/contents/{contentId}/summary";
416
- if (input.contentId !== undefined) {
417
- const labelValue = input.contentId;
418
- if (labelValue.length <= 0) {
419
- throw new Error("Empty value provided for input HTTP label: contentId.");
420
- }
421
- resolvedPath = resolvedPath.replace("{contentId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
422
- }
423
- else {
424
- throw new Error("No value provided for input HTTP label: contentId.");
425
- }
426
- if (input.knowledgeBaseId !== undefined) {
427
- const labelValue = input.knowledgeBaseId;
428
- if (labelValue.length <= 0) {
429
- throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
430
- }
431
- resolvedPath = resolvedPath.replace("{knowledgeBaseId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
432
- }
433
- else {
434
- throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
435
- }
290
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "contentId", () => input.contentId, "{contentId}", false);
291
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "knowledgeBaseId", () => input.knowledgeBaseId, "{knowledgeBaseId}", false);
436
292
  let body;
437
293
  return new protocol_http_1.HttpRequest({
438
294
  protocol,
@@ -449,16 +305,7 @@ const serializeAws_restJson1GetKnowledgeBaseCommand = async (input, context) =>
449
305
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
450
306
  const headers = {};
451
307
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/knowledgeBases/{knowledgeBaseId}";
452
- if (input.knowledgeBaseId !== undefined) {
453
- const labelValue = input.knowledgeBaseId;
454
- if (labelValue.length <= 0) {
455
- throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
456
- }
457
- resolvedPath = resolvedPath.replace("{knowledgeBaseId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
458
- }
459
- else {
460
- throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
461
- }
308
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "knowledgeBaseId", () => input.knowledgeBaseId, "{knowledgeBaseId}", false);
462
309
  let body;
463
310
  return new protocol_http_1.HttpRequest({
464
311
  protocol,
@@ -476,30 +323,12 @@ const serializeAws_restJson1GetRecommendationsCommand = async (input, context) =
476
323
  const headers = {};
477
324
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
478
325
  "/assistants/{assistantId}/sessions/{sessionId}/recommendations";
479
- if (input.assistantId !== undefined) {
480
- const labelValue = input.assistantId;
481
- if (labelValue.length <= 0) {
482
- throw new Error("Empty value provided for input HTTP label: assistantId.");
483
- }
484
- resolvedPath = resolvedPath.replace("{assistantId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
485
- }
486
- else {
487
- throw new Error("No value provided for input HTTP label: assistantId.");
488
- }
489
- if (input.sessionId !== undefined) {
490
- const labelValue = input.sessionId;
491
- if (labelValue.length <= 0) {
492
- throw new Error("Empty value provided for input HTTP label: sessionId.");
493
- }
494
- resolvedPath = resolvedPath.replace("{sessionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
495
- }
496
- else {
497
- throw new Error("No value provided for input HTTP label: sessionId.");
498
- }
499
- const query = {
500
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
501
- ...(input.waitTimeSeconds !== undefined && { waitTimeSeconds: input.waitTimeSeconds.toString() }),
502
- };
326
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "assistantId", () => input.assistantId, "{assistantId}", false);
327
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
328
+ const query = map({
329
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
330
+ waitTimeSeconds: [() => input.waitTimeSeconds !== void 0, () => input.waitTimeSeconds.toString()],
331
+ });
503
332
  let body;
504
333
  return new protocol_http_1.HttpRequest({
505
334
  protocol,
@@ -518,26 +347,8 @@ const serializeAws_restJson1GetSessionCommand = async (input, context) => {
518
347
  const headers = {};
519
348
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
520
349
  "/assistants/{assistantId}/sessions/{sessionId}";
521
- if (input.assistantId !== undefined) {
522
- const labelValue = input.assistantId;
523
- if (labelValue.length <= 0) {
524
- throw new Error("Empty value provided for input HTTP label: assistantId.");
525
- }
526
- resolvedPath = resolvedPath.replace("{assistantId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
527
- }
528
- else {
529
- throw new Error("No value provided for input HTTP label: assistantId.");
530
- }
531
- if (input.sessionId !== undefined) {
532
- const labelValue = input.sessionId;
533
- if (labelValue.length <= 0) {
534
- throw new Error("Empty value provided for input HTTP label: sessionId.");
535
- }
536
- resolvedPath = resolvedPath.replace("{sessionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
537
- }
538
- else {
539
- throw new Error("No value provided for input HTTP label: sessionId.");
540
- }
350
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "assistantId", () => input.assistantId, "{assistantId}", false);
351
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
541
352
  let body;
542
353
  return new protocol_http_1.HttpRequest({
543
354
  protocol,
@@ -554,20 +365,11 @@ const serializeAws_restJson1ListAssistantAssociationsCommand = async (input, con
554
365
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
555
366
  const headers = {};
556
367
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/assistants/{assistantId}/associations";
557
- if (input.assistantId !== undefined) {
558
- const labelValue = input.assistantId;
559
- if (labelValue.length <= 0) {
560
- throw new Error("Empty value provided for input HTTP label: assistantId.");
561
- }
562
- resolvedPath = resolvedPath.replace("{assistantId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
563
- }
564
- else {
565
- throw new Error("No value provided for input HTTP label: assistantId.");
566
- }
567
- const query = {
568
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
569
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
570
- };
368
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "assistantId", () => input.assistantId, "{assistantId}", false);
369
+ const query = map({
370
+ nextToken: [, input.nextToken],
371
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
372
+ });
571
373
  let body;
572
374
  return new protocol_http_1.HttpRequest({
573
375
  protocol,
@@ -585,10 +387,10 @@ const serializeAws_restJson1ListAssistantsCommand = async (input, context) => {
585
387
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
586
388
  const headers = {};
587
389
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/assistants";
588
- const query = {
589
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
590
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
591
- };
390
+ const query = map({
391
+ nextToken: [, input.nextToken],
392
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
393
+ });
592
394
  let body;
593
395
  return new protocol_http_1.HttpRequest({
594
396
  protocol,
@@ -607,20 +409,11 @@ const serializeAws_restJson1ListContentsCommand = async (input, context) => {
607
409
  const headers = {};
608
410
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
609
411
  "/knowledgeBases/{knowledgeBaseId}/contents";
610
- if (input.knowledgeBaseId !== undefined) {
611
- const labelValue = input.knowledgeBaseId;
612
- if (labelValue.length <= 0) {
613
- throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
614
- }
615
- resolvedPath = resolvedPath.replace("{knowledgeBaseId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
616
- }
617
- else {
618
- throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
619
- }
620
- const query = {
621
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
622
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
623
- };
412
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "knowledgeBaseId", () => input.knowledgeBaseId, "{knowledgeBaseId}", false);
413
+ const query = map({
414
+ nextToken: [, input.nextToken],
415
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
416
+ });
624
417
  let body;
625
418
  return new protocol_http_1.HttpRequest({
626
419
  protocol,
@@ -638,10 +431,10 @@ const serializeAws_restJson1ListKnowledgeBasesCommand = async (input, context) =
638
431
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
639
432
  const headers = {};
640
433
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/knowledgeBases";
641
- const query = {
642
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
643
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
644
- };
434
+ const query = map({
435
+ nextToken: [, input.nextToken],
436
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
437
+ });
645
438
  let body;
646
439
  return new protocol_http_1.HttpRequest({
647
440
  protocol,
@@ -659,16 +452,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
659
452
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
660
453
  const headers = {};
661
454
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
662
- if (input.resourceArn !== undefined) {
663
- const labelValue = input.resourceArn;
664
- if (labelValue.length <= 0) {
665
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
666
- }
667
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
668
- }
669
- else {
670
- throw new Error("No value provided for input HTTP label: resourceArn.");
671
- }
455
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
672
456
  let body;
673
457
  return new protocol_http_1.HttpRequest({
674
458
  protocol,
@@ -688,26 +472,8 @@ const serializeAws_restJson1NotifyRecommendationsReceivedCommand = async (input,
688
472
  };
689
473
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
690
474
  "/assistants/{assistantId}/sessions/{sessionId}/recommendations/notify";
691
- if (input.assistantId !== undefined) {
692
- const labelValue = input.assistantId;
693
- if (labelValue.length <= 0) {
694
- throw new Error("Empty value provided for input HTTP label: assistantId.");
695
- }
696
- resolvedPath = resolvedPath.replace("{assistantId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
697
- }
698
- else {
699
- throw new Error("No value provided for input HTTP label: assistantId.");
700
- }
701
- if (input.sessionId !== undefined) {
702
- const labelValue = input.sessionId;
703
- if (labelValue.length <= 0) {
704
- throw new Error("Empty value provided for input HTTP label: sessionId.");
705
- }
706
- resolvedPath = resolvedPath.replace("{sessionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
707
- }
708
- else {
709
- throw new Error("No value provided for input HTTP label: sessionId.");
710
- }
475
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "assistantId", () => input.assistantId, "{assistantId}", false);
476
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
711
477
  let body;
712
478
  body = JSON.stringify({
713
479
  ...(input.recommendationIds != null && {
@@ -731,16 +497,7 @@ const serializeAws_restJson1QueryAssistantCommand = async (input, context) => {
731
497
  "content-type": "application/json",
732
498
  };
733
499
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/assistants/{assistantId}/query";
734
- if (input.assistantId !== undefined) {
735
- const labelValue = input.assistantId;
736
- if (labelValue.length <= 0) {
737
- throw new Error("Empty value provided for input HTTP label: assistantId.");
738
- }
739
- resolvedPath = resolvedPath.replace("{assistantId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
740
- }
741
- else {
742
- throw new Error("No value provided for input HTTP label: assistantId.");
743
- }
500
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "assistantId", () => input.assistantId, "{assistantId}", false);
744
501
  let body;
745
502
  body = JSON.stringify({
746
503
  ...(input.maxResults != null && { maxResults: input.maxResults }),
@@ -763,16 +520,7 @@ const serializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommand = async (input
763
520
  const headers = {};
764
521
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
765
522
  "/knowledgeBases/{knowledgeBaseId}/templateUri";
766
- if (input.knowledgeBaseId !== undefined) {
767
- const labelValue = input.knowledgeBaseId;
768
- if (labelValue.length <= 0) {
769
- throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
770
- }
771
- resolvedPath = resolvedPath.replace("{knowledgeBaseId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
772
- }
773
- else {
774
- throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
775
- }
523
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "knowledgeBaseId", () => input.knowledgeBaseId, "{knowledgeBaseId}", false);
776
524
  let body;
777
525
  return new protocol_http_1.HttpRequest({
778
526
  protocol,
@@ -791,20 +539,11 @@ const serializeAws_restJson1SearchContentCommand = async (input, context) => {
791
539
  "content-type": "application/json",
792
540
  };
793
541
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/knowledgeBases/{knowledgeBaseId}/search";
794
- if (input.knowledgeBaseId !== undefined) {
795
- const labelValue = input.knowledgeBaseId;
796
- if (labelValue.length <= 0) {
797
- throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
798
- }
799
- resolvedPath = resolvedPath.replace("{knowledgeBaseId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
800
- }
801
- else {
802
- throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
803
- }
804
- const query = {
805
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
806
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
807
- };
542
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "knowledgeBaseId", () => input.knowledgeBaseId, "{knowledgeBaseId}", false);
543
+ const query = map({
544
+ nextToken: [, input.nextToken],
545
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
546
+ });
808
547
  let body;
809
548
  body = JSON.stringify({
810
549
  ...(input.searchExpression != null && {
@@ -829,20 +568,11 @@ const serializeAws_restJson1SearchSessionsCommand = async (input, context) => {
829
568
  "content-type": "application/json",
830
569
  };
831
570
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/assistants/{assistantId}/searchSessions";
832
- if (input.assistantId !== undefined) {
833
- const labelValue = input.assistantId;
834
- if (labelValue.length <= 0) {
835
- throw new Error("Empty value provided for input HTTP label: assistantId.");
836
- }
837
- resolvedPath = resolvedPath.replace("{assistantId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
838
- }
839
- else {
840
- throw new Error("No value provided for input HTTP label: assistantId.");
841
- }
842
- const query = {
843
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
844
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
845
- };
571
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "assistantId", () => input.assistantId, "{assistantId}", false);
572
+ const query = map({
573
+ nextToken: [, input.nextToken],
574
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
575
+ });
846
576
  let body;
847
577
  body = JSON.stringify({
848
578
  ...(input.searchExpression != null && {
@@ -867,16 +597,7 @@ const serializeAws_restJson1StartContentUploadCommand = async (input, context) =
867
597
  "content-type": "application/json",
868
598
  };
869
599
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/knowledgeBases/{knowledgeBaseId}/upload";
870
- if (input.knowledgeBaseId !== undefined) {
871
- const labelValue = input.knowledgeBaseId;
872
- if (labelValue.length <= 0) {
873
- throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
874
- }
875
- resolvedPath = resolvedPath.replace("{knowledgeBaseId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
876
- }
877
- else {
878
- throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
879
- }
600
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "knowledgeBaseId", () => input.knowledgeBaseId, "{knowledgeBaseId}", false);
880
601
  let body;
881
602
  body = JSON.stringify({
882
603
  ...(input.contentType != null && { contentType: input.contentType }),
@@ -898,16 +619,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
898
619
  "content-type": "application/json",
899
620
  };
900
621
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
901
- if (input.resourceArn !== undefined) {
902
- const labelValue = input.resourceArn;
903
- if (labelValue.length <= 0) {
904
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
905
- }
906
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
907
- }
908
- else {
909
- throw new Error("No value provided for input HTTP label: resourceArn.");
910
- }
622
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
911
623
  let body;
912
624
  body = JSON.stringify({
913
625
  ...(input.tags != null && { tags: serializeAws_restJson1Tags(input.tags, context) }),
@@ -927,19 +639,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
927
639
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
928
640
  const headers = {};
929
641
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
930
- if (input.resourceArn !== undefined) {
931
- const labelValue = input.resourceArn;
932
- if (labelValue.length <= 0) {
933
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
934
- }
935
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
936
- }
937
- else {
938
- throw new Error("No value provided for input HTTP label: resourceArn.");
939
- }
940
- const query = {
941
- ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }),
942
- };
642
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
643
+ const query = map({
644
+ tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys || []).map((_entry) => _entry)],
645
+ });
943
646
  let body;
944
647
  return new protocol_http_1.HttpRequest({
945
648
  protocol,
@@ -960,26 +663,8 @@ const serializeAws_restJson1UpdateContentCommand = async (input, context) => {
960
663
  };
961
664
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
962
665
  "/knowledgeBases/{knowledgeBaseId}/contents/{contentId}";
963
- if (input.knowledgeBaseId !== undefined) {
964
- const labelValue = input.knowledgeBaseId;
965
- if (labelValue.length <= 0) {
966
- throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
967
- }
968
- resolvedPath = resolvedPath.replace("{knowledgeBaseId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
969
- }
970
- else {
971
- throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
972
- }
973
- if (input.contentId !== undefined) {
974
- const labelValue = input.contentId;
975
- if (labelValue.length <= 0) {
976
- throw new Error("Empty value provided for input HTTP label: contentId.");
977
- }
978
- resolvedPath = resolvedPath.replace("{contentId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
979
- }
980
- else {
981
- throw new Error("No value provided for input HTTP label: contentId.");
982
- }
666
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "knowledgeBaseId", () => input.knowledgeBaseId, "{knowledgeBaseId}", false);
667
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "contentId", () => input.contentId, "{contentId}", false);
983
668
  let body;
984
669
  body = JSON.stringify({
985
670
  ...(input.metadata != null && { metadata: serializeAws_restJson1ContentMetadata(input.metadata, context) }),
@@ -1007,16 +692,7 @@ const serializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommand = async (input
1007
692
  };
1008
693
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1009
694
  "/knowledgeBases/{knowledgeBaseId}/templateUri";
1010
- if (input.knowledgeBaseId !== undefined) {
1011
- const labelValue = input.knowledgeBaseId;
1012
- if (labelValue.length <= 0) {
1013
- throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
1014
- }
1015
- resolvedPath = resolvedPath.replace("{knowledgeBaseId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1016
- }
1017
- else {
1018
- throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
1019
- }
695
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "knowledgeBaseId", () => input.knowledgeBaseId, "{knowledgeBaseId}", false);
1020
696
  let body;
1021
697
  body = JSON.stringify({
1022
698
  ...(input.templateUri != null && { templateUri: input.templateUri }),
@@ -1036,15 +712,14 @@ const deserializeAws_restJson1CreateAssistantCommand = async (output, context) =
1036
712
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1037
713
  return deserializeAws_restJson1CreateAssistantCommandError(output, context);
1038
714
  }
1039
- const contents = {
715
+ const contents = map({
1040
716
  $metadata: deserializeMetadata(output),
1041
- assistant: undefined,
1042
- };
717
+ });
1043
718
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1044
- if (data.assistant !== undefined && data.assistant !== null) {
719
+ if (data.assistant != null) {
1045
720
  contents.assistant = deserializeAws_restJson1AssistantData(data.assistant, context);
1046
721
  }
1047
- return Promise.resolve(contents);
722
+ return contents;
1048
723
  };
1049
724
  exports.deserializeAws_restJson1CreateAssistantCommand = deserializeAws_restJson1CreateAssistantCommand;
1050
725
  const deserializeAws_restJson1CreateAssistantCommandError = async (output, context) => {
@@ -1052,7 +727,6 @@ const deserializeAws_restJson1CreateAssistantCommandError = async (output, conte
1052
727
  ...output,
1053
728
  body: await parseBody(output.body, context),
1054
729
  };
1055
- let response;
1056
730
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1057
731
  switch (errorCode) {
1058
732
  case "AccessDeniedException":
@@ -1069,29 +743,26 @@ const deserializeAws_restJson1CreateAssistantCommandError = async (output, conte
1069
743
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1070
744
  default:
1071
745
  const parsedBody = parsedOutput.body;
1072
- const $metadata = deserializeMetadata(output);
1073
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1074
- response = new WisdomServiceException_1.WisdomServiceException({
1075
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1076
- $fault: "client",
1077
- $metadata,
746
+ (0, smithy_client_1.throwDefaultError)({
747
+ output,
748
+ parsedBody,
749
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
750
+ errorCode,
1078
751
  });
1079
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1080
752
  }
1081
753
  };
1082
754
  const deserializeAws_restJson1CreateAssistantAssociationCommand = async (output, context) => {
1083
755
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1084
756
  return deserializeAws_restJson1CreateAssistantAssociationCommandError(output, context);
1085
757
  }
1086
- const contents = {
758
+ const contents = map({
1087
759
  $metadata: deserializeMetadata(output),
1088
- assistantAssociation: undefined,
1089
- };
760
+ });
1090
761
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1091
- if (data.assistantAssociation !== undefined && data.assistantAssociation !== null) {
762
+ if (data.assistantAssociation != null) {
1092
763
  contents.assistantAssociation = deserializeAws_restJson1AssistantAssociationData(data.assistantAssociation, context);
1093
764
  }
1094
- return Promise.resolve(contents);
765
+ return contents;
1095
766
  };
1096
767
  exports.deserializeAws_restJson1CreateAssistantAssociationCommand = deserializeAws_restJson1CreateAssistantAssociationCommand;
1097
768
  const deserializeAws_restJson1CreateAssistantAssociationCommandError = async (output, context) => {
@@ -1099,7 +770,6 @@ const deserializeAws_restJson1CreateAssistantAssociationCommandError = async (ou
1099
770
  ...output,
1100
771
  body: await parseBody(output.body, context),
1101
772
  };
1102
- let response;
1103
773
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1104
774
  switch (errorCode) {
1105
775
  case "AccessDeniedException":
@@ -1119,29 +789,26 @@ const deserializeAws_restJson1CreateAssistantAssociationCommandError = async (ou
1119
789
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1120
790
  default:
1121
791
  const parsedBody = parsedOutput.body;
1122
- const $metadata = deserializeMetadata(output);
1123
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1124
- response = new WisdomServiceException_1.WisdomServiceException({
1125
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1126
- $fault: "client",
1127
- $metadata,
792
+ (0, smithy_client_1.throwDefaultError)({
793
+ output,
794
+ parsedBody,
795
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
796
+ errorCode,
1128
797
  });
1129
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1130
798
  }
1131
799
  };
1132
800
  const deserializeAws_restJson1CreateContentCommand = async (output, context) => {
1133
801
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1134
802
  return deserializeAws_restJson1CreateContentCommandError(output, context);
1135
803
  }
1136
- const contents = {
804
+ const contents = map({
1137
805
  $metadata: deserializeMetadata(output),
1138
- content: undefined,
1139
- };
806
+ });
1140
807
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1141
- if (data.content !== undefined && data.content !== null) {
808
+ if (data.content != null) {
1142
809
  contents.content = deserializeAws_restJson1ContentData(data.content, context);
1143
810
  }
1144
- return Promise.resolve(contents);
811
+ return contents;
1145
812
  };
1146
813
  exports.deserializeAws_restJson1CreateContentCommand = deserializeAws_restJson1CreateContentCommand;
1147
814
  const deserializeAws_restJson1CreateContentCommandError = async (output, context) => {
@@ -1149,7 +816,6 @@ const deserializeAws_restJson1CreateContentCommandError = async (output, context
1149
816
  ...output,
1150
817
  body: await parseBody(output.body, context),
1151
818
  };
1152
- let response;
1153
819
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1154
820
  switch (errorCode) {
1155
821
  case "AccessDeniedException":
@@ -1169,29 +835,26 @@ const deserializeAws_restJson1CreateContentCommandError = async (output, context
1169
835
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1170
836
  default:
1171
837
  const parsedBody = parsedOutput.body;
1172
- const $metadata = deserializeMetadata(output);
1173
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1174
- response = new WisdomServiceException_1.WisdomServiceException({
1175
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1176
- $fault: "client",
1177
- $metadata,
838
+ (0, smithy_client_1.throwDefaultError)({
839
+ output,
840
+ parsedBody,
841
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
842
+ errorCode,
1178
843
  });
1179
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1180
844
  }
1181
845
  };
1182
846
  const deserializeAws_restJson1CreateKnowledgeBaseCommand = async (output, context) => {
1183
847
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1184
848
  return deserializeAws_restJson1CreateKnowledgeBaseCommandError(output, context);
1185
849
  }
1186
- const contents = {
850
+ const contents = map({
1187
851
  $metadata: deserializeMetadata(output),
1188
- knowledgeBase: undefined,
1189
- };
852
+ });
1190
853
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1191
- if (data.knowledgeBase !== undefined && data.knowledgeBase !== null) {
854
+ if (data.knowledgeBase != null) {
1192
855
  contents.knowledgeBase = deserializeAws_restJson1KnowledgeBaseData(data.knowledgeBase, context);
1193
856
  }
1194
- return Promise.resolve(contents);
857
+ return contents;
1195
858
  };
1196
859
  exports.deserializeAws_restJson1CreateKnowledgeBaseCommand = deserializeAws_restJson1CreateKnowledgeBaseCommand;
1197
860
  const deserializeAws_restJson1CreateKnowledgeBaseCommandError = async (output, context) => {
@@ -1199,7 +862,6 @@ const deserializeAws_restJson1CreateKnowledgeBaseCommandError = async (output, c
1199
862
  ...output,
1200
863
  body: await parseBody(output.body, context),
1201
864
  };
1202
- let response;
1203
865
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1204
866
  switch (errorCode) {
1205
867
  case "AccessDeniedException":
@@ -1216,29 +878,26 @@ const deserializeAws_restJson1CreateKnowledgeBaseCommandError = async (output, c
1216
878
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1217
879
  default:
1218
880
  const parsedBody = parsedOutput.body;
1219
- const $metadata = deserializeMetadata(output);
1220
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1221
- response = new WisdomServiceException_1.WisdomServiceException({
1222
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1223
- $fault: "client",
1224
- $metadata,
881
+ (0, smithy_client_1.throwDefaultError)({
882
+ output,
883
+ parsedBody,
884
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
885
+ errorCode,
1225
886
  });
1226
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1227
887
  }
1228
888
  };
1229
889
  const deserializeAws_restJson1CreateSessionCommand = async (output, context) => {
1230
890
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1231
891
  return deserializeAws_restJson1CreateSessionCommandError(output, context);
1232
892
  }
1233
- const contents = {
893
+ const contents = map({
1234
894
  $metadata: deserializeMetadata(output),
1235
- session: undefined,
1236
- };
895
+ });
1237
896
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1238
- if (data.session !== undefined && data.session !== null) {
897
+ if (data.session != null) {
1239
898
  contents.session = deserializeAws_restJson1SessionData(data.session, context);
1240
899
  }
1241
- return Promise.resolve(contents);
900
+ return contents;
1242
901
  };
1243
902
  exports.deserializeAws_restJson1CreateSessionCommand = deserializeAws_restJson1CreateSessionCommand;
1244
903
  const deserializeAws_restJson1CreateSessionCommandError = async (output, context) => {
@@ -1246,7 +905,6 @@ const deserializeAws_restJson1CreateSessionCommandError = async (output, context
1246
905
  ...output,
1247
906
  body: await parseBody(output.body, context),
1248
907
  };
1249
- let response;
1250
908
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1251
909
  switch (errorCode) {
1252
910
  case "ConflictException":
@@ -1260,25 +918,23 @@ const deserializeAws_restJson1CreateSessionCommandError = async (output, context
1260
918
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1261
919
  default:
1262
920
  const parsedBody = parsedOutput.body;
1263
- const $metadata = deserializeMetadata(output);
1264
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1265
- response = new WisdomServiceException_1.WisdomServiceException({
1266
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1267
- $fault: "client",
1268
- $metadata,
921
+ (0, smithy_client_1.throwDefaultError)({
922
+ output,
923
+ parsedBody,
924
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
925
+ errorCode,
1269
926
  });
1270
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1271
927
  }
1272
928
  };
1273
929
  const deserializeAws_restJson1DeleteAssistantCommand = async (output, context) => {
1274
930
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1275
931
  return deserializeAws_restJson1DeleteAssistantCommandError(output, context);
1276
932
  }
1277
- const contents = {
933
+ const contents = map({
1278
934
  $metadata: deserializeMetadata(output),
1279
- };
935
+ });
1280
936
  await collectBody(output.body, context);
1281
- return Promise.resolve(contents);
937
+ return contents;
1282
938
  };
1283
939
  exports.deserializeAws_restJson1DeleteAssistantCommand = deserializeAws_restJson1DeleteAssistantCommand;
1284
940
  const deserializeAws_restJson1DeleteAssistantCommandError = async (output, context) => {
@@ -1286,7 +942,6 @@ const deserializeAws_restJson1DeleteAssistantCommandError = async (output, conte
1286
942
  ...output,
1287
943
  body: await parseBody(output.body, context),
1288
944
  };
1289
- let response;
1290
945
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1291
946
  switch (errorCode) {
1292
947
  case "AccessDeniedException":
@@ -1300,25 +955,23 @@ const deserializeAws_restJson1DeleteAssistantCommandError = async (output, conte
1300
955
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1301
956
  default:
1302
957
  const parsedBody = parsedOutput.body;
1303
- const $metadata = deserializeMetadata(output);
1304
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1305
- response = new WisdomServiceException_1.WisdomServiceException({
1306
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1307
- $fault: "client",
1308
- $metadata,
958
+ (0, smithy_client_1.throwDefaultError)({
959
+ output,
960
+ parsedBody,
961
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
962
+ errorCode,
1309
963
  });
1310
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1311
964
  }
1312
965
  };
1313
966
  const deserializeAws_restJson1DeleteAssistantAssociationCommand = async (output, context) => {
1314
967
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1315
968
  return deserializeAws_restJson1DeleteAssistantAssociationCommandError(output, context);
1316
969
  }
1317
- const contents = {
970
+ const contents = map({
1318
971
  $metadata: deserializeMetadata(output),
1319
- };
972
+ });
1320
973
  await collectBody(output.body, context);
1321
- return Promise.resolve(contents);
974
+ return contents;
1322
975
  };
1323
976
  exports.deserializeAws_restJson1DeleteAssistantAssociationCommand = deserializeAws_restJson1DeleteAssistantAssociationCommand;
1324
977
  const deserializeAws_restJson1DeleteAssistantAssociationCommandError = async (output, context) => {
@@ -1326,7 +979,6 @@ const deserializeAws_restJson1DeleteAssistantAssociationCommandError = async (ou
1326
979
  ...output,
1327
980
  body: await parseBody(output.body, context),
1328
981
  };
1329
- let response;
1330
982
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1331
983
  switch (errorCode) {
1332
984
  case "AccessDeniedException":
@@ -1340,25 +992,23 @@ const deserializeAws_restJson1DeleteAssistantAssociationCommandError = async (ou
1340
992
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1341
993
  default:
1342
994
  const parsedBody = parsedOutput.body;
1343
- const $metadata = deserializeMetadata(output);
1344
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1345
- response = new WisdomServiceException_1.WisdomServiceException({
1346
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1347
- $fault: "client",
1348
- $metadata,
995
+ (0, smithy_client_1.throwDefaultError)({
996
+ output,
997
+ parsedBody,
998
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
999
+ errorCode,
1349
1000
  });
1350
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1351
1001
  }
1352
1002
  };
1353
1003
  const deserializeAws_restJson1DeleteContentCommand = async (output, context) => {
1354
1004
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1355
1005
  return deserializeAws_restJson1DeleteContentCommandError(output, context);
1356
1006
  }
1357
- const contents = {
1007
+ const contents = map({
1358
1008
  $metadata: deserializeMetadata(output),
1359
- };
1009
+ });
1360
1010
  await collectBody(output.body, context);
1361
- return Promise.resolve(contents);
1011
+ return contents;
1362
1012
  };
1363
1013
  exports.deserializeAws_restJson1DeleteContentCommand = deserializeAws_restJson1DeleteContentCommand;
1364
1014
  const deserializeAws_restJson1DeleteContentCommandError = async (output, context) => {
@@ -1366,7 +1016,6 @@ const deserializeAws_restJson1DeleteContentCommandError = async (output, context
1366
1016
  ...output,
1367
1017
  body: await parseBody(output.body, context),
1368
1018
  };
1369
- let response;
1370
1019
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1371
1020
  switch (errorCode) {
1372
1021
  case "AccessDeniedException":
@@ -1380,25 +1029,23 @@ const deserializeAws_restJson1DeleteContentCommandError = async (output, context
1380
1029
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1381
1030
  default:
1382
1031
  const parsedBody = parsedOutput.body;
1383
- const $metadata = deserializeMetadata(output);
1384
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1385
- response = new WisdomServiceException_1.WisdomServiceException({
1386
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1387
- $fault: "client",
1388
- $metadata,
1032
+ (0, smithy_client_1.throwDefaultError)({
1033
+ output,
1034
+ parsedBody,
1035
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1036
+ errorCode,
1389
1037
  });
1390
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1391
1038
  }
1392
1039
  };
1393
1040
  const deserializeAws_restJson1DeleteKnowledgeBaseCommand = async (output, context) => {
1394
1041
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1395
1042
  return deserializeAws_restJson1DeleteKnowledgeBaseCommandError(output, context);
1396
1043
  }
1397
- const contents = {
1044
+ const contents = map({
1398
1045
  $metadata: deserializeMetadata(output),
1399
- };
1046
+ });
1400
1047
  await collectBody(output.body, context);
1401
- return Promise.resolve(contents);
1048
+ return contents;
1402
1049
  };
1403
1050
  exports.deserializeAws_restJson1DeleteKnowledgeBaseCommand = deserializeAws_restJson1DeleteKnowledgeBaseCommand;
1404
1051
  const deserializeAws_restJson1DeleteKnowledgeBaseCommandError = async (output, context) => {
@@ -1406,7 +1053,6 @@ const deserializeAws_restJson1DeleteKnowledgeBaseCommandError = async (output, c
1406
1053
  ...output,
1407
1054
  body: await parseBody(output.body, context),
1408
1055
  };
1409
- let response;
1410
1056
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1411
1057
  switch (errorCode) {
1412
1058
  case "AccessDeniedException":
@@ -1423,29 +1069,26 @@ const deserializeAws_restJson1DeleteKnowledgeBaseCommandError = async (output, c
1423
1069
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1424
1070
  default:
1425
1071
  const parsedBody = parsedOutput.body;
1426
- const $metadata = deserializeMetadata(output);
1427
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1428
- response = new WisdomServiceException_1.WisdomServiceException({
1429
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1430
- $fault: "client",
1431
- $metadata,
1072
+ (0, smithy_client_1.throwDefaultError)({
1073
+ output,
1074
+ parsedBody,
1075
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1076
+ errorCode,
1432
1077
  });
1433
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1434
1078
  }
1435
1079
  };
1436
1080
  const deserializeAws_restJson1GetAssistantCommand = async (output, context) => {
1437
1081
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1438
1082
  return deserializeAws_restJson1GetAssistantCommandError(output, context);
1439
1083
  }
1440
- const contents = {
1084
+ const contents = map({
1441
1085
  $metadata: deserializeMetadata(output),
1442
- assistant: undefined,
1443
- };
1086
+ });
1444
1087
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1445
- if (data.assistant !== undefined && data.assistant !== null) {
1088
+ if (data.assistant != null) {
1446
1089
  contents.assistant = deserializeAws_restJson1AssistantData(data.assistant, context);
1447
1090
  }
1448
- return Promise.resolve(contents);
1091
+ return contents;
1449
1092
  };
1450
1093
  exports.deserializeAws_restJson1GetAssistantCommand = deserializeAws_restJson1GetAssistantCommand;
1451
1094
  const deserializeAws_restJson1GetAssistantCommandError = async (output, context) => {
@@ -1453,7 +1096,6 @@ const deserializeAws_restJson1GetAssistantCommandError = async (output, context)
1453
1096
  ...output,
1454
1097
  body: await parseBody(output.body, context),
1455
1098
  };
1456
- let response;
1457
1099
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1458
1100
  switch (errorCode) {
1459
1101
  case "AccessDeniedException":
@@ -1467,29 +1109,26 @@ const deserializeAws_restJson1GetAssistantCommandError = async (output, context)
1467
1109
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1468
1110
  default:
1469
1111
  const parsedBody = parsedOutput.body;
1470
- const $metadata = deserializeMetadata(output);
1471
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1472
- response = new WisdomServiceException_1.WisdomServiceException({
1473
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1474
- $fault: "client",
1475
- $metadata,
1112
+ (0, smithy_client_1.throwDefaultError)({
1113
+ output,
1114
+ parsedBody,
1115
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1116
+ errorCode,
1476
1117
  });
1477
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1478
1118
  }
1479
1119
  };
1480
1120
  const deserializeAws_restJson1GetAssistantAssociationCommand = async (output, context) => {
1481
1121
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1482
1122
  return deserializeAws_restJson1GetAssistantAssociationCommandError(output, context);
1483
1123
  }
1484
- const contents = {
1124
+ const contents = map({
1485
1125
  $metadata: deserializeMetadata(output),
1486
- assistantAssociation: undefined,
1487
- };
1126
+ });
1488
1127
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1489
- if (data.assistantAssociation !== undefined && data.assistantAssociation !== null) {
1128
+ if (data.assistantAssociation != null) {
1490
1129
  contents.assistantAssociation = deserializeAws_restJson1AssistantAssociationData(data.assistantAssociation, context);
1491
1130
  }
1492
- return Promise.resolve(contents);
1131
+ return contents;
1493
1132
  };
1494
1133
  exports.deserializeAws_restJson1GetAssistantAssociationCommand = deserializeAws_restJson1GetAssistantAssociationCommand;
1495
1134
  const deserializeAws_restJson1GetAssistantAssociationCommandError = async (output, context) => {
@@ -1497,7 +1136,6 @@ const deserializeAws_restJson1GetAssistantAssociationCommandError = async (outpu
1497
1136
  ...output,
1498
1137
  body: await parseBody(output.body, context),
1499
1138
  };
1500
- let response;
1501
1139
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1502
1140
  switch (errorCode) {
1503
1141
  case "AccessDeniedException":
@@ -1511,29 +1149,26 @@ const deserializeAws_restJson1GetAssistantAssociationCommandError = async (outpu
1511
1149
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1512
1150
  default:
1513
1151
  const parsedBody = parsedOutput.body;
1514
- const $metadata = deserializeMetadata(output);
1515
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1516
- response = new WisdomServiceException_1.WisdomServiceException({
1517
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1518
- $fault: "client",
1519
- $metadata,
1152
+ (0, smithy_client_1.throwDefaultError)({
1153
+ output,
1154
+ parsedBody,
1155
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1156
+ errorCode,
1520
1157
  });
1521
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1522
1158
  }
1523
1159
  };
1524
1160
  const deserializeAws_restJson1GetContentCommand = async (output, context) => {
1525
1161
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1526
1162
  return deserializeAws_restJson1GetContentCommandError(output, context);
1527
1163
  }
1528
- const contents = {
1164
+ const contents = map({
1529
1165
  $metadata: deserializeMetadata(output),
1530
- content: undefined,
1531
- };
1166
+ });
1532
1167
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1533
- if (data.content !== undefined && data.content !== null) {
1168
+ if (data.content != null) {
1534
1169
  contents.content = deserializeAws_restJson1ContentData(data.content, context);
1535
1170
  }
1536
- return Promise.resolve(contents);
1171
+ return contents;
1537
1172
  };
1538
1173
  exports.deserializeAws_restJson1GetContentCommand = deserializeAws_restJson1GetContentCommand;
1539
1174
  const deserializeAws_restJson1GetContentCommandError = async (output, context) => {
@@ -1541,7 +1176,6 @@ const deserializeAws_restJson1GetContentCommandError = async (output, context) =
1541
1176
  ...output,
1542
1177
  body: await parseBody(output.body, context),
1543
1178
  };
1544
- let response;
1545
1179
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1546
1180
  switch (errorCode) {
1547
1181
  case "AccessDeniedException":
@@ -1555,29 +1189,26 @@ const deserializeAws_restJson1GetContentCommandError = async (output, context) =
1555
1189
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1556
1190
  default:
1557
1191
  const parsedBody = parsedOutput.body;
1558
- const $metadata = deserializeMetadata(output);
1559
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1560
- response = new WisdomServiceException_1.WisdomServiceException({
1561
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1562
- $fault: "client",
1563
- $metadata,
1192
+ (0, smithy_client_1.throwDefaultError)({
1193
+ output,
1194
+ parsedBody,
1195
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1196
+ errorCode,
1564
1197
  });
1565
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1566
1198
  }
1567
1199
  };
1568
1200
  const deserializeAws_restJson1GetContentSummaryCommand = async (output, context) => {
1569
1201
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1570
1202
  return deserializeAws_restJson1GetContentSummaryCommandError(output, context);
1571
1203
  }
1572
- const contents = {
1204
+ const contents = map({
1573
1205
  $metadata: deserializeMetadata(output),
1574
- contentSummary: undefined,
1575
- };
1206
+ });
1576
1207
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1577
- if (data.contentSummary !== undefined && data.contentSummary !== null) {
1208
+ if (data.contentSummary != null) {
1578
1209
  contents.contentSummary = deserializeAws_restJson1ContentSummary(data.contentSummary, context);
1579
1210
  }
1580
- return Promise.resolve(contents);
1211
+ return contents;
1581
1212
  };
1582
1213
  exports.deserializeAws_restJson1GetContentSummaryCommand = deserializeAws_restJson1GetContentSummaryCommand;
1583
1214
  const deserializeAws_restJson1GetContentSummaryCommandError = async (output, context) => {
@@ -1585,7 +1216,6 @@ const deserializeAws_restJson1GetContentSummaryCommandError = async (output, con
1585
1216
  ...output,
1586
1217
  body: await parseBody(output.body, context),
1587
1218
  };
1588
- let response;
1589
1219
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1590
1220
  switch (errorCode) {
1591
1221
  case "AccessDeniedException":
@@ -1599,29 +1229,26 @@ const deserializeAws_restJson1GetContentSummaryCommandError = async (output, con
1599
1229
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1600
1230
  default:
1601
1231
  const parsedBody = parsedOutput.body;
1602
- const $metadata = deserializeMetadata(output);
1603
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1604
- response = new WisdomServiceException_1.WisdomServiceException({
1605
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1606
- $fault: "client",
1607
- $metadata,
1232
+ (0, smithy_client_1.throwDefaultError)({
1233
+ output,
1234
+ parsedBody,
1235
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1236
+ errorCode,
1608
1237
  });
1609
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1610
1238
  }
1611
1239
  };
1612
1240
  const deserializeAws_restJson1GetKnowledgeBaseCommand = async (output, context) => {
1613
1241
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1614
1242
  return deserializeAws_restJson1GetKnowledgeBaseCommandError(output, context);
1615
1243
  }
1616
- const contents = {
1244
+ const contents = map({
1617
1245
  $metadata: deserializeMetadata(output),
1618
- knowledgeBase: undefined,
1619
- };
1246
+ });
1620
1247
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1621
- if (data.knowledgeBase !== undefined && data.knowledgeBase !== null) {
1248
+ if (data.knowledgeBase != null) {
1622
1249
  contents.knowledgeBase = deserializeAws_restJson1KnowledgeBaseData(data.knowledgeBase, context);
1623
1250
  }
1624
- return Promise.resolve(contents);
1251
+ return contents;
1625
1252
  };
1626
1253
  exports.deserializeAws_restJson1GetKnowledgeBaseCommand = deserializeAws_restJson1GetKnowledgeBaseCommand;
1627
1254
  const deserializeAws_restJson1GetKnowledgeBaseCommandError = async (output, context) => {
@@ -1629,7 +1256,6 @@ const deserializeAws_restJson1GetKnowledgeBaseCommandError = async (output, cont
1629
1256
  ...output,
1630
1257
  body: await parseBody(output.body, context),
1631
1258
  };
1632
- let response;
1633
1259
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1634
1260
  switch (errorCode) {
1635
1261
  case "AccessDeniedException":
@@ -1643,33 +1269,29 @@ const deserializeAws_restJson1GetKnowledgeBaseCommandError = async (output, cont
1643
1269
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1644
1270
  default:
1645
1271
  const parsedBody = parsedOutput.body;
1646
- const $metadata = deserializeMetadata(output);
1647
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1648
- response = new WisdomServiceException_1.WisdomServiceException({
1649
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1650
- $fault: "client",
1651
- $metadata,
1272
+ (0, smithy_client_1.throwDefaultError)({
1273
+ output,
1274
+ parsedBody,
1275
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1276
+ errorCode,
1652
1277
  });
1653
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1654
1278
  }
1655
1279
  };
1656
1280
  const deserializeAws_restJson1GetRecommendationsCommand = async (output, context) => {
1657
1281
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1658
1282
  return deserializeAws_restJson1GetRecommendationsCommandError(output, context);
1659
1283
  }
1660
- const contents = {
1284
+ const contents = map({
1661
1285
  $metadata: deserializeMetadata(output),
1662
- recommendations: undefined,
1663
- triggers: undefined,
1664
- };
1286
+ });
1665
1287
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1666
- if (data.recommendations !== undefined && data.recommendations !== null) {
1288
+ if (data.recommendations != null) {
1667
1289
  contents.recommendations = deserializeAws_restJson1RecommendationList(data.recommendations, context);
1668
1290
  }
1669
- if (data.triggers !== undefined && data.triggers !== null) {
1291
+ if (data.triggers != null) {
1670
1292
  contents.triggers = deserializeAws_restJson1RecommendationTriggerList(data.triggers, context);
1671
1293
  }
1672
- return Promise.resolve(contents);
1294
+ return contents;
1673
1295
  };
1674
1296
  exports.deserializeAws_restJson1GetRecommendationsCommand = deserializeAws_restJson1GetRecommendationsCommand;
1675
1297
  const deserializeAws_restJson1GetRecommendationsCommandError = async (output, context) => {
@@ -1677,7 +1299,6 @@ const deserializeAws_restJson1GetRecommendationsCommandError = async (output, co
1677
1299
  ...output,
1678
1300
  body: await parseBody(output.body, context),
1679
1301
  };
1680
- let response;
1681
1302
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1682
1303
  switch (errorCode) {
1683
1304
  case "AccessDeniedException":
@@ -1691,29 +1312,26 @@ const deserializeAws_restJson1GetRecommendationsCommandError = async (output, co
1691
1312
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1692
1313
  default:
1693
1314
  const parsedBody = parsedOutput.body;
1694
- const $metadata = deserializeMetadata(output);
1695
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1696
- response = new WisdomServiceException_1.WisdomServiceException({
1697
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1698
- $fault: "client",
1699
- $metadata,
1315
+ (0, smithy_client_1.throwDefaultError)({
1316
+ output,
1317
+ parsedBody,
1318
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1319
+ errorCode,
1700
1320
  });
1701
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1702
1321
  }
1703
1322
  };
1704
1323
  const deserializeAws_restJson1GetSessionCommand = async (output, context) => {
1705
1324
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1706
1325
  return deserializeAws_restJson1GetSessionCommandError(output, context);
1707
1326
  }
1708
- const contents = {
1327
+ const contents = map({
1709
1328
  $metadata: deserializeMetadata(output),
1710
- session: undefined,
1711
- };
1329
+ });
1712
1330
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1713
- if (data.session !== undefined && data.session !== null) {
1331
+ if (data.session != null) {
1714
1332
  contents.session = deserializeAws_restJson1SessionData(data.session, context);
1715
1333
  }
1716
- return Promise.resolve(contents);
1334
+ return contents;
1717
1335
  };
1718
1336
  exports.deserializeAws_restJson1GetSessionCommand = deserializeAws_restJson1GetSessionCommand;
1719
1337
  const deserializeAws_restJson1GetSessionCommandError = async (output, context) => {
@@ -1721,7 +1339,6 @@ const deserializeAws_restJson1GetSessionCommandError = async (output, context) =
1721
1339
  ...output,
1722
1340
  body: await parseBody(output.body, context),
1723
1341
  };
1724
- let response;
1725
1342
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1726
1343
  switch (errorCode) {
1727
1344
  case "AccessDeniedException":
@@ -1735,33 +1352,29 @@ const deserializeAws_restJson1GetSessionCommandError = async (output, context) =
1735
1352
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1736
1353
  default:
1737
1354
  const parsedBody = parsedOutput.body;
1738
- const $metadata = deserializeMetadata(output);
1739
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1740
- response = new WisdomServiceException_1.WisdomServiceException({
1741
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1742
- $fault: "client",
1743
- $metadata,
1355
+ (0, smithy_client_1.throwDefaultError)({
1356
+ output,
1357
+ parsedBody,
1358
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1359
+ errorCode,
1744
1360
  });
1745
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1746
1361
  }
1747
1362
  };
1748
1363
  const deserializeAws_restJson1ListAssistantAssociationsCommand = async (output, context) => {
1749
1364
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1750
1365
  return deserializeAws_restJson1ListAssistantAssociationsCommandError(output, context);
1751
1366
  }
1752
- const contents = {
1367
+ const contents = map({
1753
1368
  $metadata: deserializeMetadata(output),
1754
- assistantAssociationSummaries: undefined,
1755
- nextToken: undefined,
1756
- };
1369
+ });
1757
1370
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1758
- if (data.assistantAssociationSummaries !== undefined && data.assistantAssociationSummaries !== null) {
1371
+ if (data.assistantAssociationSummaries != null) {
1759
1372
  contents.assistantAssociationSummaries = deserializeAws_restJson1AssistantAssociationSummaryList(data.assistantAssociationSummaries, context);
1760
1373
  }
1761
- if (data.nextToken !== undefined && data.nextToken !== null) {
1374
+ if (data.nextToken != null) {
1762
1375
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1763
1376
  }
1764
- return Promise.resolve(contents);
1377
+ return contents;
1765
1378
  };
1766
1379
  exports.deserializeAws_restJson1ListAssistantAssociationsCommand = deserializeAws_restJson1ListAssistantAssociationsCommand;
1767
1380
  const deserializeAws_restJson1ListAssistantAssociationsCommandError = async (output, context) => {
@@ -1769,7 +1382,6 @@ const deserializeAws_restJson1ListAssistantAssociationsCommandError = async (out
1769
1382
  ...output,
1770
1383
  body: await parseBody(output.body, context),
1771
1384
  };
1772
- let response;
1773
1385
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1774
1386
  switch (errorCode) {
1775
1387
  case "AccessDeniedException":
@@ -1783,33 +1395,29 @@ const deserializeAws_restJson1ListAssistantAssociationsCommandError = async (out
1783
1395
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1784
1396
  default:
1785
1397
  const parsedBody = parsedOutput.body;
1786
- const $metadata = deserializeMetadata(output);
1787
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1788
- response = new WisdomServiceException_1.WisdomServiceException({
1789
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1790
- $fault: "client",
1791
- $metadata,
1398
+ (0, smithy_client_1.throwDefaultError)({
1399
+ output,
1400
+ parsedBody,
1401
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1402
+ errorCode,
1792
1403
  });
1793
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1794
1404
  }
1795
1405
  };
1796
1406
  const deserializeAws_restJson1ListAssistantsCommand = async (output, context) => {
1797
1407
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1798
1408
  return deserializeAws_restJson1ListAssistantsCommandError(output, context);
1799
1409
  }
1800
- const contents = {
1410
+ const contents = map({
1801
1411
  $metadata: deserializeMetadata(output),
1802
- assistantSummaries: undefined,
1803
- nextToken: undefined,
1804
- };
1412
+ });
1805
1413
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1806
- if (data.assistantSummaries !== undefined && data.assistantSummaries !== null) {
1414
+ if (data.assistantSummaries != null) {
1807
1415
  contents.assistantSummaries = deserializeAws_restJson1AssistantList(data.assistantSummaries, context);
1808
1416
  }
1809
- if (data.nextToken !== undefined && data.nextToken !== null) {
1417
+ if (data.nextToken != null) {
1810
1418
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1811
1419
  }
1812
- return Promise.resolve(contents);
1420
+ return contents;
1813
1421
  };
1814
1422
  exports.deserializeAws_restJson1ListAssistantsCommand = deserializeAws_restJson1ListAssistantsCommand;
1815
1423
  const deserializeAws_restJson1ListAssistantsCommandError = async (output, context) => {
@@ -1817,7 +1425,6 @@ const deserializeAws_restJson1ListAssistantsCommandError = async (output, contex
1817
1425
  ...output,
1818
1426
  body: await parseBody(output.body, context),
1819
1427
  };
1820
- let response;
1821
1428
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1822
1429
  switch (errorCode) {
1823
1430
  case "AccessDeniedException":
@@ -1828,33 +1435,29 @@ const deserializeAws_restJson1ListAssistantsCommandError = async (output, contex
1828
1435
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1829
1436
  default:
1830
1437
  const parsedBody = parsedOutput.body;
1831
- const $metadata = deserializeMetadata(output);
1832
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1833
- response = new WisdomServiceException_1.WisdomServiceException({
1834
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1835
- $fault: "client",
1836
- $metadata,
1438
+ (0, smithy_client_1.throwDefaultError)({
1439
+ output,
1440
+ parsedBody,
1441
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1442
+ errorCode,
1837
1443
  });
1838
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1839
1444
  }
1840
1445
  };
1841
1446
  const deserializeAws_restJson1ListContentsCommand = async (output, context) => {
1842
1447
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1843
1448
  return deserializeAws_restJson1ListContentsCommandError(output, context);
1844
1449
  }
1845
- const contents = {
1450
+ const contents = map({
1846
1451
  $metadata: deserializeMetadata(output),
1847
- contentSummaries: undefined,
1848
- nextToken: undefined,
1849
- };
1452
+ });
1850
1453
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1851
- if (data.contentSummaries !== undefined && data.contentSummaries !== null) {
1454
+ if (data.contentSummaries != null) {
1852
1455
  contents.contentSummaries = deserializeAws_restJson1ContentSummaryList(data.contentSummaries, context);
1853
1456
  }
1854
- if (data.nextToken !== undefined && data.nextToken !== null) {
1457
+ if (data.nextToken != null) {
1855
1458
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1856
1459
  }
1857
- return Promise.resolve(contents);
1460
+ return contents;
1858
1461
  };
1859
1462
  exports.deserializeAws_restJson1ListContentsCommand = deserializeAws_restJson1ListContentsCommand;
1860
1463
  const deserializeAws_restJson1ListContentsCommandError = async (output, context) => {
@@ -1862,7 +1465,6 @@ const deserializeAws_restJson1ListContentsCommandError = async (output, context)
1862
1465
  ...output,
1863
1466
  body: await parseBody(output.body, context),
1864
1467
  };
1865
- let response;
1866
1468
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1867
1469
  switch (errorCode) {
1868
1470
  case "AccessDeniedException":
@@ -1876,33 +1478,29 @@ const deserializeAws_restJson1ListContentsCommandError = async (output, context)
1876
1478
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1877
1479
  default:
1878
1480
  const parsedBody = parsedOutput.body;
1879
- const $metadata = deserializeMetadata(output);
1880
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1881
- response = new WisdomServiceException_1.WisdomServiceException({
1882
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1883
- $fault: "client",
1884
- $metadata,
1481
+ (0, smithy_client_1.throwDefaultError)({
1482
+ output,
1483
+ parsedBody,
1484
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1485
+ errorCode,
1885
1486
  });
1886
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1887
1487
  }
1888
1488
  };
1889
1489
  const deserializeAws_restJson1ListKnowledgeBasesCommand = async (output, context) => {
1890
1490
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1891
1491
  return deserializeAws_restJson1ListKnowledgeBasesCommandError(output, context);
1892
1492
  }
1893
- const contents = {
1493
+ const contents = map({
1894
1494
  $metadata: deserializeMetadata(output),
1895
- knowledgeBaseSummaries: undefined,
1896
- nextToken: undefined,
1897
- };
1495
+ });
1898
1496
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1899
- if (data.knowledgeBaseSummaries !== undefined && data.knowledgeBaseSummaries !== null) {
1497
+ if (data.knowledgeBaseSummaries != null) {
1900
1498
  contents.knowledgeBaseSummaries = deserializeAws_restJson1KnowledgeBaseList(data.knowledgeBaseSummaries, context);
1901
1499
  }
1902
- if (data.nextToken !== undefined && data.nextToken !== null) {
1500
+ if (data.nextToken != null) {
1903
1501
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1904
1502
  }
1905
- return Promise.resolve(contents);
1503
+ return contents;
1906
1504
  };
1907
1505
  exports.deserializeAws_restJson1ListKnowledgeBasesCommand = deserializeAws_restJson1ListKnowledgeBasesCommand;
1908
1506
  const deserializeAws_restJson1ListKnowledgeBasesCommandError = async (output, context) => {
@@ -1910,7 +1508,6 @@ const deserializeAws_restJson1ListKnowledgeBasesCommandError = async (output, co
1910
1508
  ...output,
1911
1509
  body: await parseBody(output.body, context),
1912
1510
  };
1913
- let response;
1914
1511
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1915
1512
  switch (errorCode) {
1916
1513
  case "AccessDeniedException":
@@ -1921,29 +1518,26 @@ const deserializeAws_restJson1ListKnowledgeBasesCommandError = async (output, co
1921
1518
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1922
1519
  default:
1923
1520
  const parsedBody = parsedOutput.body;
1924
- const $metadata = deserializeMetadata(output);
1925
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1926
- response = new WisdomServiceException_1.WisdomServiceException({
1927
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1928
- $fault: "client",
1929
- $metadata,
1521
+ (0, smithy_client_1.throwDefaultError)({
1522
+ output,
1523
+ parsedBody,
1524
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1525
+ errorCode,
1930
1526
  });
1931
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1932
1527
  }
1933
1528
  };
1934
1529
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
1935
1530
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1936
1531
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
1937
1532
  }
1938
- const contents = {
1533
+ const contents = map({
1939
1534
  $metadata: deserializeMetadata(output),
1940
- tags: undefined,
1941
- };
1535
+ });
1942
1536
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1943
- if (data.tags !== undefined && data.tags !== null) {
1537
+ if (data.tags != null) {
1944
1538
  contents.tags = deserializeAws_restJson1Tags(data.tags, context);
1945
1539
  }
1946
- return Promise.resolve(contents);
1540
+ return contents;
1947
1541
  };
1948
1542
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
1949
1543
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -1951,7 +1545,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1951
1545
  ...output,
1952
1546
  body: await parseBody(output.body, context),
1953
1547
  };
1954
- let response;
1955
1548
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1956
1549
  switch (errorCode) {
1957
1550
  case "ResourceNotFoundException":
@@ -1959,33 +1552,29 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1959
1552
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1960
1553
  default:
1961
1554
  const parsedBody = parsedOutput.body;
1962
- const $metadata = deserializeMetadata(output);
1963
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1964
- response = new WisdomServiceException_1.WisdomServiceException({
1965
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1966
- $fault: "client",
1967
- $metadata,
1555
+ (0, smithy_client_1.throwDefaultError)({
1556
+ output,
1557
+ parsedBody,
1558
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1559
+ errorCode,
1968
1560
  });
1969
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1970
1561
  }
1971
1562
  };
1972
1563
  const deserializeAws_restJson1NotifyRecommendationsReceivedCommand = async (output, context) => {
1973
1564
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1974
1565
  return deserializeAws_restJson1NotifyRecommendationsReceivedCommandError(output, context);
1975
1566
  }
1976
- const contents = {
1567
+ const contents = map({
1977
1568
  $metadata: deserializeMetadata(output),
1978
- errors: undefined,
1979
- recommendationIds: undefined,
1980
- };
1569
+ });
1981
1570
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1982
- if (data.errors !== undefined && data.errors !== null) {
1571
+ if (data.errors != null) {
1983
1572
  contents.errors = deserializeAws_restJson1NotifyRecommendationsReceivedErrorList(data.errors, context);
1984
1573
  }
1985
- if (data.recommendationIds !== undefined && data.recommendationIds !== null) {
1574
+ if (data.recommendationIds != null) {
1986
1575
  contents.recommendationIds = deserializeAws_restJson1RecommendationIdList(data.recommendationIds, context);
1987
1576
  }
1988
- return Promise.resolve(contents);
1577
+ return contents;
1989
1578
  };
1990
1579
  exports.deserializeAws_restJson1NotifyRecommendationsReceivedCommand = deserializeAws_restJson1NotifyRecommendationsReceivedCommand;
1991
1580
  const deserializeAws_restJson1NotifyRecommendationsReceivedCommandError = async (output, context) => {
@@ -1993,7 +1582,6 @@ const deserializeAws_restJson1NotifyRecommendationsReceivedCommandError = async
1993
1582
  ...output,
1994
1583
  body: await parseBody(output.body, context),
1995
1584
  };
1996
- let response;
1997
1585
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1998
1586
  switch (errorCode) {
1999
1587
  case "AccessDeniedException":
@@ -2007,33 +1595,29 @@ const deserializeAws_restJson1NotifyRecommendationsReceivedCommandError = async
2007
1595
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2008
1596
  default:
2009
1597
  const parsedBody = parsedOutput.body;
2010
- const $metadata = deserializeMetadata(output);
2011
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2012
- response = new WisdomServiceException_1.WisdomServiceException({
2013
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2014
- $fault: "client",
2015
- $metadata,
1598
+ (0, smithy_client_1.throwDefaultError)({
1599
+ output,
1600
+ parsedBody,
1601
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1602
+ errorCode,
2016
1603
  });
2017
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2018
1604
  }
2019
1605
  };
2020
1606
  const deserializeAws_restJson1QueryAssistantCommand = async (output, context) => {
2021
1607
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2022
1608
  return deserializeAws_restJson1QueryAssistantCommandError(output, context);
2023
1609
  }
2024
- const contents = {
1610
+ const contents = map({
2025
1611
  $metadata: deserializeMetadata(output),
2026
- nextToken: undefined,
2027
- results: undefined,
2028
- };
1612
+ });
2029
1613
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2030
- if (data.nextToken !== undefined && data.nextToken !== null) {
1614
+ if (data.nextToken != null) {
2031
1615
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2032
1616
  }
2033
- if (data.results !== undefined && data.results !== null) {
1617
+ if (data.results != null) {
2034
1618
  contents.results = deserializeAws_restJson1QueryResultsList(data.results, context);
2035
1619
  }
2036
- return Promise.resolve(contents);
1620
+ return contents;
2037
1621
  };
2038
1622
  exports.deserializeAws_restJson1QueryAssistantCommand = deserializeAws_restJson1QueryAssistantCommand;
2039
1623
  const deserializeAws_restJson1QueryAssistantCommandError = async (output, context) => {
@@ -2041,7 +1625,6 @@ const deserializeAws_restJson1QueryAssistantCommandError = async (output, contex
2041
1625
  ...output,
2042
1626
  body: await parseBody(output.body, context),
2043
1627
  };
2044
- let response;
2045
1628
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2046
1629
  switch (errorCode) {
2047
1630
  case "AccessDeniedException":
@@ -2055,25 +1638,23 @@ const deserializeAws_restJson1QueryAssistantCommandError = async (output, contex
2055
1638
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2056
1639
  default:
2057
1640
  const parsedBody = parsedOutput.body;
2058
- const $metadata = deserializeMetadata(output);
2059
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2060
- response = new WisdomServiceException_1.WisdomServiceException({
2061
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2062
- $fault: "client",
2063
- $metadata,
1641
+ (0, smithy_client_1.throwDefaultError)({
1642
+ output,
1643
+ parsedBody,
1644
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1645
+ errorCode,
2064
1646
  });
2065
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2066
1647
  }
2067
1648
  };
2068
1649
  const deserializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommand = async (output, context) => {
2069
1650
  if (output.statusCode !== 204 && output.statusCode >= 300) {
2070
1651
  return deserializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommandError(output, context);
2071
1652
  }
2072
- const contents = {
1653
+ const contents = map({
2073
1654
  $metadata: deserializeMetadata(output),
2074
- };
1655
+ });
2075
1656
  await collectBody(output.body, context);
2076
- return Promise.resolve(contents);
1657
+ return contents;
2077
1658
  };
2078
1659
  exports.deserializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommand = deserializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommand;
2079
1660
  const deserializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommandError = async (output, context) => {
@@ -2081,7 +1662,6 @@ const deserializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommandError = async
2081
1662
  ...output,
2082
1663
  body: await parseBody(output.body, context),
2083
1664
  };
2084
- let response;
2085
1665
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2086
1666
  switch (errorCode) {
2087
1667
  case "AccessDeniedException":
@@ -2095,33 +1675,29 @@ const deserializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommandError = async
2095
1675
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2096
1676
  default:
2097
1677
  const parsedBody = parsedOutput.body;
2098
- const $metadata = deserializeMetadata(output);
2099
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2100
- response = new WisdomServiceException_1.WisdomServiceException({
2101
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2102
- $fault: "client",
2103
- $metadata,
1678
+ (0, smithy_client_1.throwDefaultError)({
1679
+ output,
1680
+ parsedBody,
1681
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1682
+ errorCode,
2104
1683
  });
2105
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2106
1684
  }
2107
1685
  };
2108
1686
  const deserializeAws_restJson1SearchContentCommand = async (output, context) => {
2109
1687
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2110
1688
  return deserializeAws_restJson1SearchContentCommandError(output, context);
2111
1689
  }
2112
- const contents = {
1690
+ const contents = map({
2113
1691
  $metadata: deserializeMetadata(output),
2114
- contentSummaries: undefined,
2115
- nextToken: undefined,
2116
- };
1692
+ });
2117
1693
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2118
- if (data.contentSummaries !== undefined && data.contentSummaries !== null) {
1694
+ if (data.contentSummaries != null) {
2119
1695
  contents.contentSummaries = deserializeAws_restJson1ContentSummaryList(data.contentSummaries, context);
2120
1696
  }
2121
- if (data.nextToken !== undefined && data.nextToken !== null) {
1697
+ if (data.nextToken != null) {
2122
1698
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2123
1699
  }
2124
- return Promise.resolve(contents);
1700
+ return contents;
2125
1701
  };
2126
1702
  exports.deserializeAws_restJson1SearchContentCommand = deserializeAws_restJson1SearchContentCommand;
2127
1703
  const deserializeAws_restJson1SearchContentCommandError = async (output, context) => {
@@ -2129,7 +1705,6 @@ const deserializeAws_restJson1SearchContentCommandError = async (output, context
2129
1705
  ...output,
2130
1706
  body: await parseBody(output.body, context),
2131
1707
  };
2132
- let response;
2133
1708
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2134
1709
  switch (errorCode) {
2135
1710
  case "AccessDeniedException":
@@ -2143,33 +1718,29 @@ const deserializeAws_restJson1SearchContentCommandError = async (output, context
2143
1718
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2144
1719
  default:
2145
1720
  const parsedBody = parsedOutput.body;
2146
- const $metadata = deserializeMetadata(output);
2147
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2148
- response = new WisdomServiceException_1.WisdomServiceException({
2149
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2150
- $fault: "client",
2151
- $metadata,
1721
+ (0, smithy_client_1.throwDefaultError)({
1722
+ output,
1723
+ parsedBody,
1724
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1725
+ errorCode,
2152
1726
  });
2153
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2154
1727
  }
2155
1728
  };
2156
1729
  const deserializeAws_restJson1SearchSessionsCommand = async (output, context) => {
2157
1730
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2158
1731
  return deserializeAws_restJson1SearchSessionsCommandError(output, context);
2159
1732
  }
2160
- const contents = {
1733
+ const contents = map({
2161
1734
  $metadata: deserializeMetadata(output),
2162
- nextToken: undefined,
2163
- sessionSummaries: undefined,
2164
- };
1735
+ });
2165
1736
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2166
- if (data.nextToken !== undefined && data.nextToken !== null) {
1737
+ if (data.nextToken != null) {
2167
1738
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2168
1739
  }
2169
- if (data.sessionSummaries !== undefined && data.sessionSummaries !== null) {
1740
+ if (data.sessionSummaries != null) {
2170
1741
  contents.sessionSummaries = deserializeAws_restJson1SessionSummaries(data.sessionSummaries, context);
2171
1742
  }
2172
- return Promise.resolve(contents);
1743
+ return contents;
2173
1744
  };
2174
1745
  exports.deserializeAws_restJson1SearchSessionsCommand = deserializeAws_restJson1SearchSessionsCommand;
2175
1746
  const deserializeAws_restJson1SearchSessionsCommandError = async (output, context) => {
@@ -2177,7 +1748,6 @@ const deserializeAws_restJson1SearchSessionsCommandError = async (output, contex
2177
1748
  ...output,
2178
1749
  body: await parseBody(output.body, context),
2179
1750
  };
2180
- let response;
2181
1751
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2182
1752
  switch (errorCode) {
2183
1753
  case "AccessDeniedException":
@@ -2191,41 +1761,35 @@ const deserializeAws_restJson1SearchSessionsCommandError = async (output, contex
2191
1761
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2192
1762
  default:
2193
1763
  const parsedBody = parsedOutput.body;
2194
- const $metadata = deserializeMetadata(output);
2195
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2196
- response = new WisdomServiceException_1.WisdomServiceException({
2197
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2198
- $fault: "client",
2199
- $metadata,
1764
+ (0, smithy_client_1.throwDefaultError)({
1765
+ output,
1766
+ parsedBody,
1767
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1768
+ errorCode,
2200
1769
  });
2201
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2202
1770
  }
2203
1771
  };
2204
1772
  const deserializeAws_restJson1StartContentUploadCommand = async (output, context) => {
2205
1773
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2206
1774
  return deserializeAws_restJson1StartContentUploadCommandError(output, context);
2207
1775
  }
2208
- const contents = {
1776
+ const contents = map({
2209
1777
  $metadata: deserializeMetadata(output),
2210
- headersToInclude: undefined,
2211
- uploadId: undefined,
2212
- url: undefined,
2213
- urlExpiry: undefined,
2214
- };
1778
+ });
2215
1779
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2216
- if (data.headersToInclude !== undefined && data.headersToInclude !== null) {
1780
+ if (data.headersToInclude != null) {
2217
1781
  contents.headersToInclude = deserializeAws_restJson1Headers(data.headersToInclude, context);
2218
1782
  }
2219
- if (data.uploadId !== undefined && data.uploadId !== null) {
1783
+ if (data.uploadId != null) {
2220
1784
  contents.uploadId = (0, smithy_client_1.expectString)(data.uploadId);
2221
1785
  }
2222
- if (data.url !== undefined && data.url !== null) {
1786
+ if (data.url != null) {
2223
1787
  contents.url = (0, smithy_client_1.expectString)(data.url);
2224
1788
  }
2225
- if (data.urlExpiry !== undefined && data.urlExpiry !== null) {
1789
+ if (data.urlExpiry != null) {
2226
1790
  contents.urlExpiry = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.urlExpiry)));
2227
1791
  }
2228
- return Promise.resolve(contents);
1792
+ return contents;
2229
1793
  };
2230
1794
  exports.deserializeAws_restJson1StartContentUploadCommand = deserializeAws_restJson1StartContentUploadCommand;
2231
1795
  const deserializeAws_restJson1StartContentUploadCommandError = async (output, context) => {
@@ -2233,7 +1797,6 @@ const deserializeAws_restJson1StartContentUploadCommandError = async (output, co
2233
1797
  ...output,
2234
1798
  body: await parseBody(output.body, context),
2235
1799
  };
2236
- let response;
2237
1800
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2238
1801
  switch (errorCode) {
2239
1802
  case "AccessDeniedException":
@@ -2247,25 +1810,23 @@ const deserializeAws_restJson1StartContentUploadCommandError = async (output, co
2247
1810
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2248
1811
  default:
2249
1812
  const parsedBody = parsedOutput.body;
2250
- const $metadata = deserializeMetadata(output);
2251
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2252
- response = new WisdomServiceException_1.WisdomServiceException({
2253
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2254
- $fault: "client",
2255
- $metadata,
1813
+ (0, smithy_client_1.throwDefaultError)({
1814
+ output,
1815
+ parsedBody,
1816
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1817
+ errorCode,
2256
1818
  });
2257
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2258
1819
  }
2259
1820
  };
2260
1821
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
2261
1822
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2262
1823
  return deserializeAws_restJson1TagResourceCommandError(output, context);
2263
1824
  }
2264
- const contents = {
1825
+ const contents = map({
2265
1826
  $metadata: deserializeMetadata(output),
2266
- };
1827
+ });
2267
1828
  await collectBody(output.body, context);
2268
- return Promise.resolve(contents);
1829
+ return contents;
2269
1830
  };
2270
1831
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
2271
1832
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -2273,7 +1834,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2273
1834
  ...output,
2274
1835
  body: await parseBody(output.body, context),
2275
1836
  };
2276
- let response;
2277
1837
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2278
1838
  switch (errorCode) {
2279
1839
  case "ResourceNotFoundException":
@@ -2284,25 +1844,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2284
1844
  throw await deserializeAws_restJson1TooManyTagsExceptionResponse(parsedOutput, context);
2285
1845
  default:
2286
1846
  const parsedBody = parsedOutput.body;
2287
- const $metadata = deserializeMetadata(output);
2288
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2289
- response = new WisdomServiceException_1.WisdomServiceException({
2290
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2291
- $fault: "client",
2292
- $metadata,
1847
+ (0, smithy_client_1.throwDefaultError)({
1848
+ output,
1849
+ parsedBody,
1850
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1851
+ errorCode,
2293
1852
  });
2294
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2295
1853
  }
2296
1854
  };
2297
1855
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
2298
1856
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2299
1857
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
2300
1858
  }
2301
- const contents = {
1859
+ const contents = map({
2302
1860
  $metadata: deserializeMetadata(output),
2303
- };
1861
+ });
2304
1862
  await collectBody(output.body, context);
2305
- return Promise.resolve(contents);
1863
+ return contents;
2306
1864
  };
2307
1865
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
2308
1866
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -2310,7 +1868,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
2310
1868
  ...output,
2311
1869
  body: await parseBody(output.body, context),
2312
1870
  };
2313
- let response;
2314
1871
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2315
1872
  switch (errorCode) {
2316
1873
  case "ResourceNotFoundException":
@@ -2318,29 +1875,26 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
2318
1875
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2319
1876
  default:
2320
1877
  const parsedBody = parsedOutput.body;
2321
- const $metadata = deserializeMetadata(output);
2322
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2323
- response = new WisdomServiceException_1.WisdomServiceException({
2324
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2325
- $fault: "client",
2326
- $metadata,
1878
+ (0, smithy_client_1.throwDefaultError)({
1879
+ output,
1880
+ parsedBody,
1881
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1882
+ errorCode,
2327
1883
  });
2328
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2329
1884
  }
2330
1885
  };
2331
1886
  const deserializeAws_restJson1UpdateContentCommand = async (output, context) => {
2332
1887
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2333
1888
  return deserializeAws_restJson1UpdateContentCommandError(output, context);
2334
1889
  }
2335
- const contents = {
1890
+ const contents = map({
2336
1891
  $metadata: deserializeMetadata(output),
2337
- content: undefined,
2338
- };
1892
+ });
2339
1893
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2340
- if (data.content !== undefined && data.content !== null) {
1894
+ if (data.content != null) {
2341
1895
  contents.content = deserializeAws_restJson1ContentData(data.content, context);
2342
1896
  }
2343
- return Promise.resolve(contents);
1897
+ return contents;
2344
1898
  };
2345
1899
  exports.deserializeAws_restJson1UpdateContentCommand = deserializeAws_restJson1UpdateContentCommand;
2346
1900
  const deserializeAws_restJson1UpdateContentCommandError = async (output, context) => {
@@ -2348,7 +1902,6 @@ const deserializeAws_restJson1UpdateContentCommandError = async (output, context
2348
1902
  ...output,
2349
1903
  body: await parseBody(output.body, context),
2350
1904
  };
2351
- let response;
2352
1905
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2353
1906
  switch (errorCode) {
2354
1907
  case "AccessDeniedException":
@@ -2365,29 +1918,26 @@ const deserializeAws_restJson1UpdateContentCommandError = async (output, context
2365
1918
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2366
1919
  default:
2367
1920
  const parsedBody = parsedOutput.body;
2368
- const $metadata = deserializeMetadata(output);
2369
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2370
- response = new WisdomServiceException_1.WisdomServiceException({
2371
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2372
- $fault: "client",
2373
- $metadata,
1921
+ (0, smithy_client_1.throwDefaultError)({
1922
+ output,
1923
+ parsedBody,
1924
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1925
+ errorCode,
2374
1926
  });
2375
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2376
1927
  }
2377
1928
  };
2378
1929
  const deserializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommand = async (output, context) => {
2379
1930
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2380
1931
  return deserializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommandError(output, context);
2381
1932
  }
2382
- const contents = {
1933
+ const contents = map({
2383
1934
  $metadata: deserializeMetadata(output),
2384
- knowledgeBase: undefined,
2385
- };
1935
+ });
2386
1936
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2387
- if (data.knowledgeBase !== undefined && data.knowledgeBase !== null) {
1937
+ if (data.knowledgeBase != null) {
2388
1938
  contents.knowledgeBase = deserializeAws_restJson1KnowledgeBaseData(data.knowledgeBase, context);
2389
1939
  }
2390
- return Promise.resolve(contents);
1940
+ return contents;
2391
1941
  };
2392
1942
  exports.deserializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommand = deserializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommand;
2393
1943
  const deserializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommandError = async (output, context) => {
@@ -2395,7 +1945,6 @@ const deserializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommandError = async
2395
1945
  ...output,
2396
1946
  body: await parseBody(output.body, context),
2397
1947
  };
2398
- let response;
2399
1948
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2400
1949
  switch (errorCode) {
2401
1950
  case "AccessDeniedException":
@@ -2409,20 +1958,19 @@ const deserializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommandError = async
2409
1958
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2410
1959
  default:
2411
1960
  const parsedBody = parsedOutput.body;
2412
- const $metadata = deserializeMetadata(output);
2413
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2414
- response = new WisdomServiceException_1.WisdomServiceException({
2415
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2416
- $fault: "client",
2417
- $metadata,
1961
+ (0, smithy_client_1.throwDefaultError)({
1962
+ output,
1963
+ parsedBody,
1964
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1965
+ errorCode,
2418
1966
  });
2419
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2420
1967
  }
2421
1968
  };
1969
+ const map = smithy_client_1.map;
2422
1970
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
2423
- const contents = {};
1971
+ const contents = map({});
2424
1972
  const data = parsedOutput.body;
2425
- if (data.message !== undefined && data.message !== null) {
1973
+ if (data.message != null) {
2426
1974
  contents.message = (0, smithy_client_1.expectString)(data.message);
2427
1975
  }
2428
1976
  const exception = new models_0_1.AccessDeniedException({
@@ -2432,9 +1980,9 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
2432
1980
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2433
1981
  };
2434
1982
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
2435
- const contents = {};
1983
+ const contents = map({});
2436
1984
  const data = parsedOutput.body;
2437
- if (data.message !== undefined && data.message !== null) {
1985
+ if (data.message != null) {
2438
1986
  contents.message = (0, smithy_client_1.expectString)(data.message);
2439
1987
  }
2440
1988
  const exception = new models_0_1.ConflictException({
@@ -2444,9 +1992,9 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
2444
1992
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2445
1993
  };
2446
1994
  const deserializeAws_restJson1PreconditionFailedExceptionResponse = async (parsedOutput, context) => {
2447
- const contents = {};
1995
+ const contents = map({});
2448
1996
  const data = parsedOutput.body;
2449
- if (data.message !== undefined && data.message !== null) {
1997
+ if (data.message != null) {
2450
1998
  contents.message = (0, smithy_client_1.expectString)(data.message);
2451
1999
  }
2452
2000
  const exception = new models_0_1.PreconditionFailedException({
@@ -2456,12 +2004,12 @@ const deserializeAws_restJson1PreconditionFailedExceptionResponse = async (parse
2456
2004
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2457
2005
  };
2458
2006
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
2459
- const contents = {};
2007
+ const contents = map({});
2460
2008
  const data = parsedOutput.body;
2461
- if (data.message !== undefined && data.message !== null) {
2009
+ if (data.message != null) {
2462
2010
  contents.message = (0, smithy_client_1.expectString)(data.message);
2463
2011
  }
2464
- if (data.resourceName !== undefined && data.resourceName !== null) {
2012
+ if (data.resourceName != null) {
2465
2013
  contents.resourceName = (0, smithy_client_1.expectString)(data.resourceName);
2466
2014
  }
2467
2015
  const exception = new models_0_1.ResourceNotFoundException({
@@ -2471,9 +2019,9 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
2471
2019
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2472
2020
  };
2473
2021
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
2474
- const contents = {};
2022
+ const contents = map({});
2475
2023
  const data = parsedOutput.body;
2476
- if (data.message !== undefined && data.message !== null) {
2024
+ if (data.message != null) {
2477
2025
  contents.message = (0, smithy_client_1.expectString)(data.message);
2478
2026
  }
2479
2027
  const exception = new models_0_1.ServiceQuotaExceededException({
@@ -2483,12 +2031,12 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
2483
2031
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2484
2032
  };
2485
2033
  const deserializeAws_restJson1TooManyTagsExceptionResponse = async (parsedOutput, context) => {
2486
- const contents = {};
2034
+ const contents = map({});
2487
2035
  const data = parsedOutput.body;
2488
- if (data.message !== undefined && data.message !== null) {
2036
+ if (data.message != null) {
2489
2037
  contents.message = (0, smithy_client_1.expectString)(data.message);
2490
2038
  }
2491
- if (data.resourceName !== undefined && data.resourceName !== null) {
2039
+ if (data.resourceName != null) {
2492
2040
  contents.resourceName = (0, smithy_client_1.expectString)(data.resourceName);
2493
2041
  }
2494
2042
  const exception = new models_0_1.TooManyTagsException({
@@ -2498,9 +2046,9 @@ const deserializeAws_restJson1TooManyTagsExceptionResponse = async (parsedOutput
2498
2046
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2499
2047
  };
2500
2048
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
2501
- const contents = {};
2049
+ const contents = map({});
2502
2050
  const data = parsedOutput.body;
2503
- if (data.message !== undefined && data.message !== null) {
2051
+ if (data.message != null) {
2504
2052
  contents.message = (0, smithy_client_1.expectString)(data.message);
2505
2053
  }
2506
2054
  const exception = new models_0_1.ValidationException({
@@ -2545,9 +2093,6 @@ const serializeAws_restJson1FilterList = (input, context) => {
2545
2093
  return input
2546
2094
  .filter((e) => e != null)
2547
2095
  .map((entry) => {
2548
- if (entry === null) {
2549
- return null;
2550
- }
2551
2096
  return serializeAws_restJson1Filter(entry, context);
2552
2097
  });
2553
2098
  };
@@ -2555,9 +2100,6 @@ const serializeAws_restJson1ObjectFieldsList = (input, context) => {
2555
2100
  return input
2556
2101
  .filter((e) => e != null)
2557
2102
  .map((entry) => {
2558
- if (entry === null) {
2559
- return null;
2560
- }
2561
2103
  return entry;
2562
2104
  });
2563
2105
  };
@@ -2565,9 +2107,6 @@ const serializeAws_restJson1RecommendationIdList = (input, context) => {
2565
2107
  return input
2566
2108
  .filter((e) => e != null)
2567
2109
  .map((entry) => {
2568
- if (entry === null) {
2569
- return null;
2570
- }
2571
2110
  return entry;
2572
2111
  });
2573
2112
  };
@@ -2625,7 +2164,7 @@ const deserializeAws_restJson1AssistantAssociationData = (output, context) => {
2625
2164
  };
2626
2165
  };
2627
2166
  const deserializeAws_restJson1AssistantAssociationOutputData = (output, context) => {
2628
- if (output.knowledgeBaseAssociation !== undefined && output.knowledgeBaseAssociation !== null) {
2167
+ if (output.knowledgeBaseAssociation != null) {
2629
2168
  return {
2630
2169
  knowledgeBaseAssociation: deserializeAws_restJson1KnowledgeBaseAssociationData(output.knowledgeBaseAssociation, context),
2631
2170
  };
@@ -2950,7 +2489,7 @@ const deserializeAws_restJson1RecommendationTrigger = (output, context) => {
2950
2489
  };
2951
2490
  };
2952
2491
  const deserializeAws_restJson1RecommendationTriggerData = (output, context) => {
2953
- if (output.query !== undefined && output.query !== null) {
2492
+ if (output.query != null) {
2954
2493
  return {
2955
2494
  query: deserializeAws_restJson1QueryRecommendationTriggerData(output.query, context),
2956
2495
  };
@@ -3014,7 +2553,7 @@ const deserializeAws_restJson1SessionSummary = (output, context) => {
3014
2553
  };
3015
2554
  };
3016
2555
  const deserializeAws_restJson1SourceConfiguration = (output, context) => {
3017
- if (output.appIntegrations !== undefined && output.appIntegrations !== null) {
2556
+ if (output.appIntegrations != null) {
3018
2557
  return {
3019
2558
  appIntegrations: deserializeAws_restJson1AppIntegrationsConfiguration(output.appIntegrations, context),
3020
2559
  };