diff --git a/mobile/openapi/lib/api/upload_api.dart b/mobile/openapi/lib/api/upload_api.dart index 858efb6e29..e6b68f38b2 100644 --- a/mobile/openapi/lib/api/upload_api.dart +++ b/mobile/openapi/lib/api/upload_api.dart @@ -286,19 +286,19 @@ class UploadApi { /// * [String] reprDigest (required): /// RFC 9651 structured dictionary containing an `sha` (bytesequence) checksum used to detect duplicate files and validate data integrity. /// - /// * [String] uploadComplete (required): - /// Structured boolean indicating whether this request completes the file. Use Upload-Incomplete instead for version <= 3. - /// - /// * [String] uploadDraftInteropVersion (required): - /// Indicates the version of the RUFH protocol supported by the client. - /// /// * [String] xImmichAssetData (required): /// RFC 9651 structured dictionary containing asset metadata with the following keys: - device-asset-id (string, required): Unique device asset identifier - device-id (string, required): Device identifier - file-created-at (string/date, required): ISO 8601 date string or Unix timestamp - file-modified-at (string/date, required): ISO 8601 date string or Unix timestamp - filename (string, required): Original filename - is-favorite (boolean, optional): Favorite status - live-photo-video-id (string, optional): Live photo ID for assets from iOS devices - icloud-id (string, optional): iCloud identifier for assets from iOS devices /// /// * [String] key: /// /// * [String] slug: - Future startUploadWithHttpInfo(String contentLength, String reprDigest, String uploadComplete, String uploadDraftInteropVersion, String xImmichAssetData, { String? key, String? slug, }) async { + /// + /// * [String] uploadComplete: + /// Structured boolean indicating whether this request completes the file. Use Upload-Incomplete instead for version <= 3. + /// + /// * [String] uploadDraftInteropVersion: + /// Indicates the version of the RUFH protocol supported by the client. + Future startUploadWithHttpInfo(String contentLength, String reprDigest, String xImmichAssetData, { String? key, String? slug, String? uploadComplete, String? uploadDraftInteropVersion, }) async { // ignore: prefer_const_declarations final apiPath = r'/upload'; @@ -318,8 +318,12 @@ class UploadApi { headerParams[r'content-length'] = parameterToString(contentLength); headerParams[r'repr-digest'] = parameterToString(reprDigest); - headerParams[r'upload-complete'] = parameterToString(uploadComplete); - headerParams[r'upload-draft-interop-version'] = parameterToString(uploadDraftInteropVersion); + if (uploadComplete != null) { + headerParams[r'upload-complete'] = parameterToString(uploadComplete); + } + if (uploadDraftInteropVersion != null) { + headerParams[r'upload-draft-interop-version'] = parameterToString(uploadDraftInteropVersion); + } headerParams[r'x-immich-asset-data'] = parameterToString(xImmichAssetData); const contentTypes = []; @@ -346,20 +350,20 @@ class UploadApi { /// * [String] reprDigest (required): /// RFC 9651 structured dictionary containing an `sha` (bytesequence) checksum used to detect duplicate files and validate data integrity. /// - /// * [String] uploadComplete (required): - /// Structured boolean indicating whether this request completes the file. Use Upload-Incomplete instead for version <= 3. - /// - /// * [String] uploadDraftInteropVersion (required): - /// Indicates the version of the RUFH protocol supported by the client. - /// /// * [String] xImmichAssetData (required): /// RFC 9651 structured dictionary containing asset metadata with the following keys: - device-asset-id (string, required): Unique device asset identifier - device-id (string, required): Device identifier - file-created-at (string/date, required): ISO 8601 date string or Unix timestamp - file-modified-at (string/date, required): ISO 8601 date string or Unix timestamp - filename (string, required): Original filename - is-favorite (boolean, optional): Favorite status - live-photo-video-id (string, optional): Live photo ID for assets from iOS devices - icloud-id (string, optional): iCloud identifier for assets from iOS devices /// /// * [String] key: /// /// * [String] slug: - Future startUpload(String contentLength, String reprDigest, String uploadComplete, String uploadDraftInteropVersion, String xImmichAssetData, { String? key, String? slug, }) async { - final response = await startUploadWithHttpInfo(contentLength, reprDigest, uploadComplete, uploadDraftInteropVersion, xImmichAssetData, key: key, slug: slug, ); + /// + /// * [String] uploadComplete: + /// Structured boolean indicating whether this request completes the file. Use Upload-Incomplete instead for version <= 3. + /// + /// * [String] uploadDraftInteropVersion: + /// Indicates the version of the RUFH protocol supported by the client. + Future startUpload(String contentLength, String reprDigest, String xImmichAssetData, { String? key, String? slug, String? uploadComplete, String? uploadDraftInteropVersion, }) async { + final response = await startUploadWithHttpInfo(contentLength, reprDigest, xImmichAssetData, key: key, slug: slug, uploadComplete: uploadComplete, uploadDraftInteropVersion: uploadDraftInteropVersion, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.json index 231f106a3a..5fe7c1222f 100644 --- a/open-api/immich-openapi-specs.json +++ b/open-api/immich-openapi-specs.json @@ -9427,7 +9427,7 @@ "name": "upload-complete", "in": "header", "description": "Structured boolean indicating whether this request completes the file. Use Upload-Incomplete instead for version <= 3.", - "required": true, + "required": false, "schema": { "type": "string" } @@ -9436,7 +9436,7 @@ "name": "upload-draft-interop-version", "in": "header", "description": "Indicates the version of the RUFH protocol supported by the client.", - "required": true, + "required": false, "schema": { "type": "string" } diff --git a/open-api/typescript-sdk/src/fetch-client.ts b/open-api/typescript-sdk/src/fetch-client.ts index 317ef389fe..d3f133ec8d 100644 --- a/open-api/typescript-sdk/src/fetch-client.ts +++ b/open-api/typescript-sdk/src/fetch-client.ts @@ -4540,8 +4540,8 @@ export function startUpload({ contentLength, key, reprDigest, slug, uploadComple key?: string; reprDigest: string; slug?: string; - uploadComplete: string; - uploadDraftInteropVersion: string; + uploadComplete?: string; + uploadDraftInteropVersion?: string; xImmichAssetData: string; }, opts?: Oazapfts.RequestOpts) { return oazapfts.ok(oazapfts.fetchJson<{ diff --git a/server/src/controllers/asset-upload.controller.ts b/server/src/controllers/asset-upload.controller.ts index e1de5f83fe..258215ad37 100644 --- a/server/src/controllers/asset-upload.controller.ts +++ b/server/src/controllers/asset-upload.controller.ts @@ -59,8 +59,8 @@ export class AssetUploadController { 'RFC 9651 structured dictionary containing an `sha` (bytesequence) checksum used to detect duplicate files and validate data integrity.', required: true, }) - @ApiHeader(apiInteropVersion) - @ApiHeader(apiUploadComplete) + @ApiHeader({ ...apiInteropVersion, required: false }) + @ApiHeader({ ...apiUploadComplete, required: false }) @ApiHeader(apiContentLength) @ApiOkResponse({ type: UploadOkDto }) startUpload(@Auth() auth: AuthDto, @Req() req: Request, @Res() res: Response): Promise {