@air/api-rest 0.9.0 → 0.11.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 +5 -2
- package/dist/index.cjs +281 -0
- package/dist/index.d.cts +470 -6
- package/dist/index.d.ts +470 -6
- package/dist/index.js +278 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -38,6 +38,7 @@ var Assets = class {
|
|
|
38
38
|
limit: params.limit,
|
|
39
39
|
cursor: params.cursor,
|
|
40
40
|
parentBoardId: params.parentBoardId,
|
|
41
|
+
showcaseId: params.showcaseId,
|
|
41
42
|
search: params.search
|
|
42
43
|
};
|
|
43
44
|
if (params.includeNestedAssets !== void 0) {
|
|
@@ -187,6 +188,7 @@ var Boards = class {
|
|
|
187
188
|
cursor: params.cursor,
|
|
188
189
|
name: params.name,
|
|
189
190
|
parentBoardId: params.parentBoardId,
|
|
191
|
+
showcaseId: params.showcaseId,
|
|
190
192
|
libraryId: params.libraryId,
|
|
191
193
|
inGeneralLibrary: params.inGeneralLibrary
|
|
192
194
|
};
|
|
@@ -354,6 +356,118 @@ var CustomFields = class {
|
|
|
354
356
|
}
|
|
355
357
|
};
|
|
356
358
|
|
|
359
|
+
// src/resources/discussions.ts
|
|
360
|
+
var Discussions = class {
|
|
361
|
+
constructor(client) {
|
|
362
|
+
this.client = client;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* List discussions on an asset or on the assets currently in a board.
|
|
366
|
+
* Exactly one of `assetId` or `boardId` is required.
|
|
367
|
+
*
|
|
368
|
+
* Pages don't overlap. With the default `lastCommentedAt` sort, a reply
|
|
369
|
+
* between pages can move a discussion, so it may repeat or be skipped. For
|
|
370
|
+
* a stable walk, use `sortBy: "createdAt"` and `sortDirection: "asc"`.
|
|
371
|
+
*/
|
|
372
|
+
list(params) {
|
|
373
|
+
const query = {
|
|
374
|
+
assetId: params.assetId,
|
|
375
|
+
assetVersionId: params.assetVersionId,
|
|
376
|
+
boardId: params.boardId,
|
|
377
|
+
resolved: params.resolved,
|
|
378
|
+
sortBy: params.sortBy,
|
|
379
|
+
sortDirection: params.sortDirection,
|
|
380
|
+
limit: params.limit,
|
|
381
|
+
cursor: params.cursor
|
|
382
|
+
};
|
|
383
|
+
return this.client.requestCursorPage(
|
|
384
|
+
{ method: "GET", path: "/discussions", query },
|
|
385
|
+
query
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
/** Get one discussion, including its first 10 comments. A discussion you cannot view is 404. */
|
|
389
|
+
async get(discussionId) {
|
|
390
|
+
return this.client.request({
|
|
391
|
+
method: "GET",
|
|
392
|
+
path: `/discussions/${discussionId}`
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* List every comment on a discussion, oldest first.
|
|
397
|
+
* `discussion.comments.pagination.cursor` is accepted as `cursor`.
|
|
398
|
+
*/
|
|
399
|
+
listComments(discussionId, params = {}) {
|
|
400
|
+
const query = {
|
|
401
|
+
limit: params.limit,
|
|
402
|
+
cursor: params.cursor
|
|
403
|
+
};
|
|
404
|
+
return this.client.requestCursorPage(
|
|
405
|
+
{ method: "GET", path: `/discussions/${discussionId}/comments`, query },
|
|
406
|
+
query
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Start a discussion on an asset version. `assetVersionId` is required.
|
|
411
|
+
* Mention someone with `{{mention:N}}` and a `mentions` entry at that index.
|
|
412
|
+
* On a document or PDF, every annotation needs a `pageNumber`.
|
|
413
|
+
*
|
|
414
|
+
* The body has no board. In a workspace that scopes comments to boards, a
|
|
415
|
+
* discussion with no board needs `asset.canManageDiscussions` at the
|
|
416
|
+
* workspace level, so a board guest gets 403 even when they can comment in
|
|
417
|
+
* their board. A timeout can create a duplicate: list before retrying.
|
|
418
|
+
*/
|
|
419
|
+
async create(params) {
|
|
420
|
+
return this.client.request({
|
|
421
|
+
method: "POST",
|
|
422
|
+
path: "/discussions",
|
|
423
|
+
body: params
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
/** Add a comment. The body and mention rules match `create`. */
|
|
427
|
+
async createComment(discussionId, params) {
|
|
428
|
+
return this.client.request({
|
|
429
|
+
method: "POST",
|
|
430
|
+
path: `/discussions/${discussionId}/comments`,
|
|
431
|
+
body: params
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Resolve or reopen a discussion. The response is empty, including when the
|
|
436
|
+
* discussion was already in the requested state.
|
|
437
|
+
*/
|
|
438
|
+
async update(discussionId, params) {
|
|
439
|
+
return this.client.request({
|
|
440
|
+
method: "PATCH",
|
|
441
|
+
path: `/discussions/${discussionId}`,
|
|
442
|
+
body: params
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Replace a comment's text and mentions. Only the author can edit.
|
|
447
|
+
* The response is empty, and the edit notifies no one. An edit that leaves
|
|
448
|
+
* the text and mentions as they are changes nothing and keeps `updatedAt`.
|
|
449
|
+
* Omitting `mentions`, or sending `null`, when the comment has them is 409.
|
|
450
|
+
* `[]` removes them.
|
|
451
|
+
*/
|
|
452
|
+
async updateComment(discussionId, commentId, params) {
|
|
453
|
+
return this.client.request({
|
|
454
|
+
method: "PATCH",
|
|
455
|
+
path: `/discussions/${discussionId}/comments/${commentId}`,
|
|
456
|
+
body: params
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Delete a comment. Only the author can delete. The response is empty.
|
|
461
|
+
* Deleting the last comment deletes the discussion.
|
|
462
|
+
*/
|
|
463
|
+
async deleteComment(discussionId, commentId) {
|
|
464
|
+
return this.client.request({
|
|
465
|
+
method: "DELETE",
|
|
466
|
+
path: `/discussions/${discussionId}/comments/${commentId}`
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
|
|
357
471
|
// src/resources/imports.ts
|
|
358
472
|
var Imports = class {
|
|
359
473
|
constructor(client) {
|
|
@@ -418,6 +532,30 @@ var Libraries = class {
|
|
|
418
532
|
}
|
|
419
533
|
};
|
|
420
534
|
|
|
535
|
+
// src/resources/members.ts
|
|
536
|
+
var Members = class {
|
|
537
|
+
constructor(client) {
|
|
538
|
+
this.client = client;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* List people in the workspace. Requires `members.read`.
|
|
542
|
+
* `workspace.read` does not grant it.
|
|
543
|
+
*
|
|
544
|
+
* Sort is fixed: `firstJoinedAt` ascending, then `id`.
|
|
545
|
+
* `email` without `type` searches every type. An unknown email is an empty list.
|
|
546
|
+
*/
|
|
547
|
+
list(params = {}) {
|
|
548
|
+
const query = {
|
|
549
|
+
type: params.type,
|
|
550
|
+
email: params.email,
|
|
551
|
+
search: params.search,
|
|
552
|
+
limit: params.limit,
|
|
553
|
+
cursor: params.cursor
|
|
554
|
+
};
|
|
555
|
+
return this.client.requestCursorPage({ method: "GET", path: "/members", query }, query);
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
|
|
421
559
|
// src/resources/roles.ts
|
|
422
560
|
var Roles = class {
|
|
423
561
|
constructor(client) {
|
|
@@ -433,6 +571,137 @@ var Roles = class {
|
|
|
433
571
|
}
|
|
434
572
|
};
|
|
435
573
|
|
|
574
|
+
// src/resources/showcases.ts
|
|
575
|
+
var Showcases = class {
|
|
576
|
+
constructor(client) {
|
|
577
|
+
this.client = client;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* List the showcases the caller can see.
|
|
581
|
+
*
|
|
582
|
+
* A role that can view every showcase in the workspace sees all of them.
|
|
583
|
+
* Otherwise only the showcases that caller owns are returned. Showcases
|
|
584
|
+
* without a share link are omitted; read those with `get`. Sub-pages are
|
|
585
|
+
* not listed separately.
|
|
586
|
+
*
|
|
587
|
+
* Requires the `showcases.read` and `share_links.read` OAuth scopes.
|
|
588
|
+
*/
|
|
589
|
+
list(params = {}) {
|
|
590
|
+
const query = {
|
|
591
|
+
limit: params.limit,
|
|
592
|
+
cursor: params.cursor,
|
|
593
|
+
search: params.search,
|
|
594
|
+
status: params.status
|
|
595
|
+
};
|
|
596
|
+
return this.client.requestCursorPage(
|
|
597
|
+
{ method: "GET", path: "/showcases", query },
|
|
598
|
+
query
|
|
599
|
+
);
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Get a showcase and its share link. `shareLink` is null when the
|
|
603
|
+
* showcase has none.
|
|
604
|
+
*
|
|
605
|
+
* Requires the `showcases.read` and `share_links.read` OAuth scopes.
|
|
606
|
+
*/
|
|
607
|
+
async get(showcaseId) {
|
|
608
|
+
return this.client.request({
|
|
609
|
+
method: "GET",
|
|
610
|
+
path: `/showcases/${showcaseId}`
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* Create a showcase and its share link in one step. The result includes
|
|
615
|
+
* the link. Create does not take items.
|
|
616
|
+
*
|
|
617
|
+
* Requires the `showcases.write` and `share_links.write` OAuth scopes.
|
|
618
|
+
*/
|
|
619
|
+
async create(params) {
|
|
620
|
+
return this.client.request({
|
|
621
|
+
method: "POST",
|
|
622
|
+
path: "/showcases",
|
|
623
|
+
body: params
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Rename a showcase or change its description. Only the fields you send
|
|
628
|
+
* change. Returns no body.
|
|
629
|
+
*
|
|
630
|
+
* Requires the `showcases.write` OAuth scope.
|
|
631
|
+
*/
|
|
632
|
+
async update(showcaseId, params) {
|
|
633
|
+
return this.client.request({
|
|
634
|
+
method: "PATCH",
|
|
635
|
+
path: `/showcases/${showcaseId}`,
|
|
636
|
+
body: params
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Change the settings of a showcase's share link. Only the settings you
|
|
641
|
+
* send change. Send `password: null` or `expiresAt: null` to remove them.
|
|
642
|
+
* Returns no body.
|
|
643
|
+
*
|
|
644
|
+
* Requires the `share_links.write` and `showcases.read` OAuth scopes.
|
|
645
|
+
*/
|
|
646
|
+
async updateShareLink(showcaseId, shareLinkId, params) {
|
|
647
|
+
return this.client.request({
|
|
648
|
+
method: "PATCH",
|
|
649
|
+
path: `/showcases/${showcaseId}/share-links/${shareLinkId}`,
|
|
650
|
+
body: params
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Add assets to a showcase. Assets already in it are skipped. Returns no
|
|
655
|
+
* body. List them with `assets.list({ showcaseId })`.
|
|
656
|
+
*
|
|
657
|
+
* Requires the `showcases.write` and `assets.read` OAuth scopes.
|
|
658
|
+
*/
|
|
659
|
+
async addAssets(showcaseId, params) {
|
|
660
|
+
return this.client.request({
|
|
661
|
+
method: "POST",
|
|
662
|
+
path: `/showcases/${showcaseId}/assets`,
|
|
663
|
+
body: params
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Remove an asset from a showcase. The asset itself is not deleted.
|
|
668
|
+
* Removing an asset that is not in the showcase succeeds. Returns no body.
|
|
669
|
+
*
|
|
670
|
+
* Requires the `showcases.write` OAuth scope.
|
|
671
|
+
*/
|
|
672
|
+
async removeAsset(showcaseId, assetId) {
|
|
673
|
+
return this.client.request({
|
|
674
|
+
method: "DELETE",
|
|
675
|
+
path: `/showcases/${showcaseId}/assets/${assetId}`
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Add boards to a showcase. Boards already in it are skipped. Returns no
|
|
680
|
+
* body. List them with `boards.list({ showcaseId })`.
|
|
681
|
+
*
|
|
682
|
+
* Requires the `showcases.write` and `boards.read` OAuth scopes.
|
|
683
|
+
*/
|
|
684
|
+
async addBoards(showcaseId, params) {
|
|
685
|
+
return this.client.request({
|
|
686
|
+
method: "POST",
|
|
687
|
+
path: `/showcases/${showcaseId}/boards`,
|
|
688
|
+
body: params
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Remove a board from a showcase. The board itself is not deleted.
|
|
693
|
+
* Removing a board that is not in the showcase succeeds. Returns no body.
|
|
694
|
+
*
|
|
695
|
+
* Requires the `showcases.write` OAuth scope.
|
|
696
|
+
*/
|
|
697
|
+
async removeBoard(showcaseId, boardId) {
|
|
698
|
+
return this.client.request({
|
|
699
|
+
method: "DELETE",
|
|
700
|
+
path: `/showcases/${showcaseId}/boards/${boardId}`
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
|
|
436
705
|
// src/resources/tags.ts
|
|
437
706
|
var Tags = class {
|
|
438
707
|
constructor(client) {
|
|
@@ -722,9 +991,12 @@ var Workspaces = class {
|
|
|
722
991
|
var AirApi = class extends AirBase {
|
|
723
992
|
assets;
|
|
724
993
|
boards;
|
|
994
|
+
showcases;
|
|
725
995
|
libraries;
|
|
726
996
|
tags;
|
|
727
997
|
customFields;
|
|
998
|
+
discussions;
|
|
999
|
+
members;
|
|
728
1000
|
roles;
|
|
729
1001
|
imports;
|
|
730
1002
|
uploads;
|
|
@@ -733,9 +1005,12 @@ var AirApi = class extends AirBase {
|
|
|
733
1005
|
super(options);
|
|
734
1006
|
this.assets = new Assets(this);
|
|
735
1007
|
this.boards = new Boards(this);
|
|
1008
|
+
this.showcases = new Showcases(this);
|
|
736
1009
|
this.libraries = new Libraries(this);
|
|
737
1010
|
this.tags = new Tags(this);
|
|
738
1011
|
this.customFields = new CustomFields(this);
|
|
1012
|
+
this.discussions = new Discussions(this);
|
|
1013
|
+
this.members = new Members(this);
|
|
739
1014
|
this.roles = new Roles(this);
|
|
740
1015
|
this.imports = new Imports(this);
|
|
741
1016
|
this.uploads = new Uploads(this);
|
|
@@ -773,14 +1048,17 @@ export {
|
|
|
773
1048
|
ConnectionError,
|
|
774
1049
|
CursorPage,
|
|
775
1050
|
CustomFields,
|
|
1051
|
+
Discussions,
|
|
776
1052
|
Imports,
|
|
777
1053
|
InternalServerError,
|
|
778
1054
|
Libraries,
|
|
1055
|
+
Members,
|
|
779
1056
|
NotFoundError,
|
|
780
1057
|
PagePromise,
|
|
781
1058
|
PermissionError,
|
|
782
1059
|
RateLimitError,
|
|
783
1060
|
Roles,
|
|
1061
|
+
Showcases,
|
|
784
1062
|
Tags,
|
|
785
1063
|
TimeoutError,
|
|
786
1064
|
Uploads,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@air/api-rest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.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.11.0"
|
|
33
33
|
},
|
|
34
34
|
"engines": {
|
|
35
35
|
"node": ">=18"
|