|
11 | 11 | import com.crowdin.client.core.model.PatchRequest;
|
12 | 12 | import com.crowdin.client.core.model.ResponseList;
|
13 | 13 | import com.crowdin.client.core.model.ResponseObject;
|
14 |
| -import com.crowdin.client.projectsgroups.model.AddGroupRequest; |
15 |
| -import com.crowdin.client.projectsgroups.model.AddProjectFileFormatSettingsRequest; |
16 |
| -import com.crowdin.client.projectsgroups.model.AddProjectRequest; |
17 |
| -import com.crowdin.client.projectsgroups.model.FileFormatSettingsResource; |
18 |
| -import com.crowdin.client.projectsgroups.model.FileFormatSettingsResponseList; |
19 |
| -import com.crowdin.client.projectsgroups.model.FileFormatSettingsResponseObject; |
20 |
| -import com.crowdin.client.projectsgroups.model.Group; |
21 |
| -import com.crowdin.client.projectsgroups.model.GroupResponseList; |
22 |
| -import com.crowdin.client.projectsgroups.model.GroupResponseObject; |
23 |
| -import com.crowdin.client.projectsgroups.model.Project; |
24 |
| -import com.crowdin.client.projectsgroups.model.ProjectResponseList; |
25 |
| -import com.crowdin.client.projectsgroups.model.ProjectResponseObject; |
26 |
| -import com.crowdin.client.projectsgroups.model.StringsExporterSettingsRequest; |
27 |
| -import com.crowdin.client.projectsgroups.model.StringsExporterSettingsResource; |
28 |
| -import com.crowdin.client.projectsgroups.model.StringsExporterSettingsResponseList; |
29 |
| -import com.crowdin.client.projectsgroups.model.StringsExporterSettingsResponseObject; |
| 14 | +import com.crowdin.client.projectsgroups.model.*; |
30 | 15 |
|
31 | 16 | import java.util.List;
|
32 | 17 | import java.util.Map;
|
@@ -61,6 +46,18 @@ public ResponseList<Group> listGroups(Long parentId, Integer limit, Integer offs
|
61 | 46 | return GroupResponseList.to(groupResponseList);
|
62 | 47 | }
|
63 | 48 |
|
| 49 | + public ResponseList<Group> listGroups(ListGroupOptions options) throws HttpException, HttpBadRequestException { |
| 50 | + Map<String, Optional<Object>> queryParams = HttpRequestConfig.buildUrlParams( |
| 51 | + "parentId", Optional.ofNullable(options.getParentId()), |
| 52 | + "userId", Optional.ofNullable(options.getUserId()), |
| 53 | + "orderBy", Optional.ofNullable(options.getOrderBy()), |
| 54 | + "limit", Optional.ofNullable(options.getLimit()), |
| 55 | + "offset", Optional.ofNullable(options.getOffset()) |
| 56 | + ); |
| 57 | + GroupResponseList groupResponseList = this.httpClient.get(this.url + "/groups", new HttpRequestConfig(queryParams), GroupResponseList.class); |
| 58 | + return GroupResponseList.to(groupResponseList); |
| 59 | + } |
| 60 | + |
64 | 61 | /**
|
65 | 62 | * @param request request object
|
66 | 63 | * @return newly created group
|
@@ -130,6 +127,19 @@ public ResponseList<? extends Project> listProjects(Long groupId, Integer hasMan
|
130 | 127 | return ProjectResponseList.to(projectResponseList);
|
131 | 128 | }
|
132 | 129 |
|
| 130 | + public ResponseList<? extends Project> listProjects(ListProjectOptions options) throws HttpException, HttpBadRequestException { |
| 131 | + Map<String, Optional<Object>> queryParams = HttpRequestConfig.buildUrlParams( |
| 132 | + "groupId", Optional.ofNullable(options.getGroupId()), |
| 133 | + "hasManagerAccess", Optional.ofNullable(options.getHasManagerAccess()), |
| 134 | + "orderBy", Optional.ofNullable(options.getOrderBy()), |
| 135 | + "type", Optional.ofNullable(options.getType()), |
| 136 | + "limit", Optional.ofNullable(options.getLimit()), |
| 137 | + "offset", Optional.ofNullable(options.getOffset()) |
| 138 | + ); |
| 139 | + ProjectResponseList projectResponseList = this.httpClient.get(this.url + "/projects", new HttpRequestConfig(queryParams), ProjectResponseList.class); |
| 140 | + return ProjectResponseList.to(projectResponseList); |
| 141 | + } |
| 142 | + |
133 | 143 | /**
|
134 | 144 | * @param request request object
|
135 | 145 | * @return newly created project
|
|
0 commit comments