mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
feat: getAssetEdits respond with edit IDs (#26445)
* feat: getAssetEdits respond with edit IDs * chore: cleanup typings for edit API * chore: cleanup types with jason * fix: openapi sync * fix: factory
This commit is contained in:
@@ -3703,7 +3703,7 @@
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/AssetEditsDto"
|
||||
"$ref": "#/components/schemas/AssetEditsResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -3756,7 +3756,7 @@
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/AssetEditActionListDto"
|
||||
"$ref": "#/components/schemas/AssetEditsCreateDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -3767,7 +3767,7 @@
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/AssetEditsDto"
|
||||
"$ref": "#/components/schemas/AssetEditsResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -16082,7 +16082,7 @@
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"AssetEditActionCrop": {
|
||||
"AssetEditActionItemDto": {
|
||||
"properties": {
|
||||
"action": {
|
||||
"allOf": [
|
||||
@@ -16093,7 +16093,18 @@
|
||||
"description": "Type of edit action to perform"
|
||||
},
|
||||
"parameters": {
|
||||
"$ref": "#/components/schemas/CropParameters"
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/CropParameters"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/RotateParameters"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/MirrorParameters"
|
||||
}
|
||||
],
|
||||
"description": "List of edit actions to apply (crop, rotate, or mirror)"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -16102,30 +16113,48 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"AssetEditActionListDto": {
|
||||
"AssetEditActionItemResponseDto": {
|
||||
"properties": {
|
||||
"action": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/AssetEditAction"
|
||||
}
|
||||
],
|
||||
"description": "Type of edit action to perform"
|
||||
},
|
||||
"id": {
|
||||
"format": "uuid",
|
||||
"type": "string"
|
||||
},
|
||||
"parameters": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/CropParameters"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/RotateParameters"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/MirrorParameters"
|
||||
}
|
||||
],
|
||||
"description": "List of edit actions to apply (crop, rotate, or mirror)"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action",
|
||||
"id",
|
||||
"parameters"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"AssetEditsCreateDto": {
|
||||
"properties": {
|
||||
"edits": {
|
||||
"description": "List of edit actions to apply (crop, rotate, or mirror)",
|
||||
"items": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/AssetEditActionCrop"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/AssetEditActionRotate"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/AssetEditActionMirror"
|
||||
}
|
||||
],
|
||||
"discriminator": {
|
||||
"mapping": {
|
||||
"crop": "#/components/schemas/AssetEditActionCrop",
|
||||
"mirror": "#/components/schemas/AssetEditActionMirror",
|
||||
"rotate": "#/components/schemas/AssetEditActionRotate"
|
||||
},
|
||||
"propertyName": "action"
|
||||
}
|
||||
"$ref": "#/components/schemas/AssetEditActionItemDto"
|
||||
},
|
||||
"minItems": 1,
|
||||
"type": "array"
|
||||
@@ -16136,77 +16165,18 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"AssetEditActionMirror": {
|
||||
"properties": {
|
||||
"action": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/AssetEditAction"
|
||||
}
|
||||
],
|
||||
"description": "Type of edit action to perform"
|
||||
},
|
||||
"parameters": {
|
||||
"$ref": "#/components/schemas/MirrorParameters"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action",
|
||||
"parameters"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"AssetEditActionRotate": {
|
||||
"properties": {
|
||||
"action": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/AssetEditAction"
|
||||
}
|
||||
],
|
||||
"description": "Type of edit action to perform"
|
||||
},
|
||||
"parameters": {
|
||||
"$ref": "#/components/schemas/RotateParameters"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action",
|
||||
"parameters"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"AssetEditsDto": {
|
||||
"AssetEditsResponseDto": {
|
||||
"properties": {
|
||||
"assetId": {
|
||||
"description": "Asset ID to apply edits to",
|
||||
"description": "Asset ID these edits belong to",
|
||||
"format": "uuid",
|
||||
"type": "string"
|
||||
},
|
||||
"edits": {
|
||||
"description": "List of edit actions to apply (crop, rotate, or mirror)",
|
||||
"description": "List of edit actions applied to the asset",
|
||||
"items": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/AssetEditActionCrop"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/AssetEditActionRotate"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/AssetEditActionMirror"
|
||||
}
|
||||
],
|
||||
"discriminator": {
|
||||
"mapping": {
|
||||
"crop": "#/components/schemas/AssetEditActionCrop",
|
||||
"mirror": "#/components/schemas/AssetEditActionMirror",
|
||||
"rotate": "#/components/schemas/AssetEditActionRotate"
|
||||
},
|
||||
"propertyName": "action"
|
||||
}
|
||||
"$ref": "#/components/schemas/AssetEditActionItemResponseDto"
|
||||
},
|
||||
"minItems": 1,
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -959,38 +959,36 @@ export type CropParameters = {
|
||||
/** Top-Left Y coordinate of crop */
|
||||
y: number;
|
||||
};
|
||||
export type AssetEditActionCrop = {
|
||||
/** Type of edit action to perform */
|
||||
action: AssetEditAction;
|
||||
parameters: CropParameters;
|
||||
};
|
||||
export type RotateParameters = {
|
||||
/** Rotation angle in degrees */
|
||||
angle: number;
|
||||
};
|
||||
export type AssetEditActionRotate = {
|
||||
/** Type of edit action to perform */
|
||||
action: AssetEditAction;
|
||||
parameters: RotateParameters;
|
||||
};
|
||||
export type MirrorParameters = {
|
||||
/** Axis to mirror along */
|
||||
axis: MirrorAxis;
|
||||
};
|
||||
export type AssetEditActionMirror = {
|
||||
export type AssetEditActionItemResponseDto = {
|
||||
/** Type of edit action to perform */
|
||||
action: AssetEditAction;
|
||||
parameters: MirrorParameters;
|
||||
id: string;
|
||||
/** List of edit actions to apply (crop, rotate, or mirror) */
|
||||
parameters: CropParameters | RotateParameters | MirrorParameters;
|
||||
};
|
||||
export type AssetEditsDto = {
|
||||
/** Asset ID to apply edits to */
|
||||
export type AssetEditsResponseDto = {
|
||||
/** Asset ID these edits belong to */
|
||||
assetId: string;
|
||||
/** List of edit actions to apply (crop, rotate, or mirror) */
|
||||
edits: (AssetEditActionCrop | AssetEditActionRotate | AssetEditActionMirror)[];
|
||||
/** List of edit actions applied to the asset */
|
||||
edits: AssetEditActionItemResponseDto[];
|
||||
};
|
||||
export type AssetEditActionListDto = {
|
||||
export type AssetEditActionItemDto = {
|
||||
/** Type of edit action to perform */
|
||||
action: AssetEditAction;
|
||||
/** List of edit actions to apply (crop, rotate, or mirror) */
|
||||
edits: (AssetEditActionCrop | AssetEditActionRotate | AssetEditActionMirror)[];
|
||||
parameters: CropParameters | RotateParameters | MirrorParameters;
|
||||
};
|
||||
export type AssetEditsCreateDto = {
|
||||
/** List of edit actions to apply (crop, rotate, or mirror) */
|
||||
edits: AssetEditActionItemDto[];
|
||||
};
|
||||
export type AssetMetadataResponseDto = {
|
||||
/** Metadata key */
|
||||
@@ -4149,7 +4147,7 @@ export function getAssetEdits({ id }: {
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: AssetEditsDto;
|
||||
data: AssetEditsResponseDto;
|
||||
}>(`/assets/${encodeURIComponent(id)}/edits`, {
|
||||
...opts
|
||||
}));
|
||||
@@ -4157,17 +4155,17 @@ export function getAssetEdits({ id }: {
|
||||
/**
|
||||
* Apply edits to an existing asset
|
||||
*/
|
||||
export function editAsset({ id, assetEditActionListDto }: {
|
||||
export function editAsset({ id, assetEditsCreateDto }: {
|
||||
id: string;
|
||||
assetEditActionListDto: AssetEditActionListDto;
|
||||
assetEditsCreateDto: AssetEditsCreateDto;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: AssetEditsDto;
|
||||
data: AssetEditsResponseDto;
|
||||
}>(`/assets/${encodeURIComponent(id)}/edits`, oazapfts.json({
|
||||
...opts,
|
||||
method: "PUT",
|
||||
body: assetEditActionListDto
|
||||
body: assetEditsCreateDto
|
||||
})));
|
||||
}
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user