Commit 2ced002f authored by Tim Olshansky's avatar Tim Olshansky

Merge pull request #83 from wikiwi/update-mr

Add Method to Update Merge Request
parents e69652bb d18c394e
......@@ -645,6 +645,36 @@ public class GitlabAPI {
return retrieve().to(tailUrl, GitlabMergeRequest.class);
}
/**
* Updates a Merge Request
*
* @param projectId The id of the project
* @param mergeRequestId The id of the merge request to update
* @param targetBranch The target branch of the merge request, otherwise null to leave it untouched
* @param assigneeId The id of the assignee, otherwise null to leave it untouched
* @param title The title of the merge request, otherwise null to leave it untouched
* @param description The description of the merge request, otherwise null to leave it untouched
* @param stateEvent The state (close|reopen|merge) of the merge request, otherwise null to leave it untouched
* @param labels A comma separated list of labels, otherwise null to leave it untouched
* @return the Merge Request
* @throws IOException on gitlab api call error
*/
public GitlabMergeRequest updateMergeRequest(Serializable projectId, Integer mergeRequestId, String targetBranch,
Integer assigneeId, String title, String description, String stateEvent,
String labels) throws IOException {
Query query = new Query()
.appendIf("target_branch", targetBranch)
.appendIf("assignee_id", assigneeId)
.appendIf("title", title)
.appendIf("description", description)
.appendIf("state_event", stateEvent)
.appendIf("labels", labels);
String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + "/merge_request/" + mergeRequestId + query.toString();
return retrieve().method("PUT").to(tailUrl, GitlabMergeRequest.class);
}
/**
* @param project The Project
* @param mergeRequestId Merge Request ID
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment