|
12 | 12 | import org.gitlab4j.api.models.Group;
|
13 | 13 | import org.gitlab4j.api.models.Member;
|
14 | 14 | import org.gitlab4j.api.models.Project;
|
| 15 | +import org.gitlab4j.api.models.User; |
15 | 16 | import org.gitlab4j.api.models.Visibility;
|
16 | 17 |
|
17 | 18 | /**
|
@@ -97,14 +98,132 @@ public List<Group> getGroups(String search, int page, int perPage) throws GitLab
|
97 | 98 | *
|
98 | 99 | * @param search the group name or path search criteria
|
99 | 100 | * @param itemsPerPage the number of Group instances that will be fetched per page
|
100 |
| - * @return a List containing matching Group instances |
| 101 | + * @return a Pager containing matching Group instances |
101 | 102 | * @throws GitLabApiException if any exception occurs
|
102 | 103 | */
|
103 | 104 | public Pager<Group> getGroups(String search, int itemsPerPage) throws GitLabApiException {
|
104 | 105 | Form formData = new GitLabApiForm().withParam("search", search);
|
105 | 106 | return (new Pager<Group>(this, Group.class, itemsPerPage, formData.asMap(), "groups"));
|
106 | 107 | }
|
107 | 108 |
|
| 109 | + /** |
| 110 | + * Get a list of visible direct subgroups in this group. |
| 111 | + * |
| 112 | + * <p><code>GET /groups/:id/subgroups</code></p> |
| 113 | + * |
| 114 | + * @param groupId the group ID to get the sub groups for |
| 115 | + * @return a List<Group> containing the group's sub-groups |
| 116 | + * @throws GitLabApiException if any exception occurs |
| 117 | + * @since GitLab 10.3.0 |
| 118 | + */ |
| 119 | + public List<Group> getSubGroups(Integer groupId) throws GitLabApiException { |
| 120 | + return (getSubGroups(groupId, null, null, null, null, null, null, null, 1, getDefaultPerPage())); |
| 121 | + } |
| 122 | + |
| 123 | + /** |
| 124 | + * Get a list of visible direct subgroups in this group. |
| 125 | + * |
| 126 | + * <p><code>GET /groups/:id/subgroups</code></p> |
| 127 | + * |
| 128 | + * @param groupId the group ID to get the sub groups for |
| 129 | + * @param skipGroups skip the group IDs passed |
| 130 | + * @param allAvailable show all the groups you have access to (defaults to false for authenticated users) |
| 131 | + * @param search return the list of authorized groups matching the search criteria |
| 132 | + * @param orderBy order groups by NAME or PATH. Default is NAME |
| 133 | + * @param sortOrder order groups in ASC or DESC order. Default is ASC |
| 134 | + * @param statistics include group statistics (admins only) |
| 135 | + * @param owned limit to groups owned by the current user |
| 136 | + * @return a List<Group> of the matching subgroups |
| 137 | + * @throws GitLabApiException if any exception occurs |
| 138 | + * @since GitLab 10.3.0 |
| 139 | + */ |
| 140 | + public List<Group> getSubGroups(Integer groupId, List<Integer> skipGroups, Boolean allAvailable, String search, |
| 141 | + GroupOrderBy orderBy, SortOrder sortOrder, Boolean statistics, Boolean owned) throws GitLabApiException { |
| 142 | + return (getSubGroups(groupId, skipGroups, allAvailable, search, orderBy, sortOrder, statistics, owned, 1, getDefaultPerPage())); |
| 143 | + } |
| 144 | + |
| 145 | + /** |
| 146 | + * Get a list of visible direct subgroups in this group. |
| 147 | + * |
| 148 | + * <p><code>GET /groups/:id/subgroups</code></p> |
| 149 | + * |
| 150 | + * @param groupId the group ID to get the sub groups for |
| 151 | + * @param skipGroups skip the group IDs passed |
| 152 | + * @param allAvailable show all the groups you have access to (defaults to false for authenticated users) |
| 153 | + * @param search return the list of authorized groups matching the search criteria |
| 154 | + * @param orderBy order groups by NAME or PATH. Default is NAME |
| 155 | + * @param sortOrder order groups in ASC or DESC order. Default is ASC |
| 156 | + * @param statistics include group statistics (admins only) |
| 157 | + * @param owned limit to groups owned by the current user |
| 158 | + * @param page the page to get |
| 159 | + * @param perPage the number of Group instances per page |
| 160 | + * @return a List<Group> of the matching subgroups |
| 161 | + * @throws GitLabApiException if any exception occurs |
| 162 | + * @since GitLab 10.3.0 |
| 163 | + */ |
| 164 | + public List<Group> getSubGroups(Integer groupId, List<Integer> skipGroups, Boolean allAvailable, String search, |
| 165 | + GroupOrderBy orderBy, SortOrder sortOrder, Boolean statistics, Boolean owned, int page, int perPage) |
| 166 | + throws GitLabApiException { |
| 167 | + Form formData = new GitLabApiForm() |
| 168 | + .withParam("skip_groups", skipGroups) |
| 169 | + .withParam("all_available", allAvailable) |
| 170 | + .withParam("search", search) |
| 171 | + .withParam("order_by", orderBy) |
| 172 | + .withParam("sort_order", sortOrder) |
| 173 | + .withParam("statistics", statistics) |
| 174 | + .withParam("owned", owned) |
| 175 | + .withParam(PAGE_PARAM, page) |
| 176 | + .withParam(PER_PAGE_PARAM, perPage); |
| 177 | + Response response = get(Response.Status.OK, formData.asMap(), "groups", groupId, "subgroups"); |
| 178 | + return (response.readEntity(new GenericType<List<Group>>() {})); |
| 179 | + } |
| 180 | + |
| 181 | + /** |
| 182 | + * Get a Pager of visible direct subgroups in this group. |
| 183 | + * |
| 184 | + * <p><code>GET /groups/:id/subgroups</code></p> |
| 185 | + * |
| 186 | + * @param groupId the group ID to get the sub groups for |
| 187 | + * @param itemsPerPage the number of Group instances that will be fetched per page |
| 188 | + * @return a Pager containing matching Group instances |
| 189 | + * @throws GitLabApiException if any exception occurs |
| 190 | + * @since GitLab 10.3.0 |
| 191 | + */ |
| 192 | + public Pager<Group> getSubGroups(Integer groupId, int itemsPerPage) throws GitLabApiException { |
| 193 | + return (new Pager<Group>(this, Group.class, itemsPerPage, null, "groups", groupId, "subgroups")); |
| 194 | + } |
| 195 | + |
| 196 | + /** |
| 197 | + * Get a Pager of visible direct subgroups in this group. |
| 198 | + * |
| 199 | + * <p><code>GET /groups/:id/subgroups</code></p> |
| 200 | + * |
| 201 | + * @param groupId the group ID to get the sub groups for |
| 202 | + * @param skipGroups skip the group IDs passed |
| 203 | + * @param allAvailable show all the groups you have access to (defaults to false for authenticated users) |
| 204 | + * @param search return the list of authorized groups matching the search criteria |
| 205 | + * @param orderBy order groups by NAME or PATH. Default is NAME |
| 206 | + * @param sortOrder order groups in ASC or DESC order. Default is ASC |
| 207 | + * @param statistics include group statistics (admins only) |
| 208 | + * @param owned limit to groups owned by the current user |
| 209 | + * @param itemsPerPage the number of Group instances that will be fetched per page |
| 210 | + * @return a Pager containing matching Group instances |
| 211 | + * @throws GitLabApiException if any exception occurs |
| 212 | + * @since GitLab 10.3.0 |
| 213 | + */ |
| 214 | + public Pager<Group> getSubGroups(Integer groupId, List<Integer> skipGroups, Boolean allAvailable, String search, |
| 215 | + GroupOrderBy orderBy, SortOrder sortOrder, Boolean statistics, Boolean owned, int itemsPerPage) throws GitLabApiException { |
| 216 | + Form formData = new GitLabApiForm() |
| 217 | + .withParam("skip_groups", skipGroups) |
| 218 | + .withParam("all_available", allAvailable) |
| 219 | + .withParam("search", search) |
| 220 | + .withParam("order_by", orderBy) |
| 221 | + .withParam("sort_order", sortOrder) |
| 222 | + .withParam("statistics", statistics) |
| 223 | + .withParam("owned", owned); |
| 224 | + return (new Pager<Group>(this, Group.class, itemsPerPage, formData.asMap(), "groups", groupId, "subgroups")); |
| 225 | + } |
| 226 | + |
108 | 227 | /**
|
109 | 228 | * Get a list of projects belonging to the specified group ID.
|
110 | 229 | *
|
|
0 commit comments