Commit cc80a463 authored by Tim Olshansky's avatar Tim Olshansky

Merge pull request #91 from wikiwi/mr-changes

Add method to retrieve merge request changes
parents 9b9a4f27 bbf7dbc2
...@@ -660,6 +660,19 @@ public class GitlabAPI { ...@@ -660,6 +660,19 @@ public class GitlabAPI {
return ls.get(0); 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 { public GitlabMergeRequest getMergeRequest(GitlabProject project, Integer mergeRequestId) throws IOException {
String tailUrl = GitlabProject.URL + "/" + project.getId() + "/merge_request/" + mergeRequestId; String tailUrl = GitlabProject.URL + "/" + project.getId() + "/merge_request/" + mergeRequestId;
return retrieve().to(tailUrl, GitlabMergeRequest.class); return retrieve().to(tailUrl, GitlabMergeRequest.class);
......
package org.gitlab.api.models; package org.gitlab.api.models;
import java.util.Date; import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
...@@ -19,6 +20,7 @@ public class GitlabMergeRequest { ...@@ -19,6 +20,7 @@ public class GitlabMergeRequest {
private GitlabMilestone milestone; private GitlabMilestone milestone;
private String[] labels; private String[] labels;
private List<GitlabCommitDiff> changes;
private int upvotes; private int upvotes;
private int downvotes; private int downvotes;
...@@ -224,4 +226,12 @@ public class GitlabMergeRequest { ...@@ -224,4 +226,12 @@ public class GitlabMergeRequest {
public void setCreatedAt(Date createdAt) { public void setCreatedAt(Date createdAt) {
this.createdAt = 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