Commit fa84f306 authored by Greg Messner's avatar Greg Messner
Browse files

Added getProject() that returns a Pager.

parent 714d4a87
......@@ -13,7 +13,7 @@ import org.gitlab4j.api.models.AccessLevel;
import org.gitlab4j.api.models.Group;
import org.gitlab4j.api.models.Member;
import org.gitlab4j.api.models.Project;
import org.gitlab4j.api.models.ProjectOfGroupFilter;
import org.gitlab4j.api.models.GroupProjectsFilter;
import org.gitlab4j.api.models.Visibility;
/**
......@@ -226,19 +226,36 @@ public class GroupApi extends AbstractApi {
}
/**
* Get a list of projects belonging to the specified group ID.
* Get a list of projects belonging to the specified group ID and filter.
*
* GET /groups/:id/projects
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param filter the ProjectOfGroupFilter instance holding the filter values for the query
* @param filter the GroupProjectsFilter instance holding the filter values for the query
* @return a List containing Project instances that belong to the group and match the provided filter
* @throws GitLabApiException if any exception occurs
*/
public List<Project> getProjects(Object groupIdOrPath, ProjectOfGroupFilter filter) throws GitLabApiException {
GitLabApiForm formData = filter.getQueryParams();
Response response = get(Response.Status.OK, formData.asMap(), "groups", getGroupIdOrPath(groupIdOrPath), "projects");
return (response.readEntity(new GenericType<List<Project>>() {}));
}
public List<Project> getProjects(Object groupIdOrPath, GroupProjectsFilter filter) throws GitLabApiException {
GitLabApiForm formData = filter.getQueryParams();
Response response = get(Response.Status.OK, formData.asMap(), "groups", getGroupIdOrPath(groupIdOrPath), "projects");
return (response.readEntity(new GenericType<List<Project>>() {}));
}
/**
* Get a Pager of projects belonging to the specified group ID and filter.
*
* GET /groups/:id/projects
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param filter the GroupProjectsFilter instance holding the filter values for the query
* @param itemsPerPage the number of Project instances that will be fetched per page
* @return a Pager containing Project instances that belong to the group and match the provided filter
* @throws GitLabApiException if any exception occurs
*/
public Pager<Project> getProjects(Object groupIdOrPath, GroupProjectsFilter filter, int itemsPerPage) throws GitLabApiException {
GitLabApiForm formData = filter.getQueryParams();
return (new Pager<Project>(this, Project.class, itemsPerPage, formData.asMap(), "groups", getGroupIdOrPath(groupIdOrPath), "projects"));
}
/**
* Get a list of projects belonging to the specified group ID.
......
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