Skip to content

Commit

Permalink
Add support for cinemagraph_analysis param. (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
nitzanj authored Sep 12, 2019
1 parent e4e3ec2 commit 9d9d266
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cloudinary-core/src/main/java/com/cloudinary/Api.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public ApiResponse resource(String public_id, Map options) throws Exception {

ApiResponse response = callApi(HttpMethod.GET, Arrays.asList("resources", resourceType, type, public_id),
ObjectUtils.only(options, "exif", "colors", "faces", "coordinates",
"image_metadata", "pages", "phash", "max_results", "quality_analysis"), options);
"image_metadata", "pages", "phash", "max_results", "quality_analysis", "cinemagraph_analysis"), options);

return response;
}
Expand Down
2 changes: 1 addition & 1 deletion cloudinary-core/src/main/java/com/cloudinary/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

public class Util {
static final String[] BOOLEAN_UPLOAD_OPTIONS = new String[]{"backup", "exif", "faces", "colors", "image_metadata", "use_filename", "unique_filename",
"eager_async", "invalidate", "discard_original_filename", "overwrite", "phash", "return_delete_token", "async", "quality_analysis"};
"eager_async", "invalidate", "discard_original_filename", "overwrite", "phash", "return_delete_token", "async", "quality_analysis", "cinemagraph_analysis"};

@SuppressWarnings({"rawtypes", "unchecked"})
public static final Map<String, Object> buildUploadParams(Map options) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -951,4 +951,11 @@ public void testDeleteFolder() throws Exception {
// should throw exception (folder not found):
api.deleteFolder(cloudinary.randomPublicId(), emptyMap());
}


@Test
public void testCinemagraphAnalysisResource() throws Exception {
ApiResponse res = api.resource(API_TEST, Collections.singletonMap("cinemagraph_analysis", true));
assertNotNull(res.get("cinemagraph_analysis"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,15 @@ public void testQualityAnalysis() throws IOException {

}

@Test
public void testCinemagraphAnalysisUpload() throws IOException {
Map result = cloudinary.uploader().upload(SRC_TEST_IMAGE, asMap("cinemagraph_analysis", true, "tags", Arrays.asList(SDK_TEST_TAG, UPLOADER_TAG)));
assertNotNull(result.get("cinemagraph_analysis"));
result = cloudinary.uploader().explicit(result.get("public_id").toString(), ObjectUtils.asMap("type", "upload", "resource_type", "image", "cinemagraph_analysis", true));
assertNotNull(result.get("cinemagraph_analysis"));

}

private void addToDeleteList(String type, String id) {
Set<String> ids = toDelete.get(type);
if (ids == null) {
Expand Down

0 comments on commit 9d9d266

Please sign in to comment.