@aws-sdk/client-wisdom 3.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (358) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +201 -0
  3. package/README.md +207 -0
  4. package/dist-cjs/Wisdom.js +480 -0
  5. package/dist-cjs/Wisdom.js.map +1 -0
  6. package/dist-cjs/WisdomClient.js +48 -0
  7. package/dist-cjs/WisdomClient.js.map +1 -0
  8. package/dist-cjs/commands/CreateAssistantAssociationCommand.js +63 -0
  9. package/dist-cjs/commands/CreateAssistantAssociationCommand.js.map +1 -0
  10. package/dist-cjs/commands/CreateAssistantCommand.js +61 -0
  11. package/dist-cjs/commands/CreateAssistantCommand.js.map +1 -0
  12. package/dist-cjs/commands/CreateContentCommand.js +62 -0
  13. package/dist-cjs/commands/CreateContentCommand.js.map +1 -0
  14. package/dist-cjs/commands/CreateKnowledgeBaseCommand.js +85 -0
  15. package/dist-cjs/commands/CreateKnowledgeBaseCommand.js.map +1 -0
  16. package/dist-cjs/commands/CreateSessionCommand.js +63 -0
  17. package/dist-cjs/commands/CreateSessionCommand.js.map +1 -0
  18. package/dist-cjs/commands/DeleteAssistantAssociationCommand.js +61 -0
  19. package/dist-cjs/commands/DeleteAssistantAssociationCommand.js.map +1 -0
  20. package/dist-cjs/commands/DeleteAssistantCommand.js +61 -0
  21. package/dist-cjs/commands/DeleteAssistantCommand.js.map +1 -0
  22. package/dist-cjs/commands/DeleteContentCommand.js +61 -0
  23. package/dist-cjs/commands/DeleteContentCommand.js.map +1 -0
  24. package/dist-cjs/commands/DeleteKnowledgeBaseCommand.js +68 -0
  25. package/dist-cjs/commands/DeleteKnowledgeBaseCommand.js.map +1 -0
  26. package/dist-cjs/commands/GetAssistantAssociationCommand.js +61 -0
  27. package/dist-cjs/commands/GetAssistantAssociationCommand.js.map +1 -0
  28. package/dist-cjs/commands/GetAssistantCommand.js +61 -0
  29. package/dist-cjs/commands/GetAssistantCommand.js.map +1 -0
  30. package/dist-cjs/commands/GetContentCommand.js +61 -0
  31. package/dist-cjs/commands/GetContentCommand.js.map +1 -0
  32. package/dist-cjs/commands/GetContentSummaryCommand.js +61 -0
  33. package/dist-cjs/commands/GetContentSummaryCommand.js.map +1 -0
  34. package/dist-cjs/commands/GetKnowledgeBaseCommand.js +61 -0
  35. package/dist-cjs/commands/GetKnowledgeBaseCommand.js.map +1 -0
  36. package/dist-cjs/commands/GetRecommendationsCommand.js +64 -0
  37. package/dist-cjs/commands/GetRecommendationsCommand.js.map +1 -0
  38. package/dist-cjs/commands/GetSessionCommand.js +61 -0
  39. package/dist-cjs/commands/GetSessionCommand.js.map +1 -0
  40. package/dist-cjs/commands/ListAssistantAssociationsCommand.js +61 -0
  41. package/dist-cjs/commands/ListAssistantAssociationsCommand.js.map +1 -0
  42. package/dist-cjs/commands/ListAssistantsCommand.js +61 -0
  43. package/dist-cjs/commands/ListAssistantsCommand.js.map +1 -0
  44. package/dist-cjs/commands/ListContentsCommand.js +61 -0
  45. package/dist-cjs/commands/ListContentsCommand.js.map +1 -0
  46. package/dist-cjs/commands/ListKnowledgeBasesCommand.js +61 -0
  47. package/dist-cjs/commands/ListKnowledgeBasesCommand.js.map +1 -0
  48. package/dist-cjs/commands/ListTagsForResourceCommand.js +61 -0
  49. package/dist-cjs/commands/ListTagsForResourceCommand.js.map +1 -0
  50. package/dist-cjs/commands/NotifyRecommendationsReceivedCommand.js +63 -0
  51. package/dist-cjs/commands/NotifyRecommendationsReceivedCommand.js.map +1 -0
  52. package/dist-cjs/commands/QueryAssistantCommand.js +63 -0
  53. package/dist-cjs/commands/QueryAssistantCommand.js.map +1 -0
  54. package/dist-cjs/commands/RemoveKnowledgeBaseTemplateUriCommand.js +61 -0
  55. package/dist-cjs/commands/RemoveKnowledgeBaseTemplateUriCommand.js.map +1 -0
  56. package/dist-cjs/commands/SearchContentCommand.js +62 -0
  57. package/dist-cjs/commands/SearchContentCommand.js.map +1 -0
  58. package/dist-cjs/commands/SearchSessionsCommand.js +61 -0
  59. package/dist-cjs/commands/SearchSessionsCommand.js.map +1 -0
  60. package/dist-cjs/commands/StartContentUploadCommand.js +64 -0
  61. package/dist-cjs/commands/StartContentUploadCommand.js.map +1 -0
  62. package/dist-cjs/commands/TagResourceCommand.js +61 -0
  63. package/dist-cjs/commands/TagResourceCommand.js.map +1 -0
  64. package/dist-cjs/commands/UntagResourceCommand.js +61 -0
  65. package/dist-cjs/commands/UntagResourceCommand.js.map +1 -0
  66. package/dist-cjs/commands/UpdateContentCommand.js +61 -0
  67. package/dist-cjs/commands/UpdateContentCommand.js.map +1 -0
  68. package/dist-cjs/commands/UpdateKnowledgeBaseTemplateUriCommand.js +66 -0
  69. package/dist-cjs/commands/UpdateKnowledgeBaseTemplateUriCommand.js.map +1 -0
  70. package/dist-cjs/endpoints.js +57 -0
  71. package/dist-cjs/endpoints.js.map +1 -0
  72. package/dist-cjs/index.js +46 -0
  73. package/dist-cjs/index.js.map +1 -0
  74. package/dist-cjs/models/index.js +5 -0
  75. package/dist-cjs/models/index.js.map +1 -0
  76. package/dist-cjs/models/models_0.js +989 -0
  77. package/dist-cjs/models/models_0.js.map +1 -0
  78. package/dist-cjs/pagination/Interfaces.js +3 -0
  79. package/dist-cjs/pagination/Interfaces.js.map +1 -0
  80. package/dist-cjs/pagination/ListAssistantAssociationsPaginator.js +46 -0
  81. package/dist-cjs/pagination/ListAssistantAssociationsPaginator.js.map +1 -0
  82. package/dist-cjs/pagination/ListAssistantsPaginator.js +46 -0
  83. package/dist-cjs/pagination/ListAssistantsPaginator.js.map +1 -0
  84. package/dist-cjs/pagination/ListContentsPaginator.js +46 -0
  85. package/dist-cjs/pagination/ListContentsPaginator.js.map +1 -0
  86. package/dist-cjs/pagination/ListKnowledgeBasesPaginator.js +46 -0
  87. package/dist-cjs/pagination/ListKnowledgeBasesPaginator.js.map +1 -0
  88. package/dist-cjs/pagination/QueryAssistantPaginator.js +46 -0
  89. package/dist-cjs/pagination/QueryAssistantPaginator.js.map +1 -0
  90. package/dist-cjs/pagination/SearchContentPaginator.js +46 -0
  91. package/dist-cjs/pagination/SearchContentPaginator.js.map +1 -0
  92. package/dist-cjs/pagination/SearchSessionsPaginator.js +46 -0
  93. package/dist-cjs/pagination/SearchSessionsPaginator.js.map +1 -0
  94. package/dist-cjs/protocols/Aws_restJson1.js +3717 -0
  95. package/dist-cjs/protocols/Aws_restJson1.js.map +1 -0
  96. package/dist-cjs/runtimeConfig.browser.js +42 -0
  97. package/dist-cjs/runtimeConfig.browser.js.map +1 -0
  98. package/dist-cjs/runtimeConfig.js +47 -0
  99. package/dist-cjs/runtimeConfig.js.map +1 -0
  100. package/dist-cjs/runtimeConfig.native.js +20 -0
  101. package/dist-cjs/runtimeConfig.native.js.map +1 -0
  102. package/dist-cjs/runtimeConfig.shared.js +21 -0
  103. package/dist-cjs/runtimeConfig.shared.js.map +1 -0
  104. package/dist-es/Wisdom.js +476 -0
  105. package/dist-es/Wisdom.js.map +1 -0
  106. package/dist-es/WisdomClient.js +38 -0
  107. package/dist-es/WisdomClient.js.map +1 -0
  108. package/dist-es/commands/CreateAssistantAssociationCommand.js +40 -0
  109. package/dist-es/commands/CreateAssistantAssociationCommand.js.map +1 -0
  110. package/dist-es/commands/CreateAssistantCommand.js +40 -0
  111. package/dist-es/commands/CreateAssistantCommand.js.map +1 -0
  112. package/dist-es/commands/CreateContentCommand.js +40 -0
  113. package/dist-es/commands/CreateContentCommand.js.map +1 -0
  114. package/dist-es/commands/CreateKnowledgeBaseCommand.js +40 -0
  115. package/dist-es/commands/CreateKnowledgeBaseCommand.js.map +1 -0
  116. package/dist-es/commands/CreateSessionCommand.js +40 -0
  117. package/dist-es/commands/CreateSessionCommand.js.map +1 -0
  118. package/dist-es/commands/DeleteAssistantAssociationCommand.js +40 -0
  119. package/dist-es/commands/DeleteAssistantAssociationCommand.js.map +1 -0
  120. package/dist-es/commands/DeleteAssistantCommand.js +40 -0
  121. package/dist-es/commands/DeleteAssistantCommand.js.map +1 -0
  122. package/dist-es/commands/DeleteContentCommand.js +40 -0
  123. package/dist-es/commands/DeleteContentCommand.js.map +1 -0
  124. package/dist-es/commands/DeleteKnowledgeBaseCommand.js +40 -0
  125. package/dist-es/commands/DeleteKnowledgeBaseCommand.js.map +1 -0
  126. package/dist-es/commands/GetAssistantAssociationCommand.js +40 -0
  127. package/dist-es/commands/GetAssistantAssociationCommand.js.map +1 -0
  128. package/dist-es/commands/GetAssistantCommand.js +40 -0
  129. package/dist-es/commands/GetAssistantCommand.js.map +1 -0
  130. package/dist-es/commands/GetContentCommand.js +40 -0
  131. package/dist-es/commands/GetContentCommand.js.map +1 -0
  132. package/dist-es/commands/GetContentSummaryCommand.js +40 -0
  133. package/dist-es/commands/GetContentSummaryCommand.js.map +1 -0
  134. package/dist-es/commands/GetKnowledgeBaseCommand.js +40 -0
  135. package/dist-es/commands/GetKnowledgeBaseCommand.js.map +1 -0
  136. package/dist-es/commands/GetRecommendationsCommand.js +40 -0
  137. package/dist-es/commands/GetRecommendationsCommand.js.map +1 -0
  138. package/dist-es/commands/GetSessionCommand.js +40 -0
  139. package/dist-es/commands/GetSessionCommand.js.map +1 -0
  140. package/dist-es/commands/ListAssistantAssociationsCommand.js +40 -0
  141. package/dist-es/commands/ListAssistantAssociationsCommand.js.map +1 -0
  142. package/dist-es/commands/ListAssistantsCommand.js +40 -0
  143. package/dist-es/commands/ListAssistantsCommand.js.map +1 -0
  144. package/dist-es/commands/ListContentsCommand.js +40 -0
  145. package/dist-es/commands/ListContentsCommand.js.map +1 -0
  146. package/dist-es/commands/ListKnowledgeBasesCommand.js +40 -0
  147. package/dist-es/commands/ListKnowledgeBasesCommand.js.map +1 -0
  148. package/dist-es/commands/ListTagsForResourceCommand.js +40 -0
  149. package/dist-es/commands/ListTagsForResourceCommand.js.map +1 -0
  150. package/dist-es/commands/NotifyRecommendationsReceivedCommand.js +40 -0
  151. package/dist-es/commands/NotifyRecommendationsReceivedCommand.js.map +1 -0
  152. package/dist-es/commands/QueryAssistantCommand.js +40 -0
  153. package/dist-es/commands/QueryAssistantCommand.js.map +1 -0
  154. package/dist-es/commands/RemoveKnowledgeBaseTemplateUriCommand.js +40 -0
  155. package/dist-es/commands/RemoveKnowledgeBaseTemplateUriCommand.js.map +1 -0
  156. package/dist-es/commands/SearchContentCommand.js +40 -0
  157. package/dist-es/commands/SearchContentCommand.js.map +1 -0
  158. package/dist-es/commands/SearchSessionsCommand.js +40 -0
  159. package/dist-es/commands/SearchSessionsCommand.js.map +1 -0
  160. package/dist-es/commands/StartContentUploadCommand.js +40 -0
  161. package/dist-es/commands/StartContentUploadCommand.js.map +1 -0
  162. package/dist-es/commands/TagResourceCommand.js +40 -0
  163. package/dist-es/commands/TagResourceCommand.js.map +1 -0
  164. package/dist-es/commands/UntagResourceCommand.js +40 -0
  165. package/dist-es/commands/UntagResourceCommand.js.map +1 -0
  166. package/dist-es/commands/UpdateContentCommand.js +40 -0
  167. package/dist-es/commands/UpdateContentCommand.js.map +1 -0
  168. package/dist-es/commands/UpdateKnowledgeBaseTemplateUriCommand.js +40 -0
  169. package/dist-es/commands/UpdateKnowledgeBaseTemplateUriCommand.js.map +1 -0
  170. package/dist-es/endpoints.js +53 -0
  171. package/dist-es/endpoints.js.map +1 -0
  172. package/dist-es/index.js +43 -0
  173. package/dist-es/index.js.map +1 -0
  174. package/dist-es/models/index.js +2 -0
  175. package/dist-es/models/index.js.map +1 -0
  176. package/dist-es/models/models_0.js +495 -0
  177. package/dist-es/models/models_0.js.map +1 -0
  178. package/dist-es/pagination/Interfaces.js +2 -0
  179. package/dist-es/pagination/Interfaces.js.map +1 -0
  180. package/dist-es/pagination/ListAssistantAssociationsPaginator.js +75 -0
  181. package/dist-es/pagination/ListAssistantAssociationsPaginator.js.map +1 -0
  182. package/dist-es/pagination/ListAssistantsPaginator.js +75 -0
  183. package/dist-es/pagination/ListAssistantsPaginator.js.map +1 -0
  184. package/dist-es/pagination/ListContentsPaginator.js +75 -0
  185. package/dist-es/pagination/ListContentsPaginator.js.map +1 -0
  186. package/dist-es/pagination/ListKnowledgeBasesPaginator.js +75 -0
  187. package/dist-es/pagination/ListKnowledgeBasesPaginator.js.map +1 -0
  188. package/dist-es/pagination/QueryAssistantPaginator.js +75 -0
  189. package/dist-es/pagination/QueryAssistantPaginator.js.map +1 -0
  190. package/dist-es/pagination/SearchContentPaginator.js +75 -0
  191. package/dist-es/pagination/SearchContentPaginator.js.map +1 -0
  192. package/dist-es/pagination/SearchSessionsPaginator.js +75 -0
  193. package/dist-es/pagination/SearchSessionsPaginator.js.map +1 -0
  194. package/dist-es/protocols/Aws_restJson1.js +4214 -0
  195. package/dist-es/protocols/Aws_restJson1.js.map +1 -0
  196. package/dist-es/runtimeConfig.browser.js +17 -0
  197. package/dist-es/runtimeConfig.browser.js.map +1 -0
  198. package/dist-es/runtimeConfig.js +22 -0
  199. package/dist-es/runtimeConfig.js.map +1 -0
  200. package/dist-es/runtimeConfig.native.js +9 -0
  201. package/dist-es/runtimeConfig.native.js.map +1 -0
  202. package/dist-es/runtimeConfig.shared.js +14 -0
  203. package/dist-es/runtimeConfig.shared.js.map +1 -0
  204. package/dist-types/Wisdom.d.ts +280 -0
  205. package/dist-types/WisdomClient.d.ts +167 -0
  206. package/dist-types/commands/CreateAssistantAssociationCommand.d.ts +37 -0
  207. package/dist-types/commands/CreateAssistantCommand.d.ts +35 -0
  208. package/dist-types/commands/CreateContentCommand.d.ts +36 -0
  209. package/dist-types/commands/CreateKnowledgeBaseCommand.d.ts +59 -0
  210. package/dist-types/commands/CreateSessionCommand.d.ts +37 -0
  211. package/dist-types/commands/DeleteAssistantAssociationCommand.d.ts +35 -0
  212. package/dist-types/commands/DeleteAssistantCommand.d.ts +35 -0
  213. package/dist-types/commands/DeleteContentCommand.d.ts +35 -0
  214. package/dist-types/commands/DeleteKnowledgeBaseCommand.d.ts +42 -0
  215. package/dist-types/commands/GetAssistantAssociationCommand.d.ts +35 -0
  216. package/dist-types/commands/GetAssistantCommand.d.ts +35 -0
  217. package/dist-types/commands/GetContentCommand.d.ts +35 -0
  218. package/dist-types/commands/GetContentSummaryCommand.d.ts +35 -0
  219. package/dist-types/commands/GetKnowledgeBaseCommand.d.ts +35 -0
  220. package/dist-types/commands/GetRecommendationsCommand.d.ts +38 -0
  221. package/dist-types/commands/GetSessionCommand.d.ts +35 -0
  222. package/dist-types/commands/ListAssistantAssociationsCommand.d.ts +35 -0
  223. package/dist-types/commands/ListAssistantsCommand.d.ts +35 -0
  224. package/dist-types/commands/ListContentsCommand.d.ts +35 -0
  225. package/dist-types/commands/ListKnowledgeBasesCommand.d.ts +35 -0
  226. package/dist-types/commands/ListTagsForResourceCommand.d.ts +35 -0
  227. package/dist-types/commands/NotifyRecommendationsReceivedCommand.d.ts +37 -0
  228. package/dist-types/commands/QueryAssistantCommand.d.ts +37 -0
  229. package/dist-types/commands/RemoveKnowledgeBaseTemplateUriCommand.d.ts +35 -0
  230. package/dist-types/commands/SearchContentCommand.d.ts +36 -0
  231. package/dist-types/commands/SearchSessionsCommand.d.ts +35 -0
  232. package/dist-types/commands/StartContentUploadCommand.d.ts +38 -0
  233. package/dist-types/commands/TagResourceCommand.d.ts +35 -0
  234. package/dist-types/commands/UntagResourceCommand.d.ts +35 -0
  235. package/dist-types/commands/UpdateContentCommand.d.ts +35 -0
  236. package/dist-types/commands/UpdateKnowledgeBaseTemplateUriCommand.d.ts +40 -0
  237. package/dist-types/endpoints.d.ts +2 -0
  238. package/dist-types/index.d.ts +42 -0
  239. package/dist-types/models/index.d.ts +1 -0
  240. package/dist-types/models/models_0.d.ts +2073 -0
  241. package/dist-types/pagination/Interfaces.d.ts +6 -0
  242. package/dist-types/pagination/ListAssistantAssociationsPaginator.d.ts +4 -0
  243. package/dist-types/pagination/ListAssistantsPaginator.d.ts +4 -0
  244. package/dist-types/pagination/ListContentsPaginator.d.ts +4 -0
  245. package/dist-types/pagination/ListKnowledgeBasesPaginator.d.ts +4 -0
  246. package/dist-types/pagination/QueryAssistantPaginator.d.ts +4 -0
  247. package/dist-types/pagination/SearchContentPaginator.d.ts +4 -0
  248. package/dist-types/pagination/SearchSessionsPaginator.d.ts +4 -0
  249. package/dist-types/protocols/Aws_restJson1.d.ts +95 -0
  250. package/dist-types/runtimeConfig.browser.d.ts +37 -0
  251. package/dist-types/runtimeConfig.d.ts +37 -0
  252. package/dist-types/runtimeConfig.native.d.ts +36 -0
  253. package/dist-types/runtimeConfig.shared.d.ts +13 -0
  254. package/dist-types/ts3.4/Wisdom.d.ts +280 -0
  255. package/dist-types/ts3.4/WisdomClient.d.ts +167 -0
  256. package/dist-types/ts3.4/commands/CreateAssistantAssociationCommand.d.ts +37 -0
  257. package/dist-types/ts3.4/commands/CreateAssistantCommand.d.ts +35 -0
  258. package/dist-types/ts3.4/commands/CreateContentCommand.d.ts +36 -0
  259. package/dist-types/ts3.4/commands/CreateKnowledgeBaseCommand.d.ts +59 -0
  260. package/dist-types/ts3.4/commands/CreateSessionCommand.d.ts +37 -0
  261. package/dist-types/ts3.4/commands/DeleteAssistantAssociationCommand.d.ts +35 -0
  262. package/dist-types/ts3.4/commands/DeleteAssistantCommand.d.ts +35 -0
  263. package/dist-types/ts3.4/commands/DeleteContentCommand.d.ts +35 -0
  264. package/dist-types/ts3.4/commands/DeleteKnowledgeBaseCommand.d.ts +42 -0
  265. package/dist-types/ts3.4/commands/GetAssistantAssociationCommand.d.ts +35 -0
  266. package/dist-types/ts3.4/commands/GetAssistantCommand.d.ts +35 -0
  267. package/dist-types/ts3.4/commands/GetContentCommand.d.ts +35 -0
  268. package/dist-types/ts3.4/commands/GetContentSummaryCommand.d.ts +35 -0
  269. package/dist-types/ts3.4/commands/GetKnowledgeBaseCommand.d.ts +35 -0
  270. package/dist-types/ts3.4/commands/GetRecommendationsCommand.d.ts +38 -0
  271. package/dist-types/ts3.4/commands/GetSessionCommand.d.ts +35 -0
  272. package/dist-types/ts3.4/commands/ListAssistantAssociationsCommand.d.ts +35 -0
  273. package/dist-types/ts3.4/commands/ListAssistantsCommand.d.ts +35 -0
  274. package/dist-types/ts3.4/commands/ListContentsCommand.d.ts +35 -0
  275. package/dist-types/ts3.4/commands/ListKnowledgeBasesCommand.d.ts +35 -0
  276. package/dist-types/ts3.4/commands/ListTagsForResourceCommand.d.ts +35 -0
  277. package/dist-types/ts3.4/commands/NotifyRecommendationsReceivedCommand.d.ts +37 -0
  278. package/dist-types/ts3.4/commands/QueryAssistantCommand.d.ts +37 -0
  279. package/dist-types/ts3.4/commands/RemoveKnowledgeBaseTemplateUriCommand.d.ts +35 -0
  280. package/dist-types/ts3.4/commands/SearchContentCommand.d.ts +36 -0
  281. package/dist-types/ts3.4/commands/SearchSessionsCommand.d.ts +35 -0
  282. package/dist-types/ts3.4/commands/StartContentUploadCommand.d.ts +38 -0
  283. package/dist-types/ts3.4/commands/TagResourceCommand.d.ts +35 -0
  284. package/dist-types/ts3.4/commands/UntagResourceCommand.d.ts +35 -0
  285. package/dist-types/ts3.4/commands/UpdateContentCommand.d.ts +35 -0
  286. package/dist-types/ts3.4/commands/UpdateKnowledgeBaseTemplateUriCommand.d.ts +40 -0
  287. package/dist-types/ts3.4/endpoints.d.ts +2 -0
  288. package/dist-types/ts3.4/index.d.ts +42 -0
  289. package/dist-types/ts3.4/models/index.d.ts +1 -0
  290. package/dist-types/ts3.4/models/models_0.d.ts +2082 -0
  291. package/dist-types/ts3.4/pagination/Interfaces.d.ts +6 -0
  292. package/dist-types/ts3.4/pagination/ListAssistantAssociationsPaginator.d.ts +4 -0
  293. package/dist-types/ts3.4/pagination/ListAssistantsPaginator.d.ts +4 -0
  294. package/dist-types/ts3.4/pagination/ListContentsPaginator.d.ts +4 -0
  295. package/dist-types/ts3.4/pagination/ListKnowledgeBasesPaginator.d.ts +4 -0
  296. package/dist-types/ts3.4/pagination/QueryAssistantPaginator.d.ts +4 -0
  297. package/dist-types/ts3.4/pagination/SearchContentPaginator.d.ts +4 -0
  298. package/dist-types/ts3.4/pagination/SearchSessionsPaginator.d.ts +4 -0
  299. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +95 -0
  300. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +37 -0
  301. package/dist-types/ts3.4/runtimeConfig.d.ts +37 -0
  302. package/dist-types/ts3.4/runtimeConfig.native.d.ts +36 -0
  303. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +13 -0
  304. package/jest.config.js +4 -0
  305. package/package.json +93 -0
  306. package/src/Wisdom.ts +1175 -0
  307. package/src/WisdomClient.ts +363 -0
  308. package/src/commands/CreateAssistantAssociationCommand.ts +100 -0
  309. package/src/commands/CreateAssistantCommand.ts +95 -0
  310. package/src/commands/CreateContentCommand.ts +96 -0
  311. package/src/commands/CreateKnowledgeBaseCommand.ts +119 -0
  312. package/src/commands/CreateSessionCommand.ts +97 -0
  313. package/src/commands/DeleteAssistantAssociationCommand.ts +98 -0
  314. package/src/commands/DeleteAssistantCommand.ts +95 -0
  315. package/src/commands/DeleteContentCommand.ts +95 -0
  316. package/src/commands/DeleteKnowledgeBaseCommand.ts +102 -0
  317. package/src/commands/GetAssistantAssociationCommand.ts +95 -0
  318. package/src/commands/GetAssistantCommand.ts +95 -0
  319. package/src/commands/GetContentCommand.ts +95 -0
  320. package/src/commands/GetContentSummaryCommand.ts +95 -0
  321. package/src/commands/GetKnowledgeBaseCommand.ts +95 -0
  322. package/src/commands/GetRecommendationsCommand.ts +98 -0
  323. package/src/commands/GetSessionCommand.ts +95 -0
  324. package/src/commands/ListAssistantAssociationsCommand.ts +98 -0
  325. package/src/commands/ListAssistantsCommand.ts +95 -0
  326. package/src/commands/ListContentsCommand.ts +95 -0
  327. package/src/commands/ListKnowledgeBasesCommand.ts +95 -0
  328. package/src/commands/ListTagsForResourceCommand.ts +95 -0
  329. package/src/commands/NotifyRecommendationsReceivedCommand.ts +102 -0
  330. package/src/commands/QueryAssistantCommand.ts +97 -0
  331. package/src/commands/RemoveKnowledgeBaseTemplateUriCommand.ts +103 -0
  332. package/src/commands/SearchContentCommand.ts +96 -0
  333. package/src/commands/SearchSessionsCommand.ts +95 -0
  334. package/src/commands/StartContentUploadCommand.ts +98 -0
  335. package/src/commands/TagResourceCommand.ts +95 -0
  336. package/src/commands/UntagResourceCommand.ts +95 -0
  337. package/src/commands/UpdateContentCommand.ts +95 -0
  338. package/src/commands/UpdateKnowledgeBaseTemplateUriCommand.ts +108 -0
  339. package/src/endpoints.ts +57 -0
  340. package/src/index.ts +42 -0
  341. package/src/models/index.ts +1 -0
  342. package/src/models/models_0.ts +2662 -0
  343. package/src/pagination/Interfaces.ts +8 -0
  344. package/src/pagination/ListAssistantAssociationsPaginator.ts +59 -0
  345. package/src/pagination/ListAssistantsPaginator.ts +59 -0
  346. package/src/pagination/ListContentsPaginator.ts +59 -0
  347. package/src/pagination/ListKnowledgeBasesPaginator.ts +59 -0
  348. package/src/pagination/QueryAssistantPaginator.ts +59 -0
  349. package/src/pagination/SearchContentPaginator.ts +59 -0
  350. package/src/pagination/SearchSessionsPaginator.ts +59 -0
  351. package/src/protocols/Aws_restJson1.ts +4293 -0
  352. package/src/runtimeConfig.browser.ts +41 -0
  353. package/src/runtimeConfig.native.ts +17 -0
  354. package/src/runtimeConfig.shared.ts +17 -0
  355. package/src/runtimeConfig.ts +46 -0
  356. package/tsconfig.es.json +10 -0
  357. package/tsconfig.json +33 -0
  358. package/tsconfig.types.json +9 -0
