@airweave/sdk 0.2.15 → 0.2.16

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 (107) hide show
  1. package/Client.d.ts +3 -0
  2. package/Client.js +25 -20
  3. package/README.md +8 -10
  4. package/api/resources/apiKeys/client/Client.d.ts +140 -0
  5. package/api/resources/apiKeys/client/Client.js +421 -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 +6 -1
  9. package/api/resources/apiKeys/client/requests/DeleteApiKeyApiKeysDeleteRequest.d.ts +14 -0
  10. package/api/resources/apiKeys/client/requests/ReadApiKeyApiKeysIdGetRequest.d.ts +12 -0
  11. package/api/resources/apiKeys/client/requests/ReadApiKeyApiKeysIdGetRequest.js +5 -0
  12. package/api/resources/apiKeys/client/requests/ReadApiKeysApiKeysGetRequest.d.ts +14 -0
  13. package/api/resources/apiKeys/client/requests/ReadApiKeysApiKeysGetRequest.js +5 -0
  14. package/api/resources/apiKeys/client/requests/index.d.ts +4 -0
  15. package/api/resources/apiKeys/client/requests/index.js +2 -0
  16. package/api/resources/apiKeys/index.d.ts +1 -0
  17. package/api/resources/apiKeys/index.js +17 -0
  18. package/api/resources/connections/client/Client.js +10 -10
  19. package/api/resources/destinations/client/Client.js +2 -2
  20. package/api/resources/embeddingModels/client/Client.js +2 -2
  21. package/api/resources/entities/client/Client.js +8 -8
  22. package/api/resources/index.d.ts +2 -0
  23. package/api/resources/index.js +3 -1
  24. package/api/resources/search/client/Client.js +1 -1
  25. package/api/resources/sources/client/Client.js +2 -2
  26. package/api/resources/sync/client/Client.js +11 -11
  27. package/api/resources/transformers/client/Client.js +3 -3
  28. package/api/resources/users/client/Client.d.ts +2 -0
  29. package/api/resources/users/client/Client.js +4 -2
  30. package/api/resources/whiteLabels/client/Client.js +8 -8
  31. package/api/types/index.d.ts +0 -1
  32. package/api/types/index.js +0 -1
  33. package/dist/Client.d.ts +3 -0
  34. package/dist/Client.js +25 -20
  35. package/dist/api/resources/apiKeys/client/Client.d.ts +140 -0
  36. package/dist/api/resources/apiKeys/client/Client.js +421 -0
  37. package/dist/api/resources/apiKeys/client/index.d.ts +1 -0
  38. package/dist/api/resources/apiKeys/client/index.js +17 -0
  39. package/dist/api/{types → resources/apiKeys/client/requests}/ApiKeyCreate.d.ts +6 -1
  40. package/dist/api/resources/apiKeys/client/requests/ApiKeyCreate.js +5 -0
  41. package/dist/api/resources/apiKeys/client/requests/DeleteApiKeyApiKeysDeleteRequest.d.ts +14 -0
  42. package/dist/api/resources/apiKeys/client/requests/DeleteApiKeyApiKeysDeleteRequest.js +5 -0
  43. package/dist/api/resources/apiKeys/client/requests/ReadApiKeyApiKeysIdGetRequest.d.ts +12 -0
  44. package/dist/api/resources/apiKeys/client/requests/ReadApiKeyApiKeysIdGetRequest.js +5 -0
  45. package/dist/api/resources/apiKeys/client/requests/ReadApiKeysApiKeysGetRequest.d.ts +14 -0
  46. package/dist/api/resources/apiKeys/client/requests/ReadApiKeysApiKeysGetRequest.js +5 -0
  47. package/dist/api/resources/apiKeys/client/requests/index.d.ts +4 -0
  48. package/dist/api/resources/apiKeys/client/requests/index.js +2 -0
  49. package/dist/api/resources/apiKeys/index.d.ts +1 -0
  50. package/dist/api/resources/apiKeys/index.js +17 -0
  51. package/dist/api/resources/connections/client/Client.js +10 -10
  52. package/dist/api/resources/destinations/client/Client.js +2 -2
  53. package/dist/api/resources/embeddingModels/client/Client.js +2 -2
  54. package/dist/api/resources/entities/client/Client.js +8 -8
  55. package/dist/api/resources/index.d.ts +2 -0
  56. package/dist/api/resources/index.js +3 -1
  57. package/dist/api/resources/search/client/Client.js +1 -1
  58. package/dist/api/resources/sources/client/Client.js +2 -2
  59. package/dist/api/resources/sync/client/Client.js +11 -11
  60. package/dist/api/resources/transformers/client/Client.js +3 -3
  61. package/dist/api/resources/users/client/Client.d.ts +2 -0
  62. package/dist/api/resources/users/client/Client.js +4 -2
  63. package/dist/api/resources/whiteLabels/client/Client.js +8 -8
  64. package/dist/api/types/index.d.ts +0 -1
  65. package/dist/api/types/index.js +0 -1
  66. package/dist/environments.d.ts +2 -2
  67. package/dist/environments.js +1 -1
  68. package/dist/serialization/resources/apiKeys/client/index.d.ts +2 -0
  69. package/dist/serialization/resources/apiKeys/client/index.js +41 -0
  70. package/dist/serialization/resources/apiKeys/client/readApiKeys.d.ts +11 -0
  71. package/dist/serialization/resources/apiKeys/client/readApiKeys.js +42 -0
  72. package/dist/serialization/resources/apiKeys/client/requests/ApiKeyCreate.d.ts +12 -0
  73. package/dist/serialization/{types → resources/apiKeys/client/requests}/ApiKeyCreate.js +1 -1
  74. package/dist/serialization/resources/apiKeys/client/requests/index.d.ts +1 -0
  75. package/dist/serialization/resources/apiKeys/client/requests/index.js +5 -0
  76. package/dist/serialization/resources/apiKeys/index.d.ts +1 -0
  77. package/dist/serialization/resources/apiKeys/index.js +17 -0
  78. package/dist/serialization/resources/index.d.ts +2 -0
  79. package/dist/serialization/resources/index.js +3 -1
  80. package/dist/serialization/types/index.d.ts +0 -1
  81. package/dist/serialization/types/index.js +0 -1
  82. package/dist/version.d.ts +1 -1
  83. package/dist/version.js +1 -1
  84. package/environments.d.ts +2 -2
  85. package/environments.js +1 -1
  86. package/package.json +1 -1
  87. package/reference.md +326 -0
  88. package/serialization/resources/apiKeys/client/index.d.ts +2 -0
  89. package/serialization/resources/apiKeys/client/index.js +41 -0
  90. package/serialization/resources/apiKeys/client/readApiKeys.d.ts +11 -0
  91. package/serialization/resources/apiKeys/client/readApiKeys.js +42 -0
  92. package/serialization/resources/apiKeys/client/requests/ApiKeyCreate.d.ts +12 -0
  93. package/serialization/{types → resources/apiKeys/client/requests}/ApiKeyCreate.js +1 -1
  94. package/serialization/resources/apiKeys/client/requests/index.d.ts +1 -0
  95. package/serialization/resources/apiKeys/client/requests/index.js +5 -0
  96. package/serialization/resources/apiKeys/index.d.ts +1 -0
  97. package/serialization/resources/apiKeys/index.js +17 -0
  98. package/serialization/resources/index.d.ts +2 -0
  99. package/serialization/resources/index.js +3 -1
  100. package/serialization/types/index.d.ts +0 -1
  101. package/serialization/types/index.js +0 -1
  102. package/version.d.ts +1 -1
  103. package/version.js +1 -1
  104. package/dist/serialization/types/ApiKeyCreate.d.ts +0 -12
  105. package/serialization/types/ApiKeyCreate.d.ts +0 -12
  106. /package/api/{types → resources/apiKeys/client/requests}/ApiKeyCreate.js +0 -0
  107. /package/{dist/api/types/ApiKeyCreate.js → api/resources/apiKeys/client/requests/DeleteApiKeyApiKeysDeleteRequest.js} +0 -0
