High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
chore: deprecate (#21791)
Jason Rasmussen7e377d3e424f
diff --git a/mobile/openapi/README.md b/mobile/openapi/README.mdindex 6cd26aefc4..339ae6ff5d 100644--- a/mobile/openapi/README.md+++ b/mobile/openapi/README.md@@ -107,7 +107,7 @@ Class | Method | HTTP request | Description*AssetsApi* | [**getAssetStatistics**](doc//AssetsApi.md#getassetstatistics) | **GET** /assets/statistics |*AssetsApi* | [**getRandom**](doc//AssetsApi.md#getrandom) | **GET** /assets/random |*AssetsApi* | [**playAssetVideo**](doc//AssetsApi.md#playassetvideo) | **GET** /assets/{id}/video/playback |-*AssetsApi* | [**replaceAsset**](doc//AssetsApi.md#replaceasset) | **PUT** /assets/{id}/original | replaceAsset+*AssetsApi* | [**replaceAsset**](doc//AssetsApi.md#replaceasset) | **PUT** /assets/{id}/original | Replace the asset with new file, without changing its id*AssetsApi* | [**runAssetJobs**](doc//AssetsApi.md#runassetjobs) | **POST** /assets/jobs |*AssetsApi* | [**updateAsset**](doc//AssetsApi.md#updateasset) | **PUT** /assets/{id} |*AssetsApi* | [**updateAssetMetadata**](doc//AssetsApi.md#updateassetmetadata) | **PUT** /assets/{id}/metadata |@@ -128,6 +128,7 @@ Class | Method | HTTP request | Description*AuthenticationApi* | [**validateAccessToken**](doc//AuthenticationApi.md#validateaccesstoken) | **POST** /auth/validateToken |*DeprecatedApi* | [**createPartnerDeprecated**](doc//DeprecatedApi.md#createpartnerdeprecated) | **POST** /partners/{id} |*DeprecatedApi* | [**getRandom**](doc//DeprecatedApi.md#getrandom) | **GET** /assets/random |+*DeprecatedApi* | [**replaceAsset**](doc//DeprecatedApi.md#replaceasset) | **PUT** /assets/{id}/original | Replace the asset with new file, without changing its id*DownloadApi* | [**downloadArchive**](doc//DownloadApi.md#downloadarchive) | **POST** /download/archive |*DownloadApi* | [**getDownloadInfo**](doc//DownloadApi.md#getdownloadinfo) | **POST** /download/info |*DuplicatesApi* | [**deleteDuplicate**](doc//DuplicatesApi.md#deleteduplicate) | **DELETE** /duplicates/{id} |diff --git a/mobile/openapi/lib/api/assets_api.dart b/mobile/openapi/lib/api/assets_api.dartindex e16ac2f535..063f9ea43b 100644--- a/mobile/openapi/lib/api/assets_api.dart+++ b/mobile/openapi/lib/api/assets_api.dart@@ -729,9 +729,9 @@ class AssetsApi {return null;}- /// replaceAsset+ /// Replace the asset with new file, without changing its id///- /// Replace the asset with new file, without changing its id. This endpoint requires the `asset.replace` permission.+ /// This property was deprecated in v1.142.0. Replace the asset with new file, without changing its id. This endpoint requires the `asset.replace` permission.////// Note: This method returns the HTTP [Response].///@@ -823,9 +823,9 @@ class AssetsApi {);}- /// replaceAsset+ /// Replace the asset with new file, without changing its id///- /// Replace the asset with new file, without changing its id. This endpoint requires the `asset.replace` permission.+ /// This property was deprecated in v1.142.0. Replace the asset with new file, without changing its id. This endpoint requires the `asset.replace` permission.////// Parameters:///diff --git a/mobile/openapi/lib/api/deprecated_api.dart b/mobile/openapi/lib/api/deprecated_api.dartindex cdcd27750d..9246998ca2 100644--- a/mobile/openapi/lib/api/deprecated_api.dart+++ b/mobile/openapi/lib/api/deprecated_api.dart@@ -127,4 +127,138 @@ class DeprecatedApi {}return null;}++ /// Replace the asset with new file, without changing its id+ ///+ /// This property was deprecated in v1.142.0. Replace the asset with new file, without changing its id. This endpoint requires the `asset.replace` permission.+ ///+ /// Note: This method returns the HTTP [Response].+ ///+ /// Parameters:+ ///+ /// * [String] id (required):+ ///+ /// * [MultipartFile] assetData (required):+ ///+ /// * [String] deviceAssetId (required):+ ///+ /// * [String] deviceId (required):+ ///+ /// * [DateTime] fileCreatedAt (required):+ ///+ /// * [DateTime] fileModifiedAt (required):+ ///+ /// * [String] key:+ ///+ /// * [String] slug:+ ///+ /// * [String] duration:+ ///+ /// * [String] filename:+ Future<Response> replaceAssetWithHttpInfo(String id, MultipartFile assetData, String deviceAssetId, String deviceId, DateTime fileCreatedAt, DateTime fileModifiedAt, { String? key, String? slug, String? duration, String? filename, }) async {+ // ignore: prefer_const_declarations+ final apiPath = r'/assets/{id}/original'+ .replaceAll('{id}', id);++ // ignore: prefer_final_locals+ Object? postBody;++ final queryParams = <QueryParam>[];+ final headerParams = <String, String>{};+ final formParams = <String, String>{};++ if (key != null) {+ queryParams.addAll(_queryParams('', 'key', key));+ }+ if (slug != null) {+ queryParams.addAll(_queryParams('', 'slug', slug));+ }++ const contentTypes = <String>['multipart/form-data'];++ bool hasFields = false;+ final mp = MultipartRequest('PUT', Uri.parse(apiPath));+ if (assetData != null) {+ hasFields = true;+ mp.fields[r'assetData'] = assetData.field;+ mp.files.add(assetData);+ }+ if (deviceAssetId != null) {+ hasFields = true;+ mp.fields[r'deviceAssetId'] = parameterToString(deviceAssetId);+ }+ if (deviceId != null) {+ hasFields = true;+ mp.fields[r'deviceId'] = parameterToString(deviceId);+ }+ if (duration != null) {+ hasFields = true;+ mp.fields[r'duration'] = parameterToString(duration);+ }+ if (fileCreatedAt != null) {+ hasFields = true;+ mp.fields[r'fileCreatedAt'] = parameterToString(fileCreatedAt);+ }+ if (fileModifiedAt != null) {+ hasFields = true;+ mp.fields[r'fileModifiedAt'] = parameterToString(fileModifiedAt);+ }+ if (filename != null) {+ hasFields = true;+ mp.fields[r'filename'] = parameterToString(filename);+ }+ if (hasFields) {+ postBody = mp;+ }++ return apiClient.invokeAPI(+ apiPath,+ 'PUT',+ queryParams,+ postBody,+ headerParams,+ formParams,+ contentTypes.isEmpty ? null : contentTypes.first,+ );+ }++ /// Replace the asset with new file, without changing its id+ ///+ /// This property was deprecated in v1.142.0. Replace the asset with new file, without changing its id. This endpoint requires the `asset.replace` permission.+ ///+ /// Parameters:+ ///+ /// * [String] id (required):+ ///+ /// * [MultipartFile] assetData (required):+ ///+ /// * [String] deviceAssetId (required):+ ///+ /// * [String] deviceId (required):+ ///+ /// * [DateTime] fileCreatedAt (required):+ ///+ /// * [DateTime] fileModifiedAt (required):+ ///+ /// * [String] key:+ ///+ /// * [String] slug:+ ///+ /// * [String] duration:+ ///+ /// * [String] filename:+ Future<AssetMediaResponseDto?> replaceAsset(String id, MultipartFile assetData, String deviceAssetId, String deviceId, DateTime fileCreatedAt, DateTime fileModifiedAt, { String? key, String? slug, String? duration, String? filename, }) async {+ final response = await replaceAssetWithHttpInfo(id, assetData, deviceAssetId, deviceId, fileCreatedAt, fileModifiedAt, key: key, slug: slug, duration: duration, filename: filename, );+ if (response.statusCode >= HttpStatus.badRequest) {+ throw ApiException(response.statusCode, await _decodeBodyBytes(response));+ }+ // When a remote server returns no body with a status of 204, we shall not decode it.+ // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"+ // FormatException when trying to decode an empty string.+ if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {+ return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetMediaResponseDto',) as AssetMediaResponseDto;++ }+ return null;+ }}diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.jsonindex 5a847fc830..7caf215042 100644--- a/open-api/immich-openapi-specs.json+++ b/open-api/immich-openapi-specs.json@@ -2504,7 +2504,8 @@"description": "This endpoint requires the `asset.download` permission."},"put": {- "description": "Replace the asset with new file, without changing its id. This endpoint requires the `asset.replace` permission.",+ "deprecated": true,+ "description": "This property was deprecated in v1.142.0. Replace the asset with new file, without changing its id. This endpoint requires the `asset.replace` permission.","operationId": "replaceAsset","parameters": [{@@ -2566,12 +2567,14 @@"api_key": []}],- "summary": "replaceAsset",+ "summary": "Replace the asset with new file, without changing its id","tags": [- "Assets"+ "Assets",+ "Deprecated"],"x-immich-lifecycle": {- "addedAt": "v1.106.0"+ "addedAt": "v1.106.0",+ "deprecatedAt": "v1.142.0"},"x-immich-permission": "asset.replace"}diff --git a/open-api/typescript-sdk/src/fetch-client.ts b/open-api/typescript-sdk/src/fetch-client.tsindex 18f70f9ab8..bc38a69079 100644--- a/open-api/typescript-sdk/src/fetch-client.ts+++ b/open-api/typescript-sdk/src/fetch-client.ts@@ -2368,7 +2368,7 @@ export function downloadAsset({ id, key, slug }: {}));}/**- * replaceAsset+ * Replace the asset with new file, without changing its id*/export function replaceAsset({ id, key, slug, assetMediaReplaceDto }: {id: string;diff --git a/server/src/controllers/asset-media.controller.ts b/server/src/controllers/asset-media.controller.tsindex 171cfe7047..688e513b64 100644--- a/server/src/controllers/asset-media.controller.ts+++ b/server/src/controllers/asset-media.controller.ts@@ -96,8 +96,9 @@ export class AssetMediaController {@Put(':id/original')@UseInterceptors(FileUploadInterceptor)@ApiConsumes('multipart/form-data')- @EndpointLifecycle({ addedAt: 'v1.106.0' })- @ApiOperation({+ @EndpointLifecycle({+ addedAt: 'v1.106.0',+ deprecatedAt: 'v1.142.0',summary: 'replaceAsset',description: 'Replace the asset with new file, without changing its id',})diff --git a/server/src/decorators.ts b/server/src/decorators.tsindex b88f2d2d7e..2f1e76d097 100644--- a/server/src/decorators.ts+++ b/server/src/decorators.ts@@ -1,5 +1,5 @@import { SetMetadata, applyDecorators } from '@nestjs/common';-import { ApiExtension, ApiOperation, ApiProperty, ApiTags } from '@nestjs/swagger';+import { ApiExtension, ApiOperation, ApiOperationOptions, ApiProperty, ApiTags } from '@nestjs/swagger';import _ from 'lodash';import { ADDED_IN_PREFIX, DEPRECATED_IN_PREFIX, LIFECYCLE_EXTENSION } from 'src/constants';import { ImmichWorker, JobName, MetadataKey, QueueName } from 'src/enum';@@ -159,12 +159,21 @@ type LifecycleMetadata = {deprecatedAt?: LifecycleRelease;};-export const EndpointLifecycle = ({ addedAt, deprecatedAt }: LifecycleMetadata) => {+export const EndpointLifecycle = ({+ addedAt,+ deprecatedAt,+ description,+ ...options+}: LifecycleMetadata & ApiOperationOptions) => {const decorators: MethodDecorator[] = [ApiExtension(LIFECYCLE_EXTENSION, { addedAt, deprecatedAt })];if (deprecatedAt) {decorators.push(ApiTags('Deprecated'),- ApiOperation({ deprecated: true, description: DEPRECATED_IN_PREFIX + deprecatedAt }),+ ApiOperation({+ deprecated: true,+ description: DEPRECATED_IN_PREFIX + deprecatedAt + (description ? `. ${description}` : ''),+ ...options,+ }),);}