@airweave/sdk 0.7.0 → 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,216 +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
- - [Installation](#installation)
11
- - [Reference](#reference)
12
- - [Usage](#usage)
13
- - [Framework Tracking](#framework-tracking)
14
- - [Request and Response Types](#request-and-response-types)
15
- - [Exception Handling](#exception-handling)
16
- - [Advanced](#advanced)
17
- - [Additional Headers](#additional-headers)
18
- - [Additional Query String Parameters](#additional-query-string-parameters)
19
- - [Retries](#retries)
20
- - [Timeouts](#timeouts)
21
- - [Aborting Requests](#aborting-requests)
22
- - [Access Raw Response Data](#access-raw-response-data)
23
- - [Runtime Compatibility](#runtime-compatibility)
24
- - [Contributing](#contributing)
25
-
26
- ## Installation
27
-
28
- ```sh
29
- npm i -s @airweave/sdk
30
- ```
31
-
32
- ## Reference
33
-
34
- A full reference for this library is available [here](https://github.com/airweave-ai/typescript-sdk/blob/HEAD/./reference.md).
35
-
36
- ## Usage
37
-
38
- Instantiate and use the client with the following:
39
-
40
- ```typescript
41
- import { AirweaveSDKClient } from "@airweave/sdk";
42
-
43
- const client = new AirweaveSDKClient({
44
- apiKey: "YOUR_API_KEY",
45
- frameworkName: "YOUR_FRAMEWORK_NAME",
46
- frameworkVersion: "YOUR_FRAMEWORK_VERSION",
47
- });
48
- await client.collections.create({
49
- name: "Finance Data",
50
- readable_id: "finance-data-reports",
51
- });
52
- ```
53
-
54
- ## Framework Tracking
55
-
56
- 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.
57
-
58
- ```typescript
59
- import { AirweaveSDKClient } from "@airweave/sdk";
60
-
61
- const client = new AirweaveSDKClient({
62
- apiKey: "YOUR_API_KEY",
63
- frameworkName: "langchain",
64
- frameworkVersion: "0.2.0",
65
- });
66
- ```
67
-
68
- The framework information is automatically sent with every request as headers (`X-Framework-Name` and `X-Framework-Version`), enabling better insights and troubleshooting.
69
-
70
- ## Request and Response Types
71
-
72
- The SDK exports all request and response types as TypeScript interfaces. Simply import them with the
73
- following namespace:
74
-
75
- ```typescript
76
- import { AirweaveSDK } from "@airweave/sdk";
77
-
78
- const request: AirweaveSDK.ListCollectionsGetRequest = {
79
- ...
80
- };
81
- ```
82
-
83
- ## Exception Handling
84
-
85
- When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
86
- will be thrown.
87
-
88
- ```typescript
89
- import { AirweaveSDKError } from "@airweave/sdk";
90
-
91
- try {
92
- await client.collections.create(...);
93
- } catch (err) {
94
- if (err instanceof AirweaveSDKError) {
95
- console.log(err.statusCode);
96
- console.log(err.message);
97
- console.log(err.body);
98
- console.log(err.rawResponse);
99
- }
100
- }
101
- ```
102
-
103
- ## Advanced
104
-
105
- ### Additional Headers
106
-
107
- If you would like to send additional headers as part of the request, use the `headers` request option.
108
-
109
- ```typescript
110
- const response = await client.collections.create(..., {
111
- headers: {
112
- 'X-Custom-Header': 'custom value'
113
- }
114
- });
115
- ```
116
-
117
- ### Additional Query String Parameters
118
-
119
- If you would like to send additional query string parameters as part of the request, use the `queryParams` request option.
120
-
121
- ```typescript
122
- const response = await client.collections.create(..., {
123
- queryParams: {
124
- 'customQueryParamKey': 'custom query param value'
125
- }
126
- });
127
- ```
128
-
129
- ### Retries
130
-
131
- The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
132
- as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
133
- retry limit (default: 2).
134
-
135
- A request is deemed retryable when any of the following HTTP status codes is returned:
136
-
137
- - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
138
- - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
139
- - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
140
-
141
- Use the `maxRetries` request option to configure this behavior.
142
-
143
- ```typescript
144
- const response = await client.collections.create(..., {
145
- maxRetries: 0 // override maxRetries at the request level
146
- });
147
- ```
148
-
149
- ### Timeouts
150
-
151
- The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
152
-
153
- ```typescript
154
- const response = await client.collections.create(..., {
155
- timeoutInSeconds: 30 // override timeout to 30s
156
- });
157
- ```
158
-
159
- ### Aborting Requests
160
-
161
- The SDK allows users to abort requests at any point by passing in an abort signal.
162
-
163
- ```typescript
164
- const controller = new AbortController();
165
- const response = await client.collections.create(..., {
166
- abortSignal: controller.signal
167
- });
168
- controller.abort(); // aborts the request
169
- ```
170
-
171
- ### Access Raw Response Data
172
-
173
- The SDK provides access to raw response data, including headers, through the `.withRawResponse()` method.
174
- The `.withRawResponse()` method returns a promise that results to an object with a `data` and a `rawResponse` property.
175
-
176
- ```typescript
177
- const { data, rawResponse } = await client.collections.create(...).withRawResponse();
178
-
179
- console.log(data);
180
- console.log(rawResponse.headers['X-My-Header']);
181
- ```
182
-
183
- ### Runtime Compatibility
184
-
185
- The SDK works in the following runtimes:
186
-
187
- - Node.js 18+
188
- - Vercel
189
- - Cloudflare Workers
190
- - Deno v1.25+
191
- - Bun 1.0+
192
- - React Native
193
-
194
- ### Customizing Fetch Client
195
-
196
- The SDK provides a way for you to customize the underlying HTTP client / Fetch function. If you're running in an
197
- unsupported environment, this provides a way for you to break glass and ensure the SDK works.
198
-
199
- ```typescript
200
- import { AirweaveSDKClient } from "@airweave/sdk";
201
-
202
- const client = new AirweaveSDKClient({
203
- ...
204
- fetcher: // provide your implementation here
205
- });
206
- ```
207
-
208
- ## Contributing
209
-
210
- While we value open-source contributions to this SDK, this library is generated programmatically.
211
- Additions made directly to this library would have to be moved over to our generation code,
212
- otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
213
- a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
214
- an issue first to discuss with us!
215
-
216
- 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.0",
53
- "User-Agent": "@airweave/sdk/v0.7.0",
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.0";
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.0";
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.0",
17
- "User-Agent": "@airweave/sdk/v0.7.0",
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.0";
1
+ export declare const SDK_VERSION = "v0.7.2";
@@ -1 +1 @@
1
- export const SDK_VERSION = "v0.7.0";
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.0",
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