dto refactor

add logging

handle metadata
This commit is contained in:
mertalev 2025-09-29 18:09:06 -04:00
parent 6f61bf04e4
commit 4ed92f5df5
No known key found for this signature in database
GPG key ID: DF6ABC77AAD98C95
13 changed files with 795 additions and 370 deletions

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
})
}));
}
/**