feat(server,web): migrate oauth settings from env to system config (#1061)

This commit is contained in:
Jason Rasmussen
2022-12-09 15:51:42 -05:00
committed by GitHub
parent cefdd86b7f
commit 5e680551b9
69 changed files with 2079 additions and 1229 deletions

View File

@@ -61,9 +61,9 @@ doc/ServerVersionReponseDto.md
doc/SignUpDto.md
doc/SmartInfoResponseDto.md
doc/SystemConfigApi.md
doc/SystemConfigKey.md
doc/SystemConfigResponseDto.md
doc/SystemConfigResponseItem.md
doc/SystemConfigDto.md
doc/SystemConfigFFmpegDto.md
doc/SystemConfigOAuthDto.md
doc/TagApi.md
doc/TagResponseDto.md
doc/TagTypeEnum.md
@@ -149,9 +149,9 @@ lib/model/server_stats_response_dto.dart
lib/model/server_version_reponse_dto.dart
lib/model/sign_up_dto.dart
lib/model/smart_info_response_dto.dart
lib/model/system_config_key.dart
lib/model/system_config_response_dto.dart
lib/model/system_config_response_item.dart
lib/model/system_config_dto.dart
lib/model/system_config_f_fmpeg_dto.dart
lib/model/system_config_o_auth_dto.dart
lib/model/tag_response_dto.dart
lib/model/tag_type_enum.dart
lib/model/thumbnail_format.dart
@@ -224,9 +224,9 @@ test/server_version_reponse_dto_test.dart
test/sign_up_dto_test.dart
test/smart_info_response_dto_test.dart
test/system_config_api_test.dart
test/system_config_key_test.dart
test/system_config_response_dto_test.dart
test/system_config_response_item_test.dart
test/system_config_dto_test.dart
test/system_config_f_fmpeg_dto_test.dart
test/system_config_o_auth_dto_test.dart
test/tag_api_test.dart
test/tag_response_dto_test.dart
test/tag_type_enum_test.dart

View File

@@ -112,6 +112,7 @@ Class | Method | HTTP request | Description
*ServerInfoApi* | [**getStats**](doc//ServerInfoApi.md#getstats) | **GET** /server-info/stats |
*ServerInfoApi* | [**pingServer**](doc//ServerInfoApi.md#pingserver) | **GET** /server-info/ping |
*SystemConfigApi* | [**getConfig**](doc//SystemConfigApi.md#getconfig) | **GET** /system-config |
*SystemConfigApi* | [**getDefaults**](doc//SystemConfigApi.md#getdefaults) | **GET** /system-config/defaults |
*SystemConfigApi* | [**updateConfig**](doc//SystemConfigApi.md#updateconfig) | **PUT** /system-config |
*TagApi* | [**create**](doc//TagApi.md#create) | **POST** /tag |
*TagApi* | [**delete**](doc//TagApi.md#delete) | **DELETE** /tag/{id} |
@@ -182,9 +183,9 @@ Class | Method | HTTP request | Description
- [ServerVersionReponseDto](doc//ServerVersionReponseDto.md)
- [SignUpDto](doc//SignUpDto.md)
- [SmartInfoResponseDto](doc//SmartInfoResponseDto.md)
- [SystemConfigKey](doc//SystemConfigKey.md)
- [SystemConfigResponseDto](doc//SystemConfigResponseDto.md)
- [SystemConfigResponseItem](doc//SystemConfigResponseItem.md)
- [SystemConfigDto](doc//SystemConfigDto.md)
- [SystemConfigFFmpegDto](doc//SystemConfigFFmpegDto.md)
- [SystemConfigOAuthDto](doc//SystemConfigOAuthDto.md)
- [TagResponseDto](doc//TagResponseDto.md)
- [TagTypeEnum](doc//TagTypeEnum.md)
- [ThumbnailFormat](doc//ThumbnailFormat.md)

View File

@@ -10,11 +10,12 @@ All URIs are relative to */api*
Method | HTTP request | Description
------------- | ------------- | -------------
[**getConfig**](SystemConfigApi.md#getconfig) | **GET** /system-config |
[**getDefaults**](SystemConfigApi.md#getdefaults) | **GET** /system-config/defaults |
[**updateConfig**](SystemConfigApi.md#updateconfig) | **PUT** /system-config |
# **getConfig**
> SystemConfigResponseDto getConfig()
> SystemConfigDto getConfig()
@@ -43,7 +44,7 @@ This endpoint does not need any parameter.
### Return type
[**SystemConfigResponseDto**](SystemConfigResponseDto.md)
[**SystemConfigDto**](SystemConfigDto.md)
### Authorization
@@ -56,8 +57,8 @@ 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)
# **updateConfig**
> SystemConfigResponseDto updateConfig(body)
# **getDefaults**
> SystemConfigDto getDefaults()
@@ -72,10 +73,53 @@ import 'package:openapi/api.dart';
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken(yourTokenGeneratorFunction);
final api_instance = SystemConfigApi();
final body = Object(); // Object |
try {
final result = api_instance.updateConfig(body);
final result = api_instance.getDefaults();
print(result);
} catch (e) {
print('Exception when calling SystemConfigApi->getDefaults: $e\n');
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**SystemConfigDto**](SystemConfigDto.md)
### Authorization
[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)
# **updateConfig**
> SystemConfigDto updateConfig(systemConfigDto)
### Example
```dart
import 'package:openapi/api.dart';
// 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 = SystemConfigApi();
final systemConfigDto = SystemConfigDto(); // SystemConfigDto |
try {
final result = api_instance.updateConfig(systemConfigDto);
print(result);
} catch (e) {
print('Exception when calling SystemConfigApi->updateConfig: $e\n');
@@ -86,11 +130,11 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **Object**| |
**systemConfigDto** | [**SystemConfigDto**](SystemConfigDto.md)| |
### Return type
[**SystemConfigResponseDto**](SystemConfigResponseDto.md)
[**SystemConfigDto**](SystemConfigDto.md)
### Authorization

View File

@@ -1,4 +1,4 @@
# openapi.model.SystemConfigKey
# openapi.model.SystemConfigDto
## Load the model package
```dart
@@ -8,6 +8,8 @@ import 'package:openapi/api.dart';
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ffmpeg** | [**SystemConfigFFmpegDto**](SystemConfigFFmpegDto.md) | |
**oauth** | [**SystemConfigOAuthDto**](SystemConfigOAuthDto.md) | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -1,4 +1,4 @@
# openapi.model.SystemConfigResponseDto
# openapi.model.SystemConfigFFmpegDto
## Load the model package
```dart
@@ -8,7 +8,11 @@ import 'package:openapi/api.dart';
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**config** | [**List<SystemConfigResponseItem>**](SystemConfigResponseItem.md) | | [default to const []]
**crf** | **String** | |
**preset** | **String** | |
**targetVideoCodec** | **String** | |
**targetAudioCodec** | **String** | |
**targetScaling** | **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)

View File

@@ -1,4 +1,4 @@
# openapi.model.SystemConfigResponseItem
# openapi.model.SystemConfigOAuthDto
## Load the model package
```dart
@@ -8,10 +8,13 @@ import 'package:openapi/api.dart';
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | |
**key** | [**SystemConfigKey**](SystemConfigKey.md) | |
**value** | **String** | |
**defaultValue** | **String** | |
**enabled** | **bool** | |
**issuerUrl** | **String** | |
**clientId** | **String** | |
**clientSecret** | **String** | |
**scope** | **String** | |
**buttonText** | **String** | |
**autoRegister** | **bool** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -88,9 +88,9 @@ part 'model/server_stats_response_dto.dart';
part 'model/server_version_reponse_dto.dart';
part 'model/sign_up_dto.dart';
part 'model/smart_info_response_dto.dart';
part 'model/system_config_key.dart';
part 'model/system_config_response_dto.dart';
part 'model/system_config_response_item.dart';
part 'model/system_config_dto.dart';
part 'model/system_config_f_fmpeg_dto.dart';
part 'model/system_config_o_auth_dto.dart';
part 'model/tag_response_dto.dart';
part 'model/tag_type_enum.dart';
part 'model/thumbnail_format.dart';

View File

@@ -42,7 +42,7 @@ class SystemConfigApi {
);
}
Future<SystemConfigResponseDto?> getConfig() async {
Future<SystemConfigDto?> getConfig() async {
final response = await getConfigWithHttpInfo();
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
@@ -51,7 +51,48 @@ class SystemConfigApi {
// 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), 'SystemConfigResponseDto',) as SystemConfigResponseDto;
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'SystemConfigDto',) as SystemConfigDto;
}
return null;
}
/// Performs an HTTP 'GET /system-config/defaults' operation and returns the [Response].
Future<Response> getDefaultsWithHttpInfo() async {
// ignore: prefer_const_declarations
final path = r'/system-config/defaults';
// 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<SystemConfigDto?> getDefaults() async {
final response = await getDefaultsWithHttpInfo();
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), 'SystemConfigDto',) as SystemConfigDto;
}
return null;
@@ -60,13 +101,13 @@ class SystemConfigApi {
/// Performs an HTTP 'PUT /system-config' operation and returns the [Response].
/// Parameters:
///
/// * [Object] body (required):
Future<Response> updateConfigWithHttpInfo(Object body,) async {
/// * [SystemConfigDto] systemConfigDto (required):
Future<Response> updateConfigWithHttpInfo(SystemConfigDto systemConfigDto,) async {
// ignore: prefer_const_declarations
final path = r'/system-config';
// ignore: prefer_final_locals
Object? postBody = body;
Object? postBody = systemConfigDto;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
@@ -88,9 +129,9 @@ class SystemConfigApi {
/// Parameters:
///
/// * [Object] body (required):
Future<SystemConfigResponseDto?> updateConfig(Object body,) async {
final response = await updateConfigWithHttpInfo(body,);
/// * [SystemConfigDto] systemConfigDto (required):
Future<SystemConfigDto?> updateConfig(SystemConfigDto systemConfigDto,) async {
final response = await updateConfigWithHttpInfo(systemConfigDto,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
@@ -98,7 +139,7 @@ class SystemConfigApi {
// 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), 'SystemConfigResponseDto',) as SystemConfigResponseDto;
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'SystemConfigDto',) as SystemConfigDto;
}
return null;

View File

@@ -292,12 +292,12 @@ class ApiClient {
return SignUpDto.fromJson(value);
case 'SmartInfoResponseDto':
return SmartInfoResponseDto.fromJson(value);
case 'SystemConfigKey':
return SystemConfigKeyTypeTransformer().decode(value);
case 'SystemConfigResponseDto':
return SystemConfigResponseDto.fromJson(value);
case 'SystemConfigResponseItem':
return SystemConfigResponseItem.fromJson(value);
case 'SystemConfigDto':
return SystemConfigDto.fromJson(value);
case 'SystemConfigFFmpegDto':
return SystemConfigFFmpegDto.fromJson(value);
case 'SystemConfigOAuthDto':
return SystemConfigOAuthDto.fromJson(value);
case 'TagResponseDto':
return TagResponseDto.fromJson(value);
case 'TagTypeEnum':

View File

@@ -70,9 +70,6 @@ String parameterToString(dynamic value) {
if (value is JobId) {
return JobIdTypeTransformer().encode(value).toString();
}
if (value is SystemConfigKey) {
return SystemConfigKeyTypeTransformer().encode(value).toString();
}
if (value is TagTypeEnum) {
return TagTypeEnumTypeTransformer().encode(value).toString();
}

View File

@@ -10,36 +10,42 @@
part of openapi.api;
class SystemConfigResponseDto {
/// Returns a new [SystemConfigResponseDto] instance.
SystemConfigResponseDto({
this.config = const [],
class SystemConfigDto {
/// Returns a new [SystemConfigDto] instance.
SystemConfigDto({
required this.ffmpeg,
required this.oauth,
});
List<SystemConfigResponseItem> config;
SystemConfigFFmpegDto ffmpeg;
SystemConfigOAuthDto oauth;
@override
bool operator ==(Object other) => identical(this, other) || other is SystemConfigResponseDto &&
other.config == config;
bool operator ==(Object other) => identical(this, other) || other is SystemConfigDto &&
other.ffmpeg == ffmpeg &&
other.oauth == oauth;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(config.hashCode);
(ffmpeg.hashCode) +
(oauth.hashCode);
@override
String toString() => 'SystemConfigResponseDto[config=$config]';
String toString() => 'SystemConfigDto[ffmpeg=$ffmpeg, oauth=$oauth]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'config'] = config;
_json[r'ffmpeg'] = ffmpeg;
_json[r'oauth'] = oauth;
return _json;
}
/// Returns a new [SystemConfigResponseDto] instance and imports its values from
/// Returns a new [SystemConfigDto] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static SystemConfigResponseDto? fromJson(dynamic value) {
static SystemConfigDto? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
@@ -48,24 +54,25 @@ class SystemConfigResponseDto {
// Note 2: this code is stripped in release mode!
assert(() {
requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "SystemConfigResponseDto[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "SystemConfigResponseDto[$key]" has a null value in JSON.');
assert(json.containsKey(key), 'Required key "SystemConfigDto[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "SystemConfigDto[$key]" has a null value in JSON.');
});
return true;
}());
return SystemConfigResponseDto(
config: SystemConfigResponseItem.listFromJson(json[r'config'])!,
return SystemConfigDto(
ffmpeg: SystemConfigFFmpegDto.fromJson(json[r'ffmpeg'])!,
oauth: SystemConfigOAuthDto.fromJson(json[r'oauth'])!,
);
}
return null;
}
static List<SystemConfigResponseDto>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <SystemConfigResponseDto>[];
static List<SystemConfigDto>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <SystemConfigDto>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = SystemConfigResponseDto.fromJson(row);
final value = SystemConfigDto.fromJson(row);
if (value != null) {
result.add(value);
}
@@ -74,12 +81,12 @@ class SystemConfigResponseDto {
return result.toList(growable: growable);
}
static Map<String, SystemConfigResponseDto> mapFromJson(dynamic json) {
final map = <String, SystemConfigResponseDto>{};
static Map<String, SystemConfigDto> mapFromJson(dynamic json) {
final map = <String, SystemConfigDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = SystemConfigResponseDto.fromJson(entry.value);
final value = SystemConfigDto.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
@@ -88,13 +95,13 @@ class SystemConfigResponseDto {
return map;
}
// maps a json object with a list of SystemConfigResponseDto-objects as value to a dart map
static Map<String, List<SystemConfigResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<SystemConfigResponseDto>>{};
// maps a json object with a list of SystemConfigDto-objects as value to a dart map
static Map<String, List<SystemConfigDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<SystemConfigDto>>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = SystemConfigResponseDto.listFromJson(entry.value, growable: growable,);
final value = SystemConfigDto.listFromJson(entry.value, growable: growable,);
if (value != null) {
map[entry.key] = value;
}
@@ -105,7 +112,8 @@ class SystemConfigResponseDto {
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'config',
'ffmpeg',
'oauth',
};
}

View File

@@ -0,0 +1,143 @@
//
// 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 SystemConfigFFmpegDto {
/// Returns a new [SystemConfigFFmpegDto] instance.
SystemConfigFFmpegDto({
required this.crf,
required this.preset,
required this.targetVideoCodec,
required this.targetAudioCodec,
required this.targetScaling,
});
String crf;
String preset;
String targetVideoCodec;
String targetAudioCodec;
String targetScaling;
@override
bool operator ==(Object other) => identical(this, other) || other is SystemConfigFFmpegDto &&
other.crf == crf &&
other.preset == preset &&
other.targetVideoCodec == targetVideoCodec &&
other.targetAudioCodec == targetAudioCodec &&
other.targetScaling == targetScaling;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(crf.hashCode) +
(preset.hashCode) +
(targetVideoCodec.hashCode) +
(targetAudioCodec.hashCode) +
(targetScaling.hashCode);
@override
String toString() => 'SystemConfigFFmpegDto[crf=$crf, preset=$preset, targetVideoCodec=$targetVideoCodec, targetAudioCodec=$targetAudioCodec, targetScaling=$targetScaling]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'crf'] = crf;
_json[r'preset'] = preset;
_json[r'targetVideoCodec'] = targetVideoCodec;
_json[r'targetAudioCodec'] = targetAudioCodec;
_json[r'targetScaling'] = targetScaling;
return _json;
}
/// Returns a new [SystemConfigFFmpegDto] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static SystemConfigFFmpegDto? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
// Ensure that the map contains the required keys.
// Note 1: the values aren't checked for validity beyond being non-null.
// Note 2: this code is stripped in release mode!
assert(() {
requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "SystemConfigFFmpegDto[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "SystemConfigFFmpegDto[$key]" has a null value in JSON.');
});
return true;
}());
return SystemConfigFFmpegDto(
crf: mapValueOfType<String>(json, r'crf')!,
preset: mapValueOfType<String>(json, r'preset')!,
targetVideoCodec: mapValueOfType<String>(json, r'targetVideoCodec')!,
targetAudioCodec: mapValueOfType<String>(json, r'targetAudioCodec')!,
targetScaling: mapValueOfType<String>(json, r'targetScaling')!,
);
}
return null;
}
static List<SystemConfigFFmpegDto>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <SystemConfigFFmpegDto>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = SystemConfigFFmpegDto.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, SystemConfigFFmpegDto> mapFromJson(dynamic json) {
final map = <String, SystemConfigFFmpegDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = SystemConfigFFmpegDto.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of SystemConfigFFmpegDto-objects as value to a dart map
static Map<String, List<SystemConfigFFmpegDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<SystemConfigFFmpegDto>>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = SystemConfigFFmpegDto.listFromJson(entry.value, growable: growable,);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'crf',
'preset',
'targetVideoCodec',
'targetAudioCodec',
'targetScaling',
};
}

View File

@@ -1,94 +0,0 @@
//
// 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 SystemConfigKey {
/// Instantiate a new enum with the provided [value].
const SystemConfigKey._(this.value);
/// The underlying value of this enum member.
final String value;
@override
String toString() => value;
String toJson() => value;
static const crf = SystemConfigKey._(r'ffmpeg_crf');
static const preset = SystemConfigKey._(r'ffmpeg_preset');
static const targetVideoCodec = SystemConfigKey._(r'ffmpeg_target_video_codec');
static const targetAudioCodec = SystemConfigKey._(r'ffmpeg_target_audio_codec');
static const targetScaling = SystemConfigKey._(r'ffmpeg_target_scaling');
/// List of all possible values in this [enum][SystemConfigKey].
static const values = <SystemConfigKey>[
crf,
preset,
targetVideoCodec,
targetAudioCodec,
targetScaling,
];
static SystemConfigKey? fromJson(dynamic value) => SystemConfigKeyTypeTransformer().decode(value);
static List<SystemConfigKey>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <SystemConfigKey>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = SystemConfigKey.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
}
/// Transformation class that can [encode] an instance of [SystemConfigKey] to String,
/// and [decode] dynamic data back to [SystemConfigKey].
class SystemConfigKeyTypeTransformer {
factory SystemConfigKeyTypeTransformer() => _instance ??= const SystemConfigKeyTypeTransformer._();
const SystemConfigKeyTypeTransformer._();
String encode(SystemConfigKey data) => data.value;
/// Decodes a [dynamic value][data] to a SystemConfigKey.
///
/// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully,
/// then null is returned. However, if [allowNull] is false and the [dynamic value][data]
/// cannot be decoded successfully, then an [UnimplementedError] is thrown.
///
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
/// and users are still using an old app with the old code.
SystemConfigKey? decode(dynamic data, {bool allowNull = true}) {
if (data != null) {
switch (data.toString()) {
case r'ffmpeg_crf': return SystemConfigKey.crf;
case r'ffmpeg_preset': return SystemConfigKey.preset;
case r'ffmpeg_target_video_codec': return SystemConfigKey.targetVideoCodec;
case r'ffmpeg_target_audio_codec': return SystemConfigKey.targetAudioCodec;
case r'ffmpeg_target_scaling': return SystemConfigKey.targetScaling;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');
}
}
}
return null;
}
/// Singleton [SystemConfigKeyTypeTransformer] instance.
static SystemConfigKeyTypeTransformer? _instance;
}

View File

@@ -0,0 +1,159 @@
//
// 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 SystemConfigOAuthDto {
/// Returns a new [SystemConfigOAuthDto] instance.
SystemConfigOAuthDto({
required this.enabled,
required this.issuerUrl,
required this.clientId,
required this.clientSecret,
required this.scope,
required this.buttonText,
required this.autoRegister,
});
bool enabled;
String issuerUrl;
String clientId;
String clientSecret;
String scope;
String buttonText;
bool autoRegister;
@override
bool operator ==(Object other) => identical(this, other) || other is SystemConfigOAuthDto &&
other.enabled == enabled &&
other.issuerUrl == issuerUrl &&
other.clientId == clientId &&
other.clientSecret == clientSecret &&
other.scope == scope &&
other.buttonText == buttonText &&
other.autoRegister == autoRegister;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(enabled.hashCode) +
(issuerUrl.hashCode) +
(clientId.hashCode) +
(clientSecret.hashCode) +
(scope.hashCode) +
(buttonText.hashCode) +
(autoRegister.hashCode);
@override
String toString() => 'SystemConfigOAuthDto[enabled=$enabled, issuerUrl=$issuerUrl, clientId=$clientId, clientSecret=$clientSecret, scope=$scope, buttonText=$buttonText, autoRegister=$autoRegister]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'enabled'] = enabled;
_json[r'issuerUrl'] = issuerUrl;
_json[r'clientId'] = clientId;
_json[r'clientSecret'] = clientSecret;
_json[r'scope'] = scope;
_json[r'buttonText'] = buttonText;
_json[r'autoRegister'] = autoRegister;
return _json;
}
/// Returns a new [SystemConfigOAuthDto] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static SystemConfigOAuthDto? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
// Ensure that the map contains the required keys.
// Note 1: the values aren't checked for validity beyond being non-null.
// Note 2: this code is stripped in release mode!
assert(() {
requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "SystemConfigOAuthDto[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "SystemConfigOAuthDto[$key]" has a null value in JSON.');
});
return true;
}());
return SystemConfigOAuthDto(
enabled: mapValueOfType<bool>(json, r'enabled')!,
issuerUrl: mapValueOfType<String>(json, r'issuerUrl')!,
clientId: mapValueOfType<String>(json, r'clientId')!,
clientSecret: mapValueOfType<String>(json, r'clientSecret')!,
scope: mapValueOfType<String>(json, r'scope')!,
buttonText: mapValueOfType<String>(json, r'buttonText')!,
autoRegister: mapValueOfType<bool>(json, r'autoRegister')!,
);
}
return null;
}
static List<SystemConfigOAuthDto>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <SystemConfigOAuthDto>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = SystemConfigOAuthDto.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, SystemConfigOAuthDto> mapFromJson(dynamic json) {
final map = <String, SystemConfigOAuthDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = SystemConfigOAuthDto.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of SystemConfigOAuthDto-objects as value to a dart map
static Map<String, List<SystemConfigOAuthDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<SystemConfigOAuthDto>>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = SystemConfigOAuthDto.listFromJson(entry.value, growable: growable,);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'enabled',
'issuerUrl',
'clientId',
'clientSecret',
'scope',
'buttonText',
'autoRegister',
};
}

View File

@@ -1,135 +0,0 @@
//
// 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 SystemConfigResponseItem {
/// Returns a new [SystemConfigResponseItem] instance.
SystemConfigResponseItem({
required this.name,
required this.key,
required this.value,
required this.defaultValue,
});
String name;
SystemConfigKey key;
String value;
String defaultValue;
@override
bool operator ==(Object other) => identical(this, other) || other is SystemConfigResponseItem &&
other.name == name &&
other.key == key &&
other.value == value &&
other.defaultValue == defaultValue;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(name.hashCode) +
(key.hashCode) +
(value.hashCode) +
(defaultValue.hashCode);
@override
String toString() => 'SystemConfigResponseItem[name=$name, key=$key, value=$value, defaultValue=$defaultValue]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'name'] = name;
_json[r'key'] = key;
_json[r'value'] = value;
_json[r'defaultValue'] = defaultValue;
return _json;
}
/// Returns a new [SystemConfigResponseItem] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static SystemConfigResponseItem? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
// Ensure that the map contains the required keys.
// Note 1: the values aren't checked for validity beyond being non-null.
// Note 2: this code is stripped in release mode!
assert(() {
requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "SystemConfigResponseItem[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "SystemConfigResponseItem[$key]" has a null value in JSON.');
});
return true;
}());
return SystemConfigResponseItem(
name: mapValueOfType<String>(json, r'name')!,
key: SystemConfigKey.fromJson(json[r'key'])!,
value: mapValueOfType<String>(json, r'value')!,
defaultValue: mapValueOfType<String>(json, r'defaultValue')!,
);
}
return null;
}
static List<SystemConfigResponseItem>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <SystemConfigResponseItem>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = SystemConfigResponseItem.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, SystemConfigResponseItem> mapFromJson(dynamic json) {
final map = <String, SystemConfigResponseItem>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = SystemConfigResponseItem.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of SystemConfigResponseItem-objects as value to a dart map
static Map<String, List<SystemConfigResponseItem>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<SystemConfigResponseItem>>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = SystemConfigResponseItem.listFromJson(entry.value, growable: growable,);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'name',
'key',
'value',
'defaultValue',
};
}

View File

@@ -17,12 +17,17 @@ void main() {
// final instance = SystemConfigApi();
group('tests for SystemConfigApi', () {
//Future<SystemConfigResponseDto> getConfig() async
//Future<SystemConfigDto> getConfig() async
test('test getConfig', () async {
// TODO
});
//Future<SystemConfigResponseDto> updateConfig(Object body) async
//Future<SystemConfigDto> getDefaults() async
test('test getDefaults', () async {
// TODO
});
//Future<SystemConfigDto> updateConfig(SystemConfigDto systemConfigDto) async
test('test updateConfig', () async {
// TODO
});

View File

@@ -11,13 +11,18 @@
import 'package:openapi/api.dart';
import 'package:test/test.dart';
// tests for SystemConfigResponseDto
// tests for SystemConfigDto
void main() {
// final instance = SystemConfigResponseDto();
// final instance = SystemConfigDto();
group('test SystemConfigResponseDto', () {
// List<SystemConfigResponseItem> config (default value: const [])
test('to test the property `config`', () async {
group('test SystemConfigDto', () {
// SystemConfigFFmpegDto ffmpeg
test('to test the property `ffmpeg`', () async {
// TODO
});
// SystemConfigOAuthDto oauth
test('to test the property `oauth`', () async {
// TODO
});

View File

@@ -0,0 +1,47 @@
//
// 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 SystemConfigFFmpegDto
void main() {
// final instance = SystemConfigFFmpegDto();
group('test SystemConfigFFmpegDto', () {
// String crf
test('to test the property `crf`', () async {
// TODO
});
// String preset
test('to test the property `preset`', () async {
// TODO
});
// String targetVideoCodec
test('to test the property `targetVideoCodec`', () async {
// TODO
});
// String targetAudioCodec
test('to test the property `targetAudioCodec`', () async {
// TODO
});
// String targetScaling
test('to test the property `targetScaling`', () async {
// TODO
});
});
}

View File

@@ -1,21 +0,0 @@
//
// 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 SystemConfigKey
void main() {
group('test SystemConfigKey', () {
});
}

View File

@@ -0,0 +1,57 @@
//
// 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 SystemConfigOAuthDto
void main() {
// final instance = SystemConfigOAuthDto();
group('test SystemConfigOAuthDto', () {
// bool enabled
test('to test the property `enabled`', () async {
// TODO
});
// String issuerUrl
test('to test the property `issuerUrl`', () async {
// TODO
});
// String clientId
test('to test the property `clientId`', () async {
// TODO
});
// String clientSecret
test('to test the property `clientSecret`', () async {
// TODO
});
// String scope
test('to test the property `scope`', () async {
// TODO
});
// String buttonText
test('to test the property `buttonText`', () async {
// TODO
});
// bool autoRegister
test('to test the property `autoRegister`', () async {
// TODO
});
});
}

View File

@@ -1,42 +0,0 @@
//
// 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 SystemConfigResponseItem
void main() {
// final instance = SystemConfigResponseItem();
group('test SystemConfigResponseItem', () {
// String name
test('to test the property `name`', () async {
// TODO
});
// SystemConfigKey key
test('to test the property `key`', () async {
// TODO
});
// String value
test('to test the property `value`', () async {
// TODO
});
// String defaultValue
test('to test the property `defaultValue`', () async {
// TODO
});
});
}