From 32e35e517da637e0588a2c9b48e4ad8de7efb5e7 Mon Sep 17 00:00:00 2001 From: Raya Straus Date: Mon, 19 Jul 2021 16:04:10 +0300 Subject: [PATCH] Add update_metada type to upload api --- types/cloudinary_ts_spec.ts | 8 ++++++++ types/index.d.ts | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/types/cloudinary_ts_spec.ts b/types/cloudinary_ts_spec.ts index 9716e05f..8bbbc683 100644 --- a/types/cloudinary_ts_spec.ts +++ b/types/cloudinary_ts_spec.ts @@ -1,5 +1,6 @@ import * as cloudinary from 'cloudinary'; import * as Http from "http"; +import {MetadataFieldApiResponse, ResponseCallback, UploadApiOptions} from "cloudinary"; // $ExpectType ConfigOptions cloudinary.v2.config(); @@ -623,6 +624,13 @@ const datasource_changes = { ], }; +cloudinary.v2.uploader.update_metadata({ metadata_color: "red", metadata_shape: "" }, ["test_id_1", "test_id_2"]) + .then((res)=> {console.log(res)}) + .catch((err)=> {console.log(err)}); + +cloudinary.v2.uploader.update_metadata('countryFieldId=[\"id_us\",\"id_uk\",\"id_france"]', [ 'dog', 'lion' ], + function(error, result) { console.log(result, error) }); + cloudinary.v2.api.update_metadata_field_datasource('EXTERNAL_ID_GET_LIST1', datasource_changes) .then((res)=> {console.log(res)}) .catch((err)=> {console.log(err)}); diff --git a/types/index.d.ts b/types/index.d.ts index 01b87a21..21c0fb77 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1042,6 +1042,12 @@ declare module 'cloudinary' { function upload_tag_params(options?: UploadApiOptions, callback?: UploadResponseCallback): Promise; function upload_url(options?: ConfigOptions): Promise; + + /****************************** Structured Metadata API V2 Methods *************************************/ + + function update_metadata(metadata: string | object, public_ids: string[], options?:UploadApiOptions, callback?: ResponseCallback): Promise; + + function update_metadata(metadata: string| object, public_ids: string[], callback?: ResponseCallback): Promise; } /****************************** Search API *************************************/