|
23 | 23 |
|
24 | 24 | package org.gitlab4j.api; |
25 | 25 |
|
26 | | -import java.io.UnsupportedEncodingException; |
27 | | -import java.net.URLEncoder; |
28 | | -import java.util.List; |
29 | | - |
30 | | -import javax.ws.rs.core.Form; |
31 | | -import javax.ws.rs.core.GenericType; |
32 | | -import javax.ws.rs.core.Response; |
33 | | - |
34 | 26 | import org.gitlab4j.api.GitLabApi.ApiVersion; |
35 | 27 | import org.gitlab4j.api.models.Event; |
36 | 28 | import org.gitlab4j.api.models.Issue; |
37 | 29 | import org.gitlab4j.api.models.Member; |
38 | 30 | import org.gitlab4j.api.models.Project; |
39 | 31 | import org.gitlab4j.api.models.ProjectHook; |
| 32 | +import org.gitlab4j.api.models.ProjectUser; |
40 | 33 | import org.gitlab4j.api.models.Snippet; |
41 | 34 | import org.gitlab4j.api.models.Visibility; |
42 | 35 |
|
| 36 | +import javax.ws.rs.core.Form; |
| 37 | +import javax.ws.rs.core.GenericType; |
| 38 | +import javax.ws.rs.core.Response; |
| 39 | +import java.io.UnsupportedEncodingException; |
| 40 | +import java.net.URLEncoder; |
| 41 | +import java.util.List; |
| 42 | + |
43 | 43 | /** |
44 | 44 | * This class provides an entry point to all the GitLab API project calls. |
45 | 45 | */ |
@@ -112,8 +112,8 @@ public Pager<Project> getProjects(int itemsPerPage) throws GitLabApiException { |
112 | 112 | * Constants.ProjectOrderBy, Constants.SortOrder, String, Boolean, Boolean, Boolean, Boolean, Boolean)} |
113 | 113 | */ |
114 | 114 | public List<Project> getProjects(Boolean archived, Visibility visibility, String orderBy, |
115 | | - String sort, String search, Boolean simple, Boolean owned, Boolean membership, |
116 | | - Boolean starred, Boolean statistics) throws GitLabApiException { |
| 115 | + String sort, String search, Boolean simple, Boolean owned, Boolean membership, |
| 116 | + Boolean starred, Boolean statistics) throws GitLabApiException { |
117 | 117 |
|
118 | 118 | GitLabApiForm formData = new GitLabApiForm() |
119 | 119 | .withParam("archived", archived) |
@@ -921,6 +921,17 @@ public void removeMember(Integer projectId, Integer userId) throws GitLabApiExce |
921 | 921 | delete(expectedStatus, null, "projects", projectId, "members", userId); |
922 | 922 | } |
923 | 923 |
|
| 924 | + /** |
| 925 | + * Get a list of project users. This list includes all project members and all users assigned to project parent groups. |
| 926 | + * @param projectId the project ID to get users for |
| 927 | + * @return the users belonging to the specified project and its parent groups |
| 928 | + * @throws GitLabApiException |
| 929 | + */ |
| 930 | + public List<ProjectUser> getProjectUsers(Integer projectId) throws GitLabApiException { |
| 931 | + Response response = get(Response.Status.OK, this.getDefaultPerPageParam(), "projects", projectId, "users"); |
| 932 | + return (response.readEntity(new GenericType<List<ProjectUser>>() {})); |
| 933 | + } |
| 934 | + |
924 | 935 | /** |
925 | 936 | * Get the project events for specific project. Sorted from newest to latest. |
926 | 937 | * |
|
0 commit comments