|
34 | 34 | import org.gitlab4j.api.models.Duration;
|
35 | 35 | import org.gitlab4j.api.models.Issue;
|
36 | 36 | import org.gitlab4j.api.models.IssueFilter;
|
| 37 | +import org.gitlab4j.api.models.MergeRequest; |
37 | 38 | import org.gitlab4j.api.models.TimeStats;
|
38 | 39 | import org.gitlab4j.api.utils.DurationUtils;
|
39 | 40 |
|
@@ -621,4 +622,52 @@ public Optional<TimeStats> getOptionalTimeTrackingStats(Integer projectId, Integ
|
621 | 622 | return (GitLabApi.createOptionalFromException(glae));
|
622 | 623 | }
|
623 | 624 | }
|
| 625 | + |
| 626 | + /** |
| 627 | + * Get list containing all the merge requests that will close issue when merged. |
| 628 | + * |
| 629 | + * GET /projects/:id/issues/:issue_iid/closed_by |
| 630 | + * |
| 631 | + * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path |
| 632 | + * @param issueIid the internal ID of a project's issue |
| 633 | + * @return a List containing all the merge requests what will close the issue when merged. |
| 634 | + * @throws GitLabApiException if any exception occurs |
| 635 | + */ |
| 636 | + public List<MergeRequest> getClosedByMergeRequests(Object projectIdOrPath, Integer issueIid) throws GitLabApiException { |
| 637 | + return (getClosedByMergeRequests(projectIdOrPath, issueIid, 1, getDefaultPerPage())); |
| 638 | + } |
| 639 | + |
| 640 | + /** |
| 641 | + * Get list containing all the merge requests that will close issue when merged. |
| 642 | + * |
| 643 | + * GET /projects/:id/issues/:issue_iid/closed_by |
| 644 | + * |
| 645 | + * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path |
| 646 | + * @param issueIid the internal ID of a project's issue |
| 647 | + * @param page the page to get |
| 648 | + * @param perPage the number of issues per page |
| 649 | + * @return a List containing all the merge requests what will close the issue when merged. |
| 650 | + * @throws GitLabApiException if any exception occurs |
| 651 | + */ |
| 652 | + public List<MergeRequest> getClosedByMergeRequests(Object projectIdOrPath, Integer issueIid, int page, int perPage) throws GitLabApiException { |
| 653 | + Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), |
| 654 | + "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "closed_by"); |
| 655 | + return (response.readEntity(new GenericType<List<MergeRequest>>() { })); |
| 656 | + } |
| 657 | + |
| 658 | + /** |
| 659 | + * Get a Pager containing all the merge requests that will close issue when merged. |
| 660 | + * |
| 661 | + * GET /projects/:id/issues/:issue_iid/closed_by |
| 662 | + * |
| 663 | + * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path |
| 664 | + * @param issueIid the internal ID of a project's issue |
| 665 | + * @param itemsPerPage the number of Issue instances that will be fetched per page |
| 666 | + * @return a Pager containing all the issues that would be closed by merging the provided merge request |
| 667 | + * @throws GitLabApiException if any exception occurs |
| 668 | + */ |
| 669 | + public Pager<MergeRequest> getClosedByMergeRequests(Object projectIdOrPath, Integer issueIid, int itemsPerPage) throws GitLabApiException { |
| 670 | + return new Pager<MergeRequest>(this, MergeRequest.class, itemsPerPage, null, |
| 671 | + "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "closed_by"); |
| 672 | + } |
624 | 673 | }
|
0 commit comments