|
4 | 4 | import com.crowdin.client.core.http.HttpRequestConfig; |
5 | 5 | import com.crowdin.client.core.http.exceptions.HttpBadRequestException; |
6 | 6 | import com.crowdin.client.core.http.exceptions.HttpException; |
7 | | -import com.crowdin.client.core.model.ClientConfig; |
8 | | -import com.crowdin.client.core.model.Credentials; |
9 | | -import com.crowdin.client.core.model.DownloadLink; |
10 | | -import com.crowdin.client.core.model.DownloadLinkResponseObject; |
11 | | -import com.crowdin.client.core.model.PatchRequest; |
12 | | -import com.crowdin.client.core.model.ResponseList; |
13 | | -import com.crowdin.client.core.model.ResponseObject; |
| 7 | +import com.crowdin.client.core.model.*; |
14 | 8 | import com.crowdin.client.sourcefiles.model.*; |
15 | 9 |
|
16 | 10 | import java.util.List; |
@@ -47,6 +41,29 @@ public ResponseList<Branch> listBranches(Long projectId, String name, Integer li |
47 | 41 | return BranchResponseList.to(branchResponseList); |
48 | 42 | } |
49 | 43 |
|
| 44 | + /** |
| 45 | + * @param projectId project identifier |
| 46 | + * @param name filter by branch name |
| 47 | + * @param limit maximum number of items to retrieve (default 25) |
| 48 | + * @param offset starting offset in the collection (default 0) |
| 49 | + * @param orderBy list of OrderByField |
| 50 | + * @return list of branches |
| 51 | + * @see <ul> |
| 52 | + * <li><a href="https://developer.crowdin.com/api/v2/#operation/api.projects.branches.getMany" target="_blank"><b>API Documentation</b></a></li> |
| 53 | + * <li><a href="https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.branches.getMany" target="_blank"><b>Enterprise API Documentation</b></a></li> |
| 54 | + * </ul> |
| 55 | + */ |
| 56 | + public ResponseList<Branch> listBranches(Long projectId, String name, Integer limit, Integer offset, List<OrderByField> orderBy) throws HttpException, HttpBadRequestException { |
| 57 | + Map<String, Optional<Object>> queryParams = HttpRequestConfig.buildUrlParams( |
| 58 | + "name", Optional.ofNullable(name), |
| 59 | + "limit", Optional.ofNullable(limit), |
| 60 | + "offset", Optional.ofNullable(offset), |
| 61 | + "orderBy", Optional.ofNullable(OrderByField.generateSortParam(orderBy)) |
| 62 | + ); |
| 63 | + BranchResponseList branchResponseList = this.httpClient.get(this.url + "/projects/" + projectId + "/branches", new HttpRequestConfig(queryParams), BranchResponseList.class); |
| 64 | + return BranchResponseList.to(branchResponseList); |
| 65 | + } |
| 66 | + |
50 | 67 | /** |
51 | 68 | * @param projectId project identifier |
52 | 69 | * @param request request object |
@@ -129,6 +146,35 @@ public ResponseList<Directory> listDirectories(Long projectId, Long branchId, Lo |
129 | 146 | return DirectoryResponseList.to(directoryResponseList); |
130 | 147 | } |
131 | 148 |
|
| 149 | + /** |
| 150 | + * @param projectId project identifier |
| 151 | + * @param branchId filter by branch id |
| 152 | + * @param directoryId filter by directory id |
| 153 | + * @param filter filter directories by name |
| 154 | + * @param recursion use to list directories recursively |
| 155 | + * @param limit maximum number of items to retrieve (default 25) |
| 156 | + * @param offset starting offset in the collection (default 0) |
| 157 | + * @param orderBy list of OrderByField |
| 158 | + * @return list of directories |
| 159 | + * @see <ul> |
| 160 | + * <li><a href="https://developer.crowdin.com/api/v2/#operation/api.projects.directories.getMany" target="_blank"><b>API Documentation</b></a></li> |
| 161 | + * <li><a href="https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.directories.getMany" target="_blank"><b>Enterprise API Documentation</b></a></li> |
| 162 | + * </ul> |
| 163 | + */ |
| 164 | + public ResponseList<Directory> listDirectories(Long projectId, Long branchId, Long directoryId, String filter, Object recursion, Integer limit, Integer offset, List<OrderByField> orderBy) throws HttpException, HttpBadRequestException { |
| 165 | + Map<String, Optional<Object>> queryParams = HttpRequestConfig.buildUrlParams( |
| 166 | + "branchId", Optional.ofNullable(branchId), |
| 167 | + "directoryId", Optional.ofNullable(directoryId), |
| 168 | + "filter", Optional.ofNullable(filter), |
| 169 | + "recursion", Optional.ofNullable(recursion), |
| 170 | + "limit", Optional.ofNullable(limit), |
| 171 | + "offset", Optional.ofNullable(offset), |
| 172 | + "orderBy", Optional.ofNullable(OrderByField.generateSortParam(orderBy)) |
| 173 | + ); |
| 174 | + DirectoryResponseList directoryResponseList = this.httpClient.get(this.url + "/projects/" + projectId + "/directories", new HttpRequestConfig(queryParams), DirectoryResponseList.class); |
| 175 | + return DirectoryResponseList.to(directoryResponseList); |
| 176 | + } |
| 177 | + |
132 | 178 | /** |
133 | 179 | * @param projectId project identifier |
134 | 180 | * @param request request object |
@@ -211,6 +257,35 @@ public ResponseList<? extends FileInfo> listFiles(Long projectId, Long branchId, |
211 | 257 | return FileInfoResponseList.to(fileInfoResponseList); |
212 | 258 | } |
213 | 259 |
|
| 260 | + /** |
| 261 | + * @param projectId project identifier |
| 262 | + * @param branchId filter by branch id |
| 263 | + * @param directoryId filter by directory id |
| 264 | + * @param filter filter files by name |
| 265 | + * @param recursion use to list directories recursively |
| 266 | + * @param limit maximum number of items to retrieve (default 25) |
| 267 | + * @param offset starting offset in the collection (default 0) |
| 268 | + * @param orderBy list of OrderByField |
| 269 | + * @return list of files |
| 270 | + * @see <ul> |
| 271 | + * <li><a href="https://developer.crowdin.com/api/v2/#operation/api.projects.files.getMany" target="_blank"><b>API Documentation</b></a></li> |
| 272 | + * <li><a href="https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.files.getMany" target="_blank"><b>Enterprise API Documentation</b></a></li> |
| 273 | + * </ul> |
| 274 | + */ |
| 275 | + public ResponseList<? extends FileInfo> listFiles(Long projectId, Long branchId, Long directoryId, String filter, Object recursion, Integer limit, Integer offset, List<OrderByField> orderBy) throws HttpException, HttpBadRequestException { |
| 276 | + Map<String, Optional<Object>> queryParams = HttpRequestConfig.buildUrlParams( |
| 277 | + "branchId", Optional.ofNullable(branchId), |
| 278 | + "directoryId", Optional.ofNullable(directoryId), |
| 279 | + "filter", Optional.ofNullable(filter), |
| 280 | + "recursion", Optional.ofNullable(recursion), |
| 281 | + "limit", Optional.ofNullable(limit), |
| 282 | + "offset", Optional.ofNullable(offset), |
| 283 | + "orderBy", Optional.ofNullable(OrderByField.generateSortParam(orderBy)) |
| 284 | + ); |
| 285 | + FileInfoResponseList fileInfoResponseList = this.httpClient.get(this.url + "/projects/" + projectId + "/files", new HttpRequestConfig(queryParams), FileInfoResponseList.class); |
| 286 | + return FileInfoResponseList.to(fileInfoResponseList); |
| 287 | + } |
| 288 | + |
214 | 289 | /** |
215 | 290 | * @param projectId project identifier |
216 | 291 | * @param request request object |
|
0 commit comments