@aws-sdk/client-wisdom 3.141.0 → 3.150.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deserializeAws_restJson1ListContentsCommand = exports.deserializeAws_restJson1ListAssistantsCommand = exports.deserializeAws_restJson1ListAssistantAssociationsCommand = exports.deserializeAws_restJson1GetSessionCommand = exports.deserializeAws_restJson1GetRecommendationsCommand = exports.deserializeAws_restJson1GetKnowledgeBaseCommand = exports.deserializeAws_restJson1GetContentSummaryCommand = exports.deserializeAws_restJson1GetContentCommand = exports.deserializeAws_restJson1GetAssistantAssociationCommand = exports.deserializeAws_restJson1GetAssistantCommand = exports.deserializeAws_restJson1DeleteKnowledgeBaseCommand = exports.deserializeAws_restJson1DeleteContentCommand = exports.deserializeAws_restJson1DeleteAssistantAssociationCommand = exports.deserializeAws_restJson1DeleteAssistantCommand = exports.deserializeAws_restJson1CreateSessionCommand = exports.deserializeAws_restJson1CreateKnowledgeBaseCommand = exports.deserializeAws_restJson1CreateContentCommand = exports.deserializeAws_restJson1CreateAssistantAssociationCommand = exports.deserializeAws_restJson1CreateAssistantCommand = exports.serializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommand = exports.serializeAws_restJson1UpdateContentCommand = exports.serializeAws_restJson1UntagResourceCommand = exports.serializeAws_restJson1TagResourceCommand = exports.serializeAws_restJson1StartContentUploadCommand = exports.serializeAws_restJson1SearchSessionsCommand = exports.serializeAws_restJson1SearchContentCommand = exports.serializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommand = exports.serializeAws_restJson1QueryAssistantCommand = exports.serializeAws_restJson1NotifyRecommendationsReceivedCommand = exports.serializeAws_restJson1ListTagsForResourceCommand = exports.serializeAws_restJson1ListKnowledgeBasesCommand = exports.serializeAws_restJson1ListContentsCommand = exports.serializeAws_restJson1ListAssistantsCommand = exports.serializeAws_restJson1ListAssistantAssociationsCommand = exports.serializeAws_restJson1GetSessionCommand = exports.serializeAws_restJson1GetRecommendationsCommand = exports.serializeAws_restJson1GetKnowledgeBaseCommand = exports.serializeAws_restJson1GetContentSummaryCommand = exports.serializeAws_restJson1GetContentCommand = exports.serializeAws_restJson1GetAssistantAssociationCommand = exports.serializeAws_restJson1GetAssistantCommand = exports.serializeAws_restJson1DeleteKnowledgeBaseCommand = exports.serializeAws_restJson1DeleteContentCommand = exports.serializeAws_restJson1DeleteAssistantAssociationCommand = exports.serializeAws_restJson1DeleteAssistantCommand = exports.serializeAws_restJson1CreateSessionCommand = exports.serializeAws_restJson1CreateKnowledgeBaseCommand = exports.serializeAws_restJson1CreateContentCommand = exports.serializeAws_restJson1CreateAssistantAssociationCommand = exports.serializeAws_restJson1CreateAssistantCommand = void 0;
4
- exports.deserializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommand = exports.deserializeAws_restJson1UpdateContentCommand = exports.deserializeAws_restJson1UntagResourceCommand = exports.deserializeAws_restJson1TagResourceCommand = exports.deserializeAws_restJson1StartContentUploadCommand = exports.deserializeAws_restJson1SearchSessionsCommand = exports.deserializeAws_restJson1SearchContentCommand = exports.deserializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommand = exports.deserializeAws_restJson1QueryAssistantCommand = exports.deserializeAws_restJson1NotifyRecommendationsReceivedCommand = exports.deserializeAws_restJson1ListTagsForResourceCommand = exports.deserializeAws_restJson1ListKnowledgeBasesCommand = void 0;
3
+ exports.deserializeAws_restJson1ListAssistantsCommand = exports.deserializeAws_restJson1ListAssistantAssociationsCommand = exports.deserializeAws_restJson1GetSessionCommand = exports.deserializeAws_restJson1GetRecommendationsCommand = exports.deserializeAws_restJson1GetKnowledgeBaseCommand = exports.deserializeAws_restJson1GetContentSummaryCommand = exports.deserializeAws_restJson1GetContentCommand = exports.deserializeAws_restJson1GetAssistantAssociationCommand = exports.deserializeAws_restJson1GetAssistantCommand = exports.deserializeAws_restJson1DeleteKnowledgeBaseCommand = exports.deserializeAws_restJson1DeleteContentCommand = exports.deserializeAws_restJson1DeleteAssistantAssociationCommand = exports.deserializeAws_restJson1DeleteAssistantCommand = exports.deserializeAws_restJson1CreateSessionCommand = exports.deserializeAws_restJson1CreateKnowledgeBaseCommand = exports.deserializeAws_restJson1CreateContentCommand = exports.deserializeAws_restJson1CreateAssistantAssociationCommand = exports.deserializeAws_restJson1CreateAssistantCommand = exports.serializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommand = exports.serializeAws_restJson1UpdateContentCommand = exports.serializeAws_restJson1UntagResourceCommand = exports.serializeAws_restJson1TagResourceCommand = exports.serializeAws_restJson1StartContentUploadCommand = exports.serializeAws_restJson1SearchSessionsCommand = exports.serializeAws_restJson1SearchContentCommand = exports.serializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommand = exports.serializeAws_restJson1QueryAssistantCommand = exports.serializeAws_restJson1PutFeedbackCommand = exports.serializeAws_restJson1NotifyRecommendationsReceivedCommand = exports.serializeAws_restJson1ListTagsForResourceCommand = exports.serializeAws_restJson1ListKnowledgeBasesCommand = exports.serializeAws_restJson1ListContentsCommand = exports.serializeAws_restJson1ListAssistantsCommand = exports.serializeAws_restJson1ListAssistantAssociationsCommand = exports.serializeAws_restJson1GetSessionCommand = exports.serializeAws_restJson1GetRecommendationsCommand = exports.serializeAws_restJson1GetKnowledgeBaseCommand = exports.serializeAws_restJson1GetContentSummaryCommand = exports.serializeAws_restJson1GetContentCommand = exports.serializeAws_restJson1GetAssistantAssociationCommand = exports.serializeAws_restJson1GetAssistantCommand = exports.serializeAws_restJson1DeleteKnowledgeBaseCommand = exports.serializeAws_restJson1DeleteContentCommand = exports.serializeAws_restJson1DeleteAssistantAssociationCommand = exports.serializeAws_restJson1DeleteAssistantCommand = exports.serializeAws_restJson1CreateSessionCommand = exports.serializeAws_restJson1CreateKnowledgeBaseCommand = exports.serializeAws_restJson1CreateContentCommand = exports.serializeAws_restJson1CreateAssistantAssociationCommand = exports.serializeAws_restJson1CreateAssistantCommand = void 0;
4
+ exports.deserializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommand = exports.deserializeAws_restJson1UpdateContentCommand = exports.deserializeAws_restJson1UntagResourceCommand = exports.deserializeAws_restJson1TagResourceCommand = exports.deserializeAws_restJson1StartContentUploadCommand = exports.deserializeAws_restJson1SearchSessionsCommand = exports.deserializeAws_restJson1SearchContentCommand = exports.deserializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommand = exports.deserializeAws_restJson1QueryAssistantCommand = exports.deserializeAws_restJson1PutFeedbackCommand = exports.deserializeAws_restJson1NotifyRecommendationsReceivedCommand = exports.deserializeAws_restJson1ListTagsForResourceCommand = exports.deserializeAws_restJson1ListKnowledgeBasesCommand = exports.deserializeAws_restJson1ListContentsCommand = void 0;
5
5
  const protocol_http_1 = require("@aws-sdk/protocol-http");
6
6
  const smithy_client_1 = require("@aws-sdk/smithy-client");
7
7
  const uuid_1 = require("uuid");
@@ -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 && {
@@ -725,22 +491,37 @@ const serializeAws_restJson1NotifyRecommendationsReceivedCommand = async (input,
725
491
  });
726
492
  };
727
493
  exports.serializeAws_restJson1NotifyRecommendationsReceivedCommand = serializeAws_restJson1NotifyRecommendationsReceivedCommand;
494
+ const serializeAws_restJson1PutFeedbackCommand = async (input, context) => {
495
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
496
+ const headers = {
497
+ "content-type": "application/json",
498
+ };
499
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/assistants/{assistantId}/feedback";
500
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "assistantId", () => input.assistantId, "{assistantId}", false);
501
+ let body;
502
+ body = JSON.stringify({
503
+ ...(input.feedback != null && { feedback: serializeAws_restJson1FeedbackData(input.feedback, context) }),
504
+ ...(input.targetId != null && { targetId: input.targetId }),
505
+ ...(input.targetType != null && { targetType: input.targetType }),
506
+ });
507
+ return new protocol_http_1.HttpRequest({
508
+ protocol,
509
+ hostname,
510
+ port,
511
+ method: "PUT",
512
+ headers,
513
+ path: resolvedPath,
514
+ body,
515
+ });
516
+ };
517
+ exports.serializeAws_restJson1PutFeedbackCommand = serializeAws_restJson1PutFeedbackCommand;
728
518
  const serializeAws_restJson1QueryAssistantCommand = async (input, context) => {
729
519
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
730
520
  const headers = {
731
521
  "content-type": "application/json",
732
522
  };
733
523
  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
- }
524
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "assistantId", () => input.assistantId, "{assistantId}", false);
744
525
  let body;
