@airweave/sdk 0.1.28 → 0.1.34

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 (259) hide show
  1. package/Client.d.ts +15 -0
  2. package/Client.js +45 -20
  3. package/README.md +7 -11
  4. package/api/resources/apiKeys/client/Client.d.ts +131 -0
  5. package/api/resources/apiKeys/client/Client.js +391 -0
  6. package/api/resources/apiKeys/client/index.d.ts +1 -0
  7. package/api/resources/apiKeys/client/index.js +17 -0
  8. package/api/{types → resources/apiKeys/client/requests}/ApiKeyCreate.d.ts +2 -1
  9. package/api/resources/apiKeys/client/requests/DeleteApiKeyApiKeysDeleteRequest.d.ts +12 -0
  10. package/api/resources/apiKeys/client/requests/ReadApiKeysApiKeysGetRequest.d.ts +11 -0
  11. package/api/resources/apiKeys/client/requests/index.d.ts +3 -0
  12. package/api/resources/apiKeys/client/requests/index.js +2 -0
  13. package/api/resources/apiKeys/index.d.ts +1 -0
  14. package/api/resources/apiKeys/index.js +17 -0
  15. package/api/resources/chat/client/Client.d.ts +209 -0
  16. package/api/resources/chat/client/Client.js +669 -0
  17. package/api/resources/chat/client/index.d.ts +1 -0
  18. package/api/resources/chat/client/index.js +17 -0
  19. package/api/{types → resources/chat/client/requests}/ChatCreate.d.ts +5 -1
  20. package/api/{types → resources/chat/client/requests}/ChatMessageCreate.d.ts +4 -1
  21. package/{dist/api/types → api/resources/chat/client/requests}/ChatUpdate.d.ts +2 -1
  22. package/api/resources/chat/client/requests/ListChatsChatGetRequest.d.ts +11 -0
  23. package/api/resources/chat/client/requests/index.d.ts +4 -0
  24. package/api/resources/chat/client/requests/index.js +2 -0
  25. package/api/resources/chat/index.d.ts +1 -0
  26. package/api/resources/chat/index.js +17 -0
  27. package/api/resources/connections/client/Client.d.ts +26 -25
  28. package/api/resources/connections/client/Client.js +88 -84
  29. package/api/resources/connections/client/requests/BodyConnectSlackWithTokenConnectionsDirectTokenSlackPost.d.ts +13 -0
  30. package/api/resources/connections/client/requests/index.d.ts +1 -0
  31. package/api/resources/cursorDevelopment/client/Client.d.ts +78 -0
  32. package/api/resources/cursorDevelopment/client/Client.js +218 -0
  33. package/api/resources/cursorDevelopment/client/index.d.ts +1 -0
  34. package/api/resources/cursorDevelopment/client/index.js +2 -0
  35. package/api/resources/cursorDevelopment/index.d.ts +1 -0
  36. package/api/resources/cursorDevelopment/index.js +17 -0
  37. package/api/resources/dag/client/Client.js +4 -4
  38. package/api/resources/destinations/client/Client.js +2 -2
  39. package/api/resources/embeddingModels/client/Client.js +2 -2
  40. package/api/resources/entities/client/Client.js +8 -8
  41. package/api/resources/health/client/Client.d.ts +41 -0
  42. package/api/resources/health/client/Client.js +118 -0
  43. package/api/resources/health/client/index.d.ts +1 -0
  44. package/api/resources/health/client/index.js +2 -0
  45. package/api/resources/health/index.d.ts +1 -0
  46. package/api/resources/health/index.js +17 -0
  47. package/api/resources/index.d.ts +8 -0
  48. package/api/resources/index.js +9 -1
  49. package/api/resources/search/client/Client.d.ts +55 -0
  50. package/api/resources/search/client/Client.js +147 -0
  51. package/api/resources/search/client/index.d.ts +1 -0
  52. package/api/resources/search/client/index.js +17 -0
  53. package/api/resources/search/client/requests/SearchSearchGetRequest.d.ts +20 -0
  54. package/api/resources/search/client/requests/SearchSearchGetRequest.js +5 -0
  55. package/api/resources/search/client/requests/index.d.ts +1 -0
  56. package/api/resources/search/client/requests/index.js +2 -0
  57. package/api/resources/search/index.d.ts +1 -0
  58. package/api/resources/search/index.js +17 -0
  59. package/api/resources/sources/client/Client.js +2 -2
  60. package/api/resources/sync/client/Client.js +11 -11
  61. package/api/resources/transformers/client/Client.js +3 -3
  62. package/api/resources/users/client/Client.js +1 -1
  63. package/api/resources/whiteLabels/client/Client.js +8 -8
  64. package/api/types/index.d.ts +0 -4
  65. package/api/types/index.js +0 -4
  66. package/dist/Client.d.ts +15 -0
  67. package/dist/Client.js +45 -20
  68. package/dist/api/resources/apiKeys/client/Client.d.ts +131 -0
  69. package/dist/api/resources/apiKeys/client/Client.js +391 -0
  70. package/dist/api/resources/apiKeys/client/index.d.ts +1 -0
  71. package/dist/api/resources/apiKeys/client/index.js +17 -0
  72. package/dist/api/{types → resources/apiKeys/client/requests}/ApiKeyCreate.d.ts +2 -1
  73. package/dist/api/resources/apiKeys/client/requests/ApiKeyCreate.js +5 -0
  74. package/dist/api/resources/apiKeys/client/requests/DeleteApiKeyApiKeysDeleteRequest.d.ts +12 -0
  75. package/dist/api/resources/apiKeys/client/requests/DeleteApiKeyApiKeysDeleteRequest.js +5 -0
  76. package/dist/api/resources/apiKeys/client/requests/ReadApiKeysApiKeysGetRequest.d.ts +11 -0
  77. package/dist/api/resources/apiKeys/client/requests/ReadApiKeysApiKeysGetRequest.js +5 -0
  78. package/dist/api/resources/apiKeys/client/requests/index.d.ts +3 -0
  79. package/dist/api/resources/apiKeys/client/requests/index.js +2 -0
  80. package/dist/api/resources/apiKeys/index.d.ts +1 -0
  81. package/dist/api/resources/apiKeys/index.js +17 -0
  82. package/dist/api/resources/chat/client/Client.d.ts +209 -0
  83. package/dist/api/resources/chat/client/Client.js +669 -0
  84. package/dist/api/resources/chat/client/index.d.ts +1 -0
  85. package/dist/api/resources/chat/client/index.js +17 -0
  86. package/dist/api/{types → resources/chat/client/requests}/ChatCreate.d.ts +5 -1
  87. package/dist/api/resources/chat/client/requests/ChatCreate.js +5 -0
  88. package/dist/api/{types → resources/chat/client/requests}/ChatMessageCreate.d.ts +4 -1
  89. package/dist/api/resources/chat/client/requests/ChatMessageCreate.js +5 -0
  90. package/{api/types → dist/api/resources/chat/client/requests}/ChatUpdate.d.ts +2 -1
  91. package/dist/api/resources/chat/client/requests/ChatUpdate.js +5 -0
  92. package/dist/api/resources/chat/client/requests/ListChatsChatGetRequest.d.ts +11 -0
  93. package/dist/api/resources/chat/client/requests/ListChatsChatGetRequest.js +5 -0
  94. package/dist/api/resources/chat/client/requests/index.d.ts +4 -0
  95. package/dist/api/resources/chat/client/requests/index.js +2 -0
  96. package/dist/api/resources/chat/index.d.ts +1 -0
  97. package/dist/api/resources/chat/index.js +17 -0
  98. package/dist/api/resources/connections/client/Client.d.ts +26 -25
  99. package/dist/api/resources/connections/client/Client.js +88 -84
  100. package/dist/api/resources/connections/client/requests/BodyConnectSlackWithTokenConnectionsDirectTokenSlackPost.d.ts +13 -0
  101. package/dist/api/resources/connections/client/requests/BodyConnectSlackWithTokenConnectionsDirectTokenSlackPost.js +5 -0
  102. package/dist/api/resources/connections/client/requests/index.d.ts +1 -0
  103. package/dist/api/resources/cursorDevelopment/client/Client.d.ts +78 -0
  104. package/dist/api/resources/cursorDevelopment/client/Client.js +218 -0
  105. package/dist/api/resources/cursorDevelopment/client/index.d.ts +1 -0
  106. package/dist/api/resources/cursorDevelopment/client/index.js +2 -0
  107. package/dist/api/resources/cursorDevelopment/index.d.ts +1 -0
  108. package/dist/api/resources/cursorDevelopment/index.js +17 -0
  109. package/dist/api/resources/dag/client/Client.js +4 -4
  110. package/dist/api/resources/destinations/client/Client.js +2 -2
  111. package/dist/api/resources/embeddingModels/client/Client.js +2 -2
  112. package/dist/api/resources/entities/client/Client.js +8 -8
  113. package/dist/api/resources/health/client/Client.d.ts +41 -0
  114. package/dist/api/resources/health/client/Client.js +118 -0
  115. package/dist/api/resources/health/client/index.d.ts +1 -0
  116. package/dist/api/resources/health/client/index.js +2 -0
  117. package/dist/api/resources/health/index.d.ts +1 -0
  118. package/dist/api/resources/health/index.js +17 -0
  119. package/dist/api/resources/index.d.ts +8 -0
  120. package/dist/api/resources/index.js +9 -1
  121. package/dist/api/resources/search/client/Client.d.ts +55 -0
  122. package/dist/api/resources/search/client/Client.js +147 -0
  123. package/dist/api/resources/search/client/index.d.ts +1 -0
  124. package/dist/api/resources/search/client/index.js +17 -0
  125. package/dist/api/resources/search/client/requests/SearchSearchGetRequest.d.ts +20 -0
  126. package/dist/api/resources/search/client/requests/SearchSearchGetRequest.js +5 -0
  127. package/dist/api/resources/search/client/requests/index.d.ts +1 -0
  128. package/dist/api/resources/search/client/requests/index.js +2 -0
  129. package/dist/api/resources/search/index.d.ts +1 -0
  130. package/dist/api/resources/search/index.js +17 -0
  131. package/dist/api/resources/sources/client/Client.js +2 -2
  132. package/dist/api/resources/sync/client/Client.js +11 -11
  133. package/dist/api/resources/transformers/client/Client.js +3 -3
  134. package/dist/api/resources/users/client/Client.js +1 -1
  135. package/dist/api/resources/whiteLabels/client/Client.js +8 -8
  136. package/dist/api/types/index.d.ts +0 -4
  137. package/dist/api/types/index.js +0 -4
  138. package/dist/serialization/resources/apiKeys/client/index.d.ts +2 -0
  139. package/dist/serialization/resources/apiKeys/client/index.js +41 -0
  140. package/dist/serialization/resources/apiKeys/client/readApiKeys.d.ts +11 -0
  141. package/dist/serialization/resources/apiKeys/client/readApiKeys.js +42 -0
  142. package/dist/serialization/resources/apiKeys/client/requests/ApiKeyCreate.d.ts +12 -0
  143. package/dist/serialization/{types → resources/apiKeys/client/requests}/ApiKeyCreate.js +1 -1
  144. package/dist/serialization/resources/apiKeys/client/requests/index.d.ts +1 -0
  145. package/dist/serialization/resources/apiKeys/client/requests/index.js +5 -0
  146. package/dist/serialization/resources/apiKeys/index.d.ts +1 -0
  147. package/dist/serialization/resources/apiKeys/index.js +17 -0
  148. package/dist/serialization/resources/chat/client/index.d.ts +3 -0
  149. package/dist/serialization/resources/chat/client/index.js +42 -0
  150. package/dist/serialization/resources/chat/client/listChats.d.ts +11 -0
  151. package/dist/serialization/resources/chat/client/listChats.js +42 -0
  152. package/dist/serialization/resources/chat/client/openaiKeySet.d.ts +9 -0
  153. package/dist/serialization/resources/chat/client/openaiKeySet.js +41 -0
  154. package/{serialization/types → dist/serialization/resources/chat/client/requests}/ChatCreate.d.ts +4 -4
  155. package/{serialization/types → dist/serialization/resources/chat/client/requests}/ChatCreate.js +1 -1
  156. package/dist/serialization/resources/chat/client/requests/ChatMessageCreate.d.ts +13 -0
  157. package/dist/serialization/{types → resources/chat/client/requests}/ChatMessageCreate.js +1 -1
  158. package/{serialization/types → dist/serialization/resources/chat/client/requests}/ChatUpdate.d.ts +4 -4
  159. package/dist/serialization/{types → resources/chat/client/requests}/ChatUpdate.js +1 -1
  160. package/dist/serialization/resources/chat/client/requests/index.d.ts +3 -0
  161. package/dist/serialization/resources/chat/client/requests/index.js +9 -0
  162. package/dist/serialization/resources/chat/index.d.ts +1 -0
  163. package/dist/serialization/resources/chat/index.js +17 -0
  164. package/dist/serialization/resources/connections/client/requests/BodyConnectSlackWithTokenConnectionsDirectTokenSlackPost.d.ts +13 -0
  165. package/dist/serialization/resources/connections/client/requests/BodyConnectSlackWithTokenConnectionsDirectTokenSlackPost.js +44 -0
  166. package/dist/serialization/resources/connections/client/requests/index.d.ts +1 -0
  167. package/dist/serialization/resources/connections/client/requests/index.js +3 -1
  168. package/dist/serialization/resources/cursorDevelopment/client/checkConnectionStatus.d.ts +11 -0
  169. package/dist/serialization/resources/cursorDevelopment/client/checkConnectionStatus.js +42 -0
  170. package/dist/serialization/resources/cursorDevelopment/client/index.d.ts +1 -0
  171. package/dist/serialization/resources/cursorDevelopment/client/index.js +37 -0
  172. package/dist/serialization/resources/cursorDevelopment/index.d.ts +1 -0
  173. package/dist/serialization/resources/cursorDevelopment/index.js +17 -0
  174. package/dist/serialization/resources/health/client/healthCheck.d.ts +9 -0
  175. package/dist/serialization/resources/health/client/healthCheck.js +41 -0
  176. package/dist/serialization/resources/health/client/index.d.ts +1 -0
  177. package/dist/serialization/resources/health/client/index.js +37 -0
  178. package/dist/serialization/resources/health/index.d.ts +1 -0
  179. package/dist/serialization/resources/health/index.js +17 -0
  180. package/dist/serialization/resources/index.d.ts +7 -0
  181. package/dist/serialization/resources/index.js +8 -1
  182. package/dist/serialization/resources/search/client/index.d.ts +1 -0
  183. package/dist/serialization/resources/search/client/index.js +37 -0
  184. package/dist/serialization/resources/search/client/search.d.ts +9 -0
  185. package/dist/serialization/resources/search/client/search.js +41 -0
  186. package/dist/serialization/resources/search/index.d.ts +1 -0
  187. package/dist/serialization/resources/search/index.js +17 -0
  188. package/dist/serialization/types/index.d.ts +0 -4
  189. package/dist/serialization/types/index.js +0 -4
  190. package/dist/version.d.ts +1 -1
  191. package/dist/version.js +1 -1
  192. package/package.json +1 -1
  193. package/reference.md +1646 -447
  194. package/serialization/resources/apiKeys/client/index.d.ts +2 -0
  195. package/serialization/resources/apiKeys/client/index.js +41 -0
  196. package/serialization/resources/apiKeys/client/readApiKeys.d.ts +11 -0
  197. package/serialization/resources/apiKeys/client/readApiKeys.js +42 -0
  198. package/serialization/resources/apiKeys/client/requests/ApiKeyCreate.d.ts +12 -0
  199. package/serialization/{types → resources/apiKeys/client/requests}/ApiKeyCreate.js +1 -1
  200. package/serialization/resources/apiKeys/client/requests/index.d.ts +1 -0
  201. package/serialization/resources/apiKeys/client/requests/index.js +5 -0
  202. package/serialization/resources/apiKeys/index.d.ts +1 -0
  203. package/serialization/resources/apiKeys/index.js +17 -0
  204. package/serialization/resources/chat/client/index.d.ts +3 -0
  205. package/serialization/resources/chat/client/index.js +42 -0
  206. package/serialization/resources/chat/client/listChats.d.ts +11 -0
  207. package/serialization/resources/chat/client/listChats.js +42 -0
  208. package/serialization/resources/chat/client/openaiKeySet.d.ts +9 -0
  209. package/serialization/resources/chat/client/openaiKeySet.js +41 -0
  210. package/{dist/serialization/types → serialization/resources/chat/client/requests}/ChatCreate.d.ts +4 -4
  211. package/{dist/serialization/types → serialization/resources/chat/client/requests}/ChatCreate.js +1 -1
  212. package/serialization/resources/chat/client/requests/ChatMessageCreate.d.ts +13 -0
  213. package/serialization/{types → resources/chat/client/requests}/ChatMessageCreate.js +1 -1
  214. package/{dist/serialization/types → serialization/resources/chat/client/requests}/ChatUpdate.d.ts +4 -4
  215. package/serialization/{types → resources/chat/client/requests}/ChatUpdate.js +1 -1
  216. package/serialization/resources/chat/client/requests/index.d.ts +3 -0
  217. package/serialization/resources/chat/client/requests/index.js +9 -0
  218. package/serialization/resources/chat/index.d.ts +1 -0
  219. package/serialization/resources/chat/index.js +17 -0
  220. package/serialization/resources/connections/client/requests/BodyConnectSlackWithTokenConnectionsDirectTokenSlackPost.d.ts +13 -0
  221. package/serialization/resources/connections/client/requests/BodyConnectSlackWithTokenConnectionsDirectTokenSlackPost.js +44 -0
  222. package/serialization/resources/connections/client/requests/index.d.ts +1 -0
  223. package/serialization/resources/connections/client/requests/index.js +3 -1
  224. package/serialization/resources/cursorDevelopment/client/checkConnectionStatus.d.ts +11 -0
  225. package/serialization/resources/cursorDevelopment/client/checkConnectionStatus.js +42 -0
  226. package/serialization/resources/cursorDevelopment/client/index.d.ts +1 -0
  227. package/serialization/resources/cursorDevelopment/client/index.js +37 -0
  228. package/serialization/resources/cursorDevelopment/index.d.ts +1 -0
  229. package/serialization/resources/cursorDevelopment/index.js +17 -0
  230. package/serialization/resources/health/client/healthCheck.d.ts +9 -0
  231. package/serialization/resources/health/client/healthCheck.js +41 -0
  232. package/serialization/resources/health/client/index.d.ts +1 -0
  233. package/serialization/resources/health/client/index.js +37 -0
  234. package/serialization/resources/health/index.d.ts +1 -0
  235. package/serialization/resources/health/index.js +17 -0
  236. package/serialization/resources/index.d.ts +7 -0
  237. package/serialization/resources/index.js +8 -1
  238. package/serialization/resources/search/client/index.d.ts +1 -0
  239. package/serialization/resources/search/client/index.js +37 -0
  240. package/serialization/resources/search/client/search.d.ts +9 -0
  241. package/serialization/resources/search/client/search.js +41 -0
  242. package/serialization/resources/search/index.d.ts +1 -0
  243. package/serialization/resources/search/index.js +17 -0
  244. package/serialization/types/index.d.ts +0 -4
  245. package/serialization/types/index.js +0 -4
  246. package/version.d.ts +1 -1
  247. package/version.js +1 -1
  248. package/dist/serialization/types/ApiKeyCreate.d.ts +0 -12
  249. package/dist/serialization/types/ChatMessageCreate.d.ts +0 -13
  250. package/serialization/types/ApiKeyCreate.d.ts +0 -12
  251. package/serialization/types/ChatMessageCreate.d.ts +0 -13
  252. /package/api/{types → resources/apiKeys/client/requests}/ApiKeyCreate.js +0 -0
  253. /package/api/{types/ChatCreate.js → resources/apiKeys/client/requests/DeleteApiKeyApiKeysDeleteRequest.js} +0 -0
  254. /package/api/{types/ChatMessageCreate.js → resources/apiKeys/client/requests/ReadApiKeysApiKeysGetRequest.js} +0 -0
  255. /package/{dist/api/types → api/resources/chat/client/requests}/ChatCreate.js +0 -0
  256. /package/{dist/api/types → api/resources/chat/client/requests}/ChatMessageCreate.js +0 -0
  257. /package/api/{types → resources/chat/client/requests}/ChatUpdate.js +0 -0
  258. /package/{dist/api/types/ApiKeyCreate.js → api/resources/chat/client/requests/ListChatsChatGetRequest.js} +0 -0
  259. /package/{dist/api/types/ChatUpdate.js → api/resources/connections/client/requests/BodyConnectSlackWithTokenConnectionsDirectTokenSlackPost.js} +0 -0
