@excali-boards/boards-api-client 1.1.7 → 1.1.9

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.
@@ -1,4 +1,5 @@
1
1
  import { AccessLevel, NameInput, SingleOutput } from '../external/types';
2
+ import { BoardType } from '../../prisma/generated/default';
2
3
  import { BoardsManager } from '../core/manager';
3
4
  import { GetRoomsOutput } from './admin';
4
5
  export declare class APIBoards {
@@ -61,6 +62,7 @@ export type GetBoardOutput = {
61
62
  group: SingleOutput;
62
63
  category: SingleOutput;
63
64
  board: SingleOutput & {
65
+ type: BoardType;
64
66
  dataUrl: string;
65
67
  totalSizeBytes: number;
66
68
  accessLevel: AccessLevel;
@@ -9,43 +9,43 @@ class APIBoards {
9
9
  async getBoards({ auth, categoryId, groupId }) {
10
10
  return await this.web.request({
11
11
  method: 'GET', auth,
12
- endpoint: this.web.qp(`/data/groups/${groupId}/categories/${categoryId}`),
12
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}`),
13
13
  });
14
14
  }
15
15
  async getBoard({ auth, categoryId, groupId, boardId }) {
16
16
  return await this.web.request({
17
17
  method: 'GET', auth,
18
- endpoint: this.web.qp(`/data/groups/${groupId}/categories/${categoryId}/boards/${boardId}`),
18
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}`),
19
19
  });
20
20
  }
21
21
  async updateBoard({ auth, categoryId, groupId, boardId, body }) {
22
22
  return await this.web.request({
23
23
  method: 'PATCH', auth, body,
24
- endpoint: this.web.qp(`/data/groups/${groupId}/categories/${categoryId}/boards/${boardId}`),
24
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}`),
25
25
  });
26
26
  }
27
27
  async scheduleBoardDeletion({ auth, categoryId, groupId, boardId }) {
28
28
  return await this.web.request({
29
29
  method: 'DELETE', auth,
30
- endpoint: this.web.qp(`/data/groups/${groupId}/categories/${categoryId}/boards/${boardId}`),
30
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}`),
31
31
  });
32
32
  }
33
33
  async cancelBoardDeletion({ auth, categoryId, groupId, boardId }) {
34
34
  return await this.web.request({
35
35
  method: 'POST', auth,
36
- endpoint: this.web.qp(`/data/groups/${groupId}/categories/${categoryId}/boards/${boardId}/cancel-deletion`),
36
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/cancel-deletion`),
37
37
  });
38
38
  }
39
39
  async getBoardRoomData({ auth, categoryId, groupId, boardId }) {
40
40
  return await this.web.request({
41
41
  method: 'GET', auth,
42
- endpoint: this.web.qp(`/data/groups/${groupId}/categories/${categoryId}/boards/${boardId}/room`),
42
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/room`),
43
43
  });
44
44
  }
45
45
  async kickUserFromRoom({ auth, categoryId, groupId, boardId, userId }) {
46
46
  return await this.web.request({
47
47
  method: 'POST', auth,
48
- endpoint: this.web.qp(`/data/groups/${groupId}/categories/${categoryId}/boards/${boardId}/room`, {
48
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/room`, {
49
49
  userId,
50
50
  }),
51
51
  });
@@ -11,37 +11,37 @@ class APICategories {
11
11
  async getCategories({ auth, groupId }) {
12
12
  return await this.web.request({
13
13
  method: 'GET', auth,
14
- endpoint: this.web.qp(`/data/groups/${groupId}`),
14
+ endpoint: this.web.qp(`/groups/${groupId}`),
15
15
  });
16
16
  }
17
17
  async getCategory({ auth, groupId, categoryId }) {
18
18
  return await this.web.request({
19
19
  method: 'GET', auth,
20
- endpoint: this.web.qp(`/data/groups/${groupId}/categories/${categoryId}`),
20
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}`),
21
21
  });
22
22
  }
23
23
  async createBoardInCategory({ auth, groupId, categoryId, body }) {
24
24
  return await this.web.request({
25
25
  method: 'POST', auth, body,
26
- endpoint: this.web.qp(`/data/groups/${groupId}/categories/${categoryId}/boards`),
26
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards`),
27
27
  });
28
28
  }
29
29
  async updateCategory({ auth, groupId, categoryId, body }) {
30
30
  return await this.web.request({
31
31
  method: 'PATCH', auth, body,
32
- endpoint: this.web.qp(`/data/groups/${groupId}/categories/${categoryId}`),
32
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}`),
33
33
  });
34
34
  }
