High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
chore(server): openapi generation for Duplicate controller (#9560)
Alex2689178a355f
diff --git a/mobile/openapi/.openapi-generator/FILES b/mobile/openapi/.openapi-generator/FILESindex 222e6c1111..ae72e70d5b 100644--- a/mobile/openapi/.openapi-generator/FILES+++ b/mobile/openapi/.openapi-generator/FILES@@ -68,6 +68,7 @@ doc/DownloadApi.mddoc/DownloadArchiveInfo.mddoc/DownloadInfoDto.mddoc/DownloadResponseDto.md+doc/DuplicateApi.mddoc/DuplicateDetectionConfig.mddoc/EntityType.mddoc/ExifResponseDto.md@@ -224,6 +225,7 @@ lib/api/asset_api.dartlib/api/audit_api.dartlib/api/authentication_api.dartlib/api/download_api.dart+lib/api/duplicate_api.dartlib/api/face_api.dartlib/api/file_report_api.dartlib/api/job_api.dart@@ -503,6 +505,7 @@ test/download_api_test.darttest/download_archive_info_test.darttest/download_info_dto_test.darttest/download_response_dto_test.dart+test/duplicate_api_test.darttest/duplicate_detection_config_test.darttest/entity_type_test.darttest/exif_response_dto_test.dartdiff --git a/mobile/openapi/README.md b/mobile/openapi/README.mdindex b5a49aa26c..3cce4635cc 100644--- a/mobile/openapi/README.md+++ b/mobile/openapi/README.md@@ -119,6 +119,7 @@ Class | Method | HTTP request | Description*DownloadApi* | [**downloadArchive**](doc//DownloadApi.md#downloadarchive) | **POST** /download/archive |*DownloadApi* | [**downloadFile**](doc//DownloadApi.md#downloadfile) | **POST** /download/asset/{id} |*DownloadApi* | [**getDownloadInfo**](doc//DownloadApi.md#getdownloadinfo) | **POST** /download/info |+*DuplicateApi* | [**getAssetDuplicates**](doc//DuplicateApi.md#getassetduplicates) | **GET** /duplicates |*FaceApi* | [**getFaces**](doc//FaceApi.md#getfaces) | **GET** /face |*FaceApi* | [**reassignFacesById**](doc//FaceApi.md#reassignfacesbyid) | **PUT** /face/{id} |*FileReportApi* | [**fixAuditFiles**](doc//FileReportApi.md#fixauditfiles) | **POST** /report/fix |diff --git a/mobile/openapi/doc/DuplicateApi.md b/mobile/openapi/doc/DuplicateApi.mdnew file mode 100644index 0000000000..4dfbe55d3d--- /dev/null+++ b/mobile/openapi/doc/DuplicateApi.md@@ -0,0 +1,65 @@+# openapi.api.DuplicateApi++## Load the API package+```dart+import 'package:openapi/api.dart';+```++All URIs are relative to */api*++Method | HTTP request | Description+------------- | ------------- | -------------+[**getAssetDuplicates**](DuplicateApi.md#getassetduplicates) | **GET** /duplicates |+++# **getAssetDuplicates**+> List<AssetResponseDto> getAssetDuplicates()++++### Example+```dart+import 'package:openapi/api.dart';+// TODO Configure API key authorization: cookie+//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKey = 'YOUR_API_KEY';+// uncomment below to setup prefix (e.g. Bearer) for API key, if needed+//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKeyPrefix = 'Bearer';+// TODO Configure API key authorization: api_key+//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';+// uncomment below to setup prefix (e.g. Bearer) for API key, if needed+//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';+// TODO Configure HTTP Bearer authorization: bearer+// Case 1. Use String Token+//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken('YOUR_ACCESS_TOKEN');+// Case 2. Use Function which generate token.+// String yourTokenGeneratorFunction() { ... }+//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken(yourTokenGeneratorFunction);++final api_instance = DuplicateApi();++try {+ final result = api_instance.getAssetDuplicates();+ print(result);+} catch (e) {+ print('Exception when calling DuplicateApi->getAssetDuplicates: $e\n');+}+```++### Parameters+This endpoint does not need any parameter.++### Return type++[**List<AssetResponseDto>**](AssetResponseDto.md)++### Authorization++[cookie](../README.md#cookie), [api_key](../README.md#api_key), [bearer](../README.md#bearer)++### HTTP request headers++ - **Content-Type**: Not defined+ - **Accept**: application/json++[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)+diff --git a/mobile/openapi/lib/api.dart b/mobile/openapi/lib/api.dartindex 917959d84b..69be2f8a95 100644--- a/mobile/openapi/lib/api.dart+++ b/mobile/openapi/lib/api.dart@@ -36,6 +36,7 @@ part 'api/asset_api.dart';part 'api/audit_api.dart';part 'api/authentication_api.dart';part 'api/download_api.dart';+part 'api/duplicate_api.dart';part 'api/face_api.dart';part 'api/file_report_api.dart';part 'api/job_api.dart';diff --git a/mobile/openapi/lib/api/duplicate_api.dart b/mobile/openapi/lib/api/duplicate_api.dartnew file mode 100644index 0000000000..2833d091e9--- /dev/null+++ b/mobile/openapi/lib/api/duplicate_api.dart@@ -0,0 +1,62 @@+//+// 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 DuplicateApi {+ DuplicateApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient;++ final ApiClient apiClient;++ /// Performs an HTTP 'GET /duplicates' operation and returns the [Response].+ Future<Response> getAssetDuplicatesWithHttpInfo() async {+ // ignore: prefer_const_declarations+ final path = r'/duplicates';++ // ignore: prefer_final_locals+ Object? postBody;++ final queryParams = <QueryParam>[];+ final headerParams = <String, String>{};+ final formParams = <String, String>{};++ const contentTypes = <String>[];+++ return apiClient.invokeAPI(+ path,+ 'GET',+ queryParams,+ postBody,+ headerParams,+ formParams,+ contentTypes.isEmpty ? null : contentTypes.first,+ );+ }++ Future<List<AssetResponseDto>?> getAssetDuplicates() async {+ final response = await getAssetDuplicatesWithHttpInfo();+ 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) {+ final responseBody = await _decodeBodyBytes(response);+ return (await apiClient.deserializeAsync(responseBody, 'List<AssetResponseDto>') as List)+ .cast<AssetResponseDto>()+ .toList(growable: false);++ }+ return null;+ }+}diff --git a/mobile/openapi/test/duplicate_api_test.dart b/mobile/openapi/test/duplicate_api_test.dartnew file mode 100644index 0000000000..8e22a52533--- /dev/null+++ b/mobile/openapi/test/duplicate_api_test.dart@@ -0,0 +1,26 @@+//+// 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 DuplicateApi+void main() {+ // final instance = DuplicateApi();++ group('tests for DuplicateApi', () {+ //Future<List<AssetResponseDto>> getAssetDuplicates() async+ test('test getAssetDuplicates', () async {+ // TODO+ });++ });+}diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.jsonindex f59bc7a0ad..7fbf5f8302 100644--- a/open-api/immich-openapi-specs.json+++ b/open-api/immich-openapi-specs.json@@ -2221,6 +2221,41 @@]}},+ "/duplicates": {+ "get": {+ "operationId": "getAssetDuplicates",+ "parameters": [],+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {+ "items": {+ "$ref": "#/components/schemas/AssetResponseDto"+ },+ "type": "array"+ }+ }+ },+ "description": ""+ }+ },+ "security": [+ {+ "bearer": []+ },+ {+ "cookie": []+ },+ {+ "api_key": []+ }+ ],+ "tags": [+ "Duplicate"+ ]+ }+ },"/face": {"get": {"operationId": "getFaces",diff --git a/open-api/typescript-sdk/src/fetch-client.ts b/open-api/typescript-sdk/src/fetch-client.tsindex 996f69de83..92396c360f 100644--- a/open-api/typescript-sdk/src/fetch-client.ts+++ b/open-api/typescript-sdk/src/fetch-client.ts@@ -1695,6 +1695,14 @@ export function getDownloadInfo({ key, downloadInfoDto }: {body: downloadInfoDto})));}+export function getAssetDuplicates(opts?: Oazapfts.RequestOpts) {+ return oazapfts.ok(oazapfts.fetchJson<{+ status: 200;+ data: AssetResponseDto[];+ }>("/duplicates", {+ ...opts+ }));+}export function getFaces({ id }: {id: string;}, opts?: Oazapfts.RequestOpts) {diff --git a/server/src/controllers/index.ts b/server/src/controllers/index.tsindex df1a44a157..feec616f21 100644--- a/server/src/controllers/index.ts+++ b/server/src/controllers/index.ts@@ -7,6 +7,7 @@ import { AssetController } from 'src/controllers/asset.controller';import { AuditController } from 'src/controllers/audit.controller';import { AuthController } from 'src/controllers/auth.controller';import { DownloadController } from 'src/controllers/download.controller';+import { DuplicateController } from 'src/controllers/duplicate.controller';import { FaceController } from 'src/controllers/face.controller';import { ReportController } from 'src/controllers/file-report.controller';import { JobController } from 'src/controllers/job.controller';@@ -37,6 +38,7 @@ export const controllers = [AuditController,AuthController,DownloadController,+ DuplicateController,FaceController,JobController,LibraryController,