Skip to content

Commit a35b7ed

Browse files
committed
feat: api updates
1 parent 13f12d9 commit a35b7ed

16 files changed

+231
-112
lines changed

src/main/java/com/crowdin/client/bundles/model/AddBundleRequest.java

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class AddBundleRequest {
1313
private String exportPattern;
1414
private Boolean isMultilingual;
1515
private Boolean includeProjectSourceLanguage;
16+
private Boolean includeInContextPseudoLanguage;
1617
private List<Long> labelIds;
1718
private List<Long> excludeLabelIds;
1819
}

src/main/java/com/crowdin/client/fields/FieldsApi.java

+13-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
import com.crowdin.client.core.model.PatchRequest;
1010
import com.crowdin.client.core.model.ResponseList;
1111
import com.crowdin.client.core.model.ResponseObject;
12-
import com.crowdin.client.fields.model.Field;
13-
import com.crowdin.client.fields.model.FieldRequest;
14-
import com.crowdin.client.fields.model.FieldResponseObject;
15-
import com.crowdin.client.fields.model.FieldResponseObjectList;
12+
import com.crowdin.client.fields.model.*;
1613

1714
import java.util.List;
1815
import java.util.Map;
@@ -49,6 +46,18 @@ public ResponseList<Field> listFields(String entity, String search, Integer limi
4946
return FieldResponseObjectList.to(responseObject);
5047
}
5148