35
35
  async reorderBoardsInCategory({ auth, groupId, categoryId, body }) {
36
36
  return await this.web.request({
37
37
  method: 'PUT', auth, body,
38
- endpoint: this.web.qp(`/data/groups/${groupId}/categories/${categoryId}/boards`),
38
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards`),
39
39
  });
40
40
  }
41
41
  async deleteCategory({ auth, groupId, categoryId }) {
42
42
  return await this.web.request({
43
43
  method: 'DELETE', auth,
44
- endpoint: this.web.qp(`/data/groups/${groupId}/categories/${categoryId}`),
44
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}`),
45
45
  });
46
46
  }
47
47
  }
@@ -0,0 +1,37 @@
1
+ import { BoardsManager } from '../core/manager';
2
+ export declare class APIFiles {
3
+ private web;
4
+ constructor(web: BoardsManager);
5
+ uploadBase64Files({ auth, boardId, files }: FilesFunctionsInput['uploadBase64Files']): Promise<import("..").WebResponse<FileUploadResponse>>;
6
+ uploadRawFiles({ auth, boardId, files }: FilesFunctionsInput['uploadRawFiles']): Promise<import("..").WebResponse<FileUploadResponse>>;
7
+ deleteFiles({ auth, boardId, fileIds }: FilesFunctionsInput['deleteFiles']): Promise<import("..").WebResponse<string>>;
8
+ }
9
+ export type FilesFunctionsInput = {
10
+ 'uploadBase64Files': {
11
+ auth: string;
12
+ boardId: string;
13
+ files: Base64FileInput;
14
+ };
15
+ 'uploadRawFiles': {
16
+ auth: string;
17
+ boardId: string;
18
+ files: File[];
19
+ };
20
+ 'deleteFiles': {
21
+ auth: string;
22
+ boardId: string;
23
+ fileIds: string[];
24
+ };
25
+ };
26
+ export type Base64FileInput = {
27
+ id: string;
28
+ data: string;
29
+ mimeType: string;
30
+ }[];
31
+ export type RawFileUploadInput = {
32
+ boardId: string;
33
+ };
34
+ export type FileUploadResponse = {
35
+ success: number;
36
+ failed: number;
37
+ };
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.APIFiles = void 0;
4
+ class APIFiles {
5
+ web;
6
+ constructor(web) {
7
+ this.web = web;
8
+ }
9
+ async uploadBase64Files({ auth, boardId, files }) {
10
+ return await this.web.request({
11
+ method: 'POST', auth,
12
+ endpoint: `/files/${boardId}/base64`,
13
+ body: files,
14
+ });
15
+ }
16
+ async uploadRawFiles({ auth, boardId, files }) {
17
+ const formData = new FormData();
18
+ for (const file of files) {
19
+ formData.append('files', file);
20
+ }
21
+ return await this.web.request({
22
+ method: 'POST', auth,
23
+ endpoint: `/files/${boardId}/raw`,
24
+ body: formData,
25
+ headers: null,
26
+ });
27
+ }
28
+ async deleteFiles({ auth, boardId, fileIds }) {
29
+ return await this.web.request({
30
+ method: 'DELETE', auth,
31
+ endpoint: `/files/${boardId}/delete`,
32
+ body: fileIds,
33
+ });
34
+ }
35
+ }
36
+ exports.APIFiles = APIFiles;
@@ -11,55 +11,55 @@ class APIGroups {
11
11
  async getAllSorted({ auth }) {
12
12
  return await this.web.request({
13
13
  method: 'GET', auth,
14
- endpoint: this.web.qp('/data/all'),
14
+ endpoint: this.web.qp('/all'),
15
15
  });
16
16
  }
17
17
  async getGroups({ auth }) {
18
18
  return await this.web.request({
19
19
  method: 'GET', auth,
20
- endpoint: this.web.qp('/data/groups'),
20
+ endpoint: this.web.qp('/groups'),
21
21
  });
22
22
  }
23
23
  async getGroup({ auth, groupId }) {
24
24
  return await this.web.request({
25
25
  method: 'GET', auth,
26
- endpoint: this.web.qp(`/data/groups/${groupId}`),
26
+ endpoint: this.web.qp(`/groups/${groupId}`),
27
27
  });
28
28
  }
29
29
  async createGroup({ auth, body }) {
30
30
  return await this.web.request({
31
31
  method: 'POST', auth, body,
32
- endpoint: this.web.qp('/data/groups'),
32
+ endpoint: this.web.qp('/groups'),
33
33
  });
34
34
  }
35
35
  async createCategoryInGroup({ auth, groupId, body }) {
36
36
  return await this.web.request({
37
37
  method: 'POST', auth, body,
38
- endpoint: this.web.qp(`/data/groups/${groupId}/categories`),
38
+ endpoint: this.web.qp(`/groups/${groupId}/categories`),
39
39
  });
40
40
  }
41
41
  async updateGroup({ auth, groupId, body }) {
42
42
  return await this.web.request({
43
43
  method: 'PATCH', auth, body,
44
- endpoint: this.web.qp(`/data/groups/${groupId}`),
44
+ endpoint: this.web.qp(`/groups/${groupId}`),
45
45
  });
46
46
  }
47
47
  async reorderGroups({ auth, body }) {
48
48
  return await this.web.request({
49
49
  method: 'PUT', auth, body,
50
- endpoint: this.web.qp('/data/groups'),
50
+ endpoint: this.web.qp('/groups'),
51
51
  });
52
52
  }
53
53
  async reorderCategoriesInGroup({ auth, groupId, body }) {
54
54
  return await this.web.request({
55
55
  method: 'PUT', auth, body,
56
- endpoint: this.web.qp(`/data/groups/${groupId}/categories`),
56
+ endpoint: this.web.qp(`/groups/${groupId}/categories`),
57
57
  });
58
58
  }
59
59
  async deleteGroup({ auth, groupId }) {
60
60
  return await this.web.request({
61
61
  method: 'DELETE', auth,
62
- endpoint: this.web.qp(`/data/groups/${groupId}`),
62
+ endpoint: this.web.qp(`/groups/${groupId}`),
63
63
  });
64
64
  }
65
65
  }
