Skip to content

Commit fa84f30

Browse files
committed
Added getProject() that returns a Pager.
1 parent 714d4a8 commit fa84f30

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

src/main/java/org/gitlab4j/api/GroupApi.java

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import org.gitlab4j.api.models.Group;
1414
import org.gitlab4j.api.models.Member;
1515
import org.gitlab4j.api.models.Project;
16-
import org.gitlab4j.api.models.ProjectOfGroupFilter;
16+
import org.gitlab4j.api.models.GroupProjectsFilter;
1717
import org.gitlab4j.api.models.Visibility;
1818

1919
/**
@@ -226,19 +226,36 @@ public Pager<Group> getSubGroups(Integer groupId, List<Integer> skipGroups, Bool
226226
}
227227

228228
/**
229-
* Get a list of projects belonging to the specified group ID.
229+
* Get a list of projects belonging to the specified group ID and filter.
230230
*
231231
* GET /groups/:id/projects
232232
*
233233
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
234-
* @param filter the ProjectOfGroupFilter instance holding the filter values for the query
234+
* @param filter the GroupProjectsFilter instance holding the filter values for the query
235+
* @return a List containing Project instances that belong to the group and match the provided filter
235236
* @throws GitLabApiException if any exception occurs
236237
*/
237-
public List<Project> getProjects(Object groupIdOrPath, ProjectOfGroupFilter filter) throws GitLabApiException {
238-
GitLabApiForm formData = filter.getQueryParams();
239-
Response response = get(Response.Status.OK, formData.asMap(), "groups", getGroupIdOrPath(groupIdOrPath), "projects");
240-
return (response.readEntity(new GenericType<List<Project>>() {}));
241-
}
238+
public List<Project> getProjects(Object groupIdOrPath, GroupProjectsFilter filter) throws GitLabApiException {
239+
GitLabApiForm formData = filter.getQueryParams();
240+
Response response = get(Response.Status.OK, formData.asMap(), "groups", getGroupIdOrPath(groupIdOrPath), "projects");
241+
return (response.readEntity(new GenericType<List<Project>>() {}));
242+
}
243+
244+
/**
245+
* Get a Pager of projects belonging to the specified group ID and filter.
246+
*
247+
* GET /groups/:id/projects
248+
*
249+
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
250+
* @param filter the GroupProjectsFilter instance holding the filter values for the query
251+
* @param itemsPerPage the number of Project instances that will be fetched per page
252+
* @return a Pager containing Project instances that belong to the group and match the provided filter
253+
* @throws GitLabApiException if any exception occurs
254+
*/
255+
public Pager<Project> getProjects(Object groupIdOrPath, GroupProjectsFilter filter, int itemsPerPage) throws GitLabApiException {
256+
GitLabApiForm formData = filter.getQueryParams();
257+
return (new Pager<Project>(this, Project.class, itemsPerPage, formData.asMap(), "groups", getGroupIdOrPath(groupIdOrPath), "projects"));
258+
}
242259

243260
/**
244261
* Get a list of projects belonging to the specified group ID.

0 commit comments

Comments
 (0)