Skip to content

Commit 5e64eeb

Browse files
igystrausr
authored andcommitted
Add 'derived_next_resource' to api.resource method
1 parent 4947af7 commit 5e64eeb

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

lib-es5/api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ exports.resource = function resource(public_id, callback) {
233233
resource_type = options.resource_type || "image";
234234
type = options.type || "upload";
235235
uri = ["resources", resource_type, type, public_id];
236-
return call_api("get", uri, only(options, "exif", "colors", "faces", "image_metadata", "pages", "phash", "coordinates", "max_results"), callback, options);
236+
return call_api("get", uri, only(options, "exif", "colors", "derived_next_cursor", "faces", "image_metadata", "pages", "phash", "coordinates", "max_results"), callback, options);
237237
};
238238

239239
exports.restore = function restore(public_ids, callback) {

lib/api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ exports.resource = function resource(public_id, callback, options = {}) {
196196
resource_type = options.resource_type || "image";
197197
type = options.type || "upload";
198198
uri = ["resources", resource_type, type, public_id];
199-
return call_api("get", uri, only(options, "exif", "colors", "faces", "image_metadata", "pages", "phash", "coordinates", "max_results"), callback, options);
199+
return call_api("get", uri, only(options, "exif", "colors", "derived_next_cursor", "faces", "image_metadata", "pages", "phash", "coordinates", "max_results"), callback, options);
200200
};
201201

202202
exports.restore = function restore(public_ids, callback, options = {}) {

test/api_spec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,17 @@ describe("api", function () {
306306
expect(resource.derived).to.have.length(1);
307307
});
308308
});
309+
describe("derived pagination", function(){
310+
it("should send the derived_next_cursor to the server", function() {
311+
return helper.mockPromise((xhr, writeSpy, requestSpy) => {
312+
cloudinary.v2.api.resource(PUBLIC_ID, {derived_next_cursor: 'aaa'});
313+
return sinon.assert.calledWith(
314+
requestSpy, sinon.match(sinon.match({
315+
query: sinon.match('derived_next_cursor=aaa')
316+
}, 'derived_next_cursor=aaa')));
317+
});
318+
});
319+
});
309320
});
310321
describe("delete", function () {
311322
it("should allow deleting derived resource", function () {

0 commit comments

Comments
 (0)