mirror of
https://github.com/immich-app/immich.git
synced 2026-06-05 13:45:20 -04:00
feat: asset file apis
This commit is contained in:
@@ -773,6 +773,22 @@ export type ApiKeyUpdateDto = {
|
||||
/** List of permissions */
|
||||
permissions?: Permission[];
|
||||
};
|
||||
export type AssetFileResponseDto = {
|
||||
/** Creation date */
|
||||
createdAt: string;
|
||||
/** Asset file ID */
|
||||
id: string;
|
||||
/** The file was generated from an edit */
|
||||
isEdited: boolean;
|
||||
/** The file is a progressively encoded JPEG */
|
||||
isProgressive: boolean;
|
||||
/** File path */
|
||||
path: string;
|
||||
/** Type of file */
|
||||
"type": AssetFileType;
|
||||
/** Update date */
|
||||
updatedAt: string;
|
||||
};
|
||||
export type AssetBulkDeleteDto = {
|
||||
/** Force delete even if in use */
|
||||
force?: boolean;
|
||||
@@ -3887,6 +3903,64 @@ export function updateApiKey({ id, apiKeyUpdateDto }: {
|
||||
body: apiKeyUpdateDto
|
||||
})));
|
||||
}
|
||||
/**
|
||||
* Retrieve an asset file
|
||||
*/
|
||||
export function searchAssetFiles({ assetId, isEdited, isProgressive, $type }: {
|
||||
assetId: string;
|
||||
isEdited?: boolean;
|
||||
isProgressive?: boolean;
|
||||
$type?: AssetFileType;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: AssetFileResponseDto[];
|
||||
}>(`/asset-files${QS.query(QS.explode({
|
||||
assetId,
|
||||
isEdited,
|
||||
isProgressive,
|
||||
"type": $type
|
||||
}))}`, {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
/**
|
||||
* Delete an asset file
|
||||
*/
|
||||
export function deleteAssetFile({ id }: {
|
||||
id: string;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchText(`/asset-files/${encodeURIComponent(id)}`, {
|
||||
...opts,
|
||||
method: "DELETE"
|
||||
}));
|
||||
}
|
||||
/**
|
||||
* Retrieve an asset file
|
||||
*/
|
||||
export function getAssetFile({ id }: {
|
||||
id: string;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: AssetFileResponseDto;
|
||||
}>(`/asset-files/${encodeURIComponent(id)}`, {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
/**
|
||||
* Download an asset file
|
||||
*/
|
||||
export function downloadAssetFile({ id }: {
|
||||
id: string;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchBlob<{
|
||||
status: 200;
|
||||
data: Blob;
|
||||
}>(`/asset-files/${encodeURIComponent(id)}/download`, {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
/**
|
||||
* Delete assets
|
||||
*/
|
||||
@@ -6862,6 +6936,9 @@ export enum Permission {
|
||||
AssetReplace = "asset.replace",
|
||||
AssetCopy = "asset.copy",
|
||||
AssetDerive = "asset.derive",
|
||||
AssetFileRead = "assetFile.read",
|
||||
AssetFileDelete = "assetFile.delete",
|
||||
AssetFileDownload = "assetFile.download",
|
||||
AssetEditGet = "asset.edit.get",
|
||||
AssetEditCreate = "asset.edit.create",
|
||||
AssetEditDelete = "asset.edit.delete",
|
||||
@@ -6998,6 +7075,12 @@ export enum Permission {
|
||||
AdminSessionRead = "adminSession.read",
|
||||
AdminAuthUnlinkAll = "adminAuth.unlinkAll"
|
||||
}
|
||||
export enum AssetFileType {
|
||||
Fullsize = "fullsize",
|
||||
Preview = "preview",
|
||||
Thumbnail = "thumbnail",
|
||||
Sidecar = "sidecar"
|
||||
}
|
||||
export enum AssetMediaStatus {
|
||||
Created = "created",
|
||||
Replaced = "replaced",
|
||||
|
||||
Reference in New Issue
Block a user