-
-
Notifications
You must be signed in to change notification settings - Fork 301
/
Copy pathEpicLinks.ts
117 lines (110 loc) · 3.21 KB
/
EpicLinks.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
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
114
115
116
117
import { BaseResource } from '@gitbeaker/requester-utils';
import { RequestHelper, endpoint } from '../infrastructure';
import type {
GitlabAPIResponse,
PaginationRequestOptions,
PaginationTypes,
ShowExpanded,
Sudo,
} from '../infrastructure';
import { SimpleUserSchema } from './Users';
export interface CondensedEpicLinkSchema extends Record<string, unknown> {
id: number;
iid: number;
group_id: number;
parent_id: number;
title: string;
has_children: boolean;
has_issues: boolean;
reference: string;
url: string;
relation_url: string;
}
export interface EpicLinkSchema extends Record<string, unknown> {
id: number;
iid: number;
group_id: number;
parent_id: number;
title: string;
description: string;
author: SimpleUserSchema;
start_date?: string;
start_date_is_fixed: boolean;
start_date_fixed?: string;
start_date_from_milestones?: string;
start_date_from_inherited_source?: string;
due_date: string;
due_date_is_fixed: boolean;
due_date_fixed?: string;
due_date_from_milestones?: string;
due_date_from_inherited_source: string;
created_at: string;
updated_at: string;
labels?: string[];
}
export class EpicLinks<C extends boolean = false> extends BaseResource<C> {
all<E extends boolean = false, P extends PaginationTypes = 'offset'>(
groupId: string | number,
epicIId: number,
options?: Sudo & ShowExpanded<E> & PaginationRequestOptions<P>,
): Promise<GitlabAPIResponse<EpicLinkSchema[], C, E, P>> {
return RequestHelper.get<EpicLinkSchema[]>()(
this,
endpoint`groups/${groupId}/epics/${epicIId}/links`,
options,
);
}
assign<E extends boolean = false>(
groupId: string | number,
epicIId: number,
childEpicId: number,
options?: Sudo & ShowExpanded<E>,
): Promise<GitlabAPIResponse<EpicLinkSchema, C, E, void>> {
return RequestHelper.post<EpicLinkSchema>()(
this,
endpoint`groups/${groupId}/epics/${epicIId}/links/${childEpicId}`,
options,
);
}
create<E extends boolean = false>(
groupId: string | number,
epicIId: number,
title: string,
options?: { confidential?: boolean } & Sudo & ShowExpanded<E>,
): Promise<GitlabAPIResponse<CondensedEpicLinkSchema, C, E, void>> {
return RequestHelper.post<CondensedEpicLinkSchema>()(
this,
endpoint`groups/${groupId}/epics/${epicIId}/links`,
{
searchParams: {
title,
},
...options,
},
);
}
reorder<E extends boolean = false>(
groupId: string | number,
epicIId: number,
childEpicId: number,
options?: { moveBeforeId?: number; moveAfterId?: number } & Sudo & ShowExpanded<E>,
): Promise<GitlabAPIResponse<EpicLinkSchema, C, E, void>> {
return RequestHelper.put<EpicLinkSchema>()(
this,
endpoint`groups/${groupId}/epics/${epicIId}/links/${childEpicId}`,
options,
);
}
unassign<E extends boolean = false>(
groupId: string | number,
epicIId: number,
childEpicId: number,
options?: Sudo & ShowExpanded<E>,
): Promise<GitlabAPIResponse<EpicLinkSchema, C, E, void>> {
return RequestHelper.del<EpicLinkSchema>()(
this,
endpoint`groups/${groupId}/epics/${epicIId}/links/${childEpicId}`,
options,
);
}
}