Browse Source

refactor(nextcloud): Update comments API

Signed-off-by: jld3103 <jld3103yt@gmail.com>
pull/715/head
jld3103 1 year ago
parent
commit
a91723672a
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 2
      external/nextcloud-server
  2. 124
      packages/nextcloud/lib/src/api/comments.openapi.dart
  3. 89
      packages/nextcloud/lib/src/api/comments.openapi.g.dart
  4. 44
      packages/nextcloud/lib/src/api/comments.openapi.json

2
external/nextcloud-server vendored

@ -1 +1 @@
Subproject commit cdea1d62ba712b2c43fff51d8029674d10645842 Subproject commit eb1b09da6728d300aecf65fb28d3d49e546a9bee

124
packages/nextcloud/lib/src/api/comments.openapi.dart

@ -1,6 +1,5 @@
// ignore_for_file: camel_case_types // ignore_for_file: camel_case_types
// ignore_for_file: public_member_api_docs // ignore_for_file: public_member_api_docs
import 'dart:typed_data';
import 'package:built_value/built_value.dart'; import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart'; import 'package:built_value/serializer.dart';
@ -67,124 +66,6 @@ class CommentsClient extends DynamiteClient {
cookieJar: client.cookieJar, cookieJar: client.cookieJar,
authentications: client.authentications, 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) @BuiltValue(instantiable: false)
@ -244,11 +125,6 @@ abstract class CommentsCapabilities
// coverage:ignore-start // coverage:ignore-start
final Serializers _serializers = (Serializers().toBuilder() final Serializers _serializers = (Serializers().toBuilder()
..addBuilderFactory(
const FullType(CommentsNotificationsNotificationsViewHeaders),
CommentsNotificationsNotificationsViewHeaders.new,
)
..add(CommentsNotificationsNotificationsViewHeaders.serializer)
..addBuilderFactory(const FullType(CommentsCapabilities), CommentsCapabilities.new) ..addBuilderFactory(const FullType(CommentsCapabilities), CommentsCapabilities.new)
..add(CommentsCapabilities.serializer) ..add(CommentsCapabilities.serializer)
..addBuilderFactory(const FullType(CommentsCapabilities_Files), CommentsCapabilities_Files.new) ..addBuilderFactory(const FullType(CommentsCapabilities_Files), CommentsCapabilities_Files.new)

89
packages/nextcloud/lib/src/api/comments.openapi.g.dart

@ -86,95 +86,6 @@ class _$CommentsCapabilitiesSerializer implements StructuredSerializer<CommentsC
} }
} }
abstract mixin class CommentsNotificationsNotificationsViewHeadersInterfaceBuilder {
void replace(CommentsNotificationsNotificationsViewHeadersInterface other);
void update(void Function(CommentsNotificationsNotificationsViewHeadersInterfaceBuilder) updates);
String? get location;
set location(String? location);
}
class _$CommentsNotificationsNotificationsViewHeaders extends CommentsNotificationsNotificationsViewHeaders {
@override
final String? location;
factory _$CommentsNotificationsNotificationsViewHeaders(
[void Function(CommentsNotificationsNotificationsViewHeadersBuilder)? updates]) =>
(CommentsNotificationsNotificationsViewHeadersBuilder()..update(updates))._build();
_$CommentsNotificationsNotificationsViewHeaders._({this.location}) : super._();
@override
CommentsNotificationsNotificationsViewHeaders rebuild(
void Function(CommentsNotificationsNotificationsViewHeadersBuilder) updates) =>
(toBuilder()..update(updates)).build();
@override
CommentsNotificationsNotificationsViewHeadersBuilder toBuilder() =>
CommentsNotificationsNotificationsViewHeadersBuilder()..replace(this);
@override
bool operator ==(Object other) {
if (identical(other, this)) return true;
return other is CommentsNotificationsNotificationsViewHeaders && location == other.location;
}
@override
int get hashCode {
var _$hash = 0;
_$hash = $jc(_$hash, location.hashCode);
_$hash = $jf(_$hash);
return _$hash;
}
@override
String toString() {
return (newBuiltValueToStringHelper(r'CommentsNotificationsNotificationsViewHeaders')..add('location', location))
.toString();
}
}
class CommentsNotificationsNotificationsViewHeadersBuilder
implements
Builder<CommentsNotificationsNotificationsViewHeaders, CommentsNotificationsNotificationsViewHeadersBuilder>,
CommentsNotificationsNotificationsViewHeadersInterfaceBuilder {
_$CommentsNotificationsNotificationsViewHeaders? _$v;
String? _location;
String? get location => _$this._location;
set location(covariant String? location) => _$this._location = location;
CommentsNotificationsNotificationsViewHeadersBuilder();
CommentsNotificationsNotificationsViewHeadersBuilder get _$this {
final $v = _$v;
if ($v != null) {
_location = $v.location;
_$v = null;
}
return this;
}
@override
void replace(covariant CommentsNotificationsNotificationsViewHeaders other) {
ArgumentError.checkNotNull(other, 'other');
_$v = other as _$CommentsNotificationsNotificationsViewHeaders;
}
@override
void update(void Function(CommentsNotificationsNotificationsViewHeadersBuilder)? updates) {
if (updates != null) updates(this);
}
@override
CommentsNotificationsNotificationsViewHeaders build() => _build();
_$CommentsNotificationsNotificationsViewHeaders _build() {
final _$result = _$v ?? _$CommentsNotificationsNotificationsViewHeaders._(location: location);
replace(_$result);
return _$result;
}
}
abstract mixin class CommentsCapabilities_FilesInterfaceBuilder { abstract mixin class CommentsCapabilities_FilesInterfaceBuilder {
void replace(CommentsCapabilities_FilesInterface other); void replace(CommentsCapabilities_FilesInterface other);
void update(void Function(CommentsCapabilities_FilesInterfaceBuilder) updates); void update(void Function(CommentsCapabilities_FilesInterfaceBuilder) updates);

44
packages/nextcloud/lib/src/api/comments.openapi.json

@ -42,48 +42,6 @@
} }
} }
}, },
"paths": { "paths": {},
"/index.php/apps/comments/notifications/view/{id}": {
"get": {
"operationId": "notifications-view",
"summary": "View a notification",
"tags": [
"notifications"
],
"security": [
{},
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the notification",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"303": {
"description": "Redirected to notification",
"headers": {
"Location": {
"schema": {
"type": "string"
}
}
}
}
}
}
}
},
"tags": [] "tags": []
} }
Loading…
Cancel
Save