Skip to content

Commit 636ccb9

Browse files
author
RTLcoil
authored
Add accessibility_analysis parameter support (#463)
1 parent 36cbfa7 commit 636ccb9

File tree

7 files changed

+25
-4
lines changed

7 files changed

+25
-4
lines changed

lib-es5/api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ exports.resource = function resource(public_id, callback) {
117117
resource_type = options.resource_type || "image";
118118
type = options.type || "upload";
119119
uri = ["resources", resource_type, type, public_id];
120-
return call_api("get", uri, pickOnlyExistingValues(options, "exif", "cinemagraph_analysis", "colors", "derived_next_cursor", "faces", "image_metadata", "pages", "phash", "coordinates", "max_results", "versions"), callback, options);
120+
return call_api("get", uri, pickOnlyExistingValues(options, "exif", "cinemagraph_analysis", "colors", "derived_next_cursor", "faces", "image_metadata", "pages", "phash", "coordinates", "max_results", "versions", "accessibility_analysis"), callback, options);
121121
};
122122

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

lib-es5/utils/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,8 @@ function build_upload_params(options) {
333333
unique_filename: utils.as_safe_bool(options.unique_filename),
334334
upload_preset: options.upload_preset,
335335
use_filename: utils.as_safe_bool(options.use_filename),
336-
quality_override: options.quality_override
336+
quality_override: options.quality_override,
337+
accessibility_analysis: utils.as_safe_bool(options.accessibility_analysis)
337338
};
338339
return utils.updateable_resource_params(options, params);
339340
}

lib/api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ exports.resource = function resource(public_id, callback, options = {}) {
8282
resource_type = options.resource_type || "image";
8383
type = options.type || "upload";
8484
uri = ["resources", resource_type, type, public_id];
85-
return call_api("get", uri, pickOnlyExistingValues(options, "exif", "cinemagraph_analysis", "colors", "derived_next_cursor", "faces", "image_metadata", "pages", "phash", "coordinates", "max_results", "versions"), callback, options);
85+
return call_api("get", uri, pickOnlyExistingValues(options, "exif", "cinemagraph_analysis", "colors", "derived_next_cursor", "faces", "image_metadata", "pages", "phash", "coordinates", "max_results", "versions", "accessibility_analysis"), callback, options);
8686
};
8787

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

lib/utils/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,8 @@ function build_upload_params(options) {
317317
unique_filename: utils.as_safe_bool(options.unique_filename),
318318
upload_preset: options.upload_preset,
319319
use_filename: utils.as_safe_bool(options.use_filename),
320-
quality_override: options.quality_override
320+
quality_override: options.quality_override,
321+
accessibility_analysis: utils.as_safe_bool(options.accessibility_analysis)
321322
};
322323
return utils.updateable_resource_params(options, params);
323324
}

test/integration/api/admin/api_spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,14 @@ describe("api", function () {
286286
});
287287
});
288288
});
289+
it("should send `accessibility_analysis` param to the server", function () {
290+
return helper.provideMockObjects((mockXHR, writeSpy, requestSpy) => {
291+
cloudinary.v2.api.resource(PUBLIC_ID, { accessibility_analysis: true });
292+
return sinon.assert.calledWith(requestSpy, sinon.match({
293+
query: sinon.match(helper.apiParamMatcher("accessibility_analysis", "true"))
294+
}));
295+
});
296+
});
289297
});
290298
describe("backup resource", function () {
291299
this.timeout(TIMEOUT.MEDIUM);

test/integration/api/uploader/uploader_spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,12 @@ describe("uploader", function () {
892892
sinon.assert.calledWith(mocked.write, sinon.match(helper.uploadParamMatcher("async", 1)));
893893
});
894894
});
895+
it("should pass `accessibility_analysis` option to the server", function () {
896+
return helper.provideMockObjects((mockXHR, writeSpy, requestSpy) => {
897+
cloudinary.v2.uploader.upload(IMAGE_FILE, { accessibility_analysis: true });
898+
return sinon.assert.calledWith(writeSpy, sinon.match(helper.uploadParamMatcher("accessibility_analysis", 1)));
899+
});
900+
});
895901
describe("explicit", function () {
896902
var spy, xhr;
897903
spy = void 0;
@@ -934,6 +940,10 @@ describe("uploader", function () {
934940
});
935941
sinon.assert.calledWith(spy, sinon.match(helper.uploadParamMatcher('raw_convert', 'google_speech')));
936942
});
943+
it("should pass `accessibility_analysis` to server", function () {
944+
cloudinary.v2.uploader.explicit("cloudinary", { accessibility_analysis: true });
945+
sinon.assert.calledWith(spy, sinon.match(helper.uploadParamMatcher('accessibility_analysis', 1)));
946+
});
937947
});
938948
it("should create an image upload tag with required properties", function () {
939949
var fakeDiv, input_element, tag;

types/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ declare module 'cloudinary' {
476476
coordinates?: boolean;
477477
phash?: boolean;
478478
cinemagraph_analysis?: boolean;
479+
accessibility_analysis?: boolean;
479480

480481
[futureKey: string]: any;
481482
}

0 commit comments

Comments
 (0)