mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
feat: bulk asset metadata endpoints (#25133)
This commit is contained in:
@@ -2906,6 +2906,112 @@
|
||||
"x-immich-state": "Stable"
|
||||
}
|
||||
},
|
||||
"/assets/metadata": {
|
||||
"delete": {
|
||||
"description": "Delete metadata key-value pairs for multiple assets.",
|
||||
"operationId": "deleteBulkAssetMetadata",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/AssetMetadataBulkDeleteDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"summary": "Delete asset metadata",
|
||||
"tags": [
|
||||
"Assets"
|
||||
],
|
||||
"x-immich-history": [
|
||||
{
|
||||
"version": "v1",
|
||||
"state": "Added"
|
||||
},
|
||||
{
|
||||
"version": "v2.5.0",
|
||||
"state": "Beta"
|
||||
}
|
||||
],
|
||||
"x-immich-permission": "asset.update",
|
||||
"x-immich-state": "Beta"
|
||||
},
|
||||
"put": {
|
||||
"description": "Upsert metadata key-value pairs for multiple assets.",
|
||||
"operationId": "updateBulkAssetMetadata",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/AssetMetadataBulkUpsertDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/AssetMetadataBulkResponseDto"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"summary": "Upsert asset metadata",
|
||||
"tags": [
|
||||
"Assets"
|
||||
],
|
||||
"x-immich-history": [
|
||||
{
|
||||
"version": "v1",
|
||||
"state": "Added"
|
||||
},
|
||||
{
|
||||
"version": "v2.5.0",
|
||||
"state": "Beta"
|
||||
}
|
||||
],
|
||||
"x-immich-permission": "asset.update",
|
||||
"x-immich-state": "Beta"
|
||||
}
|
||||
},
|
||||
"/assets/random": {
|
||||
"get": {
|
||||
"deprecated": true,
|
||||
@@ -3340,7 +3446,7 @@
|
||||
"required": true,
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/AssetMetadataKey"
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -3399,7 +3505,7 @@
|
||||
"required": true,
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/AssetMetadataKey"
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -15575,20 +15681,98 @@
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"AssetMetadataKey": {
|
||||
"enum": [
|
||||
"mobile-app"
|
||||
"AssetMetadataBulkDeleteDto": {
|
||||
"properties": {
|
||||
"items": {
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/AssetMetadataBulkDeleteItemDto"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"items"
|
||||
],
|
||||
"type": "string"
|
||||
"type": "object"
|
||||
},
|
||||
"AssetMetadataBulkDeleteItemDto": {
|
||||
"properties": {
|
||||
"assetId": {
|
||||
"format": "uuid",
|
||||
"type": "string"
|
||||
},
|
||||
"key": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"assetId",
|
||||
"key"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"AssetMetadataBulkResponseDto": {
|
||||
"properties": {
|
||||
"assetId": {
|
||||
"type": "string"
|
||||
},
|
||||
"key": {
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"assetId",
|
||||
"key",
|
||||
"updatedAt",
|
||||
"value"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"AssetMetadataBulkUpsertDto": {
|
||||
"properties": {
|
||||
"items": {
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/AssetMetadataBulkUpsertItemDto"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"items"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"AssetMetadataBulkUpsertItemDto": {
|
||||
"properties": {
|
||||
"assetId": {
|
||||
"format": "uuid",
|
||||
"type": "string"
|
||||
},
|
||||
"key": {
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"assetId",
|
||||
"key",
|
||||
"value"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"AssetMetadataResponseDto": {
|
||||
"properties": {
|
||||
"key": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/AssetMetadataKey"
|
||||
}
|
||||
]
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"format": "date-time",
|
||||
@@ -15622,11 +15806,7 @@
|
||||
"AssetMetadataUpsertItemDto": {
|
||||
"properties": {
|
||||
"key": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/AssetMetadataKey"
|
||||
}
|
||||
]
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": "object"
|
||||
@@ -20651,11 +20831,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"key": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/AssetMetadataKey"
|
||||
}
|
||||
]
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -20670,11 +20846,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"key": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/AssetMetadataKey"
|
||||
}
|
||||
]
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": "object"
|
||||
|
||||
@@ -471,7 +471,7 @@ export type AssetBulkDeleteDto = {
|
||||
ids: string[];
|
||||
};
|
||||
export type AssetMetadataUpsertItemDto = {
|
||||
key: AssetMetadataKey;
|
||||
key: string;
|
||||
value: object;
|
||||
};
|
||||
export type AssetMediaCreateDto = {
|
||||
@@ -543,6 +543,27 @@ export type AssetJobsDto = {
|
||||
assetIds: string[];
|
||||
name: AssetJobName;
|
||||
};
|
||||
export type AssetMetadataBulkDeleteItemDto = {
|
||||
assetId: string;
|
||||
key: string;
|
||||
};
|
||||
export type AssetMetadataBulkDeleteDto = {
|
||||
items: AssetMetadataBulkDeleteItemDto[];
|
||||
};
|
||||
export type AssetMetadataBulkUpsertItemDto = {
|
||||
assetId: string;
|
||||
key: string;
|
||||
value: object;
|
||||
};
|
||||
export type AssetMetadataBulkUpsertDto = {
|
||||
items: AssetMetadataBulkUpsertItemDto[];
|
||||
};
|
||||
export type AssetMetadataBulkResponseDto = {
|
||||
assetId: string;
|
||||
key: string;
|
||||
updatedAt: string;
|
||||
value: object;
|
||||
};
|
||||
export type UpdateAssetDto = {
|
||||
dateTimeOriginal?: string;
|
||||
description?: string;
|
||||
@@ -554,7 +575,7 @@ export type UpdateAssetDto = {
|
||||
visibility?: AssetVisibility;
|
||||
};
|
||||
export type AssetMetadataResponseDto = {
|
||||
key: AssetMetadataKey;
|
||||
key: string;
|
||||
updatedAt: string;
|
||||
value: object;
|
||||
};
|
||||
@@ -2462,6 +2483,33 @@ export function runAssetJobs({ assetJobsDto }: {
|
||||
body: assetJobsDto
|
||||
})));
|
||||
}
|
||||
/**
|
||||
* Delete asset metadata
|
||||
*/
|
||||
export function deleteBulkAssetMetadata({ assetMetadataBulkDeleteDto }: {
|
||||
assetMetadataBulkDeleteDto: AssetMetadataBulkDeleteDto;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchText("/assets/metadata", oazapfts.json({
|
||||
...opts,
|
||||
method: "DELETE",
|
||||
body: assetMetadataBulkDeleteDto
|
||||
})));
|
||||
}
|
||||
/**
|
||||
* Upsert asset metadata
|
||||
*/
|
||||
export function updateBulkAssetMetadata({ assetMetadataBulkUpsertDto }: {
|
||||
assetMetadataBulkUpsertDto: AssetMetadataBulkUpsertDto;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: AssetMetadataBulkResponseDto[];
|
||||
}>("/assets/metadata", oazapfts.json({
|
||||
...opts,
|
||||
method: "PUT",
|
||||
body: assetMetadataBulkUpsertDto
|
||||
})));
|
||||
}
|
||||
/**
|
||||
* Get random assets
|
||||
*/
|
||||
@@ -2564,7 +2612,7 @@ export function updateAssetMetadata({ id, assetMetadataUpsertDto }: {
|
||||
*/
|
||||
export function deleteAssetMetadata({ id, key }: {
|
||||
id: string;
|
||||
key: AssetMetadataKey;
|
||||
key: string;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchText(`/assets/${encodeURIComponent(id)}/metadata/${encodeURIComponent(key)}`, {
|
||||
...opts,
|
||||
@@ -2576,7 +2624,7 @@ export function deleteAssetMetadata({ id, key }: {
|
||||
*/
|
||||
export function getAssetMetadataByKey({ id, key }: {
|
||||
id: string;
|
||||
key: AssetMetadataKey;
|
||||
key: string;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
@@ -5363,9 +5411,6 @@ export enum Permission {
|
||||
AdminSessionRead = "adminSession.read",
|
||||
AdminAuthUnlinkAll = "adminAuth.unlinkAll"
|
||||
}
|
||||
export enum AssetMetadataKey {
|
||||
MobileApp = "mobile-app"
|
||||
}
|
||||
export enum AssetMediaStatus {
|
||||
Created = "created",
|
||||
Replaced = "replaced",
|
||||
|
||||
Reference in New Issue
Block a user