use of org.gitlab4j.api.models.MergeRequest in project choerodon-starters by open-hand.
the class MergeRequestApi method updateMergeRequest.
/**
* Updates an existing merge request. You can change branches, title, or even close the MR.
* <p>
* PUT /projects/:id/merge_requests/:merge_request_id
*
* @param projectId the ID of a project
* @param mergeRequestId the ID of the merge request to update
* @param sourceBranch the source branch
* @param targetBranch the target branch
* @param title the title for the merge request
* @param description the description of the merge request
* @param assigneeId the Assignee user ID, optional
* @return the updated merge request
* @throws GitLabApiException if any exception occurs
* @deprecated as of release 4.4.3
*/
@Deprecated
public MergeRequest updateMergeRequest(Integer projectId, Integer mergeRequestId, String sourceBranch, String targetBranch, String title, String description, Integer assigneeId) throws GitLabApiException {
if (projectId == null) {
throw new GitLabApiException("projectId cannot be null");
}
if (mergeRequestId == null) {
throw new GitLabApiException("mergeRequestId cannot be null");
}
Form formData = new Form();
addFormParam(formData, "source_branch", sourceBranch, false);
addFormParam(formData, "target_branch", targetBranch, false);
addFormParam(formData, "title", title, false);
addFormParam(formData, "description", description, false);
addFormParam(formData, "assignee_id", assigneeId, false);
Response response = put(Response.Status.OK, formData.asMap(), "projects", projectId, "merge_requests", mergeRequestId);
return (response.readEntity(MergeRequest.class));
}
use of org.gitlab4j.api.models.MergeRequest in project choerodon-starters by open-hand.
the class MergeRequestApi method approveMergeRequest.
/**
* Approve a merge request.
* <p>
* Note: This API endpoint is only available on 8.9 EE and above.
* <p>
* POST /projects/:id/merge_requests/:merge_request_iid/approve
*
* @param projectId the project ID of the merge request
* @param mergeRequestId the internal ID of the merge request
* @param sha the HEAD of the merge request, optional
* @return a MergeRequest instance with approval information included
* @throws GitLabApiException if any exception occurs
*/
public MergeRequest approveMergeRequest(Integer projectId, Integer mergeRequestId, String sha) throws GitLabApiException {
if (projectId == null) {
throw new GitLabApiException("projectId cannot be null");
}
if (mergeRequestId == null) {
throw new GitLabApiException("mergeRequestId cannot be null");
}
Form formData = new GitLabApiForm().withParam("sha", sha);
Response response = post(Response.Status.OK, formData, "projects", projectId, "merge_requests", mergeRequestId, "approve");
return (response.readEntity(MergeRequest.class));
}
Aggregations