@@ -0,0 +1,140 @@
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 ApiKeys {
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 ApiKeys {
27
+ protected readonly _options: ApiKeys.Options;
28
+ constructor(_options?: ApiKeys.Options);
29
+ /**
30
+ * Retrieve all API keys for the current user.
31
+ *
32
+ * Args:
33
+ * ----
34
+ * db (AsyncSession): The database session.
35
+ * skip (int): Number of records to skip for pagination.
36
+ * limit (int): Maximum number of records to return.
37
+ * user (schemas.User): The current user.
38
+ *
39
+ * Returns:
40
+ * -------
41
+ * List[schemas.APIKey]: A list of API keys.
42
+ *
43
+ * @param {AirweaveSDK.ReadApiKeysApiKeysGetRequest} request
44
+ * @param {ApiKeys.RequestOptions} requestOptions - Request-specific configuration.
45
+ *
46
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
47
+ *
48
+ * @example
49
+ * await client.apiKeys.readApiKeys({
50
+ * creds: "creds"
51
+ * })
52
+ */
53
+ readApiKeys(request: AirweaveSDK.ReadApiKeysApiKeysGetRequest, requestOptions?: ApiKeys.RequestOptions): Promise<AirweaveSDK.ApiKey[]>;
54
+ /**
55
+ * Create a new API key for the current user.
56
+ *
57
+ * Returns a temporary plain key for the user to store securely.
58
+ * This is not stored in the database.
59
+ *
60
+ * Args:
61
+ * ----
62
+ * db (AsyncSession): The database session.
63
+ * api_key_in (schemas.APIKeyCreate): The API key creation data.
64
+ * user (schemas.User): The current user.
65
+ *
66
+ * Returns:
67
+ * -------
68
+ * schemas.APIKeyWithPlainKey: The created API key object, including the key.
69
+ *
70
+ * @param {AirweaveSDK.ApiKeyCreate} request
71
+ * @param {ApiKeys.RequestOptions} requestOptions - Request-specific configuration.
72
+ *
73
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
74
+ *
75
+ * @example
76
+ * await client.apiKeys.createApiKey({
77
+ * creds: "creds",
78
+ * expirationDate: undefined
79
+ * })
80
+ */
81
+ createApiKey(request: AirweaveSDK.ApiKeyCreate, requestOptions?: ApiKeys.RequestOptions): Promise<AirweaveSDK.ApiKeyWithPlainKey>;
82
+ /**
83
+ * Delete an API key.
84
+ *
85
+ * Args:
86
+ * ----
87
+ * db (AsyncSession): The database session.
88
+ * id (UUID): The ID of the API key.
89
+ * user (schemas.User): The current user.
90
+ *
91
+ * Returns:
92
+ * -------
93
+ * schemas.APIKey: The revoked API key object.
94
+ *
95
+ * Raises:
96
+ * ------
97
+ * HTTPException: If the API key is not found.
98
+ *
99
+ * @param {AirweaveSDK.DeleteApiKeyApiKeysDeleteRequest} request
100
+ * @param {ApiKeys.RequestOptions} requestOptions - Request-specific configuration.
101
+ *
102
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
103
+ *
104
+ * @example
105
+ * await client.apiKeys.deleteApiKey({
106
+ * id: "id",
107
+ * creds: "creds"
108
+ * })
109
+ */
110
+ deleteApiKey(request: AirweaveSDK.DeleteApiKeyApiKeysDeleteRequest, requestOptions?: ApiKeys.RequestOptions): Promise<AirweaveSDK.ApiKey>;
111
+ /**
112
+ * Retrieve an API key by ID.
113
+ *
114
+ * Args:
115
+ * ----
116
+ * db (AsyncSession): The database session.
117
+ * id (UUID): The ID of the API key.
118
+ * user (schemas.User): The current user.
119
+ *
120
+ * Returns:
121
+ * -------
122
+ * schemas.APIKey: The API key object.
123
+ *
124
+ * Raises:
125
+ * ------
126
+ * HTTPException: If the API key is not found.
127
+ *
128
+ * @param {string} id
129
+ * @param {AirweaveSDK.ReadApiKeyApiKeysIdGetRequest} request
130
+ * @param {ApiKeys.RequestOptions} requestOptions - Request-specific configuration.
131
+ *
132
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
133
+ *
134
+ * @example
135
+ * await client.apiKeys.readApiKey("id", {
136
+ * creds: "creds"
137
+ * })
138
+ */
139
+ readApiKey(id: string, request: AirweaveSDK.ReadApiKeyApiKeysIdGetRequest, requestOptions?: ApiKeys.RequestOptions): Promise<AirweaveSDK.ApiKey>;
140
+ }
@@ -0,0 +1,421 @@
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 __rest = (this && this.__rest) || function (s, e) {
48
+ var t = {};
49
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
50
+ t[p] = s[p];
51
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
52
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
53
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
54
+ t[p[i]] = s[p[i]];
55
+ }
56
+ return t;
57
+ };
58
+ var __importDefault = (this && this.__importDefault) || function (mod) {
59
+ return (mod && mod.__esModule) ? mod : { "default": mod };
60
+ };
61
+ Object.defineProperty(exports, "__esModule", { value: true });
62
+ exports.ApiKeys = void 0;
63
+ const environments = __importStar(require("../../../../environments"));
64
+ const core = __importStar(require("../../../../core"));
65
+ const AirweaveSDK = __importStar(require("../../../index"));
66
+ const url_join_1 = __importDefault(require("url-join"));
67
+ const serializers = __importStar(require("../../../../serialization/index"));
68
+ const errors = __importStar(require("../../../../errors/index"));
69
+ class ApiKeys {
70
+ constructor(_options = {}) {
71
+ this._options = _options;
72
+ }
73
+ /**
74
+ * Retrieve all API keys for the current user.
75
+ *
76
+ * Args:
77
+ * ----
78
+ * db (AsyncSession): The database session.
79
+ * skip (int): Number of records to skip for pagination.
80
+ * limit (int): Maximum number of records to return.
81
+ * user (schemas.User): The current user.
82
+ *
83
+ * Returns:
84
+ * -------
85
+ * List[schemas.APIKey]: A list of API keys.
86
+ *
87
+ * @param {AirweaveSDK.ReadApiKeysApiKeysGetRequest} request
88
+ * @param {ApiKeys.RequestOptions} requestOptions - Request-specific configuration.
89
+ *
90
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
91
+ *
92
+ * @example
93
+ * await client.apiKeys.readApiKeys({
94
+ * creds: "creds"
95
+ * })
96
+ */
97
+ readApiKeys(request, requestOptions) {
98
+ return __awaiter(this, void 0, void 0, function* () {
99
+ var _a;
100
+ const { skip, limit, creds } = request;
101
+ const _queryParams = {};
102
+ if (skip != null) {
103
+ _queryParams["skip"] = skip.toString();
104
+ }
105
+ if (limit != null) {
106
+ _queryParams["limit"] = limit.toString();
107
+ }
108
+ _queryParams["creds"] = creds;
109
+ const _response = yield core.fetcher({
110
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.AirweaveSDKEnvironment.Production, "api-keys/"),
111
+ method: "GET",
112
+ headers: Object.assign({ "x-api-key": (yield core.Supplier.get(this._options.apiKey)) != null
113
+ ? yield core.Supplier.get(this._options.apiKey)
114
+ : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airweave/sdk", "X-Fern-SDK-Version": "v0.2.16", "User-Agent": "@airweave/sdk/v0.2.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
115
+ contentType: "application/json",
116
+ queryParameters: _queryParams,
117
+ requestType: "json",
118
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
119
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
120
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
121
+ });
122
+ if (_response.ok) {
123
+ return serializers.apiKeys.readApiKeys.Response.parseOrThrow(_response.body, {
124
+ unrecognizedObjectKeys: "passthrough",
125
+ allowUnrecognizedUnionMembers: true,
126
+ allowUnrecognizedEnumValues: true,
127
+ breadcrumbsPrefix: ["response"],
128
+ });
129
+ }
130
+ if (_response.error.reason === "status-code") {
131
+ switch (_response.error.statusCode) {
132
+ case 422:
133
+ throw new AirweaveSDK.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
134
+ unrecognizedObjectKeys: "passthrough",
135
+ allowUnrecognizedUnionMembers: true,
136
+ allowUnrecognizedEnumValues: true,
137
+ breadcrumbsPrefix: ["response"],
138
+ }));
139
+ default:
140
+ throw new errors.AirweaveSDKError({
141
+ statusCode: _response.error.statusCode,
142
+ body: _response.error.body,
143
+ });
144
+ }
145
+ }
146
+ switch (_response.error.reason) {
147
+ case "non-json":
148
+ throw new errors.AirweaveSDKError({
149
+ statusCode: _response.error.statusCode,
150
+ body: _response.error.rawBody,
151
+ });
152
+ case "timeout":
153
+ throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling GET /api-keys/.");
154
+ case "unknown":
155
+ throw new errors.AirweaveSDKError({
156
+ message: _response.error.errorMessage,
157
+ });
158
+ }
159
+ });
160
+ }
161
+ /**
162
+ * Create a new API key for the current user.
163
+ *
164
+ * Returns a temporary plain key for the user to store securely.
165
+ * This is not stored in the database.
166
+ *
167
+ * Args:
168
+ * ----
169
+ * db (AsyncSession): The database session.
170
+ * api_key_in (schemas.APIKeyCreate): The API key creation data.
171
+ * user (schemas.User): The current user.
172
+ *
173
+ * Returns:
174
+ * -------
175
+ * schemas.APIKeyWithPlainKey: The created API key object, including the key.
176
+ *
177
+ * @param {AirweaveSDK.ApiKeyCreate} request
178
+ * @param {ApiKeys.RequestOptions} requestOptions - Request-specific configuration.
179
+ *
180
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
181
+ *
182
+ * @example
183
+ * await client.apiKeys.createApiKey({
184
+ * creds: "creds",
185
+ * expirationDate: undefined
186
+ * })
187
+ */
188
+ createApiKey(request, requestOptions) {
189
+ return __awaiter(this, void 0, void 0, function* () {
190
+ var _a;
191
+ const { creds } = request, _body = __rest(request, ["creds"]);
192
+ const _queryParams = {};
193
+ _queryParams["creds"] = creds;
194
+ const _response = yield core.fetcher({
195
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.AirweaveSDKEnvironment.Production, "api-keys/"),
196
+ method: "POST",
197
+ headers: Object.assign({ "x-api-key": (yield core.Supplier.get(this._options.apiKey)) != null
198
+ ? yield core.Supplier.get(this._options.apiKey)
199
+ : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airweave/sdk", "X-Fern-SDK-Version": "v0.2.16", "User-Agent": "@airweave/sdk/v0.2.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
200
+ contentType: "application/json",
201
+ queryParameters: _queryParams,
202
+ requestType: "json",
203
+ body: serializers.ApiKeyCreate.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }),
204
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
205
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
206
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
207
+ });
208
+ if (_response.ok) {
209
+ return serializers.ApiKeyWithPlainKey.parseOrThrow(_response.body, {
210
+ unrecognizedObjectKeys: "passthrough",
211
+ allowUnrecognizedUnionMembers: true,
212
+ allowUnrecognizedEnumValues: true,
213
+ breadcrumbsPrefix: ["response"],
214
+ });
215
+ }
216
+ if (_response.error.reason === "status-code") {
217
+ switch (_response.error.statusCode) {
218
+ case 422:
219
+ throw new AirweaveSDK.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
220
+ unrecognizedObjectKeys: "passthrough",
221
+ allowUnrecognizedUnionMembers: true,
222
+ allowUnrecognizedEnumValues: true,
223
+ breadcrumbsPrefix: ["response"],
224
+ }));
225
+ default:
226
+ throw new errors.AirweaveSDKError({
227
+ statusCode: _response.error.statusCode,
228
+ body: _response.error.body,
229
+ });
230
+ }
231
+ }
232
+ switch (_response.error.reason) {
233
+ case "non-json":
234
+ throw new errors.AirweaveSDKError({
235
+ statusCode: _response.error.statusCode,
236
+ body: _response.error.rawBody,
237
+ });
238
+ case "timeout":
239
+ throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling POST /api-keys/.");
240
+ case "unknown":
241
+ throw new errors.AirweaveSDKError({
242
+ message: _response.error.errorMessage,
243
+ });
244
+ }
245
+ });
246
+ }
247
+ /**
248
+ * Delete an API key.
249
+ *
250
+ * Args:
251
+ * ----
252
+ * db (AsyncSession): The database session.
253
+ * id (UUID): The ID of the API key.
254
+ * user (schemas.User): The current user.
255
+ *
256
+ * Returns:
257
+ * -------
258
+ * schemas.APIKey: The revoked API key object.
259
+ *
260
+ * Raises:
261
+ * ------
262
+ * HTTPException: If the API key is not found.
263
+ *
264
+ * @param {AirweaveSDK.DeleteApiKeyApiKeysDeleteRequest} request
265
+ * @param {ApiKeys.RequestOptions} requestOptions - Request-specific configuration.
266
+ *
267
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
268
+ *
269
+ * @example
270
+ * await client.apiKeys.deleteApiKey({
271
+ * id: "id",
272
+ * creds: "creds"
273
+ * })
274
+ */
275
+ deleteApiKey(request, requestOptions) {
276
+ return __awaiter(this, void 0, void 0, function* () {
277
+ var _a;
278
+ const { id, creds } = request;
279
+ const _queryParams = {};
280
+ _queryParams["id"] = id;
281
+ _queryParams["creds"] = creds;
282
+ const _response = yield core.fetcher({
283
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.AirweaveSDKEnvironment.Production, "api-keys/"),
284
+ method: "DELETE",
285
+ headers: Object.assign({ "x-api-key": (yield core.Supplier.get(this._options.apiKey)) != null
286
+ ? yield core.Supplier.get(this._options.apiKey)
287
+ : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airweave/sdk", "X-Fern-SDK-Version": "v0.2.16", "User-Agent": "@airweave/sdk/v0.2.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
288
+ contentType: "application/json",
289
+ queryParameters: _queryParams,
290
+ requestType: "json",
291
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
292
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
293
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
294
+ });
295
+ if (_response.ok) {
296
+ return serializers.ApiKey.parseOrThrow(_response.body, {
297
+ unrecognizedObjectKeys: "passthrough",
298
+ allowUnrecognizedUnionMembers: true,
299
+ allowUnrecognizedEnumValues: true,
300
+ breadcrumbsPrefix: ["response"],
301
+ });
302
+ }
303
+ if (_response.error.reason === "status-code") {
304
+ switch (_response.error.statusCode) {
305
+ case 422:
306
+ throw new AirweaveSDK.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
307
+ unrecognizedObjectKeys: "passthrough",
308
+ allowUnrecognizedUnionMembers: true,
309
+ allowUnrecognizedEnumValues: true,
310
+ breadcrumbsPrefix: ["response"],
311
+ }));
312
+ default:
313
+ throw new errors.AirweaveSDKError({
314
+ statusCode: _response.error.statusCode,
315
+ body: _response.error.body,
316
+ });
317
+ }
318
+ }
319
+ switch (_response.error.reason) {
320
+ case "non-json":
321
+ throw new errors.AirweaveSDKError({
322
+ statusCode: _response.error.statusCode,
323
+ body: _response.error.rawBody,
324
+ });
325
+ case "timeout":
326
+ throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling DELETE /api-keys/.");
327
+ case "unknown":
328
+ throw new errors.AirweaveSDKError({
329
+ message: _response.error.errorMessage,
330
+ });
331
+ }
332
+ });
333
+ }
334
+ /**
335
+ * Retrieve an API key by ID.
336
+ *
337
+ * Args:
338
+ * ----
339
+ * db (AsyncSession): The database session.
340
+ * id (UUID): The ID of the API key.
341
+ * user (schemas.User): The current user.
342
+ *
343
+ * Returns:
344
+ * -------
345
+ * schemas.APIKey: The API key object.
346
+ *
347
+ * Raises:
348
+ * ------
349
+ * HTTPException: If the API key is not found.
350
+ *
351
+ * @param {string} id
352
+ * @param {AirweaveSDK.ReadApiKeyApiKeysIdGetRequest} request
353
+ * @param {ApiKeys.RequestOptions} requestOptions - Request-specific configuration.
354
+ *
355
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
356
+ *
357
+ * @example
358
+ * await client.apiKeys.readApiKey("id", {
359
+ * creds: "creds"
360
+ * })
361
+ */
362
+ readApiKey(id, request, requestOptions) {
363
+ return __awaiter(this, void 0, void 0, function* () {
364
+ var _a;
365
+ const { creds } = request;
366
+ const _queryParams = {};
367
+ _queryParams["creds"] = creds;
368
+ const _response = yield core.fetcher({
369
+ 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)}`),
370
+ method: "GET",
371
+ headers: Object.assign({ "x-api-key": (yield core.Supplier.get(this._options.apiKey)) != null
372
+ ? yield core.Supplier.get(this._options.apiKey)
373
+ : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airweave/sdk", "X-Fern-SDK-Version": "v0.2.16", "User-Agent": "@airweave/sdk/v0.2.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
374
+ contentType: "application/json",
375
+ queryParameters: _queryParams,
376
+ requestType: "json",
377
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
378
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
379
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
380
+ });
381
+ if (_response.ok) {
382
+ return serializers.ApiKey.parseOrThrow(_response.body, {
383
+ unrecognizedObjectKeys: "passthrough",
384
+ allowUnrecognizedUnionMembers: true,
385
+ allowUnrecognizedEnumValues: true,
386
+ breadcrumbsPrefix: ["response"],
387
+ });
388
+ }
389
+ if (_response.error.reason === "status-code") {
390
+ switch (_response.error.statusCode) {
391
+ case 422:
392
+ throw new AirweaveSDK.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
393
+ unrecognizedObjectKeys: "passthrough",
394
+ allowUnrecognizedUnionMembers: true,
395
+ allowUnrecognizedEnumValues: true,
396
+ breadcrumbsPrefix: ["response"],
397
+ }));
398
+ default:
399
+ throw new errors.AirweaveSDKError({
400
+ statusCode: _response.error.statusCode,
401
+ body: _response.error.body,
402
+ });
403
+ }
404
+ }
405
+ switch (_response.error.reason) {
406
+ case "non-json":
407
+ throw new errors.AirweaveSDKError({
408
+ statusCode: _response.error.statusCode,
409
+ body: _response.error.rawBody,
410
+ });
411
+ case "timeout":
412
+ throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling GET /api-keys/{id}.");
413
+ case "unknown":
414
+ throw new errors.AirweaveSDKError({
415
+ message: _response.error.errorMessage,
416
+ });
417
+ }
418
+ });
419
+ }
420
+ }
421
+ exports.ApiKeys = ApiKeys;
@@ -0,0 +1 @@
1
+ export * from "./requests";
@@ -0,0 +1,17 @@
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);
@@ -2,8 +2,13 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  /**
5
- * Schema for creating an APIKey object.
5
+ * @example
6
+ * {
7
+ * creds: "creds",
8
+ * expirationDate: undefined
9
+ * }
6
10
  */
7
11
  export interface ApiKeyCreate {
12
+ creds: string;
8
13
  expirationDate?: Date;
9
14
  }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * id: "id",
8
+ * creds: "creds"
9
+ * }
10
+ */
11
+ export interface DeleteApiKeyApiKeysDeleteRequest {
12
+ id: string;
13
+ creds: string;
14
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * creds: "creds"
8
+ * }
9
+ */
10
+ export interface ReadApiKeyApiKeysIdGetRequest {
11
+ creds: string;
12
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * creds: "creds"
8
+ * }
9
+ */
10
+ export interface ReadApiKeysApiKeysGetRequest {
11
+ skip?: number;
12
+ limit?: number;
13
+ creds: string;
14
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export { type ReadApiKeysApiKeysGetRequest } from "./ReadApiKeysApiKeysGetRequest";
2
+ export { type ApiKeyCreate } from "./ApiKeyCreate";
3
+ export { type DeleteApiKeyApiKeysDeleteRequest } from "./DeleteApiKeyApiKeysDeleteRequest";
4
+ export { type ReadApiKeyApiKeysIdGetRequest } from "./ReadApiKeyApiKeysIdGetRequest";