feat: editor endpoints

This commit is contained in:
Jason Rasmussen
2024-08-08 12:47:02 -04:00
parent 11f41099c3
commit 82f05e9ca9
25 changed files with 1566 additions and 5 deletions
+180
View File
@@ -2469,6 +2469,48 @@
]
}
},
"/editor": {
"post": {
"operationId": "createAssetFromEdits",
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/EditorCreateAssetDto"
}
}
},
"required": true
},
"responses": {
"201": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AssetResponseDto"
}
}
},
"description": ""
}
},
"security": [
{
"bearer": []
},
{
"cookie": []
},
{
"api_key": []
}
],
"tags": [
"Editor"
]
}
},
"/faces": {
"get": {
"operationId": "getFaces",
@@ -8562,6 +8604,144 @@
],
"type": "object"
},
"EditorActionAdjust": {
"properties": {
"action": {
"$ref": "#/components/schemas/EditorActionType"
},
"brightness": {
"type": "integer"
},
"hue": {
"type": "integer"
},
"lightness": {
"type": "integer"
},
"saturation": {
"type": "integer"
}
},
"required": [
"action",
"brightness",
"hue",
"lightness",
"saturation"
],
"type": "object"
},
"EditorActionBlur": {
"properties": {
"action": {
"$ref": "#/components/schemas/EditorActionType"
}
},
"required": [
"action"
],
"type": "object"
},
"EditorActionCrop": {
"properties": {
"action": {
"$ref": "#/components/schemas/EditorActionType"
},
"region": {
"$ref": "#/components/schemas/EditorCropRegion"
}
},
"required": [
"action",
"region"
],
"type": "object"
},
"EditorActionRotate": {
"properties": {
"action": {
"$ref": "#/components/schemas/EditorActionType"
},
"angle": {
"type": "integer"
}
},
"required": [
"action",
"angle"
],
"type": "object"
},
"EditorActionType": {
"enum": [
"crop",
"rotate",
"blur",
"adjust"
],
"type": "string"
},
"EditorCreateAssetDto": {
"properties": {
"edits": {
"description": "list of edits",
"items": {
"anyOf": [
{
"$ref": "#/components/schemas/EditorActionCrop"
},
{
"$ref": "#/components/schemas/EditorActionRotate"
},
{
"$ref": "#/components/schemas/EditorActionBlur"
},
{
"$ref": "#/components/schemas/EditorActionAdjust"
}
]
},
"type": "array"
},
"id": {
"description": "Source asset id",
"format": "uuid",
"type": "string"
},
"stack": {
"description": "Stack the edit and the original",
"type": "boolean"
}
},
"required": [
"edits",
"id"
],
"type": "object"
},
"EditorCropRegion": {
"properties": {
"height": {
"type": "integer"
},
"left": {
"type": "integer"
},
"top": {
"type": "integer"
},
"width": {
"type": "integer"
}
},
"required": [
"height",
"left",
"top",
"width"
],
"type": "object"
},
"EmailNotificationsResponse": {
"properties": {
"albumInvite": {
@@ -444,6 +444,38 @@ export type DuplicateResponseDto = {
assets: AssetResponseDto[];
duplicateId: string;
};
export type EditorCropRegion = {
height: number;
left: number;
top: number;
width: number;
};
export type EditorActionCrop = {
action: EditorActionType;
region: EditorCropRegion;
};
export type EditorActionRotate = {
action: EditorActionType;
angle: number;
};
export type EditorActionBlur = {
action: EditorActionType;
};
export type EditorActionAdjust = {
action: EditorActionType;
brightness: number;
hue: number;
lightness: number;
saturation: number;
};
export type EditorCreateAssetDto = {
/** list of edits */
edits: (EditorActionCrop | EditorActionRotate | EditorActionBlur | EditorActionAdjust)[];
/** Source asset id */
id: string;
/** Stack the edit and the original */
stack?: boolean;
};
export type PersonResponseDto = {
birthDate: string | null;
id: string;
@@ -1836,6 +1868,18 @@ export function getAssetDuplicates(opts?: Oazapfts.RequestOpts) {
...opts
}));
}
export function createAssetFromEdits({ editorCreateAssetDto }: {
editorCreateAssetDto: EditorCreateAssetDto;
}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{
status: 201;
data: AssetResponseDto;
}>("/editor", oazapfts.json({
...opts,
method: "POST",
body: editorCreateAssetDto
})));
}
export function getFaces({ id }: {
id: string;
}, opts?: Oazapfts.RequestOpts) {
@@ -3138,6 +3182,12 @@ export enum EntityType {
Asset = "ASSET",
Album = "ALBUM"
}
export enum EditorActionType {
Crop = "crop",
Rotate = "rotate",
Blur = "blur",
Adjust = "adjust"
}
export enum JobName {
ThumbnailGeneration = "thumbnailGeneration",
MetadataExtraction = "metadataExtraction",