diff --git a/gitlab4j-api/src/main/java/org/gitlab4j/api/GroupApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/GroupApi.java index 155bf046e..c030cc651 100644 --- a/gitlab4j-api/src/main/java/org/gitlab4j/api/GroupApi.java +++ b/gitlab4j-api/src/main/java/org/gitlab4j/api/GroupApi.java @@ -118,6 +118,63 @@ public Stream getGroupsStream() throws GitLabApiException { return (getGroups(getDefaultPerPage()).stream()); } + /** + * Get a list of active groups + * + *
GitLab Endpoint: GET /groups?active=true
+ * + * @return a list of active Groups + * @throws GitLabApiException if any exception occurs + */ + public List getActiveGroups() throws GitLabApiException { + return (getActiveGroups(getDefaultPerPage()).all()); + } + + /** + * Get a list of active groups using the specified page and per page settings. + * + *
GitLab Endpoint: GET /groups?active=true
+ * + * @param page the page to get + * @param perPage the number of groups per page + * @return the list of active Groups in the specified range + * @throws GitLabApiException if any exception occurs + */ + public List getActiveGroups(int page, int perPage) throws GitLabApiException { + Form formData = new GitLabApiForm() + .withParam("active", true) + .withParam(PAGE_PARAM, page) + .withParam(PER_PAGE_PARAM, perPage); + Response response = get(Response.Status.OK, formData.asMap(), "groups"); + return (response.readEntity(new GenericType>() {})); + } + + /** + * Get a Pager of active groups. + * + *
GitLab Endpoint: GET /groups?active=true
+ * + * @param itemsPerPage the number of active Group instances that will be fetched per page + * @return a Pager of active Groups + * @throws GitLabApiException if any exception occurs + */ + public Pager getActiveGroups(int itemsPerPage) throws GitLabApiException { + Form formData = new GitLabApiForm().withParam("active", true); + return (new Pager(this, Group.class, itemsPerPage, formData.asMap(), "groups")); + } + + /** + * Get a Stream of active groups + * + *
GitLab Endpoint: GET /groups?active=true
+ * + * @return a Stream of active Groups + * @throws GitLabApiException if any exception occurs + */ + public Stream getActiveGroupsStream() throws GitLabApiException { + return (getActiveGroups(getDefaultPerPage()).stream()); + } + /** * Get all groups that match your string in their name or path. * diff --git a/gitlab4j-models/src/main/java/org/gitlab4j/api/models/Group.java b/gitlab4j-models/src/main/java/org/gitlab4j/api/models/Group.java index bfec0db61..1d4e5940b 100644 --- a/gitlab4j-models/src/main/java/org/gitlab4j/api/models/Group.java +++ b/gitlab4j-models/src/main/java/org/gitlab4j/api/models/Group.java @@ -54,6 +54,7 @@ public void setJobArtifactsSize(Long jobArtifactsSize) { private String path; private String description; + private String archived; private Visibility visibility; private Boolean lfsEnabled; private Boolean requestAccessEnabled; @@ -91,6 +92,14 @@ public void setDescription(String description) { this.description = description; } + public String getArchived() { + return archived; + } + + public void setArchived(String archived) { + this.archived = archived; + } + public Visibility getVisibility() { return visibility; } diff --git a/gitlab4j-models/src/main/java/org/gitlab4j/api/models/GroupFilter.java b/gitlab4j-models/src/main/java/org/gitlab4j/api/models/GroupFilter.java index f551c4a41..aff2d4950 100644 --- a/gitlab4j-models/src/main/java/org/gitlab4j/api/models/GroupFilter.java +++ b/gitlab4j-models/src/main/java/org/gitlab4j/api/models/GroupFilter.java @@ -20,6 +20,8 @@ public class GroupFilter implements Serializable { private String search; private GroupOrderBy orderBy; private SortOrder sort; + private Boolean archived; + private Boolean active; private Boolean statistics; private Boolean withCustomAttributes; private Boolean owned; @@ -83,6 +85,28 @@ public GroupFilter withSortOder(SortOrder sort) { return (this); } + /** + * Include group archived status. + * + * @param archived If true, returns only archived groups + * @return the reference to this GroupFilter instance + */ + public GroupFilter withArchived(Boolean archived) { + this.archived = archived; + return (this); + } + + /** + * Include group active status. + * + * @param active If true, returns only groups that are not archived and not marked for deletion. + * @return the reference to this GroupFilter instance + */ + public GroupFilter withActive(Boolean active) { + this.active = active; + return (this); + } + /** * Include group statistics (admins only). * @@ -162,6 +186,8 @@ public GitLabForm getQueryParams() { .withParam("search", search) .withParam("order_by", orderBy) .withParam("sort", sort) + .withParam("archived", archived) + .withParam("active", active) .withParam("statistics", statistics) .withParam("with_custom_attributes", withCustomAttributes) .withParam("owned", owned)