@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
package/Client.d.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import * as environments from "./environments";
5
5
  import * as core from "./core";
6
+ import { ApiKeys } from "./api/resources/apiKeys/client/Client";
6
7
  import { Users } from "./api/resources/users/client/Client";
7
8
  import { Sources } from "./api/resources/sources/client/Client";
8
9
  import { Destinations } from "./api/resources/destinations/client/Client";
@@ -34,6 +35,7 @@ export declare namespace AirweaveSDKClient {
34
35
  }
35
36
  export declare class AirweaveSDKClient {
36
37
  protected readonly _options: AirweaveSDKClient.Options;
38
+ protected _apiKeys: ApiKeys | undefined;
37
39
  protected _users: Users | undefined;
38
40
  protected _sources: Sources | undefined;
39
41
  protected _destinations: Destinations | undefined;
@@ -45,6 +47,7 @@ export declare class AirweaveSDKClient {
45
47
  protected _entities: Entities | undefined;
46
48
  protected _transformers: Transformers | undefined;
47
49
  constructor(_options?: AirweaveSDKClient.Options);
50
+ get apiKeys(): ApiKeys;
48
51
  get users(): Users;
49
52
  get sources(): Sources;
50
53
  get destinations(): Destinations;
package/Client.js CHANGED
@@ -4,59 +4,64 @@
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.AirweaveSDKClient = void 0;
7
- const Client_1 = require("./api/resources/users/client/Client");
8
- const Client_2 = require("./api/resources/sources/client/Client");
9
- const Client_3 = require("./api/resources/destinations/client/Client");
10
- const Client_4 = require("./api/resources/embeddingModels/client/Client");
11
- const Client_5 = require("./api/resources/connections/client/Client");
12
- const Client_6 = require("./api/resources/sync/client/Client");
13
- const Client_7 = require("./api/resources/search/client/Client");
14
- const Client_8 = require("./api/resources/whiteLabels/client/Client");
15
- const Client_9 = require("./api/resources/entities/client/Client");
16
- const Client_10 = require("./api/resources/transformers/client/Client");
7
+ const Client_1 = require("./api/resources/apiKeys/client/Client");
8
+ const Client_2 = require("./api/resources/users/client/Client");
9
+ const Client_3 = require("./api/resources/sources/client/Client");
10
+ const Client_4 = require("./api/resources/destinations/client/Client");
11
+ const Client_5 = require("./api/resources/embeddingModels/client/Client");
12
+ const Client_6 = require("./api/resources/connections/client/Client");
13
+ const Client_7 = require("./api/resources/sync/client/Client");
14
+ const Client_8 = require("./api/resources/search/client/Client");
15
+ const Client_9 = require("./api/resources/whiteLabels/client/Client");
16
+ const Client_10 = require("./api/resources/entities/client/Client");
17
+ const Client_11 = require("./api/resources/transformers/client/Client");
17
18
  class AirweaveSDKClient {
18
19
  constructor(_options = {}) {
19
20
  this._options = _options;
20
21
  }
22
+ get apiKeys() {
23
+ var _a;
24
+ return ((_a = this._apiKeys) !== null && _a !== void 0 ? _a : (this._apiKeys = new Client_1.ApiKeys(this._options)));
25
+ }
21
26
  get users() {
22
27
  var _a;
23
- return ((_a = this._users) !== null && _a !== void 0 ? _a : (this._users = new Client_1.Users(this._options)));
28
+ return ((_a = this._users) !== null && _a !== void 0 ? _a : (this._users = new Client_2.Users(this._options)));
24
29
  }
25
30
  get sources() {
26
31
  var _a;
27
- return ((_a = this._sources) !== null && _a !== void 0 ? _a : (this._sources = new Client_2.Sources(this._options)));
32
+ return ((_a = this._sources) !== null && _a !== void 0 ? _a : (this._sources = new Client_3.Sources(this._options)));
28
33
  }
29
34
  get destinations() {
30
35
  var _a;
31
- return ((_a = this._destinations) !== null && _a !== void 0 ? _a : (this._destinations = new Client_3.Destinations(this._options)));
36
+ return ((_a = this._destinations) !== null && _a !== void 0 ? _a : (this._destinations = new Client_4.Destinations(this._options)));
32
37
  }
33
38
  get embeddingModels() {
34
39
  var _a;
35
- return ((_a = this._embeddingModels) !== null && _a !== void 0 ? _a : (this._embeddingModels = new Client_4.EmbeddingModels(this._options)));
40
+ return ((_a = this._embeddingModels) !== null && _a !== void 0 ? _a : (this._embeddingModels = new Client_5.EmbeddingModels(this._options)));
36
41
  }
37
42
  get connections() {
38
43
  var _a;
39
- return ((_a = this._connections) !== null && _a !== void 0 ? _a : (this._connections = new Client_5.Connections(this._options)));
44
+ return ((_a = this._connections) !== null && _a !== void 0 ? _a : (this._connections = new Client_6.Connections(this._options)));
40
45
  }
41
46
  get sync() {
42
47
  var _a;
43
- return ((_a = this._sync) !== null && _a !== void 0 ? _a : (this._sync = new Client_6.Sync(this._options)));
48
+ return ((_a = this._sync) !== null && _a !== void 0 ? _a : (this._sync = new Client_7.Sync(this._options)));
44
49
  }
45
50
  get search() {
46
51
  var _a;
47
- return ((_a = this._search) !== null && _a !== void 0 ? _a : (this._search = new Client_7.Search(this._options)));
52
+ return ((_a = this._search) !== null && _a !== void 0 ? _a : (this._search = new Client_8.Search(this._options)));
48
53
  }
49
54
  get whiteLabels() {
50
55
  var _a;
51
- return ((_a = this._whiteLabels) !== null && _a !== void 0 ? _a : (this._whiteLabels = new Client_8.WhiteLabels(this._options)));
56
+ return ((_a = this._whiteLabels) !== null && _a !== void 0 ? _a : (this._whiteLabels = new Client_9.WhiteLabels(this._options)));
52
57
  }
53
58
  get entities() {
54
59
  var _a;
55
- return ((_a = this._entities) !== null && _a !== void 0 ? _a : (this._entities = new Client_9.Entities(this._options)));
60
+ return ((_a = this._entities) !== null && _a !== void 0 ? _a : (this._entities = new Client_10.Entities(this._options)));
56
61
  }
57
62
  get transformers() {
58
63
  var _a;
59
- return ((_a = this._transformers) !== null && _a !== void 0 ? _a : (this._transformers = new Client_10.Transformers(this._options)));
64
+ return ((_a = this._transformers) !== null && _a !== void 0 ? _a : (this._transformers = new Client_11.Transformers(this._options)));
60
65
  }
61
66
  }
62
67
  exports.AirweaveSDKClient = AirweaveSDKClient;
package/README.md CHANGED
@@ -23,11 +23,9 @@ Instantiate and use the client with the following:
23
23
  import { AirweaveSDKClient } from "@airweave/sdk";
24
24
 
25
25
  const client = new AirweaveSDKClient({ apiKey: "YOUR_API_KEY" });
26
- await client.users.createOrUpdateUser({
26
+ await client.apiKeys.createApiKey({
27
27
  creds: "creds",
28
- email: "email",
29
- fullName: undefined,
30
- organizationId: undefined,
28
+ expirationDate: undefined,
31
29
  });
32
30
  ```
33
31
 
@@ -39,7 +37,7 @@ following namespace:
39
37
  ```typescript
40
38
  import { AirweaveSDK } from "@airweave/sdk";
41
39
 
42
- const request: AirweaveSDK.ReadUserUsersGetRequest = {
40
+ const request: AirweaveSDK.ReadApiKeysApiKeysGetRequest = {
43
41
  ...
44
42
  };
45
43
  ```
@@ -53,7 +51,7 @@ will be thrown.
53
51
  import { AirweaveSDKError } from "@airweave/sdk";
54
52
 
55
53
  try {
56
- await client.users.createOrUpdateUser(...);
54
+ await client.apiKeys.createApiKey(...);
57
55
  } catch (err) {
58
56
  if (err instanceof AirweaveSDKError) {
59
57
  console.log(err.statusCode);
@@ -70,7 +68,7 @@ try {
70
68
  If you would like to send additional headers as part of the request, use the `headers` request option.
71
69
 
72
70
  ```typescript
73
- const response = await client.users.createOrUpdateUser(..., {
71
+ const response = await client.apiKeys.createApiKey(..., {
74
72
  headers: {
75
73
  'X-Custom-Header': 'custom value'
76
74
  }
@@ -92,7 +90,7 @@ A request is deemed retriable when any of the following HTTP status codes is ret
92
90
  Use the `maxRetries` request option to configure this behavior.
93
91
 
94
92
  ```typescript
95
- const response = await client.users.createOrUpdateUser(..., {
93
+ const response = await client.apiKeys.createApiKey(..., {
96
94
  maxRetries: 0 // override maxRetries at the request level
97
95
  });
98
96
  ```
@@ -102,7 +100,7 @@ const response = await client.users.createOrUpdateUser(..., {
102
100
  The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
103
101
 
104
102
  ```typescript
105
- const response = await client.users.createOrUpdateUser(..., {
103
+ const response = await client.apiKeys.createApiKey(..., {
106
104
  timeoutInSeconds: 30 // override timeout to 30s
107
105
  });
108
106
  ```
@@ -113,7 +111,7 @@ The SDK allows users to abort requests at any point by passing in an abort signa
113
111
 
114
112
  ```typescript
115
113
  const controller = new AbortController();
116
- const response = await client.users.createOrUpdateUser(..., {
114
+ const response = await client.apiKeys.createApiKey(..., {
117
115
  abortSignal: controller.signal
118
116
  });
119
117
  controller.abort(); // aborts the request
@@ -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
+ }