@excali-boards/boards-api-client 1.1.50 → 1.1.52
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/dist/classes/admin.d.ts +6 -3
- package/dist/classes/admin.js +1 -5
- package/dist/classes/analytics.d.ts +5 -5
- package/dist/classes/analytics.js +1 -5
- package/dist/classes/auth.d.ts +48 -0
- package/dist/classes/auth.js +12 -0
- package/dist/classes/boards.d.ts +26 -8
- package/dist/classes/boards.js +7 -5
- package/dist/classes/calendar.d.ts +6 -6
- package/dist/classes/calendar.js +1 -5
- package/dist/classes/categories.d.ts +25 -7
- package/dist/classes/categories.js +7 -5
- package/dist/classes/files.d.ts +3 -3
- package/dist/classes/files.js +1 -5
- package/dist/classes/flashcards.d.ts +10 -10
- package/dist/classes/flashcards.js +1 -5
- package/dist/classes/groups.d.ts +15 -11
- package/dist/classes/groups.js +1 -5
- package/dist/classes/invites.d.ts +7 -7
- package/dist/classes/invites.js +1 -5
- package/dist/classes/metrics.d.ts +2 -2
- package/dist/classes/metrics.js +1 -5
- package/dist/classes/permissions.d.ts +4 -4
- package/dist/classes/permissions.js +1 -5
- package/dist/classes/sessions.d.ts +6 -5
- package/dist/classes/sessions.js +1 -5
- package/dist/classes/users.d.ts +3 -3
- package/dist/classes/users.js +1 -5
- package/dist/classes/utils.d.ts +1 -1
- package/dist/classes/utils.js +1 -5
- package/dist/core/manager.d.ts +3 -1
- package/dist/core/manager.js +35 -40
- package/dist/core/utils.js +4 -10
- package/dist/external/types.d.ts +11 -0
- package/dist/external/types.js +2 -5
- package/dist/external/vars.js +15 -18
- package/dist/index.d.ts +1 -0
- package/dist/index.js +20 -35
- package/dist/src/classes/admin.d.ts +23 -0
- package/dist/src/classes/admin.js +20 -0
- package/dist/src/classes/analytics.d.ts +62 -0
- package/dist/src/classes/analytics.js +38 -0
- package/dist/src/classes/auth.d.ts +48 -0
- package/dist/src/classes/auth.js +12 -0
- package/dist/src/classes/boards.d.ts +99 -0
- package/dist/src/classes/boards.js +62 -0
- package/dist/src/classes/calendar.d.ts +84 -0
- package/dist/src/classes/calendar.js +45 -0
- package/dist/src/classes/categories.d.ts +75 -0
- package/dist/src/classes/categories.js +50 -0
- package/dist/src/classes/files.d.ts +45 -0
- package/dist/src/classes/files.js +31 -0
- package/dist/src/classes/flashcards.d.ts +120 -0
- package/dist/src/classes/flashcards.js +68 -0
- package/dist/src/classes/groups.d.ts +80 -0
- package/dist/src/classes/groups.js +62 -0
- package/dist/src/classes/invites.d.ts +116 -0
- package/dist/src/classes/invites.js +50 -0
- package/dist/src/classes/metrics.d.ts +31 -0
- package/dist/src/classes/metrics.js +20 -0
- package/dist/src/classes/permissions.d.ts +48 -0
- package/dist/src/classes/permissions.js +32 -0
- package/dist/src/classes/sessions.d.ts +61 -0
- package/dist/src/classes/sessions.js +38 -0
- package/dist/src/classes/users.d.ts +37 -0
- package/dist/src/classes/users.js +26 -0
- package/dist/src/classes/utils.d.ts +19 -0
- package/dist/src/classes/utils.js +16 -0
- package/dist/src/core/manager.d.ts +44 -0
- package/dist/src/core/manager.js +92 -0
- package/dist/src/core/utils.d.ts +9 -0
- package/dist/src/core/utils.js +52 -0
- package/dist/src/external/types.d.ts +87 -0
- package/dist/src/external/types.js +4 -0
- package/dist/src/external/vars.d.ts +99 -0
- package/dist/src/external/vars.js +65 -0
- package/dist/src/index.d.ts +20 -0
- package/dist/src/index.js +20 -0
- package/dist/src/types.d.ts +61 -0
- package/dist/src/types.js +1 -0
- package/dist/types.js +1 -2
- package/package.json +2 -2
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Data.
|
|
2
|
+
export class APIFlashcards {
|
|
3
|
+
web;
|
|
4
|
+
constructor(web) {
|
|
5
|
+
this.web = web;
|
|
6
|
+
}
|
|
7
|
+
// Methods.
|
|
8
|
+
async getDeck({ auth, groupId, categoryId, boardId, ...rest }) {
|
|
9
|
+
return await this.web.request({
|
|
10
|
+
method: 'GET', auth, ...rest,
|
|
11
|
+
endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/flashcards`),
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
async initializeDeck({ auth, groupId, categoryId, boardId, ...rest }) {
|
|
15
|
+
return await this.web.request({
|
|
16
|
+
method: 'POST', auth, ...rest,
|
|
17
|
+
endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/flashcards/initialize`),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
async destroyDeck({ auth, groupId, categoryId, boardId, ...rest }) {
|
|
21
|
+
return await this.web.request({
|
|
22
|
+
method: 'POST', auth, ...rest,
|
|
23
|
+
endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/flashcards/destroy`),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
async createCards({ auth, groupId, categoryId, boardId, body, ...rest }) {
|
|
27
|
+
return await this.web.request({
|
|
28
|
+
method: 'POST', auth, body, ...rest,
|
|
29
|
+
endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/flashcards`),
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
async updateCards({ auth, groupId, categoryId, boardId, body, ...rest }) {
|
|
33
|
+
return await this.web.request({
|
|
34
|
+
method: 'PATCH', auth, body, ...rest,
|
|
35
|
+
endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/flashcards`),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
async deleteCards({ auth, groupId, categoryId, boardId, body, ...rest }) {
|
|
39
|
+
return await this.web.request({
|
|
40
|
+
method: 'DELETE', auth, body, ...rest,
|
|
41
|
+
endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/flashcards`),
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
async overrideCards({ auth, groupId, categoryId, boardId, body, ...rest }) {
|
|
45
|
+
return await this.web.request({
|
|
46
|
+
method: 'PUT', auth, body, ...rest,
|
|
47
|
+
endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/flashcards/override`),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
async updateProgress({ auth, groupId, categoryId, boardId, body, ...rest }) {
|
|
51
|
+
return await this.web.request({
|
|
52
|
+
method: 'PATCH', auth, body, ...rest,
|
|
53
|
+
endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/flashcards/progress`),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
async resetProgress({ auth, groupId, categoryId, boardId, ...rest }) {
|
|
57
|
+
return await this.web.request({
|
|
58
|
+
method: 'DELETE', auth, ...rest,
|
|
59
|
+
endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/flashcards/progress`),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
async reorderCards({ auth, groupId, categoryId, boardId, body, ...rest }) {
|
|
63
|
+
return await this.web.request({
|
|
64
|
+
method: 'PUT', auth, body, ...rest,
|
|
65
|
+
endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/flashcards/reorder`),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|