@air/api-rest 0.3.0 → 0.5.0
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 +1 -0
- package/dist/index.cjs +23 -0
- package/dist/index.d.cts +39 -1
- package/dist/index.d.ts +39 -1
- package/dist/index.js +23 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@ npm install @air/api-rest
|
|
|
21
21
|
## What's included
|
|
22
22
|
|
|
23
23
|
- Resource classes: `BoardsResource`, `AssetsResource`, `TagsResource`, `CustomFieldsResource`, `UploadsResource`, `ImportsResource`, `RolesResource`
|
|
24
|
+
- Asset CDN link helpers: `listCdnLinks`, `createCdnLink`, and `updateCdnLink`
|
|
24
25
|
- Full TypeScript types for all API request/response shapes
|
|
25
26
|
- `AirApi` client class that composes all resources
|
|
26
27
|
|
package/dist/index.cjs
CHANGED
|
@@ -77,6 +77,9 @@ var Assets = class {
|
|
|
77
77
|
if (params.includeNestedAssets !== void 0) {
|
|
78
78
|
query.includeNestedAssets = params.includeNestedAssets;
|
|
79
79
|
}
|
|
80
|
+
if (params.semantic !== void 0) {
|
|
81
|
+
query.semantic = params.semantic;
|
|
82
|
+
}
|
|
80
83
|
if (params.tag) {
|
|
81
84
|
query.tag = params.tag;
|
|
82
85
|
}
|
|
@@ -103,6 +106,26 @@ var Assets = class {
|
|
|
103
106
|
path: `/assets/${assetId}`
|
|
104
107
|
});
|
|
105
108
|
}
|
|
109
|
+
async listCdnLinks(assetId) {
|
|
110
|
+
return this.client.request({
|
|
111
|
+
method: "GET",
|
|
112
|
+
path: `/assets/${assetId}/cdnLinks`
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
async createCdnLink(assetId, params) {
|
|
116
|
+
return this.client.request({
|
|
117
|
+
method: "POST",
|
|
118
|
+
path: `/assets/${assetId}/cdnLinks`,
|
|
119
|
+
body: params
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
async updateCdnLink(assetId, cdnLinkId, params) {
|
|
123
|
+
return this.client.request({
|
|
124
|
+
method: "PATCH",
|
|
125
|
+
path: `/assets/${assetId}/cdnLinks/${cdnLinkId}`,
|
|
126
|
+
body: params
|
|
127
|
+
});
|
|
128
|
+
}
|
|
106
129
|
async setCustomField(assetId, customFieldId, params) {
|
|
107
130
|
return this.client.request({
|
|
108
131
|
method: "PUT",
|
package/dist/index.d.cts
CHANGED
|
@@ -62,6 +62,13 @@ interface AssetListParams extends CursorPageParams {
|
|
|
62
62
|
tag?: string | string[];
|
|
63
63
|
customField?: string | string[];
|
|
64
64
|
search?: string;
|
|
65
|
+
/**
|
|
66
|
+
* When true, `search` is used for semantic search via AI embeddings.
|
|
67
|
+
* Requires a non-blank `search` value and Semantic Search enabled on the workspace.
|
|
68
|
+
* Returns a single page of results ordered by relevance. Combining with `tag`,
|
|
69
|
+
* `customField`, `createdAt`, or `cursor` is rejected by the API with 400.
|
|
70
|
+
*/
|
|
71
|
+
semantic?: boolean;
|
|
65
72
|
"createdAt[gte]"?: string;
|
|
66
73
|
"createdAt[lte]"?: string;
|
|
67
74
|
}
|
|
@@ -81,6 +88,34 @@ interface AddVersionTagParams {
|
|
|
81
88
|
interface AssetVersionDownloadUrl {
|
|
82
89
|
url: string;
|
|
83
90
|
}
|
|
91
|
+
interface CdnLinkBase {
|
|
92
|
+
id: string;
|
|
93
|
+
url: string;
|
|
94
|
+
assetId: string;
|
|
95
|
+
active: boolean;
|
|
96
|
+
createdAt: string;
|
|
97
|
+
updatedAt: string;
|
|
98
|
+
}
|
|
99
|
+
type CdnLink = (CdnLinkBase & {
|
|
100
|
+
followsDefaultVersion: true;
|
|
101
|
+
versionId?: never;
|
|
102
|
+
}) | (CdnLinkBase & {
|
|
103
|
+
followsDefaultVersion: false;
|
|
104
|
+
versionId: string;
|
|
105
|
+
});
|
|
106
|
+
type AssetCdnLinkCreateParams = {
|
|
107
|
+
followsDefaultVersion: true;
|
|
108
|
+
versionId?: never;
|
|
109
|
+
} | {
|
|
110
|
+
versionId: string;
|
|
111
|
+
followsDefaultVersion?: never;
|
|
112
|
+
};
|
|
113
|
+
interface AssetCdnLinkUpdateParams {
|
|
114
|
+
active: boolean;
|
|
115
|
+
}
|
|
116
|
+
interface AssetCdnLinkListResponse {
|
|
117
|
+
data: CdnLink[];
|
|
118
|
+
}
|
|
84
119
|
interface AssetBoardListParams extends CursorPageParams {
|
|
85
120
|
includeCustomFields?: boolean;
|
|
86
121
|
}
|
|
@@ -159,6 +194,9 @@ declare class Assets {
|
|
|
159
194
|
list(params?: AssetListParams): PagePromise<Asset>;
|
|
160
195
|
get(assetId: string): Promise<Asset>;
|
|
161
196
|
delete(assetId: string): Promise<void>;
|
|
197
|
+
listCdnLinks(assetId: string): Promise<AssetCdnLinkListResponse>;
|
|
198
|
+
createCdnLink(assetId: string, params: AssetCdnLinkCreateParams): Promise<CdnLink>;
|
|
199
|
+
updateCdnLink(assetId: string, cdnLinkId: string, params: AssetCdnLinkUpdateParams): Promise<void>;
|
|
162
200
|
setCustomField(assetId: string, customFieldId: string, params: SetCustomFieldParams): Promise<void>;
|
|
163
201
|
listVersions(assetId: string): Promise<AssetVersionListResponse>;
|
|
164
202
|
getVersion(assetId: string, versionId: string): Promise<AssetVersion>;
|
|
@@ -476,4 +514,4 @@ declare class AirApi extends AirBase {
|
|
|
476
514
|
constructor(options?: AirApiOptions);
|
|
477
515
|
}
|
|
478
516
|
|
|
479
|
-
export { type AddBoardAssetsParams, type AddGuestParams, type AddVersionTagParams, AirApi, type AirApiOptions, type Asset, type AssetBoardListParams, type AssetCustomFieldValue, type AssetListParams, type AssetVersion, type AssetVersionDownloadUrl, type AssetVersionListResponse, type AssetVersionUpdateParams, type AssetVersionUrls, Assets, type Board, type BoardCreateParams, type BoardListParams, type BoardUpdateParams, Boards, type CompleteMultipartParams, type CustomField, type CustomFieldCreateParams, type CustomFieldListParams, type CustomFieldType, type CustomFieldUpdateParams, type CustomFieldValue, type CustomFieldValueCreateParams, type CustomFieldValueUpdateParams, CustomFields, type FileMeta, type FileSource, type GetPartUploadUrlParams, type GetPartUploadUrlResponse, type Guest, type GuestListParams, type GuestListResponse, type ImportCreateParams, type ImportCreateResponse, type ImportStatus, type ImportStatusResponse, Imports, type LargeUploadResponse, Libraries, type Library, type LibraryCreateParams, type LibraryListParams, type LibraryUpdateParams, type Role, type RoleListParams, type RoleListResponse, Roles, type SetBoardCustomFieldParams, type SetCustomFieldParams, type SmallUploadResponse, type SmartTag, type Tag, type TagCreateParams, type TagListParams, type TagUpdateParams, Tags, type UpdateGuestParams, type UploadCreateParams, type UploadCreateResponse, type UploadFileOptions, type UploadFileParams, type UploadFileResponse, Uploads, type Workspace, type WorkspaceListResponse, Workspaces };
|
|
517
|
+
export { type AddBoardAssetsParams, type AddGuestParams, type AddVersionTagParams, AirApi, type AirApiOptions, type Asset, type AssetBoardListParams, type AssetCdnLinkCreateParams, type AssetCdnLinkListResponse, type AssetCdnLinkUpdateParams, type AssetCustomFieldValue, type AssetListParams, type AssetVersion, type AssetVersionDownloadUrl, type AssetVersionListResponse, type AssetVersionUpdateParams, type AssetVersionUrls, Assets, type Board, type BoardCreateParams, type BoardListParams, type BoardUpdateParams, Boards, type CdnLink, type CompleteMultipartParams, type CustomField, type CustomFieldCreateParams, type CustomFieldListParams, type CustomFieldType, type CustomFieldUpdateParams, type CustomFieldValue, type CustomFieldValueCreateParams, type CustomFieldValueUpdateParams, CustomFields, type FileMeta, type FileSource, type GetPartUploadUrlParams, type GetPartUploadUrlResponse, type Guest, type GuestListParams, type GuestListResponse, type ImportCreateParams, type ImportCreateResponse, type ImportStatus, type ImportStatusResponse, Imports, type LargeUploadResponse, Libraries, type Library, type LibraryCreateParams, type LibraryListParams, type LibraryUpdateParams, type Role, type RoleListParams, type RoleListResponse, Roles, type SetBoardCustomFieldParams, type SetCustomFieldParams, type SmallUploadResponse, type SmartTag, type Tag, type TagCreateParams, type TagListParams, type TagUpdateParams, Tags, type UpdateGuestParams, type UploadCreateParams, type UploadCreateResponse, type UploadFileOptions, type UploadFileParams, type UploadFileResponse, Uploads, type Workspace, type WorkspaceListResponse, Workspaces };
|
package/dist/index.d.ts
CHANGED
|
@@ -62,6 +62,13 @@ interface AssetListParams extends CursorPageParams {
|
|
|
62
62
|
tag?: string | string[];
|
|
63
63
|
customField?: string | string[];
|
|
64
64
|
search?: string;
|
|
65
|
+
/**
|
|
66
|
+
* When true, `search` is used for semantic search via AI embeddings.
|
|
67
|
+
* Requires a non-blank `search` value and Semantic Search enabled on the workspace.
|
|
68
|
+
* Returns a single page of results ordered by relevance. Combining with `tag`,
|
|
69
|
+
* `customField`, `createdAt`, or `cursor` is rejected by the API with 400.
|
|
70
|
+
*/
|
|
71
|
+
semantic?: boolean;
|
|
65
72
|
"createdAt[gte]"?: string;
|
|
66
73
|
"createdAt[lte]"?: string;
|
|
67
74
|
}
|
|
@@ -81,6 +88,34 @@ interface AddVersionTagParams {
|
|
|
81
88
|
interface AssetVersionDownloadUrl {
|
|
82
89
|
url: string;
|
|
83
90
|
}
|
|
91
|
+
interface CdnLinkBase {
|
|
92
|
+
id: string;
|
|
93
|
+
url: string;
|
|
94
|
+
assetId: string;
|
|
95
|
+
active: boolean;
|
|
96
|
+
createdAt: string;
|
|
97
|
+
updatedAt: string;
|
|
98
|
+
}
|
|
99
|
+
type CdnLink = (CdnLinkBase & {
|
|
100
|
+
followsDefaultVersion: true;
|
|
101
|
+
versionId?: never;
|
|
102
|
+
}) | (CdnLinkBase & {
|
|
103
|
+
followsDefaultVersion: false;
|
|
104
|
+
versionId: string;
|
|
105
|
+
});
|
|
106
|
+
type AssetCdnLinkCreateParams = {
|
|
107
|
+
followsDefaultVersion: true;
|
|
108
|
+
versionId?: never;
|
|
109
|
+
} | {
|
|
110
|
+
versionId: string;
|
|
111
|
+
followsDefaultVersion?: never;
|
|
112
|
+
};
|
|
113
|
+
interface AssetCdnLinkUpdateParams {
|
|
114
|
+
active: boolean;
|
|
115
|
+
}
|
|
116
|
+
interface AssetCdnLinkListResponse {
|
|
117
|
+
data: CdnLink[];
|
|
118
|
+
}
|
|
84
119
|
interface AssetBoardListParams extends CursorPageParams {
|
|
85
120
|
includeCustomFields?: boolean;
|
|
86
121
|
}
|
|
@@ -159,6 +194,9 @@ declare class Assets {
|
|
|
159
194
|
list(params?: AssetListParams): PagePromise<Asset>;
|
|
160
195
|
get(assetId: string): Promise<Asset>;
|
|
161
196
|
delete(assetId: string): Promise<void>;
|
|
197
|
+
listCdnLinks(assetId: string): Promise<AssetCdnLinkListResponse>;
|
|
198
|
+
createCdnLink(assetId: string, params: AssetCdnLinkCreateParams): Promise<CdnLink>;
|
|
199
|
+
updateCdnLink(assetId: string, cdnLinkId: string, params: AssetCdnLinkUpdateParams): Promise<void>;
|
|
162
200
|
setCustomField(assetId: string, customFieldId: string, params: SetCustomFieldParams): Promise<void>;
|
|
163
201
|
listVersions(assetId: string): Promise<AssetVersionListResponse>;
|
|
164
202
|
getVersion(assetId: string, versionId: string): Promise<AssetVersion>;
|
|
@@ -476,4 +514,4 @@ declare class AirApi extends AirBase {
|
|
|
476
514
|
constructor(options?: AirApiOptions);
|
|
477
515
|
}
|
|
478
516
|
|
|
479
|
-
export { type AddBoardAssetsParams, type AddGuestParams, type AddVersionTagParams, AirApi, type AirApiOptions, type Asset, type AssetBoardListParams, type AssetCustomFieldValue, type AssetListParams, type AssetVersion, type AssetVersionDownloadUrl, type AssetVersionListResponse, type AssetVersionUpdateParams, type AssetVersionUrls, Assets, type Board, type BoardCreateParams, type BoardListParams, type BoardUpdateParams, Boards, type CompleteMultipartParams, type CustomField, type CustomFieldCreateParams, type CustomFieldListParams, type CustomFieldType, type CustomFieldUpdateParams, type CustomFieldValue, type CustomFieldValueCreateParams, type CustomFieldValueUpdateParams, CustomFields, type FileMeta, type FileSource, type GetPartUploadUrlParams, type GetPartUploadUrlResponse, type Guest, type GuestListParams, type GuestListResponse, type ImportCreateParams, type ImportCreateResponse, type ImportStatus, type ImportStatusResponse, Imports, type LargeUploadResponse, Libraries, type Library, type LibraryCreateParams, type LibraryListParams, type LibraryUpdateParams, type Role, type RoleListParams, type RoleListResponse, Roles, type SetBoardCustomFieldParams, type SetCustomFieldParams, type SmallUploadResponse, type SmartTag, type Tag, type TagCreateParams, type TagListParams, type TagUpdateParams, Tags, type UpdateGuestParams, type UploadCreateParams, type UploadCreateResponse, type UploadFileOptions, type UploadFileParams, type UploadFileResponse, Uploads, type Workspace, type WorkspaceListResponse, Workspaces };
|
|
517
|
+
export { type AddBoardAssetsParams, type AddGuestParams, type AddVersionTagParams, AirApi, type AirApiOptions, type Asset, type AssetBoardListParams, type AssetCdnLinkCreateParams, type AssetCdnLinkListResponse, type AssetCdnLinkUpdateParams, type AssetCustomFieldValue, type AssetListParams, type AssetVersion, type AssetVersionDownloadUrl, type AssetVersionListResponse, type AssetVersionUpdateParams, type AssetVersionUrls, Assets, type Board, type BoardCreateParams, type BoardListParams, type BoardUpdateParams, Boards, type CdnLink, type CompleteMultipartParams, type CustomField, type CustomFieldCreateParams, type CustomFieldListParams, type CustomFieldType, type CustomFieldUpdateParams, type CustomFieldValue, type CustomFieldValueCreateParams, type CustomFieldValueUpdateParams, CustomFields, type FileMeta, type FileSource, type GetPartUploadUrlParams, type GetPartUploadUrlResponse, type Guest, type GuestListParams, type GuestListResponse, type ImportCreateParams, type ImportCreateResponse, type ImportStatus, type ImportStatusResponse, Imports, type LargeUploadResponse, Libraries, type Library, type LibraryCreateParams, type LibraryListParams, type LibraryUpdateParams, type Role, type RoleListParams, type RoleListResponse, Roles, type SetBoardCustomFieldParams, type SetCustomFieldParams, type SmallUploadResponse, type SmartTag, type Tag, type TagCreateParams, type TagListParams, type TagUpdateParams, Tags, type UpdateGuestParams, type UploadCreateParams, type UploadCreateResponse, type UploadFileOptions, type UploadFileParams, type UploadFileResponse, Uploads, type Workspace, type WorkspaceListResponse, Workspaces };
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,9 @@ var Assets = class {
|
|
|
16
16
|
if (params.includeNestedAssets !== void 0) {
|
|
17
17
|
query.includeNestedAssets = params.includeNestedAssets;
|
|
18
18
|
}
|
|
19
|
+
if (params.semantic !== void 0) {
|
|
20
|
+
query.semantic = params.semantic;
|
|
21
|
+
}
|
|
19
22
|
if (params.tag) {
|
|
20
23
|
query.tag = params.tag;
|
|
21
24
|
}
|
|
@@ -42,6 +45,26 @@ var Assets = class {
|
|
|
42
45
|
path: `/assets/${assetId}`
|
|
43
46
|
});
|
|
44
47
|
}
|
|
48
|
+
async listCdnLinks(assetId) {
|
|
49
|
+
return this.client.request({
|
|
50
|
+
method: "GET",
|
|
51
|
+
path: `/assets/${assetId}/cdnLinks`
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
async createCdnLink(assetId, params) {
|
|
55
|
+
return this.client.request({
|
|
56
|
+
method: "POST",
|
|
57
|
+
path: `/assets/${assetId}/cdnLinks`,
|
|
58
|
+
body: params
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
async updateCdnLink(assetId, cdnLinkId, params) {
|
|
62
|
+
return this.client.request({
|
|
63
|
+
method: "PATCH",
|
|
64
|
+
path: `/assets/${assetId}/cdnLinks/${cdnLinkId}`,
|
|
65
|
+
body: params
|
|
66
|
+
});
|
|
67
|
+
}
|
|
45
68
|
async setCustomField(assetId, customFieldId, params) {
|
|
46
69
|
return this.client.request({
|
|
47
70
|
method: "PUT",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@air/api-rest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Typed REST client for Air API",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"clean": "rm -rf dist .tsc-out tsconfig.tsbuildinfo"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@air/api-core": "0.
|
|
32
|
+
"@air/api-core": "0.5.0"
|
|
33
33
|
},
|
|
34
34
|
"engines": {
|
|
35
35
|
"node": ">=18"
|