@@ -3,8 +3,54 @@ import { RequestOptions } from '../infrastructure/RequestHelper';
3
3
4
4
export type MergeRequestId = string | number ;
5
5
6
+ export interface AcceptMergeRequestOptions {
7
+ merge_commit_message ?: string ;
8
+ squash_commit_message ?: string ;
9
+ squash ?: boolean ;
10
+ should_remove_source_branch ?: boolean ;
11
+ merge_when_pipeline_succeeds ?: boolean ;
12
+ sha ?: string ;
13
+ }
14
+
15
+ export interface ShowMergeRequestOptions {
16
+ render_html ?: boolean ;
17
+ include_diverged_commits_count ?: true ;
18
+ include_rebase_in_progress ?: boolean ;
19
+ }
20
+
21
+ export interface CreateMergeRequestOptions {
22
+ assignee_id ?: number ;
23
+ description ?: string ;
24
+ target_project_id ?: number ;
25
+ labels ?: string ;
26
+ milestone_id ?: number ;
27
+ remove_source_branch ?: boolean ;
28
+ allow_collaboration ?: boolean ;
29
+ allow_maintainer_to_push ?: boolean ;
30
+ squash ?: boolean ;
31
+ }
32
+
33
+ export interface UpdateMergeRequestOptions {
34
+ target_branch ?: number ;
35
+ title ?: string ;
36
+ assignee_id ?: number ;
37
+ milestone_id ?: number ;
38
+ labels ?: string ;
39
+ description ?: string ;
40
+ state_event ?: string ;
41
+ remove_source_branch ?: boolean ;
42
+ squash ?: boolean ;
43
+ discussion_locked ?: boolean ;
44
+ allow_collaboration ?: boolean ;
45
+ allow_maintainer_to_push ?: boolean ;
46
+ }
47
+
6
48
class MergeRequests extends BaseService {
7
- accept ( projectId : ProjectId , mergerequestId : MergeRequestId , options : RequestOptions ) {
49
+ accept (
50
+ projectId : ProjectId ,
51
+ mergerequestId : MergeRequestId ,
52
+ options : AcceptMergeRequestOptions & RequestOptions ,
53
+ ) {
8
54
const [ pId , mId ] = [ projectId , mergerequestId ] . map ( encodeURIComponent ) ;
9
55
10
56
return RequestHelper . put ( this , `projects/${ pId } /merge_requests/${ mId } /merge` , options ) ;
@@ -74,7 +120,7 @@ class MergeRequests extends BaseService {
74
120
sourceBranch : string ,
75
121
targetBranch : string ,
76
122
title : string ,
77
- options : RequestOptions ,
123
+ options : CreateMergeRequestOptions & RequestOptions ,
78
124
) {
79
125
const pId = encodeURIComponent ( projectId ) ;
80
126
@@ -87,7 +133,11 @@ class MergeRequests extends BaseService {
87
133
} ) ;
88
134
}
89
135
90
- edit ( projectId : ProjectId , mergerequestId : MergeRequestId , options : RequestOptions ) {
136
+ edit (
137
+ projectId : ProjectId ,
138
+ mergerequestId : MergeRequestId ,
139
+ options : UpdateMergeRequestOptions & RequestOptions ,
140
+ ) {
91
141
const [ pId , mId ] = [ projectId , mergerequestId ] . map ( encodeURIComponent ) ;
92
142
93
143
return RequestHelper . put ( this , `projects/${ pId } /merge_requests/${ mId } ` , options ) ;
@@ -138,10 +188,14 @@ class MergeRequests extends BaseService {
138
188
return RequestHelper . post ( this , `projects/${ pId } /merge_requests/${ mId } /reset_time_estimate` ) ;
139
189
}
140
190
141
- show ( projectId : ProjectId , mergerequestId : MergeRequestId ) {
191
+ show (
192
+ projectId : ProjectId ,
193
+ mergerequestId : MergeRequestId ,
194
+ options ?: ShowMergeRequestOptions & RequestOptions ,
195
+ ) {
142
196
const [ pId , mId ] = [ projectId , mergerequestId ] . map ( encodeURIComponent ) ;
143
197
144
- return RequestHelper . get ( this , `projects/${ pId } /merge_requests/${ mId } ` ) ;
198
+ return RequestHelper . get ( this , `projects/${ pId } /merge_requests/${ mId } ` , options ) ;
145
199
}
146
200
147
201
timeStats ( projectId : ProjectId , mergerequestId : MergeRequestId ) {
0 commit comments