@excali-boards/boards-api-client 1.1.23 → 1.1.24

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.
@@ -63,6 +63,7 @@ export type GetBoardOutput = {
63
63
  board: SingleOutput & {
64
64
  type: BoardType;
65
65
  dataUrl: string;
66
+ hasFlashcards: boolean;
66
67
  totalSizeBytes: number;
67
68
  accessLevel: AccessLevel;
68
69
  scheduledForDeletion: Date | null;
@@ -0,0 +1,105 @@
1
+ import { SingleOutput } from 'src/external/types';
2
+ import { BoardsManager } from '../core/manager';
3
+ export declare class APIFlashcards {
4
+ private web;
5
+ constructor(web: BoardsManager);
6
+ getDeck({ auth, groupId, categoryId, boardId }: FlashcardsFunctionsInput['getDeck']): Promise<import("..").WebResponse<FlashcardDeckResponse>>;
7
+ createCards({ auth, groupId, categoryId, boardId, body }: FlashcardsFunctionsInput['createCards']): Promise<import("..").WebResponse<string>>;
8
+ updateCards({ auth, groupId, categoryId, boardId, body }: FlashcardsFunctionsInput['updateCards']): Promise<import("..").WebResponse<string>>;
9
+ deleteCards({ auth, groupId, categoryId, boardId, body }: FlashcardsFunctionsInput['deleteCards']): Promise<import("..").WebResponse<string>>;
10
+ overrideCards({ auth, groupId, categoryId, boardId, body }: FlashcardsFunctionsInput['overrideCards']): Promise<import("..").WebResponse<string>>;
11
+ updateProgress({ auth, groupId, categoryId, boardId, body }: FlashcardsFunctionsInput['updateProgress']): Promise<import("..").WebResponse<string>>;
12
+ resetProgress({ auth, groupId, categoryId, boardId }: FlashcardsFunctionsInput['resetProgress']): Promise<import("..").WebResponse<string>>;
13
+ reorderCards({ auth, groupId, categoryId, boardId, body }: FlashcardsFunctionsInput['reorderCards']): Promise<import("..").WebResponse<string>>;
14
+ }
15
+ export type FlashcardsFunctionsInput = {
16
+ getDeck: {
17
+ auth: string;
18
+ groupId: string;
19
+ categoryId: string;
20
+ boardId: string;
21
+ };
22
+ createCards: {
23
+ auth: string;
24
+ groupId: string;
25
+ categoryId: string;
26
+ boardId: string;
27
+ body: CardInput[];
28
+ };
29
+ updateCards: {
30
+ auth: string;
31
+ groupId: string;
32
+ categoryId: string;
33
+ boardId: string;
34
+ body: CardUpdateInput[];
35
+ };
36
+ deleteCards: {
37
+ auth: string;
38
+ groupId: string;
39
+ categoryId: string;
40
+ boardId: string;
41
+ body: string[];
42
+ };
43
+ overrideCards: {
44
+ auth: string;
45
+ groupId: string;
46
+ categoryId: string;
47
+ boardId: string;
48
+ body: CardInput[];
49
+ };
50
+ updateProgress: {
51
+ auth: string;
52
+ groupId: string;
53
+ categoryId: string;
54
+ boardId: string;
55
+ body: ProgressInput;
56
+ };
57
+ resetProgress: {
58
+ auth: string;
59
+ groupId: string;
60
+ categoryId: string;
61
+ boardId: string;
62
+ };
63
+ reorderCards: {
64
+ auth: string;
65
+ groupId: string;
66
+ categoryId: string;
67
+ boardId: string;
68
+ body: string[];
69
+ };
70
+ };
71
+ export type CardInput = {
72
+ front: string;
73
+ back: string;
74
+ };
75
+ export type CardUpdateInput = {
76
+ id: string;
77
+ front?: string;
78
+ back?: string;
79
+ };
80
+ export type ProgressInput = {
81
+ currentIndex: number;
82
+ completed?: boolean;
83
+ };
84
+ export type FlashcardDeckResponse = {
85
+ board: SingleOutput;
86
+ deck: {
87
+ id: string;
88
+ createdAt: Date;
89
+ updatedAt: Date;
90
+ };
91
+ cards: FlashcardCard[];
92
+ progress: {
93
+ completed: boolean;
94
+ lastStudied: Date;
95
+ currentIndex: number;
96
+ } | null;
97
+ };
98
+ export type FlashcardCard = {
99
+ id: string;
100
+ front: string;
101
+ back: string;
102
+ index: number;
103
+ createdAt: Date;
104
+ updatedAt: Date;
105
+ };
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.APIFlashcards = void 0;
4
+ // Data.
5
+ class APIFlashcards {
6
+ web;
7
+ constructor(web) {
8
+ this.web = web;
9
+ }
10
+ // Methods.
11
+ async getDeck({ auth, groupId, categoryId, boardId }) {
12
+ return await this.web.request({
13
+ method: 'GET', auth,
14
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/flashcards`),
15
+ });
16
+ }
17
+ async createCards({ auth, groupId, categoryId, boardId, body }) {
18
+ return await this.web.request({
19
+ method: 'POST', auth, body,
20
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/flashcards`),
21
+ });
22
+ }
23
+ async updateCards({ auth, groupId, categoryId, boardId, body }) {
24
+ return await this.web.request({
25
+ method: 'PATCH', auth, body,
26
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/flashcards`),
27
+ });
28
+ }
29
+ async deleteCards({ auth, groupId, categoryId, boardId, body }) {
30
+ return await this.web.request({
31
+ method: 'DELETE', auth, body,
32
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/flashcards`),
33
+ });
34
+ }
35
+ async overrideCards({ auth, groupId, categoryId, boardId, body }) {
36
+ return await this.web.request({
37
+ method: 'PUT', auth, body,
38
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/flashcards/override`),
39
+ });
40
+ }
41
+ async updateProgress({ auth, groupId, categoryId, boardId, body }) {
42
+ return await this.web.request({
43
+ method: 'PATCH', auth, body,
44
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/flashcards/progress`),
45
+ });
46
+ }
47
+ async resetProgress({ auth, groupId, categoryId, boardId }) {
48
+ return await this.web.request({
49
+ method: 'DELETE', auth,
50
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/flashcards/progress`),
51
+ });
52
+ }
53
+ async reorderCards({ auth, groupId, categoryId, boardId, body }) {
54
+ return await this.web.request({
55
+ method: 'PUT', auth, body,
56
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/flashcards/reorder`),
57
+ });
58
+ }
59
+ }
60
+ exports.APIFlashcards = APIFlashcards;
@@ -67,6 +67,7 @@ export type GetGroupOutput = {
67
67
  export type GetAllSortedOutput = (SingleOutput & {
68
68
  categories: (SingleOutput & {
69
69
  boards: (SingleOutput & {
70
+ hasFlashcards: boolean;
70
71
  totalSizeBytes: number;
71
72
  scheduledForDeletion: Date | null;
72
73
  })[];
@@ -1,6 +1,7 @@
1
1
  import { PaginatedWebResponse, RequestMethod, WebResponse } from '../types';
2
2
  import { AxiosResponse } from 'axios';
3
3
  import { APIPermissions } from '../classes/permissions';
4
+ import { APIFlashcards } from '../classes/flashcards';
4
5
  import { APICategories } from '../classes/categories';
5
6
  import { APISessions } from '../classes/sessions';
6
7
  import { APICalendar } from '../classes/calendar';
@@ -16,6 +17,7 @@ export declare class BoardsManager {
16
17
  url: string;
17
18
  readonly permissions: APIPermissions;
18
19
  readonly categories: APICategories;
20
+ readonly flashcards: APIFlashcards;
19
21
  readonly calendar: APICalendar;
20
22
  readonly sessions: APISessions;
21
23
  readonly invites: APIInvites;
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.BoardsManager = void 0;
7
7
  const axios_1 = __importDefault(require("axios"));
8
8
  const permissions_1 = require("../classes/permissions");
9
+ const flashcards_1 = require("../classes/flashcards");
9
10
  const categories_1 = require("../classes/categories");
10
11
  const sessions_1 = require("../classes/sessions");
11
12
  const calendar_1 = require("../classes/calendar");
@@ -22,6 +23,7 @@ class BoardsManager {
22
23
  url;
23
24
  permissions = new permissions_1.APIPermissions(this);
24
25
  categories = new categories_1.APICategories(this);
26
+ flashcards = new flashcards_1.APIFlashcards(this);
25
27
  calendar = new calendar_1.APICalendar(this);
26
28
  sessions = new sessions_1.APISessions(this);
27
29
  invites = new invites_1.APIInvites(this);
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export * from './external/types';
4
4
  export * from './external/vars';
5
5
  export * from './classes/permissions';
6
6
  export * from './classes/categories';
7
+ export * from './classes/flashcards';
7
8
  export * from './classes/calendar';
8
9
  export * from './classes/sessions';
9
10
  export * from './classes/invites';
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ __exportStar(require("./external/types"), exports);
20
20
  __exportStar(require("./external/vars"), exports);
21
21
  __exportStar(require("./classes/permissions"), exports);
22
22
  __exportStar(require("./classes/categories"), exports);
23
+ __exportStar(require("./classes/flashcards"), exports);
23
24
  __exportStar(require("./classes/calendar"), exports);
24
25
  __exportStar(require("./classes/sessions"), exports);
25
26
  __exportStar(require("./classes/invites"), exports);
@@ -1 +1 @@
1
- {"root":["../src/index.ts","../src/types.ts","../src/classes/admin.ts","../src/classes/boards.ts","../src/classes/calendar.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"}
1
+ {"root":["../src/index.ts","../src/types.ts","../src/classes/admin.ts","../src/classes/boards.ts","../src/classes/calendar.ts","../src/classes/categories.ts","../src/classes/files.ts","../src/classes/flashcards.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.23",
2
+ "version": "1.1.24",
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",
@@ -5,7 +5,7 @@ model Group {
5
5
  name String
6
6
  index Int
7
7
 
8
- calCode String
8
+ calCode String?
9
9
  events Event[]
10
10
 
11
11
  categories Category[]
@@ -43,6 +43,8 @@ model Board {
43
43
  categoryId String
44
44
  category Category @relation(fields: [categoryId], references: [categoryId], onDelete: Cascade)
45
45
 
46
+ flashcardDeck FlashcardDeck?
47
+
46
48
  files File[]
47
49
  boardPermission BoardPermission[]
48
50
  }
@@ -0,0 +1,49 @@
1
+ model FlashcardDeck {
2
+ dbId String @id @default(uuid())
3
+ deckId String @unique
4
+
5
+ createdAt DateTime @default(now())
6
+ updatedAt DateTime @updatedAt
7
+
8
+ boardId String @unique
9
+ board Board @relation(fields: [boardId], references: [boardId], onDelete: Cascade)
10
+
11
+ cards FlashcardCard[]
12
+ progress DeckProgress[]
13
+
14
+ @@index([boardId])
15
+ }
16
+
17
+ model FlashcardCard {
18
+ dbId String @id @default(uuid())
19
+ cardId String @unique
20
+
21
+ front String
22
+ back String
23
+ index Int
24
+
25
+ createdAt DateTime @default(now())
26
+ updatedAt DateTime @updatedAt
27
+
28
+ deckId String
29
+ deck FlashcardDeck @relation(fields: [deckId], references: [deckId], onDelete: Cascade)
30
+
31
+ @@index([deckId])
32
+ }
33
+
34
+ model DeckProgress {
35
+ dbId String @id @default(uuid())
36
+
37
+ deckId String
38
+ userId String
39
+
40
+ currentIndex Int @default(0)
41
+ completed Boolean @default(false)
42
+ lastStudied DateTime @default(now())
43
+
44
+ deck FlashcardDeck @relation(fields: [deckId], references: [deckId], onDelete: Cascade)
45
+ user User @relation(fields: [userId], references: [userId], onDelete: Cascade)
46
+
47
+ @@unique([deckId, userId])
48
+ @@index([userId])
49
+ }
@@ -51,8 +51,8 @@ model Invite {
51
51
 
52
52
  code String @unique
53
53
 
54
- // Allow invites to multiple groups, categories, or boards
55
- // If multiple are specified, the invite grants access to all of them
54
+ // Allow invites to multiple groups, categories, or boards.
55
+ // If multiple are specified, the invite grants access to all of them.
56
56
  groupIds String[]
57
57
  groupRole GroupRole?
58
58
 
@@ -15,6 +15,8 @@ model User {
15
15
  categoryPermissions CategoryPermission[]
16
16
  boardPermissions BoardPermission[]
17
17
 
18
+ flashcardProgress DeckProgress[]
19
+
18
20
  sessions Session[]
19
21
  createdEvents Event[]
20
22
  createdInvites Invite[]