745
526
  body = JSON.stringify({
746
527
  ...(input.maxResults != null && { maxResults: input.maxResults }),
@@ -763,16 +544,7 @@ const serializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommand = async (input
763
544
  const headers = {};
764
545
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
765
546
  "/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
- }
547
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "knowledgeBaseId", () => input.knowledgeBaseId, "{knowledgeBaseId}", false);
776
548
  let body;
777
549
  return new protocol_http_1.HttpRequest({
778
550
  protocol,
@@ -791,20 +563,11 @@ const serializeAws_restJson1SearchContentCommand = async (input, context) => {
791
563
  "content-type": "application/json",
792
564
  };
793
565
  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
- };
566
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "knowledgeBaseId", () => input.knowledgeBaseId, "{knowledgeBaseId}", false);
567
+ const query = map({
568
+ nextToken: [, input.nextToken],
569
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
570
+ });
808
571
  let body;
809
572
  body = JSON.stringify({
810
573
  ...(input.searchExpression != null && {
@@ -829,20 +592,11 @@ const serializeAws_restJson1SearchSessionsCommand = async (input, context) => {
829
592
  "content-type": "application/json",
830
593
  };
831
594
  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
- };
595
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "assistantId", () => input.assistantId, "{assistantId}", false);
596
+ const query = map({
597
+ nextToken: [, input.nextToken],
598
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
599
+ });
846
600
  let body;
847
601
  body = JSON.stringify({
848
602
  ...(input.searchExpression != null && {
@@ -867,16 +621,7 @@ const serializeAws_restJson1StartContentUploadCommand = async (input, context) =
867
621
  "content-type": "application/json",
868
622
  };
869
623
  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
- }
624
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "knowledgeBaseId", () => input.knowledgeBaseId, "{knowledgeBaseId}", false);
880
625
  let body;
881
626
  body = JSON.stringify({
882
627
  ...(input.contentType != null && { contentType: input.contentType }),
@@ -898,16 +643,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
898
643
  "content-type": "application/json",
899
644
  };
900
645
  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
- }
646
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
911
647
  let body;
912
648
  body = JSON.stringify({
913
649
  ...(input.tags != null && { tags: serializeAws_restJson1Tags(input.tags, context) }),
@@ -927,19 +663,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
927
663
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
928
664
  const headers = {};
929
665
  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
- };
666
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
667
+ const query = map({
668
+ tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys || []).map((_entry) => _entry)],
669
+ });
943
670
  let body;
944
671
  return new protocol_http_1.HttpRequest({
945
672
  protocol,
@@ -960,26 +687,8 @@ const serializeAws_restJson1UpdateContentCommand = async (input, context) => {
960
687
  };
961
688
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
962
689
  "/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
- }
690
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "knowledgeBaseId", () => input.knowledgeBaseId, "{knowledgeBaseId}", false);
691
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "contentId", () => input.contentId, "{contentId}", false);
983
692
  let body;
984
693
  body = JSON.stringify({
985
694
  ...(input.metadata != null && { metadata: serializeAws_restJson1ContentMetadata(input.metadata, context) }),
@@ -1007,16 +716,7 @@ const serializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommand = async (input
1007
716
  };
1008
717
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1009
718
  "/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
- }
719
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "knowledgeBaseId", () => input.knowledgeBaseId, "{knowledgeBaseId}", false);
1020
720
  let body;
1021
721
  body = JSON.stringify({
1022
722
  ...(input.templateUri != null && { templateUri: input.templateUri }),
@@ -1036,15 +736,14 @@ const deserializeAws_restJson1CreateAssistantCommand = async (output, context) =
1036
736
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1037
737
  return deserializeAws_restJson1CreateAssistantCommandError(output, context);
1038
738
  }
1039
- const contents = {
739
+ const contents = map({
1040
740
  $metadata: deserializeMetadata(output),
1041
- assistant: undefined,
1042
- };
741
+ });
1043
742
  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) {
743
+ if (data.assistant != null) {
1045
744
  contents.assistant = deserializeAws_restJson1AssistantData(data.assistant, context);
1046
745
  }
1047
- return Promise.resolve(contents);
746
+ return contents;
1048
747
  };
1049
748
  exports.deserializeAws_restJson1CreateAssistantCommand = deserializeAws_restJson1CreateAssistantCommand;
1050
749
  const deserializeAws_restJson1CreateAssistantCommandError = async (output, context) => {
@@ -1052,7 +751,6 @@ const deserializeAws_restJson1CreateAssistantCommandError = async (output, conte
1052
751
  ...output,
1053
752
  body: await parseBody(output.body, context),
1054
753
  };
1055
- let response;
1056
754
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1057
755
  switch (errorCode) {
1058
756
  case "AccessDeniedException":
@@ -1069,29 +767,26 @@ const deserializeAws_restJson1CreateAssistantCommandError = async (output, conte
1069
767
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1070
768
  default:
1071
769
  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,
770
+ (0, smithy_client_1.throwDefaultError)({
771
+ output,
772
+ parsedBody,
773
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
774
+ errorCode,
1078
775
  });
1079
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1080
776
  }
1081
777
  };
1082
778
  const deserializeAws_restJson1CreateAssistantAssociationCommand = async (output, context) => {
1083
779
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1084
780
  return deserializeAws_restJson1CreateAssistantAssociationCommandError(output, context);
1085
781
  }
1086
- const contents = {
782
+ const contents = map({
1087
783
  $metadata: deserializeMetadata(output),
1088
- assistantAssociation: undefined,
1089
- };
784
+ });
1090
785
  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) {
786
+ if (data.assistantAssociation != null) {
1092
787
  contents.assistantAssociation = deserializeAws_restJson1AssistantAssociationData(data.assistantAssociation, context);
1093
788
  }
1094
- return Promise.resolve(contents);
789
+ return contents;
1095
790
  };
1096
791
  exports.deserializeAws_restJson1CreateAssistantAssociationCommand = deserializeAws_restJson1CreateAssistantAssociationCommand;
1097
792
  const deserializeAws_restJson1CreateAssistantAssociationCommandError = async (output, context) => {
@@ -1099,7 +794,6 @@ const deserializeAws_restJson1CreateAssistantAssociationCommandError = async (ou
1099
794
  ...output,
1100
795
  body: await parseBody(output.body, context),
1101
796
  };
1102
- let response;
1103
797
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1104
798
  switch (errorCode) {
1105
799
  case "AccessDeniedException":
@@ -1119,29 +813,26 @@ const deserializeAws_restJson1CreateAssistantAssociationCommandError = async (ou
1119
813
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1120
814
  default:
1121
815
  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,
816
+ (0, smithy_client_1.throwDefaultError)({
817
+ output,
818
+ parsedBody,
819
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
820
+ errorCode,
1128
821
  });
1129
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1130
822
  }
1131
823
  };
1132
824
  const deserializeAws_restJson1CreateContentCommand = async (output, context) => {
1133
825
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1134
826
  return deserializeAws_restJson1CreateContentCommandError(output, context);
1135
827
  }
1136
- const contents = {
828
+ const contents = map({
1137
829
  $metadata: deserializeMetadata(output),
1138
- content: undefined,
1139
- };
830
+ });
1140
831
  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) {
832
+ if (data.content != null) {
1142
833
  contents.content = deserializeAws_restJson1ContentData(data.content, context);
1143
834
  }
1144
- return Promise.resolve(contents);
835
+ return contents;
1145
836
  };
1146
837
  exports.deserializeAws_restJson1CreateContentCommand = deserializeAws_restJson1CreateContentCommand;
1147
838
  const deserializeAws_restJson1CreateContentCommandError = async (output, context) => {
@@ -1149,7 +840,6 @@ const deserializeAws_restJson1CreateContentCommandError = async (output, context
1149
840
  ...output,
1150
841
  body: await parseBody(output.body, context),
1151
842
  };
1152
- let response;
1153
843
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1154
844
  switch (errorCode) {
1155
845
  case "AccessDeniedException":
@@ -1169,29 +859,26 @@ const deserializeAws_restJson1CreateContentCommandError = async (output, context
1169
859
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1170
860
  default:
1171
861
  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,
862
+ (0, smithy_client_1.throwDefaultError)({
863
+ output,
864
+ parsedBody,
865
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
866
+ errorCode,
1178
867
  });
1179
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1180
868
  }
1181
869
  };
1182
870
  const deserializeAws_restJson1CreateKnowledgeBaseCommand = async (output, context) => {
1183
871
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1184
872
  return deserializeAws_restJson1CreateKnowledgeBaseCommandError(output, context);
1185
873
  }
1186
- const contents = {
874
+ const contents = map({
1187
875
  $metadata: deserializeMetadata(output),
1188
- knowledgeBase: undefined,
1189
- };
876
+ });
1190
877
  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) {
878
+ if (data.knowledgeBase != null) {
1192
879
  contents.knowledgeBase = deserializeAws_restJson1KnowledgeBaseData(data.knowledgeBase, context);
1193
880
  }
1194
- return Promise.resolve(contents);
881
+ return contents;
1195
882
  };
1196
883
  exports.deserializeAws_restJson1CreateKnowledgeBaseCommand = deserializeAws_restJson1CreateKnowledgeBaseCommand;
1197
884
  const deserializeAws_restJson1CreateKnowledgeBaseCommandError = async (output, context) => {
@@ -1199,7 +886,6 @@ const deserializeAws_restJson1CreateKnowledgeBaseCommandError = async (output, c
1199
886
  ...output,
1200
887
  body: await parseBody(output.body, context),
1201
888
  };
1202
- let response;
1203
889
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1204
890
  switch (errorCode) {
1205
891
  case "AccessDeniedException":
@@ -1216,29 +902,26 @@ const deserializeAws_restJson1CreateKnowledgeBaseCommandError = async (output, c
1216
902
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1217
903
  default:
1218
904
  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,
905
+ (0, smithy_client_1.throwDefaultError)({
906
+ output,
907
+ parsedBody,
908
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
909
+ errorCode,
1225
910
  });
1226
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1227
911
  }
1228
912
  };
1229
913
  const deserializeAws_restJson1CreateSessionCommand = async (output, context) => {
1230
914
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1231
915
  return deserializeAws_restJson1CreateSessionCommandError(output, context);
1232
916
  }
1233
- const contents = {
917
+ const contents = map({
1234
918
  $metadata: deserializeMetadata(output),
1235
- session: undefined,
1236
- };
919
+ });
1237
920
  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) {
921
+ if (data.session != null) {
1239
922
  contents.session = deserializeAws_restJson1SessionData(data.session, context);
1240
923
  }
1241
- return Promise.resolve(contents);
924
+ return contents;
1242
925
  };
1243
926
  exports.deserializeAws_restJson1CreateSessionCommand = deserializeAws_restJson1CreateSessionCommand;
1244
927
  const deserializeAws_restJson1CreateSessionCommandError = async (output, context) => {
@@ -1246,7 +929,6 @@ const deserializeAws_restJson1CreateSessionCommandError = async (output, context
1246
929
  ...output,
1247
930
  body: await parseBody(output.body, context),
1248
931
  };
1249
- let response;
1250
932
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1251
933
  switch (errorCode) {
1252
934
  case "ConflictException":
@@ -1260,25 +942,23 @@ const deserializeAws_restJson1CreateSessionCommandError = async (output, context
1260
942
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1261
943
  default:
1262
944
  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,
945
+ (0, smithy_client_1.throwDefaultError)({
946
+ output,
947
+ parsedBody,
948
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
949
+ errorCode,
1269
950
  });
1270
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1271
951
  }
1272
952
  };
1273
953
  const deserializeAws_restJson1DeleteAssistantCommand = async (output, context) => {
1274
954
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1275
955
  return deserializeAws_restJson1DeleteAssistantCommandError(output, context);
1276
956
  }
1277
- const contents = {
957
+ const contents = map({
1278
958
  $metadata: deserializeMetadata(output),
1279
- };
959
+ });
1280
960
  await collectBody(output.body, context);
1281
- return Promise.resolve(contents);
961
+ return contents;
1282
962
  };
1283
963
  exports.deserializeAws_restJson1DeleteAssistantCommand = deserializeAws_restJson1DeleteAssistantCommand;
1284
964
  const deserializeAws_restJson1DeleteAssistantCommandError = async (output, context) => {
@@ -1286,7 +966,6 @@ const deserializeAws_restJson1DeleteAssistantCommandError = async (output, conte
1286
966
  ...output,
1287
967
  body: await parseBody(output.body, context),
1288
968
  };
1289
- let response;
1290
969
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1291
970
  switch (errorCode) {
1292
971
  case "AccessDeniedException":
@@ -1300,25 +979,23 @@ const deserializeAws_restJson1DeleteAssistantCommandError = async (output, conte
1300
979
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1301
980
  default:
1302
981
  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,
982
+ (0, smithy_client_1.throwDefaultError)({
983
+ output,
984
+ parsedBody,
985
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
986
+ errorCode,
1309
987
  });
1310
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1311
988
  }
1312
989
  };
1313
990
  const deserializeAws_restJson1DeleteAssistantAssociationCommand = async (output, context) => {
1314
991
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1315
992
  return deserializeAws_restJson1DeleteAssistantAssociationCommandError(output, context);
1316
993
  }
1317
- const contents = {
994
+ const contents = map({
1318
995
  $metadata: deserializeMetadata(output),
1319
- };
996
+ });
1320
997
  await collectBody(output.body, context);
1321
- return Promise.resolve(contents);
998
+ return contents;
1322
999
  };
1323
1000
  exports.deserializeAws_restJson1DeleteAssistantAssociationCommand = deserializeAws_restJson1DeleteAssistantAssociationCommand;
1324
1001
  const deserializeAws_restJson1DeleteAssistantAssociationCommandError = async (output, context) => {
@@ -1326,7 +1003,6 @@ const deserializeAws_restJson1DeleteAssistantAssociationCommandError = async (ou
1326
1003
  ...output,
1327
1004
  body: await parseBody(output.body, context),
1328
1005
  };
1329
- let response;
1330
1006
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1331
1007
  switch (errorCode) {
1332
1008
  case "AccessDeniedException":
@@ -1340,25 +1016,23 @@ const deserializeAws_restJson1DeleteAssistantAssociationCommandError = async (ou
1340
1016
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1341
1017
  default:
1342
1018
  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,
1019
+ (0, smithy_client_1.throwDefaultError)({
1020
+ output,
1021
+ parsedBody,
1022
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1023
+ errorCode,
1349
1024
  });
1350
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1351
1025
  }
1352
1026
  };
1353
1027
  const deserializeAws_restJson1DeleteContentCommand = async (output, context) => {
1354
1028
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1355
1029
  return deserializeAws_restJson1DeleteContentCommandError(output, context);
1356
1030
  }
1357
- const contents = {
1031
+ const contents = map({
1358
1032
  $metadata: deserializeMetadata(output),
1359
- };
1033
+ });
1360
1034
  await collectBody(output.body, context);
1361
- return Promise.resolve(contents);
1035
+ return contents;
1362
1036
  };
1363
1037
  exports.deserializeAws_restJson1DeleteContentCommand = deserializeAws_restJson1DeleteContentCommand;
1364
1038
  const deserializeAws_restJson1DeleteContentCommandError = async (output, context) => {
@@ -1366,7 +1040,6 @@ const deserializeAws_restJson1DeleteContentCommandError = async (output, context
1366
1040
  ...output,
1367
1041
  body: await parseBody(output.body, context),
1368
1042
  };
1369
- let response;
1370
1043
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1371
1044
  switch (errorCode) {
1372
1045
  case "AccessDeniedException":
@@ -1380,25 +1053,23 @@ const deserializeAws_restJson1DeleteContentCommandError = async (output, context
1380
1053
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1381
1054
  default:
1382
1055
  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,
1056
+ (0, smithy_client_1.throwDefaultError)({
1057
+ output,
1058
+ parsedBody,
1059
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1060
+ errorCode,
1389
1061
  });
1390
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1391
1062
  }
1392
1063
  };
1393
1064
  const deserializeAws_restJson1DeleteKnowledgeBaseCommand = async (output, context) => {
1394
1065
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1395
1066
  return deserializeAws_restJson1DeleteKnowledgeBaseCommandError(output, context);
1396
1067
  }
1397
- const contents = {
1068
+ const contents = map({
1398
1069
  $metadata: deserializeMetadata(output),
1399
- };
1070
+ });
1400
1071
  await collectBody(output.body, context);
1401
- return Promise.resolve(contents);
1072
+ return contents;
1402
1073
  };
1403
1074
  exports.deserializeAws_restJson1DeleteKnowledgeBaseCommand = deserializeAws_restJson1DeleteKnowledgeBaseCommand;
1404
1075
  const deserializeAws_restJson1DeleteKnowledgeBaseCommandError = async (output, context) => {
@@ -1406,7 +1077,6 @@ const deserializeAws_restJson1DeleteKnowledgeBaseCommandError = async (output, c
1406
1077
  ...output,
1407
1078
  body: await parseBody(output.body, context),
1408
1079
  };
1409
- let response;
1410
1080
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1411
1081
  switch (errorCode) {
1412
1082
  case "AccessDeniedException":
@@ -1423,29 +1093,26 @@ const deserializeAws_restJson1DeleteKnowledgeBaseCommandError = async (output, c
1423
1093
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1424
1094
  default:
1425
1095
  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,
1096
+ (0, smithy_client_1.throwDefaultError)({
1097
+ output,
1098
+ parsedBody,
1099
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1100
+ errorCode,
1432
1101
  });
1433
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1434
1102
  }
1435
1103
  };
1436
1104
  const deserializeAws_restJson1GetAssistantCommand = async (output, context) => {
1437
1105
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1438
1106
  return deserializeAws_restJson1GetAssistantCommandError(output, context);
1439
1107
  }
1440
- const contents = {
1108
+ const contents = map({
1441
1109
  $metadata: deserializeMetadata(output),
1442
- assistant: undefined,
1443
- };
1110
+ });
1444
1111
  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) {
1112
+ if (data.assistant != null) {
1446
1113
  contents.assistant = deserializeAws_restJson1AssistantData(data.assistant, context);
1447
1114
  }
1448
- return Promise.resolve(contents);
1115
+ return contents;
1449
1116
  };
1450
1117
  exports.deserializeAws_restJson1GetAssistantCommand = deserializeAws_restJson1GetAssistantCommand;
1451
1118
  const deserializeAws_restJson1GetAssistantCommandError = async (output, context) => {
@@ -1453,7 +1120,6 @@ const deserializeAws_restJson1GetAssistantCommandError = async (output, context)
1453
1120
  ...output,
1454
1121
  body: await parseBody(output.body, context),
1455
1122
  };
1456
- let response;
1457
1123
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1458
1124
  switch (errorCode) {
1459
1125
  case "AccessDeniedException":
@@ -1467,29 +1133,26 @@ const deserializeAws_restJson1GetAssistantCommandError = async (output, context)
1467
1133
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1468
1134
  default:
1469
1135
  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,
1136
+ (0, smithy_client_1.throwDefaultError)({
1137
+ output,
1138
+ parsedBody,
1139
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1140
+ errorCode,
1476
1141
  });
1477
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1478
1142
  }
1479
1143
  };
1480
1144
  const deserializeAws_restJson1GetAssistantAssociationCommand = async (output, context) => {
1481
1145
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1482
1146
  return deserializeAws_restJson1GetAssistantAssociationCommandError(output, context);
1483
1147
  }
1484
- const contents = {
1148
+ const contents = map({
1485
1149
  $metadata: deserializeMetadata(output),
1486
- assistantAssociation: undefined,
1487
- };
1150
+ });
1488
1151
  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) {
1152
+ if (data.assistantAssociation != null) {
1490
1153
  contents.assistantAssociation = deserializeAws_restJson1AssistantAssociationData(data.assistantAssociation, context);
1491
1154
  }
1492
- return Promise.resolve(contents);
1155
+ return contents;
1493
1156
  };
