Browse Source

Merge pull request #324 from Leptopoda/fix/#321

built_value followup
pull/325/head
Nikolas Rimikis 2 years ago committed by GitHub
parent
commit
9632c2b208
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 32
      packages/dynamite/dynamite/lib/src/openapi_builder.dart
  2. 16
      packages/dynamite/dynamite/lib/src/type_result/base.dart
  3. 14
      packages/dynamite/dynamite/lib/src/type_result/enum.dart
  4. 18
      packages/dynamite/dynamite/lib/src/type_result/list.dart
  5. 27
      packages/dynamite/dynamite/lib/src/type_result/map.dart
  6. 32
      packages/dynamite/dynamite/lib/src/type_result/object.dart
  7. 33
      packages/dynamite/dynamite/lib/src/type_result/type_result.dart
  8. 433
      packages/nextcloud/lib/src/nextcloud.openapi.dart
  9. 5
      packages/nextcloud/test/core.dart

32
packages/dynamite/dynamite/lib/src/openapi_builder.dart

@ -726,7 +726,7 @@ class OpenAPIBuilder implements Builder {
), ),
parameter.schema!, parameter.schema!,
nullable: dartParameterNullable, nullable: dartParameterNullable,
); ).dartType;
state.resolvedTypeCombinations.add(result); state.resolvedTypeCombinations.add(result);
@ -779,7 +779,7 @@ class OpenAPIBuilder implements Builder {
code.write('if (${_toDartName(parameter.name)} != null) {'); code.write('if (${_toDartName(parameter.name)} != null) {');
} }
final value = result.encode( final value = result.encode(
result.serialize(_toDartName(parameter.name)), _toDartName(parameter.name),
onlyChildren: result is TypeResultList && parameter.in_ == 'query', onlyChildren: result is TypeResultList && parameter.in_ == 'query',
// Objects inside the query always have to be interpreted in some way // Objects inside the query always have to be interpreted in some way
mimeType: 'application/json', mimeType: 'application/json',
@ -858,7 +858,7 @@ class OpenAPIBuilder implements Builder {
code.write('if ($parameterName != null) {'); code.write('if ($parameterName != null) {');
} }
code.write( 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) { if (dartParameterNullable) {
code.write('}'); code.write('}');
@ -930,6 +930,8 @@ class OpenAPIBuilder implements Builder {
), ),
mediaType.schema!, mediaType.schema!,
); );
state.resolvedTypeCombinations.add(result);
if (mimeType == '*/*' || mimeType.startsWith('image/')) { if (mimeType == '*/*' || mimeType.startsWith('image/')) {
dataType = 'Uint8List'; dataType = 'Uint8List';
dataValue = 'response.body'; dataValue = 'response.body';
@ -1493,9 +1495,13 @@ TypeResult resolveObject(
return [ return [
Code("case '$propertyName':"), Code("case '$propertyName':"),
if (result.className != 'String') ...[ if (result.className != 'String') ...[
Code( if (result is TypeResultBase || result is TypeResultEnum) ...[
'result.${_toDartName(propertyName)} = ${result.deserialize('jsonDecode(value!)', toBuilder: true)};', Code('result.${_toDartName(propertyName)} = ${result.deserialize(result.decode('value!'))};'),
), ] else ...[
Code(
'result.${_toDartName(propertyName)}.replace(${result.deserialize(result.decode('value!'))});',
),
],
] else ...[ ] else ...[
Code( Code(
'result.${_toDartName(propertyName)} = value!;', 'result.${_toDartName(propertyName)} = value!;',
@ -1512,7 +1518,7 @@ TypeResult resolveObject(
const Code('while (iterator.moveNext()) {'), const Code('while (iterator.moveNext()) {'),
const Code('final key = iterator.current! as String;'), const Code('final key = iterator.current! as String;'),
const Code('iterator.moveNext();'), const Code('iterator.moveNext();'),
const Code('final value = iterator.current as String?;'), const Code('final value = iterator.current! as String;'),
const Code('switch (key) {'), const Code('switch (key) {'),
for (final propertyName in schema.properties!.keys) ...[ for (final propertyName in schema.properties!.keys) ...[
...deserializeProperty(propertyName), ...deserializeProperty(propertyName),
@ -1749,7 +1755,11 @@ TypeResult resolveType(
'..data = JsonObject(data);', '..data = JsonObject(data);',
if (schema.allOf != null) ...[ if (schema.allOf != null) ...[
for (final result in results) ...[ 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 ...[ ] else ...[
if (schema.discriminator != null) ...[ if (schema.discriminator != null) ...[
@ -1786,7 +1796,11 @@ TypeResult resolveType(
], ],
], ],
'try {', '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 (_) {', '} catch (_) {',
if (schema.discriminator != null) ...[ if (schema.discriminator != null) ...[
'rethrow;', 'rethrow;',

16
packages/dynamite/dynamite/lib/src/type_result/base.dart

@ -26,7 +26,7 @@ class TypeResultBase extends TypeResult {
return 'JsonObject($object)${nullable ? '?' : ''}'; return 'JsonObject($object)${nullable ? '?' : ''}';
} }
return '($object as $name ${nullable ? '?' : ''})'; return '($object as $nullableName)';
} }
@override @override
@ -42,4 +42,18 @@ class TypeResultBase extends TypeResult {
throw Exception('Can not decode "$name" from String'); 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);
}
} }

14
packages/dynamite/dynamite/lib/src/type_result/enum.dart

@ -12,20 +12,18 @@ class TypeResultEnum extends TypeResult {
@override @override
String? get _builderFactory => null; String? get _builderFactory => null;
@override
String serialize(final String object) => '$object.name';
@override @override
String encode( String encode(
final String object, { final String object, {
final bool onlyChildren = false, final bool onlyChildren = false,
final String? mimeType, final String? mimeType,
}) => }) {
subType.encode(object); if (subType.name == 'String') {
return '$object.name';
}
@override return super.encode(object, mimeType: mimeType);
String deserialize(final String object, {final bool toBuilder = false}) => }
'$name.valueOf($object as ${subType.name})';
@override @override
String decode(final String object) => subType.decode(object); String decode(final String object) => subType.decode(object);

18
packages/dynamite/dynamite/lib/src/type_result/list.dart

@ -12,9 +12,6 @@ class TypeResultList extends TypeResult {
@override @override
String? get _builderFactory => '..addBuilderFactory($fullType, ListBuilder<${subType.className}>.new)'; String? get _builderFactory => '..addBuilderFactory($fullType, ListBuilder<${subType.className}>.new)';
@override
String serialize(final String object) => '$object.map((final e) => ${subType.serialize('e')})';
@override @override
String encode( String encode(
final String object, { final String object, {
@ -25,20 +22,9 @@ class TypeResultList extends TypeResult {
return '$object.map((final e) => ${subType.encode('e', mimeType: mimeType)})'; return '$object.map((final e) => ${subType.encode('e', mimeType: mimeType)})';
} }
switch (mimeType) { return super.encode(object, mimeType: 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 @override
String deserialize(final String object, {final bool toBuilder = false}) => TypeResultList get dartType => TypeResultList('List', subType, nullable: nullable);
'$name(($object as List).map((final e) => ${subType.deserialize('e')}))${toBuilder ? '.toBuilder()' : ''}';
@override
String decode(final String object) => 'json.decode($object as String)';
} }

27
packages/dynamite/dynamite/lib/src/type_result/map.dart

@ -10,31 +10,8 @@ class TypeResultMap extends TypeResult {
TypeResult get subType => generics[1]; TypeResult get subType => generics[1];
@override @override
String? get _builderFactory => '..addBuilderFactory($fullType, ListBuilder<String, ${subType.className}>.new)'; String? get _builderFactory => '..addBuilderFactory($fullType, MapBuilder<String, ${subType.className}>.new)';
@override @override
String serialize(final String object) => object; TypeResultMap get dartType => TypeResultMap('Map', subType, nullable: nullable);
@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<String, ${subType.name}>)${toBuilder ? '.toBuilder()' : ''}';
@override
String decode(final String object) => 'json.decode($object as String)';
} }

32
packages/dynamite/dynamite/lib/src/type_result/object.dart

@ -15,15 +15,6 @@ class TypeResultObject extends TypeResult {
@override @override
String? get _builderFactory => '..addBuilderFactory($fullType, $name.new)'; 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 @override
String encode( String encode(
final String object, { final String object, {
@ -32,28 +23,9 @@ class TypeResultObject extends TypeResult {
}) { }) {
if (className == _contentString) { if (className == _contentString) {
assert(mimeType == 'application/json', '$_contentString should have a mimeType of application/json'); assert(mimeType == 'application/json', '$_contentString should have a mimeType of application/json');
return object; return serialize(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"');
} }
}
@override return super.encode(object, onlyChildren: onlyChildren, mimeType: mimeType);
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()' : ''}';
} }
@override
String decode(final String object) => 'json.decode($object as String)';
} }

33
packages/dynamite/dynamite/lib/src/type_result/type_result.dart

@ -46,17 +46,42 @@ abstract class TypeResult {
String? get _builderFactory; 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( String encode(
final String object, { final String object, {
final bool onlyChildren = false, final bool onlyChildren = false,
final String? mimeType, 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<String, dynamic>).query';
default:
throw Exception('Can not encode mime type "$mimeType"');
}
}
/// Nullable TypeName
String get nullableName => nullable ? '$name?' : name; String get nullableName => nullable ? '$name?' : name;
/// Native dart type equivalent
// ignore: avoid_returning_this
TypeResult get dartType => this;
} }

433
packages/nextcloud/lib/src/nextcloud.openapi.dart

@ -186,7 +186,10 @@ class NextcloudCoreClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -210,7 +213,10 @@ class NextcloudCoreClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -234,7 +240,10 @@ class NextcloudCoreClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -253,7 +262,10 @@ class NextcloudCoreClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -273,7 +285,10 @@ class NextcloudCoreClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -389,7 +404,7 @@ class NextcloudCoreClient {
required final String search, required final String search,
required final String itemType, required final String itemType,
required final String itemId, required final String itemId,
required final BuiltList<int> shareTypes, required final List<int> shareTypes,
final String? sorter, final String? sorter,
final int limit = 10, final int limit = 10,
}) async { }) async {
@ -407,7 +422,7 @@ class NextcloudCoreClient {
queryParameters['search'] = search; queryParameters['search'] = search;
queryParameters['itemType'] = itemType; queryParameters['itemType'] = itemType;
queryParameters['itemId'] = itemId; 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) { if (sorter != null) {
queryParameters['sorter'] = sorter; queryParameters['sorter'] = sorter;
} }
@ -421,7 +436,10 @@ class NextcloudCoreClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -475,7 +493,10 @@ class NextcloudNewsClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -499,7 +520,10 @@ class NextcloudNewsClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -524,7 +548,10 @@ class NextcloudNewsClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -625,7 +652,10 @@ class NextcloudNewsClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -656,7 +686,10 @@ class NextcloudNewsClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -811,7 +844,10 @@ class NextcloudNewsClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -848,7 +884,10 @@ class NextcloudNewsClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -995,9 +1034,10 @@ class NextcloudNotesClient {
body, body,
); );
if (response.statusCode == 200) { if (response.statusCode == 200) {
return BuiltList<NextcloudNotesNote>( return jsonSerializers.deserialize(
(json.decode(utf8.decode(response.body)) as List).map((final e) => NextcloudNotesNote.fromJson(e as Object)), json.decode(utf8.decode(response.body)),
); specifiedType: const FullType(BuiltList, [FullType(NextcloudNotesNote)]),
)! as BuiltList<NextcloudNotesNote>;
} }
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1042,7 +1082,10 @@ class NextcloudNotesClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1077,7 +1120,10 @@ class NextcloudNotesClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1128,7 +1174,10 @@ class NextcloudNotesClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1177,7 +1226,10 @@ class NextcloudNotesClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1195,7 +1247,11 @@ class NextcloudNotesClient {
throw Exception('Missing authentication for basic_auth'); throw Exception('Missing authentication for basic_auth');
} }
headers['Content-Type'] = 'application/json'; 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( final response = await rootClient.doRequest(
'put', 'put',
Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(), Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null).toString(),
@ -1203,7 +1259,10 @@ class NextcloudNotesClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1233,9 +1292,10 @@ class NextcloudNotificationsClient {
body, body,
); );
if (response.statusCode == 200) { if (response.statusCode == 200) {
return NextcloudNotificationsListNotifications.fromJson( return jsonSerializers.deserialize(
json.decode(utf8.decode(response.body)) as Object, json.decode(utf8.decode(response.body)),
); specifiedType: const FullType(NextcloudNotificationsListNotifications),
)! as NextcloudNotificationsListNotifications;
} }
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1284,9 +1344,10 @@ class NextcloudNotificationsClient {
body, body,
); );
if (response.statusCode == 200) { if (response.statusCode == 200) {
return NextcloudNotificationsGetNotification.fromJson( return jsonSerializers.deserialize(
json.decode(utf8.decode(response.body)) as Object, json.decode(utf8.decode(response.body)),
); specifiedType: const FullType(NextcloudNotificationsGetNotification),
)! as NextcloudNotificationsGetNotification;
} }
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1311,7 +1372,10 @@ class NextcloudNotificationsClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1342,9 +1406,10 @@ class NextcloudNotificationsClient {
body, body,
); );
if (response.statusCode == 201) { if (response.statusCode == 201) {
return NextcloudNotificationsPushServerRegistration.fromJson( return jsonSerializers.deserialize(
json.decode(utf8.decode(response.body)) as Object, json.decode(utf8.decode(response.body)),
); specifiedType: const FullType(NextcloudNotificationsPushServerRegistration),
)! as NextcloudNotificationsPushServerRegistration;
} }
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1401,7 +1466,10 @@ class NextcloudNotificationsClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1431,7 +1499,10 @@ class NextcloudProvisioningApiClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1456,7 +1527,10 @@ class NextcloudProvisioningApiClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1487,9 +1561,10 @@ class NextcloudUnifiedPushProviderClient {
body, body,
); );
if (response.statusCode == 200) { if (response.statusCode == 200) {
return NextcloudUnifiedPushProviderCheckResponse200ApplicationJson.fromJson( return jsonSerializers.deserialize(
json.decode(utf8.decode(response.body)) as Object, json.decode(utf8.decode(response.body)),
); specifiedType: const FullType(NextcloudUnifiedPushProviderCheckResponse200ApplicationJson),
)! as NextcloudUnifiedPushProviderCheckResponse200ApplicationJson;
} }
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1519,9 +1594,10 @@ class NextcloudUnifiedPushProviderClient {
body, body,
); );
if (response.statusCode == 200) { if (response.statusCode == 200) {
return NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson.fromJson( return jsonSerializers.deserialize(
json.decode(utf8.decode(response.body)) as Object, json.decode(utf8.decode(response.body)),
); specifiedType: const FullType(NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson),
)! as NextcloudUnifiedPushProviderSetKeepaliveResponse200ApplicationJson;
} }
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1549,9 +1625,10 @@ class NextcloudUnifiedPushProviderClient {
body, body,
); );
if (response.statusCode == 200) { if (response.statusCode == 200) {
return NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson.fromJson( return jsonSerializers.deserialize(
json.decode(utf8.decode(response.body)) as Object, json.decode(utf8.decode(response.body)),
); specifiedType: const FullType(NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson),
)! as NextcloudUnifiedPushProviderCreateDeviceResponse200ApplicationJson;
} }
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1581,9 +1658,10 @@ class NextcloudUnifiedPushProviderClient {
body, body,
); );
if (response.statusCode == 401) { if (response.statusCode == 401) {
return NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson.fromJson( return jsonSerializers.deserialize(
json.decode(utf8.decode(response.body)) as Object, json.decode(utf8.decode(response.body)),
); specifiedType: const FullType(NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson),
)! as NextcloudUnifiedPushProviderSyncDeviceResponse401ApplicationJson;
} }
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1611,9 +1689,10 @@ class NextcloudUnifiedPushProviderClient {
body, body,
); );
if (response.statusCode == 200) { if (response.statusCode == 200) {
return NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson.fromJson( return jsonSerializers.deserialize(
json.decode(utf8.decode(response.body)) as Object, json.decode(utf8.decode(response.body)),
); specifiedType: const FullType(NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson),
)! as NextcloudUnifiedPushProviderDeleteDeviceResponse200ApplicationJson;
} }
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1643,9 +1722,10 @@ class NextcloudUnifiedPushProviderClient {
body, body,
); );
if (response.statusCode == 200) { if (response.statusCode == 200) {
return NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson.fromJson( return jsonSerializers.deserialize(
json.decode(utf8.decode(response.body)) as Object, json.decode(utf8.decode(response.body)),
); specifiedType: const FullType(NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson),
)! as NextcloudUnifiedPushProviderCreateAppResponse200ApplicationJson;
} }
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1673,9 +1753,10 @@ class NextcloudUnifiedPushProviderClient {
body, body,
); );
if (response.statusCode == 200) { if (response.statusCode == 200) {
return NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson.fromJson( return jsonSerializers.deserialize(
json.decode(utf8.decode(response.body)) as Object, json.decode(utf8.decode(response.body)),
); specifiedType: const FullType(NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson),
)! as NextcloudUnifiedPushProviderDeleteAppResponse200ApplicationJson;
} }
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1703,9 +1784,10 @@ class NextcloudUnifiedPushProviderClient {
body, body,
); );
if (response.statusCode == 200) { if (response.statusCode == 200) {
return NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson.fromJson( return jsonSerializers.deserialize(
json.decode(utf8.decode(response.body)) as Object, json.decode(utf8.decode(response.body)),
); specifiedType: const FullType(NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson),
)! as NextcloudUnifiedPushProviderUnifiedpushDiscoveryResponse200ApplicationJson;
} }
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1731,9 +1813,10 @@ class NextcloudUnifiedPushProviderClient {
body, body,
); );
if (response.statusCode == 201) { if (response.statusCode == 201) {
return NextcloudUnifiedPushProviderPushResponse201ApplicationJson.fromJson( return jsonSerializers.deserialize(
json.decode(utf8.decode(response.body)) as Object, json.decode(utf8.decode(response.body)),
); specifiedType: const FullType(NextcloudUnifiedPushProviderPushResponse201ApplicationJson),
)! as NextcloudUnifiedPushProviderPushResponse201ApplicationJson;
} }
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1758,9 +1841,10 @@ class NextcloudUnifiedPushProviderClient {
body, body,
); );
if (response.statusCode == 200) { if (response.statusCode == 200) {
return NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson.fromJson( return jsonSerializers.deserialize(
json.decode(utf8.decode(response.body)) as Object, json.decode(utf8.decode(response.body)),
); specifiedType: const FullType(NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson),
)! as NextcloudUnifiedPushProviderGatewayMatrixDiscoveryResponse200ApplicationJson;
} }
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1785,9 +1869,10 @@ class NextcloudUnifiedPushProviderClient {
body, body,
); );
if (response.statusCode == 200) { if (response.statusCode == 200) {
return NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson.fromJson( return jsonSerializers.deserialize(
json.decode(utf8.decode(response.body)) as Object, json.decode(utf8.decode(response.body)),
); specifiedType: const FullType(NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson),
)! as NextcloudUnifiedPushProviderGatewayMatrixResponse200ApplicationJson;
} }
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1817,7 +1902,10 @@ class NextcloudUserStatusClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1842,7 +1930,10 @@ class NextcloudUserStatusClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1866,7 +1957,10 @@ class NextcloudUserStatusClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1891,7 +1985,10 @@ class NextcloudUserStatusClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1922,7 +2019,10 @@ class NextcloudUserStatusClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -1959,7 +2059,10 @@ class NextcloudUserStatusClient {
body, body,
); );
if (response.statusCode == 200) { 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 throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -2005,9 +2108,10 @@ class NextcloudUserStatusClient {
body, body,
); );
if (response.statusCode == 200) { if (response.statusCode == 200) {
return NextcloudUserStatusPredefinedStatuses.fromJson( return jsonSerializers.deserialize(
json.decode(utf8.decode(response.body)) as Object, json.decode(utf8.decode(response.body)),
); specifiedType: const FullType(NextcloudUserStatusPredefinedStatuses),
)! as NextcloudUserStatusPredefinedStatuses;
} }
throw NextcloudApiException.fromResponse(response); // coverage:ignore-line throw NextcloudApiException.fromResponse(response); // coverage:ignore-line
} }
@ -2032,7 +2136,10 @@ class NextcloudUserStatusClient {
body, body,
); );
if (response.statusCode == 200) { 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 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); final result = NextcloudCoreNavigationApps_Ocs_Data_OrderBuilder()..data = JsonObject(data);
try { try {
result.$int = data as int?; result._$int = data as int?;
} catch (_) {} } catch (_) {}
try { try {
result.string = data as String?; result._string = data as String?;
} catch (_) {} } catch (_) {}
assert([result._$int, result._string].where((final x) => x != null).isNotEmpty, 'Need oneOf for ${result._data}'); assert([result._$int, result._string].where((final x) => x != null).isNotEmpty, 'Need oneOf for ${result._data}');
return result.build(); return result.build();
@ -3295,10 +3402,14 @@ class _$NextcloudCoreAutocompleteResult_Ocs_Data_StatusSerializer
}) { }) {
final result = NextcloudCoreAutocompleteResult_Ocs_Data_StatusBuilder()..data = JsonObject(data); final result = NextcloudCoreAutocompleteResult_Ocs_Data_StatusBuilder()..data = JsonObject(data);
try { try {
result.builtListJsonObject = BuiltList<JsonObject>((data as List).map(JsonObject.new)).toBuilder(); result._builtListJsonObject = (jsonSerializers.deserialize(
data,
specifiedType: const FullType(BuiltList, [FullType(JsonObject)]),
)! as BuiltList<JsonObject>)
.toBuilder();
} catch (_) {} } catch (_) {}
try { try {
result.string = data as String?; result._string = data as String?;
} catch (_) {} } catch (_) {}
assert( assert(
[result._builtListJsonObject, result._string].where((final x) => x != null).isNotEmpty, [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); final result = NextcloudUserStatusClearAt_TimeBuilder()..data = JsonObject(data);
try { try {
result.userStatusClearAtTime0 = NextcloudUserStatusClearAt_Time0.valueOf(data as String); result._userStatusClearAtTime0 = jsonSerializers.deserialize(
data,
specifiedType: const FullType(NextcloudUserStatusClearAt_Time0),
)! as NextcloudUserStatusClearAt_Time0;
} catch (_) {} } catch (_) {}
try { try {
result.$int = data as int?; result._$int = data as int?;
} catch (_) {} } catch (_) {}
assert( assert(
[result._userStatusClearAtTime0, result._$int].where((final x) => x != null).isNotEmpty, [result._userStatusClearAtTime0, result._$int].where((final x) => x != null).isNotEmpty,
@ -4194,10 +4308,14 @@ class _$NextcloudUserStatusPublicStatus_ClearAtSerializer
}) { }) {
final result = NextcloudUserStatusPublicStatus_ClearAtBuilder()..data = JsonObject(data); final result = NextcloudUserStatusPublicStatus_ClearAtBuilder()..data = JsonObject(data);
try { try {
result.userStatusClearAt = NextcloudUserStatusClearAt.fromJson(data).toBuilder(); result._userStatusClearAt = (jsonSerializers.deserialize(
data,
specifiedType: const FullType(NextcloudUserStatusClearAt),
)! as NextcloudUserStatusClearAt)
.toBuilder();
} catch (_) {} } catch (_) {}
try { try {
result.$int = data as int?; result._$int = data as int?;
} catch (_) {} } catch (_) {}
assert( assert(
[result._userStatusClearAt, result._$int].where((final x) => x != null).isNotEmpty, [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); final result = NextcloudUserStatusGetPublicStatus_Ocs_DataBuilder()..data = JsonObject(data);
try { try {
result.builtListJsonObject = BuiltList<JsonObject>((data as List).map(JsonObject.new)).toBuilder(); result._builtListJsonObject = (jsonSerializers.deserialize(
data,
specifiedType: const FullType(BuiltList, [FullType(JsonObject)]),
)! as BuiltList<JsonObject>)
.toBuilder();
} catch (_) {} } catch (_) {}
try { try {
result.userStatusPublicStatus = NextcloudUserStatusPublicStatus.fromJson(data).toBuilder(); result._userStatusPublicStatus = (jsonSerializers.deserialize(
data,
specifiedType: const FullType(NextcloudUserStatusPublicStatus),
)! as NextcloudUserStatusPublicStatus)
.toBuilder();
} catch (_) {} } catch (_) {}
assert( assert(
[result._builtListJsonObject, result._userStatusPublicStatus].where((final x) => x != null).isNotEmpty, [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); final result = NextcloudUserStatusStatus_ClearAtBuilder()..data = JsonObject(data);
try { try {
result.userStatusClearAt = NextcloudUserStatusClearAt.fromJson(data).toBuilder(); result._userStatusClearAt = (jsonSerializers.deserialize(
data,
specifiedType: const FullType(NextcloudUserStatusClearAt),
)! as NextcloudUserStatusClearAt)
.toBuilder();
} catch (_) {} } catch (_) {}
try { try {
result.$int = data as int?; result._$int = data as int?;
} catch (_) {} } catch (_) {}
assert( assert(
[result._userStatusClearAt, result._$int].where((final x) => x != null).isNotEmpty, [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); final result = NextcloudUserStatusGetStatus_Ocs_DataBuilder()..data = JsonObject(data);
try { try {
result.builtListJsonObject = BuiltList<JsonObject>((data as List).map(JsonObject.new)).toBuilder(); result._builtListJsonObject = (jsonSerializers.deserialize(
data,
specifiedType: const FullType(BuiltList, [FullType(JsonObject)]),
)! as BuiltList<JsonObject>)
.toBuilder();
} catch (_) {} } catch (_) {}
try { try {
result.userStatusStatus = NextcloudUserStatusStatus.fromJson(data).toBuilder(); result._userStatusStatus = (jsonSerializers.deserialize(
data,
specifiedType: const FullType(NextcloudUserStatusStatus),
)! as NextcloudUserStatusStatus)
.toBuilder();
} catch (_) {} } catch (_) {}
assert( assert(
[result._builtListJsonObject, result._userStatusStatus].where((final x) => x != null).isNotEmpty, [result._builtListJsonObject, result._userStatusStatus].where((final x) => x != null).isNotEmpty,
@ -4561,10 +4699,14 @@ class _$NextcloudUserStatusPredefinedStatus_ClearAtSerializer
}) { }) {
final result = NextcloudUserStatusPredefinedStatus_ClearAtBuilder()..data = JsonObject(data); final result = NextcloudUserStatusPredefinedStatus_ClearAtBuilder()..data = JsonObject(data);
try { try {
result.userStatusClearAt = NextcloudUserStatusClearAt.fromJson(data).toBuilder(); result._userStatusClearAt = (jsonSerializers.deserialize(
data,
specifiedType: const FullType(NextcloudUserStatusClearAt),
)! as NextcloudUserStatusClearAt)
.toBuilder();
} catch (_) {} } catch (_) {}
try { try {
result.$int = data as int?; result._$int = data as int?;
} catch (_) {} } catch (_) {}
assert( assert(
[result._userStatusClearAt, result._$int].where((final x) => x != null).isNotEmpty, [result._userStatusClearAt, result._$int].where((final x) => x != null).isNotEmpty,
@ -4789,7 +4931,104 @@ abstract class NextcloudNotificationsNotificationDecryptedSubject
NextcloudNotificationsNotificationDecryptedSubject, NextcloudNotificationsNotificationDecryptedSubject,
]) ])
final Serializers serializers = (_$serializers.toBuilder() final Serializers serializers = (_$serializers.toBuilder()
..addBuilderFactory(const FullType(BuiltList, [FullType(int)]), ListBuilder<int>.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<int>.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<NextcloudNotesNote>.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(); .build();
final Serializers jsonSerializers = (serializers.toBuilder() final Serializers jsonSerializers = (serializers.toBuilder()

5
packages/nextcloud/test/core.dart

@ -1,4 +1,3 @@
import 'package:built_collection/built_collection.dart';
import 'package:nextcloud/nextcloud.dart'; import 'package:nextcloud/nextcloud.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
@ -68,10 +67,10 @@ Future run(final DockerImage image) async {
search: '', search: '',
itemType: 'call', itemType: 'call',
itemId: 'new', itemId: 'new',
shareTypes: BuiltList([ shareTypes: [
ShareType.user.code, ShareType.user.code,
ShareType.group.code, ShareType.group.code,
]), ],
); );
expect(response.ocs.data, hasLength(3)); expect(response.ocs.data, hasLength(3));

Loading…
Cancel
Save