49+
public ResponseList<Field> listFields(ListFieldsParams params) throws HttpException, HttpBadRequestException {
50+
Map<String, Optional<Object>> queryParams = HttpRequestConfig.buildUrlParams(
51+
"entity", Optional.ofNullable(params.getEntity()),
52+
"search", Optional.ofNullable(params.getSearch()),
53+
"limit", Optional.ofNullable(params.getLimit()),
54+
"type", Optional.ofNullable(params.getType()),
55+
"offset", Optional.ofNullable(params.getOffset())
56+
);
57+
FieldResponseObjectList responseObject = this.httpClient.get(this.url + "/fields", new HttpRequestConfig(queryParams), FieldResponseObjectList.class);
58+
return FieldResponseObjectList.to(responseObject);
59+
}
60+
5261
/**
5362
* @param request object {@link com.crowdin.client.fields.model.FieldRequest}
5463
* @return Field object

src/main/java/com/crowdin/client/fields/model/Config.java

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
public class Config {
99
private List<Option> options;
1010
private List<Location> locations;
11+
private Integer min;
12+
private Integer max;
13+
private String units;
1114

1215
@Data
1316
public static class Option {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.crowdin.client.fields.model;
2+
3+
import com.crowdin.client.core.model.Pagination;
4+
import com.crowdin.client.fields.model.enums.FieldType;
5+
import lombok.Data;
6+
import lombok.EqualsAndHashCode;
7+
8+
@Data
9+
@EqualsAndHashCode(callSuper = false)
10+
public class ListFieldsParams extends Pagination {
11+
12+
private String entity;
13+
private String search;
14+
private FieldType type;
15+
}

src/main/java/com/crowdin/client/projectsgroups/ProjectsGroupsApi.java

+26-16
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,7 @@
1111
import com.crowdin.client.core.model.PatchRequest;
1212
import com.crowdin.client.core.model.ResponseList;
1313
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.*;
3015

3116
import java.util.List;
3217
import java.util.Map;
@@ -61,6 +46,18 @@ public ResponseList<Group> listGroups(Long parentId, Integer limit, Integer offs
6146
return GroupResponseList.to(groupResponseList);
6247
}
6348

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+
6461
/**
6562
* @param request request object
6663
* @return newly created group
@@ -130,6 +127,19 @@ public ResponseList<? extends Project> listProjects(Long groupId, Integer hasMan
130127
return ProjectResponseList.to(projectResponseList);
131128
}
132129

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+
133143
/**
134144
* @param request request object
135145
* @return newly created project
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.crowdin.client.projectsgroups.model;
2+
3+
import lombok.Data;
4+
5+
import java.util.List;
6+
7+
@Data
8+
public class AiPreTranslate {
9+
10+
private Boolean enabled;
11+
private List<AiPromptItem> aiPrompts;
12+
13+
@Data
14+
public static class AiPromptItem {
15+
private Long aiPromptId;
16+
private List<String> languageIds;
17+
}
18+
}

src/main/java/com/crowdin/client/projectsgroups/model/EnterpriseProjectRequest.java

+19-8
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,43 @@ public class EnterpriseProjectRequest extends AddProjectRequest {
2020
private Long mtEngineId;
2121
private String description;
2222
private Integer translateDuplicates;
23+
private Integer tagsDetection;
2324
private Boolean isMtAllowed;
2425
private Boolean taskBasedAccessControl;
26+
private List<Long> taskReviewerIds;
2527
private Boolean autoSubstitution;
28+
private Boolean showTmSuggestionsDialects;
2629
private Boolean autoTranslateDialects;
2730
private Boolean publicDownloads;
2831
private Boolean hiddenStringsProofreadersAccess;
29-
private Boolean useGlobalTm;
3032
private Boolean delayedWorkflowStart;
3133
private Boolean skipUntranslatedStrings;
32-
private Boolean skipUntranslatedFiles;
3334
private Integer exportWithMinApprovalsCount;
35+
private Integer exportStringsThatPassedWorkflow;
3436
private Boolean normalizePlaceholder;
35-
private Boolean saveMetaInfoInSource;
36-
private Boolean inContext;
37-
private Boolean inContextProcessHiddenStrings;
38-
private Boolean inContextPseudoLanguageId;
3937
private Boolean qaCheckIsActive;
4038
private Integer qaApprovalsCount;
4139
private QaCheckCategories qaCheckCategories;
4240
private QaCheckCategories qaChecksIgnorableCategories;
4341
private List<Integer> customQaCheckIds;
44-
private TmContextType tmContextType;
4542
private Map<String, Map<String, String>> languageMapping;
43+
/**
44+
* @deprecated
45+
*/
4646
private Boolean glossaryAccess;
47+
private String glossaryAccessOption;
4748
private NotificationSettings notificationSettings;
48-
private TmPenalties tmPenalties;
49+
private Long savingsReportSettingsTemplateId;
50+
private Long assistActionAiPromptId;
51+
private Long editorSuggestionAiPromptId;
52+
private Long alignmentActionAiPromptId;
4953
private Integer defaultTmId;
5054
private Integer defaultGlossaryId;
55+
private Boolean inContext;
56+
private Boolean inContextProcessHiddenStrings;
57+
private Boolean inContextPseudoLanguageId;
58+
private Boolean saveMetaInfoInSource;
59+
private Integer type;
60+
private Boolean skipUntranslatedFiles;
61+
private TmContextType tmContextType;
5162
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.crowdin.client.projectsgroups.model;
2+
3+
import com.crowdin.client.core.model.Pagination;
4+
import lombok.Data;
5+
import lombok.EqualsAndHashCode;
6+
7+
@EqualsAndHashCode(callSuper = true)
8+
@Data
9+
public class ListGroupOptions extends Pagination {
10+
11+
private Long parentId;
12+
private Long userId;
13+
private String orderBy;
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.crowdin.client.projectsgroups.model;
2+
3+
import com.crowdin.client.core.model.Pagination;
4+
import lombok.Data;
5+
import lombok.EqualsAndHashCode;
6+
7+
@EqualsAndHashCode(callSuper = true)
8+
@Data
9+
public class ListProjectOptions extends Pagination {
10+
11+
private Long groupId;
12+
private Integer hasManagerAccess;
13+
private String orderBy;
14+
private Integer type;
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.crowdin.client.projectsgroups.model;
2+
3+
import lombok.Data;
4+
5+
import java.util.List;
6+
7+
@Data
8+
public class MtPreTranslate {
9+
10+
private Boolean enabled;
11+
private List<MtItem> mts;
12+
13+
@Data
14+
public static class MtItem {
15+
private Long mtId;
16+
private List<String> languageIds;
17+
}
18+
}

src/main/java/com/crowdin/client/projectsgroups/model/Project.java

+14-8
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,33 @@ public class Project {
1111

1212
private Long id;
1313
private Type type;
14-
private Long groupId;
1514
private Long userId;
1615
private String sourceLanguageId;
1716
private List<String> targetLanguageIds;
17+
private String languageAccessPolicy;
1818
private String name;
19-
private String cname;
2019
private String identifier;
2120
private String description;
2221
private String visibility;
2322
private String logo;
24-
private String background;
25-
private boolean isExternal;
26-
private String externalType;
27-
private Long workflowId;
28-
private boolean hasCrowdsourcing;
2923
private boolean publicDownloads;
3024
private Date createdAt;
3125
private Date updatedAt;
3226
private Date lastActivity;
3327
private Language sourceLanguage;
3428
private List<Language> targetLanguages;
3529
private String webUrl;
36-
30+
private Long savingsReportSettingsTemplateId;
31+
//community
32+
private String cname;
33+
//enterprise
34+
private Long groupId;
35+
private String background;
36+
private boolean isExternal;
37+
private String externalType;
38+
private Long externalProjectId;
39+
private Long externalOrganizationId;
40+
private Long workflowId;
41+
private boolean hasCrowdsourcing;
42+
private String publicUrl;
3743
}

src/main/java/com/crowdin/client/projectsgroups/model/FilesBasedProjectRequest.java src/main/java/com/crowdin/client/projectsgroups/model/ProjectRequest.java

+22-12
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@
88

99
@Data
1010
@EqualsAndHashCode(callSuper = true)
11-
public class FilesBasedProjectRequest extends AddProjectRequest {
11+
public class ProjectRequest extends AddProjectRequest {
1212

13-
private Integer type;
14-
private Boolean normalizePlaceholder;
15-
private Boolean saveMetaInfoInSource;
16-
private NotificationSettings notificationSettings;
1713
private String name;
1814
private String identifier;
1915
private String sourceLanguageId;
@@ -22,27 +18,41 @@ public class FilesBasedProjectRequest extends AddProjectRequest {
2218
private String languageAccessPolicy;
2319
private String cname;
2420
private String description;
21+
private Integer tagDetection;
2522
private Boolean isMtAllowed;
2623
private Boolean taskBasedAccessControl;
2724
private Boolean autoSubstitution;
2825
private Boolean autoTranslateDialects;
2926
private Boolean publicDownloads;
3027
private Boolean hiddenStringsProofreadersAccess;
3128
private Boolean useGlobalTm;
29+
private Boolean showTmSuggestionsDialects;
3230
private Boolean skipUntranslatedStrings;
33-
private Boolean skipUntranslatedFiles;
3431
private Boolean exportApprovedOnly;
35-
private Boolean inContext;
36-
private Boolean inContextProcessHiddenStrings;
37-
private String inContextPseudoLanguageId;
3832
private Boolean qaCheckIsActive;
3933
private QaCheckCategories qaCheckCategories;
4034
private QaCheckCategories qaChecksIgnorableCategories;
4135
private Map<String, Map<String, String>> languageMapping;
36+
/**
37+
* @deprecated
38+
*/
4239
private Boolean glossaryAccess;
43-
private TmPenalties tmPenalties;
44-
private TmContextType tmContextType;
40+
private String glossaryAccessOption;
41+
private Boolean normalizePlaceholder;
42+
private NotificationSettings notificationSettings;
43+
private TmPreTranslate tmPreTranslate;
44+
private MtPreTranslate mtPreTranslate;
45+
private AiPreTranslate aiPreTranslate;
46+
private Long assistActionAiPromptId;
47+
private Long editorSuggestionAiPromptId;
48+
private Long savingsReportSettingsTemplateId;
4549
private Integer defaultTmId;
4650
private Integer defaultGlossaryId;
47-
51+
private Boolean inContext;
52+
private Boolean inContextProcessHiddenStrings;
53+
private String inContextPseudoLanguageId;
54+
private Boolean saveMetaInfoInSource;
55+
private Integer type;
56+
private Boolean skipUntranslatedFiles;
57+
private TmContextType tmContextType;
4858
}

0 commit comments

Comments
 (0)