1494
1157
  exports.deserializeAws_restJson1GetAssistantAssociationCommand = deserializeAws_restJson1GetAssistantAssociationCommand;
1495
1158
  const deserializeAws_restJson1GetAssistantAssociationCommandError = async (output, context) => {
@@ -1497,7 +1160,6 @@ const deserializeAws_restJson1GetAssistantAssociationCommandError = async (outpu
1497
1160
  ...output,
1498
1161
  body: await parseBody(output.body, context),
1499
1162
  };
1500
- let response;
1501
1163
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1502
1164
  switch (errorCode) {
1503
1165
  case "AccessDeniedException":
@@ -1511,29 +1173,26 @@ const deserializeAws_restJson1GetAssistantAssociationCommandError = async (outpu
1511
1173
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1512
1174
  default:
1513
1175
  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,
1176
+ (0, smithy_client_1.throwDefaultError)({
1177
+ output,
1178
+ parsedBody,
1179
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1180
+ errorCode,
1520
1181
  });
1521
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1522
1182
  }
1523
1183
  };
1524
1184
  const deserializeAws_restJson1GetContentCommand = async (output, context) => {
1525
1185
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1526
1186
  return deserializeAws_restJson1GetContentCommandError(output, context);
1527
1187
  }
1528
- const contents = {
1188
+ const contents = map({
1529
1189
  $metadata: deserializeMetadata(output),
1530
- content: undefined,
1531
- };
1190
+ });
1532
1191
  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) {
1192
+ if (data.content != null) {
1534
1193
  contents.content = deserializeAws_restJson1ContentData(data.content, context);
1535
1194
  }
1536
- return Promise.resolve(contents);
1195
+ return contents;
1537
1196
  };
