@airweave/sdk 0.1.12 → 0.1.14

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,391 +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.ApiKeys = 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 ApiKeys {
59
- constructor(_options = {}) {
60
- this._options = _options;
61
- }
62
- /**
63
- * Retrieve all API keys for the current user.
64
- *
65
- * Args:
66
- * ----
67
- * db (AsyncSession): The database session.
68
- * skip (int): Number of records to skip for pagination.
69
- * limit (int): Maximum number of records to return.
70
- * user (schemas.User): The current user.
71
- *
72
- * Returns:
73
- * -------
74
- * List[schemas.APIKey]: A list of API keys.
75
- *
76
- * @param {AirweaveSDK.ReadApiKeysApiKeysGetRequest} request
77
- * @param {ApiKeys.RequestOptions} requestOptions - Request-specific configuration.
78
- *
79
- * @throws {@link AirweaveSDK.UnprocessableEntityError}
80
- *
81
- * @example
82
- * await client.apiKeys.readApiKeys()
83
- */
84
- readApiKeys() {
85
- return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
86
- var _a;
87
- const { skip, limit } = request;
88
- const _queryParams = {};
89
- if (skip != null) {
90
- _queryParams["skip"] = skip.toString();
91
- }
92
- if (limit != null) {
93
- _queryParams["limit"] = limit.toString();
94
- }
95
- const _response = yield core.fetcher({
96
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.AirweaveSDKEnvironment.Production, "api_keys/"),
97
- method: "GET",
98
- headers: Object.assign({ "x-api-key": (yield core.Supplier.get(this._options.apiKey)) != null
99
- ? yield core.Supplier.get(this._options.apiKey)
100
- : 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),
101
- contentType: "application/json",
102
- queryParameters: _queryParams,
103
- requestType: "json",
104
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
105
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
106
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
107
- });
108
- if (_response.ok) {
109
- return serializers.apiKeys.readApiKeys.Response.parseOrThrow(_response.body, {
110
- unrecognizedObjectKeys: "passthrough",
111
- allowUnrecognizedUnionMembers: true,
112
- allowUnrecognizedEnumValues: true,
113
- breadcrumbsPrefix: ["response"],
114
- });
115
- }
116
- if (_response.error.reason === "status-code") {
117
- switch (_response.error.statusCode) {
118
- case 422:
119
- throw new AirweaveSDK.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
120
- unrecognizedObjectKeys: "passthrough",
121
- allowUnrecognizedUnionMembers: true,
122
- allowUnrecognizedEnumValues: true,
123
- breadcrumbsPrefix: ["response"],
124
- }));
125
- default:
126
- throw new errors.AirweaveSDKError({
127
- statusCode: _response.error.statusCode,
128
- body: _response.error.body,
129
- });
130
- }
131
- }
132
- switch (_response.error.reason) {
133
- case "non-json":
134
- throw new errors.AirweaveSDKError({
135
- statusCode: _response.error.statusCode,
136
- body: _response.error.rawBody,
137
- });
138
- case "timeout":
139
- throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling GET /api_keys/.");
140
- case "unknown":
141
- throw new errors.AirweaveSDKError({
142
- message: _response.error.errorMessage,
143
- });
144
- }
145
- });
146
- }
147
- /**
148
- * Create a new API key for the current user.
149
- *
150
- * Returns a temporary plain key for the user to store securely.
151
- * This is not stored in the database.
152
- *
153
- * Args:
154
- * ----
155
- * db (AsyncSession): The database session.
156
- * api_key_in (schemas.APIKeyCreate): The API key creation data.
157
- * user (schemas.User): The current user.
158
- *
159
- * Returns:
160
- * -------
161
- * schemas.APIKeyWithPlainKey: The created API key object, including the key.
162
- *
163
- * @param {AirweaveSDK.ApiKeyCreate} request
164
- * @param {ApiKeys.RequestOptions} requestOptions - Request-specific configuration.
165
- *
166
- * @throws {@link AirweaveSDK.UnprocessableEntityError}
167
- *
168
- * @example
169
- * await client.apiKeys.createApiKey()
170
- */
171
- createApiKey() {
172
- return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
173
- var _a;
174
- const _response = yield core.fetcher({
175
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.AirweaveSDKEnvironment.Production, "api_keys/"),
176
- method: "POST",
177
- headers: Object.assign({ "x-api-key": (yield core.Supplier.get(this._options.apiKey)) != null
178
- ? yield core.Supplier.get(this._options.apiKey)
179
- : 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),
180
- contentType: "application/json",
181
- requestType: "json",
182
- body: serializers.ApiKeyCreate.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
183
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
184
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
185
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
186
- });
187
- if (_response.ok) {
188
- return serializers.ApiKeyWithPlainKey.parseOrThrow(_response.body, {
189
- unrecognizedObjectKeys: "passthrough",
190
- allowUnrecognizedUnionMembers: true,
191
- allowUnrecognizedEnumValues: true,
192
- breadcrumbsPrefix: ["response"],
193
- });
194
- }
195
- if (_response.error.reason === "status-code") {
196
- switch (_response.error.statusCode) {
197
- case 422:
198
- throw new AirweaveSDK.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
199
- unrecognizedObjectKeys: "passthrough",
200
- allowUnrecognizedUnionMembers: true,
201
- allowUnrecognizedEnumValues: true,
202
- breadcrumbsPrefix: ["response"],
203
- }));
204
- default:
205
- throw new errors.AirweaveSDKError({
206
- statusCode: _response.error.statusCode,
207
- body: _response.error.body,
208
- });
209
- }
210
- }
211
- switch (_response.error.reason) {
212
- case "non-json":
213
- throw new errors.AirweaveSDKError({
214
- statusCode: _response.error.statusCode,
215
- body: _response.error.rawBody,
216
- });
217
- case "timeout":
218
- throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling POST /api_keys/.");
219
- case "unknown":
220
- throw new errors.AirweaveSDKError({
221
- message: _response.error.errorMessage,
222
- });
223
- }
224
- });
225
- }
226
- /**
227
- * Delete an API key.
228
- *
229
- * Args:
230
- * ----
231
- * db (AsyncSession): The database session.
232
- * id (UUID): The ID of the API key.
233
- * user (schemas.User): The current user.
234
- *
235
- * Returns:
236
- * -------
237
- * schemas.APIKey: The revoked API key object.
238
- *
239
- * Raises:
240
- * ------
241
- * HTTPException: If the API key is not found.
242
- *
243
- * @param {AirweaveSDK.DeleteApiKeyApiKeysDeleteRequest} request
244
- * @param {ApiKeys.RequestOptions} requestOptions - Request-specific configuration.
245
- *
246
- * @throws {@link AirweaveSDK.UnprocessableEntityError}
247
- *
248
- * @example
249
- * await client.apiKeys.deleteApiKey({
250
- * id: "id"
251
- * })
252
- */
253
- deleteApiKey(request, requestOptions) {
254
- return __awaiter(this, void 0, void 0, function* () {
255
- var _a;
256
- const { id } = request;
257
- const _queryParams = {};
258
- _queryParams["id"] = id;
259
- const _response = yield core.fetcher({
260
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.AirweaveSDKEnvironment.Production, "api_keys/"),
261
- method: "DELETE",
262
- headers: Object.assign({ "x-api-key": (yield core.Supplier.get(this._options.apiKey)) != null
263
- ? yield core.Supplier.get(this._options.apiKey)
264
- : 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),
265
- contentType: "application/json",
266
- queryParameters: _queryParams,
267
- requestType: "json",
268
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
269
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
270
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
271
- });
272
- if (_response.ok) {
273
- return serializers.ApiKey.parseOrThrow(_response.body, {
274
- unrecognizedObjectKeys: "passthrough",
275
- allowUnrecognizedUnionMembers: true,
276
- allowUnrecognizedEnumValues: true,
277
- breadcrumbsPrefix: ["response"],
278
- });
279
- }
280
- if (_response.error.reason === "status-code") {
281
- switch (_response.error.statusCode) {
282
- case 422:
283
- throw new AirweaveSDK.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
284
- unrecognizedObjectKeys: "passthrough",
285
- allowUnrecognizedUnionMembers: true,
286
- allowUnrecognizedEnumValues: true,
287
- breadcrumbsPrefix: ["response"],
288
- }));
289
- default:
290
- throw new errors.AirweaveSDKError({
291
- statusCode: _response.error.statusCode,
292
- body: _response.error.body,
293
- });
294
- }
295
- }
296
- switch (_response.error.reason) {
297
- case "non-json":
298
- throw new errors.AirweaveSDKError({
299
- statusCode: _response.error.statusCode,
300
- body: _response.error.rawBody,
301
- });
302
- case "timeout":
303
- throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling DELETE /api_keys/.");
304
- case "unknown":
305
- throw new errors.AirweaveSDKError({
306
- message: _response.error.errorMessage,
307
- });
308
- }
309
- });
310
- }
311
- /**
312
- * Retrieve an API key by ID.
313
- *
314
- * Args:
315
- * ----
316
- * db (AsyncSession): The database session.
317
- * id (UUID): The ID of the API key.
318
- * user (schemas.User): The current user.
319
- *
320
- * Returns:
321
- * -------
322
- * schemas.APIKey: The API key object.
323
- *
324
- * Raises:
325
- * ------
326
- * HTTPException: If the API key is not found.
327
- *
328
- * @param {string} id
329
- * @param {ApiKeys.RequestOptions} requestOptions - Request-specific configuration.
330
- *
331
- * @throws {@link AirweaveSDK.UnprocessableEntityError}
332
- *
333
- * @example
334
- * await client.apiKeys.readApiKey("id")
335
- */
336
- readApiKey(id, requestOptions) {
337
- return __awaiter(this, void 0, void 0, function* () {
338
- var _a;
339
- const _response = yield core.fetcher({
340
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.AirweaveSDKEnvironment.Production, `api_keys/${encodeURIComponent(id)}`),
341
- method: "GET",
342
- headers: Object.assign({ "x-api-key": (yield core.Supplier.get(this._options.apiKey)) != null
343
- ? yield core.Supplier.get(this._options.apiKey)
344
- : 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),
345
- contentType: "application/json",
346
- requestType: "json",
347
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
348
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
349
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
350
- });
351
- if (_response.ok) {
352
- return serializers.ApiKey.parseOrThrow(_response.body, {
353
- unrecognizedObjectKeys: "passthrough",
354
- allowUnrecognizedUnionMembers: true,
355
- allowUnrecognizedEnumValues: true,
356
- breadcrumbsPrefix: ["response"],
357
- });
358
- }
359
- if (_response.error.reason === "status-code") {
360
- switch (_response.error.statusCode) {
361
- case 422:
362
- throw new AirweaveSDK.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
363
- unrecognizedObjectKeys: "passthrough",
364
- allowUnrecognizedUnionMembers: true,
365
- allowUnrecognizedEnumValues: true,
366
- breadcrumbsPrefix: ["response"],
367
- }));
368
- default:
369
- throw new errors.AirweaveSDKError({
370
- statusCode: _response.error.statusCode,
371
- body: _response.error.body,
372
- });
373
- }
374
- }
375
- switch (_response.error.reason) {
376
- case "non-json":
377
- throw new errors.AirweaveSDKError({
378
- statusCode: _response.error.statusCode,
379
- body: _response.error.rawBody,
380
- });
381
- case "timeout":
382
- throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling GET /api_keys/{id}.");
383
- case "unknown":
384
- throw new errors.AirweaveSDKError({
385
- message: _response.error.errorMessage,
386
- });
387
- }
388
- });
389
- }
390
- }
391
- exports.ApiKeys = ApiKeys;
@@ -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,12 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- /**
5
- * @example
6
- * {
7
- * id: "id"
8
- * }
9
- */
10
- export interface DeleteApiKeyApiKeysDeleteRequest {
11
- id: string;
12
- }
@@ -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,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 ReadApiKeysApiKeysGetRequest {
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,3 +0,0 @@
1
- export { type ReadApiKeysApiKeysGetRequest } from "./ReadApiKeysApiKeysGetRequest";
2
- export { type ApiKeyCreate } from "./ApiKeyCreate";
3
- export { type DeleteApiKeyApiKeysDeleteRequest } from "./DeleteApiKeyApiKeysDeleteRequest";
@@ -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);
@@ -1,134 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as environments from "../../../../environments";
5
- import * as core from "../../../../core";
6
- import * as AirweaveSDK from "../../../index";
7
- export declare namespace Chat {
8
- interface Options {
9
- environment?: core.Supplier<environments.AirweaveSDKEnvironment | string>;
10
- /** Override the x-api-key header */
11
- apiKey?: core.Supplier<string | undefined>;
12
- }
13
- interface RequestOptions {
14
- /** The maximum time to wait for a response in seconds. */
15
- timeoutInSeconds?: number;
16
- /** The number of times to retry the request. Defaults to 2. */
17
- maxRetries?: number;
18
- /** A hook to abort the request. */
19
- abortSignal?: AbortSignal;
20
- /** Override the x-api-key header */
21
- apiKey?: string | undefined;
22
- /** Additional headers to include in the request. */
23
- headers?: Record<string, string>;
24
- }
25
- }
26
- export declare class Chat {
27
- protected readonly _options: Chat.Options;
28
- constructor(_options?: Chat.Options);
29
- /**
30
- * Check if the OpenAI API key is set for the current user.
31
- *
32
- * Returns:
33
- * bool: True if the OpenAI API key is set, False otherwise.
34
- *
35
- * @param {Chat.RequestOptions} requestOptions - Request-specific configuration.
36
- *
37
- * @throws {@link AirweaveSDK.UnprocessableEntityError}
38
- *
39
- * @example
40
- * await client.chat.openaiKeySet()
41
- */
42
- openaiKeySet(requestOptions?: Chat.RequestOptions): Promise<boolean>;
43
- /**
44
- * List all chats for the current user.
45
- *
46
- * @param {AirweaveSDK.ListChatsChatGetRequest} request
47
- * @param {Chat.RequestOptions} requestOptions - Request-specific configuration.
48
- *
49
- * @throws {@link AirweaveSDK.UnprocessableEntityError}
50
- *
51
- * @example
52
- * await client.chat.listChats()
53
- */
54
- listChats(request?: AirweaveSDK.ListChatsChatGetRequest, requestOptions?: Chat.RequestOptions): Promise<AirweaveSDK.Chat[]>;
55
- /**
56
- * Create a new chat.
57
- *
58
- * @param {AirweaveSDK.ChatCreate} request
59
- * @param {Chat.RequestOptions} requestOptions - Request-specific configuration.
60
- *
61
- * @throws {@link AirweaveSDK.UnprocessableEntityError}
62
- *
63
- * @example
64
- * await client.chat.createChat({
65
- * name: "name",
66
- * syncId: "sync_id"
67
- * })
68
- */
69
- createChat(request: AirweaveSDK.ChatCreate, requestOptions?: Chat.RequestOptions): Promise<AirweaveSDK.Chat>;
70
- /**
71
- * Get a specific chat by ID.
72
- *
73
- * @param {string} chatId
74
- * @param {Chat.RequestOptions} requestOptions - Request-specific configuration.
75
- *
76
- * @throws {@link AirweaveSDK.UnprocessableEntityError}
77
- *
78
- * @example
79
- * await client.chat.getChat("chat_id")
80
- */
81
- getChat(chatId: string, requestOptions?: Chat.RequestOptions): Promise<AirweaveSDK.Chat>;
82
- /**
83
- * Update a chat.
84
- *
85
- * @param {string} chatId
86
- * @param {AirweaveSDK.ChatUpdate} request
87
- * @param {Chat.RequestOptions} requestOptions - Request-specific configuration.
88
- *
89
- * @throws {@link AirweaveSDK.UnprocessableEntityError}
90
- *
91
- * @example
92
- * await client.chat.updateChat("chat_id")
93
- */
94
- updateChat(chatId: string, request?: AirweaveSDK.ChatUpdate, requestOptions?: Chat.RequestOptions): Promise<AirweaveSDK.Chat>;
95
- /**
96
- * Archive a chat.
97
- *
98
- * @param {string} chatId
99
- * @param {Chat.RequestOptions} requestOptions - Request-specific configuration.
100
- *
101
- * @throws {@link AirweaveSDK.UnprocessableEntityError}
102
- *
103
- * @example
104
- * await client.chat.deleteChat("chat_id")
105
- */
106
- deleteChat(chatId: string, requestOptions?: Chat.RequestOptions): Promise<void>;
107
- /**
108
- * Send a message to a chat.
109
- *
110
- * @param {string} chatId
111
- * @param {AirweaveSDK.ChatMessageCreate} request
112
- * @param {Chat.RequestOptions} requestOptions - Request-specific configuration.
113
- *
114
- * @throws {@link AirweaveSDK.UnprocessableEntityError}
115
- *
116
- * @example
117
- * await client.chat.sendMessage("chat_id", {
118
- * content: "content"
119
- * })
120
- */
121
- sendMessage(chatId: string, request: AirweaveSDK.ChatMessageCreate, requestOptions?: Chat.RequestOptions): Promise<AirweaveSDK.ChatMessage>;
122
- /**
123
- * Stream an AI response for a chat message.
124
- *
125
- * @param {string} chatId
126
- * @param {Chat.RequestOptions} requestOptions - Request-specific configuration.
127
- *
128
- * @throws {@link AirweaveSDK.UnprocessableEntityError}
129
- *
130
- * @example
131
- * await client.chat.streamChatResponse("chat_id")
132
- */
133
- streamChatResponse(chatId: string, requestOptions?: Chat.RequestOptions): Promise<void>;
134
- }