Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions src/main/java/org/gitlab4j/api/IssuesApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.gitlab4j.api.models.Duration;
import org.gitlab4j.api.models.Issue;
import org.gitlab4j.api.models.IssueFilter;
import org.gitlab4j.api.models.MergeRequest;
import org.gitlab4j.api.models.TimeStats;
import org.gitlab4j.api.utils.DurationUtils;

Expand Down Expand Up @@ -621,4 +622,52 @@ public Optional<TimeStats> getOptionalTimeTrackingStats(Integer projectId, Integ
return (GitLabApi.createOptionalFromException(glae));
}
}

/**
* Get list containing all the merge requests that will close issue when merged.
*
* GET /projects/:id/issues/:issue_iid/closed_by
*
* @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
* @param issueIid the internal ID of a project's issue
* @return a List containing all the merge requests what will close the issue when merged.
* @throws GitLabApiException if any exception occurs
*/
public List<MergeRequest> getClosedByMergeRequests(Object projectIdOrPath, Integer issueIid) throws GitLabApiException {
return (getClosedByMergeRequests(projectIdOrPath, issueIid, 1, getDefaultPerPage()));
}

/**
* Get list containing all the merge requests that will close issue when merged.
*
* GET /projects/:id/issues/:issue_iid/closed_by
*
* @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
* @param issueIid the internal ID of a project's issue
* @param page the page to get
* @param perPage the number of issues per page
* @return a List containing all the merge requests what will close the issue when merged.
* @throws GitLabApiException if any exception occurs
*/
public List<MergeRequest> getClosedByMergeRequests(Object projectIdOrPath, Integer issueIid, int page, int perPage) throws GitLabApiException {
Response response = get(Response.Status.OK, getPageQueryParams(page, perPage),
"projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "closed_by");
return (response.readEntity(new GenericType<List<MergeRequest>>() { }));
}

/**
* Get a Pager containing all the merge requests that will close issue when merged.
*
* GET /projects/:id/issues/:issue_iid/closed_by
*
* @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
* @param issueIid the internal ID of a project's issue
* @param itemsPerPage the number of Issue instances that will be fetched per page
* @return a Pager containing all the issues that would be closed by merging the provided merge request
* @throws GitLabApiException if any exception occurs
*/
public Pager<MergeRequest> getClosedByMergeRequests(Object projectIdOrPath, Integer issueIid, int itemsPerPage) throws GitLabApiException {
return new Pager<MergeRequest>(this, MergeRequest.class, itemsPerPage, null,
"projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "closed_by");
}
}