@excali-boards/boards-api-client 1.1.1-dev.6 → 1.1.1-dev.7

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.
@@ -1,18 +1,35 @@
1
+ import { BulkViewPermissionsQuery, ViewPermissionsQuery } from './permissions';
1
2
  import { BoardRole, CategoryRole, GroupRole } from '../external/vars';
2
3
  import { GrantedRoles } from '../external/types';
4
+ import { Invite } from '../../prisma/generated';
3
5
  import { BoardsManager } from '../core/manager';
4
6
  export declare class APIInvites {
5
7
  private web;
6
8
  constructor(web: BoardsManager);
7
- getInvites({ auth }: InvitesFunctionsInput['getInvites']): Promise<import("..").WebResponse<GetInvitesOutput>>;
9
+ getUserInvites({ auth }: InvitesFunctionsInput['getUserInvites']): Promise<import("..").WebResponse<GetUserInvitesOutput>>;
10
+ getResourceInvites({ auth, query }: InvitesFunctionsInput['getResourceInvites']): Promise<import("..").WebResponse<GetResourceInvitesOutput>>;
11
+ bulkGetResourceInvites({ auth, query }: InvitesFunctionsInput['bulkGetResourceInvites']): Promise<import("..").WebResponse<GetResourceInvitesOutput>>;
12
+ getInviteDetails({ auth, code }: InvitesFunctionsInput['getInviteDetails']): Promise<import("..").WebResponse<InviteDetails>>;
8
13
  createInvite({ auth, body }: InvitesFunctionsInput['createInvite']): Promise<import("..").WebResponse<CreateInviteOutput>>;
9
14
  useInvite({ auth, code }: InvitesFunctionsInput['useInvite']): Promise<import("..").WebResponse<UseInviteOutput>>;
10
15
  revokeInvite({ auth, code }: InvitesFunctionsInput['revokeInvite']): Promise<import("..").WebResponse<string>>;
11
16
  }
12
17
  export type InvitesFunctionsInput = {
13
- 'getInvites': {
18
+ 'getUserInvites': {
14
19
  auth: string;
15
20
  };
21
+ 'getResourceInvites': {
22
+ auth: string;
23
+ query: ViewPermissionsQuery;
24
+ };
25
+ 'bulkGetResourceInvites': {
26
+ auth: string;
27
+ query: BulkViewPermissionsQuery;
28
+ };
29
+ 'getInviteDetails': {
30
+ auth: string;
31
+ code: string;
32
+ };
16
33
  'createInvite': {
17
34
  auth: string;
18
35
  body: CreateInviteInput;
@@ -41,21 +58,8 @@ export type CreateInviteOutput = {
41
58
  expiresAt: string;
42
59
  maxUses: number;
43
60
  };
44
- export type GetInvitesOutput = {
45
- dbId: string;
46
- code: string;
47
- createdBy: string;
48
- expiresAt: string | null;
49
- maxUses: number | null;
50
- currentUses: number;
51
- groupIds: string[];
52
- categoryIds: string[];
53
- boardIds: string[];
54
- groupRole: GroupRole | null;
55
- categoryRole: CategoryRole | null;
56
- boardRole: BoardRole | null;
57
- createdAt: string;
58
- }[];
61
+ export type GetUserInvitesOutput = Invite[];
62
+ export type GetResourceInvitesOutput = InviteData[];
59
63
  export type UseInviteOutput = {
60
64
  granted: GrantedRoles;
61
65
  details: {
@@ -75,3 +79,20 @@ export type UseInviteOutput = {
75
79
  }[];
76
80
  };
77
81
  };
82
+ export type InviteDetails = Pick<Invite, 'code' | 'expiresAt' | 'maxUses' | 'currentUses'>;
83
+ export type InviteData = Pick<Invite, 'code' | 'expiresAt' | 'maxUses' | 'currentUses' | 'boardRole' | 'categoryRole' | 'groupRole'> & {
84
+ groups: {
85
+ groupId: string;
86
+ name: string;
87
+ }[];
88
+ categories: {
89
+ categoryId: string;
90
+ name: string;
91
+ groupId: string;
92
+ }[];
93
+ boards: {
94
+ boardId: string;
95
+ name: string;
96
+ categoryId: string;
97
+ }[];
98
+ };
@@ -8,12 +8,30 @@ class APIInvites {
8
8
  this.web = web;
9
9
  }
10
10
  // Methods.
11
- async getInvites({ auth }) {
11
+ async getUserInvites({ auth }) {
12
12
  return await this.web.request({
13
13
  method: 'GET', auth,
14
14
  endpoint: this.web.qp('/invites'),
15
15
  });
16
16
  }
17
+ async getResourceInvites({ auth, query }) {
18
+ return await this.web.request({
19
+ method: 'GET', auth,
20
+ endpoint: this.web.qp('/invites/view', query),
21
+ });
22
+ }
23
+ async bulkGetResourceInvites({ auth, query }) {
24
+ return await this.web.request({
25
+ method: 'GET', auth,
26
+ endpoint: this.web.qp('/invites/view-bulk', query),
27
+ });
28
+ }
29
+ async getInviteDetails({ auth, code }) {
30
+ return await this.web.request({
31
+ method: 'GET', auth,
32
+ endpoint: this.web.qp(`/invites/${code}`),
33
+ });
34
+ }
17
35
  async createInvite({ auth, body }) {
18
36
  return await this.web.request({
19
37
  method: 'POST', auth, body,
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.1-dev.6",
2
+ "version": "1.1.1-dev.7",
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",