1538
1197
  exports.deserializeAws_restJson1GetContentCommand = deserializeAws_restJson1GetContentCommand;
1539
1198
  const deserializeAws_restJson1GetContentCommandError = async (output, context) => {
@@ -1541,7 +1200,6 @@ const deserializeAws_restJson1GetContentCommandError = async (output, context) =
1541
1200
  ...output,
1542
1201
  body: await parseBody(output.body, context),
1543
1202
  };
1544
- let response;
1545
1203
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1546
1204
  switch (errorCode) {
1547
1205
  case "AccessDeniedException":
@@ -1555,29 +1213,26 @@ const deserializeAws_restJson1GetContentCommandError = async (output, context) =
1555
1213
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1556
1214
  default:
1557
1215
  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,
1216
+ (0, smithy_client_1.throwDefaultError)({
1217
+ output,
1218
+ parsedBody,
1219
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1220
+ errorCode,
1564
1221
  });
1565
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1566
1222
  }
1567
1223
  };
1568
1224
  const deserializeAws_restJson1GetContentSummaryCommand = async (output, context) => {
1569
1225
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1570
1226
  return deserializeAws_restJson1GetContentSummaryCommandError(output, context);
1571
1227
  }
1572
- const contents = {
1228
+ const contents = map({
1573
1229
  $metadata: deserializeMetadata(output),
1574
- contentSummary: undefined,
1575
- };
1230
+ });
1576
1231
  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) {
1232
+ if (data.contentSummary != null) {
1578
1233
  contents.contentSummary = deserializeAws_restJson1ContentSummary(data.contentSummary, context);
1579
1234
  }
1580
- return Promise.resolve(contents);
1235
+ return contents;
1581
1236
  };
1582
1237
  exports.deserializeAws_restJson1GetContentSummaryCommand = deserializeAws_restJson1GetContentSummaryCommand;
1583
1238
  const deserializeAws_restJson1GetContentSummaryCommandError = async (output, context) => {
@@ -1585,7 +1240,6 @@ const deserializeAws_restJson1GetContentSummaryCommandError = async (output, con
1585
1240
  ...output,
1586
1241
  body: await parseBody(output.body, context),
1587
1242
  };
1588
- let response;
1589
1243
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1590
1244
  switch (errorCode) {
1591
1245
  case "AccessDeniedException":
@@ -1599,29 +1253,26 @@ const deserializeAws_restJson1GetContentSummaryCommandError = async (output, con
1599
1253
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1600
1254
  default:
1601
1255
  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,
1256
+ (0, smithy_client_1.throwDefaultError)({
1257
+ output,
1258
+ parsedBody,
1259
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1260
+ errorCode,
1608
1261
  });
1609
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1610
1262
  }
1611
1263
  };
1612
1264
  const deserializeAws_restJson1GetKnowledgeBaseCommand = async (output, context) => {
1613
1265
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1614
1266
  return deserializeAws_restJson1GetKnowledgeBaseCommandError(output, context);
1615
1267
  }
1616
- const contents = {
1268
+ const contents = map({
1617
1269
  $metadata: deserializeMetadata(output),
1618
- knowledgeBase: undefined,
1619
- };
1270
+ });
1620
1271
  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) {
1272
+ if (data.knowledgeBase != null) {
1622
1273
  contents.knowledgeBase = deserializeAws_restJson1KnowledgeBaseData(data.knowledgeBase, context);
1623
1274
  }
1624
- return Promise.resolve(contents);
1275
+ return contents;
1625
1276
  };
1626
1277
  exports.deserializeAws_restJson1GetKnowledgeBaseCommand = deserializeAws_restJson1GetKnowledgeBaseCommand;
1627
1278
  const deserializeAws_restJson1GetKnowledgeBaseCommandError = async (output, context) => {
@@ -1629,7 +1280,6 @@ const deserializeAws_restJson1GetKnowledgeBaseCommandError = async (output, cont
1629
1280
  ...output,
1630
1281
  body: await parseBody(output.body, context),
1631
1282
  };
1632
- let response;
1633
1283
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1634
1284
  switch (errorCode) {
1635
1285
  case "AccessDeniedException":
@@ -1643,33 +1293,29 @@ const deserializeAws_restJson1GetKnowledgeBaseCommandError = async (output, cont
1643
1293
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1644
1294
  default:
1645
1295
  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,
1296
+ (0, smithy_client_1.throwDefaultError)({
1297
+ output,
1298
+ parsedBody,
1299
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1300
+ errorCode,
1652
1301
  });
1653
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1654
1302
  }
1655
1303
  };
1656
1304
  const deserializeAws_restJson1GetRecommendationsCommand = async (output, context) => {
1657
1305
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1658
1306
  return deserializeAws_restJson1GetRecommendationsCommandError(output, context);
1659
1307
  }
1660
- const contents = {
1308
+ const contents = map({
1661
1309
  $metadata: deserializeMetadata(output),
1662
- recommendations: undefined,
1663
- triggers: undefined,
1664
- };
1310
+ });
1665
1311
  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) {
1312
+ if (data.recommendations != null) {
1667
1313
  contents.recommendations = deserializeAws_restJson1RecommendationList(data.recommendations, context);
1668
1314
  }
1669
- if (data.triggers !== undefined && data.triggers !== null) {
1315
+ if (data.triggers != null) {
1670
1316
  contents.triggers = deserializeAws_restJson1RecommendationTriggerList(data.triggers, context);
1671
1317
  }
1672
- return Promise.resolve(contents);
1318
+ return contents;
1673
1319
  };
1674
1320
  exports.deserializeAws_restJson1GetRecommendationsCommand = deserializeAws_restJson1GetRecommendationsCommand;
1675
1321
  const deserializeAws_restJson1GetRecommendationsCommandError = async (output, context) => {
@@ -1677,7 +1323,6 @@ const deserializeAws_restJson1GetRecommendationsCommandError = async (output, co
1677
1323
  ...output,
1678
1324
  body: await parseBody(output.body, context),
1679
1325
  };
1680
- let response;
1681
1326
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1682
1327
  switch (errorCode) {
1683
1328
  case "AccessDeniedException":
@@ -1691,29 +1336,26 @@ const deserializeAws_restJson1GetRecommendationsCommandError = async (output, co
1691
1336
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1692
1337
  default:
1693
1338
  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,
1339
+ (0, smithy_client_1.throwDefaultError)({
1340
+ output,
1341
+ parsedBody,
1342
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1343
+ errorCode,
1700
1344
  });
1701
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1702
1345
  }
1703
1346
  };
1704
1347
  const deserializeAws_restJson1GetSessionCommand = async (output, context) => {
1705
1348
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1706
1349
  return deserializeAws_restJson1GetSessionCommandError(output, context);
1707
1350
  }
1708
- const contents = {
1351
+ const contents = map({
1709
1352
  $metadata: deserializeMetadata(output),
1710
- session: undefined,
1711
- };
1353
+ });
1712
1354
  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) {
1355
+ if (data.session != null) {
1714
1356
  contents.session = deserializeAws_restJson1SessionData(data.session, context);
1715
1357
  }
1716
- return Promise.resolve(contents);
1358
+ return contents;
1717
1359
  };
1718
1360
  exports.deserializeAws_restJson1GetSessionCommand = deserializeAws_restJson1GetSessionCommand;
1719
1361
  const deserializeAws_restJson1GetSessionCommandError = async (output, context) => {
@@ -1721,7 +1363,6 @@ const deserializeAws_restJson1GetSessionCommandError = async (output, context) =
1721
1363
  ...output,
1722
1364
  body: await parseBody(output.body, context),
1723
1365
  };
1724
- let response;
1725
1366
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1726
1367
  switch (errorCode) {
1727
1368
  case "AccessDeniedException":
@@ -1735,33 +1376,29 @@ const deserializeAws_restJson1GetSessionCommandError = async (output, context) =
1735
1376
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1736
1377
  default:
1737
1378
  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,
1379
+ (0, smithy_client_1.throwDefaultError)({
1380
+ output,
1381
+ parsedBody,
1382
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1383
+ errorCode,
1744
1384
  });
1745
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1746
1385
  }
1747
1386
  };
