You've already forked immich
							
							
				mirror of
				https://github.com/immich-app/immich.git
				synced 2025-10-31 00:18:28 +02:00 
			
		
		
		
	feat(server): add endpoint to get supported media types on the server (#3284)
* feat(server): add endpoint to get supported media types on the server * api generation * remove xmp format * change dto * openapi * dev
This commit is contained in:
		
							
								
								
									
										81
									
								
								cli/src/api/open-api/api.ts
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										81
									
								
								cli/src/api/open-api/api.ts
									
									
									
										generated
									
									
									
								
							| @@ -2085,6 +2085,31 @@ export interface ServerInfoResponseDto { | ||||
|      */ | ||||
|     'diskAvailable': string; | ||||
| } | ||||
| /** | ||||
|  *  | ||||
|  * @export | ||||
|  * @interface ServerMediaTypesResponseDto | ||||
|  */ | ||||
| export interface ServerMediaTypesResponseDto { | ||||
|     /** | ||||
|      *  | ||||
|      * @type {Array<string>} | ||||
|      * @memberof ServerMediaTypesResponseDto | ||||
|      */ | ||||
|     'video': Array<string>; | ||||
|     /** | ||||
|      *  | ||||
|      * @type {Array<string>} | ||||
|      * @memberof ServerMediaTypesResponseDto | ||||
|      */ | ||||
|     'image': Array<string>; | ||||
|     /** | ||||
|      *  | ||||
|      * @type {Array<string>} | ||||
|      * @memberof ServerMediaTypesResponseDto | ||||
|      */ | ||||
|     'sidecar': Array<string>; | ||||
| } | ||||
| /** | ||||
|  *  | ||||
|  * @export | ||||
| @@ -9711,6 +9736,35 @@ export const ServerInfoApiAxiosParamCreator = function (configuration?: Configur | ||||
| 
 | ||||
| 
 | ||||
|      | ||||
|             setSearchParams(localVarUrlObj, localVarQueryParameter); | ||||
|             let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; | ||||
|             localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; | ||||
| 
 | ||||
|             return { | ||||
|                 url: toPathString(localVarUrlObj), | ||||
|                 options: localVarRequestOptions, | ||||
|             }; | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         getSupportedMediaTypes: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => { | ||||
|             const localVarPath = `/server-info/media-types`; | ||||
|             // use dummy base URL string because the URL constructor only accepts absolute URLs.
 | ||||
|             const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); | ||||
|             let baseOptions; | ||||
|             if (configuration) { | ||||
|                 baseOptions = configuration.baseOptions; | ||||
|             } | ||||
| 
 | ||||
|             const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; | ||||
|             const localVarHeaderParameter = {} as any; | ||||
|             const localVarQueryParameter = {} as any; | ||||
| 
 | ||||
| 
 | ||||
|      | ||||
|             setSearchParams(localVarUrlObj, localVarQueryParameter); | ||||
|             let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; | ||||
|             localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; | ||||
| @@ -9786,6 +9840,15 @@ export const ServerInfoApiFp = function(configuration?: Configuration) { | ||||
|             const localVarAxiosArgs = await localVarAxiosParamCreator.getStats(options); | ||||
|             return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         async getSupportedMediaTypes(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ServerMediaTypesResponseDto>> { | ||||
|             const localVarAxiosArgs = await localVarAxiosParamCreator.getSupportedMediaTypes(options); | ||||
|             return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {*} [options] Override http request option. | ||||
| @@ -9829,6 +9892,14 @@ export const ServerInfoApiFactory = function (configuration?: Configuration, bas | ||||
|         getStats(options?: AxiosRequestConfig): AxiosPromise<ServerStatsResponseDto> { | ||||
|             return localVarFp.getStats(options).then((request) => request(axios, basePath)); | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         getSupportedMediaTypes(options?: AxiosRequestConfig): AxiosPromise<ServerMediaTypesResponseDto> { | ||||
|             return localVarFp.getSupportedMediaTypes(options).then((request) => request(axios, basePath)); | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {*} [options] Override http request option. | ||||
| @@ -9877,6 +9948,16 @@ export class ServerInfoApi extends BaseAPI { | ||||
|         return ServerInfoApiFp(this.configuration).getStats(options).then((request) => request(this.axios, this.basePath)); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      *  | ||||
|      * @param {*} [options] Override http request option. | ||||
|      * @throws {RequiredError} | ||||
|      * @memberof ServerInfoApi | ||||
|      */ | ||||
|     public getSupportedMediaTypes(options?: AxiosRequestConfig) { | ||||
|         return ServerInfoApiFp(this.configuration).getSupportedMediaTypes(options).then((request) => request(this.axios, this.basePath)); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      *  | ||||
|      * @param {*} [options] Override http request option. | ||||
|   | ||||
							
								
								
									
										3
									
								
								mobile/openapi/.openapi-generator/FILES
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										3
									
								
								mobile/openapi/.openapi-generator/FILES
									
									
									
										generated
									
									
									
								
							| @@ -88,6 +88,7 @@ doc/SearchFacetResponseDto.md | ||||
| doc/SearchResponseDto.md | ||||
| doc/ServerInfoApi.md | ||||
| doc/ServerInfoResponseDto.md | ||||
| doc/ServerMediaTypesResponseDto.md | ||||
| doc/ServerPingResponse.md | ||||
| doc/ServerStatsResponseDto.md | ||||
| doc/ServerVersionReponseDto.md | ||||
| @@ -221,6 +222,7 @@ lib/model/search_facet_count_response_dto.dart | ||||
| lib/model/search_facet_response_dto.dart | ||||
| lib/model/search_response_dto.dart | ||||
| lib/model/server_info_response_dto.dart | ||||
| lib/model/server_media_types_response_dto.dart | ||||
| lib/model/server_ping_response.dart | ||||
| lib/model/server_stats_response_dto.dart | ||||
| lib/model/server_version_reponse_dto.dart | ||||
| @@ -337,6 +339,7 @@ test/search_facet_response_dto_test.dart | ||||
| test/search_response_dto_test.dart | ||||
| test/server_info_api_test.dart | ||||
| test/server_info_response_dto_test.dart | ||||
| test/server_media_types_response_dto_test.dart | ||||
| test/server_ping_response_test.dart | ||||
| test/server_stats_response_dto_test.dart | ||||
| test/server_version_reponse_dto_test.dart | ||||
|   | ||||
							
								
								
									
										2
									
								
								mobile/openapi/README.md
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								mobile/openapi/README.md
									
									
									
										generated
									
									
									
								
							| @@ -141,6 +141,7 @@ Class | Method | HTTP request | Description | ||||
| *ServerInfoApi* | [**getServerInfo**](doc//ServerInfoApi.md#getserverinfo) | **GET** /server-info |  | ||||
| *ServerInfoApi* | [**getServerVersion**](doc//ServerInfoApi.md#getserverversion) | **GET** /server-info/version |  | ||||
| *ServerInfoApi* | [**getStats**](doc//ServerInfoApi.md#getstats) | **GET** /server-info/stats |  | ||||
| *ServerInfoApi* | [**getSupportedMediaTypes**](doc//ServerInfoApi.md#getsupportedmediatypes) | **GET** /server-info/media-types |  | ||||
| *ServerInfoApi* | [**pingServer**](doc//ServerInfoApi.md#pingserver) | **GET** /server-info/ping |  | ||||
| *SharedLinkApi* | [**addSharedLinkAssets**](doc//SharedLinkApi.md#addsharedlinkassets) | **PUT** /shared-link/{id}/assets |  | ||||
| *SharedLinkApi* | [**createSharedLink**](doc//SharedLinkApi.md#createsharedlink) | **POST** /shared-link |  | ||||
| @@ -251,6 +252,7 @@ Class | Method | HTTP request | Description | ||||
|  - [SearchFacetResponseDto](doc//SearchFacetResponseDto.md) | ||||
|  - [SearchResponseDto](doc//SearchResponseDto.md) | ||||
|  - [ServerInfoResponseDto](doc//ServerInfoResponseDto.md) | ||||
|  - [ServerMediaTypesResponseDto](doc//ServerMediaTypesResponseDto.md) | ||||
|  - [ServerPingResponse](doc//ServerPingResponse.md) | ||||
|  - [ServerStatsResponseDto](doc//ServerStatsResponseDto.md) | ||||
|  - [ServerVersionReponseDto](doc//ServerVersionReponseDto.md) | ||||
|   | ||||
							
								
								
									
										38
									
								
								mobile/openapi/doc/ServerInfoApi.md
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										38
									
								
								mobile/openapi/doc/ServerInfoApi.md
									
									
									
										generated
									
									
									
								
							| @@ -12,6 +12,7 @@ Method | HTTP request | Description | ||||
| [**getServerInfo**](ServerInfoApi.md#getserverinfo) | **GET** /server-info |  | ||||
| [**getServerVersion**](ServerInfoApi.md#getserverversion) | **GET** /server-info/version |  | ||||
| [**getStats**](ServerInfoApi.md#getstats) | **GET** /server-info/stats |  | ||||
| [**getSupportedMediaTypes**](ServerInfoApi.md#getsupportedmediatypes) | **GET** /server-info/media-types |  | ||||
| [**pingServer**](ServerInfoApi.md#pingserver) | **GET** /server-info/ping |  | ||||
| 
 | ||||
| 
 | ||||
| @@ -154,6 +155,43 @@ This endpoint does not need any parameter. | ||||
| 
 | ||||
| [[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) | ||||
| 
 | ||||
| # **getSupportedMediaTypes** | ||||
| > ServerMediaTypesResponseDto getSupportedMediaTypes() | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| ### Example | ||||
| ```dart | ||||
| import 'package:openapi/api.dart'; | ||||
| 
 | ||||
| final api_instance = ServerInfoApi(); | ||||
| 
 | ||||
| try { | ||||
|     final result = api_instance.getSupportedMediaTypes(); | ||||
|     print(result); | ||||
| } catch (e) { | ||||
|     print('Exception when calling ServerInfoApi->getSupportedMediaTypes: $e\n'); | ||||
| } | ||||
| ``` | ||||
| 
 | ||||
| ### Parameters | ||||
| This endpoint does not need any parameter. | ||||
| 
 | ||||
| ### Return type | ||||
| 
 | ||||
| [**ServerMediaTypesResponseDto**](ServerMediaTypesResponseDto.md) | ||||
| 
 | ||||
| ### Authorization | ||||
| 
 | ||||
| No authorization required | ||||
| 
 | ||||
| ### 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) | ||||
| 
 | ||||
| # **pingServer** | ||||
| > ServerPingResponse pingServer() | ||||
| 
 | ||||
|   | ||||
							
								
								
									
										17
									
								
								mobile/openapi/doc/ServerMediaTypesResponseDto.md
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								mobile/openapi/doc/ServerMediaTypesResponseDto.md
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| # openapi.model.ServerMediaTypesResponseDto | ||||
| 
 | ||||
| ## Load the model package | ||||
| ```dart | ||||
| import 'package:openapi/api.dart'; | ||||
| ``` | ||||
| 
 | ||||
| ## Properties | ||||
| Name | Type | Description | Notes | ||||
| ------------ | ------------- | ------------- | ------------- | ||||
| **video** | **List<String>** |  | [default to const []] | ||||
| **image** | **List<String>** |  | [default to const []] | ||||
| **sidecar** | **List<String>** |  | [default to const []] | ||||
| 
 | ||||
| [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) | ||||
| 
 | ||||
| 
 | ||||
							
								
								
									
										1
									
								
								mobile/openapi/lib/api.dart
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1
									
								
								mobile/openapi/lib/api.dart
									
									
									
										generated
									
									
									
								
							| @@ -118,6 +118,7 @@ part 'model/search_facet_count_response_dto.dart'; | ||||
| part 'model/search_facet_response_dto.dart'; | ||||
| part 'model/search_response_dto.dart'; | ||||
| part 'model/server_info_response_dto.dart'; | ||||
| part 'model/server_media_types_response_dto.dart'; | ||||
| part 'model/server_ping_response.dart'; | ||||
| part 'model/server_stats_response_dto.dart'; | ||||
| part 'model/server_version_reponse_dto.dart'; | ||||
|   | ||||
							
								
								
									
										41
									
								
								mobile/openapi/lib/api/server_info_api.dart
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										41
									
								
								mobile/openapi/lib/api/server_info_api.dart
									
									
									
										generated
									
									
									
								
							| @@ -139,6 +139,47 @@ class ServerInfoApi { | ||||
|     return null; | ||||
|   } | ||||
| 
 | ||||
|   /// Performs an HTTP 'GET /server-info/media-types' operation and returns the [Response]. | ||||
|   Future<Response> getSupportedMediaTypesWithHttpInfo() async { | ||||
|     // ignore: prefer_const_declarations | ||||
|     final path = r'/server-info/media-types'; | ||||
| 
 | ||||
|     // 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<ServerMediaTypesResponseDto?> getSupportedMediaTypes() async { | ||||
|     final response = await getSupportedMediaTypesWithHttpInfo(); | ||||
|     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), 'ServerMediaTypesResponseDto',) as ServerMediaTypesResponseDto; | ||||
|      | ||||
|     } | ||||
|     return null; | ||||
|   } | ||||
| 
 | ||||
|   /// Performs an HTTP 'GET /server-info/ping' operation and returns the [Response]. | ||||
|   Future<Response> pingServerWithHttpInfo() async { | ||||
|     // ignore: prefer_const_declarations | ||||
|   | ||||
							
								
								
									
										2
									
								
								mobile/openapi/lib/api_client.dart
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								mobile/openapi/lib/api_client.dart
									
									
									
										generated
									
									
									
								
							| @@ -331,6 +331,8 @@ class ApiClient { | ||||
|           return SearchResponseDto.fromJson(value); | ||||
|         case 'ServerInfoResponseDto': | ||||
|           return ServerInfoResponseDto.fromJson(value); | ||||
|         case 'ServerMediaTypesResponseDto': | ||||
|           return ServerMediaTypesResponseDto.fromJson(value); | ||||
|         case 'ServerPingResponse': | ||||
|           return ServerPingResponse.fromJson(value); | ||||
|         case 'ServerStatsResponseDto': | ||||
|   | ||||
							
								
								
									
										120
									
								
								mobile/openapi/lib/model/server_media_types_response_dto.dart
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										120
									
								
								mobile/openapi/lib/model/server_media_types_response_dto.dart
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,120 @@ | ||||
| // | ||||
| // AUTO-GENERATED FILE, DO NOT MODIFY! | ||||
| // | ||||
| // @dart=2.12 | ||||
| 
 | ||||
| // 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 ServerMediaTypesResponseDto { | ||||
|   /// Returns a new [ServerMediaTypesResponseDto] instance. | ||||
|   ServerMediaTypesResponseDto({ | ||||
|     this.video = const [], | ||||
|     this.image = const [], | ||||
|     this.sidecar = const [], | ||||
|   }); | ||||
| 
 | ||||
|   List<String> video; | ||||
| 
 | ||||
|   List<String> image; | ||||
| 
 | ||||
|   List<String> sidecar; | ||||
| 
 | ||||
|   @override | ||||
|   bool operator ==(Object other) => identical(this, other) || other is ServerMediaTypesResponseDto && | ||||
|      other.video == video && | ||||
|      other.image == image && | ||||
|      other.sidecar == sidecar; | ||||
| 
 | ||||
|   @override | ||||
|   int get hashCode => | ||||
|     // ignore: unnecessary_parenthesis | ||||
|     (video.hashCode) + | ||||
|     (image.hashCode) + | ||||
|     (sidecar.hashCode); | ||||
| 
 | ||||
|   @override | ||||
|   String toString() => 'ServerMediaTypesResponseDto[video=$video, image=$image, sidecar=$sidecar]'; | ||||
| 
 | ||||
|   Map<String, dynamic> toJson() { | ||||
|     final json = <String, dynamic>{}; | ||||
|       json[r'video'] = this.video; | ||||
|       json[r'image'] = this.image; | ||||
|       json[r'sidecar'] = this.sidecar; | ||||
|     return json; | ||||
|   } | ||||
| 
 | ||||
|   /// Returns a new [ServerMediaTypesResponseDto] instance and imports its values from | ||||
|   /// [value] if it's a [Map], null otherwise. | ||||
|   // ignore: prefer_constructors_over_static_methods | ||||
|   static ServerMediaTypesResponseDto? fromJson(dynamic value) { | ||||
|     if (value is Map) { | ||||
|       final json = value.cast<String, dynamic>(); | ||||
| 
 | ||||
|       return ServerMediaTypesResponseDto( | ||||
|         video: json[r'video'] is Iterable | ||||
|             ? (json[r'video'] as Iterable).cast<String>().toList(growable: false) | ||||
|             : const [], | ||||
|         image: json[r'image'] is Iterable | ||||
|             ? (json[r'image'] as Iterable).cast<String>().toList(growable: false) | ||||
|             : const [], | ||||
|         sidecar: json[r'sidecar'] is Iterable | ||||
|             ? (json[r'sidecar'] as Iterable).cast<String>().toList(growable: false) | ||||
|             : const [], | ||||
|       ); | ||||
|     } | ||||
|     return null; | ||||
|   } | ||||
| 
 | ||||
|   static List<ServerMediaTypesResponseDto> listFromJson(dynamic json, {bool growable = false,}) { | ||||
|     final result = <ServerMediaTypesResponseDto>[]; | ||||
|     if (json is List && json.isNotEmpty) { | ||||
|       for (final row in json) { | ||||
|         final value = ServerMediaTypesResponseDto.fromJson(row); | ||||
|         if (value != null) { | ||||
|           result.add(value); | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|     return result.toList(growable: growable); | ||||
|   } | ||||
| 
 | ||||
|   static Map<String, ServerMediaTypesResponseDto> mapFromJson(dynamic json) { | ||||
|     final map = <String, ServerMediaTypesResponseDto>{}; | ||||
|     if (json is Map && json.isNotEmpty) { | ||||
|       json = json.cast<String, dynamic>(); // ignore: parameter_assignments | ||||
|       for (final entry in json.entries) { | ||||
|         final value = ServerMediaTypesResponseDto.fromJson(entry.value); | ||||
|         if (value != null) { | ||||
|           map[entry.key] = value; | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|     return map; | ||||
|   } | ||||
| 
 | ||||
|   // maps a json object with a list of ServerMediaTypesResponseDto-objects as value to a dart map | ||||
|   static Map<String, List<ServerMediaTypesResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) { | ||||
|     final map = <String, List<ServerMediaTypesResponseDto>>{}; | ||||
|     if (json is Map && json.isNotEmpty) { | ||||
|       // ignore: parameter_assignments | ||||
|       json = json.cast<String, dynamic>(); | ||||
|       for (final entry in json.entries) { | ||||
|         map[entry.key] = ServerMediaTypesResponseDto.listFromJson(entry.value, growable: growable,); | ||||
|       } | ||||
|     } | ||||
|     return map; | ||||
|   } | ||||
| 
 | ||||
|   /// The list of required keys that must be present in a JSON. | ||||
|   static const requiredKeys = <String>{ | ||||
|     'video', | ||||
|     'image', | ||||
|     'sidecar', | ||||
|   }; | ||||
| } | ||||
| 
 | ||||
							
								
								
									
										5
									
								
								mobile/openapi/test/server_info_api_test.dart
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										5
									
								
								mobile/openapi/test/server_info_api_test.dart
									
									
									
										generated
									
									
									
								
							| @@ -32,6 +32,11 @@ void main() { | ||||
|       // TODO | ||||
|     }); | ||||
| 
 | ||||
|     //Future<ServerMediaTypesResponseDto> getSupportedMediaTypes() async | ||||
|     test('test getSupportedMediaTypes', () async { | ||||
|       // TODO | ||||
|     }); | ||||
| 
 | ||||
|     //Future<ServerPingResponse> pingServer() async | ||||
|     test('test pingServer', () async { | ||||
|       // TODO | ||||
|   | ||||
							
								
								
									
										37
									
								
								mobile/openapi/test/server_media_types_response_dto_test.dart
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								mobile/openapi/test/server_media_types_response_dto_test.dart
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| // | ||||
| // AUTO-GENERATED FILE, DO NOT MODIFY! | ||||
| // | ||||
| // @dart=2.12 | ||||
| 
 | ||||
| // 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 ServerMediaTypesResponseDto | ||||
| void main() { | ||||
|   // final instance = ServerMediaTypesResponseDto(); | ||||
| 
 | ||||
|   group('test ServerMediaTypesResponseDto', () { | ||||
|     // List<String> video (default value: const []) | ||||
|     test('to test the property `video`', () async { | ||||
|       // TODO | ||||
|     }); | ||||
| 
 | ||||
|     // List<String> image (default value: const []) | ||||
|     test('to test the property `image`', () async { | ||||
|       // TODO | ||||
|     }); | ||||
| 
 | ||||
|     // List<String> sidecar (default value: const []) | ||||
|     test('to test the property `sidecar`', () async { | ||||
|       // TODO | ||||
|     }); | ||||
| 
 | ||||
| 
 | ||||
|   }); | ||||
| 
 | ||||
| } | ||||
| @@ -3040,6 +3040,27 @@ | ||||
|         ] | ||||
|       } | ||||
|     }, | ||||
|     "/server-info/media-types": { | ||||
|       "get": { | ||||
|         "operationId": "getSupportedMediaTypes", | ||||
|         "parameters": [], | ||||
|         "responses": { | ||||
|           "200": { | ||||
|             "description": "", | ||||
|             "content": { | ||||
|               "application/json": { | ||||
|                 "schema": { | ||||
|                   "$ref": "#/components/schemas/ServerMediaTypesResponseDto" | ||||
|                 } | ||||
|               } | ||||
|             } | ||||
|           } | ||||
|         }, | ||||
|         "tags": [ | ||||
|           "Server Info" | ||||
|         ] | ||||
|       } | ||||
|     }, | ||||
|     "/server-info/ping": { | ||||
|       "get": { | ||||
|         "operationId": "pingServer", | ||||
| @@ -6118,6 +6139,34 @@ | ||||
|           "diskAvailable" | ||||
|         ] | ||||
|       }, | ||||
|       "ServerMediaTypesResponseDto": { | ||||
|         "type": "object", | ||||
|         "properties": { | ||||
|           "video": { | ||||
|             "type": "array", | ||||
|             "items": { | ||||
|               "type": "string" | ||||
|             } | ||||
|           }, | ||||
|           "image": { | ||||
|             "type": "array", | ||||
|             "items": { | ||||
|               "type": "string" | ||||
|             } | ||||
|           }, | ||||
|           "sidecar": { | ||||
|             "type": "array", | ||||
|             "items": { | ||||
|               "type": "string" | ||||
|             } | ||||
|           } | ||||
|         }, | ||||
|         "required": [ | ||||
|           "video", | ||||
|           "image", | ||||
|           "sidecar" | ||||
|         ] | ||||
|       }, | ||||
|       "ServerPingResponse": { | ||||
|         "type": "object", | ||||
|         "properties": { | ||||
|   | ||||
| @@ -25,3 +25,9 @@ export class ServerStatsResponseDto { | ||||
|   }) | ||||
|   usageByUser: UsageByUserDto[] = []; | ||||
| } | ||||
|  | ||||
| export class ServerMediaTypesResponseDto { | ||||
|   video!: string[]; | ||||
|   image!: string[]; | ||||
|   sidecar!: string[]; | ||||
| } | ||||
|   | ||||
| @@ -1,9 +1,15 @@ | ||||
| import { Inject, Injectable } from '@nestjs/common'; | ||||
| import { serverVersion } from '../domain.constant'; | ||||
| import { mimeTypes, serverVersion } from '../domain.constant'; | ||||
| import { asHumanReadable } from '../domain.util'; | ||||
| import { IStorageRepository, StorageCore, StorageFolder } from '../storage'; | ||||
| import { IUserRepository, UserStatsQueryResponse } from '../user'; | ||||
| import { ServerInfoResponseDto, ServerPingResponse, ServerStatsResponseDto, UsageByUserDto } from './response-dto'; | ||||
| import { | ||||
|   ServerInfoResponseDto, | ||||
|   ServerMediaTypesResponseDto, | ||||
|   ServerPingResponse, | ||||
|   ServerStatsResponseDto, | ||||
|   UsageByUserDto, | ||||
| } from './response-dto'; | ||||
|  | ||||
| @Injectable() | ||||
| export class ServerInfoService { | ||||
| @@ -60,4 +66,12 @@ export class ServerInfoService { | ||||
|  | ||||
|     return serverStats; | ||||
|   } | ||||
|  | ||||
|   getSupportedMediaTypes(): ServerMediaTypesResponseDto { | ||||
|     return { | ||||
|       video: [...Object.keys(mimeTypes.video)], | ||||
|       image: [...Object.keys(mimeTypes.image)], | ||||
|       sidecar: [...Object.keys(mimeTypes.sidecar)], | ||||
|     }; | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| import { | ||||
|   ServerInfoResponseDto, | ||||
|   ServerInfoService, | ||||
|   ServerMediaTypesResponseDto, | ||||
|   ServerPingResponse, | ||||
|   ServerStatsResponseDto, | ||||
|   ServerVersionReponseDto, | ||||
| @@ -39,4 +40,10 @@ export class ServerInfoController { | ||||
|   getStats(): Promise<ServerStatsResponseDto> { | ||||
|     return this.service.getStats(); | ||||
|   } | ||||
|  | ||||
|   @PublicRoute() | ||||
|   @Get('/media-types') | ||||
|   getSupportedMediaTypes(): ServerMediaTypesResponseDto { | ||||
|     return this.service.getSupportedMediaTypes(); | ||||
|   } | ||||
| } | ||||
|   | ||||
							
								
								
									
										81
									
								
								web/src/api/open-api/api.ts
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										81
									
								
								web/src/api/open-api/api.ts
									
									
									
										generated
									
									
									
								
							| @@ -2085,6 +2085,31 @@ export interface ServerInfoResponseDto { | ||||
|      */ | ||||
|     'diskAvailable': string; | ||||
| } | ||||
| /** | ||||
|  *  | ||||
|  * @export | ||||
|  * @interface ServerMediaTypesResponseDto | ||||
|  */ | ||||
| export interface ServerMediaTypesResponseDto { | ||||
|     /** | ||||
|      *  | ||||
|      * @type {Array<string>} | ||||
|      * @memberof ServerMediaTypesResponseDto | ||||
|      */ | ||||
|     'video': Array<string>; | ||||
|     /** | ||||
|      *  | ||||
|      * @type {Array<string>} | ||||
|      * @memberof ServerMediaTypesResponseDto | ||||
|      */ | ||||
|     'image': Array<string>; | ||||
|     /** | ||||
|      *  | ||||
|      * @type {Array<string>} | ||||
|      * @memberof ServerMediaTypesResponseDto | ||||
|      */ | ||||
|     'sidecar': Array<string>; | ||||
| } | ||||
| /** | ||||
|  *  | ||||
|  * @export | ||||
| @@ -9771,6 +9796,35 @@ export const ServerInfoApiAxiosParamCreator = function (configuration?: Configur | ||||
| 
 | ||||
| 
 | ||||
|      | ||||
|             setSearchParams(localVarUrlObj, localVarQueryParameter); | ||||
|             let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; | ||||
|             localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; | ||||
| 
 | ||||
|             return { | ||||
|                 url: toPathString(localVarUrlObj), | ||||
|                 options: localVarRequestOptions, | ||||
|             }; | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         getSupportedMediaTypes: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => { | ||||
|             const localVarPath = `/server-info/media-types`; | ||||
|             // use dummy base URL string because the URL constructor only accepts absolute URLs.
 | ||||
|             const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); | ||||
|             let baseOptions; | ||||
|             if (configuration) { | ||||
|                 baseOptions = configuration.baseOptions; | ||||
|             } | ||||
| 
 | ||||
|             const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; | ||||
|             const localVarHeaderParameter = {} as any; | ||||
|             const localVarQueryParameter = {} as any; | ||||
| 
 | ||||
| 
 | ||||
|      | ||||
|             setSearchParams(localVarUrlObj, localVarQueryParameter); | ||||
|             let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; | ||||
|             localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; | ||||
| @@ -9846,6 +9900,15 @@ export const ServerInfoApiFp = function(configuration?: Configuration) { | ||||
|             const localVarAxiosArgs = await localVarAxiosParamCreator.getStats(options); | ||||
|             return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         async getSupportedMediaTypes(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ServerMediaTypesResponseDto>> { | ||||
|             const localVarAxiosArgs = await localVarAxiosParamCreator.getSupportedMediaTypes(options); | ||||
|             return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {*} [options] Override http request option. | ||||
| @@ -9889,6 +9952,14 @@ export const ServerInfoApiFactory = function (configuration?: Configuration, bas | ||||
|         getStats(options?: any): AxiosPromise<ServerStatsResponseDto> { | ||||
|             return localVarFp.getStats(options).then((request) => request(axios, basePath)); | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {*} [options] Override http request option. | ||||
|          * @throws {RequiredError} | ||||
|          */ | ||||
|         getSupportedMediaTypes(options?: any): AxiosPromise<ServerMediaTypesResponseDto> { | ||||
|             return localVarFp.getSupportedMediaTypes(options).then((request) => request(axios, basePath)); | ||||
|         }, | ||||
|         /** | ||||
|          *  | ||||
|          * @param {*} [options] Override http request option. | ||||
| @@ -9937,6 +10008,16 @@ export class ServerInfoApi extends BaseAPI { | ||||
|         return ServerInfoApiFp(this.configuration).getStats(options).then((request) => request(this.axios, this.basePath)); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      *  | ||||
|      * @param {*} [options] Override http request option. | ||||
|      * @throws {RequiredError} | ||||
|      * @memberof ServerInfoApi | ||||
|      */ | ||||
|     public getSupportedMediaTypes(options?: AxiosRequestConfig) { | ||||
|         return ServerInfoApiFp(this.configuration).getSupportedMediaTypes(options).then((request) => request(this.axios, this.basePath)); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      *  | ||||
|      * @param {*} [options] Override http request option. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user