jld3103
1 year ago
33 changed files with 46723 additions and 11930 deletions
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,203 @@
|
||||
// ignore_for_file: camel_case_types |
||||
// ignore_for_file: public_member_api_docs |
||||
import 'dart:convert'; |
||||
import 'dart:typed_data'; |
||||
|
||||
import 'package:built_value/built_value.dart'; |
||||
import 'package:built_value/serializer.dart'; |
||||
import 'package:built_value/standard_json_plugin.dart'; |
||||
import 'package:dynamite_runtime/content_string.dart'; |
||||
import 'package:dynamite_runtime/http_client.dart'; |
||||
import 'package:universal_io/io.dart'; |
||||
|
||||
export 'package:dynamite_runtime/http_client.dart'; |
||||
|
||||
part 'settings.openapi.g.dart'; |
||||
|
||||
class SettingsResponse<T, U> extends DynamiteResponse<T, U> { |
||||
SettingsResponse( |
||||
super.data, |
||||
super.headers, |
||||
); |
||||
|
||||
@override |
||||
String toString() => 'SettingsResponse(data: $data, headers: $headers)'; |
||||
} |
||||
|
||||
class SettingsApiException extends DynamiteApiException { |
||||
SettingsApiException( |
||||
super.statusCode, |
||||
super.headers, |
||||
super.body, |
||||
); |
||||
|
||||
static Future<SettingsApiException> fromResponse(final HttpClientResponse response) async { |
||||
final data = await response.bodyBytes; |
||||
|
||||
String body; |
||||
try { |
||||
body = utf8.decode(data); |
||||
} on FormatException { |
||||
body = 'binary'; |
||||
} |
||||
|
||||
return SettingsApiException( |
||||
response.statusCode, |
||||
response.responseHeaders, |
||||
body, |
||||
); |
||||
} |
||||
|
||||
@override |
||||
String toString() => 'SettingsApiException(statusCode: $statusCode, headers: $headers, body: $body)'; |
||||
} |
||||
|
||||
class SettingsClient extends DynamiteClient { |
||||
SettingsClient( |
||||
super.baseURL, { |
||||
super.baseHeaders, |
||||
super.userAgent, |
||||
super.httpClient, |
||||
super.cookieJar, |
||||
super.authentications, |
||||
}); |
||||
|
||||
SettingsClient.fromClient(final DynamiteClient client) |
||||
: super( |
||||
client.baseURL, |
||||
baseHeaders: client.baseHeaders, |
||||
httpClient: client.httpClient, |
||||
cookieJar: client.cookieJar, |
||||
authentications: client.authentications, |
||||
); |
||||
|
||||
SettingsLogSettingsClient get logSettings => SettingsLogSettingsClient(this); |
||||
} |
||||
|
||||
class SettingsLogSettingsClient { |
||||
SettingsLogSettingsClient(this.rootClient); |
||||
|
||||
final SettingsClient rootClient; |
||||
|
||||
/// download logfile |
||||
/// |
||||
/// This endpoint requires admin access |
||||
Future<SettingsResponse<Uint8List, SettingsLogSettingsLogSettingsDownloadHeaders>> download() async { |
||||
const path = '/index.php/settings/admin/log/download'; |
||||
final queryParameters = <String, dynamic>{}; |
||||
final headers = <String, String>{ |
||||
'Accept': 'application/octet-stream', |
||||
}; |
||||
Uint8List? body; |
||||
if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { |
||||
headers.addAll( |
||||
rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, |
||||
); |
||||
} else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { |
||||
headers |
||||
.addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); |
||||
} else { |
||||
throw Exception('Missing authentication for bearer_auth or basic_auth'); // coverage:ignore-line |
||||
} |
||||
final response = await rootClient.doRequest( |
||||
'get', |
||||
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), |
||||
headers, |
||||
body, |
||||
); |
||||
if (response.statusCode == 200) { |
||||
return SettingsResponse<Uint8List, SettingsLogSettingsLogSettingsDownloadHeaders>( |
||||
await response.bodyBytes, |
||||
_jsonSerializers.deserialize( |
||||
response.responseHeaders, |
||||
specifiedType: const FullType(SettingsLogSettingsLogSettingsDownloadHeaders), |
||||
)! as SettingsLogSettingsLogSettingsDownloadHeaders, |
||||
); |
||||
} |
||||
throw await SettingsApiException.fromResponse(response); // coverage:ignore-line |
||||
} |
||||
} |
||||
|
||||
abstract class SettingsLogSettingsLogSettingsDownloadHeaders |
||||
implements |
||||
Built<SettingsLogSettingsLogSettingsDownloadHeaders, SettingsLogSettingsLogSettingsDownloadHeadersBuilder> { |
||||
factory SettingsLogSettingsLogSettingsDownloadHeaders([ |
||||
final void Function(SettingsLogSettingsLogSettingsDownloadHeadersBuilder)? b, |
||||
]) = _$SettingsLogSettingsLogSettingsDownloadHeaders; |
||||
const SettingsLogSettingsLogSettingsDownloadHeaders._(); |
||||
|
||||
factory SettingsLogSettingsLogSettingsDownloadHeaders.fromJson(final Map<String, dynamic> json) => |
||||
_jsonSerializers.deserializeWith(serializer, json)!; |
||||
|
||||
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; |
||||
@BuiltValueField(wireName: 'content-disposition') |
||||
String? get contentDisposition; |
||||
@BuiltValueSerializer(custom: true) |
||||
static Serializer<SettingsLogSettingsLogSettingsDownloadHeaders> get serializer => |
||||
_$SettingsLogSettingsLogSettingsDownloadHeadersSerializer(); |
||||
} |
||||
|
||||
class _$SettingsLogSettingsLogSettingsDownloadHeadersSerializer |
||||
implements StructuredSerializer<SettingsLogSettingsLogSettingsDownloadHeaders> { |
||||
@override |
||||
final Iterable<Type> types = const [ |
||||
SettingsLogSettingsLogSettingsDownloadHeaders, |
||||
_$SettingsLogSettingsLogSettingsDownloadHeaders |
||||
]; |
||||
|
||||
@override |
||||
final String wireName = 'SettingsLogSettingsLogSettingsDownloadHeaders'; |
||||
|
||||
@override |
||||
Iterable<Object?> serialize( |
||||
final Serializers serializers, |
||||
final SettingsLogSettingsLogSettingsDownloadHeaders object, { |
||||
final FullType specifiedType = FullType.unspecified, |
||||
}) { |
||||
throw UnimplementedError(); |
||||
} |
||||
|
||||
@override |
||||
SettingsLogSettingsLogSettingsDownloadHeaders deserialize( |
||||
final Serializers serializers, |
||||
final Iterable<Object?> serialized, { |
||||
final FullType specifiedType = FullType.unspecified, |
||||
}) { |
||||
final result = SettingsLogSettingsLogSettingsDownloadHeadersBuilder(); |
||||
|
||||
final iterator = serialized.iterator; |
||||
while (iterator.moveNext()) { |
||||
final key = iterator.current! as String; |
||||
iterator.moveNext(); |
||||
final value = iterator.current! as String; |
||||
switch (key) { |
||||
case 'content-disposition': |
||||
result.contentDisposition = value; |
||||
break; |
||||
} |
||||
} |
||||
|
||||
return result.build(); |
||||
} |
||||
} |
||||
|
||||
final Serializers _serializers = (Serializers().toBuilder() |
||||
..addBuilderFactory( |
||||
const FullType(SettingsLogSettingsLogSettingsDownloadHeaders), |
||||
SettingsLogSettingsLogSettingsDownloadHeaders.new, |
||||
) |
||||
..add(SettingsLogSettingsLogSettingsDownloadHeaders.serializer)) |
||||
.build(); |
||||
|
||||
Serializers get settingsSerializers => _serializers; |
||||
|
||||
final Serializers _jsonSerializers = (_serializers.toBuilder() |
||||
..addPlugin(StandardJsonPlugin()) |
||||
..addPlugin(const ContentStringPlugin())) |
||||
.build(); |
||||
|
||||
// coverage:ignore-start |
||||
T deserializeSettings<T>(final Object data) => _serializers.deserialize(data, specifiedType: FullType(T))! as T; |
||||
|
||||
Object? serializeSettings<T>(final T data) => _serializers.serialize(data, specifiedType: FullType(T)); |
||||
// coverage:ignore-end |
@ -0,0 +1,91 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND |
||||
|
||||
part of 'settings.openapi.dart'; |
||||
|
||||
// ************************************************************************** |
||||
// BuiltValueGenerator |
||||
// ************************************************************************** |
||||
|
||||
class _$SettingsLogSettingsLogSettingsDownloadHeaders extends SettingsLogSettingsLogSettingsDownloadHeaders { |
||||
@override |
||||
final String? contentDisposition; |
||||
|
||||
factory _$SettingsLogSettingsLogSettingsDownloadHeaders( |
||||
[void Function(SettingsLogSettingsLogSettingsDownloadHeadersBuilder)? updates]) => |
||||
(SettingsLogSettingsLogSettingsDownloadHeadersBuilder()..update(updates))._build(); |
||||
|
||||
_$SettingsLogSettingsLogSettingsDownloadHeaders._({this.contentDisposition}) : super._(); |
||||
|
||||
@override |
||||
SettingsLogSettingsLogSettingsDownloadHeaders rebuild( |
||||
void Function(SettingsLogSettingsLogSettingsDownloadHeadersBuilder) updates) => |
||||
(toBuilder()..update(updates)).build(); |
||||
|
||||
@override |
||||
SettingsLogSettingsLogSettingsDownloadHeadersBuilder toBuilder() => |
||||
SettingsLogSettingsLogSettingsDownloadHeadersBuilder()..replace(this); |
||||
|
||||
@override |
||||
bool operator ==(Object other) { |
||||
if (identical(other, this)) return true; |
||||
return other is SettingsLogSettingsLogSettingsDownloadHeaders && contentDisposition == other.contentDisposition; |
||||
} |
||||
|
||||
@override |
||||
int get hashCode { |
||||
var _$hash = 0; |
||||
_$hash = $jc(_$hash, contentDisposition.hashCode); |
||||
_$hash = $jf(_$hash); |
||||
return _$hash; |
||||
} |
||||
|
||||
@override |
||||
String toString() { |
||||
return (newBuiltValueToStringHelper(r'SettingsLogSettingsLogSettingsDownloadHeaders') |
||||
..add('contentDisposition', contentDisposition)) |
||||
.toString(); |
||||
} |
||||
} |
||||
|
||||
class SettingsLogSettingsLogSettingsDownloadHeadersBuilder |
||||
implements |
||||
Builder<SettingsLogSettingsLogSettingsDownloadHeaders, SettingsLogSettingsLogSettingsDownloadHeadersBuilder> { |
||||
_$SettingsLogSettingsLogSettingsDownloadHeaders? _$v; |
||||
|
||||
String? _contentDisposition; |
||||
String? get contentDisposition => _$this._contentDisposition; |
||||
set contentDisposition(String? contentDisposition) => _$this._contentDisposition = contentDisposition; |
||||
|
||||
SettingsLogSettingsLogSettingsDownloadHeadersBuilder(); |
||||
|
||||
SettingsLogSettingsLogSettingsDownloadHeadersBuilder get _$this { |
||||
final $v = _$v; |
||||
if ($v != null) { |
||||
_contentDisposition = $v.contentDisposition; |
||||
_$v = null; |
||||
} |
||||
return this; |
||||
} |
||||
|
||||
@override |
||||
void replace(SettingsLogSettingsLogSettingsDownloadHeaders other) { |
||||
ArgumentError.checkNotNull(other, 'other'); |
||||
_$v = other as _$SettingsLogSettingsLogSettingsDownloadHeaders; |
||||
} |
||||
|
||||
@override |
||||
void update(void Function(SettingsLogSettingsLogSettingsDownloadHeadersBuilder)? updates) { |
||||
if (updates != null) updates(this); |
||||
} |
||||
|
||||
@override |
||||
SettingsLogSettingsLogSettingsDownloadHeaders build() => _build(); |
||||
|
||||
_$SettingsLogSettingsLogSettingsDownloadHeaders _build() { |
||||
final _$result = _$v ?? _$SettingsLogSettingsLogSettingsDownloadHeaders._(contentDisposition: contentDisposition); |
||||
replace(_$result); |
||||
return _$result; |
||||
} |
||||
} |
||||
|
||||
// ignore_for_file: deprecated_member_use_from_same_package,type=lint |
@ -0,0 +1,739 @@
|
||||
// ignore_for_file: camel_case_types |
||||
// ignore_for_file: public_member_api_docs |
||||
import 'dart:convert'; |
||||
import 'dart:typed_data'; |
||||
|
||||
import 'package:built_collection/built_collection.dart'; |
||||
import 'package:built_value/built_value.dart'; |
||||
import 'package:built_value/json_object.dart'; |
||||
import 'package:built_value/serializer.dart'; |
||||
import 'package:built_value/standard_json_plugin.dart'; |
||||
import 'package:dynamite_runtime/content_string.dart'; |
||||
import 'package:dynamite_runtime/http_client.dart'; |
||||
import 'package:universal_io/io.dart'; |
||||
|
||||
export 'package:dynamite_runtime/http_client.dart'; |
||||
|
||||
part 'theming.openapi.g.dart'; |
||||
|
||||
class ThemingResponse<T, U> extends DynamiteResponse<T, U> { |
||||
ThemingResponse( |
||||
super.data, |
||||
super.headers, |
||||
); |
||||
|
||||
@override |
||||
String toString() => 'ThemingResponse(data: $data, headers: $headers)'; |
||||
} |
||||
|
||||
class ThemingApiException extends DynamiteApiException { |
||||
ThemingApiException( |
||||
super.statusCode, |
||||
super.headers, |
||||
super.body, |
||||
); |
||||
|
||||
static Future<ThemingApiException> fromResponse(final HttpClientResponse response) async { |
||||
final data = await response.bodyBytes; |
||||
|
||||
String body; |
||||
try { |
||||
body = utf8.decode(data); |
||||
} on FormatException { |
||||
body = 'binary'; |
||||
} |
||||
|
||||
return ThemingApiException( |
||||
response.statusCode, |
||||
response.responseHeaders, |
||||
body, |
||||
); |
||||
} |
||||
|
||||
@override |
||||
String toString() => 'ThemingApiException(statusCode: $statusCode, headers: $headers, body: $body)'; |
||||
} |
||||
|
||||
class ThemingClient extends DynamiteClient { |
||||
ThemingClient( |
||||
super.baseURL, { |
||||
super.baseHeaders, |
||||
super.userAgent, |
||||
super.httpClient, |
||||
super.cookieJar, |
||||
super.authentications, |
||||
}); |
||||
|
||||
ThemingClient.fromClient(final DynamiteClient client) |
||||
: super( |
||||
client.baseURL, |
||||
baseHeaders: client.baseHeaders, |
||||
httpClient: client.httpClient, |
||||
cookieJar: client.cookieJar, |
||||
authentications: client.authentications, |
||||
); |
||||
|
||||
ThemingIconClient get icon => ThemingIconClient(this); |
||||
ThemingThemingClient get theming => ThemingThemingClient(this); |
||||
ThemingUserThemeClient get userTheme => ThemingUserThemeClient(this); |
||||
} |
||||
|
||||
class ThemingIconClient { |
||||
ThemingIconClient(this.rootClient); |
||||
|
||||
final ThemingClient rootClient; |
||||
|
||||
/// Return a 32x32 favicon as png |
||||
Future<Uint8List> getFavicon({final String app = 'core'}) async { |
||||
var path = '/index.php/apps/theming/favicon/{app}'; |
||||
final queryParameters = <String, dynamic>{}; |
||||
final headers = <String, String>{ |
||||
'Accept': 'image/x-icon', |
||||
}; |
||||
Uint8List? body; |
||||
if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { |
||||
headers.addAll( |
||||
rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, |
||||
); |
||||
} else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { |
||||
headers |
||||
.addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); |
||||
} |
||||
path = path.replaceAll('{app}', Uri.encodeQueryComponent(app)); |
||||
final response = await rootClient.doRequest( |
||||
'get', |
||||
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), |
||||
headers, |
||||
body, |
||||
); |
||||
if (response.statusCode == 200) { |
||||
return response.bodyBytes; |
||||
} |
||||
throw await ThemingApiException.fromResponse(response); // coverage:ignore-line |
||||
} |
||||
|
||||
/// Return a 512x512 icon for touch devices |
||||
Future<Uint8List> getTouchIcon({final String app = 'core'}) async { |
||||
var path = '/index.php/apps/theming/icon/{app}'; |
||||
final queryParameters = <String, dynamic>{}; |
||||
final headers = <String, String>{ |
||||
'Accept': 'image/png', |
||||
}; |
||||
Uint8List? body; |
||||
if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { |
||||
headers.addAll( |
||||
rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, |
||||
); |
||||
} else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { |
||||
headers |
||||
.addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); |
||||
} |
||||
path = path.replaceAll('{app}', Uri.encodeQueryComponent(app)); |
||||
final response = await rootClient.doRequest( |
||||
'get', |
||||
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), |
||||
headers, |
||||
body, |
||||
); |
||||
if (response.statusCode == 200) { |
||||
return response.bodyBytes; |
||||
} |
||||
throw await ThemingApiException.fromResponse(response); // coverage:ignore-line |
||||
} |
||||
|
||||
/// Get a themed icon |
||||
Future<Uint8List> getThemedIcon({ |
||||
required final String app, |
||||
required final String image, |
||||
}) async { |
||||
var path = '/index.php/apps/theming/img/{app}/{image}'; |
||||
final queryParameters = <String, dynamic>{}; |
||||
final headers = <String, String>{ |
||||
'Accept': 'image/svg+xml', |
||||
}; |
||||
Uint8List? body; |
||||
if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { |
||||
headers.addAll( |
||||
rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, |
||||
); |
||||
} else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { |
||||
headers |
||||
.addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); |
||||
} |
||||
path = path.replaceAll('{app}', Uri.encodeQueryComponent(app)); |
||||
if (!RegExp(r'^.+$').hasMatch(image)) { |
||||
throw Exception('Invalid value "$image" for parameter "image" with pattern "${r'^.+$'}"'); // coverage:ignore-line |
||||
} |
||||
path = path.replaceAll('{image}', Uri.encodeQueryComponent(image)); |
||||
final response = await rootClient.doRequest( |
||||
'get', |
||||
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), |
||||
headers, |
||||
body, |
||||
); |
||||
if (response.statusCode == 200) { |
||||
return response.bodyBytes; |
||||
} |
||||
throw await ThemingApiException.fromResponse(response); // coverage:ignore-line |
||||
} |
||||
} |
||||
|
||||
/// Class ThemingController |
||||
/// handle ajax requests to update the theme |
||||
class ThemingThemingClient { |
||||
ThemingThemingClient(this.rootClient); |
||||
|
||||
final ThemingClient rootClient; |
||||
|
||||
/// Get the CSS stylesheet for a theme |
||||
Future<String> getThemeStylesheet({ |
||||
required final String themeId, |
||||
final int plain = 0, |
||||
final int withCustomCss = 0, |
||||
}) async { |
||||
var path = '/index.php/apps/theming/theme/{themeId}.css'; |
||||
final queryParameters = <String, dynamic>{}; |
||||
final headers = <String, String>{ |
||||
'Accept': 'text/css', |
||||
}; |
||||
Uint8List? body; |
||||
if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { |
||||
headers.addAll( |
||||
rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, |
||||
); |
||||
} else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { |
||||
headers |
||||
.addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); |
||||
} |
||||
path = path.replaceAll('{themeId}', Uri.encodeQueryComponent(themeId)); |
||||
if (plain != 0) { |
||||
queryParameters['plain'] = plain.toString(); |
||||
} |
||||
if (withCustomCss != 0) { |
||||
queryParameters['withCustomCss'] = withCustomCss.toString(); |
||||
} |
||||
final response = await rootClient.doRequest( |
||||
'get', |
||||
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), |
||||
headers, |
||||
body, |
||||
); |
||||
if (response.statusCode == 200) { |
||||
return response.body; |
||||
} |
||||
throw await ThemingApiException.fromResponse(response); // coverage:ignore-line |
||||
} |
||||
|
||||
/// Get an image |
||||
Future<Uint8List> getImage({ |
||||
required final String key, |
||||
final int useSvg = 1, |
||||
}) async { |
||||
var path = '/index.php/apps/theming/image/{key}'; |
||||
final queryParameters = <String, dynamic>{}; |
||||
final headers = <String, String>{ |
||||
'Accept': '*/*', |
||||
}; |
||||
Uint8List? body; |
||||
if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { |
||||
headers.addAll( |
||||
rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, |
||||
); |
||||
} else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { |
||||
headers |
||||
.addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); |
||||
} |
||||
path = path.replaceAll('{key}', Uri.encodeQueryComponent(key)); |
||||
if (useSvg != 1) { |
||||
queryParameters['useSvg'] = useSvg.toString(); |
||||
} |
||||
final response = await rootClient.doRequest( |
||||
'get', |
||||
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), |
||||
headers, |
||||
body, |
||||
); |
||||
if (response.statusCode == 200) { |
||||
return response.bodyBytes; |
||||
} |
||||
throw await ThemingApiException.fromResponse(response); // coverage:ignore-line |
||||
} |
||||
|
||||
/// Get the manifest for an app |
||||
Future<ThemingThemingGetManifestResponse200ApplicationJson> getManifest({required final String app}) async { |
||||
var path = '/index.php/apps/theming/manifest/{app}'; |
||||
final queryParameters = <String, dynamic>{}; |
||||
final headers = <String, String>{ |
||||
'Accept': 'application/json', |
||||
}; |
||||
Uint8List? body; |
||||
if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { |
||||
headers.addAll( |
||||
rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, |
||||
); |
||||
} else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { |
||||
headers |
||||
.addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); |
||||
} |
||||
path = path.replaceAll('{app}', Uri.encodeQueryComponent(app)); |
||||
final response = await rootClient.doRequest( |
||||
'get', |
||||
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), |
||||
headers, |
||||
body, |
||||
); |
||||
if (response.statusCode == 200) { |
||||
return _jsonSerializers.deserialize( |
||||
await response.jsonBody, |
||||
specifiedType: const FullType(ThemingThemingGetManifestResponse200ApplicationJson), |
||||
)! as ThemingThemingGetManifestResponse200ApplicationJson; |
||||
} |
||||
throw await ThemingApiException.fromResponse(response); // coverage:ignore-line |
||||
} |
||||
} |
||||
|
||||
class ThemingUserThemeClient { |
||||
ThemingUserThemeClient(this.rootClient); |
||||
|
||||
final ThemingClient rootClient; |
||||
|
||||
/// Get the background image |
||||
Future<Uint8List> getBackground({final String oCSAPIRequest = 'true'}) async { |
||||
const path = '/index.php/apps/theming/background'; |
||||
final queryParameters = <String, dynamic>{}; |
||||
final headers = <String, String>{ |
||||
'Accept': '*/*', |
||||
}; |
||||
Uint8List? body; |
||||
if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { |
||||
headers.addAll( |
||||
rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, |
||||
); |
||||
} else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { |
||||
headers |
||||
.addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); |
||||
} else { |
||||
throw Exception('Missing authentication for bearer_auth or basic_auth'); // coverage:ignore-line |
||||
} |
||||
headers['OCS-APIRequest'] = oCSAPIRequest; |
||||
final response = await rootClient.doRequest( |
||||
'get', |
||||
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), |
||||
headers, |
||||
body, |
||||
); |
||||
if (response.statusCode == 200) { |
||||
return response.bodyBytes; |
||||
} |
||||
throw await ThemingApiException.fromResponse(response); // coverage:ignore-line |
||||
} |
||||
|
||||
/// Set the background |
||||
Future<ThemingBackground> setBackground({ |
||||
required final String type, |
||||
final String value = '', |
||||
final String? color, |
||||
final String oCSAPIRequest = 'true', |
||||
}) async { |
||||
var path = '/index.php/apps/theming/background/{type}'; |
||||
final queryParameters = <String, dynamic>{}; |
||||
final headers = <String, String>{ |
||||
'Accept': 'application/json', |
||||
}; |
||||
Uint8List? body; |
||||
if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { |
||||
headers.addAll( |
||||
rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, |
||||
); |
||||
} else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { |
||||
headers |
||||
.addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); |
||||
} else { |
||||
throw Exception('Missing authentication for bearer_auth or basic_auth'); // coverage:ignore-line |
||||
} |
||||
path = path.replaceAll('{type}', Uri.encodeQueryComponent(type)); |
||||
if (value != '') { |
||||
queryParameters['value'] = value; |
||||
} |
||||
if (color != null) { |
||||
queryParameters['color'] = color; |
||||
} |
||||
headers['OCS-APIRequest'] = oCSAPIRequest; |
||||
final response = await rootClient.doRequest( |
||||
'post', |
||||
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), |
||||
headers, |
||||
body, |
||||
); |
||||
if (response.statusCode == 200) { |
||||
return _jsonSerializers.deserialize(await response.jsonBody, specifiedType: const FullType(ThemingBackground))! |
||||
as ThemingBackground; |
||||
} |
||||
throw await ThemingApiException.fromResponse(response); // coverage:ignore-line |
||||
} |
||||
|
||||
/// Delete the background |
||||
Future<ThemingBackground> deleteBackground({final String oCSAPIRequest = 'true'}) async { |
||||
const path = '/index.php/apps/theming/background/custom'; |
||||
final queryParameters = <String, dynamic>{}; |
||||
final headers = <String, String>{ |
||||
'Accept': 'application/json', |
||||
}; |
||||
Uint8List? body; |
||||
if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { |
||||
headers.addAll( |
||||
rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, |
||||
); |
||||
} else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { |
||||
headers |
||||
.addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); |
||||
} else { |
||||
throw Exception('Missing authentication for bearer_auth or basic_auth'); // coverage:ignore-line |
||||
} |
||||
headers['OCS-APIRequest'] = oCSAPIRequest; |
||||
final response = await rootClient.doRequest( |
||||
'delete', |
||||
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), |
||||
headers, |
||||
body, |
||||
); |
||||
if (response.statusCode == 200) { |
||||
return _jsonSerializers.deserialize(await response.jsonBody, specifiedType: const FullType(ThemingBackground))! |
||||
as ThemingBackground; |
||||
} |
||||
throw await ThemingApiException.fromResponse(response); // coverage:ignore-line |
||||
} |
||||
|
||||
/// Enable theme |
||||
Future<ThemingUserThemeEnableThemeResponse200ApplicationJson> enableTheme({ |
||||
required final String themeId, |
||||
final String oCSAPIRequest = 'true', |
||||
}) async { |
||||
var path = '/ocs/v2.php/apps/theming/api/v1/theme/{themeId}/enable'; |
||||
final queryParameters = <String, dynamic>{}; |
||||
final headers = <String, String>{ |
||||
'Accept': 'application/json', |
||||
}; |
||||
Uint8List? body; |
||||
if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { |
||||
headers.addAll( |
||||
rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, |
||||
); |
||||
} else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { |
||||
headers |
||||
.addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); |
||||
} else { |
||||
throw Exception('Missing authentication for bearer_auth or basic_auth'); // coverage:ignore-line |
||||
} |
||||
path = path.replaceAll('{themeId}', Uri.encodeQueryComponent(themeId)); |
||||
headers['OCS-APIRequest'] = oCSAPIRequest; |
||||
final response = await rootClient.doRequest( |
||||
'put', |
||||
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), |
||||
headers, |
||||
body, |
||||
); |
||||
if (response.statusCode == 200) { |
||||
return _jsonSerializers.deserialize( |
||||
await response.jsonBody, |
||||
specifiedType: const FullType(ThemingUserThemeEnableThemeResponse200ApplicationJson), |
||||
)! as ThemingUserThemeEnableThemeResponse200ApplicationJson; |
||||
} |
||||
throw await ThemingApiException.fromResponse(response); // coverage:ignore-line |
||||
} |
||||
|
||||
/// Disable theme |
||||
Future<ThemingUserThemeDisableThemeResponse200ApplicationJson> disableTheme({ |
||||
required final String themeId, |
||||
final String oCSAPIRequest = 'true', |
||||
}) async { |
||||
var path = '/ocs/v2.php/apps/theming/api/v1/theme/{themeId}'; |
||||
final queryParameters = <String, dynamic>{}; |
||||
final headers = <String, String>{ |
||||
'Accept': 'application/json', |
||||
}; |
||||
Uint8List? body; |
||||
if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'bearer').isNotEmpty) { |
||||
headers.addAll( |
||||
rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'bearer').headers, |
||||
); |
||||
} else if (rootClient.authentications.where((final a) => a.type == 'http' && a.scheme == 'basic').isNotEmpty) { |
||||
headers |
||||
.addAll(rootClient.authentications.singleWhere((final a) => a.type == 'http' && a.scheme == 'basic').headers); |
||||
} else { |
||||
throw Exception('Missing authentication for bearer_auth or basic_auth'); // coverage:ignore-line |
||||
} |
||||
path = path.replaceAll('{themeId}', Uri.encodeQueryComponent(themeId)); |
||||
headers['OCS-APIRequest'] = oCSAPIRequest; |
||||
final response = await rootClient.doRequest( |
||||
'delete', |
||||
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), |
||||
headers, |
||||
body, |
||||
); |
||||
if (response.statusCode == 200) { |
||||
return _jsonSerializers.deserialize( |
||||
await response.jsonBody, |
||||
specifiedType: const FullType(ThemingUserThemeDisableThemeResponse200ApplicationJson), |
||||
)! as ThemingUserThemeDisableThemeResponse200ApplicationJson; |
||||
} |
||||
throw await ThemingApiException.fromResponse(response); // coverage:ignore-line |
||||
} |
||||
} |
||||
|
||||
abstract class ThemingThemingGetManifestResponse200ApplicationJson_Icons |
||||
implements |
||||
Built<ThemingThemingGetManifestResponse200ApplicationJson_Icons, |
||||
ThemingThemingGetManifestResponse200ApplicationJson_IconsBuilder> { |
||||
factory ThemingThemingGetManifestResponse200ApplicationJson_Icons([ |
||||
final void Function(ThemingThemingGetManifestResponse200ApplicationJson_IconsBuilder)? b, |
||||
]) = _$ThemingThemingGetManifestResponse200ApplicationJson_Icons; |
||||
const ThemingThemingGetManifestResponse200ApplicationJson_Icons._(); |
||||
|
||||
factory ThemingThemingGetManifestResponse200ApplicationJson_Icons.fromJson(final Map<String, dynamic> json) => |
||||
_jsonSerializers.deserializeWith(serializer, json)!; |
||||
|
||||
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; |
||||
String get src; |
||||
String get type; |
||||
String get sizes; |
||||
static Serializer<ThemingThemingGetManifestResponse200ApplicationJson_Icons> get serializer => |
||||
_$themingThemingGetManifestResponse200ApplicationJsonIconsSerializer; |
||||
} |
||||
|
||||
abstract class ThemingThemingGetManifestResponse200ApplicationJson |
||||
implements |
||||
Built<ThemingThemingGetManifestResponse200ApplicationJson, |
||||
ThemingThemingGetManifestResponse200ApplicationJsonBuilder> { |
||||
factory ThemingThemingGetManifestResponse200ApplicationJson([ |
||||
final void Function(ThemingThemingGetManifestResponse200ApplicationJsonBuilder)? b, |
||||
]) = _$ThemingThemingGetManifestResponse200ApplicationJson; |
||||
const ThemingThemingGetManifestResponse200ApplicationJson._(); |
||||
|
||||
factory ThemingThemingGetManifestResponse200ApplicationJson.fromJson(final Map<String, dynamic> json) => |
||||
_jsonSerializers.deserializeWith(serializer, json)!; |
||||
|
||||
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; |
||||
String get name; |
||||
@BuiltValueField(wireName: 'short_name') |
||||
String get shortName; |
||||
@BuiltValueField(wireName: 'start_url') |
||||
String get startUrl; |
||||
@BuiltValueField(wireName: 'theme_color') |
||||
String get themeColor; |
||||
@BuiltValueField(wireName: 'background_color') |
||||
String get backgroundColor; |
||||
String get description; |
||||
BuiltList<ThemingThemingGetManifestResponse200ApplicationJson_Icons> get icons; |
||||
String get display; |
||||
static Serializer<ThemingThemingGetManifestResponse200ApplicationJson> get serializer => |
||||
_$themingThemingGetManifestResponse200ApplicationJsonSerializer; |
||||
} |
||||
|
||||
abstract class ThemingBackground implements Built<ThemingBackground, ThemingBackgroundBuilder> { |
||||
factory ThemingBackground([final void Function(ThemingBackgroundBuilder)? b]) = _$ThemingBackground; |
||||
const ThemingBackground._(); |
||||
|
||||
factory ThemingBackground.fromJson(final Map<String, dynamic> json) => |
||||
_jsonSerializers.deserializeWith(serializer, json)!; |
||||
|
||||
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; |
||||
String? get backgroundImage; |
||||
String get backgroundColor; |
||||
int get version; |
||||
static Serializer<ThemingBackground> get serializer => _$themingBackgroundSerializer; |
||||
} |
||||
|
||||
abstract class ThemingOCSMeta implements Built<ThemingOCSMeta, ThemingOCSMetaBuilder> { |
||||
factory ThemingOCSMeta([final void Function(ThemingOCSMetaBuilder)? b]) = _$ThemingOCSMeta; |
||||
const ThemingOCSMeta._(); |
||||
|
||||
factory ThemingOCSMeta.fromJson(final Map<String, dynamic> json) => |
||||
_jsonSerializers.deserializeWith(serializer, json)!; |
||||
|
||||
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; |
||||
String get status; |
||||
int get statuscode; |
||||
String? get message; |
||||
String? get totalitems; |
||||
String? get itemsperpage; |
||||
static Serializer<ThemingOCSMeta> get serializer => _$themingOCSMetaSerializer; |
||||
} |
||||
|
||||
abstract class ThemingUserThemeEnableThemeResponse200ApplicationJson_Ocs |
||||
implements |
||||
Built<ThemingUserThemeEnableThemeResponse200ApplicationJson_Ocs, |
||||
ThemingUserThemeEnableThemeResponse200ApplicationJson_OcsBuilder> { |
||||
factory ThemingUserThemeEnableThemeResponse200ApplicationJson_Ocs([ |
||||
final void Function(ThemingUserThemeEnableThemeResponse200ApplicationJson_OcsBuilder)? b, |
||||
]) = _$ThemingUserThemeEnableThemeResponse200ApplicationJson_Ocs; |
||||
const ThemingUserThemeEnableThemeResponse200ApplicationJson_Ocs._(); |
||||
|
||||
factory ThemingUserThemeEnableThemeResponse200ApplicationJson_Ocs.fromJson(final Map<String, dynamic> json) => |
||||
_jsonSerializers.deserializeWith(serializer, json)!; |
||||
|
||||
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; |
||||
ThemingOCSMeta get meta; |
||||
JsonObject get data; |
||||
static Serializer<ThemingUserThemeEnableThemeResponse200ApplicationJson_Ocs> get serializer => |
||||
_$themingUserThemeEnableThemeResponse200ApplicationJsonOcsSerializer; |
||||
} |
||||
|
||||
abstract class ThemingUserThemeEnableThemeResponse200ApplicationJson |
||||
implements |
||||
Built<ThemingUserThemeEnableThemeResponse200ApplicationJson, |
||||
ThemingUserThemeEnableThemeResponse200ApplicationJsonBuilder> { |
||||
factory ThemingUserThemeEnableThemeResponse200ApplicationJson([ |
||||
final void Function(ThemingUserThemeEnableThemeResponse200ApplicationJsonBuilder)? b, |
||||
]) = _$ThemingUserThemeEnableThemeResponse200ApplicationJson; |
||||
const ThemingUserThemeEnableThemeResponse200ApplicationJson._(); |
||||
|
||||
factory ThemingUserThemeEnableThemeResponse200ApplicationJson.fromJson(final Map<String, dynamic> json) => |
||||
_jsonSerializers.deserializeWith(serializer, json)!; |
||||
|
||||
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; |
||||
ThemingUserThemeEnableThemeResponse200ApplicationJson_Ocs get ocs; |
||||
static Serializer<ThemingUserThemeEnableThemeResponse200ApplicationJson> get serializer => |
||||
_$themingUserThemeEnableThemeResponse200ApplicationJsonSerializer; |
||||
} |
||||
|
||||
abstract class ThemingUserThemeDisableThemeResponse200ApplicationJson_Ocs |
||||
implements |
||||
Built<ThemingUserThemeDisableThemeResponse200ApplicationJson_Ocs, |
||||
ThemingUserThemeDisableThemeResponse200ApplicationJson_OcsBuilder> { |
||||
factory ThemingUserThemeDisableThemeResponse200ApplicationJson_Ocs([ |
||||
final void Function(ThemingUserThemeDisableThemeResponse200ApplicationJson_OcsBuilder)? b, |
||||
]) = _$ThemingUserThemeDisableThemeResponse200ApplicationJson_Ocs; |
||||
const ThemingUserThemeDisableThemeResponse200ApplicationJson_Ocs._(); |
||||
|
||||
factory ThemingUserThemeDisableThemeResponse200ApplicationJson_Ocs.fromJson(final Map<String, dynamic> json) => |
||||
_jsonSerializers.deserializeWith(serializer, json)!; |
||||
|
||||
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; |
||||
ThemingOCSMeta get meta; |
||||
JsonObject get data; |
||||
static Serializer<ThemingUserThemeDisableThemeResponse200ApplicationJson_Ocs> get serializer => |
||||
_$themingUserThemeDisableThemeResponse200ApplicationJsonOcsSerializer; |
||||
} |
||||
|
||||
abstract class ThemingUserThemeDisableThemeResponse200ApplicationJson |
||||
implements |
||||
Built<ThemingUserThemeDisableThemeResponse200ApplicationJson, |
||||
ThemingUserThemeDisableThemeResponse200ApplicationJsonBuilder> { |
||||
factory ThemingUserThemeDisableThemeResponse200ApplicationJson([ |
||||
final void Function(ThemingUserThemeDisableThemeResponse200ApplicationJsonBuilder)? b, |
||||
]) = _$ThemingUserThemeDisableThemeResponse200ApplicationJson; |
||||
const ThemingUserThemeDisableThemeResponse200ApplicationJson._(); |
||||
|
||||
factory ThemingUserThemeDisableThemeResponse200ApplicationJson.fromJson(final Map<String, dynamic> json) => |
||||
_jsonSerializers.deserializeWith(serializer, json)!; |
||||
|
||||
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; |
||||
ThemingUserThemeDisableThemeResponse200ApplicationJson_Ocs get ocs; |
||||
static Serializer<ThemingUserThemeDisableThemeResponse200ApplicationJson> get serializer => |
||||
_$themingUserThemeDisableThemeResponse200ApplicationJsonSerializer; |
||||
} |
||||
|
||||
abstract class ThemingPublicCapabilities_Theming |
||||
implements Built<ThemingPublicCapabilities_Theming, ThemingPublicCapabilities_ThemingBuilder> { |
||||
factory ThemingPublicCapabilities_Theming([final void Function(ThemingPublicCapabilities_ThemingBuilder)? b]) = |
||||
_$ThemingPublicCapabilities_Theming; |
||||
const ThemingPublicCapabilities_Theming._(); |
||||
|
||||
factory ThemingPublicCapabilities_Theming.fromJson(final Map<String, dynamic> json) => |
||||
_jsonSerializers.deserializeWith(serializer, json)!; |
||||
|
||||
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; |
||||
String get name; |
||||
String get url; |
||||
String get slogan; |
||||
String get color; |
||||
@BuiltValueField(wireName: 'color-text') |
||||
String get colorText; |
||||
@BuiltValueField(wireName: 'color-element') |
||||
String get colorElement; |
||||
@BuiltValueField(wireName: 'color-element-bright') |
||||
String get colorElementBright; |
||||
@BuiltValueField(wireName: 'color-element-dark') |
||||
String get colorElementDark; |
||||
String get logo; |
||||
String get background; |
||||
@BuiltValueField(wireName: 'background-plain') |
||||
bool get backgroundPlain; |
||||
@BuiltValueField(wireName: 'background-default') |
||||
bool get backgroundDefault; |
||||
String get logoheader; |
||||
String get favicon; |
||||
static Serializer<ThemingPublicCapabilities_Theming> get serializer => _$themingPublicCapabilitiesThemingSerializer; |
||||
} |
||||
|
||||
abstract class ThemingPublicCapabilities implements Built<ThemingPublicCapabilities, ThemingPublicCapabilitiesBuilder> { |
||||
factory ThemingPublicCapabilities([final void Function(ThemingPublicCapabilitiesBuilder)? b]) = |
||||
_$ThemingPublicCapabilities; |
||||
const ThemingPublicCapabilities._(); |
||||
|
||||
factory ThemingPublicCapabilities.fromJson(final Map<String, dynamic> json) => |
||||
_jsonSerializers.deserializeWith(serializer, json)!; |
||||
|
||||
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; |
||||
ThemingPublicCapabilities_Theming get theming; |
||||
static Serializer<ThemingPublicCapabilities> get serializer => _$themingPublicCapabilitiesSerializer; |
||||
} |
||||
|
||||
final Serializers _serializers = (Serializers().toBuilder() |
||||
..addBuilderFactory( |
||||
const FullType(ThemingThemingGetManifestResponse200ApplicationJson), |
||||
ThemingThemingGetManifestResponse200ApplicationJson.new, |
||||
) |
||||
..add(ThemingThemingGetManifestResponse200ApplicationJson.serializer) |
||||
..addBuilderFactory( |
||||
const FullType(ThemingThemingGetManifestResponse200ApplicationJson_Icons), |
||||
ThemingThemingGetManifestResponse200ApplicationJson_Icons.new, |
||||
) |
||||
..add(ThemingThemingGetManifestResponse200ApplicationJson_Icons.serializer) |
||||
..addBuilderFactory( |
||||
const FullType(BuiltList, [FullType(ThemingThemingGetManifestResponse200ApplicationJson_Icons)]), |
||||
ListBuilder<ThemingThemingGetManifestResponse200ApplicationJson_Icons>.new, |
||||
) |
||||
..addBuilderFactory(const FullType(ThemingBackground), ThemingBackground.new) |
||||
..add(ThemingBackground.serializer) |
||||
..addBuilderFactory( |
||||
const FullType(ThemingUserThemeEnableThemeResponse200ApplicationJson), |
||||
ThemingUserThemeEnableThemeResponse200ApplicationJson.new, |
||||
) |
||||
..add(ThemingUserThemeEnableThemeResponse200ApplicationJson.serializer) |
||||
..addBuilderFactory( |
||||
const FullType(ThemingUserThemeEnableThemeResponse200ApplicationJson_Ocs), |
||||
ThemingUserThemeEnableThemeResponse200ApplicationJson_Ocs.new, |
||||
) |
||||
..add(ThemingUserThemeEnableThemeResponse200ApplicationJson_Ocs.serializer) |
||||
..addBuilderFactory(const FullType(ThemingOCSMeta), ThemingOCSMeta.new) |
||||
..add(ThemingOCSMeta.serializer) |
||||
..addBuilderFactory( |
||||
const FullType(ThemingUserThemeDisableThemeResponse200ApplicationJson), |
||||
ThemingUserThemeDisableThemeResponse200ApplicationJson.new, |
||||
) |
||||
..add(ThemingUserThemeDisableThemeResponse200ApplicationJson.serializer) |
||||
..addBuilderFactory( |
||||
const FullType(ThemingUserThemeDisableThemeResponse200ApplicationJson_Ocs), |
||||
ThemingUserThemeDisableThemeResponse200ApplicationJson_Ocs.new, |
||||
) |
||||
..add(ThemingUserThemeDisableThemeResponse200ApplicationJson_Ocs.serializer) |
||||
..addBuilderFactory(const FullType(ThemingPublicCapabilities), ThemingPublicCapabilities.new) |
||||
..add(ThemingPublicCapabilities.serializer) |
||||
..addBuilderFactory(const FullType(ThemingPublicCapabilities_Theming), ThemingPublicCapabilities_Theming.new) |
||||
..add(ThemingPublicCapabilities_Theming.serializer)) |
||||
.build(); |
||||
|
||||
Serializers get themingSerializers => _serializers; |
||||
|
||||
final Serializers _jsonSerializers = (_serializers.toBuilder() |
||||
..addPlugin(StandardJsonPlugin()) |
||||
..addPlugin(const ContentStringPlugin())) |
||||
.build(); |
||||
|
||||
// coverage:ignore-start |
||||
T deserializeTheming<T>(final Object data) => _serializers.deserialize(data, specifiedType: FullType(T))! as T; |
||||
|
||||
Object? serializeTheming<T>(final T data) => _serializers.serialize(data, specifiedType: FullType(T)); |
||||
// coverage:ignore-end |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,54 +0,0 @@
|
||||
// ignore_for_file: public_member_api_docs |
||||
|
||||
import 'dart:convert'; |
||||
|
||||
import 'package:crypto/crypto.dart'; |
||||
import 'package:crypton/crypton.dart'; |
||||
import 'package:nextcloud/src/api/notifications.openapi.dart'; |
||||
|
||||
/// Generates the push token hash which is just sha512 |
||||
String generatePushTokenHash(final String pushToken) => sha512.convert(utf8.encode(pushToken)).toString(); |
||||
|
||||
/// Decrypts the subject of a push notification |
||||
NotificationsNotificationDecryptedSubject decryptPushNotificationSubject( |
||||
final RSAPrivateKey privateKey, |
||||
final String subject, |
||||
) => |
||||
NotificationsNotificationDecryptedSubject.fromJson( |
||||
json.decode(privateKey.decrypt(subject)) as Map<String, dynamic>, |
||||
); |
||||
|
||||
/// See https://github.com/nextcloud/news/blob/4a107b3d53c4fe651ac704251b99e04a53cd587f/lib/Db/ListType.php |
||||
enum NewsListType { |
||||
feed(0), |
||||
folder(1), |
||||
starred(2), |
||||
allItems(3), |
||||
shared(4), |
||||
explore(5), |
||||
unread(6); |
||||
|
||||
const NewsListType(this.code); |
||||
|
||||
final int code; |
||||
} |
||||
|
||||
enum ShareType { |
||||
user(0), |
||||
group(1), |
||||
usergroup(2), |
||||
link(3), |
||||
email(4), |
||||
// 5 was contact, is no longer used |
||||
remote(6), |
||||
circle(7), |
||||
guest(8), |
||||
remoteGroup(9), |
||||
room(10), |
||||
// 11 is userroom, but it's only used internally |
||||
deck(12), |
||||
deckUser(13); |
||||
|
||||
const ShareType(this.code); |
||||
final int code; |
||||
} |
@ -0,0 +1,20 @@
|
||||
// ignore_for_file: public_member_api_docs |
||||
|
||||
enum ShareType { |
||||
user, |
||||
group, |
||||
usergroup, |
||||
link, |
||||
email, |
||||
@Deprecated('No longer used') |
||||
contact, |
||||
remote, |
||||
circle, |
||||
guest, |
||||
remoteGroup, |
||||
room, |
||||
@Deprecated('Only used internally') |
||||
userroom, |
||||
deck, |
||||
deckUser, |
||||
} |
@ -0,0 +1,12 @@
|
||||
// ignore_for_file: public_member_api_docs |
||||
|
||||
/// See https://github.com/nextcloud/news/blob/4a107b3d53c4fe651ac704251b99e04a53cd587f/lib/Db/ListType.php |
||||
enum NewsListType { |
||||
feed, |
||||
folder, |
||||
starred, |
||||
allItems, |
||||
shared, |
||||
explore, |
||||
unread, |
||||
} |
@ -0,0 +1,63 @@
|
||||
import 'dart:convert'; |
||||
|
||||
import 'package:crypto/crypto.dart'; |
||||
import 'package:crypton/crypton.dart'; |
||||
import 'package:json_annotation/json_annotation.dart'; |
||||
|
||||
part 'notifications.g.dart'; |
||||
|
||||
/// Generates the push token hash which is just sha512 |
||||
String generatePushTokenHash(final String pushToken) => sha512.convert(utf8.encode(pushToken)).toString(); |
||||
|
||||
@JsonSerializable() |
||||
// ignore: public_member_api_docs |
||||
class NotificationsDecryptedSubject { |
||||
// ignore: public_member_api_docs |
||||
NotificationsDecryptedSubject({ |
||||
this.nid, |
||||
this.app, |
||||
this.subject, |
||||
this.type, |
||||
this.id, |
||||
this.delete, |
||||
this.deleteAll, |
||||
}); |
||||
|
||||
// ignore: public_member_api_docs |
||||
factory NotificationsDecryptedSubject.fromJson(final Map<String, dynamic> json) => |
||||
_$NotificationsDecryptedSubjectFromJson(json); |
||||
|
||||
/// ID if the notification |
||||
final int? nid; |
||||
|
||||
/// App that sent the notification |
||||
final String? app; |
||||
|
||||
/// Subject of the notification |
||||
final String? subject; |
||||
|
||||
/// Type of the notification |
||||
final String? type; |
||||
|
||||
/// ID of the notification |
||||
final String? id; |
||||
|
||||
/// Delete the notification |
||||
final bool? delete; |
||||
|
||||
/// Delete all notifications |
||||
@JsonKey(name: 'delete-all') |
||||
final bool? deleteAll; |
||||
|
||||
// ignore: public_member_api_docs |
||||
Map<String, dynamic> toJson() => _$NotificationsDecryptedSubjectToJson(this); |
||||
} |
||||
|
||||
/// Decrypts the subject of a push notification |
||||
NotificationsDecryptedSubject decryptPushNotificationSubject( |
||||
final RSAPrivateKey privateKey, |
||||
final String subject, |
||||
) => |
||||
NotificationsDecryptedSubject.fromJson( |
||||
json.decode(privateKey.decrypt(subject)) as Map<String, dynamic>, |
||||
); |
@ -0,0 +1,28 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND |
||||
|
||||
part of 'notifications.dart'; |
||||
|
||||
// ************************************************************************** |
||||
// JsonSerializableGenerator |
||||
// ************************************************************************** |
||||
|
||||
NotificationsDecryptedSubject _$NotificationsDecryptedSubjectFromJson(Map<String, dynamic> json) => |
||||
NotificationsDecryptedSubject( |
||||
nid: json['nid'] as int?, |
||||
app: json['app'] as String?, |
||||
subject: json['subject'] as String?, |
||||
type: json['type'] as String?, |
||||
id: json['id'] as String?, |
||||
delete: json['delete'] as bool?, |
||||
deleteAll: json['delete-all'] as bool?, |
||||
); |
||||
|
||||
Map<String, dynamic> _$NotificationsDecryptedSubjectToJson(NotificationsDecryptedSubject instance) => <String, dynamic>{ |
||||
'nid': instance.nid, |
||||
'app': instance.app, |
||||
'subject': instance.subject, |
||||
'type': instance.type, |
||||
'id': instance.id, |
||||
'delete': instance.delete, |
||||
'delete-all': instance.deleteAll, |
||||
}; |
@ -0,0 +1,29 @@
|
||||
import 'dart:convert'; |
||||
|
||||
import 'package:test/test.dart'; |
||||
|
||||
import 'helper.dart'; |
||||
|
||||
Future main() async { |
||||
await run(await getDockerImage()); |
||||
} |
||||
|
||||
Future run(final DockerImage image) async { |
||||
group('settings', () { |
||||
late DockerContainer container; |
||||
late TestNextcloudClient client; |
||||
setUp(() async { |
||||
container = await getDockerContainer(image); |
||||
client = await getTestClient( |
||||
container, |
||||
username: 'admin', |
||||
); |
||||
}); |
||||
tearDown(() => container.destroy()); |
||||
|
||||
test('Download log file', () async { |
||||
final response = utf8.decode((await client.settings.logSettings.download()).data); |
||||
expect(response, await container.nextcloudLogs()); |
||||
}); |
||||
}); |
||||
} |
Loading…
Reference in new issue