-
-
Notifications
You must be signed in to change notification settings - Fork 301
/
Copy pathProjectInvitations.ts
51 lines (46 loc) · 1.74 KB
/
ProjectInvitations.ts
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
import type { BaseResourceOptions } from '@gitbeaker/requester-utils';
import { ResourceInvitations } from '../templates';
import type { InvitationSchema } from '../templates/ResourceInvitations';
import type {
GitlabAPIResponse,
OneOf,
PaginationRequestOptions,
PaginationTypes,
ShowExpanded,
Sudo,
} from '../infrastructure';
import { AccessLevel } from '../constants';
export interface ProjectInvitations<C extends boolean = false> {
add<E extends boolean = false>(
projectId: string | number,
accessLevel: Exclude<AccessLevel, AccessLevel.ADMIN>,
options: OneOf<{ email: string; userId: string }> & {
expiresAt?: string;
inviteSource?: string;
tasksToBeDone?: string[];
tasksProjectId?: number;
} & Sudo &
ShowExpanded<E>,
): Promise<GitlabAPIResponse<InvitationSchema, C, E, void>>;
all<E extends boolean = false, P extends PaginationTypes = 'offset'>(
projectId: string | number,
options?: PaginationRequestOptions<P> & { query?: string } & Sudo & ShowExpanded<E>,
): Promise<GitlabAPIResponse<InvitationSchema[], C, E, P>>;
edit<E extends boolean = false>(
projectId: string | number,
email: string,
options?: { expiresAt?: string; accessLevel?: Exclude<AccessLevel, AccessLevel.ADMIN> } & Sudo &
ShowExpanded<E>,
): Promise<GitlabAPIResponse<InvitationSchema, C, E, void>>;
remove<E extends boolean = false>(
projectId: string | number,
email: string,
options?: Sudo & ShowExpanded<E>,
): Promise<GitlabAPIResponse<InvitationSchema, C, E, void>>;
}
export class ProjectInvitations<C extends boolean = false> extends ResourceInvitations<C> {
constructor(options: BaseResourceOptions<C>) {
/* istanbul ignore next */
super('projects', options);
}
}