|
12 | 12 | import org.gitlab4j.api.GitLabApi.ApiVersion;
|
13 | 13 | import org.gitlab4j.api.models.AccessLevel;
|
14 | 14 | import org.gitlab4j.api.models.Group;
|
| 15 | +import org.gitlab4j.api.models.GroupFilter; |
15 | 16 | import org.gitlab4j.api.models.Member;
|
16 | 17 | import org.gitlab4j.api.models.Project;
|
17 | 18 | import org.gitlab4j.api.models.GroupProjectsFilter;
|
@@ -128,6 +129,47 @@ public Stream<Group> getGroupsStream(String search) throws GitLabApiException {
|
128 | 129 | return (getGroups(search, getDefaultPerPage()).stream());
|
129 | 130 | }
|
130 | 131 |
|
| 132 | + /** |
| 133 | + * Get a list of visible groups for the authenticated user using the provided filter. |
| 134 | + * |
| 135 | + * <pre><code>GitLab Endpoint: GET /groups</code></pre> |
| 136 | + * |
| 137 | + * @param filter the GroupFilter to match against |
| 138 | + * @return a List<Group> of the matching groups |
| 139 | + * @throws GitLabApiException if any exception occurs |
| 140 | + */ |
| 141 | + public List<Group> getGroups(GroupFilter filter) throws GitLabApiException { |
| 142 | + return (getGroups(filter, getDefaultPerPage()).all()); |
| 143 | + } |
| 144 | + |
| 145 | + /** |
| 146 | + * Get a Pager of visible groups for the authenticated user using the provided filter. |
| 147 | + * |
| 148 | + * <pre><code>GitLab Endpoint: GET /groups</code></pre> |
| 149 | + * |
| 150 | + * @param filter the GroupFilter to match against |
| 151 | + * @param itemsPerPage the number of Group instances that will be fetched per page |
| 152 | + * @return a Pager containing matching Group instances |
| 153 | + * @throws GitLabApiException if any exception occurs |
| 154 | + */ |
| 155 | + public Pager<Group> getGroups(GroupFilter filter, int itemsPerPage) throws GitLabApiException { |
| 156 | + GitLabApiForm formData = filter.getQueryParams(); |
| 157 | + return (new Pager<Group>(this, Group.class, itemsPerPage, formData.asMap(), "groups")); |
| 158 | + } |
| 159 | + |
| 160 | + /** |
| 161 | + * Get a Stream of visible groups for the authenticated user using the provided filter. |
| 162 | + * |
| 163 | + * <pre><code>GitLab Endpoint: GET /groups</code></pre> |
| 164 | + * |
| 165 | + * @param filter the GroupFilter to match against |
| 166 | + * @return a Stream<Group> of the matching groups |
| 167 | + * @throws GitLabApiException if any exception occurs |
| 168 | + */ |
| 169 | + public Stream<Group> getGroupsStream(GroupFilter filter) throws GitLabApiException { |
| 170 | + return (getGroups(filter, getDefaultPerPage()).stream()); |
| 171 | + } |
| 172 | + |
131 | 173 | /**
|
132 | 174 | * Get a list of visible direct subgroups in this group.
|
133 | 175 | *
|
|
0 commit comments