@excali-boards/boards-api-client 1.1.34 → 1.1.36

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/README.md CHANGED
@@ -6,7 +6,7 @@ A comprehensive TypeScript client library for the [Boards Room API](https://gith
6
6
 
7
7
  ## Features
8
8
 
9
- - Fully typed REST client (boards, users, permissions, files, sessions, categories, flashcards, metrics, invites)
9
+ - Fully typed REST client (boards, users, permissions, files, sessions, categories, flashcards, codesnippets, metrics, invites)
10
10
  - WebSocket client with auto-reconnect, heartbeat, and message queueing
11
11
  - React hooks: generic `useWebSocket` and `useExecutor` for code execution streams
12
12
  - Zero-config defaults; override `baseUrl` when needed
@@ -65,6 +65,7 @@ export type GetBoardOutput = {
65
65
  type: BoardType;
66
66
  dataUrl: string;
67
67
  hasFlashcards: boolean;
68
+ hasCodeSnippets: boolean;
68
69
  totalSizeBytes: number;
69
70
  accessLevel: AccessLevel;
70
71
  scheduledForDeletion: Date | null;
@@ -0,0 +1,93 @@
1
+ import { AccessLevel } from '../external/types';
2
+ import { BoardsManager } from '../core/manager';
3
+ export declare class APICodeSnippets {
4
+ private web;
5
+ constructor(web: BoardsManager);
6
+ getCollection({ auth, groupId, categoryId, boardId }: CodeSnippetsFunctionsInput['getCollection']): Promise<import("..").WebResponse<CodeSnippetCollectionResponse>>;
7
+ initializeCollection({ auth, groupId, categoryId, boardId }: CodeSnippetsFunctionsInput['initializeCollection']): Promise<import("..").WebResponse<string>>;
8
+ destroyCollection({ auth, groupId, categoryId, boardId }: CodeSnippetsFunctionsInput['destroyCollection']): Promise<import("..").WebResponse<string>>;
9
+ createSnippets({ auth, groupId, categoryId, boardId, body }: CodeSnippetsFunctionsInput['createSnippets']): Promise<import("..").WebResponse<string>>;
10
+ updateSnippets({ auth, groupId, categoryId, boardId, body }: CodeSnippetsFunctionsInput['updateSnippets']): Promise<import("..").WebResponse<string>>;
11
+ deleteSnippets({ auth, groupId, categoryId, boardId, body }: CodeSnippetsFunctionsInput['deleteSnippets']): Promise<import("..").WebResponse<string>>;
12
+ reorderSnippets({ auth, groupId, categoryId, boardId, body }: CodeSnippetsFunctionsInput['reorderSnippets']): Promise<import("..").WebResponse<string>>;
13
+ }
14
+ export type CodeSnippetsFunctionsInput = {
15
+ getCollection: {
16
+ auth: string;
17
+ groupId: string;
18
+ categoryId: string;
19
+ boardId: string;
20
+ };
21
+ initializeCollection: {
22
+ auth: string;
23
+ groupId: string;
24
+ categoryId: string;
25
+ boardId: string;
26
+ };
27
+ destroyCollection: {
28
+ auth: string;
29
+ groupId: string;
30
+ categoryId: string;
31
+ boardId: string;
32
+ };
33
+ createSnippets: {
34
+ auth: string;
35
+ groupId: string;
36
+ categoryId: string;
37
+ boardId: string;
38
+ body: CodeSnippetInput[];
39
+ };
40
+ updateSnippets: {
41
+ auth: string;
42
+ groupId: string;
43
+ categoryId: string;
44
+ boardId: string;
45
+ body: CodeSnippetUpdateInput[];
46
+ };
47
+ deleteSnippets: {
48
+ auth: string;
49
+ groupId: string;
50
+ categoryId: string;
51
+ boardId: string;
52
+ body: string[];
53
+ };
54
+ reorderSnippets: {
55
+ auth: string;
56
+ groupId: string;
57
+ categoryId: string;
58
+ boardId: string;
59
+ body: string[];
60
+ };
61
+ };
62
+ export type CodeSnippetInput = {
63
+ title: string;
64
+ description?: string;
65
+ code: string;
66
+ language?: string;
67
+ };
68
+ export type CodeSnippetUpdateInput = CodeSnippetInput & {
69
+ id: string;
70
+ };
71
+ export type CodeSnippetCollectionResponse = {
72
+ board: {
73
+ id: string;
74
+ name: string;
75
+ accessLevel: AccessLevel;
76
+ };
77
+ collection: {
78
+ id: string;
79
+ createdAt: Date;
80
+ updatedAt: Date;
81
+ };
82
+ snippets: CodeSnippet[];
83
+ };
84
+ export type CodeSnippet = {
85
+ id: string;
86
+ title: string;
87
+ description: string;
88
+ code: string;
89
+ language: string;
90
+ index: number;
91
+ createdAt: Date;
92
+ updatedAt: Date;
93
+ };
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.APICodeSnippets = void 0;
4
+ // Data.
5
+ class APICodeSnippets {
6
+ web;
7
+ constructor(web) {
8
+ this.web = web;
9
+ }
10
+ // Methods.
11
+ async getCollection({ 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}/codesnippets`),
15
+ });
16
+ }
17
+ async initializeCollection({ auth, groupId, categoryId, boardId }) {
18
+ return await this.web.request({
19
+ method: 'POST', auth,
20
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/codesnippets/initialize`),
21
+ });
22
+ }
23
+ async destroyCollection({ auth, groupId, categoryId, boardId }) {
24
+ return await this.web.request({
25
+ method: 'POST', auth,
26
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/codesnippets/destroy`),
27
+ });
28
+ }
29
+ async createSnippets({ auth, groupId, categoryId, boardId, body }) {
30
+ return await this.web.request({
31
+ method: 'POST', auth, body,
32
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/codesnippets`),
33
+ });
34
+ }
35
+ async updateSnippets({ auth, groupId, categoryId, boardId, body }) {
36
+ return await this.web.request({
37
+ method: 'PATCH', auth, body,
38
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/codesnippets`),
39
+ });
40
+ }
41
+ async deleteSnippets({ auth, groupId, categoryId, boardId, body }) {
42
+ return await this.web.request({
43
+ method: 'DELETE', auth, body,
44
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/codesnippets`),
45
+ });
46
+ }
47
+ async reorderSnippets({ auth, groupId, categoryId, boardId, body }) {
48
+ return await this.web.request({
49
+ method: 'POST', auth, body,
50
+ endpoint: this.web.qp(`/groups/${groupId}/categories/${categoryId}/boards/${boardId}/codesnippets/reorder`),
51
+ });
52
+ }
53
+ }
54
+ exports.APICodeSnippets = APICodeSnippets;
@@ -68,6 +68,7 @@ export type GetAllSortedOutput = (SingleOutput & {
68
68
  categories: (SingleOutput & {
69
69
  boards: (SingleOutput & {
70
70
  hasFlashcards: boolean;
71
+ hasCodeSnippets: boolean;
71
72
  totalSizeBytes: number;
72
73
  scheduledForDeletion: Date | null;
73
74
  })[];
@@ -1,4 +1,5 @@
1
1
  import { PaginatedWebResponse, RequestMethod, WebResponse } from '../types';
2
+ import { APICodeSnippets } from '../classes/codesnippets';
2
3
  import { AxiosResponse } from 'axios';
3
4
  import { APIPermissions } from '../classes/permissions';
4
5
  import { APIFlashcards } from '../classes/flashcards';
@@ -15,6 +16,7 @@ import { APIFiles } from '../classes/files';
15
16
  import { APIAdmin } from '../classes/admin';
16
17
  export declare class BoardsManager {
17
18
  url: string;
19
+ readonly codeSnippets: APICodeSnippets;
18
20
  readonly permissions: APIPermissions;
19
21
  readonly categories: APICategories;
20
22
  readonly flashcards: APIFlashcards;
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.BoardsManager = void 0;
7
+ const codesnippets_1 = require("../classes/codesnippets");
7
8
  const axios_1 = __importDefault(require("axios"));
8
9
  const permissions_1 = require("../classes/permissions");
9
10
  const flashcards_1 = require("../classes/flashcards");
@@ -21,6 +22,7 @@ const admin_1 = require("../classes/admin");
21
22
  const utils_2 = require("./utils");
22
23
  class BoardsManager {
23
24
  url;
25
+ codeSnippets = new codesnippets_1.APICodeSnippets(this);
24
26
  permissions = new permissions_1.APIPermissions(this);
25
27
  categories = new categories_1.APICategories(this);
26
28
  flashcards = new flashcards_1.APIFlashcards(this);
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from './external/vars';
5
5
  export * from './websocket/manager';
6
6
  export * from './websocket/client';
7
7
  export * from './websocket/types';
8
+ export * from './classes/codesnippets';
8
9
  export * from './classes/permissions';
9
10
  export * from './classes/categories';
10
11
  export * from './classes/flashcards';
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ __exportStar(require("./external/vars"), exports);
21
21
  __exportStar(require("./websocket/manager"), exports);
22
22
  __exportStar(require("./websocket/client"), exports);
23
23
  __exportStar(require("./websocket/types"), exports);
24
+ __exportStar(require("./classes/codesnippets"), exports);
24
25
  __exportStar(require("./classes/permissions"), exports);
25
26
  __exportStar(require("./classes/categories"), exports);
26
27
  __exportStar(require("./classes/flashcards"), 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/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","../src/websocket/client.ts","../src/websocket/manager.ts","../src/websocket/types.ts","../src/websocket/hooks/useExecutor.ts","../src/websocket/hooks/useWebSocket.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/codesnippets.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","../src/websocket/client.ts","../src/websocket/manager.ts","../src/websocket/types.ts","../src/websocket/hooks/useExecutor.ts","../src/websocket/hooks/useWebSocket.ts"],"version":"5.9.2"}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.34",
2
+ "version": "1.1.36",
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",