Skip to content

Commit 9f32ecb

Browse files
committed
Added getForks() methods that return List.
1 parent 639ca5a commit 9f32ecb

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

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

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2054,13 +2054,42 @@ public void deletePushRules(Integer projectId) throws GitLabApiException {
20542054

20552055
delete(Response.Status.OK, null, "projects", projectId, "push_rule");
20562056
}
2057-
2057+
20582058
/**
2059-
* Get a Pager of projects that were forked from the specified project.
2059+
* Get a list of projects that were forked from the specified project.
20602060
*
20612061
* GET /projects/:id/forks
20622062
*
20632063
* @param projectId the ID of the project
2064+
* @return a List of forked projects
2065+
* @throws GitLabApiException if any exception occurs
2066+
*/
2067+
public List<Project> getForks(Integer projectId) throws GitLabApiException {
2068+
return (getForks(projectId, 1, getDefaultPerPage()));
2069+
}
2070+
2071+
/**
2072+
* Get a list of projects that were forked from the specified project and in the specified page range.
2073+
*
2074+
* GET /projects/:id/forks
2075+
*
2076+
* @param projectId the ID of the project
2077+
* @param page the page to get
2078+
* @param perPage the number of projects per page
2079+
* @return a List of forked projects
2080+
* @throws GitLabApiException if any exception occurs
2081+
*/
2082+
public List<Project> getForks(Integer projectId, int page, int perPage) throws GitLabApiException {
2083+
Response response = get(Response.Status.OK, getPageQueryParams(page, perPage),"projects", projectId, "forks");
2084+
return (response.readEntity(new GenericType<List<Project>>() { }));
2085+
}
2086+
2087+
/**
2088+
* Get a Pager of projects that were forked from the specified project.
2089+
*
2090+
* GET /projects/:id/forks
2091+
*
2092+
* @param projectId the ID of the project
20642093
* @param itemsPerPage the number of Project instances that will be fetched per page
20652094
* @return a Pager of projects
20662095
* @throws GitLabApiException if any exception occurs

0 commit comments

Comments
 (0)