diff --git a/src/main/java/org/gitlab4j/api/ProjectApi.java b/src/main/java/org/gitlab4j/api/ProjectApi.java index 71bfdf3218479fd5384f6f90e5dda7af757475c7..d67f716b9b75f200358d278999d20e9b1c564415 100644 --- a/src/main/java/org/gitlab4j/api/ProjectApi.java +++ b/src/main/java/org/gitlab4j/api/ProjectApi.java @@ -40,6 +40,25 @@ public class ProjectApi extends AbstractApi implements Constants { })); } + /** + * Get a list of projects accessible by the authenticated user and in the specified page range. + * + * GET /projects + * + * @param page the page to get + * @param perPage the number of projects per page + * @return a list of projects accessible by the authenticated user + * @throws GitLabApiException if any exception occurs + */ + public List getProjects(int page, int perPage) throws GitLabApiException { + GitLabApiForm formData = new GitLabApiForm() + .withParam("page", page, false) + .withParam("per_page", perPage, false); + Response response = get(Response.Status.OK, formData.asMap(), "projects"); + return (response.readEntity(new GenericType>() { + })); + } + /** * Get a list of projects accessible by the authenticated user and matching the supplied filter parameters. * All filter parameters are optional.