-
-
Notifications
You must be signed in to change notification settings - Fork 301
/
Copy pathProjectRelationsExport.ts
46 lines (42 loc) · 1.35 KB
/
ProjectRelationsExport.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
import { BaseResource } from '@gitbeaker/requester-utils';
import { RequestHelper, endpoint } from '../infrastructure';
import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure';
export interface RelationsExportStatusSchema extends Record<string, unknown> {
relation: string;
status: number;
error?: string;
updated_at: string;
}
export class ProjectRelationsExport<C extends boolean = false> extends BaseResource<C> {
download<E extends boolean = false>(
projectId: string | number,
relation: string,
options?: Sudo & ShowExpanded<E>,
): Promise<GitlabAPIResponse<Blob, void, E, void>> {
return RequestHelper.get<Blob>()(
this,
endpoint`projects/${projectId}/export_relations/download`,
{
relation,
...options,
},
);
}
showExportStatus(projectId: string | number, options?: Sudo) {
return RequestHelper.get<RelationsExportStatusSchema>()(
this,
endpoint`projects/${projectId}/export_relations/status`,
options,
);
}
scheduleExport<E extends boolean = false>(
projectId: string | number,
options?: Sudo & ShowExpanded<E>,
): Promise<GitlabAPIResponse<{ message: string }, C, E, void>> {
return RequestHelper.post<{ message: string }>()(
this,
endpoint`projects/${projectId}/export_relations`,
options,
);
}
}