Skip to content

Commit 78dd2bc

Browse files
ANKUR DWIVEDIANKUR DWIVEDI
authored andcommitted
added parameter
1 parent 9fe6eb0 commit 78dd2bc

File tree

7 files changed

+4846
-8
lines changed

7 files changed

+4846
-8
lines changed

libs/interfaces/FileDetails.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ export interface FileDetailsOptions {
7272
* A key-value data to be associated with the asset. To unset a key, send null value for that key. Before setting any custom metadata on an asset you have to create the field using custom metadata fields API.
7373
*/
7474
customMetadata?: CMValues;
75+
/**
76+
* Configure the publication status of a file and its versions.
77+
*/
78+
publish?: {
79+
isPublished: boolean;
80+
includeFileVersions?: boolean;
81+
};
7582
}
7683

7784
/**

libs/interfaces/UploadOptions.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,10 @@ export interface UploadOptions {
112112
* Optional `checks` parameters can be used to run server-side checks before files are uploaded to the Media Library.
113113
*/
114114
checks?: string
115+
/**
116+
* Optional. Determines whether the file should be uploaded as published.
117+
* If set to false, the file will be marked as unpublished, restricting access to the file through the media library only.
118+
* Files in draft or unpublished states can only be publicly accessed after they are published.
119+
*/
120+
isPublished?: boolean
115121
}

libs/manage/file.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,20 @@ const updateDetails = function (
202202
respond(true, errorMessages.UPDATE_DATA_MISSING, callback);
203203
return;
204204
}
205-
var data = {
206-
tags: updateData.tags,
207-
customCoordinates: updateData.customCoordinates,
208-
extensions: updateData.extensions,
209-
webhookUrl: updateData.webhookUrl,
210-
customMetadata: updateData.customMetadata
211-
};
205+
206+
var data;
207+
if (updateData.publish)
208+
data = {
209+
publish: updateData.publish,
210+
};
211+
else
212+
data = {
213+
tags: updateData.tags,
214+
customCoordinates: updateData.customCoordinates,
215+
extensions: updateData.extensions,
216+
webhookUrl: updateData.webhookUrl,
217+
customMetadata: updateData.customMetadata,
218+
};
212219

213220
var requestOptions = {
214221
url: "https://api.imagekit.io/v1/files/" + fileId + "/details",

0 commit comments

Comments
 (0)