@@ -0,0 +1,669 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
39
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
40
+ return new (P || (P = Promise))(function (resolve, reject) {
41
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
42
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
43
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
44
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
45
+ });
46
+ };
47
+ var __importDefault = (this && this.__importDefault) || function (mod) {
48
+ return (mod && mod.__esModule) ? mod : { "default": mod };
49
+ };
50
+ Object.defineProperty(exports, "__esModule", { value: true });
51
+ exports.Chat = void 0;
52
+ const environments = __importStar(require("../../../../environments"));
53
+ const core = __importStar(require("../../../../core"));
54
+ const AirweaveSDK = __importStar(require("../../../index"));
55
+ const url_join_1 = __importDefault(require("url-join"));
56
+ const serializers = __importStar(require("../../../../serialization/index"));
57
+ const errors = __importStar(require("../../../../errors/index"));
58
+ class Chat {
59
+ constructor(_options = {}) {
60
+ this._options = _options;
61
+ }
62
+ /**
63
+ * Check if the OpenAI API key is set for the current user.
64
+ *
65
+ * Args:
66
+ * ----
67
+ * db: The database session.
68
+ * user: The current user.
69
+ *
70
+ * Returns:
71
+ * -------
72
+ * bool: True if the OpenAI API key is set, False otherwise.
73
+ *
74
+ * @param {Chat.RequestOptions} requestOptions - Request-specific configuration.
75
+ *
76
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
77
+ *
78
+ * @example
79
+ * await client.chat.openaiKeySet()
80
+ */
81
+ openaiKeySet(requestOptions) {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ var _a;
84
+ const _response = yield core.fetcher({
85
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.AirweaveSDKEnvironment.Production, "chat/openai_key_set"),
86
+ method: "GET",
87
+ headers: Object.assign({ "x-api-key": (yield core.Supplier.get(this._options.apiKey)) != null
88
+ ? yield core.Supplier.get(this._options.apiKey)
89
+ : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airweave/sdk", "X-Fern-SDK-Version": "v0.1.34", "User-Agent": "@airweave/sdk/v0.1.34", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
90
+ contentType: "application/json",
91
+ requestType: "json",
92
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
93
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
94
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
95
+ });
96
+ if (_response.ok) {
97
+ return serializers.chat.openaiKeySet.Response.parseOrThrow(_response.body, {
98
+ unrecognizedObjectKeys: "passthrough",
99
+ allowUnrecognizedUnionMembers: true,
100
+ allowUnrecognizedEnumValues: true,
101
+ breadcrumbsPrefix: ["response"],
102
+ });
103
+ }
104
+ if (_response.error.reason === "status-code") {
105
+ switch (_response.error.statusCode) {
106
+ case 422:
107
+ throw new AirweaveSDK.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
108
+ unrecognizedObjectKeys: "passthrough",
109
+ allowUnrecognizedUnionMembers: true,
110
+ allowUnrecognizedEnumValues: true,
111
+ breadcrumbsPrefix: ["response"],
112
+ }));
113
+ default:
114
+ throw new errors.AirweaveSDKError({
115
+ statusCode: _response.error.statusCode,
116
+ body: _response.error.body,
117
+ });
118
+ }
119
+ }
120
+ switch (_response.error.reason) {
121
+ case "non-json":
122
+ throw new errors.AirweaveSDKError({
123
+ statusCode: _response.error.statusCode,
124
+ body: _response.error.rawBody,
125
+ });
126
+ case "timeout":
127
+ throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling GET /chat/openai_key_set.");
128
+ case "unknown":
129
+ throw new errors.AirweaveSDKError({
130
+ message: _response.error.errorMessage,
131
+ });
132
+ }
133
+ });
134
+ }
135
+ /**
136
+ * List all chats for the current user.
137
+ *
138
+ * Args:
139
+ * ----
140
+ * db: The database session.
141
+ * skip: The number of chats to skip.
142
+ * limit: The number of chats to return.
143
+ * user: The current user.
144
+ *
145
+ * Returns:
146
+ * -------
147
+ * list[schemas.Chat]: The list of chats.
148
+ *
149
+ * @param {AirweaveSDK.ListChatsChatGetRequest} request
150
+ * @param {Chat.RequestOptions} requestOptions - Request-specific configuration.
151
+ *
152
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
153
+ *
154
+ * @example
155
+ * await client.chat.listChats()
156
+ */
157
+ listChats() {
158
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
159
+ var _a;
160
+ const { skip, limit } = request;
161
+ const _queryParams = {};
162
+ if (skip != null) {
163
+ _queryParams["skip"] = skip.toString();
164
+ }
165
+ if (limit != null) {
166
+ _queryParams["limit"] = limit.toString();
167
+ }
168
+ const _response = yield core.fetcher({
169
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.AirweaveSDKEnvironment.Production, "chat/"),
170
+ method: "GET",
171
+ headers: Object.assign({ "x-api-key": (yield core.Supplier.get(this._options.apiKey)) != null
172
+ ? yield core.Supplier.get(this._options.apiKey)
173
+ : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airweave/sdk", "X-Fern-SDK-Version": "v0.1.34", "User-Agent": "@airweave/sdk/v0.1.34", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
174
+ contentType: "application/json",
175
+ queryParameters: _queryParams,
176
+ requestType: "json",
177
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
178
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
179
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
180
+ });
181
+ if (_response.ok) {
182
+ return serializers.chat.listChats.Response.parseOrThrow(_response.body, {
183
+ unrecognizedObjectKeys: "passthrough",
184
+ allowUnrecognizedUnionMembers: true,
185
+ allowUnrecognizedEnumValues: true,
186
+ breadcrumbsPrefix: ["response"],
187
+ });
188
+ }
189
+ if (_response.error.reason === "status-code") {
190
+ switch (_response.error.statusCode) {
191
+ case 422:
192
+ throw new AirweaveSDK.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
193
+ unrecognizedObjectKeys: "passthrough",
194
+ allowUnrecognizedUnionMembers: true,
195
+ allowUnrecognizedEnumValues: true,
196
+ breadcrumbsPrefix: ["response"],
197
+ }));
198
+ default:
199
+ throw new errors.AirweaveSDKError({
200
+ statusCode: _response.error.statusCode,
201
+ body: _response.error.body,
202
+ });
203
+ }
204
+ }
205
+ switch (_response.error.reason) {
206
+ case "non-json":
207
+ throw new errors.AirweaveSDKError({
208
+ statusCode: _response.error.statusCode,
209
+ body: _response.error.rawBody,
210
+ });
211
+ case "timeout":
212
+ throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling GET /chat/.");
213
+ case "unknown":
214
+ throw new errors.AirweaveSDKError({
215
+ message: _response.error.errorMessage,
216
+ });
217
+ }
218
+ });
219
+ }
220
+ /**
221
+ * Create a new chat.
222
+ *
223
+ * Args:
224
+ * ----
225
+ * db: The database session.
226
+ * chat_in: The chat creation data.
227
+ * user: The current user.
228
+ *
229
+ * Returns:
230
+ * -------
231
+ * schemas.Chat: The created chat.
232
+ *
233
+ * @param {AirweaveSDK.ChatCreate} request
234
+ * @param {Chat.RequestOptions} requestOptions - Request-specific configuration.
235
+ *
236
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
237
+ *
238
+ * @example
239
+ * await client.chat.createChat({
240
+ * name: "name",
241
+ * syncId: "sync_id"
242
+ * })
243
+ */
244
+ createChat(request, requestOptions) {
245
+ return __awaiter(this, void 0, void 0, function* () {
246
+ var _a;
247
+ const _response = yield core.fetcher({
248
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.AirweaveSDKEnvironment.Production, "chat/"),
249
+ method: "POST",
250
+ headers: Object.assign({ "x-api-key": (yield core.Supplier.get(this._options.apiKey)) != null
251
+ ? yield core.Supplier.get(this._options.apiKey)
252
+ : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airweave/sdk", "X-Fern-SDK-Version": "v0.1.34", "User-Agent": "@airweave/sdk/v0.1.34", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
253
+ contentType: "application/json",
254
+ requestType: "json",
255
+ body: serializers.ChatCreate.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
256
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
257
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
258
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
259
+ });
260
+ if (_response.ok) {
261
+ return serializers.Chat.parseOrThrow(_response.body, {
262
+ unrecognizedObjectKeys: "passthrough",
263
+ allowUnrecognizedUnionMembers: true,
264
+ allowUnrecognizedEnumValues: true,
265
+ breadcrumbsPrefix: ["response"],
266
+ });
267
+ }
268
+ if (_response.error.reason === "status-code") {
269
+ switch (_response.error.statusCode) {
270
+ case 422:
271
+ throw new AirweaveSDK.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
272
+ unrecognizedObjectKeys: "passthrough",
273
+ allowUnrecognizedUnionMembers: true,
274
+ allowUnrecognizedEnumValues: true,
275
+ breadcrumbsPrefix: ["response"],
276
+ }));
277
+ default:
278
+ throw new errors.AirweaveSDKError({
279
+ statusCode: _response.error.statusCode,
280
+ body: _response.error.body,
281
+ });
282
+ }
283
+ }
284
+ switch (_response.error.reason) {
285
+ case "non-json":
286
+ throw new errors.AirweaveSDKError({
287
+ statusCode: _response.error.statusCode,
288
+ body: _response.error.rawBody,
289
+ });
290
+ case "timeout":
291
+ throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling POST /chat/.");
292
+ case "unknown":
293
+ throw new errors.AirweaveSDKError({
294
+ message: _response.error.errorMessage,
295
+ });
296
+ }
297
+ });
298
+ }
299
+ /**
300
+ * Get a specific chat by ID.
301
+ *
302
+ * Args:
303
+ * ----
304
+ * db: The database session.
305
+ * chat_id: The ID of the chat to get.
306
+ * user: The current user.
307
+ *
308
+ * Returns:
309
+ * -------
310
+ * schemas.Chat: The chat.
311
+ *
312
+ * @param {string} chatId
313
+ * @param {Chat.RequestOptions} requestOptions - Request-specific configuration.
314
+ *
315
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
316
+ *
317
+ * @example
318
+ * await client.chat.getChat("chat_id")
319
+ */
320
+ getChat(chatId, requestOptions) {
321
+ return __awaiter(this, void 0, void 0, function* () {
322
+ var _a;
323
+ const _response = yield core.fetcher({
324
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.AirweaveSDKEnvironment.Production, `chat/${encodeURIComponent(chatId)}`),
325
+ method: "GET",
326
+ headers: Object.assign({ "x-api-key": (yield core.Supplier.get(this._options.apiKey)) != null
327
+ ? yield core.Supplier.get(this._options.apiKey)
328
+ : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airweave/sdk", "X-Fern-SDK-Version": "v0.1.34", "User-Agent": "@airweave/sdk/v0.1.34", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
329
+ contentType: "application/json",
330
+ requestType: "json",
331
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
332
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
333
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
334
+ });
335
+ if (_response.ok) {
336
+ return serializers.Chat.parseOrThrow(_response.body, {
337
+ unrecognizedObjectKeys: "passthrough",
338
+ allowUnrecognizedUnionMembers: true,
339
+ allowUnrecognizedEnumValues: true,
340
+ breadcrumbsPrefix: ["response"],
341
+ });
342
+ }
343
+ if (_response.error.reason === "status-code") {
344
+ switch (_response.error.statusCode) {
345
+ case 422:
346
+ throw new AirweaveSDK.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
347
+ unrecognizedObjectKeys: "passthrough",
348
+ allowUnrecognizedUnionMembers: true,
349
+ allowUnrecognizedEnumValues: true,
350
+ breadcrumbsPrefix: ["response"],
351
+ }));
352
+ default:
353
+ throw new errors.AirweaveSDKError({
354
+ statusCode: _response.error.statusCode,
355
+ body: _response.error.body,
356
+ });
357
+ }
358
+ }
359
+ switch (_response.error.reason) {
360
+ case "non-json":
361
+ throw new errors.AirweaveSDKError({
362
+ statusCode: _response.error.statusCode,
363
+ body: _response.error.rawBody,
364
+ });
365
+ case "timeout":
366
+ throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling GET /chat/{chat_id}.");
367
+ case "unknown":
368
+ throw new errors.AirweaveSDKError({
369
+ message: _response.error.errorMessage,
370
+ });
371
+ }
372
+ });
373
+ }
374
+ /**
375
+ * Update a chat.
376
+ *
377
+ * Args:
378
+ * ----
379
+ * db: The database session.
380
+ * chat_id: The ID of the chat to update.
381
+ * chat_in: The chat update data.
382
+ * user: The current user.
383
+ *
384
+ * Returns:
385
+ * -------
386
+ * schemas.Chat: The updated chat.
387
+ *
388
+ * @param {string} chatId
389
+ * @param {AirweaveSDK.ChatUpdate} request
390
+ * @param {Chat.RequestOptions} requestOptions - Request-specific configuration.
391
+ *
392
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
393
+ *
394
+ * @example
395
+ * await client.chat.updateChat("chat_id")
396
+ */
397
+ updateChat(chatId_1) {
398
+ return __awaiter(this, arguments, void 0, function* (chatId, request = {}, requestOptions) {
399
+ var _a;
400
+ const _response = yield core.fetcher({
401
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.AirweaveSDKEnvironment.Production, `chat/${encodeURIComponent(chatId)}`),
402
+ method: "PUT",
403
+ headers: Object.assign({ "x-api-key": (yield core.Supplier.get(this._options.apiKey)) != null
404
+ ? yield core.Supplier.get(this._options.apiKey)
405
+ : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airweave/sdk", "X-Fern-SDK-Version": "v0.1.34", "User-Agent": "@airweave/sdk/v0.1.34", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
406
+ contentType: "application/json",
407
+ requestType: "json",
408
+ body: serializers.ChatUpdate.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
409
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
410
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
411
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
412
+ });
413
+ if (_response.ok) {
414
+ return serializers.Chat.parseOrThrow(_response.body, {
415
+ unrecognizedObjectKeys: "passthrough",
416
+ allowUnrecognizedUnionMembers: true,
417
+ allowUnrecognizedEnumValues: true,
418
+ breadcrumbsPrefix: ["response"],
419
+ });
420
+ }
421
+ if (_response.error.reason === "status-code") {
422
+ switch (_response.error.statusCode) {
423
+ case 422:
424
+ throw new AirweaveSDK.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
425
+ unrecognizedObjectKeys: "passthrough",
426
+ allowUnrecognizedUnionMembers: true,
427
+ allowUnrecognizedEnumValues: true,
428
+ breadcrumbsPrefix: ["response"],
429
+ }));
430
+ default:
431
+ throw new errors.AirweaveSDKError({
432
+ statusCode: _response.error.statusCode,
433
+ body: _response.error.body,
434
+ });
435
+ }
436
+ }
437
+ switch (_response.error.reason) {
438
+ case "non-json":
439
+ throw new errors.AirweaveSDKError({
440
+ statusCode: _response.error.statusCode,
441
+ body: _response.error.rawBody,
442
+ });
443
+ case "timeout":
444
+ throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling PUT /chat/{chat_id}.");
445
+ case "unknown":
446
+ throw new errors.AirweaveSDKError({
447
+ message: _response.error.errorMessage,
448
+ });
449
+ }
450
+ });
451
+ }
452
+ /**
453
+ * Archive a chat.
454
+ *
455
+ * Args:
456
+ * ----
457
+ * db: The database session.
458
+ * chat_id: The ID of the chat to archive.
459
+ * user: The current user.
460
+ *
461
+ * @param {string} chatId
462
+ * @param {Chat.RequestOptions} requestOptions - Request-specific configuration.
463
+ *
464
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
465
+ *
466
+ * @example
467
+ * await client.chat.deleteChat("chat_id")
468
+ */
469
+ deleteChat(chatId, requestOptions) {
470
+ return __awaiter(this, void 0, void 0, function* () {
471
+ var _a;
472
+ const _response = yield core.fetcher({
473
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.AirweaveSDKEnvironment.Production, `chat/${encodeURIComponent(chatId)}`),
474
+ method: "DELETE",
475
+ headers: Object.assign({ "x-api-key": (yield core.Supplier.get(this._options.apiKey)) != null
476
+ ? yield core.Supplier.get(this._options.apiKey)
477
+ : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airweave/sdk", "X-Fern-SDK-Version": "v0.1.34", "User-Agent": "@airweave/sdk/v0.1.34", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
478
+ contentType: "application/json",
479
+ requestType: "json",
480
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
481
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
482
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
483
+ });
484
+ if (_response.ok) {
485
+ return;
486
+ }
487
+ if (_response.error.reason === "status-code") {
488
+ switch (_response.error.statusCode) {
489
+ case 422:
490
+ throw new AirweaveSDK.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
491
+ unrecognizedObjectKeys: "passthrough",
492
+ allowUnrecognizedUnionMembers: true,
493
+ allowUnrecognizedEnumValues: true,
494
+ breadcrumbsPrefix: ["response"],
495
+ }));
496
+ default:
497
+ throw new errors.AirweaveSDKError({
498
+ statusCode: _response.error.statusCode,
499
+ body: _response.error.body,
500
+ });
501
+ }
502
+ }
503
+ switch (_response.error.reason) {
504
+ case "non-json":
505
+ throw new errors.AirweaveSDKError({
506
+ statusCode: _response.error.statusCode,
507
+ body: _response.error.rawBody,
508
+ });
509
+ case "timeout":
510
+ throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling DELETE /chat/{chat_id}.");
511
+ case "unknown":
512
+ throw new errors.AirweaveSDKError({
513
+ message: _response.error.errorMessage,
514
+ });
515
+ }
516
+ });
517
+ }
518
+ /**
519
+ * Send a message to a chat.
520
+ *
521
+ * Args:
522
+ * -----
523
+ * db: The database session.
524
+ * chat_id: The ID of the chat to send the message to.
525
+ * message: The message to send.
526
+ * user: The current user.
527
+ *
528
+ * Returns:
529
+ * -------
530
+ * schemas.ChatMessage: The sent message.
531
+ *
532
+ * @param {string} chatId
533
+ * @param {AirweaveSDK.ChatMessageCreate} request
534
+ * @param {Chat.RequestOptions} requestOptions - Request-specific configuration.
535
+ *
536
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
537
+ *
538
+ * @example
539
+ * await client.chat.sendMessage("chat_id", {
540
+ * content: "content"
541
+ * })
542
+ */
543
+ sendMessage(chatId, request, requestOptions) {
544
+ return __awaiter(this, void 0, void 0, function* () {
545
+ var _a;
546
+ const _response = yield core.fetcher({
547
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.AirweaveSDKEnvironment.Production, `chat/${encodeURIComponent(chatId)}/message`),
548
+ method: "POST",
549
+ headers: Object.assign({ "x-api-key": (yield core.Supplier.get(this._options.apiKey)) != null
550
+ ? yield core.Supplier.get(this._options.apiKey)
551
+ : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airweave/sdk", "X-Fern-SDK-Version": "v0.1.34", "User-Agent": "@airweave/sdk/v0.1.34", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
552
+ contentType: "application/json",
553
+ requestType: "json",
554
+ body: serializers.ChatMessageCreate.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
555
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
556
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
557
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
558
+ });
559
+ if (_response.ok) {
560
+ return serializers.ChatMessage.parseOrThrow(_response.body, {
561
+ unrecognizedObjectKeys: "passthrough",
562
+ allowUnrecognizedUnionMembers: true,
563
+ allowUnrecognizedEnumValues: true,
564
+ breadcrumbsPrefix: ["response"],
565
+ });
566
+ }
567
+ if (_response.error.reason === "status-code") {
568
+ switch (_response.error.statusCode) {
569
+ case 422:
570
+ throw new AirweaveSDK.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
571
+ unrecognizedObjectKeys: "passthrough",
572
+ allowUnrecognizedUnionMembers: true,
573
+ allowUnrecognizedEnumValues: true,
574
+ breadcrumbsPrefix: ["response"],
575
+ }));
576
+ default:
577
+ throw new errors.AirweaveSDKError({
578
+ statusCode: _response.error.statusCode,
579
+ body: _response.error.body,
580
+ });
581
+ }
582
+ }
583
+ switch (_response.error.reason) {
584
+ case "non-json":
585
+ throw new errors.AirweaveSDKError({
586
+ statusCode: _response.error.statusCode,
587
+ body: _response.error.rawBody,
588
+ });
589
+ case "timeout":
590
+ throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling POST /chat/{chat_id}/message.");
591
+ case "unknown":
592
+ throw new errors.AirweaveSDKError({
593
+ message: _response.error.errorMessage,
594
+ });
595
+ }
596
+ });
597
+ }
598
+ /**
599
+ * Stream an AI response for a chat message.
600
+ *
601
+ * Args:
602
+ * -----
603
+ * db: The database session.
604
+ * chat_id: The ID of the chat to stream the response for.
605
+ * user: The current user.
606
+ *
607
+ * Returns:
608
+ * -------
609
+ * StreamingResponse: The streaming response.
610
+ *
611
+ * @param {string} chatId
612
+ * @param {Chat.RequestOptions} requestOptions - Request-specific configuration.
613
+ *
614
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
615
+ *
616
+ * @example
617
+ * await client.chat.streamChatResponse("chat_id")
618
+ */
619
+ streamChatResponse(chatId, requestOptions) {
620
+ return __awaiter(this, void 0, void 0, function* () {
621
+ var _a;
622
+ const _response = yield core.fetcher({
623
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.AirweaveSDKEnvironment.Production, `chat/${encodeURIComponent(chatId)}/stream`),
624
+ method: "GET",
625
+ headers: Object.assign({ "x-api-key": (yield core.Supplier.get(this._options.apiKey)) != null
626
+ ? yield core.Supplier.get(this._options.apiKey)
627
+ : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airweave/sdk", "X-Fern-SDK-Version": "v0.1.34", "User-Agent": "@airweave/sdk/v0.1.34", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
628
+ contentType: "application/json",
629
+ requestType: "json",
630
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
631
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
632
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
633
+ });
634
+ if (_response.ok) {
635
+ return;
636
+ }
637
+ if (_response.error.reason === "status-code") {
638
+ switch (_response.error.statusCode) {
639
+ case 422:
640
+ throw new AirweaveSDK.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
641
+ unrecognizedObjectKeys: "passthrough",
642
+ allowUnrecognizedUnionMembers: true,
643
+ allowUnrecognizedEnumValues: true,
644
+ breadcrumbsPrefix: ["response"],
645
+ }));
646
+ default:
647
+ throw new errors.AirweaveSDKError({
648
+ statusCode: _response.error.statusCode,
649
+ body: _response.error.body,
650
+ });
651
+ }
652
+ }
653
+ switch (_response.error.reason) {
654
+ case "non-json":
655
+ throw new errors.AirweaveSDKError({
656
+ statusCode: _response.error.statusCode,
657
+ body: _response.error.rawBody,
658
+ });
659
+ case "timeout":
660
+ throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling GET /chat/{chat_id}/stream.");
661
+ case "unknown":
662
+ throw new errors.AirweaveSDKError({
663
+ message: _response.error.errorMessage,
664
+ });
665
+ }
666
+ });
667
+ }
668
+ }
669
+ exports.Chat = Chat;
@@ -0,0 +1 @@
1
+ export * from "./requests";