|
1 | 1 | package org.gitlab4j.api;
|
2 | 2 |
|
3 |
| -import org.gitlab4j.api.GitLabApi.ApiVersion; |
4 |
| -import org.gitlab4j.api.models.Commit; |
5 |
| -import org.gitlab4j.api.models.MergeRequest; |
6 |
| -import org.gitlab4j.api.models.MergeRequestFilter; |
7 |
| -import org.gitlab4j.api.models.Participant; |
| 3 | +import java.util.List; |
| 4 | +import java.util.Optional; |
8 | 5 |
|
9 | 6 | import javax.ws.rs.core.Form;
|
10 | 7 | import javax.ws.rs.core.GenericType;
|
11 | 8 | import javax.ws.rs.core.MultivaluedMap;
|
12 | 9 | import javax.ws.rs.core.Response;
|
13 |
| -import java.util.List; |
14 |
| -import java.util.Optional; |
| 10 | + |
| 11 | +import org.gitlab4j.api.GitLabApi.ApiVersion; |
| 12 | +import org.gitlab4j.api.models.Commit; |
| 13 | +import org.gitlab4j.api.models.Issue; |
| 14 | +import org.gitlab4j.api.models.MergeRequest; |
| 15 | +import org.gitlab4j.api.models.MergeRequestFilter; |
| 16 | +import org.gitlab4j.api.models.Participant; |
15 | 17 |
|
16 | 18 | /**
|
17 | 19 | * This class implements the client side API for the GitLab merge request calls.
|
@@ -785,4 +787,52 @@ public List<Participant> getParticipants(Integer projectId, Integer mergeRequest
|
785 | 787 | public Pager<Participant> getParticipants(Integer projectId, Integer mergeRequestIid, int itemsPerPage) throws GitLabApiException {
|
786 | 788 | return new Pager<Participant>(this, Participant.class, itemsPerPage, null, "projects", projectId, "merge_requests", mergeRequestIid, "participants");
|
787 | 789 | }
|
| 790 | + |
| 791 | + /** |
| 792 | + * Get list containing all the issues that would be closed by merging the provided merge requestt. |
| 793 | + * |
| 794 | + * <pre><code>GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/closes_issues</code></pre> |
| 795 | + * |
| 796 | + * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path |
| 797 | + * @param mergeRequestIid the IID of the merge request to get the closes issues for |
| 798 | + * @return a List containing all the issues that would be closed by merging the provided merge request |
| 799 | + * @throws GitLabApiException if any exception occurs |
| 800 | + */ |
| 801 | + public List<Issue> getClosesIssues(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException { |
| 802 | + return (getClosesIssues(projectIdOrPath, mergeRequestIid, 1, getDefaultPerPage())); |
| 803 | + } |
| 804 | + |
| 805 | + /** |
| 806 | + * Get list containing all the issues that would be closed by merging the provided merge request. |
| 807 | + * |
| 808 | + * <pre><code>GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/closes_issues</code></pre> |
| 809 | + * |
| 810 | + * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path |
| 811 | + * @param mergeRequestIid the IID of the merge request to get the closes issues for |
| 812 | + * @param page the page to get |
| 813 | + * @param perPage the number of issues per page |
| 814 | + * @return a List containing all the issues that would be closed by merging the provided merge request |
| 815 | + * @throws GitLabApiException if any exception occurs |
| 816 | + */ |
| 817 | + public List<Issue> getClosesIssues(Object projectIdOrPath, Integer mergeRequestIid, int page, int perPage) throws GitLabApiException { |
| 818 | + Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), |
| 819 | + "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "closes_issues"); |
| 820 | + return (response.readEntity(new GenericType<List<Issue>>() { })); |
| 821 | + } |
| 822 | + |
| 823 | + /** |
| 824 | + * Get a Pager containing all the issues that would be closed by merging the provided merge request. |
| 825 | + * |
| 826 | + * <pre><code>GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/closes_issues</code></pre> |
| 827 | + * |
| 828 | + * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path |
| 829 | + * @param mergeRequestIid the IID of the merge request to get the closes issues for |
| 830 | + * @param itemsPerPage the number of Issue instances that will be fetched per page |
| 831 | + * @return a Pager containing all the issues that would be closed by merging the provided merge request |
| 832 | + * @throws GitLabApiException if any exception occurs |
| 833 | + */ |
| 834 | + public Pager<Issue> getClosesIssues(Object projectIdOrPath, Integer mergeRequestIid, int itemsPerPage) throws GitLabApiException { |
| 835 | + return new Pager<Issue>(this, Issue.class, itemsPerPage, null, |
| 836 | + "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "closes_issues"); |
| 837 | + } |
788 | 838 | }
|
0 commit comments