@excali-boards/boards-api-client 1.1.51 → 1.1.53

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.
Files changed (85) hide show
  1. package/dist/classes/admin.d.ts +9 -6
  2. package/dist/classes/admin.js +1 -5
  3. package/dist/classes/analytics.d.ts +7 -7
  4. package/dist/classes/analytics.js +1 -5
  5. package/dist/classes/auth.d.ts +48 -0
  6. package/dist/classes/auth.js +12 -0
  7. package/dist/classes/boards.d.ts +13 -13
  8. package/dist/classes/boards.js +1 -5
  9. package/dist/classes/calendar.d.ts +9 -9
  10. package/dist/classes/calendar.js +1 -5
  11. package/dist/classes/categories.d.ts +14 -12
  12. package/dist/classes/categories.js +1 -5
  13. package/dist/classes/files.d.ts +5 -5
  14. package/dist/classes/files.js +1 -5
  15. package/dist/classes/flashcards.d.ts +13 -13
  16. package/dist/classes/flashcards.js +1 -5
  17. package/dist/classes/groups.d.ts +18 -14
  18. package/dist/classes/groups.js +1 -5
  19. package/dist/classes/invites.d.ts +11 -11
  20. package/dist/classes/invites.js +1 -5
  21. package/dist/classes/metrics.d.ts +4 -4
  22. package/dist/classes/metrics.js +1 -5
  23. package/dist/classes/permissions.d.ts +8 -8
  24. package/dist/classes/permissions.js +1 -5
  25. package/dist/classes/sessions.d.ts +9 -8
  26. package/dist/classes/sessions.js +1 -5
  27. package/dist/classes/users.d.ts +7 -7
  28. package/dist/classes/users.js +1 -5
  29. package/dist/classes/utils.d.ts +3 -3
  30. package/dist/classes/utils.js +1 -5
  31. package/dist/core/manager.d.ts +17 -15
  32. package/dist/core/manager.js +35 -40
  33. package/dist/core/utils.d.ts +1 -1
  34. package/dist/core/utils.js +4 -10
  35. package/dist/external/types.d.ts +13 -2
  36. package/dist/external/types.js +2 -5
  37. package/dist/external/vars.d.ts +2 -2
  38. package/dist/external/vars.js +15 -18
  39. package/dist/index.d.ts +20 -19
  40. package/dist/index.js +20 -35
  41. package/dist/src/classes/admin.d.ts +23 -0
  42. package/dist/src/classes/admin.js +20 -0
  43. package/dist/src/classes/analytics.d.ts +62 -0
  44. package/dist/src/classes/analytics.js +38 -0
  45. package/dist/src/classes/auth.d.ts +48 -0
  46. package/dist/src/classes/auth.js +12 -0
  47. package/dist/src/classes/boards.d.ts +99 -0
  48. package/dist/src/classes/boards.js +62 -0
  49. package/dist/src/classes/calendar.d.ts +84 -0
  50. package/dist/src/classes/calendar.js +45 -0
  51. package/dist/src/classes/categories.d.ts +75 -0
  52. package/dist/src/classes/categories.js +50 -0
  53. package/dist/src/classes/files.d.ts +45 -0
  54. package/dist/src/classes/files.js +31 -0
  55. package/dist/src/classes/flashcards.d.ts +120 -0
  56. package/dist/src/classes/flashcards.js +68 -0
  57. package/dist/src/classes/groups.d.ts +80 -0
  58. package/dist/src/classes/groups.js +62 -0
  59. package/dist/src/classes/invites.d.ts +116 -0
  60. package/dist/src/classes/invites.js +50 -0
  61. package/dist/src/classes/metrics.d.ts +31 -0
  62. package/dist/src/classes/metrics.js +20 -0
  63. package/dist/src/classes/permissions.d.ts +48 -0
  64. package/dist/src/classes/permissions.js +32 -0
  65. package/dist/src/classes/sessions.d.ts +61 -0
  66. package/dist/src/classes/sessions.js +38 -0
  67. package/dist/src/classes/users.d.ts +37 -0
  68. package/dist/src/classes/users.js +26 -0
  69. package/dist/src/classes/utils.d.ts +19 -0
  70. package/dist/src/classes/utils.js +16 -0
  71. package/dist/src/core/manager.d.ts +44 -0
  72. package/dist/src/core/manager.js +92 -0
  73. package/dist/src/core/utils.d.ts +9 -0
  74. package/dist/src/core/utils.js +52 -0
  75. package/dist/src/external/types.d.ts +87 -0
  76. package/dist/src/external/types.js +4 -0
  77. package/dist/src/external/vars.d.ts +99 -0
  78. package/dist/src/external/vars.js +65 -0
  79. package/dist/src/index.d.ts +20 -0
  80. package/dist/src/index.js +20 -0
  81. package/dist/src/types.d.ts +61 -0
  82. package/dist/src/types.js +1 -0
  83. package/dist/types.js +1 -2
  84. package/package.json +2 -9
  85. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,48 @@
