|
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.glossaries.model.AddGlossaryRequest; |
15 |
| -import com.crowdin.client.glossaries.model.AddTermRequest; |
16 |
| -import com.crowdin.client.glossaries.model.Concept; |
17 |
| -import com.crowdin.client.glossaries.model.ConceptResponseList; |
18 |
| -import com.crowdin.client.glossaries.model.ConceptResponseObject; |
19 |
| -import com.crowdin.client.glossaries.model.ExportGlossaryRequest; |
20 |
| -import com.crowdin.client.glossaries.model.Glossary; |
21 |
| -import com.crowdin.client.glossaries.model.GlossaryExportStatus; |
22 |
| -import com.crowdin.client.glossaries.model.GlossaryExportStatusResponseObject; |
23 |
| -import com.crowdin.client.glossaries.model.GlossaryImportStatus; |
24 |
| -import com.crowdin.client.glossaries.model.GlossaryImportStatusResponseObject; |
25 |
| -import com.crowdin.client.glossaries.model.GlossaryResponseList; |
26 |
| -import com.crowdin.client.glossaries.model.GlossaryResponseObject; |
27 |
| -import com.crowdin.client.glossaries.model.ImportGlossaryRequest; |
28 |
| -import com.crowdin.client.glossaries.model.SearchConcordance; |
29 |
| -import com.crowdin.client.glossaries.model.SearchConcordanceRequest; |
30 |
| -import com.crowdin.client.glossaries.model.SearchConcordanceResponseList; |
31 |
| -import com.crowdin.client.glossaries.model.Term; |
32 |
| -import com.crowdin.client.glossaries.model.TermResponseList; |
33 |
| -import com.crowdin.client.glossaries.model.TermResponseObject; |
| 14 | +import com.crowdin.client.glossaries.model.*; |
34 | 15 |
|
35 | 16 | import java.util.List;
|
36 | 17 | import java.util.Map;
|
@@ -72,9 +53,17 @@ public ResponseList<SearchConcordance> searchConcordance(Long projectId, SearchC
|
72 | 53 | * </ul>
|
73 | 54 | */
|
74 | 55 | public ResponseList<Concept> listConcepts(Long glossaryId, Integer limit, Integer offset) throws HttpException, HttpBadRequestException {
|
| 56 | + ListConceptsParams params = new ListConceptsParams(); |
| 57 | + params.setLimit(limit); |
| 58 | + params.setOffset(offset); |
| 59 | + return listConcepts(glossaryId, params); |
| 60 | + } |
| 61 | + |
| 62 | + public ResponseList<Concept> listConcepts(Long glossaryId, ListConceptsParams params) throws HttpException, HttpBadRequestException { |
75 | 63 | Map<String, Optional<Object>> queryParams = HttpRequestConfig.buildUrlParams(
|
76 |
| - "limit", Optional.ofNullable(limit), |
77 |
| - "offset", Optional.ofNullable(offset) |
| 64 | + "orderBy", Optional.ofNullable(params.getOrderBy()), |
| 65 | + "limit", Optional.ofNullable(params.getLimit()), |
| 66 | + "offset", Optional.ofNullable(params.getOffset()) |
78 | 67 | );
|
79 | 68 | ConceptResponseList conceptResponseList = this.httpClient.get(this.url + "/glossaries/" + glossaryId + "/concepts", new HttpRequestConfig(queryParams), ConceptResponseList.class);
|
80 | 69 | return ConceptResponseList.to(conceptResponseList);
|
@@ -132,10 +121,19 @@ public void deleteConcept(Long glossaryId, Long conceptId) throws HttpException,
|
132 | 121 | * </ul>
|
133 | 122 | */
|
134 | 123 | public ResponseList<Glossary> listGlossaries(Long groupId, Integer limit, Integer offset) throws HttpException, HttpBadRequestException {
|
| 124 | + ListGlossariesParams params = new ListGlossariesParams(); |
| 125 | + params.setGroupId(groupId); |
| 126 | + params.setLimit(limit); |
| 127 | + params.setOffset(offset); |
| 128 | + return listGlossaries(params); |
| 129 | + } |
| 130 | + |
| 131 | + public ResponseList<Glossary> listGlossaries(ListGlossariesParams params) throws HttpException, HttpBadRequestException { |
135 | 132 | Map<String, Optional<Object>> queryParams = HttpRequestConfig.buildUrlParams(
|
136 |
| - "groupId", Optional.ofNullable(groupId), |
137 |
| - "limit", Optional.ofNullable(limit), |
138 |
| - "offset", Optional.ofNullable(offset) |
| 133 | + "groupId", Optional.ofNullable(params.getGroupId()), |
| 134 | + "userId", Optional.ofNullable(params.getUserId()), |
| 135 | + "limit", Optional.ofNullable(params.getLimit()), |
| 136 | + "offset", Optional.ofNullable(params.getOffset()) |
139 | 137 | );
|
140 | 138 | GlossaryResponseList glossaryResponseList = this.httpClient.get(this.url + "/glossaries", new HttpRequestConfig(queryParams), GlossaryResponseList.class);
|
141 | 139 | return GlossaryResponseList.to(glossaryResponseList);
|
@@ -277,13 +275,26 @@ public ResponseObject<GlossaryImportStatus> checkGlossaryImportStatus(Long gloss
|
277 | 275 | * </ul>
|
278 | 276 | */
|
279 | 277 | public ResponseList<Term> listTerms(Long glossaryId, Long userId, String languageId, Long conceptId, @Deprecated Long translationOfTermId, Integer limit, Integer offset) throws HttpException, HttpBadRequestException {
|
| 278 | + ListTermsParams params = new ListTermsParams(); |
| 279 | + params.setUserId(userId); |
| 280 | + params.setLanguageId(languageId); |
| 281 | + params.setConceptId(conceptId); |
| 282 | + params.setTranslationOfTermId(translationOfTermId); |
| 283 | + params.setLimit(limit); |
| 284 | + params.setOffset(offset); |
| 285 | + return listTerms(glossaryId, params); |
| 286 | + } |
| 287 | + |
| 288 | + public ResponseList<Term> listTerms(Long glossaryId, ListTermsParams params) throws HttpException, HttpBadRequestException { |
280 | 289 | Map<String, Optional<Object>> queryParams = HttpRequestConfig.buildUrlParams(
|
281 |
| - "userId", Optional.ofNullable(userId), |
282 |
| - "languageId", Optional.ofNullable(languageId), |
283 |
| - "conceptId", Optional.ofNullable(conceptId), |
284 |
| - "translationOfTermId", Optional.ofNullable(translationOfTermId), |
285 |
| - "limit", Optional.ofNullable(limit), |
286 |
| - "offset", Optional.ofNullable(offset) |
| 290 | + "orderBy", Optional.ofNullable(params.getOrderBy()), |
| 291 | + "userId", Optional.ofNullable(params.getUserId()), |
| 292 | + "languageId", Optional.ofNullable(params.getLanguageId()), |
| 293 | + "conceptId", Optional.ofNullable(params.getConceptId()), |
| 294 | + "translationOfTermId", Optional.ofNullable(params.getTranslationOfTermId()), |
| 295 | + "croql", Optional.ofNullable(params.getCroql()), |
| 296 | + "limit", Optional.ofNullable(params.getLimit()), |
| 297 | + "offset", Optional.ofNullable(params.getOffset()) |
287 | 298 | );
|
288 | 299 | TermResponseList termResponseList = this.httpClient.get(this.url + "/glossaries/" + glossaryId + "/terms", new HttpRequestConfig(queryParams), TermResponseList.class);
|
289 | 300 | return TermResponseList.to(termResponseList);
|
|
0 commit comments