1748
1387
  const deserializeAws_restJson1ListAssistantAssociationsCommand = async (output, context) => {
1749
1388
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1750
1389
  return deserializeAws_restJson1ListAssistantAssociationsCommandError(output, context);
1751
1390
  }
1752
- const contents = {
1391
+ const contents = map({
1753
1392
  $metadata: deserializeMetadata(output),
1754
- assistantAssociationSummaries: undefined,
1755
- nextToken: undefined,
1756
- };
1393
+ });
1757
1394
  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) {
1395
+ if (data.assistantAssociationSummaries != null) {
1759
1396
  contents.assistantAssociationSummaries = deserializeAws_restJson1AssistantAssociationSummaryList(data.assistantAssociationSummaries, context);
1760
1397
  }
1761
- if (data.nextToken !== undefined && data.nextToken !== null) {
1398
+ if (data.nextToken != null) {
1762
1399
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1763
1400
  }
1764
- return Promise.resolve(contents);
1401
+ return contents;
1765
1402
  };
1766
1403
  exports.deserializeAws_restJson1ListAssistantAssociationsCommand = deserializeAws_restJson1ListAssistantAssociationsCommand;
1767
1404
  const deserializeAws_restJson1ListAssistantAssociationsCommandError = async (output, context) => {
@@ -1769,7 +1406,6 @@ const deserializeAws_restJson1ListAssistantAssociationsCommandError = async (out
1769
1406
  ...output,
1770
1407
  body: await parseBody(output.body, context),
1771
1408
  };
1772
- let response;
1773
1409
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1774
1410
  switch (errorCode) {
1775
1411
  case "AccessDeniedException":
@@ -1783,33 +1419,29 @@ const deserializeAws_restJson1ListAssistantAssociationsCommandError = async (out
1783
1419
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1784
1420
  default:
1785
1421
  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,
1422
+ (0, smithy_client_1.throwDefaultError)({
1423
+ output,
1424
+ parsedBody,
1425
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1426
+ errorCode,
1792
1427
  });
1793
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1794
1428
  }
1795
1429
  };
1796
1430
  const deserializeAws_restJson1ListAssistantsCommand = async (output, context) => {
1797
1431
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1798
1432
  return deserializeAws_restJson1ListAssistantsCommandError(output, context);
1799
1433
  }
1800
- const contents = {
1434
+ const contents = map({
1801
1435
  $metadata: deserializeMetadata(output),
1802
- assistantSummaries: undefined,
1803
- nextToken: undefined,
1804
- };
1436
+ });
1805
1437
  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) {
1438
+ if (data.assistantSummaries != null) {
1807
1439
  contents.assistantSummaries = deserializeAws_restJson1AssistantList(data.assistantSummaries, context);
1808
1440
  }
1809
- if (data.nextToken !== undefined && data.nextToken !== null) {
1441
+ if (data.nextToken != null) {
1810
1442
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1811
1443
  }
1812
- return Promise.resolve(contents);
1444
+ return contents;
1813
1445
  };
1814
1446
  exports.deserializeAws_restJson1ListAssistantsCommand = deserializeAws_restJson1ListAssistantsCommand;
1815
1447
  const deserializeAws_restJson1ListAssistantsCommandError = async (output, context) => {
@@ -1817,7 +1449,6 @@ const deserializeAws_restJson1ListAssistantsCommandError = async (output, contex
1817
1449
  ...output,
1818
1450
  body: await parseBody(output.body, context),
1819
1451
  };
1820
- let response;
1821
1452
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1822
1453
  switch (errorCode) {
1823
1454
  case "AccessDeniedException":
@@ -1828,33 +1459,29 @@ const deserializeAws_restJson1ListAssistantsCommandError = async (output, contex
1828
1459
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1829
1460
  default:
1830
1461
  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,
1462
+ (0, smithy_client_1.throwDefaultError)({
1463
+ output,
1464
+ parsedBody,
1465
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1466
+ errorCode,
1837
1467
  });
1838
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1839
1468
  }
1840
1469
  };
1841
1470
  const deserializeAws_restJson1ListContentsCommand = async (output, context) => {
1842
1471
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1843
1472
  return deserializeAws_restJson1ListContentsCommandError(output, context);
1844
1473
  }
1845
- const contents = {
1474
+ const contents = map({
1846
1475
  $metadata: deserializeMetadata(output),
1847
- contentSummaries: undefined,
1848
- nextToken: undefined,
1849
- };
1476
+ });
1850
1477
  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) {
1478
+ if (data.contentSummaries != null) {
1852
1479
  contents.contentSummaries = deserializeAws_restJson1ContentSummaryList(data.contentSummaries, context);
1853
1480
  }
1854
- if (data.nextToken !== undefined && data.nextToken !== null) {
1481
+ if (data.nextToken != null) {
1855
1482
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1856
1483
  }
1857
- return Promise.resolve(contents);
1484
+ return contents;
1858
1485
  };
1859
1486
  exports.deserializeAws_restJson1ListContentsCommand = deserializeAws_restJson1ListContentsCommand;
1860
1487
  const deserializeAws_restJson1ListContentsCommandError = async (output, context) => {
@@ -1862,7 +1489,6 @@ const deserializeAws_restJson1ListContentsCommandError = async (output, context)
1862
1489
  ...output,
1863
1490
  body: await parseBody(output.body, context),
1864
1491
  };
1865
- let response;
1866
1492
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1867
1493
  switch (errorCode) {
1868
1494
  case "AccessDeniedException":
@@ -1876,33 +1502,29 @@ const deserializeAws_restJson1ListContentsCommandError = async (output, context)
1876
1502
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1877
1503
  default:
1878
1504
  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,
1505
+ (0, smithy_client_1.throwDefaultError)({
1506
+ output,
1507
+ parsedBody,
1508
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1509
+ errorCode,
1885
1510
  });
1886
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1887
1511
  }
1888
1512
  };
1889
1513
  const deserializeAws_restJson1ListKnowledgeBasesCommand = async (output, context) => {
1890
1514
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1891
1515
  return deserializeAws_restJson1ListKnowledgeBasesCommandError(output, context);
1892
1516
  }
1893
- const contents = {
1517
+ const contents = map({
1894
1518
  $metadata: deserializeMetadata(output),
1895
- knowledgeBaseSummaries: undefined,
1896
- nextToken: undefined,
1897
- };
1519
+ });
1898
1520
  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) {
1521
+ if (data.knowledgeBaseSummaries != null) {
1900
1522
  contents.knowledgeBaseSummaries = deserializeAws_restJson1KnowledgeBaseList(data.knowledgeBaseSummaries, context);
1901
1523
  }
1902
- if (data.nextToken !== undefined && data.nextToken !== null) {
1524
+ if (data.nextToken != null) {
1903
1525
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1904
1526
  }
1905
- return Promise.resolve(contents);
1527
+ return contents;
1906
1528
  };
1907
1529
  exports.deserializeAws_restJson1ListKnowledgeBasesCommand = deserializeAws_restJson1ListKnowledgeBasesCommand;
1908
1530
  const deserializeAws_restJson1ListKnowledgeBasesCommandError = async (output, context) => {
@@ -1910,7 +1532,6 @@ const deserializeAws_restJson1ListKnowledgeBasesCommandError = async (output, co
1910
1532
  ...output,
1911
1533
  body: await parseBody(output.body, context),
1912
1534
  };
1913
- let response;
1914
1535
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1915
1536
  switch (errorCode) {
1916
1537
  case "AccessDeniedException":
@@ -1921,29 +1542,26 @@ const deserializeAws_restJson1ListKnowledgeBasesCommandError = async (output, co
1921
1542
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1922
1543
  default:
1923
1544
  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,
1545
+ (0, smithy_client_1.throwDefaultError)({
1546
+ output,
1547
+ parsedBody,
1548
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1549
+ errorCode,
1930
1550
  });
1931
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1932
1551
  }
1933
1552
  };
1934
1553
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
1935
1554
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1936
1555
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
1937
1556
  }
1938
- const contents = {
1557
+ const contents = map({
1939
1558
  $metadata: deserializeMetadata(output),
1940
- tags: undefined,
1941
- };
1559
+ });
1942
1560
  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) {
1561
+ if (data.tags != null) {
1944
1562
  contents.tags = deserializeAws_restJson1Tags(data.tags, context);
1945
1563
  }
1946
- return Promise.resolve(contents);
1564
+ return contents;
1947
1565
  };
1948
1566
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
1949
1567
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -1951,7 +1569,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1951
1569
  ...output,
1952
1570
  body: await parseBody(output.body, context),
1953
1571
  };
