Skip to content

Commit

Permalink
added parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
ANKUR DWIVEDI authored and ANKUR DWIVEDI committed Aug 22, 2024
1 parent 9fe6eb0 commit 78dd2bc
Show file tree
Hide file tree
Showing 7 changed files with 4,846 additions and 8 deletions.
7 changes: 7 additions & 0 deletions libs/interfaces/FileDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ export interface FileDetailsOptions {
* 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.
*/
customMetadata?: CMValues;
/**
* Configure the publication status of a file and its versions.
*/
publish?: {
isPublished: boolean;
includeFileVersions?: boolean;
};
}

/**
Expand Down
6 changes: 6 additions & 0 deletions libs/interfaces/UploadOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,10 @@ export interface UploadOptions {
* Optional `checks` parameters can be used to run server-side checks before files are uploaded to the Media Library.
*/
checks?: string
/**
* Optional. Determines whether the file should be uploaded as published.
* If set to false, the file will be marked as unpublished, restricting access to the file through the media library only.
* Files in draft or unpublished states can only be publicly accessed after they are published.
*/
isPublished?: boolean
}
21 changes: 14 additions & 7 deletions libs/manage/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,20 @@ const updateDetails = function (
respond(true, errorMessages.UPDATE_DATA_MISSING, callback);
return;
}
var data = {
tags: updateData.tags,
customCoordinates: updateData.customCoordinates,
extensions: updateData.extensions,
webhookUrl: updateData.webhookUrl,
customMetadata: updateData.customMetadata
};

var data;
if (updateData.publish)
data = {
publish: updateData.publish,
};
else
data = {
tags: updateData.tags,
customCoordinates: updateData.customCoordinates,
extensions: updateData.extensions,
webhookUrl: updateData.webhookUrl,
customMetadata: updateData.customMetadata,
};

var requestOptions = {
url: "https://api.imagekit.io/v1/files/" + fileId + "/details",
Expand Down
Loading

0 comments on commit 78dd2bc

Please sign in to comment.