@airweave/sdk 0.7.1 → 0.7.2

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.
package/README.md CHANGED
@@ -1,235 +0,0 @@
1
- # Airweave TypeScript Library
2
-
3
- [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fairweave-ai%2Ftypescript-sdk)
4
- [![npm shield](https://img.shields.io/npm/v/@airweave/sdk)](https://www.npmjs.com/package/@airweave/sdk)
5
-
6
- The Airweave TypeScript library provides convenient access to the Airweave APIs from TypeScript.
7
-
8
- ## Table of Contents
9
-
10
- - [Table of Contents](#table-of-contents)
11
- - [Installation](#installation)
12
- - [Reference](#reference)
13
- - [Usage](#usage)
14
- - [Framework Tracking](#framework-tracking)
15
- - [Request and Response Types](#request-and-response-types)
16
- - [Exception Handling](#exception-handling)
17
- - [Advanced](#advanced)
18
- - [Additional Headers](#additional-headers)
19
- - [Additional Query String Parameters](#additional-query-string-parameters)
20
- - [Retries](#retries)
21
- - [Timeouts](#timeouts)
22
- - [Aborting Requests](#aborting-requests)
23
- - [Access Raw Response Data](#access-raw-response-data)
24
- - [Runtime Compatibility](#runtime-compatibility)
25
- - [Contributing](#contributing)
26
-
27
- ## Table of Contents
28
-
29
- - [Installation](#installation)
30
- - [Reference](#reference)
31
- - [Usage](#usage)
32
- - [Framework Tracking](#framework-tracking)
33
- - [Request and Response Types](#request-and-response-types)
34
- - [Exception Handling](#exception-handling)
35
- - [Advanced](#advanced)
36
- - [Additional Headers](#additional-headers)
37
- - [Additional Query String Parameters](#additional-query-string-parameters)
38
- - [Retries](#retries)
39
- - [Timeouts](#timeouts)
40
- - [Aborting Requests](#aborting-requests)
41
- - [Access Raw Response Data](#access-raw-response-data)
42
- - [Runtime Compatibility](#runtime-compatibility)
43
- - [Contributing](#contributing)
44
-
45
- ## Installation
46
-
47
- ```sh
48
- npm i -s @airweave/sdk
49
- ```
50
-
51
- ## Reference
52
-
53
- A full reference for this library is available [here](https://github.com/airweave-ai/typescript-sdk/blob/HEAD/./reference.md).
54
-
55
- ## Usage
56
-
57
- Instantiate and use the client with the following:
58
-
59
- ```typescript
60
- import { AirweaveSDKClient } from "@airweave/sdk";
61
-
62
- const client = new AirweaveSDKClient({
63
- apiKey: "YOUR_API_KEY",
64
- frameworkName: "YOUR_FRAMEWORK_NAME",
65
- frameworkVersion: "YOUR_FRAMEWORK_VERSION",
66
- });
67
- await client.collections.create({
68
- name: "Finance Data",
69
- readable_id: "finance-data-reports",
70
- });
71
- ```
72
-
73
- ## Framework Tracking
74
-
75
- If you're using Airweave with an agent framework like CrewAI, LangChain, or LlamaIndex, you can track which framework is making requests. This helps Airweave provide better analytics and support for your specific framework.
76
-
77
- ```typescript
78
- import { AirweaveSDKClient } from "@airweave/sdk";
79
-
80
- const client = new AirweaveSDKClient({
81
- apiKey: "YOUR_API_KEY",
82
- frameworkName: "langchain",
83
- frameworkVersion: "0.2.0",
84
- });
85
- ```
86
-
87
- The framework information is automatically sent with every request as headers (`X-Framework-Name` and `X-Framework-Version`), enabling better insights and troubleshooting.
88
-
89
- ## Request and Response Types
90
-
91
- The SDK exports all request and response types as TypeScript interfaces. Simply import them with the
92
- following namespace:
93
-
94
- ```typescript
95
- import { AirweaveSDK } from "@airweave/sdk";
96
-
97
- const request: AirweaveSDK.ListCollectionsGetRequest = {
98
- ...
99
- };
100
- ```
101
-
102
- ## Exception Handling
103
-
104
- When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
105
- will be thrown.
106
-
107
- ```typescript
108
- import { AirweaveSDKError } from "@airweave/sdk";
109
-
110
- try {
111
- await client.collections.create(...);
112
- } catch (err) {
113
- if (err instanceof AirweaveSDKError) {
114
- console.log(err.statusCode);
115
- console.log(err.message);
116
- console.log(err.body);
117
- console.log(err.rawResponse);
118
- }
119
- }
120
- ```
121
-
122
- ## Advanced
123
-
124
- ### Additional Headers
125
-
126
- If you would like to send additional headers as part of the request, use the `headers` request option.
127
-
128
- ```typescript
129
- const response = await client.collections.create(..., {
130
- headers: {
131
- 'X-Custom-Header': 'custom value'
132
- }
133
- });
134
- ```
135
-
136
- ### Additional Query String Parameters
137
-
138
- If you would like to send additional query string parameters as part of the request, use the `queryParams` request option.
139
-
140
- ```typescript
141
- const response = await client.collections.create(..., {
142
- queryParams: {
143
- 'customQueryParamKey': 'custom query param value'
144
- }
145
- });
146
- ```
147
-
148
- ### Retries
149
-
150
- The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
151
- as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
152
- retry limit (default: 2).
153
-
154
- A request is deemed retryable when any of the following HTTP status codes is returned:
155
-
156
- - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
157
- - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
158
- - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
159
-
160
- Use the `maxRetries` request option to configure this behavior.
161
-
162
- ```typescript
163
- const response = await client.collections.create(..., {
164
- maxRetries: 0 // override maxRetries at the request level
165
- });
166
- ```
167
-
168
- ### Timeouts
169
-
170
- The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
171
-
172
- ```typescript
173
- const response = await client.collections.create(..., {
174
- timeoutInSeconds: 30 // override timeout to 30s
175
- });
176
- ```
177
-
178
- ### Aborting Requests
179
-
180
- The SDK allows users to abort requests at any point by passing in an abort signal.
181
-
182
- ```typescript
183
- const controller = new AbortController();
184
- const response = await client.collections.create(..., {
185
- abortSignal: controller.signal
186
- });
187
- controller.abort(); // aborts the request
188
- ```
189
-
190
- ### Access Raw Response Data
191
-
192
- The SDK provides access to raw response data, including headers, through the `.withRawResponse()` method.
193
- The `.withRawResponse()` method returns a promise that results to an object with a `data` and a `rawResponse` property.
194
-
195
- ```typescript
196
- const { data, rawResponse } = await client.collections.create(...).withRawResponse();
197
-
198
- console.log(data);
199
- console.log(rawResponse.headers['X-My-Header']);
200
- ```
201
-
202
- ### Runtime Compatibility
203
-
204
- The SDK works in the following runtimes:
205
-
206
- - Node.js 18+
207
- - Vercel
208
- - Cloudflare Workers
209
- - Deno v1.25+
210
- - Bun 1.0+
211
- - React Native
212
-
213
- ### Customizing Fetch Client
214
-
215
- The SDK provides a way for you to customize the underlying HTTP client / Fetch function. If you're running in an
216
- unsupported environment, this provides a way for you to break glass and ensure the SDK works.
217
-
218
- ```typescript
219
- import { AirweaveSDKClient } from "@airweave/sdk";
220
-
221
- const client = new AirweaveSDKClient({
222
- ...
223
- fetcher: // provide your implementation here
224
- });
225
- ```
226
-
227
- ## Contributing
228
-
229
- While we value open-source contributions to this SDK, this library is generated programmatically.
230
- Additions made directly to this library would have to be moved over to our generation code,
231
- otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
232
- a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
233
- an issue first to discuss with us!
234
-
235
- On the other hand, contributions to the README are always very welcome!
@@ -49,8 +49,8 @@ class AirweaveSDKClient {
49
49
  "X-Framework-Version": _options === null || _options === void 0 ? void 0 : _options.frameworkVersion,
50
50
  "X-Fern-Language": "JavaScript",
51
51
  "X-Fern-SDK-Name": "@airweave/sdk",
52
- "X-Fern-SDK-Version": "v0.7.1",
53
- "User-Agent": "@airweave/sdk/v0.7.1",
52
+ "X-Fern-SDK-Version": "v0.7.2",
53
+ "User-Agent": "@airweave/sdk/v0.7.2",
54
54
  "X-Fern-Runtime": core.RUNTIME.type,
55
55
  "X-Fern-Runtime-Version": core.RUNTIME.version,
56
56
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -41,7 +41,9 @@ export declare class Collections {
41
41
  protected readonly _options: Collections.Options;
42
42
  constructor(_options: Collections.Options);
43
43
  /**
44
- * List all collections that belong to your organization.
44
+ * List all collections that belong to your organization with optional search filtering.
45
+ *
46
+ * Collections are always sorted by creation date (newest first).
45
47
  *
46
48
  * @param {AirweaveSDK.ListCollectionsGetRequest} request
47
49
  * @param {Collections.RequestOptions} requestOptions - Request-specific configuration.
@@ -51,7 +53,8 @@ export declare class Collections {
51
53
  * @example
52
54
  * await client.collections.list({
53
55
  * skip: 1,
54
- * limit: 1
56
+ * limit: 1,
57
+ * search: "search"
55
58
  * })
56
59
  */
57
60
  list(request?: AirweaveSDK.ListCollectionsGetRequest, requestOptions?: Collections.RequestOptions): core.HttpResponsePromise<AirweaveSDK.Collection[]>;
@@ -59,7 +59,9 @@ class Collections {
59
59
  this._options = _options;
60
60
  }
61
61
  /**
62
- * List all collections that belong to your organization.
62
+ * List all collections that belong to your organization with optional search filtering.
63
+ *
64
+ * Collections are always sorted by creation date (newest first).
63
65
  *
64
66
  * @param {AirweaveSDK.ListCollectionsGetRequest} request
65
67
  * @param {Collections.RequestOptions} requestOptions - Request-specific configuration.
@@ -69,7 +71,8 @@ class Collections {
69
71
  * @example
70
72
  * await client.collections.list({
71
73
  * skip: 1,
72
- * limit: 1
74
+ * limit: 1,
75
+ * search: "search"
73
76
  * })
74
77
  */
75
78
  list(request = {}, requestOptions) {
@@ -78,7 +81,7 @@ class Collections {
78
81
  __list() {
79
82
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
80
83
  var _a, _b, _c, _d, _e, _f, _g;
81
- const { skip, limit } = request;
84
+ const { skip, limit, search } = request;
82
85
  const _queryParams = {};
83
86
  if (skip != null) {
84
87
  _queryParams["skip"] = skip.toString();
@@ -86,6 +89,9 @@ class Collections {
86
89
  if (limit != null) {
87
90
  _queryParams["limit"] = limit.toString();
88
91
  }
92
+ if (search != null) {
93
+ _queryParams["search"] = search;
94
+ }
89
95
  let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({ "X-Framework-Name": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.frameworkName) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.frameworkName, "X-Framework-Version": (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.frameworkVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.frameworkVersion }, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
90
96
  const _response = yield core.fetcher({
91
97
  url: core.url.join((_g = (_f = (yield core.Supplier.get(this._options.baseUrl))) !== null && _f !== void 0 ? _f : (yield core.Supplier.get(this._options.environment))) !== null && _g !== void 0 ? _g : environments.AirweaveSDKEnvironment.Production, "collections"),
@@ -5,7 +5,8 @@
5
5
  * @example
6
6
  * {
7
7
  * skip: 1,
8
- * limit: 1
8
+ * limit: 1,
9
+ * search: "search"
9
10
  * }
10
11
  */
11
12
  export interface ListCollectionsGetRequest {
@@ -13,4 +14,6 @@ export interface ListCollectionsGetRequest {
13
14
  skip?: number;
14
15
  /** Maximum number of collections to return (1-1000) */
15
16
  limit?: number;
17
+ /** Search term to filter by name or readable_id */
18
+ search?: string;
16
19
  }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "v0.7.1";
1
+ export declare const SDK_VERSION = "v0.7.2";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "v0.7.1";
4
+ exports.SDK_VERSION = "v0.7.2";
@@ -13,8 +13,8 @@ export class AirweaveSDKClient {
13
13
  "X-Framework-Version": _options === null || _options === void 0 ? void 0 : _options.frameworkVersion,
14
14
  "X-Fern-Language": "JavaScript",
15
15
  "X-Fern-SDK-Name": "@airweave/sdk",
16
- "X-Fern-SDK-Version": "v0.7.1",
17
- "User-Agent": "@airweave/sdk/v0.7.1",
16
+ "X-Fern-SDK-Version": "v0.7.2",
17
+ "User-Agent": "@airweave/sdk/v0.7.2",
18
18
  "X-Fern-Runtime": core.RUNTIME.type,
19
19
  "X-Fern-Runtime-Version": core.RUNTIME.version,
20
20
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -41,7 +41,9 @@ export declare class Collections {
41
41
  protected readonly _options: Collections.Options;
42
42
  constructor(_options: Collections.Options);
43
43
  /**
44
- * List all collections that belong to your organization.
44
+ * List all collections that belong to your organization with optional search filtering.
45
+ *
46
+ * Collections are always sorted by creation date (newest first).
45
47
  *
46
48
  * @param {AirweaveSDK.ListCollectionsGetRequest} request
47
49
  * @param {Collections.RequestOptions} requestOptions - Request-specific configuration.
@@ -51,7 +53,8 @@ export declare class Collections {
51
53
  * @example
52
54
  * await client.collections.list({
53
55
  * skip: 1,
54
- * limit: 1
56
+ * limit: 1,
57
+ * search: "search"
55
58
  * })
56
59
  */
57
60
  list(request?: AirweaveSDK.ListCollectionsGetRequest, requestOptions?: Collections.RequestOptions): core.HttpResponsePromise<AirweaveSDK.Collection[]>;
@@ -23,7 +23,9 @@ export class Collections {
23
23
  this._options = _options;
24
24
  }
25
25
  /**
26
- * List all collections that belong to your organization.
26
+ * List all collections that belong to your organization with optional search filtering.
27
+ *
28
+ * Collections are always sorted by creation date (newest first).
27
29
  *
28
30
  * @param {AirweaveSDK.ListCollectionsGetRequest} request
29
31
  * @param {Collections.RequestOptions} requestOptions - Request-specific configuration.
@@ -33,7 +35,8 @@ export class Collections {
33
35
  * @example
34
36
  * await client.collections.list({
35
37
  * skip: 1,
36
- * limit: 1
38
+ * limit: 1,
39
+ * search: "search"
37
40
  * })
38
41
  */
39
42
  list(request = {}, requestOptions) {
@@ -42,7 +45,7 @@ export class Collections {
42
45
  __list() {
43
46
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
44
47
  var _a, _b, _c, _d, _e, _f, _g;
45
- const { skip, limit } = request;
48
+ const { skip, limit, search } = request;
46
49
  const _queryParams = {};
47
50
  if (skip != null) {
48
51
  _queryParams["skip"] = skip.toString();
@@ -50,6 +53,9 @@ export class Collections {
50
53
  if (limit != null) {
51
54
  _queryParams["limit"] = limit.toString();
52
55
  }
56
+ if (search != null) {
57
+ _queryParams["search"] = search;
58
+ }
53
59
  let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({ "X-Framework-Name": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.frameworkName) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.frameworkName, "X-Framework-Version": (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.frameworkVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.frameworkVersion }, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
54
60
  const _response = yield core.fetcher({
55
61
  url: core.url.join((_g = (_f = (yield core.Supplier.get(this._options.baseUrl))) !== null && _f !== void 0 ? _f : (yield core.Supplier.get(this._options.environment))) !== null && _g !== void 0 ? _g : environments.AirweaveSDKEnvironment.Production, "collections"),
@@ -5,7 +5,8 @@
5
5
  * @example
6
6
  * {
7
7
  * skip: 1,
8
- * limit: 1
8
+ * limit: 1,
9
+ * search: "search"
9
10
  * }
10
11
  */
11
12
  export interface ListCollectionsGetRequest {
@@ -13,4 +14,6 @@ export interface ListCollectionsGetRequest {
13
14
  skip?: number;
14
15
  /** Maximum number of collections to return (1-1000) */
15
16
  limit?: number;
17
+ /** Search term to filter by name or readable_id */
18
+ search?: string;
16
19
  }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "v0.7.1";
1
+ export declare const SDK_VERSION = "v0.7.2";
@@ -1 +1 @@
1
- export const SDK_VERSION = "v0.7.1";
1
+ export const SDK_VERSION = "v0.7.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@airweave/sdk",
3
- "version": "v0.7.1",
3
+ "version": "v0.7.2",
4
4
  "private": false,
5
5
  "repository": "github:airweave-ai/typescript-sdk",
6
6
  "type": "commonjs",
package/reference.md CHANGED
@@ -137,7 +137,9 @@ await client.sources.get("short_name");
137
137
  <dl>
138
138
  <dd>
139
139
 
140
- List all collections that belong to your organization.
140
+ List all collections that belong to your organization with optional search filtering.
141
+
142
+ Collections are always sorted by creation date (newest first).
141
143
 
142
144
  </dd>
143
145
  </dl>
@@ -156,6 +158,7 @@ List all collections that belong to your organization.
156
158
  await client.collections.list({
157
159
  skip: 1,
158
160
  limit: 1,
161
+ search: "search",
159
162
  });
160
163
  ```
161
164