Skip to content

Commit 07a1e4d

Browse files
committed
Added getContributors() methods that return List.
1 parent 9f32ecb commit 07a1e4d

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

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

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -499,16 +499,45 @@ public CompareResults compare(String projectPath, String from, String to) throws
499499
Response response = get(Response.Status.OK, formData.asMap(), "projects", projectPath, "repository", "compare");
500500
return (response.readEntity(CompareResults.class));
501501
}
502-
502+
503+
/**
504+
* Get a list of contributors from a project.
505+
*
506+
* GET /projects/:id/repository/contributors
507+
*
508+
* @param projectId the project to get the list of contributors for
509+
* @return a List containing the contributors for the specified project ID
510+
* @throws GitLabApiException if any exception occurs
511+
*/
512+
public List<Contributor> getContributors(Integer projectId) throws GitLabApiException {
513+
return (getContributors(projectId, 1, getDefaultPerPage()));
514+
}
515+
516+
/**
517+
* Get a list of contributors from a project and in the specified page range.
518+
*
519+
* GET /projects/:id/repository/contributors
520+
*
521+
* @param projectId the project to get the list of contributors for
522+
* @param page the page to get
523+
* @param perPage the number of projects per page
524+
* @return a List containing the contributors for the specified project ID
525+
* @throws GitLabApiException if any exception occurs
526+
*/
527+
public List<Contributor> getContributors(Integer projectId, int page, int perPage) throws GitLabApiException {
528+
Response response = get(Response.Status.OK, getPageQueryParams(page, perPage),
529+
"projects", projectId, "repository", "contributors");
530+
return (response.readEntity(new GenericType<List<Contributor>>() { }));
531+
}
532+
503533
/**
504534
* Get a Pager of contributors from a project.
505535
*
506536
* GET /projects/:id/repository/contributors
507537
*
508538
* @param projectId the project to get the list of contributors for
509539
* @param itemsPerPage the number of Project instances that will be fetched per page
510-
* @return the list of contributors for the specified project ID
511-
*
540+
* @return a Pager containing the contributors for the specified project ID
512541
* @throws GitLabApiException if any exception occurs
513542
*/
514543
public Pager<Contributor> getContributors(Integer projectId, int itemsPerPage) throws GitLabApiException {

0 commit comments

Comments
 (0)