@airweave/sdk 0.1.12 → 0.1.13

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