1954
- let response;
1955
1572
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1956
1573
  switch (errorCode) {
1957
1574
  case "ResourceNotFoundException":
@@ -1959,33 +1576,29 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1959
1576
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1960
1577
  default:
1961
1578
  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,
1579
+ (0, smithy_client_1.throwDefaultError)({
1580
+ output,
1581
+ parsedBody,
1582
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1583
+ errorCode,
1968
1584
  });
1969
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1970
1585
  }
1971
1586
  };
1972
1587
  const deserializeAws_restJson1NotifyRecommendationsReceivedCommand = async (output, context) => {
1973
1588
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1974
1589
  return deserializeAws_restJson1NotifyRecommendationsReceivedCommandError(output, context);
1975
1590
  }
1976
- const contents = {
1591
+ const contents = map({
1977
1592
  $metadata: deserializeMetadata(output),
1978
- errors: undefined,
1979
- recommendationIds: undefined,
1980
- };
1593
+ });
1981
1594
  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) {
1595
+ if (data.errors != null) {
1983
1596
  contents.errors = deserializeAws_restJson1NotifyRecommendationsReceivedErrorList(data.errors, context);
1984
1597
  }
1985
- if (data.recommendationIds !== undefined && data.recommendationIds !== null) {
1598
+ if (data.recommendationIds != null) {
1986
1599
  contents.recommendationIds = deserializeAws_restJson1RecommendationIdList(data.recommendationIds, context);
1987
1600
  }
1988
- return Promise.resolve(contents);
1601
+ return contents;
1989
1602
  };
1990
1603
  exports.deserializeAws_restJson1NotifyRecommendationsReceivedCommand = deserializeAws_restJson1NotifyRecommendationsReceivedCommand;
1991
1604
  const deserializeAws_restJson1NotifyRecommendationsReceivedCommandError = async (output, context) => {
@@ -1993,7 +1606,6 @@ const deserializeAws_restJson1NotifyRecommendationsReceivedCommandError = async
1993
1606
  ...output,
1994
1607
  body: await parseBody(output.body, context),
1995
1608
  };
1996
- let response;
1997
1609
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1998
1610
  switch (errorCode) {
1999
1611
  case "AccessDeniedException":
@@ -2007,33 +1619,81 @@ const deserializeAws_restJson1NotifyRecommendationsReceivedCommandError = async
2007
1619
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2008
1620
  default:
2009
1621
  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,
1622
+ (0, smithy_client_1.throwDefaultError)({
1623
+ output,
1624
+ parsedBody,
1625
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1626
+ errorCode,
1627
+ });
1628
+ }
1629
+ };
1630
+ const deserializeAws_restJson1PutFeedbackCommand = async (output, context) => {
1631
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1632
+ return deserializeAws_restJson1PutFeedbackCommandError(output, context);
1633
+ }
1634
+ const contents = map({
1635
+ $metadata: deserializeMetadata(output),
1636
+ });
1637
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1638
+ if (data.assistantArn != null) {
1639
+ contents.assistantArn = (0, smithy_client_1.expectString)(data.assistantArn);
1640
+ }
1641
+ if (data.assistantId != null) {
1642
+ contents.assistantId = (0, smithy_client_1.expectString)(data.assistantId);
1643
+ }
1644
+ if (data.feedback != null) {
1645
+ contents.feedback = deserializeAws_restJson1FeedbackData(data.feedback, context);
1646
+ }
1647
+ if (data.targetId != null) {
1648
+ contents.targetId = (0, smithy_client_1.expectString)(data.targetId);
1649
+ }
1650
+ if (data.targetType != null) {
1651
+ contents.targetType = (0, smithy_client_1.expectString)(data.targetType);
1652
+ }
1653
+ return contents;
1654
+ };
1655
+ exports.deserializeAws_restJson1PutFeedbackCommand = deserializeAws_restJson1PutFeedbackCommand;
1656
+ const deserializeAws_restJson1PutFeedbackCommandError = async (output, context) => {
1657
+ const parsedOutput = {
1658
+ ...output,
1659
+ body: await parseBody(output.body, context),
1660
+ };
1661
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1662
+ switch (errorCode) {
1663
+ case "AccessDeniedException":
1664
+ case "com.amazonaws.wisdom#AccessDeniedException":
1665
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1666
+ case "ResourceNotFoundException":
1667
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
1668
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1669
+ case "ValidationException":
1670
+ case "com.amazonaws.wisdom#ValidationException":
1671
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1672
+ default:
1673
+ const parsedBody = parsedOutput.body;
1674
+ (0, smithy_client_1.throwDefaultError)({
1675
+ output,
1676
+ parsedBody,
1677
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1678
+ errorCode,
2016
1679
  });
2017
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2018
1680
  }
2019
1681
  };
2020
1682
  const deserializeAws_restJson1QueryAssistantCommand = async (output, context) => {
2021
1683
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2022
1684
  return deserializeAws_restJson1QueryAssistantCommandError(output, context);
2023
1685
  }
