High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
chore(server): openapi generation (#9585)
Alex1ad04f0b179d
diff --git a/mobile/openapi/.openapi-generator/FILES b/mobile/openapi/.openapi-generator/FILESindex ae72e70d5b..69172bd977 100644--- a/mobile/openapi/.openapi-generator/FILES+++ b/mobile/openapi/.openapi-generator/FILES@@ -70,6 +70,7 @@ doc/DownloadInfoDto.mddoc/DownloadResponseDto.mddoc/DuplicateApi.mddoc/DuplicateDetectionConfig.md+doc/DuplicateResponseDto.mddoc/EntityType.mddoc/ExifResponseDto.mddoc/FaceApi.md@@ -312,6 +313,7 @@ lib/model/download_archive_info.dartlib/model/download_info_dto.dartlib/model/download_response_dto.dartlib/model/duplicate_detection_config.dart+lib/model/duplicate_response_dto.dartlib/model/entity_type.dartlib/model/exif_response_dto.dartlib/model/face_dto.dart@@ -507,6 +509,7 @@ test/download_info_dto_test.darttest/download_response_dto_test.darttest/duplicate_api_test.darttest/duplicate_detection_config_test.dart+test/duplicate_response_dto_test.darttest/entity_type_test.darttest/exif_response_dto_test.darttest/face_api_test.dartdiff --git a/mobile/openapi/README.md b/mobile/openapi/README.mdindex 3cce4635cc..048d5b00a0 100644--- a/mobile/openapi/README.md+++ b/mobile/openapi/README.md@@ -284,6 +284,7 @@ Class | Method | HTTP request | Description- [DownloadInfoDto](doc//DownloadInfoDto.md)- [DownloadResponseDto](doc//DownloadResponseDto.md)- [DuplicateDetectionConfig](doc//DuplicateDetectionConfig.md)+ - [DuplicateResponseDto](doc//DuplicateResponseDto.md)- [EntityType](doc//EntityType.md)- [ExifResponseDto](doc//ExifResponseDto.md)- [FaceDto](doc//FaceDto.md)diff --git a/mobile/openapi/doc/AssetResponseDto.md b/mobile/openapi/doc/AssetResponseDto.mdindex 98290b3745..41a628bd54 100644--- a/mobile/openapi/doc/AssetResponseDto.md+++ b/mobile/openapi/doc/AssetResponseDto.md@@ -11,6 +11,7 @@ Name | Type | Description | Notes**checksum** | **String** | base64 encoded sha1 hash |**deviceAssetId** | **String** | |**deviceId** | **String** | |+**duplicateId** | **String** | | [optional]**duration** | **String** | |**exifInfo** | [**ExifResponseDto**](ExifResponseDto.md) | | [optional]**fileCreatedAt** | [**DateTime**](DateTime.md) | |diff --git a/mobile/openapi/doc/DuplicateApi.md b/mobile/openapi/doc/DuplicateApi.mdindex 4dfbe55d3d..cdf279b69a 100644--- a/mobile/openapi/doc/DuplicateApi.md+++ b/mobile/openapi/doc/DuplicateApi.md@@ -13,7 +13,7 @@ Method | HTTP request | Description# **getAssetDuplicates**-> List<AssetResponseDto> getAssetDuplicates()+> List<DuplicateResponseDto> getAssetDuplicates()@@ -50,7 +50,7 @@ This endpoint does not need any parameter.### Return type-[**List<AssetResponseDto>**](AssetResponseDto.md)+[**List<DuplicateResponseDto>**](DuplicateResponseDto.md)### Authorizationdiff --git a/mobile/openapi/doc/DuplicateResponseDto.md b/mobile/openapi/doc/DuplicateResponseDto.mdnew file mode 100644index 0000000000..f982569996--- /dev/null+++ b/mobile/openapi/doc/DuplicateResponseDto.md@@ -0,0 +1,16 @@+# openapi.model.DuplicateResponseDto++## Load the model package+```dart+import 'package:openapi/api.dart';+```++## Properties+Name | Type | Description | Notes+------------ | ------------- | ------------- | -------------+**assets** | [**List<AssetResponseDto>**](AssetResponseDto.md) | | [default to const []]+**duplicateId** | **String** | |++[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)++diff --git a/mobile/openapi/lib/api.dart b/mobile/openapi/lib/api.dartindex 69be2f8a95..110c4f757e 100644--- a/mobile/openapi/lib/api.dart+++ b/mobile/openapi/lib/api.dart@@ -116,6 +116,7 @@ part 'model/download_archive_info.dart';part 'model/download_info_dto.dart';part 'model/download_response_dto.dart';part 'model/duplicate_detection_config.dart';+part 'model/duplicate_response_dto.dart';part 'model/entity_type.dart';part 'model/exif_response_dto.dart';part 'model/face_dto.dart';diff --git a/mobile/openapi/lib/api/duplicate_api.dart b/mobile/openapi/lib/api/duplicate_api.dartindex 2833d091e9..ef71108b86 100644--- a/mobile/openapi/lib/api/duplicate_api.dart+++ b/mobile/openapi/lib/api/duplicate_api.dart@@ -42,7 +42,7 @@ class DuplicateApi {);}- Future<List<AssetResponseDto>?> getAssetDuplicates() async {+ Future<List<DuplicateResponseDto>?> getAssetDuplicates() async {final response = await getAssetDuplicatesWithHttpInfo();if (response.statusCode >= HttpStatus.badRequest) {throw ApiException(response.statusCode, await _decodeBodyBytes(response));@@ -52,8 +52,8 @@ class DuplicateApi {// FormatException when trying to decode an empty string.if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {final responseBody = await _decodeBodyBytes(response);- return (await apiClient.deserializeAsync(responseBody, 'List<AssetResponseDto>') as List)- .cast<AssetResponseDto>()+ return (await apiClient.deserializeAsync(responseBody, 'List<DuplicateResponseDto>') as List)+ .cast<DuplicateResponseDto>().toList(growable: false);}diff --git a/mobile/openapi/lib/api_client.dart b/mobile/openapi/lib/api_client.dartindex 537d63db33..6256d0c487 100644--- a/mobile/openapi/lib/api_client.dart+++ b/mobile/openapi/lib/api_client.dart@@ -300,6 +300,8 @@ class ApiClient {return DownloadResponseDto.fromJson(value);case 'DuplicateDetectionConfig':return DuplicateDetectionConfig.fromJson(value);+ case 'DuplicateResponseDto':+ return DuplicateResponseDto.fromJson(value);case 'EntityType':return EntityTypeTypeTransformer().decode(value);case 'ExifResponseDto':diff --git a/mobile/openapi/lib/model/asset_response_dto.dart b/mobile/openapi/lib/model/asset_response_dto.dartindex 86dec6392f..8802bb03ab 100644--- a/mobile/openapi/lib/model/asset_response_dto.dart+++ b/mobile/openapi/lib/model/asset_response_dto.dart@@ -16,6 +16,7 @@ class AssetResponseDto {required this.checksum,required this.deviceAssetId,required this.deviceId,+ this.duplicateId,required this.duration,this.exifInfo,required this.fileCreatedAt,@@ -54,6 +55,8 @@ class AssetResponseDto {String deviceId;+ String? duplicateId;+String duration;///@@ -149,6 +152,7 @@ class AssetResponseDto {other.checksum == checksum &&other.deviceAssetId == deviceAssetId &&other.deviceId == deviceId &&+ other.duplicateId == duplicateId &&other.duration == duration &&other.exifInfo == exifInfo &&other.fileCreatedAt == fileCreatedAt &&@@ -185,6 +189,7 @@ class AssetResponseDto {(checksum.hashCode) +(deviceAssetId.hashCode) +(deviceId.hashCode) ++ (duplicateId == null ? 0 : duplicateId!.hashCode) +(duration.hashCode) +(exifInfo == null ? 0 : exifInfo!.hashCode) +(fileCreatedAt.hashCode) +@@ -216,13 +221,18 @@ class AssetResponseDto {(updatedAt.hashCode);@override- String toString() => 'AssetResponseDto[checksum=$checksum, deviceAssetId=$deviceAssetId, deviceId=$deviceId, duration=$duration, exifInfo=$exifInfo, fileCreatedAt=$fileCreatedAt, fileModifiedAt=$fileModifiedAt, hasMetadata=$hasMetadata, id=$id, isArchived=$isArchived, isExternal=$isExternal, isFavorite=$isFavorite, isOffline=$isOffline, isReadOnly=$isReadOnly, isTrashed=$isTrashed, libraryId=$libraryId, livePhotoVideoId=$livePhotoVideoId, localDateTime=$localDateTime, originalFileName=$originalFileName, originalPath=$originalPath, owner=$owner, ownerId=$ownerId, people=$people, resized=$resized, smartInfo=$smartInfo, stack=$stack, stackCount=$stackCount, stackParentId=$stackParentId, tags=$tags, thumbhash=$thumbhash, type=$type, updatedAt=$updatedAt]';+ String toString() => 'AssetResponseDto[checksum=$checksum, deviceAssetId=$deviceAssetId, deviceId=$deviceId, duplicateId=$duplicateId, duration=$duration, exifInfo=$exifInfo, fileCreatedAt=$fileCreatedAt, fileModifiedAt=$fileModifiedAt, hasMetadata=$hasMetadata, id=$id, isArchived=$isArchived, isExternal=$isExternal, isFavorite=$isFavorite, isOffline=$isOffline, isReadOnly=$isReadOnly, isTrashed=$isTrashed, libraryId=$libraryId, livePhotoVideoId=$livePhotoVideoId, localDateTime=$localDateTime, originalFileName=$originalFileName, originalPath=$originalPath, owner=$owner, ownerId=$ownerId, people=$people, resized=$resized, smartInfo=$smartInfo, stack=$stack, stackCount=$stackCount, stackParentId=$stackParentId, tags=$tags, thumbhash=$thumbhash, type=$type, updatedAt=$updatedAt]';Map<String, dynamic> toJson() {final json = <String, dynamic>{};json[r'checksum'] = this.checksum;json[r'deviceAssetId'] = this.deviceAssetId;json[r'deviceId'] = this.deviceId;+ if (this.duplicateId != null) {+ json[r'duplicateId'] = this.duplicateId;+ } else {+ // json[r'duplicateId'] = null;+ }json[r'duration'] = this.duration;if (this.exifInfo != null) {json[r'exifInfo'] = this.exifInfo;@@ -302,6 +312,7 @@ class AssetResponseDto {checksum: mapValueOfType<String>(json, r'checksum')!,deviceAssetId: mapValueOfType<String>(json, r'deviceAssetId')!,deviceId: mapValueOfType<String>(json, r'deviceId')!,+ duplicateId: mapValueOfType<String>(json, r'duplicateId'),duration: mapValueOfType<String>(json, r'duration')!,exifInfo: ExifResponseDto.fromJson(json[r'exifInfo']),fileCreatedAt: mapDateTime(json, r'fileCreatedAt', r'')!,diff --git a/mobile/openapi/lib/model/duplicate_response_dto.dart b/mobile/openapi/lib/model/duplicate_response_dto.dartnew file mode 100644index 0000000000..b93ecfe5f5--- /dev/null+++ b/mobile/openapi/lib/model/duplicate_response_dto.dart@@ -0,0 +1,106 @@+//+// AUTO-GENERATED FILE, DO NOT MODIFY!+//+// @dart=2.18++// ignore_for_file: unused_element, unused_import+// ignore_for_file: always_put_required_named_parameters_first+// ignore_for_file: constant_identifier_names+// ignore_for_file: lines_longer_than_80_chars++part of openapi.api;++class DuplicateResponseDto {+ /// Returns a new [DuplicateResponseDto] instance.+ DuplicateResponseDto({+ this.assets = const [],+ required this.duplicateId,+ });++ List<AssetResponseDto> assets;++ String duplicateId;++ @override+ bool operator ==(Object other) => identical(this, other) || other is DuplicateResponseDto &&+ _deepEquality.equals(other.assets, assets) &&+ other.duplicateId == duplicateId;++ @override+ int get hashCode =>+ // ignore: unnecessary_parenthesis+ (assets.hashCode) ++ (duplicateId.hashCode);++ @override+ String toString() => 'DuplicateResponseDto[assets=$assets, duplicateId=$duplicateId]';++ Map<String, dynamic> toJson() {+ final json = <String, dynamic>{};+ json[r'assets'] = this.assets;+ json[r'duplicateId'] = this.duplicateId;+ return json;+ }++ /// Returns a new [DuplicateResponseDto] instance and imports its values from+ /// [value] if it's a [Map], null otherwise.+ // ignore: prefer_constructors_over_static_methods+ static DuplicateResponseDto? fromJson(dynamic value) {+ if (value is Map) {+ final json = value.cast<String, dynamic>();++ return DuplicateResponseDto(+ assets: AssetResponseDto.listFromJson(json[r'assets']),+ duplicateId: mapValueOfType<String>(json, r'duplicateId')!,+ );+ }+ return null;+ }++ static List<DuplicateResponseDto> listFromJson(dynamic json, {bool growable = false,}) {+ final result = <DuplicateResponseDto>[];+ if (json is List && json.isNotEmpty) {+ for (final row in json) {+ final value = DuplicateResponseDto.fromJson(row);+ if (value != null) {+ result.add(value);+ }+ }+ }+ return result.toList(growable: growable);+ }++ static Map<String, DuplicateResponseDto> mapFromJson(dynamic json) {+ final map = <String, DuplicateResponseDto>{};+ if (json is Map && json.isNotEmpty) {+ json = json.cast<String, dynamic>(); // ignore: parameter_assignments+ for (final entry in json.entries) {+ final value = DuplicateResponseDto.fromJson(entry.value);+ if (value != null) {+ map[entry.key] = value;+ }+ }+ }+ return map;+ }++ // maps a json object with a list of DuplicateResponseDto-objects as value to a dart map+ static Map<String, List<DuplicateResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {+ final map = <String, List<DuplicateResponseDto>>{};+ if (json is Map && json.isNotEmpty) {+ // ignore: parameter_assignments+ json = json.cast<String, dynamic>();+ for (final entry in json.entries) {+ map[entry.key] = DuplicateResponseDto.listFromJson(entry.value, growable: growable,);+ }+ }+ return map;+ }++ /// The list of required keys that must be present in a JSON.+ static const requiredKeys = <String>{+ 'assets',+ 'duplicateId',+ };+}+diff --git a/mobile/openapi/test/asset_response_dto_test.dart b/mobile/openapi/test/asset_response_dto_test.dartindex 6e927e6014..e666a3bb7e 100644--- a/mobile/openapi/test/asset_response_dto_test.dart+++ b/mobile/openapi/test/asset_response_dto_test.dart@@ -32,6 +32,11 @@ void main() {// TODO});+ // String duplicateId+ test('to test the property `duplicateId`', () async {+ // TODO+ });+// String durationtest('to test the property `duration`', () async {// TODOdiff --git a/mobile/openapi/test/duplicate_api_test.dart b/mobile/openapi/test/duplicate_api_test.dartindex 8e22a52533..50a090bc3b 100644--- a/mobile/openapi/test/duplicate_api_test.dart+++ b/mobile/openapi/test/duplicate_api_test.dart@@ -17,7 +17,7 @@ void main() {// final instance = DuplicateApi();group('tests for DuplicateApi', () {- //Future<List<AssetResponseDto>> getAssetDuplicates() async+ //Future<List<DuplicateResponseDto>> getAssetDuplicates() asynctest('test getAssetDuplicates', () async {// TODO});diff --git a/mobile/openapi/test/duplicate_response_dto_test.dart b/mobile/openapi/test/duplicate_response_dto_test.dartnew file mode 100644index 0000000000..a531c133cc--- /dev/null+++ b/mobile/openapi/test/duplicate_response_dto_test.dart@@ -0,0 +1,32 @@+//+// AUTO-GENERATED FILE, DO NOT MODIFY!+//+// @dart=2.18++// ignore_for_file: unused_element, unused_import+// ignore_for_file: always_put_required_named_parameters_first+// ignore_for_file: constant_identifier_names+// ignore_for_file: lines_longer_than_80_chars++import 'package:openapi/api.dart';+import 'package:test/test.dart';++// tests for DuplicateResponseDto+void main() {+ // final instance = DuplicateResponseDto();++ group('test DuplicateResponseDto', () {+ // List<AssetResponseDto> assets (default value: const [])+ test('to test the property `assets`', () async {+ // TODO+ });++ // String duplicateId+ test('to test the property `duplicateId`', () async {+ // TODO+ });+++ });++}diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.jsonindex 7fbf5f8302..8fc5378edf 100644--- a/open-api/immich-openapi-specs.json+++ b/open-api/immich-openapi-specs.json@@ -2231,7 +2231,7 @@"application/json": {"schema": {"items": {- "$ref": "#/components/schemas/AssetResponseDto"+ "$ref": "#/components/schemas/DuplicateResponseDto"},"type": "array"}@@ -7318,6 +7318,10 @@"deviceId": {"type": "string"},+ "duplicateId": {+ "nullable": true,+ "type": "string"+ },"duration": {"type": "string"},@@ -7930,6 +7934,24 @@],"type": "object"},+ "DuplicateResponseDto": {+ "properties": {+ "assets": {+ "items": {+ "$ref": "#/components/schemas/AssetResponseDto"+ },+ "type": "array"+ },+ "duplicateId": {+ "type": "string"+ }+ },+ "required": [+ "assets",+ "duplicateId"+ ],+ "type": "object"+ },"EntityType": {"enum": ["ASSET",diff --git a/open-api/typescript-sdk/src/fetch-client.ts b/open-api/typescript-sdk/src/fetch-client.tsindex 92396c360f..f0af90a8dd 100644--- a/open-api/typescript-sdk/src/fetch-client.ts+++ b/open-api/typescript-sdk/src/fetch-client.ts@@ -115,6 +115,7 @@ export type AssetResponseDto = {checksum: string;deviceAssetId: string;deviceId: string;+ duplicateId?: string | null;duration: string;exifInfo?: ExifResponseDto;fileCreatedAt: string;@@ -372,6 +373,10 @@ export type DownloadResponseDto = {archives: DownloadArchiveInfo[];totalSize: number;};+export type DuplicateResponseDto = {+ assets: AssetResponseDto[];+ duplicateId: string;+};export type PersonResponseDto = {birthDate: string | null;id: string;@@ -1698,7 +1703,7 @@ export function getDownloadInfo({ key, downloadInfoDto }: {export function getAssetDuplicates(opts?: Oazapfts.RequestOpts) {return oazapfts.ok(oazapfts.fetchJson<{status: 200;- data: AssetResponseDto[];+ data: DuplicateResponseDto[];}>("/duplicates", {...opts}));