1
+ import { BoardsManager } from '../core/manager';
2
+ import { CreateSessionInput } from './sessions';
3
+ import { DBUserPartialType } from '../external/vars';
4
+ import { WithHeaders } from '../types';
5
+ export declare class APIAuth {
6
+ private web;
7
+ constructor(web: BoardsManager);
8
+ authenticate({ auth, body, ...rest }: AuthFunctionsInput['authenticate']): Promise<import("..").WebResponse<{
9
+ avatarUrl: string | null;
10
+ boardPermissions: {
11
+ boardId: string;
12
+ role: import("../../prisma/generated").$Enums.BoardRole;
13
+ }[];
14
+ categoryPermissions: {
15
+ categoryId: string;
16
+ role: import("../../prisma/generated").$Enums.CategoryRole;
17
+ }[];
18
+ displayName: string;
19
+ email: string;
20
+ groupPermissions: {
21
+ groupId: string;
22
+ role: import("../../prisma/generated").$Enums.GroupRole;
23
+ }[];
24
+ invitedBy: string | null;
25
+ loginMethods: {
26
+ platform: import("../../prisma/generated").$Enums.Platforms;
27
+ platformEmail: string;
28
+ }[];
29
+ mainGroupId: string | null;
30
+ mainLoginType: import("../../prisma/generated").$Enums.Platforms;
31
+ registrationMethod: import("../../prisma/generated").$Enums.RegistrationMethod;
32
+ userId: string;
33
+ }>>;
34
+ }
35
+ export type AuthFunctionsInput = WithHeaders<{
36
+ 'authenticate': {
37
+ auth: string;
38
+ body: CreateSessionInput & {
39
+ refreshProfile?: boolean;
40
+ };
41
+ };
42
+ }>;
43
+ export type AuthOutput = DBUserPartialType & {
44
+ sessions: {
45
+ dbId: string;
46
+ lastUsed: Date;
47
+ }[];
48
+ };
@@ -0,0 +1,12 @@
1
+ export class APIAuth {
2
+ web;
3
+ constructor(web) {
4
+ this.web = web;
5
+ }
6
+ async authenticate({ auth, body, ...rest }) {
7
+ return await this.web.request({
8
+ method: 'POST', auth, body, ...rest,
9
+ endpoint: this.web.qp('/auth/authenticate'),
10
+ });
11
+ }
12
+ }
@@ -0,0 +1,99 @@
1
+ import { AccessLevel, AllRooms, NameInput, SingleOutput } from '../external/types';
2
+ import { BoardType } from '../../prisma/generated/default';
3
+ import { BoardsManager } from '../core/manager';
4
+ import { WithHeaders } from '../types';
5
+ export declare class APIBoards {
6
+ private web;
7
+ constructor(web: BoardsManager);
8
+ getBoards({ auth, categoryId, groupId, ...rest }: BoardsFunctionsInput['getBoards']): Promise<import("..").WebResponse<GetBoardOutput[]>>;
9
+ getBoard({ auth, categoryId, groupId, boardId, ...rest }: BoardsFunctionsInput['getBoard']): Promise<import("..").WebResponse<GetBoardOutput>>;
10
+ updateBoard({ auth, categoryId, groupId, boardId, body, ...rest }: BoardsFunctionsInput['updateBoard']): Promise<import("..").WebResponse<string>>;
11
+ moveBoard({ auth, categoryId, groupId, boardId, body, ...rest }: BoardsFunctionsInput['moveBoard']): Promise<import("..").WebResponse<MoveBoardOutput>>;
12
+ scheduleBoardDeletion({ auth, categoryId, groupId, boardId, ...rest }: BoardsFunctionsInput['scheduleBoardDeletion']): Promise<import("..").WebResponse<string>>;
13
+ forceDeleteBoard({ auth, categoryId, groupId, boardId, ...rest }: BoardsFunctionsInput['scheduleBoardDeletion']): Promise<import("..").WebResponse<string>>;
14
+ cancelBoardDeletion({ auth, categoryId, groupId, boardId, ...rest }: BoardsFunctionsInput['cancelBoardDeletion']): Promise<import("..").WebResponse<string>>;
15
+ getBoardRoomData({ auth, categoryId, groupId, boardId, ...rest }: BoardsFunctionsInput['getRoomData']): Promise<import("..").WebResponse<AllRooms>>;
16
+ kickUserFromRoom({ auth, categoryId, groupId, boardId, userId, ...rest }: BoardsFunctionsInput['kickUserFromRoom']): Promise<import("..").WebResponse<string>>;
17
+ }
18
+ export type BoardsFunctionsInput = WithHeaders<{
19
+ 'getBoards': {
20
+ auth: string;
21
+ categoryId: string;
22
+ groupId: string;
23
+ };
24
+ 'getBoard': {
25
+ auth: string;
26
+ categoryId: string;
27
+ groupId: string;
28
+ boardId: string;
29
+ };
30
+ 'updateBoard': {
31
+ auth: string;
32
+ categoryId: string;
33
+ groupId: string;
34
+ boardId: string;
35
+ body: NameInput;
36
+ };
37
+ 'moveBoard': {
38
+ auth: string;
39
+ categoryId: string;
40
+ groupId: string;
41
+ boardId: string;
42
+ body: MoveBoardInput;
43
+ };
44
+ 'scheduleBoardDeletion': {
45
+ auth: string;
46
+ categoryId: string;
47
+ groupId: string;
48
+ boardId: string;
49
+ };
50
+ 'cancelBoardDeletion': {
51
+ auth: string;
52
+ categoryId: string;
53
+ groupId: string;
54
+ boardId: string;
55
+ };
56
+ 'getRoomData': {
57
+ auth: string;
58
+ categoryId: string;
59
+ groupId: string;
60
+ boardId: string;
61
+ };
62
+ 'kickUserFromRoom': {
63
+ auth: string;
64
+ categoryId: string;
65
+ groupId: string;
66
+ boardId: string;
67
+ userId: string;
68
+ };
69
+ }>;
70
+ export type GetBoardOutput = {
71
+ group: SingleOutput;
72
+ category: SingleOutput;
73
+ board: SingleOutput & {
74
+ type: BoardType;
75
+ dataUrl: string;
76
+ hasFlashcards: boolean;
77
+ totalSizeBytes: number;
78
+ accessLevel: AccessLevel;
79
+ scheduledForDeletion: Date | null;
80
+ files: {
81
+ fileId: string;
82
+ mimeType: string;
83
+ createdAt: Date;
84
+ sizeBytes: number;
85
+ fileUrl: string;
86
+ }[];
87
+ };
88
+ };
89
+ export type GetFileOutput = ReadableStream | Blob;
90
+ export type MoveBoardInput = {
91
+ targetCategoryId: string;
92
+ targetIndex?: number;
93
+ };
94
+ export type MoveBoardOutput = {
95
+ boardId: string;
96
+ categoryId: string;
97
+ groupId: string;
98
+ index: number;
99
+ };
@@ -0,0 +1,62 @@
1
+ export class APIBoards {
2
+ web;
3
+ constructor(web) {
4
+ this.web = web;
5
+ }
6
+ async getBoards({ auth, categoryId, groupId, ...rest }) {
7
+ return await this.web.request({
8
+ method: 'GET', auth, ...rest,
9
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}`),
10
+ });
11
+ }
12
+ async getBoard({ auth, categoryId, groupId, boardId, ...rest }) {
13
+ return await this.web.request({
14
+ method: 'GET', auth, ...rest,
15
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}`),
16
+ });
17
+ }
18
+ async updateBoard({ auth, categoryId, groupId, boardId, body, ...rest }) {
19
+ return await this.web.request({
20
+ method: 'PATCH', auth, body, ...rest,
21
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}`),
22
+ });
23
+ }
24
+ async moveBoard({ auth, categoryId, groupId, boardId, body, ...rest }) {
25
+ return await this.web.request({
26
+ method: 'POST', auth, body, ...rest,
27
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/move`),
28
+ });
29
+ }
30
+ async scheduleBoardDeletion({ auth, categoryId, groupId, boardId, ...rest }) {
31
+ return await this.web.request({
32
+ method: 'DELETE', auth, ...rest,
33
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}`),
34
+ });
35
+ }
36
+ async forceDeleteBoard({ auth, categoryId, groupId, boardId, ...rest }) {
37
+ return await this.web.request({
38
+ method: 'DELETE', auth, ...rest,
39
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}?force=true`),
40
+ });
41
+ }
42
+ async cancelBoardDeletion({ auth, categoryId, groupId, boardId, ...rest }) {
43
+ return await this.web.request({
44
+ method: 'POST', auth, ...rest,
45
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/cancel-deletion`),
46
+ });
47
+ }
48
+ async getBoardRoomData({ auth, categoryId, groupId, boardId, ...rest }) {
49
+ return await this.web.request({
50
+ method: 'GET', auth, ...rest,
51
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/room`),
52
+ });
53
+ }
54
+ async kickUserFromRoom({ auth, categoryId, groupId, boardId, userId, ...rest }) {
55
+ return await this.web.request({
56
+ method: 'POST', auth, ...rest,
57
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/room-kick`, {
58
+ userId,
59
+ }),
60
+ });
61
+ }
62
+ }
@@ -0,0 +1,84 @@
1
+ import { SingleOutput } from '../external/types';
2
+ import { BoardsManager } from '../core/manager';
3
+ import { WithHeaders } from '../types';
4
+ export declare class APICalendar {
5
+ private web;
6
+ constructor(web: BoardsManager);
7
+ getCalendar({ auth, groupId, ...rest }: CalendarFunctionsInput['getCalendar']): Promise<import("..").WebResponse<GetCalendarResponse>>;
8
+ getHolidays({ auth, countryCode, year, ...rest }: CalendarFunctionsInput['getHolidays']): Promise<import("..").WebResponse<FormattedHoliday[]>>;
9
+ updateGroupCalendarCode({ auth, groupId, calCode, ...rest }: CalendarFunctionsInput['updateGroupCalendarCode']): Promise<import("..").WebResponse<string>>;
10
+ createEvent({ auth, groupId, event, ...rest }: CalendarFunctionsInput['createEvent']): Promise<import("..").WebResponse<string>>;
11
+ updateEvent({ auth, groupId, eventId, event, ...rest }: CalendarFunctionsInput['updateEvent']): Promise<import("..").WebResponse<string>>;
12
+ deleteEvent({ auth, groupId, eventId, ...rest }: CalendarFunctionsInput['deleteEvent']): Promise<import("..").WebResponse<string>>;
13
+ }
14
+ export type CalendarFunctionsInput = WithHeaders<{
15
+ 'getCalendar': {
16
+ auth: string;
17
+ groupId: string;
18
+ };
19
+ 'getHolidays': {
20
+ auth: string;
21
+ countryCode: string;
22
+ year: number;
23
+ };
24
+ 'createEvent': {
25
+ auth: string;
26
+ groupId: string;
27
+ event: EventObject;
28
+ };
29
+ 'updateGroupCalendarCode': {
30
+ auth: string;
31
+ groupId: string;
32
+ calCode: string | null;
33
+ };
34
+ 'updateEvent': {
35
+ auth: string;
36
+ groupId: string;
37
+ eventId: string;
38
+ event: Partial<EventObject>;
39
+ };
40
+ 'deleteEvent': {
41
+ auth: string;
42
+ groupId: string;
43
+ eventId: string;
44
+ };
45
+ }>;
46
+ export type EventObject = {
47
+ title: string;
48
+ start: Date;
49
+ end: Date;
50
+ color: string;
51
+ description?: string;
52
+ where?: string;
53
+ };
54
+ export type GetCalendarResponse = {
55
+ group: SingleOutput & {
56
+ calendarCode: string | null;
57
+ };
58
+ events: CalendarEvent[];
59
+ };
60
+ export type CalendarEvent = {
61
+ id: string;
62
+ title: string;
63
+ color: string;
64
+ description: string | null;
65
+ where: string | null;
66
+ start: Date;
67
+ end: Date;
68
+ createdAt: Date;
69
+ updatedAt: Date;
70
+ createdBy: {
71
+ displayName: string;
72
+ avatarUrl: string | null;
73
+ };
74
+ };
75
+ export type ClosedStatus = 'Public' | 'Bank' | 'School' | 'Authorities' | 'Optional' | 'Observance';
76
+ export type FormattedHoliday = {
77
+ id: string;
78
+ title: string;
79
+ start: Date;
80
+ end: Date;
81
+ color: string;
82
+ description: string;
83
+ types: ClosedStatus[];
84
+ };
@@ -0,0 +1,45 @@
1
+ export class APICalendar {
2
+ web;
3
+ constructor(web) {
4
+ this.web = web;
5
+ }
6
+ async getCalendar({ auth, groupId, ...rest }) {
7
+ return await this.web.request({
8
+ method: 'GET', auth, ...rest,
9
+ endpoint: `/groups/${groupId}/calendar`,
10
+ });
11
+ }
12
+ async getHolidays({ auth, countryCode, year, ...rest }) {
13
+ return await this.web.request({
14
+ method: 'GET', auth, ...rest,
15
+ endpoint: `/holidays/${countryCode}/${year}`,
16
+ });
17
+ }
18
+ async updateGroupCalendarCode({ auth, groupId, calCode, ...rest }) {
19
+ return await this.web.request({
20
+ method: 'PATCH', auth, ...rest,
21
+ endpoint: `/groups/${groupId}/calendar`,
22
+ body: { calCode },
23
+ });
24
+ }
25
+ async createEvent({ auth, groupId, event, ...rest }) {
26
+ return await this.web.request({
27
+ method: 'POST', auth, ...rest,
28
+ endpoint: `/groups/${groupId}/calendar`,
29
+ body: event,
30
+ });
31
+ }
32
+ async updateEvent({ auth, groupId, eventId, event, ...rest }) {
33
+ return await this.web.request({
34
+ method: 'PATCH', auth, ...rest,
35
+ endpoint: `/groups/${groupId}/calendar/${eventId}`,
36
+ body: event,
37
+ });
38
+ }
39
+ async deleteEvent({ auth, groupId, eventId, ...rest }) {
40
+ return await this.web.request({
41
+ method: 'DELETE', auth, ...rest,
42
+ endpoint: `/groups/${groupId}/calendar/${eventId}`,
43
+ });
44
+ }
45
+ }
@@ -0,0 +1,75 @@
1
+ import { BoardInput, NameInput, SingleOutput } from '../external/types';
2
+ import { BoardsManager } from '../core/manager';
3
+ import { GetBoardOutput } from './boards';
4
+ import { WithHeaders } from '../types';
5
+ export declare class APICategories {
6
+ private web;
7
+ constructor(web: BoardsManager);
8
+ getCategories({ auth, groupId, ...rest }: CategoriesFunctionsInput['getCategories']): Promise<import("..").WebResponse<GetCategoriesOutput>>;
9
+ getCategory({ auth, groupId, categoryId, ...rest }: CategoriesFunctionsInput['getCategory']): Promise<import("..").WebResponse<GetCategoryOutput>>;
10
+ createBoardInCategory({ auth, groupId, categoryId, body, ...rest }: CategoriesFunctionsInput['createBoardInCategory']): Promise<import("..").WebResponse<string>>;
11
+ updateCategory({ auth, groupId, categoryId, body, ...rest }: CategoriesFunctionsInput['updateCategory']): Promise<import("..").WebResponse<string>>;
12
+ moveCategory({ auth, groupId, categoryId, body, ...rest }: CategoriesFunctionsInput['moveCategory']): Promise<import("..").WebResponse<MoveCategoryOutput>>;
13
+ reorderBoardsInCategory({ auth, groupId, categoryId, body, ...rest }: CategoriesFunctionsInput['reorderBoards']): Promise<import("..").WebResponse<string>>;
14
+ deleteCategory({ auth, groupId, categoryId, ...rest }: CategoriesFunctionsInput['deleteCategory']): Promise<import("..").WebResponse<string>>;
15
+ }
16
+ export type CategoriesFunctionsInput = WithHeaders<{
17
+ 'getCategories': {
18
+ auth: string;
19
+ groupId: string;
20
+ };
21
+ 'getCategory': {
22
+ auth: string;
23
+ groupId: string;
24
+ categoryId: string;
25
+ };
26
+ 'createBoardInCategory': {
27
+ auth: string;
28
+ groupId: string;
29
+ categoryId: string;
30
+ body: BoardInput & {
31
+ copyPermissionsFromBoardId?: string;
32
+ };
33
+ };
34
+ 'updateCategory': {
35
+ auth: string;
36
+ groupId: string;
37
+ categoryId: string;
38
+ body: NameInput;
39
+ };
40
+ 'moveCategory': {
41
+ auth: string;
42
+ groupId: string;
43
+ categoryId: string;
44
+ body: MoveCategoryInput;
45
+ };
46
+ 'reorderBoards': {
47
+ auth: string;
48
+ groupId: string;
49
+ categoryId: string;
50
+ body: string[];
51
+ };
52
+ 'deleteCategory': {
53
+ auth: string;
54
+ groupId: string;
55
+ categoryId: string;
56
+ };
57
+ }>;
58
+ export type GetCategoriesOutput = (SingleOutput & {
59
+ boards: number;
60
+ group: SingleOutput;
61
+ })[];
62
+ export type GetCategoryOutput = {
63
+ group: SingleOutput;
64
+ category: SingleOutput;
65
+ boards: Omit<GetBoardOutput['board'], 'files'>[];
66
+ };
67
+ export type MoveCategoryInput = {
68
+ targetGroupId: string;
69
+ targetIndex?: number;
70
+ };
71
+ export type MoveCategoryOutput = {
72
+ categoryId: string;
73
+ groupId: string;
74
+ index: number;
75
+ };
@@ -0,0 +1,50 @@
1
+ // Data.
2
+ export class APICategories {
3
+ web;
4
+ constructor(web) {
5
+ this.web = web;
6
+ }
7
+ // Methods.
8
+ async getCategories({ auth, groupId, ...rest }) {
9
+ return await this.web.request({
10
+ method: 'GET', auth, ...rest,
11
+ endpoint: this.web.qp(`/groups/${groupId}`),
12
+ });
13
+ }
14
+ async getCategory({ auth, groupId, categoryId, ...rest }) {
15
+ return await this.web.request({
16
+ method: 'GET', auth, ...rest,
17
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}`),
18
+ });
19
+ }
20
+ async createBoardInCategory({ auth, groupId, categoryId, body, ...rest }) {
21
+ return await this.web.request({
22
+ method: 'POST', auth, body, ...rest,
23
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards`),
24
+ });
25
+ }
26
+ async updateCategory({ auth, groupId, categoryId, body, ...rest }) {
27
+ return await this.web.request({
28
+ method: 'PATCH', auth, body, ...rest,
29
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}`),
30
+ });
31
+ }
32
+ async moveCategory({ auth, groupId, categoryId, body, ...rest }) {
33
+ return await this.web.request({
34
+ method: 'POST', auth, body, ...rest,
35
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/move`),
36
+ });
37
+ }
38
+ async reorderBoardsInCategory({ auth, groupId, categoryId, body, ...rest }) {
39
+ return await this.web.request({
40
+ method: 'PUT', auth, body, ...rest,
41
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards`),
42
+ });
43
+ }
44
+ async deleteCategory({ auth, groupId, categoryId, ...rest }) {
45
+ return await this.web.request({
46
+ method: 'DELETE', auth, ...rest,
47
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}`),
48
+ });
49
+ }
50
+ }
@@ -0,0 +1,45 @@
1
+ import { BoardsManager } from '../core/manager';
2
+ import { WithHeaders } from '../types';
3
+ export declare class APIFiles {
4
+ private web;
5
+ constructor(web: BoardsManager);
6
+ uploadBase64Files({ auth, boardId, files, ...rest }: FilesFunctionsInput['uploadBase64Files']): Promise<import("..").WebResponse<FileUploadResponse>>;
7
+ uploadRawFiles({ auth, boardId, files, ...rest }: FilesFunctionsInput['uploadRawFiles']): Promise<import("..").WebResponse<FileUploadResponse>>;
8
+ deleteFiles({ auth, boardId, fileIds, ...rest }: FilesFunctionsInput['deleteFiles']): Promise<import("..").WebResponse<string>>;
9
+ }
10
+ export type FilesFunctionsInput = WithHeaders<{
11
+ 'uploadBase64Files': {
12
+ auth: string;
13
+ boardId: string;
14
+ files: Base64FileInput;
15
+ };
16
+ 'uploadRawFiles': {
17
+ auth: string;
18
+ boardId: string;
19
+ files: RawFileInput[];
20
+ };
21
+ 'deleteFiles': {
22
+ auth: string;
23
+ boardId: string;
24
+ fileIds: string[];
25
+ };
26
+ }>;
27
+ export type Base64FileInput = {
28
+ id: string;
29
+ data: string;
30
+ mimeType: string;
31
+ }[];
32
+ export type RawFileInput = {
33
+ file: File;
34
+ clientId: string;
35
+ };
36
+ export type FileUploadResponse = {
37
+ success: number;
38
+ failed: number;
39
+ files: FileUrlMapping[];
40
+ };
41
+ export type FileUrlMapping = {
42
+ clientId: string;
43
+ serverId: string;
44
+ url: string;
45
+ };
@@ -0,0 +1,31 @@
1
+ export class APIFiles {
2
+ web;
3
+ constructor(web) {
4
+ this.web = web;
5
+ }
6
+ async uploadBase64Files({ auth, boardId, files, ...rest }) {
7
+ return await this.web.request({
8
+ method: 'POST', auth, ...rest,
9
+ endpoint: `/files/${boardId}/base64`,
10
+ body: files,
11
+ });
12
+ }
13
+ async uploadRawFiles({ auth, boardId, files, ...rest }) {
14
+ const formData = new FormData();
15
+ for (const file of files) {
16
+ formData.append(`file-${file.clientId}`, file.file);
17
+ }
18
+ return await this.web.request({
19
+ method: 'POST', auth, ...rest,
20
+ endpoint: `/files/${boardId}/raw`,
21
+ body: formData,
22
+ });
23
+ }
24
+ async deleteFiles({ auth, boardId, fileIds, ...rest }) {
25
+ return await this.web.request({
26
+ method: 'DELETE', auth, ...rest,
27
+ endpoint: `/files/${boardId}/delete`,
28
+ body: fileIds,
29
+ });
30
+ }
31
+ }
@@ -0,0 +1,120 @@
1
+ import { SingleOutput } from '../external/types';
2
+ import { BoardsManager } from '../core/manager';
3
+ import { WithHeaders } from '../types';
4
+ export declare class APIFlashcards {
5
+ private web;
6
+ constructor(web: BoardsManager);
7
+ getDeck({ auth, groupId, categoryId, boardId, ...rest }: FlashcardsFunctionsInput['getDeck']): Promise<import("..").WebResponse<FlashcardDeckResponse>>;
8
+ initializeDeck({ auth, groupId, categoryId, boardId, ...rest }: FlashcardsFunctionsInput['initializeDeck']): Promise<import("..").WebResponse<string>>;
9
+ destroyDeck({ auth, groupId, categoryId, boardId, ...rest }: FlashcardsFunctionsInput['destroyDeck']): Promise<import("..").WebResponse<string>>;
10
+ createCards({ auth, groupId, categoryId, boardId, body, ...rest }: FlashcardsFunctionsInput['createCards']): Promise<import("..").WebResponse<string>>;
11
+ updateCards({ auth, groupId, categoryId, boardId, body, ...rest }: FlashcardsFunctionsInput['updateCards']): Promise<import("..").WebResponse<string>>;
12
+ deleteCards({ auth, groupId, categoryId, boardId, body, ...rest }: FlashcardsFunctionsInput['deleteCards']): Promise<import("..").WebResponse<string>>;
13
+ overrideCards({ auth, groupId, categoryId, boardId, body, ...rest }: FlashcardsFunctionsInput['overrideCards']): Promise<import("..").WebResponse<string>>;
14
+ updateProgress({ auth, groupId, categoryId, boardId, body, ...rest }: FlashcardsFunctionsInput['updateProgress']): Promise<import("..").WebResponse<string>>;
15
+ resetProgress({ auth, groupId, categoryId, boardId, ...rest }: FlashcardsFunctionsInput['resetProgress']): Promise<import("..").WebResponse<string>>;
16
+ reorderCards({ auth, groupId, categoryId, boardId, body, ...rest }: FlashcardsFunctionsInput['reorderCards']): Promise<import("..").WebResponse<string>>;
17
+ }
18
+ export type FlashcardsFunctionsInput = WithHeaders<{
19
+ getDeck: {
20
+ auth: string;
21
+ groupId: string;
22
+ categoryId: string;
23
+ boardId: string;
24
+ };
25
+ initializeDeck: {
26
+ auth: string;
27
+ groupId: string;
28
+ categoryId: string;
29
+ boardId: string;
30
+ };
31
+ destroyDeck: {
32
+ auth: string;
33
+ groupId: string;
34
+ categoryId: string;
35
+ boardId: string;
36
+ };
37
+ createCards: {
38
+ auth: string;
39
+ groupId: string;
40
+ categoryId: string;
41
+ boardId: string;
42
+ body: CardInput[];
43
+ };
44
+ updateCards: {
45
+ auth: string;
46
+ groupId: string;
47
+ categoryId: string;
48
+ boardId: string;
49
+ body: CardUpdateInput[];
50
+ };
51
+ deleteCards: {
52
+ auth: string;
53
+ groupId: string;
54
+ categoryId: string;
55
+ boardId: string;
56
+ body: string[];
57
+ };
58
+ overrideCards: {
59
+ auth: string;
60
+ groupId: string;
61
+ categoryId: string;
62
+ boardId: string;
63
+ body: CardInput[];
64
+ };
65
+ updateProgress: {
66
+ auth: string;
67
+ groupId: string;
68
+ categoryId: string;
69
+ boardId: string;
70
+ body: ProgressInput;
71
+ };
72
+ resetProgress: {
73
+ auth: string;
74
+ groupId: string;
75
+ categoryId: string;
76
+ boardId: string;
77
+ };
78
+ reorderCards: {
79
+ auth: string;
80
+ groupId: string;
81
+ categoryId: string;
82
+ boardId: string;
83
+ body: string[];
84
+ };
85
+ }>;
86
+ export type CardInput = {
87
+ front: string;
88
+ back: string;
89
+ };
90
+ export type CardUpdateInput = {
91
+ id: string;
92
+ front?: string;
93
+ back?: string;
94
+ };
95
+ export type ProgressInput = {
96
+ currentIndex: number;
97
+ completed?: boolean;
98
+ };
99
+ export type FlashcardDeckResponse = {
100
+ board: SingleOutput;
101
+ deck: {
102
+ id: string;
103
+ createdAt: Date;
104
+ updatedAt: Date;
105
+ };
106
+ cards: FlashcardCard[];
107
+ progress: {
108
+ completed: boolean;
109
+ lastStudied: Date;
110
+ currentIndex: number;
111
+ } | null;
112
+ };
113
+ export type FlashcardCard = {
114
+ id: string;
115
+ front: string;
116
+ back: string;
117
+ index: number;
118
+ createdAt: Date;
119
+ updatedAt: Date;
120
+ };