2022-07-13 14:23:48 +02:00
|
|
|
//
|
|
|
|
// 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 ApiClient {
|
2023-04-09 04:26:09 +02:00
|
|
|
ApiClient({this.basePath = '/api', this.authentication,});
|
2022-07-13 14:23:48 +02:00
|
|
|
|
|
|
|
final String basePath;
|
2023-04-09 04:26:09 +02:00
|
|
|
final Authentication? authentication;
|
2022-07-13 14:23:48 +02:00
|
|
|
|
|
|
|
var _client = Client();
|
2023-04-09 04:26:09 +02:00
|
|
|
final _defaultHeaderMap = <String, String>{};
|
2022-07-13 14:23:48 +02:00
|
|
|
|
|
|
|
/// Returns the current HTTP [Client] instance to use in this class.
|
|
|
|
///
|
|
|
|
/// The return value is guaranteed to never be null.
|
|
|
|
Client get client => _client;
|
|
|
|
|
|
|
|
/// Requests to use a new HTTP [Client] in this class.
|
|
|
|
set client(Client newClient) {
|
|
|
|
_client = newClient;
|
|
|
|
}
|
|
|
|
|
2023-04-09 04:26:09 +02:00
|
|
|
Map<String, String> get defaultHeaderMap => _defaultHeaderMap;
|
2022-07-13 14:23:48 +02:00
|
|
|
|
|
|
|
void addDefaultHeader(String key, String value) {
|
|
|
|
_defaultHeaderMap[key] = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
// We don't use a Map<String, String> for queryParams.
|
|
|
|
// If collectionFormat is 'multi', a key might appear multiple times.
|
|
|
|
Future<Response> invokeAPI(
|
|
|
|
String path,
|
|
|
|
String method,
|
|
|
|
List<QueryParam> queryParams,
|
|
|
|
Object? body,
|
|
|
|
Map<String, String> headerParams,
|
|
|
|
Map<String, String> formParams,
|
|
|
|
String? contentType,
|
|
|
|
) async {
|
2023-04-09 04:26:09 +02:00
|
|
|
await authentication?.applyToParams(queryParams, headerParams);
|
2022-07-13 14:23:48 +02:00
|
|
|
|
|
|
|
headerParams.addAll(_defaultHeaderMap);
|
|
|
|
if (contentType != null) {
|
|
|
|
headerParams['Content-Type'] = contentType;
|
|
|
|
}
|
|
|
|
|
|
|
|
final urlEncodedQueryParams = queryParams.map((param) => '$param');
|
|
|
|
final queryString = urlEncodedQueryParams.isNotEmpty ? '?${urlEncodedQueryParams.join('&')}' : '';
|
|
|
|
final uri = Uri.parse('$basePath$path$queryString');
|
|
|
|
|
|
|
|
try {
|
|
|
|
// Special case for uploading a single file which isn't a 'multipart/form-data'.
|
|
|
|
if (
|
|
|
|
body is MultipartFile && (contentType == null ||
|
|
|
|
!contentType.toLowerCase().startsWith('multipart/form-data'))
|
|
|
|
) {
|
|
|
|
final request = StreamedRequest(method, uri);
|
|
|
|
request.headers.addAll(headerParams);
|
|
|
|
request.contentLength = body.length;
|
|
|
|
body.finalize().listen(
|
|
|
|
request.sink.add,
|
|
|
|
onDone: request.sink.close,
|
|
|
|
// ignore: avoid_types_on_closure_parameters
|
|
|
|
onError: (Object error, StackTrace trace) => request.sink.close(),
|
|
|
|
cancelOnError: true,
|
|
|
|
);
|
|
|
|
final response = await _client.send(request);
|
|
|
|
return Response.fromStream(response);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (body is MultipartRequest) {
|
|
|
|
final request = MultipartRequest(method, uri);
|
|
|
|
request.fields.addAll(body.fields);
|
|
|
|
request.files.addAll(body.files);
|
|
|
|
request.headers.addAll(body.headers);
|
|
|
|
request.headers.addAll(headerParams);
|
|
|
|
final response = await _client.send(request);
|
|
|
|
return Response.fromStream(response);
|
|
|
|
}
|
|
|
|
|
|
|
|
final msgBody = contentType == 'application/x-www-form-urlencoded'
|
|
|
|
? formParams
|
|
|
|
: await serializeAsync(body);
|
|
|
|
final nullableHeaderParams = headerParams.isEmpty ? null : headerParams;
|
|
|
|
|
|
|
|
switch(method) {
|
|
|
|
case 'POST': return await _client.post(uri, headers: nullableHeaderParams, body: msgBody,);
|
|
|
|
case 'PUT': return await _client.put(uri, headers: nullableHeaderParams, body: msgBody,);
|
|
|
|
case 'DELETE': return await _client.delete(uri, headers: nullableHeaderParams, body: msgBody,);
|
|
|
|
case 'PATCH': return await _client.patch(uri, headers: nullableHeaderParams, body: msgBody,);
|
|
|
|
case 'HEAD': return await _client.head(uri, headers: nullableHeaderParams,);
|
|
|
|
case 'GET': return await _client.get(uri, headers: nullableHeaderParams,);
|
|
|
|
}
|
|
|
|
} on SocketException catch (error, trace) {
|
|
|
|
throw ApiException.withInner(
|
|
|
|
HttpStatus.badRequest,
|
|
|
|
'Socket operation failed: $method $path',
|
|
|
|
error,
|
|
|
|
trace,
|
|
|
|
);
|
|
|
|
} on TlsException catch (error, trace) {
|
|
|
|
throw ApiException.withInner(
|
|
|
|
HttpStatus.badRequest,
|
|
|
|
'TLS/SSL communication failed: $method $path',
|
|
|
|
error,
|
|
|
|
trace,
|
|
|
|
);
|
|
|
|
} on IOException catch (error, trace) {
|
|
|
|
throw ApiException.withInner(
|
|
|
|
HttpStatus.badRequest,
|
|
|
|
'I/O operation failed: $method $path',
|
|
|
|
error,
|
|
|
|
trace,
|
|
|
|
);
|
|
|
|
} on ClientException catch (error, trace) {
|
|
|
|
throw ApiException.withInner(
|
|
|
|
HttpStatus.badRequest,
|
|
|
|
'HTTP connection failed: $method $path',
|
|
|
|
error,
|
|
|
|
trace,
|
|
|
|
);
|
|
|
|
} on Exception catch (error, trace) {
|
|
|
|
throw ApiException.withInner(
|
|
|
|
HttpStatus.badRequest,
|
|
|
|
'Exception occurred: $method $path',
|
|
|
|
error,
|
|
|
|
trace,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
throw ApiException(
|
|
|
|
HttpStatus.badRequest,
|
|
|
|
'Invalid HTTP operation: $method $path',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2024-01-26 18:40:28 +02:00
|
|
|
Future<dynamic> deserializeAsync(String value, String targetType, {bool growable = false,}) =>
|
2022-07-13 14:23:48 +02:00
|
|
|
// ignore: deprecated_member_use_from_same_package
|
2024-01-26 18:40:28 +02:00
|
|
|
deserialize(value, targetType, growable: growable);
|
2022-07-13 14:23:48 +02:00
|
|
|
|
|
|
|
@Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use deserializeAsync() instead.')
|
2024-01-26 18:40:28 +02:00
|
|
|
Future<dynamic> deserialize(String value, String targetType, {bool growable = false,}) async {
|
2022-07-13 14:23:48 +02:00
|
|
|
// Remove all spaces. Necessary for regular expressions as well.
|
|
|
|
targetType = targetType.replaceAll(' ', ''); // ignore: parameter_assignments
|
|
|
|
|
|
|
|
// If the expected target type is String, nothing to do...
|
|
|
|
return targetType == 'String'
|
2024-01-26 18:40:28 +02:00
|
|
|
? value
|
|
|
|
: fromJson(await compute((String j) => json.decode(j), value), targetType, growable: growable);
|
2022-07-13 14:23:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// ignore: deprecated_member_use_from_same_package
|
|
|
|
Future<String> serializeAsync(Object? value) async => serialize(value);
|
|
|
|
|
|
|
|
@Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use serializeAsync() instead.')
|
|
|
|
String serialize(Object? value) => value == null ? '' : json.encode(value);
|
|
|
|
|
2024-01-26 18:40:28 +02:00
|
|
|
/// Returns a native instance of an OpenAPI class matching the [specified type][targetType].
|
|
|
|
static dynamic fromJson(dynamic value, String targetType, {bool growable = false,}) {
|
2022-07-13 14:23:48 +02:00
|
|
|
try {
|
|
|
|
switch (targetType) {
|
|
|
|
case 'String':
|
|
|
|
return value is String ? value : value.toString();
|
|
|
|
case 'int':
|
|
|
|
return value is int ? value : int.parse('$value');
|
|
|
|
case 'double':
|
|
|
|
return value is double ? value : double.parse('$value');
|
|
|
|
case 'bool':
|
|
|
|
if (value is bool) {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
final valueString = '$value'.toLowerCase();
|
|
|
|
return valueString == 'true' || valueString == '1';
|
|
|
|
case 'DateTime':
|
|
|
|
return value is DateTime ? value : DateTime.tryParse(value);
|
2023-01-02 22:22:33 +02:00
|
|
|
case 'APIKeyCreateDto':
|
|
|
|
return APIKeyCreateDto.fromJson(value);
|
|
|
|
case 'APIKeyCreateResponseDto':
|
|
|
|
return APIKeyCreateResponseDto.fromJson(value);
|
|
|
|
case 'APIKeyResponseDto':
|
|
|
|
return APIKeyResponseDto.fromJson(value);
|
|
|
|
case 'APIKeyUpdateDto':
|
|
|
|
return APIKeyUpdateDto.fromJson(value);
|
2023-11-01 05:13:34 +02:00
|
|
|
case 'ActivityCreateDto':
|
|
|
|
return ActivityCreateDto.fromJson(value);
|
|
|
|
case 'ActivityResponseDto':
|
|
|
|
return ActivityResponseDto.fromJson(value);
|
|
|
|
case 'ActivityStatisticsResponseDto':
|
|
|
|
return ActivityStatisticsResponseDto.fromJson(value);
|
2022-07-13 14:23:48 +02:00
|
|
|
case 'AddUsersDto':
|
|
|
|
return AddUsersDto.fromJson(value);
|
2022-09-07 22:16:18 +02:00
|
|
|
case 'AlbumCountResponseDto':
|
|
|
|
return AlbumCountResponseDto.fromJson(value);
|
2022-07-13 14:23:48 +02:00
|
|
|
case 'AlbumResponseDto':
|
|
|
|
return AlbumResponseDto.fromJson(value);
|
2022-10-06 18:25:54 +02:00
|
|
|
case 'AllJobStatusResponseDto':
|
|
|
|
return AllJobStatusResponseDto.fromJson(value);
|
2023-10-06 09:01:14 +02:00
|
|
|
case 'AssetBulkDeleteDto':
|
|
|
|
return AssetBulkDeleteDto.fromJson(value);
|
2023-08-16 22:04:55 +02:00
|
|
|
case 'AssetBulkUpdateDto':
|
|
|
|
return AssetBulkUpdateDto.fromJson(value);
|
2023-05-24 23:08:21 +02:00
|
|
|
case 'AssetBulkUploadCheckDto':
|
|
|
|
return AssetBulkUploadCheckDto.fromJson(value);
|
|
|
|
case 'AssetBulkUploadCheckItem':
|
|
|
|
return AssetBulkUploadCheckItem.fromJson(value);
|
|
|
|
case 'AssetBulkUploadCheckResponseDto':
|
|
|
|
return AssetBulkUploadCheckResponseDto.fromJson(value);
|
|
|
|
case 'AssetBulkUploadCheckResult':
|
|
|
|
return AssetBulkUploadCheckResult.fromJson(value);
|
2023-12-05 17:43:15 +02:00
|
|
|
case 'AssetFaceResponseDto':
|
|
|
|
return AssetFaceResponseDto.fromJson(value);
|
|
|
|
case 'AssetFaceUpdateDto':
|
|
|
|
return AssetFaceUpdateDto.fromJson(value);
|
|
|
|
case 'AssetFaceUpdateItem':
|
|
|
|
return AssetFaceUpdateItem.fromJson(value);
|
|
|
|
case 'AssetFaceWithoutPersonResponseDto':
|
|
|
|
return AssetFaceWithoutPersonResponseDto.fromJson(value);
|
2022-07-13 14:23:48 +02:00
|
|
|
case 'AssetFileUploadResponseDto':
|
|
|
|
return AssetFileUploadResponseDto.fromJson(value);
|
2023-06-01 03:51:28 +02:00
|
|
|
case 'AssetIdsDto':
|
|
|
|
return AssetIdsDto.fromJson(value);
|
|
|
|
case 'AssetIdsResponseDto':
|
|
|
|
return AssetIdsResponseDto.fromJson(value);
|
2023-08-18 16:31:48 +02:00
|
|
|
case 'AssetJobName':
|
|
|
|
return AssetJobNameTypeTransformer().decode(value);
|
|
|
|
case 'AssetJobsDto':
|
|
|
|
return AssetJobsDto.fromJson(value);
|
2023-11-15 00:47:15 +02:00
|
|
|
case 'AssetOrder':
|
|
|
|
return AssetOrderTypeTransformer().decode(value);
|
2022-07-13 14:23:48 +02:00
|
|
|
case 'AssetResponseDto':
|
|
|
|
return AssetResponseDto.fromJson(value);
|
2023-07-14 15:30:17 +02:00
|
|
|
case 'AssetStatsResponseDto':
|
|
|
|
return AssetStatsResponseDto.fromJson(value);
|
2022-07-13 14:23:48 +02:00
|
|
|
case 'AssetTypeEnum':
|
|
|
|
return AssetTypeEnumTypeTransformer().decode(value);
|
2023-07-09 04:43:11 +02:00
|
|
|
case 'AudioCodec':
|
|
|
|
return AudioCodecTypeTransformer().decode(value);
|
2023-08-24 21:28:50 +02:00
|
|
|
case 'AuditDeletesResponseDto':
|
|
|
|
return AuditDeletesResponseDto.fromJson(value);
|
2023-04-26 04:19:23 +02:00
|
|
|
case 'AuthDeviceResponseDto':
|
|
|
|
return AuthDeviceResponseDto.fromJson(value);
|
2023-07-11 23:52:41 +02:00
|
|
|
case 'BulkIdResponseDto':
|
|
|
|
return BulkIdResponseDto.fromJson(value);
|
2023-08-02 03:29:14 +02:00
|
|
|
case 'BulkIdsDto':
|
|
|
|
return BulkIdsDto.fromJson(value);
|
2023-08-29 15:58:00 +02:00
|
|
|
case 'CLIPConfig':
|
|
|
|
return CLIPConfig.fromJson(value);
|
|
|
|
case 'CLIPMode':
|
|
|
|
return CLIPModeTypeTransformer().decode(value);
|
2023-09-03 03:22:42 +02:00
|
|
|
case 'CQMode':
|
|
|
|
return CQModeTypeTransformer().decode(value);
|
2022-12-21 16:43:35 +02:00
|
|
|
case 'ChangePasswordDto':
|
|
|
|
return ChangePasswordDto.fromJson(value);
|
2022-10-25 16:51:03 +02:00
|
|
|
case 'CheckExistingAssetsDto':
|
|
|
|
return CheckExistingAssetsDto.fromJson(value);
|
|
|
|
case 'CheckExistingAssetsResponseDto':
|
|
|
|
return CheckExistingAssetsResponseDto.fromJson(value);
|
2023-09-03 08:21:51 +02:00
|
|
|
case 'Colorspace':
|
|
|
|
return ColorspaceTypeTransformer().decode(value);
|
2022-07-13 14:23:48 +02:00
|
|
|
case 'CreateAlbumDto':
|
|
|
|
return CreateAlbumDto.fromJson(value);
|
2023-09-20 13:16:33 +02:00
|
|
|
case 'CreateLibraryDto':
|
|
|
|
return CreateLibraryDto.fromJson(value);
|
2022-07-13 14:23:48 +02:00
|
|
|
case 'CreateProfileImageResponseDto':
|
|
|
|
return CreateProfileImageResponseDto.fromJson(value);
|
2022-12-05 19:56:44 +02:00
|
|
|
case 'CreateTagDto':
|
|
|
|
return CreateTagDto.fromJson(value);
|
2022-07-13 14:23:48 +02:00
|
|
|
case 'CreateUserDto':
|
|
|
|
return CreateUserDto.fromJson(value);
|
|
|
|
case 'CuratedLocationsResponseDto':
|
|
|
|
return CuratedLocationsResponseDto.fromJson(value);
|
|
|
|
case 'CuratedObjectsResponseDto':
|
|
|
|
return CuratedObjectsResponseDto.fromJson(value);
|
2024-03-09 00:49:39 +02:00
|
|
|
case 'DeleteUserDto':
|
|
|
|
return DeleteUserDto.fromJson(value);
|
2023-06-30 18:24:28 +02:00
|
|
|
case 'DownloadArchiveInfo':
|
|
|
|
return DownloadArchiveInfo.fromJson(value);
|
2023-08-15 17:49:32 +02:00
|
|
|
case 'DownloadInfoDto':
|
|
|
|
return DownloadInfoDto.fromJson(value);
|
2023-06-30 18:24:28 +02:00
|
|
|
case 'DownloadResponseDto':
|
|
|
|
return DownloadResponseDto.fromJson(value);
|
2023-08-24 21:28:50 +02:00
|
|
|
case 'EntityType':
|
|
|
|
return EntityTypeTypeTransformer().decode(value);
|
2022-07-13 14:23:48 +02:00
|
|
|
case 'ExifResponseDto':
|
|
|
|
return ExifResponseDto.fromJson(value);
|
2023-12-05 17:43:15 +02:00
|
|
|
case 'FaceDto':
|
|
|
|
return FaceDto.fromJson(value);
|
2023-10-14 19:12:59 +02:00
|
|
|
case 'FileChecksumDto':
|
|
|
|
return FileChecksumDto.fromJson(value);
|
|
|
|
case 'FileChecksumResponseDto':
|
|
|
|
return FileChecksumResponseDto.fromJson(value);
|
|
|
|
case 'FileReportDto':
|
|
|
|
return FileReportDto.fromJson(value);
|
|
|
|
case 'FileReportFixDto':
|
|
|
|
return FileReportFixDto.fromJson(value);
|
|
|
|
case 'FileReportItemDto':
|
|
|
|
return FileReportItemDto.fromJson(value);
|
2024-04-02 06:56:56 +02:00
|
|
|
case 'ImageFormat':
|
|
|
|
return ImageFormatTypeTransformer().decode(value);
|
2022-10-06 18:25:54 +02:00
|
|
|
case 'JobCommand':
|
|
|
|
return JobCommandTypeTransformer().decode(value);
|
|
|
|
case 'JobCommandDto':
|
|
|
|
return JobCommandDto.fromJson(value);
|
2023-03-20 17:55:28 +02:00
|
|
|
case 'JobCountsDto':
|
|
|
|
return JobCountsDto.fromJson(value);
|
|
|
|
case 'JobName':
|
|
|
|
return JobNameTypeTransformer().decode(value);
|
2023-06-01 12:32:51 +02:00
|
|
|
case 'JobSettingsDto':
|
|
|
|
return JobSettingsDto.fromJson(value);
|
2023-04-01 22:46:07 +02:00
|
|
|
case 'JobStatusDto':
|
|
|
|
return JobStatusDto.fromJson(value);
|
2023-09-20 13:16:33 +02:00
|
|
|
case 'LibraryResponseDto':
|
|
|
|
return LibraryResponseDto.fromJson(value);
|
|
|
|
case 'LibraryStatsResponseDto':
|
|
|
|
return LibraryStatsResponseDto.fromJson(value);
|
|
|
|
case 'LibraryType':
|
|
|
|
return LibraryTypeTypeTransformer().decode(value);
|
2023-12-14 18:55:40 +02:00
|
|
|
case 'LogLevel':
|
|
|
|
return LogLevelTypeTransformer().decode(value);
|
2022-07-13 14:23:48 +02:00
|
|
|
case 'LoginCredentialDto':
|
|
|
|
return LoginCredentialDto.fromJson(value);
|
|
|
|
case 'LoginResponseDto':
|
|
|
|
return LoginResponseDto.fromJson(value);
|
2022-07-19 20:49:58 +02:00
|
|
|
case 'LogoutResponseDto':
|
|
|
|
return LogoutResponseDto.fromJson(value);
|
2023-05-06 03:33:30 +02:00
|
|
|
case 'MapMarkerResponseDto':
|
|
|
|
return MapMarkerResponseDto.fromJson(value);
|
2023-11-09 18:10:56 +02:00
|
|
|
case 'MapTheme':
|
|
|
|
return MapThemeTypeTransformer().decode(value);
|
2024-04-02 16:23:17 +02:00
|
|
|
case 'MemoryCreateDto':
|
|
|
|
return MemoryCreateDto.fromJson(value);
|
2023-06-15 03:47:18 +02:00
|
|
|
case 'MemoryLaneResponseDto':
|
|
|
|
return MemoryLaneResponseDto.fromJson(value);
|
2024-04-02 16:23:17 +02:00
|
|
|
case 'MemoryResponseDto':
|
|
|
|
return MemoryResponseDto.fromJson(value);
|
|
|
|
case 'MemoryType':
|
|
|
|
return MemoryTypeTypeTransformer().decode(value);
|
|
|
|
case 'MemoryUpdateDto':
|
|
|
|
return MemoryUpdateDto.fromJson(value);
|
2023-07-11 23:52:41 +02:00
|
|
|
case 'MergePersonDto':
|
|
|
|
return MergePersonDto.fromJson(value);
|
2024-02-17 19:00:55 +02:00
|
|
|
case 'MetadataSearchDto':
|
|
|
|
return MetadataSearchDto.fromJson(value);
|
2023-08-29 15:58:00 +02:00
|
|
|
case 'ModelType':
|
|
|
|
return ModelTypeTypeTransformer().decode(value);
|
2023-09-01 13:08:42 +02:00
|
|
|
case 'OAuthAuthorizeResponseDto':
|
|
|
|
return OAuthAuthorizeResponseDto.fromJson(value);
|
2022-11-15 04:24:25 +02:00
|
|
|
case 'OAuthCallbackDto':
|
|
|
|
return OAuthCallbackDto.fromJson(value);
|
|
|
|
case 'OAuthConfigDto':
|
|
|
|
return OAuthConfigDto.fromJson(value);
|
2024-04-02 21:21:58 +02:00
|
|
|
case 'OnThisDayDto':
|
|
|
|
return OnThisDayDto.fromJson(value);
|
2023-11-11 23:06:19 +02:00
|
|
|
case 'PartnerResponseDto':
|
|
|
|
return PartnerResponseDto.fromJson(value);
|
2023-10-14 19:12:59 +02:00
|
|
|
case 'PathEntityType':
|
|
|
|
return PathEntityTypeTypeTransformer().decode(value);
|
|
|
|
case 'PathType':
|
|
|
|
return PathTypeTypeTransformer().decode(value);
|
2023-07-18 20:09:43 +02:00
|
|
|
case 'PeopleResponseDto':
|
|
|
|
return PeopleResponseDto.fromJson(value);
|
2023-07-23 05:00:43 +02:00
|
|
|
case 'PeopleUpdateDto':
|
|
|
|
return PeopleUpdateDto.fromJson(value);
|
|
|
|
case 'PeopleUpdateItem':
|
|
|
|
return PeopleUpdateItem.fromJson(value);
|
2024-03-07 22:34:57 +02:00
|
|
|
case 'PersonCreateDto':
|
|
|
|
return PersonCreateDto.fromJson(value);
|
2023-05-17 19:07:17 +02:00
|
|
|
case 'PersonResponseDto':
|
|
|
|
return PersonResponseDto.fromJson(value);
|
2023-10-24 17:53:49 +02:00
|
|
|
case 'PersonStatisticsResponseDto':
|
|
|
|
return PersonStatisticsResponseDto.fromJson(value);
|
2023-05-17 19:07:17 +02:00
|
|
|
case 'PersonUpdateDto':
|
|
|
|
return PersonUpdateDto.fromJson(value);
|
2023-12-05 17:43:15 +02:00
|
|
|
case 'PersonWithFacesResponseDto':
|
|
|
|
return PersonWithFacesResponseDto.fromJson(value);
|
2024-02-24 02:42:37 +02:00
|
|
|
case 'PlacesResponseDto':
|
|
|
|
return PlacesResponseDto.fromJson(value);
|
2023-04-01 22:46:07 +02:00
|
|
|
case 'QueueStatusDto':
|
|
|
|
return QueueStatusDto.fromJson(value);
|
2023-11-10 04:32:31 +02:00
|
|
|
case 'ReactionLevel':
|
|
|
|
return ReactionLevelTypeTransformer().decode(value);
|
2023-11-01 05:13:34 +02:00
|
|
|
case 'ReactionType':
|
|
|
|
return ReactionTypeTypeTransformer().decode(value);
|
2023-08-29 15:58:00 +02:00
|
|
|
case 'RecognitionConfig':
|
|
|
|
return RecognitionConfig.fromJson(value);
|
2023-09-20 13:16:33 +02:00
|
|
|
case 'ScanLibraryDto':
|
|
|
|
return ScanLibraryDto.fromJson(value);
|
2023-03-03 04:47:08 +02:00
|
|
|
case 'SearchAlbumResponseDto':
|
|
|
|
return SearchAlbumResponseDto.fromJson(value);
|
|
|
|
case 'SearchAssetResponseDto':
|
|
|
|
return SearchAssetResponseDto.fromJson(value);
|
2023-03-05 22:44:31 +02:00
|
|
|
case 'SearchExploreItem':
|
|
|
|
return SearchExploreItem.fromJson(value);
|
|
|
|
case 'SearchExploreResponseDto':
|
|
|
|
return SearchExploreResponseDto.fromJson(value);
|
2023-03-03 04:47:08 +02:00
|
|
|
case 'SearchFacetCountResponseDto':
|
|
|
|
return SearchFacetCountResponseDto.fromJson(value);
|
|
|
|
case 'SearchFacetResponseDto':
|
|
|
|
return SearchFacetResponseDto.fromJson(value);
|
|
|
|
case 'SearchResponseDto':
|
|
|
|
return SearchResponseDto.fromJson(value);
|
2024-02-13 21:54:58 +02:00
|
|
|
case 'SearchSuggestionType':
|
|
|
|
return SearchSuggestionTypeTypeTransformer().decode(value);
|
2023-09-09 04:51:46 +02:00
|
|
|
case 'ServerConfigDto':
|
|
|
|
return ServerConfigDto.fromJson(value);
|
2023-08-18 06:55:26 +02:00
|
|
|
case 'ServerFeaturesDto':
|
|
|
|
return ServerFeaturesDto.fromJson(value);
|
2022-07-13 14:23:48 +02:00
|
|
|
case 'ServerInfoResponseDto':
|
|
|
|
return ServerInfoResponseDto.fromJson(value);
|
2023-07-16 03:24:46 +02:00
|
|
|
case 'ServerMediaTypesResponseDto':
|
|
|
|
return ServerMediaTypesResponseDto.fromJson(value);
|
2022-07-13 14:23:48 +02:00
|
|
|
case 'ServerPingResponse':
|
|
|
|
return ServerPingResponse.fromJson(value);
|
2022-10-23 23:54:54 +02:00
|
|
|
case 'ServerStatsResponseDto':
|
|
|
|
return ServerStatsResponseDto.fromJson(value);
|
2023-10-26 00:13:05 +02:00
|
|
|
case 'ServerThemeDto':
|
|
|
|
return ServerThemeDto.fromJson(value);
|
2023-08-18 06:55:26 +02:00
|
|
|
case 'ServerVersionResponseDto':
|
|
|
|
return ServerVersionResponseDto.fromJson(value);
|
2023-06-21 03:08:43 +02:00
|
|
|
case 'SharedLinkCreateDto':
|
|
|
|
return SharedLinkCreateDto.fromJson(value);
|
|
|
|
case 'SharedLinkEditDto':
|
|
|
|
return SharedLinkEditDto.fromJson(value);
|
2023-01-09 22:16:08 +02:00
|
|
|
case 'SharedLinkResponseDto':
|
|
|
|
return SharedLinkResponseDto.fromJson(value);
|
|
|
|
case 'SharedLinkType':
|
|
|
|
return SharedLinkTypeTypeTransformer().decode(value);
|
2022-07-13 14:23:48 +02:00
|
|
|
case 'SignUpDto':
|
|
|
|
return SignUpDto.fromJson(value);
|
|
|
|
case 'SmartInfoResponseDto':
|
|
|
|
return SmartInfoResponseDto.fromJson(value);
|
2024-02-17 19:00:55 +02:00
|
|
|
case 'SmartSearchDto':
|
|
|
|
return SmartSearchDto.fromJson(value);
|
2022-12-09 22:51:42 +02:00
|
|
|
case 'SystemConfigDto':
|
|
|
|
return SystemConfigDto.fromJson(value);
|
|
|
|
case 'SystemConfigFFmpegDto':
|
|
|
|
return SystemConfigFFmpegDto.fromJson(value);
|
2024-04-02 06:56:56 +02:00
|
|
|
case 'SystemConfigImageDto':
|
|
|
|
return SystemConfigImageDto.fromJson(value);
|
2023-06-01 12:32:51 +02:00
|
|
|
case 'SystemConfigJobDto':
|
|
|
|
return SystemConfigJobDto.fromJson(value);
|
2023-10-31 22:19:12 +02:00
|
|
|
case 'SystemConfigLibraryDto':
|
|
|
|
return SystemConfigLibraryDto.fromJson(value);
|
|
|
|
case 'SystemConfigLibraryScanDto':
|
|
|
|
return SystemConfigLibraryScanDto.fromJson(value);
|
2024-01-31 10:15:54 +02:00
|
|
|
case 'SystemConfigLibraryWatchDto':
|
|
|
|
return SystemConfigLibraryWatchDto.fromJson(value);
|
2023-12-14 18:55:40 +02:00
|
|
|
case 'SystemConfigLoggingDto':
|
|
|
|
return SystemConfigLoggingDto.fromJson(value);
|
2023-08-25 06:15:03 +02:00
|
|
|
case 'SystemConfigMachineLearningDto':
|
|
|
|
return SystemConfigMachineLearningDto.fromJson(value);
|
2023-09-09 04:51:46 +02:00
|
|
|
case 'SystemConfigMapDto':
|
|
|
|
return SystemConfigMapDto.fromJson(value);
|
2023-10-24 17:05:42 +02:00
|
|
|
case 'SystemConfigNewVersionCheckDto':
|
|
|
|
return SystemConfigNewVersionCheckDto.fromJson(value);
|
2022-12-09 22:51:42 +02:00
|
|
|
case 'SystemConfigOAuthDto':
|
|
|
|
return SystemConfigOAuthDto.fromJson(value);
|
2023-01-09 23:32:58 +02:00
|
|
|
case 'SystemConfigPasswordLoginDto':
|
|
|
|
return SystemConfigPasswordLoginDto.fromJson(value);
|
2023-09-26 09:03:57 +02:00
|
|
|
case 'SystemConfigReverseGeocodingDto':
|
|
|
|
return SystemConfigReverseGeocodingDto.fromJson(value);
|
2024-01-04 04:54:48 +02:00
|
|
|
case 'SystemConfigServerDto':
|
|
|
|
return SystemConfigServerDto.fromJson(value);
|
2022-12-16 22:26:12 +02:00
|
|
|
case 'SystemConfigStorageTemplateDto':
|
|
|
|
return SystemConfigStorageTemplateDto.fromJson(value);
|
|
|
|
case 'SystemConfigTemplateStorageOptionDto':
|
|
|
|
return SystemConfigTemplateStorageOptionDto.fromJson(value);
|
2023-10-23 20:38:41 +02:00
|
|
|
case 'SystemConfigThemeDto':
|
|
|
|
return SystemConfigThemeDto.fromJson(value);
|
2023-10-06 09:01:14 +02:00
|
|
|
case 'SystemConfigTrashDto':
|
|
|
|
return SystemConfigTrashDto.fromJson(value);
|
2024-03-06 07:45:40 +02:00
|
|
|
case 'SystemConfigUserDto':
|
|
|
|
return SystemConfigUserDto.fromJson(value);
|
2022-12-05 19:56:44 +02:00
|
|
|
case 'TagResponseDto':
|
|
|
|
return TagResponseDto.fromJson(value);
|
|
|
|
case 'TagTypeEnum':
|
|
|
|
return TagTypeEnumTypeTransformer().decode(value);
|
2022-07-16 06:18:17 +02:00
|
|
|
case 'ThumbnailFormat':
|
|
|
|
return ThumbnailFormatTypeTransformer().decode(value);
|
2023-08-04 23:07:15 +02:00
|
|
|
case 'TimeBucketResponseDto':
|
|
|
|
return TimeBucketResponseDto.fromJson(value);
|
|
|
|
case 'TimeBucketSize':
|
|
|
|
return TimeBucketSizeTypeTransformer().decode(value);
|
2023-08-07 22:35:25 +02:00
|
|
|
case 'ToneMapping':
|
|
|
|
return ToneMappingTypeTransformer().decode(value);
|
2023-08-02 03:56:10 +02:00
|
|
|
case 'TranscodeHWAccel':
|
|
|
|
return TranscodeHWAccelTypeTransformer().decode(value);
|
2023-07-09 04:43:11 +02:00
|
|
|
case 'TranscodePolicy':
|
|
|
|
return TranscodePolicyTypeTransformer().decode(value);
|
2022-07-13 14:23:48 +02:00
|
|
|
case 'UpdateAlbumDto':
|
|
|
|
return UpdateAlbumDto.fromJson(value);
|
2022-11-08 18:20:36 +02:00
|
|
|
case 'UpdateAssetDto':
|
|
|
|
return UpdateAssetDto.fromJson(value);
|
2023-09-20 13:16:33 +02:00
|
|
|
case 'UpdateLibraryDto':
|
|
|
|
return UpdateLibraryDto.fromJson(value);
|
2023-11-11 23:06:19 +02:00
|
|
|
case 'UpdatePartnerDto':
|
|
|
|
return UpdatePartnerDto.fromJson(value);
|
2023-10-22 04:38:07 +02:00
|
|
|
case 'UpdateStackParentDto':
|
|
|
|
return UpdateStackParentDto.fromJson(value);
|
2022-12-05 19:56:44 +02:00
|
|
|
case 'UpdateTagDto':
|
|
|
|
return UpdateTagDto.fromJson(value);
|
2022-07-13 14:23:48 +02:00
|
|
|
case 'UpdateUserDto':
|
|
|
|
return UpdateUserDto.fromJson(value);
|
2022-10-23 23:54:54 +02:00
|
|
|
case 'UsageByUserDto':
|
|
|
|
return UsageByUserDto.fromJson(value);
|
2023-11-14 05:10:35 +02:00
|
|
|
case 'UserAvatarColor':
|
|
|
|
return UserAvatarColorTypeTransformer().decode(value);
|
2023-11-01 05:13:34 +02:00
|
|
|
case 'UserDto':
|
|
|
|
return UserDto.fromJson(value);
|
2022-07-13 14:23:48 +02:00
|
|
|
case 'UserResponseDto':
|
|
|
|
return UserResponseDto.fromJson(value);
|
2024-03-09 00:49:39 +02:00
|
|
|
case 'UserStatus':
|
|
|
|
return UserStatusTypeTransformer().decode(value);
|
2022-07-13 14:23:48 +02:00
|
|
|
case 'ValidateAccessTokenResponseDto':
|
|
|
|
return ValidateAccessTokenResponseDto.fromJson(value);
|
2024-02-20 17:53:12 +02:00
|
|
|
case 'ValidateLibraryDto':
|
|
|
|
return ValidateLibraryDto.fromJson(value);
|
|
|
|
case 'ValidateLibraryImportPathResponseDto':
|
|
|
|
return ValidateLibraryImportPathResponseDto.fromJson(value);
|
|
|
|
case 'ValidateLibraryResponseDto':
|
|
|
|
return ValidateLibraryResponseDto.fromJson(value);
|
2023-07-09 04:43:11 +02:00
|
|
|
case 'VideoCodec':
|
|
|
|
return VideoCodecTypeTransformer().decode(value);
|
2022-07-13 14:23:48 +02:00
|
|
|
default:
|
|
|
|
dynamic match;
|
|
|
|
if (value is List && (match = _regList.firstMatch(targetType)?.group(1)) != null) {
|
|
|
|
return value
|
2024-01-26 18:40:28 +02:00
|
|
|
.map<dynamic>((dynamic v) => fromJson(v, match, growable: growable,))
|
2022-07-13 14:23:48 +02:00
|
|
|
.toList(growable: growable);
|
|
|
|
}
|
|
|
|
if (value is Set && (match = _regSet.firstMatch(targetType)?.group(1)) != null) {
|
|
|
|
return value
|
2024-01-26 18:40:28 +02:00
|
|
|
.map<dynamic>((dynamic v) => fromJson(v, match, growable: growable,))
|
2022-07-13 14:23:48 +02:00
|
|
|
.toSet();
|
|
|
|
}
|
|
|
|
if (value is Map && (match = _regMap.firstMatch(targetType)?.group(1)) != null) {
|
|
|
|
return Map<String, dynamic>.fromIterables(
|
|
|
|
value.keys.cast<String>(),
|
2024-01-26 18:40:28 +02:00
|
|
|
value.values.map<dynamic>((dynamic v) => fromJson(v, match, growable: growable,)),
|
2022-07-13 14:23:48 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} on Exception catch (error, trace) {
|
|
|
|
throw ApiException.withInner(HttpStatus.internalServerError, 'Exception during deserialization.', error, trace,);
|
|
|
|
}
|
|
|
|
throw ApiException(HttpStatus.internalServerError, 'Could not find a suitable class for deserialization',);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Primarily intended for use in an isolate.
|
|
|
|
class DeserializationMessage {
|
|
|
|
const DeserializationMessage({
|
|
|
|
required this.json,
|
|
|
|
required this.targetType,
|
|
|
|
this.growable = false,
|
|
|
|
});
|
|
|
|
|
|
|
|
/// The JSON value to deserialize.
|
|
|
|
final String json;
|
|
|
|
|
|
|
|
/// Target type to deserialize to.
|
|
|
|
final String targetType;
|
|
|
|
|
|
|
|
/// Whether to make deserialized lists or maps growable.
|
|
|
|
final bool growable;
|
|
|
|
}
|
|
|
|
|
2024-01-26 18:40:28 +02:00
|
|
|
/// Primarily intended for use in an isolate.
|
|
|
|
Future<dynamic> decodeAsync(DeserializationMessage message) async {
|
|
|
|
// Remove all spaces. Necessary for regular expressions as well.
|
|
|
|
final targetType = message.targetType.replaceAll(' ', '');
|
|
|
|
|
|
|
|
// If the expected target type is String, nothing to do...
|
|
|
|
return targetType == 'String'
|
|
|
|
? message.json
|
|
|
|
: json.decode(message.json);
|
|
|
|
}
|
|
|
|
|
2022-07-13 14:23:48 +02:00
|
|
|
/// Primarily intended for use in an isolate.
|
|
|
|
Future<dynamic> deserializeAsync(DeserializationMessage message) async {
|
|
|
|
// Remove all spaces. Necessary for regular expressions as well.
|
|
|
|
final targetType = message.targetType.replaceAll(' ', '');
|
|
|
|
|
|
|
|
// If the expected target type is String, nothing to do...
|
|
|
|
return targetType == 'String'
|
|
|
|
? message.json
|
2024-01-26 18:40:28 +02:00
|
|
|
: ApiClient.fromJson(
|
|
|
|
json.decode(message.json),
|
2022-07-13 14:23:48 +02:00
|
|
|
targetType,
|
|
|
|
growable: message.growable,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Primarily intended for use in an isolate.
|
|
|
|
Future<String> serializeAsync(Object? value) async => value == null ? '' : json.encode(value);
|