From 2ff9337310047995c7a4340e5037aa3b86f253ee Mon Sep 17 00:00:00 2001 From: jld3103 Date: Fri, 25 Nov 2022 12:12:38 +0100 Subject: [PATCH] dynamite,nextcloud: Refactor type and object resolving --- .../dynamite/lib/src/openapi_builder.dart | 931 ++-- .../nextcloud/lib/src/nextcloud.openapi.dart | 4212 ++++++++--------- 2 files changed, 2596 insertions(+), 2547 deletions(-) diff --git a/packages/dynamite/lib/src/openapi_builder.dart b/packages/dynamite/lib/src/openapi_builder.dart index c5c9a00f..33d4cad4 100644 --- a/packages/dynamite/lib/src/openapi_builder.dart +++ b/packages/dynamite/lib/src/openapi_builder.dart @@ -30,8 +30,7 @@ class OpenAPIBuilder implements Builder { ]; final hasAnySecurity = spec.security?.isNotEmpty ?? false; - final resolvedTypes = []; - final registeredJsonObjects = []; + final state = State(); final output = [ "import 'dart:convert';", "import 'dart:io';", @@ -302,442 +301,6 @@ class OpenAPIBuilder implements Builder { } } - TypeResult resolveType( - final String identifier, - final Schema schema, { - final bool ignoreEnum = false, - final Map? extraJsonSerializableValues, - final Map>? extraJsonKeyValues, - }) { - TypeResult? result; - if (schema.ref != null) { - final name = schema.ref!.split('/').last; - result = resolveType( - name, - spec.components!.schemas![name]!, - extraJsonSerializableValues: extraJsonSerializableValues, - ); - } else if (schema.ofs != null) { - if (!resolvedTypes.contains(identifier)) { - resolvedTypes.add(identifier); - - final results = schema.ofs! - .map( - (final s) => resolveType( - '$identifier${schema.ofs!.indexOf(s)}', - s, - extraJsonSerializableValues: extraJsonSerializableValues, - ), - ) - .toList(); - - output.add( - Class( - (final b) { - final fields = {}; - for (final result in results) { - final dartName = _toDartName(result.name); - fields[result.name] = _toFieldName(dartName, result.name); - } - - b - ..name = identifier - ..fields.addAll([ - Field( - (final b) { - b - ..name = '_data' - ..type = refer('dynamic') - ..modifier = FieldModifier.final$; - }, - ), - for (final result in results) ...[ - Field( - (final b) { - final s = schema.ofs![results.indexOf(result)]; - b - ..name = fields[result.name]! - ..type = refer(_makeNullable(result.name, true)) - ..modifier = FieldModifier.final$ - ..docs.addAll([ - if (s.description != null && s.description!.isNotEmpty) ...[ - '/// ${s.description!}', - ], - ]); - }, - ), - ], - ]) - ..constructors.addAll([ - Constructor( - (final b) => b - ..requiredParameters.add( - Parameter( - (final b) => b - ..name = '_data' - ..toThis = true, - ), - ) - ..optionalParameters.addAll([ - for (final result in results) ...[ - Parameter( - (final b) => b - ..name = fields[result.name]! - ..toThis = true - ..named = true, - ), - ], - ]), - ), - Constructor( - (final b) { - b - ..factory = true - ..name = 'fromJson' - ..requiredParameters.add( - Parameter( - (final b) => b - ..name = 'data' - ..type = refer('dynamic'), - ), - ) - ..body = Code( - [ - for (final result in results) ...[ - '${result.name}? ${fields[result.name]!};', - 'try {', - '${fields[result.name]!} = ${result.deserialize('data')};', - '} catch (_) {', - '}', - ], - if (schema.oneOf != null) ...[ - "assert([${fields.values.join(',')}].where((final x) => x != null).length == 1, 'Need oneOf');", - ], - if (schema.allOf != null) ...[ - "assert([${fields.values.join(',')}].where((final x) => x != null).length == ${fields.length}, 'Need allOf');", - ], - 'return $identifier(', - 'data,', - for (final result in results) ...[ - '${fields[result.name]!}: ${fields[result.name]!},', - ], - ');', - ].join(), - ); - }, - ), - ]) - ..methods.add( - Method( - (final b) => b - ..name = 'toJson' - ..returns = refer('dynamic') - ..lambda = true - ..body = const Code('_data'), - ), - ); - }, - ).accept(emitter).toString(), - ); - } - - result = TypeResultObject(identifier); - } else { - switch (schema.type) { - case 'boolean': - result = TypeResultBase('bool'); - break; - case 'integer': - result = TypeResultBase('int'); - break; - case 'number': - result = TypeResultBase('num'); - break; - case 'string': - switch (schema.format) { - case 'binary': - result = TypeResultBase('Uint8List'); - break; - case null: - result = TypeResultBase( - 'String', - ); - break; - } - break; - case 'array': - if (schema.items != null) { - final subResult = resolveType( - identifier, - schema.items!, - extraJsonSerializableValues: extraJsonSerializableValues, - ); - result = TypeResultList( - 'List<${subResult.name}>', - subResult, - ); - } else { - result = TypeResultList( - 'List', - TypeResultBase('dynamic'), - ); - } - break; - case 'object': - if (schema.properties == null) { - result = TypeResultBase('dynamic'); - break; - } - if (schema.properties!.isEmpty) { - result = TypeResultMap( - 'Map', - TypeResultBase('dynamic'), - ); - break; - } - - if (!resolvedTypes.contains(identifier)) { - resolvedTypes.add(identifier); - registeredJsonObjects.add(identifier); - output.add( - Class( - (final b) { - b - ..name = identifier - ..docs.addAll([ - if (schema.description != null && schema.description!.isNotEmpty) ...[ - '/// ${schema.description!}', - ], - ]) - ..annotations.add( - refer('JsonSerializable').call( - [], - { - if (schema.additionalProperties ?? false) ...{ - 'disallowUnrecognizedKeys': refer('false'), - }, - if (extraJsonSerializableValues != null) ...{ - for (final key in extraJsonSerializableValues.keys) ...{ - key: refer(extraJsonSerializableValues[key]!), - }, - }, - }, - ), - ) - ..constructors.addAll( - [ - Constructor( - (final b) => b - ..optionalParameters.addAll( - schema.properties!.keys.map( - (final propertyName) => Parameter( - (final b) { - final propertySchema = schema.properties![propertyName]!; - b - ..name = _toDartName(propertyName) - ..toThis = true - ..named = true - ..required = (schema.required ?? []).contains(propertyName) && - propertySchema.default_ == null; - if (propertySchema.default_ != null) { - final value = propertySchema.default_!.toString(); - final result = resolveType( - propertySchema.type!, - propertySchema, - ); - b.defaultTo = Code(_valueToEscapedValue(result.name, value)); - } - }, - ), - ), - ), - ), - Constructor( - (final b) => b - ..factory = true - ..name = 'fromJson' - ..lambda = true - ..requiredParameters.add( - Parameter( - (final b) => b - ..name = 'json' - ..type = refer('Map'), - ), - ) - ..body = Code('_\$${identifier}FromJson(json)'), - ), - ], - ) - ..methods.add( - Method( - (final b) => b - ..name = 'toJson' - ..returns = refer('Map') - ..lambda = true - ..body = Code('_\$${identifier}ToJson(this)'), - ), - ) - ..fields.addAll([ - for (final propertyName in schema.properties!.keys) ...[ - Field( - (final b) { - final result = resolveType( - '${identifier}_${_toDartName(propertyName, uppercaseFirstCharacter: true)}', - schema.properties![propertyName]!, - extraJsonSerializableValues: extraJsonSerializableValues, - ); - - final propertySchema = schema.properties![propertyName]!; - - b - ..name = _toDartName(propertyName) - ..type = refer( - _makeNullable( - result.name, - !(schema.required ?? []).contains(propertyName), - ), - ) - ..modifier = FieldModifier.final$ - ..docs.addAll([ - if (propertySchema.description != null && - propertySchema.description!.isNotEmpty) ...[ - '/// ${propertySchema.description!}', - ], - ]); - if (_toDartName(propertyName) != propertyName) { - b.annotations.add( - refer('JsonKey').call( - [], - { - 'name': refer("'$propertyName'"), - if (extraJsonKeyValues != null) ...{ - for (final p in extraJsonKeyValues.keys) ...{ - if (p == propertyName) ...{ - for (final key in extraJsonKeyValues[p]!.keys) ...{ - key: refer(extraJsonKeyValues[p]![key]!), - }, - }, - }, - }, - }, - ), - ); - } - }, - ) - ], - ]); - }, - ).accept(emitter).toString(), - ); - } - result = TypeResultObject(identifier); - break; - } - } - - if (result != null) { - if (!ignoreEnum && schema.enum_ != null) { - if (!resolvedTypes.contains(identifier)) { - resolvedTypes.add(identifier); - - output.add( - Enum( - (final b) => b - ..name = identifier - ..constructors.add( - Constructor( - (final b) => b - ..constant = true - ..requiredParameters.add( - Parameter( - (final b) => b - ..name = 'value' - ..toThis = true, - ), - ), - ), - ) - ..fields.add( - Field( - (final b) => b - ..name = 'value' - ..type = refer(result!.name) - ..modifier = FieldModifier.final$, - ), - ) - ..values.addAll( - schema.enum_!.map( - (final value) => EnumValue( - (final b) { - final result = resolveType( - '$identifier${_toDartName(value.toString(), uppercaseFirstCharacter: true)}', - schema, - ignoreEnum: true, - extraJsonSerializableValues: extraJsonSerializableValues, - ); - b - ..name = _toDartName(value.toString()) - ..arguments.add( - refer(_valueToEscapedValue(result.name, value)), - ); - if (_toDartName(value.toString()) != value.toString()) { - if (result.name != 'String' && result.name != 'int') { - throw Exception( - 'Sorry enum values are a bit broken. ' - 'See https://github.com/google/json_serializable.dart/issues/616. ' - 'Please remove the enum values on $identifier.', - ); - } - b.annotations.add( - refer('JsonValue').call([ - refer(_valueToEscapedValue(result.name, value.toString())), - ]), - ); - } - }, - ), - ), - ) - ..methods.add( - Method( - (final b) => b - ..name = 'fromValue' - ..static = true - ..returns = refer(identifier) - ..requiredParameters.add( - Parameter( - (final b) => b - ..name = 'value' - ..type = refer(result!.name), - ), - ) - ..body = Code( - [ - 'switch (value) {', - for (final value in schema.enum_!) ...[ - 'case ${_valueToEscapedValue(result!.name, value)}:', - 'return $identifier.${_toDartName(value.toString())};', - ], - 'default:', - 'throw Exception(\'Can not parse UserStatusClearAtTime0 from "\$value"\');', - '}', - ].join(), - ), - ), - ), - ).accept(emitter).toString(), - ); - } - result = TypeResultEnum(identifier, result); - } - - return result; - } - - throw Exception('Can not convert OpenAPI type "${schema.toJson()}" to a Dart type'); - } - for (final tag in tags) { final isRootClient = tag == null; final paths = {}; @@ -986,6 +549,8 @@ class OpenAPIBuilder implements Builder { ); final result = resolveType( + spec, + state, _toDartName( parameter.name, uppercaseFirstCharacter: true, @@ -1004,6 +569,8 @@ class OpenAPIBuilder implements Builder { if (parameter.schema!.default_ != null) { final value = parameter.schema!.default_!.toString(); final result = resolveType( + spec, + state, parameter.schema!.type!, parameter.schema!, ); @@ -1059,6 +626,8 @@ class OpenAPIBuilder implements Builder { code.write("headers['Content-Type'] = '$mimeType';"); final result = resolveType( + spec, + state, _toDartName(methodName, uppercaseFirstCharacter: true), mediaType.schema!, ); @@ -1122,6 +691,8 @@ class OpenAPIBuilder implements Builder { final functionIdentifier = '_${_toDartName('${identifier}Parse$headerName')}'; headerParseFunctions[headerName] = functionIdentifier; final result = resolveType( + spec, + state, identifier, response.headers![headerName]!.schema!, ); @@ -1130,6 +701,8 @@ class OpenAPIBuilder implements Builder { ); } final result = resolveType( + spec, + state, identifier, Schema( type: 'object', @@ -1164,6 +737,8 @@ class OpenAPIBuilder implements Builder { final mediaType = response.content![mimeType]!; final result = resolveType( + spec, + state, _toDartName(methodName, uppercaseFirstCharacter: true), mediaType.schema!, ); @@ -1223,6 +798,8 @@ class OpenAPIBuilder implements Builder { output.add('typedef $identifier = dynamic;'); } else { final result = resolveType( + spec, + state, identifier, schema, ); @@ -1233,18 +810,20 @@ class OpenAPIBuilder implements Builder { } } - if (registeredJsonObjects.isNotEmpty) { + output.addAll(state.output.map((final e) => e.accept(emitter).toString())); + + if (state.registeredJsonObjects.isNotEmpty) { output.addAll([ '// coverage:ignore-start', 'final _deserializers = {', - for (final name in registeredJsonObjects) ...[ + for (final name in state.registeredJsonObjects) ...[ '$name: (final data) => ${TypeResultObject(name).deserialize('data')},', 'List<$name>: (final data) => ${TypeResultList('List<$name>', TypeResultObject(name)).deserialize('data')},', ], '};', '', 'final _serializers = {', - for (final name in registeredJsonObjects) ...[ + for (final name in state.registeredJsonObjects) ...[ '$name: (final data) => ${TypeResultObject(name).serialize('data')},', 'List<$name>: (final data) => ${TypeResultList('List<$name>', TypeResultObject(name)).serialize('data')},', ], @@ -1394,3 +973,473 @@ String _toFieldName(final String dartName, final String type) => dartName == typ bool _isParameterNullable(final bool? required, final dynamic default_) => !(required ?? false) && default_ == null; String _valueToEscapedValue(final String type, final dynamic value) => type == 'String' ? "'$value'" : value.toString(); + +class State { + final resolvedTypes = []; + final registeredJsonObjects = []; + final output = []; +} + +TypeResult resolveObject( + final OpenAPI spec, + final State state, + final String identifier, + final Schema schema, { + required final Map? extraJsonSerializableValues, + required final Map>? extraJsonKeyValues, +}) { + if (!state.resolvedTypes.contains(identifier)) { + state.resolvedTypes.add(identifier); + state.registeredJsonObjects.add(identifier); + state.output.add( + Class( + (final b) { + b + ..name = identifier + ..docs.addAll([ + if (schema.description != null && schema.description!.isNotEmpty) ...[ + '/// ${schema.description!}', + ], + ]) + ..annotations.add( + refer('JsonSerializable').call( + [], + { + if (schema.additionalProperties ?? false) ...{ + 'disallowUnrecognizedKeys': refer('false'), + }, + if (extraJsonSerializableValues != null) ...{ + for (final key in extraJsonSerializableValues.keys) ...{ + key: refer(extraJsonSerializableValues[key]!), + }, + }, + }, + ), + ) + ..constructors.addAll( + [ + Constructor( + (final b) => b + ..optionalParameters.addAll( + schema.properties!.keys.map( + (final propertyName) => Parameter( + (final b) { + final propertySchema = schema.properties![propertyName]!; + b + ..name = _toDartName(propertyName) + ..toThis = true + ..named = true + ..required = + (schema.required ?? []).contains(propertyName) && propertySchema.default_ == null; + if (propertySchema.default_ != null) { + final value = propertySchema.default_!.toString(); + final result = resolveType( + spec, + state, + propertySchema.type!, + propertySchema, + ); + b.defaultTo = Code(_valueToEscapedValue(result.name, value)); + } + }, + ), + ), + ), + ), + Constructor( + (final b) => b + ..factory = true + ..name = 'fromJson' + ..lambda = true + ..requiredParameters.add( + Parameter( + (final b) => b + ..name = 'json' + ..type = refer('Map'), + ), + ) + ..body = Code('_\$${identifier}FromJson(json)'), + ), + ], + ) + ..methods.add( + Method( + (final b) => b + ..name = 'toJson' + ..returns = refer('Map') + ..lambda = true + ..body = Code('_\$${identifier}ToJson(this)'), + ), + ) + ..fields.addAll([ + for (final propertyName in schema.properties!.keys) ...[ + Field( + (final b) { + final result = resolveType( + spec, + state, + '${identifier}_${_toDartName(propertyName, uppercaseFirstCharacter: true)}', + schema.properties![propertyName]!, + extraJsonSerializableValues: extraJsonSerializableValues, + ); + + final propertySchema = schema.properties![propertyName]!; + + b + ..name = _toDartName(propertyName) + ..type = refer( + _makeNullable( + result.name, + !(schema.required ?? []).contains(propertyName), + ), + ) + ..modifier = FieldModifier.final$ + ..docs.addAll([ + if (propertySchema.description != null && propertySchema.description!.isNotEmpty) ...[ + '/// ${propertySchema.description!}', + ], + ]); + if (_toDartName(propertyName) != propertyName) { + b.annotations.add( + refer('JsonKey').call( + [], + { + 'name': refer("'$propertyName'"), + if (extraJsonKeyValues != null) ...{ + for (final p in extraJsonKeyValues.keys) ...{ + if (p == propertyName) ...{ + for (final key in extraJsonKeyValues[p]!.keys) ...{ + key: refer(extraJsonKeyValues[p]![key]!), + }, + }, + }, + }, + }, + ), + ); + } + }, + ) + ], + ]); + }, + ), + ); + } + return TypeResultObject(identifier); +} + +TypeResult resolveType( + final OpenAPI spec, + final State state, + final String identifier, + final Schema schema, { + final Map? extraJsonSerializableValues, + final Map>? extraJsonKeyValues, + final bool ignoreEnum = false, +}) { + TypeResult? result; + if (schema.ref != null) { + final name = schema.ref!.split('/').last; + result = resolveType( + spec, + state, + name, + spec.components!.schemas![name]!, + extraJsonSerializableValues: extraJsonSerializableValues, + ); + } else if (schema.ofs != null) { + if (!state.resolvedTypes.contains(identifier)) { + state.resolvedTypes.add(identifier); + final results = schema.ofs! + .map( + (final s) => resolveType( + spec, + state, + '$identifier${schema.ofs!.indexOf(s)}', + s, + extraJsonSerializableValues: extraJsonSerializableValues, + ), + ) + .toList(); + state.output.add( + Class( + (final b) { + final fields = {}; + for (final result in results) { + final dartName = _toDartName(result.name); + fields[result.name] = _toFieldName(dartName, result.name); + } + + b + ..name = identifier + ..fields.addAll([ + Field( + (final b) { + b + ..name = '_data' + ..type = refer('dynamic') + ..modifier = FieldModifier.final$; + }, + ), + for (final result in results) ...[ + Field( + (final b) { + final s = schema.ofs![results.indexOf(result)]; + b + ..name = fields[result.name]! + ..type = refer(_makeNullable(result.name, true)) + ..modifier = FieldModifier.final$ + ..docs.addAll([ + if (s.description != null && s.description!.isNotEmpty) ...[ + '/// ${s.description!}', + ], + ]); + }, + ), + ], + ]) + ..constructors.addAll([ + Constructor( + (final b) => b + ..requiredParameters.add( + Parameter( + (final b) => b + ..name = '_data' + ..toThis = true, + ), + ) + ..optionalParameters.addAll([ + for (final result in results) ...[ + Parameter( + (final b) => b + ..name = fields[result.name]! + ..toThis = true + ..named = true, + ), + ], + ]), + ), + Constructor( + (final b) { + b + ..factory = true + ..name = 'fromJson' + ..requiredParameters.add( + Parameter( + (final b) => b + ..name = 'data' + ..type = refer('dynamic'), + ), + ) + ..body = Code( + [ + for (final result in results) ...[ + '${result.name}? ${fields[result.name]!};', + 'try {', + '${fields[result.name]!} = ${result.deserialize('data')};', + '} catch (_) {', + '}', + ], + if (schema.oneOf != null) ...[ + "assert([${fields.values.join(',')}].where((final x) => x != null).length == 1, 'Need oneOf');", + ], + if (schema.allOf != null) ...[ + "assert([${fields.values.join(',')}].where((final x) => x != null).length == ${fields.length}, 'Need allOf');", + ], + 'return $identifier(', + 'data,', + for (final result in results) ...[ + '${fields[result.name]!}: ${fields[result.name]!},', + ], + ');', + ].join(), + ); + }, + ), + ]) + ..methods.add( + Method( + (final b) => b + ..name = 'toJson' + ..returns = refer('dynamic') + ..lambda = true + ..body = const Code('_data'), + ), + ); + }, + ), + ); + } + + result = TypeResultObject(identifier); + } else { + switch (schema.type) { + case 'boolean': + result = TypeResultBase('bool'); + break; + case 'integer': + result = TypeResultBase('int'); + break; + case 'number': + result = TypeResultBase('num'); + break; + case 'string': + switch (schema.format) { + case 'binary': + result = TypeResultBase('Uint8List'); + break; + case null: + result = TypeResultBase( + 'String', + ); + break; + } + break; + case 'array': + if (schema.items != null) { + final subResult = resolveType( + spec, + state, + identifier, + schema.items!, + extraJsonSerializableValues: extraJsonSerializableValues, + ); + result = TypeResultList( + 'List<${subResult.name}>', + subResult, + ); + } else { + result = TypeResultList( + 'List', + TypeResultBase('dynamic'), + ); + } + break; + case 'object': + if (schema.properties == null) { + result = TypeResultBase('dynamic'); + break; + } + if (schema.properties!.isEmpty) { + result = TypeResultMap( + 'Map', + TypeResultBase('dynamic'), + ); + break; + } + + result = resolveObject( + spec, + state, + identifier, + schema, + extraJsonSerializableValues: extraJsonSerializableValues, + extraJsonKeyValues: extraJsonKeyValues, + ); + break; + } + } + + if (result != null) { + if (!ignoreEnum && schema.enum_ != null) { + if (!state.resolvedTypes.contains(identifier)) { + state.resolvedTypes.add(identifier); + state.output.add( + Enum( + (final b) => b + ..name = identifier + ..constructors.add( + Constructor( + (final b) => b + ..constant = true + ..requiredParameters.add( + Parameter( + (final b) => b + ..name = 'value' + ..toThis = true, + ), + ), + ), + ) + ..fields.add( + Field( + (final b) => b + ..name = 'value' + ..type = refer(result!.name) + ..modifier = FieldModifier.final$, + ), + ) + ..values.addAll( + schema.enum_!.map( + (final value) => EnumValue( + (final b) { + final result = resolveType( + spec, + state, + '$identifier${_toDartName(value.toString(), uppercaseFirstCharacter: true)}', + schema, + ignoreEnum: true, + extraJsonSerializableValues: extraJsonSerializableValues, + ); + b + ..name = _toDartName(value.toString()) + ..arguments.add( + refer(_valueToEscapedValue(result.name, value)), + ); + if (_toDartName(value.toString()) != value.toString()) { + if (result.name != 'String' && result.name != 'int') { + throw Exception( + 'Sorry enum values are a bit broken. ' + 'See https://github.com/google/json_serializable.dart/issues/616. ' + 'Please remove the enum values on $identifier.', + ); + } + b.annotations.add( + refer('JsonValue').call([ + refer(_valueToEscapedValue(result.name, value.toString())), + ]), + ); + } + }, + ), + ), + ) + ..methods.add( + Method( + (final b) => b + ..name = 'fromValue' + ..static = true + ..returns = refer(identifier) + ..requiredParameters.add( + Parameter( + (final b) => b + ..name = 'value' + ..type = refer(result!.name), + ), + ) + ..body = Code( + [ + 'switch (value) {', + for (final value in schema.enum_!) ...[ + 'case ${_valueToEscapedValue(result!.name, value)}:', + 'return $identifier.${_toDartName(value.toString())};', + ], + 'default:', + 'throw Exception(\'Can not parse UserStatusClearAtTime0 from "\$value"\');', + '}', + ].join(), + ), + ), + ), + ), + ); + } + result = TypeResultEnum(identifier, result); + } + + return result; + } + + throw Exception('Can not convert OpenAPI type "${schema.toJson()}" to a Dart type'); +} diff --git a/packages/nextcloud/lib/src/nextcloud.openapi.dart b/packages/nextcloud/lib/src/nextcloud.openapi.dart index 9b124cf7..72da67b6 100644 --- a/packages/nextcloud/lib/src/nextcloud.openapi.dart +++ b/packages/nextcloud/lib/src/nextcloud.openapi.dart @@ -152,2411 +152,2784 @@ class Client { } } -@JsonSerializable() -class CoreServerStatus { - CoreServerStatus({ - required this.installed, - required this.maintenance, - required this.needsDbUpgrade, - required this.version, - required this.versionstring, - required this.edition, - required this.productname, - required this.extendedSupport, - }); - - factory CoreServerStatus.fromJson(Map json) => _$CoreServerStatusFromJson(json); +class CoreClient { + CoreClient(this.rootClient); - final bool installed; + final Client rootClient; - final bool maintenance; + Future getStatus() async { + var path = '/status.php'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + final response = await rootClient.doRequest( + 'get', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return CoreServerStatus.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - final bool needsDbUpgrade; + Future getCapabilities() async { + var path = '/ocs/v2.php/cloud/capabilities'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + final response = await rootClient.doRequest( + 'get', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return CoreServerCapabilities.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - final String version; + Future getNavigationApps() async { + var path = '/ocs/v2.php/core/navigation/apps'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + final response = await rootClient.doRequest( + 'get', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return CoreNavigationApps.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - final String versionstring; + Future initLoginFlow() async { + var path = '/index.php/login/v2'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + final response = await rootClient.doRequest( + 'post', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return CoreLoginFlowInit.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - final String edition; + Future getLoginFlowResult({required String token}) async { + var path = '/index.php/login/v2/poll'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + queryParameters['token'] = token.toString(); + final response = await rootClient.doRequest( + 'post', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return CoreLoginFlowResult.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - final String productname; + Future getPreview({ + String file = '', + int x = 32, + int y = 32, + int a = 0, + int forceIcon = 1, + String mode = 'fill', + }) async { + var path = '/index.php/core/preview.png'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + queryParameters['file'] = file.toString(); + queryParameters['x'] = x.toString(); + queryParameters['y'] = y.toString(); + queryParameters['a'] = a.toString(); + queryParameters['forceIcon'] = forceIcon.toString(); + queryParameters['mode'] = mode.toString(); + final response = await rootClient.doRequest( + 'get', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return response.body; + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - final bool extendedSupport; + Future getDarkAvatar({ + required String userId, + required int size, + }) async { + var path = '/index.php/avatar/{userId}/{size}/dark'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId.toString())); + path = path.replaceAll('{size}', Uri.encodeQueryComponent(size.toString())); + final response = await rootClient.doRequest( + 'get', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return response.body; + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - // coverage:ignore-start - Map toJson() => _$CoreServerStatusToJson(this); - // coverage:ignore-end + Future getAvatar({ + required String userId, + required int size, + }) async { + var path = '/index.php/avatar/{userId}/{size}'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId.toString())); + path = path.replaceAll('{size}', Uri.encodeQueryComponent(size.toString())); + final response = await rootClient.doRequest( + 'get', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return response.body; + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } } -@JsonSerializable() -class OCSMeta { - OCSMeta({ - required this.status, - required this.statuscode, - this.message, - this.totalitems, - this.itemsperpage, - }); - - factory OCSMeta.fromJson(Map json) => _$OCSMetaFromJson(json); - - final String status; - - final int statuscode; +class NewsClient { + NewsClient(this.rootClient); - final String? message; + final Client rootClient; - final String? totalitems; + Future getSupportedApiVersions() async { + var path = '/index.php/apps/news/api'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + final response = await rootClient.doRequest( + 'get', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return GetSupportedApiVersions.fromJson( + json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - final String? itemsperpage; + Future listFolders() async { + var path = '/index.php/apps/news/api/v1-3/folders'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + final response = await rootClient.doRequest( + 'get', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return NewsListFolders.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - // coverage:ignore-start - Map toJson() => _$OCSMetaToJson(this); - // coverage:ignore-end -} + Future createFolder({required String name}) async { + var path = '/index.php/apps/news/api/v1-3/folders'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + queryParameters['name'] = name.toString(); + final response = await rootClient.doRequest( + 'post', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return NewsListFolders.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } -@JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Version { - CoreServerCapabilities_Ocs_Data_Version({ - required this.major, - required this.minor, - required this.micro, - required this.string, - required this.edition, - required this.extendedSupport, - }); + Future renameFolder({ + required int folderId, + required String name, + }) async { + var path = '/index.php/apps/news/api/v1-3/folders/{folderId}'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + path = path.replaceAll('{folderId}', Uri.encodeQueryComponent(folderId.toString())); + queryParameters['name'] = name.toString(); + final response = await rootClient.doRequest( + 'put', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return; + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - factory CoreServerCapabilities_Ocs_Data_Version.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_VersionFromJson(json); + Future deleteFolder({required int folderId}) async { + var path = '/index.php/apps/news/api/v1-3/folders/{folderId}'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + path = path.replaceAll('{folderId}', Uri.encodeQueryComponent(folderId.toString())); + final response = await rootClient.doRequest( + 'delete', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return; + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - final int major; + Future markFolderAsRead({ + required int folderId, + required int newestItemId, + }) async { + var path = '/index.php/apps/news/api/v1-3/folders/{folderId}/read'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + path = path.replaceAll('{folderId}', Uri.encodeQueryComponent(folderId.toString())); + queryParameters['newestItemId'] = newestItemId.toString(); + final response = await rootClient.doRequest( + 'post', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return; + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - final int minor; + Future listFeeds() async { + var path = '/index.php/apps/news/api/v1-3/feeds'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + final response = await rootClient.doRequest( + 'get', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return NewsListFeeds.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - final int micro; + Future addFeed({ + required String url, + int? folderId, + }) async { + var path = '/index.php/apps/news/api/v1-3/feeds'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + queryParameters['url'] = url.toString(); + if (folderId != null) { + queryParameters['folderId'] = folderId.toString(); + } + final response = await rootClient.doRequest( + 'post', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return NewsListFeeds.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - final String string; + Future deleteFeed({required int feedId}) async { + var path = '/index.php/apps/news/api/v1-3/feeds/{feedId}'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + path = path.replaceAll('{feedId}', Uri.encodeQueryComponent(feedId.toString())); + final response = await rootClient.doRequest( + 'delete', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return; + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - final String edition; + Future moveFeed({ + required int feedId, + int? folderId, + }) async { + var path = '/index.php/apps/news/api/v1-3/feeds/{feedId}/move'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + path = path.replaceAll('{feedId}', Uri.encodeQueryComponent(feedId.toString())); + if (folderId != null) { + queryParameters['folderId'] = folderId.toString(); + } + final response = await rootClient.doRequest( + 'post', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return; + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - final bool extendedSupport; + Future renameFeed({ + required int feedId, + required String feedTitle, + }) async { + var path = '/index.php/apps/news/api/v1-3/feeds/{feedId}/rename'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + path = path.replaceAll('{feedId}', Uri.encodeQueryComponent(feedId.toString())); + queryParameters['feedTitle'] = feedTitle.toString(); + final response = await rootClient.doRequest( + 'post', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return; + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_VersionToJson(this); - // coverage:ignore-end -} + Future markFeedAsRead({ + required int feedId, + required int newestItemId, + }) async { + var path = '/index.php/apps/news/api/v1-3/feeds/{feedId}/read'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + path = path.replaceAll('{feedId}', Uri.encodeQueryComponent(feedId.toString())); + queryParameters['newestItemId'] = newestItemId.toString(); + final response = await rootClient.doRequest( + 'post', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return; + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } -@JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_Core { - CoreServerCapabilities_Ocs_Data_Capabilities_Core({ - required this.pollinterval, - required this.webdavRoot, - required this.referenceApi, - required this.referenceRegex, - }); + Future listArticles({ + int type = 3, + int id = 0, + int getRead = 1, + int batchSize = -1, + int offset = 0, + int oldestFirst = 0, + }) async { + var path = '/index.php/apps/news/api/v1-3/items'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + queryParameters['type'] = type.toString(); + queryParameters['id'] = id.toString(); + queryParameters['getRead'] = getRead.toString(); + queryParameters['batchSize'] = batchSize.toString(); + queryParameters['offset'] = offset.toString(); + queryParameters['oldestFirst'] = oldestFirst.toString(); + final response = await rootClient.doRequest( + 'get', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return NewsListArticles.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - factory CoreServerCapabilities_Ocs_Data_Capabilities_Core.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_CoreFromJson(json); + Future listUpdatedArticles({ + int type = 3, + int id = 0, + int lastModified = 0, + }) async { + var path = '/index.php/apps/news/api/v1-3/items/updated'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + queryParameters['type'] = type.toString(); + queryParameters['id'] = id.toString(); + queryParameters['lastModified'] = lastModified.toString(); + final response = await rootClient.doRequest( + 'get', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return NewsListArticles.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - final int pollinterval; + Future markArticleAsRead({required int itemId}) async { + var path = '/index.php/apps/news/api/v1-3/items/{itemId}/read'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + path = path.replaceAll('{itemId}', Uri.encodeQueryComponent(itemId.toString())); + final response = await rootClient.doRequest( + 'post', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return; + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - @JsonKey(name: 'webdav-root') - final String webdavRoot; + Future markArticleAsUnread({required int itemId}) async { + var path = '/index.php/apps/news/api/v1-3/items/{itemId}/unread'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + path = path.replaceAll('{itemId}', Uri.encodeQueryComponent(itemId.toString())); + final response = await rootClient.doRequest( + 'post', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return; + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - @JsonKey(name: 'reference-api') - final bool referenceApi; + Future starArticle({required int itemId}) async { + var path = '/index.php/apps/news/api/v1-3/items/{itemId}/star'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + path = path.replaceAll('{itemId}', Uri.encodeQueryComponent(itemId.toString())); + final response = await rootClient.doRequest( + 'post', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return; + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } + + Future unstarArticle({required int itemId}) async { + var path = '/index.php/apps/news/api/v1-3/items/{itemId}/unstar'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + path = path.replaceAll('{itemId}', Uri.encodeQueryComponent(itemId.toString())); + final response = await rootClient.doRequest( + 'post', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return; + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } +} + +class NotesClient { + NotesClient(this.rootClient); + + final Client rootClient; + + Future> getNotes({ + String? category, + String exclude = '', + int pruneBefore = 0, + int chunkSize = 0, + String? chunkCursor, + String? ifNoneMatch, + }) async { + var path = '/index.php/apps/notes/api/v1/notes'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + if (category != null) { + queryParameters['category'] = category.toString(); + } + queryParameters['exclude'] = exclude.toString(); + queryParameters['pruneBefore'] = pruneBefore.toString(); + queryParameters['chunkSize'] = chunkSize.toString(); + if (chunkCursor != null) { + queryParameters['chunkCursor'] = chunkCursor.toString(); + } + if (ifNoneMatch != null) { + headers['If-None-Match'] = ifNoneMatch.toString(); + } + final response = await rootClient.doRequest( + 'get', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return (json.decode(utf8.decode(response.body) as String) as List) + .map((final e) => NotesNote.fromJson(e as Map)) + .toList(); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - @JsonKey(name: 'reference-regex') - final String referenceRegex; + Future createNote({ + String category = '', + String title = '', + String content = '', + int modified = 0, + int favorite = 0, + }) async { + var path = '/index.php/apps/notes/api/v1/notes'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + queryParameters['category'] = category.toString(); + queryParameters['title'] = title.toString(); + queryParameters['content'] = content.toString(); + queryParameters['modified'] = modified.toString(); + queryParameters['favorite'] = favorite.toString(); + final response = await rootClient.doRequest( + 'post', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return NotesNote.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_CoreToJson(this); - // coverage:ignore-end -} + Future getNote({ + required int id, + String exclude = '', + String? ifNoneMatch, + }) async { + var path = '/index.php/apps/notes/api/v1/notes/{id}'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + path = path.replaceAll('{id}', Uri.encodeQueryComponent(id.toString())); + queryParameters['exclude'] = exclude.toString(); + if (ifNoneMatch != null) { + headers['If-None-Match'] = ifNoneMatch.toString(); + } + final response = await rootClient.doRequest( + 'get', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return NotesNote.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } -@JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_Bruteforce { - CoreServerCapabilities_Ocs_Data_Capabilities_Bruteforce({required this.delay}); + Future updateNote({ + required int id, + String? content, + int? modified, + String? title, + String? category, + int favorite = 0, + String? ifMatch, + }) async { + var path = '/index.php/apps/notes/api/v1/notes/{id}'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + path = path.replaceAll('{id}', Uri.encodeQueryComponent(id.toString())); + if (content != null) { + queryParameters['content'] = content.toString(); + } + if (modified != null) { + queryParameters['modified'] = modified.toString(); + } + if (title != null) { + queryParameters['title'] = title.toString(); + } + if (category != null) { + queryParameters['category'] = category.toString(); + } + queryParameters['favorite'] = favorite.toString(); + if (ifMatch != null) { + headers['If-Match'] = ifMatch.toString(); + } + final response = await rootClient.doRequest( + 'put', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return NotesNote.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - factory CoreServerCapabilities_Ocs_Data_Capabilities_Bruteforce.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_BruteforceFromJson(json); + Future deleteNote({required int id}) async { + var path = '/index.php/apps/notes/api/v1/notes/{id}'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + path = path.replaceAll('{id}', Uri.encodeQueryComponent(id.toString())); + final response = await rootClient.doRequest( + 'delete', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return ((utf8.decode(response.body) as String) as String); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - final int delay; + Future getSettings() async { + var path = '/index.php/apps/notes/api/v1/settings'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + final response = await rootClient.doRequest( + 'get', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return NotesSettings.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_BruteforceToJson(this); - // coverage:ignore-end + Future updateSettings({required NotesSettings notesSettings}) async { + var path = '/index.php/apps/notes/api/v1/settings'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + headers['Content-Type'] = 'application/json'; + body = Uint8List.fromList(utf8.encode(json.encode(notesSettings.toJson()))); + final response = await rootClient.doRequest( + 'put', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return NotesSettings.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } } -@JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_MetadataAvailable { - CoreServerCapabilities_Ocs_Data_Capabilities_MetadataAvailable({ - required this.size, - required this.gps, - }); - - factory CoreServerCapabilities_Ocs_Data_Capabilities_MetadataAvailable.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_MetadataAvailableFromJson(json); +class NotificationsClient { + NotificationsClient(this.rootClient); - final List size; + final Client rootClient; - final List gps; + Future listNotifications() async { + var path = '/ocs/v2.php/apps/notifications/api/v2/notifications'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + final response = await rootClient.doRequest( + 'get', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return NotificationsListNotifications.fromJson( + json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_MetadataAvailableToJson(this); - // coverage:ignore-end -} + Future deleteAllNotifications() async { + var path = '/ocs/v2.php/apps/notifications/api/v2/notifications'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + final response = await rootClient.doRequest( + 'delete', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return ((utf8.decode(response.body) as String) as String); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } -@JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_Files_DirectEditing { - CoreServerCapabilities_Ocs_Data_Capabilities_Files_DirectEditing({ - required this.url, - required this.etag, - }); + Future getNotification({required int id}) async { + var path = '/ocs/v2.php/apps/notifications/api/v2/notifications/{id}'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + path = path.replaceAll('{id}', Uri.encodeQueryComponent(id.toString())); + final response = await rootClient.doRequest( + 'get', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return NotificationsGetNotification.fromJson( + json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - factory CoreServerCapabilities_Ocs_Data_Capabilities_Files_DirectEditing.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_Files_DirectEditingFromJson(json); + Future deleteNotification({required int id}) async { + var path = '/ocs/v2.php/apps/notifications/api/v2/notifications/{id}'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + path = path.replaceAll('{id}', Uri.encodeQueryComponent(id.toString())); + final response = await rootClient.doRequest( + 'delete', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return EmptyOCS.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - final String url; + Future registerDevice({ + required String pushTokenHash, + required String devicePublicKey, + required String proxyServer, + }) async { + var path = '/ocs/v2.php/apps/notifications/api/v2/push'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + queryParameters['pushTokenHash'] = pushTokenHash.toString(); + queryParameters['devicePublicKey'] = devicePublicKey.toString(); + queryParameters['proxyServer'] = proxyServer.toString(); + final response = await rootClient.doRequest( + 'post', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 201) { + return NotificationsPushServerRegistration.fromJson( + json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - final String etag; + Future removeDevice() async { + var path = '/ocs/v2.php/apps/notifications/api/v2/push'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + final response = await rootClient.doRequest( + 'delete', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 202) { + return ((utf8.decode(response.body) as String) as String); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_Files_DirectEditingToJson(this); - // coverage:ignore-end + Future sendAdminNotification({ + required String userId, + required String shortMessage, + String longMessage = '', + }) async { + var path = '/ocs/v2.php/apps/notifications/api/v2/admin_notifications/{userId}'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId.toString())); + queryParameters['shortMessage'] = shortMessage.toString(); + queryParameters['longMessage'] = longMessage.toString(); + final response = await rootClient.doRequest( + 'post', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return EmptyOCS.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } } -@JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_Files { - CoreServerCapabilities_Ocs_Data_Capabilities_Files({ - required this.bigfilechunking, - required this.blacklistedFiles, - required this.directEditing, - required this.comments, - required this.undelete, - required this.versioning, - }); - - factory CoreServerCapabilities_Ocs_Data_Capabilities_Files.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesFromJson(json); - - final bool bigfilechunking; +class ProvisioningApiClient { + ProvisioningApiClient(this.rootClient); - @JsonKey(name: 'blacklisted_files') - final List blacklistedFiles; + final Client rootClient; - final CoreServerCapabilities_Ocs_Data_Capabilities_Files_DirectEditing directEditing; + Future getCurrentUser() async { + var path = '/ocs/v2.php/cloud/user'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + final response = await rootClient.doRequest( + 'get', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return ProvisioningApiUser.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - final bool comments; + Future getUser({required String userId}) async { + var path = '/ocs/v2.php/cloud/users/{userId}'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId.toString())); + final response = await rootClient.doRequest( + 'get', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return ProvisioningApiUser.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } +} - final bool undelete; +class UserStatusClient { + UserStatusClient(this.rootClient); - final bool versioning; + final Client rootClient; - // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesToJson(this); - // coverage:ignore-end -} + Future findAllStatuses() async { + var path = '/ocs/v2.php/apps/user_status/api/v1/statuses'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + final response = await rootClient.doRequest( + 'get', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return UserStatusFindAllStatuses.fromJson( + json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } -@JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_Activity { - CoreServerCapabilities_Ocs_Data_Capabilities_Activity({required this.apiv2}); + Future findStatus({required String userId}) async { + var path = '/ocs/v2.php/apps/user_status/api/v1/statuses/{userId}'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId.toString())); + final response = await rootClient.doRequest( + 'get', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return UserStatusFindStatus.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - factory CoreServerCapabilities_Ocs_Data_Capabilities_Activity.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_ActivityFromJson(json); + Future getStatus() async { + var path = '/ocs/v2.php/apps/user_status/api/v1/user_status'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + final response = await rootClient.doRequest( + 'get', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return UserStatusGetUserStatus.fromJson( + json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - final List apiv2; + Future setStatus({required UserStatusType statusType}) async { + var path = '/ocs/v2.php/apps/user_status/api/v1/user_status/status'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + queryParameters['statusType'] = statusType.value.toString(); + final response = await rootClient.doRequest( + 'put', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return UserStatusGetUserStatus.fromJson( + json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_ActivityToJson(this); - // coverage:ignore-end -} + Future setPredefinedMessage({ + required String messageId, + int? clearAt, + }) async { + var path = '/ocs/v2.php/apps/user_status/api/v1/user_status/message/predefined'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + queryParameters['messageId'] = messageId.toString(); + if (clearAt != null) { + queryParameters['clearAt'] = clearAt.toString(); + } + final response = await rootClient.doRequest( + 'put', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return UserStatusGetUserStatus.fromJson( + json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } -@JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Status { - CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Status({required this.globalScale}); + Future setCustomMessage({ + String? statusIcon, + String? message, + int? clearAt, + }) async { + var path = '/ocs/v2.php/apps/user_status/api/v1/user_status/message/custom'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + if (statusIcon != null) { + queryParameters['statusIcon'] = statusIcon.toString(); + } + if (message != null) { + queryParameters['message'] = message.toString(); + } + if (clearAt != null) { + queryParameters['clearAt'] = clearAt.toString(); + } + final response = await rootClient.doRequest( + 'put', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return UserStatusGetUserStatus.fromJson( + json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - factory CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Status.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_StatusFromJson(json); + Future clearMessage() async { + var path = '/ocs/v2.php/apps/user_status/api/v1/user_status/message'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + final response = await rootClient.doRequest( + 'delete', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return; + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - final bool globalScale; + Future findAllPredefinedStatuses() async { + var path = '/ocs/v2.php/apps/user_status/api/v1/predefined_statuses'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + final response = await rootClient.doRequest( + 'get', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return UserStatusPredefinedStatuses.fromJson( + json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } - // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_StatusToJson(this); - // coverage:ignore-end + Future heartbeat({required UserStatusType status}) async { + var path = '/ocs/v2.php/apps/user_status/api/v1/heartbeat'; + final queryParameters = {}; + final headers = {}; + Uint8List? body; + queryParameters['status'] = status.value.toString(); + final response = await rootClient.doRequest( + 'put', + Uri(path: path, queryParameters: queryParameters).toString(), + headers, + body, + ); + if (response.statusCode == 200) { + return UserStatus.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + } + throw ApiException.fromResponse(response); // coverage:ignore-line + } } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Settings { - CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Settings({ - required this.frontendEnabled, - required this.allowedCircles, - required this.allowedUserTypes, - required this.membersLimit, +class CoreServerStatus { + CoreServerStatus({ + required this.installed, + required this.maintenance, + required this.needsDbUpgrade, + required this.version, + required this.versionstring, + required this.edition, + required this.productname, + required this.extendedSupport, }); - factory CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Settings.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_SettingsFromJson(json); - - final bool frontendEnabled; + factory CoreServerStatus.fromJson(Map json) => _$CoreServerStatusFromJson(json); - final int allowedCircles; + final bool installed; - final int allowedUserTypes; + final bool maintenance; - final int membersLimit; + final bool needsDbUpgrade; - // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_SettingsToJson(this); - // coverage:ignore-end -} + final String version; -@JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Constants_Source { - CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Constants_Source({ - required this.core, - required this.extra, - }); + final String versionstring; - factory CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Constants_Source.fromJson( - Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Constants_SourceFromJson(json); + final String edition; - final dynamic core; + final String productname; - final dynamic extra; + final bool extendedSupport; // coverage:ignore-start - Map toJson() => - _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Constants_SourceToJson(this); + Map toJson() => _$CoreServerStatusToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Constants { - CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Constants({ - required this.flags, - required this.source, +class OCSMeta { + OCSMeta({ + required this.status, + required this.statuscode, + this.message, + this.totalitems, + this.itemsperpage, }); - factory CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Constants.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_ConstantsFromJson(json); - - final dynamic flags; - - final CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Constants_Source source; + factory OCSMeta.fromJson(Map json) => _$OCSMetaFromJson(json); - // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_ConstantsToJson(this); - // coverage:ignore-end -} + final String status; -@JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Config { - CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Config({ - required this.coreFlags, - required this.systemFlags, - }); + final int statuscode; - factory CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Config.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_ConfigFromJson(json); + final String? message; - final List coreFlags; + final String? totalitems; - final List systemFlags; + final String? itemsperpage; // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_ConfigToJson(this); + Map toJson() => _$OCSMetaToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle { - CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle({ - required this.constants, - required this.config, +class CoreServerCapabilities_Ocs_Data_Version { + CoreServerCapabilities_Ocs_Data_Version({ + required this.major, + required this.minor, + required this.micro, + required this.string, + required this.edition, + required this.extendedSupport, }); - factory CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_CircleFromJson(json); - - final CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Constants constants; - - final CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Config config; - - // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_CircleToJson(this); - // coverage:ignore-end -} - -@JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Member_Constants { - CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Member_Constants({required this.level}); - - factory CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Member_Constants.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Member_ConstantsFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Version.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_VersionFromJson(json); - final dynamic level; + final int major; - // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Member_ConstantsToJson(this); - // coverage:ignore-end -} + final int minor; -@JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Member { - CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Member({ - required this.constants, - required this.type, - }); + final int micro; - factory CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Member.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_MemberFromJson(json); + final String string; - final CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Member_Constants constants; + final String edition; - final dynamic type; + final bool extendedSupport; // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_MemberToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_VersionToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_Circles { - CoreServerCapabilities_Ocs_Data_Capabilities_Circles({ - required this.version, - required this.status, - required this.settings, - required this.circle, - required this.member, +class CoreServerCapabilities_Ocs_Data_Capabilities_Core { + CoreServerCapabilities_Ocs_Data_Capabilities_Core({ + required this.pollinterval, + required this.webdavRoot, + required this.referenceApi, + required this.referenceRegex, }); - factory CoreServerCapabilities_Ocs_Data_Capabilities_Circles.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_CirclesFromJson(json); - - final String version; - - final CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Status status; - - final CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Settings settings; - - final CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle circle; - - final CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Member member; + factory CoreServerCapabilities_Ocs_Data_Capabilities_Core.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_CoreFromJson(json); - // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_CirclesToJson(this); - // coverage:ignore-end -} + final int pollinterval; -@JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_Ocm_ResourceTypes_Protocols { - CoreServerCapabilities_Ocs_Data_Capabilities_Ocm_ResourceTypes_Protocols({required this.webdav}); + @JsonKey(name: 'webdav-root') + final String webdavRoot; - factory CoreServerCapabilities_Ocs_Data_Capabilities_Ocm_ResourceTypes_Protocols.fromJson( - Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_Ocm_ResourceTypes_ProtocolsFromJson(json); + @JsonKey(name: 'reference-api') + final bool referenceApi; - final String webdav; + @JsonKey(name: 'reference-regex') + final String referenceRegex; // coverage:ignore-start - Map toJson() => - _$CoreServerCapabilities_Ocs_Data_Capabilities_Ocm_ResourceTypes_ProtocolsToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_CoreToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_Ocm_ResourceTypes { - CoreServerCapabilities_Ocs_Data_Capabilities_Ocm_ResourceTypes({ - required this.name, - required this.shareTypes, - required this.protocols, - }); - - factory CoreServerCapabilities_Ocs_Data_Capabilities_Ocm_ResourceTypes.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_Ocm_ResourceTypesFromJson(json); - - final String name; +class CoreServerCapabilities_Ocs_Data_Capabilities_Bruteforce { + CoreServerCapabilities_Ocs_Data_Capabilities_Bruteforce({required this.delay}); - final List shareTypes; + factory CoreServerCapabilities_Ocs_Data_Capabilities_Bruteforce.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_BruteforceFromJson(json); - final CoreServerCapabilities_Ocs_Data_Capabilities_Ocm_ResourceTypes_Protocols protocols; + final int delay; // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_Ocm_ResourceTypesToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_BruteforceToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_Ocm { - CoreServerCapabilities_Ocs_Data_Capabilities_Ocm({ - required this.enabled, - required this.apiVersion, - required this.endPoint, - required this.resourceTypes, +class CoreServerCapabilities_Ocs_Data_Capabilities_MetadataAvailable { + CoreServerCapabilities_Ocs_Data_Capabilities_MetadataAvailable({ + required this.size, + required this.gps, }); - factory CoreServerCapabilities_Ocs_Data_Capabilities_Ocm.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_OcmFromJson(json); - - final bool enabled; - - final String apiVersion; + factory CoreServerCapabilities_Ocs_Data_Capabilities_MetadataAvailable.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_MetadataAvailableFromJson(json); - final String endPoint; + final List size; - final List resourceTypes; + final List gps; // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_OcmToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_MetadataAvailableToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_Dav { - CoreServerCapabilities_Ocs_Data_Capabilities_Dav({ - this.bulkupload, - required this.chunking, +class CoreServerCapabilities_Ocs_Data_Capabilities_Files_DirectEditing { + CoreServerCapabilities_Ocs_Data_Capabilities_Files_DirectEditing({ + required this.url, + required this.etag, }); - factory CoreServerCapabilities_Ocs_Data_Capabilities_Dav.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_DavFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Capabilities_Files_DirectEditing.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_Files_DirectEditingFromJson(json); - final String? bulkupload; + final String url; - final String chunking; + final String etag; // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_DavToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_Files_DirectEditingToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_Password { - CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_Password({ - required this.enforced, - required this.askForOptionalPassword, +class CoreServerCapabilities_Ocs_Data_Capabilities_Files { + CoreServerCapabilities_Ocs_Data_Capabilities_Files({ + required this.bigfilechunking, + required this.blacklistedFiles, + required this.directEditing, + required this.comments, + required this.undelete, + required this.versioning, }); - factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_Password.fromJson( - Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_PasswordFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Capabilities_Files.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesFromJson(json); - final bool enforced; + final bool bigfilechunking; - final bool askForOptionalPassword; + @JsonKey(name: 'blacklisted_files') + final List blacklistedFiles; - // coverage:ignore-start - Map toJson() => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_PasswordToJson(this); - // coverage:ignore-end -} + final CoreServerCapabilities_Ocs_Data_Capabilities_Files_DirectEditing directEditing; -@JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDate { - CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDate({required this.enabled}); + final bool comments; - factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDate.fromJson( - Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateFromJson(json); + final bool undelete; - final bool enabled; + final bool versioning; // coverage:ignore-start - Map toJson() => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateInternal { - CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateInternal({required this.enabled}); +class CoreServerCapabilities_Ocs_Data_Capabilities_Activity { + CoreServerCapabilities_Ocs_Data_Capabilities_Activity({required this.apiv2}); - factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateInternal.fromJson( - Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateInternalFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Capabilities_Activity.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_ActivityFromJson(json); - final bool enabled; + final List apiv2; // coverage:ignore-start - Map toJson() => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateInternalToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_ActivityToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateRemote { - CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateRemote({required this.enabled}); +class CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Status { + CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Status({required this.globalScale}); - factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateRemote.fromJson( - Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateRemoteFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Status.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_StatusFromJson(json); - final bool enabled; + final bool globalScale; // coverage:ignore-start - Map toJson() => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateRemoteToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_StatusToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public { - CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public({ - required this.enabled, - required this.password, - required this.expireDate, - required this.multipleLinks, - required this.expireDateInternal, - required this.expireDateRemote, - required this.sendMail, - required this.upload, - required this.uploadFilesDrop, +class CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Settings { + CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Settings({ + required this.frontendEnabled, + required this.allowedCircles, + required this.allowedUserTypes, + required this.membersLimit, }); - factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_PublicFromJson(json); - - final bool enabled; - - final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_Password password; - - @JsonKey(name: 'expire_date') - final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDate expireDate; - - @JsonKey(name: 'multiple_links') - final bool multipleLinks; - - @JsonKey(name: 'expire_date_internal') - final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateInternal expireDateInternal; + factory CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Settings.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_SettingsFromJson(json); - @JsonKey(name: 'expire_date_remote') - final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateRemote expireDateRemote; + final bool frontendEnabled; - @JsonKey(name: 'send_mail') - final bool sendMail; + final int allowedCircles; - final bool upload; + final int allowedUserTypes; - @JsonKey(name: 'upload_files_drop') - final bool uploadFilesDrop; + final int membersLimit; // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_PublicToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_SettingsToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_User_ExpireDate { - CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_User_ExpireDate({required this.enabled}); +class CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Constants_Source { + CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Constants_Source({ + required this.core, + required this.extra, + }); - factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_User_ExpireDate.fromJson( + factory CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Constants_Source.fromJson( Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_User_ExpireDateFromJson(json); + _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Constants_SourceFromJson(json); - final bool enabled; + final dynamic core; + + final dynamic extra; // coverage:ignore-start Map toJson() => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_User_ExpireDateToJson(this); + _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Constants_SourceToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_User { - CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_User({ - required this.sendMail, - required this.expireDate, +class CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Constants { + CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Constants({ + required this.flags, + required this.source, }); - factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_User.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_UserFromJson(json); - - @JsonKey(name: 'send_mail') - final bool sendMail; - - @JsonKey(name: 'expire_date') - final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_User_ExpireDate expireDate; - - // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_UserToJson(this); - // coverage:ignore-end -} - -@JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Group_ExpireDate { - CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Group_ExpireDate({required this.enabled}); + factory CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Constants.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_ConstantsFromJson(json); - factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Group_ExpireDate.fromJson( - Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Group_ExpireDateFromJson(json); + final dynamic flags; - final bool enabled; + final CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Constants_Source source; // coverage:ignore-start - Map toJson() => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Group_ExpireDateToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_ConstantsToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Group { - CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Group({ - required this.enabled, - required this.expireDate, +class CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Config { + CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Config({ + required this.coreFlags, + required this.systemFlags, }); - factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Group.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_GroupFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Config.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_ConfigFromJson(json); - final bool enabled; + final List coreFlags; - @JsonKey(name: 'expire_date') - final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Group_ExpireDate expireDate; + final List systemFlags; // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_GroupToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_ConfigToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDate { - CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDate({required this.enabled}); +class CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle { + CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle({ + required this.constants, + required this.config, + }); - factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDate.fromJson( - Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDateFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_CircleFromJson(json); - final bool enabled; + final CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Constants constants; + + final CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle_Config config; // coverage:ignore-start - Map toJson() => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDateToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_CircleToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDateSupported { - CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDateSupported({required this.enabled}); +class CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Member_Constants { + CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Member_Constants({required this.level}); - factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDateSupported.fromJson( - Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDateSupportedFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Member_Constants.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Member_ConstantsFromJson(json); - final bool enabled; + final dynamic level; // coverage:ignore-start - Map toJson() => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDateSupportedToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Member_ConstantsToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation { - CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation({ - required this.outgoing, - required this.incoming, - required this.expireDate, - required this.expireDateSupported, +class CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Member { + CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Member({ + required this.constants, + required this.type, }); - factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_FederationFromJson(json); - - final bool outgoing; - - final bool incoming; + factory CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Member.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_MemberFromJson(json); - @JsonKey(name: 'expire_date') - final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDate expireDate; + final CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Member_Constants constants; - @JsonKey(name: 'expire_date_supported') - final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDateSupported expireDateSupported; + final dynamic type; // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_FederationToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_Circles_MemberToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharee { - CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharee({ - required this.queryLookupDefault, - required this.alwaysShowUnique, +class CoreServerCapabilities_Ocs_Data_Capabilities_Circles { + CoreServerCapabilities_Ocs_Data_Capabilities_Circles({ + required this.version, + required this.status, + required this.settings, + required this.circle, + required this.member, }); - factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharee.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_ShareeFromJson(json); - - @JsonKey(name: 'query_lookup_default') - final bool queryLookupDefault; + factory CoreServerCapabilities_Ocs_Data_Capabilities_Circles.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_CirclesFromJson(json); - @JsonKey(name: 'always_show_unique') - final bool alwaysShowUnique; + final String version; - // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_ShareeToJson(this); - // coverage:ignore-end -} + final CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Status status; -@JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_UploadFilesDrop { - CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_UploadFilesDrop({required this.enabled}); + final CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Settings settings; - factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_UploadFilesDrop.fromJson( - Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_UploadFilesDropFromJson(json); + final CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Circle circle; - final bool enabled; + final CoreServerCapabilities_Ocs_Data_Capabilities_Circles_Member member; // coverage:ignore-start - Map toJson() => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_UploadFilesDropToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_CirclesToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_Password { - CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_Password({ - required this.enabled, - required this.enforced, - }); +class CoreServerCapabilities_Ocs_Data_Capabilities_Ocm_ResourceTypes_Protocols { + CoreServerCapabilities_Ocs_Data_Capabilities_Ocm_ResourceTypes_Protocols({required this.webdav}); - factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_Password.fromJson( + factory CoreServerCapabilities_Ocs_Data_Capabilities_Ocm_ResourceTypes_Protocols.fromJson( Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_PasswordFromJson(json); - - final bool enabled; + _$CoreServerCapabilities_Ocs_Data_Capabilities_Ocm_ResourceTypes_ProtocolsFromJson(json); - final bool enforced; + final String webdav; // coverage:ignore-start Map toJson() => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_PasswordToJson(this); + _$CoreServerCapabilities_Ocs_Data_Capabilities_Ocm_ResourceTypes_ProtocolsToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_ExpireDate { - CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_ExpireDate({ - required this.enabled, - required this.enforced, +class CoreServerCapabilities_Ocs_Data_Capabilities_Ocm_ResourceTypes { + CoreServerCapabilities_Ocs_Data_Capabilities_Ocm_ResourceTypes({ + required this.name, + required this.shareTypes, + required this.protocols, }); - factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_ExpireDate.fromJson( - Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_ExpireDateFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Capabilities_Ocm_ResourceTypes.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_Ocm_ResourceTypesFromJson(json); - final bool enabled; + final String name; - final bool enforced; + final List shareTypes; + + final CoreServerCapabilities_Ocs_Data_Capabilities_Ocm_ResourceTypes_Protocols protocols; // coverage:ignore-start - Map toJson() => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_ExpireDateToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_Ocm_ResourceTypesToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail { - CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail({ +class CoreServerCapabilities_Ocs_Data_Capabilities_Ocm { + CoreServerCapabilities_Ocs_Data_Capabilities_Ocm({ required this.enabled, - required this.sendPasswordByMail, - required this.uploadFilesDrop, - required this.password, - required this.expireDate, + required this.apiVersion, + required this.endPoint, + required this.resourceTypes, }); - factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_SharebymailFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Capabilities_Ocm.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_OcmFromJson(json); final bool enabled; - @JsonKey(name: 'send_password_by_mail') - final bool sendPasswordByMail; - - @JsonKey(name: 'upload_files_drop') - final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_UploadFilesDrop uploadFilesDrop; + final String apiVersion; - final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_Password password; + final String endPoint; - @JsonKey(name: 'expire_date') - final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_ExpireDate expireDate; + final List resourceTypes; // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_SharebymailToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_OcmToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing { - CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing({ - required this.apiEnabled, - required this.public, - required this.resharing, - required this.user, - required this.groupSharing, - required this.group, - required this.defaultPermissions, - required this.federation, - required this.sharee, - required this.sharebymail, +class CoreServerCapabilities_Ocs_Data_Capabilities_Dav { + CoreServerCapabilities_Ocs_Data_Capabilities_Dav({ + this.bulkupload, + required this.chunking, }); - factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharingFromJson(json); - - @JsonKey(name: 'api_enabled') - final bool apiEnabled; - - final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public public; - - final bool resharing; - - final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_User user; - - @JsonKey(name: 'group_sharing') - final bool groupSharing; - - final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Group group; - - @JsonKey(name: 'default_permissions') - final int defaultPermissions; - - final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation federation; + factory CoreServerCapabilities_Ocs_Data_Capabilities_Dav.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_DavFromJson(json); - final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharee sharee; + final String? bulkupload; - final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail sharebymail; + final String chunking; // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharingToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_DavToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_Notes { - CoreServerCapabilities_Ocs_Data_Capabilities_Notes({ - required this.apiVersion, - required this.version, +class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_Password { + CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_Password({ + required this.enforced, + required this.askForOptionalPassword, }); - factory CoreServerCapabilities_Ocs_Data_Capabilities_Notes.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_NotesFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_Password.fromJson( + Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_PasswordFromJson(json); - @JsonKey(name: 'api_version') - final List apiVersion; + final bool enforced; - final String version; + final bool askForOptionalPassword; // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_NotesToJson(this); + Map toJson() => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_PasswordToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_Notifications { - CoreServerCapabilities_Ocs_Data_Capabilities_Notifications({ - required this.ocsEndpoints, - required this.push, - required this.adminNotifications, - }); +class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDate { + CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDate({required this.enabled}); - factory CoreServerCapabilities_Ocs_Data_Capabilities_Notifications.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_NotificationsFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDate.fromJson( + Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateFromJson(json); + + final bool enabled; + + // coverage:ignore-start + Map toJson() => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateToJson(this); + // coverage:ignore-end +} - @JsonKey(name: 'ocs-endpoints') - final List ocsEndpoints; +@JsonSerializable() +class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateInternal { + CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateInternal({required this.enabled}); - final List push; + factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateInternal.fromJson( + Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateInternalFromJson(json); - @JsonKey(name: 'admin-notifications') - final List adminNotifications; + final bool enabled; // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_NotificationsToJson(this); + Map toJson() => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateInternalToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicy_Api { - CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicy_Api({ - required this.generate, - required this.validate, - }); - - factory CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicy_Api.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicy_ApiFromJson(json); +class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateRemote { + CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateRemote({required this.enabled}); - final String generate; + factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateRemote.fromJson( + Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateRemoteFromJson(json); - final String validate; + final bool enabled; // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicy_ApiToJson(this); + Map toJson() => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateRemoteToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicy { - CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicy({ - required this.minLength, - required this.enforceNonCommonPassword, - required this.enforceNumericCharacters, - required this.enforceSpecialCharacters, - required this.enforceUpperLowerCase, - required this.api, +class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public { + CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public({ + required this.enabled, + required this.password, + required this.expireDate, + required this.multipleLinks, + required this.expireDateInternal, + required this.expireDateRemote, + required this.sendMail, + required this.upload, + required this.uploadFilesDrop, }); - factory CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicy.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicyFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_PublicFromJson(json); - final int minLength; + final bool enabled; - final bool enforceNonCommonPassword; + final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_Password password; - final bool enforceNumericCharacters; + @JsonKey(name: 'expire_date') + final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDate expireDate; - final bool enforceSpecialCharacters; + @JsonKey(name: 'multiple_links') + final bool multipleLinks; - final bool enforceUpperLowerCase; + @JsonKey(name: 'expire_date_internal') + final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateInternal expireDateInternal; - final CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicy_Api api; + @JsonKey(name: 'expire_date_remote') + final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public_ExpireDateRemote expireDateRemote; + + @JsonKey(name: 'send_mail') + final bool sendMail; + + final bool upload; + + @JsonKey(name: 'upload_files_drop') + final bool uploadFilesDrop; // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicyToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_PublicToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_ProvisioningApi { - CoreServerCapabilities_Ocs_Data_Capabilities_ProvisioningApi({ - required this.version, - required this.accountPropertyScopesVersion, - required this.accountPropertyScopesFederatedEnabled, - required this.accountPropertyScopesPublishedEnabled, - }); - - factory CoreServerCapabilities_Ocs_Data_Capabilities_ProvisioningApi.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_ProvisioningApiFromJson(json); - - final String version; - - @JsonKey(name: 'AccountPropertyScopesVersion') - final int accountPropertyScopesVersion; +class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_User_ExpireDate { + CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_User_ExpireDate({required this.enabled}); - @JsonKey(name: 'AccountPropertyScopesFederatedEnabled') - final bool accountPropertyScopesFederatedEnabled; + factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_User_ExpireDate.fromJson( + Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_User_ExpireDateFromJson(json); - @JsonKey(name: 'AccountPropertyScopesPublishedEnabled') - final bool accountPropertyScopesPublishedEnabled; + final bool enabled; // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_ProvisioningApiToJson(this); + Map toJson() => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_User_ExpireDateToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_Theming { - CoreServerCapabilities_Ocs_Data_Capabilities_Theming({ - required this.name, - required this.url, - required this.slogan, - required this.color, - required this.colorText, - required this.colorElement, - required this.colorElementBright, - required this.colorElementDark, - required this.logo, - required this.background, - required this.backgroundPlain, - required this.backgroundDefault, - required this.logoheader, - required this.favicon, +class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_User { + CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_User({ + required this.sendMail, + required this.expireDate, }); - factory CoreServerCapabilities_Ocs_Data_Capabilities_Theming.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_ThemingFromJson(json); - - final String name; - - final String url; - - final String slogan; - - final String color; - - @JsonKey(name: 'color-text') - final String colorText; - - @JsonKey(name: 'color-element') - final String colorElement; - - @JsonKey(name: 'color-element-bright') - final String colorElementBright; - - @JsonKey(name: 'color-element-dark') - final String colorElementDark; + factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_User.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_UserFromJson(json); - final String logo; + @JsonKey(name: 'send_mail') + final bool sendMail; - final String background; + @JsonKey(name: 'expire_date') + final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_User_ExpireDate expireDate; - @JsonKey(name: 'background-plain') - final bool backgroundPlain; + // coverage:ignore-start + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_UserToJson(this); + // coverage:ignore-end +} - @JsonKey(name: 'background-default') - final bool backgroundDefault; +@JsonSerializable() +class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Group_ExpireDate { + CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Group_ExpireDate({required this.enabled}); - final String logoheader; + factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Group_ExpireDate.fromJson( + Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Group_ExpireDateFromJson(json); - final String favicon; + final bool enabled; // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_ThemingToJson(this); + Map toJson() => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Group_ExpireDateToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_UserStatus { - CoreServerCapabilities_Ocs_Data_Capabilities_UserStatus({ +class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Group { + CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Group({ required this.enabled, - required this.supportsEmoji, + required this.expireDate, }); - factory CoreServerCapabilities_Ocs_Data_Capabilities_UserStatus.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_UserStatusFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Group.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_GroupFromJson(json); final bool enabled; - @JsonKey(name: 'supports_emoji') - final bool supportsEmoji; + @JsonKey(name: 'expire_date') + final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Group_ExpireDate expireDate; // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_UserStatusToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_GroupToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data_Capabilities_WeatherStatus { - CoreServerCapabilities_Ocs_Data_Capabilities_WeatherStatus({required this.enabled}); +class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDate { + CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDate({required this.enabled}); - factory CoreServerCapabilities_Ocs_Data_Capabilities_WeatherStatus.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_Capabilities_WeatherStatusFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDate.fromJson( + Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDateFromJson(json); final bool enabled; // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_WeatherStatusToJson(this); + Map toJson() => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDateToJson(this); // coverage:ignore-end } -@JsonSerializable(disallowUnrecognizedKeys: false) -class CoreServerCapabilities_Ocs_Data_Capabilities { - CoreServerCapabilities_Ocs_Data_Capabilities({ - required this.core, - required this.bruteforce, - required this.metadataAvailable, - required this.files, - this.activity, - this.circles, - required this.ocm, - required this.dav, - this.filesSharing, - this.notes, - this.notifications, - this.passwordPolicy, - this.provisioningApi, - this.theming, - this.userStatus, - this.weatherStatus, - }); +@JsonSerializable() +class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDateSupported { + CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDateSupported({required this.enabled}); - factory CoreServerCapabilities_Ocs_Data_Capabilities.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_Data_CapabilitiesFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDateSupported.fromJson( + Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDateSupportedFromJson(json); - final CoreServerCapabilities_Ocs_Data_Capabilities_Core core; + final bool enabled; - final CoreServerCapabilities_Ocs_Data_Capabilities_Bruteforce bruteforce; + // coverage:ignore-start + Map toJson() => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDateSupportedToJson(this); + // coverage:ignore-end +} + +@JsonSerializable() +class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation { + CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation({ + required this.outgoing, + required this.incoming, + required this.expireDate, + required this.expireDateSupported, + }); - final CoreServerCapabilities_Ocs_Data_Capabilities_MetadataAvailable metadataAvailable; + factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_FederationFromJson(json); - final CoreServerCapabilities_Ocs_Data_Capabilities_Files files; + final bool outgoing; - final CoreServerCapabilities_Ocs_Data_Capabilities_Activity? activity; + final bool incoming; - final CoreServerCapabilities_Ocs_Data_Capabilities_Circles? circles; + @JsonKey(name: 'expire_date') + final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDate expireDate; - final CoreServerCapabilities_Ocs_Data_Capabilities_Ocm ocm; + @JsonKey(name: 'expire_date_supported') + final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation_ExpireDateSupported expireDateSupported; - final CoreServerCapabilities_Ocs_Data_Capabilities_Dav dav; + // coverage:ignore-start + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_FederationToJson(this); + // coverage:ignore-end +} - @JsonKey(name: 'files_sharing') - final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing? filesSharing; +@JsonSerializable() +class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharee { + CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharee({ + required this.queryLookupDefault, + required this.alwaysShowUnique, + }); - final CoreServerCapabilities_Ocs_Data_Capabilities_Notes? notes; + factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharee.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_ShareeFromJson(json); - final CoreServerCapabilities_Ocs_Data_Capabilities_Notifications? notifications; + @JsonKey(name: 'query_lookup_default') + final bool queryLookupDefault; - @JsonKey(name: 'password_policy') - final CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicy? passwordPolicy; + @JsonKey(name: 'always_show_unique') + final bool alwaysShowUnique; - @JsonKey(name: 'provisioning_api') - final CoreServerCapabilities_Ocs_Data_Capabilities_ProvisioningApi? provisioningApi; + // coverage:ignore-start + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_ShareeToJson(this); + // coverage:ignore-end +} - final CoreServerCapabilities_Ocs_Data_Capabilities_Theming? theming; +@JsonSerializable() +class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_UploadFilesDrop { + CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_UploadFilesDrop({required this.enabled}); - @JsonKey(name: 'user_status') - final CoreServerCapabilities_Ocs_Data_Capabilities_UserStatus? userStatus; + factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_UploadFilesDrop.fromJson( + Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_UploadFilesDropFromJson(json); - @JsonKey(name: 'weather_status') - final CoreServerCapabilities_Ocs_Data_Capabilities_WeatherStatus? weatherStatus; + final bool enabled; // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_Data_CapabilitiesToJson(this); + Map toJson() => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_UploadFilesDropToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs_Data { - CoreServerCapabilities_Ocs_Data({ - required this.version, - required this.capabilities, +class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_Password { + CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_Password({ + required this.enabled, + required this.enforced, }); - factory CoreServerCapabilities_Ocs_Data.fromJson(Map json) => - _$CoreServerCapabilities_Ocs_DataFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_Password.fromJson( + Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_PasswordFromJson(json); - final CoreServerCapabilities_Ocs_Data_Version version; + final bool enabled; - final CoreServerCapabilities_Ocs_Data_Capabilities capabilities; + final bool enforced; // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_Ocs_DataToJson(this); + Map toJson() => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_PasswordToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities_Ocs { - CoreServerCapabilities_Ocs({ - required this.meta, - required this.data, +class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_ExpireDate { + CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_ExpireDate({ + required this.enabled, + required this.enforced, }); - factory CoreServerCapabilities_Ocs.fromJson(Map json) => _$CoreServerCapabilities_OcsFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_ExpireDate.fromJson( + Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_ExpireDateFromJson(json); - final OCSMeta meta; + final bool enabled; - final CoreServerCapabilities_Ocs_Data data; + final bool enforced; // coverage:ignore-start - Map toJson() => _$CoreServerCapabilities_OcsToJson(this); + Map toJson() => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_ExpireDateToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreServerCapabilities { - CoreServerCapabilities({required this.ocs}); +class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail { + CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail({ + required this.enabled, + required this.sendPasswordByMail, + required this.uploadFilesDrop, + required this.password, + required this.expireDate, + }); - factory CoreServerCapabilities.fromJson(Map json) => _$CoreServerCapabilitiesFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_SharebymailFromJson(json); - final CoreServerCapabilities_Ocs ocs; + final bool enabled; + + @JsonKey(name: 'send_password_by_mail') + final bool sendPasswordByMail; + + @JsonKey(name: 'upload_files_drop') + final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_UploadFilesDrop uploadFilesDrop; + + final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_Password password; + + @JsonKey(name: 'expire_date') + final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail_ExpireDate expireDate; // coverage:ignore-start - Map toJson() => _$CoreServerCapabilitiesToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_SharebymailToJson(this); // coverage:ignore-end } -class CoreNavigationApps_Ocs_Data_Order { - CoreNavigationApps_Ocs_Data_Order( - this._data, { - this.$int, - this.string, +@JsonSerializable() +class CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing { + CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing({ + required this.apiEnabled, + required this.public, + required this.resharing, + required this.user, + required this.groupSharing, + required this.group, + required this.defaultPermissions, + required this.federation, + required this.sharee, + required this.sharebymail, }); - factory CoreNavigationApps_Ocs_Data_Order.fromJson(dynamic data) { - int? $int; - try { - $int = (data as int); - } catch (_) {} - String? string; - try { - string = (data as String); - } catch (_) {} - assert([$int, string].where((final x) => x != null).length == 1, 'Need oneOf'); - return CoreNavigationApps_Ocs_Data_Order( - data, - $int: $int, - string: string, - ); - } + factory CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharingFromJson(json); - final dynamic _data; + @JsonKey(name: 'api_enabled') + final bool apiEnabled; - final int? $int; + final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Public public; - final String? string; + final bool resharing; - // coverage:ignore-start - dynamic toJson() => _data; - // coverage:ignore-end -} + final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_User user; -@JsonSerializable() -class CoreNavigationApps_Ocs_Data { - CoreNavigationApps_Ocs_Data({ - required this.id, - required this.order, - required this.href, - required this.icon, - required this.type, - required this.name, - required this.active, - required this.classes, - required this.unread, - }); + @JsonKey(name: 'group_sharing') + final bool groupSharing; - factory CoreNavigationApps_Ocs_Data.fromJson(Map json) => - _$CoreNavigationApps_Ocs_DataFromJson(json); + final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Group group; - final String id; + @JsonKey(name: 'default_permissions') + final int defaultPermissions; - /// Should always be an integer, but there is a bug. See https://github.com/nextcloud/server/issues/32828 - final CoreNavigationApps_Ocs_Data_Order order; + final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Federation federation; - final String href; + final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharee sharee; - final String icon; + final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing_Sharebymail sharebymail; - final String type; + // coverage:ignore-start + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharingToJson(this); + // coverage:ignore-end +} - final String name; +@JsonSerializable() +class CoreServerCapabilities_Ocs_Data_Capabilities_Notes { + CoreServerCapabilities_Ocs_Data_Capabilities_Notes({ + required this.apiVersion, + required this.version, + }); - final bool active; + factory CoreServerCapabilities_Ocs_Data_Capabilities_Notes.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_NotesFromJson(json); - final String classes; + @JsonKey(name: 'api_version') + final List apiVersion; - final int unread; + final String version; // coverage:ignore-start - Map toJson() => _$CoreNavigationApps_Ocs_DataToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_NotesToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreNavigationApps_Ocs { - CoreNavigationApps_Ocs({ - required this.meta, - required this.data, +class CoreServerCapabilities_Ocs_Data_Capabilities_Notifications { + CoreServerCapabilities_Ocs_Data_Capabilities_Notifications({ + required this.ocsEndpoints, + required this.push, + required this.adminNotifications, }); - factory CoreNavigationApps_Ocs.fromJson(Map json) => _$CoreNavigationApps_OcsFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Capabilities_Notifications.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_NotificationsFromJson(json); - final OCSMeta meta; + @JsonKey(name: 'ocs-endpoints') + final List ocsEndpoints; - final List data; + final List push; + + @JsonKey(name: 'admin-notifications') + final List adminNotifications; // coverage:ignore-start - Map toJson() => _$CoreNavigationApps_OcsToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_NotificationsToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreNavigationApps { - CoreNavigationApps({required this.ocs}); +class CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicy_Api { + CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicy_Api({ + required this.generate, + required this.validate, + }); - factory CoreNavigationApps.fromJson(Map json) => _$CoreNavigationAppsFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicy_Api.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicy_ApiFromJson(json); + + final String generate; - final CoreNavigationApps_Ocs ocs; + final String validate; // coverage:ignore-start - Map toJson() => _$CoreNavigationAppsToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicy_ApiToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreLoginFlowInit_Poll { - CoreLoginFlowInit_Poll({ - required this.token, - required this.endpoint, +class CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicy { + CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicy({ + required this.minLength, + required this.enforceNonCommonPassword, + required this.enforceNumericCharacters, + required this.enforceSpecialCharacters, + required this.enforceUpperLowerCase, + required this.api, }); - factory CoreLoginFlowInit_Poll.fromJson(Map json) => _$CoreLoginFlowInit_PollFromJson(json); - - final String token; + factory CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicy.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicyFromJson(json); - final String endpoint; + final int minLength; - // coverage:ignore-start - Map toJson() => _$CoreLoginFlowInit_PollToJson(this); - // coverage:ignore-end -} + final bool enforceNonCommonPassword; -@JsonSerializable() -class CoreLoginFlowInit { - CoreLoginFlowInit({ - required this.poll, - required this.login, - }); + final bool enforceNumericCharacters; - factory CoreLoginFlowInit.fromJson(Map json) => _$CoreLoginFlowInitFromJson(json); + final bool enforceSpecialCharacters; - final CoreLoginFlowInit_Poll poll; + final bool enforceUpperLowerCase; - final String login; + final CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicy_Api api; // coverage:ignore-start - Map toJson() => _$CoreLoginFlowInitToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicyToJson(this); // coverage:ignore-end } @JsonSerializable() -class CoreLoginFlowResult { - CoreLoginFlowResult({ - required this.server, - required this.loginName, - required this.appPassword, +class CoreServerCapabilities_Ocs_Data_Capabilities_ProvisioningApi { + CoreServerCapabilities_Ocs_Data_Capabilities_ProvisioningApi({ + required this.version, + required this.accountPropertyScopesVersion, + required this.accountPropertyScopesFederatedEnabled, + required this.accountPropertyScopesPublishedEnabled, }); - factory CoreLoginFlowResult.fromJson(Map json) => _$CoreLoginFlowResultFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Capabilities_ProvisioningApi.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_ProvisioningApiFromJson(json); - final String server; + final String version; - final String loginName; + @JsonKey(name: 'AccountPropertyScopesVersion') + final int accountPropertyScopesVersion; - final String appPassword; + @JsonKey(name: 'AccountPropertyScopesFederatedEnabled') + final bool accountPropertyScopesFederatedEnabled; + + @JsonKey(name: 'AccountPropertyScopesPublishedEnabled') + final bool accountPropertyScopesPublishedEnabled; // coverage:ignore-start - Map toJson() => _$CoreLoginFlowResultToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_ProvisioningApiToJson(this); // coverage:ignore-end } -class CoreClient { - CoreClient(this.rootClient); - - final Client rootClient; +@JsonSerializable() +class CoreServerCapabilities_Ocs_Data_Capabilities_Theming { + CoreServerCapabilities_Ocs_Data_Capabilities_Theming({ + required this.name, + required this.url, + required this.slogan, + required this.color, + required this.colorText, + required this.colorElement, + required this.colorElementBright, + required this.colorElementDark, + required this.logo, + required this.background, + required this.backgroundPlain, + required this.backgroundDefault, + required this.logoheader, + required this.favicon, + }); - Future getStatus() async { - var path = '/status.php'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - final response = await rootClient.doRequest( - 'get', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return CoreServerStatus.fromJson(json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + factory CoreServerCapabilities_Ocs_Data_Capabilities_Theming.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_ThemingFromJson(json); - Future getCapabilities() async { - var path = '/ocs/v2.php/cloud/capabilities'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - final response = await rootClient.doRequest( - 'get', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return CoreServerCapabilities.fromJson(json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final String name; - Future getNavigationApps() async { - var path = '/ocs/v2.php/core/navigation/apps'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - final response = await rootClient.doRequest( - 'get', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return CoreNavigationApps.fromJson(json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final String url; - Future initLoginFlow() async { - var path = '/index.php/login/v2'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - final response = await rootClient.doRequest( - 'post', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return CoreLoginFlowInit.fromJson(json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final String slogan; - Future getLoginFlowResult({required String token}) async { - var path = '/index.php/login/v2/poll'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - queryParameters['token'] = token.toString(); - final response = await rootClient.doRequest( - 'post', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return CoreLoginFlowResult.fromJson(json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final String color; - Future getPreview({ - String file = '', - int x = 32, - int y = 32, - int a = 0, - int forceIcon = 1, - String mode = 'fill', - }) async { - var path = '/index.php/core/preview.png'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - queryParameters['file'] = file.toString(); - queryParameters['x'] = x.toString(); - queryParameters['y'] = y.toString(); - queryParameters['a'] = a.toString(); - queryParameters['forceIcon'] = forceIcon.toString(); - queryParameters['mode'] = mode.toString(); - final response = await rootClient.doRequest( - 'get', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return response.body; - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + @JsonKey(name: 'color-text') + final String colorText; - Future getDarkAvatar({ - required String userId, - required int size, - }) async { - var path = '/index.php/avatar/{userId}/{size}/dark'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId.toString())); - path = path.replaceAll('{size}', Uri.encodeQueryComponent(size.toString())); - final response = await rootClient.doRequest( - 'get', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return response.body; - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + @JsonKey(name: 'color-element') + final String colorElement; - Future getAvatar({ - required String userId, - required int size, - }) async { - var path = '/index.php/avatar/{userId}/{size}'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId.toString())); - path = path.replaceAll('{size}', Uri.encodeQueryComponent(size.toString())); - final response = await rootClient.doRequest( - 'get', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return response.body; - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + @JsonKey(name: 'color-element-bright') + final String colorElementBright; + + @JsonKey(name: 'color-element-dark') + final String colorElementDark; + + final String logo; + + final String background; + + @JsonKey(name: 'background-plain') + final bool backgroundPlain; + + @JsonKey(name: 'background-default') + final bool backgroundDefault; + + final String logoheader; + + final String favicon; + + // coverage:ignore-start + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_ThemingToJson(this); + // coverage:ignore-end } @JsonSerializable() -class GetSupportedApiVersions { - GetSupportedApiVersions({this.apiLevels}); +class CoreServerCapabilities_Ocs_Data_Capabilities_UserStatus { + CoreServerCapabilities_Ocs_Data_Capabilities_UserStatus({ + required this.enabled, + required this.supportsEmoji, + }); - factory GetSupportedApiVersions.fromJson(Map json) => _$GetSupportedApiVersionsFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Capabilities_UserStatus.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_UserStatusFromJson(json); - final List? apiLevels; + final bool enabled; + + @JsonKey(name: 'supports_emoji') + final bool supportsEmoji; // coverage:ignore-start - Map toJson() => _$GetSupportedApiVersionsToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_UserStatusToJson(this); // coverage:ignore-end } @JsonSerializable() -class NewsArticle { - NewsArticle({ - required this.id, - required this.guid, - required this.guidHash, - this.url, - required this.title, - this.author, - required this.pubDate, - this.updatedDate, - required this.body, - this.enclosureMime, - this.enclosureLink, - this.mediaThumbnail, - this.mediaDescription, - required this.feedId, - required this.unread, - required this.starred, - required this.lastModified, - required this.rtl, - required this.fingerprint, - required this.contentHash, +class CoreServerCapabilities_Ocs_Data_Capabilities_WeatherStatus { + CoreServerCapabilities_Ocs_Data_Capabilities_WeatherStatus({required this.enabled}); + + factory CoreServerCapabilities_Ocs_Data_Capabilities_WeatherStatus.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_Capabilities_WeatherStatusFromJson(json); + + final bool enabled; + + // coverage:ignore-start + Map toJson() => _$CoreServerCapabilities_Ocs_Data_Capabilities_WeatherStatusToJson(this); + // coverage:ignore-end +} + +@JsonSerializable(disallowUnrecognizedKeys: false) +class CoreServerCapabilities_Ocs_Data_Capabilities { + CoreServerCapabilities_Ocs_Data_Capabilities({ + required this.core, + required this.bruteforce, + required this.metadataAvailable, + required this.files, + this.activity, + this.circles, + required this.ocm, + required this.dav, + this.filesSharing, + this.notes, + this.notifications, + this.passwordPolicy, + this.provisioningApi, + this.theming, + this.userStatus, + this.weatherStatus, }); - factory NewsArticle.fromJson(Map json) => _$NewsArticleFromJson(json); + factory CoreServerCapabilities_Ocs_Data_Capabilities.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_Data_CapabilitiesFromJson(json); - final int id; + final CoreServerCapabilities_Ocs_Data_Capabilities_Core core; - final String guid; + final CoreServerCapabilities_Ocs_Data_Capabilities_Bruteforce bruteforce; - final String guidHash; + final CoreServerCapabilities_Ocs_Data_Capabilities_MetadataAvailable metadataAvailable; - final String? url; + final CoreServerCapabilities_Ocs_Data_Capabilities_Files files; - final String title; + final CoreServerCapabilities_Ocs_Data_Capabilities_Activity? activity; - final String? author; + final CoreServerCapabilities_Ocs_Data_Capabilities_Circles? circles; - final int pubDate; + final CoreServerCapabilities_Ocs_Data_Capabilities_Ocm ocm; - final int? updatedDate; + final CoreServerCapabilities_Ocs_Data_Capabilities_Dav dav; - final String body; + @JsonKey(name: 'files_sharing') + final CoreServerCapabilities_Ocs_Data_Capabilities_FilesSharing? filesSharing; - final String? enclosureMime; + final CoreServerCapabilities_Ocs_Data_Capabilities_Notes? notes; - final String? enclosureLink; + final CoreServerCapabilities_Ocs_Data_Capabilities_Notifications? notifications; - final String? mediaThumbnail; + @JsonKey(name: 'password_policy') + final CoreServerCapabilities_Ocs_Data_Capabilities_PasswordPolicy? passwordPolicy; - final String? mediaDescription; + @JsonKey(name: 'provisioning_api') + final CoreServerCapabilities_Ocs_Data_Capabilities_ProvisioningApi? provisioningApi; - final int feedId; + final CoreServerCapabilities_Ocs_Data_Capabilities_Theming? theming; - final bool unread; + @JsonKey(name: 'user_status') + final CoreServerCapabilities_Ocs_Data_Capabilities_UserStatus? userStatus; - final bool starred; + @JsonKey(name: 'weather_status') + final CoreServerCapabilities_Ocs_Data_Capabilities_WeatherStatus? weatherStatus; - final int lastModified; + // coverage:ignore-start + Map toJson() => _$CoreServerCapabilities_Ocs_Data_CapabilitiesToJson(this); + // coverage:ignore-end +} - final bool rtl; +@JsonSerializable() +class CoreServerCapabilities_Ocs_Data { + CoreServerCapabilities_Ocs_Data({ + required this.version, + required this.capabilities, + }); - final String fingerprint; + factory CoreServerCapabilities_Ocs_Data.fromJson(Map json) => + _$CoreServerCapabilities_Ocs_DataFromJson(json); - final String contentHash; + final CoreServerCapabilities_Ocs_Data_Version version; + + final CoreServerCapabilities_Ocs_Data_Capabilities capabilities; // coverage:ignore-start - Map toJson() => _$NewsArticleToJson(this); + Map toJson() => _$CoreServerCapabilities_Ocs_DataToJson(this); // coverage:ignore-end } @JsonSerializable() -class NewsFeed { - NewsFeed({ +class CoreServerCapabilities_Ocs { + CoreServerCapabilities_Ocs({ + required this.meta, + required this.data, + }); + + factory CoreServerCapabilities_Ocs.fromJson(Map json) => _$CoreServerCapabilities_OcsFromJson(json); + + final OCSMeta meta; + + final CoreServerCapabilities_Ocs_Data data; + + // coverage:ignore-start + Map toJson() => _$CoreServerCapabilities_OcsToJson(this); + // coverage:ignore-end +} + +@JsonSerializable() +class CoreServerCapabilities { + CoreServerCapabilities({required this.ocs}); + + factory CoreServerCapabilities.fromJson(Map json) => _$CoreServerCapabilitiesFromJson(json); + + final CoreServerCapabilities_Ocs ocs; + + // coverage:ignore-start + Map toJson() => _$CoreServerCapabilitiesToJson(this); + // coverage:ignore-end +} + +class CoreNavigationApps_Ocs_Data_Order { + CoreNavigationApps_Ocs_Data_Order( + this._data, { + this.$int, + this.string, + }); + + factory CoreNavigationApps_Ocs_Data_Order.fromJson(dynamic data) { + int? $int; + try { + $int = (data as int); + } catch (_) {} + String? string; + try { + string = (data as String); + } catch (_) {} + assert([$int, string].where((final x) => x != null).length == 1, 'Need oneOf'); + return CoreNavigationApps_Ocs_Data_Order( + data, + $int: $int, + string: string, + ); + } + + final dynamic _data; + + final int? $int; + + final String? string; + + // coverage:ignore-start + dynamic toJson() => _data; + // coverage:ignore-end +} + +@JsonSerializable() +class CoreNavigationApps_Ocs_Data { + CoreNavigationApps_Ocs_Data({ required this.id, - required this.url, - required this.title, - required this.faviconLink, - required this.added, - this.folderId, - this.unreadCount, - required this.ordering, - this.link, - required this.pinned, - required this.updateErrorCount, - this.lastUpdateError, - required this.items, + required this.order, + required this.href, + required this.icon, + required this.type, + required this.name, + required this.active, + required this.classes, + required this.unread, }); - factory NewsFeed.fromJson(Map json) => _$NewsFeedFromJson(json); + factory CoreNavigationApps_Ocs_Data.fromJson(Map json) => + _$CoreNavigationApps_Ocs_DataFromJson(json); + + final String id; + + /// Should always be an integer, but there is a bug. See https://github.com/nextcloud/server/issues/32828 + final CoreNavigationApps_Ocs_Data_Order order; + + final String href; + + final String icon; + + final String type; - final int id; + final String name; - final String url; + final bool active; - final String title; + final String classes; - final String faviconLink; + final int unread; - final int added; + // coverage:ignore-start + Map toJson() => _$CoreNavigationApps_Ocs_DataToJson(this); + // coverage:ignore-end +} - final int? folderId; +@JsonSerializable() +class CoreNavigationApps_Ocs { + CoreNavigationApps_Ocs({ + required this.meta, + required this.data, + }); - final int? unreadCount; + factory CoreNavigationApps_Ocs.fromJson(Map json) => _$CoreNavigationApps_OcsFromJson(json); - final int ordering; + final OCSMeta meta; - final String? link; + final List data; - final bool pinned; + // coverage:ignore-start + Map toJson() => _$CoreNavigationApps_OcsToJson(this); + // coverage:ignore-end +} - final int updateErrorCount; +@JsonSerializable() +class CoreNavigationApps { + CoreNavigationApps({required this.ocs}); - final String? lastUpdateError; + factory CoreNavigationApps.fromJson(Map json) => _$CoreNavigationAppsFromJson(json); - final List items; + final CoreNavigationApps_Ocs ocs; // coverage:ignore-start - Map toJson() => _$NewsFeedToJson(this); + Map toJson() => _$CoreNavigationAppsToJson(this); // coverage:ignore-end } @JsonSerializable() -class NewsFolder { - NewsFolder({ - required this.id, - required this.name, - required this.opened, - required this.feeds, +class CoreLoginFlowInit_Poll { + CoreLoginFlowInit_Poll({ + required this.token, + required this.endpoint, }); - factory NewsFolder.fromJson(Map json) => _$NewsFolderFromJson(json); - - final int id; - - final String name; + factory CoreLoginFlowInit_Poll.fromJson(Map json) => _$CoreLoginFlowInit_PollFromJson(json); - final bool opened; + final String token; - /// This seems to be broken. In testing it is always empty - final List feeds; + final String endpoint; // coverage:ignore-start - Map toJson() => _$NewsFolderToJson(this); + Map toJson() => _$CoreLoginFlowInit_PollToJson(this); // coverage:ignore-end } @JsonSerializable() -class NewsListFolders { - NewsListFolders({required this.folders}); +class CoreLoginFlowInit { + CoreLoginFlowInit({ + required this.poll, + required this.login, + }); - factory NewsListFolders.fromJson(Map json) => _$NewsListFoldersFromJson(json); + factory CoreLoginFlowInit.fromJson(Map json) => _$CoreLoginFlowInitFromJson(json); - final List folders; + final CoreLoginFlowInit_Poll poll; + + final String login; // coverage:ignore-start - Map toJson() => _$NewsListFoldersToJson(this); + Map toJson() => _$CoreLoginFlowInitToJson(this); // coverage:ignore-end } @JsonSerializable() -class NewsListFeeds { - NewsListFeeds({ - this.starredCount, - this.newestItemId, - required this.feeds, +class CoreLoginFlowResult { + CoreLoginFlowResult({ + required this.server, + required this.loginName, + required this.appPassword, }); - factory NewsListFeeds.fromJson(Map json) => _$NewsListFeedsFromJson(json); + factory CoreLoginFlowResult.fromJson(Map json) => _$CoreLoginFlowResultFromJson(json); - final int? starredCount; + final String server; - final int? newestItemId; + final String loginName; - final List feeds; + final String appPassword; // coverage:ignore-start - Map toJson() => _$NewsListFeedsToJson(this); + Map toJson() => _$CoreLoginFlowResultToJson(this); // coverage:ignore-end } @JsonSerializable() -class NewsListArticles { - NewsListArticles({required this.items}); +class GetSupportedApiVersions { + GetSupportedApiVersions({this.apiLevels}); - factory NewsListArticles.fromJson(Map json) => _$NewsListArticlesFromJson(json); + factory GetSupportedApiVersions.fromJson(Map json) => _$GetSupportedApiVersionsFromJson(json); - final List items; + final List? apiLevels; // coverage:ignore-start - Map toJson() => _$NewsListArticlesToJson(this); + Map toJson() => _$GetSupportedApiVersionsToJson(this); // coverage:ignore-end } -class NewsClient { - NewsClient(this.rootClient); +@JsonSerializable() +class NewsArticle { + NewsArticle({ + required this.id, + required this.guid, + required this.guidHash, + this.url, + required this.title, + this.author, + required this.pubDate, + this.updatedDate, + required this.body, + this.enclosureMime, + this.enclosureLink, + this.mediaThumbnail, + this.mediaDescription, + required this.feedId, + required this.unread, + required this.starred, + required this.lastModified, + required this.rtl, + required this.fingerprint, + required this.contentHash, + }); - final Client rootClient; + factory NewsArticle.fromJson(Map json) => _$NewsArticleFromJson(json); - Future getSupportedApiVersions() async { - var path = '/index.php/apps/news/api'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - final response = await rootClient.doRequest( - 'get', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return GetSupportedApiVersions.fromJson( - json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final int id; - Future listFolders() async { - var path = '/index.php/apps/news/api/v1-3/folders'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - final response = await rootClient.doRequest( - 'get', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return NewsListFolders.fromJson(json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final String guid; - Future createFolder({required String name}) async { - var path = '/index.php/apps/news/api/v1-3/folders'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - queryParameters['name'] = name.toString(); - final response = await rootClient.doRequest( - 'post', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return NewsListFolders.fromJson(json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final String guidHash; - Future renameFolder({ - required int folderId, - required String name, - }) async { - var path = '/index.php/apps/news/api/v1-3/folders/{folderId}'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - path = path.replaceAll('{folderId}', Uri.encodeQueryComponent(folderId.toString())); - queryParameters['name'] = name.toString(); - final response = await rootClient.doRequest( - 'put', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return; - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final String? url; - Future deleteFolder({required int folderId}) async { - var path = '/index.php/apps/news/api/v1-3/folders/{folderId}'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - path = path.replaceAll('{folderId}', Uri.encodeQueryComponent(folderId.toString())); - final response = await rootClient.doRequest( - 'delete', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return; - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final String title; - Future markFolderAsRead({ - required int folderId, - required int newestItemId, - }) async { - var path = '/index.php/apps/news/api/v1-3/folders/{folderId}/read'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - path = path.replaceAll('{folderId}', Uri.encodeQueryComponent(folderId.toString())); - queryParameters['newestItemId'] = newestItemId.toString(); - final response = await rootClient.doRequest( - 'post', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return; - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final String? author; + + final int pubDate; + + final int? updatedDate; - Future listFeeds() async { - var path = '/index.php/apps/news/api/v1-3/feeds'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - final response = await rootClient.doRequest( - 'get', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return NewsListFeeds.fromJson(json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final String body; - Future addFeed({ - required String url, - int? folderId, - }) async { - var path = '/index.php/apps/news/api/v1-3/feeds'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - queryParameters['url'] = url.toString(); - if (folderId != null) { - queryParameters['folderId'] = folderId.toString(); - } - final response = await rootClient.doRequest( - 'post', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return NewsListFeeds.fromJson(json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final String? enclosureMime; - Future deleteFeed({required int feedId}) async { - var path = '/index.php/apps/news/api/v1-3/feeds/{feedId}'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - path = path.replaceAll('{feedId}', Uri.encodeQueryComponent(feedId.toString())); - final response = await rootClient.doRequest( - 'delete', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return; - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final String? enclosureLink; - Future moveFeed({ - required int feedId, - int? folderId, - }) async { - var path = '/index.php/apps/news/api/v1-3/feeds/{feedId}/move'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - path = path.replaceAll('{feedId}', Uri.encodeQueryComponent(feedId.toString())); - if (folderId != null) { - queryParameters['folderId'] = folderId.toString(); - } - final response = await rootClient.doRequest( - 'post', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return; - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final String? mediaThumbnail; - Future renameFeed({ - required int feedId, - required String feedTitle, - }) async { - var path = '/index.php/apps/news/api/v1-3/feeds/{feedId}/rename'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - path = path.replaceAll('{feedId}', Uri.encodeQueryComponent(feedId.toString())); - queryParameters['feedTitle'] = feedTitle.toString(); - final response = await rootClient.doRequest( - 'post', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return; - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final String? mediaDescription; - Future markFeedAsRead({ - required int feedId, - required int newestItemId, - }) async { - var path = '/index.php/apps/news/api/v1-3/feeds/{feedId}/read'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - path = path.replaceAll('{feedId}', Uri.encodeQueryComponent(feedId.toString())); - queryParameters['newestItemId'] = newestItemId.toString(); - final response = await rootClient.doRequest( - 'post', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return; - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final int feedId; - Future listArticles({ - int type = 3, - int id = 0, - int getRead = 1, - int batchSize = -1, - int offset = 0, - int oldestFirst = 0, - }) async { - var path = '/index.php/apps/news/api/v1-3/items'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - queryParameters['type'] = type.toString(); - queryParameters['id'] = id.toString(); - queryParameters['getRead'] = getRead.toString(); - queryParameters['batchSize'] = batchSize.toString(); - queryParameters['offset'] = offset.toString(); - queryParameters['oldestFirst'] = oldestFirst.toString(); - final response = await rootClient.doRequest( - 'get', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return NewsListArticles.fromJson(json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final bool unread; - Future listUpdatedArticles({ - int type = 3, - int id = 0, - int lastModified = 0, - }) async { - var path = '/index.php/apps/news/api/v1-3/items/updated'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - queryParameters['type'] = type.toString(); - queryParameters['id'] = id.toString(); - queryParameters['lastModified'] = lastModified.toString(); - final response = await rootClient.doRequest( - 'get', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return NewsListArticles.fromJson(json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final bool starred; - Future markArticleAsRead({required int itemId}) async { - var path = '/index.php/apps/news/api/v1-3/items/{itemId}/read'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - path = path.replaceAll('{itemId}', Uri.encodeQueryComponent(itemId.toString())); - final response = await rootClient.doRequest( - 'post', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return; - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final int lastModified; - Future markArticleAsUnread({required int itemId}) async { - var path = '/index.php/apps/news/api/v1-3/items/{itemId}/unread'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - path = path.replaceAll('{itemId}', Uri.encodeQueryComponent(itemId.toString())); - final response = await rootClient.doRequest( - 'post', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return; - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final bool rtl; - Future starArticle({required int itemId}) async { - var path = '/index.php/apps/news/api/v1-3/items/{itemId}/star'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - path = path.replaceAll('{itemId}', Uri.encodeQueryComponent(itemId.toString())); - final response = await rootClient.doRequest( - 'post', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return; - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final String fingerprint; - Future unstarArticle({required int itemId}) async { - var path = '/index.php/apps/news/api/v1-3/items/{itemId}/unstar'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - path = path.replaceAll('{itemId}', Uri.encodeQueryComponent(itemId.toString())); - final response = await rootClient.doRequest( - 'post', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return; - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final String contentHash; + + // coverage:ignore-start + Map toJson() => _$NewsArticleToJson(this); + // coverage:ignore-end } @JsonSerializable() -class NotesNote { - NotesNote({ +class NewsFeed { + NewsFeed({ required this.id, - required this.etag, - required this.readonly, - required this.content, + required this.url, required this.title, - required this.category, - required this.favorite, - required this.modified, - required this.error, - required this.errorType, + required this.faviconLink, + required this.added, + this.folderId, + this.unreadCount, + required this.ordering, + this.link, + required this.pinned, + required this.updateErrorCount, + this.lastUpdateError, + required this.items, }); - factory NotesNote.fromJson(Map json) => _$NotesNoteFromJson(json); + factory NewsFeed.fromJson(Map json) => _$NewsFeedFromJson(json); final int id; - final String etag; + final String url; - final bool readonly; + final String title; - final String content; + final String faviconLink; - final String title; + final int added; - final String category; + final int? folderId; - final bool favorite; + final int? unreadCount; - final int modified; + final int ordering; - final bool error; + final String? link; - final String errorType; + final bool pinned; + + final int updateErrorCount; + + final String? lastUpdateError; + + final List items; // coverage:ignore-start - Map toJson() => _$NotesNoteToJson(this); + Map toJson() => _$NewsFeedToJson(this); // coverage:ignore-end } -enum NotesSettings_NoteMode { - edit('edit'), - preview('preview'); +@JsonSerializable() +class NewsFolder { + NewsFolder({ + required this.id, + required this.name, + required this.opened, + required this.feeds, + }); - const NotesSettings_NoteMode(this.value); + factory NewsFolder.fromJson(Map json) => _$NewsFolderFromJson(json); - final String value; + final int id; - static NotesSettings_NoteMode fromValue(String value) { - switch (value) { - case 'edit': - return NotesSettings_NoteMode.edit; - case 'preview': - return NotesSettings_NoteMode.preview; - default: - throw Exception('Can not parse UserStatusClearAtTime0 from "$value"'); - } - } + final String name; + + final bool opened; + + /// This seems to be broken. In testing it is always empty + final List feeds; + + // coverage:ignore-start + Map toJson() => _$NewsFolderToJson(this); + // coverage:ignore-end } @JsonSerializable() -class NotesSettings { - NotesSettings({ - required this.notesPath, - required this.fileSuffix, - required this.noteMode, +class NewsListFolders { + NewsListFolders({required this.folders}); + + factory NewsListFolders.fromJson(Map json) => _$NewsListFoldersFromJson(json); + + final List folders; + + // coverage:ignore-start + Map toJson() => _$NewsListFoldersToJson(this); + // coverage:ignore-end +} + +@JsonSerializable() +class NewsListFeeds { + NewsListFeeds({ + this.starredCount, + this.newestItemId, + required this.feeds, }); - factory NotesSettings.fromJson(Map json) => _$NotesSettingsFromJson(json); + factory NewsListFeeds.fromJson(Map json) => _$NewsListFeedsFromJson(json); - final String notesPath; + final int? starredCount; - final String fileSuffix; + final int? newestItemId; - final NotesSettings_NoteMode noteMode; + final List feeds; // coverage:ignore-start - Map toJson() => _$NotesSettingsToJson(this); + Map toJson() => _$NewsListFeedsToJson(this); // coverage:ignore-end } -class NotesClient { - NotesClient(this.rootClient); +@JsonSerializable() +class NewsListArticles { + NewsListArticles({required this.items}); - final Client rootClient; + factory NewsListArticles.fromJson(Map json) => _$NewsListArticlesFromJson(json); - Future> getNotes({ - String? category, - String exclude = '', - int pruneBefore = 0, - int chunkSize = 0, - String? chunkCursor, - String? ifNoneMatch, - }) async { - var path = '/index.php/apps/notes/api/v1/notes'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - if (category != null) { - queryParameters['category'] = category.toString(); - } - queryParameters['exclude'] = exclude.toString(); - queryParameters['pruneBefore'] = pruneBefore.toString(); - queryParameters['chunkSize'] = chunkSize.toString(); - if (chunkCursor != null) { - queryParameters['chunkCursor'] = chunkCursor.toString(); - } - if (ifNoneMatch != null) { - headers['If-None-Match'] = ifNoneMatch.toString(); - } - final response = await rootClient.doRequest( - 'get', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return (json.decode(utf8.decode(response.body) as String) as List) - .map((final e) => NotesNote.fromJson(e as Map)) - .toList(); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final List items; - Future createNote({ - String category = '', - String title = '', - String content = '', - int modified = 0, - int favorite = 0, - }) async { - var path = '/index.php/apps/notes/api/v1/notes'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - queryParameters['category'] = category.toString(); - queryParameters['title'] = title.toString(); - queryParameters['content'] = content.toString(); - queryParameters['modified'] = modified.toString(); - queryParameters['favorite'] = favorite.toString(); - final response = await rootClient.doRequest( - 'post', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return NotesNote.fromJson(json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + // coverage:ignore-start + Map toJson() => _$NewsListArticlesToJson(this); + // coverage:ignore-end +} - Future getNote({ - required int id, - String exclude = '', - String? ifNoneMatch, - }) async { - var path = '/index.php/apps/notes/api/v1/notes/{id}'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - path = path.replaceAll('{id}', Uri.encodeQueryComponent(id.toString())); - queryParameters['exclude'] = exclude.toString(); - if (ifNoneMatch != null) { - headers['If-None-Match'] = ifNoneMatch.toString(); - } - final response = await rootClient.doRequest( - 'get', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return NotesNote.fromJson(json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } +@JsonSerializable() +class NotesNote { + NotesNote({ + required this.id, + required this.etag, + required this.readonly, + required this.content, + required this.title, + required this.category, + required this.favorite, + required this.modified, + required this.error, + required this.errorType, + }); + + factory NotesNote.fromJson(Map json) => _$NotesNoteFromJson(json); + + final int id; + + final String etag; + + final bool readonly; + + final String content; + + final String title; + + final String category; + + final bool favorite; + + final int modified; + + final bool error; - Future updateNote({ - required int id, - String? content, - int? modified, - String? title, - String? category, - int favorite = 0, - String? ifMatch, - }) async { - var path = '/index.php/apps/notes/api/v1/notes/{id}'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - path = path.replaceAll('{id}', Uri.encodeQueryComponent(id.toString())); - if (content != null) { - queryParameters['content'] = content.toString(); - } - if (modified != null) { - queryParameters['modified'] = modified.toString(); - } - if (title != null) { - queryParameters['title'] = title.toString(); - } - if (category != null) { - queryParameters['category'] = category.toString(); - } - queryParameters['favorite'] = favorite.toString(); - if (ifMatch != null) { - headers['If-Match'] = ifMatch.toString(); - } - final response = await rootClient.doRequest( - 'put', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return NotesNote.fromJson(json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final String errorType; - Future deleteNote({required int id}) async { - var path = '/index.php/apps/notes/api/v1/notes/{id}'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - path = path.replaceAll('{id}', Uri.encodeQueryComponent(id.toString())); - final response = await rootClient.doRequest( - 'delete', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return ((utf8.decode(response.body) as String) as String); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + // coverage:ignore-start + Map toJson() => _$NotesNoteToJson(this); + // coverage:ignore-end +} - Future getSettings() async { - var path = '/index.php/apps/notes/api/v1/settings'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - final response = await rootClient.doRequest( - 'get', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return NotesSettings.fromJson(json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } +enum NotesSettings_NoteMode { + edit('edit'), + preview('preview'); - Future updateSettings({required NotesSettings notesSettings}) async { - var path = '/index.php/apps/notes/api/v1/settings'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - headers['Content-Type'] = 'application/json'; - body = Uint8List.fromList(utf8.encode(json.encode(notesSettings.toJson()))); - final response = await rootClient.doRequest( - 'put', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return NotesSettings.fromJson(json.decode(utf8.decode(response.body) as String) as Map); + const NotesSettings_NoteMode(this.value); + + final String value; + + static NotesSettings_NoteMode fromValue(String value) { + switch (value) { + case 'edit': + return NotesSettings_NoteMode.edit; + case 'preview': + return NotesSettings_NoteMode.preview; + default: + throw Exception('Can not parse UserStatusClearAtTime0 from "$value"'); } - throw ApiException.fromResponse(response); // coverage:ignore-line } } +@JsonSerializable() +class NotesSettings { + NotesSettings({ + required this.notesPath, + required this.fileSuffix, + required this.noteMode, + }); + + factory NotesSettings.fromJson(Map json) => _$NotesSettingsFromJson(json); + + final String notesPath; + + final String fileSuffix; + + final NotesSettings_NoteMode noteMode; + + // coverage:ignore-start + Map toJson() => _$NotesSettingsToJson(this); + // coverage:ignore-end +} + class NotificationsNotification_SubjectRichParameters { NotificationsNotification_SubjectRichParameters( this._data, { @@ -2842,155 +3215,11 @@ class NotificationsPushServerRegistration { factory NotificationsPushServerRegistration.fromJson(Map json) => _$NotificationsPushServerRegistrationFromJson(json); - final NotificationsPushServerRegistration_Ocs ocs; - - // coverage:ignore-start - Map toJson() => _$NotificationsPushServerRegistrationToJson(this); - // coverage:ignore-end -} - -class NotificationsClient { - NotificationsClient(this.rootClient); - - final Client rootClient; - - Future listNotifications() async { - var path = '/ocs/v2.php/apps/notifications/api/v2/notifications'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - final response = await rootClient.doRequest( - 'get', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return NotificationsListNotifications.fromJson( - json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } - - Future deleteAllNotifications() async { - var path = '/ocs/v2.php/apps/notifications/api/v2/notifications'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - final response = await rootClient.doRequest( - 'delete', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return ((utf8.decode(response.body) as String) as String); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } - - Future getNotification({required int id}) async { - var path = '/ocs/v2.php/apps/notifications/api/v2/notifications/{id}'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - path = path.replaceAll('{id}', Uri.encodeQueryComponent(id.toString())); - final response = await rootClient.doRequest( - 'get', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return NotificationsGetNotification.fromJson( - json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } - - Future deleteNotification({required int id}) async { - var path = '/ocs/v2.php/apps/notifications/api/v2/notifications/{id}'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - path = path.replaceAll('{id}', Uri.encodeQueryComponent(id.toString())); - final response = await rootClient.doRequest( - 'delete', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return EmptyOCS.fromJson(json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } - - Future registerDevice({ - required String pushTokenHash, - required String devicePublicKey, - required String proxyServer, - }) async { - var path = '/ocs/v2.php/apps/notifications/api/v2/push'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - queryParameters['pushTokenHash'] = pushTokenHash.toString(); - queryParameters['devicePublicKey'] = devicePublicKey.toString(); - queryParameters['proxyServer'] = proxyServer.toString(); - final response = await rootClient.doRequest( - 'post', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 201) { - return NotificationsPushServerRegistration.fromJson( - json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } - - Future removeDevice() async { - var path = '/ocs/v2.php/apps/notifications/api/v2/push'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - final response = await rootClient.doRequest( - 'delete', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 202) { - return ((utf8.decode(response.body) as String) as String); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + final NotificationsPushServerRegistration_Ocs ocs; - Future sendAdminNotification({ - required String userId, - required String shortMessage, - String longMessage = '', - }) async { - var path = '/ocs/v2.php/apps/notifications/api/v2/admin_notifications/{userId}'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId.toString())); - queryParameters['shortMessage'] = shortMessage.toString(); - queryParameters['longMessage'] = longMessage.toString(); - final response = await rootClient.doRequest( - 'post', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return EmptyOCS.fromJson(json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } + // coverage:ignore-start + Map toJson() => _$NotificationsPushServerRegistrationToJson(this); + // coverage:ignore-end } @JsonSerializable() @@ -3203,47 +3432,6 @@ class ProvisioningApiUser { // coverage:ignore-end } -class ProvisioningApiClient { - ProvisioningApiClient(this.rootClient); - - final Client rootClient; - - Future getCurrentUser() async { - var path = '/ocs/v2.php/cloud/user'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - final response = await rootClient.doRequest( - 'get', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return ProvisioningApiUser.fromJson(json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } - - Future getUser({required String userId}) async { - var path = '/ocs/v2.php/cloud/users/{userId}'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId.toString())); - final response = await rootClient.doRequest( - 'get', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return ProvisioningApiUser.fromJson(json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } -} - enum UserStatusClearAt_Type { period('period'), @JsonValue('end-of') @@ -3740,194 +3928,6 @@ class UserStatusPredefinedStatuses { // coverage:ignore-end } -class UserStatusClient { - UserStatusClient(this.rootClient); - - final Client rootClient; - - Future findAllStatuses() async { - var path = '/ocs/v2.php/apps/user_status/api/v1/statuses'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - final response = await rootClient.doRequest( - 'get', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return UserStatusFindAllStatuses.fromJson( - json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } - - Future findStatus({required String userId}) async { - var path = '/ocs/v2.php/apps/user_status/api/v1/statuses/{userId}'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId.toString())); - final response = await rootClient.doRequest( - 'get', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return UserStatusFindStatus.fromJson(json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } - - Future getStatus() async { - var path = '/ocs/v2.php/apps/user_status/api/v1/user_status'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - final response = await rootClient.doRequest( - 'get', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return UserStatusGetUserStatus.fromJson( - json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } - - Future setStatus({required UserStatusType statusType}) async { - var path = '/ocs/v2.php/apps/user_status/api/v1/user_status/status'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - queryParameters['statusType'] = statusType.value.toString(); - final response = await rootClient.doRequest( - 'put', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return UserStatusGetUserStatus.fromJson( - json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } - - Future setPredefinedMessage({ - required String messageId, - int? clearAt, - }) async { - var path = '/ocs/v2.php/apps/user_status/api/v1/user_status/message/predefined'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - queryParameters['messageId'] = messageId.toString(); - if (clearAt != null) { - queryParameters['clearAt'] = clearAt.toString(); - } - final response = await rootClient.doRequest( - 'put', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return UserStatusGetUserStatus.fromJson( - json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } - - Future setCustomMessage({ - String? statusIcon, - String? message, - int? clearAt, - }) async { - var path = '/ocs/v2.php/apps/user_status/api/v1/user_status/message/custom'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - if (statusIcon != null) { - queryParameters['statusIcon'] = statusIcon.toString(); - } - if (message != null) { - queryParameters['message'] = message.toString(); - } - if (clearAt != null) { - queryParameters['clearAt'] = clearAt.toString(); - } - final response = await rootClient.doRequest( - 'put', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return UserStatusGetUserStatus.fromJson( - json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } - - Future clearMessage() async { - var path = '/ocs/v2.php/apps/user_status/api/v1/user_status/message'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - final response = await rootClient.doRequest( - 'delete', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return; - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } - - Future findAllPredefinedStatuses() async { - var path = '/ocs/v2.php/apps/user_status/api/v1/predefined_statuses'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - final response = await rootClient.doRequest( - 'get', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return UserStatusPredefinedStatuses.fromJson( - json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } - - Future heartbeat({required UserStatusType status}) async { - var path = '/ocs/v2.php/apps/user_status/api/v1/heartbeat'; - final queryParameters = {}; - final headers = {}; - Uint8List? body; - queryParameters['status'] = status.value.toString(); - final response = await rootClient.doRequest( - 'put', - Uri(path: path, queryParameters: queryParameters).toString(), - headers, - body, - ); - if (response.statusCode == 200) { - return UserStatus.fromJson(json.decode(utf8.decode(response.body) as String) as Map); - } - throw ApiException.fromResponse(response); // coverage:ignore-line - } -} - @JsonSerializable() class NotificationsPushNotificationDecryptedSubject { NotificationsPushNotificationDecryptedSubject({