From e6314be5c08d9562c2f6e5df7dc92d3e461089eb Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Thu, 18 May 2023 14:56:20 +0200 Subject: [PATCH 1/5] dynamite: use dart types as parameters --- .../dynamite/dynamite/lib/src/openapi_builder.dart | 2 +- .../dynamite/lib/src/type_result/base.dart | 14 ++++++++++++++ .../dynamite/lib/src/type_result/list.dart | 3 +++ .../dynamite/dynamite/lib/src/type_result/map.dart | 3 +++ .../dynamite/lib/src/type_result/type_result.dart | 4 ++++ 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/packages/dynamite/dynamite/lib/src/openapi_builder.dart b/packages/dynamite/dynamite/lib/src/openapi_builder.dart index 715ee969..be020277 100644 --- a/packages/dynamite/dynamite/lib/src/openapi_builder.dart +++ b/packages/dynamite/dynamite/lib/src/openapi_builder.dart @@ -726,7 +726,7 @@ class OpenAPIBuilder implements Builder { ), parameter.schema!, nullable: dartParameterNullable, - ); + ).dartType; state.resolvedTypeCombinations.add(result); diff --git a/packages/dynamite/dynamite/lib/src/type_result/base.dart b/packages/dynamite/dynamite/lib/src/type_result/base.dart index a0b4f297..924c98f3 100644 --- a/packages/dynamite/dynamite/lib/src/type_result/base.dart +++ b/packages/dynamite/dynamite/lib/src/type_result/base.dart @@ -42,4 +42,18 @@ class TypeResultBase extends TypeResult { throw Exception('Can not decode "$name" from String'); } } + + @override + TypeResultBase get dartType { + final String dartName; + switch (name) { + case 'JsonObject': + dartName = 'dynamic'; + break; + default: + dartName = name; + } + + return TypeResultBase(dartName, nullable: nullable); + } } diff --git a/packages/dynamite/dynamite/lib/src/type_result/list.dart b/packages/dynamite/dynamite/lib/src/type_result/list.dart index 5d31f9ea..944603ba 100644 --- a/packages/dynamite/dynamite/lib/src/type_result/list.dart +++ b/packages/dynamite/dynamite/lib/src/type_result/list.dart @@ -41,4 +41,7 @@ class TypeResultList extends TypeResult { @override String decode(final String object) => 'json.decode($object as String)'; + + @override + TypeResultList get dartType => TypeResultList('List', subType, nullable: nullable); } diff --git a/packages/dynamite/dynamite/lib/src/type_result/map.dart b/packages/dynamite/dynamite/lib/src/type_result/map.dart index 90333a41..599daeff 100644 --- a/packages/dynamite/dynamite/lib/src/type_result/map.dart +++ b/packages/dynamite/dynamite/lib/src/type_result/map.dart @@ -37,4 +37,7 @@ class TypeResultMap extends TypeResult { @override String decode(final String object) => 'json.decode($object as String)'; + + @override + TypeResultMap get dartType => TypeResultMap('Map', subType, nullable: nullable); } diff --git a/packages/dynamite/dynamite/lib/src/type_result/type_result.dart b/packages/dynamite/dynamite/lib/src/type_result/type_result.dart index 2807c02a..6c6b6931 100644 --- a/packages/dynamite/dynamite/lib/src/type_result/type_result.dart +++ b/packages/dynamite/dynamite/lib/src/type_result/type_result.dart @@ -59,4 +59,8 @@ abstract class TypeResult { }); String get nullableName => nullable ? '$name?' : name; + + /// Native dart type equivalent + // ignore: avoid_returning_this + TypeResult get dartType => this; } From 8d1f4143bd68c8669bd344b728b0921ac1fc1399 Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Thu, 18 May 2023 15:02:45 +0200 Subject: [PATCH 2/5] dynamite: unify serialization and encoding --- .../dynamite/lib/src/openapi_builder.dart | 28 +++++++++++----- .../dynamite/lib/src/type_result/base.dart | 2 +- .../dynamite/lib/src/type_result/enum.dart | 14 ++++---- .../dynamite/lib/src/type_result/list.dart | 19 +---------- .../dynamite/lib/src/type_result/map.dart | 28 +--------------- .../dynamite/lib/src/type_result/object.dart | 32 ++----------------- .../lib/src/type_result/type_result.dart | 29 ++++++++++++++--- 7 files changed, 56 insertions(+), 96 deletions(-) diff --git a/packages/dynamite/dynamite/lib/src/openapi_builder.dart b/packages/dynamite/dynamite/lib/src/openapi_builder.dart index be020277..f3fe09d4 100644 --- a/packages/dynamite/dynamite/lib/src/openapi_builder.dart +++ b/packages/dynamite/dynamite/lib/src/openapi_builder.dart @@ -779,7 +779,7 @@ class OpenAPIBuilder implements Builder { code.write('if (${_toDartName(parameter.name)} != null) {'); } final value = result.encode( - result.serialize(_toDartName(parameter.name)), + _toDartName(parameter.name), onlyChildren: result is TypeResultList && parameter.in_ == 'query', // Objects inside the query always have to be interpreted in some way mimeType: 'application/json', @@ -858,7 +858,7 @@ class OpenAPIBuilder implements Builder { code.write('if ($parameterName != null) {'); } code.write( - 'body = Uint8List.fromList(utf8.encode(${result.encode(result.serialize(parameterName), mimeType: mimeType)}));', + 'body = Uint8List.fromList(utf8.encode(${result.encode(parameterName, mimeType: mimeType)}));', ); if (dartParameterNullable) { code.write('}'); @@ -1493,9 +1493,13 @@ TypeResult resolveObject( return [ Code("case '$propertyName':"), if (result.className != 'String') ...[ - Code( - 'result.${_toDartName(propertyName)} = ${result.deserialize('jsonDecode(value!)', toBuilder: true)};', - ), + if (result is TypeResultBase || result is TypeResultEnum) ...[ + Code('result.${_toDartName(propertyName)} = ${result.deserialize(result.decode('value!'))};'), + ] else ...[ + Code( + 'result.${_toDartName(propertyName)}.replace(${result.deserialize(result.decode('value!'))});', + ), + ], ] else ...[ Code( 'result.${_toDartName(propertyName)} = value!;', @@ -1512,7 +1516,7 @@ TypeResult resolveObject( const Code('while (iterator.moveNext()) {'), const Code('final key = iterator.current! as String;'), const Code('iterator.moveNext();'), - const Code('final value = iterator.current as String?;'), + const Code('final value = iterator.current! as String;'), const Code('switch (key) {'), for (final propertyName in schema.properties!.keys) ...[ ...deserializeProperty(propertyName), @@ -1749,7 +1753,11 @@ TypeResult resolveType( '..data = JsonObject(data);', if (schema.allOf != null) ...[ for (final result in results) ...[ - 'result.${fields[result.name]!} = ${result.deserialize('data', toBuilder: true)};', + if (result is TypeResultBase || result is TypeResultEnum) ...[ + 'result.${fields[result.name]!} = ${result.deserialize('data')};', + ] else ...[ + 'result.${fields[result.name]!}.replace(${result.deserialize('data')});', + ], ], ] else ...[ if (schema.discriminator != null) ...[ @@ -1786,7 +1794,11 @@ TypeResult resolveType( ], ], 'try {', - 'result.${fields[result.name]!} = ${result.deserialize('data', toBuilder: true)};', + if (result is TypeResultBase || result is TypeResultEnum) ...[ + 'result._${fields[result.name]!} = ${result.deserialize('data')};', + ] else ...[ + 'result._${fields[result.name]!} = ${result.deserialize('data')}.toBuilder();', + ], '} catch (_) {', if (schema.discriminator != null) ...[ 'rethrow;', diff --git a/packages/dynamite/dynamite/lib/src/type_result/base.dart b/packages/dynamite/dynamite/lib/src/type_result/base.dart index 924c98f3..e78a1a1c 100644 --- a/packages/dynamite/dynamite/lib/src/type_result/base.dart +++ b/packages/dynamite/dynamite/lib/src/type_result/base.dart @@ -26,7 +26,7 @@ class TypeResultBase extends TypeResult { return 'JsonObject($object)${nullable ? '?' : ''}'; } - return '($object as $name ${nullable ? '?' : ''})'; + return '($object as $nullableName)'; } @override diff --git a/packages/dynamite/dynamite/lib/src/type_result/enum.dart b/packages/dynamite/dynamite/lib/src/type_result/enum.dart index 742b8217..54e59a70 100644 --- a/packages/dynamite/dynamite/lib/src/type_result/enum.dart +++ b/packages/dynamite/dynamite/lib/src/type_result/enum.dart @@ -12,20 +12,18 @@ class TypeResultEnum extends TypeResult { @override String? get _builderFactory => null; - @override - String serialize(final String object) => '$object.name'; - @override String encode( final String object, { final bool onlyChildren = false, final String? mimeType, - }) => - subType.encode(object); + }) { + if (subType.name == 'String') { + return '$object.name'; + } - @override - String deserialize(final String object, {final bool toBuilder = false}) => - '$name.valueOf($object as ${subType.name})'; + return super.encode(object, mimeType: mimeType); + } @override String decode(final String object) => subType.decode(object); diff --git a/packages/dynamite/dynamite/lib/src/type_result/list.dart b/packages/dynamite/dynamite/lib/src/type_result/list.dart index 944603ba..db00cff9 100644 --- a/packages/dynamite/dynamite/lib/src/type_result/list.dart +++ b/packages/dynamite/dynamite/lib/src/type_result/list.dart @@ -12,9 +12,6 @@ class TypeResultList extends TypeResult { @override String? get _builderFactory => '..addBuilderFactory($fullType, ListBuilder<${subType.className}>.new)'; - @override - String serialize(final String object) => '$object.map((final e) => ${subType.serialize('e')})'; - @override String encode( final String object, { @@ -25,23 +22,9 @@ class TypeResultList extends TypeResult { return '$object.map((final e) => ${subType.encode('e', mimeType: mimeType)})'; } - switch (mimeType) { - case 'application/json': - return 'json.encode($object)'; - case 'application/x-www-form-urlencoded': - return 'Uri(queryParameters: $object).query'; - default: - throw Exception('Can not encode mime type "$mimeType"'); - } + return super.encode(object, mimeType: mimeType); } - @override - String deserialize(final String object, {final bool toBuilder = false}) => - '$name(($object as List).map((final e) => ${subType.deserialize('e')}))${toBuilder ? '.toBuilder()' : ''}'; - - @override - String decode(final String object) => 'json.decode($object as String)'; - @override TypeResultList get dartType => TypeResultList('List', subType, nullable: nullable); } diff --git a/packages/dynamite/dynamite/lib/src/type_result/map.dart b/packages/dynamite/dynamite/lib/src/type_result/map.dart index 599daeff..6e0efdcc 100644 --- a/packages/dynamite/dynamite/lib/src/type_result/map.dart +++ b/packages/dynamite/dynamite/lib/src/type_result/map.dart @@ -10,33 +10,7 @@ class TypeResultMap extends TypeResult { TypeResult get subType => generics[1]; @override - String? get _builderFactory => '..addBuilderFactory($fullType, ListBuilder.new)'; - - @override - String serialize(final String object) => object; - - @override - String encode( - final String object, { - final bool onlyChildren = false, - final String? mimeType, - }) { - switch (mimeType) { - case 'application/json': - return 'json.encode($object)'; - case 'application/x-www-form-urlencoded': - return 'Uri(queryParameters: $object).query'; - default: - throw Exception('Can not encode mime type "$mimeType"'); - } - } - - @override - String deserialize(final String object, {final bool toBuilder = false}) => - '($object as $className)${toBuilder ? '.toBuilder()' : ''}'; - - @override - String decode(final String object) => 'json.decode($object as String)'; + String? get _builderFactory => '..addBuilderFactory($fullType, MapBuilder.new)'; @override TypeResultMap get dartType => TypeResultMap('Map', subType, nullable: nullable); diff --git a/packages/dynamite/dynamite/lib/src/type_result/object.dart b/packages/dynamite/dynamite/lib/src/type_result/object.dart index 85a96823..c93c049c 100644 --- a/packages/dynamite/dynamite/lib/src/type_result/object.dart +++ b/packages/dynamite/dynamite/lib/src/type_result/object.dart @@ -15,15 +15,6 @@ class TypeResultObject extends TypeResult { @override String? get _builderFactory => '..addBuilderFactory($fullType, $name.new)'; - @override - String serialize(final String object) { - if (className == _contentString) { - return 'jsonSerializers.serialize(messages, specifiedType: const $fullType)'; - } - - return '$object.toJson()'; - } - @override String encode( final String object, { @@ -32,28 +23,9 @@ class TypeResultObject extends TypeResult { }) { if (className == _contentString) { assert(mimeType == 'application/json', '$_contentString should have a mimeType of application/json'); - return object; - } - - switch (mimeType) { - case 'application/json': - return 'json.encode($object)'; - case 'application/x-www-form-urlencoded': - return 'Uri(queryParameters: $object).query'; - default: - throw Exception('Can not encode mime type "$mimeType"'); + return serialize(object); } - } - @override - String deserialize(final String object, {final bool toBuilder = false}) { - if (className == 'ContentString') { - return 'jsonSerializers.deserialize(messages, specifiedType: const $fullType)! as $name${nullable ? '?' : ''}'; - } - - return '$name.fromJson($object as Object${nullable ? '?' : ''})${nullable && toBuilder ? '?' : ''}${toBuilder ? '.toBuilder()' : ''}'; + return super.encode(object, onlyChildren: onlyChildren, mimeType: mimeType); } - - @override - String decode(final String object) => 'json.decode($object as String)'; } diff --git a/packages/dynamite/dynamite/lib/src/type_result/type_result.dart b/packages/dynamite/dynamite/lib/src/type_result/type_result.dart index 6c6b6931..950fb70e 100644 --- a/packages/dynamite/dynamite/lib/src/type_result/type_result.dart +++ b/packages/dynamite/dynamite/lib/src/type_result/type_result.dart @@ -46,18 +46,39 @@ abstract class TypeResult { String? get _builderFactory; - String serialize(final String object); + /// Serializes the variable named [object]. + /// + /// The serialized result is an [Object]? + String serialize(final String object) => 'jsonSerializers.serialize($object, specifiedType: const $fullType)'; - String deserialize(final String object, {final bool toBuilder = false}); + /// Deserializes the variable named [object]. + /// + /// The serialized result will be of [name]. + String deserialize(final String object) => + '(jsonSerializers.deserialize($object, specifiedType: const $fullType)! as $name)'; - String decode(final String object); + /// Decodes the variable named [object]. + String decode(final String object) => 'json.decode($object as String)'; + /// Encodes the variable named [object]. String encode( final String object, { final bool onlyChildren = false, final String? mimeType, - }); + }) { + final serialized = serialize(object); + switch (mimeType) { + case 'application/json': + return 'json.encode($serialized)'; + case 'application/x-www-form-urlencoded': + return 'Uri(queryParameters: $serialized! as Map).query'; + default: + throw Exception('Can not encode mime type "$mimeType"'); + } + } + + /// Nullable TypeName String get nullableName => nullable ? '$name?' : name; /// Native dart type equivalent From a6d8f98cd372cb5035cbfbe3d8eceaf2f0df7579 Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Thu, 18 May 2023 15:03:51 +0200 Subject: [PATCH 3/5] dynamite: generate builderFactories for all returntypes --- packages/dynamite/dynamite/lib/src/openapi_builder.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/dynamite/dynamite/lib/src/openapi_builder.dart b/packages/dynamite/dynamite/lib/src/openapi_builder.dart index f3fe09d4..80a702b8 100644 --- a/packages/dynamite/dynamite/lib/src/openapi_builder.dart +++ b/packages/dynamite/dynamite/lib/src/openapi_builder.dart @@ -930,6 +930,8 @@ class OpenAPIBuilder implements Builder { ), mediaType.schema!, ); + state.resolvedTypeCombinations.add(result); + if (mimeType == '*/*' || mimeType.startsWith('image/')) { dataType = 'Uint8List'; dataValue = 'response.body'; From 6653b30c071a922bad22f2943349e0c5d3575eb3 Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Thu, 18 May 2023 15:04:07 +0200 Subject: [PATCH 4/5] nextcloud: rebuild --- .../nextcloud/lib/src/nextcloud.openapi.dart | 433 ++++++++++++++---- 1 file changed, 336 insertions(+), 97 deletions(-) diff --git a/packages/nextcloud/lib/src/nextcloud.openapi.dart b/packages/nextcloud/lib/src/nextcloud.openapi.dart index 97872fb6..c9293b48 100644 --- a/packages/nextcloud/lib/src/nextcloud.openapi.dart +++ b/packages/nextcloud/lib/src/nextcloud.openapi.dart @@ -186,7 +186,10 @@ class NextcloudCoreClient { body, ); if (response.statusCode == 200) { - return NextcloudCoreServerStatus.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudCoreServerStatus), + )! as NextcloudCoreServerStatus; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -210,7 +213,10 @@ class NextcloudCoreClient { body, ); if (response.statusCode == 200) { - return NextcloudCoreServerCapabilities.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudCoreServerCapabilities), + )! as NextcloudCoreServerCapabilities; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -234,7 +240,10 @@ class NextcloudCoreClient { body, ); if (response.statusCode == 200) { - return NextcloudCoreNavigationApps.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudCoreNavigationApps), + )! as NextcloudCoreNavigationApps; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -253,7 +262,10 @@ class NextcloudCoreClient { body, ); if (response.statusCode == 200) { - return NextcloudCoreLoginFlowInit.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudCoreLoginFlowInit), + )! as NextcloudCoreLoginFlowInit; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -273,7 +285,10 @@ class NextcloudCoreClient { body, ); if (response.statusCode == 200) { - return NextcloudCoreLoginFlowResult.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudCoreLoginFlowResult), + )! as NextcloudCoreLoginFlowResult; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -389,7 +404,7 @@ class NextcloudCoreClient { required final String search, required final String itemType, required final String itemId, - required final BuiltList shareTypes, + required final List shareTypes, final String? sorter, final int limit = 10, }) async { @@ -407,7 +422,7 @@ class NextcloudCoreClient { queryParameters['search'] = search; queryParameters['itemType'] = itemType; queryParameters['itemId'] = itemId; - queryParameters['shareTypes[]'] = shareTypes.map((final e) => e).map((final e) => e.toString()); + queryParameters['shareTypes[]'] = shareTypes.map((final e) => e.toString()); if (sorter != null) { queryParameters['sorter'] = sorter; } @@ -421,7 +436,10 @@ class NextcloudCoreClient { body, ); if (response.statusCode == 200) { - return NextcloudCoreAutocompleteResult.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudCoreAutocompleteResult), + )! as NextcloudCoreAutocompleteResult; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -475,7 +493,10 @@ class NextcloudNewsClient { body, ); if (response.statusCode == 200) { - return NextcloudNewsSupportedAPIVersions.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudNewsSupportedAPIVersions), + )! as NextcloudNewsSupportedAPIVersions; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -499,7 +520,10 @@ class NextcloudNewsClient { body, ); if (response.statusCode == 200) { - return NextcloudNewsListFolders.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudNewsListFolders), + )! as NextcloudNewsListFolders; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -524,7 +548,10 @@ class NextcloudNewsClient { body, ); if (response.statusCode == 200) { - return NextcloudNewsListFolders.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudNewsListFolders), + )! as NextcloudNewsListFolders; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -625,7 +652,10 @@ class NextcloudNewsClient { body, ); if (response.statusCode == 200) { - return NextcloudNewsListFeeds.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudNewsListFeeds), + )! as NextcloudNewsListFeeds; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -656,7 +686,10 @@ class NextcloudNewsClient { body, ); if (response.statusCode == 200) { - return NextcloudNewsListFeeds.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudNewsListFeeds), + )! as NextcloudNewsListFeeds; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -811,7 +844,10 @@ class NextcloudNewsClient { body, ); if (response.statusCode == 200) { - return NextcloudNewsListArticles.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudNewsListArticles), + )! as NextcloudNewsListArticles; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -848,7 +884,10 @@ class NextcloudNewsClient { body, ); if (response.statusCode == 200) { - return NextcloudNewsListArticles.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudNewsListArticles), + )! as NextcloudNewsListArticles; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -995,9 +1034,10 @@ class NextcloudNotesClient { body, ); if (response.statusCode == 200) { - return BuiltList( - (json.decode(utf8.decode(response.body)) as List).map((final e) => NextcloudNotesNote.fromJson(e as Object)), - ); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(BuiltList, [FullType(NextcloudNotesNote)]), + )! as BuiltList; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1042,7 +1082,10 @@ class NextcloudNotesClient { body, ); if (response.statusCode == 200) { - return NextcloudNotesNote.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudNotesNote), + )! as NextcloudNotesNote; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1077,7 +1120,10 @@ class NextcloudNotesClient { body, ); if (response.statusCode == 200) { - return NextcloudNotesNote.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudNotesNote), + )! as NextcloudNotesNote; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1128,7 +1174,10 @@ class NextcloudNotesClient { body, ); if (response.statusCode == 200) { - return NextcloudNotesNote.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudNotesNote), + )! as NextcloudNotesNote; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1177,7 +1226,10 @@ class NextcloudNotesClient { body, ); if (response.statusCode == 200) { - return NextcloudNotesSettings.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudNotesSettings), + )! as NextcloudNotesSettings; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1195,7 +1247,11 @@ class NextcloudNotesClient { throw Exception('Missing authentication for basic_auth'); } headers['Content-Type'] = 'application/json'; - body = Uint8List.fromList(utf8.encode(json.encode(notesSettings.toJson()))); + body = Uint8List.fromList( + utf8.encode( + json.encode(jsonSerializers.serialize(notesSettings, specifiedType: const FullType(NextcloudNotesSettings))), + ), + ); final response = await rootClient.doRequest( 'put', Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), @@ -1203,7 +1259,10 @@ class NextcloudNotesClient { body, ); if (response.statusCode == 200) { - return NextcloudNotesSettings.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudNotesSettings), + )! as NextcloudNotesSettings; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1233,9 +1292,10 @@ class NextcloudNotificationsClient { body, ); if (response.statusCode == 200) { - return NextcloudNotificationsListNotifications.fromJson( - json.decode(utf8.decode(response.body)) as Object, - ); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudNotificationsListNotifications), + )! as NextcloudNotificationsListNotifications; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1284,9 +1344,10 @@ class NextcloudNotificationsClient { body, ); if (response.statusCode == 200) { - return NextcloudNotificationsGetNotification.fromJson( - json.decode(utf8.decode(response.body)) as Object, - ); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudNotificationsGetNotification), + )! as NextcloudNotificationsGetNotification; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1311,7 +1372,10 @@ class NextcloudNotificationsClient { body, ); if (response.statusCode == 200) { - return NextcloudEmptyOCS.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudEmptyOCS), + )! as NextcloudEmptyOCS; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1342,9 +1406,10 @@ class NextcloudNotificationsClient { body, ); if (response.statusCode == 201) { - return NextcloudNotificationsPushServerRegistration.fromJson( - json.decode(utf8.decode(response.body)) as Object, - ); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudNotificationsPushServerRegistration), + )! as NextcloudNotificationsPushServerRegistration; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1401,7 +1466,10 @@ class NextcloudNotificationsClient { body, ); if (response.statusCode == 200) { - return NextcloudEmptyOCS.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudEmptyOCS), + )! as NextcloudEmptyOCS; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1431,7 +1499,10 @@ class NextcloudProvisioningApiClient { body, ); if (response.statusCode == 200) { - return NextcloudProvisioningApiUser.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudProvisioningApiUser), + )! as NextcloudProvisioningApiUser; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1456,7 +1527,10 @@ class NextcloudProvisioningApiClient { body, ); if (response.statusCode == 200) { - return NextcloudProvisioningApiUser.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudProvisioningApiUser), + )! as NextcloudProvisioningApiUser; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1487,9 +1561,10 @@ class NextcloudUnifiedPushProviderClient { body, ); if (response.statusCode == 200) { - return NextcloudUnifiedPushProviderCheckResponse200ApplicationJson.fromJson( - json.decode(utf8.decode(response.body)) as Object, - ); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudUnifiedPushProviderCheckResponse200ApplicationJson), + )! as NextcloudUnifiedPushProviderCheckResponse200ApplicationJson; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1519,9 +1594,10 @@ class NextcloudUnifiedPushProviderClient { body, ); if (response.statusCode == 200) { - return NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson.fromJson( - json.decode(utf8.decode(response.body)) as Object, - ); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson), + )! as NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1549,9 +1625,10 @@ class NextcloudUnifiedPushProviderClient { body, ); if (response.statusCode == 200) { - return NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson.fromJson( - json.decode(utf8.decode(response.body)) as Object, - ); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson), + )! as NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1581,9 +1658,10 @@ class NextcloudUnifiedPushProviderClient { body, ); if (response.statusCode == 401) { - return NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson.fromJson( - json.decode(utf8.decode(response.body)) as Object, - ); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson), + )! as NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1611,9 +1689,10 @@ class NextcloudUnifiedPushProviderClient { body, ); if (response.statusCode == 200) { - return NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson.fromJson( - json.decode(utf8.decode(response.body)) as Object, - ); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson), + )! as NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1643,9 +1722,10 @@ class NextcloudUnifiedPushProviderClient { body, ); if (response.statusCode == 200) { - return NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson.fromJson( - json.decode(utf8.decode(response.body)) as Object, - ); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson), + )! as NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1673,9 +1753,10 @@ class NextcloudUnifiedPushProviderClient { body, ); if (response.statusCode == 200) { - return NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson.fromJson( - json.decode(utf8.decode(response.body)) as Object, - ); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson), + )! as NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1703,9 +1784,10 @@ class NextcloudUnifiedPushProviderClient { body, ); if (response.statusCode == 200) { - return NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson.fromJson( - json.decode(utf8.decode(response.body)) as Object, - ); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson), + )! as NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1731,9 +1813,10 @@ class NextcloudUnifiedPushProviderClient { body, ); if (response.statusCode == 201) { - return NextcloudUnifiedPushProviderPushResponse201ApplicationJson.fromJson( - json.decode(utf8.decode(response.body)) as Object, - ); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudUnifiedPushProviderPushResponse201ApplicationJson), + )! as NextcloudUnifiedPushProviderPushResponse201ApplicationJson; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1758,9 +1841,10 @@ class NextcloudUnifiedPushProviderClient { body, ); if (response.statusCode == 200) { - return NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson.fromJson( - json.decode(utf8.decode(response.body)) as Object, - ); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson), + )! as NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1785,9 +1869,10 @@ class NextcloudUnifiedPushProviderClient { body, ); if (response.statusCode == 200) { - return NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson.fromJson( - json.decode(utf8.decode(response.body)) as Object, - ); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson), + )! as NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1817,7 +1902,10 @@ class NextcloudUserStatusClient { body, ); if (response.statusCode == 200) { - return NextcloudUserStatusGetPublicStatuses.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudUserStatusGetPublicStatuses), + )! as NextcloudUserStatusGetPublicStatuses; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1842,7 +1930,10 @@ class NextcloudUserStatusClient { body, ); if (response.statusCode == 200) { - return NextcloudUserStatusGetPublicStatus.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudUserStatusGetPublicStatus), + )! as NextcloudUserStatusGetPublicStatus; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1866,7 +1957,10 @@ class NextcloudUserStatusClient { body, ); if (response.statusCode == 200) { - return NextcloudUserStatusGetStatus.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudUserStatusGetStatus), + )! as NextcloudUserStatusGetStatus; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1891,7 +1985,10 @@ class NextcloudUserStatusClient { body, ); if (response.statusCode == 200) { - return NextcloudUserStatusGetStatus.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudUserStatusGetStatus), + )! as NextcloudUserStatusGetStatus; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1922,7 +2019,10 @@ class NextcloudUserStatusClient { body, ); if (response.statusCode == 200) { - return NextcloudUserStatusGetStatus.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudUserStatusGetStatus), + )! as NextcloudUserStatusGetStatus; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -1959,7 +2059,10 @@ class NextcloudUserStatusClient { body, ); if (response.statusCode == 200) { - return NextcloudUserStatusGetStatus.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudUserStatusGetStatus), + )! as NextcloudUserStatusGetStatus; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -2005,9 +2108,10 @@ class NextcloudUserStatusClient { body, ); if (response.statusCode == 200) { - return NextcloudUserStatusPredefinedStatuses.fromJson( - json.decode(utf8.decode(response.body)) as Object, - ); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudUserStatusPredefinedStatuses), + )! as NextcloudUserStatusPredefinedStatuses; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -2032,7 +2136,10 @@ class NextcloudUserStatusClient { body, ); if (response.statusCode == 200) { - return NextcloudUserStatusHeartbeat.fromJson(json.decode(utf8.decode(response.body)) as Object); + return jsonSerializers.deserialize( + json.decode(utf8.decode(response.body)), + specifiedType: const FullType(NextcloudUserStatusHeartbeat), + )! as NextcloudUserStatusHeartbeat; } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line } @@ -3148,10 +3255,10 @@ class _$NextcloudCoreNavigationApps_Ocs_Data_OrderSerializer }) { final result = NextcloudCoreNavigationApps_Ocs_Data_OrderBuilder()..data = JsonObject(data); try { - result.$int = data as int?; + result._$int = data as int?; } catch (_) {} try { - result.string = data as String?; + result._string = data as String?; } catch (_) {} assert([result._$int, result._string].where((final x) => x != null).isNotEmpty, 'Need oneOf for ${result._data}'); return result.build(); @@ -3295,10 +3402,14 @@ class _$NextcloudCoreAutocompleteResult_Ocs_Data_StatusSerializer }) { final result = NextcloudCoreAutocompleteResult_Ocs_Data_StatusBuilder()..data = JsonObject(data); try { - result.builtListJsonObject = BuiltList((data as List).map(JsonObject.new)).toBuilder(); + result._builtListJsonObject = (jsonSerializers.deserialize( + data, + specifiedType: const FullType(BuiltList, [FullType(JsonObject)]), + )! as BuiltList) + .toBuilder(); } catch (_) {} try { - result.string = data as String?; + result._string = data as String?; } catch (_) {} assert( [result._builtListJsonObject, result._string].where((final x) => x != null).isNotEmpty, @@ -4121,10 +4232,13 @@ class _$NextcloudUserStatusClearAt_TimeSerializer implements PrimitiveSerializer }) { final result = NextcloudUserStatusClearAt_TimeBuilder()..data = JsonObject(data); try { - result.userStatusClearAtTime0 = NextcloudUserStatusClearAt_Time0.valueOf(data as String); + result._userStatusClearAtTime0 = jsonSerializers.deserialize( + data, + specifiedType: const FullType(NextcloudUserStatusClearAt_Time0), + )! as NextcloudUserStatusClearAt_Time0; } catch (_) {} try { - result.$int = data as int?; + result._$int = data as int?; } catch (_) {} assert( [result._userStatusClearAtTime0, result._$int].where((final x) => x != null).isNotEmpty, @@ -4194,10 +4308,14 @@ class _$NextcloudUserStatusPublicStatus_ClearAtSerializer }) { final result = NextcloudUserStatusPublicStatus_ClearAtBuilder()..data = JsonObject(data); try { - result.userStatusClearAt = NextcloudUserStatusClearAt.fromJson(data).toBuilder(); + result._userStatusClearAt = (jsonSerializers.deserialize( + data, + specifiedType: const FullType(NextcloudUserStatusClearAt), + )! as NextcloudUserStatusClearAt) + .toBuilder(); } catch (_) {} try { - result.$int = data as int?; + result._$int = data as int?; } catch (_) {} assert( [result._userStatusClearAt, result._$int].where((final x) => x != null).isNotEmpty, @@ -4317,10 +4435,18 @@ class _$NextcloudUserStatusGetPublicStatus_Ocs_DataSerializer }) { final result = NextcloudUserStatusGetPublicStatus_Ocs_DataBuilder()..data = JsonObject(data); try { - result.builtListJsonObject = BuiltList((data as List).map(JsonObject.new)).toBuilder(); + result._builtListJsonObject = (jsonSerializers.deserialize( + data, + specifiedType: const FullType(BuiltList, [FullType(JsonObject)]), + )! as BuiltList) + .toBuilder(); } catch (_) {} try { - result.userStatusPublicStatus = NextcloudUserStatusPublicStatus.fromJson(data).toBuilder(); + result._userStatusPublicStatus = (jsonSerializers.deserialize( + data, + specifiedType: const FullType(NextcloudUserStatusPublicStatus), + )! as NextcloudUserStatusPublicStatus) + .toBuilder(); } catch (_) {} assert( [result._builtListJsonObject, result._userStatusPublicStatus].where((final x) => x != null).isNotEmpty, @@ -4402,10 +4528,14 @@ class _$NextcloudUserStatusStatus_ClearAtSerializer implements PrimitiveSerializ }) { final result = NextcloudUserStatusStatus_ClearAtBuilder()..data = JsonObject(data); try { - result.userStatusClearAt = NextcloudUserStatusClearAt.fromJson(data).toBuilder(); + result._userStatusClearAt = (jsonSerializers.deserialize( + data, + specifiedType: const FullType(NextcloudUserStatusClearAt), + )! as NextcloudUserStatusClearAt) + .toBuilder(); } catch (_) {} try { - result.$int = data as int?; + result._$int = data as int?; } catch (_) {} assert( [result._userStatusClearAt, result._$int].where((final x) => x != null).isNotEmpty, @@ -4475,10 +4605,18 @@ class _$NextcloudUserStatusGetStatus_Ocs_DataSerializer }) { final result = NextcloudUserStatusGetStatus_Ocs_DataBuilder()..data = JsonObject(data); try { - result.builtListJsonObject = BuiltList((data as List).map(JsonObject.new)).toBuilder(); + result._builtListJsonObject = (jsonSerializers.deserialize( + data, + specifiedType: const FullType(BuiltList, [FullType(JsonObject)]), + )! as BuiltList) + .toBuilder(); } catch (_) {} try { - result.userStatusStatus = NextcloudUserStatusStatus.fromJson(data).toBuilder(); + result._userStatusStatus = (jsonSerializers.deserialize( + data, + specifiedType: const FullType(NextcloudUserStatusStatus), + )! as NextcloudUserStatusStatus) + .toBuilder(); } catch (_) {} assert( [result._builtListJsonObject, result._userStatusStatus].where((final x) => x != null).isNotEmpty, @@ -4561,10 +4699,14 @@ class _$NextcloudUserStatusPredefinedStatus_ClearAtSerializer }) { final result = NextcloudUserStatusPredefinedStatus_ClearAtBuilder()..data = JsonObject(data); try { - result.userStatusClearAt = NextcloudUserStatusClearAt.fromJson(data).toBuilder(); + result._userStatusClearAt = (jsonSerializers.deserialize( + data, + specifiedType: const FullType(NextcloudUserStatusClearAt), + )! as NextcloudUserStatusClearAt) + .toBuilder(); } catch (_) {} try { - result.$int = data as int?; + result._$int = data as int?; } catch (_) {} assert( [result._userStatusClearAt, result._$int].where((final x) => x != null).isNotEmpty, @@ -4789,7 +4931,104 @@ abstract class NextcloudNotificationsNotificationDecryptedSubject NextcloudNotificationsNotificationDecryptedSubject, ]) final Serializers serializers = (_$serializers.toBuilder() - ..addBuilderFactory(const FullType(BuiltList, [FullType(int)]), ListBuilder.new)) + ..addBuilderFactory(const FullType(NextcloudCoreServerStatus), NextcloudCoreServerStatus.new) + ..addBuilderFactory(const FullType(NextcloudCoreServerCapabilities), NextcloudCoreServerCapabilities.new) + ..addBuilderFactory(const FullType(NextcloudCoreNavigationApps), NextcloudCoreNavigationApps.new) + ..addBuilderFactory(const FullType(NextcloudCoreLoginFlowInit), NextcloudCoreLoginFlowInit.new) + ..addBuilderFactory(const FullType(NextcloudCoreLoginFlowResult), NextcloudCoreLoginFlowResult.new) + ..addBuilderFactory(const FullType(List, [FullType(int)]), ListBuilder.new) + ..addBuilderFactory(const FullType(NextcloudCoreAutocompleteResult), NextcloudCoreAutocompleteResult.new) + ..addBuilderFactory(const FullType(NextcloudNewsSupportedAPIVersions), NextcloudNewsSupportedAPIVersions.new) + ..addBuilderFactory(const FullType(NextcloudNewsListFolders), NextcloudNewsListFolders.new) + ..addBuilderFactory(const FullType(NextcloudNewsListFolders), NextcloudNewsListFolders.new) + ..addBuilderFactory(const FullType(NextcloudNewsListFeeds), NextcloudNewsListFeeds.new) + ..addBuilderFactory(const FullType(NextcloudNewsListFeeds), NextcloudNewsListFeeds.new) + ..addBuilderFactory(const FullType(NextcloudNewsListArticles), NextcloudNewsListArticles.new) + ..addBuilderFactory(const FullType(NextcloudNewsListArticles), NextcloudNewsListArticles.new) + ..addBuilderFactory(const FullType(NextcloudNotesNote), NextcloudNotesNote.new) + ..addBuilderFactory( + const FullType(BuiltList, [FullType(NextcloudNotesNote)]), + ListBuilder.new, + ) + ..addBuilderFactory(const FullType(NextcloudNotesNote), NextcloudNotesNote.new) + ..addBuilderFactory(const FullType(NextcloudNotesNote), NextcloudNotesNote.new) + ..addBuilderFactory(const FullType(NextcloudNotesNote), NextcloudNotesNote.new) + ..addBuilderFactory(const FullType(NextcloudNotesSettings), NextcloudNotesSettings.new) + ..addBuilderFactory(const FullType(NextcloudNotesSettings), NextcloudNotesSettings.new) + ..addBuilderFactory( + const FullType(NextcloudNotificationsListNotifications), + NextcloudNotificationsListNotifications.new, + ) + ..addBuilderFactory( + const FullType(NextcloudNotificationsGetNotification), + NextcloudNotificationsGetNotification.new, + ) + ..addBuilderFactory(const FullType(NextcloudEmptyOCS), NextcloudEmptyOCS.new) + ..addBuilderFactory( + const FullType(NextcloudNotificationsPushServerRegistration), + NextcloudNotificationsPushServerRegistration.new, + ) + ..addBuilderFactory(const FullType(NextcloudEmptyOCS), NextcloudEmptyOCS.new) + ..addBuilderFactory(const FullType(NextcloudProvisioningApiUser), NextcloudProvisioningApiUser.new) + ..addBuilderFactory(const FullType(NextcloudProvisioningApiUser), NextcloudProvisioningApiUser.new) + ..addBuilderFactory( + const FullType(NextcloudUnifiedPushProviderCheckResponse200ApplicationJson), + NextcloudUnifiedPushProviderCheckResponse200ApplicationJson.new, + ) + ..addBuilderFactory( + const FullType(NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson), + NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson.new, + ) + ..addBuilderFactory( + const FullType(NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson), + NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson.new, + ) + ..addBuilderFactory( + const FullType(NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson), + NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson.new, + ) + ..addBuilderFactory( + const FullType(NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson), + NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson.new, + ) + ..addBuilderFactory( + const FullType(NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson), + NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson.new, + ) + ..addBuilderFactory( + const FullType(NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson), + NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson.new, + ) + ..addBuilderFactory( + const FullType(NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson), + NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson.new, + ) + ..addBuilderFactory( + const FullType(NextcloudUnifiedPushProviderPushResponse201ApplicationJson), + NextcloudUnifiedPushProviderPushResponse201ApplicationJson.new, + ) + ..addBuilderFactory( + const FullType(NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson), + NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson.new, + ) + ..addBuilderFactory( + const FullType(NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson), + NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson.new, + ) + ..addBuilderFactory( + const FullType(NextcloudUserStatusGetPublicStatuses), + NextcloudUserStatusGetPublicStatuses.new, + ) + ..addBuilderFactory(const FullType(NextcloudUserStatusGetPublicStatus), NextcloudUserStatusGetPublicStatus.new) + ..addBuilderFactory(const FullType(NextcloudUserStatusGetStatus), NextcloudUserStatusGetStatus.new) + ..addBuilderFactory(const FullType(NextcloudUserStatusGetStatus), NextcloudUserStatusGetStatus.new) + ..addBuilderFactory(const FullType(NextcloudUserStatusGetStatus), NextcloudUserStatusGetStatus.new) + ..addBuilderFactory(const FullType(NextcloudUserStatusGetStatus), NextcloudUserStatusGetStatus.new) + ..addBuilderFactory( + const FullType(NextcloudUserStatusPredefinedStatuses), + NextcloudUserStatusPredefinedStatuses.new, + ) + ..addBuilderFactory(const FullType(NextcloudUserStatusHeartbeat), NextcloudUserStatusHeartbeat.new)) .build(); final Serializers jsonSerializers = (serializers.toBuilder() From 4acb257eec3fcb531a81f0465123dc70437a4490 Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Thu, 18 May 2023 15:04:27 +0200 Subject: [PATCH 5/5] nextcloud: adapt unit test --- packages/nextcloud/test/core.dart | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/nextcloud/test/core.dart b/packages/nextcloud/test/core.dart index bd53f964..12e52c74 100644 --- a/packages/nextcloud/test/core.dart +++ b/packages/nextcloud/test/core.dart @@ -1,4 +1,3 @@ -import 'package:built_collection/built_collection.dart'; import 'package:nextcloud/nextcloud.dart'; import 'package:test/test.dart'; @@ -68,10 +67,10 @@ Future run(final DockerImage image) async { search: '', itemType: 'call', itemId: 'new', - shareTypes: BuiltList([ + shareTypes: [ ShareType.user.code, ShareType.group.code, - ]), + ], ); expect(response.ocs.data, hasLength(3));