Commit bbf7dbc2 authored by Chi Vinh Le's avatar Chi Vinh Le

Add method to retrieve merge request changes

parent 3927dfb0
......@@ -660,6 +660,19 @@ public class GitlabAPI {
return ls.get(0);
}
/**
* Return a Merge Request including its changes.
*
* @param projectId The id of the project
* @param mergeRequestId The id of the merge request
* @return the Gitlab Merge Request
* @throws IOException on gitlab api call error
*/
public GitlabMergeRequest getMergeRequestChanges(Serializable projectId, Integer mergeRequestId) throws IOException {
String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + "/merge_request/" + mergeRequestId + "/changes";
return retrieve().to(tailUrl, GitlabMergeRequest.class);
}
public GitlabMergeRequest getMergeRequest(GitlabProject project, Integer mergeRequestId) throws IOException {
String tailUrl = GitlabProject.URL + "/" + project.getId() + "/merge_request/" + mergeRequestId;
return retrieve().to(tailUrl, GitlabMergeRequest.class);
......
package org.gitlab.api.models;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
......@@ -19,6 +20,7 @@ public class GitlabMergeRequest {
private GitlabMilestone milestone;
private String[] labels;
private List<GitlabCommitDiff> changes;
private int upvotes;
private int downvotes;
......@@ -224,4 +226,12 @@ public class GitlabMergeRequest {
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public List<GitlabCommitDiff> getChanges() {
return changes;
}
public void setChanges(List<GitlabCommitDiff> changes) {
this.changes = changes;
}
}
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