@@ -9,6 +9,7 @@ import { APIGroups } from '../classes/groups';
9
9
  import { APIBoards } from '../classes/boards';
10
10
  import { APIUtils } from '../classes/utils';
11
11
  import { APIUsers } from '../classes/users';
12
+ import { APIFiles } from '../classes/files';
12
13
  import { APIAdmin } from '../classes/admin';
13
14
  export declare class BoardsManager {
14
15
  url: string;
@@ -22,6 +23,7 @@ export declare class BoardsManager {
22
23
  readonly admin: APIAdmin;
23
24
  readonly users: APIUsers;
24
25
  readonly utils: APIUtils;
26
+ readonly files: APIFiles;
25
27
  constructor(url: string);
26
28
  request<O, T = unknown, R extends boolean = false, P extends boolean = false>(data: {
27
29
  endpoint: string;
@@ -14,6 +14,7 @@ const groups_1 = require("../classes/groups");
14
14
  const boards_1 = require("../classes/boards");
15
15
  const utils_1 = require("../classes/utils");
16
16
  const users_1 = require("../classes/users");
17
+ const files_1 = require("../classes/files");
17
18
  const admin_1 = require("../classes/admin");
18
19
  const utils_2 = require("./utils");
19
20
  class BoardsManager {
@@ -28,6 +29,7 @@ class BoardsManager {
28
29
  admin = new admin_1.APIAdmin(this);
29
30
  users = new users_1.APIUsers(this);
30
31
  utils = new utils_1.APIUtils(this);
32
+ files = new files_1.APIFiles(this);
31
33
  constructor(url) {
32
34
  this.url = url;
33
35
  }
package/dist/index.d.ts CHANGED
@@ -12,3 +12,4 @@ export * from './classes/boards';
12
12
  export * from './classes/utils';
13
13
  export * from './classes/admin';
14
14
  export * from './classes/users';
15
+ export * from './classes/files';
package/dist/index.js CHANGED
@@ -28,3 +28,4 @@ __exportStar(require("./classes/boards"), exports);
28
28
  __exportStar(require("./classes/utils"), exports);
29
29
  __exportStar(require("./classes/admin"), exports);
30
30
  __exportStar(require("./classes/users"), exports);
31
+ __exportStar(require("./classes/files"), exports);
@@ -1 +1 @@
1
- {"root":["../src/index.ts","../src/types.ts","../src/classes/admin.ts","../src/classes/boards.ts","../src/classes/categories.ts","../src/classes/groups.ts","../src/classes/invites.ts","../src/classes/metrics.ts","../src/classes/permissions.ts","../src/classes/sessions.ts","../src/classes/users.ts","../src/classes/utils.ts","../src/core/manager.ts","../src/core/utils.ts","../src/external/types.ts","../src/external/vars.ts"],"version":"5.9.2"}
1
+ {"root":["../src/index.ts","../src/types.ts","../src/classes/admin.ts","../src/classes/boards.ts","../src/classes/categories.ts","../src/classes/files.ts","../src/classes/groups.ts","../src/classes/invites.ts","../src/classes/metrics.ts","../src/classes/permissions.ts","../src/classes/sessions.ts","../src/classes/users.ts","../src/classes/utils.ts","../src/core/manager.ts","../src/core/utils.ts","../src/external/types.ts","../src/external/vars.ts"],"version":"5.9.2"}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.7",
2
+ "version": "1.1.9",
3
3
  "name": "@excali-boards/boards-api-client",
4
4
  "description": "A simple API client for the Boards API.",
5
5
  "repository": "https://github.com/Excali-Boards/boards-api-client",
@@ -29,6 +29,7 @@ enum Device {
29
29
  enum BoardType {
30
30
  Excalidraw
31
31
  Tldraw
32
+ Text
32
33
  }
33
34
 
34
35
  // Separate role enums for each resource type