2024
- const contents = {
1686
+ const contents = map({
2025
1687
  $metadata: deserializeMetadata(output),
2026
- nextToken: undefined,
2027
- results: undefined,
2028
- };
1688
+ });
2029
1689
  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) {
1690
+ if (data.nextToken != null) {
2031
1691
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2032
1692
  }
2033
- if (data.results !== undefined && data.results !== null) {
1693
+ if (data.results != null) {
2034
1694
  contents.results = deserializeAws_restJson1QueryResultsList(data.results, context);
2035
1695
  }
2036
- return Promise.resolve(contents);
1696
+ return contents;
2037
1697
  };
2038
1698
  exports.deserializeAws_restJson1QueryAssistantCommand = deserializeAws_restJson1QueryAssistantCommand;
2039
1699
  const deserializeAws_restJson1QueryAssistantCommandError = async (output, context) => {
@@ -2041,7 +1701,6 @@ const deserializeAws_restJson1QueryAssistantCommandError = async (output, contex
2041
1701
  ...output,
2042
1702
  body: await parseBody(output.body, context),
2043
1703
  };
2044
- let response;
2045
1704
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2046
1705
  switch (errorCode) {
2047
1706
  case "AccessDeniedException":
@@ -2055,25 +1714,23 @@ const deserializeAws_restJson1QueryAssistantCommandError = async (output, contex
2055
1714
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2056
1715
  default:
2057
1716
  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,
1717
+ (0, smithy_client_1.throwDefaultError)({
1718
+ output,
1719
+ parsedBody,
1720
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1721
+ errorCode,
2064
1722
  });
2065
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2066
1723
  }
2067
1724
  };
2068
1725
  const deserializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommand = async (output, context) => {
2069
1726
  if (output.statusCode !== 204 && output.statusCode >= 300) {
2070
1727
  return deserializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommandError(output, context);
2071
1728
  }
2072
- const contents = {
1729
+ const contents = map({
2073
1730
  $metadata: deserializeMetadata(output),
2074
- };
1731
+ });
2075
1732
  await collectBody(output.body, context);
2076
- return Promise.resolve(contents);
1733
+ return contents;
2077
1734
  };
2078
1735
  exports.deserializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommand = deserializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommand;
2079
1736
  const deserializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommandError = async (output, context) => {
@@ -2081,7 +1738,6 @@ const deserializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommandError = async
2081
1738
  ...output,
2082
1739
  body: await parseBody(output.body, context),
2083
1740
  };
2084
- let response;
2085
1741
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2086
1742
  switch (errorCode) {
2087
1743
  case "AccessDeniedException":
@@ -2095,33 +1751,29 @@ const deserializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommandError = async
2095
1751
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2096
1752
  default:
2097
1753
  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,
1754
+ (0, smithy_client_1.throwDefaultError)({
1755
+ output,
1756
+ parsedBody,
1757
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1758
+ errorCode,
2104
1759
  });
2105
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2106
1760
  }
2107
1761
  };
2108
1762
  const deserializeAws_restJson1SearchContentCommand = async (output, context) => {
2109
1763
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2110
1764
  return deserializeAws_restJson1SearchContentCommandError(output, context);
2111
1765
  }
2112
- const contents = {
1766
+ const contents = map({
2113
1767
  $metadata: deserializeMetadata(output),
2114
- contentSummaries: undefined,
2115
- nextToken: undefined,
2116
- };
1768
+ });
2117
1769
  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) {
1770
+ if (data.contentSummaries != null) {
2119
1771
  contents.contentSummaries = deserializeAws_restJson1ContentSummaryList(data.contentSummaries, context);
2120
1772
  }
2121
- if (data.nextToken !== undefined && data.nextToken !== null) {
1773
+ if (data.nextToken != null) {
2122
1774
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2123
1775
  }
2124
- return Promise.resolve(contents);
1776
+ return contents;
2125
1777
  };
2126
1778
  exports.deserializeAws_restJson1SearchContentCommand = deserializeAws_restJson1SearchContentCommand;
2127
1779
  const deserializeAws_restJson1SearchContentCommandError = async (output, context) => {
@@ -2129,7 +1781,6 @@ const deserializeAws_restJson1SearchContentCommandError = async (output, context
2129
1781
  ...output,
2130
1782
  body: await parseBody(output.body, context),
2131
1783
  };
2132
- let response;
2133
1784
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2134
1785
  switch (errorCode) {
2135
1786
  case "AccessDeniedException":
@@ -2143,33 +1794,29 @@ const deserializeAws_restJson1SearchContentCommandError = async (output, context
2143
1794
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2144
1795
  default:
2145
1796
  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,
1797
+ (0, smithy_client_1.throwDefaultError)({
1798
+ output,
1799
+ parsedBody,
1800
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1801
+ errorCode,
2152
1802
  });
2153
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2154
1803
  }
2155
1804
  };
2156
1805
  const deserializeAws_restJson1SearchSessionsCommand = async (output, context) => {
2157
1806
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2158
1807
  return deserializeAws_restJson1SearchSessionsCommandError(output, context);
2159
1808
  }
2160
- const contents = {
1809
+ const contents = map({
2161
1810
  $metadata: deserializeMetadata(output),
2162
- nextToken: undefined,
2163
- sessionSummaries: undefined,
2164
- };
1811
+ });
2165
1812
  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) {
1813
+ if (data.nextToken != null) {
2167
1814
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2168
1815
  }
2169
- if (data.sessionSummaries !== undefined && data.sessionSummaries !== null) {
1816
+ if (data.sessionSummaries != null) {
2170
1817
  contents.sessionSummaries = deserializeAws_restJson1SessionSummaries(data.sessionSummaries, context);
2171
1818
  }
2172
- return Promise.resolve(contents);
1819
+ return contents;
2173
1820
  };
2174
1821
  exports.deserializeAws_restJson1SearchSessionsCommand = deserializeAws_restJson1SearchSessionsCommand;
2175
1822
  const deserializeAws_restJson1SearchSessionsCommandError = async (output, context) => {
@@ -2177,7 +1824,6 @@ const deserializeAws_restJson1SearchSessionsCommandError = async (output, contex
2177
1824
  ...output,
2178
1825
  body: await parseBody(output.body, context),
2179
1826
  };
2180
- let response;
2181
1827
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2182
1828
  switch (errorCode) {
2183
1829
  case "AccessDeniedException":
@@ -2191,41 +1837,35 @@ const deserializeAws_restJson1SearchSessionsCommandError = async (output, contex
2191
1837
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2192
1838
  default:
2193
1839
  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,
1840
+ (0, smithy_client_1.throwDefaultError)({
1841
+ output,
1842
+ parsedBody,
1843
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1844
+ errorCode,
2200
1845
  });
2201
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2202
1846
  }
2203
1847
  };
2204
1848
  const deserializeAws_restJson1StartContentUploadCommand = async (output, context) => {
2205
1849
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2206
1850
  return deserializeAws_restJson1StartContentUploadCommandError(output, context);
2207
1851
  }
2208
- const contents = {
1852
+ const contents = map({
2209
1853
  $metadata: deserializeMetadata(output),
2210
- headersToInclude: undefined,
2211
- uploadId: undefined,
2212
- url: undefined,
2213
- urlExpiry: undefined,
2214
- };
1854
+ });
2215
1855
  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) {
1856
+ if (data.headersToInclude != null) {
2217
1857
  contents.headersToInclude = deserializeAws_restJson1Headers(data.headersToInclude, context);
2218
1858
  }
2219
- if (data.uploadId !== undefined && data.uploadId !== null) {
1859
+ if (data.uploadId != null) {
2220
1860
  contents.uploadId = (0, smithy_client_1.expectString)(data.uploadId);
2221
1861
  }
2222
- if (data.url !== undefined && data.url !== null) {
1862
+ if (data.url != null) {
2223
1863
  contents.url = (0, smithy_client_1.expectString)(data.url);
2224
1864
  }
2225
- if (data.urlExpiry !== undefined && data.urlExpiry !== null) {
1865
+ if (data.urlExpiry != null) {
2226
1866
  contents.urlExpiry = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.urlExpiry)));
2227
1867
  }
2228
- return Promise.resolve(contents);
1868
+ return contents;
2229
1869
  };
2230
1870
  exports.deserializeAws_restJson1StartContentUploadCommand = deserializeAws_restJson1StartContentUploadCommand;
2231
1871
  const deserializeAws_restJson1StartContentUploadCommandError = async (output, context) => {
@@ -2233,7 +1873,6 @@ const deserializeAws_restJson1StartContentUploadCommandError = async (output, co
2233
1873
  ...output,
2234
1874
  body: await parseBody(output.body, context),
2235
1875
  };
2236
- let response;
2237
1876
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2238
1877
  switch (errorCode) {
2239
1878
  case "AccessDeniedException":
@@ -2247,25 +1886,23 @@ const deserializeAws_restJson1StartContentUploadCommandError = async (output, co
2247
1886
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2248
1887
  default:
2249
1888
  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,
1889
+ (0, smithy_client_1.throwDefaultError)({
1890
+ output,
1891
+ parsedBody,
1892
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1893
+ errorCode,
2256
1894
  });
2257
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2258
1895
  }
2259
1896
  };
2260
1897
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
2261
1898
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2262
1899
  return deserializeAws_restJson1TagResourceCommandError(output, context);
2263
1900
  }
2264
- const contents = {
1901
+ const contents = map({
2265
1902
  $metadata: deserializeMetadata(output),
2266
- };
1903
+ });
2267
1904
  await collectBody(output.body, context);
2268
- return Promise.resolve(contents);
1905
+ return contents;
2269
1906
  };
2270
1907
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
2271
1908
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -2273,7 +1910,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2273
1910
  ...output,
2274
1911
  body: await parseBody(output.body, context),
2275
1912
  };
2276
- let response;
2277
1913
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2278
1914
  switch (errorCode) {
2279
1915
  case "ResourceNotFoundException":
@@ -2284,25 +1920,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2284
1920
  throw await deserializeAws_restJson1TooManyTagsExceptionResponse(parsedOutput, context);
2285
1921
  default:
2286
1922
  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,
1923
+ (0, smithy_client_1.throwDefaultError)({
1924
+ output,
1925
+ parsedBody,
1926
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1927
+ errorCode,
2293
1928
  });
2294
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2295
1929
  }
2296
1930
  };
2297
1931
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
2298
1932
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2299
1933
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
2300
1934
  }
2301
- const contents = {
1935
+ const contents = map({
2302
1936
  $metadata: deserializeMetadata(output),
2303
- };
1937
+ });
2304
1938
  await collectBody(output.body, context);
2305
- return Promise.resolve(contents);
1939
+ return contents;
2306
1940
  };
2307
1941
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
2308
1942
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -2310,7 +1944,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
2310
1944
  ...output,
2311
1945
  body: await parseBody(output.body, context),
2312
1946
  };
2313
- let response;
2314
1947
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2315
1948
  switch (errorCode) {
2316
1949
  case "ResourceNotFoundException":
@@ -2318,29 +1951,26 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
2318
1951
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2319
1952
  default:
2320
1953
  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,
1954
+ (0, smithy_client_1.throwDefaultError)({
1955
+ output,
1956
+ parsedBody,
1957
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
1958
+ errorCode,
2327
1959
  });
2328
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2329
1960
  }
2330
1961
  };
2331
1962
  const deserializeAws_restJson1UpdateContentCommand = async (output, context) => {
2332
1963
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2333
1964
  return deserializeAws_restJson1UpdateContentCommandError(output, context);
2334
1965
  }
2335
- const contents = {
1966
+ const contents = map({
2336
1967
  $metadata: deserializeMetadata(output),
2337
- content: undefined,
2338
- };
1968
+ });
2339
1969
  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) {
1970
+ if (data.content != null) {
2341
1971
  contents.content = deserializeAws_restJson1ContentData(data.content, context);
2342
1972
  }
2343
- return Promise.resolve(contents);
1973
+ return contents;
2344
1974
  };
2345
1975
  exports.deserializeAws_restJson1UpdateContentCommand = deserializeAws_restJson1UpdateContentCommand;
2346
1976
  const deserializeAws_restJson1UpdateContentCommandError = async (output, context) => {
@@ -2348,7 +1978,6 @@ const deserializeAws_restJson1UpdateContentCommandError = async (output, context
2348
1978
  ...output,
2349
1979
  body: await parseBody(output.body, context),
2350
1980
  };
2351
- let response;
2352
1981
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2353
1982
  switch (errorCode) {
2354
1983
  case "AccessDeniedException":
@@ -2365,29 +1994,26 @@ const deserializeAws_restJson1UpdateContentCommandError = async (output, context
2365
1994
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2366
1995
  default:
2367
1996
  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,
1997
+ (0, smithy_client_1.throwDefaultError)({
1998
+ output,
1999
+ parsedBody,
2000
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
2001
+ errorCode,
2374
2002
  });
2375
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2376
2003
  }
2377
2004
  };
2378
2005
  const deserializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommand = async (output, context) => {
2379
2006
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2380
2007
  return deserializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommandError(output, context);
2381
2008
  }
2382
- const contents = {
2009
+ const contents = map({
2383
2010
  $metadata: deserializeMetadata(output),
2384
- knowledgeBase: undefined,
2385
- };
2011
+ });
2386
2012
  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) {
2013
+ if (data.knowledgeBase != null) {
2388
2014
  contents.knowledgeBase = deserializeAws_restJson1KnowledgeBaseData(data.knowledgeBase, context);
2389
2015
  }
2390
- return Promise.resolve(contents);
2016
+ return contents;
2391
2017
  };
