@air/api-rest 0.6.0 → 0.7.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 -1
- package/dist/index.cjs +28 -0
- package/dist/index.d.cts +35 -1
- package/dist/index.d.ts +35 -1
- package/dist/index.js +28 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ npm install @air/api-rest
|
|
|
22
22
|
|
|
23
23
|
- Resource classes: `BoardsResource`, `AssetsResource`, `TagsResource`, `CustomFieldsResource`, `UploadsResource`, `ImportsResource`, `RolesResource`
|
|
24
24
|
- Asset CDN link helpers: `listCdnLinks`, `createCdnLink`, and `updateCdnLink`
|
|
25
|
-
- Share
|
|
25
|
+
- Share links: `listShareLinks`, `createShareLink`, and `updateShareLink` on assets and boards
|
|
26
26
|
- Full TypeScript types for all API request/response shapes
|
|
27
27
|
- `AirApi` client class that composes all resources
|
|
28
28
|
|
package/dist/index.cjs
CHANGED
|
@@ -181,6 +181,20 @@ var Assets = class {
|
|
|
181
181
|
query
|
|
182
182
|
);
|
|
183
183
|
}
|
|
184
|
+
async createShareLink(assetId, params) {
|
|
185
|
+
return this.client.request({
|
|
186
|
+
method: "POST",
|
|
187
|
+
path: `/assets/${assetId}/share-links`,
|
|
188
|
+
body: params
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
async updateShareLink(assetId, shareLinkId, params) {
|
|
192
|
+
return this.client.request({
|
|
193
|
+
method: "PATCH",
|
|
194
|
+
path: `/assets/${assetId}/share-links/${shareLinkId}`,
|
|
195
|
+
body: params
|
|
196
|
+
});
|
|
197
|
+
}
|
|
184
198
|
listBoards(assetId, params = {}) {
|
|
185
199
|
const query = {
|
|
186
200
|
limit: params.limit,
|
|
@@ -267,6 +281,20 @@ var Boards = class {
|
|
|
267
281
|
path: `/boards/${boardId}/share-links`
|
|
268
282
|
});
|
|
269
283
|
}
|
|
284
|
+
async createShareLink(boardId, params = {}) {
|
|
285
|
+
return this.client.request({
|
|
286
|
+
method: "POST",
|
|
287
|
+
path: `/boards/${boardId}/share-links`,
|
|
288
|
+
body: params
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
async updateShareLink(boardId, shareLinkId, params) {
|
|
292
|
+
return this.client.request({
|
|
293
|
+
method: "PATCH",
|
|
294
|
+
path: `/boards/${boardId}/share-links/${shareLinkId}`,
|
|
295
|
+
body: params
|
|
296
|
+
});
|
|
297
|
+
}
|
|
270
298
|
async addGuest(boardId, params) {
|
|
271
299
|
return this.client.request({
|
|
272
300
|
method: "POST",
|
package/dist/index.d.cts
CHANGED
|
@@ -238,6 +238,36 @@ type AssetShareLinkListParams = CursorPageParams;
|
|
|
238
238
|
interface BoardShareLinkListResponse extends CursorPageResponse<BoardShareLink> {
|
|
239
239
|
total: number;
|
|
240
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* Settings accepted on share-link create and update.
|
|
243
|
+
* Omitted fields follow the workspace Share Link Defaults on create,
|
|
244
|
+
* and stay unchanged on update.
|
|
245
|
+
*/
|
|
246
|
+
interface ShareLinkWriteSettings {
|
|
247
|
+
active?: boolean;
|
|
248
|
+
allowDownload?: boolean;
|
|
249
|
+
}
|
|
250
|
+
/** Asset links also accept `showAllVersions`. */
|
|
251
|
+
interface AssetShareLinkWriteSettings extends ShareLinkWriteSettings {
|
|
252
|
+
showAllVersions?: boolean;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Body for `POST /assets/:assetId/share-links`.
|
|
256
|
+
* Exactly one of `followsDefaultVersion: true` or `versionId`.
|
|
257
|
+
*/
|
|
258
|
+
type AssetShareLinkCreateParams = AssetShareLinkWriteSettings & ({
|
|
259
|
+
followsDefaultVersion: true;
|
|
260
|
+
versionId?: never;
|
|
261
|
+
} | {
|
|
262
|
+
versionId: string;
|
|
263
|
+
followsDefaultVersion?: never;
|
|
264
|
+
});
|
|
265
|
+
/** Body for `PATCH /assets/:assetId/share-links/:shareLinkId`. */
|
|
266
|
+
type AssetShareLinkUpdateParams = AssetShareLinkWriteSettings;
|
|
267
|
+
/** Body for `POST /boards/:boardId/share-links`. */
|
|
268
|
+
type BoardShareLinkCreateParams = ShareLinkWriteSettings;
|
|
269
|
+
/** Body for `PATCH /boards/:boardId/share-links/:shareLinkId`. */
|
|
270
|
+
type BoardShareLinkUpdateParams = ShareLinkWriteSettings;
|
|
241
271
|
|
|
242
272
|
declare class Assets {
|
|
243
273
|
private client;
|
|
@@ -256,6 +286,8 @@ declare class Assets {
|
|
|
256
286
|
addVersionTag(assetId: string, versionId: string, params: AddVersionTagParams): Promise<AssetVersion>;
|
|
257
287
|
removeVersionTag(assetId: string, versionId: string, tagId: string): Promise<void>;
|
|
258
288
|
listShareLinks(assetId: string, params?: AssetShareLinkListParams): PagePromise<AssetShareLink>;
|
|
289
|
+
createShareLink(assetId: string, params: AssetShareLinkCreateParams): Promise<AssetShareLink>;
|
|
290
|
+
updateShareLink(assetId: string, shareLinkId: string, params: AssetShareLinkUpdateParams): Promise<void>;
|
|
259
291
|
listBoards(assetId: string, params?: AssetBoardListParams): PagePromise<Board>;
|
|
260
292
|
}
|
|
261
293
|
|
|
@@ -271,6 +303,8 @@ declare class Boards {
|
|
|
271
303
|
removeAsset(boardId: string, assetId: string): Promise<void>;
|
|
272
304
|
setCustomField(boardId: string, customFieldId: string, params: SetBoardCustomFieldParams): Promise<void>;
|
|
273
305
|
listShareLinks(boardId: string): Promise<BoardShareLinkListResponse>;
|
|
306
|
+
createShareLink(boardId: string, params?: BoardShareLinkCreateParams): Promise<BoardShareLink>;
|
|
307
|
+
updateShareLink(boardId: string, shareLinkId: string, params: BoardShareLinkUpdateParams): Promise<void>;
|
|
274
308
|
addGuest(boardId: string, params: AddGuestParams): Promise<Guest>;
|
|
275
309
|
listGuests(boardId: string, params?: GuestListParams): Promise<Guest[]>;
|
|
276
310
|
updateGuest(boardId: string, guestId: string, params: UpdateGuestParams): Promise<void>;
|
|
@@ -567,4 +601,4 @@ declare class AirApi extends AirBase {
|
|
|
567
601
|
constructor(options?: AirApiOptions);
|
|
568
602
|
}
|
|
569
603
|
|
|
570
|
-
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 AssetShareLink, type AssetShareLinkListParams, type AssetVersion, type AssetVersionDownloadUrl, type AssetVersionListResponse, type AssetVersionUpdateParams, type AssetVersionUrls, Assets, type Board, type BoardCreateParams, type BoardListParams, type BoardShareLink, type BoardShareLinkListResponse, 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 ShareLink, type ShareLinkCommentsAccess, type ShareLinkCustomFieldsAccess, 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 };
|
|
604
|
+
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 AssetShareLink, type AssetShareLinkCreateParams, type AssetShareLinkListParams, type AssetShareLinkUpdateParams, type AssetShareLinkWriteSettings, type AssetVersion, type AssetVersionDownloadUrl, type AssetVersionListResponse, type AssetVersionUpdateParams, type AssetVersionUrls, Assets, type Board, type BoardCreateParams, type BoardListParams, type BoardShareLink, type BoardShareLinkCreateParams, type BoardShareLinkListResponse, type BoardShareLinkUpdateParams, 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 ShareLink, type ShareLinkCommentsAccess, type ShareLinkCustomFieldsAccess, type ShareLinkWriteSettings, 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
|
@@ -238,6 +238,36 @@ type AssetShareLinkListParams = CursorPageParams;
|
|
|
238
238
|
interface BoardShareLinkListResponse extends CursorPageResponse<BoardShareLink> {
|
|
239
239
|
total: number;
|
|
240
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* Settings accepted on share-link create and update.
|
|
243
|
+
* Omitted fields follow the workspace Share Link Defaults on create,
|
|
244
|
+
* and stay unchanged on update.
|
|
245
|
+
*/
|
|
246
|
+
interface ShareLinkWriteSettings {
|
|
247
|
+
active?: boolean;
|
|
248
|
+
allowDownload?: boolean;
|
|
249
|
+
}
|
|
250
|
+
/** Asset links also accept `showAllVersions`. */
|
|
251
|
+
interface AssetShareLinkWriteSettings extends ShareLinkWriteSettings {
|
|
252
|
+
showAllVersions?: boolean;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Body for `POST /assets/:assetId/share-links`.
|
|
256
|
+
* Exactly one of `followsDefaultVersion: true` or `versionId`.
|
|
257
|
+
*/
|
|
258
|
+
type AssetShareLinkCreateParams = AssetShareLinkWriteSettings & ({
|
|
259
|
+
followsDefaultVersion: true;
|
|
260
|
+
versionId?: never;
|
|
261
|
+
} | {
|
|
262
|
+
versionId: string;
|
|
263
|
+
followsDefaultVersion?: never;
|
|
264
|
+
});
|
|
265
|
+
/** Body for `PATCH /assets/:assetId/share-links/:shareLinkId`. */
|
|
266
|
+
type AssetShareLinkUpdateParams = AssetShareLinkWriteSettings;
|
|
267
|
+
/** Body for `POST /boards/:boardId/share-links`. */
|
|
268
|
+
type BoardShareLinkCreateParams = ShareLinkWriteSettings;
|
|
269
|
+
/** Body for `PATCH /boards/:boardId/share-links/:shareLinkId`. */
|
|
270
|
+
type BoardShareLinkUpdateParams = ShareLinkWriteSettings;
|
|
241
271
|
|
|
242
272
|
declare class Assets {
|
|
243
273
|
private client;
|
|
@@ -256,6 +286,8 @@ declare class Assets {
|
|
|
256
286
|
addVersionTag(assetId: string, versionId: string, params: AddVersionTagParams): Promise<AssetVersion>;
|
|
257
287
|
removeVersionTag(assetId: string, versionId: string, tagId: string): Promise<void>;
|
|
258
288
|
listShareLinks(assetId: string, params?: AssetShareLinkListParams): PagePromise<AssetShareLink>;
|
|
289
|
+
createShareLink(assetId: string, params: AssetShareLinkCreateParams): Promise<AssetShareLink>;
|
|
290
|
+
updateShareLink(assetId: string, shareLinkId: string, params: AssetShareLinkUpdateParams): Promise<void>;
|
|
259
291
|
listBoards(assetId: string, params?: AssetBoardListParams): PagePromise<Board>;
|
|
260
292
|
}
|
|
261
293
|
|
|
@@ -271,6 +303,8 @@ declare class Boards {
|
|
|
271
303
|
removeAsset(boardId: string, assetId: string): Promise<void>;
|
|
272
304
|
setCustomField(boardId: string, customFieldId: string, params: SetBoardCustomFieldParams): Promise<void>;
|
|
273
305
|
listShareLinks(boardId: string): Promise<BoardShareLinkListResponse>;
|
|
306
|
+
createShareLink(boardId: string, params?: BoardShareLinkCreateParams): Promise<BoardShareLink>;
|
|
307
|
+
updateShareLink(boardId: string, shareLinkId: string, params: BoardShareLinkUpdateParams): Promise<void>;
|
|
274
308
|
addGuest(boardId: string, params: AddGuestParams): Promise<Guest>;
|
|
275
309
|
listGuests(boardId: string, params?: GuestListParams): Promise<Guest[]>;
|
|
276
310
|
updateGuest(boardId: string, guestId: string, params: UpdateGuestParams): Promise<void>;
|
|
@@ -567,4 +601,4 @@ declare class AirApi extends AirBase {
|
|
|
567
601
|
constructor(options?: AirApiOptions);
|
|
568
602
|
}
|
|
569
603
|
|
|
570
|
-
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 AssetShareLink, type AssetShareLinkListParams, type AssetVersion, type AssetVersionDownloadUrl, type AssetVersionListResponse, type AssetVersionUpdateParams, type AssetVersionUrls, Assets, type Board, type BoardCreateParams, type BoardListParams, type BoardShareLink, type BoardShareLinkListResponse, 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 ShareLink, type ShareLinkCommentsAccess, type ShareLinkCustomFieldsAccess, 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 };
|
|
604
|
+
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 AssetShareLink, type AssetShareLinkCreateParams, type AssetShareLinkListParams, type AssetShareLinkUpdateParams, type AssetShareLinkWriteSettings, type AssetVersion, type AssetVersionDownloadUrl, type AssetVersionListResponse, type AssetVersionUpdateParams, type AssetVersionUrls, Assets, type Board, type BoardCreateParams, type BoardListParams, type BoardShareLink, type BoardShareLinkCreateParams, type BoardShareLinkListResponse, type BoardShareLinkUpdateParams, 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 ShareLink, type ShareLinkCommentsAccess, type ShareLinkCustomFieldsAccess, type ShareLinkWriteSettings, 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
|
@@ -120,6 +120,20 @@ var Assets = class {
|
|
|
120
120
|
query
|
|
121
121
|
);
|
|
122
122
|
}
|
|
123
|
+
async createShareLink(assetId, params) {
|
|
124
|
+
return this.client.request({
|
|
125
|
+
method: "POST",
|
|
126
|
+
path: `/assets/${assetId}/share-links`,
|
|
127
|
+
body: params
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
async updateShareLink(assetId, shareLinkId, params) {
|
|
131
|
+
return this.client.request({
|
|
132
|
+
method: "PATCH",
|
|
133
|
+
path: `/assets/${assetId}/share-links/${shareLinkId}`,
|
|
134
|
+
body: params
|
|
135
|
+
});
|
|
136
|
+
}
|
|
123
137
|
listBoards(assetId, params = {}) {
|
|
124
138
|
const query = {
|
|
125
139
|
limit: params.limit,
|
|
@@ -206,6 +220,20 @@ var Boards = class {
|
|
|
206
220
|
path: `/boards/${boardId}/share-links`
|
|
207
221
|
});
|
|
208
222
|
}
|
|
223
|
+
async createShareLink(boardId, params = {}) {
|
|
224
|
+
return this.client.request({
|
|
225
|
+
method: "POST",
|
|
226
|
+
path: `/boards/${boardId}/share-links`,
|
|
227
|
+
body: params
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
async updateShareLink(boardId, shareLinkId, params) {
|
|
231
|
+
return this.client.request({
|
|
232
|
+
method: "PATCH",
|
|
233
|
+
path: `/boards/${boardId}/share-links/${shareLinkId}`,
|
|
234
|
+
body: params
|
|
235
|
+
});
|
|
236
|
+
}
|
|
209
237
|
async addGuest(boardId, params) {
|
|
210
238
|
return this.client.request({
|
|
211
239
|
method: "POST",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@air/api-rest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.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.7.0"
|
|
33
33
|
},
|
|
34
34
|
"engines": {
|
|
35
35
|
"node": ">=18"
|