Unverified Commit 2483e642 authored by Erkan Erkişi's avatar Erkan Erkişi Committed by GitHub
Browse files

get all merge requests for a group (#932)

Co-authored-by: Erkan <erkanerkisi>
parent ea9042ee
......@@ -85,20 +85,22 @@ public class MergeRequestApi extends AbstractApi {
*
* @param filter a MergeRequestFilter instance with the filter settings
* @param itemsPerPage the number of MergeRequest instances that will be fetched per page
* @return all merge requests for the specified project matching the filter
* @return all merge requests for the specified project/group matching the filter
* @throws GitLabApiException if any exception occurs
*/
public Pager<MergeRequest> getMergeRequests(MergeRequestFilter filter, int itemsPerPage) throws GitLabApiException {
MultivaluedMap<String, String> queryParams = (filter != null ? filter.getQueryParams().asMap() : null);
if (filter != null && (filter.getProjectId() != null && filter.getProjectId().intValue() > 0) ||
(filter.getIids() != null && filter.getIids().size() > 0)) {
if (filter != null && ((filter.getProjectId() != null && filter.getProjectId().intValue() > 0) ||
(filter.getIids() != null && filter.getIids().size() > 0))) {
if (filter.getProjectId() == null || filter.getProjectId().intValue() == 0) {
throw new RuntimeException("project ID cannot be null or 0");
}
return (new Pager<MergeRequest>(this, MergeRequest.class, itemsPerPage, queryParams, "projects", filter.getProjectId(), "merge_requests"));
} else if (filter != null && filter.getGroupId() != null && filter.getGroupId().intValue() > 0) {
return (new Pager<MergeRequest>(this, MergeRequest.class, itemsPerPage, queryParams, "groups", filter.getGroupId(), "merge_requests"));
} else {
return (new Pager<MergeRequest>(this, MergeRequest.class, itemsPerPage, queryParams, "merge_requests"));
}
......
......@@ -22,6 +22,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
public class MergeRequestFilter {
private Long projectId;
private Long groupId;
private List<Long> iids;
private MergeRequestState state;
private MergeRequestOrderBy orderBy;
......@@ -315,6 +316,19 @@ public class MergeRequestFilter {
this.wip = wip;
}
public Long getGroupId() {
return groupId;
}
public void setGroupId(Long groupId) {
this.groupId = groupId;
}
public MergeRequestFilter withGroupId(Long groupId) {
this.groupId = groupId;
return (this);
}
public MergeRequestFilter withWip(Boolean wip) {
this.wip = wip;
return (this);
......
Supports Markdown
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