@excali-boards/boards-api-client 1.1.51 → 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.
Files changed (83) hide show
  1. package/dist/classes/admin.d.ts +6 -3
  2. package/dist/classes/admin.js +1 -5
  3. package/dist/classes/analytics.d.ts +5 -5
  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 +9 -9
  8. package/dist/classes/boards.js +1 -5
  9. package/dist/classes/calendar.d.ts +6 -6
  10. package/dist/classes/calendar.js +1 -5
  11. package/dist/classes/categories.d.ts +10 -8
  12. package/dist/classes/categories.js +1 -5
  13. package/dist/classes/files.d.ts +3 -3
  14. package/dist/classes/files.js +1 -5
  15. package/dist/classes/flashcards.d.ts +10 -10
  16. package/dist/classes/flashcards.js +1 -5
  17. package/dist/classes/groups.d.ts +15 -11
  18. package/dist/classes/groups.js +1 -5
  19. package/dist/classes/invites.d.ts +7 -7
  20. package/dist/classes/invites.js +1 -5
  21. package/dist/classes/metrics.d.ts +2 -2
  22. package/dist/classes/metrics.js +1 -5
  23. package/dist/classes/permissions.d.ts +4 -4
  24. package/dist/classes/permissions.js +1 -5
  25. package/dist/classes/sessions.d.ts +6 -5
  26. package/dist/classes/sessions.js +1 -5
  27. package/dist/classes/users.d.ts +3 -3
  28. package/dist/classes/users.js +1 -5
  29. package/dist/classes/utils.d.ts +1 -1
  30. package/dist/classes/utils.js +1 -5
  31. package/dist/core/manager.d.ts +3 -1
  32. package/dist/core/manager.js +35 -40
  33. package/dist/core/utils.js +4 -10
  34. package/dist/external/types.d.ts +11 -0
  35. package/dist/external/types.js +2 -5
  36. package/dist/external/vars.js +15 -18
  37. package/dist/index.d.ts +1 -0
  38. package/dist/index.js +20 -35
  39. package/dist/src/classes/admin.d.ts +23 -0
  40. package/dist/src/classes/admin.js +20 -0
  41. package/dist/src/classes/analytics.d.ts +62 -0
  42. package/dist/src/classes/analytics.js +38 -0
  43. package/dist/src/classes/auth.d.ts +48 -0
  44. package/dist/src/classes/auth.js +12 -0
  45. package/dist/src/classes/boards.d.ts +99 -0
  46. package/dist/src/classes/boards.js +62 -0
  47. package/dist/src/classes/calendar.d.ts +84 -0
  48. package/dist/src/classes/calendar.js +45 -0
  49. package/dist/src/classes/categories.d.ts +75 -0
  50. package/dist/src/classes/categories.js +50 -0
  51. package/dist/src/classes/files.d.ts +45 -0
  52. package/dist/src/classes/files.js +31 -0
  53. package/dist/src/classes/flashcards.d.ts +120 -0
  54. package/dist/src/classes/flashcards.js +68 -0
  55. package/dist/src/classes/groups.d.ts +80 -0
  56. package/dist/src/classes/groups.js +62 -0
  57. package/dist/src/classes/invites.d.ts +116 -0
  58. package/dist/src/classes/invites.js +50 -0
  59. package/dist/src/classes/metrics.d.ts +31 -0
  60. package/dist/src/classes/metrics.js +20 -0
  61. package/dist/src/classes/permissions.d.ts +48 -0
  62. package/dist/src/classes/permissions.js +32 -0
  63. package/dist/src/classes/sessions.d.ts +61 -0
  64. package/dist/src/classes/sessions.js +38 -0
  65. package/dist/src/classes/users.d.ts +37 -0
  66. package/dist/src/classes/users.js +26 -0
  67. package/dist/src/classes/utils.d.ts +19 -0
  68. package/dist/src/classes/utils.js +16 -0
  69. package/dist/src/core/manager.d.ts +44 -0
  70. package/dist/src/core/manager.js +92 -0
  71. package/dist/src/core/utils.d.ts +9 -0
  72. package/dist/src/core/utils.js +52 -0
  73. package/dist/src/external/types.d.ts +87 -0
  74. package/dist/src/external/types.js +4 -0
  75. package/dist/src/external/vars.d.ts +99 -0
  76. package/dist/src/external/vars.js +65 -0
  77. package/dist/src/index.d.ts +20 -0
  78. package/dist/src/index.js +20 -0
  79. package/dist/src/types.d.ts +61 -0
  80. package/dist/src/types.js +1 -0
  81. package/dist/types.js +1 -2
  82. package/package.json +2 -2
  83. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -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
