feat: asset file apis

This commit is contained in:
Jason Rasmussen
2026-02-04 16:00:29 -05:00
parent e9f8521a50
commit 5abe4e2bd7
24 changed files with 1192 additions and 0 deletions
+311
View File
@@ -2760,6 +2760,253 @@
"x-immich-state": "Stable"
}
},
"/asset-files": {
"get": {
"description": "Returns a metadata about a specific asset file.",
"operationId": "searchAssetFiles",
"parameters": [
{
"name": "assetId",
"required": true,
"in": "query",
"description": "Asset ID to filter files by",
"schema": {
"format": "uuid",
"type": "string"
}
},
{
"name": "isEdited",
"required": false,
"in": "query",
"description": "The file was generated from an edit",
"schema": {
"type": "boolean"
}
},
{
"name": "isProgressive",
"required": false,
"in": "query",
"description": "The file is a progressively encoded JPEG",
"schema": {
"type": "boolean"
}
},
{
"name": "type",
"required": false,
"in": "query",
"description": "Filter by type of file",
"schema": {
"$ref": "#/components/schemas/AssetFileType"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"items": {
"$ref": "#/components/schemas/AssetFileResponseDto"
},
"type": "array"
}
}
},
"description": ""
}
},
"security": [
{
"bearer": []
},
{
"cookie": []
},
{
"api_key": []
}
],
"summary": "Retrieve an asset file",
"tags": [
"Asset files"
],
"x-immich-history": [
{
"version": "v2.6.0",
"state": "Added"
},
{
"version": "v2.6.0",
"state": "Beta"
}
],
"x-immich-permission": "assetFile.read",
"x-immich-state": "Beta"
}
},
"/asset-files/{id}": {
"delete": {
"description": "Delete a file and remove it from the database.",
"operationId": "deleteAssetFile",
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"format": "uuid",
"type": "string"
}
}
],
"responses": {
"204": {
"description": ""
}
},
"security": [
{
"bearer": []
},
{
"cookie": []
},
{
"api_key": []
}
],
"summary": "Delete an asset file",
"tags": [
"Asset files"
],
"x-immich-history": [
{
"version": "v2.6.0",
"state": "Added"
},
{
"version": "v2.6.0",
"state": "Beta"
}
],
"x-immich-permission": "assetFile.delete",
"x-immich-state": "Beta"
},
"get": {
"description": "Returns a metadata about a specific asset file.",
"operationId": "getAssetFile",
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"format": "uuid",
"type": "string"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AssetFileResponseDto"
}
}
},
"description": ""
}
},
"security": [
{
"bearer": []
},
{
"cookie": []
},
{
"api_key": []
}
],
"summary": "Retrieve an asset file",
"tags": [
"Asset files"
],
"x-immich-history": [
{
"version": "v2.6.0",
"state": "Added"
},
{
"version": "v2.6.0",
"state": "Beta"
}
],
"x-immich-permission": "assetFile.read",
"x-immich-state": "Beta"
}
},
"/asset-files/{id}/download": {
"get": {
"description": "Serve the contents of a specific asset file.",
"operationId": "downloadAssetFile",
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"format": "uuid",
"type": "string"
}
}
],
"responses": {
"200": {
"content": {
"application/octet-stream": {
"schema": {
"format": "binary",
"type": "string"
}
}
},
"description": ""
}
},
"security": [
{
"bearer": []
},
{
"cookie": []
},
{
"api_key": []
}
],
"summary": "Download an asset file",
"tags": [
"Asset files"
],
"x-immich-history": [
{
"version": "v2.6.0",
"state": "Added"
},
{
"version": "v2.6.0",
"state": "Beta"
}
],
"x-immich-permission": "assetFile.download",
"x-immich-state": "Beta"
}
},
"/assets": {
"delete": {
"description": "Deletes multiple assets at the same time.",
@@ -15077,6 +15324,10 @@
"name": "Assets",
"description": "An asset is an image or video that has been uploaded to Immich."
},
{
"name": "Asset files",
"description": "An asset file is a file associated with an asset, including edited versions, thumbnails, etc."
},
{
"name": "Authentication",
"description": "Endpoints related to user authentication, including OAuth."
@@ -16320,6 +16571,63 @@
],
"type": "object"
},
"AssetFileResponseDto": {
"properties": {
"createdAt": {
"description": "Creation date",
"format": "date-time",
"type": "string"
},
"id": {
"description": "Asset file ID",
"type": "string"
},
"isEdited": {
"description": "The file was generated from an edit",
"type": "boolean"
},
"isProgressive": {
"description": "The file is a progressively encoded JPEG",
"type": "boolean"
},
"path": {
"description": "File path",
"type": "string"
},
"type": {
"allOf": [
{
"$ref": "#/components/schemas/AssetFileType"
}
],
"description": "Type of file"
},
"updatedAt": {
"description": "Update date",
"format": "date-time",
"type": "string"
}
},
"required": [
"createdAt",
"id",
"isEdited",
"isProgressive",
"path",
"type",
"updatedAt"
],
"type": "object"
},
"AssetFileType": {
"enum": [
"fullsize",
"preview",
"thumbnail",
"sidecar"
],
"type": "string"
},
"AssetFullSyncDto": {
"properties": {
"lastId": {
@@ -19520,6 +19828,9 @@
"asset.replace",
"asset.copy",
"asset.derive",
"assetFile.read",
"assetFile.delete",
"assetFile.download",
"asset.edit.get",
"asset.edit.create",
"asset.edit.delete",
@@ -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",