|
5 | 5 | import com.crowdin.client.core.http.exceptions.HttpBadRequestException; |
6 | 6 | import com.crowdin.client.core.http.exceptions.HttpException; |
7 | 7 | import com.crowdin.client.core.model.*; |
8 | | -import com.crowdin.client.teams.model.TeamResponseObject; |
9 | 8 | import com.crowdin.client.users.model.*; |
10 | 9 |
|
11 | 10 | import java.util.List; |
@@ -40,6 +39,26 @@ public ResponseList<GroupManager> listGroupManagers(Long groupId, List<Long> tea |
40 | 39 | return GroupManagerResponseList.to(response); |
41 | 40 | } |
42 | 41 |
|
| 42 | + /** |
| 43 | + * List group managers. For Crowdin Enterprise only |
| 44 | + * @param groupId Group Identifier. Get via List Groups |
| 45 | + * @param params ListGroupManagersParams |
| 46 | + * @return list of group managers |
| 47 | + * @see <ul> |
| 48 | + * <li><a href="https://developer.crowdin.com/enterprise/api/v2/#operation/api.groups.managers.getMany" target="_blank"><b>Enterprise API Documentation</b></a></li> |
| 49 | + * </ul> |
| 50 | + */ |
| 51 | + public ResponseList<GroupManager> listGroupManagers(Long groupId, ListGroupManagersParams params) throws HttpException, HttpBadRequestException { |
| 52 | + ListGroupManagersParams query = Optional.ofNullable(params).orElse(new ListGroupManagersParams()); |
| 53 | + |
| 54 | + Map<String, Optional<Object>> queryParams = HttpRequestConfig.buildUrlParams( |
| 55 | + "teamIds", Optional.ofNullable(query.getTeamIds()), |
| 56 | + "orderBy", Optional.ofNullable(OrderByField.generateSortParam(query.getOrderBy())) |
| 57 | + ); |
| 58 | + GroupManagerResponseList response = this.httpClient.get(this.url + "/groups/" + groupId + "/managers", new HttpRequestConfig(queryParams), GroupManagerResponseList.class); |
| 59 | + return GroupManagerResponseList.to(response); |
| 60 | + } |
| 61 | + |
43 | 62 | /** |
44 | 63 | * Update group managers. For Crowdin Enterprise only |
45 | 64 | * @param groupId group identifier |
@@ -94,6 +113,34 @@ public ResponseList<ProjectMember> listProjectMembersEnterprise(Long projectId, |
94 | 113 | return ProjectMemberResponseList.to(response); |
95 | 114 | } |
96 | 115 |
|
| 116 | + /** |
| 117 | + * List project members. For Crowdin Enterprise only |
| 118 | + * @param projectId Project Identifier. Get via List Projects |
| 119 | + * @param search Search users by firstName, lastName or username |
| 120 | + * @param languageId Language Identifier. Get via Project Target Languages |
| 121 | + * @param workflowStepId Workflow Step Identifier. Get via List Workflow Steps |
| 122 | + * @param limit A maximum number of items to retrieve |
| 123 | + * @param offset A starting offset in the collection |
| 124 | + * @param orderBy list of OrderByField |
| 125 | + * @return list of project members |
| 126 | + * @see <ul> |
| 127 | + * <li><a href="https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.members.getMany" target="_blank"><b>Enterprise API Documentation</b></a></li> |
| 128 | + * </ul> |
| 129 | + */ |
| 130 | + public ResponseList<ProjectMember> listProjectMembersEnterprise(Long projectId, String search, String languageId, Long workflowStepId, Integer limit, Integer offset, List<OrderByField> orderBy) throws HttpException, HttpBadRequestException { |
| 131 | + String builtUrl = String.format("%s/projects/%d/members", this.url, projectId); |
| 132 | + Map<String, Optional<Object>> queryParams = HttpRequestConfig.buildUrlParams( |
| 133 | + "search", Optional.ofNullable(search), |
| 134 | + "languageId", Optional.ofNullable(languageId), |
| 135 | + "workflowStepId", Optional.ofNullable(workflowStepId), |
| 136 | + "limit", Optional.ofNullable(limit), |
| 137 | + "offset", Optional.ofNullable(offset), |
| 138 | + "orderBy", Optional.ofNullable(OrderByField.generateSortParam(orderBy)) |
| 139 | + ); |
| 140 | + ProjectMemberResponseList response = this.httpClient.get(builtUrl, new HttpRequestConfig(queryParams), ProjectMemberResponseList.class); |
| 141 | + return ProjectMemberResponseList.to(response); |
| 142 | + } |
| 143 | + |
97 | 144 | /** |
98 | 145 | * @param projectId project identifier |
99 | 146 | * @param request request object |
@@ -171,6 +218,31 @@ public ResponseList<User> listUsers(Status status, String search, TwoFactor twoF |
171 | 218 | return UserResponseList.to(userResponseList); |
172 | 219 | } |
173 | 220 |
|
| 221 | + /** |
| 222 | + * @param status filter by status |
| 223 | + * @param search search users by firstName, lastName, username, or email (2 or more characters) |
| 224 | + * @param twoFactor filter by two-factor authentication status |
| 225 | + * @param limit maximum number of items to retrieve (default 25) |
| 226 | + * @param offset starting offset in the collection (default 0) |
| 227 | + * @param orderBy list of OrderByField |
| 228 | + * @return list of users |
| 229 | + * @see <ul> |
| 230 | + * <li><a href="https://developer.crowdin.com/enterprise/api/v2/#operation/api.users.getMany" target="_blank"><b>Enterprise API Documentation</b></a></li> |
| 231 | + * </ul> |
| 232 | + */ |
| 233 | + public ResponseList<User> listUsers(Status status, String search, TwoFactor twoFactor, Integer limit, Integer offset, List<OrderByField> orderBy) throws HttpException, HttpBadRequestException { |
| 234 | + Map<String, Optional<Object>> queryParams = HttpRequestConfig.buildUrlParams( |
| 235 | + "status", Optional.ofNullable(status), |
| 236 | + "search", Optional.ofNullable(search), |
| 237 | + "twoFactor", Optional.ofNullable(twoFactor), |
| 238 | + "limit", Optional.ofNullable(limit), |
| 239 | + "offset", Optional.ofNullable(offset), |
| 240 | + "orderBy", Optional.ofNullable(OrderByField.generateSortParam(orderBy)) |
| 241 | + ); |
| 242 | + UserResponseList userResponseList = this.httpClient.get(this.url + "/users", new HttpRequestConfig(queryParams), UserResponseList.class); |
| 243 | + return UserResponseList.to(userResponseList); |
| 244 | + } |
| 245 | + |
174 | 246 | /** |
175 | 247 | * @param request request object |
176 | 248 | * @return invited user |
@@ -250,6 +322,28 @@ public ResponseList<TeamMember> listProjectMembers(Long projectId, String search |
250 | 322 | return TeamMemberResponseList.to(teamMemberResponseList); |
251 | 323 | } |
252 | 324 |
|
| 325 | + /** |
| 326 | + * @param projectId project identifier |
| 327 | + * @param search search users by firstName, lastName, username, or email (2 or more characters) |
| 328 | + * @param limit maximum number of items to retrieve (default 25) |
| 329 | + * @param offset starting offset in the collection (default 0) |
| 330 | + * @param orderBy list of OrderByField |
| 331 | + * @return list of team members |
| 332 | + * @see <ul> |
| 333 | + * <li><a href="https://developer.crowdin.com/api/v2/#operation/api.projects.members.getMany" target="_blank"><b>API Documentation</b></a></li> |
| 334 | + * </ul> |
| 335 | + */ |
| 336 | + public ResponseList<TeamMember> listProjectMembers(Long projectId, String search, Integer limit, Integer offset, List<OrderByField> orderBy) throws HttpException, HttpBadRequestException { |
| 337 | + Map<String, Optional<Object>> queryParams = HttpRequestConfig.buildUrlParams( |
| 338 | + "search", Optional.ofNullable(search), |
| 339 | + "limit", Optional.ofNullable(limit), |
| 340 | + "offset", Optional.ofNullable(offset), |
| 341 | + "orderBy", Optional.ofNullable(OrderByField.generateSortParam(orderBy)) |
| 342 | + ); |
| 343 | + TeamMemberResponseList teamMemberResponseList = this.httpClient.get(this.url + "/projects/" + projectId + "/members", new HttpRequestConfig(queryParams), TeamMemberResponseList.class); |
| 344 | + return TeamMemberResponseList.to(teamMemberResponseList); |
| 345 | + } |
| 346 | + |
253 | 347 | /** |
254 | 348 | * @param projectId project identifier |
255 | 349 | * @param memberId member identifier |
|
0 commit comments