+ }
@@ -0,0 +1,80 @@
1
+ import { NameInput, SingleOutput } from '../external/types';
2
+ import { BoardsManager } from '../core/manager';
3
+ import { WithHeaders } from '../types';
4
+ export declare class APIGroups {
5
+ private web;
6
+ constructor(web: BoardsManager);
7
+ getAllSorted({ auth, ...rest }: GroupsFunctionsInput['getAllSorted']): Promise<import("..").WebResponse<GetAllSortedOutput>>;
8
+ getGroups({ auth, ...rest }: GroupsFunctionsInput['getGroups']): Promise<import("..").WebResponse<GetGroupsOutput>>;
9
+ getGroup({ auth, groupId, ...rest }: GroupsFunctionsInput['getGroup']): Promise<import("..").WebResponse<GetGroupOutput>>;
10
+ createGroup({ auth, body, ...rest }: GroupsFunctionsInput['createGroup']): Promise<import("..").WebResponse<string>>;
11
+ createCategoryInGroup({ auth, groupId, body, ...rest }: GroupsFunctionsInput['createCategoryInGroup']): Promise<import("..").WebResponse<string>>;
12
+ updateGroup({ auth, groupId, body, ...rest }: GroupsFunctionsInput['updateGroup']): Promise<import("..").WebResponse<string>>;
13
+ reorderGroups({ auth, body, ...rest }: GroupsFunctionsInput['reorderGroups']): Promise<import("..").WebResponse<string>>;
14
+ reorderCategoriesInGroup({ auth, groupId, body, ...rest }: GroupsFunctionsInput['reorderCategoriesInGroup']): Promise<import("..").WebResponse<string>>;
15
+ deleteGroup({ auth, groupId, ...rest }: GroupsFunctionsInput['deleteGroup']): Promise<import("..").WebResponse<string>>;
16
+ }
17
+ export type GroupsFunctionsInput = WithHeaders<{
18
+ 'getAllSorted': {
19
+ auth: string;
20
+ };
21
+ 'getGroups': {
22
+ auth: string;
23
+ };
24
+ 'getGroup': {
25
+ auth: string;
26
+ groupId: string;
27
+ };
28
+ 'createGroup': {
29
+ auth: string;
30
+ body: NameInput & {
31
+ copyPermissionsFromGroupId?: string;
32
+ };
33
+ };
34
+ 'createCategoryInGroup': {
35
+ auth: string;
36
+ groupId: string;
37
+ body: NameInput & {
38
+ copyPermissionsFromCategoryId?: string;
39
+ };
40
+ };
41
+ 'updateGroup': {
42
+ auth: string;
43
+ groupId: string;
44
+ body: NameInput;
45
+ };
46
+ 'reorderGroups': {
47
+ auth: string;
48
+ body: string[];
49
+ };
50
+ 'reorderCategoriesInGroup': {
51
+ auth: string;
52
+ groupId: string;
53
+ body: string[];
54
+ };
55
+ 'deleteGroup': {
56
+ auth: string;
57
+ groupId: string;
58
+ };
59
+ }>;
60
+ export type GetGroupsOutput = (SingleOutput & {
61
+ categories: number;
62
+ isDefault: boolean;
63
+ sizeBytes: number;
64
+ })[];
65
+ export type GetGroupOutput = {
66
+ group: SingleOutput;
67
+ categories: (SingleOutput & {
68
+ boards: number;
69
+ totalSizeBytes: number;
70
+ })[];
71
+ };
72
+ export type GetAllSortedOutput = (SingleOutput & {
73
+ categories: (SingleOutput & {
74
+ boards: (SingleOutput & {
75
+ hasFlashcards: boolean;
76
+ totalSizeBytes: number;
77
+ scheduledForDeletion: Date | null;
78
+ })[];
79
+ })[];
80
+ })[];