Skip to content

Commit 178559b

Browse files
authored
Add derived next cursor support
1 parent 232a2e5 commit 178559b

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

cloudinary-core/src/main/java/com/cloudinary/Api.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public ApiResponse resource(String public_id, Map options) throws Exception {
200200
ApiResponse response = callApi(HttpMethod.GET, Arrays.asList("resources", resourceType, type, public_id),
201201
ObjectUtils.only(options, "exif", "colors", "faces", "coordinates",
202202
"image_metadata", "pages", "phash", "max_results", "quality_analysis", "cinemagraph_analysis",
203-
"accessibility_analysis", "versions", "media_metadata"), options);
203+
"accessibility_analysis", "versions", "media_metadata", "derived_next_cursor"), options);
204204

205205
return response;
206206
}

cloudinary-test-common/src/main/java/com/cloudinary/test/AbstractApiTest.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,4 +1305,29 @@ public void testDeleteBackedupAsset() throws Exception {
13051305
assertEquals(deletedVersionIds.get(0), firstAssetVersion);
13061306
}
13071307
}
1308+
1309+
@Test
1310+
public void testAllowDerivedNextCursor() throws Exception {
1311+
String publicId = "allowderivednextcursor_" + SUFFIX;
1312+
Map options = ObjectUtils.asMap("public_id", publicId, "eager", Arrays.asList(
1313+
new Transformation().width(100),
1314+
new Transformation().width(101),
1315+
new Transformation().width(102)
1316+
));
1317+
1318+
try {
1319+
cloudinary.uploader().upload(SRC_TEST_IMAGE, options);
1320+
ApiResponse res = api.resource(publicId, Collections.singletonMap("max_results", 1));
1321+
String derivedNextCursor = res.get("derived_next_cursor").toString();
1322+
assertNotNull(derivedNextCursor);
1323+
1324+
ApiResponse res2 = api.resource(publicId, ObjectUtils.asMap("derived_next_cursor", derivedNextCursor, "max_results", 1));
1325+
String derivedNextCursor2 = res2.get("derived_next_cursor").toString();
1326+
assertNotNull(derivedNextCursor2);
1327+
1328+
assertNotEquals(derivedNextCursor, derivedNextCursor2);
1329+
} finally {
1330+
cloudinary.uploader().destroy(publicId, Collections.singletonMap("invalidate", true));
1331+
}
1332+
}
13081333
}

0 commit comments

Comments
 (0)