Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions gitlab4j-api/src/main/java/org/gitlab4j/api/ProjectApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -3972,6 +3972,44 @@ public List<Badge> getBadges(Object projectIdOrPath, String bagdeName) throws Gi
return (response.readEntity(new GenericType<List<Badge>>() {}));
}

/**
* Gets a pager of a project’s badges and its group badges.
*
* <pre><code>GitLab Endpoint: GET /projects/:id/badges</code></pre>
*
* @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance
* @param itemsPerPage the number of Badge instances that will be fetched per page
* @return a pager of Badge instances for the specified project
* @throws GitLabApiException if any exception occurs
*/
public Pager<Badge> getBadges(Object projectIdOrPath, int itemsPerPage) throws GitLabApiException {
return getBadges(projectIdOrPath, null, itemsPerPage);
}

/**
* Gets a pager of a project’s badges and its group badges, case-sensitively filtered on bagdeName if non-null.
*
* <pre><code>GitLab Endpoint: GET /projects/:id/badges?name=:name</code></pre>
*
* @param projectIdOrPath the project in the form of a Long(ID), String(path), or Project instance
* @param bagdeName The name to filter on (case-sensitive), ignored if null.
* @param itemsPerPage the number of Badge instances that will be fetched per page
* @return a pager of the GitLab item, case insensitively filtered on name.
* @throws GitLabApiException If any problem is encountered
*/
public Pager<Badge> getBadges(Object projectIdOrPath, String bagdeName, int itemsPerPage)
throws GitLabApiException {
Form queryParam = new GitLabApiForm().withParam("name", bagdeName);
return new Pager<Badge>(
this,
Badge.class,
itemsPerPage,
queryParam.asMap(),
"projects",
getProjectIdOrPath(projectIdOrPath),
"badges");
}

/**
* Gets a badge of a project.
*
Expand Down
Loading