@@ -216,12 +216,16 @@ public Pager<Commit> getCommits(int projectId, int mergeRequestIid, int itemsPer
216216 * @param title the title for the merge request, required
217217 * @param description the description of the merge request
218218 * @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
219223 * @return the created MergeRequest instance
220224 * @throws GitLabApiException if any exception occurs
221225 */
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 )
223228 throws GitLabApiException {
224-
225229 if (projectId == null ) {
226230 throw new RuntimeException ("projectId cannot be null" );
227231 }
@@ -232,11 +236,34 @@ public MergeRequest createMergeRequest(Integer projectId, String sourceBranch, S
232236 addFormParam (formData , "title" , title , true );
233237 addFormParam (formData , "description" , description , false );
234238 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 );
235243
236244 Response response = post (Response .Status .CREATED , formData , "projects" , projectId , "merge_requests" );
237245 return (response .readEntity (MergeRequest .class ));
238246 }
239247
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+
240267 /**
241268 * Updates an existing merge request. You can change branches, title, or even close the MR.
242269 *
0 commit comments