Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): Bundles API: add the includeProjectSourceLanguage property #173

Merged
merged 2 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/java/com/crowdin/client/bundles/model/Bundle.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class Bundle {
private List<String> ignorePatterns;
private String exportPattern;
private boolean isMultilingual;
private Boolean includeProjectSourceLanguage;
private List<Long> labelIds;
private Date createdAt;
private Date updatedAt;
Expand Down
26 changes: 20 additions & 6 deletions src/test/java/com/crowdin/client/bundles/BundlesApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
import org.apache.http.client.methods.HttpPost;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
import java.util.Date;
import java.util.Calendar;

import static org.junit.jupiter.api.Assertions.*;

Expand Down Expand Up @@ -74,6 +75,7 @@ public void addBundleTest() {
request.setIgnorePatterns(Collections.singletonList("/master/environments/"));
request.setExportPattern(pattern);
request.setMultilingual(true);
request.setIncludeProjectSourceLanguage(true);
request.setLabelIds(Collections.singletonList(0L));

ResponseObject<Bundle> response = this.getBundlesApi().addBundle(projectId, request);
Expand All @@ -89,6 +91,7 @@ public void getBundleTest() {
assertEquals(response.getData().getId(), projectId);
assertEquals(response.getData().getName(), name);
assertTrue(response.getData().isMultilingual());
assertTrue(response.getData().getIncludeProjectSourceLanguage());
}

@Test
Expand All @@ -98,10 +101,20 @@ public void deleteBundleTest() {

@Test
public void editBundleTest() {
PatchRequest request = new PatchRequest();
request.setOp(PatchOperation.REPLACE);
request.setPath("/name");
ResponseObject<Bundle> response = this.getBundlesApi().editBundle(projectId, bundleId, Arrays.asList(request));
List<PatchRequest> request = new ArrayList<PatchRequest>() {{
add(new PatchRequest() {{
setOp(PatchOperation.REPLACE);
setPath("/name");
setValue("New name");
}});
add(new PatchRequest() {{
setOp(PatchOperation.REPLACE);
setPath("/includeProjectSourceLanguage");
setValue(true);
}});
}};

ResponseObject<Bundle> response = this.getBundlesApi().editBundle(projectId, bundleId, request);
assertEquals(response.getData().getId(), projectId);
assertEquals(response.getData().getName(), name);
}
Expand Down Expand Up @@ -140,6 +153,7 @@ public void exportBundleTest() {
request.setIgnorePatterns(Collections.singletonList("/master/environments/"));
request.setExportPattern(pattern);
request.setMultilingual(true);
request.setIncludeProjectSourceLanguage(true);
request.setLabelIds(Collections.singletonList(0L));

ResponseObject<BundleExport> response = this.getBundlesApi().exportBundle(projectId, bundleId, request);
Expand Down
1 change: 1 addition & 0 deletions src/test/resources/api/bundles/addBundleRequest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
],
"exportPattern": "strings-%two_letter_code%.resx",
"isMultilingual": true,
"includeProjectSourceLanguage": true,
"labelIds": [
0
]
Expand Down
1 change: 1 addition & 0 deletions src/test/resources/api/bundles/bundle.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
],
"exportPattern": "strings-%two_letters_code%.resx",
"isMultilingual": true,
"includeProjectSourceLanguage": true,
"labelIds": [
0
],
Expand Down
8 changes: 7 additions & 1 deletion src/test/resources/api/bundles/editBundle.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
[
{
"op": "replace",
"path": "/name"
"path": "/name",
"value": "New name"
},
{
"op": "replace",
"path": "/includeProjectSourceLanguage",
"value": true
}
]