Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
d8a7ea93
Unverified
Commit
d8a7ea93
authored
Mar 30, 2023
by
Jérémie Bresson
Committed by
GitHub
Mar 30, 2023
Browse files
Add getDescendantGroups() methods to GroupApi (#907)
* Add getDescendantGroups() methods to GroupApi * Update javadoc
parent
336a8c89
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/GroupApi.java
View file @
d8a7ea93
...
...
@@ -350,6 +350,50 @@ public class GroupApi extends AbstractApi {
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<Group> 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<Group> 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.
*
...
...
src/main/java/org/gitlab4j/api/models/GroupFilter.java
View file @
d8a7ea93
...
...
@@ -7,7 +7,7 @@ import org.gitlab4j.api.Constants.SortOrder;
import
org.gitlab4j.api.GitLabApiForm
;
/**
* This class is used to filter
P
ro
ject
s when getting lists of
projects for a specified
group.
* This class is used to filter
G
ro
up
s when getting lists of group
s
.
*/
public
class
GroupFilter
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment