|
|
|
@ -1,6 +1,5 @@
|
|
|
|
|
// ignore_for_file: camel_case_types |
|
|
|
|
// ignore_for_file: public_member_api_docs |
|
|
|
|
import 'dart:typed_data'; |
|
|
|
|
|
|
|
|
|
import 'package:built_value/built_value.dart'; |
|
|
|
|
import 'package:built_value/serializer.dart'; |
|
|
|
@ -67,124 +66,6 @@ class CommentsClient extends DynamiteClient {
|
|
|
|
|
cookieJar: client.cookieJar, |
|
|
|
|
authentications: client.authentications, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
CommentsNotificationsClient get notifications => CommentsNotificationsClient(this); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class CommentsNotificationsClient { |
|
|
|
|
CommentsNotificationsClient(this._rootClient); |
|
|
|
|
|
|
|
|
|
final CommentsClient _rootClient; |
|
|
|
|
|
|
|
|
|
/// View a notification |
|
|
|
|
Future<CommentsNotificationsNotificationsViewHeaders> view({required final String id}) async { |
|
|
|
|
var path = '/index.php/apps/comments/notifications/view/{id}'; |
|
|
|
|
final queryParameters = <String, dynamic>{}; |
|
|
|
|
final headers = <String, String>{}; |
|
|
|
|
Uint8List? body; |
|
|
|
|
// coverage:ignore-start |
|
|
|
|
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, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
// coverage:ignore-end |
|
|
|
|
path = path.replaceAll('{id}', Uri.encodeQueryComponent(id)); |
|
|
|
|
final response = await _rootClient.doRequest( |
|
|
|
|
'get', |
|
|
|
|
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null), |
|
|
|
|
headers, |
|
|
|
|
body, |
|
|
|
|
); |
|
|
|
|
if (response.statusCode == 303) { |
|
|
|
|
return _jsonSerializers.deserialize( |
|
|
|
|
response.responseHeaders, |
|
|
|
|
specifiedType: const FullType(CommentsNotificationsNotificationsViewHeaders), |
|
|
|
|
)! as CommentsNotificationsNotificationsViewHeaders; |
|
|
|
|
} |
|
|
|
|
throw await CommentsApiException.fromResponse(response); // coverage:ignore-line |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@BuiltValue(instantiable: false) |
|
|
|
|
abstract interface class CommentsNotificationsNotificationsViewHeadersInterface { |
|
|
|
|
String? get location; |
|
|
|
|
CommentsNotificationsNotificationsViewHeadersInterface rebuild( |
|
|
|
|
final void Function(CommentsNotificationsNotificationsViewHeadersInterfaceBuilder) updates, |
|
|
|
|
); |
|
|
|
|
CommentsNotificationsNotificationsViewHeadersInterfaceBuilder toBuilder(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
abstract class CommentsNotificationsNotificationsViewHeaders |
|
|
|
|
implements |
|
|
|
|
CommentsNotificationsNotificationsViewHeadersInterface, |
|
|
|
|
Built<CommentsNotificationsNotificationsViewHeaders, CommentsNotificationsNotificationsViewHeadersBuilder> { |
|
|
|
|
factory CommentsNotificationsNotificationsViewHeaders([ |
|
|
|
|
final void Function(CommentsNotificationsNotificationsViewHeadersBuilder)? b, |
|
|
|
|
]) = _$CommentsNotificationsNotificationsViewHeaders; |
|
|
|
|
|
|
|
|
|
// coverage:ignore-start |
|
|
|
|
const CommentsNotificationsNotificationsViewHeaders._(); |
|
|
|
|
// coverage:ignore-end |
|
|
|
|
|
|
|
|
|
// coverage:ignore-start |
|
|
|
|
factory CommentsNotificationsNotificationsViewHeaders.fromJson(final Map<String, dynamic> json) => |
|
|
|
|
_jsonSerializers.deserializeWith(serializer, json)!; |
|
|
|
|
// coverage:ignore-end |
|
|
|
|
|
|
|
|
|
// coverage:ignore-start |
|
|
|
|
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; |
|
|
|
|
// coverage:ignore-end |
|
|
|
|
@BuiltValueSerializer(custom: true) |
|
|
|
|
static Serializer<CommentsNotificationsNotificationsViewHeaders> get serializer => |
|
|
|
|
_$CommentsNotificationsNotificationsViewHeadersSerializer(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class _$CommentsNotificationsNotificationsViewHeadersSerializer |
|
|
|
|
implements StructuredSerializer<CommentsNotificationsNotificationsViewHeaders> { |
|
|
|
|
@override |
|
|
|
|
final Iterable<Type> types = const [ |
|
|
|
|
CommentsNotificationsNotificationsViewHeaders, |
|
|
|
|
_$CommentsNotificationsNotificationsViewHeaders, |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
final String wireName = 'CommentsNotificationsNotificationsViewHeaders'; |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Iterable<Object?> serialize( |
|
|
|
|
final Serializers serializers, |
|
|
|
|
final CommentsNotificationsNotificationsViewHeaders object, { |
|
|
|
|
final FullType specifiedType = FullType.unspecified, |
|
|
|
|
}) { |
|
|
|
|
throw UnimplementedError(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
CommentsNotificationsNotificationsViewHeaders deserialize( |
|
|
|
|
final Serializers serializers, |
|
|
|
|
final Iterable<Object?> serialized, { |
|
|
|
|
final FullType specifiedType = FullType.unspecified, |
|
|
|
|
}) { |
|
|
|
|
final result = CommentsNotificationsNotificationsViewHeadersBuilder(); |
|
|
|
|
|
|
|
|
|
final iterator = serialized.iterator; |
|
|
|
|
while (iterator.moveNext()) { |
|
|
|
|
final key = iterator.current! as String; |
|
|
|
|
iterator.moveNext(); |
|
|
|
|
final value = iterator.current! as String; |
|
|
|
|
switch (key) { |
|
|
|
|
case 'location': |
|
|
|
|
result.location = value; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return result.build(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@BuiltValue(instantiable: false) |
|
|
|
@ -244,11 +125,6 @@ abstract class CommentsCapabilities
|
|
|
|
|
|
|
|
|
|
// coverage:ignore-start |
|
|
|
|
final Serializers _serializers = (Serializers().toBuilder() |
|
|
|
|
..addBuilderFactory( |
|
|
|
|
const FullType(CommentsNotificationsNotificationsViewHeaders), |
|
|
|
|
CommentsNotificationsNotificationsViewHeaders.new, |
|
|
|
|
) |
|
|
|
|
..add(CommentsNotificationsNotificationsViewHeaders.serializer) |
|
|
|
|
..addBuilderFactory(const FullType(CommentsCapabilities), CommentsCapabilities.new) |
|
|
|
|
..add(CommentsCapabilities.serializer) |
|
|
|
|
..addBuilderFactory(const FullType(CommentsCapabilities_Files), CommentsCapabilities_Files.new) |
|
|
|
|