Skip to content

Commit 31432c8

Browse files
authored
Add update_metada type to upload api (#500)
1 parent ccf2fd2 commit 31432c8

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

types/cloudinary_ts_spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as cloudinary from 'cloudinary';
22
import * as Http from "http";
3+
import {MetadataFieldApiResponse, ResponseCallback, UploadApiOptions} from "cloudinary";
34

45
// $ExpectType ConfigOptions
56
cloudinary.v2.config();
@@ -623,6 +624,13 @@ const datasource_changes = {
623624
],
624625
};
625626

627+
cloudinary.v2.uploader.update_metadata({ metadata_color: "red", metadata_shape: "" }, ["test_id_1", "test_id_2"])
628+
.then((res)=> {console.log(res)})
629+
.catch((err)=> {console.log(err)});
630+
631+
cloudinary.v2.uploader.update_metadata('countryFieldId=[\"id_us\",\"id_uk\",\"id_france"]', [ 'dog', 'lion' ],
632+
function(error, result) { console.log(result, error) });
633+
626634
cloudinary.v2.api.update_metadata_field_datasource('EXTERNAL_ID_GET_LIST1', datasource_changes)
627635
.then((res)=> {console.log(res)})
628636
.catch((err)=> {console.log(err)});

types/index.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,12 @@ declare module 'cloudinary' {
10421042
function upload_tag_params(options?: UploadApiOptions, callback?: UploadResponseCallback): Promise<any>;
10431043

10441044
function upload_url(options?: ConfigOptions): Promise<any>;
1045+
1046+
/****************************** Structured Metadata API V2 Methods *************************************/
1047+
1048+
function update_metadata(metadata: string | object, public_ids: string[], options?:UploadApiOptions, callback?: ResponseCallback): Promise<MetadataFieldApiResponse>;
1049+
1050+
function update_metadata(metadata: string| object, public_ids: string[], callback?: ResponseCallback): Promise<MetadataFieldApiResponse>;
10451051
}
10461052

10471053
/****************************** Search API *************************************/

0 commit comments

Comments
 (0)