diff --git a/src/main/java/org/gitlab4j/api/ProjectApi.java b/src/main/java/org/gitlab4j/api/ProjectApi.java index 3b7a36742a7253af88ce249a5d80eaa1dbf469e4..d2dce47fb83c51eaa6e5bd8b70383e1997ee477e 100644 --- a/src/main/java/org/gitlab4j/api/ProjectApi.java +++ b/src/main/java/org/gitlab4j/api/ProjectApi.java @@ -2054,13 +2054,42 @@ public class ProjectApi extends AbstractApi implements Constants { delete(Response.Status.OK, null, "projects", projectId, "push_rule"); } - + /** - * Get a Pager of projects that were forked from the specified project. + * Get a list of projects that were forked from the specified project. * * GET /projects/:id/forks * * @param projectId the ID of the project + * @return a List of forked projects + * @throws GitLabApiException if any exception occurs + */ + public List getForks(Integer projectId) throws GitLabApiException { + return (getForks(projectId, 1, getDefaultPerPage())); + } + + /** + * Get a list of projects that were forked from the specified project and in the specified page range. + * + * GET /projects/:id/forks + * + * @param projectId the ID of the project + * @param page the page to get + * @param perPage the number of projects per page + * @return a List of forked projects + * @throws GitLabApiException if any exception occurs + */ + public List getForks(Integer projectId, int page, int perPage) throws GitLabApiException { + Response response = get(Response.Status.OK, getPageQueryParams(page, perPage),"projects", projectId, "forks"); + return (response.readEntity(new GenericType>() { })); + } + + /** + * Get a Pager of projects that were forked from the specified project. + * + * GET /projects/:id/forks + * + * @param projectId the ID of the project * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of projects * @throws GitLabApiException if any exception occurs