@air/api-rest 0.5.1 → 0.6.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 CHANGED
@@ -22,6 +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 link reads: `assets.listShareLinks` and `boards.listShareLinks`
25
26
  - Full TypeScript types for all API request/response shapes
26
27
  - `AirApi` client class that composes all resources
27
28
 
package/dist/index.cjs CHANGED
@@ -171,6 +171,16 @@ var Assets = class {
171
171
  path: `/assets/${assetId}/versions/${versionId}/tags/${tagId}`
172
172
  });
173
173
  }
174
+ listShareLinks(assetId, params = {}) {
175
+ const query = {
176
+ limit: params.limit,
177
+ cursor: params.cursor
178
+ };
179
+ return this.client.requestCursorPage(
180
+ { method: "GET", path: `/assets/${assetId}/share-links`, query },
181
+ query
182
+ );
183
+ }
174
184
  listBoards(assetId, params = {}) {
175
185
  const query = {
176
186
  limit: params.limit,
@@ -251,6 +261,12 @@ var Boards = class {
251
261
  body: params
252
262
  });
253
263
  }
264
+ async listShareLinks(boardId) {
265
+ return this.client.request({
266
+ method: "GET",
267
+ path: `/boards/${boardId}/share-links`
268
+ });
269
+ }
254
270
  async addGuest(boardId, params) {
255
271
  return this.client.request({
256
272
  method: "POST",
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { CursorPageParams, AirBase, PagePromise, AirBaseOptions } from '@air/api-core';
1
+ import { CursorPageParams, CursorPageResponse, AirBase, PagePromise, AirBaseOptions } from '@air/api-core';
2
2
  export { APIError, AirBase, AirBaseOptions, AuthenticationError, BadRequestError, BuildAuthorizationUrlOptions, ConnectionError, CursorPage, CursorPageParams, CursorPageResponse, ExchangeAuthorizationCodeOptions, InternalServerError, NotFoundError, OAuthAccessToken, OAuthClientAuthMethod, PKCEChallenge, PagePromise, PermissionError, RateLimitError, RequestOptions, TimeoutError, VERSION, buildAuthorizationUrl, exchangeAuthorizationCode, generatePKCEChallenge } from '@air/api-core';
3
3
 
4
4
  interface Tag {
@@ -188,6 +188,57 @@ interface GuestListResponse {
188
188
  data: Guest[];
189
189
  }
190
190
 
191
+ /** Visitor comment access on a share link. */
192
+ type ShareLinkCommentsAccess = "hidden" | "read_only" | "allowed";
193
+ /** Visitor custom field access on a share link. */
194
+ type ShareLinkCustomFieldsAccess = "hidden" | "read_only" | "editable";
195
+ /**
196
+ * Public share link fields shared by assets and boards.
197
+ * `url` is the link to give to people. The password is never returned;
198
+ * `hasPassword` says whether one is set. Disabled links are included
199
+ * with `active: false`.
200
+ */
201
+ interface ShareLink {
202
+ id: string;
203
+ url: string;
204
+ active: boolean;
205
+ hasPassword: boolean;
206
+ expiresAt: string | null;
207
+ requireAccount: boolean;
208
+ allowDownload: boolean;
209
+ comments: ShareLinkCommentsAccess;
210
+ customFields: ShareLinkCustomFieldsAccess;
211
+ createdAt: string;
212
+ }
213
+ /**
214
+ * Asset share link. An asset can have one link that follows the current
215
+ * version and one link per pinned version. `versionId` is present only
216
+ * when the link is pinned to a version.
217
+ */
218
+ type AssetShareLink = (ShareLink & {
219
+ followsDefaultVersion: true;
220
+ versionId?: never;
221
+ showAllVersions: boolean;
222
+ }) | (ShareLink & {
223
+ followsDefaultVersion: false;
224
+ versionId: string;
225
+ showAllVersions: boolean;
226
+ });
227
+ /** Board share link. A board has at most one. */
228
+ type BoardShareLink = ShareLink;
229
+ /**
230
+ * Pagination for `GET /assets/:assetId/share-links`.
231
+ * The API defaults `limit` to 12 and caps it at 200.
232
+ */
233
+ type AssetShareLinkListParams = CursorPageParams;
234
+ /**
235
+ * Response for `GET /boards/:boardId/share-links`.
236
+ * `data` holds the board's share link, or is empty when the board has none.
237
+ */
238
+ interface BoardShareLinkListResponse extends CursorPageResponse<BoardShareLink> {
239
+ total: number;
240
+ }
241
+
191
242
  declare class Assets {
192
243
  private client;
193
244
  constructor(client: AirBase);
@@ -204,6 +255,7 @@ declare class Assets {
204
255
  getVersionDownloadUrl(assetId: string, versionId: string): Promise<AssetVersionDownloadUrl>;
205
256
  addVersionTag(assetId: string, versionId: string, params: AddVersionTagParams): Promise<AssetVersion>;
206
257
  removeVersionTag(assetId: string, versionId: string, tagId: string): Promise<void>;
258
+ listShareLinks(assetId: string, params?: AssetShareLinkListParams): PagePromise<AssetShareLink>;
207
259
  listBoards(assetId: string, params?: AssetBoardListParams): PagePromise<Board>;
208
260
  }
209
261
 
@@ -218,6 +270,7 @@ declare class Boards {
218
270
  addAssets(boardId: string, params: AddBoardAssetsParams): Promise<void>;
219
271
  removeAsset(boardId: string, assetId: string): Promise<void>;
220
272
  setCustomField(boardId: string, customFieldId: string, params: SetBoardCustomFieldParams): Promise<void>;
273
+ listShareLinks(boardId: string): Promise<BoardShareLinkListResponse>;
221
274
  addGuest(boardId: string, params: AddGuestParams): Promise<Guest>;
222
275
  listGuests(boardId: string, params?: GuestListParams): Promise<Guest[]>;
223
276
  updateGuest(boardId: string, guestId: string, params: UpdateGuestParams): Promise<void>;
@@ -514,4 +567,4 @@ declare class AirApi extends AirBase {
514
567
  constructor(options?: AirApiOptions);
515
568
  }
516
569
 
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 };
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 };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CursorPageParams, AirBase, PagePromise, AirBaseOptions } from '@air/api-core';
1
+ import { CursorPageParams, CursorPageResponse, AirBase, PagePromise, AirBaseOptions } from '@air/api-core';
2
2
  export { APIError, AirBase, AirBaseOptions, AuthenticationError, BadRequestError, BuildAuthorizationUrlOptions, ConnectionError, CursorPage, CursorPageParams, CursorPageResponse, ExchangeAuthorizationCodeOptions, InternalServerError, NotFoundError, OAuthAccessToken, OAuthClientAuthMethod, PKCEChallenge, PagePromise, PermissionError, RateLimitError, RequestOptions, TimeoutError, VERSION, buildAuthorizationUrl, exchangeAuthorizationCode, generatePKCEChallenge } from '@air/api-core';
3
3
 
4
4
  interface Tag {
@@ -188,6 +188,57 @@ interface GuestListResponse {
188
188
  data: Guest[];
189
189
  }
190
190
 
191
+ /** Visitor comment access on a share link. */
192
+ type ShareLinkCommentsAccess = "hidden" | "read_only" | "allowed";
193
+ /** Visitor custom field access on a share link. */
194
+ type ShareLinkCustomFieldsAccess = "hidden" | "read_only" | "editable";
195
+ /**
196
+ * Public share link fields shared by assets and boards.
197
+ * `url` is the link to give to people. The password is never returned;
198
+ * `hasPassword` says whether one is set. Disabled links are included
199
+ * with `active: false`.
200
+ */
201
+ interface ShareLink {
202
+ id: string;
203
+ url: string;
204
+ active: boolean;
205
+ hasPassword: boolean;
206
+ expiresAt: string | null;
207
+ requireAccount: boolean;
208
+ allowDownload: boolean;
209
+ comments: ShareLinkCommentsAccess;
210
+ customFields: ShareLinkCustomFieldsAccess;
211
+ createdAt: string;
212
+ }
213
+ /**
214
+ * Asset share link. An asset can have one link that follows the current
215
+ * version and one link per pinned version. `versionId` is present only
216
+ * when the link is pinned to a version.
217
+ */
218
+ type AssetShareLink = (ShareLink & {
219
+ followsDefaultVersion: true;
220
+ versionId?: never;
221
+ showAllVersions: boolean;
222
+ }) | (ShareLink & {
223
+ followsDefaultVersion: false;
224
+ versionId: string;
225
+ showAllVersions: boolean;
226
+ });
227
+ /** Board share link. A board has at most one. */
228
+ type BoardShareLink = ShareLink;
229
+ /**
230
+ * Pagination for `GET /assets/:assetId/share-links`.
231
+ * The API defaults `limit` to 12 and caps it at 200.
232
+ */
233
+ type AssetShareLinkListParams = CursorPageParams;
234
+ /**
235
+ * Response for `GET /boards/:boardId/share-links`.
236
+ * `data` holds the board's share link, or is empty when the board has none.
237
+ */
238
+ interface BoardShareLinkListResponse extends CursorPageResponse<BoardShareLink> {
239
+ total: number;
240
+ }
241
+
191
242
  declare class Assets {
192
243
  private client;
193
244
  constructor(client: AirBase);
@@ -204,6 +255,7 @@ declare class Assets {
204
255
  getVersionDownloadUrl(assetId: string, versionId: string): Promise<AssetVersionDownloadUrl>;
205
256
  addVersionTag(assetId: string, versionId: string, params: AddVersionTagParams): Promise<AssetVersion>;
206
257
  removeVersionTag(assetId: string, versionId: string, tagId: string): Promise<void>;
258
+ listShareLinks(assetId: string, params?: AssetShareLinkListParams): PagePromise<AssetShareLink>;
207
259
  listBoards(assetId: string, params?: AssetBoardListParams): PagePromise<Board>;
208
260
  }
209
261
 
@@ -218,6 +270,7 @@ declare class Boards {
218
270
  addAssets(boardId: string, params: AddBoardAssetsParams): Promise<void>;
219
271
  removeAsset(boardId: string, assetId: string): Promise<void>;
220
272
  setCustomField(boardId: string, customFieldId: string, params: SetBoardCustomFieldParams): Promise<void>;
273
+ listShareLinks(boardId: string): Promise<BoardShareLinkListResponse>;
221
274
  addGuest(boardId: string, params: AddGuestParams): Promise<Guest>;
222
275
  listGuests(boardId: string, params?: GuestListParams): Promise<Guest[]>;
223
276
  updateGuest(boardId: string, guestId: string, params: UpdateGuestParams): Promise<void>;
@@ -514,4 +567,4 @@ declare class AirApi extends AirBase {
514
567
  constructor(options?: AirApiOptions);
515
568
  }
516
569
 
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 };
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 };
package/dist/index.js CHANGED
@@ -110,6 +110,16 @@ var Assets = class {
110
110
  path: `/assets/${assetId}/versions/${versionId}/tags/${tagId}`
111
111
  });
112
112
  }
113
+ listShareLinks(assetId, params = {}) {
114
+ const query = {
115
+ limit: params.limit,
116
+ cursor: params.cursor
117
+ };
118
+ return this.client.requestCursorPage(
119
+ { method: "GET", path: `/assets/${assetId}/share-links`, query },
120
+ query
121
+ );
122
+ }
113
123
  listBoards(assetId, params = {}) {
114
124
  const query = {
115
125
  limit: params.limit,
@@ -190,6 +200,12 @@ var Boards = class {
190
200
  body: params
191
201
  });
192
202
  }
203
+ async listShareLinks(boardId) {
204
+ return this.client.request({
205
+ method: "GET",
206
+ path: `/boards/${boardId}/share-links`
207
+ });
208
+ }
193
209
  async addGuest(boardId, params) {
194
210
  return this.client.request({
195
211
  method: "POST",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@air/api-rest",
3
- "version": "0.5.1",
3
+ "version": "0.6.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.5.1"
32
+ "@air/api-core": "0.6.0"
33
33
  },
34
34
  "engines": {
35
35
  "node": ">=18"