feat: asset copy (#23172)

This commit is contained in:
Daniel Dietzler
2025-10-29 14:43:47 +01:00
committed by GitHub
parent fdfb04d83c
commit 4ae7cadeae
20 changed files with 644 additions and 2 deletions

View File

@@ -1946,6 +1946,43 @@
"x-immich-permission": "asset.upload"
}
},
"/assets/copy": {
"put": {
"operationId": "copyAsset",
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AssetCopyDto"
}
}
},
"required": true
},
"responses": {
"204": {
"description": ""
}
},
"security": [
{
"bearer": []
},
{
"cookie": []
},
{
"api_key": []
}
],
"tags": [
"Assets"
],
"x-immich-permission": "asset.copy",
"description": "This endpoint requires the `asset.copy` permission."
}
},
"/assets/device/{deviceId}": {
"get": {
"description": "Get all asset of a device that are in the database, ID only.",
@@ -10651,6 +10688,43 @@
],
"type": "object"
},
"AssetCopyDto": {
"properties": {
"albums": {
"default": true,
"type": "boolean"
},
"favorite": {
"default": true,
"type": "boolean"
},
"sharedLinks": {
"default": true,
"type": "boolean"
},
"sidecar": {
"default": true,
"type": "boolean"
},
"sourceId": {
"format": "uuid",
"type": "string"
},
"stack": {
"default": true,
"type": "boolean"
},
"targetId": {
"format": "uuid",
"type": "string"
}
},
"required": [
"sourceId",
"targetId"
],
"type": "object"
},
"AssetDeltaSyncDto": {
"properties": {
"updatedAfter": {
@@ -13398,6 +13472,7 @@
"asset.download",
"asset.upload",
"asset.replace",
"asset.copy",
"album.create",
"album.read",
"album.update",

View File

@@ -517,6 +517,15 @@ export type AssetBulkUploadCheckResult = {
export type AssetBulkUploadCheckResponseDto = {
results: AssetBulkUploadCheckResult[];
};
export type AssetCopyDto = {
albums?: boolean;
favorite?: boolean;
sharedLinks?: boolean;
sidecar?: boolean;
sourceId: string;
stack?: boolean;
targetId: string;
};
export type CheckExistingAssetsDto = {
deviceAssetIds: string[];
deviceId: string;
@@ -2256,6 +2265,18 @@ export function checkBulkUpload({ assetBulkUploadCheckDto }: {
body: assetBulkUploadCheckDto
})));
}
/**
* This endpoint requires the `asset.copy` permission.
*/
export function copyAsset({ assetCopyDto }: {
assetCopyDto: AssetCopyDto;
}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchText("/assets/copy", oazapfts.json({
...opts,
method: "PUT",
body: assetCopyDto
})));
}
/**
* getAllUserAssetsByDeviceId
*/
@@ -4796,6 +4817,7 @@ export enum Permission {
AssetDownload = "asset.download",
AssetUpload = "asset.upload",
AssetReplace = "asset.replace",
AssetCopy = "asset.copy",
AlbumCreate = "album.create",
AlbumRead = "album.read",
AlbumUpdate = "album.update",