2392
2018
  exports.deserializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommand = deserializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommand;
2393
2019
  const deserializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommandError = async (output, context) => {
@@ -2395,7 +2021,6 @@ const deserializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommandError = async
2395
2021
  ...output,
2396
2022
  body: await parseBody(output.body, context),
2397
2023
  };
2398
- let response;
2399
2024
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2400
2025
  switch (errorCode) {
2401
2026
  case "AccessDeniedException":
@@ -2409,20 +2034,19 @@ const deserializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommandError = async
2409
2034
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2410
2035
  default:
2411
2036
  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,
2037
+ (0, smithy_client_1.throwDefaultError)({
2038
+ output,
2039
+ parsedBody,
2040
+ exceptionCtor: WisdomServiceException_1.WisdomServiceException,
2041
+ errorCode,
2418
2042
  });
2419
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2420
2043
  }
2421
2044
  };
2045
+ const map = smithy_client_1.map;
2422
2046
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
2423
- const contents = {};
2047
+ const contents = map({});
2424
2048
  const data = parsedOutput.body;
2425
- if (data.message !== undefined && data.message !== null) {
2049
+ if (data.message != null) {
2426
2050
  contents.message = (0, smithy_client_1.expectString)(data.message);
2427
2051
  }
2428
2052
  const exception = new models_0_1.AccessDeniedException({
@@ -2432,9 +2056,9 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
2432
2056
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2433
2057
  };
2434
2058
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
2435
- const contents = {};
2059
+ const contents = map({});
2436
2060
  const data = parsedOutput.body;
2437
- if (data.message !== undefined && data.message !== null) {
2061
+ if (data.message != null) {
2438
2062
  contents.message = (0, smithy_client_1.expectString)(data.message);
2439
2063
  }
2440
2064
  const exception = new models_0_1.ConflictException({
@@ -2444,9 +2068,9 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
2444
2068
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2445
2069
  };
2446
2070
  const deserializeAws_restJson1PreconditionFailedExceptionResponse = async (parsedOutput, context) => {
2447
- const contents = {};
2071
+ const contents = map({});
2448
2072
  const data = parsedOutput.body;
2449
- if (data.message !== undefined && data.message !== null) {
2073
+ if (data.message != null) {
2450
2074
  contents.message = (0, smithy_client_1.expectString)(data.message);
2451
2075
  }
2452
2076
  const exception = new models_0_1.PreconditionFailedException({
@@ -2456,12 +2080,12 @@ const deserializeAws_restJson1PreconditionFailedExceptionResponse = async (parse
2456
2080
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2457
2081
  };
2458
2082
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
2459
- const contents = {};
2083
+ const contents = map({});
2460
2084
  const data = parsedOutput.body;
2461
- if (data.message !== undefined && data.message !== null) {
2085
+ if (data.message != null) {
2462
2086
  contents.message = (0, smithy_client_1.expectString)(data.message);
2463
2087
  }
2464
- if (data.resourceName !== undefined && data.resourceName !== null) {
2088
+ if (data.resourceName != null) {
2465
2089
  contents.resourceName = (0, smithy_client_1.expectString)(data.resourceName);
2466
2090
  }
2467
2091
  const exception = new models_0_1.ResourceNotFoundException({
@@ -2471,9 +2095,9 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
2471
2095
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2472
2096
  };
2473
2097
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
2474
- const contents = {};
2098
+ const contents = map({});
2475
2099
  const data = parsedOutput.body;
2476
- if (data.message !== undefined && data.message !== null) {
2100
+ if (data.message != null) {
2477
2101
  contents.message = (0, smithy_client_1.expectString)(data.message);
2478
2102
  }
2479
2103
  const exception = new models_0_1.ServiceQuotaExceededException({
@@ -2483,12 +2107,12 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
2483
2107
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2484
2108
  };
2485
2109
  const deserializeAws_restJson1TooManyTagsExceptionResponse = async (parsedOutput, context) => {
2486
- const contents = {};
2110
+ const contents = map({});
2487
2111
  const data = parsedOutput.body;
2488
- if (data.message !== undefined && data.message !== null) {
2112
+ if (data.message != null) {
2489
2113
  contents.message = (0, smithy_client_1.expectString)(data.message);
2490
2114
  }
2491
- if (data.resourceName !== undefined && data.resourceName !== null) {
2115
+ if (data.resourceName != null) {
2492
2116
  contents.resourceName = (0, smithy_client_1.expectString)(data.resourceName);
2493
2117
  }
2494
2118
  const exception = new models_0_1.TooManyTagsException({
@@ -2498,9 +2122,9 @@ const deserializeAws_restJson1TooManyTagsExceptionResponse = async (parsedOutput
2498
2122
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2499
2123
  };
2500
2124
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
2501
- const contents = {};
2125
+ const contents = map({});
2502
2126
  const data = parsedOutput.body;
2503
- if (data.message !== undefined && data.message !== null) {
2127
+ if (data.message != null) {
2504
2128
  contents.message = (0, smithy_client_1.expectString)(data.message);
2505
2129
  }
2506
2130
  const exception = new models_0_1.ValidationException({
@@ -2534,6 +2158,11 @@ const serializeAws_restJson1ContentMetadata = (input, context) => {
2534
2158
  };
2535
2159
  }, {});
2536
2160
  };
2161
+ const serializeAws_restJson1FeedbackData = (input, context) => {
2162
+ return {
2163
+ ...(input.relevance != null && { relevance: input.relevance }),
2164
+ };
2165
+ };
2537
2166
  const serializeAws_restJson1Filter = (input, context) => {
2538
2167
  return {
2539
2168
  ...(input.field != null && { field: input.field }),
@@ -2545,9 +2174,6 @@ const serializeAws_restJson1FilterList = (input, context) => {
2545
2174
  return input
2546
2175
  .filter((e) => e != null)
2547
2176
  .map((entry) => {
2548
- if (entry === null) {
2549
- return null;
2550
- }
2551
2177
  return serializeAws_restJson1Filter(entry, context);
2552
2178
  });
2553
2179
  };
@@ -2555,9 +2181,6 @@ const serializeAws_restJson1ObjectFieldsList = (input, context) => {
2555
2181
  return input
2556
2182
  .filter((e) => e != null)
2557
2183
  .map((entry) => {
2558
- if (entry === null) {
2559
- return null;
2560
- }
2561
2184
  return entry;
2562
2185
  });
2563
2186
  };
@@ -2565,9 +2188,6 @@ const serializeAws_restJson1RecommendationIdList = (input, context) => {
2565
2188
  return input
2566
2189
  .filter((e) => e != null)
2567
2190
  .map((entry) => {
2568
- if (entry === null) {
2569
- return null;
2570
- }
2571
2191
  return entry;
2572
2192
  });
2573
2193
  };
@@ -2625,7 +2245,7 @@ const deserializeAws_restJson1AssistantAssociationData = (output, context) => {
2625
2245
  };
2626
2246
  };
2627
2247
  const deserializeAws_restJson1AssistantAssociationOutputData = (output, context) => {
2628
- if (output.knowledgeBaseAssociation !== undefined && output.knowledgeBaseAssociation !== null) {
2248
+ if (output.knowledgeBaseAssociation != null) {
2629
2249
  return {
2630
2250
  knowledgeBaseAssociation: deserializeAws_restJson1KnowledgeBaseAssociationData(output.knowledgeBaseAssociation, context),
2631
2251
  };
@@ -2773,6 +2393,11 @@ const deserializeAws_restJson1DocumentText = (output, context) => {
2773
2393
  text: (0, smithy_client_1.expectString)(output.text),
2774
2394
  };
2775
2395
  };
2396
+ const deserializeAws_restJson1FeedbackData = (output, context) => {
2397
+ return {
2398
+ relevance: (0, smithy_client_1.expectString)(output.relevance),
2399
+ };
2400
+ };
2776
2401
  const deserializeAws_restJson1Headers = (output, context) => {
2777
2402
  return Object.entries(output).reduce((acc, [key, value]) => {
2778
2403
  if (value === null) {
@@ -2950,7 +2575,7 @@ const deserializeAws_restJson1RecommendationTrigger = (output, context) => {
2950
2575
  };
2951
2576
  };
2952
2577
  const deserializeAws_restJson1RecommendationTriggerData = (output, context) => {
2953
- if (output.query !== undefined && output.query !== null) {
2578
+ if (output.query != null) {
2954
2579
  return {
2955
2580
  query: deserializeAws_restJson1QueryRecommendationTriggerData(output.query, context),
2956
2581
  };
@@ -3014,7 +2639,7 @@ const deserializeAws_restJson1SessionSummary = (output, context) => {
3014
2639
  };
3015
2640
  };
3016
2641
  const deserializeAws_restJson1SourceConfiguration = (output, context) => {
3017
- if (output.appIntegrations !== undefined && output.appIntegrations !== null) {
2642
+ if (output.appIntegrations != null) {
3018
2643
  return {
3019
2644
  appIntegrations: deserializeAws_restJson1AppIntegrationsConfiguration(output.appIntegrations, context),
3020
2645
  };