forked from clerk/javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorganization.ts
More file actions
113 lines (97 loc) · 4.02 KB
/
Copy pathorganization.ts
File metadata and controls
113 lines (97 loc) · 4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import type { OrganizationJSONSnapshot } from 'snapshots';
import type { OrganizationDomainResource, OrganizationEnrollmentMode } from './organizationDomain';
import type { OrganizationInvitationResource, OrganizationInvitationStatus } from './organizationInvitation';
import type { OrganizationCustomRoleKey, OrganizationMembershipResource } from './organizationMembership';
import type { OrganizationMembershipRequestResource } from './organizationMembershipRequest';
import type { ClerkPaginatedResponse, ClerkPaginationParams } from './pagination';
import type { ClerkResource } from './resource';
import type { RoleResource } from './role';
declare global {
/**
* If you want to provide custom types for the organization.publicMetadata object,
* simply redeclare this rule in the global namespace.
* Every organization object will use the provided type.
*/
interface OrganizationPublicMetadata {
[k: string]: unknown;
}
/**
* If you want to provide custom types for the organization.privateMetadata object,
* simply redeclare this rule in the global namespace.
* Every organization object will use the provided type.
*/
interface OrganizationPrivateMetadata {
[k: string]: unknown;
}
}
export interface OrganizationResource extends ClerkResource {
id: string;
name: string;
slug: string | null;
imageUrl: string;
hasImage: boolean;
membersCount: number;
pendingInvitationsCount: number;
publicMetadata: OrganizationPublicMetadata;
adminDeleteEnabled: boolean;
maxAllowedMemberships: number;
createdAt: Date;
updatedAt: Date;
update: (params: UpdateOrganizationParams) => Promise<OrganizationResource>;
getMemberships: GetMemberships;
getInvitations: (params?: GetInvitationsParams) => Promise<ClerkPaginatedResponse<OrganizationInvitationResource>>;
getRoles: (params?: GetRolesParams) => Promise<ClerkPaginatedResponse<RoleResource>>;
getDomains: (params?: GetDomainsParams) => Promise<ClerkPaginatedResponse<OrganizationDomainResource>>;
getMembershipRequests: (
params?: GetMembershipRequestParams,
) => Promise<ClerkPaginatedResponse<OrganizationMembershipRequestResource>>;
addMember: (params: AddMemberParams) => Promise<OrganizationMembershipResource>;
inviteMember: (params: InviteMemberParams) => Promise<OrganizationInvitationResource>;
inviteMembers: (params: InviteMembersParams) => Promise<OrganizationInvitationResource[]>;
updateMember: (params: UpdateMembershipParams) => Promise<OrganizationMembershipResource>;
removeMember: (userId: string) => Promise<OrganizationMembershipResource>;
createDomain: (domainName: string) => Promise<OrganizationDomainResource>;
getDomain: ({ domainId }: { domainId: string }) => Promise<OrganizationDomainResource>;
destroy: () => Promise<void>;
setLogo: (params: SetOrganizationLogoParams) => Promise<OrganizationResource>;
__internal_toSnapshot: () => OrganizationJSONSnapshot;
}
export type GetRolesParams = ClerkPaginationParams;
export type GetMembersParams = ClerkPaginationParams<{
role?: OrganizationCustomRoleKey[];
}>;
export type GetDomainsParams = ClerkPaginationParams<{
enrollmentMode?: OrganizationEnrollmentMode;
}>;
export type GetInvitationsParams = ClerkPaginationParams<{
status?: OrganizationInvitationStatus[];
}>;
export type GetMembershipRequestParams = ClerkPaginationParams<{
status?: OrganizationInvitationStatus;
}>;
export interface AddMemberParams {
userId: string;
role: OrganizationCustomRoleKey;
}
export interface InviteMemberParams {
emailAddress: string;
role: OrganizationCustomRoleKey;
}
export interface InviteMembersParams {
emailAddresses: string[];
role: OrganizationCustomRoleKey;
}
export interface UpdateMembershipParams {
userId: string;
role: OrganizationCustomRoleKey;
}
export interface UpdateOrganizationParams {
name: string;
slug?: string;
}
export interface SetOrganizationLogoParams {
file: Blob | File | string | null;
}
export type GetMemberships = (
params?: GetMembersParams,
) => Promise<ClerkPaginatedResponse<OrganizationMembershipResource>>;