From f16e0e19c7238d56aea5fd8a961d8ca7fe001d1c Mon Sep 17 00:00:00 2001 From: Greg Messner Date: Thu, 15 Jun 2017 07:25:31 -0700 Subject: [PATCH] Added getProjects(int page, int perPage). --- .../java/org/gitlab4j/api/ProjectApi.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/main/java/org/gitlab4j/api/ProjectApi.java b/src/main/java/org/gitlab4j/api/ProjectApi.java index 71bfdf32..d67f716b 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. -- GitLab