feat: adding metadata button
This commit is contained in:
@@ -188,6 +188,21 @@ export async function checksum(url: string, algo: ChecksumAlg) {
|
||||
return (await data.json()).checksums[algo];
|
||||
}
|
||||
|
||||
export async function metadata(url: string) {
|
||||
// Fetch metadata for a resource. Backend support is required for this to work.
|
||||
const res = await resourceAction(`${url}?metadata=1`, "GET");
|
||||
try {
|
||||
return await res.json();
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export async function updateMetadata(url: string, content: any) {
|
||||
// Update metadata for a resource. Backend must support PATCH with action=metadata.
|
||||
return resourceAction(`${url}?action=metadata`, "PATCH", JSON.stringify(content));
|
||||
}
|
||||
|
||||
export function getDownloadURL(file: ResourceItem, inline: any) {
|
||||
const params = {
|
||||
...(inline && { inline: "true" }),
|
||||
|
||||
Reference in New Issue
Block a user