@@ -216,12 +216,16 @@ public Pager<Commit> getCommits(int projectId, int mergeRequestIid, int itemsPer
216
216
* @param title the title for the merge request, required
217
217
* @param description the description of the merge request
218
218
* @param assigneeId the Assignee user ID, optional
219
+ * @param targetProjectId the ID of a target project, optional
220
+ * @param labels labels for MR, optional
221
+ * @param milestoneId the ID of a milestone, optional
222
+ * @param removeSourceBranch Flag indicating if a merge request should remove the source branch when merging, optional
219
223
* @return the created MergeRequest instance
220
224
* @throws GitLabApiException if any exception occurs
221
225
*/
222
- public MergeRequest createMergeRequest (Integer projectId , String sourceBranch , String targetBranch , String title , String description , Integer assigneeId )
226
+ public MergeRequest createMergeRequest (Integer projectId , String sourceBranch , String targetBranch , String title , String description , Integer assigneeId ,
227
+ Integer targetProjectId , String [] labels , Integer milestoneId , Boolean removeSourceBranch )
223
228
throws GitLabApiException {
224
-
225
229
if (projectId == null ) {
226
230
throw new RuntimeException ("projectId cannot be null" );
227
231
}
@@ -232,11 +236,34 @@ public MergeRequest createMergeRequest(Integer projectId, String sourceBranch, S
232
236
addFormParam (formData , "title" , title , true );
233
237
addFormParam (formData , "description" , description , false );
234
238
addFormParam (formData , "assignee_id" , assigneeId , false );
239
+ addFormParam (formData , "target_project_id" , targetProjectId , false );
240
+ addFormParam (formData , "labels" , labels == null ? null : String .join ("," , labels ), false );
241
+ addFormParam (formData , "milestone_id" , milestoneId , false );
242
+ addFormParam (formData , "remove_source_branch" , removeSourceBranch , false );
235
243
236
244
Response response = post (Response .Status .CREATED , formData , "projects" , projectId , "merge_requests" );
237
245
return (response .readEntity (MergeRequest .class ));
238
246
}
239
247
248
+ /**
249
+ * Creates a merge request and optionally assigns a reviewer to it.
250
+ *
251
+ * POST /projects/:id/merge_requests
252
+ *
253
+ * @param projectId the ID of a project, required
254
+ * @param sourceBranch the source branch, required
255
+ * @param targetBranch the target branch, required
256
+ * @param title the title for the merge request, required
257
+ * @param description the description of the merge request
258
+ * @param assigneeId the Assignee user ID, optional
259
+ * @return the created MergeRequest instance
260
+ * @throws GitLabApiException if any exception occurs
261
+ */
262
+ public MergeRequest createMergeRequest (Integer projectId , String sourceBranch , String targetBranch , String title , String description , Integer assigneeId )
263
+ throws GitLabApiException {
264
+ return createMergeRequest (projectId , sourceBranch , targetBranch , title , description , assigneeId , null , null , null , null );
265
+ }
266
+
240
267
/**
241
268
* Updates an existing merge request. You can change branches, title, or even close the MR.
242
269
*
0 commit comments