Unverified Commit d8a7ea93 authored by Jérémie Bresson's avatar Jérémie Bresson Committed by GitHub
Browse files

Add getDescendantGroups() methods to GroupApi (#907)

* Add getDescendantGroups() methods to GroupApi

* Update javadoc
parent 336a8c89
...@@ -350,6 +350,50 @@ public class GroupApi extends AbstractApi { ...@@ -350,6 +350,50 @@ public class GroupApi extends AbstractApi {
return (getSubGroups(groupIdOrPath, skipGroups, allAvailable, search, orderBy, sortOrder, statistics, owned, getDefaultPerPage()).stream()); return (getSubGroups(groupIdOrPath, skipGroups, allAvailable, search, orderBy, sortOrder, statistics, owned, getDefaultPerPage()).stream());
} }
/**
* Get a list of visible descendant groups of a given group for the authenticated user using the provided filter.
*
* <pre><code>GitLab Endpoint: GET /groups/:id/descendant_groups</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path, required
* @param filter the GroupFilter to match against
* @return a List&lt;Group&gt; of the matching groups
* @throws GitLabApiException if any exception occurs
*/
public List<Group> getDescendantGroups(Object groupIdOrPath, GroupFilter filter) throws GitLabApiException {
return (getDescendantGroups(groupIdOrPath, filter, getDefaultPerPage()).all());
}
/**
* Get a Pager of visible descendant groups of a given group for the authenticated user using the provided filter.
*
* <pre><code>GitLab Endpoint: GET /groups/:id/descendant_groups</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path, required
* @param filter the GroupFilter to match against
* @param itemsPerPage the number of Group instances that will be fetched per page
* @return a Pager containing matching Group instances
* @throws GitLabApiException if any exception occurs
*/
public Pager<Group> getDescendantGroups(Object groupIdOrPath, GroupFilter filter, int itemsPerPage) throws GitLabApiException {
GitLabApiForm formData = filter.getQueryParams();
return (new Pager<Group>(this, Group.class, itemsPerPage, formData.asMap(), "groups", getGroupIdOrPath(groupIdOrPath), "descendant_groups"));
}
/**
* Get a Stream of visible descendant groups of a given group for the authenticated user using the provided filter.
*
* <pre><code>GitLab Endpoint: GET /groups/:id/descendant_groups</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path, required
* @param filter the GroupFilter to match against
* @return a Stream&lt;Group&gt; of the matching groups
* @throws GitLabApiException if any exception occurs
*/
public Stream<Group> getDescendantGroupsStream(Object groupIdOrPath, GroupFilter filter) throws GitLabApiException {
return (getDescendantGroups(groupIdOrPath, filter, getDefaultPerPage()).stream());
}
/** /**
* Get a list of projects belonging to the specified group ID and filter. * Get a list of projects belonging to the specified group ID and filter.
* *
......
...@@ -7,7 +7,7 @@ import org.gitlab4j.api.Constants.SortOrder; ...@@ -7,7 +7,7 @@ import org.gitlab4j.api.Constants.SortOrder;
import org.gitlab4j.api.GitLabApiForm; import org.gitlab4j.api.GitLabApiForm;
/** /**
* This class is used to filter Projects when getting lists of projects for a specified group. * This class is used to filter Groups when getting lists of groups.
*/ */
public class GroupFilter { public class GroupFilter {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment