@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,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
+ })[];
@@ -0,0 +1,62 @@
1
+ // Data.
2
+ export class APIGroups {
3
+ web;
4
+ constructor(web) {
5
+ this.web = web;
6
+ }
7
+ // Methods.
8
+ async getAllSorted({ auth, ...rest }) {
9
+ return await this.web.request({
10
+ method: 'GET', auth, ...rest,
11
+ endpoint: this.web.qp('/all'),
12
+ });
13
+ }
14
+ async getGroups({ auth, ...rest }) {
15
+ return await this.web.request({
16
+ method: 'GET', auth, ...rest,
17
+ endpoint: this.web.qp('/groups'),
18
+ });
19
+ }
20
+ async getGroup({ auth, groupId, ...rest }) {
21
+ return await this.web.request({
22
+ method: 'GET', auth, ...rest,
23
+ endpoint: this.web.qp(`/groups/${groupId}`),
24
+ });
25
+ }
26
+ async createGroup({ auth, body, ...rest }) {
27
+ return await this.web.request({
28
+ method: 'POST', auth, body, ...rest,
29
+ endpoint: this.web.qp('/groups'),
30
+ });
31
+ }
32
+ async createCategoryInGroup({ auth, groupId, body, ...rest }) {
33
+ return await this.web.request({
34
+ method: 'POST', auth, body, ...rest,
35
+ endpoint: this.web.qp(`/groups/${groupId}/categories`),
36
+ });
37
+ }
38
+ async updateGroup({ auth, groupId, body, ...rest }) {
39
+ return await this.web.request({
40
+ method: 'PATCH', auth, body, ...rest,
41
+ endpoint: this.web.qp(`/groups/${groupId}`),
42
+ });
43
+ }
44
+ async reorderGroups({ auth, body, ...rest }) {
45
+ return await this.web.request({
46
+ method: 'PUT', auth, body, ...rest,
47
+ endpoint: this.web.qp('/groups'),
48
+ });
49
+ }
50
+ async reorderCategoriesInGroup({ auth, groupId, body, ...rest }) {
51
+ return await this.web.request({
52
+ method: 'PUT', auth, body, ...rest,
53
+ endpoint: this.web.qp(`/groups/${groupId}/categories`),
54
+ });
55
+ }
56
+ async deleteGroup({ auth, groupId, ...rest }) {
57
+ return await this.web.request({
58
+ method: 'DELETE', auth, ...rest,
59
+ endpoint: this.web.qp(`/groups/${groupId}`),
60
+ });
61
+ }
62
+ }
@@ -0,0 +1,116 @@
1
+ import { BoardRole, CategoryRole, GroupRole } from '../external/vars';
2
+ import { GrantedRoles, ResourceType } from '../external/types';
3
+ import { Invite } from '../../prisma/generated';
4
+ import { BoardsManager } from '../core/manager';
5
+ import { WithHeaders } from '../types';
6
+ export declare class APIInvites {
7
+ private web;
8
+ constructor(web: BoardsManager);
9
+ getUserInvites({ auth, ...rest }: InvitesFunctionsInput['getUserInvites']): Promise<import("..").WebResponse<GetUserInvitesOutput>>;
10
+ getResourceInvites({ auth, query, ...rest }: InvitesFunctionsInput['getResourceInvites']): Promise<import("..").WebResponse<GetResourceInvitesOutput>>;
11
+ getInviteDetails({ auth, code, ...rest }: InvitesFunctionsInput['getInviteDetails']): Promise<import("..").WebResponse<InviteDetails>>;
12
+ createInvite({ auth, body, ...rest }: InvitesFunctionsInput['createInvite']): Promise<import("..").WebResponse<CreateInviteOutput>>;
13
+ useInvite({ auth, code, ...rest }: InvitesFunctionsInput['useInvite']): Promise<import("..").WebResponse<UseInviteOutput>>;
14
+ renewInvite({ auth, code, ...rest }: InvitesFunctionsInput['renewInvite']): Promise<import("..").WebResponse<RenewInviteOutput>>;
15
+ revokeInvite({ auth, code, ...rest }: InvitesFunctionsInput['revokeInvite']): Promise<import("..").WebResponse<string>>;
16
+ }
17
+ export type InvitesFunctionsInput = WithHeaders<{
18
+ 'getUserInvites': {
19
+ auth: string;
20
+ };
21
+ 'getResourceInvites': {
22
+ auth: string;
23
+ query: ViewInvitesQuery;
24
+ };
25
+ 'getInviteDetails': {
26
+ auth: string;
27
+ code: string;
28
+ };
29
+ 'createInvite': {
30
+ auth: string;
31
+ body: CreateInviteInput;
32
+ };
33
+ 'useInvite': {
34
+ auth: string;
35
+ code: string;
36
+ };
37
+ 'revokeInvite': {
38
+ auth: string;
39
+ code: string;
40
+ };
41
+ 'renewInvite': {
42
+ auth: string;
43
+ code: string;
44
+ };
45
+ }>;
46
+ export type ViewInvitesQuery = {
47
+ type: ResourceType;
48
+ groupId?: string;
49
+ categoryId?: string;
50
+ boardId?: string;
51
+ };
52
+ export type CreateInviteInput = {
53
+ groupIds?: string[];
54
+ categoryIds?: string[];
55
+ boardIds?: string[];
56
+ groupRole?: GroupRole;
57
+ categoryRole?: CategoryRole;
58
+ boardRole?: BoardRole;
59
+ expiresIn?: number;
60
+ maxUses?: number;
61
+ };
62
+ export type CreateInviteOutput = {
63
+ code: string;
64
+ expiresAt: string;
65
+ maxUses: number;
66
+ };
67
+ export type RenewInviteOutput = CreateInviteOutput & {
68
+ currentUses: number;
69
+ };
70
+ export type GetUserInvitesOutput = {
71
+ invites: InviteData[];
72
+ canInvite: boolean;
73
+ };
74
+ export type GetResourceInvitesOutput = InviteData[];
75
+ export type UseInviteOutput = {
76
+ granted: GrantedRoles;
77
+ details: {
78
+ groups: {
79
+ groupId: string;
80
+ name: string;
81
+ }[];
82
+ categories: {
83
+ categoryId: string;
84
+ name: string;
85
+ groupId: string;
86
+ }[];
87
+ boards: {
88
+ boardId: string;
89
+ name: string;
90
+ categoryId: string;
91
+ }[];
92
+ };
93
+ };
94
+ export type InviteDetails = RenewInviteOutput & {
95
+ invitedBy: {
96
+ userId: string;
97
+ displayName: string;
98
+ avatarUrl: string | null;
99
+ };
100
+ };
101
+ export type InviteData = Pick<Invite, 'code' | 'expiresAt' | 'maxUses' | 'currentUses' | 'boardRole' | 'categoryRole' | 'groupRole'> & {
102
+ groups: {
103
+ groupId: string;
104
+ name: string;
105
+ }[];
106
+ categories: {
107
+ categoryId: string;
108
+ name: string;
109
+ groupId: string;
110
+ }[];
111
+ boards: {
112
+ boardId: string;
113
+ name: string;
114
+ categoryId: string;
115
+ }[];
116
+ };
@@ -0,0 +1,50 @@
1
+ // Data.
2
+ export class APIInvites {
3
+ web;
4
+ constructor(web) {
5
+ this.web = web;
6
+ }
7
+ // Methods.
8
+ async getUserInvites({ auth, ...rest }) {
9
+ return await this.web.request({
10
+ method: 'GET', auth, ...rest,
11
+ endpoint: this.web.qp('/invites'),
12
+ });
13
+ }
14
+ async getResourceInvites({ auth, query, ...rest }) {
15
+ return await this.web.request({
16
+ method: 'GET', auth, ...rest,
17
+ endpoint: this.web.qp('/resources/invites', query),
18
+ });
19
+ }
20
+ async getInviteDetails({ auth, code, ...rest }) {
21
+ return await this.web.request({
22
+ method: 'GET', auth, ...rest,
23
+ endpoint: this.web.qp(`/invites/${code}`),
24
+ });
25
+ }
26
+ async createInvite({ auth, body, ...rest }) {
27
+ return await this.web.request({
28
+ method: 'POST', auth, body, ...rest,
29
+ endpoint: this.web.qp('/invites'),
30
+ });
31
+ }
32
+ async useInvite({ auth, code, ...rest }) {
33
+ return await this.web.request({
34
+ method: 'POST', auth, ...rest,
35
+ endpoint: this.web.qp(`/invites/${code}`),
36
+ });
37
+ }
38
+ async renewInvite({ auth, code, ...rest }) {
39
+ return await this.web.request({
40
+ method: 'PATCH', auth, ...rest,
41
+ endpoint: this.web.qp(`/invites/${code}`),
42
+ });
43
+ }
44
+ async revokeInvite({ auth, code, ...rest }) {
45
+ return await this.web.request({
46
+ method: 'DELETE', auth, ...rest,
47
+ endpoint: this.web.qp(`/invites/${code}`),
48
+ });
49
+ }
50
+ }
@@ -0,0 +1,31 @@
1
+ import { BoardsManager } from '../core/manager';
2
+ import { WithHeaders } from '../types';
3
+ export declare class APIMetrics {
4
+ private web;
5
+ constructor(web: BoardsManager);
6
+ getMetrics({ auth, ...rest }: MetricsFunctionsInput['getMetrics']): Promise<import("..").WebResponse<string>>;
7
+ getStatus({ auth, ...rest }: MetricsFunctionsInput['getStatus']): Promise<import("..").WebResponse<SystemStatus>>;
8
+ }
9
+ export type MetricsFunctionsInput = WithHeaders<{
10
+ 'getMetrics': {
11
+ auth: string;
12
+ };
13
+ 'getStatus': {
14
+ auth: string;
15
+ };
16
+ }>;
17
+ export type SystemStatus = {
18
+ cpuUsage: number;
19
+ memoryUsageMb: number;
20
+ uptimeSeconds: number;
21
+ activeRooms: number;
22
+ socketConnections: number;
23
+ queuedFiles: number;
24
+ totalUsers: number;
25
+ totalInvites: number;
26
+ totalBoards: number;
27
+ totalCategories: number;
28
+ totalGroups: number;
29
+ totalFiles: number;
30
+ storageSizeMb: number;
31
+ };
@@ -0,0 +1,20 @@
1
+ // Data.
2
+ export class APIMetrics {
3
+ web;
4
+ constructor(web) {
5
+ this.web = web;
6
+ }
7
+ // Methods.
8
+ async getMetrics({ auth, ...rest }) {
9
+ return await this.web.request({
10
+ method: 'GET', auth, ...rest,
11
+ endpoint: this.web.qp('/metrics'),
12
+ });
13
+ }
14
+ async getStatus({ auth, ...rest }) {
15
+ return await this.web.request({
16
+ method: 'GET', auth, ...rest,
17
+ endpoint: this.web.qp('/status'),
18
+ });
19
+ }
20
+ }
@@ -0,0 +1,48 @@
1
+ import { BoardRole, CategoryRole, GroupRole } from '../external/vars';
2
+ import { PermUser, ResourceType } from '../external/types';
3
+ import { BoardsManager } from '../core/manager';
4
+ import { WithHeaders } from '../types';
5
+ export declare class APIPermissions {
6
+ private web;
7
+ constructor(web: BoardsManager);
8
+ viewPermissions({ auth, query, ...rest }: PermissionsFunctionsInput['viewPermissions']): Promise<import("..").WebResponse<PermUser[]>>;
9
+ viewAllPermissions({ auth, userIds, ...rest }: PermissionsFunctionsInput['viewAllPermissions']): Promise<import("..").WebResponse<Record<string, PermUser>>>;
10
+ grantPermissions({ auth, body, ...rest }: PermissionsFunctionsInput['grantPermissions']): Promise<import("..").WebResponse<string>>;
11
+ revokePermissions({ auth, body, ...rest }: PermissionsFunctionsInput['revokePermissions']): Promise<import("..").WebResponse<string>>;
12
+ }
13
+ export type PermissionsFunctionsInput = WithHeaders<{
14
+ 'viewPermissions': {
15
+ auth: string;
16
+ query: ViewPermissionsQuery;
17
+ };
18
+ 'viewAllPermissions': {
19
+ auth: string;
20
+ userIds: string[];
21
+ };
22
+ 'grantPermissions': {
23
+ auth: string;
24
+ body: GrantPermissionsInput;
25
+ };
26
+ 'revokePermissions': {
27
+ auth: string;
28
+ body: RevokePermissionsInput;
29
+ };
30
+ }>;
31
+ export type ViewPermissionsQuery = {
32
+ type: ResourceType;
33
+ id: string;
34
+ };
35
+ export type GrantPermissionsInput = {
36
+ userId: string;
37
+ groupIds?: string[];
38
+ groupRole?: GroupRole;
39
+ categoryIds?: string[];
40
+ categoryRole?: CategoryRole;
41
+ boardIds?: string[];
42
+ boardRole?: BoardRole;
43
+ };
44
+ export type RevokePermissionsInput = {
45
+ userId: string;
46
+ resourceType: ResourceType;
47
+ resourceId: string;
48
+ };
@@ -0,0 +1,32 @@
1
+ // Data.
2
+ export class APIPermissions {
3
+ web;
4
+ constructor(web) {
5
+ this.web = web;
6
+ }
7
+ // Methods.
8
+ async viewPermissions({ auth, query, ...rest }) {
9
+ return await this.web.request({
10
+ method: 'GET', auth, ...rest,
11
+ endpoint: this.web.qp('/permissions/view', query),
12
+ });
13
+ }
14
+ async viewAllPermissions({ auth, userIds, ...rest }) {
15
+ return await this.web.request({
16
+ method: 'POST', auth, body: { userIds }, ...rest,
17
+ endpoint: this.web.qp('/permissions/view-all'),
18
+ });
19
+ }
20
+ async grantPermissions({ auth, body, ...rest }) {
21
+ return await this.web.request({
22
+ method: 'POST', auth, body, ...rest,
23
+ endpoint: this.web.qp('/permissions/grant'),
24
+ });
25
+ }
26
+ async revokePermissions({ auth, body, ...rest }) {
27
+ return await this.web.request({
28
+ method: 'POST', auth, body, ...rest,
29
+ endpoint: this.web.qp('/permissions/revoke'),
30
+ });
31
+ }
32
+ }
@@ -0,0 +1,61 @@
1
+ import { Device, Platforms } from '../../prisma/generated/default';
2
+ import { BoardsManager } from '../core/manager';
3
+ import { WithHeaders } from '../types';
4
+ export declare class APISessions {
5
+ private web;
6
+ constructor(web: BoardsManager);
7
+ createSession({ auth, body, ...rest }: SessionsFunctionsInput['createSession']): Promise<import("..").WebResponse<CreateSessionOutput>>;
8
+ getAllSessions({ auth, ...rest }: SessionsFunctionsInput['getAllSessions']): Promise<import("..").WebResponse<SessionsOutput>>;
9
+ deleteSession({ auth, dbId, ...rest }: SessionsFunctionsInput['deleteSession']): Promise<import("..").WebResponse<string>>;
10
+ deleteAllSessions({ auth, ...rest }: SessionsFunctionsInput['deleteAllSessions']): Promise<import("..").WebResponse<string>>;
11
+ rotateLinkedSession({ auth, body, ...rest }: SessionsFunctionsInput['rotateLinkedSession']): Promise<import("..").WebResponse<string>>;
12
+ }
13
+ export type SessionsFunctionsInput = WithHeaders<{
14
+ 'createSession': {
15
+ auth: string;
16
+ body: CreateSessionInput;
17
+ };
18
+ 'getAllSessions': {
19
+ auth: string;
20
+ };
21
+ 'deleteSession': {
22
+ auth: string;
23
+ dbId: string;
24
+ };
25
+ 'deleteAllSessions': {
26
+ auth: string;
27
+ };
28
+ 'rotateLinkedSession': {
29
+ auth: string;
30
+ body: UnlinkLoginMethodInput;
31
+ };
32
+ }>;
33
+ export type CreateSessionInput = {
34
+ ip?: string;
35
+ email: string;
36
+ device?: Device;
37
+ platform: Platforms;
38
+ displayName: string;
39
+ avatarUrl?: string | null;
40
+ currentUserId?: string;
41
+ refreshProfile?: boolean;
42
+ };
43
+ export type CreateSessionOutput = {
44
+ token: string;
45
+ expiresAt: Date;
46
+ };
47
+ export type SessionsOutput = {
48
+ activeDbId: string;
49
+ sessions: {
50
+ location: string | null;
51
+ device: Device | null;
52
+ tokenPreview: string;
53
+ dbId: string;
54
+ expiresAt: Date;
55
+ createdAt: Date;
56
+ lastUsed: Date;
57
+ }[];
58
+ };
59
+ export type UnlinkLoginMethodInput = {
60
+ platform: Platforms;
61
+ };
@@ -0,0 +1,38 @@
1
+ // Data.
2
+ export class APISessions {
3
+ web;
4
+ constructor(web) {
5
+ this.web = web;
6
+ }
7
+ // Methods.
8
+ async createSession({ auth, body, ...rest }) {
9
+ return await this.web.request({
10
+ method: 'POST', auth, body, ...rest,
11
+ endpoint: this.web.qp('/sessions'),
12
+ });
13
+ }
14
+ async getAllSessions({ auth, ...rest }) {
15
+ return await this.web.request({
16
+ method: 'GET', auth, ...rest,
17
+ endpoint: this.web.qp('/sessions'),
18
+ });
19
+ }
20
+ async deleteSession({ auth, dbId, ...rest }) {
21
+ return await this.web.request({
22
+ method: 'DELETE', auth, body: { dbId }, ...rest,
23
+ endpoint: this.web.qp('/sessions'),
24
+ });
25
+ }
26
+ async deleteAllSessions({ auth, ...rest }) {
27
+ return await this.web.request({
28
+ method: 'DELETE', auth, ...rest,
29
+ endpoint: this.web.qp('/sessions/all'),
30
+ });
31
+ }
32
+ async rotateLinkedSession({ auth, body, ...rest }) {
33
+ return await this.web.request({
34
+ method: 'POST', auth, body, ...rest,
35
+ endpoint: this.web.qp('/sessions/rotate'),
36
+ });
37
+ }
38
+ }
@@ -0,0 +1,37 @@
1
+ import { Platforms } from '../../prisma/generated/default';
2
+ import { DBUserPartialType } from '../external/vars';
3
+ import { BoardsManager } from '../core/manager';
4
+ import { WithHeaders } from '../types';
5
+ export declare class APIUsers {
6
+ private web;
7
+ constructor(web: BoardsManager);
8
+ getUser({ auth, userId, ...rest }: UsersFunctionsInput['getCurrentUser']): Promise<import("..").WebResponse<GetUsersOutput>>;
9
+ updateUser({ auth, userId, body, ...rest }: UsersFunctionsInput['updateUser']): Promise<import("..").WebResponse<string>>;
10
+ deleteAccount({ auth, userId, ...rest }: UsersFunctionsInput['deleteAccount']): Promise<import("..").WebResponse<void>>;
11
+ }
12
+ export type UsersFunctionsInput = WithHeaders<{
13
+ 'getCurrentUser': {
14
+ auth: string;
15
+ userId?: string;
16
+ };
17
+ 'updateUser': {
18
+ auth: string;
19
+ userId?: string;
20
+ body: UserInput;
21
+ };
22
+ 'deleteAccount': {
23
+ auth: string;
24
+ userId?: string;
25
+ };
26
+ 'isCurrentUserDev': {
27
+ auth: string;
28
+ };
29
+ }>;
30
+ export type GetUsersOutput = DBUserPartialType & {
31
+ isDev: boolean;
32
+ };
33
+ export type UserInput = {
34
+ mainGroupId?: string | null;
35
+ displayName?: string;
36
+ platform?: Platforms;
37
+ };
@@ -0,0 +1,26 @@
1
+ // Data.
2
+ export class APIUsers {
3
+ web;
4
+ constructor(web) {
5
+ this.web = web;
6
+ }
7
+ // Methods.
8
+ async getUser({ auth, userId, ...rest }) {
9
+ return await this.web.request({
10
+ method: 'GET', auth, ...rest,
11
+ endpoint: this.web.qp('/users' + (userId ? `/${userId}` : '')),
12
+ });
13
+ }
14
+ async updateUser({ auth, userId, body, ...rest }) {
15
+ return await this.web.request({
16
+ method: 'PATCH', auth, body, ...rest,
17
+ endpoint: this.web.qp('/users' + (userId ? `/${userId}` : '')),
18
+ });
19
+ }
20
+ async deleteAccount({ auth, userId, ...rest }) {
21
+ return await this.web.request({
22
+ method: 'DELETE', auth, ...rest,
23
+ endpoint: this.web.qp('/users' + (userId ? `/${userId}` : '')),
24
+ });
25
+ }
26
+ }