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