Skip to content

Commit 15d5c66

Browse files
committed
source strings api updates
1 parent 754fa45 commit 15d5c66

File tree

4 files changed

+33
-13
lines changed

4 files changed

+33
-13
lines changed

src/main/java/com/crowdin/client/core/http/HttpRequestConfig.java

+17
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,21 @@ public static <T extends Optional> Map<String, T> buildUrlParams(String k1, T v1
160160
put(k11, v11);
161161
}};
162162
}
163+
164+
public static <T extends Optional> Map<String, T> buildUrlParams(String k1, T v1, String k2, T v2, String k3, T v3, String k4, T v4, String k5, T v5, String k6, T v6, String k7, T v7, String k8, T v8, String k9, T v9, String k10, T v10, String k11, T v11, String k12, T v12) {
165+
return new HashMap<String, T>() {{
166+
put(k1, v1);
167+
put(k2, v2);
168+
put(k3, v3);
169+
put(k4, v4);
170+
put(k5, v5);
171+
put(k6, v6);
172+
put(k7, v7);
173+
put(k8, v8);
174+
put(k9, v9);
175+
put(k10, v10);
176+
put(k11, v11);
177+
put(k12, v12);
178+
}};
179+
}
163180
}

src/main/java/com/crowdin/client/sourcestrings/SourceStringsApi.java

+13-13
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,18 @@ public ResponseObject<UploadStringsProgress> uploadStrings(Long projectId, Uploa
5757
*/
5858
@Deprecated
5959
public ResponseList<SourceString> listSourceStrings(Long projectId, Long fileId, Integer denormalizePlaceholders, Long branchId, String labelIds, String croql, String filter, String scope, Integer limit, Integer offset) throws HttpException, HttpBadRequestException {
60-
Map<String, Optional<Object>> queryParams = HttpRequestConfig.buildUrlParams(
61-
"fileId", Optional.ofNullable(fileId),
62-
"denormalizePlaceholders", Optional.ofNullable(denormalizePlaceholders),
63-
"branchId", Optional.ofNullable(branchId),
64-
"labelIds", Optional.ofNullable(labelIds),
65-
"croql", Optional.ofNullable(croql),
66-
"filter", Optional.ofNullable(filter),
67-
"scope", Optional.ofNullable(scope),
68-
"limit", Optional.ofNullable(limit),
69-
"offset", Optional.ofNullable(offset)
70-
);
71-
SourceStringResponseList sourceStringResponseList = this.httpClient.get(this.url + "/projects/" + projectId + "/strings", new HttpRequestConfig(queryParams), SourceStringResponseList.class);
72-
return SourceStringResponseList.to(sourceStringResponseList);
60+
ListSourceStringsParams params = ListSourceStringsParams.builder()
61+
.fileId(fileId)
62+
.denormalizePlaceholders(denormalizePlaceholders)
63+
.branchId(branchId)
64+
.labelIds(labelIds)
65+
.croql(croql)
66+
.filter(filter)
67+
.scope(scope)
68+
.limit(limit)
69+
.offset(offset)
70+
.build();
71+
return listSourceStrings(projectId, params);
7372
}
7473

7574
public ResponseList<SourceString> listSourceStrings(Long projectId, ListSourceStringsParams params) throws HttpException, HttpBadRequestException {
@@ -80,6 +79,7 @@ public ResponseList<SourceString> listSourceStrings(Long projectId, ListSourceSt
8079
"fileId", Optional.ofNullable(params.getFileId()),
8180
"branchId", Optional.ofNullable(params.getBranchId()),
8281
"directoryId", Optional.ofNullable(params.getDirectoryId()),
82+
"taskId", Optional.ofNullable(params.getTaskId()),
8383
"croql", Optional.ofNullable(params.getCroql()),
8484
"filter", Optional.ofNullable(params.getFilter()),
8585
"scope", Optional.ofNullable(params.getScope()),

src/main/java/com/crowdin/client/sourcestrings/model/ListSourceStringsParams.java

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class ListSourceStringsParams {
1313
private Long fileId;
1414
private Long branchId;
1515
private Long directoryId;
16+
private Long taskId;
1617
private String croql;
1718
private String filter;
1819
private String scope;

src/main/java/com/crowdin/client/sourcestrings/model/SourceString.java

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public class SourceString {
1111
private Long id;
1212
private Long projectId;
1313
private Long fileId;
14+
private Long directoryId;
1415
private Long branchId;
1516
private Long masterStringId;
1617
private String identifier;
@@ -26,4 +27,5 @@ public class SourceString {
2627
private Date createdAt;
2728
private Date updatedAt;
2829
private boolean isDuplicate;
30+
private String webUrl;
2931
}

0 commit comments

Comments
 (0)