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 .ResponseList ;
10
- import com .crowdin .client .core .model .ResponseObject ;
7
+ import com .crowdin .client .core .model .*;
11
8
import com .crowdin .client .stringtranslations .model .*;
12
9
13
10
import java .util .Map ;
@@ -53,15 +50,29 @@ public AlignTranslationResponse alignTranslation(Long projectId, AlignTranslatio
53
50
* </ul>
54
51
*/
55
52
public ResponseList <Approval > listTranslationApprovals (Long projectId , Long fileId , Long stringId , String languageId , Long translationId , String labelIds , String excludeLabelIds , Integer limit , Integer offset ) throws HttpException , HttpBadRequestException {
53
+ ListTranslationApprovalsOptions options = new ListTranslationApprovalsOptions ();
54
+ options .setFileId (fileId );
55
+ options .setStringId (stringId );
56
+ options .setLanguageId (languageId );
57
+ options .setTranslationId (translationId );
58
+ options .setLabelIds (labelIds );
59
+ options .setExcludeLabelIds (excludeLabelIds );
60
+ options .setLimit (limit );
61
+ options .setOffset (offset );
62
+ return listTranslationApprovals (projectId , options );
63
+ }
64
+
65
+ public ResponseList <Approval > listTranslationApprovals (Long projectId , ListTranslationApprovalsOptions options ) throws HttpException , HttpBadRequestException {
56
66
Map <String , Optional <Object >> queryParams = HttpRequestConfig .buildUrlParams (
57
- "fileId" , Optional .ofNullable (fileId ),
58
- "stringId" , Optional .ofNullable (stringId ),
59
- "languageId" , Optional .ofNullable (languageId ),
60
- "translationId" , Optional .ofNullable (translationId ),
61
- "labelIds" , Optional .ofNullable (labelIds ),
62
- "excludeLabelIds" , Optional .ofNullable (excludeLabelIds ),
63
- "limit" , Optional .ofNullable (limit ),
64
- "offset" , Optional .ofNullable (offset )
67
+ "orderBy" , Optional .ofNullable (options .getOrderBy ()),
68
+ "fileId" , Optional .ofNullable (options .getFileId ()),
69
+ "labelIds" , Optional .ofNullable (options .getLabelIds ()),
70
+ "excludeLabelIds" , Optional .ofNullable (options .getExcludeLabelIds ()),
71
+ "stringId" , Optional .ofNullable (options .getStringId ()),
72
+ "languageId" , Optional .ofNullable (options .getLanguageId ()),
73
+ "translationId" , Optional .ofNullable (options .getTranslationId ()),
74
+ "limit" , Optional .ofNullable (options .getLimit ()),
75
+ "offset" , Optional .ofNullable (options .getOffset ())
65
76
);
66
77
ApprovalResponseList approvalResponseList = this .httpClient .get (this .url + "/projects/" + projectId + "/approvals" , new HttpRequestConfig (queryParams ), ApprovalResponseList .class );
67
78
return ApprovalResponseList .to (approvalResponseList );
@@ -126,17 +137,33 @@ public void removeApproval(Long projectId, Long approvalId) throws HttpException
126
137
* </ul>
127
138
*/
128
139
public ResponseList <LanguageTranslations > listLanguageTranslations (Long projectId , String languageId , String stringIds , String labelIds , Long fileId , Long branchId , Long directoryId , String croql , Integer denormalizePlaceholders , Integer limit , Integer offset ) throws HttpException , HttpBadRequestException {
140
+ ListLanguageTranslationsOptions options = new ListLanguageTranslationsOptions ();
141
+ options .setStringIds (stringIds );
142
+ options .setLabelIds (labelIds );
143
+ options .setFileId (fileId );
144
+ options .setBranchId (branchId );
145
+ options .setDirectoryId (directoryId );
146
+ options .setCroql (croql );
147
+ options .setDenormalizePlaceholders (BooleanInt .fromInt (denormalizePlaceholders ));
148
+ options .setLimit (limit );
149
+ options .setOffset (offset );
150
+ return listLanguageTranslations (projectId , languageId , options );
151
+ }
152
+
153
+ public ResponseList <LanguageTranslations > listLanguageTranslations (Long projectId , String languageId , ListLanguageTranslationsOptions options ) throws HttpException , HttpBadRequestException {
129
154
String builtUrl = String .format ("%s/projects/%d/languages/%s/translations" , this .url , projectId , languageId );
130
155
Map <String , Optional <Object >> queryParams = HttpRequestConfig .buildUrlParams (
131
- "stringIds" , Optional .ofNullable (stringIds ),
132
- "labelIds" , Optional .ofNullable (labelIds ),
133
- "fileId" , Optional .ofNullable (fileId ),
134
- "branchId" , Optional .ofNullable (branchId ),
135
- "directoryId" , Optional .ofNullable (directoryId ),
136
- "croql" , Optional .ofNullable (croql ),
137
- "denormalizePlaceholders" , Optional .ofNullable (denormalizePlaceholders ),
138
- "limit" , Optional .ofNullable (limit ),
139
- "offset" , Optional .ofNullable (offset )
156
+ "stringIds" , Optional .ofNullable (options .getStringIds ()),
157
+ "labelIds" , Optional .ofNullable (options .getLabelIds ()),
158
+ "fileId" , Optional .ofNullable (options .getFileId ()),
159
+ "branchId" , Optional .ofNullable (options .getBranchId ()),
160
+ "directoryId" , Optional .ofNullable (options .getDirectoryId ()),
161
+ "passedWorkflow" , Optional .ofNullable (options .getPassedWorkflow ()),
162
+ "minApprovalCount" , Optional .ofNullable (options .getMinApprovalCount ()),
163
+ "croql" , Optional .ofNullable (options .getCroql ()),
164
+ "denormalizePlaceholders" , Optional .ofNullable (options .getDenormalizePlaceholders ()),
165
+ "limit" , Optional .ofNullable (options .getLimit ()),
166
+ "offset" , Optional .ofNullable (options .getOffset ())
140
167
);
141
168
LanguageTranslationsResponseList languageTranslationsResponseList = this .httpClient .get (builtUrl , new HttpRequestConfig (queryParams ), LanguageTranslationsResponseList .class );
142
169
return LanguageTranslationsResponseList .to (languageTranslationsResponseList );
@@ -155,11 +182,22 @@ public ResponseList<LanguageTranslations> listLanguageTranslations(Long projectI
155
182
* </ul>
156
183
*/
157
184
public ResponseList <StringTranslation > listStringTranslations (Long projectId , Long stringId , String languageId , Integer limit , Integer offset ) throws HttpException , HttpBadRequestException {
185
+ ListStringTranslationsOptions options = new ListStringTranslationsOptions ();
186
+ options .setStringId (stringId );
187
+ options .setLanguageId (languageId );
188
+ options .setLimit (limit );
189
+ options .setOffset (offset );
190
+ return listStringTranslations (projectId , options );
191
+ }
192
+
193
+ public ResponseList <StringTranslation > listStringTranslations (Long projectId , ListStringTranslationsOptions options ) throws HttpException , HttpBadRequestException {
158
194
Map <String , Optional <Object >> queryParams = HttpRequestConfig .buildUrlParams (
159
- "stringId" , Optional .ofNullable (stringId ),
160
- "languageId" , Optional .ofNullable (languageId ),
161
- "limit" , Optional .ofNullable (limit ),
162
- "offset" , Optional .ofNullable (offset )
195
+ "stringId" , Optional .ofNullable (options .getStringId ()),
196
+ "languageId" , Optional .ofNullable (options .getLanguageId ()),
197
+ "orderBy" , Optional .ofNullable (options .getOrderBy ()),
198
+ "denormalizePlaceholders" , Optional .ofNullable (options .getDenormalizePlaceholders ()),
199
+ "limit" , Optional .ofNullable (options .getLimit ()),
200
+ "offset" , Optional .ofNullable (options .getOffset ())
163
201
);
164
202
StringTranslationResponseList stringTranslationResponseList = this .httpClient .get (this .url + "/projects/" + projectId + "/translations" , new HttpRequestConfig (queryParams ), StringTranslationResponseList .class );
165
203
return StringTranslationResponseList .to (stringTranslationResponseList );
@@ -252,14 +290,27 @@ public ResponseObject<StringTranslation> restoreStringTranslation(Long projectId
252
290
* </ul>
253
291
*/
254
292
public ResponseList <Vote > listTranslationVotes (Long projectId , Long stringId , String languageId , Long translationId , String labelIds , String excludeLabelIds , Integer limit , Integer offset ) throws HttpException , HttpBadRequestException {
293
+ ListTranslationVotesOptions options = new ListTranslationVotesOptions ();
294
+ options .setStringId (stringId );
295
+ options .setLanguageId (languageId );
296
+ options .setTranslationId (translationId );
297
+ options .setLabelIds (labelIds );
298
+ options .setExcludeLabelIds (excludeLabelIds );
299
+ options .setLimit (limit );
300
+ options .setOffset (offset );
301
+ return listTranslationVotes (projectId , options );
302
+ }
303
+
304
+ public ResponseList <Vote > listTranslationVotes (Long projectId , ListTranslationVotesOptions options ) throws HttpException , HttpBadRequestException {
255
305
Map <String , Optional <Object >> queryParams = HttpRequestConfig .buildUrlParams (
256
- "stringId" , Optional .ofNullable (stringId ),
257
- "languageId" , Optional .ofNullable (languageId ),
258
- "translationId" , Optional .ofNullable (translationId ),
259
- "labelIds" , Optional .ofNullable (labelIds ),
260
- "excludeLabelIds" , Optional .ofNullable (excludeLabelIds ),
261
- "limit" , Optional .ofNullable (limit ),
262
- "offset" , Optional .ofNullable (offset )
306
+ "stringId" , Optional .ofNullable (options .getStringId ()),
307
+ "languageId" , Optional .ofNullable (options .getLanguageId ()),
308
+ "translationId" , Optional .ofNullable (options .getTranslationId ()),
309
+ "fileId" , Optional .ofNullable (options .getFileId ()),
310
+ "labelIds" , Optional .ofNullable (options .getLabelIds ()),
311
+ "excludeLabelIds" , Optional .ofNullable (options .getExcludeLabelIds ()),
312
+ "limit" , Optional .ofNullable (options .getLimit ()),
313
+ "offset" , Optional .ofNullable (options .getOffset ())
263
314
);
264
315
VoteResponseList voteResponseList = this .httpClient .get (this .url + "/projects/" + projectId + "/votes" , new HttpRequestConfig (queryParams ), VoteResponseList .class );
265
316
return VoteResponseList .to (voteResponseList );
0 commit comments