@@ -671,18 +671,19 @@ public List<Contributor> getContributors(Object projectIdOrPath, int page, int p
671671 * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance
672672 * @param page the page to get
673673 * @param perPage the number of projects per page
674- * @param sort optional param to sort the list of contributors by
674+ * @param orderBy (optional param) returns contributors ordered by NAME, EMAIL, or COMMITS. Default is COMMITS
675+ * @param sortOrder (optional param) returns contributors sorted in ASC or DESC order. Default is ASC
675676 * @return a List containing the contributors for the specified project ID
676677 * @throws GitLabApiException if any exception occurs
677678 */
678- public List <Contributor > getContributors (Object projectIdOrPath , int page , int perPage , String sort ) throws GitLabApiException {
679- if (sort != null && !(sort .equals ("asc" ) || sort .equals ("desc" )) ) {
680- throw new RuntimeException ("Sort must be asc or desc" );
679+ public List <Contributor > getContributors (Object projectIdOrPath , int page , int perPage , ContributorOrderBy orderBy , SortOrder sortOrder ) throws GitLabApiException {
680+ GitLabApiForm formData = new GitLabApiForm ().withParam (PAGE_PARAM , page ).withParam (PER_PAGE_PARAM , perPage );
681+ if (sortOrder != null ) {
682+ formData .withParam ("sort" , sortOrder , false );
681683 }
682684
683- GitLabApiForm formData = new GitLabApiForm ().withParam (PAGE_PARAM , page ).withParam (PER_PAGE_PARAM , perPage );
684- if (sort != null ) {
685- formData .withParam ("sort" , sort , false );
685+ if (orderBy != null ) {
686+ formData .withParam ("order_by" , orderBy , false );
686687 }
687688
688689 Response response = get (Response .Status .OK , formData .asMap (),
0 commit comments