@@ -0,0 +1,4293 @@
1
+ import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
2
+ import {
3
+ expectInt32 as __expectInt32,
4
+ expectNonNull as __expectNonNull,
5
+ expectNumber as __expectNumber,
6
+ expectObject as __expectObject,
7
+ expectString as __expectString,
8
+ expectUnion as __expectUnion,
9
+ extendedEncodeURIComponent as __extendedEncodeURIComponent,
10
+ limitedParseDouble as __limitedParseDouble,
11
+ parseEpochTimestamp as __parseEpochTimestamp,
12
+ } from "@aws-sdk/smithy-client";
13
+ import {
14
+ Endpoint as __Endpoint,
15
+ MetadataBearer as __MetadataBearer,
16
+ ResponseMetadata as __ResponseMetadata,
17
+ SerdeContext as __SerdeContext,
18
+ SmithyException as __SmithyException,
19
+ } from "@aws-sdk/types";
20
+ import { v4 as generateIdempotencyToken } from "uuid";
21
+
22
+ import {
23
+ CreateAssistantAssociationCommandInput,
24
+ CreateAssistantAssociationCommandOutput,
25
+ } from "../commands/CreateAssistantAssociationCommand";
26
+ import { CreateAssistantCommandInput, CreateAssistantCommandOutput } from "../commands/CreateAssistantCommand";
27
+ import { CreateContentCommandInput, CreateContentCommandOutput } from "../commands/CreateContentCommand";
28
+ import {
29
+ CreateKnowledgeBaseCommandInput,
30
+ CreateKnowledgeBaseCommandOutput,
31
+ } from "../commands/CreateKnowledgeBaseCommand";
32
+ import { CreateSessionCommandInput, CreateSessionCommandOutput } from "../commands/CreateSessionCommand";
33
+ import {
34
+ DeleteAssistantAssociationCommandInput,
35
+ DeleteAssistantAssociationCommandOutput,
36
+ } from "../commands/DeleteAssistantAssociationCommand";
37
+ import { DeleteAssistantCommandInput, DeleteAssistantCommandOutput } from "../commands/DeleteAssistantCommand";
38
+ import { DeleteContentCommandInput, DeleteContentCommandOutput } from "../commands/DeleteContentCommand";
39
+ import {
40
+ DeleteKnowledgeBaseCommandInput,
41
+ DeleteKnowledgeBaseCommandOutput,
42
+ } from "../commands/DeleteKnowledgeBaseCommand";
43
+ import {
44
+ GetAssistantAssociationCommandInput,
45
+ GetAssistantAssociationCommandOutput,
46
+ } from "../commands/GetAssistantAssociationCommand";
47
+ import { GetAssistantCommandInput, GetAssistantCommandOutput } from "../commands/GetAssistantCommand";
48
+ import { GetContentCommandInput, GetContentCommandOutput } from "../commands/GetContentCommand";
49
+ import { GetContentSummaryCommandInput, GetContentSummaryCommandOutput } from "../commands/GetContentSummaryCommand";
50
+ import { GetKnowledgeBaseCommandInput, GetKnowledgeBaseCommandOutput } from "../commands/GetKnowledgeBaseCommand";
51
+ import { GetRecommendationsCommandInput, GetRecommendationsCommandOutput } from "../commands/GetRecommendationsCommand";
52
+ import { GetSessionCommandInput, GetSessionCommandOutput } from "../commands/GetSessionCommand";
53
+ import {
54
+ ListAssistantAssociationsCommandInput,
55
+ ListAssistantAssociationsCommandOutput,
56
+ } from "../commands/ListAssistantAssociationsCommand";
57
+ import { ListAssistantsCommandInput, ListAssistantsCommandOutput } from "../commands/ListAssistantsCommand";
58
+ import { ListContentsCommandInput, ListContentsCommandOutput } from "../commands/ListContentsCommand";
59
+ import { ListKnowledgeBasesCommandInput, ListKnowledgeBasesCommandOutput } from "../commands/ListKnowledgeBasesCommand";
60
+ import {
61
+ ListTagsForResourceCommandInput,
62
+ ListTagsForResourceCommandOutput,
63
+ } from "../commands/ListTagsForResourceCommand";
64
+ import {
65
+ NotifyRecommendationsReceivedCommandInput,
66
+ NotifyRecommendationsReceivedCommandOutput,
67
+ } from "../commands/NotifyRecommendationsReceivedCommand";
68
+ import { QueryAssistantCommandInput, QueryAssistantCommandOutput } from "../commands/QueryAssistantCommand";
69
+ import {
70
+ RemoveKnowledgeBaseTemplateUriCommandInput,
71
+ RemoveKnowledgeBaseTemplateUriCommandOutput,
72
+ } from "../commands/RemoveKnowledgeBaseTemplateUriCommand";
73
+ import { SearchContentCommandInput, SearchContentCommandOutput } from "../commands/SearchContentCommand";
74
+ import { SearchSessionsCommandInput, SearchSessionsCommandOutput } from "../commands/SearchSessionsCommand";
75
+ import { StartContentUploadCommandInput, StartContentUploadCommandOutput } from "../commands/StartContentUploadCommand";
76
+ import { TagResourceCommandInput, TagResourceCommandOutput } from "../commands/TagResourceCommand";
77
+ import { UntagResourceCommandInput, UntagResourceCommandOutput } from "../commands/UntagResourceCommand";
78
+ import { UpdateContentCommandInput, UpdateContentCommandOutput } from "../commands/UpdateContentCommand";
79
+ import {
80
+ UpdateKnowledgeBaseTemplateUriCommandInput,
81
+ UpdateKnowledgeBaseTemplateUriCommandOutput,
82
+ } from "../commands/UpdateKnowledgeBaseTemplateUriCommand";
83
+ import {
84
+ AccessDeniedException,
85
+ AppIntegrationsConfiguration,
86
+ AssistantAssociationData,
87
+ AssistantAssociationInputData,
88
+ AssistantAssociationOutputData,
89
+ AssistantAssociationSummary,
90
+ AssistantData,
91
+ AssistantSummary,
92
+ ConflictException,
93
+ ContentData,
94
+ ContentReference,
95
+ ContentSummary,
96
+ Document,
97
+ DocumentText,
98
+ Filter,
99
+ Highlight,
100
+ KnowledgeBaseAssociationData,
101
+ KnowledgeBaseData,
102
+ KnowledgeBaseSummary,
103
+ NotifyRecommendationsReceivedError,
104
+ PreconditionFailedException,
105
+ RecommendationData,
106
+ RenderingConfiguration,
107
+ ResourceNotFoundException,
108
+ ResultData,
109
+ SearchExpression,
110
+ ServerSideEncryptionConfiguration,
111
+ ServiceQuotaExceededException,
112
+ SessionData,
113
+ SessionSummary,
114
+ SourceConfiguration,
115
+ TooManyTagsException,
116
+ ValidationException,
117
+ } from "../models/models_0";
118
+
119
+ export const serializeAws_restJson1CreateAssistantCommand = async (
120
+ input: CreateAssistantCommandInput,
121
+ context: __SerdeContext
122
+ ): Promise<__HttpRequest> => {
123
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
124
+ const headers: any = {
125
+ "content-type": "application/json",
126
+ };
127
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assistants";
128
+ let body: any;
129
+ body = JSON.stringify({
130
+ clientToken: input.clientToken ?? generateIdempotencyToken(),
131
+ ...(input.description !== undefined && input.description !== null && { description: input.description }),
132
+ ...(input.name !== undefined && input.name !== null && { name: input.name }),
133
+ ...(input.serverSideEncryptionConfiguration !== undefined &&
134
+ input.serverSideEncryptionConfiguration !== null && {
135
+ serverSideEncryptionConfiguration: serializeAws_restJson1ServerSideEncryptionConfiguration(
136
+ input.serverSideEncryptionConfiguration,
137
+ context
138
+ ),
139
+ }),
140
+ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }),
141
+ ...(input.type !== undefined && input.type !== null && { type: input.type }),
142
+ });
143
+ return new __HttpRequest({
144
+ protocol,
145
+ hostname,
146
+ port,
147
+ method: "POST",
148
+ headers,
149
+ path: resolvedPath,
150
+ body,
151
+ });
152
+ };
153
+
154
+ export const serializeAws_restJson1CreateAssistantAssociationCommand = async (
155
+ input: CreateAssistantAssociationCommandInput,
156
+ context: __SerdeContext
157
+ ): Promise<__HttpRequest> => {
158
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
159
+ const headers: any = {
160
+ "content-type": "application/json",
161
+ };
162
+ let resolvedPath =
163
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assistants/{assistantId}/associations";
164
+ if (input.assistantId !== undefined) {
165
+ const labelValue: string = input.assistantId;
166
+ if (labelValue.length <= 0) {
167
+ throw new Error("Empty value provided for input HTTP label: assistantId.");
168
+ }
169
+ resolvedPath = resolvedPath.replace("{assistantId}", __extendedEncodeURIComponent(labelValue));
170
+ } else {
171
+ throw new Error("No value provided for input HTTP label: assistantId.");
172
+ }
173
+ let body: any;
174
+ body = JSON.stringify({
175
+ ...(input.association !== undefined &&
176
+ input.association !== null && {
177
+ association: serializeAws_restJson1AssistantAssociationInputData(input.association, context),
178
+ }),
179
+ ...(input.associationType !== undefined &&
180
+ input.associationType !== null && { associationType: input.associationType }),
181
+ clientToken: input.clientToken ?? generateIdempotencyToken(),
182
+ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }),
183
+ });
184
+ return new __HttpRequest({
185
+ protocol,
186
+ hostname,
187
+ port,
188
+ method: "POST",
189
+ headers,
190
+ path: resolvedPath,
191
+ body,
192
+ });
193
+ };
194
+
195
+ export const serializeAws_restJson1CreateContentCommand = async (
196
+ input: CreateContentCommandInput,
197
+ context: __SerdeContext
198
+ ): Promise<__HttpRequest> => {
199
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
200
+ const headers: any = {
201
+ "content-type": "application/json",
202
+ };
203
+ let resolvedPath =
204
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
205
+ "/knowledgeBases/{knowledgeBaseId}/contents";
206
+ if (input.knowledgeBaseId !== undefined) {
207
+ const labelValue: string = input.knowledgeBaseId;
208
+ if (labelValue.length <= 0) {
209
+ throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
210
+ }
211
+ resolvedPath = resolvedPath.replace("{knowledgeBaseId}", __extendedEncodeURIComponent(labelValue));
212
+ } else {
213
+ throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
214
+ }
215
+ let body: any;
216
+ body = JSON.stringify({
217
+ clientToken: input.clientToken ?? generateIdempotencyToken(),
218
+ ...(input.metadata !== undefined &&
219
+ input.metadata !== null && { metadata: serializeAws_restJson1ContentMetadata(input.metadata, context) }),
220
+ ...(input.name !== undefined && input.name !== null && { name: input.name }),
221
+ ...(input.overrideLinkOutUri !== undefined &&
222
+ input.overrideLinkOutUri !== null && { overrideLinkOutUri: input.overrideLinkOutUri }),
223
+ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }),
224
+ ...(input.title !== undefined && input.title !== null && { title: input.title }),
225
+ ...(input.uploadId !== undefined && input.uploadId !== null && { uploadId: input.uploadId }),
226
+ });
227
+ return new __HttpRequest({
228
+ protocol,
229
+ hostname,
230
+ port,
231
+ method: "POST",
232
+ headers,
233
+ path: resolvedPath,
234
+ body,
235
+ });
236
+ };
237
+
238
+ export const serializeAws_restJson1CreateKnowledgeBaseCommand = async (
239
+ input: CreateKnowledgeBaseCommandInput,
240
+ context: __SerdeContext
241
+ ): Promise<__HttpRequest> => {
242
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
243
+ const headers: any = {
244
+ "content-type": "application/json",
245
+ };
246
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/knowledgeBases";
247
+ let body: any;
248
+ body = JSON.stringify({
249
+ clientToken: input.clientToken ?? generateIdempotencyToken(),
250
+ ...(input.description !== undefined && input.description !== null && { description: input.description }),
251
+ ...(input.knowledgeBaseType !== undefined &&
252
+ input.knowledgeBaseType !== null && { knowledgeBaseType: input.knowledgeBaseType }),
253
+ ...(input.name !== undefined && input.name !== null && { name: input.name }),
254
+ ...(input.renderingConfiguration !== undefined &&
255
+ input.renderingConfiguration !== null && {
256
+ renderingConfiguration: serializeAws_restJson1RenderingConfiguration(input.renderingConfiguration, context),
257
+ }),
258
+ ...(input.serverSideEncryptionConfiguration !== undefined &&
259
+ input.serverSideEncryptionConfiguration !== null && {
260
+ serverSideEncryptionConfiguration: serializeAws_restJson1ServerSideEncryptionConfiguration(
261
+ input.serverSideEncryptionConfiguration,
262
+ context
263
+ ),
264
+ }),
265
+ ...(input.sourceConfiguration !== undefined &&
266
+ input.sourceConfiguration !== null && {
267
+ sourceConfiguration: serializeAws_restJson1SourceConfiguration(input.sourceConfiguration, context),
268
+ }),
269
+ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }),
270
+ });
271
+ return new __HttpRequest({
272
+ protocol,
273
+ hostname,
274
+ port,
275
+ method: "POST",
276
+ headers,
277
+ path: resolvedPath,
278
+ body,
279
+ });
280
+ };
281
+
282
+ export const serializeAws_restJson1CreateSessionCommand = async (
283
+ input: CreateSessionCommandInput,
284
+ context: __SerdeContext
285
+ ): Promise<__HttpRequest> => {
286
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
287
+ const headers: any = {
288
+ "content-type": "application/json",
289
+ };
290
+ let resolvedPath =
291
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assistants/{assistantId}/sessions";
292
+ if (input.assistantId !== undefined) {
293
+ const labelValue: string = input.assistantId;
294
+ if (labelValue.length <= 0) {
295
+ throw new Error("Empty value provided for input HTTP label: assistantId.");
296
+ }
297
+ resolvedPath = resolvedPath.replace("{assistantId}", __extendedEncodeURIComponent(labelValue));
298
+ } else {
299
+ throw new Error("No value provided for input HTTP label: assistantId.");
300
+ }
301
+ let body: any;
302
+ body = JSON.stringify({
303
+ clientToken: input.clientToken ?? generateIdempotencyToken(),
304
+ ...(input.description !== undefined && input.description !== null && { description: input.description }),
305
+ ...(input.name !== undefined && input.name !== null && { name: input.name }),
306
+ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }),
307
+ });
308
+ return new __HttpRequest({
309
+ protocol,
310
+ hostname,
311
+ port,
312
+ method: "POST",
313
+ headers,
314
+ path: resolvedPath,
315
+ body,
316
+ });
317
+ };
318
+
319
+ export const serializeAws_restJson1DeleteAssistantCommand = async (
320
+ input: DeleteAssistantCommandInput,
321
+ context: __SerdeContext
322
+ ): Promise<__HttpRequest> => {
323
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
324
+ const headers: any = {};
325
+ let resolvedPath =
326
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assistants/{assistantId}";
327
+ if (input.assistantId !== undefined) {
328
+ const labelValue: string = input.assistantId;
329
+ if (labelValue.length <= 0) {
330
+ throw new Error("Empty value provided for input HTTP label: assistantId.");
331
+ }
332
+ resolvedPath = resolvedPath.replace("{assistantId}", __extendedEncodeURIComponent(labelValue));
333
+ } else {
334
+ throw new Error("No value provided for input HTTP label: assistantId.");
335
+ }
336
+ let body: any;
337
+ return new __HttpRequest({
338
+ protocol,
339
+ hostname,
340
+ port,
341
+ method: "DELETE",
342
+ headers,
343
+ path: resolvedPath,
344
+ body,
345
+ });
346
+ };
347
+
348
+ export const serializeAws_restJson1DeleteAssistantAssociationCommand = async (
349
+ input: DeleteAssistantAssociationCommandInput,
350
+ context: __SerdeContext
351
+ ): Promise<__HttpRequest> => {
352
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
353
+ const headers: any = {};
354
+ let resolvedPath =
355
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
356
+ "/assistants/{assistantId}/associations/{assistantAssociationId}";
357
+ if (input.assistantAssociationId !== undefined) {
358
+ const labelValue: string = input.assistantAssociationId;
359
+ if (labelValue.length <= 0) {
360
+ throw new Error("Empty value provided for input HTTP label: assistantAssociationId.");
361
+ }
362
+ resolvedPath = resolvedPath.replace("{assistantAssociationId}", __extendedEncodeURIComponent(labelValue));
363
+ } else {
364
+ throw new Error("No value provided for input HTTP label: assistantAssociationId.");
365
+ }
366
+ if (input.assistantId !== undefined) {
367
+ const labelValue: string = input.assistantId;
368
+ if (labelValue.length <= 0) {
369
+ throw new Error("Empty value provided for input HTTP label: assistantId.");
370
+ }
371
+ resolvedPath = resolvedPath.replace("{assistantId}", __extendedEncodeURIComponent(labelValue));
372
+ } else {
373
+ throw new Error("No value provided for input HTTP label: assistantId.");
374
+ }
375
+ let body: any;
376
+ return new __HttpRequest({
377
+ protocol,
378
+ hostname,
379
+ port,
380
+ method: "DELETE",
381
+ headers,
382
+ path: resolvedPath,
383
+ body,
384
+ });
385
+ };
386
+
387
+ export const serializeAws_restJson1DeleteContentCommand = async (
388
+ input: DeleteContentCommandInput,
389
+ context: __SerdeContext
390
+ ): Promise<__HttpRequest> => {
391
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
392
+ const headers: any = {};
393
+ let resolvedPath =
394
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
395
+ "/knowledgeBases/{knowledgeBaseId}/contents/{contentId}";
396
+ if (input.knowledgeBaseId !== undefined) {
397
+ const labelValue: string = input.knowledgeBaseId;
398
+ if (labelValue.length <= 0) {
399
+ throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
400
+ }
401
+ resolvedPath = resolvedPath.replace("{knowledgeBaseId}", __extendedEncodeURIComponent(labelValue));
402
+ } else {
403
+ throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
404
+ }
405
+ if (input.contentId !== undefined) {
406
+ const labelValue: string = input.contentId;
407
+ if (labelValue.length <= 0) {
408
+ throw new Error("Empty value provided for input HTTP label: contentId.");
409
+ }
410
+ resolvedPath = resolvedPath.replace("{contentId}", __extendedEncodeURIComponent(labelValue));
411
+ } else {
412
+ throw new Error("No value provided for input HTTP label: contentId.");
413
+ }
414
+ let body: any;
415
+ return new __HttpRequest({
416
+ protocol,
417
+ hostname,
418
+ port,
419
+ method: "DELETE",
420
+ headers,
421
+ path: resolvedPath,
422
+ body,
423
+ });
424
+ };
425
+
426
+ export const serializeAws_restJson1DeleteKnowledgeBaseCommand = async (
427
+ input: DeleteKnowledgeBaseCommandInput,
428
+ context: __SerdeContext
429
+ ): Promise<__HttpRequest> => {
430
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
431
+ const headers: any = {};
432
+ let resolvedPath =
433
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/knowledgeBases/{knowledgeBaseId}";
434
+ if (input.knowledgeBaseId !== undefined) {
435
+ const labelValue: string = input.knowledgeBaseId;
436
+ if (labelValue.length <= 0) {
437
+ throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
438
+ }
439
+ resolvedPath = resolvedPath.replace("{knowledgeBaseId}", __extendedEncodeURIComponent(labelValue));
440
+ } else {
441
+ throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
442
+ }
443
+ let body: any;
444
+ return new __HttpRequest({
445
+ protocol,
446
+ hostname,
447
+ port,
448
+ method: "DELETE",
449
+ headers,
450
+ path: resolvedPath,
451
+ body,
452
+ });
453
+ };
454
+
455
+ export const serializeAws_restJson1GetAssistantCommand = async (
456
+ input: GetAssistantCommandInput,
457
+ context: __SerdeContext
458
+ ): Promise<__HttpRequest> => {
459
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
460
+ const headers: any = {};
461
+ let resolvedPath =
462
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assistants/{assistantId}";
463
+ if (input.assistantId !== undefined) {
464
+ const labelValue: string = input.assistantId;
465
+ if (labelValue.length <= 0) {
466
+ throw new Error("Empty value provided for input HTTP label: assistantId.");
467
+ }
468
+ resolvedPath = resolvedPath.replace("{assistantId}", __extendedEncodeURIComponent(labelValue));
469
+ } else {
470
+ throw new Error("No value provided for input HTTP label: assistantId.");
471
+ }
472
+ let body: any;
473
+ return new __HttpRequest({
474
+ protocol,
475
+ hostname,
476
+ port,
477
+ method: "GET",
478
+ headers,
479
+ path: resolvedPath,
480
+ body,
481
+ });
482
+ };
483
+
484
+ export const serializeAws_restJson1GetAssistantAssociationCommand = async (
485
+ input: GetAssistantAssociationCommandInput,
486
+ context: __SerdeContext
487
+ ): Promise<__HttpRequest> => {
488
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
489
+ const headers: any = {};
490
+ let resolvedPath =
491
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
492
+ "/assistants/{assistantId}/associations/{assistantAssociationId}";
493
+ if (input.assistantAssociationId !== undefined) {
494
+ const labelValue: string = input.assistantAssociationId;
495
+ if (labelValue.length <= 0) {
496
+ throw new Error("Empty value provided for input HTTP label: assistantAssociationId.");
497
+ }
498
+ resolvedPath = resolvedPath.replace("{assistantAssociationId}", __extendedEncodeURIComponent(labelValue));
499
+ } else {
500
+ throw new Error("No value provided for input HTTP label: assistantAssociationId.");
501
+ }
502
+ if (input.assistantId !== undefined) {
503
+ const labelValue: string = input.assistantId;
504
+ if (labelValue.length <= 0) {
505
+ throw new Error("Empty value provided for input HTTP label: assistantId.");
506
+ }
507
+ resolvedPath = resolvedPath.replace("{assistantId}", __extendedEncodeURIComponent(labelValue));
508
+ } else {
509
+ throw new Error("No value provided for input HTTP label: assistantId.");
510
+ }
511
+ let body: any;
512
+ return new __HttpRequest({
513
+ protocol,
514
+ hostname,
515
+ port,
516
+ method: "GET",
517
+ headers,
518
+ path: resolvedPath,
519
+ body,
520
+ });
521
+ };
522
+
523
+ export const serializeAws_restJson1GetContentCommand = async (
524
+ input: GetContentCommandInput,
525
+ context: __SerdeContext
526
+ ): Promise<__HttpRequest> => {
527
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
528
+ const headers: any = {};
529
+ let resolvedPath =
530
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
531
+ "/knowledgeBases/{knowledgeBaseId}/contents/{contentId}";
532
+ if (input.contentId !== undefined) {
533
+ const labelValue: string = input.contentId;
534
+ if (labelValue.length <= 0) {
535
+ throw new Error("Empty value provided for input HTTP label: contentId.");
536
+ }
537
+ resolvedPath = resolvedPath.replace("{contentId}", __extendedEncodeURIComponent(labelValue));
538
+ } else {
539
+ throw new Error("No value provided for input HTTP label: contentId.");
540
+ }
541
+ if (input.knowledgeBaseId !== undefined) {
542
+ const labelValue: string = input.knowledgeBaseId;
543
+ if (labelValue.length <= 0) {
544
+ throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
545
+ }
546
+ resolvedPath = resolvedPath.replace("{knowledgeBaseId}", __extendedEncodeURIComponent(labelValue));
547
+ } else {
548
+ throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
549
+ }
550
+ let body: any;
551
+ return new __HttpRequest({
552
+ protocol,
553
+ hostname,
554
+ port,
555
+ method: "GET",
556
+ headers,
557
+ path: resolvedPath,
558
+ body,
559
+ });
560
+ };
561
+
562
+ export const serializeAws_restJson1GetContentSummaryCommand = async (
563
+ input: GetContentSummaryCommandInput,
564
+ context: __SerdeContext
565
+ ): Promise<__HttpRequest> => {
566
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
567
+ const headers: any = {};
568
+ let resolvedPath =
569
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
570
+ "/knowledgeBases/{knowledgeBaseId}/contents/{contentId}/summary";
571
+ if (input.contentId !== undefined) {
572
+ const labelValue: string = input.contentId;
573
+ if (labelValue.length <= 0) {
574
+ throw new Error("Empty value provided for input HTTP label: contentId.");
575
+ }
576
+ resolvedPath = resolvedPath.replace("{contentId}", __extendedEncodeURIComponent(labelValue));
577
+ } else {
578
+ throw new Error("No value provided for input HTTP label: contentId.");
579
+ }
580
+ if (input.knowledgeBaseId !== undefined) {
581
+ const labelValue: string = input.knowledgeBaseId;
582
+ if (labelValue.length <= 0) {
583
+ throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
584
+ }
585
+ resolvedPath = resolvedPath.replace("{knowledgeBaseId}", __extendedEncodeURIComponent(labelValue));
586
+ } else {
587
+ throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
588
+ }
589
+ let body: any;
590
+ return new __HttpRequest({
591
+ protocol,
592
+ hostname,
593
+ port,
594
+ method: "GET",
595
+ headers,
596
+ path: resolvedPath,
597
+ body,
598
+ });
599
+ };
600
+
601
+ export const serializeAws_restJson1GetKnowledgeBaseCommand = async (
602
+ input: GetKnowledgeBaseCommandInput,
603
+ context: __SerdeContext
604
+ ): Promise<__HttpRequest> => {
605
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
606
+ const headers: any = {};
607
+ let resolvedPath =
608
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/knowledgeBases/{knowledgeBaseId}";
609
+ if (input.knowledgeBaseId !== undefined) {
610
+ const labelValue: string = input.knowledgeBaseId;
611
+ if (labelValue.length <= 0) {
612
+ throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
613
+ }
614
+ resolvedPath = resolvedPath.replace("{knowledgeBaseId}", __extendedEncodeURIComponent(labelValue));
615
+ } else {
616
+ throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
617
+ }
618
+ let body: any;
619
+ return new __HttpRequest({
620
+ protocol,
621
+ hostname,
622
+ port,
623
+ method: "GET",
624
+ headers,
625
+ path: resolvedPath,
626
+ body,
627
+ });
628
+ };
629
+
630
+ export const serializeAws_restJson1GetRecommendationsCommand = async (
631
+ input: GetRecommendationsCommandInput,
632
+ context: __SerdeContext
633
+ ): Promise<__HttpRequest> => {
634
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
635
+ const headers: any = {};
636
+ let resolvedPath =
637
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
638
+ "/assistants/{assistantId}/sessions/{sessionId}/recommendations";
639
+ if (input.assistantId !== undefined) {
640
+ const labelValue: string = input.assistantId;
641
+ if (labelValue.length <= 0) {
642
+ throw new Error("Empty value provided for input HTTP label: assistantId.");
643
+ }
644
+ resolvedPath = resolvedPath.replace("{assistantId}", __extendedEncodeURIComponent(labelValue));
645
+ } else {
646
+ throw new Error("No value provided for input HTTP label: assistantId.");
647
+ }
648
+ if (input.sessionId !== undefined) {
649
+ const labelValue: string = input.sessionId;
650
+ if (labelValue.length <= 0) {
651
+ throw new Error("Empty value provided for input HTTP label: sessionId.");
652
+ }
653
+ resolvedPath = resolvedPath.replace("{sessionId}", __extendedEncodeURIComponent(labelValue));
654
+ } else {
655
+ throw new Error("No value provided for input HTTP label: sessionId.");
656
+ }
657
+ const query: any = {
658
+ ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
659
+ ...(input.waitTimeSeconds !== undefined && { waitTimeSeconds: input.waitTimeSeconds.toString() }),
660
+ };
661
+ let body: any;
662
+ return new __HttpRequest({
663
+ protocol,
664
+ hostname,
665
+ port,
666
+ method: "GET",
667
+ headers,
668
+ path: resolvedPath,
669
+ query,
670
+ body,
671
+ });
672
+ };
673
+
674
+ export const serializeAws_restJson1GetSessionCommand = async (
675
+ input: GetSessionCommandInput,
676
+ context: __SerdeContext
677
+ ): Promise<__HttpRequest> => {
678
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
679
+ const headers: any = {};
680
+ let resolvedPath =
681
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
682
+ "/assistants/{assistantId}/sessions/{sessionId}";
683
+ if (input.assistantId !== undefined) {
684
+ const labelValue: string = input.assistantId;
685
+ if (labelValue.length <= 0) {
686
+ throw new Error("Empty value provided for input HTTP label: assistantId.");
687
+ }
688
+ resolvedPath = resolvedPath.replace("{assistantId}", __extendedEncodeURIComponent(labelValue));
689
+ } else {
690
+ throw new Error("No value provided for input HTTP label: assistantId.");
691
+ }
692
+ if (input.sessionId !== undefined) {
693
+ const labelValue: string = input.sessionId;
694
+ if (labelValue.length <= 0) {
695
+ throw new Error("Empty value provided for input HTTP label: sessionId.");
696
+ }
697
+ resolvedPath = resolvedPath.replace("{sessionId}", __extendedEncodeURIComponent(labelValue));
698
+ } else {
699
+ throw new Error("No value provided for input HTTP label: sessionId.");
700
+ }
701
+ let body: any;
702
+ return new __HttpRequest({
703
+ protocol,
704
+ hostname,
705
+ port,
706
+ method: "GET",
707
+ headers,
708
+ path: resolvedPath,
709
+ body,
710
+ });
711
+ };
712
+
713
+ export const serializeAws_restJson1ListAssistantAssociationsCommand = async (
714
+ input: ListAssistantAssociationsCommandInput,
715
+ context: __SerdeContext
716
+ ): Promise<__HttpRequest> => {
717
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
718
+ const headers: any = {};
719
+ let resolvedPath =
720
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assistants/{assistantId}/associations";
721
+ if (input.assistantId !== undefined) {
722
+ const labelValue: string = input.assistantId;
723
+ if (labelValue.length <= 0) {
724
+ throw new Error("Empty value provided for input HTTP label: assistantId.");
725
+ }
726
+ resolvedPath = resolvedPath.replace("{assistantId}", __extendedEncodeURIComponent(labelValue));
727
+ } else {
728
+ throw new Error("No value provided for input HTTP label: assistantId.");
729
+ }
730
+ const query: any = {
731
+ ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
732
+ ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
733
+ };
734
+ let body: any;
735
+ return new __HttpRequest({
736
+ protocol,
737
+ hostname,
738
+ port,
739
+ method: "GET",
740
+ headers,
741
+ path: resolvedPath,
742
+ query,
743
+ body,
744
+ });
745
+ };
746
+
747
+ export const serializeAws_restJson1ListAssistantsCommand = async (
748
+ input: ListAssistantsCommandInput,
749
+ context: __SerdeContext
750
+ ): Promise<__HttpRequest> => {
751
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
752
+ const headers: any = {};
753
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assistants";
754
+ const query: any = {
755
+ ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
756
+ ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
757
+ };
758
+ let body: any;
759
+ return new __HttpRequest({
760
+ protocol,
761
+ hostname,
762
+ port,
763
+ method: "GET",
764
+ headers,
765
+ path: resolvedPath,
766
+ query,
767
+ body,
768
+ });
769
+ };
770
+
771
+ export const serializeAws_restJson1ListContentsCommand = async (
772
+ input: ListContentsCommandInput,
773
+ context: __SerdeContext
774
+ ): Promise<__HttpRequest> => {
775
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
776
+ const headers: any = {};
777
+ let resolvedPath =
778
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
779
+ "/knowledgeBases/{knowledgeBaseId}/contents";
780
+ if (input.knowledgeBaseId !== undefined) {
781
+ const labelValue: string = input.knowledgeBaseId;
782
+ if (labelValue.length <= 0) {
783
+ throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
784
+ }
785
+ resolvedPath = resolvedPath.replace("{knowledgeBaseId}", __extendedEncodeURIComponent(labelValue));
786
+ } else {
787
+ throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
788
+ }
789
+ const query: any = {
790
+ ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
791
+ ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
792
+ };
793
+ let body: any;
794
+ return new __HttpRequest({
795
+ protocol,
796
+ hostname,
797
+ port,
798
+ method: "GET",
799
+ headers,
800
+ path: resolvedPath,
801
+ query,
802
+ body,
803
+ });
804
+ };
805
+
806
+ export const serializeAws_restJson1ListKnowledgeBasesCommand = async (
807
+ input: ListKnowledgeBasesCommandInput,
808
+ context: __SerdeContext
809
+ ): Promise<__HttpRequest> => {
810
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
811
+ const headers: any = {};
812
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/knowledgeBases";
813
+ const query: any = {
814
+ ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
815
+ ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
816
+ };
817
+ let body: any;
818
+ return new __HttpRequest({
819
+ protocol,
820
+ hostname,
821
+ port,
822
+ method: "GET",
823
+ headers,
824
+ path: resolvedPath,
825
+ query,
826
+ body,
827
+ });
828
+ };
829
+
830
+ export const serializeAws_restJson1ListTagsForResourceCommand = async (
831
+ input: ListTagsForResourceCommandInput,
832
+ context: __SerdeContext
833
+ ): Promise<__HttpRequest> => {
834
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
835
+ const headers: any = {};
836
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
837
+ if (input.resourceArn !== undefined) {
838
+ const labelValue: string = input.resourceArn;
839
+ if (labelValue.length <= 0) {
840
+ throw new Error("Empty value provided for input HTTP label: resourceArn.");
841
+ }
842
+ resolvedPath = resolvedPath.replace("{resourceArn}", __extendedEncodeURIComponent(labelValue));
843
+ } else {
844
+ throw new Error("No value provided for input HTTP label: resourceArn.");
845
+ }
846
+ let body: any;
847
+ return new __HttpRequest({
848
+ protocol,
849
+ hostname,
850
+ port,
851
+ method: "GET",
852
+ headers,
853
+ path: resolvedPath,
854
+ body,
855
+ });
856
+ };
857
+
858
+ export const serializeAws_restJson1NotifyRecommendationsReceivedCommand = async (
859
+ input: NotifyRecommendationsReceivedCommandInput,
860
+ context: __SerdeContext
861
+ ): Promise<__HttpRequest> => {
862
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
863
+ const headers: any = {
864
+ "content-type": "application/json",
865
+ };
866
+ let resolvedPath =
867
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
868
+ "/assistants/{assistantId}/sessions/{sessionId}/recommendations/notify";
869
+ if (input.assistantId !== undefined) {
870
+ const labelValue: string = input.assistantId;
871
+ if (labelValue.length <= 0) {
872
+ throw new Error("Empty value provided for input HTTP label: assistantId.");
873
+ }
874
+ resolvedPath = resolvedPath.replace("{assistantId}", __extendedEncodeURIComponent(labelValue));
875
+ } else {
876
+ throw new Error("No value provided for input HTTP label: assistantId.");
877
+ }
878
+ if (input.sessionId !== undefined) {
879
+ const labelValue: string = input.sessionId;
880
+ if (labelValue.length <= 0) {
881
+ throw new Error("Empty value provided for input HTTP label: sessionId.");
882
+ }
883
+ resolvedPath = resolvedPath.replace("{sessionId}", __extendedEncodeURIComponent(labelValue));
884
+ } else {
885
+ throw new Error("No value provided for input HTTP label: sessionId.");
886
+ }
887
+ let body: any;
888
+ body = JSON.stringify({
889
+ ...(input.recommendationIds !== undefined &&
890
+ input.recommendationIds !== null && {
891
+ recommendationIds: serializeAws_restJson1RecommendationIdList(input.recommendationIds, context),
892
+ }),
893
+ });
894
+ return new __HttpRequest({
895
+ protocol,
896
+ hostname,
897
+ port,
898
+ method: "POST",
899
+ headers,
900
+ path: resolvedPath,
901
+ body,
902
+ });
903
+ };
904
+
905
+ export const serializeAws_restJson1QueryAssistantCommand = async (
906
+ input: QueryAssistantCommandInput,
907
+ context: __SerdeContext
908
+ ): Promise<__HttpRequest> => {
909
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
910
+ const headers: any = {
911
+ "content-type": "application/json",
912
+ };
913
+ let resolvedPath =
914
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assistants/{assistantId}/query";
915
+ if (input.assistantId !== undefined) {
916
+ const labelValue: string = input.assistantId;
917
+ if (labelValue.length <= 0) {
918
+ throw new Error("Empty value provided for input HTTP label: assistantId.");
919
+ }
920
+ resolvedPath = resolvedPath.replace("{assistantId}", __extendedEncodeURIComponent(labelValue));
921
+ } else {
922
+ throw new Error("No value provided for input HTTP label: assistantId.");
923
+ }
924
+ let body: any;
925
+ body = JSON.stringify({
926
+ ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }),
927
+ ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }),
928
+ ...(input.queryText !== undefined && input.queryText !== null && { queryText: input.queryText }),
929
+ });
930
+ return new __HttpRequest({
931
+ protocol,
932
+ hostname,
933
+ port,
934
+ method: "POST",
935
+ headers,
936
+ path: resolvedPath,
937
+ body,
938
+ });
939
+ };
940
+
941
+ export const serializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommand = async (
942
+ input: RemoveKnowledgeBaseTemplateUriCommandInput,
943
+ context: __SerdeContext
944
+ ): Promise<__HttpRequest> => {
945
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
946
+ const headers: any = {};
947
+ let resolvedPath =
948
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
949
+ "/knowledgeBases/{knowledgeBaseId}/templateUri";
950
+ if (input.knowledgeBaseId !== undefined) {
951
+ const labelValue: string = input.knowledgeBaseId;
952
+ if (labelValue.length <= 0) {
953
+ throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
954
+ }
955
+ resolvedPath = resolvedPath.replace("{knowledgeBaseId}", __extendedEncodeURIComponent(labelValue));
956
+ } else {
957
+ throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
958
+ }
959
+ let body: any;
960
+ return new __HttpRequest({
961
+ protocol,
962
+ hostname,
963
+ port,
964
+ method: "DELETE",
965
+ headers,
966
+ path: resolvedPath,
967
+ body,
968
+ });
969
+ };
970
+
971
+ export const serializeAws_restJson1SearchContentCommand = async (
972
+ input: SearchContentCommandInput,
973
+ context: __SerdeContext
974
+ ): Promise<__HttpRequest> => {
975
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
976
+ const headers: any = {
977
+ "content-type": "application/json",
978
+ };
979
+ let resolvedPath =
980
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/knowledgeBases/{knowledgeBaseId}/search";
981
+ if (input.knowledgeBaseId !== undefined) {
982
+ const labelValue: string = input.knowledgeBaseId;
983
+ if (labelValue.length <= 0) {
984
+ throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
985
+ }
986
+ resolvedPath = resolvedPath.replace("{knowledgeBaseId}", __extendedEncodeURIComponent(labelValue));
987
+ } else {
988
+ throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
989
+ }
990
+ const query: any = {
991
+ ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
992
+ ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
993
+ };
994
+ let body: any;
995
+ body = JSON.stringify({
996
+ ...(input.searchExpression !== undefined &&
997
+ input.searchExpression !== null && {
998
+ searchExpression: serializeAws_restJson1SearchExpression(input.searchExpression, context),
999
+ }),
1000
+ });
1001
+ return new __HttpRequest({
1002
+ protocol,
1003
+ hostname,
1004
+ port,
1005
+ method: "POST",
1006
+ headers,
1007
+ path: resolvedPath,
1008
+ query,
1009
+ body,
1010
+ });
1011
+ };
1012
+
1013
+ export const serializeAws_restJson1SearchSessionsCommand = async (
1014
+ input: SearchSessionsCommandInput,
1015
+ context: __SerdeContext
1016
+ ): Promise<__HttpRequest> => {
1017
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1018
+ const headers: any = {
1019
+ "content-type": "application/json",
1020
+ };
1021
+ let resolvedPath =
1022
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assistants/{assistantId}/searchSessions";
1023
+ if (input.assistantId !== undefined) {
1024
+ const labelValue: string = input.assistantId;
1025
+ if (labelValue.length <= 0) {
1026
+ throw new Error("Empty value provided for input HTTP label: assistantId.");
1027
+ }
1028
+ resolvedPath = resolvedPath.replace("{assistantId}", __extendedEncodeURIComponent(labelValue));
1029
+ } else {
1030
+ throw new Error("No value provided for input HTTP label: assistantId.");
1031
+ }
1032
+ const query: any = {
1033
+ ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
1034
+ ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
1035
+ };
1036
+ let body: any;
1037
+ body = JSON.stringify({
1038
+ ...(input.searchExpression !== undefined &&
1039
+ input.searchExpression !== null && {
1040
+ searchExpression: serializeAws_restJson1SearchExpression(input.searchExpression, context),
1041
+ }),
1042
+ });
1043
+ return new __HttpRequest({
1044
+ protocol,
1045
+ hostname,
1046
+ port,
1047
+ method: "POST",
1048
+ headers,
1049
+ path: resolvedPath,
1050
+ query,
1051
+ body,
1052
+ });
1053
+ };
1054
+
1055
+ export const serializeAws_restJson1StartContentUploadCommand = async (
1056
+ input: StartContentUploadCommandInput,
1057
+ context: __SerdeContext
1058
+ ): Promise<__HttpRequest> => {
1059
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1060
+ const headers: any = {
1061
+ "content-type": "application/json",
1062
+ };
1063
+ let resolvedPath =
1064
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/knowledgeBases/{knowledgeBaseId}/upload";
1065
+ if (input.knowledgeBaseId !== undefined) {
1066
+ const labelValue: string = input.knowledgeBaseId;
1067
+ if (labelValue.length <= 0) {
1068
+ throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
1069
+ }
1070
+ resolvedPath = resolvedPath.replace("{knowledgeBaseId}", __extendedEncodeURIComponent(labelValue));
1071
+ } else {
1072
+ throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
1073
+ }
1074
+ let body: any;
1075
+ body = JSON.stringify({
1076
+ ...(input.contentType !== undefined && input.contentType !== null && { contentType: input.contentType }),
1077
+ });
1078
+ return new __HttpRequest({
1079
+ protocol,
1080
+ hostname,
1081
+ port,
1082
+ method: "POST",
1083
+ headers,
1084
+ path: resolvedPath,
1085
+ body,
1086
+ });
1087
+ };
1088
+
1089
+ export const serializeAws_restJson1TagResourceCommand = async (
1090
+ input: TagResourceCommandInput,
1091
+ context: __SerdeContext
1092
+ ): Promise<__HttpRequest> => {
1093
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1094
+ const headers: any = {
1095
+ "content-type": "application/json",
1096
+ };
1097
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
1098
+ if (input.resourceArn !== undefined) {
1099
+ const labelValue: string = input.resourceArn;
1100
+ if (labelValue.length <= 0) {
1101
+ throw new Error("Empty value provided for input HTTP label: resourceArn.");
1102
+ }
1103
+ resolvedPath = resolvedPath.replace("{resourceArn}", __extendedEncodeURIComponent(labelValue));
1104
+ } else {
1105
+ throw new Error("No value provided for input HTTP label: resourceArn.");
1106
+ }
1107
+ let body: any;
1108
+ body = JSON.stringify({
1109
+ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }),
1110
+ });
1111
+ return new __HttpRequest({
1112
+ protocol,
1113
+ hostname,
1114
+ port,
1115
+ method: "POST",
1116
+ headers,
1117
+ path: resolvedPath,
1118
+ body,
1119
+ });
1120
+ };
1121
+
1122
+ export const serializeAws_restJson1UntagResourceCommand = async (
1123
+ input: UntagResourceCommandInput,
1124
+ context: __SerdeContext
1125
+ ): Promise<__HttpRequest> => {
1126
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1127
+ const headers: any = {};
1128
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
1129
+ if (input.resourceArn !== undefined) {
1130
+ const labelValue: string = input.resourceArn;
1131
+ if (labelValue.length <= 0) {
1132
+ throw new Error("Empty value provided for input HTTP label: resourceArn.");
1133
+ }
1134
+ resolvedPath = resolvedPath.replace("{resourceArn}", __extendedEncodeURIComponent(labelValue));
1135
+ } else {
1136
+ throw new Error("No value provided for input HTTP label: resourceArn.");
1137
+ }
1138
+ const query: any = {
1139
+ ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry as any) }),
1140
+ };
1141
+ let body: any;
1142
+ return new __HttpRequest({
1143
+ protocol,
1144
+ hostname,
1145
+ port,
1146
+ method: "DELETE",
1147
+ headers,
1148
+ path: resolvedPath,
1149
+ query,
1150
+ body,
1151
+ });
1152
+ };
1153
+
1154
+ export const serializeAws_restJson1UpdateContentCommand = async (
1155
+ input: UpdateContentCommandInput,
1156
+ context: __SerdeContext
1157
+ ): Promise<__HttpRequest> => {
1158
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1159
+ const headers: any = {
1160
+ "content-type": "application/json",
1161
+ };
1162
+ let resolvedPath =
1163
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
1164
+ "/knowledgeBases/{knowledgeBaseId}/contents/{contentId}";
1165
+ if (input.knowledgeBaseId !== undefined) {
1166
+ const labelValue: string = input.knowledgeBaseId;
1167
+ if (labelValue.length <= 0) {
1168
+ throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
1169
+ }
1170
+ resolvedPath = resolvedPath.replace("{knowledgeBaseId}", __extendedEncodeURIComponent(labelValue));
1171
+ } else {
1172
+ throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
1173
+ }
1174
+ if (input.contentId !== undefined) {
1175
+ const labelValue: string = input.contentId;
1176
+ if (labelValue.length <= 0) {
1177
+ throw new Error("Empty value provided for input HTTP label: contentId.");
1178
+ }
1179
+ resolvedPath = resolvedPath.replace("{contentId}", __extendedEncodeURIComponent(labelValue));
1180
+ } else {
1181
+ throw new Error("No value provided for input HTTP label: contentId.");
1182
+ }
1183
+ let body: any;
1184
+ body = JSON.stringify({
1185
+ ...(input.metadata !== undefined &&
1186
+ input.metadata !== null && { metadata: serializeAws_restJson1ContentMetadata(input.metadata, context) }),
1187
+ ...(input.overrideLinkOutUri !== undefined &&
1188
+ input.overrideLinkOutUri !== null && { overrideLinkOutUri: input.overrideLinkOutUri }),
1189
+ ...(input.removeOverrideLinkOutUri !== undefined &&
1190
+ input.removeOverrideLinkOutUri !== null && { removeOverrideLinkOutUri: input.removeOverrideLinkOutUri }),
1191
+ ...(input.revisionId !== undefined && input.revisionId !== null && { revisionId: input.revisionId }),
1192
+ ...(input.title !== undefined && input.title !== null && { title: input.title }),
1193
+ ...(input.uploadId !== undefined && input.uploadId !== null && { uploadId: input.uploadId }),
1194
+ });
1195
+ return new __HttpRequest({
1196
+ protocol,
1197
+ hostname,
1198
+ port,
1199
+ method: "POST",
1200
+ headers,
1201
+ path: resolvedPath,
1202
+ body,
1203
+ });
1204
+ };
1205
+
1206
+ export const serializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommand = async (
1207
+ input: UpdateKnowledgeBaseTemplateUriCommandInput,
1208
+ context: __SerdeContext
1209
+ ): Promise<__HttpRequest> => {
1210
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1211
+ const headers: any = {
1212
+ "content-type": "application/json",
1213
+ };
1214
+ let resolvedPath =
1215
+ `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
1216
+ "/knowledgeBases/{knowledgeBaseId}/templateUri";
1217
+ if (input.knowledgeBaseId !== undefined) {
1218
+ const labelValue: string = input.knowledgeBaseId;
1219
+ if (labelValue.length <= 0) {
1220
+ throw new Error("Empty value provided for input HTTP label: knowledgeBaseId.");
1221
+ }
1222
+ resolvedPath = resolvedPath.replace("{knowledgeBaseId}", __extendedEncodeURIComponent(labelValue));
1223
+ } else {
1224
+ throw new Error("No value provided for input HTTP label: knowledgeBaseId.");
1225
+ }
1226
+ let body: any;
1227
+ body = JSON.stringify({
1228
+ ...(input.templateUri !== undefined && input.templateUri !== null && { templateUri: input.templateUri }),
1229
+ });
1230
+ return new __HttpRequest({
1231
+ protocol,
1232
+ hostname,
1233
+ port,
1234
+ method: "POST",
1235
+ headers,
1236
+ path: resolvedPath,
1237
+ body,
1238
+ });
1239
+ };
1240
+
1241
+ export const deserializeAws_restJson1CreateAssistantCommand = async (
1242
+ output: __HttpResponse,
1243
+ context: __SerdeContext
1244
+ ): Promise<CreateAssistantCommandOutput> => {
1245
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1246
+ return deserializeAws_restJson1CreateAssistantCommandError(output, context);
1247
+ }
1248
+ const contents: CreateAssistantCommandOutput = {
1249
+ $metadata: deserializeMetadata(output),
1250
+ assistant: undefined,
1251
+ };
1252
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1253
+ if (data.assistant !== undefined && data.assistant !== null) {
1254
+ contents.assistant = deserializeAws_restJson1AssistantData(data.assistant, context);
1255
+ }
1256
+ return Promise.resolve(contents);
1257
+ };
1258
+
1259
+ const deserializeAws_restJson1CreateAssistantCommandError = async (
1260
+ output: __HttpResponse,
1261
+ context: __SerdeContext
1262
+ ): Promise<CreateAssistantCommandOutput> => {
1263
+ const parsedOutput: any = {
1264
+ ...output,
1265
+ body: await parseBody(output.body, context),
1266
+ };
1267
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1268
+ let errorCode = "UnknownError";
1269
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1270
+ switch (errorCode) {
1271
+ case "AccessDeniedException":
1272
+ case "com.amazonaws.wisdom#AccessDeniedException":
1273
+ response = {
1274
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1275
+ name: errorCode,
1276
+ $metadata: deserializeMetadata(output),
1277
+ };
1278
+ break;
1279
+ case "ConflictException":
1280
+ case "com.amazonaws.wisdom#ConflictException":
1281
+ response = {
1282
+ ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
1283
+ name: errorCode,
1284
+ $metadata: deserializeMetadata(output),
1285
+ };
1286
+ break;
1287
+ case "ServiceQuotaExceededException":
1288
+ case "com.amazonaws.wisdom#ServiceQuotaExceededException":
1289
+ response = {
1290
+ ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
1291
+ name: errorCode,
1292
+ $metadata: deserializeMetadata(output),
1293
+ };
1294
+ break;
1295
+ case "ValidationException":
1296
+ case "com.amazonaws.wisdom#ValidationException":
1297
+ response = {
1298
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1299
+ name: errorCode,
1300
+ $metadata: deserializeMetadata(output),
1301
+ };
1302
+ break;
1303
+ default:
1304
+ const parsedBody = parsedOutput.body;
1305
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
1306
+ response = {
1307
+ ...parsedBody,
1308
+ name: `${errorCode}`,
1309
+ message: parsedBody.message || parsedBody.Message || errorCode,
1310
+ $fault: "client",
1311
+ $metadata: deserializeMetadata(output),
1312
+ } as any;
1313
+ }
1314
+ const message = response.message || response.Message || errorCode;
1315
+ response.message = message;
1316
+ delete response.Message;
1317
+ return Promise.reject(Object.assign(new Error(message), response));
1318
+ };
1319
+
1320
+ export const deserializeAws_restJson1CreateAssistantAssociationCommand = async (
1321
+ output: __HttpResponse,
1322
+ context: __SerdeContext
1323
+ ): Promise<CreateAssistantAssociationCommandOutput> => {
1324
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1325
+ return deserializeAws_restJson1CreateAssistantAssociationCommandError(output, context);
1326
+ }
1327
+ const contents: CreateAssistantAssociationCommandOutput = {
1328
+ $metadata: deserializeMetadata(output),
1329
+ assistantAssociation: undefined,
1330
+ };
1331
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1332
+ if (data.assistantAssociation !== undefined && data.assistantAssociation !== null) {
1333
+ contents.assistantAssociation = deserializeAws_restJson1AssistantAssociationData(
1334
+ data.assistantAssociation,
1335
+ context
1336
+ );
1337
+ }
1338
+ return Promise.resolve(contents);
1339
+ };
1340
+
1341
+ const deserializeAws_restJson1CreateAssistantAssociationCommandError = async (
1342
+ output: __HttpResponse,
1343
+ context: __SerdeContext
1344
+ ): Promise<CreateAssistantAssociationCommandOutput> => {
1345
+ const parsedOutput: any = {
1346
+ ...output,
1347
+ body: await parseBody(output.body, context),
1348
+ };
1349
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1350
+ let errorCode = "UnknownError";
1351
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1352
+ switch (errorCode) {
1353
+ case "AccessDeniedException":
1354
+ case "com.amazonaws.wisdom#AccessDeniedException":
1355
+ response = {
1356
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1357
+ name: errorCode,
1358
+ $metadata: deserializeMetadata(output),
1359
+ };
1360
+ break;
1361
+ case "ConflictException":
1362
+ case "com.amazonaws.wisdom#ConflictException":
1363
+ response = {
1364
+ ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
1365
+ name: errorCode,
1366
+ $metadata: deserializeMetadata(output),
1367
+ };
1368
+ break;
1369
+ case "ResourceNotFoundException":
1370
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
1371
+ response = {
1372
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1373
+ name: errorCode,
1374
+ $metadata: deserializeMetadata(output),
1375
+ };
1376
+ break;
1377
+ case "ServiceQuotaExceededException":
1378
+ case "com.amazonaws.wisdom#ServiceQuotaExceededException":
1379
+ response = {
1380
+ ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
1381
+ name: errorCode,
1382
+ $metadata: deserializeMetadata(output),
1383
+ };
1384
+ break;
1385
+ case "ValidationException":
1386
+ case "com.amazonaws.wisdom#ValidationException":
1387
+ response = {
1388
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1389
+ name: errorCode,
1390
+ $metadata: deserializeMetadata(output),
1391
+ };
1392
+ break;
1393
+ default:
1394
+ const parsedBody = parsedOutput.body;
1395
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
1396
+ response = {
1397
+ ...parsedBody,
1398
+ name: `${errorCode}`,
1399
+ message: parsedBody.message || parsedBody.Message || errorCode,
1400
+ $fault: "client",
1401
+ $metadata: deserializeMetadata(output),
1402
+ } as any;
1403
+ }
1404
+ const message = response.message || response.Message || errorCode;
1405
+ response.message = message;
1406
+ delete response.Message;
1407
+ return Promise.reject(Object.assign(new Error(message), response));
1408
+ };
1409
+
1410
+ export const deserializeAws_restJson1CreateContentCommand = async (
1411
+ output: __HttpResponse,
1412
+ context: __SerdeContext
1413
+ ): Promise<CreateContentCommandOutput> => {
1414
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1415
+ return deserializeAws_restJson1CreateContentCommandError(output, context);
1416
+ }
1417
+ const contents: CreateContentCommandOutput = {
1418
+ $metadata: deserializeMetadata(output),
1419
+ content: undefined,
1420
+ };
1421
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1422
+ if (data.content !== undefined && data.content !== null) {
1423
+ contents.content = deserializeAws_restJson1ContentData(data.content, context);
1424
+ }
1425
+ return Promise.resolve(contents);
1426
+ };
1427
+
1428
+ const deserializeAws_restJson1CreateContentCommandError = async (
1429
+ output: __HttpResponse,
1430
+ context: __SerdeContext
1431
+ ): Promise<CreateContentCommandOutput> => {
1432
+ const parsedOutput: any = {
1433
+ ...output,
1434
+ body: await parseBody(output.body, context),
1435
+ };
1436
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1437
+ let errorCode = "UnknownError";
1438
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1439
+ switch (errorCode) {
1440
+ case "AccessDeniedException":
1441
+ case "com.amazonaws.wisdom#AccessDeniedException":
1442
+ response = {
1443
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1444
+ name: errorCode,
1445
+ $metadata: deserializeMetadata(output),
1446
+ };
1447
+ break;
1448
+ case "ConflictException":
1449
+ case "com.amazonaws.wisdom#ConflictException":
1450
+ response = {
1451
+ ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
1452
+ name: errorCode,
1453
+ $metadata: deserializeMetadata(output),
1454
+ };
1455
+ break;
1456
+ case "ResourceNotFoundException":
1457
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
1458
+ response = {
1459
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1460
+ name: errorCode,
1461
+ $metadata: deserializeMetadata(output),
1462
+ };
1463
+ break;
1464
+ case "ServiceQuotaExceededException":
1465
+ case "com.amazonaws.wisdom#ServiceQuotaExceededException":
1466
+ response = {
1467
+ ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
1468
+ name: errorCode,
1469
+ $metadata: deserializeMetadata(output),
1470
+ };
1471
+ break;
1472
+ case "ValidationException":
1473
+ case "com.amazonaws.wisdom#ValidationException":
1474
+ response = {
1475
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1476
+ name: errorCode,
1477
+ $metadata: deserializeMetadata(output),
1478
+ };
1479
+ break;
1480
+ default:
1481
+ const parsedBody = parsedOutput.body;
1482
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
1483
+ response = {
1484
+ ...parsedBody,
1485
+ name: `${errorCode}`,
1486
+ message: parsedBody.message || parsedBody.Message || errorCode,
1487
+ $fault: "client",
1488
+ $metadata: deserializeMetadata(output),
1489
+ } as any;
1490
+ }
1491
+ const message = response.message || response.Message || errorCode;
1492
+ response.message = message;
1493
+ delete response.Message;
1494
+ return Promise.reject(Object.assign(new Error(message), response));
1495
+ };
1496
+
1497
+ export const deserializeAws_restJson1CreateKnowledgeBaseCommand = async (
1498
+ output: __HttpResponse,
1499
+ context: __SerdeContext
1500
+ ): Promise<CreateKnowledgeBaseCommandOutput> => {
1501
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1502
+ return deserializeAws_restJson1CreateKnowledgeBaseCommandError(output, context);
1503
+ }
1504
+ const contents: CreateKnowledgeBaseCommandOutput = {
1505
+ $metadata: deserializeMetadata(output),
1506
+ knowledgeBase: undefined,
1507
+ };
1508
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1509
+ if (data.knowledgeBase !== undefined && data.knowledgeBase !== null) {
1510
+ contents.knowledgeBase = deserializeAws_restJson1KnowledgeBaseData(data.knowledgeBase, context);
1511
+ }
1512
+ return Promise.resolve(contents);
1513
+ };
1514
+
1515
+ const deserializeAws_restJson1CreateKnowledgeBaseCommandError = async (
1516
+ output: __HttpResponse,
1517
+ context: __SerdeContext
1518
+ ): Promise<CreateKnowledgeBaseCommandOutput> => {
1519
+ const parsedOutput: any = {
1520
+ ...output,
1521
+ body: await parseBody(output.body, context),
1522
+ };
1523
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1524
+ let errorCode = "UnknownError";
1525
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1526
+ switch (errorCode) {
1527
+ case "AccessDeniedException":
1528
+ case "com.amazonaws.wisdom#AccessDeniedException":
1529
+ response = {
1530
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1531
+ name: errorCode,
1532
+ $metadata: deserializeMetadata(output),
1533
+ };
1534
+ break;
1535
+ case "ConflictException":
1536
+ case "com.amazonaws.wisdom#ConflictException":
1537
+ response = {
1538
+ ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
1539
+ name: errorCode,
1540
+ $metadata: deserializeMetadata(output),
1541
+ };
1542
+ break;
1543
+ case "ServiceQuotaExceededException":
1544
+ case "com.amazonaws.wisdom#ServiceQuotaExceededException":
1545
+ response = {
1546
+ ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
1547
+ name: errorCode,
1548
+ $metadata: deserializeMetadata(output),
1549
+ };
1550
+ break;
1551
+ case "ValidationException":
1552
+ case "com.amazonaws.wisdom#ValidationException":
1553
+ response = {
1554
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1555
+ name: errorCode,
1556
+ $metadata: deserializeMetadata(output),
1557
+ };
1558
+ break;
1559
+ default:
1560
+ const parsedBody = parsedOutput.body;
1561
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
1562
+ response = {
1563
+ ...parsedBody,
1564
+ name: `${errorCode}`,
1565
+ message: parsedBody.message || parsedBody.Message || errorCode,
1566
+ $fault: "client",
1567
+ $metadata: deserializeMetadata(output),
1568
+ } as any;
1569
+ }
1570
+ const message = response.message || response.Message || errorCode;
1571
+ response.message = message;
1572
+ delete response.Message;
1573
+ return Promise.reject(Object.assign(new Error(message), response));
1574
+ };
1575
+
1576
+ export const deserializeAws_restJson1CreateSessionCommand = async (
1577
+ output: __HttpResponse,
1578
+ context: __SerdeContext
1579
+ ): Promise<CreateSessionCommandOutput> => {
1580
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1581
+ return deserializeAws_restJson1CreateSessionCommandError(output, context);
1582
+ }
1583
+ const contents: CreateSessionCommandOutput = {
1584
+ $metadata: deserializeMetadata(output),
1585
+ session: undefined,
1586
+ };
1587
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1588
+ if (data.session !== undefined && data.session !== null) {
1589
+ contents.session = deserializeAws_restJson1SessionData(data.session, context);
1590
+ }
1591
+ return Promise.resolve(contents);
1592
+ };
1593
+
1594
+ const deserializeAws_restJson1CreateSessionCommandError = async (
1595
+ output: __HttpResponse,
1596
+ context: __SerdeContext
1597
+ ): Promise<CreateSessionCommandOutput> => {
1598
+ const parsedOutput: any = {
1599
+ ...output,
1600
+ body: await parseBody(output.body, context),
1601
+ };
1602
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1603
+ let errorCode = "UnknownError";
1604
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1605
+ switch (errorCode) {
1606
+ case "ConflictException":
1607
+ case "com.amazonaws.wisdom#ConflictException":
1608
+ response = {
1609
+ ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
1610
+ name: errorCode,
1611
+ $metadata: deserializeMetadata(output),
1612
+ };
1613
+ break;
1614
+ case "ResourceNotFoundException":
1615
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
1616
+ response = {
1617
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1618
+ name: errorCode,
1619
+ $metadata: deserializeMetadata(output),
1620
+ };
1621
+ break;
1622
+ case "ValidationException":
1623
+ case "com.amazonaws.wisdom#ValidationException":
1624
+ response = {
1625
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1626
+ name: errorCode,
1627
+ $metadata: deserializeMetadata(output),
1628
+ };
1629
+ break;
1630
+ default:
1631
+ const parsedBody = parsedOutput.body;
1632
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
1633
+ response = {
1634
+ ...parsedBody,
1635
+ name: `${errorCode}`,
1636
+ message: parsedBody.message || parsedBody.Message || errorCode,
1637
+ $fault: "client",
1638
+ $metadata: deserializeMetadata(output),
1639
+ } as any;
1640
+ }
1641
+ const message = response.message || response.Message || errorCode;
1642
+ response.message = message;
1643
+ delete response.Message;
1644
+ return Promise.reject(Object.assign(new Error(message), response));
1645
+ };
1646
+
1647
+ export const deserializeAws_restJson1DeleteAssistantCommand = async (
1648
+ output: __HttpResponse,
1649
+ context: __SerdeContext
1650
+ ): Promise<DeleteAssistantCommandOutput> => {
1651
+ if (output.statusCode !== 204 && output.statusCode >= 300) {
1652
+ return deserializeAws_restJson1DeleteAssistantCommandError(output, context);
1653
+ }
1654
+ const contents: DeleteAssistantCommandOutput = {
1655
+ $metadata: deserializeMetadata(output),
1656
+ };
1657
+ await collectBody(output.body, context);
1658
+ return Promise.resolve(contents);
1659
+ };
1660
+
1661
+ const deserializeAws_restJson1DeleteAssistantCommandError = async (
1662
+ output: __HttpResponse,
1663
+ context: __SerdeContext
1664
+ ): Promise<DeleteAssistantCommandOutput> => {
1665
+ const parsedOutput: any = {
1666
+ ...output,
1667
+ body: await parseBody(output.body, context),
1668
+ };
1669
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1670
+ let errorCode = "UnknownError";
1671
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1672
+ switch (errorCode) {
1673
+ case "AccessDeniedException":
1674
+ case "com.amazonaws.wisdom#AccessDeniedException":
1675
+ response = {
1676
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1677
+ name: errorCode,
1678
+ $metadata: deserializeMetadata(output),
1679
+ };
1680
+ break;
1681
+ case "ResourceNotFoundException":
1682
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
1683
+ response = {
1684
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1685
+ name: errorCode,
1686
+ $metadata: deserializeMetadata(output),
1687
+ };
1688
+ break;
1689
+ case "ValidationException":
1690
+ case "com.amazonaws.wisdom#ValidationException":
1691
+ response = {
1692
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1693
+ name: errorCode,
1694
+ $metadata: deserializeMetadata(output),
1695
+ };
1696
+ break;
1697
+ default:
1698
+ const parsedBody = parsedOutput.body;
1699
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
1700
+ response = {
1701
+ ...parsedBody,
1702
+ name: `${errorCode}`,
1703
+ message: parsedBody.message || parsedBody.Message || errorCode,
1704
+ $fault: "client",
1705
+ $metadata: deserializeMetadata(output),
1706
+ } as any;
1707
+ }
1708
+ const message = response.message || response.Message || errorCode;
1709
+ response.message = message;
1710
+ delete response.Message;
1711
+ return Promise.reject(Object.assign(new Error(message), response));
1712
+ };
1713
+
1714
+ export const deserializeAws_restJson1DeleteAssistantAssociationCommand = async (
1715
+ output: __HttpResponse,
1716
+ context: __SerdeContext
1717
+ ): Promise<DeleteAssistantAssociationCommandOutput> => {
1718
+ if (output.statusCode !== 204 && output.statusCode >= 300) {
1719
+ return deserializeAws_restJson1DeleteAssistantAssociationCommandError(output, context);
1720
+ }
1721
+ const contents: DeleteAssistantAssociationCommandOutput = {
1722
+ $metadata: deserializeMetadata(output),
1723
+ };
1724
+ await collectBody(output.body, context);
1725
+ return Promise.resolve(contents);
1726
+ };
1727
+
1728
+ const deserializeAws_restJson1DeleteAssistantAssociationCommandError = async (
1729
+ output: __HttpResponse,
1730
+ context: __SerdeContext
1731
+ ): Promise<DeleteAssistantAssociationCommandOutput> => {
1732
+ const parsedOutput: any = {
1733
+ ...output,
1734
+ body: await parseBody(output.body, context),
1735
+ };
1736
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1737
+ let errorCode = "UnknownError";
1738
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1739
+ switch (errorCode) {
1740
+ case "AccessDeniedException":
1741
+ case "com.amazonaws.wisdom#AccessDeniedException":
1742
+ response = {
1743
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1744
+ name: errorCode,
1745
+ $metadata: deserializeMetadata(output),
1746
+ };
1747
+ break;
1748
+ case "ResourceNotFoundException":
1749
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
1750
+ response = {
1751
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1752
+ name: errorCode,
1753
+ $metadata: deserializeMetadata(output),
1754
+ };
1755
+ break;
1756
+ case "ValidationException":
1757
+ case "com.amazonaws.wisdom#ValidationException":
1758
+ response = {
1759
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1760
+ name: errorCode,
1761
+ $metadata: deserializeMetadata(output),
1762
+ };
1763
+ break;
1764
+ default:
1765
+ const parsedBody = parsedOutput.body;
1766
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
1767
+ response = {
1768
+ ...parsedBody,
1769
+ name: `${errorCode}`,
1770
+ message: parsedBody.message || parsedBody.Message || errorCode,
1771
+ $fault: "client",
1772
+ $metadata: deserializeMetadata(output),
1773
+ } as any;
1774
+ }
1775
+ const message = response.message || response.Message || errorCode;
1776
+ response.message = message;
1777
+ delete response.Message;
1778
+ return Promise.reject(Object.assign(new Error(message), response));
1779
+ };
1780
+
1781
+ export const deserializeAws_restJson1DeleteContentCommand = async (
1782
+ output: __HttpResponse,
1783
+ context: __SerdeContext
1784
+ ): Promise<DeleteContentCommandOutput> => {
1785
+ if (output.statusCode !== 204 && output.statusCode >= 300) {
1786
+ return deserializeAws_restJson1DeleteContentCommandError(output, context);
1787
+ }
1788
+ const contents: DeleteContentCommandOutput = {
1789
+ $metadata: deserializeMetadata(output),
1790
+ };
1791
+ await collectBody(output.body, context);
1792
+ return Promise.resolve(contents);
1793
+ };
1794
+
1795
+ const deserializeAws_restJson1DeleteContentCommandError = async (
1796
+ output: __HttpResponse,
1797
+ context: __SerdeContext
1798
+ ): Promise<DeleteContentCommandOutput> => {
1799
+ const parsedOutput: any = {
1800
+ ...output,
1801
+ body: await parseBody(output.body, context),
1802
+ };
1803
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1804
+ let errorCode = "UnknownError";
1805
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1806
+ switch (errorCode) {
1807
+ case "AccessDeniedException":
1808
+ case "com.amazonaws.wisdom#AccessDeniedException":
1809
+ response = {
1810
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1811
+ name: errorCode,
1812
+ $metadata: deserializeMetadata(output),
1813
+ };
1814
+ break;
1815
+ case "ResourceNotFoundException":
1816
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
1817
+ response = {
1818
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1819
+ name: errorCode,
1820
+ $metadata: deserializeMetadata(output),
1821
+ };
1822
+ break;
1823
+ case "ValidationException":
1824
+ case "com.amazonaws.wisdom#ValidationException":
1825
+ response = {
1826
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1827
+ name: errorCode,
1828
+ $metadata: deserializeMetadata(output),
1829
+ };
1830
+ break;
1831
+ default:
1832
+ const parsedBody = parsedOutput.body;
1833
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
1834
+ response = {
1835
+ ...parsedBody,
1836
+ name: `${errorCode}`,
1837
+ message: parsedBody.message || parsedBody.Message || errorCode,
1838
+ $fault: "client",
1839
+ $metadata: deserializeMetadata(output),
1840
+ } as any;
1841
+ }
1842
+ const message = response.message || response.Message || errorCode;
1843
+ response.message = message;
1844
+ delete response.Message;
1845
+ return Promise.reject(Object.assign(new Error(message), response));
1846
+ };
1847
+
1848
+ export const deserializeAws_restJson1DeleteKnowledgeBaseCommand = async (
1849
+ output: __HttpResponse,
1850
+ context: __SerdeContext
1851
+ ): Promise<DeleteKnowledgeBaseCommandOutput> => {
1852
+ if (output.statusCode !== 204 && output.statusCode >= 300) {
1853
+ return deserializeAws_restJson1DeleteKnowledgeBaseCommandError(output, context);
1854
+ }
1855
+ const contents: DeleteKnowledgeBaseCommandOutput = {
1856
+ $metadata: deserializeMetadata(output),
1857
+ };
1858
+ await collectBody(output.body, context);
1859
+ return Promise.resolve(contents);
1860
+ };
1861
+
1862
+ const deserializeAws_restJson1DeleteKnowledgeBaseCommandError = async (
1863
+ output: __HttpResponse,
1864
+ context: __SerdeContext
1865
+ ): Promise<DeleteKnowledgeBaseCommandOutput> => {
1866
+ const parsedOutput: any = {
1867
+ ...output,
1868
+ body: await parseBody(output.body, context),
1869
+ };
1870
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1871
+ let errorCode = "UnknownError";
1872
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1873
+ switch (errorCode) {
1874
+ case "AccessDeniedException":
1875
+ case "com.amazonaws.wisdom#AccessDeniedException":
1876
+ response = {
1877
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1878
+ name: errorCode,
1879
+ $metadata: deserializeMetadata(output),
1880
+ };
1881
+ break;
1882
+ case "ConflictException":
1883
+ case "com.amazonaws.wisdom#ConflictException":
1884
+ response = {
1885
+ ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
1886
+ name: errorCode,
1887
+ $metadata: deserializeMetadata(output),
1888
+ };
1889
+ break;
1890
+ case "ResourceNotFoundException":
1891
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
1892
+ response = {
1893
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1894
+ name: errorCode,
1895
+ $metadata: deserializeMetadata(output),
1896
+ };
1897
+ break;
1898
+ default:
1899
+ const parsedBody = parsedOutput.body;
1900
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
1901
+ response = {
1902
+ ...parsedBody,
1903
+ name: `${errorCode}`,
1904
+ message: parsedBody.message || parsedBody.Message || errorCode,
1905
+ $fault: "client",
1906
+ $metadata: deserializeMetadata(output),
1907
+ } as any;
1908
+ }
1909
+ const message = response.message || response.Message || errorCode;
1910
+ response.message = message;
1911
+ delete response.Message;
1912
+ return Promise.reject(Object.assign(new Error(message), response));
1913
+ };
1914
+
1915
+ export const deserializeAws_restJson1GetAssistantCommand = async (
1916
+ output: __HttpResponse,
1917
+ context: __SerdeContext
1918
+ ): Promise<GetAssistantCommandOutput> => {
1919
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1920
+ return deserializeAws_restJson1GetAssistantCommandError(output, context);
1921
+ }
1922
+ const contents: GetAssistantCommandOutput = {
1923
+ $metadata: deserializeMetadata(output),
1924
+ assistant: undefined,
1925
+ };
1926
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1927
+ if (data.assistant !== undefined && data.assistant !== null) {
1928
+ contents.assistant = deserializeAws_restJson1AssistantData(data.assistant, context);
1929
+ }
1930
+ return Promise.resolve(contents);
1931
+ };
1932
+
1933
+ const deserializeAws_restJson1GetAssistantCommandError = async (
1934
+ output: __HttpResponse,
1935
+ context: __SerdeContext
1936
+ ): Promise<GetAssistantCommandOutput> => {
1937
+ const parsedOutput: any = {
1938
+ ...output,
1939
+ body: await parseBody(output.body, context),
1940
+ };
1941
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1942
+ let errorCode = "UnknownError";
1943
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1944
+ switch (errorCode) {
1945
+ case "AccessDeniedException":
1946
+ case "com.amazonaws.wisdom#AccessDeniedException":
1947
+ response = {
1948
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1949
+ name: errorCode,
1950
+ $metadata: deserializeMetadata(output),
1951
+ };
1952
+ break;
1953
+ case "ResourceNotFoundException":
1954
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
1955
+ response = {
1956
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1957
+ name: errorCode,
1958
+ $metadata: deserializeMetadata(output),
1959
+ };
1960
+ break;
1961
+ case "ValidationException":
1962
+ case "com.amazonaws.wisdom#ValidationException":
1963
+ response = {
1964
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1965
+ name: errorCode,
1966
+ $metadata: deserializeMetadata(output),
1967
+ };
1968
+ break;
1969
+ default:
1970
+ const parsedBody = parsedOutput.body;
1971
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
1972
+ response = {
1973
+ ...parsedBody,
1974
+ name: `${errorCode}`,
1975
+ message: parsedBody.message || parsedBody.Message || errorCode,
1976
+ $fault: "client",
1977
+ $metadata: deserializeMetadata(output),
1978
+ } as any;
1979
+ }
1980
+ const message = response.message || response.Message || errorCode;
1981
+ response.message = message;
1982
+ delete response.Message;
1983
+ return Promise.reject(Object.assign(new Error(message), response));
1984
+ };
1985
+
1986
+ export const deserializeAws_restJson1GetAssistantAssociationCommand = async (
1987
+ output: __HttpResponse,
1988
+ context: __SerdeContext
1989
+ ): Promise<GetAssistantAssociationCommandOutput> => {
1990
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1991
+ return deserializeAws_restJson1GetAssistantAssociationCommandError(output, context);
1992
+ }
1993
+ const contents: GetAssistantAssociationCommandOutput = {
1994
+ $metadata: deserializeMetadata(output),
1995
+ assistantAssociation: undefined,
1996
+ };
1997
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1998
+ if (data.assistantAssociation !== undefined && data.assistantAssociation !== null) {
1999
+ contents.assistantAssociation = deserializeAws_restJson1AssistantAssociationData(
2000
+ data.assistantAssociation,
2001
+ context
2002
+ );
2003
+ }
2004
+ return Promise.resolve(contents);
2005
+ };
2006
+
2007
+ const deserializeAws_restJson1GetAssistantAssociationCommandError = async (
2008
+ output: __HttpResponse,
2009
+ context: __SerdeContext
2010
+ ): Promise<GetAssistantAssociationCommandOutput> => {
2011
+ const parsedOutput: any = {
2012
+ ...output,
2013
+ body: await parseBody(output.body, context),
2014
+ };
2015
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
2016
+ let errorCode = "UnknownError";
2017
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2018
+ switch (errorCode) {
2019
+ case "AccessDeniedException":
2020
+ case "com.amazonaws.wisdom#AccessDeniedException":
2021
+ response = {
2022
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2023
+ name: errorCode,
2024
+ $metadata: deserializeMetadata(output),
2025
+ };
2026
+ break;
2027
+ case "ResourceNotFoundException":
2028
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
2029
+ response = {
2030
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2031
+ name: errorCode,
2032
+ $metadata: deserializeMetadata(output),
2033
+ };
2034
+ break;
2035
+ case "ValidationException":
2036
+ case "com.amazonaws.wisdom#ValidationException":
2037
+ response = {
2038
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2039
+ name: errorCode,
2040
+ $metadata: deserializeMetadata(output),
2041
+ };
2042
+ break;
2043
+ default:
2044
+ const parsedBody = parsedOutput.body;
2045
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
2046
+ response = {
2047
+ ...parsedBody,
2048
+ name: `${errorCode}`,
2049
+ message: parsedBody.message || parsedBody.Message || errorCode,
2050
+ $fault: "client",
2051
+ $metadata: deserializeMetadata(output),
2052
+ } as any;
2053
+ }
2054
+ const message = response.message || response.Message || errorCode;
2055
+ response.message = message;
2056
+ delete response.Message;
2057
+ return Promise.reject(Object.assign(new Error(message), response));
2058
+ };
2059
+
2060
+ export const deserializeAws_restJson1GetContentCommand = async (
2061
+ output: __HttpResponse,
2062
+ context: __SerdeContext
2063
+ ): Promise<GetContentCommandOutput> => {
2064
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
2065
+ return deserializeAws_restJson1GetContentCommandError(output, context);
2066
+ }
2067
+ const contents: GetContentCommandOutput = {
2068
+ $metadata: deserializeMetadata(output),
2069
+ content: undefined,
2070
+ };
2071
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
2072
+ if (data.content !== undefined && data.content !== null) {
2073
+ contents.content = deserializeAws_restJson1ContentData(data.content, context);
2074
+ }
2075
+ return Promise.resolve(contents);
2076
+ };
2077
+
2078
+ const deserializeAws_restJson1GetContentCommandError = async (
2079
+ output: __HttpResponse,
2080
+ context: __SerdeContext
2081
+ ): Promise<GetContentCommandOutput> => {
2082
+ const parsedOutput: any = {
2083
+ ...output,
2084
+ body: await parseBody(output.body, context),
2085
+ };
2086
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
2087
+ let errorCode = "UnknownError";
2088
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2089
+ switch (errorCode) {
2090
+ case "AccessDeniedException":
2091
+ case "com.amazonaws.wisdom#AccessDeniedException":
2092
+ response = {
2093
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2094
+ name: errorCode,
2095
+ $metadata: deserializeMetadata(output),
2096
+ };
2097
+ break;
2098
+ case "ResourceNotFoundException":
2099
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
2100
+ response = {
2101
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2102
+ name: errorCode,
2103
+ $metadata: deserializeMetadata(output),
2104
+ };
2105
+ break;
2106
+ case "ValidationException":
2107
+ case "com.amazonaws.wisdom#ValidationException":
2108
+ response = {
2109
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2110
+ name: errorCode,
2111
+ $metadata: deserializeMetadata(output),
2112
+ };
2113
+ break;
2114
+ default:
2115
+ const parsedBody = parsedOutput.body;
2116
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
2117
+ response = {
2118
+ ...parsedBody,
2119
+ name: `${errorCode}`,
2120
+ message: parsedBody.message || parsedBody.Message || errorCode,
2121
+ $fault: "client",
2122
+ $metadata: deserializeMetadata(output),
2123
+ } as any;
2124
+ }
2125
+ const message = response.message || response.Message || errorCode;
2126
+ response.message = message;
2127
+ delete response.Message;
2128
+ return Promise.reject(Object.assign(new Error(message), response));
2129
+ };
2130
+
2131
+ export const deserializeAws_restJson1GetContentSummaryCommand = async (
2132
+ output: __HttpResponse,
2133
+ context: __SerdeContext
2134
+ ): Promise<GetContentSummaryCommandOutput> => {
2135
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
2136
+ return deserializeAws_restJson1GetContentSummaryCommandError(output, context);
2137
+ }
2138
+ const contents: GetContentSummaryCommandOutput = {
2139
+ $metadata: deserializeMetadata(output),
2140
+ contentSummary: undefined,
2141
+ };
2142
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
2143
+ if (data.contentSummary !== undefined && data.contentSummary !== null) {
2144
+ contents.contentSummary = deserializeAws_restJson1ContentSummary(data.contentSummary, context);
2145
+ }
2146
+ return Promise.resolve(contents);
2147
+ };
2148
+
2149
+ const deserializeAws_restJson1GetContentSummaryCommandError = async (
2150
+ output: __HttpResponse,
2151
+ context: __SerdeContext
2152
+ ): Promise<GetContentSummaryCommandOutput> => {
2153
+ const parsedOutput: any = {
2154
+ ...output,
2155
+ body: await parseBody(output.body, context),
2156
+ };
2157
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
2158
+ let errorCode = "UnknownError";
2159
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2160
+ switch (errorCode) {
2161
+ case "AccessDeniedException":
2162
+ case "com.amazonaws.wisdom#AccessDeniedException":
2163
+ response = {
2164
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2165
+ name: errorCode,
2166
+ $metadata: deserializeMetadata(output),
2167
+ };
2168
+ break;
2169
+ case "ResourceNotFoundException":
2170
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
2171
+ response = {
2172
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2173
+ name: errorCode,
2174
+ $metadata: deserializeMetadata(output),
2175
+ };
2176
+ break;
2177
+ case "ValidationException":
2178
+ case "com.amazonaws.wisdom#ValidationException":
2179
+ response = {
2180
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2181
+ name: errorCode,
2182
+ $metadata: deserializeMetadata(output),
2183
+ };
2184
+ break;
2185
+ default:
2186
+ const parsedBody = parsedOutput.body;
2187
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
2188
+ response = {
2189
+ ...parsedBody,
2190
+ name: `${errorCode}`,
2191
+ message: parsedBody.message || parsedBody.Message || errorCode,
2192
+ $fault: "client",
2193
+ $metadata: deserializeMetadata(output),
2194
+ } as any;
2195
+ }
2196
+ const message = response.message || response.Message || errorCode;
2197
+ response.message = message;
2198
+ delete response.Message;
2199
+ return Promise.reject(Object.assign(new Error(message), response));
2200
+ };
2201
+
2202
+ export const deserializeAws_restJson1GetKnowledgeBaseCommand = async (
2203
+ output: __HttpResponse,
2204
+ context: __SerdeContext
2205
+ ): Promise<GetKnowledgeBaseCommandOutput> => {
2206
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
2207
+ return deserializeAws_restJson1GetKnowledgeBaseCommandError(output, context);
2208
+ }
2209
+ const contents: GetKnowledgeBaseCommandOutput = {
2210
+ $metadata: deserializeMetadata(output),
2211
+ knowledgeBase: undefined,
2212
+ };
2213
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
2214
+ if (data.knowledgeBase !== undefined && data.knowledgeBase !== null) {
2215
+ contents.knowledgeBase = deserializeAws_restJson1KnowledgeBaseData(data.knowledgeBase, context);
2216
+ }
2217
+ return Promise.resolve(contents);
2218
+ };
2219
+
2220
+ const deserializeAws_restJson1GetKnowledgeBaseCommandError = async (
2221
+ output: __HttpResponse,
2222
+ context: __SerdeContext
2223
+ ): Promise<GetKnowledgeBaseCommandOutput> => {
2224
+ const parsedOutput: any = {
2225
+ ...output,
2226
+ body: await parseBody(output.body, context),
2227
+ };
2228
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
2229
+ let errorCode = "UnknownError";
2230
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2231
+ switch (errorCode) {
2232
+ case "AccessDeniedException":
2233
+ case "com.amazonaws.wisdom#AccessDeniedException":
2234
+ response = {
2235
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2236
+ name: errorCode,
2237
+ $metadata: deserializeMetadata(output),
2238
+ };
2239
+ break;
2240
+ case "ResourceNotFoundException":
2241
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
2242
+ response = {
2243
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2244
+ name: errorCode,
2245
+ $metadata: deserializeMetadata(output),
2246
+ };
2247
+ break;
2248
+ case "ValidationException":
2249
+ case "com.amazonaws.wisdom#ValidationException":
2250
+ response = {
2251
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2252
+ name: errorCode,
2253
+ $metadata: deserializeMetadata(output),
2254
+ };
2255
+ break;
2256
+ default:
2257
+ const parsedBody = parsedOutput.body;
2258
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
2259
+ response = {
2260
+ ...parsedBody,
2261
+ name: `${errorCode}`,
2262
+ message: parsedBody.message || parsedBody.Message || errorCode,
2263
+ $fault: "client",
2264
+ $metadata: deserializeMetadata(output),
2265
+ } as any;
2266
+ }
2267
+ const message = response.message || response.Message || errorCode;
2268
+ response.message = message;
2269
+ delete response.Message;
2270
+ return Promise.reject(Object.assign(new Error(message), response));
2271
+ };
2272
+
2273
+ export const deserializeAws_restJson1GetRecommendationsCommand = async (
2274
+ output: __HttpResponse,
2275
+ context: __SerdeContext
2276
+ ): Promise<GetRecommendationsCommandOutput> => {
2277
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
2278
+ return deserializeAws_restJson1GetRecommendationsCommandError(output, context);
2279
+ }
2280
+ const contents: GetRecommendationsCommandOutput = {
2281
+ $metadata: deserializeMetadata(output),
2282
+ recommendations: undefined,
2283
+ };
2284
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
2285
+ if (data.recommendations !== undefined && data.recommendations !== null) {
2286
+ contents.recommendations = deserializeAws_restJson1RecommendationList(data.recommendations, context);
2287
+ }
2288
+ return Promise.resolve(contents);
2289
+ };
2290
+
2291
+ const deserializeAws_restJson1GetRecommendationsCommandError = async (
2292
+ output: __HttpResponse,
2293
+ context: __SerdeContext
2294
+ ): Promise<GetRecommendationsCommandOutput> => {
2295
+ const parsedOutput: any = {
2296
+ ...output,
2297
+ body: await parseBody(output.body, context),
2298
+ };
2299
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
2300
+ let errorCode = "UnknownError";
2301
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2302
+ switch (errorCode) {
2303
+ case "AccessDeniedException":
2304
+ case "com.amazonaws.wisdom#AccessDeniedException":
2305
+ response = {
2306
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2307
+ name: errorCode,
2308
+ $metadata: deserializeMetadata(output),
2309
+ };
2310
+ break;
2311
+ case "ResourceNotFoundException":
2312
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
2313
+ response = {
2314
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2315
+ name: errorCode,
2316
+ $metadata: deserializeMetadata(output),
2317
+ };
2318
+ break;
2319
+ case "ValidationException":
2320
+ case "com.amazonaws.wisdom#ValidationException":
2321
+ response = {
2322
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2323
+ name: errorCode,
2324
+ $metadata: deserializeMetadata(output),
2325
+ };
2326
+ break;
2327
+ default:
2328
+ const parsedBody = parsedOutput.body;
2329
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
2330
+ response = {
2331
+ ...parsedBody,
2332
+ name: `${errorCode}`,
2333
+ message: parsedBody.message || parsedBody.Message || errorCode,
2334
+ $fault: "client",
2335
+ $metadata: deserializeMetadata(output),
2336
+ } as any;
2337
+ }
2338
+ const message = response.message || response.Message || errorCode;
2339
+ response.message = message;
2340
+ delete response.Message;
2341
+ return Promise.reject(Object.assign(new Error(message), response));
2342
+ };
2343
+
2344
+ export const deserializeAws_restJson1GetSessionCommand = async (
2345
+ output: __HttpResponse,
2346
+ context: __SerdeContext
2347
+ ): Promise<GetSessionCommandOutput> => {
2348
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
2349
+ return deserializeAws_restJson1GetSessionCommandError(output, context);
2350
+ }
2351
+ const contents: GetSessionCommandOutput = {
2352
+ $metadata: deserializeMetadata(output),
2353
+ session: undefined,
2354
+ };
2355
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
2356
+ if (data.session !== undefined && data.session !== null) {
2357
+ contents.session = deserializeAws_restJson1SessionData(data.session, context);
2358
+ }
2359
+ return Promise.resolve(contents);
2360
+ };
2361
+
2362
+ const deserializeAws_restJson1GetSessionCommandError = async (
2363
+ output: __HttpResponse,
2364
+ context: __SerdeContext
2365
+ ): Promise<GetSessionCommandOutput> => {
2366
+ const parsedOutput: any = {
2367
+ ...output,
2368
+ body: await parseBody(output.body, context),
2369
+ };
2370
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
2371
+ let errorCode = "UnknownError";
2372
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2373
+ switch (errorCode) {
2374
+ case "AccessDeniedException":
2375
+ case "com.amazonaws.wisdom#AccessDeniedException":
2376
+ response = {
2377
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2378
+ name: errorCode,
2379
+ $metadata: deserializeMetadata(output),
2380
+ };
2381
+ break;
2382
+ case "ResourceNotFoundException":
2383
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
2384
+ response = {
2385
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2386
+ name: errorCode,
2387
+ $metadata: deserializeMetadata(output),
2388
+ };
2389
+ break;
2390
+ case "ValidationException":
2391
+ case "com.amazonaws.wisdom#ValidationException":
2392
+ response = {
2393
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2394
+ name: errorCode,
2395
+ $metadata: deserializeMetadata(output),
2396
+ };
2397
+ break;
2398
+ default:
2399
+ const parsedBody = parsedOutput.body;
2400
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
2401
+ response = {
2402
+ ...parsedBody,
2403
+ name: `${errorCode}`,
2404
+ message: parsedBody.message || parsedBody.Message || errorCode,
2405
+ $fault: "client",
2406
+ $metadata: deserializeMetadata(output),
2407
+ } as any;
2408
+ }
2409
+ const message = response.message || response.Message || errorCode;
2410
+ response.message = message;
2411
+ delete response.Message;
2412
+ return Promise.reject(Object.assign(new Error(message), response));
2413
+ };
2414
+
2415
+ export const deserializeAws_restJson1ListAssistantAssociationsCommand = async (
2416
+ output: __HttpResponse,
2417
+ context: __SerdeContext
2418
+ ): Promise<ListAssistantAssociationsCommandOutput> => {
2419
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
2420
+ return deserializeAws_restJson1ListAssistantAssociationsCommandError(output, context);
2421
+ }
2422
+ const contents: ListAssistantAssociationsCommandOutput = {
2423
+ $metadata: deserializeMetadata(output),
2424
+ assistantAssociationSummaries: undefined,
2425
+ nextToken: undefined,
2426
+ };
2427
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
2428
+ if (data.assistantAssociationSummaries !== undefined && data.assistantAssociationSummaries !== null) {
2429
+ contents.assistantAssociationSummaries = deserializeAws_restJson1AssistantAssociationSummaryList(
2430
+ data.assistantAssociationSummaries,
2431
+ context
2432
+ );
2433
+ }
2434
+ if (data.nextToken !== undefined && data.nextToken !== null) {
2435
+ contents.nextToken = __expectString(data.nextToken);
2436
+ }
2437
+ return Promise.resolve(contents);
2438
+ };
2439
+
2440
+ const deserializeAws_restJson1ListAssistantAssociationsCommandError = async (
2441
+ output: __HttpResponse,
2442
+ context: __SerdeContext
2443
+ ): Promise<ListAssistantAssociationsCommandOutput> => {
2444
+ const parsedOutput: any = {
2445
+ ...output,
2446
+ body: await parseBody(output.body, context),
2447
+ };
2448
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
2449
+ let errorCode = "UnknownError";
2450
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2451
+ switch (errorCode) {
2452
+ case "AccessDeniedException":
2453
+ case "com.amazonaws.wisdom#AccessDeniedException":
2454
+ response = {
2455
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2456
+ name: errorCode,
2457
+ $metadata: deserializeMetadata(output),
2458
+ };
2459
+ break;
2460
+ case "ResourceNotFoundException":
2461
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
2462
+ response = {
2463
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2464
+ name: errorCode,
2465
+ $metadata: deserializeMetadata(output),
2466
+ };
2467
+ break;
2468
+ case "ValidationException":
2469
+ case "com.amazonaws.wisdom#ValidationException":
2470
+ response = {
2471
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2472
+ name: errorCode,
2473
+ $metadata: deserializeMetadata(output),
2474
+ };
2475
+ break;
2476
+ default:
2477
+ const parsedBody = parsedOutput.body;
2478
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
2479
+ response = {
2480
+ ...parsedBody,
2481
+ name: `${errorCode}`,
2482
+ message: parsedBody.message || parsedBody.Message || errorCode,
2483
+ $fault: "client",
2484
+ $metadata: deserializeMetadata(output),
2485
+ } as any;
2486
+ }
2487
+ const message = response.message || response.Message || errorCode;
2488
+ response.message = message;
2489
+ delete response.Message;
2490
+ return Promise.reject(Object.assign(new Error(message), response));
2491
+ };
2492
+
2493
+ export const deserializeAws_restJson1ListAssistantsCommand = async (
2494
+ output: __HttpResponse,
2495
+ context: __SerdeContext
2496
+ ): Promise<ListAssistantsCommandOutput> => {
2497
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
2498
+ return deserializeAws_restJson1ListAssistantsCommandError(output, context);
2499
+ }
2500
+ const contents: ListAssistantsCommandOutput = {
2501
+ $metadata: deserializeMetadata(output),
2502
+ assistantSummaries: undefined,
2503
+ nextToken: undefined,
2504
+ };
2505
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
2506
+ if (data.assistantSummaries !== undefined && data.assistantSummaries !== null) {
2507
+ contents.assistantSummaries = deserializeAws_restJson1AssistantList(data.assistantSummaries, context);
2508
+ }
2509
+ if (data.nextToken !== undefined && data.nextToken !== null) {
2510
+ contents.nextToken = __expectString(data.nextToken);
2511
+ }
2512
+ return Promise.resolve(contents);
2513
+ };
2514
+
2515
+ const deserializeAws_restJson1ListAssistantsCommandError = async (
2516
+ output: __HttpResponse,
2517
+ context: __SerdeContext
2518
+ ): Promise<ListAssistantsCommandOutput> => {
2519
+ const parsedOutput: any = {
2520
+ ...output,
2521
+ body: await parseBody(output.body, context),
2522
+ };
2523
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
2524
+ let errorCode = "UnknownError";
2525
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2526
+ switch (errorCode) {
2527
+ case "AccessDeniedException":
2528
+ case "com.amazonaws.wisdom#AccessDeniedException":
2529
+ response = {
2530
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2531
+ name: errorCode,
2532
+ $metadata: deserializeMetadata(output),
2533
+ };
2534
+ break;
2535
+ case "ValidationException":
2536
+ case "com.amazonaws.wisdom#ValidationException":
2537
+ response = {
2538
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2539
+ name: errorCode,
2540
+ $metadata: deserializeMetadata(output),
2541
+ };
2542
+ break;
2543
+ default:
2544
+ const parsedBody = parsedOutput.body;
2545
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
2546
+ response = {
2547
+ ...parsedBody,
2548
+ name: `${errorCode}`,
2549
+ message: parsedBody.message || parsedBody.Message || errorCode,
2550
+ $fault: "client",
2551
+ $metadata: deserializeMetadata(output),
2552
+ } as any;
2553
+ }
2554
+ const message = response.message || response.Message || errorCode;
2555
+ response.message = message;
2556
+ delete response.Message;
2557
+ return Promise.reject(Object.assign(new Error(message), response));
2558
+ };
2559
+
2560
+ export const deserializeAws_restJson1ListContentsCommand = async (
2561
+ output: __HttpResponse,
2562
+ context: __SerdeContext
2563
+ ): Promise<ListContentsCommandOutput> => {
2564
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
2565
+ return deserializeAws_restJson1ListContentsCommandError(output, context);
2566
+ }
2567
+ const contents: ListContentsCommandOutput = {
2568
+ $metadata: deserializeMetadata(output),
2569
+ contentSummaries: undefined,
2570
+ nextToken: undefined,
2571
+ };
2572
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
2573
+ if (data.contentSummaries !== undefined && data.contentSummaries !== null) {
2574
+ contents.contentSummaries = deserializeAws_restJson1ContentSummaryList(data.contentSummaries, context);
2575
+ }
2576
+ if (data.nextToken !== undefined && data.nextToken !== null) {
2577
+ contents.nextToken = __expectString(data.nextToken);
2578
+ }
2579
+ return Promise.resolve(contents);
2580
+ };
2581
+
2582
+ const deserializeAws_restJson1ListContentsCommandError = async (
2583
+ output: __HttpResponse,
2584
+ context: __SerdeContext
2585
+ ): Promise<ListContentsCommandOutput> => {
2586
+ const parsedOutput: any = {
2587
+ ...output,
2588
+ body: await parseBody(output.body, context),
2589
+ };
2590
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
2591
+ let errorCode = "UnknownError";
2592
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2593
+ switch (errorCode) {
2594
+ case "AccessDeniedException":
2595
+ case "com.amazonaws.wisdom#AccessDeniedException":
2596
+ response = {
2597
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2598
+ name: errorCode,
2599
+ $metadata: deserializeMetadata(output),
2600
+ };
2601
+ break;
2602
+ case "ResourceNotFoundException":
2603
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
2604
+ response = {
2605
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2606
+ name: errorCode,
2607
+ $metadata: deserializeMetadata(output),
2608
+ };
2609
+ break;
2610
+ case "ValidationException":
2611
+ case "com.amazonaws.wisdom#ValidationException":
2612
+ response = {
2613
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2614
+ name: errorCode,
2615
+ $metadata: deserializeMetadata(output),
2616
+ };
2617
+ break;
2618
+ default:
2619
+ const parsedBody = parsedOutput.body;
2620
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
2621
+ response = {
2622
+ ...parsedBody,
2623
+ name: `${errorCode}`,
2624
+ message: parsedBody.message || parsedBody.Message || errorCode,
2625
+ $fault: "client",
2626
+ $metadata: deserializeMetadata(output),
2627
+ } as any;
2628
+ }
2629
+ const message = response.message || response.Message || errorCode;
2630
+ response.message = message;
2631
+ delete response.Message;
2632
+ return Promise.reject(Object.assign(new Error(message), response));
2633
+ };
2634
+
2635
+ export const deserializeAws_restJson1ListKnowledgeBasesCommand = async (
2636
+ output: __HttpResponse,
2637
+ context: __SerdeContext
2638
+ ): Promise<ListKnowledgeBasesCommandOutput> => {
2639
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
2640
+ return deserializeAws_restJson1ListKnowledgeBasesCommandError(output, context);
2641
+ }
2642
+ const contents: ListKnowledgeBasesCommandOutput = {
2643
+ $metadata: deserializeMetadata(output),
2644
+ knowledgeBaseSummaries: undefined,
2645
+ nextToken: undefined,
2646
+ };
2647
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
2648
+ if (data.knowledgeBaseSummaries !== undefined && data.knowledgeBaseSummaries !== null) {
2649
+ contents.knowledgeBaseSummaries = deserializeAws_restJson1KnowledgeBaseList(data.knowledgeBaseSummaries, context);
2650
+ }
2651
+ if (data.nextToken !== undefined && data.nextToken !== null) {
2652
+ contents.nextToken = __expectString(data.nextToken);
2653
+ }
2654
+ return Promise.resolve(contents);
2655
+ };
2656
+
2657
+ const deserializeAws_restJson1ListKnowledgeBasesCommandError = async (
2658
+ output: __HttpResponse,
2659
+ context: __SerdeContext
2660
+ ): Promise<ListKnowledgeBasesCommandOutput> => {
2661
+ const parsedOutput: any = {
2662
+ ...output,
2663
+ body: await parseBody(output.body, context),
2664
+ };
2665
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
2666
+ let errorCode = "UnknownError";
2667
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2668
+ switch (errorCode) {
2669
+ case "AccessDeniedException":
2670
+ case "com.amazonaws.wisdom#AccessDeniedException":
2671
+ response = {
2672
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2673
+ name: errorCode,
2674
+ $metadata: deserializeMetadata(output),
2675
+ };
2676
+ break;
2677
+ case "ValidationException":
2678
+ case "com.amazonaws.wisdom#ValidationException":
2679
+ response = {
2680
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2681
+ name: errorCode,
2682
+ $metadata: deserializeMetadata(output),
2683
+ };
2684
+ break;
2685
+ default:
2686
+ const parsedBody = parsedOutput.body;
2687
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
2688
+ response = {
2689
+ ...parsedBody,
2690
+ name: `${errorCode}`,
2691
+ message: parsedBody.message || parsedBody.Message || errorCode,
2692
+ $fault: "client",
2693
+ $metadata: deserializeMetadata(output),
2694
+ } as any;
2695
+ }
2696
+ const message = response.message || response.Message || errorCode;
2697
+ response.message = message;
2698
+ delete response.Message;
2699
+ return Promise.reject(Object.assign(new Error(message), response));
2700
+ };
2701
+
2702
+ export const deserializeAws_restJson1ListTagsForResourceCommand = async (
2703
+ output: __HttpResponse,
2704
+ context: __SerdeContext
2705
+ ): Promise<ListTagsForResourceCommandOutput> => {
2706
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
2707
+ return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
2708
+ }
2709
+ const contents: ListTagsForResourceCommandOutput = {
2710
+ $metadata: deserializeMetadata(output),
2711
+ tags: undefined,
2712
+ };
2713
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
2714
+ if (data.tags !== undefined && data.tags !== null) {
2715
+ contents.tags = deserializeAws_restJson1Tags(data.tags, context);
2716
+ }
2717
+ return Promise.resolve(contents);
2718
+ };
2719
+
2720
+ const deserializeAws_restJson1ListTagsForResourceCommandError = async (
2721
+ output: __HttpResponse,
2722
+ context: __SerdeContext
2723
+ ): Promise<ListTagsForResourceCommandOutput> => {
2724
+ const parsedOutput: any = {
2725
+ ...output,
2726
+ body: await parseBody(output.body, context),
2727
+ };
2728
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
2729
+ let errorCode = "UnknownError";
2730
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2731
+ switch (errorCode) {
2732
+ case "ResourceNotFoundException":
2733
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
2734
+ response = {
2735
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2736
+ name: errorCode,
2737
+ $metadata: deserializeMetadata(output),
2738
+ };
2739
+ break;
2740
+ default:
2741
+ const parsedBody = parsedOutput.body;
2742
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
2743
+ response = {
2744
+ ...parsedBody,
2745
+ name: `${errorCode}`,
2746
+ message: parsedBody.message || parsedBody.Message || errorCode,
2747
+ $fault: "client",
2748
+ $metadata: deserializeMetadata(output),
2749
+ } as any;
2750
+ }
2751
+ const message = response.message || response.Message || errorCode;
2752
+ response.message = message;
2753
+ delete response.Message;
2754
+ return Promise.reject(Object.assign(new Error(message), response));
2755
+ };
2756
+
2757
+ export const deserializeAws_restJson1NotifyRecommendationsReceivedCommand = async (
2758
+ output: __HttpResponse,
2759
+ context: __SerdeContext
2760
+ ): Promise<NotifyRecommendationsReceivedCommandOutput> => {
2761
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
2762
+ return deserializeAws_restJson1NotifyRecommendationsReceivedCommandError(output, context);
2763
+ }
2764
+ const contents: NotifyRecommendationsReceivedCommandOutput = {
2765
+ $metadata: deserializeMetadata(output),
2766
+ errors: undefined,
2767
+ recommendationIds: undefined,
2768
+ };
2769
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
2770
+ if (data.errors !== undefined && data.errors !== null) {
2771
+ contents.errors = deserializeAws_restJson1NotifyRecommendationsReceivedErrorList(data.errors, context);
2772
+ }
2773
+ if (data.recommendationIds !== undefined && data.recommendationIds !== null) {
2774
+ contents.recommendationIds = deserializeAws_restJson1RecommendationIdList(data.recommendationIds, context);
2775
+ }
2776
+ return Promise.resolve(contents);
2777
+ };
2778
+
2779
+ const deserializeAws_restJson1NotifyRecommendationsReceivedCommandError = async (
2780
+ output: __HttpResponse,
2781
+ context: __SerdeContext
2782
+ ): Promise<NotifyRecommendationsReceivedCommandOutput> => {
2783
+ const parsedOutput: any = {
2784
+ ...output,
2785
+ body: await parseBody(output.body, context),
2786
+ };
2787
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
2788
+ let errorCode = "UnknownError";
2789
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2790
+ switch (errorCode) {
2791
+ case "AccessDeniedException":
2792
+ case "com.amazonaws.wisdom#AccessDeniedException":
2793
+ response = {
2794
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2795
+ name: errorCode,
2796
+ $metadata: deserializeMetadata(output),
2797
+ };
2798
+ break;
2799
+ case "ResourceNotFoundException":
2800
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
2801
+ response = {
2802
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2803
+ name: errorCode,
2804
+ $metadata: deserializeMetadata(output),
2805
+ };
2806
+ break;
2807
+ case "ValidationException":
2808
+ case "com.amazonaws.wisdom#ValidationException":
2809
+ response = {
2810
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2811
+ name: errorCode,
2812
+ $metadata: deserializeMetadata(output),
2813
+ };
2814
+ break;
2815
+ default:
2816
+ const parsedBody = parsedOutput.body;
2817
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
2818
+ response = {
2819
+ ...parsedBody,
2820
+ name: `${errorCode}`,
2821
+ message: parsedBody.message || parsedBody.Message || errorCode,
2822
+ $fault: "client",
2823
+ $metadata: deserializeMetadata(output),
2824
+ } as any;
2825
+ }
2826
+ const message = response.message || response.Message || errorCode;
2827
+ response.message = message;
2828
+ delete response.Message;
2829
+ return Promise.reject(Object.assign(new Error(message), response));
2830
+ };
2831
+
2832
+ export const deserializeAws_restJson1QueryAssistantCommand = async (
2833
+ output: __HttpResponse,
2834
+ context: __SerdeContext
2835
+ ): Promise<QueryAssistantCommandOutput> => {
2836
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
2837
+ return deserializeAws_restJson1QueryAssistantCommandError(output, context);
2838
+ }
2839
+ const contents: QueryAssistantCommandOutput = {
2840
+ $metadata: deserializeMetadata(output),
2841
+ nextToken: undefined,
2842
+ results: undefined,
2843
+ };
2844
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
2845
+ if (data.nextToken !== undefined && data.nextToken !== null) {
2846
+ contents.nextToken = __expectString(data.nextToken);
2847
+ }
2848
+ if (data.results !== undefined && data.results !== null) {
2849
+ contents.results = deserializeAws_restJson1QueryResultsList(data.results, context);
2850
+ }
2851
+ return Promise.resolve(contents);
2852
+ };
2853
+
2854
+ const deserializeAws_restJson1QueryAssistantCommandError = async (
2855
+ output: __HttpResponse,
2856
+ context: __SerdeContext
2857
+ ): Promise<QueryAssistantCommandOutput> => {
2858
+ const parsedOutput: any = {
2859
+ ...output,
2860
+ body: await parseBody(output.body, context),
2861
+ };
2862
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
2863
+ let errorCode = "UnknownError";
2864
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2865
+ switch (errorCode) {
2866
+ case "AccessDeniedException":
2867
+ case "com.amazonaws.wisdom#AccessDeniedException":
2868
+ response = {
2869
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2870
+ name: errorCode,
2871
+ $metadata: deserializeMetadata(output),
2872
+ };
2873
+ break;
2874
+ case "ResourceNotFoundException":
2875
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
2876
+ response = {
2877
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2878
+ name: errorCode,
2879
+ $metadata: deserializeMetadata(output),
2880
+ };
2881
+ break;
2882
+ case "ValidationException":
2883
+ case "com.amazonaws.wisdom#ValidationException":
2884
+ response = {
2885
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2886
+ name: errorCode,
2887
+ $metadata: deserializeMetadata(output),
2888
+ };
2889
+ break;
2890
+ default:
2891
+ const parsedBody = parsedOutput.body;
2892
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
2893
+ response = {
2894
+ ...parsedBody,
2895
+ name: `${errorCode}`,
2896
+ message: parsedBody.message || parsedBody.Message || errorCode,
2897
+ $fault: "client",
2898
+ $metadata: deserializeMetadata(output),
2899
+ } as any;
2900
+ }
2901
+ const message = response.message || response.Message || errorCode;
2902
+ response.message = message;
2903
+ delete response.Message;
2904
+ return Promise.reject(Object.assign(new Error(message), response));
2905
+ };
2906
+
2907
+ export const deserializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommand = async (
2908
+ output: __HttpResponse,
2909
+ context: __SerdeContext
2910
+ ): Promise<RemoveKnowledgeBaseTemplateUriCommandOutput> => {
2911
+ if (output.statusCode !== 204 && output.statusCode >= 300) {
2912
+ return deserializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommandError(output, context);
2913
+ }
2914
+ const contents: RemoveKnowledgeBaseTemplateUriCommandOutput = {
2915
+ $metadata: deserializeMetadata(output),
2916
+ };
2917
+ await collectBody(output.body, context);
2918
+ return Promise.resolve(contents);
2919
+ };
2920
+
2921
+ const deserializeAws_restJson1RemoveKnowledgeBaseTemplateUriCommandError = async (
2922
+ output: __HttpResponse,
2923
+ context: __SerdeContext
2924
+ ): Promise<RemoveKnowledgeBaseTemplateUriCommandOutput> => {
2925
+ const parsedOutput: any = {
2926
+ ...output,
2927
+ body: await parseBody(output.body, context),
2928
+ };
2929
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
2930
+ let errorCode = "UnknownError";
2931
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2932
+ switch (errorCode) {
2933
+ case "AccessDeniedException":
2934
+ case "com.amazonaws.wisdom#AccessDeniedException":
2935
+ response = {
2936
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2937
+ name: errorCode,
2938
+ $metadata: deserializeMetadata(output),
2939
+ };
2940
+ break;
2941
+ case "ResourceNotFoundException":
2942
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
2943
+ response = {
2944
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2945
+ name: errorCode,
2946
+ $metadata: deserializeMetadata(output),
2947
+ };
2948
+ break;
2949
+ case "ValidationException":
2950
+ case "com.amazonaws.wisdom#ValidationException":
2951
+ response = {
2952
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2953
+ name: errorCode,
2954
+ $metadata: deserializeMetadata(output),
2955
+ };
2956
+ break;
2957
+ default:
2958
+ const parsedBody = parsedOutput.body;
2959
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
2960
+ response = {
2961
+ ...parsedBody,
2962
+ name: `${errorCode}`,
2963
+ message: parsedBody.message || parsedBody.Message || errorCode,
2964
+ $fault: "client",
2965
+ $metadata: deserializeMetadata(output),
2966
+ } as any;
2967
+ }
2968
+ const message = response.message || response.Message || errorCode;
2969
+ response.message = message;
2970
+ delete response.Message;
2971
+ return Promise.reject(Object.assign(new Error(message), response));
2972
+ };
2973
+
2974
+ export const deserializeAws_restJson1SearchContentCommand = async (
2975
+ output: __HttpResponse,
2976
+ context: __SerdeContext
2977
+ ): Promise<SearchContentCommandOutput> => {
2978
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
2979
+ return deserializeAws_restJson1SearchContentCommandError(output, context);
2980
+ }
2981
+ const contents: SearchContentCommandOutput = {
2982
+ $metadata: deserializeMetadata(output),
2983
+ contentSummaries: undefined,
2984
+ nextToken: undefined,
2985
+ };
2986
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
2987
+ if (data.contentSummaries !== undefined && data.contentSummaries !== null) {
2988
+ contents.contentSummaries = deserializeAws_restJson1ContentSummaryList(data.contentSummaries, context);
2989
+ }
2990
+ if (data.nextToken !== undefined && data.nextToken !== null) {
2991
+ contents.nextToken = __expectString(data.nextToken);
2992
+ }
2993
+ return Promise.resolve(contents);
2994
+ };
2995
+
2996
+ const deserializeAws_restJson1SearchContentCommandError = async (
2997
+ output: __HttpResponse,
2998
+ context: __SerdeContext
2999
+ ): Promise<SearchContentCommandOutput> => {
3000
+ const parsedOutput: any = {
3001
+ ...output,
3002
+ body: await parseBody(output.body, context),
3003
+ };
3004
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
3005
+ let errorCode = "UnknownError";
3006
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3007
+ switch (errorCode) {
3008
+ case "AccessDeniedException":
3009
+ case "com.amazonaws.wisdom#AccessDeniedException":
3010
+ response = {
3011
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
3012
+ name: errorCode,
3013
+ $metadata: deserializeMetadata(output),
3014
+ };
3015
+ break;
3016
+ case "ResourceNotFoundException":
3017
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
3018
+ response = {
3019
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
3020
+ name: errorCode,
3021
+ $metadata: deserializeMetadata(output),
3022
+ };
3023
+ break;
3024
+ case "ValidationException":
3025
+ case "com.amazonaws.wisdom#ValidationException":
3026
+ response = {
3027
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
3028
+ name: errorCode,
3029
+ $metadata: deserializeMetadata(output),
3030
+ };
3031
+ break;
3032
+ default:
3033
+ const parsedBody = parsedOutput.body;
3034
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
3035
+ response = {
3036
+ ...parsedBody,
3037
+ name: `${errorCode}`,
3038
+ message: parsedBody.message || parsedBody.Message || errorCode,
3039
+ $fault: "client",
3040
+ $metadata: deserializeMetadata(output),
3041
+ } as any;
3042
+ }
3043
+ const message = response.message || response.Message || errorCode;
3044
+ response.message = message;
3045
+ delete response.Message;
3046
+ return Promise.reject(Object.assign(new Error(message), response));
3047
+ };
3048
+
3049
+ export const deserializeAws_restJson1SearchSessionsCommand = async (
3050
+ output: __HttpResponse,
3051
+ context: __SerdeContext
3052
+ ): Promise<SearchSessionsCommandOutput> => {
3053
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
3054
+ return deserializeAws_restJson1SearchSessionsCommandError(output, context);
3055
+ }
3056
+ const contents: SearchSessionsCommandOutput = {
3057
+ $metadata: deserializeMetadata(output),
3058
+ nextToken: undefined,
3059
+ sessionSummaries: undefined,
3060
+ };
3061
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
3062
+ if (data.nextToken !== undefined && data.nextToken !== null) {
3063
+ contents.nextToken = __expectString(data.nextToken);
3064
+ }
3065
+ if (data.sessionSummaries !== undefined && data.sessionSummaries !== null) {
3066
+ contents.sessionSummaries = deserializeAws_restJson1SessionSummaries(data.sessionSummaries, context);
3067
+ }
3068
+ return Promise.resolve(contents);
3069
+ };
3070
+
3071
+ const deserializeAws_restJson1SearchSessionsCommandError = async (
3072
+ output: __HttpResponse,
3073
+ context: __SerdeContext
3074
+ ): Promise<SearchSessionsCommandOutput> => {
3075
+ const parsedOutput: any = {
3076
+ ...output,
3077
+ body: await parseBody(output.body, context),
3078
+ };
3079
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
3080
+ let errorCode = "UnknownError";
3081
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3082
+ switch (errorCode) {
3083
+ case "AccessDeniedException":
3084
+ case "com.amazonaws.wisdom#AccessDeniedException":
3085
+ response = {
3086
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
3087
+ name: errorCode,
3088
+ $metadata: deserializeMetadata(output),
3089
+ };
3090
+ break;
3091
+ case "ResourceNotFoundException":
3092
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
3093
+ response = {
3094
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
3095
+ name: errorCode,
3096
+ $metadata: deserializeMetadata(output),
3097
+ };
3098
+ break;
3099
+ case "ValidationException":
3100
+ case "com.amazonaws.wisdom#ValidationException":
3101
+ response = {
3102
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
3103
+ name: errorCode,
3104
+ $metadata: deserializeMetadata(output),
3105
+ };
3106
+ break;
3107
+ default:
3108
+ const parsedBody = parsedOutput.body;
3109
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
3110
+ response = {
3111
+ ...parsedBody,
3112
+ name: `${errorCode}`,
3113
+ message: parsedBody.message || parsedBody.Message || errorCode,
3114
+ $fault: "client",
3115
+ $metadata: deserializeMetadata(output),
3116
+ } as any;
3117
+ }
3118
+ const message = response.message || response.Message || errorCode;
3119
+ response.message = message;
3120
+ delete response.Message;
3121
+ return Promise.reject(Object.assign(new Error(message), response));
3122
+ };
3123
+
3124
+ export const deserializeAws_restJson1StartContentUploadCommand = async (
3125
+ output: __HttpResponse,
3126
+ context: __SerdeContext
3127
+ ): Promise<StartContentUploadCommandOutput> => {
3128
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
3129
+ return deserializeAws_restJson1StartContentUploadCommandError(output, context);
3130
+ }
3131
+ const contents: StartContentUploadCommandOutput = {
3132
+ $metadata: deserializeMetadata(output),
3133
+ headersToInclude: undefined,
3134
+ uploadId: undefined,
3135
+ url: undefined,
3136
+ urlExpiry: undefined,
3137
+ };
3138
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
3139
+ if (data.headersToInclude !== undefined && data.headersToInclude !== null) {
3140
+ contents.headersToInclude = deserializeAws_restJson1Headers(data.headersToInclude, context);
3141
+ }
3142
+ if (data.uploadId !== undefined && data.uploadId !== null) {
3143
+ contents.uploadId = __expectString(data.uploadId);
3144
+ }
3145
+ if (data.url !== undefined && data.url !== null) {
3146
+ contents.url = __expectString(data.url);
3147
+ }
3148
+ if (data.urlExpiry !== undefined && data.urlExpiry !== null) {
3149
+ contents.urlExpiry = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.urlExpiry)));
3150
+ }
3151
+ return Promise.resolve(contents);
3152
+ };
3153
+
3154
+ const deserializeAws_restJson1StartContentUploadCommandError = async (
3155
+ output: __HttpResponse,
3156
+ context: __SerdeContext
3157
+ ): Promise<StartContentUploadCommandOutput> => {
3158
+ const parsedOutput: any = {
3159
+ ...output,
3160
+ body: await parseBody(output.body, context),
3161
+ };
3162
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
3163
+ let errorCode = "UnknownError";
3164
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3165
+ switch (errorCode) {
3166
+ case "AccessDeniedException":
3167
+ case "com.amazonaws.wisdom#AccessDeniedException":
3168
+ response = {
3169
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
3170
+ name: errorCode,
3171
+ $metadata: deserializeMetadata(output),
3172
+ };
3173
+ break;
3174
+ case "ResourceNotFoundException":
3175
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
3176
+ response = {
3177
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
3178
+ name: errorCode,
3179
+ $metadata: deserializeMetadata(output),
3180
+ };
3181
+ break;
3182
+ case "ValidationException":
3183
+ case "com.amazonaws.wisdom#ValidationException":
3184
+ response = {
3185
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
3186
+ name: errorCode,
3187
+ $metadata: deserializeMetadata(output),
3188
+ };
3189
+ break;
3190
+ default:
3191
+ const parsedBody = parsedOutput.body;
3192
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
3193
+ response = {
3194
+ ...parsedBody,
3195
+ name: `${errorCode}`,
3196
+ message: parsedBody.message || parsedBody.Message || errorCode,
3197
+ $fault: "client",
3198
+ $metadata: deserializeMetadata(output),
3199
+ } as any;
3200
+ }
3201
+ const message = response.message || response.Message || errorCode;
3202
+ response.message = message;
3203
+ delete response.Message;
3204
+ return Promise.reject(Object.assign(new Error(message), response));
3205
+ };
3206
+
3207
+ export const deserializeAws_restJson1TagResourceCommand = async (
3208
+ output: __HttpResponse,
3209
+ context: __SerdeContext
3210
+ ): Promise<TagResourceCommandOutput> => {
3211
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
3212
+ return deserializeAws_restJson1TagResourceCommandError(output, context);
3213
+ }
3214
+ const contents: TagResourceCommandOutput = {
3215
+ $metadata: deserializeMetadata(output),
3216
+ };
3217
+ await collectBody(output.body, context);
3218
+ return Promise.resolve(contents);
3219
+ };
3220
+
3221
+ const deserializeAws_restJson1TagResourceCommandError = async (
3222
+ output: __HttpResponse,
3223
+ context: __SerdeContext
3224
+ ): Promise<TagResourceCommandOutput> => {
3225
+ const parsedOutput: any = {
3226
+ ...output,
3227
+ body: await parseBody(output.body, context),
3228
+ };
3229
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
3230
+ let errorCode = "UnknownError";
3231
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3232
+ switch (errorCode) {
3233
+ case "ResourceNotFoundException":
3234
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
3235
+ response = {
3236
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
3237
+ name: errorCode,
3238
+ $metadata: deserializeMetadata(output),
3239
+ };
3240
+ break;
3241
+ case "TooManyTagsException":
3242
+ case "com.amazonaws.wisdom#TooManyTagsException":
3243
+ response = {
3244
+ ...(await deserializeAws_restJson1TooManyTagsExceptionResponse(parsedOutput, context)),
3245
+ name: errorCode,
3246
+ $metadata: deserializeMetadata(output),
3247
+ };
3248
+ break;
3249
+ default:
3250
+ const parsedBody = parsedOutput.body;
3251
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
3252
+ response = {
3253
+ ...parsedBody,
3254
+ name: `${errorCode}`,
3255
+ message: parsedBody.message || parsedBody.Message || errorCode,
3256
+ $fault: "client",
3257
+ $metadata: deserializeMetadata(output),
3258
+ } as any;
3259
+ }
3260
+ const message = response.message || response.Message || errorCode;
3261
+ response.message = message;
3262
+ delete response.Message;
3263
+ return Promise.reject(Object.assign(new Error(message), response));
3264
+ };
3265
+
3266
+ export const deserializeAws_restJson1UntagResourceCommand = async (
3267
+ output: __HttpResponse,
3268
+ context: __SerdeContext
3269
+ ): Promise<UntagResourceCommandOutput> => {
3270
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
3271
+ return deserializeAws_restJson1UntagResourceCommandError(output, context);
3272
+ }
3273
+ const contents: UntagResourceCommandOutput = {
3274
+ $metadata: deserializeMetadata(output),
3275
+ };
3276
+ await collectBody(output.body, context);
3277
+ return Promise.resolve(contents);
3278
+ };
3279
+
3280
+ const deserializeAws_restJson1UntagResourceCommandError = async (
3281
+ output: __HttpResponse,
3282
+ context: __SerdeContext
3283
+ ): Promise<UntagResourceCommandOutput> => {
3284
+ const parsedOutput: any = {
3285
+ ...output,
3286
+ body: await parseBody(output.body, context),
3287
+ };
3288
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
3289
+ let errorCode = "UnknownError";
3290
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3291
+ switch (errorCode) {
3292
+ case "ResourceNotFoundException":
3293
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
3294
+ response = {
3295
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
3296
+ name: errorCode,
3297
+ $metadata: deserializeMetadata(output),
3298
+ };
3299
+ break;
3300
+ default:
3301
+ const parsedBody = parsedOutput.body;
3302
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
3303
+ response = {
3304
+ ...parsedBody,
3305
+ name: `${errorCode}`,
3306
+ message: parsedBody.message || parsedBody.Message || errorCode,
3307
+ $fault: "client",
3308
+ $metadata: deserializeMetadata(output),
3309
+ } as any;
3310
+ }
3311
+ const message = response.message || response.Message || errorCode;
3312
+ response.message = message;
3313
+ delete response.Message;
3314
+ return Promise.reject(Object.assign(new Error(message), response));
3315
+ };
3316
+
3317
+ export const deserializeAws_restJson1UpdateContentCommand = async (
3318
+ output: __HttpResponse,
3319
+ context: __SerdeContext
3320
+ ): Promise<UpdateContentCommandOutput> => {
3321
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
3322
+ return deserializeAws_restJson1UpdateContentCommandError(output, context);
3323
+ }
3324
+ const contents: UpdateContentCommandOutput = {
3325
+ $metadata: deserializeMetadata(output),
3326
+ content: undefined,
3327
+ };
3328
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
3329
+ if (data.content !== undefined && data.content !== null) {
3330
+ contents.content = deserializeAws_restJson1ContentData(data.content, context);
3331
+ }
3332
+ return Promise.resolve(contents);
3333
+ };
3334
+
3335
+ const deserializeAws_restJson1UpdateContentCommandError = async (
3336
+ output: __HttpResponse,
3337
+ context: __SerdeContext
3338
+ ): Promise<UpdateContentCommandOutput> => {
3339
+ const parsedOutput: any = {
3340
+ ...output,
3341
+ body: await parseBody(output.body, context),
3342
+ };
3343
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
3344
+ let errorCode = "UnknownError";
3345
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3346
+ switch (errorCode) {
3347
+ case "AccessDeniedException":
3348
+ case "com.amazonaws.wisdom#AccessDeniedException":
3349
+ response = {
3350
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
3351
+ name: errorCode,
3352
+ $metadata: deserializeMetadata(output),
3353
+ };
3354
+ break;
3355
+ case "PreconditionFailedException":
3356
+ case "com.amazonaws.wisdom#PreconditionFailedException":
3357
+ response = {
3358
+ ...(await deserializeAws_restJson1PreconditionFailedExceptionResponse(parsedOutput, context)),
3359
+ name: errorCode,
3360
+ $metadata: deserializeMetadata(output),
3361
+ };
3362
+ break;
3363
+ case "ResourceNotFoundException":
3364
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
3365
+ response = {
3366
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
3367
+ name: errorCode,
3368
+ $metadata: deserializeMetadata(output),
3369
+ };
3370
+ break;
3371
+ case "ValidationException":
3372
+ case "com.amazonaws.wisdom#ValidationException":
3373
+ response = {
3374
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
3375
+ name: errorCode,
3376
+ $metadata: deserializeMetadata(output),
3377
+ };
3378
+ break;
3379
+ default:
3380
+ const parsedBody = parsedOutput.body;
3381
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
3382
+ response = {
3383
+ ...parsedBody,
3384
+ name: `${errorCode}`,
3385
+ message: parsedBody.message || parsedBody.Message || errorCode,
3386
+ $fault: "client",
3387
+ $metadata: deserializeMetadata(output),
3388
+ } as any;
3389
+ }
3390
+ const message = response.message || response.Message || errorCode;
3391
+ response.message = message;
3392
+ delete response.Message;
3393
+ return Promise.reject(Object.assign(new Error(message), response));
3394
+ };
3395
+
3396
+ export const deserializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommand = async (
3397
+ output: __HttpResponse,
3398
+ context: __SerdeContext
3399
+ ): Promise<UpdateKnowledgeBaseTemplateUriCommandOutput> => {
3400
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
3401
+ return deserializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommandError(output, context);
3402
+ }
3403
+ const contents: UpdateKnowledgeBaseTemplateUriCommandOutput = {
3404
+ $metadata: deserializeMetadata(output),
3405
+ knowledgeBase: undefined,
3406
+ };
3407
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
3408
+ if (data.knowledgeBase !== undefined && data.knowledgeBase !== null) {
3409
+ contents.knowledgeBase = deserializeAws_restJson1KnowledgeBaseData(data.knowledgeBase, context);
3410
+ }
3411
+ return Promise.resolve(contents);
3412
+ };
3413
+
3414
+ const deserializeAws_restJson1UpdateKnowledgeBaseTemplateUriCommandError = async (
3415
+ output: __HttpResponse,
3416
+ context: __SerdeContext
3417
+ ): Promise<UpdateKnowledgeBaseTemplateUriCommandOutput> => {
3418
+ const parsedOutput: any = {
3419
+ ...output,
3420
+ body: await parseBody(output.body, context),
3421
+ };
3422
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
3423
+ let errorCode = "UnknownError";
3424
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3425
+ switch (errorCode) {
3426
+ case "AccessDeniedException":
3427
+ case "com.amazonaws.wisdom#AccessDeniedException":
3428
+ response = {
3429
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
3430
+ name: errorCode,
3431
+ $metadata: deserializeMetadata(output),
3432
+ };
3433
+ break;
3434
+ case "ResourceNotFoundException":
3435
+ case "com.amazonaws.wisdom#ResourceNotFoundException":
3436
+ response = {
3437
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
3438
+ name: errorCode,
3439
+ $metadata: deserializeMetadata(output),
3440
+ };
3441
+ break;
3442
+ case "ValidationException":
3443
+ case "com.amazonaws.wisdom#ValidationException":
3444
+ response = {
3445
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
3446
+ name: errorCode,
3447
+ $metadata: deserializeMetadata(output),
3448
+ };
3449
+ break;
3450
+ default:
3451
+ const parsedBody = parsedOutput.body;
3452
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
3453
+ response = {
3454
+ ...parsedBody,
3455
+ name: `${errorCode}`,
3456
+ message: parsedBody.message || parsedBody.Message || errorCode,
3457
+ $fault: "client",
3458
+ $metadata: deserializeMetadata(output),
3459
+ } as any;
3460
+ }
3461
+ const message = response.message || response.Message || errorCode;
3462
+ response.message = message;
3463
+ delete response.Message;
3464
+ return Promise.reject(Object.assign(new Error(message), response));
3465
+ };
3466
+
3467
+ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (
3468
+ parsedOutput: any,
3469
+ context: __SerdeContext
3470
+ ): Promise<AccessDeniedException> => {
3471
+ const contents: AccessDeniedException = {
3472
+ name: "AccessDeniedException",
3473
+ $fault: "client",
3474
+ $metadata: deserializeMetadata(parsedOutput),
3475
+ message: undefined,
3476
+ };
3477
+ const data: any = parsedOutput.body;
3478
+ if (data.message !== undefined && data.message !== null) {
3479
+ contents.message = __expectString(data.message);
3480
+ }
3481
+ return contents;
3482
+ };
3483
+
3484
+ const deserializeAws_restJson1ConflictExceptionResponse = async (
3485
+ parsedOutput: any,
3486
+ context: __SerdeContext
3487
+ ): Promise<ConflictException> => {
3488
+ const contents: ConflictException = {
3489
+ name: "ConflictException",
3490
+ $fault: "client",
3491
+ $metadata: deserializeMetadata(parsedOutput),
3492
+ message: undefined,
3493
+ };
3494
+ const data: any = parsedOutput.body;
3495
+ if (data.message !== undefined && data.message !== null) {
3496
+ contents.message = __expectString(data.message);
3497
+ }
3498
+ return contents;
3499
+ };
3500
+
3501
+ const deserializeAws_restJson1PreconditionFailedExceptionResponse = async (
3502
+ parsedOutput: any,
3503
+ context: __SerdeContext
3504
+ ): Promise<PreconditionFailedException> => {
3505
+ const contents: PreconditionFailedException = {
3506
+ name: "PreconditionFailedException",
3507
+ $fault: "client",
3508
+ $metadata: deserializeMetadata(parsedOutput),
3509
+ message: undefined,
3510
+ };
3511
+ const data: any = parsedOutput.body;
3512
+ if (data.message !== undefined && data.message !== null) {
3513
+ contents.message = __expectString(data.message);
3514
+ }
3515
+ return contents;
3516
+ };
3517
+
3518
+ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (
3519
+ parsedOutput: any,
3520
+ context: __SerdeContext
3521
+ ): Promise<ResourceNotFoundException> => {
3522
+ const contents: ResourceNotFoundException = {
3523
+ name: "ResourceNotFoundException",
3524
+ $fault: "client",
3525
+ $metadata: deserializeMetadata(parsedOutput),
3526
+ message: undefined,
3527
+ resourceName: undefined,
3528
+ };
3529
+ const data: any = parsedOutput.body;
3530
+ if (data.message !== undefined && data.message !== null) {
3531
+ contents.message = __expectString(data.message);
3532
+ }
3533
+ if (data.resourceName !== undefined && data.resourceName !== null) {
3534
+ contents.resourceName = __expectString(data.resourceName);
3535
+ }
3536
+ return contents;
3537
+ };
3538
+
3539
+ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (
3540
+ parsedOutput: any,
3541
+ context: __SerdeContext
3542
+ ): Promise<ServiceQuotaExceededException> => {
3543
+ const contents: ServiceQuotaExceededException = {
3544
+ name: "ServiceQuotaExceededException",
3545
+ $fault: "client",
3546
+ $metadata: deserializeMetadata(parsedOutput),
3547
+ message: undefined,
3548
+ };
3549
+ const data: any = parsedOutput.body;
3550
+ if (data.message !== undefined && data.message !== null) {
3551
+ contents.message = __expectString(data.message);
3552
+ }
3553
+ return contents;
3554
+ };
3555
+
3556
+ const deserializeAws_restJson1TooManyTagsExceptionResponse = async (
3557
+ parsedOutput: any,
3558
+ context: __SerdeContext
3559
+ ): Promise<TooManyTagsException> => {
3560
+ const contents: TooManyTagsException = {
3561
+ name: "TooManyTagsException",
3562
+ $fault: "client",
3563
+ $metadata: deserializeMetadata(parsedOutput),
3564
+ message: undefined,
3565
+ resourceName: undefined,
3566
+ };
3567
+ const data: any = parsedOutput.body;
3568
+ if (data.message !== undefined && data.message !== null) {
3569
+ contents.message = __expectString(data.message);
3570
+ }
3571
+ if (data.resourceName !== undefined && data.resourceName !== null) {
3572
+ contents.resourceName = __expectString(data.resourceName);
3573
+ }
3574
+ return contents;
3575
+ };
3576
+
3577
+ const deserializeAws_restJson1ValidationExceptionResponse = async (
3578
+ parsedOutput: any,
3579
+ context: __SerdeContext
3580
+ ): Promise<ValidationException> => {
3581
+ const contents: ValidationException = {
3582
+ name: "ValidationException",
3583
+ $fault: "client",
3584
+ $metadata: deserializeMetadata(parsedOutput),
3585
+ message: undefined,
3586
+ };
3587
+ const data: any = parsedOutput.body;
3588
+ if (data.message !== undefined && data.message !== null) {
3589
+ contents.message = __expectString(data.message);
3590
+ }
3591
+ return contents;
3592
+ };
3593
+
3594
+ const serializeAws_restJson1AppIntegrationsConfiguration = (
3595
+ input: AppIntegrationsConfiguration,
3596
+ context: __SerdeContext
3597
+ ): any => {
3598
+ return {
3599
+ ...(input.appIntegrationArn !== undefined &&
3600
+ input.appIntegrationArn !== null && { appIntegrationArn: input.appIntegrationArn }),
3601
+ ...(input.objectFields !== undefined &&
3602
+ input.objectFields !== null && {
3603
+ objectFields: serializeAws_restJson1ObjectFieldsList(input.objectFields, context),
3604
+ }),
3605
+ };
3606
+ };
3607
+
3608
+ const serializeAws_restJson1AssistantAssociationInputData = (
3609
+ input: AssistantAssociationInputData,
3610
+ context: __SerdeContext
3611
+ ): any => {
3612
+ return AssistantAssociationInputData.visit(input, {
3613
+ knowledgeBaseId: (value) => ({ knowledgeBaseId: value }),
3614
+ _: (name, value) => ({ name: value } as any),
3615
+ });
3616
+ };
3617
+
3618
+ const serializeAws_restJson1ContentMetadata = (input: { [key: string]: string }, context: __SerdeContext): any => {
3619
+ return Object.entries(input).reduce((acc: { [key: string]: any }, [key, value]: [string, any]) => {
3620
+ if (value === null) {
3621
+ return acc;
3622
+ }
3623
+ return {
3624
+ ...acc,
3625
+ [key]: value,
3626
+ };
3627
+ }, {});
3628
+ };
3629
+
3630
+ const serializeAws_restJson1Filter = (input: Filter, context: __SerdeContext): any => {
3631
+ return {
3632
+ ...(input.field !== undefined && input.field !== null && { field: input.field }),
3633
+ ...(input.operator !== undefined && input.operator !== null && { operator: input.operator }),
3634
+ ...(input.value !== undefined && input.value !== null && { value: input.value }),
3635
+ };
3636
+ };
3637
+
3638
+ const serializeAws_restJson1FilterList = (input: Filter[], context: __SerdeContext): any => {
3639
+ return input
3640
+ .filter((e: any) => e != null)
3641
+ .map((entry) => {
3642
+ if (entry === null) {
3643
+ return null as any;
3644
+ }
3645
+ return serializeAws_restJson1Filter(entry, context);
3646
+ });
3647
+ };
3648
+
3649
+ const serializeAws_restJson1ObjectFieldsList = (input: string[], context: __SerdeContext): any => {
3650
+ return input
3651
+ .filter((e: any) => e != null)
3652
+ .map((entry) => {
3653
+ if (entry === null) {
3654
+ return null as any;
3655
+ }
3656
+ return entry;
3657
+ });
3658
+ };
3659
+
3660
+ const serializeAws_restJson1RecommendationIdList = (input: string[], context: __SerdeContext): any => {
3661
+ return input
3662
+ .filter((e: any) => e != null)
3663
+ .map((entry) => {
3664
+ if (entry === null) {
3665
+ return null as any;
3666
+ }
3667
+ return entry;
3668
+ });
3669
+ };
3670
+
3671
+ const serializeAws_restJson1RenderingConfiguration = (input: RenderingConfiguration, context: __SerdeContext): any => {
3672
+ return {
3673
+ ...(input.templateUri !== undefined && input.templateUri !== null && { templateUri: input.templateUri }),
3674
+ };
3675
+ };
3676
+
3677
+ const serializeAws_restJson1SearchExpression = (input: SearchExpression, context: __SerdeContext): any => {
3678
+ return {
3679
+ ...(input.filters !== undefined &&
3680
+ input.filters !== null && { filters: serializeAws_restJson1FilterList(input.filters, context) }),
3681
+ };
3682
+ };
3683
+
3684
+ const serializeAws_restJson1ServerSideEncryptionConfiguration = (
3685
+ input: ServerSideEncryptionConfiguration,
3686
+ context: __SerdeContext
3687
+ ): any => {
3688
+ return {
3689
+ ...(input.kmsKeyId !== undefined && input.kmsKeyId !== null && { kmsKeyId: input.kmsKeyId }),
3690
+ };
3691
+ };
3692
+
3693
+ const serializeAws_restJson1SourceConfiguration = (input: SourceConfiguration, context: __SerdeContext): any => {
3694
+ return SourceConfiguration.visit(input, {
3695
+ appIntegrations: (value) => ({
3696
+ appIntegrations: serializeAws_restJson1AppIntegrationsConfiguration(value, context),
3697
+ }),
3698
+ _: (name, value) => ({ name: value } as any),
3699
+ });
3700
+ };
3701
+
3702
+ const serializeAws_restJson1Tags = (input: { [key: string]: string }, context: __SerdeContext): any => {
3703
+ return Object.entries(input).reduce((acc: { [key: string]: any }, [key, value]: [string, any]) => {
3704
+ if (value === null) {
3705
+ return acc;
3706
+ }
3707
+ return {
3708
+ ...acc,
3709
+ [key]: value,
3710
+ };
3711
+ }, {});
3712
+ };
3713
+
3714
+ const deserializeAws_restJson1AppIntegrationsConfiguration = (
3715
+ output: any,
3716
+ context: __SerdeContext
3717
+ ): AppIntegrationsConfiguration => {
3718
+ return {
3719
+ appIntegrationArn: __expectString(output.appIntegrationArn),
3720
+ objectFields:
3721
+ output.objectFields !== undefined && output.objectFields !== null
3722
+ ? deserializeAws_restJson1ObjectFieldsList(output.objectFields, context)
3723
+ : undefined,
3724
+ } as any;
3725
+ };
3726
+
3727
+ const deserializeAws_restJson1AssistantAssociationData = (
3728
+ output: any,
3729
+ context: __SerdeContext
3730
+ ): AssistantAssociationData => {
3731
+ return {
3732
+ assistantArn: __expectString(output.assistantArn),
3733
+ assistantAssociationArn: __expectString(output.assistantAssociationArn),
3734
+ assistantAssociationId: __expectString(output.assistantAssociationId),
3735
+ assistantId: __expectString(output.assistantId),
3736
+ associationData:
3737
+ output.associationData !== undefined && output.associationData !== null
3738
+ ? deserializeAws_restJson1AssistantAssociationOutputData(__expectUnion(output.associationData), context)
3739
+ : undefined,
3740
+ associationType: __expectString(output.associationType),
3741
+ tags:
3742
+ output.tags !== undefined && output.tags !== null
3743
+ ? deserializeAws_restJson1Tags(output.tags, context)
3744
+ : undefined,
3745
+ } as any;
3746
+ };
3747
+
3748
+ const deserializeAws_restJson1AssistantAssociationOutputData = (
3749
+ output: any,
3750
+ context: __SerdeContext
3751
+ ): AssistantAssociationOutputData => {
3752
+ if (output.knowledgeBaseAssociation !== undefined && output.knowledgeBaseAssociation !== null) {
3753
+ return {
3754
+ knowledgeBaseAssociation: deserializeAws_restJson1KnowledgeBaseAssociationData(
3755
+ output.knowledgeBaseAssociation,
3756
+ context
3757
+ ),
3758
+ };
3759
+ }
3760
+ return { $unknown: Object.entries(output)[0] };
3761
+ };
3762
+
3763
+ const deserializeAws_restJson1AssistantAssociationSummary = (
3764
+ output: any,
3765
+ context: __SerdeContext
3766
+ ): AssistantAssociationSummary => {
3767
+ return {
3768
+ assistantArn: __expectString(output.assistantArn),
3769
+ assistantAssociationArn: __expectString(output.assistantAssociationArn),
3770
+ assistantAssociationId: __expectString(output.assistantAssociationId),
3771
+ assistantId: __expectString(output.assistantId),
3772
+ associationData:
3773
+ output.associationData !== undefined && output.associationData !== null
3774
+ ? deserializeAws_restJson1AssistantAssociationOutputData(__expectUnion(output.associationData), context)
3775
+ : undefined,
3776
+ associationType: __expectString(output.associationType),
3777
+ tags:
3778
+ output.tags !== undefined && output.tags !== null
3779
+ ? deserializeAws_restJson1Tags(output.tags, context)
3780
+ : undefined,
3781
+ } as any;
3782
+ };
3783
+
3784
+ const deserializeAws_restJson1AssistantAssociationSummaryList = (
3785
+ output: any,
3786
+ context: __SerdeContext
3787
+ ): AssistantAssociationSummary[] => {
3788
+ return (output || [])
3789
+ .filter((e: any) => e != null)
3790
+ .map((entry: any) => {
3791
+ if (entry === null) {
3792
+ return null as any;
3793
+ }
3794
+ return deserializeAws_restJson1AssistantAssociationSummary(entry, context);
3795
+ });
3796
+ };
3797
+
3798
+ const deserializeAws_restJson1AssistantData = (output: any, context: __SerdeContext): AssistantData => {
3799
+ return {
3800
+ assistantArn: __expectString(output.assistantArn),
3801
+ assistantId: __expectString(output.assistantId),
3802
+ description: __expectString(output.description),
3803
+ name: __expectString(output.name),
3804
+ serverSideEncryptionConfiguration:
3805
+ output.serverSideEncryptionConfiguration !== undefined && output.serverSideEncryptionConfiguration !== null
3806
+ ? deserializeAws_restJson1ServerSideEncryptionConfiguration(output.serverSideEncryptionConfiguration, context)
3807
+ : undefined,
3808
+ status: __expectString(output.status),
3809
+ tags:
3810
+ output.tags !== undefined && output.tags !== null
3811
+ ? deserializeAws_restJson1Tags(output.tags, context)
3812
+ : undefined,
3813
+ type: __expectString(output.type),
3814
+ } as any;
3815
+ };
3816
+
3817
+ const deserializeAws_restJson1AssistantList = (output: any, context: __SerdeContext): AssistantSummary[] => {
3818
+ return (output || [])
3819
+ .filter((e: any) => e != null)
3820
+ .map((entry: any) => {
3821
+ if (entry === null) {
3822
+ return null as any;
3823
+ }
3824
+ return deserializeAws_restJson1AssistantSummary(entry, context);
3825
+ });
3826
+ };
3827
+
3828
+ const deserializeAws_restJson1AssistantSummary = (output: any, context: __SerdeContext): AssistantSummary => {
3829
+ return {
3830
+ assistantArn: __expectString(output.assistantArn),
3831
+ assistantId: __expectString(output.assistantId),
3832
+ description: __expectString(output.description),
3833
+ name: __expectString(output.name),
3834
+ serverSideEncryptionConfiguration:
3835
+ output.serverSideEncryptionConfiguration !== undefined && output.serverSideEncryptionConfiguration !== null
3836
+ ? deserializeAws_restJson1ServerSideEncryptionConfiguration(output.serverSideEncryptionConfiguration, context)
3837
+ : undefined,
3838
+ status: __expectString(output.status),
3839
+ tags:
3840
+ output.tags !== undefined && output.tags !== null
3841
+ ? deserializeAws_restJson1Tags(output.tags, context)
3842
+ : undefined,
3843
+ type: __expectString(output.type),
3844
+ } as any;
3845
+ };
3846
+
3847
+ const deserializeAws_restJson1ContentData = (output: any, context: __SerdeContext): ContentData => {
3848
+ return {
3849
+ contentArn: __expectString(output.contentArn),
3850
+ contentId: __expectString(output.contentId),
3851
+ contentType: __expectString(output.contentType),
3852
+ knowledgeBaseArn: __expectString(output.knowledgeBaseArn),
3853
+ knowledgeBaseId: __expectString(output.knowledgeBaseId),
3854
+ linkOutUri: __expectString(output.linkOutUri),
3855
+ metadata:
3856
+ output.metadata !== undefined && output.metadata !== null
3857
+ ? deserializeAws_restJson1ContentMetadata(output.metadata, context)
3858
+ : undefined,
3859
+ name: __expectString(output.name),
3860
+ revisionId: __expectString(output.revisionId),
3861
+ status: __expectString(output.status),
3862
+ tags:
3863
+ output.tags !== undefined && output.tags !== null
3864
+ ? deserializeAws_restJson1Tags(output.tags, context)
3865
+ : undefined,
3866
+ title: __expectString(output.title),
3867
+ url: __expectString(output.url),
3868
+ urlExpiry:
3869
+ output.urlExpiry !== undefined && output.urlExpiry !== null
3870
+ ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.urlExpiry)))
3871
+ : undefined,
3872
+ } as any;
3873
+ };
3874
+
3875
+ const deserializeAws_restJson1ContentMetadata = (output: any, context: __SerdeContext): { [key: string]: string } => {
3876
+ return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => {
3877
+ if (value === null) {
3878
+ return acc;
3879
+ }
3880
+ return {
3881
+ ...acc,
3882
+ [key]: __expectString(value) as any,
3883
+ };
3884
+ }, {});
3885
+ };
3886
+
3887
+ const deserializeAws_restJson1ContentReference = (output: any, context: __SerdeContext): ContentReference => {
3888
+ return {
3889
+ contentArn: __expectString(output.contentArn),
3890
+ contentId: __expectString(output.contentId),
3891
+ knowledgeBaseArn: __expectString(output.knowledgeBaseArn),
3892
+ knowledgeBaseId: __expectString(output.knowledgeBaseId),
3893
+ } as any;
3894
+ };
3895
+
3896
+ const deserializeAws_restJson1ContentSummary = (output: any, context: __SerdeContext): ContentSummary => {
3897
+ return {
3898
+ contentArn: __expectString(output.contentArn),
3899
+ contentId: __expectString(output.contentId),
3900
+ contentType: __expectString(output.contentType),
3901
+ knowledgeBaseArn: __expectString(output.knowledgeBaseArn),
3902
+ knowledgeBaseId: __expectString(output.knowledgeBaseId),
3903
+ metadata:
3904
+ output.metadata !== undefined && output.metadata !== null
3905
+ ? deserializeAws_restJson1ContentMetadata(output.metadata, context)
3906
+ : undefined,
3907
+ name: __expectString(output.name),
3908
+ revisionId: __expectString(output.revisionId),
3909
+ status: __expectString(output.status),
3910
+ tags:
3911
+ output.tags !== undefined && output.tags !== null
3912
+ ? deserializeAws_restJson1Tags(output.tags, context)
3913
+ : undefined,
3914
+ title: __expectString(output.title),
3915
+ } as any;
3916
+ };
3917
+
3918
+ const deserializeAws_restJson1ContentSummaryList = (output: any, context: __SerdeContext): ContentSummary[] => {
3919
+ return (output || [])
3920
+ .filter((e: any) => e != null)
3921
+ .map((entry: any) => {
3922
+ if (entry === null) {
3923
+ return null as any;
3924
+ }
3925
+ return deserializeAws_restJson1ContentSummary(entry, context);
3926
+ });
3927
+ };
3928
+
3929
+ const deserializeAws_restJson1Document = (output: any, context: __SerdeContext): Document => {
3930
+ return {
3931
+ contentReference:
3932
+ output.contentReference !== undefined && output.contentReference !== null
3933
+ ? deserializeAws_restJson1ContentReference(output.contentReference, context)
3934
+ : undefined,
3935
+ excerpt:
3936
+ output.excerpt !== undefined && output.excerpt !== null
3937
+ ? deserializeAws_restJson1DocumentText(output.excerpt, context)
3938
+ : undefined,
3939
+ title:
3940
+ output.title !== undefined && output.title !== null
3941
+ ? deserializeAws_restJson1DocumentText(output.title, context)
3942
+ : undefined,
3943
+ } as any;
3944
+ };
3945
+
3946
+ const deserializeAws_restJson1DocumentText = (output: any, context: __SerdeContext): DocumentText => {
3947
+ return {
3948
+ highlights:
3949
+ output.highlights !== undefined && output.highlights !== null
3950
+ ? deserializeAws_restJson1Highlights(output.highlights, context)
3951
+ : undefined,
3952
+ text: __expectString(output.text),
3953
+ } as any;
3954
+ };
3955
+
3956
+ const deserializeAws_restJson1Headers = (output: any, context: __SerdeContext): { [key: string]: string } => {
3957
+ return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => {
3958
+ if (value === null) {
3959
+ return acc;
3960
+ }
3961
+ return {
3962
+ ...acc,
3963
+ [key]: __expectString(value) as any,
3964
+ };
3965
+ }, {});
3966
+ };
3967
+
3968
+ const deserializeAws_restJson1Highlight = (output: any, context: __SerdeContext): Highlight => {
3969
+ return {
3970
+ beginOffsetInclusive: __expectInt32(output.beginOffsetInclusive),
3971
+ endOffsetExclusive: __expectInt32(output.endOffsetExclusive),
3972
+ } as any;
3973
+ };
3974
+
3975
+ const deserializeAws_restJson1Highlights = (output: any, context: __SerdeContext): Highlight[] => {
3976
+ return (output || [])
3977
+ .filter((e: any) => e != null)
3978
+ .map((entry: any) => {
3979
+ if (entry === null) {
3980
+ return null as any;
3981
+ }
3982
+ return deserializeAws_restJson1Highlight(entry, context);
3983
+ });
3984
+ };
3985
+
3986
+ const deserializeAws_restJson1KnowledgeBaseAssociationData = (
3987
+ output: any,
3988
+ context: __SerdeContext
3989
+ ): KnowledgeBaseAssociationData => {
3990
+ return {
3991
+ knowledgeBaseArn: __expectString(output.knowledgeBaseArn),
3992
+ knowledgeBaseId: __expectString(output.knowledgeBaseId),
3993
+ } as any;
3994
+ };
3995
+
3996
+ const deserializeAws_restJson1KnowledgeBaseData = (output: any, context: __SerdeContext): KnowledgeBaseData => {
3997
+ return {
3998
+ description: __expectString(output.description),
3999
+ knowledgeBaseArn: __expectString(output.knowledgeBaseArn),
4000
+ knowledgeBaseId: __expectString(output.knowledgeBaseId),
4001
+ knowledgeBaseType: __expectString(output.knowledgeBaseType),
4002
+ lastContentModificationTime:
4003
+ output.lastContentModificationTime !== undefined && output.lastContentModificationTime !== null
4004
+ ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.lastContentModificationTime)))
4005
+ : undefined,
4006
+ name: __expectString(output.name),
4007
+ renderingConfiguration:
4008
+ output.renderingConfiguration !== undefined && output.renderingConfiguration !== null
4009
+ ? deserializeAws_restJson1RenderingConfiguration(output.renderingConfiguration, context)
4010
+ : undefined,
4011
+ serverSideEncryptionConfiguration:
4012
+ output.serverSideEncryptionConfiguration !== undefined && output.serverSideEncryptionConfiguration !== null
4013
+ ? deserializeAws_restJson1ServerSideEncryptionConfiguration(output.serverSideEncryptionConfiguration, context)
4014
+ : undefined,
4015
+ sourceConfiguration:
4016
+ output.sourceConfiguration !== undefined && output.sourceConfiguration !== null
4017
+ ? deserializeAws_restJson1SourceConfiguration(__expectUnion(output.sourceConfiguration), context)
4018
+ : undefined,
4019
+ status: __expectString(output.status),
4020
+ tags:
4021
+ output.tags !== undefined && output.tags !== null
4022
+ ? deserializeAws_restJson1Tags(output.tags, context)
4023
+ : undefined,
4024
+ } as any;
4025
+ };
4026
+
4027
+ const deserializeAws_restJson1KnowledgeBaseList = (output: any, context: __SerdeContext): KnowledgeBaseSummary[] => {
4028
+ return (output || [])
4029
+ .filter((e: any) => e != null)
4030
+ .map((entry: any) => {
4031
+ if (entry === null) {
4032
+ return null as any;
4033
+ }
4034
+ return deserializeAws_restJson1KnowledgeBaseSummary(entry, context);
4035
+ });
4036
+ };
4037
+
4038
+ const deserializeAws_restJson1KnowledgeBaseSummary = (output: any, context: __SerdeContext): KnowledgeBaseSummary => {
4039
+ return {
4040
+ description: __expectString(output.description),
4041
+ knowledgeBaseArn: __expectString(output.knowledgeBaseArn),
4042
+ knowledgeBaseId: __expectString(output.knowledgeBaseId),
4043
+ knowledgeBaseType: __expectString(output.knowledgeBaseType),
4044
+ name: __expectString(output.name),
4045
+ renderingConfiguration:
4046
+ output.renderingConfiguration !== undefined && output.renderingConfiguration !== null
4047
+ ? deserializeAws_restJson1RenderingConfiguration(output.renderingConfiguration, context)
4048
+ : undefined,
4049
+ serverSideEncryptionConfiguration:
4050
+ output.serverSideEncryptionConfiguration !== undefined && output.serverSideEncryptionConfiguration !== null
4051
+ ? deserializeAws_restJson1ServerSideEncryptionConfiguration(output.serverSideEncryptionConfiguration, context)
4052
+ : undefined,
4053
+ sourceConfiguration:
4054
+ output.sourceConfiguration !== undefined && output.sourceConfiguration !== null
4055
+ ? deserializeAws_restJson1SourceConfiguration(__expectUnion(output.sourceConfiguration), context)
4056
+ : undefined,
4057
+ status: __expectString(output.status),
4058
+ tags:
4059
+ output.tags !== undefined && output.tags !== null
4060
+ ? deserializeAws_restJson1Tags(output.tags, context)
4061
+ : undefined,
4062
+ } as any;
4063
+ };
4064
+
4065
+ const deserializeAws_restJson1NotifyRecommendationsReceivedError = (
4066
+ output: any,
4067
+ context: __SerdeContext
4068
+ ): NotifyRecommendationsReceivedError => {
4069
+ return {
4070
+ message: __expectString(output.message),
4071
+ recommendationId: __expectString(output.recommendationId),
4072
+ } as any;
4073
+ };
4074
+
4075
+ const deserializeAws_restJson1NotifyRecommendationsReceivedErrorList = (
4076
+ output: any,
4077
+ context: __SerdeContext
4078
+ ): NotifyRecommendationsReceivedError[] => {
4079
+ return (output || [])
4080
+ .filter((e: any) => e != null)
4081
+ .map((entry: any) => {
4082
+ if (entry === null) {
4083
+ return null as any;
4084
+ }
4085
+ return deserializeAws_restJson1NotifyRecommendationsReceivedError(entry, context);
4086
+ });
4087
+ };
4088
+
4089
+ const deserializeAws_restJson1ObjectFieldsList = (output: any, context: __SerdeContext): string[] => {
4090
+ return (output || [])
4091
+ .filter((e: any) => e != null)
4092
+ .map((entry: any) => {
4093
+ if (entry === null) {
4094
+ return null as any;
4095
+ }
4096
+ return __expectString(entry) as any;
4097
+ });
4098
+ };
4099
+
4100
+ const deserializeAws_restJson1QueryResultsList = (output: any, context: __SerdeContext): ResultData[] => {
4101
+ return (output || [])
4102
+ .filter((e: any) => e != null)
4103
+ .map((entry: any) => {
4104
+ if (entry === null) {
4105
+ return null as any;
4106
+ }
4107
+ return deserializeAws_restJson1ResultData(entry, context);
4108
+ });
4109
+ };
4110
+
4111
+ const deserializeAws_restJson1RecommendationData = (output: any, context: __SerdeContext): RecommendationData => {
4112
+ return {
4113
+ document:
4114
+ output.document !== undefined && output.document !== null
4115
+ ? deserializeAws_restJson1Document(output.document, context)
4116
+ : undefined,
4117
+ recommendationId: __expectString(output.recommendationId),
4118
+ relevanceLevel: __expectString(output.relevanceLevel),
4119
+ relevanceScore: __limitedParseDouble(output.relevanceScore),
4120
+ } as any;
4121
+ };
4122
+
4123
+ const deserializeAws_restJson1RecommendationIdList = (output: any, context: __SerdeContext): string[] => {
4124
+ return (output || [])
4125
+ .filter((e: any) => e != null)
4126
+ .map((entry: any) => {
4127
+ if (entry === null) {
4128
+ return null as any;
4129
+ }
4130
+ return __expectString(entry) as any;
4131
+ });
4132
+ };
4133
+
4134
+ const deserializeAws_restJson1RecommendationList = (output: any, context: __SerdeContext): RecommendationData[] => {
4135
+ return (output || [])
4136
+ .filter((e: any) => e != null)
4137
+ .map((entry: any) => {
4138
+ if (entry === null) {
4139
+ return null as any;
4140
+ }
4141
+ return deserializeAws_restJson1RecommendationData(entry, context);
4142
+ });
4143
+ };
4144
+
4145
+ const deserializeAws_restJson1RenderingConfiguration = (
4146
+ output: any,
4147
+ context: __SerdeContext
4148
+ ): RenderingConfiguration => {
4149
+ return {
4150
+ templateUri: __expectString(output.templateUri),
4151
+ } as any;
4152
+ };
4153
+
4154
+ const deserializeAws_restJson1ResultData = (output: any, context: __SerdeContext): ResultData => {
4155
+ return {
4156
+ document:
4157
+ output.document !== undefined && output.document !== null
4158
+ ? deserializeAws_restJson1Document(output.document, context)
4159
+ : undefined,
4160
+ relevanceScore: __limitedParseDouble(output.relevanceScore),
4161
+ resultId: __expectString(output.resultId),
4162
+ } as any;
4163
+ };
4164
+
4165
+ const deserializeAws_restJson1ServerSideEncryptionConfiguration = (
4166
+ output: any,
4167
+ context: __SerdeContext
4168
+ ): ServerSideEncryptionConfiguration => {
4169
+ return {
4170
+ kmsKeyId: __expectString(output.kmsKeyId),
4171
+ } as any;
4172
+ };
4173
+
4174
+ const deserializeAws_restJson1SessionData = (output: any, context: __SerdeContext): SessionData => {
4175
+ return {
4176
+ description: __expectString(output.description),
4177
+ name: __expectString(output.name),
4178
+ sessionArn: __expectString(output.sessionArn),
4179
+ sessionId: __expectString(output.sessionId),
4180
+ tags:
4181
+ output.tags !== undefined && output.tags !== null
4182
+ ? deserializeAws_restJson1Tags(output.tags, context)
4183
+ : undefined,
4184
+ } as any;
4185
+ };
4186
+
4187
+ const deserializeAws_restJson1SessionSummaries = (output: any, context: __SerdeContext): SessionSummary[] => {
4188
+ return (output || [])
4189
+ .filter((e: any) => e != null)
4190
+ .map((entry: any) => {
4191
+ if (entry === null) {
4192
+ return null as any;
4193
+ }
4194
+ return deserializeAws_restJson1SessionSummary(entry, context);
4195
+ });
4196
+ };
4197
+
4198
+ const deserializeAws_restJson1SessionSummary = (output: any, context: __SerdeContext): SessionSummary => {
4199
+ return {
4200
+ assistantArn: __expectString(output.assistantArn),
4201
+ assistantId: __expectString(output.assistantId),
4202
+ sessionArn: __expectString(output.sessionArn),
4203
+ sessionId: __expectString(output.sessionId),
4204
+ } as any;
4205
+ };
4206
+
4207
+ const deserializeAws_restJson1SourceConfiguration = (output: any, context: __SerdeContext): SourceConfiguration => {
4208
+ if (output.appIntegrations !== undefined && output.appIntegrations !== null) {
4209
+ return {
4210
+ appIntegrations: deserializeAws_restJson1AppIntegrationsConfiguration(output.appIntegrations, context),
4211
+ };
4212
+ }
4213
+ return { $unknown: Object.entries(output)[0] };
4214
+ };
4215
+
4216
+ const deserializeAws_restJson1Tags = (output: any, context: __SerdeContext): { [key: string]: string } => {
4217
+ return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => {
4218
+ if (value === null) {
4219
+ return acc;
4220
+ }
4221
+ return {
4222
+ ...acc,
4223
+ [key]: __expectString(value) as any,
4224
+ };
4225
+ }, {});
4226
+ };
4227
+
4228
+ const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
4229
+ httpStatusCode: output.statusCode,
4230
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
4231
+ extendedRequestId: output.headers["x-amz-id-2"],
4232
+ cfId: output.headers["x-amz-cf-id"],
4233
+ });
4234
+
4235
+ // Collect low-level response body stream to Uint8Array.
4236
+ const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
4237
+ if (streamBody instanceof Uint8Array) {
4238
+ return Promise.resolve(streamBody);
4239
+ }
4240
+ return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
4241
+ };
4242
+
4243
+ // Encode Uint8Array data into string with utf-8.
4244
+ const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
4245
+ collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
4246
+
4247
+ const isSerializableHeaderValue = (value: any): boolean =>
4248
+ value !== undefined &&
4249
+ value !== null &&
4250
+ value !== "" &&
4251
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
4252
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
4253
+
4254
+ const parseBody = (streamBody: any, context: __SerdeContext): any =>
4255
+ collectBodyString(streamBody, context).then((encoded) => {
4256
+ if (encoded.length) {
4257
+ return JSON.parse(encoded);
4258
+ }
4259
+ return {};
4260
+ });
4261
+
4262
+ /**
4263
+ * Load an error code for the aws.rest-json-1.1 protocol.
4264
+ */
4265
+ const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => {
4266
+ const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
4267
+
4268
+ const sanitizeErrorCode = (rawValue: string): string => {
4269
+ let cleanValue = rawValue;
4270
+ if (cleanValue.indexOf(":") >= 0) {
4271
+ cleanValue = cleanValue.split(":")[0];
4272
+ }
4273
+ if (cleanValue.indexOf("#") >= 0) {
4274
+ cleanValue = cleanValue.split("#")[1];
4275
+ }
4276
+ return cleanValue;
4277
+ };
4278
+
4279
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
4280
+ if (headerKey !== undefined) {
4281
+ return sanitizeErrorCode(output.headers[headerKey]);
4282
+ }
4283
+
4284
+ if (data.code !== undefined) {
4285
+ return sanitizeErrorCode(data.code);
4286
+ }
4287
+
4288
+ if (data["__type"] !== undefined) {
4289
+ return sanitizeErrorCode(data["__type"]);
4290
+ }
4291
+
4292
+ return "";
4293
+ };