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
e95af61d
Commit
e95af61d
authored
Feb 18, 2019
by
Greg Messner
Browse files
Added support to get groups with filter (#302).
parent
5a7f99c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/Constants.java
View file @
e95af61d
...
@@ -180,7 +180,7 @@ public interface Constants {
...
@@ -180,7 +180,7 @@ public interface Constants {
/** Enum to use for ordering the results of getGroups() and getSubGroups(). */
/** Enum to use for ordering the results of getGroups() and getSubGroups(). */
public
enum
GroupOrderBy
{
public
enum
GroupOrderBy
{
NAME
,
PATH
;
NAME
,
PATH
,
ID
;
private
static
JacksonJsonEnumHelper
<
GroupOrderBy
>
enumHelper
=
new
JacksonJsonEnumHelper
<>(
GroupOrderBy
.
class
);
private
static
JacksonJsonEnumHelper
<
GroupOrderBy
>
enumHelper
=
new
JacksonJsonEnumHelper
<>(
GroupOrderBy
.
class
);
@JsonCreator
@JsonCreator
...
...
src/main/java/org/gitlab4j/api/GroupApi.java
View file @
e95af61d
...
@@ -12,6 +12,7 @@ import javax.ws.rs.core.Response;
...
@@ -12,6 +12,7 @@ import javax.ws.rs.core.Response;
import
org.gitlab4j.api.GitLabApi.ApiVersion
;
import
org.gitlab4j.api.GitLabApi.ApiVersion
;
import
org.gitlab4j.api.models.AccessLevel
;
import
org.gitlab4j.api.models.AccessLevel
;
import
org.gitlab4j.api.models.Group
;
import
org.gitlab4j.api.models.Group
;
import
org.gitlab4j.api.models.GroupFilter
;
import
org.gitlab4j.api.models.Member
;
import
org.gitlab4j.api.models.Member
;
import
org.gitlab4j.api.models.Project
;
import
org.gitlab4j.api.models.Project
;
import
org.gitlab4j.api.models.GroupProjectsFilter
;
import
org.gitlab4j.api.models.GroupProjectsFilter
;
...
@@ -128,6 +129,47 @@ public class GroupApi extends AbstractApi {
...
@@ -128,6 +129,47 @@ public class GroupApi extends AbstractApi {
return
(
getGroups
(
search
,
getDefaultPerPage
()).
stream
());
return
(
getGroups
(
search
,
getDefaultPerPage
()).
stream
());
}
}
/**
* Get a list of visible groups for the authenticated user using the provided filter.
*
* <pre><code>GitLab Endpoint: GET /groups</code></pre>
*
* @param filter the GroupFilter to match against
* @return a List<Group> of the matching groups
* @throws GitLabApiException if any exception occurs
*/
public
List
<
Group
>
getGroups
(
GroupFilter
filter
)
throws
GitLabApiException
{
return
(
getGroups
(
filter
,
getDefaultPerPage
()).
all
());
}
/**
* Get a Pager of visible groups for the authenticated user using the provided filter.
*
* <pre><code>GitLab Endpoint: GET /groups</code></pre>
*
* @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
>
getGroups
(
GroupFilter
filter
,
int
itemsPerPage
)
throws
GitLabApiException
{
GitLabApiForm
formData
=
filter
.
getQueryParams
();
return
(
new
Pager
<
Group
>(
this
,
Group
.
class
,
itemsPerPage
,
formData
.
asMap
(),
"groups"
));
}
/**
* Get a Stream of visible groups for the authenticated user using the provided filter.
*
* <pre><code>GitLab Endpoint: GET /groups</code></pre>
*
* @param filter the GroupFilter to match against
* @return a Stream<Group> of the matching groups
* @throws GitLabApiException if any exception occurs
*/
public
Stream
<
Group
>
getGroupsStream
(
GroupFilter
filter
)
throws
GitLabApiException
{
return
(
getGroups
(
filter
,
getDefaultPerPage
()).
stream
());
}
/**
/**
* Get a list of visible direct subgroups in this group.
* Get a list of visible direct subgroups in this group.
*
*
...
...
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