Skip to content

Commit 2cd9cf2

Browse files
committed
#14 Add single pull request endpoint
1 parent c1655e4 commit 2cd9cf2

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

src/main/java/com/dkaedv/glghproxy/controller/ReposController.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,22 @@ public List<PullRequest> getPulls(
122122
//LOG.info(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(mergeRequests));
123123
return mergeRequests;
124124
}
125-
125+
126+
@RequestMapping("/{namespace}/{repo}/pulls/{id}")
127+
@ResponseBody
128+
public PullRequest getPull(
129+
@PathVariable String namespace,
130+
@PathVariable String repo,
131+
@PathVariable Integer id,
132+
@RequestHeader("Authorization") String authorization
133+
) throws IOException {
134+
135+
GitlabAPI api = gitlab.connect(authorization);
136+
GitlabMergeRequest mergeRequest = findMergeRequestByProjectAndIid(namespace, repo, id, api);
137+
138+
return GitlabToGithubConverter.convertMergeRequest(mergeRequest, authorization, namespace, repo);
139+
}
140+
126141

127142
@RequestMapping("/{namespace}/{repo}/pulls/{id}/commits")
128143
@ResponseBody

src/main/java/com/dkaedv/glghproxy/converter/GitlabToGithubConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public static List<PullRequest> convertMergeRequests(List<GitlabMergeRequest> gl
184184
return pulls;
185185
}
186186

187-
static PullRequest convertMergeRequest(GitlabMergeRequest glmr, String gitlabUrl, String namespace, String repo) {
187+
public static PullRequest convertMergeRequest(GitlabMergeRequest glmr, String gitlabUrl, String namespace, String repo) {
188188
PullRequest pull = new PullRequest();
189189

190190
pull.setAssignee(convertUser(glmr.getAssignee()));

0 commit comments

Comments
 (0)