dto refactor

add logging

handle metadata
This commit is contained in:
mertalev
2025-09-29 18:09:06 -04:00
parent 6f61bf04e4
commit 4ed92f5df5
13 changed files with 795 additions and 370 deletions

View File

@@ -9419,6 +9419,24 @@
"post": {
"operationId": "startUpload",
"parameters": [
{
"name": "content-length",
"in": "header",
"description": "Non-negative size of the request body in bytes.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "draft-upload-interop-version",
"in": "header",
"description": "Indicates the version of the RUFH protocol supported by the client.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "key",
"required": false,
@@ -9427,6 +9445,15 @@
"type": "string"
}
},
{
"name": "repr-digest",
"in": "header",
"description": "Structured dictionary containing an SHA-1 checksum used to detect duplicate files and validate data integrity.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "slug",
"required": false,
@@ -9434,6 +9461,24 @@
"schema": {
"type": "string"
}
},
{
"name": "upload-complete",
"in": "header",
"description": "Structured boolean indicating whether this request completes the file. Use Upload-Incomplete instead for version <= 3.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "x-immich-asset-data",
"in": "header",
"description": "Base64-encoded JSON of asset metadata. The expected content is the same as AssetMediaCreateDto, except that `filename` is required and `sidecarData` is ignored.",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -9514,6 +9559,15 @@
"head": {
"operationId": "getUploadStatus",
"parameters": [
{
"name": "draft-upload-interop-version",
"in": "header",
"description": "Indicates the version of the RUFH protocol supported by the client.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "id",
"required": true,
@@ -9565,6 +9619,24 @@
"patch": {
"operationId": "resumeUpload",
"parameters": [
{
"name": "content-length",
"in": "header",
"description": "Non-negative size of the request body in bytes.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "draft-upload-interop-version",
"in": "header",
"description": "Indicates the version of the RUFH protocol supported by the client.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "id",
"required": true,
@@ -9589,6 +9661,24 @@
"schema": {
"type": "string"
}
},
{
"name": "upload-complete",
"in": "header",
"description": "Structured boolean indicating whether this request completes the file. Use Upload-Incomplete instead for version <= 3.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "upload-offset",
"in": "header",
"description": "Non-negative byte offset indicating the starting position of the data in the request body within the entire file.",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {

View File

@@ -4536,16 +4536,28 @@ export function getUploadOptions({ key, slug }: {
/**
* This endpoint requires the `asset.upload` permission.
*/
export function startUpload({ key, slug }: {
export function startUpload({ contentLength, draftUploadInteropVersion, key, reprDigest, slug, uploadComplete, xImmichAssetData }: {
contentLength: string;
draftUploadInteropVersion: string;
key?: string;
reprDigest: string;
slug?: string;
uploadComplete: string;
xImmichAssetData: string;
}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchText(`/upload${QS.query(QS.explode({
key,
slug
}))}`, {
...opts,
method: "POST"
method: "POST",
headers: oazapfts.mergeHeaders(opts?.headers, {
"content-length": contentLength,
"draft-upload-interop-version": draftUploadInteropVersion,
"repr-digest": reprDigest,
"upload-complete": uploadComplete,
"x-immich-asset-data": xImmichAssetData
})
}));
}
/**
@@ -4567,7 +4579,8 @@ export function cancelUpload({ id, key, slug }: {
/**
* This endpoint requires the `asset.upload` permission.
*/
export function getUploadStatus({ id, key, slug }: {
export function getUploadStatus({ draftUploadInteropVersion, id, key, slug }: {
draftUploadInteropVersion: string;
id: string;
key?: string;
slug?: string;
@@ -4577,23 +4590,36 @@ export function getUploadStatus({ id, key, slug }: {
slug
}))}`, {
...opts,
method: "HEAD"
method: "HEAD",
headers: oazapfts.mergeHeaders(opts?.headers, {
"draft-upload-interop-version": draftUploadInteropVersion
})
}));
}
/**
* This endpoint requires the `asset.upload` permission.
*/
export function resumeUpload({ id, key, slug }: {
export function resumeUpload({ contentLength, draftUploadInteropVersion, id, key, slug, uploadComplete, uploadOffset }: {
contentLength: string;
draftUploadInteropVersion: string;
id: string;
key?: string;
slug?: string;
uploadComplete: string;
uploadOffset: string;
}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchText(`/upload/${encodeURIComponent(id)}${QS.query(QS.explode({
key,
slug
}))}`, {
...opts,
method: "PATCH"
method: "PATCH",
headers: oazapfts.mergeHeaders(opts?.headers, {
"content-length": contentLength,
"draft-upload-interop-version": draftUploadInteropVersion,
"upload-complete": uploadComplete,
"upload-offset": uploadOffset
})
}));
}
/**