From 18d3039dc4103bb28d9496720bc4738fc52e62f1 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Sat, 17 Dec 2022 14:26:19 +0400 Subject: [PATCH 01/96] chore: Create infrastructure for Digital Ocean DNS provider Also rename hardcoded cloudflare names from backend --- .../rest_maps/api_factory_creator.dart | 3 + .../dns_providers/cloudflare/cloudflare.dart | 2 +- .../digital_ocean_dns/digital_ocean_dns.dart | 304 ++++++++++++++++++ .../digital_ocean_dns_factory.dart | 16 + .../initializing/dns_provider_form_cubit.dart | 2 +- .../server_installation_cubit.dart | 20 +- .../server_installation_repository.dart | 14 +- .../server_installation_state.dart | 40 +-- lib/logic/get_it/api_config.dart | 12 +- lib/logic/models/hive/server_domain.dart | 2 + .../setup/recovering/recovery_routing.dart | 2 +- 11 files changed, 371 insertions(+), 46 deletions(-) create mode 100644 lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart create mode 100644 lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_factory.dart diff --git a/lib/logic/api_maps/rest_maps/api_factory_creator.dart b/lib/logic/api_maps/rest_maps/api_factory_creator.dart index 25518f3c..c835b0cd 100644 --- a/lib/logic/api_maps/rest_maps/api_factory_creator.dart +++ b/lib/logic/api_maps/rest_maps/api_factory_creator.dart @@ -1,5 +1,6 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_factory.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_factory.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_factory.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_factory.dart'; @@ -32,6 +33,8 @@ class ApiFactoryCreator { switch (settings.provider) { case DnsProvider.cloudflare: return CloudflareApiFactory(); + case DnsProvider.digitalOcean: + return DigitalOceanDnsApiFactory(); case DnsProvider.unknown: throw UnknownApiProviderException('Unknown DNS provider'); } diff --git a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart index 14cf5c96..04ff622b 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart @@ -27,7 +27,7 @@ class CloudflareApi extends DnsProviderApi { BaseOptions get options { final BaseOptions options = BaseOptions(baseUrl: rootAddress); if (isWithToken) { - final String? token = getIt().cloudFlareKey; + final String? token = getIt().dnsProviderKey; assert(token != null); options.headers = {'Authorization': 'Bearer $token'}; } diff --git a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart new file mode 100644 index 00000000..a633fa65 --- /dev/null +++ b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart @@ -0,0 +1,304 @@ +import 'dart:io'; + +import 'package:dio/dio.dart'; +import 'package:selfprivacy/config/get_it_config.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; +import 'package:selfprivacy/logic/models/hive/server_domain.dart'; +import 'package:selfprivacy/logic/models/json/dns_records.dart'; + +class DigitalOceanDnsApi extends DnsProviderApi { + DigitalOceanDnsApi({ + this.hasLogger = false, + this.isWithToken = true, + this.customToken, + }); + @override + final bool hasLogger; + @override + final bool isWithToken; + + final String? customToken; + + @override + RegExp getApiTokenValidation() => + RegExp(r'\s+|[!$%^&*()@+|~=`{}\[\]:<>?,.\/]'); + + @override + BaseOptions get options { + final BaseOptions options = BaseOptions(baseUrl: rootAddress); + if (isWithToken) { + final String? token = getIt().dnsProviderKey; + assert(token != null); + options.headers = {'Authorization': 'Bearer $token'}; + } + + if (customToken != null) { + options.headers = {'Authorization': 'Bearer $customToken'}; + } + + if (validateStatus != null) { + options.validateStatus = validateStatus!; + } + return options; + } + + @override + String rootAddress = 'https://api.digitalocean.com/v2'; + + @override + Future> isApiTokenValid(final String token) async { + bool isValid = false; + Response? response; + String message = ''; + final Dio client = await getClient(); + try { + response = await client.get( + '/account', + options: Options( + followRedirects: false, + validateStatus: (final status) => + status != null && (status >= 200 || status == 401), + headers: {'Authorization': 'Bearer $token'}, + ), + ); + } catch (e) { + print(e); + isValid = false; + message = e.toString(); + } finally { + close(client); + } + + if (response == null) { + return APIGenericResult( + data: isValid, + success: false, + message: message, + ); + } + + if (response.statusCode == HttpStatus.ok) { + isValid = true; + } else if (response.statusCode == HttpStatus.unauthorized) { + isValid = false; + } else { + throw Exception('code: ${response.statusCode}'); + } + + return APIGenericResult( + data: isValid, + success: true, + message: response.statusMessage, + ); + } + + @override + // TODO: Remove from DnsProviderInterface, stub for now + Future getZoneId(final String domain) async => domain; + + @override + Future> removeSimilarRecords({ + required final ServerDomain domain, + final String? ip4, + }) async { + final String domainName = domain.domainName; + final String domainZoneId = domain.zoneId; + + final String url = '/zones/$domainZoneId/dns_records'; + + final Dio client = await getClient(); + try { + final Response response = await client.get(url); + + final List records = response.data['result'] ?? []; + final List allDeleteFutures = []; + + for (final record in records) { + if (record['zone_name'] == domainName) { + allDeleteFutures.add( + client.delete('$url/${record["id"]}'), + ); + } + } + await Future.wait(allDeleteFutures); + } catch (e) { + print(e); + return APIGenericResult( + success: false, + data: null, + message: e.toString(), + ); + } finally { + close(client); + } + + return APIGenericResult(success: true, data: null); + } + + @override + Future> getDnsRecords({ + required final ServerDomain domain, + }) async { + Response response; + final String domainName = domain.domainName; + final String domainZoneId = domain.zoneId; + final List allRecords = []; + + final String url = '/zones/$domainZoneId/dns_records'; + + final Dio client = await getClient(); + try { + response = await client.get(url); + final List records = response.data['result'] ?? []; + + for (final record in records) { + if (record['zone_name'] == domainName) { + allRecords.add( + DnsRecord( + name: record['name'], + type: record['type'], + content: record['content'], + ttl: record['ttl'], + proxied: record['proxied'], + ), + ); + } + } + } catch (e) { + print(e); + } finally { + close(client); + } + + return allRecords; + } + + @override + Future> createMultipleDnsRecords({ + required final ServerDomain domain, + final String? ip4, + }) async { + final String domainName = domain.domainName; + final String domainZoneId = domain.zoneId; + final List listDnsRecords = projectDnsRecords(domainName, ip4); + final List allCreateFutures = []; + + final Dio client = await getClient(); + try { + for (final DnsRecord record in listDnsRecords) { + allCreateFutures.add( + client.post( + '/zones/$domainZoneId/dns_records', + data: record.toJson(), + ), + ); + } + await Future.wait(allCreateFutures); + } on DioError catch (e) { + print(e.message); + rethrow; + } catch (e) { + print(e); + return APIGenericResult( + success: false, + data: null, + message: e.toString(), + ); + } finally { + close(client); + } + + return APIGenericResult(success: true, data: null); + } + + List projectDnsRecords( + final String? domainName, + final String? ip4, + ) { + final DnsRecord domainA = + DnsRecord(type: 'A', name: domainName, content: ip4); + + final DnsRecord mx = DnsRecord(type: 'MX', name: '@', content: domainName); + final DnsRecord apiA = DnsRecord(type: 'A', name: 'api', content: ip4); + final DnsRecord cloudA = DnsRecord(type: 'A', name: 'cloud', content: ip4); + final DnsRecord gitA = DnsRecord(type: 'A', name: 'git', content: ip4); + final DnsRecord meetA = DnsRecord(type: 'A', name: 'meet', content: ip4); + final DnsRecord passwordA = + DnsRecord(type: 'A', name: 'password', content: ip4); + final DnsRecord socialA = + DnsRecord(type: 'A', name: 'social', content: ip4); + final DnsRecord vpn = DnsRecord(type: 'A', name: 'vpn', content: ip4); + + final DnsRecord txt1 = DnsRecord( + type: 'TXT', + name: '_dmarc', + content: 'v=DMARC1; p=none', + ttl: 18000, + ); + + final DnsRecord txt2 = DnsRecord( + type: 'TXT', + name: domainName, + content: 'v=spf1 a mx ip4:$ip4 -all', + ttl: 18000, + ); + + return [ + domainA, + apiA, + cloudA, + gitA, + meetA, + passwordA, + socialA, + mx, + txt1, + txt2, + vpn + ]; + } + + @override + Future setDnsRecord( + final DnsRecord record, + final ServerDomain domain, + ) async { + final String domainZoneId = domain.zoneId; + final String url = '$rootAddress/zones/$domainZoneId/dns_records'; + + final Dio client = await getClient(); + try { + await client.post( + url, + data: record.toJson(), + ); + } catch (e) { + print(e); + } finally { + close(client); + } + } + + @override + Future> domainList() async { + final String url = '$rootAddress/zones'; + List domains = []; + + final Dio client = await getClient(); + try { + final Response response = await client.get( + url, + queryParameters: {'per_page': 50}, + ); + domains = response.data['result'] + .map((final el) => el['name'] as String) + .toList(); + } catch (e) { + print(e); + } finally { + close(client); + } + + return domains; + } +} diff --git a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_factory.dart b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_factory.dart new file mode 100644 index 00000000..715a4178 --- /dev/null +++ b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_factory.dart @@ -0,0 +1,16 @@ +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart'; + +class DigitalOceanDnsApiFactory extends DnsProviderApiFactory { + @override + DnsProviderApi getDnsProvider({ + final DnsProviderApiSettings settings = const DnsProviderApiSettings(), + }) => + DigitalOceanDnsApi( + hasLogger: settings.hasLogger, + isWithToken: settings.isWithToken, + customToken: settings.customToken, + ); +} diff --git a/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart b/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart index 553c3492..bfcaf0f9 100644 --- a/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart @@ -20,7 +20,7 @@ class DnsProviderFormCubit extends FormCubit { @override FutureOr onSubmit() async { - initializingCubit.setCloudflareKey(apiKey.state.value); + initializingCubit.setDnsApiToken(apiKey.state.value); } final ServerInstallationCubit initializingCubit; diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index c63154c0..466d255c 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -214,16 +214,16 @@ class ServerInstallationCubit extends Cubit { ); } - void setCloudflareKey(final String cloudFlareKey) async { + void setDnsApiToken(final String dnsApiToken) async { if (state is ServerInstallationRecovery) { - setAndValidateCloudflareToken(cloudFlareKey); + setAndValidateCloudflareToken(dnsApiToken); return; } - await repository.saveCloudFlareKey(cloudFlareKey); + await repository.setDnsApiToken(dnsApiToken); emit( (state as ServerInstallationNotFinished) - .copyWith(cloudFlareKey: cloudFlareKey), + .copyWith(dnsApiToken: dnsApiToken), ); } @@ -284,7 +284,7 @@ class ServerInstallationCubit extends Cubit { await repository.createServer( state.rootUser!, state.serverDomain!.domainName, - state.cloudFlareKey!, + state.dnsApiToken!, state.backblazeCredential!, onCancel: onCancel, onSuccess: onSuccess, @@ -586,7 +586,7 @@ class ServerInstallationCubit extends Cubit { ), ); break; - case RecoveryStep.cloudflareToken: + case RecoveryStep.dnsProviderToken: repository.deleteServerDetails(); emit( dataState.copyWith( @@ -673,7 +673,7 @@ class ServerInstallationCubit extends Cubit { emit( dataState.copyWith( serverDetails: serverDetails, - currentStep: RecoveryStep.cloudflareToken, + currentStep: RecoveryStep.dnsProviderToken, ), ); } @@ -699,7 +699,7 @@ class ServerInstallationCubit extends Cubit { provider: DnsProvider.cloudflare, ), ); - await repository.saveCloudFlareKey(token); + await repository.setDnsApiToken(token); emit( dataState.copyWith( serverDomain: ServerDomain( @@ -707,7 +707,7 @@ class ServerInstallationCubit extends Cubit { zoneId: zoneId, provider: DnsProvider.cloudflare, ), - cloudFlareKey: token, + dnsApiToken: token, currentStep: RecoveryStep.backblazeToken, ), ); @@ -754,7 +754,7 @@ class ServerInstallationCubit extends Cubit { ServerInstallationNotFinished( providerApiToken: state.providerApiToken, serverDomain: state.serverDomain, - cloudFlareKey: state.cloudFlareKey, + dnsApiToken: state.dnsApiToken, backblazeCredential: state.backblazeCredential, rootUser: state.rootUser, serverDetails: null, diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index f1aeadf5..0cb476ea 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -45,7 +45,7 @@ class ServerInstallationRepository { Future load() async { final String? providerApiToken = getIt().serverProviderKey; final String? location = getIt().serverLocation; - final String? cloudflareToken = getIt().cloudFlareKey; + final String? cloudflareToken = getIt().dnsProviderKey; final String? serverTypeIdentificator = getIt().serverType; final ServerDomain? serverDomain = getIt().serverDomain; final ServerProvider? serverProvider = @@ -86,7 +86,7 @@ class ServerInstallationRepository { return ServerInstallationFinished( providerApiToken: providerApiToken!, serverTypeIdentificator: serverTypeIdentificator ?? '', - cloudFlareKey: cloudflareToken!, + dnsApiToken: cloudflareToken!, serverDomain: serverDomain!, backblazeCredential: backblazeCredential!, serverDetails: serverDetails!, @@ -103,7 +103,7 @@ class ServerInstallationRepository { serverDomain != null) { return ServerInstallationRecovery( providerApiToken: providerApiToken, - cloudFlareKey: cloudflareToken, + dnsApiToken: cloudflareToken, serverDomain: serverDomain, backblazeCredential: backblazeCredential, serverDetails: serverDetails, @@ -120,7 +120,7 @@ class ServerInstallationRepository { return ServerInstallationNotFinished( providerApiToken: providerApiToken, - cloudFlareKey: cloudflareToken, + dnsApiToken: cloudflareToken, serverDomain: serverDomain, backblazeCredential: backblazeCredential, serverDetails: serverDetails, @@ -147,7 +147,7 @@ class ServerInstallationRepository { if (serverDomain.provider != DnsProvider.unknown) { return RecoveryStep.backblazeToken; } - return RecoveryStep.cloudflareToken; + return RecoveryStep.dnsProviderToken; } return RecoveryStep.serverSelection; } @@ -717,8 +717,8 @@ class ServerInstallationRepository { getIt().init(); } - Future saveCloudFlareKey(final String key) async { - await getIt().storeCloudFlareKey(key); + Future setDnsApiToken(final String key) async { + await getIt().storeDnsProviderKey(key); } Future deleteCloudFlareKey() async { diff --git a/lib/logic/cubit/server_installation/server_installation_state.dart b/lib/logic/cubit/server_installation/server_installation_state.dart index 331c3e2a..5ceaafdd 100644 --- a/lib/logic/cubit/server_installation/server_installation_state.dart +++ b/lib/logic/cubit/server_installation/server_installation_state.dart @@ -4,7 +4,7 @@ abstract class ServerInstallationState extends Equatable { const ServerInstallationState({ required this.providerApiToken, required this.serverTypeIdentificator, - required this.cloudFlareKey, + required this.dnsApiToken, required this.backblazeCredential, required this.serverDomain, required this.rootUser, @@ -18,7 +18,7 @@ abstract class ServerInstallationState extends Equatable { List get props => [ providerApiToken, serverTypeIdentificator, - cloudFlareKey, + dnsApiToken, backblazeCredential, serverDomain, rootUser, @@ -28,7 +28,7 @@ abstract class ServerInstallationState extends Equatable { ]; final String? providerApiToken; - final String? cloudFlareKey; + final String? dnsApiToken; final String? serverTypeIdentificator; final BackblazeCredential? backblazeCredential; final ServerDomain? serverDomain; @@ -40,7 +40,7 @@ abstract class ServerInstallationState extends Equatable { bool get isServerProviderApiKeyFilled => providerApiToken != null; bool get isServerTypeFilled => serverTypeIdentificator != null; - bool get isDnsProviderFilled => cloudFlareKey != null; + bool get isDnsProviderFilled => dnsApiToken != null; bool get isBackupsProviderFilled => backblazeCredential != null; bool get isDomainSelected => serverDomain != null; bool get isPrimaryUserFilled => rootUser != null; @@ -87,7 +87,7 @@ class TimerState extends ServerInstallationNotFinished { }) : super( providerApiToken: dataState.providerApiToken, serverTypeIdentificator: dataState.serverTypeIdentificator, - cloudFlareKey: dataState.cloudFlareKey, + dnsApiToken: dataState.dnsApiToken, backblazeCredential: dataState.backblazeCredential, serverDomain: dataState.serverDomain, rootUser: dataState.rootUser, @@ -114,7 +114,7 @@ enum ServerSetupProgress { nothingYet, serverProviderFilled, servertTypeFilled, - cloudFlareFilled, + dnsProviderFilled, backblazeFilled, domainFilled, userFilled, @@ -133,7 +133,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { required this.dnsMatches, super.providerApiToken, super.serverTypeIdentificator, - super.cloudFlareKey, + super.dnsApiToken, super.backblazeCredential, super.serverDomain, super.rootUser, @@ -146,7 +146,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { List get props => [ providerApiToken, serverTypeIdentificator, - cloudFlareKey, + dnsApiToken, backblazeCredential, serverDomain, rootUser, @@ -160,7 +160,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { ServerInstallationNotFinished copyWith({ final String? providerApiToken, final String? serverTypeIdentificator, - final String? cloudFlareKey, + final String? dnsApiToken, final BackblazeCredential? backblazeCredential, final ServerDomain? serverDomain, final User? rootUser, @@ -175,7 +175,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { providerApiToken: providerApiToken ?? this.providerApiToken, serverTypeIdentificator: serverTypeIdentificator ?? this.serverTypeIdentificator, - cloudFlareKey: cloudFlareKey ?? this.cloudFlareKey, + dnsApiToken: dnsApiToken ?? this.dnsApiToken, backblazeCredential: backblazeCredential ?? this.backblazeCredential, serverDomain: serverDomain ?? this.serverDomain, rootUser: rootUser ?? this.rootUser, @@ -192,7 +192,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { ServerInstallationFinished finish() => ServerInstallationFinished( providerApiToken: providerApiToken!, serverTypeIdentificator: serverTypeIdentificator ?? '', - cloudFlareKey: cloudFlareKey!, + dnsApiToken: dnsApiToken!, backblazeCredential: backblazeCredential!, serverDomain: serverDomain!, rootUser: rootUser!, @@ -208,7 +208,7 @@ class ServerInstallationEmpty extends ServerInstallationNotFinished { : super( providerApiToken: null, serverTypeIdentificator: null, - cloudFlareKey: null, + dnsApiToken: null, backblazeCredential: null, serverDomain: null, rootUser: null, @@ -225,7 +225,7 @@ class ServerInstallationFinished extends ServerInstallationState { const ServerInstallationFinished({ required String super.providerApiToken, required String super.serverTypeIdentificator, - required String super.cloudFlareKey, + required String super.dnsApiToken, required BackblazeCredential super.backblazeCredential, required ServerDomain super.serverDomain, required User super.rootUser, @@ -239,7 +239,7 @@ class ServerInstallationFinished extends ServerInstallationState { List get props => [ providerApiToken, serverTypeIdentificator, - cloudFlareKey, + dnsApiToken, backblazeCredential, serverDomain, rootUser, @@ -256,7 +256,7 @@ enum RecoveryStep { oldToken, serverProviderToken, serverSelection, - cloudflareToken, + dnsProviderToken, backblazeToken, } @@ -278,7 +278,7 @@ class ServerInstallationRecovery extends ServerInstallationState { required this.recoveryCapabilities, super.providerApiToken, super.serverTypeIdentificator, - super.cloudFlareKey, + super.dnsApiToken, super.backblazeCredential, super.serverDomain, super.rootUser, @@ -295,7 +295,7 @@ class ServerInstallationRecovery extends ServerInstallationState { List get props => [ providerApiToken, serverTypeIdentificator, - cloudFlareKey, + dnsApiToken, backblazeCredential, serverDomain, rootUser, @@ -308,7 +308,7 @@ class ServerInstallationRecovery extends ServerInstallationState { ServerInstallationRecovery copyWith({ final String? providerApiToken, final String? serverTypeIdentificator, - final String? cloudFlareKey, + final String? dnsApiToken, final BackblazeCredential? backblazeCredential, final ServerDomain? serverDomain, final User? rootUser, @@ -320,7 +320,7 @@ class ServerInstallationRecovery extends ServerInstallationState { providerApiToken: providerApiToken ?? this.providerApiToken, serverTypeIdentificator: serverTypeIdentificator ?? this.serverTypeIdentificator, - cloudFlareKey: cloudFlareKey ?? this.cloudFlareKey, + dnsApiToken: dnsApiToken ?? this.dnsApiToken, backblazeCredential: backblazeCredential ?? this.backblazeCredential, serverDomain: serverDomain ?? this.serverDomain, rootUser: rootUser ?? this.rootUser, @@ -332,7 +332,7 @@ class ServerInstallationRecovery extends ServerInstallationState { ServerInstallationFinished finish() => ServerInstallationFinished( providerApiToken: providerApiToken!, serverTypeIdentificator: serverTypeIdentificator ?? '', - cloudFlareKey: cloudFlareKey!, + dnsApiToken: dnsApiToken!, backblazeCredential: backblazeCredential!, serverDomain: serverDomain!, rootUser: rootUser!, diff --git a/lib/logic/get_it/api_config.dart b/lib/logic/get_it/api_config.dart index 434c9b32..6697c2f8 100644 --- a/lib/logic/get_it/api_config.dart +++ b/lib/logic/get_it/api_config.dart @@ -12,7 +12,7 @@ class ApiConfigModel { String? get serverProviderKey => _serverProviderKey; String? get serverLocation => _serverLocation; String? get serverType => _serverType; - String? get cloudFlareKey => _cloudFlareKey; + String? get dnsProviderKey => _dnsProviderKey; ServerProvider? get serverProvider => _serverProvider; BackblazeCredential? get backblazeCredential => _backblazeCredential; ServerDomain? get serverDomain => _serverDomain; @@ -20,7 +20,7 @@ class ApiConfigModel { String? _serverProviderKey; String? _serverLocation; - String? _cloudFlareKey; + String? _dnsProviderKey; String? _serverType; ServerProvider? _serverProvider; ServerHostingDetails? _serverDetails; @@ -38,9 +38,9 @@ class ApiConfigModel { _serverProviderKey = value; } - Future storeCloudFlareKey(final String value) async { + Future storeDnsProviderKey(final String value) async { await _box.put(BNames.cloudFlareKey, value); - _cloudFlareKey = value; + _dnsProviderKey = value; } Future storeServerTypeIdentifier(final String typeIdentifier) async { @@ -76,7 +76,7 @@ class ApiConfigModel { void clear() { _serverProviderKey = null; _serverLocation = null; - _cloudFlareKey = null; + _dnsProviderKey = null; _backblazeCredential = null; _serverDomain = null; _serverDetails = null; @@ -88,7 +88,7 @@ class ApiConfigModel { void init() { _serverProviderKey = _box.get(BNames.hetznerKey); _serverLocation = _box.get(BNames.serverLocation); - _cloudFlareKey = _box.get(BNames.cloudFlareKey); + _dnsProviderKey = _box.get(BNames.cloudFlareKey); _backblazeCredential = _box.get(BNames.backblazeCredential); _serverDomain = _box.get(BNames.serverDomain); _serverDetails = _box.get(BNames.serverDetails); diff --git a/lib/logic/models/hive/server_domain.dart b/lib/logic/models/hive/server_domain.dart index 9b5d32c1..a58ff5a1 100644 --- a/lib/logic/models/hive/server_domain.dart +++ b/lib/logic/models/hive/server_domain.dart @@ -29,4 +29,6 @@ enum DnsProvider { unknown, @HiveField(1) cloudflare, + @HiveField(2) + digitalOcean, } diff --git a/lib/ui/pages/setup/recovering/recovery_routing.dart b/lib/ui/pages/setup/recovering/recovery_routing.dart index c2fb1d13..120cf11b 100644 --- a/lib/ui/pages/setup/recovering/recovery_routing.dart +++ b/lib/ui/pages/setup/recovering/recovery_routing.dart @@ -53,7 +53,7 @@ class RecoveryRouting extends StatelessWidget { case RecoveryStep.serverSelection: currentPage = const RecoveryConfirmServer(); break; - case RecoveryStep.cloudflareToken: + case RecoveryStep.dnsProviderToken: currentPage = const RecoveryConfirmCloudflare(); break; case RecoveryStep.backblazeToken: From a45b93cd27aaf9de3452b8bfc5d71dd047a80952 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 21 Dec 2022 23:31:03 +0400 Subject: [PATCH 02/96] feat: Improve Dns Record structure and logic It is to much digital ocean api. The decision with adding optional id is bad, but it will be refactored soon along with entire backend. --- .../dns_providers/cloudflare/cloudflare.dart | 50 +------ .../digital_ocean_dns/digital_ocean_dns.dart | 125 ++++++------------ .../rest_maps/dns_providers/dns_provider.dart | 47 +++++++ lib/logic/models/json/dns_records.dart | 4 + 4 files changed, 94 insertions(+), 132 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart index 04ff622b..433ee792 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart @@ -196,7 +196,8 @@ class CloudflareApi extends DnsProviderApi { }) async { final String domainName = domain.domainName; final String domainZoneId = domain.zoneId; - final List listDnsRecords = projectDnsRecords(domainName, ip4); + final List listDnsRecords = + getProjectDnsRecords(domainName, ip4); final List allCreateFutures = []; final Dio client = await getClient(); @@ -227,53 +228,6 @@ class CloudflareApi extends DnsProviderApi { return APIGenericResult(success: true, data: null); } - List projectDnsRecords( - final String? domainName, - final String? ip4, - ) { - final DnsRecord domainA = - DnsRecord(type: 'A', name: domainName, content: ip4); - - final DnsRecord mx = DnsRecord(type: 'MX', name: '@', content: domainName); - final DnsRecord apiA = DnsRecord(type: 'A', name: 'api', content: ip4); - final DnsRecord cloudA = DnsRecord(type: 'A', name: 'cloud', content: ip4); - final DnsRecord gitA = DnsRecord(type: 'A', name: 'git', content: ip4); - final DnsRecord meetA = DnsRecord(type: 'A', name: 'meet', content: ip4); - final DnsRecord passwordA = - DnsRecord(type: 'A', name: 'password', content: ip4); - final DnsRecord socialA = - DnsRecord(type: 'A', name: 'social', content: ip4); - final DnsRecord vpn = DnsRecord(type: 'A', name: 'vpn', content: ip4); - - final DnsRecord txt1 = DnsRecord( - type: 'TXT', - name: '_dmarc', - content: 'v=DMARC1; p=none', - ttl: 18000, - ); - - final DnsRecord txt2 = DnsRecord( - type: 'TXT', - name: domainName, - content: 'v=spf1 a mx ip4:$ip4 -all', - ttl: 18000, - ); - - return [ - domainA, - apiA, - cloudA, - gitA, - meetA, - passwordA, - socialA, - mx, - txt1, - txt2, - vpn - ]; - } - @override Future setDnsRecord( final DnsRecord record, diff --git a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart index a633fa65..887dc1ca 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart @@ -102,23 +102,15 @@ class DigitalOceanDnsApi extends DnsProviderApi { final String? ip4, }) async { final String domainName = domain.domainName; - final String domainZoneId = domain.zoneId; - - final String url = '/zones/$domainZoneId/dns_records'; final Dio client = await getClient(); try { - final Response response = await client.get(url); - - final List records = response.data['result'] ?? []; - final List allDeleteFutures = []; - + final List allDeleteFutures = []; + final List records = await getDnsRecords(domain: domain); for (final record in records) { - if (record['zone_name'] == domainName) { - allDeleteFutures.add( - client.delete('$url/${record["id"]}'), - ); - } + allDeleteFutures.add( + client.delete('/domains/$domainName/records/${record.id}'), + ); } await Future.wait(allDeleteFutures); } catch (e) { @@ -141,28 +133,31 @@ class DigitalOceanDnsApi extends DnsProviderApi { }) async { Response response; final String domainName = domain.domainName; - final String domainZoneId = domain.zoneId; final List allRecords = []; - final String url = '/zones/$domainZoneId/dns_records'; + /// Default amount is 20, but we will eventually overflow it, + /// so I hardcode it to the maximum available amount in advance just in case + /// + /// https://docs.digitalocean.com/reference/api/api-reference/#operation/domains_list_records + const int amountPerPage = 200; + final String url = '/domains/$domainName/records?per_page=$amountPerPage'; final Dio client = await getClient(); try { response = await client.get(url); - final List records = response.data['result'] ?? []; + final List records = response.data['domain_records'] ?? []; for (final record in records) { - if (record['zone_name'] == domainName) { - allRecords.add( - DnsRecord( - name: record['name'], - type: record['type'], - content: record['content'], - ttl: record['ttl'], - proxied: record['proxied'], - ), - ); - } + allRecords.add( + DnsRecord( + id: record['id'], + name: record['name'], + type: record['type'], + content: record['data'], + ttl: record['ttl'], + proxied: false, + ), + ); } } catch (e) { print(e); @@ -179,17 +174,22 @@ class DigitalOceanDnsApi extends DnsProviderApi { final String? ip4, }) async { final String domainName = domain.domainName; - final String domainZoneId = domain.zoneId; - final List listDnsRecords = projectDnsRecords(domainName, ip4); + final List dnsRecords = getProjectDnsRecords(domainName, ip4); final List allCreateFutures = []; final Dio client = await getClient(); try { - for (final DnsRecord record in listDnsRecords) { + for (final DnsRecord record in dnsRecords) { allCreateFutures.add( client.post( - '/zones/$domainZoneId/dns_records', - data: record.toJson(), + '/domains/$domainName/records', + data: { + 'type': record.type, + 'name': record.name, + 'data': record.content, + 'ttl': record.ttl, + 'priority': record.priority, + }, ), ); } @@ -211,66 +211,23 @@ class DigitalOceanDnsApi extends DnsProviderApi { return APIGenericResult(success: true, data: null); } - List projectDnsRecords( - final String? domainName, - final String? ip4, - ) { - final DnsRecord domainA = - DnsRecord(type: 'A', name: domainName, content: ip4); - - final DnsRecord mx = DnsRecord(type: 'MX', name: '@', content: domainName); - final DnsRecord apiA = DnsRecord(type: 'A', name: 'api', content: ip4); - final DnsRecord cloudA = DnsRecord(type: 'A', name: 'cloud', content: ip4); - final DnsRecord gitA = DnsRecord(type: 'A', name: 'git', content: ip4); - final DnsRecord meetA = DnsRecord(type: 'A', name: 'meet', content: ip4); - final DnsRecord passwordA = - DnsRecord(type: 'A', name: 'password', content: ip4); - final DnsRecord socialA = - DnsRecord(type: 'A', name: 'social', content: ip4); - final DnsRecord vpn = DnsRecord(type: 'A', name: 'vpn', content: ip4); - - final DnsRecord txt1 = DnsRecord( - type: 'TXT', - name: '_dmarc', - content: 'v=DMARC1; p=none', - ttl: 18000, - ); - - final DnsRecord txt2 = DnsRecord( - type: 'TXT', - name: domainName, - content: 'v=spf1 a mx ip4:$ip4 -all', - ttl: 18000, - ); - - return [ - domainA, - apiA, - cloudA, - gitA, - meetA, - passwordA, - socialA, - mx, - txt1, - txt2, - vpn - ]; - } - @override Future setDnsRecord( final DnsRecord record, final ServerDomain domain, ) async { - final String domainZoneId = domain.zoneId; - final String url = '$rootAddress/zones/$domainZoneId/dns_records'; - final Dio client = await getClient(); try { + final domainName = domain.domainName; await client.post( - url, - data: record.toJson(), + '/domains/$domainName/records', + data: { + 'type': record.type, + 'name': record.name, + 'data': record.content, + 'ttl': record.ttl, + 'priority': record.priority, + }, ); } catch (e) { print(e); diff --git a/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart b/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart index 106d185c..ce308121 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart @@ -31,4 +31,51 @@ abstract class DnsProviderApi extends ApiMap { Future> isApiTokenValid(final String token); RegExp getApiTokenValidation(); + + List getProjectDnsRecords( + final String? domainName, + final String? ip4, + ) { + final DnsRecord domainA = + DnsRecord(type: 'A', name: domainName, content: ip4); + + final DnsRecord mx = DnsRecord(type: 'MX', name: '@', content: domainName); + final DnsRecord apiA = DnsRecord(type: 'A', name: 'api', content: ip4); + final DnsRecord cloudA = DnsRecord(type: 'A', name: 'cloud', content: ip4); + final DnsRecord gitA = DnsRecord(type: 'A', name: 'git', content: ip4); + final DnsRecord meetA = DnsRecord(type: 'A', name: 'meet', content: ip4); + final DnsRecord passwordA = + DnsRecord(type: 'A', name: 'password', content: ip4); + final DnsRecord socialA = + DnsRecord(type: 'A', name: 'social', content: ip4); + final DnsRecord vpn = DnsRecord(type: 'A', name: 'vpn', content: ip4); + + final DnsRecord txt1 = DnsRecord( + type: 'TXT', + name: '_dmarc', + content: 'v=DMARC1; p=none', + ttl: 18000, + ); + + final DnsRecord txt2 = DnsRecord( + type: 'TXT', + name: domainName, + content: 'v=spf1 a mx ip4:$ip4 -all', + ttl: 18000, + ); + + return [ + domainA, + apiA, + cloudA, + gitA, + meetA, + passwordA, + socialA, + mx, + txt1, + txt2, + vpn + ]; + } } diff --git a/lib/logic/models/json/dns_records.dart b/lib/logic/models/json/dns_records.dart index c4799876..1680e943 100644 --- a/lib/logic/models/json/dns_records.dart +++ b/lib/logic/models/json/dns_records.dart @@ -9,6 +9,7 @@ class DnsRecord { required this.type, required this.name, required this.content, + this.id, this.ttl = 3600, this.priority = 10, this.proxied = false, @@ -31,5 +32,8 @@ class DnsRecord { final int priority; final bool proxied; + /// TODO: Refactoring refactoring refactoring refactoring >:c + final int? id; + Map toJson() => _$DnsRecordToJson(this); } From fc4f78162bb4d351fd0945fc1c4d7dd51fadeb72 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 21 Dec 2022 23:35:20 +0400 Subject: [PATCH 03/96] feat: Implement domain list getter for digital ocean dns --- .../digital_ocean_dns/digital_ocean_dns.dart | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart index 887dc1ca..1d5dba6f 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart @@ -238,16 +238,13 @@ class DigitalOceanDnsApi extends DnsProviderApi { @override Future> domainList() async { - final String url = '$rootAddress/zones'; + final String url = '$rootAddress/domains'; List domains = []; final Dio client = await getClient(); try { - final Response response = await client.get( - url, - queryParameters: {'per_page': 50}, - ); - domains = response.data['result'] + final Response response = await client.get(url); + domains = response.data['domains'] .map((final el) => el['name'] as String) .toList(); } catch (e) { From d333787f3734b640ac47e3ded94b18639ecfd6a2 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 28 Dec 2022 17:23:28 +0400 Subject: [PATCH 04/96] fix: Change incorrect domain for domain lists --- .../dns_providers/digital_ocean_dns/digital_ocean_dns.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart index 1d5dba6f..d2359e87 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart @@ -238,12 +238,11 @@ class DigitalOceanDnsApi extends DnsProviderApi { @override Future> domainList() async { - final String url = '$rootAddress/domains'; List domains = []; final Dio client = await getClient(); try { - final Response response = await client.get(url); + final Response response = await client.get('/domains'); domains = response.data['domains'] .map((final el) => el['name'] as String) .toList(); From e560de58e7cd98671a63c4c90395d4c694ce1413 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 30 Dec 2022 07:25:18 +0400 Subject: [PATCH 05/96] feat: Implement DNS provider picker page --- assets/translations/en.json | 7 +- assets/translations/ru.json | 5 +- lib/config/hive_config.dart | 3 + ...t.dart => server_provider_form_cubit.dart} | 4 +- .../server_installation_cubit.dart | 19 +- .../server_installation_repository.dart | 4 + lib/logic/get_it/api_config.dart | 9 + .../initializing/dns_provider_picker.dart | 205 ++++++++++++++++++ .../setup/initializing/initializing.dart | 62 ++---- .../initializing/server_provider_picker.dart | 8 +- .../recovery_server_provider_connected.dart | 11 +- 11 files changed, 267 insertions(+), 70 deletions(-) rename lib/logic/cubit/forms/setup/initializing/{provider_form_cubit.dart => server_provider_form_cubit.dart} (91%) create mode 100644 lib/ui/pages/setup/initializing/dns_provider_picker.dart diff --git a/assets/translations/en.json b/assets/translations/en.json index daa4544f..05bb823b 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -268,9 +268,10 @@ "no_ssh_notice": "Only email and SSH accounts are created for this user. Single Sign On for all services is coming soon." }, "initializing": { - "connect_to_server": "Connect a server", + "connect_to_server": "Connect the server provider", "select_provider": "Select your provider", - "place_where_data": "A place where your data and SelfPrivacy services will reside:", + "server_provider_description": "A place where your data and SelfPrivacy services will reside:", + "dns_provider_description": "A service which lets your IP point towards domain names:", "how": "How to obtain API token", "provider_bad_key_error": "Provider API key is invalid", "could_not_connect": "Counldn't connect to the provider.", @@ -280,7 +281,7 @@ "no_server_types_found": "No available server types found. Make sure your account is accessible and try to change your server location.", "cloudflare_bad_key_error": "Cloudflare API key is invalid", "backblaze_bad_key_error": "Backblaze storage information is invalid", - "connect_cloudflare": "Connect CloudFlare", + "connect_to_dns": "Connect the DNS provider", "manage_domain_dns": "To manage your domain's DNS", "cloudflare_api_token": "CloudFlare API Token", "connect_backblaze_storage": "Connect Backblaze storage", diff --git a/assets/translations/ru.json b/assets/translations/ru.json index a5cc6634..f9fb3fb2 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -269,7 +269,8 @@ }, "initializing": { "connect_to_server": "Подключите сервер", - "place_where_data": "Здесь будут жить ваши данные и SelfPrivacy-сервисы:", + "server_provider_description": "Здесь будут жить ваши данные и SelfPrivacy-сервисы:", + "dns_provider_description": "Это позволит связать ваш домен с IP адресом:", "how": "Как получить API Token", "provider_bad_key_error": "API ключ провайдера неверен", "could_not_connect": "Не удалось соединиться с провайдером.", @@ -279,7 +280,7 @@ "no_server_types_found": "Не удалось получить список серверов. Убедитесь, что ваш аккаунт доступен и попытайтесь сменить локацию сервера.", "cloudflare_bad_key_error": "Cloudflare API ключ неверен", "backblaze_bad_key_error": "Информация о Backblaze хранилище неверна", - "connect_cloudflare": "Подключите CloudFlare", + "connect_to_dns": "Подключите DNS провайдер", "manage_domain_dns": "Для управления DNS вашего домена", "cloudflare_api_token": "CloudFlare API ключ", "connect_backblaze_storage": "Подключите облачное хранилище Backblaze", diff --git a/lib/config/hive_config.dart b/lib/config/hive_config.dart index 93bce6ee..b300e247 100644 --- a/lib/config/hive_config.dart +++ b/lib/config/hive_config.dart @@ -90,6 +90,9 @@ class BNames { /// A String field of [serverInstallationBox] box. static String serverProvider = 'serverProvider'; + /// A String field of [serverInstallationBox] box. + static String dnsProvider = 'dnsProvider'; + /// A String field of [serverLocation] box. static String serverLocation = 'serverLocation'; diff --git a/lib/logic/cubit/forms/setup/initializing/provider_form_cubit.dart b/lib/logic/cubit/forms/setup/initializing/server_provider_form_cubit.dart similarity index 91% rename from lib/logic/cubit/forms/setup/initializing/provider_form_cubit.dart rename to lib/logic/cubit/forms/setup/initializing/server_provider_form_cubit.dart index ebabb5e7..97144d29 100644 --- a/lib/logic/cubit/forms/setup/initializing/provider_form_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/server_provider_form_cubit.dart @@ -4,8 +4,8 @@ import 'package:cubit_form/cubit_form.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; -class ProviderFormCubit extends FormCubit { - ProviderFormCubit(this.serverInstallationCubit) { +class ServerProviderFormCubit extends FormCubit { + ServerProviderFormCubit(this.serverInstallationCubit) { //final int tokenLength = // serverInstallationCubit.serverProviderApiTokenValidation().length; apiKey = FieldCubit( diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 244cd5de..1d8a4c5e 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -66,6 +66,15 @@ class ServerInstallationCubit extends Cubit { ); } + void setDnsProviderType(final DnsProvider providerType) async { + await repository.saveDnsProviderType(providerType); + ApiController.initDnsProviderApiFactory( + DnsProviderApiFactorySettings( + provider: providerType, + ), + ); + } + ProviderApiTokenValidation serverProviderApiTokenValidation() => ApiController.currentServerProviderApiFactory! .getServerProvider() @@ -101,16 +110,6 @@ class ServerInstallationCubit extends Cubit { Future isDnsProviderApiTokenValid( final String providerToken, ) async { - if (ApiController.currentDnsProviderApiFactory == null) { - // No other DNS provider is supported for now, - // so it's safe to hardcode Cloudflare - ApiController.initDnsProviderApiFactory( - DnsProviderApiFactorySettings( - provider: DnsProvider.cloudflare, - ), - ); - } - final APIGenericResult apiResponse = await ApiController.currentDnsProviderApiFactory! .getDnsProvider( diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 0cb476ea..817db846 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -688,6 +688,10 @@ class ServerInstallationRepository { await getIt().storeServerProviderType(type); } + Future saveDnsProviderType(final DnsProvider type) async { + await getIt().storeDnsProviderType(type); + } + Future saveServerProviderKey(final String key) async { await getIt().storeServerProviderKey(key); } diff --git a/lib/logic/get_it/api_config.dart b/lib/logic/get_it/api_config.dart index 6697c2f8..2ca9d53b 100644 --- a/lib/logic/get_it/api_config.dart +++ b/lib/logic/get_it/api_config.dart @@ -14,6 +14,7 @@ class ApiConfigModel { String? get serverType => _serverType; String? get dnsProviderKey => _dnsProviderKey; ServerProvider? get serverProvider => _serverProvider; + DnsProvider? get dnsProvider => _dnsProvider; BackblazeCredential? get backblazeCredential => _backblazeCredential; ServerDomain? get serverDomain => _serverDomain; BackblazeBucket? get backblazeBucket => _backblazeBucket; @@ -23,6 +24,7 @@ class ApiConfigModel { String? _dnsProviderKey; String? _serverType; ServerProvider? _serverProvider; + DnsProvider? _dnsProvider; ServerHostingDetails? _serverDetails; BackblazeCredential? _backblazeCredential; ServerDomain? _serverDomain; @@ -33,6 +35,11 @@ class ApiConfigModel { _serverProvider = value; } + Future storeDnsProviderType(final DnsProvider value) async { + await _box.put(BNames.dnsProvider, value); + _dnsProvider = value; + } + Future storeServerProviderKey(final String value) async { await _box.put(BNames.hetznerKey, value); _serverProviderKey = value; @@ -75,6 +82,7 @@ class ApiConfigModel { void clear() { _serverProviderKey = null; + _dnsProvider = null; _serverLocation = null; _dnsProviderKey = null; _backblazeCredential = null; @@ -95,5 +103,6 @@ class ApiConfigModel { _backblazeBucket = _box.get(BNames.backblazeBucket); _serverType = _box.get(BNames.serverTypeIdentifier); _serverProvider = _box.get(BNames.serverProvider); + _dnsProvider = _box.get(BNames.dnsProvider); } } diff --git a/lib/ui/pages/setup/initializing/dns_provider_picker.dart b/lib/ui/pages/setup/initializing/dns_provider_picker.dart new file mode 100644 index 00000000..74bb9b4b --- /dev/null +++ b/lib/ui/pages/setup/initializing/dns_provider_picker.dart @@ -0,0 +1,205 @@ +import 'package:cubit_form/cubit_form.dart'; +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:selfprivacy/config/brand_theme.dart'; +import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; +import 'package:selfprivacy/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart'; +import 'package:selfprivacy/logic/models/hive/server_details.dart'; +import 'package:selfprivacy/logic/models/hive/server_domain.dart'; +import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart'; +import 'package:selfprivacy/ui/components/brand_button/filled_button.dart'; +import 'package:selfprivacy/ui/components/brand_md/brand_md.dart'; + +class DnsProviderPicker extends StatefulWidget { + const DnsProviderPicker({ + required this.formCubit, + required this.serverInstallationCubit, + super.key, + }); + + final DnsProviderFormCubit formCubit; + final ServerInstallationCubit serverInstallationCubit; + + @override + State createState() => _DnsProviderPickerState(); +} + +class _DnsProviderPickerState extends State { + DnsProvider selectedProvider = DnsProvider.unknown; + + void setProvider(final DnsProvider provider) { + setState(() { + selectedProvider = provider; + }); + } + + @override + Widget build(final BuildContext context) { + switch (selectedProvider) { + case DnsProvider.unknown: + return ProviderSelectionPage( + serverInstallationCubit: widget.serverInstallationCubit, + callback: setProvider, + ); + + case DnsProvider.cloudflare: + return ProviderInputDataPage( + providerCubit: widget.formCubit, + providerInfo: ProviderPageInfo( + providerType: DnsProvider.cloudflare, + pathToHow: 'how_cloudflare', + image: Image.asset( + 'assets/images/logos/cloudflare.png', + width: 150, + ), + ), + ); + + case DnsProvider.digitalOcean: + return ProviderInputDataPage( + providerCubit: widget.formCubit, + providerInfo: ProviderPageInfo( + providerType: DnsProvider.digitalOcean, + pathToHow: 'how_cloudflare', + image: Image.asset( + 'assets/images/logos/digital_ocean.png', + width: 150, + ), + ), + ); + } + } +} + +class ProviderPageInfo { + const ProviderPageInfo({ + required this.providerType, + required this.pathToHow, + required this.image, + }); + + final String pathToHow; + final Image image; + final DnsProvider providerType; +} + +class ProviderInputDataPage extends StatelessWidget { + const ProviderInputDataPage({ + required this.providerInfo, + required this.providerCubit, + super.key, + }); + + final ProviderPageInfo providerInfo; + final DnsProviderFormCubit providerCubit; + + @override + Widget build(final BuildContext context) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + providerInfo.image, + const SizedBox(height: 10), + Text( + 'initializing.connect_to_dns'.tr(), + style: Theme.of(context).textTheme.titleLarge, + ), + const Spacer(), + CubitFormTextField( + formFieldCubit: providerCubit.apiKey, + textAlign: TextAlign.center, + scrollPadding: const EdgeInsets.only(bottom: 70), + decoration: const InputDecoration( + hintText: 'Provider API Token', + ), + ), + const Spacer(), + FilledButton( + title: 'basis.connect'.tr(), + onPressed: () => providerCubit.trySubmit(), + ), + const SizedBox(height: 10), + OutlinedButton( + child: Text('initializing.how'.tr()), + onPressed: () => showModalBottomSheet( + context: context, + isScrollControlled: true, + backgroundColor: Colors.transparent, + builder: (final BuildContext context) => BrandBottomSheet( + isExpended: true, + child: Padding( + padding: paddingH15V0, + child: ListView( + padding: const EdgeInsets.symmetric(vertical: 16), + children: [ + BrandMarkdown( + fileName: providerInfo.pathToHow, + ), + ], + ), + ), + ), + ), + ), + ], + ); +} + +class ProviderSelectionPage extends StatelessWidget { + const ProviderSelectionPage({ + required this.callback, + required this.serverInstallationCubit, + super.key, + }); + + final Function callback; + final ServerInstallationCubit serverInstallationCubit; + + @override + Widget build(final BuildContext context) => Column( + children: [ + Text( + 'initializing.select_provider'.tr(), + style: Theme.of(context).textTheme.titleLarge, + ), + const SizedBox(height: 10), + Text( + 'initializing.dns_provider_description'.tr(), + ), + const SizedBox(height: 10), + ConstrainedBox( + constraints: const BoxConstraints( + maxWidth: 320, + ), + child: Row( + children: [ + InkWell( + onTap: () { + serverInstallationCubit + .setDnsProviderType(DnsProvider.cloudflare); + callback(DnsProvider.cloudflare); + }, + child: Image.asset( + 'assets/images/logos/cloudflare.png', + width: 150, + ), + ), + const SizedBox( + width: 20, + ), + InkWell( + onTap: () { + serverInstallationCubit + .setDnsProviderType(DnsProvider.digitalOcean); + callback(DnsProvider.digitalOcean); + }, + child: Image.asset( + 'assets/images/logos/digital_ocean.png', + width: 150, + ), + ), + ], + ), + ), + ], + ); +} diff --git a/lib/ui/pages/setup/initializing/initializing.dart b/lib/ui/pages/setup/initializing/initializing.dart index 1e3e7982..831b6ebb 100644 --- a/lib/ui/pages/setup/initializing/initializing.dart +++ b/lib/ui/pages/setup/initializing/initializing.dart @@ -2,7 +2,7 @@ import 'package:cubit_form/cubit_form.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:selfprivacy/config/brand_theme.dart'; -import 'package:selfprivacy/logic/cubit/forms/setup/initializing/provider_form_cubit.dart'; +import 'package:selfprivacy/logic/cubit/forms/setup/initializing/server_provider_form_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/cubit/forms/factories/field_cubit_factory.dart'; import 'package:selfprivacy/logic/cubit/forms/setup/initializing/backblaze_form_cubit.dart'; @@ -17,6 +17,7 @@ import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; import 'package:selfprivacy/ui/components/brand_timer/brand_timer.dart'; import 'package:selfprivacy/ui/components/progress_bar/progress_bar.dart'; import 'package:selfprivacy/ui/pages/root_route.dart'; +import 'package:selfprivacy/ui/pages/setup/initializing/dns_provider_picker.dart'; import 'package:selfprivacy/ui/pages/setup/initializing/server_provider_picker.dart'; import 'package:selfprivacy/ui/pages/setup/initializing/server_type_picker.dart'; import 'package:selfprivacy/ui/pages/setup/recovering/recovery_routing.dart'; @@ -37,7 +38,7 @@ class InitializingPage extends StatelessWidget { actualInitializingPage = [ () => _stepServerProviderToken(cubit), () => _stepServerType(cubit), - () => _stepCloudflare(cubit), + () => _stepDnsProviderToken(cubit), () => _stepBackblaze(cubit), () => _stepDomain(cubit), () => _stepUser(cubit), @@ -149,10 +150,11 @@ class InitializingPage extends StatelessWidget { final ServerInstallationCubit serverInstallationCubit, ) => BlocProvider( - create: (final context) => ProviderFormCubit(serverInstallationCubit), + create: (final context) => + ServerProviderFormCubit(serverInstallationCubit), child: Builder( builder: (final context) { - final providerCubit = context.watch(); + final providerCubit = context.watch(); return ServerProviderPicker( formCubit: providerCubit, serverInstallationCubit: serverInstallationCubit, @@ -165,7 +167,8 @@ class InitializingPage extends StatelessWidget { final ServerInstallationCubit serverInstallationCubit, ) => BlocProvider( - create: (final context) => ProviderFormCubit(serverInstallationCubit), + create: (final context) => + ServerProviderFormCubit(serverInstallationCubit), child: Builder( builder: (final context) => ServerTypePicker( serverInstallationCubit: serverInstallationCubit, @@ -182,48 +185,19 @@ class InitializingPage extends StatelessWidget { ); } - Widget _stepCloudflare(final ServerInstallationCubit initializingCubit) => + Widget _stepDnsProviderToken( + final ServerInstallationCubit initializingCubit, + ) => BlocProvider( create: (final context) => DnsProviderFormCubit(initializingCubit), child: Builder( - builder: (final context) => Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset( - 'assets/images/logos/cloudflare.png', - width: 150, - ), - const SizedBox(height: 10), - BrandText.h2('initializing.connect_cloudflare'.tr()), - const SizedBox(height: 10), - BrandText.body2('initializing.manage_domain_dns'.tr()), - const Spacer(), - CubitFormTextField( - formFieldCubit: context.read().apiKey, - textAlign: TextAlign.center, - scrollPadding: const EdgeInsets.only(bottom: 70), - decoration: InputDecoration( - hintText: 'initializing.cloudflare_api_token'.tr(), - ), - ), - const Spacer(), - BrandButton.rised( - onPressed: () => - context.read().trySubmit(), - text: 'basis.connect'.tr(), - ), - const SizedBox(height: 10), - BrandButton.text( - onPressed: () => _showModal( - context, - const _HowTo( - fileName: 'how_cloudflare', - ), - ), - title: 'initializing.how'.tr(), - ), - ], - ), + builder: (final context) { + final providerCubit = context.watch(); + return DnsProviderPicker( + formCubit: providerCubit, + serverInstallationCubit: initializingCubit, + ); + }, ), ); diff --git a/lib/ui/pages/setup/initializing/server_provider_picker.dart b/lib/ui/pages/setup/initializing/server_provider_picker.dart index 4934d1e3..947da77b 100644 --- a/lib/ui/pages/setup/initializing/server_provider_picker.dart +++ b/lib/ui/pages/setup/initializing/server_provider_picker.dart @@ -3,7 +3,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:selfprivacy/config/brand_theme.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; -import 'package:selfprivacy/logic/cubit/forms/setup/initializing/provider_form_cubit.dart'; +import 'package:selfprivacy/logic/cubit/forms/setup/initializing/server_provider_form_cubit.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart'; import 'package:selfprivacy/ui/components/brand_button/filled_button.dart'; @@ -16,7 +16,7 @@ class ServerProviderPicker extends StatefulWidget { super.key, }); - final ProviderFormCubit formCubit; + final ServerProviderFormCubit formCubit; final ServerInstallationCubit serverInstallationCubit; @override @@ -90,7 +90,7 @@ class ProviderInputDataPage extends StatelessWidget { }); final ProviderPageInfo providerInfo; - final ProviderFormCubit providerCubit; + final ServerProviderFormCubit providerCubit; @override Widget build(final BuildContext context) => Column( @@ -162,7 +162,7 @@ class ProviderSelectionPage extends StatelessWidget { ), const SizedBox(height: 10), Text( - 'initializing.place_where_data'.tr(), + 'initializing.server_provider_description'.tr(), ), const SizedBox(height: 10), ConstrainedBox( diff --git a/lib/ui/pages/setup/recovering/recovery_server_provider_connected.dart b/lib/ui/pages/setup/recovering/recovery_server_provider_connected.dart index 152e4308..f2771bf5 100644 --- a/lib/ui/pages/setup/recovering/recovery_server_provider_connected.dart +++ b/lib/ui/pages/setup/recovering/recovery_server_provider_connected.dart @@ -1,7 +1,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:selfprivacy/config/brand_theme.dart'; -import 'package:selfprivacy/logic/cubit/forms/setup/initializing/provider_form_cubit.dart'; +import 'package:selfprivacy/logic/cubit/forms/setup/initializing/server_provider_form_cubit.dart'; import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart'; import 'package:selfprivacy/ui/components/brand_button/filled_button.dart'; import 'package:selfprivacy/ui/components/brand_button/brand_button.dart'; @@ -19,11 +19,12 @@ class RecoveryServerProviderConnected extends StatelessWidget { context.watch(); return BlocProvider( - create: (final BuildContext context) => ProviderFormCubit(appConfig), + create: (final BuildContext context) => + ServerProviderFormCubit(appConfig), child: Builder( builder: (final BuildContext context) { final FormCubitState formCubitState = - context.watch().state; + context.watch().state; return BrandHeroScreen( heroTitle: 'recovering.server_provider_connected'.tr(), @@ -37,7 +38,7 @@ class RecoveryServerProviderConnected extends StatelessWidget { }, children: [ CubitFormTextField( - formFieldCubit: context.read().apiKey, + formFieldCubit: context.read().apiKey, decoration: InputDecoration( border: const OutlineInputBorder(), labelText: @@ -49,7 +50,7 @@ class RecoveryServerProviderConnected extends StatelessWidget { title: 'basis.continue'.tr(), onPressed: formCubitState.isSubmitting ? null - : () => context.read().trySubmit(), + : () => context.read().trySubmit(), ), const SizedBox(height: 16), BrandButton.text( From 2980887333b00d6b6bc2e5fe877e694362af8adb Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 4 Jan 2023 14:42:22 +0400 Subject: [PATCH 06/96] feat: Add DNS provider selection page Upload cloudflare svg --- assets/images/logos/cloudflare.svg | 10 +++++ assets/translations/en.json | 4 +- assets/translations/ru.json | 4 +- .../initializing/dns_provider_form_cubit.dart | 3 +- .../initializing/dns_provider_picker.dart | 39 ++++--------------- 5 files changed, 25 insertions(+), 35 deletions(-) create mode 100644 assets/images/logos/cloudflare.svg diff --git a/assets/images/logos/cloudflare.svg b/assets/images/logos/cloudflare.svg new file mode 100644 index 00000000..a8cbf3bc --- /dev/null +++ b/assets/images/logos/cloudflare.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/translations/en.json b/assets/translations/en.json index 7d39a922..5f74b0e1 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -285,11 +285,13 @@ "select_provider_countries_text_hetzner": "Germany, Finland, USA", "select_provider_countries_text_do": "USA, Netherlands, Singapore, UK, Germany, Canada, India, Australia", "select_provider_price_title": "Average price", + "select_provider_price_free": "Free", "select_provider_price_text_hetzner": "€8 per month for a relatively small server and 50GB of disk storage", "select_provider_price_text_do": "$17 per month for a relatively small server and 50GB of disk storage", "select_provider_payment_title": "Payment methods", "select_provider_payment_text_hetzner": "Credit cards, SWIFT, SEPA, PayPal", "select_provider_payment_text_do": "Credit cards, Google Pay, PayPal", + "select_provider_payment_text_cloudflare": "Credit cards", "select_provider_email_notice": "E-mail hosting won't be available for new clients. Nevertheless it will be unlocked as soon as you complete your first payment.", "select_provider_site_button": "Visit site", "connect_to_server_provider": "Now log in ", @@ -310,7 +312,7 @@ "choose_server_type_storage": "{} GB of system storage", "choose_server_type_payment_per_month": "{} per month", "no_server_types_found": "No available server types found. Make sure your account is accessible and try to change your server location.", - "cloudflare_bad_key_error": "Cloudflare API key is invalid", + "dns_provider_bad_key_error": "API key is invalid", "backblaze_bad_key_error": "Backblaze storage information is invalid", "connect_to_dns": "Connect the DNS provider", "select_dns": "Now let's select a DNS provider", diff --git a/assets/translations/ru.json b/assets/translations/ru.json index 29492950..82183962 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -284,11 +284,13 @@ "select_provider_countries_text_hetzner": "Германия, Финляндия, США", "select_provider_countries_text_do": "США, Нидерланды, Сингапур, Великобритания, Германия, Канада, Индия, Австралия", "select_provider_price_title": "Средняя цена", + "select_provider_price_free": "Бесплатно", "select_provider_price_text_hetzner": "€8 в месяц за небольшой сервер и 50GB места на диске", "select_provider_price_text_do": "$17 в месяц за небольшой сервер и 50GB места на диске", "select_provider_payment_title": "Методы оплаты", "select_provider_payment_text_hetzner": "Банковские карты, SWIFT, SEPA, PayPal", "select_provider_payment_text_do": "Банковские карты, Google Pay, PayPal", + "select_provider_payment_text_cloudflare": "Банковские карты", "select_provider_email_notice": "Хостинг электронной почты недоступен для новых клиентов. Разблокировать можно будет после первой оплаты.", "select_provider_site_button": "Посетить сайт", "connect_to_server_provider": "Авторизоваться в ", @@ -309,7 +311,7 @@ "choose_server_type_storage": "{} GB системного хранилища", "choose_server_type_payment_per_month": "{} в месяц", "no_server_types_found": "Не найдено доступных типов сервера! Пожалуйста, убедитесь, что у вас есть доступ к провайдеру сервера...", - "cloudflare_bad_key_error": "Cloudflare API ключ неверен", + "dns_provider_bad_key_error": "API ключ неверен", "backblaze_bad_key_error": "Информация о Backblaze хранилище неверна", "connect_to_dns": "Подключите DNS провайдер", "manage_domain_dns": "Для управления DNS вашего домена", diff --git a/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart b/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart index bfcaf0f9..eb23dd42 100644 --- a/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart @@ -11,7 +11,6 @@ class DnsProviderFormCubit extends FormCubit { initalValue: '', validations: [ RequiredStringValidation('validations.required'.tr()), - LengthStringNotEqualValidation(40) ], ); @@ -43,7 +42,7 @@ class DnsProviderFormCubit extends FormCubit { } if (!isKeyValid) { - apiKey.setError('initializing.cloudflare_bad_key_error'.tr()); + apiKey.setError('initializing.dns_provider_bad_key_error'.tr()); } return isKeyValid; diff --git a/lib/ui/pages/setup/initializing/dns_provider_picker.dart b/lib/ui/pages/setup/initializing/dns_provider_picker.dart index 99aadfbc..da6098f5 100644 --- a/lib/ui/pages/setup/initializing/dns_provider_picker.dart +++ b/lib/ui/pages/setup/initializing/dns_provider_picker.dart @@ -164,7 +164,7 @@ class ProviderSelectionPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - 'initializing.connect_to_server'.tr(), + 'initializing.select_dns'.tr(), style: Theme.of(context).textTheme.headlineSmall, ), const SizedBox(height: 10), @@ -187,10 +187,10 @@ class ProviderSelectionPage extends StatelessWidget { padding: const EdgeInsets.all(10), decoration: BoxDecoration( borderRadius: BorderRadius.circular(40), - color: const Color(0xFFD50C2D), + color: const Color.fromARGB(255, 241, 215, 166), ), child: SvgPicture.asset( - 'assets/images/logos/hetzner.svg', + 'assets/images/logos/cloudflare.svg', ), ), const SizedBox(width: 16), @@ -201,22 +201,12 @@ class ProviderSelectionPage extends StatelessWidget { ], ), const SizedBox(height: 16), - Text( - 'initializing.select_provider_countries_title'.tr(), - style: Theme.of(context).textTheme.bodyLarge, - ), - Text( - 'initializing.select_provider_countries_text_hetzner' - .tr(), - style: Theme.of(context).textTheme.bodySmall, - ), - const SizedBox(height: 16), Text( 'initializing.select_provider_price_title'.tr(), style: Theme.of(context).textTheme.bodyLarge, ), Text( - 'initializing.select_provider_price_text_hetzner'.tr(), + 'initializing.select_provider_price_free'.tr(), style: Theme.of(context).textTheme.bodySmall, ), const SizedBox(height: 16), @@ -225,12 +215,8 @@ class ProviderSelectionPage extends StatelessWidget { style: Theme.of(context).textTheme.bodyLarge, ), Text( - 'initializing.select_provider_payment_text_hetzner'.tr(), - style: Theme.of(context).textTheme.bodySmall, - ), - const SizedBox(height: 16), - Text( - 'initializing.select_provider_email_notice'.tr(), + 'initializing.select_provider_payment_text_cloudflare' + .tr(), style: Theme.of(context).textTheme.bodySmall, ), const SizedBox(height: 16), @@ -245,7 +231,7 @@ class ProviderSelectionPage extends StatelessWidget { // Outlined button that will open website BrandOutlinedButton( onPressed: () => - launchURL('https://cloud.digitalocean.com/'), + launchURL('https://dash.cloudflare.com/'), title: 'initializing.select_provider_site_button'.tr(), ), ], @@ -281,21 +267,12 @@ class ProviderSelectionPage extends StatelessWidget { ], ), const SizedBox(height: 16), - Text( - 'initializing.select_provider_countries_title'.tr(), - style: Theme.of(context).textTheme.bodyLarge, - ), - Text( - 'initializing.select_provider_countries_text_do'.tr(), - style: Theme.of(context).textTheme.bodySmall, - ), - const SizedBox(height: 16), Text( 'initializing.select_provider_price_title'.tr(), style: Theme.of(context).textTheme.bodyLarge, ), Text( - 'initializing.select_provider_price_text_do'.tr(), + 'initializing.select_provider_price_free'.tr(), style: Theme.of(context).textTheme.bodySmall, ), const SizedBox(height: 16), From 36bc5b25546f3314f80597900bb0563bd87dca85 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Thu, 5 Jan 2023 13:16:30 +0400 Subject: [PATCH 07/96] chore: Generate build runner files --- assets/translations/en.json | 1 + assets/translations/ru.json | 1 + .../graphql_maps/schema/disk_volumes.graphql.dart | 2 +- .../graphql_maps/schema/server_api.graphql.dart | 1 + .../schema/server_settings.graphql.dart | 2 +- .../graphql_maps/schema/services.graphql.dart | 1 - .../graphql_maps/schema/users.graphql.dart | 2 +- lib/logic/models/hive/server_domain.g.dart | 5 +++++ lib/logic/models/json/dns_records.g.dart | 1 + .../setup/initializing/dns_provider_picker.dart | 15 +++++++++------ 10 files changed, 21 insertions(+), 10 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index 5f74b0e1..d039a22d 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -315,6 +315,7 @@ "dns_provider_bad_key_error": "API key is invalid", "backblaze_bad_key_error": "Backblaze storage information is invalid", "connect_to_dns": "Connect the DNS provider", + "connect_to_dns_provider_text": "With API token SelfPrivacy will manage all DNS entries", "select_dns": "Now let's select a DNS provider", "manage_domain_dns": "To manage your domain's DNS", "use_this_domain": "Use this domain?", diff --git a/assets/translations/ru.json b/assets/translations/ru.json index 82183962..586d5f58 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -314,6 +314,7 @@ "dns_provider_bad_key_error": "API ключ неверен", "backblaze_bad_key_error": "Информация о Backblaze хранилище неверна", "connect_to_dns": "Подключите DNS провайдер", + "connect_to_dns_provider_text": "С помощью API токена приложение SelfPrivacy настроит DNS записи", "manage_domain_dns": "Для управления DNS вашего домена", "use_this_domain": "Используем этот домен?", "use_this_domain_text": "Указанный вами токен даёт контроль над этим доменом", diff --git a/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart index 359a7a27..2464c561 100644 --- a/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart @@ -4,7 +4,7 @@ import 'package:graphql/client.dart' as graphql; import 'package:json_annotation/json_annotation.dart'; import 'package:selfprivacy/utils/scalars.dart'; import 'schema.graphql.dart'; -import 'server_api.graphql.dart'; +import 'services.graphql.dart'; part 'disk_volumes.graphql.g.dart'; @JsonSerializable(explicitToJson: true) diff --git a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart index 325ee89d..09671eed 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart @@ -4,6 +4,7 @@ import 'package:graphql/client.dart' as graphql; import 'package:json_annotation/json_annotation.dart'; import 'package:selfprivacy/utils/scalars.dart'; import 'schema.graphql.dart'; +import 'services.graphql.dart'; part 'server_api.graphql.g.dart'; @JsonSerializable(explicitToJson: true) diff --git a/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart index a077cf7d..5d036afa 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart @@ -3,7 +3,7 @@ import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; import 'package:json_annotation/json_annotation.dart'; import 'schema.graphql.dart'; -import 'server_api.graphql.dart'; +import 'services.graphql.dart'; part 'server_settings.graphql.g.dart'; @JsonSerializable(explicitToJson: true) diff --git a/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart index 92138d02..a31058c4 100644 --- a/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart @@ -4,7 +4,6 @@ import 'package:graphql/client.dart' as graphql; import 'package:json_annotation/json_annotation.dart'; import 'package:selfprivacy/utils/scalars.dart'; import 'schema.graphql.dart'; -import 'server_api.graphql.dart'; part 'services.graphql.g.dart'; @JsonSerializable(explicitToJson: true) diff --git a/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart index ce846b30..18a15aa9 100644 --- a/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart @@ -3,7 +3,7 @@ import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; import 'package:json_annotation/json_annotation.dart'; import 'schema.graphql.dart'; -import 'server_api.graphql.dart'; +import 'services.graphql.dart'; part 'users.graphql.g.dart'; @JsonSerializable(explicitToJson: true) diff --git a/lib/logic/models/hive/server_domain.g.dart b/lib/logic/models/hive/server_domain.g.dart index 3265db6b..c7ebc25f 100644 --- a/lib/logic/models/hive/server_domain.g.dart +++ b/lib/logic/models/hive/server_domain.g.dart @@ -58,6 +58,8 @@ class DnsProviderAdapter extends TypeAdapter { return DnsProvider.unknown; case 1: return DnsProvider.cloudflare; + case 2: + return DnsProvider.digitalOcean; default: return DnsProvider.unknown; } @@ -72,6 +74,9 @@ class DnsProviderAdapter extends TypeAdapter { case DnsProvider.cloudflare: writer.writeByte(1); break; + case DnsProvider.digitalOcean: + writer.writeByte(2); + break; } } diff --git a/lib/logic/models/json/dns_records.g.dart b/lib/logic/models/json/dns_records.g.dart index c8c12c34..b58db5de 100644 --- a/lib/logic/models/json/dns_records.g.dart +++ b/lib/logic/models/json/dns_records.g.dart @@ -13,4 +13,5 @@ Map _$DnsRecordToJson(DnsRecord instance) => { 'ttl': instance.ttl, 'priority': instance.priority, 'proxied': instance.proxied, + 'id': instance.id, }; diff --git a/lib/ui/pages/setup/initializing/dns_provider_picker.dart b/lib/ui/pages/setup/initializing/dns_provider_picker.dart index da6098f5..e72d8203 100644 --- a/lib/ui/pages/setup/initializing/dns_provider_picker.dart +++ b/lib/ui/pages/setup/initializing/dns_provider_picker.dart @@ -100,13 +100,16 @@ class ProviderInputDataPage extends StatelessWidget { Widget build(final BuildContext context) => Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - providerInfo.image, - const SizedBox(height: 10), Text( 'initializing.connect_to_dns'.tr(), - style: Theme.of(context).textTheme.titleLarge, + style: Theme.of(context).textTheme.headlineSmall, ), - const Spacer(), + const SizedBox(height: 16), + Text( + 'initializing.connect_to_server_provider_text'.tr(), + style: Theme.of(context).textTheme.bodyMedium, + ), + const SizedBox(height: 32), CubitFormTextField( formFieldCubit: providerCubit.apiKey, textAlign: TextAlign.center, @@ -115,13 +118,13 @@ class ProviderInputDataPage extends StatelessWidget { hintText: 'Provider API Token', ), ), - const Spacer(), + const SizedBox(height: 32), FilledButton( title: 'basis.connect'.tr(), onPressed: () => providerCubit.trySubmit(), ), const SizedBox(height: 10), - OutlinedButton( + BrandOutlinedButton( child: Text('initializing.how'.tr()), onPressed: () => showModalBottomSheet( context: context, From 9184a9db5d3a5f8cfbec37e82f344da120895e80 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Thu, 5 Jan 2023 14:05:05 +0400 Subject: [PATCH 08/96] feat: Implement DnsProvider loaging --- .../initializing/dns_provider_form_cubit.dart | 1 - .../server_installation_repository.dart | 16 ++++++++++------ lib/ui/pages/services/service_page.dart | 1 - lib/ui/pages/services/services.dart | 1 - 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart b/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart index eb23dd42..084adb83 100644 --- a/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart @@ -3,7 +3,6 @@ import 'dart:async'; import 'package:cubit_form/cubit_form.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; -import 'package:selfprivacy/logic/cubit/forms/validations/validations.dart'; class DnsProviderFormCubit extends FormCubit { DnsProviderFormCubit(this.initializingCubit) { diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 83a2d2fa..5f98229f 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -48,6 +48,7 @@ class ServerInstallationRepository { final String? cloudflareToken = getIt().dnsProviderKey; final String? serverTypeIdentificator = getIt().serverType; final ServerDomain? serverDomain = getIt().serverDomain; + final DnsProvider? dnsProvider = getIt().dnsProvider; final ServerProvider? serverProvider = getIt().serverProvider; final BackblazeCredential? backblazeCredential = @@ -75,12 +76,15 @@ class ServerInstallationRepository { ); } - // No other DNS provider is supported for now, so it's fine. - ApiController.initDnsProviderApiFactory( - DnsProviderApiFactorySettings( - provider: DnsProvider.cloudflare, - ), - ); + if (dnsProvider != null || + (serverDomain != null && + serverDomain.provider != ServerProvider.unknown)) { + ApiController.initDnsProviderApiFactory( + DnsProviderApiFactorySettings( + provider: dnsProvider ?? serverDomain!.provider, + ), + ); + } if (box.get(BNames.hasFinalChecked, defaultValue: false)) { return ServerInstallationFinished( diff --git a/lib/ui/pages/services/service_page.dart b/lib/ui/pages/services/service_page.dart index c2ebbe3a..b6ca7cee 100644 --- a/lib/ui/pages/services/service_page.dart +++ b/lib/ui/pages/services/service_page.dart @@ -11,7 +11,6 @@ import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.da import 'package:selfprivacy/ui/pages/server_storage/binds_migration/services_migration.dart'; import 'package:selfprivacy/utils/network_utils.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; -import 'package:url_launcher/url_launcher.dart'; class ServicePage extends StatefulWidget { const ServicePage({required this.serviceId, super.key}); diff --git a/lib/ui/pages/services/services.dart b/lib/ui/pages/services/services.dart index 0f0243ef..e6c0e5c9 100644 --- a/lib/ui/pages/services/services.dart +++ b/lib/ui/pages/services/services.dart @@ -15,7 +15,6 @@ import 'package:selfprivacy/ui/pages/services/service_page.dart'; import 'package:selfprivacy/utils/network_utils.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; import 'package:selfprivacy/utils/ui_helpers.dart'; -import 'package:url_launcher/url_launcher.dart'; class ServicesPage extends StatefulWidget { const ServicesPage({super.key}); From 07de11c75aa662bb758c79627d0658a8662700db Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 6 Jan 2023 19:28:52 +0400 Subject: [PATCH 09/96] fix: Implement correct DNS entries creation and deletion --- .../digital_ocean_dns/digital_ocean_dns.dart | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart index d2359e87..b98a2794 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart @@ -105,12 +105,15 @@ class DigitalOceanDnsApi extends DnsProviderApi { final Dio client = await getClient(); try { + const String ignoreType = 'SOA'; final List allDeleteFutures = []; final List records = await getDnsRecords(domain: domain); for (final record in records) { - allDeleteFutures.add( - client.delete('/domains/$domainName/records/${record.id}'), - ); + if (record.type != ignoreType) { + allDeleteFutures.add( + client.delete('/domains/$domainName/records/${record.id}'), + ); + } } await Future.wait(allDeleteFutures); } catch (e) { @@ -186,7 +189,7 @@ class DigitalOceanDnsApi extends DnsProviderApi { data: { 'type': record.type, 'name': record.name, - 'data': record.content, + 'data': record.type == 'MX' ? '@' : record.content, 'ttl': record.ttl, 'priority': record.priority, }, From 120a8fc64427637889dad089f8f1d8d7f0ab0f78 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 10 Jan 2023 21:24:26 +0400 Subject: [PATCH 10/96] feat: Implement proper DNS entries creation for Digital Ocean --- .../dns_providers/digital_ocean_dns/digital_ocean_dns.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart index b98a2794..309c26a8 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart @@ -188,7 +188,7 @@ class DigitalOceanDnsApi extends DnsProviderApi { '/domains/$domainName/records', data: { 'type': record.type, - 'name': record.name, + 'name': record.name == domainName ? '@' : record.name, 'data': record.type == 'MX' ? '@' : record.content, 'ttl': record.ttl, 'priority': record.priority, From 3b962c5f5ae0da5c7572360b66cc9726d1cecb2a Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 11 Jan 2023 22:01:46 +0400 Subject: [PATCH 11/96] feat: Adapt Desired DNS Records checking for Digital Ocean --- .../dns_providers/cloudflare/cloudflare.dart | 82 ++++++++++++ .../dns_providers/desired_dns_record.dart | 44 +++++++ .../digital_ocean_dns/digital_ocean_dns.dart | 90 +++++++++++++ .../rest_maps/dns_providers/dns_provider.dart | 7 + .../cubit/dns_records/dns_records_cubit.dart | 50 ++++--- lib/ui/pages/dns_details/dns_details.dart | 13 +- lib/utils/network_utils.dart | 122 ------------------ 7 files changed, 261 insertions(+), 147 deletions(-) create mode 100644 lib/logic/api_maps/rest_maps/dns_providers/desired_dns_record.dart diff --git a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart index 433ee792..1da08c40 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart @@ -189,6 +189,88 @@ class CloudflareApi extends DnsProviderApi { return allRecords; } + @override + List getDesiredDnsRecords({ + final String? domainName, + final String? ipAddress, + final String? dkimPublicKey, + }) { + if (domainName == null || ipAddress == null) { + return []; + } + return [ + DesiredDnsRecord( + name: domainName, + content: ipAddress, + description: 'record.root', + ), + DesiredDnsRecord( + name: 'api.$domainName', + content: ipAddress, + description: 'record.api', + ), + DesiredDnsRecord( + name: 'cloud.$domainName', + content: ipAddress, + description: 'record.cloud', + ), + DesiredDnsRecord( + name: 'git.$domainName', + content: ipAddress, + description: 'record.git', + ), + DesiredDnsRecord( + name: 'meet.$domainName', + content: ipAddress, + description: 'record.meet', + ), + DesiredDnsRecord( + name: 'social.$domainName', + content: ipAddress, + description: 'record.social', + ), + DesiredDnsRecord( + name: 'password.$domainName', + content: ipAddress, + description: 'record.password', + ), + DesiredDnsRecord( + name: 'vpn.$domainName', + content: ipAddress, + description: 'record.vpn', + ), + DesiredDnsRecord( + name: domainName, + content: domainName, + description: 'record.mx', + type: 'MX', + category: DnsRecordsCategory.email, + ), + DesiredDnsRecord( + name: '_dmarc.$domainName', + content: 'v=DMARC1; p=none', + description: 'record.dmarc', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + DesiredDnsRecord( + name: domainName, + content: 'v=spf1 a mx ip4:$ipAddress -all', + description: 'record.spf', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + if (dkimPublicKey != null) + DesiredDnsRecord( + name: 'selector._domainkey.$domainName', + content: dkimPublicKey, + description: 'record.dkim', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + ]; + } + @override Future> createMultipleDnsRecords({ required final ServerDomain domain, diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desired_dns_record.dart b/lib/logic/api_maps/rest_maps/dns_providers/desired_dns_record.dart new file mode 100644 index 00000000..4a64d49e --- /dev/null +++ b/lib/logic/api_maps/rest_maps/dns_providers/desired_dns_record.dart @@ -0,0 +1,44 @@ +enum DnsRecordsCategory { + services, + email, + other, +} + +class DesiredDnsRecord { + const DesiredDnsRecord({ + required this.name, + required this.content, + this.type = 'A', + this.description = '', + this.category = DnsRecordsCategory.services, + this.isSatisfied = false, + this.displayName, + }); + + final String name; + final String type; + final String content; + final String description; + final String? displayName; + final DnsRecordsCategory category; + final bool isSatisfied; + + DesiredDnsRecord copyWith({ + final String? name, + final String? type, + final String? content, + final String? description, + final String? displayName, + final DnsRecordsCategory? category, + final bool? isSatisfied, + }) => + DesiredDnsRecord( + name: name ?? this.name, + type: type ?? this.type, + content: content ?? this.content, + description: description ?? this.description, + category: category ?? this.category, + isSatisfied: isSatisfied ?? this.isSatisfied, + displayName: displayName ?? this.displayName, + ); +} diff --git a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart index 309c26a8..b1485312 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart @@ -171,6 +171,96 @@ class DigitalOceanDnsApi extends DnsProviderApi { return allRecords; } + @override + List getDesiredDnsRecords({ + final String? domainName, + final String? ipAddress, + final String? dkimPublicKey, + }) { + if (domainName == null || ipAddress == null) { + return []; + } + return [ + DesiredDnsRecord( + name: '@', + content: ipAddress, + description: 'record.root', + displayName: domainName, + ), + DesiredDnsRecord( + name: 'api', + content: ipAddress, + description: 'record.api', + displayName: 'api.$domainName', + ), + DesiredDnsRecord( + name: 'cloud', + content: ipAddress, + description: 'record.cloud', + displayName: 'cloud.$domainName', + ), + DesiredDnsRecord( + name: 'git', + content: ipAddress, + description: 'record.git', + displayName: 'git.$domainName', + ), + DesiredDnsRecord( + name: 'meet', + content: ipAddress, + description: 'record.meet', + displayName: 'meet.$domainName', + ), + DesiredDnsRecord( + name: 'social', + content: ipAddress, + description: 'record.social', + displayName: 'social.$domainName', + ), + DesiredDnsRecord( + name: 'password', + content: ipAddress, + description: 'record.password', + displayName: 'password.$domainName', + ), + DesiredDnsRecord( + name: 'vpn', + content: ipAddress, + description: 'record.vpn', + displayName: 'vpn.$domainName', + ), + DesiredDnsRecord( + name: domainName, + content: domainName, + description: 'record.mx', + type: 'MX', + category: DnsRecordsCategory.email, + ), + DesiredDnsRecord( + name: '_dmarc.$domainName', + content: 'v=DMARC1; p=none', + description: 'record.dmarc', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + DesiredDnsRecord( + name: domainName, + content: 'v=spf1 a mx ip4:$ipAddress -all', + description: 'record.spf', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + if (dkimPublicKey != null) + DesiredDnsRecord( + name: 'selector._domainkey.$domainName', + content: dkimPublicKey, + description: 'record.dkim', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + ]; + } + @override Future> createMultipleDnsRecords({ required final ServerDomain domain, diff --git a/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart b/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart index ce308121..0d010242 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart @@ -1,9 +1,11 @@ import 'package:selfprivacy/logic/api_maps/api_generic_result.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desired_dns_record.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; export 'package:selfprivacy/logic/api_maps/api_generic_result.dart'; +export 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desired_dns_record.dart'; class DomainNotFoundException implements Exception { DomainNotFoundException(this.message); @@ -14,6 +16,11 @@ abstract class DnsProviderApi extends ApiMap { Future> getDnsRecords({ required final ServerDomain domain, }); + List getDesiredDnsRecords({ + final String? domainName, + final String? ipAddress, + final String? dkimPublicKey, + }); Future> removeSimilarRecords({ required final ServerDomain domain, final String? ip4, diff --git a/lib/logic/cubit/dns_records/dns_records_cubit.dart b/lib/logic/cubit/dns_records/dns_records_cubit.dart index 3403dc68..589fb1ff 100644 --- a/lib/logic/cubit/dns_records/dns_records_cubit.dart +++ b/lib/logic/cubit/dns_records/dns_records_cubit.dart @@ -25,11 +25,14 @@ class DnsRecordsCubit emit( DnsRecordsState( dnsState: DnsRecordsStatus.refreshing, - dnsRecords: getDesiredDnsRecords( - serverInstallationCubit.state.serverDomain?.domainName, - '', - '', - ), + dnsRecords: ApiController.currentDnsProviderApiFactory! + .getDnsProvider() + .getDesiredDnsRecords( + domainName: + serverInstallationCubit.state.serverDomain?.domainName, + dkimPublicKey: '', + ipAddress: '', + ), ), ); @@ -44,16 +47,23 @@ class DnsRecordsCubit .getDnsRecords(domain: domain); final String? dkimPublicKey = extractDkimRecord(await api.getDnsRecords())?.content; - final List desiredRecords = - getDesiredDnsRecords(domain.domainName, ipAddress, dkimPublicKey); + final List desiredRecords = ApiController + .currentDnsProviderApiFactory! + .getDnsProvider() + .getDesiredDnsRecords( + domainName: domain.domainName, + ipAddress: ipAddress, + dkimPublicKey: dkimPublicKey, + ); final List foundRecords = []; - for (final DesiredDnsRecord record in desiredRecords) { - if (record.description == 'record.dkim') { + for (final DesiredDnsRecord desiredRecord in desiredRecords) { + if (desiredRecord.description == 'record.dkim') { final DnsRecord foundRecord = records.firstWhere( - (final r) => r.name == record.name && r.type == record.type, + (final r) => + r.name == desiredRecord.name && r.type == desiredRecord.type, orElse: () => DnsRecord( - name: record.name, - type: record.type, + name: desiredRecord.name, + type: desiredRecord.type, content: '', ttl: 800, proxied: false, @@ -65,22 +75,22 @@ class DnsRecordsCubit final String? foundContent = foundRecord.content?.replaceAll(RegExp(r'\s+'), ''); final String content = - record.content.replaceAll(RegExp(r'\s+'), ''); + desiredRecord.content.replaceAll(RegExp(r'\s+'), ''); if (foundContent == content) { - foundRecords.add(record.copyWith(isSatisfied: true)); + foundRecords.add(desiredRecord.copyWith(isSatisfied: true)); } else { - foundRecords.add(record.copyWith(isSatisfied: false)); + foundRecords.add(desiredRecord.copyWith(isSatisfied: false)); } } else { if (records.any( (final r) => - r.name == record.name && - r.type == record.type && - r.content == record.content, + r.name == desiredRecord.name && + r.type == desiredRecord.type && + r.content == desiredRecord.content, )) { - foundRecords.add(record.copyWith(isSatisfied: true)); + foundRecords.add(desiredRecord.copyWith(isSatisfied: true)); } else { - foundRecords.add(record.copyWith(isSatisfied: false)); + foundRecords.add(desiredRecord.copyWith(isSatisfied: false)); } } } diff --git a/lib/ui/pages/dns_details/dns_details.dart b/lib/ui/pages/dns_details/dns_details.dart index 692921eb..98f23979 100644 --- a/lib/ui/pages/dns_details/dns_details.dart +++ b/lib/ui/pages/dns_details/dns_details.dart @@ -1,12 +1,12 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:selfprivacy/config/get_it_config.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desired_dns_record.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/cubit/dns_records/dns_records_cubit.dart'; import 'package:selfprivacy/ui/components/brand_cards/filled_card.dart'; import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart'; -import 'package:selfprivacy/utils/network_utils.dart'; class DnsDetailsPage extends StatefulWidget { const DnsDetailsPage({super.key}); @@ -109,9 +109,12 @@ class _DnsDetailsPageState extends State { heroIcon: BrandIcons.globe, heroTitle: 'domain.screen_title'.tr(), children: [ - _getStateCard(dnsCubit.dnsState, () { - context.read().fix(); - }), + _getStateCard( + dnsCubit.dnsState, + () { + context.read().fix(); + }, + ), const SizedBox(height: 16.0), ListTile( title: Text( @@ -150,7 +153,7 @@ class _DnsDetailsPageState extends State { dnsRecord.description.tr(), ), subtitle: Text( - dnsRecord.name, + dnsRecord.displayName ?? dnsRecord.name, ), ), ], diff --git a/lib/utils/network_utils.dart b/lib/utils/network_utils.dart index 1a8f0df2..a94ecb35 100644 --- a/lib/utils/network_utils.dart +++ b/lib/utils/network_utils.dart @@ -1,128 +1,6 @@ import 'package:selfprivacy/logic/models/json/dns_records.dart'; import 'package:url_launcher/url_launcher.dart'; -enum DnsRecordsCategory { - services, - email, - other, -} - -class DesiredDnsRecord { - const DesiredDnsRecord({ - required this.name, - required this.content, - this.type = 'A', - this.description = '', - this.category = DnsRecordsCategory.services, - this.isSatisfied = false, - }); - - final String name; - final String type; - final String content; - final String description; - final DnsRecordsCategory category; - final bool isSatisfied; - - DesiredDnsRecord copyWith({ - final String? name, - final String? type, - final String? content, - final String? description, - final DnsRecordsCategory? category, - final bool? isSatisfied, - }) => - DesiredDnsRecord( - name: name ?? this.name, - type: type ?? this.type, - content: content ?? this.content, - description: description ?? this.description, - category: category ?? this.category, - isSatisfied: isSatisfied ?? this.isSatisfied, - ); -} - -List getDesiredDnsRecords( - final String? domainName, - final String? ipAddress, - final String? dkimPublicKey, -) { - if (domainName == null || ipAddress == null) { - return []; - } - return [ - DesiredDnsRecord( - name: domainName, - content: ipAddress, - description: 'record.root', - ), - DesiredDnsRecord( - name: 'api.$domainName', - content: ipAddress, - description: 'record.api', - ), - DesiredDnsRecord( - name: 'cloud.$domainName', - content: ipAddress, - description: 'record.cloud', - ), - DesiredDnsRecord( - name: 'git.$domainName', - content: ipAddress, - description: 'record.git', - ), - DesiredDnsRecord( - name: 'meet.$domainName', - content: ipAddress, - description: 'record.meet', - ), - DesiredDnsRecord( - name: 'social.$domainName', - content: ipAddress, - description: 'record.social', - ), - DesiredDnsRecord( - name: 'password.$domainName', - content: ipAddress, - description: 'record.password', - ), - DesiredDnsRecord( - name: 'vpn.$domainName', - content: ipAddress, - description: 'record.vpn', - ), - DesiredDnsRecord( - name: domainName, - content: domainName, - description: 'record.mx', - type: 'MX', - category: DnsRecordsCategory.email, - ), - DesiredDnsRecord( - name: '_dmarc.$domainName', - content: 'v=DMARC1; p=none', - description: 'record.dmarc', - type: 'TXT', - category: DnsRecordsCategory.email, - ), - DesiredDnsRecord( - name: domainName, - content: 'v=spf1 a mx ip4:$ipAddress -all', - description: 'record.spf', - type: 'TXT', - category: DnsRecordsCategory.email, - ), - if (dkimPublicKey != null) - DesiredDnsRecord( - name: 'selector._domainkey.$domainName', - content: dkimPublicKey, - description: 'record.dkim', - type: 'TXT', - category: DnsRecordsCategory.email, - ), - ]; -} - DnsRecord? extractDkimRecord(final List records) { DnsRecord? dkimRecord; From 841aee73e89a9f784a9c9763e35147d66c1b67fb Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 16 Jan 2023 21:25:48 +0400 Subject: [PATCH 12/96] feat: Implement Digital Ocean DNS email entries --- .../digital_ocean_dns/digital_ocean_dns.dart | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart index b1485312..b5b33f98 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart @@ -229,22 +229,22 @@ class DigitalOceanDnsApi extends DnsProviderApi { description: 'record.vpn', displayName: 'vpn.$domainName', ), - DesiredDnsRecord( - name: domainName, - content: domainName, + const DesiredDnsRecord( + name: '@', + content: '@', description: 'record.mx', type: 'MX', category: DnsRecordsCategory.email, ), - DesiredDnsRecord( - name: '_dmarc.$domainName', + const DesiredDnsRecord( + name: '_dmarc', content: 'v=DMARC1; p=none', description: 'record.dmarc', type: 'TXT', category: DnsRecordsCategory.email, ), DesiredDnsRecord( - name: domainName, + name: '@', content: 'v=spf1 a mx ip4:$ipAddress -all', description: 'record.spf', type: 'TXT', @@ -252,7 +252,7 @@ class DigitalOceanDnsApi extends DnsProviderApi { ), if (dkimPublicKey != null) DesiredDnsRecord( - name: 'selector._domainkey.$domainName', + name: 'selector._domainkey', content: dkimPublicKey, description: 'record.dkim', type: 'TXT', From 08cd59a709b73963315cb56a4c0526b3a32125cb Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 17 Jan 2023 17:27:32 +0400 Subject: [PATCH 13/96] feat: Implement DNS_PROVIDER_TYPE variable for infecting server --- .../digital_ocean/digital_ocean.dart | 4 +++- .../server_providers/hetzner/hetzner.dart | 6 +++++- .../server_providers/server_provider.dart | 15 +++++++++++++++ .../server_installation_repository.dart | 3 +++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean.dart index 4beb53f7..438e92bf 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean.dart @@ -332,6 +332,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { required final User rootUser, required final String domainName, required final String serverType, + required final DnsProvider dnsProvider, }) async { ServerHostingDetails? serverDetails; @@ -344,9 +345,10 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { final String formattedHostname = getHostnameFromDomain(domainName); const String infectBranch = 'providers/digital-ocean'; final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false'; + final String dnsProviderType = dnsProviderToInfectName(dnsProvider); final String userdataString = - "#cloud-config\nruncmd:\n- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/$infectBranch/nixos-infect | PROVIDER=$infectProviderName STAGING_ACME='$stagingAcme' DOMAIN='$domainName' LUSER='${rootUser.login}' ENCODED_PASSWORD='$base64Password' CF_TOKEN=$dnsApiToken DB_PASSWORD=$dbPassword API_TOKEN=$apiToken HOSTNAME=$formattedHostname bash 2>&1 | tee /tmp/infect.log"; + "#cloud-config\nruncmd:\n- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/$infectBranch/nixos-infect | PROVIDER=$infectProviderName DNS_PROVIDER_TYPE=$dnsProviderType STAGING_ACME='$stagingAcme' DOMAIN='$domainName' LUSER='${rootUser.login}' ENCODED_PASSWORD='$base64Password' CF_TOKEN=$dnsApiToken DB_PASSWORD=$dbPassword API_TOKEN=$apiToken HOSTNAME=$formattedHostname bash 2>&1 | tee /tmp/infect.log"; print(userdataString); Response? serverCreateResponse; diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart index 7f51c768..b9761133 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart @@ -356,6 +356,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { required final User rootUser, required final String domainName, required final String serverType, + required final DnsProvider dnsProvider, }) async { final APIGenericResult newVolumeResponse = await createVolume(); @@ -374,6 +375,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { domainName: domainName, volume: newVolumeResponse.data!, serverType: serverType, + dnsProvider: dnsProvider, ); } @@ -383,6 +385,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { required final String domainName, required final ServerVolume volume, required final String serverType, + required final DnsProvider dnsProvider, }) async { final Dio client = await getClient(); @@ -395,9 +398,10 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false'; final String base64Password = base64.encode(utf8.encode(rootUser.password ?? 'PASS')); + final String dnsProviderType = dnsProviderToInfectName(dnsProvider); final String userdataString = - "#cloud-config\nruncmd:\n- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/$infectBranch/nixos-infect | STAGING_ACME='$stagingAcme' PROVIDER=$infectProviderName NIX_CHANNEL=nixos-21.05 DOMAIN='$domainName' LUSER='${rootUser.login}' ENCODED_PASSWORD='$base64Password' CF_TOKEN=$dnsApiToken DB_PASSWORD=$dbPassword API_TOKEN=$apiToken HOSTNAME=$hostname bash 2>&1 | tee /tmp/infect.log"; + "#cloud-config\nruncmd:\n- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/$infectBranch/nixos-infect | STAGING_ACME='$stagingAcme' PROVIDER=$infectProviderName DNS_PROVIDER_TYPE=$dnsProviderType NIX_CHANNEL=nixos-21.05 DOMAIN='$domainName' LUSER='${rootUser.login}' ENCODED_PASSWORD='$base64Password' CF_TOKEN=$dnsApiToken DB_PASSWORD=$dbPassword API_TOKEN=$apiToken HOSTNAME=$hostname bash 2>&1 | tee /tmp/infect.log"; Response? serverCreateResponse; ServerHostingDetails? serverDetails; diff --git a/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart b/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart index c858d67b..32d31764 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart @@ -39,6 +39,7 @@ abstract class ServerProviderApi extends ApiMap { required final User rootUser, required final String domainName, required final String serverType, + required final DnsProvider dnsProvider, }); Future> createReverseDns({ required final ServerHostingDetails serverDetails, @@ -54,6 +55,20 @@ abstract class ServerProviderApi extends ApiMap { final DateTime end, ); + String dnsProviderToInfectName(final DnsProvider dnsProvider) { + String dnsProviderType; + switch (dnsProvider) { + case DnsProvider.digitalOcean: + dnsProviderType = 'DIGITALOCEAN'; + break; + case DnsProvider.cloudflare: + default: + dnsProviderType = 'CLOUDFLARE'; + break; + } + return dnsProviderType; + } + /// Provider name key which lets infect understand what kind of installation /// it requires, for example 'digitaloceal' for Digital Ocean String get infectProviderName; diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 5f98229f..3b787a70 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -260,6 +260,7 @@ class ServerInstallationRepository { ServerHostingDetails? serverDetails; try { final APIGenericResult createResult = await api.createServer( + dnsProvider: getIt().dnsProvider!, dnsApiToken: cloudFlareKey, rootUser: rootUser, domainName: domainName, @@ -284,6 +285,7 @@ class ServerInstallationRepository { try { final APIGenericResult createServerResult = await api.createServer( + dnsProvider: getIt().dnsProvider!, dnsApiToken: cloudFlareKey, rootUser: rootUser, domainName: domainName, @@ -308,6 +310,7 @@ class ServerInstallationRepository { ServerHostingDetails? serverDetails; try { final APIGenericResult createResult = await api.createServer( + dnsProvider: getIt().dnsProvider!, dnsApiToken: cloudFlareKey, rootUser: rootUser, domainName: domainName, From 14263083a57c3624fdd684f136aab7489019434a Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 17 Jan 2023 18:33:25 +0400 Subject: [PATCH 14/96] feat: Implement server recovery for different dns providers --- .../graphql_maps/schema/schema.graphql | 3 +- .../graphql_maps/schema/schema.graphql.dart | 2 + .../graphql_maps/schema/server_api.graphql | 8 + .../schema/server_api.graphql.dart | 412 ++++++++++++++++++ .../schema/server_api.graphql.g.dart | 52 +++ .../schema/server_settings.graphql.g.dart | 1 + .../graphql_maps/server_api/server_api.dart | 20 + .../server_installation_cubit.dart | 16 +- lib/logic/models/hive/server_domain.dart | 14 +- 9 files changed, 523 insertions(+), 5 deletions(-) diff --git a/lib/logic/api_maps/graphql_maps/schema/schema.graphql b/lib/logic/api_maps/graphql_maps/schema/schema.graphql index ed167742..81c703d1 100644 --- a/lib/logic/api_maps/graphql_maps/schema/schema.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql @@ -75,7 +75,8 @@ type DeviceApiTokenMutationReturn implements MutationReturnInterface { } enum DnsProvider { - CLOUDFLARE + CLOUDFLARE, + DIGITALOCEAN } type DnsRecord { diff --git a/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart index 11d49a43..305ca781 100644 --- a/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart @@ -687,6 +687,8 @@ class _CopyWithStubImpl$Input$UserMutationInput enum Enum$DnsProvider { @JsonValue('CLOUDFLARE') CLOUDFLARE, + @JsonValue('DIGITALOCEAN') + DIGITALOCEAN, $unknown } diff --git a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql index d4339094..f1012815 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql @@ -72,6 +72,14 @@ query SystemServerProvider { } } +query SystemDnsProvider { + system { + domainInfo { + provider + } + } +} + query GetApiTokens { api { devices { diff --git a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart index 09671eed..16c4a4a6 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart @@ -3597,6 +3597,418 @@ class _CopyWithStubImpl$Query$SystemServerProvider$system$provider call({Enum$ServerProvider? provider, String? $__typename}) => _res; } +@JsonSerializable(explicitToJson: true) +class Query$SystemDnsProvider { + Query$SystemDnsProvider({required this.system, required this.$__typename}); + + @override + factory Query$SystemDnsProvider.fromJson(Map json) => + _$Query$SystemDnsProviderFromJson(json); + + final Query$SystemDnsProvider$system system; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$SystemDnsProviderToJson(this); + int get hashCode { + final l$system = system; + final l$$__typename = $__typename; + return Object.hashAll([l$system, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$SystemDnsProvider) || runtimeType != other.runtimeType) + return false; + final l$system = system; + final lOther$system = other.system; + if (l$system != lOther$system) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$SystemDnsProvider on Query$SystemDnsProvider { + CopyWith$Query$SystemDnsProvider get copyWith => + CopyWith$Query$SystemDnsProvider(this, (i) => i); +} + +abstract class CopyWith$Query$SystemDnsProvider { + factory CopyWith$Query$SystemDnsProvider(Query$SystemDnsProvider instance, + TRes Function(Query$SystemDnsProvider) then) = + _CopyWithImpl$Query$SystemDnsProvider; + + factory CopyWith$Query$SystemDnsProvider.stub(TRes res) = + _CopyWithStubImpl$Query$SystemDnsProvider; + + TRes call({Query$SystemDnsProvider$system? system, String? $__typename}); + CopyWith$Query$SystemDnsProvider$system get system; +} + +class _CopyWithImpl$Query$SystemDnsProvider + implements CopyWith$Query$SystemDnsProvider { + _CopyWithImpl$Query$SystemDnsProvider(this._instance, this._then); + + final Query$SystemDnsProvider _instance; + + final TRes Function(Query$SystemDnsProvider) _then; + + static const _undefined = {}; + + TRes call({Object? system = _undefined, Object? $__typename = _undefined}) => + _then(Query$SystemDnsProvider( + system: system == _undefined || system == null + ? _instance.system + : (system as Query$SystemDnsProvider$system), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); + CopyWith$Query$SystemDnsProvider$system get system { + final local$system = _instance.system; + return CopyWith$Query$SystemDnsProvider$system( + local$system, (e) => call(system: e)); + } +} + +class _CopyWithStubImpl$Query$SystemDnsProvider + implements CopyWith$Query$SystemDnsProvider { + _CopyWithStubImpl$Query$SystemDnsProvider(this._res); + + TRes _res; + + call({Query$SystemDnsProvider$system? system, String? $__typename}) => _res; + CopyWith$Query$SystemDnsProvider$system get system => + CopyWith$Query$SystemDnsProvider$system.stub(_res); +} + +const documentNodeQuerySystemDnsProvider = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.query, + name: NameNode(value: 'SystemDnsProvider'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'system'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'domainInfo'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'provider'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), +]); +Query$SystemDnsProvider _parserFn$Query$SystemDnsProvider( + Map data) => + Query$SystemDnsProvider.fromJson(data); + +class Options$Query$SystemDnsProvider + extends graphql.QueryOptions { + Options$Query$SystemDnsProvider( + {String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Duration? pollInterval, + graphql.Context? context}) + : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + pollInterval: pollInterval, + context: context, + document: documentNodeQuerySystemDnsProvider, + parserFn: _parserFn$Query$SystemDnsProvider); +} + +class WatchOptions$Query$SystemDnsProvider + extends graphql.WatchQueryOptions { + WatchOptions$Query$SystemDnsProvider( + {String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false}) + : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeQuerySystemDnsProvider, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Query$SystemDnsProvider); +} + +class FetchMoreOptions$Query$SystemDnsProvider + extends graphql.FetchMoreOptions { + FetchMoreOptions$Query$SystemDnsProvider( + {required graphql.UpdateQuery updateQuery}) + : super( + updateQuery: updateQuery, + document: documentNodeQuerySystemDnsProvider); +} + +extension ClientExtension$Query$SystemDnsProvider on graphql.GraphQLClient { + Future> query$SystemDnsProvider( + [Options$Query$SystemDnsProvider? options]) async => + await this.query(options ?? Options$Query$SystemDnsProvider()); + graphql.ObservableQuery watchQuery$SystemDnsProvider( + [WatchOptions$Query$SystemDnsProvider? options]) => + this.watchQuery(options ?? WatchOptions$Query$SystemDnsProvider()); + void writeQuery$SystemDnsProvider( + {required Query$SystemDnsProvider data, bool broadcast = true}) => + this.writeQuery( + graphql.Request( + operation: graphql.Operation( + document: documentNodeQuerySystemDnsProvider)), + data: data.toJson(), + broadcast: broadcast); + Query$SystemDnsProvider? readQuery$SystemDnsProvider( + {bool optimistic = true}) { + final result = this.readQuery( + graphql.Request( + operation: graphql.Operation( + document: documentNodeQuerySystemDnsProvider)), + optimistic: optimistic); + return result == null ? null : Query$SystemDnsProvider.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$SystemDnsProvider$system { + Query$SystemDnsProvider$system( + {required this.domainInfo, required this.$__typename}); + + @override + factory Query$SystemDnsProvider$system.fromJson(Map json) => + _$Query$SystemDnsProvider$systemFromJson(json); + + final Query$SystemDnsProvider$system$domainInfo domainInfo; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$SystemDnsProvider$systemToJson(this); + int get hashCode { + final l$domainInfo = domainInfo; + final l$$__typename = $__typename; + return Object.hashAll([l$domainInfo, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$SystemDnsProvider$system) || + runtimeType != other.runtimeType) return false; + final l$domainInfo = domainInfo; + final lOther$domainInfo = other.domainInfo; + if (l$domainInfo != lOther$domainInfo) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$SystemDnsProvider$system + on Query$SystemDnsProvider$system { + CopyWith$Query$SystemDnsProvider$system + get copyWith => CopyWith$Query$SystemDnsProvider$system(this, (i) => i); +} + +abstract class CopyWith$Query$SystemDnsProvider$system { + factory CopyWith$Query$SystemDnsProvider$system( + Query$SystemDnsProvider$system instance, + TRes Function(Query$SystemDnsProvider$system) then) = + _CopyWithImpl$Query$SystemDnsProvider$system; + + factory CopyWith$Query$SystemDnsProvider$system.stub(TRes res) = + _CopyWithStubImpl$Query$SystemDnsProvider$system; + + TRes call( + {Query$SystemDnsProvider$system$domainInfo? domainInfo, + String? $__typename}); + CopyWith$Query$SystemDnsProvider$system$domainInfo get domainInfo; +} + +class _CopyWithImpl$Query$SystemDnsProvider$system + implements CopyWith$Query$SystemDnsProvider$system { + _CopyWithImpl$Query$SystemDnsProvider$system(this._instance, this._then); + + final Query$SystemDnsProvider$system _instance; + + final TRes Function(Query$SystemDnsProvider$system) _then; + + static const _undefined = {}; + + TRes call( + {Object? domainInfo = _undefined, + Object? $__typename = _undefined}) => + _then(Query$SystemDnsProvider$system( + domainInfo: domainInfo == _undefined || domainInfo == null + ? _instance.domainInfo + : (domainInfo as Query$SystemDnsProvider$system$domainInfo), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); + CopyWith$Query$SystemDnsProvider$system$domainInfo get domainInfo { + final local$domainInfo = _instance.domainInfo; + return CopyWith$Query$SystemDnsProvider$system$domainInfo( + local$domainInfo, (e) => call(domainInfo: e)); + } +} + +class _CopyWithStubImpl$Query$SystemDnsProvider$system + implements CopyWith$Query$SystemDnsProvider$system { + _CopyWithStubImpl$Query$SystemDnsProvider$system(this._res); + + TRes _res; + + call( + {Query$SystemDnsProvider$system$domainInfo? domainInfo, + String? $__typename}) => + _res; + CopyWith$Query$SystemDnsProvider$system$domainInfo get domainInfo => + CopyWith$Query$SystemDnsProvider$system$domainInfo.stub(_res); +} + +@JsonSerializable(explicitToJson: true) +class Query$SystemDnsProvider$system$domainInfo { + Query$SystemDnsProvider$system$domainInfo( + {required this.provider, required this.$__typename}); + + @override + factory Query$SystemDnsProvider$system$domainInfo.fromJson( + Map json) => + _$Query$SystemDnsProvider$system$domainInfoFromJson(json); + + @JsonKey(unknownEnumValue: Enum$DnsProvider.$unknown) + final Enum$DnsProvider provider; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Query$SystemDnsProvider$system$domainInfoToJson(this); + int get hashCode { + final l$provider = provider; + final l$$__typename = $__typename; + return Object.hashAll([l$provider, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$SystemDnsProvider$system$domainInfo) || + runtimeType != other.runtimeType) return false; + final l$provider = provider; + final lOther$provider = other.provider; + if (l$provider != lOther$provider) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$SystemDnsProvider$system$domainInfo + on Query$SystemDnsProvider$system$domainInfo { + CopyWith$Query$SystemDnsProvider$system$domainInfo< + Query$SystemDnsProvider$system$domainInfo> + get copyWith => + CopyWith$Query$SystemDnsProvider$system$domainInfo(this, (i) => i); +} + +abstract class CopyWith$Query$SystemDnsProvider$system$domainInfo { + factory CopyWith$Query$SystemDnsProvider$system$domainInfo( + Query$SystemDnsProvider$system$domainInfo instance, + TRes Function(Query$SystemDnsProvider$system$domainInfo) then) = + _CopyWithImpl$Query$SystemDnsProvider$system$domainInfo; + + factory CopyWith$Query$SystemDnsProvider$system$domainInfo.stub(TRes res) = + _CopyWithStubImpl$Query$SystemDnsProvider$system$domainInfo; + + TRes call({Enum$DnsProvider? provider, String? $__typename}); +} + +class _CopyWithImpl$Query$SystemDnsProvider$system$domainInfo + implements CopyWith$Query$SystemDnsProvider$system$domainInfo { + _CopyWithImpl$Query$SystemDnsProvider$system$domainInfo( + this._instance, this._then); + + final Query$SystemDnsProvider$system$domainInfo _instance; + + final TRes Function(Query$SystemDnsProvider$system$domainInfo) _then; + + static const _undefined = {}; + + TRes call( + {Object? provider = _undefined, Object? $__typename = _undefined}) => + _then(Query$SystemDnsProvider$system$domainInfo( + provider: provider == _undefined || provider == null + ? _instance.provider + : (provider as Enum$DnsProvider), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); +} + +class _CopyWithStubImpl$Query$SystemDnsProvider$system$domainInfo + implements CopyWith$Query$SystemDnsProvider$system$domainInfo { + _CopyWithStubImpl$Query$SystemDnsProvider$system$domainInfo(this._res); + + TRes _res; + + call({Enum$DnsProvider? provider, String? $__typename}) => _res; +} + @JsonSerializable(explicitToJson: true) class Query$GetApiTokens { Query$GetApiTokens({required this.api, required this.$__typename}); diff --git a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.g.dart b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.g.dart index f0ec390c..0d658310 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.g.dart +++ b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.g.dart @@ -382,6 +382,58 @@ const _$Enum$ServerProviderEnumMap = { Enum$ServerProvider.$unknown: r'$unknown', }; +Query$SystemDnsProvider _$Query$SystemDnsProviderFromJson( + Map json) => + Query$SystemDnsProvider( + system: Query$SystemDnsProvider$system.fromJson( + json['system'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Query$SystemDnsProviderToJson( + Query$SystemDnsProvider instance) => + { + 'system': instance.system.toJson(), + '__typename': instance.$__typename, + }; + +Query$SystemDnsProvider$system _$Query$SystemDnsProvider$systemFromJson( + Map json) => + Query$SystemDnsProvider$system( + domainInfo: Query$SystemDnsProvider$system$domainInfo.fromJson( + json['domainInfo'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Query$SystemDnsProvider$systemToJson( + Query$SystemDnsProvider$system instance) => + { + 'domainInfo': instance.domainInfo.toJson(), + '__typename': instance.$__typename, + }; + +Query$SystemDnsProvider$system$domainInfo + _$Query$SystemDnsProvider$system$domainInfoFromJson( + Map json) => + Query$SystemDnsProvider$system$domainInfo( + provider: $enumDecode(_$Enum$DnsProviderEnumMap, json['provider'], + unknownValue: Enum$DnsProvider.$unknown), + $__typename: json['__typename'] as String, + ); + +Map _$Query$SystemDnsProvider$system$domainInfoToJson( + Query$SystemDnsProvider$system$domainInfo instance) => + { + 'provider': _$Enum$DnsProviderEnumMap[instance.provider]!, + '__typename': instance.$__typename, + }; + +const _$Enum$DnsProviderEnumMap = { + Enum$DnsProvider.CLOUDFLARE: 'CLOUDFLARE', + Enum$DnsProvider.DIGITALOCEAN: 'DIGITALOCEAN', + Enum$DnsProvider.$unknown: r'$unknown', +}; + Query$GetApiTokens _$Query$GetApiTokensFromJson(Map json) => Query$GetApiTokens( api: Query$GetApiTokens$api.fromJson(json['api'] as Map), diff --git a/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.g.dart b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.g.dart index c928b177..6f4cb2d4 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.g.dart +++ b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.g.dart @@ -208,6 +208,7 @@ Map _$Query$DomainInfo$system$domainInfoToJson( const _$Enum$DnsProviderEnumMap = { Enum$DnsProvider.CLOUDFLARE: 'CLOUDFLARE', + Enum$DnsProvider.DIGITALOCEAN: 'DIGITALOCEAN', Enum$DnsProvider.$unknown: r'$unknown', }; diff --git a/lib/logic/api_maps/graphql_maps/server_api/server_api.dart b/lib/logic/api_maps/graphql_maps/server_api/server_api.dart index bb703103..51da63ac 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/server_api.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/server_api.dart @@ -11,6 +11,7 @@ import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/users.graphql.dar import 'package:selfprivacy/logic/models/auto_upgrade_settings.dart'; import 'package:selfprivacy/logic/models/hive/backblaze_bucket.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; +import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; import 'package:selfprivacy/logic/models/json/api_token.dart'; import 'package:selfprivacy/logic/models/json/backup.dart'; @@ -87,6 +88,25 @@ class ServerApi extends ApiMap return providerType; } + Future getDnsProviderType() async { + QueryResult response; + DnsProvider providerType = DnsProvider.unknown; + + try { + final GraphQLClient client = await getClient(); + response = await client.query$SystemDnsProvider(); + if (response.hasException) { + print(response.exception.toString()); + } + providerType = DnsProvider.fromGraphQL( + response.parsedData!.system.domainInfo.provider, + ); + } catch (e) { + print(e); + } + return providerType; + } + Future isUsingBinds() async { QueryResult response; bool usesBinds = false; diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 487e60c7..60a801fd 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -537,17 +537,27 @@ class ServerInstallationCubit extends Cubit { token, dataState.recoveryCapabilities, ); - final ServerProvider provider = await ServerApi( + final ServerProvider serverProvider = await ServerApi( customToken: serverDetails.apiToken, isWithToken: true, ).getServerProviderType(); - if (provider == ServerProvider.unknown) { + final DnsProvider dnsProvider = await ServerApi( + customToken: serverDetails.apiToken, + isWithToken: true, + ).getDnsProviderType(); + if (serverProvider == ServerProvider.unknown) { + getIt() + .showSnackBar('recovering.generic_error'.tr()); + return; + } + if (dnsProvider == DnsProvider.unknown) { getIt() .showSnackBar('recovering.generic_error'.tr()); return; } await repository.saveServerDetails(serverDetails); - setServerProviderType(provider); + setServerProviderType(serverProvider); + setDnsProviderType(dnsProvider); emit( dataState.copyWith( serverDetails: serverDetails, diff --git a/lib/logic/models/hive/server_domain.dart b/lib/logic/models/hive/server_domain.dart index a58ff5a1..0b8a5bc8 100644 --- a/lib/logic/models/hive/server_domain.dart +++ b/lib/logic/models/hive/server_domain.dart @@ -1,4 +1,5 @@ import 'package:hive/hive.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/schema.graphql.dart'; part 'server_domain.g.dart'; @@ -30,5 +31,16 @@ enum DnsProvider { @HiveField(1) cloudflare, @HiveField(2) - digitalOcean, + digitalOcean; + + factory DnsProvider.fromGraphQL(final Enum$DnsProvider provider) { + switch (provider) { + case Enum$DnsProvider.CLOUDFLARE: + return cloudflare; + case Enum$DnsProvider.DIGITALOCEAN: + return digitalOcean; + default: + return unknown; + } + } } From 0ae4a40e6246d302e46d2574282b4abea20be2da Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 23 Jan 2023 19:36:43 +0400 Subject: [PATCH 15/96] chore: Rename api factories --- .../api_maps/rest_maps/api_factory_creator.dart | 4 ++-- .../{digital_ocean.dart => digital_ocean_api.dart} | 0 ...factory.dart => digital_ocean_api_factory.dart} | 2 +- .../hetzner/{hetzner.dart => hetzner_api.dart} | 0 ...tzner_factory.dart => hetzner_api_factory.dart} | 2 +- lib/logic/providers/server_providers/hetzner.dart | 0 .../server_providers/server_provider_factory.dart | 14 ++++++++++++++ 7 files changed, 18 insertions(+), 4 deletions(-) rename lib/logic/api_maps/rest_maps/server_providers/digital_ocean/{digital_ocean.dart => digital_ocean_api.dart} (100%) rename lib/logic/api_maps/rest_maps/server_providers/digital_ocean/{digital_ocean_factory.dart => digital_ocean_api_factory.dart} (96%) rename lib/logic/api_maps/rest_maps/server_providers/hetzner/{hetzner.dart => hetzner_api.dart} (100%) rename lib/logic/api_maps/rest_maps/server_providers/hetzner/{hetzner_factory.dart => hetzner_api_factory.dart} (97%) create mode 100644 lib/logic/providers/server_providers/hetzner.dart create mode 100644 lib/logic/providers/server_providers/server_provider_factory.dart diff --git a/lib/logic/api_maps/rest_maps/api_factory_creator.dart b/lib/logic/api_maps/rest_maps/api_factory_creator.dart index c835b0cd..662dd4f8 100644 --- a/lib/logic/api_maps/rest_maps/api_factory_creator.dart +++ b/lib/logic/api_maps/rest_maps/api_factory_creator.dart @@ -2,8 +2,8 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_factory.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_factory.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_factory.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_factory.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api_factory.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api_factory.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_factory.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart similarity index 100% rename from lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean.dart rename to lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_factory.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api_factory.dart similarity index 96% rename from lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_factory.dart rename to lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api_factory.dart index 73a1e647..6383c4ab 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_factory.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api_factory.dart @@ -1,4 +1,4 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_api_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_factory.dart'; diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart similarity index 100% rename from lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart rename to lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_factory.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api_factory.dart similarity index 97% rename from lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_factory.dart rename to lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api_factory.dart index 5f8fcab5..6824d385 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_factory.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api_factory.dart @@ -1,4 +1,4 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_api_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_factory.dart'; diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart new file mode 100644 index 00000000..e69de29b diff --git a/lib/logic/providers/server_providers/server_provider_factory.dart b/lib/logic/providers/server_providers/server_provider_factory.dart new file mode 100644 index 00000000..669ffbd6 --- /dev/null +++ b/lib/logic/providers/server_providers/server_provider_factory.dart @@ -0,0 +1,14 @@ +class ServerProviderFactory { + static ServerProvider createServerProviderApiFactory( + final ServerProviderApiFactorySettings settings, + ) { + switch (settings.provider) { + case ServerProvider.hetzner: + return HetznerApiFactory(region: settings.location); + case ServerProvider.digitalOcean: + return DigitalOceanApiFactory(region: settings.location); + case ServerProvider.unknown: + throw UnknownApiProviderException('Unknown server provider'); + } + } +} From fcd1c2960689a13b124206cd9823c8fb274d8697 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Sun, 29 Jan 2023 08:56:51 +0400 Subject: [PATCH 16/96] fix: Remove breaking underscore from a launchURL call In services.dart --- lib/ui/pages/services/services.dart | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/ui/pages/services/services.dart b/lib/ui/pages/services/services.dart index 8295df27..c7c01daa 100644 --- a/lib/ui/pages/services/services.dart +++ b/lib/ui/pages/services/services.dart @@ -133,13 +133,8 @@ class _Card extends StatelessWidget { Column( children: [ GestureDetector( -<<<<<<< HEAD onTap: () => launchURL( - 'https://${service.url}', -======= - onTap: () => _launchURL( service.url, ->>>>>>> master ), child: Text( '${service.url}', From a270f3dfbb951fc3ccc43ca574813cafb289eef2 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 30 Jan 2023 19:44:52 +0400 Subject: [PATCH 17/96] feat: Implement general server provider and its factory --- .../graphql_maps/server_api/server_api.dart | 12 ++-- .../api_maps/rest_maps/api_controller.dart | 8 +-- .../rest_maps/api_factory_creator.dart | 26 ++++----- .../digital_ocean/digital_ocean_api.dart | 4 +- .../server_providers/hetzner/hetzner_api.dart | 6 +- .../server_providers/server_provider.dart | 8 +-- .../initializing/domain_setup_cubit.dart | 2 +- .../server_installation_cubit.dart | 55 +++++++------------ .../server_installation_repository.dart | 32 +++++------ lib/logic/get_it/api_config.dart | 12 ++-- lib/logic/models/hive/server_details.dart | 12 ++-- lib/logic/models/hive/server_domain.dart | 8 +-- .../provider_settings.dart} | 12 ++-- lib/logic/providers/providers_controller.dart | 20 +++++++ lib/logic/providers/server_provider.dart | 5 ++ .../server_providers/digital_ocean.dart | 3 + .../providers/server_providers/hetzner.dart | 3 + .../server_provider_factory.dart | 27 ++++++--- .../initializing/dns_provider_picker.dart | 24 ++++---- .../initializing/server_provider_picker.dart | 26 ++++----- 20 files changed, 166 insertions(+), 139 deletions(-) rename lib/logic/{api_maps/rest_maps/api_factory_settings.dart => providers/provider_settings.dart} (54%) create mode 100644 lib/logic/providers/providers_controller.dart create mode 100644 lib/logic/providers/server_provider.dart create mode 100644 lib/logic/providers/server_providers/digital_ocean.dart diff --git a/lib/logic/api_maps/graphql_maps/server_api/server_api.dart b/lib/logic/api_maps/graphql_maps/server_api/server_api.dart index 51da63ac..9f863b1f 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/server_api.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/server_api.dart @@ -69,9 +69,9 @@ class ServerApi extends ApiMap return apiVersion; } - Future getServerProviderType() async { + Future getServerProviderType() async { QueryResult response; - ServerProvider providerType = ServerProvider.unknown; + ServerProviderType providerType = ServerProviderType.unknown; try { final GraphQLClient client = await getClient(); @@ -79,7 +79,7 @@ class ServerApi extends ApiMap if (response.hasException) { print(response.exception.toString()); } - providerType = ServerProvider.fromGraphQL( + providerType = ServerProviderType.fromGraphQL( response.parsedData!.system.provider.provider, ); } catch (e) { @@ -88,9 +88,9 @@ class ServerApi extends ApiMap return providerType; } - Future getDnsProviderType() async { + Future getDnsProviderType() async { QueryResult response; - DnsProvider providerType = DnsProvider.unknown; + DnsProviderType providerType = DnsProviderType.unknown; try { final GraphQLClient client = await getClient(); @@ -98,7 +98,7 @@ class ServerApi extends ApiMap if (response.hasException) { print(response.exception.toString()); } - providerType = DnsProvider.fromGraphQL( + providerType = DnsProviderType.fromGraphQL( response.parsedData!.system.domainInfo.provider, ); } catch (e) { diff --git a/lib/logic/api_maps/rest_maps/api_controller.dart b/lib/logic/api_maps/rest_maps/api_controller.dart index 440d25af..73fd8e5c 100644 --- a/lib/logic/api_maps/rest_maps/api_controller.dart +++ b/lib/logic/api_maps/rest_maps/api_controller.dart @@ -1,5 +1,5 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_creator.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_settings.dart'; +import 'package:selfprivacy/logic/providers/provider_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_factory.dart'; @@ -12,21 +12,21 @@ class ApiController { _serverProviderApiFactory; static void initVolumeProviderApiFactory( - final ServerProviderApiFactorySettings settings, + final ServerProviderSettings settings, ) { _volumeProviderApiFactory = VolumeApiFactoryCreator.createVolumeProviderApiFactory(settings); } static void initDnsProviderApiFactory( - final DnsProviderApiFactorySettings settings, + final DnsProviderFactorySettings settings, ) { _dnsProviderApiFactory = ApiFactoryCreator.createDnsProviderApiFactory(settings); } static void initServerProviderApiFactory( - final ServerProviderApiFactorySettings settings, + final ServerProviderSettings settings, ) { _serverProviderApiFactory = ApiFactoryCreator.createServerProviderApiFactory(settings); diff --git a/lib/logic/api_maps/rest_maps/api_factory_creator.dart b/lib/logic/api_maps/rest_maps/api_factory_creator.dart index 662dd4f8..97bb3acd 100644 --- a/lib/logic/api_maps/rest_maps/api_factory_creator.dart +++ b/lib/logic/api_maps/rest_maps/api_factory_creator.dart @@ -1,4 +1,4 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_settings.dart'; +import 'package:selfprivacy/logic/providers/provider_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_factory.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_factory.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart'; @@ -15,27 +15,27 @@ class UnknownApiProviderException implements Exception { class ApiFactoryCreator { static ServerProviderApiFactory createServerProviderApiFactory( - final ServerProviderApiFactorySettings settings, + final ServerProviderSettings settings, ) { switch (settings.provider) { - case ServerProvider.hetzner: + case ServerProviderType.hetzner: return HetznerApiFactory(region: settings.location); - case ServerProvider.digitalOcean: + case ServerProviderType.digitalOcean: return DigitalOceanApiFactory(region: settings.location); - case ServerProvider.unknown: + case ServerProviderType.unknown: throw UnknownApiProviderException('Unknown server provider'); } } static DnsProviderApiFactory createDnsProviderApiFactory( - final DnsProviderApiFactorySettings settings, + final DnsProviderFactorySettings settings, ) { switch (settings.provider) { - case DnsProvider.cloudflare: + case DnsProviderType.cloudflare: return CloudflareApiFactory(); - case DnsProvider.digitalOcean: + case DnsProviderType.digitalOcean: return DigitalOceanDnsApiFactory(); - case DnsProvider.unknown: + case DnsProviderType.unknown: throw UnknownApiProviderException('Unknown DNS provider'); } } @@ -43,14 +43,14 @@ class ApiFactoryCreator { class VolumeApiFactoryCreator { static VolumeProviderApiFactory createVolumeProviderApiFactory( - final ServerProviderApiFactorySettings settings, + final ServerProviderSettings settings, ) { switch (settings.provider) { - case ServerProvider.hetzner: + case ServerProviderType.hetzner: return HetznerApiFactory(); - case ServerProvider.digitalOcean: + case ServerProviderType.digitalOcean: return DigitalOceanApiFactory(); - case ServerProvider.unknown: + case ServerProviderType.unknown: throw UnknownApiProviderException('Unknown volume provider'); } } diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart index 438e92bf..540b39c5 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart @@ -332,7 +332,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { required final User rootUser, required final String domainName, required final String serverType, - required final DnsProvider dnsProvider, + required final DnsProviderType dnsProvider, }) async { ServerHostingDetails? serverDetails; @@ -394,7 +394,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { createTime: DateTime.now(), volume: newVolume, apiToken: apiToken, - provider: ServerProvider.digitalOcean, + provider: ServerProviderType.digitalOcean, ); } } catch (e) { diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart index b9761133..cfd9eb40 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart @@ -356,7 +356,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { required final User rootUser, required final String domainName, required final String serverType, - required final DnsProvider dnsProvider, + required final DnsProviderType dnsProvider, }) async { final APIGenericResult newVolumeResponse = await createVolume(); @@ -385,7 +385,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { required final String domainName, required final ServerVolume volume, required final String serverType, - required final DnsProvider dnsProvider, + required final DnsProviderType dnsProvider, }) async { final Dio client = await getClient(); @@ -434,7 +434,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { createTime: DateTime.now(), volume: volume, apiToken: apiToken, - provider: ServerProvider.hetzner, + provider: ServerProviderType.hetzner, ); success = true; } on DioError catch (e) { diff --git a/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart b/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart index 32d31764..99516535 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart @@ -39,7 +39,7 @@ abstract class ServerProviderApi extends ApiMap { required final User rootUser, required final String domainName, required final String serverType, - required final DnsProvider dnsProvider, + required final DnsProviderType dnsProvider, }); Future> createReverseDns({ required final ServerHostingDetails serverDetails, @@ -55,13 +55,13 @@ abstract class ServerProviderApi extends ApiMap { final DateTime end, ); - String dnsProviderToInfectName(final DnsProvider dnsProvider) { + String dnsProviderToInfectName(final DnsProviderType dnsProvider) { String dnsProviderType; switch (dnsProvider) { - case DnsProvider.digitalOcean: + case DnsProviderType.digitalOcean: dnsProviderType = 'DIGITALOCEAN'; break; - case DnsProvider.cloudflare: + case DnsProviderType.cloudflare: default: dnsProviderType = 'CLOUDFLARE'; break; diff --git a/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart b/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart index 62fc1050..c4c8a22f 100644 --- a/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart @@ -39,7 +39,7 @@ class DomainSetupCubit extends Cubit { final ServerDomain domain = ServerDomain( domainName: domainName, zoneId: zoneId, - provider: DnsProvider.cloudflare, + provider: DnsProviderType.cloudflare, ); serverInstallationCubit.setDomain(domain); diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 60a801fd..e6ad9be1 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -6,8 +6,9 @@ import 'package:equatable/equatable.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server_api.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/api_controller.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_settings.dart'; +import 'package:selfprivacy/logic/providers/provider_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart'; +import 'package:selfprivacy/logic/providers/providers_controller.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_api_settings.dart'; import 'package:selfprivacy/logic/models/hive/backblaze_credential.dart'; @@ -57,45 +58,29 @@ class ServerInstallationCubit extends Cubit { } } - void setServerProviderType(final ServerProvider providerType) async { + void setServerProviderType(final ServerProviderType providerType) async { await repository.saveServerProviderType(providerType); - ApiController.initServerProviderApiFactory( - ServerProviderApiFactorySettings( - provider: providerType, - ), + ProvidersController.initServerProvider( + ServerProviderSettings(provider: providerType), ); } - void setDnsProviderType(final DnsProvider providerType) async { + void setDnsProviderType(final DnsProviderType providerType) async { await repository.saveDnsProviderType(providerType); ApiController.initDnsProviderApiFactory( - DnsProviderApiFactorySettings( + DnsProviderFactorySettings( provider: providerType, ), ); } - ProviderApiTokenValidation serverProviderApiTokenValidation() => - ApiController.currentServerProviderApiFactory! - .getServerProvider() - .getApiTokenValidation(); - - RegExp getDnsProviderApiTokenValidation() => - ApiController.currentDnsProviderApiFactory! - .getDnsProvider() - .getApiTokenValidation(); - Future isServerProviderApiTokenValid( final String providerToken, ) async { final APIGenericResult apiResponse = - await ApiController.currentServerProviderApiFactory! - .getServerProvider( - settings: const ServerProviderApiSettings( - isWithToken: false, - ), - ) - .isApiTokenValid(providerToken); + await ProvidersController.currentServerProvider!.isApiTokenValid( + providerToken, + ); if (!apiResponse.success) { getIt().showSnackBar( @@ -191,7 +176,7 @@ class ServerInstallationCubit extends Cubit { await repository.saveServerType(serverType); ApiController.initServerProviderApiFactory( - ServerProviderApiFactorySettings( + ServerProviderSettings( provider: getIt().serverProvider!, location: serverType.location.identifier, ), @@ -200,7 +185,7 @@ class ServerInstallationCubit extends Cubit { // All server providers support volumes for now, // so it's safe to initialize. ApiController.initVolumeProviderApiFactory( - ServerProviderApiFactorySettings( + ServerProviderSettings( provider: getIt().serverProvider!, location: serverType.location.identifier, ), @@ -485,7 +470,7 @@ class ServerInstallationCubit extends Cubit { void submitDomainForAccessRecovery(final String domain) async { final ServerDomain serverDomain = ServerDomain( domainName: domain, - provider: DnsProvider.unknown, + provider: DnsProviderType.unknown, zoneId: '', ); final ServerRecoveryCapabilities recoveryCapabilities = @@ -537,20 +522,20 @@ class ServerInstallationCubit extends Cubit { token, dataState.recoveryCapabilities, ); - final ServerProvider serverProvider = await ServerApi( + final ServerProviderType serverProvider = await ServerApi( customToken: serverDetails.apiToken, isWithToken: true, ).getServerProviderType(); - final DnsProvider dnsProvider = await ServerApi( + final DnsProviderType dnsProvider = await ServerApi( customToken: serverDetails.apiToken, isWithToken: true, ).getDnsProviderType(); - if (serverProvider == ServerProvider.unknown) { + if (serverProvider == ServerProviderType.unknown) { getIt() .showSnackBar('recovering.generic_error'.tr()); return; } - if (dnsProvider == DnsProvider.unknown) { + if (dnsProvider == DnsProviderType.unknown) { getIt() .showSnackBar('recovering.generic_error'.tr()); return; @@ -684,7 +669,7 @@ class ServerInstallationCubit extends Cubit { linuxDevice: '', ), apiToken: dataState.serverDetails!.apiToken, - provider: ServerProvider.hetzner, + provider: ServerProviderType.hetzner, ); await repository.saveDomain(serverDomain); await repository.saveServerDetails(serverDetails); @@ -714,7 +699,7 @@ class ServerInstallationCubit extends Cubit { ServerDomain( domainName: serverDomain.domainName, zoneId: zoneId, - provider: DnsProvider.cloudflare, + provider: DnsProviderType.cloudflare, ), ); await repository.setDnsApiToken(token); @@ -723,7 +708,7 @@ class ServerInstallationCubit extends Cubit { serverDomain: ServerDomain( domainName: serverDomain.domainName, zoneId: zoneId, - provider: DnsProvider.cloudflare, + provider: DnsProviderType.cloudflare, ), dnsApiToken: token, currentStep: RecoveryStep.backblazeToken, diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 3b787a70..50eb7998 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -10,7 +10,7 @@ import 'package:pub_semver/pub_semver.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/config/hive_config.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/api_controller.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_settings.dart'; +import 'package:selfprivacy/logic/providers/provider_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server_api.dart'; @@ -48,8 +48,8 @@ class ServerInstallationRepository { final String? cloudflareToken = getIt().dnsProviderKey; final String? serverTypeIdentificator = getIt().serverType; final ServerDomain? serverDomain = getIt().serverDomain; - final DnsProvider? dnsProvider = getIt().dnsProvider; - final ServerProvider? serverProvider = + final DnsProviderType? dnsProvider = getIt().dnsProvider; + final ServerProviderType? serverProvider = getIt().serverProvider; final BackblazeCredential? backblazeCredential = getIt().backblazeCredential; @@ -58,9 +58,9 @@ class ServerInstallationRepository { if (serverProvider != null || (serverDetails != null && - serverDetails.provider != ServerProvider.unknown)) { + serverDetails.provider != ServerProviderType.unknown)) { ApiController.initServerProviderApiFactory( - ServerProviderApiFactorySettings( + ServerProviderSettings( provider: serverProvider ?? serverDetails!.provider, location: location, ), @@ -69,7 +69,7 @@ class ServerInstallationRepository { // All current providers support volumes // so it's safe to hardcode for now ApiController.initVolumeProviderApiFactory( - ServerProviderApiFactorySettings( + ServerProviderSettings( provider: serverProvider ?? serverDetails!.provider, location: location, ), @@ -78,9 +78,9 @@ class ServerInstallationRepository { if (dnsProvider != null || (serverDomain != null && - serverDomain.provider != ServerProvider.unknown)) { + serverDomain.provider != ServerProviderType.unknown)) { ApiController.initDnsProviderApiFactory( - DnsProviderApiFactorySettings( + DnsProviderFactorySettings( provider: dnsProvider ?? serverDomain!.provider, ), ); @@ -147,8 +147,8 @@ class ServerInstallationRepository { ) { if (serverDetails != null) { if (serverProviderToken != null) { - if (serverDetails.provider != ServerProvider.unknown) { - if (serverDomain.provider != DnsProvider.unknown) { + if (serverDetails.provider != ServerProviderType.unknown) { + if (serverDomain.provider != DnsProviderType.unknown) { return RecoveryStep.backblazeToken; } return RecoveryStep.dnsProviderToken; @@ -534,7 +534,7 @@ class ServerInstallationRepository { serverId: 0, linuxDevice: '', ), - provider: ServerProvider.unknown, + provider: ServerProviderType.unknown, id: 0, ip4: serverIp, startTime: null, @@ -571,7 +571,7 @@ class ServerInstallationRepository { serverId: 0, linuxDevice: '', ), - provider: ServerProvider.unknown, + provider: ServerProviderType.unknown, id: 0, ip4: serverIp, startTime: null, @@ -606,7 +606,7 @@ class ServerInstallationRepository { sizeByte: 0, linuxDevice: '', ), - provider: ServerProvider.unknown, + provider: ServerProviderType.unknown, id: 0, ip4: serverIp, startTime: null, @@ -634,7 +634,7 @@ class ServerInstallationRepository { serverId: 0, linuxDevice: '', ), - provider: ServerProvider.unknown, + provider: ServerProviderType.unknown, id: 0, ip4: serverIp, startTime: null, @@ -691,11 +691,11 @@ class ServerInstallationRepository { getIt().init(); } - Future saveServerProviderType(final ServerProvider type) async { + Future saveServerProviderType(final ServerProviderType type) async { await getIt().storeServerProviderType(type); } - Future saveDnsProviderType(final DnsProvider type) async { + Future saveDnsProviderType(final DnsProviderType type) async { await getIt().storeDnsProviderType(type); } diff --git a/lib/logic/get_it/api_config.dart b/lib/logic/get_it/api_config.dart index 2ca9d53b..b93105d3 100644 --- a/lib/logic/get_it/api_config.dart +++ b/lib/logic/get_it/api_config.dart @@ -13,8 +13,8 @@ class ApiConfigModel { String? get serverLocation => _serverLocation; String? get serverType => _serverType; String? get dnsProviderKey => _dnsProviderKey; - ServerProvider? get serverProvider => _serverProvider; - DnsProvider? get dnsProvider => _dnsProvider; + ServerProviderType? get serverProvider => _serverProvider; + DnsProviderType? get dnsProvider => _dnsProvider; BackblazeCredential? get backblazeCredential => _backblazeCredential; ServerDomain? get serverDomain => _serverDomain; BackblazeBucket? get backblazeBucket => _backblazeBucket; @@ -23,19 +23,19 @@ class ApiConfigModel { String? _serverLocation; String? _dnsProviderKey; String? _serverType; - ServerProvider? _serverProvider; - DnsProvider? _dnsProvider; + ServerProviderType? _serverProvider; + DnsProviderType? _dnsProvider; ServerHostingDetails? _serverDetails; BackblazeCredential? _backblazeCredential; ServerDomain? _serverDomain; BackblazeBucket? _backblazeBucket; - Future storeServerProviderType(final ServerProvider value) async { + Future storeServerProviderType(final ServerProviderType value) async { await _box.put(BNames.serverProvider, value); _serverProvider = value; } - Future storeDnsProviderType(final DnsProvider value) async { + Future storeDnsProviderType(final DnsProviderType value) async { await _box.put(BNames.dnsProvider, value); _dnsProvider = value; } diff --git a/lib/logic/models/hive/server_details.dart b/lib/logic/models/hive/server_details.dart index 54ec257f..e746dd75 100644 --- a/lib/logic/models/hive/server_details.dart +++ b/lib/logic/models/hive/server_details.dart @@ -33,8 +33,8 @@ class ServerHostingDetails { @HiveField(5) final String apiToken; - @HiveField(6, defaultValue: ServerProvider.hetzner) - final ServerProvider provider; + @HiveField(6, defaultValue: ServerProviderType.hetzner) + final ServerProviderType provider; ServerHostingDetails copyWith({final DateTime? startTime}) => ServerHostingDetails( @@ -77,7 +77,7 @@ class ServerVolume { } @HiveType(typeId: 101) -enum ServerProvider { +enum ServerProviderType { @HiveField(0) unknown, @HiveField(1) @@ -85,7 +85,7 @@ enum ServerProvider { @HiveField(2) digitalOcean; - factory ServerProvider.fromGraphQL(final Enum$ServerProvider provider) { + factory ServerProviderType.fromGraphQL(final Enum$ServerProvider provider) { switch (provider) { case Enum$ServerProvider.HETZNER: return hetzner; @@ -98,9 +98,9 @@ enum ServerProvider { String get displayName { switch (this) { - case ServerProvider.hetzner: + case ServerProviderType.hetzner: return 'Hetzner Cloud'; - case ServerProvider.digitalOcean: + case ServerProviderType.digitalOcean: return 'Digital Ocean'; default: return 'Unknown'; diff --git a/lib/logic/models/hive/server_domain.dart b/lib/logic/models/hive/server_domain.dart index 0b8a5bc8..2d9a554b 100644 --- a/lib/logic/models/hive/server_domain.dart +++ b/lib/logic/models/hive/server_domain.dart @@ -17,15 +17,15 @@ class ServerDomain { @HiveField(1) final String zoneId; - @HiveField(2, defaultValue: DnsProvider.cloudflare) - final DnsProvider provider; + @HiveField(2, defaultValue: DnsProviderType.cloudflare) + final DnsProviderType provider; @override String toString() => '$domainName: $zoneId'; } @HiveType(typeId: 100) -enum DnsProvider { +enum DnsProviderType { @HiveField(0) unknown, @HiveField(1) @@ -33,7 +33,7 @@ enum DnsProvider { @HiveField(2) digitalOcean; - factory DnsProvider.fromGraphQL(final Enum$DnsProvider provider) { + factory DnsProviderType.fromGraphQL(final Enum$DnsProvider provider) { switch (provider) { case Enum$DnsProvider.CLOUDFLARE: return cloudflare; diff --git a/lib/logic/api_maps/rest_maps/api_factory_settings.dart b/lib/logic/providers/provider_settings.dart similarity index 54% rename from lib/logic/api_maps/rest_maps/api_factory_settings.dart rename to lib/logic/providers/provider_settings.dart index 438b92d5..8145cff7 100644 --- a/lib/logic/api_maps/rest_maps/api_factory_settings.dart +++ b/lib/logic/providers/provider_settings.dart @@ -1,20 +1,20 @@ import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; -class ServerProviderApiFactorySettings { - ServerProviderApiFactorySettings({ +class ServerProviderSettings { + ServerProviderSettings({ required this.provider, this.location, }); - final ServerProvider provider; + final ServerProviderType provider; final String? location; } -class DnsProviderApiFactorySettings { - DnsProviderApiFactorySettings({ +class DnsProviderFactorySettings { + DnsProviderFactorySettings({ required this.provider, }); - final DnsProvider provider; + final DnsProviderType provider; } diff --git a/lib/logic/providers/providers_controller.dart b/lib/logic/providers/providers_controller.dart new file mode 100644 index 00000000..bd72a59e --- /dev/null +++ b/lib/logic/providers/providers_controller.dart @@ -0,0 +1,20 @@ +import 'package:selfprivacy/logic/providers/provider_settings.dart'; +import 'package:selfprivacy/logic/providers/server_provider.dart'; +import 'package:selfprivacy/logic/providers/server_providers/server_provider_factory.dart'; + +class ProvidersController { + static ServerProvider? get currentServerProvider => _serverProvider; + + static void initServerProvider( + final ServerProviderSettings settings, + ) { + _serverProvider = + ServerProviderFactory.createServerProviderInterface(settings); + } + + static void clearProviders() { + _serverProvider = null; + } + + static ServerProvider? _serverProvider; +} diff --git a/lib/logic/providers/server_provider.dart b/lib/logic/providers/server_provider.dart new file mode 100644 index 00000000..15475715 --- /dev/null +++ b/lib/logic/providers/server_provider.dart @@ -0,0 +1,5 @@ +import 'package:selfprivacy/logic/api_maps/api_generic_result.dart'; + +abstract class ServerProvider { + Future> isApiTokenValid(final String apiToken); +} diff --git a/lib/logic/providers/server_providers/digital_ocean.dart b/lib/logic/providers/server_providers/digital_ocean.dart new file mode 100644 index 00000000..4a26c49e --- /dev/null +++ b/lib/logic/providers/server_providers/digital_ocean.dart @@ -0,0 +1,3 @@ +import 'package:selfprivacy/logic/providers/server_provider.dart'; + +class DigitalOceanServerProvider extends ServerProvider {} diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index e69de29b..2e4ff1e8 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -0,0 +1,3 @@ +import 'package:selfprivacy/logic/providers/server_provider.dart'; + +class HetznerServerProvider extends ServerProvider {} diff --git a/lib/logic/providers/server_providers/server_provider_factory.dart b/lib/logic/providers/server_providers/server_provider_factory.dart index 669ffbd6..2d35ecba 100644 --- a/lib/logic/providers/server_providers/server_provider_factory.dart +++ b/lib/logic/providers/server_providers/server_provider_factory.dart @@ -1,14 +1,25 @@ +import 'package:selfprivacy/logic/providers/provider_settings.dart'; +import 'package:selfprivacy/logic/models/hive/server_details.dart'; +import 'package:selfprivacy/logic/providers/server_provider.dart'; +import 'package:selfprivacy/logic/providers/server_providers/digital_ocean.dart'; +import 'package:selfprivacy/logic/providers/server_providers/hetzner.dart'; + +class UnknownProviderException implements Exception { + UnknownProviderException(this.message); + final String message; +} + class ServerProviderFactory { - static ServerProvider createServerProviderApiFactory( - final ServerProviderApiFactorySettings settings, + static ServerProvider createServerProviderInterface( + final ServerProviderSettings settings, ) { switch (settings.provider) { - case ServerProvider.hetzner: - return HetznerApiFactory(region: settings.location); - case ServerProvider.digitalOcean: - return DigitalOceanApiFactory(region: settings.location); - case ServerProvider.unknown: - throw UnknownApiProviderException('Unknown server provider'); + case ServerProviderType.hetzner: + return HetznerServerProvider(); + case ServerProviderType.digitalOcean: + return DigitalOceanServerProvider(); + case ServerProviderType.unknown: + throw UnknownProviderException('Unknown server provider'); } } } diff --git a/lib/ui/pages/setup/initializing/dns_provider_picker.dart b/lib/ui/pages/setup/initializing/dns_provider_picker.dart index e72d8203..a5917b10 100644 --- a/lib/ui/pages/setup/initializing/dns_provider_picker.dart +++ b/lib/ui/pages/setup/initializing/dns_provider_picker.dart @@ -28,9 +28,9 @@ class DnsProviderPicker extends StatefulWidget { } class _DnsProviderPickerState extends State { - DnsProvider selectedProvider = DnsProvider.unknown; + DnsProviderType selectedProvider = DnsProviderType.unknown; - void setProvider(final DnsProvider provider) { + void setProvider(final DnsProviderType provider) { setState(() { selectedProvider = provider; }); @@ -39,17 +39,17 @@ class _DnsProviderPickerState extends State { @override Widget build(final BuildContext context) { switch (selectedProvider) { - case DnsProvider.unknown: + case DnsProviderType.unknown: return ProviderSelectionPage( serverInstallationCubit: widget.serverInstallationCubit, callback: setProvider, ); - case DnsProvider.cloudflare: + case DnsProviderType.cloudflare: return ProviderInputDataPage( providerCubit: widget.formCubit, providerInfo: ProviderPageInfo( - providerType: DnsProvider.cloudflare, + providerType: DnsProviderType.cloudflare, pathToHow: 'how_cloudflare', image: Image.asset( 'assets/images/logos/cloudflare.png', @@ -58,11 +58,11 @@ class _DnsProviderPickerState extends State { ), ); - case DnsProvider.digitalOcean: + case DnsProviderType.digitalOcean: return ProviderInputDataPage( providerCubit: widget.formCubit, providerInfo: ProviderPageInfo( - providerType: DnsProvider.digitalOcean, + providerType: DnsProviderType.digitalOcean, pathToHow: 'how_digital_ocean_dns', image: Image.asset( 'assets/images/logos/digital_ocean.png', @@ -83,7 +83,7 @@ class ProviderPageInfo { final String pathToHow; final Image image; - final DnsProvider providerType; + final DnsProviderType providerType; } class ProviderInputDataPage extends StatelessWidget { @@ -227,8 +227,8 @@ class ProviderSelectionPage extends StatelessWidget { title: 'basis.select'.tr(), onPressed: () { serverInstallationCubit - .setDnsProviderType(DnsProvider.cloudflare); - callback(DnsProvider.cloudflare); + .setDnsProviderType(DnsProviderType.cloudflare); + callback(DnsProviderType.cloudflare); }, ), // Outlined button that will open website @@ -292,8 +292,8 @@ class ProviderSelectionPage extends StatelessWidget { title: 'basis.select'.tr(), onPressed: () { serverInstallationCubit - .setDnsProviderType(DnsProvider.digitalOcean); - callback(DnsProvider.digitalOcean); + .setDnsProviderType(DnsProviderType.digitalOcean); + callback(DnsProviderType.digitalOcean); }, ), // Outlined button that will open website diff --git a/lib/ui/pages/setup/initializing/server_provider_picker.dart b/lib/ui/pages/setup/initializing/server_provider_picker.dart index a7f551f1..f096a5e1 100644 --- a/lib/ui/pages/setup/initializing/server_provider_picker.dart +++ b/lib/ui/pages/setup/initializing/server_provider_picker.dart @@ -29,9 +29,9 @@ class ServerProviderPicker extends StatefulWidget { } class _ServerProviderPickerState extends State { - ServerProvider selectedProvider = ServerProvider.unknown; + ServerProviderType selectedProvider = ServerProviderType.unknown; - void setProvider(final ServerProvider provider) { + void setProvider(final ServerProviderType provider) { setState(() { selectedProvider = provider; }); @@ -40,17 +40,17 @@ class _ServerProviderPickerState extends State { @override Widget build(final BuildContext context) { switch (selectedProvider) { - case ServerProvider.unknown: + case ServerProviderType.unknown: return ProviderSelectionPage( serverInstallationCubit: widget.serverInstallationCubit, callback: setProvider, ); - case ServerProvider.hetzner: + case ServerProviderType.hetzner: return ProviderInputDataPage( providerCubit: widget.formCubit, providerInfo: ProviderPageInfo( - providerType: ServerProvider.hetzner, + providerType: ServerProviderType.hetzner, pathToHow: 'how_hetzner', image: Image.asset( 'assets/images/logos/hetzner.png', @@ -59,11 +59,11 @@ class _ServerProviderPickerState extends State { ), ); - case ServerProvider.digitalOcean: + case ServerProviderType.digitalOcean: return ProviderInputDataPage( providerCubit: widget.formCubit, providerInfo: ProviderPageInfo( - providerType: ServerProvider.digitalOcean, + providerType: ServerProviderType.digitalOcean, pathToHow: 'how_digital_ocean', image: Image.asset( 'assets/images/logos/digital_ocean.png', @@ -84,7 +84,7 @@ class ProviderPageInfo { final String pathToHow; final Image image; - final ServerProvider providerType; + final ServerProviderType providerType; } class ProviderInputDataPage extends StatelessWidget { @@ -242,8 +242,8 @@ class ProviderSelectionPage extends StatelessWidget { title: 'basis.select'.tr(), onPressed: () { serverInstallationCubit - .setServerProviderType(ServerProvider.hetzner); - callback(ServerProvider.hetzner); + .setServerProviderType(ServerProviderType.hetzner); + callback(ServerProviderType.hetzner); }, ), // Outlined button that will open website @@ -315,9 +315,9 @@ class ProviderSelectionPage extends StatelessWidget { FilledButton( title: 'basis.select'.tr(), onPressed: () { - serverInstallationCubit - .setServerProviderType(ServerProvider.digitalOcean); - callback(ServerProvider.digitalOcean); + serverInstallationCubit.setServerProviderType( + ServerProviderType.digitalOcean); + callback(ServerProviderType.digitalOcean); }, ), // Outlined button that will open website From c1738ec875c22bc3cc0219b00b81ae1864281369 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 6 Feb 2023 13:28:30 +0400 Subject: [PATCH 18/96] chore: Add build runner results --- .../schema/disk_volumes.graphql.dart | 5923 +++++--- .../schema/disk_volumes.graphql.g.dart | 376 - .../graphql_maps/schema/schema.graphql.dart | 1681 ++- .../graphql_maps/schema/schema.graphql.g.dart | 147 - .../schema/server_api.graphql.dart | 11427 +++++++++++----- .../schema/server_api.graphql.g.dart | 849 -- .../schema/server_settings.graphql.dart | 5117 +++++-- .../schema/server_settings.graphql.g.dart | 316 - .../graphql_maps/schema/services.graphql.dart | 6803 ++++++--- .../schema/services.graphql.g.dart | 458 - .../graphql_maps/schema/users.graphql.dart | 6019 +++++--- .../graphql_maps/schema/users.graphql.g.dart | 366 - .../digital_ocean/digital_ocean.dart | 2 +- 13 files changed, 26210 insertions(+), 13274 deletions(-) delete mode 100644 lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.g.dart delete mode 100644 lib/logic/api_maps/graphql_maps/schema/schema.graphql.g.dart delete mode 100644 lib/logic/api_maps/graphql_maps/schema/server_api.graphql.g.dart delete mode 100644 lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.g.dart delete mode 100644 lib/logic/api_maps/graphql_maps/schema/services.graphql.g.dart delete mode 100644 lib/logic/api_maps/graphql_maps/schema/users.graphql.g.dart diff --git a/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart index 2464c561..9ffbfe0b 100644 --- a/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart @@ -1,24 +1,70 @@ import 'dart:async'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; -import 'package:json_annotation/json_annotation.dart'; import 'package:selfprivacy/utils/scalars.dart'; import 'schema.graphql.dart'; import 'services.graphql.dart'; -part 'disk_volumes.graphql.g.dart'; -@JsonSerializable(explicitToJson: true) class Fragment$basicMutationReturnFields { - Fragment$basicMutationReturnFields( - {required this.code, - required this.message, - required this.success, - required this.$__typename}); + Fragment$basicMutationReturnFields({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override factory Fragment$basicMutationReturnFields.fromJson( - Map json) => - _$Fragment$basicMutationReturnFieldsFromJson(json); + Map json) { + switch (json["__typename"] as String) { + case "ApiKeyMutationReturn": + return Fragment$basicMutationReturnFields$$ApiKeyMutationReturn + .fromJson(json); + + case "AutoUpgradeSettingsMutationReturn": + return Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + .fromJson(json); + + case "DeviceApiTokenMutationReturn": + return Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn + .fromJson(json); + + case "GenericJobButationReturn": + return Fragment$basicMutationReturnFields$$GenericJobButationReturn + .fromJson(json); + + case "GenericMutationReturn": + return Fragment$basicMutationReturnFields$$GenericMutationReturn + .fromJson(json); + + case "ServiceJobMutationReturn": + return Fragment$basicMutationReturnFields$$ServiceJobMutationReturn + .fromJson(json); + + case "ServiceMutationReturn": + return Fragment$basicMutationReturnFields$$ServiceMutationReturn + .fromJson(json); + + case "TimezoneMutationReturn": + return Fragment$basicMutationReturnFields$$TimezoneMutationReturn + .fromJson(json); + + case "UserMutationReturn": + return Fragment$basicMutationReturnFields$$UserMutationReturn.fromJson( + json); + + default: + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + } final int code; @@ -26,36 +72,64 @@ class Fragment$basicMutationReturnFields { final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Fragment$basicMutationReturnFieldsToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; - return Object.hashAll([l$code, l$message, l$success, l$$__typename]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Fragment$basicMutationReturnFields) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -64,25 +138,35 @@ extension UtilityExtension$Fragment$basicMutationReturnFields on Fragment$basicMutationReturnFields { CopyWith$Fragment$basicMutationReturnFields< Fragment$basicMutationReturnFields> - get copyWith => - CopyWith$Fragment$basicMutationReturnFields(this, (i) => i); + get copyWith => CopyWith$Fragment$basicMutationReturnFields( + this, + (i) => i, + ); } abstract class CopyWith$Fragment$basicMutationReturnFields { factory CopyWith$Fragment$basicMutationReturnFields( - Fragment$basicMutationReturnFields instance, - TRes Function(Fragment$basicMutationReturnFields) then) = - _CopyWithImpl$Fragment$basicMutationReturnFields; + Fragment$basicMutationReturnFields instance, + TRes Function(Fragment$basicMutationReturnFields) then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields; factory CopyWith$Fragment$basicMutationReturnFields.stub(TRes res) = _CopyWithStubImpl$Fragment$basicMutationReturnFields; - TRes call({int? code, String? message, bool? success, String? $__typename}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); } class _CopyWithImpl$Fragment$basicMutationReturnFields implements CopyWith$Fragment$basicMutationReturnFields { - _CopyWithImpl$Fragment$basicMutationReturnFields(this._instance, this._then); + _CopyWithImpl$Fragment$basicMutationReturnFields( + this._instance, + this._then, + ); final Fragment$basicMutationReturnFields _instance; @@ -90,24 +174,25 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => _then(Fragment$basicMutationReturnFields( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Fragment$basicMutationReturnFields @@ -116,43 +201,54 @@ class _CopyWithStubImpl$Fragment$basicMutationReturnFields TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => _res; } const fragmentDefinitionbasicMutationReturnFields = FragmentDefinitionNode( - name: NameNode(value: 'basicMutationReturnFields'), - typeCondition: TypeConditionNode( - on: NamedTypeNode( - name: NameNode(value: 'MutationReturnInterface'), - isNonNull: false)), - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'code'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'message'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'success'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])); + name: NameNode(value: 'basicMutationReturnFields'), + typeCondition: TypeConditionNode( + on: NamedTypeNode( + name: NameNode(value: 'MutationReturnInterface'), + isNonNull: false, + )), + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'code'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'message'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'success'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), +); const documentNodeFragmentbasicMutationReturnFields = DocumentNode(definitions: [ fragmentDefinitionbasicMutationReturnFields, @@ -160,65 +256,1719 @@ const documentNodeFragmentbasicMutationReturnFields = extension ClientExtension$Fragment$basicMutationReturnFields on graphql.GraphQLClient { - void writeFragment$basicMutationReturnFields( - {required Fragment$basicMutationReturnFields data, - required Map idFields, - bool broadcast = true}) => + void writeFragment$basicMutationReturnFields({ + required Fragment$basicMutationReturnFields data, + required Map idFields, + bool broadcast = true, + }) => this.writeFragment( - graphql.FragmentRequest( - idFields: idFields, - fragment: const graphql.Fragment( - fragmentName: 'basicMutationReturnFields', - document: documentNodeFragmentbasicMutationReturnFields)), - data: data.toJson(), - broadcast: broadcast); - Fragment$basicMutationReturnFields? readFragment$basicMutationReturnFields( - {required Map idFields, bool optimistic = true}) { - final result = this.readFragment( graphql.FragmentRequest( - idFields: idFields, - fragment: const graphql.Fragment( - fragmentName: 'basicMutationReturnFields', - document: documentNodeFragmentbasicMutationReturnFields)), - optimistic: optimistic); + idFields: idFields, + fragment: const graphql.Fragment( + fragmentName: 'basicMutationReturnFields', + document: documentNodeFragmentbasicMutationReturnFields, + ), + ), + data: data.toJson(), + broadcast: broadcast, + ); + Fragment$basicMutationReturnFields? readFragment$basicMutationReturnFields({ + required Map idFields, + bool optimistic = true, + }) { + final result = this.readFragment( + graphql.FragmentRequest( + idFields: idFields, + fragment: const graphql.Fragment( + fragmentName: 'basicMutationReturnFields', + document: documentNodeFragmentbasicMutationReturnFields, + ), + ), + optimistic: optimistic, + ); return result == null ? null : Fragment$basicMutationReturnFields.fromJson(result); } } -@JsonSerializable(explicitToJson: true) -class Query$GetServerDiskVolumes { - Query$GetServerDiskVolumes( - {required this.storage, required this.$__typename}); +class Fragment$basicMutationReturnFields$$ApiKeyMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$ApiKeyMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override - factory Query$GetServerDiskVolumes.fromJson(Map json) => - _$Query$GetServerDiskVolumesFromJson(json); + factory Fragment$basicMutationReturnFields$$ApiKeyMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } - final Query$GetServerDiskVolumes$storage storage; + final int code; + + final String message; + + final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$GetServerDiskVolumesToJson(this); - int get hashCode { - final l$storage = storage; + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; final l$$__typename = $__typename; - return Object.hashAll([l$storage, l$$__typename]); + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Query$GetServerDiskVolumes) || - runtimeType != other.runtimeType) return false; - final l$storage = storage; - final lOther$storage = other.storage; - if (l$storage != lOther$storage) return false; + if (identical(this, other)) { + return true; + } + if (!(other is Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn + on Fragment$basicMutationReturnFields$$ApiKeyMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + Fragment$basicMutationReturnFields$$ApiKeyMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + Fragment$basicMutationReturnFields$$ApiKeyMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$ApiKeyMutationReturn _instance; + + final TRes Function(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + on Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + instance, + TRes Function( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn + on Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn instance, + TRes Function( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn + _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$GenericJobButationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$GenericJobButationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$GenericJobButationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$GenericJobButationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$GenericJobButationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$GenericJobButationReturn + on Fragment$basicMutationReturnFields$$GenericJobButationReturn { + CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + Fragment$basicMutationReturnFields$$GenericJobButationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn( + Fragment$basicMutationReturnFields$$GenericJobButationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$GenericJobButationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$GenericJobButationReturn _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$GenericJobButationReturn) _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$GenericJobButationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$GenericMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$GenericMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$GenericMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$GenericMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Fragment$basicMutationReturnFields$$GenericMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$GenericMutationReturn + on Fragment$basicMutationReturnFields$$GenericMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn< + Fragment$basicMutationReturnFields$$GenericMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn( + Fragment$basicMutationReturnFields$$GenericMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$GenericMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$GenericMutationReturn _instance; + + final TRes Function(Fragment$basicMutationReturnFields$$GenericMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$GenericMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$ServiceJobMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$ServiceJobMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn + on Fragment$basicMutationReturnFields$$ServiceJobMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$ServiceJobMutationReturn _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$ServiceMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$ServiceMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$ServiceMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$ServiceMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Fragment$basicMutationReturnFields$$ServiceMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$ServiceMutationReturn + on Fragment$basicMutationReturnFields$$ServiceMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + Fragment$basicMutationReturnFields$$ServiceMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn( + Fragment$basicMutationReturnFields$$ServiceMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$ServiceMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$ServiceMutationReturn _instance; + + final TRes Function(Fragment$basicMutationReturnFields$$ServiceMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$ServiceMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$TimezoneMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$TimezoneMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$TimezoneMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$TimezoneMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$TimezoneMutationReturn + on Fragment$basicMutationReturnFields$$TimezoneMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + Fragment$basicMutationReturnFields$$TimezoneMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + Fragment$basicMutationReturnFields$$TimezoneMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$TimezoneMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$TimezoneMutationReturn _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$TimezoneMutationReturn) _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$UserMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$UserMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$UserMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$UserMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Fragment$basicMutationReturnFields$$UserMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$UserMutationReturn + on Fragment$basicMutationReturnFields$$UserMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn< + Fragment$basicMutationReturnFields$$UserMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn( + Fragment$basicMutationReturnFields$$UserMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$UserMutationReturn) then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$UserMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$UserMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$UserMutationReturn + implements + CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn { + _CopyWithImpl$Fragment$basicMutationReturnFields$$UserMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$UserMutationReturn _instance; + + final TRes Function(Fragment$basicMutationReturnFields$$UserMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$UserMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$UserMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$UserMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Query$GetServerDiskVolumes { + Query$GetServerDiskVolumes({ + required this.storage, + required this.$__typename, + }); + + factory Query$GetServerDiskVolumes.fromJson(Map json) { + final l$storage = json['storage']; + final l$$__typename = json['__typename']; + return Query$GetServerDiskVolumes( + storage: Query$GetServerDiskVolumes$storage.fromJson( + (l$storage as Map)), + $__typename: (l$$__typename as String), + ); + } + + final Query$GetServerDiskVolumes$storage storage; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$storage = storage; + _resultData['storage'] = l$storage.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$storage = storage; + final l$$__typename = $__typename; + return Object.hashAll([ + l$storage, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Query$GetServerDiskVolumes) || + runtimeType != other.runtimeType) { + return false; + } + final l$storage = storage; + final lOther$storage = other.storage; + if (l$storage != lOther$storage) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -226,25 +1976,34 @@ class Query$GetServerDiskVolumes { extension UtilityExtension$Query$GetServerDiskVolumes on Query$GetServerDiskVolumes { CopyWith$Query$GetServerDiskVolumes - get copyWith => CopyWith$Query$GetServerDiskVolumes(this, (i) => i); + get copyWith => CopyWith$Query$GetServerDiskVolumes( + this, + (i) => i, + ); } abstract class CopyWith$Query$GetServerDiskVolumes { factory CopyWith$Query$GetServerDiskVolumes( - Query$GetServerDiskVolumes instance, - TRes Function(Query$GetServerDiskVolumes) then) = - _CopyWithImpl$Query$GetServerDiskVolumes; + Query$GetServerDiskVolumes instance, + TRes Function(Query$GetServerDiskVolumes) then, + ) = _CopyWithImpl$Query$GetServerDiskVolumes; factory CopyWith$Query$GetServerDiskVolumes.stub(TRes res) = _CopyWithStubImpl$Query$GetServerDiskVolumes; - TRes call({Query$GetServerDiskVolumes$storage? storage, String? $__typename}); + TRes call({ + Query$GetServerDiskVolumes$storage? storage, + String? $__typename, + }); CopyWith$Query$GetServerDiskVolumes$storage get storage; } class _CopyWithImpl$Query$GetServerDiskVolumes implements CopyWith$Query$GetServerDiskVolumes { - _CopyWithImpl$Query$GetServerDiskVolumes(this._instance, this._then); + _CopyWithImpl$Query$GetServerDiskVolumes( + this._instance, + this._then, + ); final Query$GetServerDiskVolumes _instance; @@ -252,14 +2011,18 @@ class _CopyWithImpl$Query$GetServerDiskVolumes static const _undefined = {}; - TRes call({Object? storage = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? storage = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$GetServerDiskVolumes( - storage: storage == _undefined || storage == null - ? _instance.storage - : (storage as Query$GetServerDiskVolumes$storage), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + storage: storage == _undefined || storage == null + ? _instance.storage + : (storage as Query$GetServerDiskVolumes$storage), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Query$GetServerDiskVolumes$storage get storage { final local$storage = _instance.storage; return CopyWith$Query$GetServerDiskVolumes$storage( @@ -273,7 +2036,10 @@ class _CopyWithStubImpl$Query$GetServerDiskVolumes TRes _res; - call({Query$GetServerDiskVolumes$storage? storage, String? $__typename}) => + call({ + Query$GetServerDiskVolumes$storage? storage, + String? $__typename, + }) => _res; CopyWith$Query$GetServerDiskVolumes$storage get storage => CopyWith$Query$GetServerDiskVolumes$storage.stub(_res); @@ -281,163 +2047,188 @@ class _CopyWithStubImpl$Query$GetServerDiskVolumes const documentNodeQueryGetServerDiskVolumes = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'GetServerDiskVolumes'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'storage'), + type: OperationType.query, + name: NameNode(value: 'GetServerDiskVolumes'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'storage'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'volumes'), alias: null, arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ FieldNode( - name: NameNode(value: 'volumes'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'freeSpace'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'model'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'name'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'root'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'serial'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'totalSpace'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'type'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'usages'), + name: NameNode(value: 'freeSpace'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'model'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'name'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'root'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'serial'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'totalSpace'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'type'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'usages'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'title'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'usedSpace'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + InlineFragmentNode( + typeCondition: TypeConditionNode( + on: NamedTypeNode( + name: NameNode(value: 'ServiceStorageUsage'), + isNonNull: false, + )), + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'service'), alias: null, arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ FieldNode( - name: NameNode(value: 'title'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), + name: NameNode(value: 'id'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), FieldNode( - name: NameNode(value: 'usedSpace'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), + name: NameNode(value: 'isMovable'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - InlineFragmentNode( - typeCondition: TypeConditionNode( - on: NamedTypeNode( - name: NameNode( - value: 'ServiceStorageUsage'), - isNonNull: false)), - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'service'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'id'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'isMovable'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'displayName'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ])), - FieldNode( - name: NameNode(value: 'usedSpace'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( + name: NameNode(value: 'displayName'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + ]), + ), FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + name: NameNode(value: 'usedSpace'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), ]); Query$GetServerDiskVolumes _parserFn$Query$GetServerDiskVolumes( Map data) => @@ -445,52 +2236,54 @@ Query$GetServerDiskVolumes _parserFn$Query$GetServerDiskVolumes( class Options$Query$GetServerDiskVolumes extends graphql.QueryOptions { - Options$Query$GetServerDiskVolumes( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - Duration? pollInterval, - graphql.Context? context}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - pollInterval: pollInterval, - context: context, - document: documentNodeQueryGetServerDiskVolumes, - parserFn: _parserFn$Query$GetServerDiskVolumes); + Options$Query$GetServerDiskVolumes({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Duration? pollInterval, + graphql.Context? context, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + pollInterval: pollInterval, + context: context, + document: documentNodeQueryGetServerDiskVolumes, + parserFn: _parserFn$Query$GetServerDiskVolumes, + ); } class WatchOptions$Query$GetServerDiskVolumes extends graphql.WatchQueryOptions { - WatchOptions$Query$GetServerDiskVolumes( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeQueryGetServerDiskVolumes, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Query$GetServerDiskVolumes); + WatchOptions$Query$GetServerDiskVolumes({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeQueryGetServerDiskVolumes, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Query$GetServerDiskVolumes, + ); } class FetchMoreOptions$Query$GetServerDiskVolumes @@ -498,8 +2291,9 @@ class FetchMoreOptions$Query$GetServerDiskVolumes FetchMoreOptions$Query$GetServerDiskVolumes( {required graphql.UpdateQuery updateQuery}) : super( - updateQuery: updateQuery, - document: documentNodeQueryGetServerDiskVolumes); + updateQuery: updateQuery, + document: documentNodeQueryGetServerDiskVolumes, + ); } extension ClientExtension$Query$GetServerDiskVolumes on graphql.GraphQLClient { @@ -511,66 +2305,97 @@ extension ClientExtension$Query$GetServerDiskVolumes on graphql.GraphQLClient { watchQuery$GetServerDiskVolumes( [WatchOptions$Query$GetServerDiskVolumes? options]) => this.watchQuery(options ?? WatchOptions$Query$GetServerDiskVolumes()); - void writeQuery$GetServerDiskVolumes( - {required Query$GetServerDiskVolumes data, bool broadcast = true}) => + void writeQuery$GetServerDiskVolumes({ + required Query$GetServerDiskVolumes data, + bool broadcast = true, + }) => this.writeQuery( - graphql.Request( - operation: graphql.Operation( - document: documentNodeQueryGetServerDiskVolumes)), - data: data.toJson(), - broadcast: broadcast); - Query$GetServerDiskVolumes? readQuery$GetServerDiskVolumes( - {bool optimistic = true}) { - final result = this.readQuery( graphql.Request( operation: graphql.Operation( document: documentNodeQueryGetServerDiskVolumes)), - optimistic: optimistic); + data: data.toJson(), + broadcast: broadcast, + ); + Query$GetServerDiskVolumes? readQuery$GetServerDiskVolumes( + {bool optimistic = true}) { + final result = this.readQuery( + graphql.Request( + operation: graphql.Operation( + document: documentNodeQueryGetServerDiskVolumes)), + optimistic: optimistic, + ); return result == null ? null : Query$GetServerDiskVolumes.fromJson(result); } } -@JsonSerializable(explicitToJson: true) class Query$GetServerDiskVolumes$storage { - Query$GetServerDiskVolumes$storage( - {required this.volumes, required this.$__typename}); + Query$GetServerDiskVolumes$storage({ + required this.volumes, + required this.$__typename, + }); - @override factory Query$GetServerDiskVolumes$storage.fromJson( - Map json) => - _$Query$GetServerDiskVolumes$storageFromJson(json); + Map json) { + final l$volumes = json['volumes']; + final l$$__typename = json['__typename']; + return Query$GetServerDiskVolumes$storage( + volumes: (l$volumes as List) + .map((e) => Query$GetServerDiskVolumes$storage$volumes.fromJson( + (e as Map))) + .toList(), + $__typename: (l$$__typename as String), + ); + } final List volumes; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Query$GetServerDiskVolumes$storageToJson(this); + Map toJson() { + final _resultData = {}; + final l$volumes = volumes; + _resultData['volumes'] = l$volumes.map((e) => e.toJson()).toList(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$volumes = volumes; final l$$__typename = $__typename; - return Object.hashAll( - [Object.hashAll(l$volumes.map((v) => v)), l$$__typename]); + return Object.hashAll([ + Object.hashAll(l$volumes.map((v) => v)), + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$GetServerDiskVolumes$storage) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$volumes = volumes; final lOther$volumes = other.volumes; - if (l$volumes.length != lOther$volumes.length) return false; + if (l$volumes.length != lOther$volumes.length) { + return false; + } for (int i = 0; i < l$volumes.length; i++) { final l$volumes$entry = l$volumes[i]; final lOther$volumes$entry = lOther$volumes[i]; - if (l$volumes$entry != lOther$volumes$entry) return false; + if (l$volumes$entry != lOther$volumes$entry) { + return false; + } } - final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -579,22 +2404,25 @@ extension UtilityExtension$Query$GetServerDiskVolumes$storage on Query$GetServerDiskVolumes$storage { CopyWith$Query$GetServerDiskVolumes$storage< Query$GetServerDiskVolumes$storage> - get copyWith => - CopyWith$Query$GetServerDiskVolumes$storage(this, (i) => i); + get copyWith => CopyWith$Query$GetServerDiskVolumes$storage( + this, + (i) => i, + ); } abstract class CopyWith$Query$GetServerDiskVolumes$storage { factory CopyWith$Query$GetServerDiskVolumes$storage( - Query$GetServerDiskVolumes$storage instance, - TRes Function(Query$GetServerDiskVolumes$storage) then) = - _CopyWithImpl$Query$GetServerDiskVolumes$storage; + Query$GetServerDiskVolumes$storage instance, + TRes Function(Query$GetServerDiskVolumes$storage) then, + ) = _CopyWithImpl$Query$GetServerDiskVolumes$storage; factory CopyWith$Query$GetServerDiskVolumes$storage.stub(TRes res) = _CopyWithStubImpl$Query$GetServerDiskVolumes$storage; - TRes call( - {List? volumes, - String? $__typename}); + TRes call({ + List? volumes, + String? $__typename, + }); TRes volumes( Iterable Function( Iterable< @@ -605,7 +2433,10 @@ abstract class CopyWith$Query$GetServerDiskVolumes$storage { class _CopyWithImpl$Query$GetServerDiskVolumes$storage implements CopyWith$Query$GetServerDiskVolumes$storage { - _CopyWithImpl$Query$GetServerDiskVolumes$storage(this._instance, this._then); + _CopyWithImpl$Query$GetServerDiskVolumes$storage( + this._instance, + this._then, + ); final Query$GetServerDiskVolumes$storage _instance; @@ -613,14 +2444,18 @@ class _CopyWithImpl$Query$GetServerDiskVolumes$storage static const _undefined = {}; - TRes call({Object? volumes = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? volumes = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$GetServerDiskVolumes$storage( - volumes: volumes == _undefined || volumes == null - ? _instance.volumes - : (volumes as List), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + volumes: volumes == _undefined || volumes == null + ? _instance.volumes + : (volumes as List), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); TRes volumes( Iterable Function( Iterable< @@ -628,9 +2463,11 @@ class _CopyWithImpl$Query$GetServerDiskVolumes$storage Query$GetServerDiskVolumes$storage$volumes>>) _fn) => call( - volumes: _fn(_instance.volumes.map((e) => - CopyWith$Query$GetServerDiskVolumes$storage$volumes( - e, (i) => i))).toList()); + volumes: _fn(_instance.volumes + .map((e) => CopyWith$Query$GetServerDiskVolumes$storage$volumes( + e, + (i) => i, + ))).toList()); } class _CopyWithStubImpl$Query$GetServerDiskVolumes$storage @@ -639,31 +2476,57 @@ class _CopyWithStubImpl$Query$GetServerDiskVolumes$storage TRes _res; - call( - {List? volumes, - String? $__typename}) => + call({ + List? volumes, + String? $__typename, + }) => _res; volumes(_fn) => _res; } -@JsonSerializable(explicitToJson: true) class Query$GetServerDiskVolumes$storage$volumes { - Query$GetServerDiskVolumes$storage$volumes( - {required this.freeSpace, - this.model, - required this.name, - required this.root, - this.serial, - required this.totalSpace, - required this.type, - required this.usages, - required this.usedSpace, - required this.$__typename}); + Query$GetServerDiskVolumes$storage$volumes({ + required this.freeSpace, + this.model, + required this.name, + required this.root, + this.serial, + required this.totalSpace, + required this.type, + required this.usages, + required this.usedSpace, + required this.$__typename, + }); - @override factory Query$GetServerDiskVolumes$storage$volumes.fromJson( - Map json) => - _$Query$GetServerDiskVolumes$storage$volumesFromJson(json); + Map json) { + final l$freeSpace = json['freeSpace']; + final l$model = json['model']; + final l$name = json['name']; + final l$root = json['root']; + final l$serial = json['serial']; + final l$totalSpace = json['totalSpace']; + final l$type = json['type']; + final l$usages = json['usages']; + final l$usedSpace = json['usedSpace']; + final l$$__typename = json['__typename']; + return Query$GetServerDiskVolumes$storage$volumes( + freeSpace: (l$freeSpace as String), + model: (l$model as String?), + name: (l$name as String), + root: (l$root as bool), + serial: (l$serial as String?), + totalSpace: (l$totalSpace as String), + type: (l$type as String), + usages: (l$usages as List) + .map((e) => + Query$GetServerDiskVolumes$storage$volumes$usages.fromJson( + (e as Map))) + .toList(), + usedSpace: (l$usedSpace as String), + $__typename: (l$$__typename as String), + ); + } final String freeSpace; @@ -683,11 +2546,34 @@ class Query$GetServerDiskVolumes$storage$volumes { final String usedSpace; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Query$GetServerDiskVolumes$storage$volumesToJson(this); + Map toJson() { + final _resultData = {}; + final l$freeSpace = freeSpace; + _resultData['freeSpace'] = l$freeSpace; + final l$model = model; + _resultData['model'] = l$model; + final l$name = name; + _resultData['name'] = l$name; + final l$root = root; + _resultData['root'] = l$root; + final l$serial = serial; + _resultData['serial'] = l$serial; + final l$totalSpace = totalSpace; + _resultData['totalSpace'] = l$totalSpace; + final l$type = type; + _resultData['type'] = l$type; + final l$usages = usages; + _resultData['usages'] = l$usages.map((e) => e.toJson()).toList(); + final l$usedSpace = usedSpace; + _resultData['usedSpace'] = l$usedSpace; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$freeSpace = freeSpace; final l$model = model; @@ -709,51 +2595,76 @@ class Query$GetServerDiskVolumes$storage$volumes { l$type, Object.hashAll(l$usages.map((v) => v)), l$usedSpace, - l$$__typename + l$$__typename, ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$GetServerDiskVolumes$storage$volumes) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$freeSpace = freeSpace; final lOther$freeSpace = other.freeSpace; - if (l$freeSpace != lOther$freeSpace) return false; + if (l$freeSpace != lOther$freeSpace) { + return false; + } final l$model = model; final lOther$model = other.model; - if (l$model != lOther$model) return false; + if (l$model != lOther$model) { + return false; + } final l$name = name; final lOther$name = other.name; - if (l$name != lOther$name) return false; + if (l$name != lOther$name) { + return false; + } final l$root = root; final lOther$root = other.root; - if (l$root != lOther$root) return false; + if (l$root != lOther$root) { + return false; + } final l$serial = serial; final lOther$serial = other.serial; - if (l$serial != lOther$serial) return false; + if (l$serial != lOther$serial) { + return false; + } final l$totalSpace = totalSpace; final lOther$totalSpace = other.totalSpace; - if (l$totalSpace != lOther$totalSpace) return false; + if (l$totalSpace != lOther$totalSpace) { + return false; + } final l$type = type; final lOther$type = other.type; - if (l$type != lOther$type) return false; + if (l$type != lOther$type) { + return false; + } final l$usages = usages; final lOther$usages = other.usages; - if (l$usages.length != lOther$usages.length) return false; + if (l$usages.length != lOther$usages.length) { + return false; + } for (int i = 0; i < l$usages.length; i++) { final l$usages$entry = l$usages[i]; final lOther$usages$entry = lOther$usages[i]; - if (l$usages$entry != lOther$usages$entry) return false; + if (l$usages$entry != lOther$usages$entry) { + return false; + } } - final l$usedSpace = usedSpace; final lOther$usedSpace = other.usedSpace; - if (l$usedSpace != lOther$usedSpace) return false; + if (l$usedSpace != lOther$usedSpace) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -762,30 +2673,33 @@ extension UtilityExtension$Query$GetServerDiskVolumes$storage$volumes on Query$GetServerDiskVolumes$storage$volumes { CopyWith$Query$GetServerDiskVolumes$storage$volumes< Query$GetServerDiskVolumes$storage$volumes> - get copyWith => - CopyWith$Query$GetServerDiskVolumes$storage$volumes(this, (i) => i); + get copyWith => CopyWith$Query$GetServerDiskVolumes$storage$volumes( + this, + (i) => i, + ); } abstract class CopyWith$Query$GetServerDiskVolumes$storage$volumes { factory CopyWith$Query$GetServerDiskVolumes$storage$volumes( - Query$GetServerDiskVolumes$storage$volumes instance, - TRes Function(Query$GetServerDiskVolumes$storage$volumes) then) = - _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes; + Query$GetServerDiskVolumes$storage$volumes instance, + TRes Function(Query$GetServerDiskVolumes$storage$volumes) then, + ) = _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes; factory CopyWith$Query$GetServerDiskVolumes$storage$volumes.stub(TRes res) = _CopyWithStubImpl$Query$GetServerDiskVolumes$storage$volumes; - TRes call( - {String? freeSpace, - String? model, - String? name, - bool? root, - String? serial, - String? totalSpace, - String? type, - List? usages, - String? usedSpace, - String? $__typename}); + TRes call({ + String? freeSpace, + String? model, + String? name, + bool? root, + String? serial, + String? totalSpace, + String? type, + List? usages, + String? usedSpace, + String? $__typename, + }); TRes usages( Iterable Function( Iterable< @@ -797,7 +2711,9 @@ abstract class CopyWith$Query$GetServerDiskVolumes$storage$volumes { class _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes implements CopyWith$Query$GetServerDiskVolumes$storage$volumes { _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes( - this._instance, this._then); + this._instance, + this._then, + ); final Query$GetServerDiskVolumes$storage$volumes _instance; @@ -805,45 +2721,47 @@ class _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes static const _undefined = {}; - TRes call( - {Object? freeSpace = _undefined, - Object? model = _undefined, - Object? name = _undefined, - Object? root = _undefined, - Object? serial = _undefined, - Object? totalSpace = _undefined, - Object? type = _undefined, - Object? usages = _undefined, - Object? usedSpace = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? freeSpace = _undefined, + Object? model = _undefined, + Object? name = _undefined, + Object? root = _undefined, + Object? serial = _undefined, + Object? totalSpace = _undefined, + Object? type = _undefined, + Object? usages = _undefined, + Object? usedSpace = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$GetServerDiskVolumes$storage$volumes( - freeSpace: freeSpace == _undefined || freeSpace == null - ? _instance.freeSpace - : (freeSpace as String), - model: model == _undefined ? _instance.model : (model as String?), - name: name == _undefined || name == null - ? _instance.name - : (name as String), - root: root == _undefined || root == null - ? _instance.root - : (root as bool), - serial: serial == _undefined ? _instance.serial : (serial as String?), - totalSpace: totalSpace == _undefined || totalSpace == null - ? _instance.totalSpace - : (totalSpace as String), - type: type == _undefined || type == null - ? _instance.type - : (type as String), - usages: usages == _undefined || usages == null - ? _instance.usages - : (usages - as List), - usedSpace: usedSpace == _undefined || usedSpace == null - ? _instance.usedSpace - : (usedSpace as String), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + freeSpace: freeSpace == _undefined || freeSpace == null + ? _instance.freeSpace + : (freeSpace as String), + model: model == _undefined ? _instance.model : (model as String?), + name: name == _undefined || name == null + ? _instance.name + : (name as String), + root: root == _undefined || root == null + ? _instance.root + : (root as bool), + serial: serial == _undefined ? _instance.serial : (serial as String?), + totalSpace: totalSpace == _undefined || totalSpace == null + ? _instance.totalSpace + : (totalSpace as String), + type: type == _undefined || type == null + ? _instance.type + : (type as String), + usages: usages == _undefined || usages == null + ? _instance.usages + : (usages + as List), + usedSpace: usedSpace == _undefined || usedSpace == null + ? _instance.usedSpace + : (usedSpace as String), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); TRes usages( Iterable Function( Iterable< @@ -851,9 +2769,11 @@ class _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes Query$GetServerDiskVolumes$storage$volumes$usages>>) _fn) => call( - usages: _fn(_instance.usages.map((e) => - CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages( - e, (i) => i))).toList()); + usages: _fn(_instance.usages.map( + (e) => CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages( + e, + (i) => i, + ))).toList()); } class _CopyWithStubImpl$Query$GetServerDiskVolumes$storage$volumes @@ -862,38 +2782,45 @@ class _CopyWithStubImpl$Query$GetServerDiskVolumes$storage$volumes TRes _res; - call( - {String? freeSpace, - String? model, - String? name, - bool? root, - String? serial, - String? totalSpace, - String? type, - List? usages, - String? usedSpace, - String? $__typename}) => + call({ + String? freeSpace, + String? model, + String? name, + bool? root, + String? serial, + String? totalSpace, + String? type, + List? usages, + String? usedSpace, + String? $__typename, + }) => _res; usages(_fn) => _res; } -@JsonSerializable(explicitToJson: true) class Query$GetServerDiskVolumes$storage$volumes$usages { - Query$GetServerDiskVolumes$storage$volumes$usages( - {required this.title, - required this.usedSpace, - required this.$__typename}); + Query$GetServerDiskVolumes$storage$volumes$usages({ + required this.title, + required this.usedSpace, + required this.$__typename, + }); - @override factory Query$GetServerDiskVolumes$storage$volumes$usages.fromJson( Map json) { switch (json["__typename"] as String) { case "ServiceStorageUsage": return Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage .fromJson(json); + default: - return _$Query$GetServerDiskVolumes$storage$volumes$usagesFromJson( - json); + final l$title = json['title']; + final l$usedSpace = json['usedSpace']; + final l$$__typename = json['__typename']; + return Query$GetServerDiskVolumes$storage$volumes$usages( + title: (l$title as String), + usedSpace: (l$usedSpace as String), + $__typename: (l$$__typename as String), + ); } } @@ -901,32 +2828,55 @@ class Query$GetServerDiskVolumes$storage$volumes$usages { final String usedSpace; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Query$GetServerDiskVolumes$storage$volumes$usagesToJson(this); + Map toJson() { + final _resultData = {}; + final l$title = title; + _resultData['title'] = l$title; + final l$usedSpace = usedSpace; + _resultData['usedSpace'] = l$usedSpace; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$title = title; final l$usedSpace = usedSpace; final l$$__typename = $__typename; - return Object.hashAll([l$title, l$usedSpace, l$$__typename]); + return Object.hashAll([ + l$title, + l$usedSpace, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$GetServerDiskVolumes$storage$volumes$usages) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$title = title; final lOther$title = other.title; - if (l$title != lOther$title) return false; + if (l$title != lOther$title) { + return false; + } final l$usedSpace = usedSpace; final lOther$usedSpace = other.usedSpace; - if (l$usedSpace != lOther$usedSpace) return false; + if (l$usedSpace != lOther$usedSpace) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -937,29 +2887,36 @@ extension UtilityExtension$Query$GetServerDiskVolumes$storage$volumes$usages Query$GetServerDiskVolumes$storage$volumes$usages> get copyWith => CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages( - this, (i) => i); + this, + (i) => i, + ); } abstract class CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages< TRes> { factory CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages( - Query$GetServerDiskVolumes$storage$volumes$usages instance, - TRes Function(Query$GetServerDiskVolumes$storage$volumes$usages) - then) = - _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes$usages; + Query$GetServerDiskVolumes$storage$volumes$usages instance, + TRes Function(Query$GetServerDiskVolumes$storage$volumes$usages) then, + ) = _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes$usages; factory CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages.stub( TRes res) = _CopyWithStubImpl$Query$GetServerDiskVolumes$storage$volumes$usages; - TRes call({String? title, String? usedSpace, String? $__typename}); + TRes call({ + String? title, + String? usedSpace, + String? $__typename, + }); } class _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes$usages implements CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages { _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes$usages( - this._instance, this._then); + this._instance, + this._then, + ); final Query$GetServerDiskVolumes$storage$volumes$usages _instance; @@ -967,20 +2924,22 @@ class _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes$usages static const _undefined = {}; - TRes call( - {Object? title = _undefined, - Object? usedSpace = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? title = _undefined, + Object? usedSpace = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$GetServerDiskVolumes$storage$volumes$usages( - title: title == _undefined || title == null - ? _instance.title - : (title as String), - usedSpace: usedSpace == _undefined || usedSpace == null - ? _instance.usedSpace - : (usedSpace as String), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + title: title == _undefined || title == null + ? _instance.title + : (title as String), + usedSpace: usedSpace == _undefined || usedSpace == null + ? _instance.usedSpace + : (usedSpace as String), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Query$GetServerDiskVolumes$storage$volumes$usages @@ -991,63 +2950,106 @@ class _CopyWithStubImpl$Query$GetServerDiskVolumes$storage$volumes$usages TRes _res; - call({String? title, String? usedSpace, String? $__typename}) => _res; + call({ + String? title, + String? usedSpace, + String? $__typename, + }) => + _res; } -@JsonSerializable(explicitToJson: true) class Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage implements Query$GetServerDiskVolumes$storage$volumes$usages { - Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage( - {required this.title, - required this.usedSpace, - required this.$__typename, - this.service}); + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage({ + this.service, + required this.$__typename, + required this.title, + required this.usedSpace, + }); - @override factory Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage.fromJson( - Map json) => - _$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsageFromJson( - json); + Map json) { + final l$service = json['service']; + final l$$__typename = json['__typename']; + final l$title = json['title']; + final l$usedSpace = json['usedSpace']; + return Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage( + service: l$service == null + ? null + : Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service + .fromJson((l$service as Map)), + $__typename: (l$$__typename as String), + title: (l$title as String), + usedSpace: (l$usedSpace as String), + ); + } + + final Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service? + service; + + final String $__typename; final String title; final String usedSpace; - @JsonKey(name: '__typename') - final String $__typename; + Map toJson() { + final _resultData = {}; + final l$service = service; + _resultData['service'] = l$service?.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + final l$title = title; + _resultData['title'] = l$title; + final l$usedSpace = usedSpace; + _resultData['usedSpace'] = l$usedSpace; + return _resultData; + } - final Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service? - service; - - Map toJson() => - _$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsageToJson( - this); + @override int get hashCode { + final l$service = service; + final l$$__typename = $__typename; final l$title = title; final l$usedSpace = usedSpace; - final l$$__typename = $__typename; - final l$service = service; - return Object.hashAll([l$title, l$usedSpace, l$$__typename, l$service]); + return Object.hashAll([ + l$service, + l$$__typename, + l$title, + l$usedSpace, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage) || - runtimeType != other.runtimeType) return false; - final l$title = title; - final lOther$title = other.title; - if (l$title != lOther$title) return false; - final l$usedSpace = usedSpace; - final lOther$usedSpace = other.usedSpace; - if (l$usedSpace != lOther$usedSpace) return false; - final l$$__typename = $__typename; - final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + runtimeType != other.runtimeType) { + return false; + } final l$service = service; final lOther$service = other.service; - if (l$service != lOther$service) return false; + if (l$service != lOther$service) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + final l$title = title; + final lOther$title = other.title; + if (l$title != lOther$title) { + return false; + } + final l$usedSpace = usedSpace; + final lOther$usedSpace = other.usedSpace; + if (l$usedSpace != lOther$usedSpace) { + return false; + } return true; } } @@ -1058,29 +3060,32 @@ extension UtilityExtension$Query$GetServerDiskVolumes$storage$volumes$usages$$Se Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage> get copyWith => CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage( - this, (i) => i); + this, + (i) => i, + ); } abstract class CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage< TRes> { factory CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage( - Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage - instance, - TRes Function( - Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage) - then) = - _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage; + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage + instance, + TRes Function( + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage) + then, + ) = _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage; factory CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage.stub( TRes res) = _CopyWithStubImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage; - TRes call( - {String? title, - String? usedSpace, - String? $__typename, - Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service? - service}); + TRes call({ + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service? + service, + String? $__typename, + String? title, + String? usedSpace, + }); CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service< TRes> get service; } @@ -1091,7 +3096,9 @@ class _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceSt CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage< TRes> { _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage( - this._instance, this._then); + this._instance, + this._then, + ); final Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage _instance; @@ -1102,25 +3109,28 @@ class _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceSt static const _undefined = {}; - TRes call( - {Object? title = _undefined, - Object? usedSpace = _undefined, - Object? $__typename = _undefined, - Object? service = _undefined}) => - _then(Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage( - title: title == _undefined || title == null - ? _instance.title - : (title as String), - usedSpace: usedSpace == _undefined || usedSpace == null - ? _instance.usedSpace - : (usedSpace as String), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String), - service: service == _undefined - ? _instance.service - : (service - as Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service?))); + TRes call({ + Object? service = _undefined, + Object? $__typename = _undefined, + Object? title = _undefined, + Object? usedSpace = _undefined, + }) => + _then( + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage( + service: service == _undefined + ? _instance.service + : (service + as Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service?), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + title: title == _undefined || title == null + ? _instance.title + : (title as String), + usedSpace: usedSpace == _undefined || usedSpace == null + ? _instance.usedSpace + : (usedSpace as String), + )); CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service< TRes> get service { final local$service = _instance.service; @@ -1142,12 +3152,13 @@ class _CopyWithStubImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$Servi TRes _res; - call( - {String? title, - String? usedSpace, - String? $__typename, - Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service? - service}) => + call({ + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service? + service, + String? $__typename, + String? title, + String? usedSpace, + }) => _res; CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service< TRes> @@ -1156,19 +3167,27 @@ class _CopyWithStubImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$Servi .stub(_res); } -@JsonSerializable(explicitToJson: true) class Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service { - Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service( - {required this.id, - required this.isMovable, - required this.displayName, - required this.$__typename}); + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service({ + required this.id, + required this.isMovable, + required this.displayName, + required this.$__typename, + }); - @override factory Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service.fromJson( - Map json) => - _$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$serviceFromJson( - json); + Map json) { + final l$id = json['id']; + final l$isMovable = json['isMovable']; + final l$displayName = json['displayName']; + final l$$__typename = json['__typename']; + return Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service( + id: (l$id as String), + isMovable: (l$isMovable as bool), + displayName: (l$displayName as String), + $__typename: (l$$__typename as String), + ); + } final String id; @@ -1176,38 +3195,65 @@ class Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$ser final String displayName; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$serviceToJson( - this); + Map toJson() { + final _resultData = {}; + final l$id = id; + _resultData['id'] = l$id; + final l$isMovable = isMovable; + _resultData['isMovable'] = l$isMovable; + final l$displayName = displayName; + _resultData['displayName'] = l$displayName; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$id = id; final l$isMovable = isMovable; final l$displayName = displayName; final l$$__typename = $__typename; - return Object.hashAll([l$id, l$isMovable, l$displayName, l$$__typename]); + return Object.hashAll([ + l$id, + l$isMovable, + l$displayName, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$id = id; final lOther$id = other.id; - if (l$id != lOther$id) return false; + if (l$id != lOther$id) { + return false; + } final l$isMovable = isMovable; final lOther$isMovable = other.isMovable; - if (l$isMovable != lOther$isMovable) return false; + if (l$isMovable != lOther$isMovable) { + return false; + } final l$displayName = displayName; final lOther$displayName = other.displayName; - if (l$displayName != lOther$displayName) return false; + if (l$displayName != lOther$displayName) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -1218,25 +3264,31 @@ extension UtilityExtension$Query$GetServerDiskVolumes$storage$volumes$usages$$Se Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service> get copyWith => CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service( - this, (i) => i); + this, + (i) => i, + ); } abstract class CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service< TRes> { factory CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service( - Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service - instance, - TRes Function( - Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service) - then) = - _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service; + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service + instance, + TRes Function( + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service) + then, + ) = _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service; factory CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service.stub( TRes res) = _CopyWithStubImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service; - TRes call( - {String? id, bool? isMovable, String? displayName, String? $__typename}); + TRes call({ + String? id, + bool? isMovable, + String? displayName, + String? $__typename, + }); } class _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service< @@ -1245,7 +3297,9 @@ class _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceSt CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service< TRes> { _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service( - this._instance, this._then); + this._instance, + this._then, + ); final Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service _instance; @@ -1256,25 +3310,25 @@ class _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceSt static const _undefined = {}; - TRes call( - {Object? id = _undefined, - Object? isMovable = _undefined, - Object? displayName = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? id = _undefined, + Object? isMovable = _undefined, + Object? displayName = _undefined, + Object? $__typename = _undefined, + }) => _then( Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service( - id: id == _undefined || id == null - ? _instance.id - : (id as String), - isMovable: isMovable == _undefined || isMovable == null - ? _instance.isMovable - : (isMovable as bool), - displayName: displayName == _undefined || displayName == null - ? _instance.displayName - : (displayName as String), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + id: id == _undefined || id == null ? _instance.id : (id as String), + isMovable: isMovable == _undefined || isMovable == null + ? _instance.isMovable + : (isMovable as bool), + displayName: displayName == _undefined || displayName == null + ? _instance.displayName + : (displayName as String), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service< @@ -1287,50 +3341,74 @@ class _CopyWithStubImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$Servi TRes _res; - call( - {String? id, - bool? isMovable, - String? displayName, - String? $__typename}) => + call({ + String? id, + bool? isMovable, + String? displayName, + String? $__typename, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Variables$Mutation$MountVolume { - Variables$Mutation$MountVolume({required this.name}); + factory Variables$Mutation$MountVolume({required String name}) => + Variables$Mutation$MountVolume._({ + r'name': name, + }); + + Variables$Mutation$MountVolume._(this._$data); + + factory Variables$Mutation$MountVolume.fromJson(Map data) { + final result$data = {}; + final l$name = data['name']; + result$data['name'] = (l$name as String); + return Variables$Mutation$MountVolume._(result$data); + } + + Map _$data; + + String get name => (_$data['name'] as String); + Map toJson() { + final result$data = {}; + final l$name = name; + result$data['name'] = l$name; + return result$data; + } + + CopyWith$Variables$Mutation$MountVolume + get copyWith => CopyWith$Variables$Mutation$MountVolume( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$MountVolume) || + runtimeType != other.runtimeType) { + return false; + } + final l$name = name; + final lOther$name = other.name; + if (l$name != lOther$name) { + return false; + } + return true; + } @override - factory Variables$Mutation$MountVolume.fromJson(Map json) => - _$Variables$Mutation$MountVolumeFromJson(json); - - final String name; - - Map toJson() => _$Variables$Mutation$MountVolumeToJson(this); int get hashCode { final l$name = name; return Object.hashAll([l$name]); } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Variables$Mutation$MountVolume) || - runtimeType != other.runtimeType) return false; - final l$name = name; - final lOther$name = other.name; - if (l$name != lOther$name) return false; - return true; - } - - CopyWith$Variables$Mutation$MountVolume - get copyWith => CopyWith$Variables$Mutation$MountVolume(this, (i) => i); } abstract class CopyWith$Variables$Mutation$MountVolume { factory CopyWith$Variables$Mutation$MountVolume( - Variables$Mutation$MountVolume instance, - TRes Function(Variables$Mutation$MountVolume) then) = - _CopyWithImpl$Variables$Mutation$MountVolume; + Variables$Mutation$MountVolume instance, + TRes Function(Variables$Mutation$MountVolume) then, + ) = _CopyWithImpl$Variables$Mutation$MountVolume; factory CopyWith$Variables$Mutation$MountVolume.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$MountVolume; @@ -1340,7 +3418,10 @@ abstract class CopyWith$Variables$Mutation$MountVolume { class _CopyWithImpl$Variables$Mutation$MountVolume implements CopyWith$Variables$Mutation$MountVolume { - _CopyWithImpl$Variables$Mutation$MountVolume(this._instance, this._then); + _CopyWithImpl$Variables$Mutation$MountVolume( + this._instance, + this._then, + ); final Variables$Mutation$MountVolume _instance; @@ -1349,10 +3430,10 @@ class _CopyWithImpl$Variables$Mutation$MountVolume static const _undefined = {}; TRes call({Object? name = _undefined}) => - _then(Variables$Mutation$MountVolume( - name: name == _undefined || name == null - ? _instance.name - : (name as String))); + _then(Variables$Mutation$MountVolume._({ + ..._instance._$data, + if (name != _undefined && name != null) 'name': (name as String), + })); } class _CopyWithStubImpl$Variables$Mutation$MountVolume @@ -1364,62 +3445,97 @@ class _CopyWithStubImpl$Variables$Mutation$MountVolume call({String? name}) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$MountVolume { - Mutation$MountVolume({required this.mountVolume, required this.$__typename}); + Mutation$MountVolume({ + required this.mountVolume, + required this.$__typename, + }); - @override - factory Mutation$MountVolume.fromJson(Map json) => - _$Mutation$MountVolumeFromJson(json); + factory Mutation$MountVolume.fromJson(Map json) { + final l$mountVolume = json['mountVolume']; + final l$$__typename = json['__typename']; + return Mutation$MountVolume( + mountVolume: Mutation$MountVolume$mountVolume.fromJson( + (l$mountVolume as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$MountVolume$mountVolume mountVolume; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$MountVolumeToJson(this); + Map toJson() { + final _resultData = {}; + final l$mountVolume = mountVolume; + _resultData['mountVolume'] = l$mountVolume.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$mountVolume = mountVolume; final l$$__typename = $__typename; - return Object.hashAll([l$mountVolume, l$$__typename]); + return Object.hashAll([ + l$mountVolume, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Mutation$MountVolume) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Mutation$MountVolume) || runtimeType != other.runtimeType) { return false; + } final l$mountVolume = mountVolume; final lOther$mountVolume = other.mountVolume; - if (l$mountVolume != lOther$mountVolume) return false; + if (l$mountVolume != lOther$mountVolume) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Mutation$MountVolume on Mutation$MountVolume { CopyWith$Mutation$MountVolume get copyWith => - CopyWith$Mutation$MountVolume(this, (i) => i); + CopyWith$Mutation$MountVolume( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$MountVolume { - factory CopyWith$Mutation$MountVolume(Mutation$MountVolume instance, - TRes Function(Mutation$MountVolume) then) = - _CopyWithImpl$Mutation$MountVolume; + factory CopyWith$Mutation$MountVolume( + Mutation$MountVolume instance, + TRes Function(Mutation$MountVolume) then, + ) = _CopyWithImpl$Mutation$MountVolume; factory CopyWith$Mutation$MountVolume.stub(TRes res) = _CopyWithStubImpl$Mutation$MountVolume; - TRes call( - {Mutation$MountVolume$mountVolume? mountVolume, String? $__typename}); + TRes call({ + Mutation$MountVolume$mountVolume? mountVolume, + String? $__typename, + }); CopyWith$Mutation$MountVolume$mountVolume get mountVolume; } class _CopyWithImpl$Mutation$MountVolume implements CopyWith$Mutation$MountVolume { - _CopyWithImpl$Mutation$MountVolume(this._instance, this._then); + _CopyWithImpl$Mutation$MountVolume( + this._instance, + this._then, + ); final Mutation$MountVolume _instance; @@ -1427,16 +3543,18 @@ class _CopyWithImpl$Mutation$MountVolume static const _undefined = {}; - TRes call( - {Object? mountVolume = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? mountVolume = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$MountVolume( - mountVolume: mountVolume == _undefined || mountVolume == null - ? _instance.mountVolume - : (mountVolume as Mutation$MountVolume$mountVolume), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + mountVolume: mountVolume == _undefined || mountVolume == null + ? _instance.mountVolume + : (mountVolume as Mutation$MountVolume$mountVolume), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$MountVolume$mountVolume get mountVolume { final local$mountVolume = _instance.mountVolume; return CopyWith$Mutation$MountVolume$mountVolume( @@ -1450,7 +3568,10 @@ class _CopyWithStubImpl$Mutation$MountVolume TRes _res; - call({Mutation$MountVolume$mountVolume? mountVolume, String? $__typename}) => + call({ + Mutation$MountVolume$mountVolume? mountVolume, + String? $__typename, + }) => _res; CopyWith$Mutation$MountVolume$mountVolume get mountVolume => CopyWith$Mutation$MountVolume$mountVolume.stub(_res); @@ -1458,83 +3579,97 @@ class _CopyWithStubImpl$Mutation$MountVolume const documentNodeMutationMountVolume = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'MountVolume'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'name')), - type: - NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'mountVolume'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'name'), - value: VariableNode(name: NameNode(value: 'name'))) - ], + type: OperationType.mutation, + name: NameNode(value: 'MountVolume'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'name')), + type: NamedTypeNode( + name: NameNode(value: 'String'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'mountVolume'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'name'), + value: VariableNode(name: NameNode(value: 'name')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$MountVolume _parserFn$Mutation$MountVolume( Map data) => Mutation$MountVolume.fromJson(data); typedef OnMutationCompleted$Mutation$MountVolume = FutureOr Function( - dynamic, Mutation$MountVolume?); + dynamic, + Mutation$MountVolume?, +); class Options$Mutation$MountVolume extends graphql.MutationOptions { - Options$Mutation$MountVolume( - {String? operationName, - required Variables$Mutation$MountVolume variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$MountVolume? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$MountVolume({ + String? operationName, + required Variables$Mutation$MountVolume variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$MountVolume? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted(data, - data == null ? null : _parserFn$Mutation$MountVolume(data)), - update: update, - onError: onError, - document: documentNodeMutationMountVolume, - parserFn: _parserFn$Mutation$MountVolume); + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( + data, + data == null ? null : _parserFn$Mutation$MountVolume(data), + ), + update: update, + onError: onError, + document: documentNodeMutationMountVolume, + parserFn: _parserFn$Mutation$MountVolume, + ); final OnMutationCompleted$Mutation$MountVolume? onCompletedWithParsed; @@ -1543,38 +3678,39 @@ class Options$Mutation$MountVolume ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$MountVolume extends graphql.WatchQueryOptions { - WatchOptions$Mutation$MountVolume( - {String? operationName, - required Variables$Mutation$MountVolume variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationMountVolume, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$MountVolume); + WatchOptions$Mutation$MountVolume({ + String? operationName, + required Variables$Mutation$MountVolume variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationMountVolume, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$MountVolume, + ); } extension ClientExtension$Mutation$MountVolume on graphql.GraphQLClient { @@ -1586,19 +3722,27 @@ extension ClientExtension$Mutation$MountVolume on graphql.GraphQLClient { this.watchMutation(options); } -@JsonSerializable(explicitToJson: true) class Mutation$MountVolume$mountVolume - implements Fragment$basicMutationReturnFields { - Mutation$MountVolume$mountVolume( - {required this.code, - required this.message, - required this.success, - required this.$__typename}); + implements Fragment$basicMutationReturnFields$$GenericMutationReturn { + Mutation$MountVolume$mountVolume({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override - factory Mutation$MountVolume$mountVolume.fromJson( - Map json) => - _$Mutation$MountVolume$mountVolumeFromJson(json); + factory Mutation$MountVolume$mountVolume.fromJson(Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Mutation$MountVolume$mountVolume( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } final int code; @@ -1606,36 +3750,64 @@ class Mutation$MountVolume$mountVolume final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Mutation$MountVolume$mountVolumeToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; - return Object.hashAll([l$code, l$message, l$success, l$$__typename]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$MountVolume$mountVolume) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -1643,24 +3815,35 @@ class Mutation$MountVolume$mountVolume extension UtilityExtension$Mutation$MountVolume$mountVolume on Mutation$MountVolume$mountVolume { CopyWith$Mutation$MountVolume$mountVolume - get copyWith => CopyWith$Mutation$MountVolume$mountVolume(this, (i) => i); + get copyWith => CopyWith$Mutation$MountVolume$mountVolume( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$MountVolume$mountVolume { factory CopyWith$Mutation$MountVolume$mountVolume( - Mutation$MountVolume$mountVolume instance, - TRes Function(Mutation$MountVolume$mountVolume) then) = - _CopyWithImpl$Mutation$MountVolume$mountVolume; + Mutation$MountVolume$mountVolume instance, + TRes Function(Mutation$MountVolume$mountVolume) then, + ) = _CopyWithImpl$Mutation$MountVolume$mountVolume; factory CopyWith$Mutation$MountVolume$mountVolume.stub(TRes res) = _CopyWithStubImpl$Mutation$MountVolume$mountVolume; - TRes call({int? code, String? message, bool? success, String? $__typename}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); } class _CopyWithImpl$Mutation$MountVolume$mountVolume implements CopyWith$Mutation$MountVolume$mountVolume { - _CopyWithImpl$Mutation$MountVolume$mountVolume(this._instance, this._then); + _CopyWithImpl$Mutation$MountVolume$mountVolume( + this._instance, + this._then, + ); final Mutation$MountVolume$mountVolume _instance; @@ -1668,24 +3851,25 @@ class _CopyWithImpl$Mutation$MountVolume$mountVolume static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$MountVolume$mountVolume( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Mutation$MountVolume$mountVolume @@ -1694,47 +3878,74 @@ class _CopyWithStubImpl$Mutation$MountVolume$mountVolume TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Variables$Mutation$ResizeVolume { - Variables$Mutation$ResizeVolume({required this.name}); + factory Variables$Mutation$ResizeVolume({required String name}) => + Variables$Mutation$ResizeVolume._({ + r'name': name, + }); + + Variables$Mutation$ResizeVolume._(this._$data); + + factory Variables$Mutation$ResizeVolume.fromJson(Map data) { + final result$data = {}; + final l$name = data['name']; + result$data['name'] = (l$name as String); + return Variables$Mutation$ResizeVolume._(result$data); + } + + Map _$data; + + String get name => (_$data['name'] as String); + Map toJson() { + final result$data = {}; + final l$name = name; + result$data['name'] = l$name; + return result$data; + } + + CopyWith$Variables$Mutation$ResizeVolume + get copyWith => CopyWith$Variables$Mutation$ResizeVolume( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$ResizeVolume) || + runtimeType != other.runtimeType) { + return false; + } + final l$name = name; + final lOther$name = other.name; + if (l$name != lOther$name) { + return false; + } + return true; + } @override - factory Variables$Mutation$ResizeVolume.fromJson(Map json) => - _$Variables$Mutation$ResizeVolumeFromJson(json); - - final String name; - - Map toJson() => - _$Variables$Mutation$ResizeVolumeToJson(this); int get hashCode { final l$name = name; return Object.hashAll([l$name]); } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Variables$Mutation$ResizeVolume) || - runtimeType != other.runtimeType) return false; - final l$name = name; - final lOther$name = other.name; - if (l$name != lOther$name) return false; - return true; - } - - CopyWith$Variables$Mutation$ResizeVolume - get copyWith => CopyWith$Variables$Mutation$ResizeVolume(this, (i) => i); } abstract class CopyWith$Variables$Mutation$ResizeVolume { factory CopyWith$Variables$Mutation$ResizeVolume( - Variables$Mutation$ResizeVolume instance, - TRes Function(Variables$Mutation$ResizeVolume) then) = - _CopyWithImpl$Variables$Mutation$ResizeVolume; + Variables$Mutation$ResizeVolume instance, + TRes Function(Variables$Mutation$ResizeVolume) then, + ) = _CopyWithImpl$Variables$Mutation$ResizeVolume; factory CopyWith$Variables$Mutation$ResizeVolume.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$ResizeVolume; @@ -1744,7 +3955,10 @@ abstract class CopyWith$Variables$Mutation$ResizeVolume { class _CopyWithImpl$Variables$Mutation$ResizeVolume implements CopyWith$Variables$Mutation$ResizeVolume { - _CopyWithImpl$Variables$Mutation$ResizeVolume(this._instance, this._then); + _CopyWithImpl$Variables$Mutation$ResizeVolume( + this._instance, + this._then, + ); final Variables$Mutation$ResizeVolume _instance; @@ -1753,10 +3967,10 @@ class _CopyWithImpl$Variables$Mutation$ResizeVolume static const _undefined = {}; TRes call({Object? name = _undefined}) => - _then(Variables$Mutation$ResizeVolume( - name: name == _undefined || name == null - ? _instance.name - : (name as String))); + _then(Variables$Mutation$ResizeVolume._({ + ..._instance._$data, + if (name != _undefined && name != null) 'name': (name as String), + })); } class _CopyWithStubImpl$Variables$Mutation$ResizeVolume @@ -1768,63 +3982,97 @@ class _CopyWithStubImpl$Variables$Mutation$ResizeVolume call({String? name}) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$ResizeVolume { - Mutation$ResizeVolume( - {required this.resizeVolume, required this.$__typename}); + Mutation$ResizeVolume({ + required this.resizeVolume, + required this.$__typename, + }); - @override - factory Mutation$ResizeVolume.fromJson(Map json) => - _$Mutation$ResizeVolumeFromJson(json); + factory Mutation$ResizeVolume.fromJson(Map json) { + final l$resizeVolume = json['resizeVolume']; + final l$$__typename = json['__typename']; + return Mutation$ResizeVolume( + resizeVolume: Mutation$ResizeVolume$resizeVolume.fromJson( + (l$resizeVolume as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$ResizeVolume$resizeVolume resizeVolume; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$ResizeVolumeToJson(this); + Map toJson() { + final _resultData = {}; + final l$resizeVolume = resizeVolume; + _resultData['resizeVolume'] = l$resizeVolume.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$resizeVolume = resizeVolume; final l$$__typename = $__typename; - return Object.hashAll([l$resizeVolume, l$$__typename]); + return Object.hashAll([ + l$resizeVolume, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Mutation$ResizeVolume) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Mutation$ResizeVolume) || runtimeType != other.runtimeType) { return false; + } final l$resizeVolume = resizeVolume; final lOther$resizeVolume = other.resizeVolume; - if (l$resizeVolume != lOther$resizeVolume) return false; + if (l$resizeVolume != lOther$resizeVolume) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Mutation$ResizeVolume on Mutation$ResizeVolume { CopyWith$Mutation$ResizeVolume get copyWith => - CopyWith$Mutation$ResizeVolume(this, (i) => i); + CopyWith$Mutation$ResizeVolume( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$ResizeVolume { - factory CopyWith$Mutation$ResizeVolume(Mutation$ResizeVolume instance, - TRes Function(Mutation$ResizeVolume) then) = - _CopyWithImpl$Mutation$ResizeVolume; + factory CopyWith$Mutation$ResizeVolume( + Mutation$ResizeVolume instance, + TRes Function(Mutation$ResizeVolume) then, + ) = _CopyWithImpl$Mutation$ResizeVolume; factory CopyWith$Mutation$ResizeVolume.stub(TRes res) = _CopyWithStubImpl$Mutation$ResizeVolume; - TRes call( - {Mutation$ResizeVolume$resizeVolume? resizeVolume, String? $__typename}); + TRes call({ + Mutation$ResizeVolume$resizeVolume? resizeVolume, + String? $__typename, + }); CopyWith$Mutation$ResizeVolume$resizeVolume get resizeVolume; } class _CopyWithImpl$Mutation$ResizeVolume implements CopyWith$Mutation$ResizeVolume { - _CopyWithImpl$Mutation$ResizeVolume(this._instance, this._then); + _CopyWithImpl$Mutation$ResizeVolume( + this._instance, + this._then, + ); final Mutation$ResizeVolume _instance; @@ -1832,16 +4080,18 @@ class _CopyWithImpl$Mutation$ResizeVolume static const _undefined = {}; - TRes call( - {Object? resizeVolume = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? resizeVolume = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$ResizeVolume( - resizeVolume: resizeVolume == _undefined || resizeVolume == null - ? _instance.resizeVolume - : (resizeVolume as Mutation$ResizeVolume$resizeVolume), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + resizeVolume: resizeVolume == _undefined || resizeVolume == null + ? _instance.resizeVolume + : (resizeVolume as Mutation$ResizeVolume$resizeVolume), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$ResizeVolume$resizeVolume get resizeVolume { final local$resizeVolume = _instance.resizeVolume; return CopyWith$Mutation$ResizeVolume$resizeVolume( @@ -1855,9 +4105,10 @@ class _CopyWithStubImpl$Mutation$ResizeVolume TRes _res; - call( - {Mutation$ResizeVolume$resizeVolume? resizeVolume, - String? $__typename}) => + call({ + Mutation$ResizeVolume$resizeVolume? resizeVolume, + String? $__typename, + }) => _res; CopyWith$Mutation$ResizeVolume$resizeVolume get resizeVolume => CopyWith$Mutation$ResizeVolume$resizeVolume.stub(_res); @@ -1865,86 +4116,97 @@ class _CopyWithStubImpl$Mutation$ResizeVolume const documentNodeMutationResizeVolume = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'ResizeVolume'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'name')), - type: - NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'resizeVolume'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'name'), - value: VariableNode(name: NameNode(value: 'name'))) - ], + type: OperationType.mutation, + name: NameNode(value: 'ResizeVolume'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'name')), + type: NamedTypeNode( + name: NameNode(value: 'String'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'resizeVolume'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'name'), + value: VariableNode(name: NameNode(value: 'name')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$ResizeVolume _parserFn$Mutation$ResizeVolume( Map data) => Mutation$ResizeVolume.fromJson(data); typedef OnMutationCompleted$Mutation$ResizeVolume = FutureOr Function( - dynamic, Mutation$ResizeVolume?); + dynamic, + Mutation$ResizeVolume?, +); class Options$Mutation$ResizeVolume extends graphql.MutationOptions { - Options$Mutation$ResizeVolume( - {String? operationName, - required Variables$Mutation$ResizeVolume variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$ResizeVolume? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$ResizeVolume({ + String? operationName, + required Variables$Mutation$ResizeVolume variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$ResizeVolume? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( data, - data == null - ? null - : _parserFn$Mutation$ResizeVolume(data)), - update: update, - onError: onError, - document: documentNodeMutationResizeVolume, - parserFn: _parserFn$Mutation$ResizeVolume); + data == null ? null : _parserFn$Mutation$ResizeVolume(data), + ), + update: update, + onError: onError, + document: documentNodeMutationResizeVolume, + parserFn: _parserFn$Mutation$ResizeVolume, + ); final OnMutationCompleted$Mutation$ResizeVolume? onCompletedWithParsed; @@ -1953,38 +4215,39 @@ class Options$Mutation$ResizeVolume ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$ResizeVolume extends graphql.WatchQueryOptions { - WatchOptions$Mutation$ResizeVolume( - {String? operationName, - required Variables$Mutation$ResizeVolume variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationResizeVolume, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$ResizeVolume); + WatchOptions$Mutation$ResizeVolume({ + String? operationName, + required Variables$Mutation$ResizeVolume variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationResizeVolume, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$ResizeVolume, + ); } extension ClientExtension$Mutation$ResizeVolume on graphql.GraphQLClient { @@ -1996,19 +4259,28 @@ extension ClientExtension$Mutation$ResizeVolume on graphql.GraphQLClient { this.watchMutation(options); } -@JsonSerializable(explicitToJson: true) class Mutation$ResizeVolume$resizeVolume - implements Fragment$basicMutationReturnFields { - Mutation$ResizeVolume$resizeVolume( - {required this.code, - required this.message, - required this.success, - required this.$__typename}); + implements Fragment$basicMutationReturnFields$$GenericMutationReturn { + Mutation$ResizeVolume$resizeVolume({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override factory Mutation$ResizeVolume$resizeVolume.fromJson( - Map json) => - _$Mutation$ResizeVolume$resizeVolumeFromJson(json); + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Mutation$ResizeVolume$resizeVolume( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } final int code; @@ -2016,36 +4288,64 @@ class Mutation$ResizeVolume$resizeVolume final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Mutation$ResizeVolume$resizeVolumeToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; - return Object.hashAll([l$code, l$message, l$success, l$$__typename]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$ResizeVolume$resizeVolume) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -2054,25 +4354,35 @@ extension UtilityExtension$Mutation$ResizeVolume$resizeVolume on Mutation$ResizeVolume$resizeVolume { CopyWith$Mutation$ResizeVolume$resizeVolume< Mutation$ResizeVolume$resizeVolume> - get copyWith => - CopyWith$Mutation$ResizeVolume$resizeVolume(this, (i) => i); + get copyWith => CopyWith$Mutation$ResizeVolume$resizeVolume( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$ResizeVolume$resizeVolume { factory CopyWith$Mutation$ResizeVolume$resizeVolume( - Mutation$ResizeVolume$resizeVolume instance, - TRes Function(Mutation$ResizeVolume$resizeVolume) then) = - _CopyWithImpl$Mutation$ResizeVolume$resizeVolume; + Mutation$ResizeVolume$resizeVolume instance, + TRes Function(Mutation$ResizeVolume$resizeVolume) then, + ) = _CopyWithImpl$Mutation$ResizeVolume$resizeVolume; factory CopyWith$Mutation$ResizeVolume$resizeVolume.stub(TRes res) = _CopyWithStubImpl$Mutation$ResizeVolume$resizeVolume; - TRes call({int? code, String? message, bool? success, String? $__typename}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); } class _CopyWithImpl$Mutation$ResizeVolume$resizeVolume implements CopyWith$Mutation$ResizeVolume$resizeVolume { - _CopyWithImpl$Mutation$ResizeVolume$resizeVolume(this._instance, this._then); + _CopyWithImpl$Mutation$ResizeVolume$resizeVolume( + this._instance, + this._then, + ); final Mutation$ResizeVolume$resizeVolume _instance; @@ -2080,24 +4390,25 @@ class _CopyWithImpl$Mutation$ResizeVolume$resizeVolume static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$ResizeVolume$resizeVolume( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Mutation$ResizeVolume$resizeVolume @@ -2106,48 +4417,74 @@ class _CopyWithStubImpl$Mutation$ResizeVolume$resizeVolume TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Variables$Mutation$UnmountVolume { - Variables$Mutation$UnmountVolume({required this.name}); + factory Variables$Mutation$UnmountVolume({required String name}) => + Variables$Mutation$UnmountVolume._({ + r'name': name, + }); + + Variables$Mutation$UnmountVolume._(this._$data); + + factory Variables$Mutation$UnmountVolume.fromJson(Map data) { + final result$data = {}; + final l$name = data['name']; + result$data['name'] = (l$name as String); + return Variables$Mutation$UnmountVolume._(result$data); + } + + Map _$data; + + String get name => (_$data['name'] as String); + Map toJson() { + final result$data = {}; + final l$name = name; + result$data['name'] = l$name; + return result$data; + } + + CopyWith$Variables$Mutation$UnmountVolume + get copyWith => CopyWith$Variables$Mutation$UnmountVolume( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$UnmountVolume) || + runtimeType != other.runtimeType) { + return false; + } + final l$name = name; + final lOther$name = other.name; + if (l$name != lOther$name) { + return false; + } + return true; + } @override - factory Variables$Mutation$UnmountVolume.fromJson( - Map json) => - _$Variables$Mutation$UnmountVolumeFromJson(json); - - final String name; - - Map toJson() => - _$Variables$Mutation$UnmountVolumeToJson(this); int get hashCode { final l$name = name; return Object.hashAll([l$name]); } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Variables$Mutation$UnmountVolume) || - runtimeType != other.runtimeType) return false; - final l$name = name; - final lOther$name = other.name; - if (l$name != lOther$name) return false; - return true; - } - - CopyWith$Variables$Mutation$UnmountVolume - get copyWith => CopyWith$Variables$Mutation$UnmountVolume(this, (i) => i); } abstract class CopyWith$Variables$Mutation$UnmountVolume { factory CopyWith$Variables$Mutation$UnmountVolume( - Variables$Mutation$UnmountVolume instance, - TRes Function(Variables$Mutation$UnmountVolume) then) = - _CopyWithImpl$Variables$Mutation$UnmountVolume; + Variables$Mutation$UnmountVolume instance, + TRes Function(Variables$Mutation$UnmountVolume) then, + ) = _CopyWithImpl$Variables$Mutation$UnmountVolume; factory CopyWith$Variables$Mutation$UnmountVolume.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$UnmountVolume; @@ -2157,7 +4494,10 @@ abstract class CopyWith$Variables$Mutation$UnmountVolume { class _CopyWithImpl$Variables$Mutation$UnmountVolume implements CopyWith$Variables$Mutation$UnmountVolume { - _CopyWithImpl$Variables$Mutation$UnmountVolume(this._instance, this._then); + _CopyWithImpl$Variables$Mutation$UnmountVolume( + this._instance, + this._then, + ); final Variables$Mutation$UnmountVolume _instance; @@ -2166,10 +4506,10 @@ class _CopyWithImpl$Variables$Mutation$UnmountVolume static const _undefined = {}; TRes call({Object? name = _undefined}) => - _then(Variables$Mutation$UnmountVolume( - name: name == _undefined || name == null - ? _instance.name - : (name as String))); + _then(Variables$Mutation$UnmountVolume._({ + ..._instance._$data, + if (name != _undefined && name != null) 'name': (name as String), + })); } class _CopyWithStubImpl$Variables$Mutation$UnmountVolume @@ -2181,64 +4521,98 @@ class _CopyWithStubImpl$Variables$Mutation$UnmountVolume call({String? name}) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$UnmountVolume { - Mutation$UnmountVolume( - {required this.unmountVolume, required this.$__typename}); + Mutation$UnmountVolume({ + required this.unmountVolume, + required this.$__typename, + }); - @override - factory Mutation$UnmountVolume.fromJson(Map json) => - _$Mutation$UnmountVolumeFromJson(json); + factory Mutation$UnmountVolume.fromJson(Map json) { + final l$unmountVolume = json['unmountVolume']; + final l$$__typename = json['__typename']; + return Mutation$UnmountVolume( + unmountVolume: Mutation$UnmountVolume$unmountVolume.fromJson( + (l$unmountVolume as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$UnmountVolume$unmountVolume unmountVolume; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$UnmountVolumeToJson(this); + Map toJson() { + final _resultData = {}; + final l$unmountVolume = unmountVolume; + _resultData['unmountVolume'] = l$unmountVolume.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$unmountVolume = unmountVolume; final l$$__typename = $__typename; - return Object.hashAll([l$unmountVolume, l$$__typename]); + return Object.hashAll([ + l$unmountVolume, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Mutation$UnmountVolume) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Mutation$UnmountVolume) || + runtimeType != other.runtimeType) { return false; + } final l$unmountVolume = unmountVolume; final lOther$unmountVolume = other.unmountVolume; - if (l$unmountVolume != lOther$unmountVolume) return false; + if (l$unmountVolume != lOther$unmountVolume) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Mutation$UnmountVolume on Mutation$UnmountVolume { CopyWith$Mutation$UnmountVolume get copyWith => - CopyWith$Mutation$UnmountVolume(this, (i) => i); + CopyWith$Mutation$UnmountVolume( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$UnmountVolume { - factory CopyWith$Mutation$UnmountVolume(Mutation$UnmountVolume instance, - TRes Function(Mutation$UnmountVolume) then) = - _CopyWithImpl$Mutation$UnmountVolume; + factory CopyWith$Mutation$UnmountVolume( + Mutation$UnmountVolume instance, + TRes Function(Mutation$UnmountVolume) then, + ) = _CopyWithImpl$Mutation$UnmountVolume; factory CopyWith$Mutation$UnmountVolume.stub(TRes res) = _CopyWithStubImpl$Mutation$UnmountVolume; - TRes call( - {Mutation$UnmountVolume$unmountVolume? unmountVolume, - String? $__typename}); + TRes call({ + Mutation$UnmountVolume$unmountVolume? unmountVolume, + String? $__typename, + }); CopyWith$Mutation$UnmountVolume$unmountVolume get unmountVolume; } class _CopyWithImpl$Mutation$UnmountVolume implements CopyWith$Mutation$UnmountVolume { - _CopyWithImpl$Mutation$UnmountVolume(this._instance, this._then); + _CopyWithImpl$Mutation$UnmountVolume( + this._instance, + this._then, + ); final Mutation$UnmountVolume _instance; @@ -2246,16 +4620,18 @@ class _CopyWithImpl$Mutation$UnmountVolume static const _undefined = {}; - TRes call( - {Object? unmountVolume = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? unmountVolume = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$UnmountVolume( - unmountVolume: unmountVolume == _undefined || unmountVolume == null - ? _instance.unmountVolume - : (unmountVolume as Mutation$UnmountVolume$unmountVolume), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + unmountVolume: unmountVolume == _undefined || unmountVolume == null + ? _instance.unmountVolume + : (unmountVolume as Mutation$UnmountVolume$unmountVolume), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$UnmountVolume$unmountVolume get unmountVolume { final local$unmountVolume = _instance.unmountVolume; return CopyWith$Mutation$UnmountVolume$unmountVolume( @@ -2269,9 +4645,10 @@ class _CopyWithStubImpl$Mutation$UnmountVolume TRes _res; - call( - {Mutation$UnmountVolume$unmountVolume? unmountVolume, - String? $__typename}) => + call({ + Mutation$UnmountVolume$unmountVolume? unmountVolume, + String? $__typename, + }) => _res; CopyWith$Mutation$UnmountVolume$unmountVolume get unmountVolume => CopyWith$Mutation$UnmountVolume$unmountVolume.stub(_res); @@ -2279,86 +4656,99 @@ class _CopyWithStubImpl$Mutation$UnmountVolume const documentNodeMutationUnmountVolume = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'UnmountVolume'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'name')), - type: - NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'unmountVolume'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'name'), - value: VariableNode(name: NameNode(value: 'name'))) - ], + type: OperationType.mutation, + name: NameNode(value: 'UnmountVolume'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'name')), + type: NamedTypeNode( + name: NameNode(value: 'String'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'unmountVolume'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'name'), + value: VariableNode(name: NameNode(value: 'name')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$UnmountVolume _parserFn$Mutation$UnmountVolume( Map data) => Mutation$UnmountVolume.fromJson(data); typedef OnMutationCompleted$Mutation$UnmountVolume = FutureOr Function( - dynamic, Mutation$UnmountVolume?); + dynamic, + Mutation$UnmountVolume?, +); class Options$Mutation$UnmountVolume extends graphql.MutationOptions { - Options$Mutation$UnmountVolume( - {String? operationName, - required Variables$Mutation$UnmountVolume variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$UnmountVolume? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$UnmountVolume({ + String? operationName, + required Variables$Mutation$UnmountVolume variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$UnmountVolume? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( data, data == null ? null - : _parserFn$Mutation$UnmountVolume(data)), - update: update, - onError: onError, - document: documentNodeMutationUnmountVolume, - parserFn: _parserFn$Mutation$UnmountVolume); + : _parserFn$Mutation$UnmountVolume(data), + ), + update: update, + onError: onError, + document: documentNodeMutationUnmountVolume, + parserFn: _parserFn$Mutation$UnmountVolume, + ); final OnMutationCompleted$Mutation$UnmountVolume? onCompletedWithParsed; @@ -2367,38 +4757,39 @@ class Options$Mutation$UnmountVolume ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$UnmountVolume extends graphql.WatchQueryOptions { - WatchOptions$Mutation$UnmountVolume( - {String? operationName, - required Variables$Mutation$UnmountVolume variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationUnmountVolume, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$UnmountVolume); + WatchOptions$Mutation$UnmountVolume({ + String? operationName, + required Variables$Mutation$UnmountVolume variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationUnmountVolume, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$UnmountVolume, + ); } extension ClientExtension$Mutation$UnmountVolume on graphql.GraphQLClient { @@ -2410,19 +4801,28 @@ extension ClientExtension$Mutation$UnmountVolume on graphql.GraphQLClient { this.watchMutation(options); } -@JsonSerializable(explicitToJson: true) class Mutation$UnmountVolume$unmountVolume - implements Fragment$basicMutationReturnFields { - Mutation$UnmountVolume$unmountVolume( - {required this.code, - required this.message, - required this.success, - required this.$__typename}); + implements Fragment$basicMutationReturnFields$$GenericMutationReturn { + Mutation$UnmountVolume$unmountVolume({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override factory Mutation$UnmountVolume$unmountVolume.fromJson( - Map json) => - _$Mutation$UnmountVolume$unmountVolumeFromJson(json); + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Mutation$UnmountVolume$unmountVolume( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } final int code; @@ -2430,36 +4830,64 @@ class Mutation$UnmountVolume$unmountVolume final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Mutation$UnmountVolume$unmountVolumeToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; - return Object.hashAll([l$code, l$message, l$success, l$$__typename]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$UnmountVolume$unmountVolume) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -2468,26 +4896,35 @@ extension UtilityExtension$Mutation$UnmountVolume$unmountVolume on Mutation$UnmountVolume$unmountVolume { CopyWith$Mutation$UnmountVolume$unmountVolume< Mutation$UnmountVolume$unmountVolume> - get copyWith => - CopyWith$Mutation$UnmountVolume$unmountVolume(this, (i) => i); + get copyWith => CopyWith$Mutation$UnmountVolume$unmountVolume( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$UnmountVolume$unmountVolume { factory CopyWith$Mutation$UnmountVolume$unmountVolume( - Mutation$UnmountVolume$unmountVolume instance, - TRes Function(Mutation$UnmountVolume$unmountVolume) then) = - _CopyWithImpl$Mutation$UnmountVolume$unmountVolume; + Mutation$UnmountVolume$unmountVolume instance, + TRes Function(Mutation$UnmountVolume$unmountVolume) then, + ) = _CopyWithImpl$Mutation$UnmountVolume$unmountVolume; factory CopyWith$Mutation$UnmountVolume$unmountVolume.stub(TRes res) = _CopyWithStubImpl$Mutation$UnmountVolume$unmountVolume; - TRes call({int? code, String? message, bool? success, String? $__typename}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); } class _CopyWithImpl$Mutation$UnmountVolume$unmountVolume implements CopyWith$Mutation$UnmountVolume$unmountVolume { _CopyWithImpl$Mutation$UnmountVolume$unmountVolume( - this._instance, this._then); + this._instance, + this._then, + ); final Mutation$UnmountVolume$unmountVolume _instance; @@ -2495,24 +4932,25 @@ class _CopyWithImpl$Mutation$UnmountVolume$unmountVolume static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$UnmountVolume$unmountVolume( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Mutation$UnmountVolume$unmountVolume @@ -2521,49 +4959,78 @@ class _CopyWithStubImpl$Mutation$UnmountVolume$unmountVolume TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Variables$Mutation$MigrateToBinds { - Variables$Mutation$MigrateToBinds({required this.input}); + factory Variables$Mutation$MigrateToBinds( + {required Input$MigrateToBindsInput input}) => + Variables$Mutation$MigrateToBinds._({ + r'input': input, + }); + + Variables$Mutation$MigrateToBinds._(this._$data); + + factory Variables$Mutation$MigrateToBinds.fromJson( + Map data) { + final result$data = {}; + final l$input = data['input']; + result$data['input'] = + Input$MigrateToBindsInput.fromJson((l$input as Map)); + return Variables$Mutation$MigrateToBinds._(result$data); + } + + Map _$data; + + Input$MigrateToBindsInput get input => + (_$data['input'] as Input$MigrateToBindsInput); + Map toJson() { + final result$data = {}; + final l$input = input; + result$data['input'] = l$input.toJson(); + return result$data; + } + + CopyWith$Variables$Mutation$MigrateToBinds + get copyWith => CopyWith$Variables$Mutation$MigrateToBinds( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$MigrateToBinds) || + runtimeType != other.runtimeType) { + return false; + } + final l$input = input; + final lOther$input = other.input; + if (l$input != lOther$input) { + return false; + } + return true; + } @override - factory Variables$Mutation$MigrateToBinds.fromJson( - Map json) => - _$Variables$Mutation$MigrateToBindsFromJson(json); - - final Input$MigrateToBindsInput input; - - Map toJson() => - _$Variables$Mutation$MigrateToBindsToJson(this); int get hashCode { final l$input = input; return Object.hashAll([l$input]); } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Variables$Mutation$MigrateToBinds) || - runtimeType != other.runtimeType) return false; - final l$input = input; - final lOther$input = other.input; - if (l$input != lOther$input) return false; - return true; - } - - CopyWith$Variables$Mutation$MigrateToBinds - get copyWith => - CopyWith$Variables$Mutation$MigrateToBinds(this, (i) => i); } abstract class CopyWith$Variables$Mutation$MigrateToBinds { factory CopyWith$Variables$Mutation$MigrateToBinds( - Variables$Mutation$MigrateToBinds instance, - TRes Function(Variables$Mutation$MigrateToBinds) then) = - _CopyWithImpl$Variables$Mutation$MigrateToBinds; + Variables$Mutation$MigrateToBinds instance, + TRes Function(Variables$Mutation$MigrateToBinds) then, + ) = _CopyWithImpl$Variables$Mutation$MigrateToBinds; factory CopyWith$Variables$Mutation$MigrateToBinds.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$MigrateToBinds; @@ -2573,7 +5040,10 @@ abstract class CopyWith$Variables$Mutation$MigrateToBinds { class _CopyWithImpl$Variables$Mutation$MigrateToBinds implements CopyWith$Variables$Mutation$MigrateToBinds { - _CopyWithImpl$Variables$Mutation$MigrateToBinds(this._instance, this._then); + _CopyWithImpl$Variables$Mutation$MigrateToBinds( + this._instance, + this._then, + ); final Variables$Mutation$MigrateToBinds _instance; @@ -2582,10 +5052,11 @@ class _CopyWithImpl$Variables$Mutation$MigrateToBinds static const _undefined = {}; TRes call({Object? input = _undefined}) => - _then(Variables$Mutation$MigrateToBinds( - input: input == _undefined || input == null - ? _instance.input - : (input as Input$MigrateToBindsInput))); + _then(Variables$Mutation$MigrateToBinds._({ + ..._instance._$data, + if (input != _undefined && input != null) + 'input': (input as Input$MigrateToBindsInput), + })); } class _CopyWithStubImpl$Variables$Mutation$MigrateToBinds @@ -2597,64 +5068,98 @@ class _CopyWithStubImpl$Variables$Mutation$MigrateToBinds call({Input$MigrateToBindsInput? input}) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$MigrateToBinds { - Mutation$MigrateToBinds( - {required this.migrateToBinds, required this.$__typename}); + Mutation$MigrateToBinds({ + required this.migrateToBinds, + required this.$__typename, + }); - @override - factory Mutation$MigrateToBinds.fromJson(Map json) => - _$Mutation$MigrateToBindsFromJson(json); + factory Mutation$MigrateToBinds.fromJson(Map json) { + final l$migrateToBinds = json['migrateToBinds']; + final l$$__typename = json['__typename']; + return Mutation$MigrateToBinds( + migrateToBinds: Mutation$MigrateToBinds$migrateToBinds.fromJson( + (l$migrateToBinds as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$MigrateToBinds$migrateToBinds migrateToBinds; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$MigrateToBindsToJson(this); + Map toJson() { + final _resultData = {}; + final l$migrateToBinds = migrateToBinds; + _resultData['migrateToBinds'] = l$migrateToBinds.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$migrateToBinds = migrateToBinds; final l$$__typename = $__typename; - return Object.hashAll([l$migrateToBinds, l$$__typename]); + return Object.hashAll([ + l$migrateToBinds, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Mutation$MigrateToBinds) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Mutation$MigrateToBinds) || + runtimeType != other.runtimeType) { return false; + } final l$migrateToBinds = migrateToBinds; final lOther$migrateToBinds = other.migrateToBinds; - if (l$migrateToBinds != lOther$migrateToBinds) return false; + if (l$migrateToBinds != lOther$migrateToBinds) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Mutation$MigrateToBinds on Mutation$MigrateToBinds { CopyWith$Mutation$MigrateToBinds get copyWith => - CopyWith$Mutation$MigrateToBinds(this, (i) => i); + CopyWith$Mutation$MigrateToBinds( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$MigrateToBinds { - factory CopyWith$Mutation$MigrateToBinds(Mutation$MigrateToBinds instance, - TRes Function(Mutation$MigrateToBinds) then) = - _CopyWithImpl$Mutation$MigrateToBinds; + factory CopyWith$Mutation$MigrateToBinds( + Mutation$MigrateToBinds instance, + TRes Function(Mutation$MigrateToBinds) then, + ) = _CopyWithImpl$Mutation$MigrateToBinds; factory CopyWith$Mutation$MigrateToBinds.stub(TRes res) = _CopyWithStubImpl$Mutation$MigrateToBinds; - TRes call( - {Mutation$MigrateToBinds$migrateToBinds? migrateToBinds, - String? $__typename}); + TRes call({ + Mutation$MigrateToBinds$migrateToBinds? migrateToBinds, + String? $__typename, + }); CopyWith$Mutation$MigrateToBinds$migrateToBinds get migrateToBinds; } class _CopyWithImpl$Mutation$MigrateToBinds implements CopyWith$Mutation$MigrateToBinds { - _CopyWithImpl$Mutation$MigrateToBinds(this._instance, this._then); + _CopyWithImpl$Mutation$MigrateToBinds( + this._instance, + this._then, + ); final Mutation$MigrateToBinds _instance; @@ -2662,16 +5167,18 @@ class _CopyWithImpl$Mutation$MigrateToBinds static const _undefined = {}; - TRes call( - {Object? migrateToBinds = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? migrateToBinds = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$MigrateToBinds( - migrateToBinds: migrateToBinds == _undefined || migrateToBinds == null - ? _instance.migrateToBinds - : (migrateToBinds as Mutation$MigrateToBinds$migrateToBinds), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + migrateToBinds: migrateToBinds == _undefined || migrateToBinds == null + ? _instance.migrateToBinds + : (migrateToBinds as Mutation$MigrateToBinds$migrateToBinds), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$MigrateToBinds$migrateToBinds get migrateToBinds { final local$migrateToBinds = _instance.migrateToBinds; return CopyWith$Mutation$MigrateToBinds$migrateToBinds( @@ -2685,9 +5192,10 @@ class _CopyWithStubImpl$Mutation$MigrateToBinds TRes _res; - call( - {Mutation$MigrateToBinds$migrateToBinds? migrateToBinds, - String? $__typename}) => + call({ + Mutation$MigrateToBinds$migrateToBinds? migrateToBinds, + String? $__typename, + }) => _res; CopyWith$Mutation$MigrateToBinds$migrateToBinds get migrateToBinds => CopyWith$Mutation$MigrateToBinds$migrateToBinds.stub(_res); @@ -2695,165 +5203,191 @@ class _CopyWithStubImpl$Mutation$MigrateToBinds const documentNodeMutationMigrateToBinds = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'MigrateToBinds'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'input')), - type: NamedTypeNode( - name: NameNode(value: 'MigrateToBindsInput'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'migrateToBinds'), + type: OperationType.mutation, + name: NameNode(value: 'MigrateToBinds'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'input')), + type: NamedTypeNode( + name: NameNode(value: 'MigrateToBindsInput'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'migrateToBinds'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'input'), + value: VariableNode(name: NameNode(value: 'input')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: [], + ), + FieldNode( + name: NameNode(value: 'job'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'input'), - value: VariableNode(name: NameNode(value: 'input'))) - ], + arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), FieldNode( - name: NameNode(value: 'job'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'createdAt'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'description'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'error'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'finishedAt'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'name'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'progress'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'result'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'status'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'statusText'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'uid'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'updatedAt'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), + name: NameNode(value: 'createdAt'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + name: NameNode(value: 'description'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'error'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'finishedAt'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'name'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'progress'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'result'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'status'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'statusText'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'uid'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'updatedAt'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$MigrateToBinds _parserFn$Mutation$MigrateToBinds( Map data) => Mutation$MigrateToBinds.fromJson(data); typedef OnMutationCompleted$Mutation$MigrateToBinds = FutureOr Function( - dynamic, Mutation$MigrateToBinds?); + dynamic, + Mutation$MigrateToBinds?, +); class Options$Mutation$MigrateToBinds extends graphql.MutationOptions { - Options$Mutation$MigrateToBinds( - {String? operationName, - required Variables$Mutation$MigrateToBinds variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$MigrateToBinds? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$MigrateToBinds({ + String? operationName, + required Variables$Mutation$MigrateToBinds variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$MigrateToBinds? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( data, data == null ? null - : _parserFn$Mutation$MigrateToBinds(data)), - update: update, - onError: onError, - document: documentNodeMutationMigrateToBinds, - parserFn: _parserFn$Mutation$MigrateToBinds); + : _parserFn$Mutation$MigrateToBinds(data), + ), + update: update, + onError: onError, + document: documentNodeMutationMigrateToBinds, + parserFn: _parserFn$Mutation$MigrateToBinds, + ); final OnMutationCompleted$Mutation$MigrateToBinds? onCompletedWithParsed; @@ -2862,38 +5396,39 @@ class Options$Mutation$MigrateToBinds ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$MigrateToBinds extends graphql.WatchQueryOptions { - WatchOptions$Mutation$MigrateToBinds( - {String? operationName, - required Variables$Mutation$MigrateToBinds variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationMigrateToBinds, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$MigrateToBinds); + WatchOptions$Mutation$MigrateToBinds({ + String? operationName, + required Variables$Mutation$MigrateToBinds variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationMigrateToBinds, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$MigrateToBinds, + ); } extension ClientExtension$Mutation$MigrateToBinds on graphql.GraphQLClient { @@ -2905,20 +5440,34 @@ extension ClientExtension$Mutation$MigrateToBinds on graphql.GraphQLClient { this.watchMutation(options); } -@JsonSerializable(explicitToJson: true) class Mutation$MigrateToBinds$migrateToBinds - implements Fragment$basicMutationReturnFields { - Mutation$MigrateToBinds$migrateToBinds( - {required this.code, - required this.message, - required this.success, - required this.$__typename, - this.job}); + implements Fragment$basicMutationReturnFields$$GenericJobButationReturn { + Mutation$MigrateToBinds$migrateToBinds({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + this.job, + }); - @override factory Mutation$MigrateToBinds$migrateToBinds.fromJson( - Map json) => - _$Mutation$MigrateToBinds$migrateToBindsFromJson(json); + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + final l$job = json['job']; + return Mutation$MigrateToBinds$migrateToBinds( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + job: l$job == null + ? null + : Mutation$MigrateToBinds$migrateToBinds$job.fromJson( + (l$job as Map)), + ); + } final int code; @@ -2926,42 +5475,75 @@ class Mutation$MigrateToBinds$migrateToBinds final bool success; - @JsonKey(name: '__typename') final String $__typename; final Mutation$MigrateToBinds$migrateToBinds$job? job; - Map toJson() => - _$Mutation$MigrateToBinds$migrateToBindsToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + final l$job = job; + _resultData['job'] = l$job?.toJson(); + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; final l$job = job; - return Object.hashAll([l$code, l$message, l$success, l$$__typename, l$job]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + l$job, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$MigrateToBinds$migrateToBinds) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } final l$job = job; final lOther$job = other.job; - if (l$job != lOther$job) return false; + if (l$job != lOther$job) { + return false; + } return true; } } @@ -2970,32 +5552,37 @@ extension UtilityExtension$Mutation$MigrateToBinds$migrateToBinds on Mutation$MigrateToBinds$migrateToBinds { CopyWith$Mutation$MigrateToBinds$migrateToBinds< Mutation$MigrateToBinds$migrateToBinds> - get copyWith => - CopyWith$Mutation$MigrateToBinds$migrateToBinds(this, (i) => i); + get copyWith => CopyWith$Mutation$MigrateToBinds$migrateToBinds( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$MigrateToBinds$migrateToBinds { factory CopyWith$Mutation$MigrateToBinds$migrateToBinds( - Mutation$MigrateToBinds$migrateToBinds instance, - TRes Function(Mutation$MigrateToBinds$migrateToBinds) then) = - _CopyWithImpl$Mutation$MigrateToBinds$migrateToBinds; + Mutation$MigrateToBinds$migrateToBinds instance, + TRes Function(Mutation$MigrateToBinds$migrateToBinds) then, + ) = _CopyWithImpl$Mutation$MigrateToBinds$migrateToBinds; factory CopyWith$Mutation$MigrateToBinds$migrateToBinds.stub(TRes res) = _CopyWithStubImpl$Mutation$MigrateToBinds$migrateToBinds; - TRes call( - {int? code, - String? message, - bool? success, - String? $__typename, - Mutation$MigrateToBinds$migrateToBinds$job? job}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + Mutation$MigrateToBinds$migrateToBinds$job? job, + }); CopyWith$Mutation$MigrateToBinds$migrateToBinds$job get job; } class _CopyWithImpl$Mutation$MigrateToBinds$migrateToBinds implements CopyWith$Mutation$MigrateToBinds$migrateToBinds { _CopyWithImpl$Mutation$MigrateToBinds$migrateToBinds( - this._instance, this._then); + this._instance, + this._then, + ); final Mutation$MigrateToBinds$migrateToBinds _instance; @@ -3003,28 +5590,29 @@ class _CopyWithImpl$Mutation$MigrateToBinds$migrateToBinds static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined, - Object? job = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + Object? job = _undefined, + }) => _then(Mutation$MigrateToBinds$migrateToBinds( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String), - job: job == _undefined - ? _instance.job - : (job as Mutation$MigrateToBinds$migrateToBinds$job?))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + job: job == _undefined + ? _instance.job + : (job as Mutation$MigrateToBinds$migrateToBinds$job?), + )); CopyWith$Mutation$MigrateToBinds$migrateToBinds$job get job { final local$job = _instance.job; return local$job == null @@ -3041,47 +5629,70 @@ class _CopyWithStubImpl$Mutation$MigrateToBinds$migrateToBinds TRes _res; - call( - {int? code, - String? message, - bool? success, - String? $__typename, - Mutation$MigrateToBinds$migrateToBinds$job? job}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + Mutation$MigrateToBinds$migrateToBinds$job? job, + }) => _res; CopyWith$Mutation$MigrateToBinds$migrateToBinds$job get job => CopyWith$Mutation$MigrateToBinds$migrateToBinds$job.stub(_res); } -@JsonSerializable(explicitToJson: true) class Mutation$MigrateToBinds$migrateToBinds$job { - Mutation$MigrateToBinds$migrateToBinds$job( - {required this.createdAt, - required this.description, - this.error, - this.finishedAt, - required this.name, - this.progress, - this.result, - required this.status, - this.statusText, - required this.uid, - required this.updatedAt, - required this.$__typename}); + Mutation$MigrateToBinds$migrateToBinds$job({ + required this.createdAt, + required this.description, + this.error, + this.finishedAt, + required this.name, + this.progress, + this.result, + required this.status, + this.statusText, + required this.uid, + required this.updatedAt, + required this.$__typename, + }); - @override factory Mutation$MigrateToBinds$migrateToBinds$job.fromJson( - Map json) => - _$Mutation$MigrateToBinds$migrateToBinds$jobFromJson(json); + Map json) { + final l$createdAt = json['createdAt']; + final l$description = json['description']; + final l$error = json['error']; + final l$finishedAt = json['finishedAt']; + final l$name = json['name']; + final l$progress = json['progress']; + final l$result = json['result']; + final l$status = json['status']; + final l$statusText = json['statusText']; + final l$uid = json['uid']; + final l$updatedAt = json['updatedAt']; + final l$$__typename = json['__typename']; + return Mutation$MigrateToBinds$migrateToBinds$job( + createdAt: dateTimeFromJson(l$createdAt), + description: (l$description as String), + error: (l$error as String?), + finishedAt: l$finishedAt == null ? null : dateTimeFromJson(l$finishedAt), + name: (l$name as String), + progress: (l$progress as int?), + result: (l$result as String?), + status: (l$status as String), + statusText: (l$statusText as String?), + uid: (l$uid as String), + updatedAt: dateTimeFromJson(l$updatedAt), + $__typename: (l$$__typename as String), + ); + } - @JsonKey(fromJson: dateTimeFromJson, toJson: dateTimeToJson) final DateTime createdAt; final String description; final String? error; - @JsonKey( - fromJson: _nullable$dateTimeFromJson, toJson: _nullable$dateTimeToJson) final DateTime? finishedAt; final String name; @@ -3096,14 +5707,41 @@ class Mutation$MigrateToBinds$migrateToBinds$job { final String uid; - @JsonKey(fromJson: dateTimeFromJson, toJson: dateTimeToJson) final DateTime updatedAt; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Mutation$MigrateToBinds$migrateToBinds$jobToJson(this); + Map toJson() { + final _resultData = {}; + final l$createdAt = createdAt; + _resultData['createdAt'] = dateTimeToJson(l$createdAt); + final l$description = description; + _resultData['description'] = l$description; + final l$error = error; + _resultData['error'] = l$error; + final l$finishedAt = finishedAt; + _resultData['finishedAt'] = + l$finishedAt == null ? null : dateTimeToJson(l$finishedAt); + final l$name = name; + _resultData['name'] = l$name; + final l$progress = progress; + _resultData['progress'] = l$progress; + final l$result = result; + _resultData['result'] = l$result; + final l$status = status; + _resultData['status'] = l$status; + final l$statusText = statusText; + _resultData['statusText'] = l$statusText; + final l$uid = uid; + _resultData['uid'] = l$uid; + final l$updatedAt = updatedAt; + _resultData['updatedAt'] = dateTimeToJson(l$updatedAt); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$createdAt = createdAt; final l$description = description; @@ -3129,51 +5767,79 @@ class Mutation$MigrateToBinds$migrateToBinds$job { l$statusText, l$uid, l$updatedAt, - l$$__typename + l$$__typename, ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$MigrateToBinds$migrateToBinds$job) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$createdAt = createdAt; final lOther$createdAt = other.createdAt; - if (l$createdAt != lOther$createdAt) return false; + if (l$createdAt != lOther$createdAt) { + return false; + } final l$description = description; final lOther$description = other.description; - if (l$description != lOther$description) return false; + if (l$description != lOther$description) { + return false; + } final l$error = error; final lOther$error = other.error; - if (l$error != lOther$error) return false; + if (l$error != lOther$error) { + return false; + } final l$finishedAt = finishedAt; final lOther$finishedAt = other.finishedAt; - if (l$finishedAt != lOther$finishedAt) return false; + if (l$finishedAt != lOther$finishedAt) { + return false; + } final l$name = name; final lOther$name = other.name; - if (l$name != lOther$name) return false; + if (l$name != lOther$name) { + return false; + } final l$progress = progress; final lOther$progress = other.progress; - if (l$progress != lOther$progress) return false; + if (l$progress != lOther$progress) { + return false; + } final l$result = result; final lOther$result = other.result; - if (l$result != lOther$result) return false; + if (l$result != lOther$result) { + return false; + } final l$status = status; final lOther$status = other.status; - if (l$status != lOther$status) return false; + if (l$status != lOther$status) { + return false; + } final l$statusText = statusText; final lOther$statusText = other.statusText; - if (l$statusText != lOther$statusText) return false; + if (l$statusText != lOther$statusText) { + return false; + } final l$uid = uid; final lOther$uid = other.uid; - if (l$uid != lOther$uid) return false; + if (l$uid != lOther$uid) { + return false; + } final l$updatedAt = updatedAt; final lOther$updatedAt = other.updatedAt; - if (l$updatedAt != lOther$updatedAt) return false; + if (l$updatedAt != lOther$updatedAt) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -3182,38 +5848,43 @@ extension UtilityExtension$Mutation$MigrateToBinds$migrateToBinds$job on Mutation$MigrateToBinds$migrateToBinds$job { CopyWith$Mutation$MigrateToBinds$migrateToBinds$job< Mutation$MigrateToBinds$migrateToBinds$job> - get copyWith => - CopyWith$Mutation$MigrateToBinds$migrateToBinds$job(this, (i) => i); + get copyWith => CopyWith$Mutation$MigrateToBinds$migrateToBinds$job( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$MigrateToBinds$migrateToBinds$job { factory CopyWith$Mutation$MigrateToBinds$migrateToBinds$job( - Mutation$MigrateToBinds$migrateToBinds$job instance, - TRes Function(Mutation$MigrateToBinds$migrateToBinds$job) then) = - _CopyWithImpl$Mutation$MigrateToBinds$migrateToBinds$job; + Mutation$MigrateToBinds$migrateToBinds$job instance, + TRes Function(Mutation$MigrateToBinds$migrateToBinds$job) then, + ) = _CopyWithImpl$Mutation$MigrateToBinds$migrateToBinds$job; factory CopyWith$Mutation$MigrateToBinds$migrateToBinds$job.stub(TRes res) = _CopyWithStubImpl$Mutation$MigrateToBinds$migrateToBinds$job; - TRes call( - {DateTime? createdAt, - String? description, - String? error, - DateTime? finishedAt, - String? name, - int? progress, - String? result, - String? status, - String? statusText, - String? uid, - DateTime? updatedAt, - String? $__typename}); + TRes call({ + DateTime? createdAt, + String? description, + String? error, + DateTime? finishedAt, + String? name, + int? progress, + String? result, + String? status, + String? statusText, + String? uid, + DateTime? updatedAt, + String? $__typename, + }); } class _CopyWithImpl$Mutation$MigrateToBinds$migrateToBinds$job implements CopyWith$Mutation$MigrateToBinds$migrateToBinds$job { _CopyWithImpl$Mutation$MigrateToBinds$migrateToBinds$job( - this._instance, this._then); + this._instance, + this._then, + ); final Mutation$MigrateToBinds$migrateToBinds$job _instance; @@ -3221,51 +5892,51 @@ class _CopyWithImpl$Mutation$MigrateToBinds$migrateToBinds$job static const _undefined = {}; - TRes call( - {Object? createdAt = _undefined, - Object? description = _undefined, - Object? error = _undefined, - Object? finishedAt = _undefined, - Object? name = _undefined, - Object? progress = _undefined, - Object? result = _undefined, - Object? status = _undefined, - Object? statusText = _undefined, - Object? uid = _undefined, - Object? updatedAt = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? createdAt = _undefined, + Object? description = _undefined, + Object? error = _undefined, + Object? finishedAt = _undefined, + Object? name = _undefined, + Object? progress = _undefined, + Object? result = _undefined, + Object? status = _undefined, + Object? statusText = _undefined, + Object? uid = _undefined, + Object? updatedAt = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$MigrateToBinds$migrateToBinds$job( - createdAt: createdAt == _undefined || createdAt == null - ? _instance.createdAt - : (createdAt as DateTime), - description: description == _undefined || description == null - ? _instance.description - : (description as String), - error: error == _undefined ? _instance.error : (error as String?), - finishedAt: finishedAt == _undefined - ? _instance.finishedAt - : (finishedAt as DateTime?), - name: name == _undefined || name == null - ? _instance.name - : (name as String), - progress: - progress == _undefined ? _instance.progress : (progress as int?), - result: result == _undefined ? _instance.result : (result as String?), - status: status == _undefined || status == null - ? _instance.status - : (status as String), - statusText: statusText == _undefined - ? _instance.statusText - : (statusText as String?), - uid: uid == _undefined || uid == null - ? _instance.uid - : (uid as String), - updatedAt: updatedAt == _undefined || updatedAt == null - ? _instance.updatedAt - : (updatedAt as DateTime), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + createdAt: createdAt == _undefined || createdAt == null + ? _instance.createdAt + : (createdAt as DateTime), + description: description == _undefined || description == null + ? _instance.description + : (description as String), + error: error == _undefined ? _instance.error : (error as String?), + finishedAt: finishedAt == _undefined + ? _instance.finishedAt + : (finishedAt as DateTime?), + name: name == _undefined || name == null + ? _instance.name + : (name as String), + progress: + progress == _undefined ? _instance.progress : (progress as int?), + result: result == _undefined ? _instance.result : (result as String?), + status: status == _undefined || status == null + ? _instance.status + : (status as String), + statusText: statusText == _undefined + ? _instance.statusText + : (statusText as String?), + uid: uid == _undefined || uid == null ? _instance.uid : (uid as String), + updatedAt: updatedAt == _undefined || updatedAt == null + ? _instance.updatedAt + : (updatedAt as DateTime), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Mutation$MigrateToBinds$migrateToBinds$job @@ -3274,23 +5945,19 @@ class _CopyWithStubImpl$Mutation$MigrateToBinds$migrateToBinds$job TRes _res; - call( - {DateTime? createdAt, - String? description, - String? error, - DateTime? finishedAt, - String? name, - int? progress, - String? result, - String? status, - String? statusText, - String? uid, - DateTime? updatedAt, - String? $__typename}) => + call({ + DateTime? createdAt, + String? description, + String? error, + DateTime? finishedAt, + String? name, + int? progress, + String? result, + String? status, + String? statusText, + String? uid, + DateTime? updatedAt, + String? $__typename, + }) => _res; } - -DateTime? _nullable$dateTimeFromJson(dynamic data) => - data == null ? null : dateTimeFromJson(data); -dynamic _nullable$dateTimeToJson(DateTime? data) => - data == null ? null : dateTimeToJson(data); diff --git a/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.g.dart b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.g.dart deleted file mode 100644 index c1ab4fba..00000000 --- a/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.g.dart +++ /dev/null @@ -1,376 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'disk_volumes.graphql.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -Fragment$basicMutationReturnFields _$Fragment$basicMutationReturnFieldsFromJson( - Map json) => - Fragment$basicMutationReturnFields( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Fragment$basicMutationReturnFieldsToJson( - Fragment$basicMutationReturnFields instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - }; - -Query$GetServerDiskVolumes _$Query$GetServerDiskVolumesFromJson( - Map json) => - Query$GetServerDiskVolumes( - storage: Query$GetServerDiskVolumes$storage.fromJson( - json['storage'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Query$GetServerDiskVolumesToJson( - Query$GetServerDiskVolumes instance) => - { - 'storage': instance.storage.toJson(), - '__typename': instance.$__typename, - }; - -Query$GetServerDiskVolumes$storage _$Query$GetServerDiskVolumes$storageFromJson( - Map json) => - Query$GetServerDiskVolumes$storage( - volumes: (json['volumes'] as List) - .map((e) => Query$GetServerDiskVolumes$storage$volumes.fromJson( - e as Map)) - .toList(), - $__typename: json['__typename'] as String, - ); - -Map _$Query$GetServerDiskVolumes$storageToJson( - Query$GetServerDiskVolumes$storage instance) => - { - 'volumes': instance.volumes.map((e) => e.toJson()).toList(), - '__typename': instance.$__typename, - }; - -Query$GetServerDiskVolumes$storage$volumes - _$Query$GetServerDiskVolumes$storage$volumesFromJson( - Map json) => - Query$GetServerDiskVolumes$storage$volumes( - freeSpace: json['freeSpace'] as String, - model: json['model'] as String?, - name: json['name'] as String, - root: json['root'] as bool, - serial: json['serial'] as String?, - totalSpace: json['totalSpace'] as String, - type: json['type'] as String, - usages: (json['usages'] as List) - .map((e) => - Query$GetServerDiskVolumes$storage$volumes$usages.fromJson( - e as Map)) - .toList(), - usedSpace: json['usedSpace'] as String, - $__typename: json['__typename'] as String, - ); - -Map _$Query$GetServerDiskVolumes$storage$volumesToJson( - Query$GetServerDiskVolumes$storage$volumes instance) => - { - 'freeSpace': instance.freeSpace, - 'model': instance.model, - 'name': instance.name, - 'root': instance.root, - 'serial': instance.serial, - 'totalSpace': instance.totalSpace, - 'type': instance.type, - 'usages': instance.usages.map((e) => e.toJson()).toList(), - 'usedSpace': instance.usedSpace, - '__typename': instance.$__typename, - }; - -Query$GetServerDiskVolumes$storage$volumes$usages - _$Query$GetServerDiskVolumes$storage$volumes$usagesFromJson( - Map json) => - Query$GetServerDiskVolumes$storage$volumes$usages( - title: json['title'] as String, - usedSpace: json['usedSpace'] as String, - $__typename: json['__typename'] as String, - ); - -Map _$Query$GetServerDiskVolumes$storage$volumes$usagesToJson( - Query$GetServerDiskVolumes$storage$volumes$usages instance) => - { - 'title': instance.title, - 'usedSpace': instance.usedSpace, - '__typename': instance.$__typename, - }; - -Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage - _$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsageFromJson( - Map json) => - Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage( - title: json['title'] as String, - usedSpace: json['usedSpace'] as String, - $__typename: json['__typename'] as String, - service: json['service'] == null - ? null - : Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service - .fromJson(json['service'] as Map), - ); - -Map - _$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsageToJson( - Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage - instance) => - { - 'title': instance.title, - 'usedSpace': instance.usedSpace, - '__typename': instance.$__typename, - 'service': instance.service?.toJson(), - }; - -Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service - _$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$serviceFromJson( - Map json) => - Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service( - id: json['id'] as String, - isMovable: json['isMovable'] as bool, - displayName: json['displayName'] as String, - $__typename: json['__typename'] as String, - ); - -Map - _$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$serviceToJson( - Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service - instance) => - { - 'id': instance.id, - 'isMovable': instance.isMovable, - 'displayName': instance.displayName, - '__typename': instance.$__typename, - }; - -Variables$Mutation$MountVolume _$Variables$Mutation$MountVolumeFromJson( - Map json) => - Variables$Mutation$MountVolume( - name: json['name'] as String, - ); - -Map _$Variables$Mutation$MountVolumeToJson( - Variables$Mutation$MountVolume instance) => - { - 'name': instance.name, - }; - -Mutation$MountVolume _$Mutation$MountVolumeFromJson( - Map json) => - Mutation$MountVolume( - mountVolume: Mutation$MountVolume$mountVolume.fromJson( - json['mountVolume'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$MountVolumeToJson( - Mutation$MountVolume instance) => - { - 'mountVolume': instance.mountVolume.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$MountVolume$mountVolume _$Mutation$MountVolume$mountVolumeFromJson( - Map json) => - Mutation$MountVolume$mountVolume( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$MountVolume$mountVolumeToJson( - Mutation$MountVolume$mountVolume instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - }; - -Variables$Mutation$ResizeVolume _$Variables$Mutation$ResizeVolumeFromJson( - Map json) => - Variables$Mutation$ResizeVolume( - name: json['name'] as String, - ); - -Map _$Variables$Mutation$ResizeVolumeToJson( - Variables$Mutation$ResizeVolume instance) => - { - 'name': instance.name, - }; - -Mutation$ResizeVolume _$Mutation$ResizeVolumeFromJson( - Map json) => - Mutation$ResizeVolume( - resizeVolume: Mutation$ResizeVolume$resizeVolume.fromJson( - json['resizeVolume'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$ResizeVolumeToJson( - Mutation$ResizeVolume instance) => - { - 'resizeVolume': instance.resizeVolume.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$ResizeVolume$resizeVolume _$Mutation$ResizeVolume$resizeVolumeFromJson( - Map json) => - Mutation$ResizeVolume$resizeVolume( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$ResizeVolume$resizeVolumeToJson( - Mutation$ResizeVolume$resizeVolume instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - }; - -Variables$Mutation$UnmountVolume _$Variables$Mutation$UnmountVolumeFromJson( - Map json) => - Variables$Mutation$UnmountVolume( - name: json['name'] as String, - ); - -Map _$Variables$Mutation$UnmountVolumeToJson( - Variables$Mutation$UnmountVolume instance) => - { - 'name': instance.name, - }; - -Mutation$UnmountVolume _$Mutation$UnmountVolumeFromJson( - Map json) => - Mutation$UnmountVolume( - unmountVolume: Mutation$UnmountVolume$unmountVolume.fromJson( - json['unmountVolume'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$UnmountVolumeToJson( - Mutation$UnmountVolume instance) => - { - 'unmountVolume': instance.unmountVolume.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$UnmountVolume$unmountVolume - _$Mutation$UnmountVolume$unmountVolumeFromJson(Map json) => - Mutation$UnmountVolume$unmountVolume( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$UnmountVolume$unmountVolumeToJson( - Mutation$UnmountVolume$unmountVolume instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - }; - -Variables$Mutation$MigrateToBinds _$Variables$Mutation$MigrateToBindsFromJson( - Map json) => - Variables$Mutation$MigrateToBinds( - input: Input$MigrateToBindsInput.fromJson( - json['input'] as Map), - ); - -Map _$Variables$Mutation$MigrateToBindsToJson( - Variables$Mutation$MigrateToBinds instance) => - { - 'input': instance.input.toJson(), - }; - -Mutation$MigrateToBinds _$Mutation$MigrateToBindsFromJson( - Map json) => - Mutation$MigrateToBinds( - migrateToBinds: Mutation$MigrateToBinds$migrateToBinds.fromJson( - json['migrateToBinds'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$MigrateToBindsToJson( - Mutation$MigrateToBinds instance) => - { - 'migrateToBinds': instance.migrateToBinds.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$MigrateToBinds$migrateToBinds - _$Mutation$MigrateToBinds$migrateToBindsFromJson( - Map json) => - Mutation$MigrateToBinds$migrateToBinds( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - job: json['job'] == null - ? null - : Mutation$MigrateToBinds$migrateToBinds$job.fromJson( - json['job'] as Map), - ); - -Map _$Mutation$MigrateToBinds$migrateToBindsToJson( - Mutation$MigrateToBinds$migrateToBinds instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - 'job': instance.job?.toJson(), - }; - -Mutation$MigrateToBinds$migrateToBinds$job - _$Mutation$MigrateToBinds$migrateToBinds$jobFromJson( - Map json) => - Mutation$MigrateToBinds$migrateToBinds$job( - createdAt: dateTimeFromJson(json['createdAt']), - description: json['description'] as String, - error: json['error'] as String?, - finishedAt: _nullable$dateTimeFromJson(json['finishedAt']), - name: json['name'] as String, - progress: json['progress'] as int?, - result: json['result'] as String?, - status: json['status'] as String, - statusText: json['statusText'] as String?, - uid: json['uid'] as String, - updatedAt: dateTimeFromJson(json['updatedAt']), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$MigrateToBinds$migrateToBinds$jobToJson( - Mutation$MigrateToBinds$migrateToBinds$job instance) => - { - 'createdAt': dateTimeToJson(instance.createdAt), - 'description': instance.description, - 'error': instance.error, - 'finishedAt': _nullable$dateTimeToJson(instance.finishedAt), - 'name': instance.name, - 'progress': instance.progress, - 'result': instance.result, - 'status': instance.status, - 'statusText': instance.statusText, - 'uid': instance.uid, - 'updatedAt': dateTimeToJson(instance.updatedAt), - '__typename': instance.$__typename, - }; diff --git a/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart index 305ca781..a8318d9f 100644 --- a/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart @@ -1,61 +1,116 @@ import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; -import 'package:json_annotation/json_annotation.dart'; import 'package:selfprivacy/utils/scalars.dart'; -part 'schema.graphql.g.dart'; -@JsonSerializable(explicitToJson: true) class Input$AutoUpgradeSettingsInput { - Input$AutoUpgradeSettingsInput({this.enableAutoUpgrade, this.allowReboot}); + factory Input$AutoUpgradeSettingsInput({ + bool? enableAutoUpgrade, + bool? allowReboot, + }) => + Input$AutoUpgradeSettingsInput._({ + if (enableAutoUpgrade != null) r'enableAutoUpgrade': enableAutoUpgrade, + if (allowReboot != null) r'allowReboot': allowReboot, + }); - @override - factory Input$AutoUpgradeSettingsInput.fromJson(Map json) => - _$Input$AutoUpgradeSettingsInputFromJson(json); + Input$AutoUpgradeSettingsInput._(this._$data); - final bool? enableAutoUpgrade; - - final bool? allowReboot; - - Map toJson() => _$Input$AutoUpgradeSettingsInputToJson(this); - int get hashCode { - final l$enableAutoUpgrade = enableAutoUpgrade; - final l$allowReboot = allowReboot; - return Object.hashAll([l$enableAutoUpgrade, l$allowReboot]); + factory Input$AutoUpgradeSettingsInput.fromJson(Map data) { + final result$data = {}; + if (data.containsKey('enableAutoUpgrade')) { + final l$enableAutoUpgrade = data['enableAutoUpgrade']; + result$data['enableAutoUpgrade'] = (l$enableAutoUpgrade as bool?); + } + if (data.containsKey('allowReboot')) { + final l$allowReboot = data['allowReboot']; + result$data['allowReboot'] = (l$allowReboot as bool?); + } + return Input$AutoUpgradeSettingsInput._(result$data); } - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Input$AutoUpgradeSettingsInput) || - runtimeType != other.runtimeType) return false; - final l$enableAutoUpgrade = enableAutoUpgrade; - final lOther$enableAutoUpgrade = other.enableAutoUpgrade; - if (l$enableAutoUpgrade != lOther$enableAutoUpgrade) return false; - final l$allowReboot = allowReboot; - final lOther$allowReboot = other.allowReboot; - if (l$allowReboot != lOther$allowReboot) return false; - return true; + Map _$data; + + bool? get enableAutoUpgrade => (_$data['enableAutoUpgrade'] as bool?); + bool? get allowReboot => (_$data['allowReboot'] as bool?); + Map toJson() { + final result$data = {}; + if (_$data.containsKey('enableAutoUpgrade')) { + final l$enableAutoUpgrade = enableAutoUpgrade; + result$data['enableAutoUpgrade'] = l$enableAutoUpgrade; + } + if (_$data.containsKey('allowReboot')) { + final l$allowReboot = allowReboot; + result$data['allowReboot'] = l$allowReboot; + } + return result$data; } CopyWith$Input$AutoUpgradeSettingsInput - get copyWith => CopyWith$Input$AutoUpgradeSettingsInput(this, (i) => i); + get copyWith => CopyWith$Input$AutoUpgradeSettingsInput( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Input$AutoUpgradeSettingsInput) || + runtimeType != other.runtimeType) { + return false; + } + final l$enableAutoUpgrade = enableAutoUpgrade; + final lOther$enableAutoUpgrade = other.enableAutoUpgrade; + if (_$data.containsKey('enableAutoUpgrade') != + other._$data.containsKey('enableAutoUpgrade')) { + return false; + } + if (l$enableAutoUpgrade != lOther$enableAutoUpgrade) { + return false; + } + final l$allowReboot = allowReboot; + final lOther$allowReboot = other.allowReboot; + if (_$data.containsKey('allowReboot') != + other._$data.containsKey('allowReboot')) { + return false; + } + if (l$allowReboot != lOther$allowReboot) { + return false; + } + return true; + } + + @override + int get hashCode { + final l$enableAutoUpgrade = enableAutoUpgrade; + final l$allowReboot = allowReboot; + return Object.hashAll([ + _$data.containsKey('enableAutoUpgrade') ? l$enableAutoUpgrade : const {}, + _$data.containsKey('allowReboot') ? l$allowReboot : const {}, + ]); + } } abstract class CopyWith$Input$AutoUpgradeSettingsInput { factory CopyWith$Input$AutoUpgradeSettingsInput( - Input$AutoUpgradeSettingsInput instance, - TRes Function(Input$AutoUpgradeSettingsInput) then) = - _CopyWithImpl$Input$AutoUpgradeSettingsInput; + Input$AutoUpgradeSettingsInput instance, + TRes Function(Input$AutoUpgradeSettingsInput) then, + ) = _CopyWithImpl$Input$AutoUpgradeSettingsInput; factory CopyWith$Input$AutoUpgradeSettingsInput.stub(TRes res) = _CopyWithStubImpl$Input$AutoUpgradeSettingsInput; - TRes call({bool? enableAutoUpgrade, bool? allowReboot}); + TRes call({ + bool? enableAutoUpgrade, + bool? allowReboot, + }); } class _CopyWithImpl$Input$AutoUpgradeSettingsInput implements CopyWith$Input$AutoUpgradeSettingsInput { - _CopyWithImpl$Input$AutoUpgradeSettingsInput(this._instance, this._then); + _CopyWithImpl$Input$AutoUpgradeSettingsInput( + this._instance, + this._then, + ); final Input$AutoUpgradeSettingsInput _instance; @@ -63,16 +118,16 @@ class _CopyWithImpl$Input$AutoUpgradeSettingsInput static const _undefined = {}; - TRes call( - {Object? enableAutoUpgrade = _undefined, - Object? allowReboot = _undefined}) => - _then(Input$AutoUpgradeSettingsInput( - enableAutoUpgrade: enableAutoUpgrade == _undefined - ? _instance.enableAutoUpgrade - : (enableAutoUpgrade as bool?), - allowReboot: allowReboot == _undefined - ? _instance.allowReboot - : (allowReboot as bool?))); + TRes call({ + Object? enableAutoUpgrade = _undefined, + Object? allowReboot = _undefined, + }) => + _then(Input$AutoUpgradeSettingsInput._({ + ..._instance._$data, + if (enableAutoUpgrade != _undefined) + 'enableAutoUpgrade': (enableAutoUpgrade as bool?), + if (allowReboot != _undefined) 'allowReboot': (allowReboot as bool?), + })); } class _CopyWithStubImpl$Input$AutoUpgradeSettingsInput @@ -81,33 +136,111 @@ class _CopyWithStubImpl$Input$AutoUpgradeSettingsInput TRes _res; - call({bool? enableAutoUpgrade, bool? allowReboot}) => _res; + call({ + bool? enableAutoUpgrade, + bool? allowReboot, + }) => + _res; } -@JsonSerializable(explicitToJson: true) class Input$MigrateToBindsInput { - Input$MigrateToBindsInput( - {required this.emailBlockDevice, - required this.bitwardenBlockDevice, - required this.giteaBlockDevice, - required this.nextcloudBlockDevice, - required this.pleromaBlockDevice}); + factory Input$MigrateToBindsInput({ + required String emailBlockDevice, + required String bitwardenBlockDevice, + required String giteaBlockDevice, + required String nextcloudBlockDevice, + required String pleromaBlockDevice, + }) => + Input$MigrateToBindsInput._({ + r'emailBlockDevice': emailBlockDevice, + r'bitwardenBlockDevice': bitwardenBlockDevice, + r'giteaBlockDevice': giteaBlockDevice, + r'nextcloudBlockDevice': nextcloudBlockDevice, + r'pleromaBlockDevice': pleromaBlockDevice, + }); + + Input$MigrateToBindsInput._(this._$data); + + factory Input$MigrateToBindsInput.fromJson(Map data) { + final result$data = {}; + final l$emailBlockDevice = data['emailBlockDevice']; + result$data['emailBlockDevice'] = (l$emailBlockDevice as String); + final l$bitwardenBlockDevice = data['bitwardenBlockDevice']; + result$data['bitwardenBlockDevice'] = (l$bitwardenBlockDevice as String); + final l$giteaBlockDevice = data['giteaBlockDevice']; + result$data['giteaBlockDevice'] = (l$giteaBlockDevice as String); + final l$nextcloudBlockDevice = data['nextcloudBlockDevice']; + result$data['nextcloudBlockDevice'] = (l$nextcloudBlockDevice as String); + final l$pleromaBlockDevice = data['pleromaBlockDevice']; + result$data['pleromaBlockDevice'] = (l$pleromaBlockDevice as String); + return Input$MigrateToBindsInput._(result$data); + } + + Map _$data; + + String get emailBlockDevice => (_$data['emailBlockDevice'] as String); + String get bitwardenBlockDevice => (_$data['bitwardenBlockDevice'] as String); + String get giteaBlockDevice => (_$data['giteaBlockDevice'] as String); + String get nextcloudBlockDevice => (_$data['nextcloudBlockDevice'] as String); + String get pleromaBlockDevice => (_$data['pleromaBlockDevice'] as String); + Map toJson() { + final result$data = {}; + final l$emailBlockDevice = emailBlockDevice; + result$data['emailBlockDevice'] = l$emailBlockDevice; + final l$bitwardenBlockDevice = bitwardenBlockDevice; + result$data['bitwardenBlockDevice'] = l$bitwardenBlockDevice; + final l$giteaBlockDevice = giteaBlockDevice; + result$data['giteaBlockDevice'] = l$giteaBlockDevice; + final l$nextcloudBlockDevice = nextcloudBlockDevice; + result$data['nextcloudBlockDevice'] = l$nextcloudBlockDevice; + final l$pleromaBlockDevice = pleromaBlockDevice; + result$data['pleromaBlockDevice'] = l$pleromaBlockDevice; + return result$data; + } + + CopyWith$Input$MigrateToBindsInput get copyWith => + CopyWith$Input$MigrateToBindsInput( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Input$MigrateToBindsInput) || + runtimeType != other.runtimeType) { + return false; + } + final l$emailBlockDevice = emailBlockDevice; + final lOther$emailBlockDevice = other.emailBlockDevice; + if (l$emailBlockDevice != lOther$emailBlockDevice) { + return false; + } + final l$bitwardenBlockDevice = bitwardenBlockDevice; + final lOther$bitwardenBlockDevice = other.bitwardenBlockDevice; + if (l$bitwardenBlockDevice != lOther$bitwardenBlockDevice) { + return false; + } + final l$giteaBlockDevice = giteaBlockDevice; + final lOther$giteaBlockDevice = other.giteaBlockDevice; + if (l$giteaBlockDevice != lOther$giteaBlockDevice) { + return false; + } + final l$nextcloudBlockDevice = nextcloudBlockDevice; + final lOther$nextcloudBlockDevice = other.nextcloudBlockDevice; + if (l$nextcloudBlockDevice != lOther$nextcloudBlockDevice) { + return false; + } + final l$pleromaBlockDevice = pleromaBlockDevice; + final lOther$pleromaBlockDevice = other.pleromaBlockDevice; + if (l$pleromaBlockDevice != lOther$pleromaBlockDevice) { + return false; + } + return true; + } @override - factory Input$MigrateToBindsInput.fromJson(Map json) => - _$Input$MigrateToBindsInputFromJson(json); - - final String emailBlockDevice; - - final String bitwardenBlockDevice; - - final String giteaBlockDevice; - - final String nextcloudBlockDevice; - - final String pleromaBlockDevice; - - Map toJson() => _$Input$MigrateToBindsInputToJson(this); int get hashCode { final l$emailBlockDevice = emailBlockDevice; final l$bitwardenBlockDevice = bitwardenBlockDevice; @@ -119,56 +252,35 @@ class Input$MigrateToBindsInput { l$bitwardenBlockDevice, l$giteaBlockDevice, l$nextcloudBlockDevice, - l$pleromaBlockDevice + l$pleromaBlockDevice, ]); } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Input$MigrateToBindsInput) || - runtimeType != other.runtimeType) return false; - final l$emailBlockDevice = emailBlockDevice; - final lOther$emailBlockDevice = other.emailBlockDevice; - if (l$emailBlockDevice != lOther$emailBlockDevice) return false; - final l$bitwardenBlockDevice = bitwardenBlockDevice; - final lOther$bitwardenBlockDevice = other.bitwardenBlockDevice; - if (l$bitwardenBlockDevice != lOther$bitwardenBlockDevice) return false; - final l$giteaBlockDevice = giteaBlockDevice; - final lOther$giteaBlockDevice = other.giteaBlockDevice; - if (l$giteaBlockDevice != lOther$giteaBlockDevice) return false; - final l$nextcloudBlockDevice = nextcloudBlockDevice; - final lOther$nextcloudBlockDevice = other.nextcloudBlockDevice; - if (l$nextcloudBlockDevice != lOther$nextcloudBlockDevice) return false; - final l$pleromaBlockDevice = pleromaBlockDevice; - final lOther$pleromaBlockDevice = other.pleromaBlockDevice; - if (l$pleromaBlockDevice != lOther$pleromaBlockDevice) return false; - return true; - } - - CopyWith$Input$MigrateToBindsInput get copyWith => - CopyWith$Input$MigrateToBindsInput(this, (i) => i); } abstract class CopyWith$Input$MigrateToBindsInput { - factory CopyWith$Input$MigrateToBindsInput(Input$MigrateToBindsInput instance, - TRes Function(Input$MigrateToBindsInput) then) = - _CopyWithImpl$Input$MigrateToBindsInput; + factory CopyWith$Input$MigrateToBindsInput( + Input$MigrateToBindsInput instance, + TRes Function(Input$MigrateToBindsInput) then, + ) = _CopyWithImpl$Input$MigrateToBindsInput; factory CopyWith$Input$MigrateToBindsInput.stub(TRes res) = _CopyWithStubImpl$Input$MigrateToBindsInput; - TRes call( - {String? emailBlockDevice, - String? bitwardenBlockDevice, - String? giteaBlockDevice, - String? nextcloudBlockDevice, - String? pleromaBlockDevice}); + TRes call({ + String? emailBlockDevice, + String? bitwardenBlockDevice, + String? giteaBlockDevice, + String? nextcloudBlockDevice, + String? pleromaBlockDevice, + }); } class _CopyWithImpl$Input$MigrateToBindsInput implements CopyWith$Input$MigrateToBindsInput { - _CopyWithImpl$Input$MigrateToBindsInput(this._instance, this._then); + _CopyWithImpl$Input$MigrateToBindsInput( + this._instance, + this._then, + ); final Input$MigrateToBindsInput _instance; @@ -176,33 +288,26 @@ class _CopyWithImpl$Input$MigrateToBindsInput static const _undefined = {}; - TRes call( - {Object? emailBlockDevice = _undefined, - Object? bitwardenBlockDevice = _undefined, - Object? giteaBlockDevice = _undefined, - Object? nextcloudBlockDevice = _undefined, - Object? pleromaBlockDevice = _undefined}) => - _then(Input$MigrateToBindsInput( - emailBlockDevice: - emailBlockDevice == _undefined || emailBlockDevice == null - ? _instance.emailBlockDevice - : (emailBlockDevice as String), - bitwardenBlockDevice: - bitwardenBlockDevice == _undefined || bitwardenBlockDevice == null - ? _instance.bitwardenBlockDevice - : (bitwardenBlockDevice as String), - giteaBlockDevice: - giteaBlockDevice == _undefined || giteaBlockDevice == null - ? _instance.giteaBlockDevice - : (giteaBlockDevice as String), - nextcloudBlockDevice: - nextcloudBlockDevice == _undefined || nextcloudBlockDevice == null - ? _instance.nextcloudBlockDevice - : (nextcloudBlockDevice as String), - pleromaBlockDevice: - pleromaBlockDevice == _undefined || pleromaBlockDevice == null - ? _instance.pleromaBlockDevice - : (pleromaBlockDevice as String))); + TRes call({ + Object? emailBlockDevice = _undefined, + Object? bitwardenBlockDevice = _undefined, + Object? giteaBlockDevice = _undefined, + Object? nextcloudBlockDevice = _undefined, + Object? pleromaBlockDevice = _undefined, + }) => + _then(Input$MigrateToBindsInput._({ + ..._instance._$data, + if (emailBlockDevice != _undefined && emailBlockDevice != null) + 'emailBlockDevice': (emailBlockDevice as String), + if (bitwardenBlockDevice != _undefined && bitwardenBlockDevice != null) + 'bitwardenBlockDevice': (bitwardenBlockDevice as String), + if (giteaBlockDevice != _undefined && giteaBlockDevice != null) + 'giteaBlockDevice': (giteaBlockDevice as String), + if (nextcloudBlockDevice != _undefined && nextcloudBlockDevice != null) + 'nextcloudBlockDevice': (nextcloudBlockDevice as String), + if (pleromaBlockDevice != _undefined && pleromaBlockDevice != null) + 'pleromaBlockDevice': (pleromaBlockDevice as String), + })); } class _CopyWithStubImpl$Input$MigrateToBindsInput @@ -211,66 +316,109 @@ class _CopyWithStubImpl$Input$MigrateToBindsInput TRes _res; - call( - {String? emailBlockDevice, - String? bitwardenBlockDevice, - String? giteaBlockDevice, - String? nextcloudBlockDevice, - String? pleromaBlockDevice}) => + call({ + String? emailBlockDevice, + String? bitwardenBlockDevice, + String? giteaBlockDevice, + String? nextcloudBlockDevice, + String? pleromaBlockDevice, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Input$MoveServiceInput { - Input$MoveServiceInput({required this.serviceId, required this.location}); + factory Input$MoveServiceInput({ + required String serviceId, + required String location, + }) => + Input$MoveServiceInput._({ + r'serviceId': serviceId, + r'location': location, + }); - @override - factory Input$MoveServiceInput.fromJson(Map json) => - _$Input$MoveServiceInputFromJson(json); + Input$MoveServiceInput._(this._$data); - final String serviceId; - - final String location; - - Map toJson() => _$Input$MoveServiceInputToJson(this); - int get hashCode { - final l$serviceId = serviceId; - final l$location = location; - return Object.hashAll([l$serviceId, l$location]); + factory Input$MoveServiceInput.fromJson(Map data) { + final result$data = {}; + final l$serviceId = data['serviceId']; + result$data['serviceId'] = (l$serviceId as String); + final l$location = data['location']; + result$data['location'] = (l$location as String); + return Input$MoveServiceInput._(result$data); } - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Input$MoveServiceInput) || runtimeType != other.runtimeType) - return false; + Map _$data; + + String get serviceId => (_$data['serviceId'] as String); + String get location => (_$data['location'] as String); + Map toJson() { + final result$data = {}; final l$serviceId = serviceId; - final lOther$serviceId = other.serviceId; - if (l$serviceId != lOther$serviceId) return false; + result$data['serviceId'] = l$serviceId; final l$location = location; - final lOther$location = other.location; - if (l$location != lOther$location) return false; - return true; + result$data['location'] = l$location; + return result$data; } CopyWith$Input$MoveServiceInput get copyWith => - CopyWith$Input$MoveServiceInput(this, (i) => i); + CopyWith$Input$MoveServiceInput( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Input$MoveServiceInput) || + runtimeType != other.runtimeType) { + return false; + } + final l$serviceId = serviceId; + final lOther$serviceId = other.serviceId; + if (l$serviceId != lOther$serviceId) { + return false; + } + final l$location = location; + final lOther$location = other.location; + if (l$location != lOther$location) { + return false; + } + return true; + } + + @override + int get hashCode { + final l$serviceId = serviceId; + final l$location = location; + return Object.hashAll([ + l$serviceId, + l$location, + ]); + } } abstract class CopyWith$Input$MoveServiceInput { - factory CopyWith$Input$MoveServiceInput(Input$MoveServiceInput instance, - TRes Function(Input$MoveServiceInput) then) = - _CopyWithImpl$Input$MoveServiceInput; + factory CopyWith$Input$MoveServiceInput( + Input$MoveServiceInput instance, + TRes Function(Input$MoveServiceInput) then, + ) = _CopyWithImpl$Input$MoveServiceInput; factory CopyWith$Input$MoveServiceInput.stub(TRes res) = _CopyWithStubImpl$Input$MoveServiceInput; - TRes call({String? serviceId, String? location}); + TRes call({ + String? serviceId, + String? location, + }); } class _CopyWithImpl$Input$MoveServiceInput implements CopyWith$Input$MoveServiceInput { - _CopyWithImpl$Input$MoveServiceInput(this._instance, this._then); + _CopyWithImpl$Input$MoveServiceInput( + this._instance, + this._then, + ); final Input$MoveServiceInput _instance; @@ -278,14 +426,17 @@ class _CopyWithImpl$Input$MoveServiceInput static const _undefined = {}; - TRes call({Object? serviceId = _undefined, Object? location = _undefined}) => - _then(Input$MoveServiceInput( - serviceId: serviceId == _undefined || serviceId == null - ? _instance.serviceId - : (serviceId as String), - location: location == _undefined || location == null - ? _instance.location - : (location as String))); + TRes call({ + Object? serviceId = _undefined, + Object? location = _undefined, + }) => + _then(Input$MoveServiceInput._({ + ..._instance._$data, + if (serviceId != _undefined && serviceId != null) + 'serviceId': (serviceId as String), + if (location != _undefined && location != null) + 'location': (location as String), + })); } class _CopyWithStubImpl$Input$MoveServiceInput @@ -294,63 +445,123 @@ class _CopyWithStubImpl$Input$MoveServiceInput TRes _res; - call({String? serviceId, String? location}) => _res; + call({ + String? serviceId, + String? location, + }) => + _res; } -@JsonSerializable(explicitToJson: true) class Input$RecoveryKeyLimitsInput { - Input$RecoveryKeyLimitsInput({this.expirationDate, this.uses}); + factory Input$RecoveryKeyLimitsInput({ + DateTime? expirationDate, + int? uses, + }) => + Input$RecoveryKeyLimitsInput._({ + if (expirationDate != null) r'expirationDate': expirationDate, + if (uses != null) r'uses': uses, + }); - @override - factory Input$RecoveryKeyLimitsInput.fromJson(Map json) => - _$Input$RecoveryKeyLimitsInputFromJson(json); + Input$RecoveryKeyLimitsInput._(this._$data); - @JsonKey( - fromJson: _nullable$dateTimeFromJson, toJson: _nullable$dateTimeToJson) - final DateTime? expirationDate; - - final int? uses; - - Map toJson() => _$Input$RecoveryKeyLimitsInputToJson(this); - int get hashCode { - final l$expirationDate = expirationDate; - final l$uses = uses; - return Object.hashAll([l$expirationDate, l$uses]); + factory Input$RecoveryKeyLimitsInput.fromJson(Map data) { + final result$data = {}; + if (data.containsKey('expirationDate')) { + final l$expirationDate = data['expirationDate']; + result$data['expirationDate'] = + l$expirationDate == null ? null : dateTimeFromJson(l$expirationDate); + } + if (data.containsKey('uses')) { + final l$uses = data['uses']; + result$data['uses'] = (l$uses as int?); + } + return Input$RecoveryKeyLimitsInput._(result$data); } - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Input$RecoveryKeyLimitsInput) || - runtimeType != other.runtimeType) return false; - final l$expirationDate = expirationDate; - final lOther$expirationDate = other.expirationDate; - if (l$expirationDate != lOther$expirationDate) return false; - final l$uses = uses; - final lOther$uses = other.uses; - if (l$uses != lOther$uses) return false; - return true; + Map _$data; + + DateTime? get expirationDate => (_$data['expirationDate'] as DateTime?); + int? get uses => (_$data['uses'] as int?); + Map toJson() { + final result$data = {}; + if (_$data.containsKey('expirationDate')) { + final l$expirationDate = expirationDate; + result$data['expirationDate'] = + l$expirationDate == null ? null : dateTimeToJson(l$expirationDate); + } + if (_$data.containsKey('uses')) { + final l$uses = uses; + result$data['uses'] = l$uses; + } + return result$data; } CopyWith$Input$RecoveryKeyLimitsInput - get copyWith => CopyWith$Input$RecoveryKeyLimitsInput(this, (i) => i); + get copyWith => CopyWith$Input$RecoveryKeyLimitsInput( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Input$RecoveryKeyLimitsInput) || + runtimeType != other.runtimeType) { + return false; + } + final l$expirationDate = expirationDate; + final lOther$expirationDate = other.expirationDate; + if (_$data.containsKey('expirationDate') != + other._$data.containsKey('expirationDate')) { + return false; + } + if (l$expirationDate != lOther$expirationDate) { + return false; + } + final l$uses = uses; + final lOther$uses = other.uses; + if (_$data.containsKey('uses') != other._$data.containsKey('uses')) { + return false; + } + if (l$uses != lOther$uses) { + return false; + } + return true; + } + + @override + int get hashCode { + final l$expirationDate = expirationDate; + final l$uses = uses; + return Object.hashAll([ + _$data.containsKey('expirationDate') ? l$expirationDate : const {}, + _$data.containsKey('uses') ? l$uses : const {}, + ]); + } } abstract class CopyWith$Input$RecoveryKeyLimitsInput { factory CopyWith$Input$RecoveryKeyLimitsInput( - Input$RecoveryKeyLimitsInput instance, - TRes Function(Input$RecoveryKeyLimitsInput) then) = - _CopyWithImpl$Input$RecoveryKeyLimitsInput; + Input$RecoveryKeyLimitsInput instance, + TRes Function(Input$RecoveryKeyLimitsInput) then, + ) = _CopyWithImpl$Input$RecoveryKeyLimitsInput; factory CopyWith$Input$RecoveryKeyLimitsInput.stub(TRes res) = _CopyWithStubImpl$Input$RecoveryKeyLimitsInput; - TRes call({DateTime? expirationDate, int? uses}); + TRes call({ + DateTime? expirationDate, + int? uses, + }); } class _CopyWithImpl$Input$RecoveryKeyLimitsInput implements CopyWith$Input$RecoveryKeyLimitsInput { - _CopyWithImpl$Input$RecoveryKeyLimitsInput(this._instance, this._then); + _CopyWithImpl$Input$RecoveryKeyLimitsInput( + this._instance, + this._then, + ); final Input$RecoveryKeyLimitsInput _instance; @@ -358,12 +569,16 @@ class _CopyWithImpl$Input$RecoveryKeyLimitsInput static const _undefined = {}; - TRes call({Object? expirationDate = _undefined, Object? uses = _undefined}) => - _then(Input$RecoveryKeyLimitsInput( - expirationDate: expirationDate == _undefined - ? _instance.expirationDate - : (expirationDate as DateTime?), - uses: uses == _undefined ? _instance.uses : (uses as int?))); + TRes call({ + Object? expirationDate = _undefined, + Object? uses = _undefined, + }) => + _then(Input$RecoveryKeyLimitsInput._({ + ..._instance._$data, + if (expirationDate != _undefined) + 'expirationDate': (expirationDate as DateTime?), + if (uses != _undefined) 'uses': (uses as int?), + })); } class _CopyWithStubImpl$Input$RecoveryKeyLimitsInput @@ -372,60 +587,106 @@ class _CopyWithStubImpl$Input$RecoveryKeyLimitsInput TRes _res; - call({DateTime? expirationDate, int? uses}) => _res; + call({ + DateTime? expirationDate, + int? uses, + }) => + _res; } -@JsonSerializable(explicitToJson: true) class Input$SshMutationInput { - Input$SshMutationInput({required this.username, required this.sshKey}); + factory Input$SshMutationInput({ + required String username, + required String sshKey, + }) => + Input$SshMutationInput._({ + r'username': username, + r'sshKey': sshKey, + }); - @override - factory Input$SshMutationInput.fromJson(Map json) => - _$Input$SshMutationInputFromJson(json); + Input$SshMutationInput._(this._$data); - final String username; - - final String sshKey; - - Map toJson() => _$Input$SshMutationInputToJson(this); - int get hashCode { - final l$username = username; - final l$sshKey = sshKey; - return Object.hashAll([l$username, l$sshKey]); + factory Input$SshMutationInput.fromJson(Map data) { + final result$data = {}; + final l$username = data['username']; + result$data['username'] = (l$username as String); + final l$sshKey = data['sshKey']; + result$data['sshKey'] = (l$sshKey as String); + return Input$SshMutationInput._(result$data); } - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Input$SshMutationInput) || runtimeType != other.runtimeType) - return false; + Map _$data; + + String get username => (_$data['username'] as String); + String get sshKey => (_$data['sshKey'] as String); + Map toJson() { + final result$data = {}; final l$username = username; - final lOther$username = other.username; - if (l$username != lOther$username) return false; + result$data['username'] = l$username; final l$sshKey = sshKey; - final lOther$sshKey = other.sshKey; - if (l$sshKey != lOther$sshKey) return false; - return true; + result$data['sshKey'] = l$sshKey; + return result$data; } CopyWith$Input$SshMutationInput get copyWith => - CopyWith$Input$SshMutationInput(this, (i) => i); + CopyWith$Input$SshMutationInput( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Input$SshMutationInput) || + runtimeType != other.runtimeType) { + return false; + } + final l$username = username; + final lOther$username = other.username; + if (l$username != lOther$username) { + return false; + } + final l$sshKey = sshKey; + final lOther$sshKey = other.sshKey; + if (l$sshKey != lOther$sshKey) { + return false; + } + return true; + } + + @override + int get hashCode { + final l$username = username; + final l$sshKey = sshKey; + return Object.hashAll([ + l$username, + l$sshKey, + ]); + } } abstract class CopyWith$Input$SshMutationInput { - factory CopyWith$Input$SshMutationInput(Input$SshMutationInput instance, - TRes Function(Input$SshMutationInput) then) = - _CopyWithImpl$Input$SshMutationInput; + factory CopyWith$Input$SshMutationInput( + Input$SshMutationInput instance, + TRes Function(Input$SshMutationInput) then, + ) = _CopyWithImpl$Input$SshMutationInput; factory CopyWith$Input$SshMutationInput.stub(TRes res) = _CopyWithStubImpl$Input$SshMutationInput; - TRes call({String? username, String? sshKey}); + TRes call({ + String? username, + String? sshKey, + }); } class _CopyWithImpl$Input$SshMutationInput implements CopyWith$Input$SshMutationInput { - _CopyWithImpl$Input$SshMutationInput(this._instance, this._then); + _CopyWithImpl$Input$SshMutationInput( + this._instance, + this._then, + ); final Input$SshMutationInput _instance; @@ -433,14 +694,17 @@ class _CopyWithImpl$Input$SshMutationInput static const _undefined = {}; - TRes call({Object? username = _undefined, Object? sshKey = _undefined}) => - _then(Input$SshMutationInput( - username: username == _undefined || username == null - ? _instance.username - : (username as String), - sshKey: sshKey == _undefined || sshKey == null - ? _instance.sshKey - : (sshKey as String))); + TRes call({ + Object? username = _undefined, + Object? sshKey = _undefined, + }) => + _then(Input$SshMutationInput._({ + ..._instance._$data, + if (username != _undefined && username != null) + 'username': (username as String), + if (sshKey != _undefined && sshKey != null) + 'sshKey': (sshKey as String), + })); } class _CopyWithStubImpl$Input$SshMutationInput @@ -449,61 +713,106 @@ class _CopyWithStubImpl$Input$SshMutationInput TRes _res; - call({String? username, String? sshKey}) => _res; + call({ + String? username, + String? sshKey, + }) => + _res; } -@JsonSerializable(explicitToJson: true) class Input$UseNewDeviceKeyInput { - Input$UseNewDeviceKeyInput({required this.key, required this.deviceName}); + factory Input$UseNewDeviceKeyInput({ + required String key, + required String deviceName, + }) => + Input$UseNewDeviceKeyInput._({ + r'key': key, + r'deviceName': deviceName, + }); - @override - factory Input$UseNewDeviceKeyInput.fromJson(Map json) => - _$Input$UseNewDeviceKeyInputFromJson(json); + Input$UseNewDeviceKeyInput._(this._$data); - final String key; - - final String deviceName; - - Map toJson() => _$Input$UseNewDeviceKeyInputToJson(this); - int get hashCode { - final l$key = key; - final l$deviceName = deviceName; - return Object.hashAll([l$key, l$deviceName]); + factory Input$UseNewDeviceKeyInput.fromJson(Map data) { + final result$data = {}; + final l$key = data['key']; + result$data['key'] = (l$key as String); + final l$deviceName = data['deviceName']; + result$data['deviceName'] = (l$deviceName as String); + return Input$UseNewDeviceKeyInput._(result$data); } - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Input$UseNewDeviceKeyInput) || - runtimeType != other.runtimeType) return false; + Map _$data; + + String get key => (_$data['key'] as String); + String get deviceName => (_$data['deviceName'] as String); + Map toJson() { + final result$data = {}; final l$key = key; - final lOther$key = other.key; - if (l$key != lOther$key) return false; + result$data['key'] = l$key; final l$deviceName = deviceName; - final lOther$deviceName = other.deviceName; - if (l$deviceName != lOther$deviceName) return false; - return true; + result$data['deviceName'] = l$deviceName; + return result$data; } CopyWith$Input$UseNewDeviceKeyInput - get copyWith => CopyWith$Input$UseNewDeviceKeyInput(this, (i) => i); + get copyWith => CopyWith$Input$UseNewDeviceKeyInput( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Input$UseNewDeviceKeyInput) || + runtimeType != other.runtimeType) { + return false; + } + final l$key = key; + final lOther$key = other.key; + if (l$key != lOther$key) { + return false; + } + final l$deviceName = deviceName; + final lOther$deviceName = other.deviceName; + if (l$deviceName != lOther$deviceName) { + return false; + } + return true; + } + + @override + int get hashCode { + final l$key = key; + final l$deviceName = deviceName; + return Object.hashAll([ + l$key, + l$deviceName, + ]); + } } abstract class CopyWith$Input$UseNewDeviceKeyInput { factory CopyWith$Input$UseNewDeviceKeyInput( - Input$UseNewDeviceKeyInput instance, - TRes Function(Input$UseNewDeviceKeyInput) then) = - _CopyWithImpl$Input$UseNewDeviceKeyInput; + Input$UseNewDeviceKeyInput instance, + TRes Function(Input$UseNewDeviceKeyInput) then, + ) = _CopyWithImpl$Input$UseNewDeviceKeyInput; factory CopyWith$Input$UseNewDeviceKeyInput.stub(TRes res) = _CopyWithStubImpl$Input$UseNewDeviceKeyInput; - TRes call({String? key, String? deviceName}); + TRes call({ + String? key, + String? deviceName, + }); } class _CopyWithImpl$Input$UseNewDeviceKeyInput implements CopyWith$Input$UseNewDeviceKeyInput { - _CopyWithImpl$Input$UseNewDeviceKeyInput(this._instance, this._then); + _CopyWithImpl$Input$UseNewDeviceKeyInput( + this._instance, + this._then, + ); final Input$UseNewDeviceKeyInput _instance; @@ -511,14 +820,16 @@ class _CopyWithImpl$Input$UseNewDeviceKeyInput static const _undefined = {}; - TRes call({Object? key = _undefined, Object? deviceName = _undefined}) => - _then(Input$UseNewDeviceKeyInput( - key: key == _undefined || key == null - ? _instance.key - : (key as String), - deviceName: deviceName == _undefined || deviceName == null - ? _instance.deviceName - : (deviceName as String))); + TRes call({ + Object? key = _undefined, + Object? deviceName = _undefined, + }) => + _then(Input$UseNewDeviceKeyInput._({ + ..._instance._$data, + if (key != _undefined && key != null) 'key': (key as String), + if (deviceName != _undefined && deviceName != null) + 'deviceName': (deviceName as String), + })); } class _CopyWithStubImpl$Input$UseNewDeviceKeyInput @@ -527,60 +838,106 @@ class _CopyWithStubImpl$Input$UseNewDeviceKeyInput TRes _res; - call({String? key, String? deviceName}) => _res; + call({ + String? key, + String? deviceName, + }) => + _res; } -@JsonSerializable(explicitToJson: true) class Input$UseRecoveryKeyInput { - Input$UseRecoveryKeyInput({required this.key, required this.deviceName}); + factory Input$UseRecoveryKeyInput({ + required String key, + required String deviceName, + }) => + Input$UseRecoveryKeyInput._({ + r'key': key, + r'deviceName': deviceName, + }); - @override - factory Input$UseRecoveryKeyInput.fromJson(Map json) => - _$Input$UseRecoveryKeyInputFromJson(json); + Input$UseRecoveryKeyInput._(this._$data); - final String key; - - final String deviceName; - - Map toJson() => _$Input$UseRecoveryKeyInputToJson(this); - int get hashCode { - final l$key = key; - final l$deviceName = deviceName; - return Object.hashAll([l$key, l$deviceName]); + factory Input$UseRecoveryKeyInput.fromJson(Map data) { + final result$data = {}; + final l$key = data['key']; + result$data['key'] = (l$key as String); + final l$deviceName = data['deviceName']; + result$data['deviceName'] = (l$deviceName as String); + return Input$UseRecoveryKeyInput._(result$data); } - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Input$UseRecoveryKeyInput) || - runtimeType != other.runtimeType) return false; + Map _$data; + + String get key => (_$data['key'] as String); + String get deviceName => (_$data['deviceName'] as String); + Map toJson() { + final result$data = {}; final l$key = key; - final lOther$key = other.key; - if (l$key != lOther$key) return false; + result$data['key'] = l$key; final l$deviceName = deviceName; - final lOther$deviceName = other.deviceName; - if (l$deviceName != lOther$deviceName) return false; - return true; + result$data['deviceName'] = l$deviceName; + return result$data; } CopyWith$Input$UseRecoveryKeyInput get copyWith => - CopyWith$Input$UseRecoveryKeyInput(this, (i) => i); + CopyWith$Input$UseRecoveryKeyInput( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Input$UseRecoveryKeyInput) || + runtimeType != other.runtimeType) { + return false; + } + final l$key = key; + final lOther$key = other.key; + if (l$key != lOther$key) { + return false; + } + final l$deviceName = deviceName; + final lOther$deviceName = other.deviceName; + if (l$deviceName != lOther$deviceName) { + return false; + } + return true; + } + + @override + int get hashCode { + final l$key = key; + final l$deviceName = deviceName; + return Object.hashAll([ + l$key, + l$deviceName, + ]); + } } abstract class CopyWith$Input$UseRecoveryKeyInput { - factory CopyWith$Input$UseRecoveryKeyInput(Input$UseRecoveryKeyInput instance, - TRes Function(Input$UseRecoveryKeyInput) then) = - _CopyWithImpl$Input$UseRecoveryKeyInput; + factory CopyWith$Input$UseRecoveryKeyInput( + Input$UseRecoveryKeyInput instance, + TRes Function(Input$UseRecoveryKeyInput) then, + ) = _CopyWithImpl$Input$UseRecoveryKeyInput; factory CopyWith$Input$UseRecoveryKeyInput.stub(TRes res) = _CopyWithStubImpl$Input$UseRecoveryKeyInput; - TRes call({String? key, String? deviceName}); + TRes call({ + String? key, + String? deviceName, + }); } class _CopyWithImpl$Input$UseRecoveryKeyInput implements CopyWith$Input$UseRecoveryKeyInput { - _CopyWithImpl$Input$UseRecoveryKeyInput(this._instance, this._then); + _CopyWithImpl$Input$UseRecoveryKeyInput( + this._instance, + this._then, + ); final Input$UseRecoveryKeyInput _instance; @@ -588,14 +945,16 @@ class _CopyWithImpl$Input$UseRecoveryKeyInput static const _undefined = {}; - TRes call({Object? key = _undefined, Object? deviceName = _undefined}) => - _then(Input$UseRecoveryKeyInput( - key: key == _undefined || key == null - ? _instance.key - : (key as String), - deviceName: deviceName == _undefined || deviceName == null - ? _instance.deviceName - : (deviceName as String))); + TRes call({ + Object? key = _undefined, + Object? deviceName = _undefined, + }) => + _then(Input$UseRecoveryKeyInput._({ + ..._instance._$data, + if (key != _undefined && key != null) 'key': (key as String), + if (deviceName != _undefined && deviceName != null) + 'deviceName': (deviceName as String), + })); } class _CopyWithStubImpl$Input$UseRecoveryKeyInput @@ -604,60 +963,106 @@ class _CopyWithStubImpl$Input$UseRecoveryKeyInput TRes _res; - call({String? key, String? deviceName}) => _res; + call({ + String? key, + String? deviceName, + }) => + _res; } -@JsonSerializable(explicitToJson: true) class Input$UserMutationInput { - Input$UserMutationInput({required this.username, required this.password}); + factory Input$UserMutationInput({ + required String username, + required String password, + }) => + Input$UserMutationInput._({ + r'username': username, + r'password': password, + }); - @override - factory Input$UserMutationInput.fromJson(Map json) => - _$Input$UserMutationInputFromJson(json); + Input$UserMutationInput._(this._$data); - final String username; - - final String password; - - Map toJson() => _$Input$UserMutationInputToJson(this); - int get hashCode { - final l$username = username; - final l$password = password; - return Object.hashAll([l$username, l$password]); + factory Input$UserMutationInput.fromJson(Map data) { + final result$data = {}; + final l$username = data['username']; + result$data['username'] = (l$username as String); + final l$password = data['password']; + result$data['password'] = (l$password as String); + return Input$UserMutationInput._(result$data); } - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Input$UserMutationInput) || runtimeType != other.runtimeType) - return false; + Map _$data; + + String get username => (_$data['username'] as String); + String get password => (_$data['password'] as String); + Map toJson() { + final result$data = {}; final l$username = username; - final lOther$username = other.username; - if (l$username != lOther$username) return false; + result$data['username'] = l$username; final l$password = password; - final lOther$password = other.password; - if (l$password != lOther$password) return false; - return true; + result$data['password'] = l$password; + return result$data; } CopyWith$Input$UserMutationInput get copyWith => - CopyWith$Input$UserMutationInput(this, (i) => i); + CopyWith$Input$UserMutationInput( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Input$UserMutationInput) || + runtimeType != other.runtimeType) { + return false; + } + final l$username = username; + final lOther$username = other.username; + if (l$username != lOther$username) { + return false; + } + final l$password = password; + final lOther$password = other.password; + if (l$password != lOther$password) { + return false; + } + return true; + } + + @override + int get hashCode { + final l$username = username; + final l$password = password; + return Object.hashAll([ + l$username, + l$password, + ]); + } } abstract class CopyWith$Input$UserMutationInput { - factory CopyWith$Input$UserMutationInput(Input$UserMutationInput instance, - TRes Function(Input$UserMutationInput) then) = - _CopyWithImpl$Input$UserMutationInput; + factory CopyWith$Input$UserMutationInput( + Input$UserMutationInput instance, + TRes Function(Input$UserMutationInput) then, + ) = _CopyWithImpl$Input$UserMutationInput; factory CopyWith$Input$UserMutationInput.stub(TRes res) = _CopyWithStubImpl$Input$UserMutationInput; - TRes call({String? username, String? password}); + TRes call({ + String? username, + String? password, + }); } class _CopyWithImpl$Input$UserMutationInput implements CopyWith$Input$UserMutationInput { - _CopyWithImpl$Input$UserMutationInput(this._instance, this._then); + _CopyWithImpl$Input$UserMutationInput( + this._instance, + this._then, + ); final Input$UserMutationInput _instance; @@ -665,14 +1070,17 @@ class _CopyWithImpl$Input$UserMutationInput static const _undefined = {}; - TRes call({Object? username = _undefined, Object? password = _undefined}) => - _then(Input$UserMutationInput( - username: username == _undefined || username == null - ? _instance.username - : (username as String), - password: password == _undefined || password == null - ? _instance.password - : (password as String))); + TRes call({ + Object? username = _undefined, + Object? password = _undefined, + }) => + _then(Input$UserMutationInput._({ + ..._instance._$data, + if (username != _undefined && username != null) + 'username': (username as String), + if (password != _undefined && password != null) + 'password': (password as String), + })); } class _CopyWithStubImpl$Input$UserMutationInput @@ -681,80 +1089,204 @@ class _CopyWithStubImpl$Input$UserMutationInput TRes _res; - call({String? username, String? password}) => _res; + call({ + String? username, + String? password, + }) => + _res; } -enum Enum$DnsProvider { - @JsonValue('CLOUDFLARE') - CLOUDFLARE, - @JsonValue('DIGITALOCEAN') - DIGITALOCEAN, - $unknown +enum Enum$DnsProvider { CLOUDFLARE, DIGITALOCEAN, $unknown } + +String toJson$Enum$DnsProvider(Enum$DnsProvider e) { + switch (e) { + case Enum$DnsProvider.CLOUDFLARE: + return r'CLOUDFLARE'; + case Enum$DnsProvider.DIGITALOCEAN: + return r'DIGITALOCEAN'; + case Enum$DnsProvider.$unknown: + return r'$unknown'; + } } -enum Enum$ServerProvider { - @JsonValue('HETZNER') - HETZNER, - @JsonValue('DIGITALOCEAN') - DIGITALOCEAN, - $unknown +Enum$DnsProvider fromJson$Enum$DnsProvider(String value) { + switch (value) { + case r'CLOUDFLARE': + return Enum$DnsProvider.CLOUDFLARE; + case r'DIGITALOCEAN': + return Enum$DnsProvider.DIGITALOCEAN; + default: + return Enum$DnsProvider.$unknown; + } +} + +enum Enum$ServerProvider { HETZNER, DIGITALOCEAN, $unknown } + +String toJson$Enum$ServerProvider(Enum$ServerProvider e) { + switch (e) { + case Enum$ServerProvider.HETZNER: + return r'HETZNER'; + case Enum$ServerProvider.DIGITALOCEAN: + return r'DIGITALOCEAN'; + case Enum$ServerProvider.$unknown: + return r'$unknown'; + } +} + +Enum$ServerProvider fromJson$Enum$ServerProvider(String value) { + switch (value) { + case r'HETZNER': + return Enum$ServerProvider.HETZNER; + case r'DIGITALOCEAN': + return Enum$ServerProvider.DIGITALOCEAN; + default: + return Enum$ServerProvider.$unknown; + } } enum Enum$ServiceStatusEnum { - @JsonValue('ACTIVATING') ACTIVATING, - @JsonValue('ACTIVE') ACTIVE, - @JsonValue('DEACTIVATING') DEACTIVATING, - @JsonValue('FAILED') FAILED, - @JsonValue('INACTIVE') INACTIVE, - @JsonValue('OFF') OFF, - @JsonValue('RELOADING') RELOADING, $unknown } -enum Enum$Severity { - @JsonValue('CRITICAL') - CRITICAL, - @JsonValue('ERROR') - ERROR, - @JsonValue('INFO') - INFO, - @JsonValue('SUCCESS') - SUCCESS, - @JsonValue('WARNING') - WARNING, - $unknown +String toJson$Enum$ServiceStatusEnum(Enum$ServiceStatusEnum e) { + switch (e) { + case Enum$ServiceStatusEnum.ACTIVATING: + return r'ACTIVATING'; + case Enum$ServiceStatusEnum.ACTIVE: + return r'ACTIVE'; + case Enum$ServiceStatusEnum.DEACTIVATING: + return r'DEACTIVATING'; + case Enum$ServiceStatusEnum.FAILED: + return r'FAILED'; + case Enum$ServiceStatusEnum.INACTIVE: + return r'INACTIVE'; + case Enum$ServiceStatusEnum.OFF: + return r'OFF'; + case Enum$ServiceStatusEnum.RELOADING: + return r'RELOADING'; + case Enum$ServiceStatusEnum.$unknown: + return r'$unknown'; + } } -enum Enum$UserType { - @JsonValue('NORMAL') - NORMAL, - @JsonValue('PRIMARY') - PRIMARY, - @JsonValue('ROOT') - ROOT, - $unknown +Enum$ServiceStatusEnum fromJson$Enum$ServiceStatusEnum(String value) { + switch (value) { + case r'ACTIVATING': + return Enum$ServiceStatusEnum.ACTIVATING; + case r'ACTIVE': + return Enum$ServiceStatusEnum.ACTIVE; + case r'DEACTIVATING': + return Enum$ServiceStatusEnum.DEACTIVATING; + case r'FAILED': + return Enum$ServiceStatusEnum.FAILED; + case r'INACTIVE': + return Enum$ServiceStatusEnum.INACTIVE; + case r'OFF': + return Enum$ServiceStatusEnum.OFF; + case r'RELOADING': + return Enum$ServiceStatusEnum.RELOADING; + default: + return Enum$ServiceStatusEnum.$unknown; + } +} + +enum Enum$Severity { CRITICAL, ERROR, INFO, SUCCESS, WARNING, $unknown } + +String toJson$Enum$Severity(Enum$Severity e) { + switch (e) { + case Enum$Severity.CRITICAL: + return r'CRITICAL'; + case Enum$Severity.ERROR: + return r'ERROR'; + case Enum$Severity.INFO: + return r'INFO'; + case Enum$Severity.SUCCESS: + return r'SUCCESS'; + case Enum$Severity.WARNING: + return r'WARNING'; + case Enum$Severity.$unknown: + return r'$unknown'; + } +} + +Enum$Severity fromJson$Enum$Severity(String value) { + switch (value) { + case r'CRITICAL': + return Enum$Severity.CRITICAL; + case r'ERROR': + return Enum$Severity.ERROR; + case r'INFO': + return Enum$Severity.INFO; + case r'SUCCESS': + return Enum$Severity.SUCCESS; + case r'WARNING': + return Enum$Severity.WARNING; + default: + return Enum$Severity.$unknown; + } +} + +enum Enum$UserType { NORMAL, PRIMARY, ROOT, $unknown } + +String toJson$Enum$UserType(Enum$UserType e) { + switch (e) { + case Enum$UserType.NORMAL: + return r'NORMAL'; + case Enum$UserType.PRIMARY: + return r'PRIMARY'; + case Enum$UserType.ROOT: + return r'ROOT'; + case Enum$UserType.$unknown: + return r'$unknown'; + } +} + +Enum$UserType fromJson$Enum$UserType(String value) { + switch (value) { + case r'NORMAL': + return Enum$UserType.NORMAL; + case r'PRIMARY': + return Enum$UserType.PRIMARY; + case r'ROOT': + return Enum$UserType.ROOT; + default: + return Enum$UserType.$unknown; + } } -@JsonSerializable(explicitToJson: true) class Fragment$dnsRecordFields { - Fragment$dnsRecordFields( - {required this.content, - required this.name, - this.priority, - required this.recordType, - required this.ttl, - required this.$__typename}); + Fragment$dnsRecordFields({ + required this.content, + required this.name, + this.priority, + required this.recordType, + required this.ttl, + required this.$__typename, + }); - @override - factory Fragment$dnsRecordFields.fromJson(Map json) => - _$Fragment$dnsRecordFieldsFromJson(json); + factory Fragment$dnsRecordFields.fromJson(Map json) { + final l$content = json['content']; + final l$name = json['name']; + final l$priority = json['priority']; + final l$recordType = json['recordType']; + final l$ttl = json['ttl']; + final l$$__typename = json['__typename']; + return Fragment$dnsRecordFields( + content: (l$content as String), + name: (l$name as String), + priority: (l$priority as int?), + recordType: (l$recordType as String), + ttl: (l$ttl as int), + $__typename: (l$$__typename as String), + ); + } final String content; @@ -766,10 +1298,26 @@ class Fragment$dnsRecordFields { final int ttl; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Fragment$dnsRecordFieldsToJson(this); + Map toJson() { + final _resultData = {}; + final l$content = content; + _resultData['content'] = l$content; + final l$name = name; + _resultData['name'] = l$name; + final l$priority = priority; + _resultData['priority'] = l$priority; + final l$recordType = recordType; + _resultData['recordType'] = l$recordType; + final l$ttl = ttl; + _resultData['ttl'] = l$ttl; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$content = content; final l$name = name; @@ -777,33 +1325,55 @@ class Fragment$dnsRecordFields { final l$recordType = recordType; final l$ttl = ttl; final l$$__typename = $__typename; - return Object.hashAll( - [l$content, l$name, l$priority, l$recordType, l$ttl, l$$__typename]); + return Object.hashAll([ + l$content, + l$name, + l$priority, + l$recordType, + l$ttl, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Fragment$dnsRecordFields) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$content = content; final lOther$content = other.content; - if (l$content != lOther$content) return false; + if (l$content != lOther$content) { + return false; + } final l$name = name; final lOther$name = other.name; - if (l$name != lOther$name) return false; + if (l$name != lOther$name) { + return false; + } final l$priority = priority; final lOther$priority = other.priority; - if (l$priority != lOther$priority) return false; + if (l$priority != lOther$priority) { + return false; + } final l$recordType = recordType; final lOther$recordType = other.recordType; - if (l$recordType != lOther$recordType) return false; + if (l$recordType != lOther$recordType) { + return false; + } final l$ttl = ttl; final lOther$ttl = other.ttl; - if (l$ttl != lOther$ttl) return false; + if (l$ttl != lOther$ttl) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -811,29 +1381,37 @@ class Fragment$dnsRecordFields { extension UtilityExtension$Fragment$dnsRecordFields on Fragment$dnsRecordFields { CopyWith$Fragment$dnsRecordFields get copyWith => - CopyWith$Fragment$dnsRecordFields(this, (i) => i); + CopyWith$Fragment$dnsRecordFields( + this, + (i) => i, + ); } abstract class CopyWith$Fragment$dnsRecordFields { - factory CopyWith$Fragment$dnsRecordFields(Fragment$dnsRecordFields instance, - TRes Function(Fragment$dnsRecordFields) then) = - _CopyWithImpl$Fragment$dnsRecordFields; + factory CopyWith$Fragment$dnsRecordFields( + Fragment$dnsRecordFields instance, + TRes Function(Fragment$dnsRecordFields) then, + ) = _CopyWithImpl$Fragment$dnsRecordFields; factory CopyWith$Fragment$dnsRecordFields.stub(TRes res) = _CopyWithStubImpl$Fragment$dnsRecordFields; - TRes call( - {String? content, - String? name, - int? priority, - String? recordType, - int? ttl, - String? $__typename}); + TRes call({ + String? content, + String? name, + int? priority, + String? recordType, + int? ttl, + String? $__typename, + }); } class _CopyWithImpl$Fragment$dnsRecordFields implements CopyWith$Fragment$dnsRecordFields { - _CopyWithImpl$Fragment$dnsRecordFields(this._instance, this._then); + _CopyWithImpl$Fragment$dnsRecordFields( + this._instance, + this._then, + ); final Fragment$dnsRecordFields _instance; @@ -841,29 +1419,31 @@ class _CopyWithImpl$Fragment$dnsRecordFields static const _undefined = {}; - TRes call( - {Object? content = _undefined, - Object? name = _undefined, - Object? priority = _undefined, - Object? recordType = _undefined, - Object? ttl = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? content = _undefined, + Object? name = _undefined, + Object? priority = _undefined, + Object? recordType = _undefined, + Object? ttl = _undefined, + Object? $__typename = _undefined, + }) => _then(Fragment$dnsRecordFields( - content: content == _undefined || content == null - ? _instance.content - : (content as String), - name: name == _undefined || name == null - ? _instance.name - : (name as String), - priority: - priority == _undefined ? _instance.priority : (priority as int?), - recordType: recordType == _undefined || recordType == null - ? _instance.recordType - : (recordType as String), - ttl: ttl == _undefined || ttl == null ? _instance.ttl : (ttl as int), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + content: content == _undefined || content == null + ? _instance.content + : (content as String), + name: name == _undefined || name == null + ? _instance.name + : (name as String), + priority: + priority == _undefined ? _instance.priority : (priority as int?), + recordType: recordType == _undefined || recordType == null + ? _instance.recordType + : (recordType as String), + ttl: ttl == _undefined || ttl == null ? _instance.ttl : (ttl as int), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Fragment$dnsRecordFields @@ -872,86 +1452,105 @@ class _CopyWithStubImpl$Fragment$dnsRecordFields TRes _res; - call( - {String? content, - String? name, - int? priority, - String? recordType, - int? ttl, - String? $__typename}) => + call({ + String? content, + String? name, + int? priority, + String? recordType, + int? ttl, + String? $__typename, + }) => _res; } const fragmentDefinitiondnsRecordFields = FragmentDefinitionNode( - name: NameNode(value: 'dnsRecordFields'), - typeCondition: TypeConditionNode( - on: NamedTypeNode( - name: NameNode(value: 'DnsRecord'), isNonNull: false)), - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'content'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'name'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'priority'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'recordType'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'ttl'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])); + name: NameNode(value: 'dnsRecordFields'), + typeCondition: TypeConditionNode( + on: NamedTypeNode( + name: NameNode(value: 'DnsRecord'), + isNonNull: false, + )), + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'content'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'name'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'priority'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'recordType'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'ttl'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), +); const documentNodeFragmentdnsRecordFields = DocumentNode(definitions: [ fragmentDefinitiondnsRecordFields, ]); extension ClientExtension$Fragment$dnsRecordFields on graphql.GraphQLClient { - void writeFragment$dnsRecordFields( - {required Fragment$dnsRecordFields data, - required Map idFields, - bool broadcast = true}) => + void writeFragment$dnsRecordFields({ + required Fragment$dnsRecordFields data, + required Map idFields, + bool broadcast = true, + }) => this.writeFragment( - graphql.FragmentRequest( - idFields: idFields, - fragment: const graphql.Fragment( - fragmentName: 'dnsRecordFields', - document: documentNodeFragmentdnsRecordFields)), - data: data.toJson(), - broadcast: broadcast); - Fragment$dnsRecordFields? readFragment$dnsRecordFields( - {required Map idFields, bool optimistic = true}) { - final result = this.readFragment( graphql.FragmentRequest( - idFields: idFields, - fragment: const graphql.Fragment( - fragmentName: 'dnsRecordFields', - document: documentNodeFragmentdnsRecordFields)), - optimistic: optimistic); + idFields: idFields, + fragment: const graphql.Fragment( + fragmentName: 'dnsRecordFields', + document: documentNodeFragmentdnsRecordFields, + ), + ), + data: data.toJson(), + broadcast: broadcast, + ); + Fragment$dnsRecordFields? readFragment$dnsRecordFields({ + required Map idFields, + bool optimistic = true, + }) { + final result = this.readFragment( + graphql.FragmentRequest( + idFields: idFields, + fragment: const graphql.Fragment( + fragmentName: 'dnsRecordFields', + document: documentNodeFragmentdnsRecordFields, + ), + ), + optimistic: optimistic, + ); return result == null ? null : Fragment$dnsRecordFields.fromJson(result); } } @@ -966,11 +1565,7 @@ const possibleTypesMap = { 'ServiceJobMutationReturn', 'ServiceMutationReturn', 'TimezoneMutationReturn', - 'UserMutationReturn' + 'UserMutationReturn', }, - 'StorageUsageInterface': {'ServiceStorageUsage'} + 'StorageUsageInterface': {'ServiceStorageUsage'}, }; -DateTime? _nullable$dateTimeFromJson(dynamic data) => - data == null ? null : dateTimeFromJson(data); -dynamic _nullable$dateTimeToJson(DateTime? data) => - data == null ? null : dateTimeToJson(data); diff --git a/lib/logic/api_maps/graphql_maps/schema/schema.graphql.g.dart b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.g.dart deleted file mode 100644 index 7d1280c8..00000000 --- a/lib/logic/api_maps/graphql_maps/schema/schema.graphql.g.dart +++ /dev/null @@ -1,147 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'schema.graphql.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -Input$AutoUpgradeSettingsInput _$Input$AutoUpgradeSettingsInputFromJson( - Map json) => - Input$AutoUpgradeSettingsInput( - enableAutoUpgrade: json['enableAutoUpgrade'] as bool?, - allowReboot: json['allowReboot'] as bool?, - ); - -Map _$Input$AutoUpgradeSettingsInputToJson( - Input$AutoUpgradeSettingsInput instance) => - { - 'enableAutoUpgrade': instance.enableAutoUpgrade, - 'allowReboot': instance.allowReboot, - }; - -Input$MigrateToBindsInput _$Input$MigrateToBindsInputFromJson( - Map json) => - Input$MigrateToBindsInput( - emailBlockDevice: json['emailBlockDevice'] as String, - bitwardenBlockDevice: json['bitwardenBlockDevice'] as String, - giteaBlockDevice: json['giteaBlockDevice'] as String, - nextcloudBlockDevice: json['nextcloudBlockDevice'] as String, - pleromaBlockDevice: json['pleromaBlockDevice'] as String, - ); - -Map _$Input$MigrateToBindsInputToJson( - Input$MigrateToBindsInput instance) => - { - 'emailBlockDevice': instance.emailBlockDevice, - 'bitwardenBlockDevice': instance.bitwardenBlockDevice, - 'giteaBlockDevice': instance.giteaBlockDevice, - 'nextcloudBlockDevice': instance.nextcloudBlockDevice, - 'pleromaBlockDevice': instance.pleromaBlockDevice, - }; - -Input$MoveServiceInput _$Input$MoveServiceInputFromJson( - Map json) => - Input$MoveServiceInput( - serviceId: json['serviceId'] as String, - location: json['location'] as String, - ); - -Map _$Input$MoveServiceInputToJson( - Input$MoveServiceInput instance) => - { - 'serviceId': instance.serviceId, - 'location': instance.location, - }; - -Input$RecoveryKeyLimitsInput _$Input$RecoveryKeyLimitsInputFromJson( - Map json) => - Input$RecoveryKeyLimitsInput( - expirationDate: _nullable$dateTimeFromJson(json['expirationDate']), - uses: json['uses'] as int?, - ); - -Map _$Input$RecoveryKeyLimitsInputToJson( - Input$RecoveryKeyLimitsInput instance) => - { - 'expirationDate': _nullable$dateTimeToJson(instance.expirationDate), - 'uses': instance.uses, - }; - -Input$SshMutationInput _$Input$SshMutationInputFromJson( - Map json) => - Input$SshMutationInput( - username: json['username'] as String, - sshKey: json['sshKey'] as String, - ); - -Map _$Input$SshMutationInputToJson( - Input$SshMutationInput instance) => - { - 'username': instance.username, - 'sshKey': instance.sshKey, - }; - -Input$UseNewDeviceKeyInput _$Input$UseNewDeviceKeyInputFromJson( - Map json) => - Input$UseNewDeviceKeyInput( - key: json['key'] as String, - deviceName: json['deviceName'] as String, - ); - -Map _$Input$UseNewDeviceKeyInputToJson( - Input$UseNewDeviceKeyInput instance) => - { - 'key': instance.key, - 'deviceName': instance.deviceName, - }; - -Input$UseRecoveryKeyInput _$Input$UseRecoveryKeyInputFromJson( - Map json) => - Input$UseRecoveryKeyInput( - key: json['key'] as String, - deviceName: json['deviceName'] as String, - ); - -Map _$Input$UseRecoveryKeyInputToJson( - Input$UseRecoveryKeyInput instance) => - { - 'key': instance.key, - 'deviceName': instance.deviceName, - }; - -Input$UserMutationInput _$Input$UserMutationInputFromJson( - Map json) => - Input$UserMutationInput( - username: json['username'] as String, - password: json['password'] as String, - ); - -Map _$Input$UserMutationInputToJson( - Input$UserMutationInput instance) => - { - 'username': instance.username, - 'password': instance.password, - }; - -Fragment$dnsRecordFields _$Fragment$dnsRecordFieldsFromJson( - Map json) => - Fragment$dnsRecordFields( - content: json['content'] as String, - name: json['name'] as String, - priority: json['priority'] as int?, - recordType: json['recordType'] as String, - ttl: json['ttl'] as int, - $__typename: json['__typename'] as String, - ); - -Map _$Fragment$dnsRecordFieldsToJson( - Fragment$dnsRecordFields instance) => - { - 'content': instance.content, - 'name': instance.name, - 'priority': instance.priority, - 'recordType': instance.recordType, - 'ttl': instance.ttl, - '__typename': instance.$__typename, - }; diff --git a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart index 16c4a4a6..4eda2c92 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart @@ -1,24 +1,70 @@ import 'dart:async'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; -import 'package:json_annotation/json_annotation.dart'; import 'package:selfprivacy/utils/scalars.dart'; import 'schema.graphql.dart'; import 'services.graphql.dart'; -part 'server_api.graphql.g.dart'; -@JsonSerializable(explicitToJson: true) class Fragment$basicMutationReturnFields { - Fragment$basicMutationReturnFields( - {required this.code, - required this.message, - required this.success, - required this.$__typename}); + Fragment$basicMutationReturnFields({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override factory Fragment$basicMutationReturnFields.fromJson( - Map json) => - _$Fragment$basicMutationReturnFieldsFromJson(json); + Map json) { + switch (json["__typename"] as String) { + case "ApiKeyMutationReturn": + return Fragment$basicMutationReturnFields$$ApiKeyMutationReturn + .fromJson(json); + + case "AutoUpgradeSettingsMutationReturn": + return Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + .fromJson(json); + + case "DeviceApiTokenMutationReturn": + return Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn + .fromJson(json); + + case "GenericJobButationReturn": + return Fragment$basicMutationReturnFields$$GenericJobButationReturn + .fromJson(json); + + case "GenericMutationReturn": + return Fragment$basicMutationReturnFields$$GenericMutationReturn + .fromJson(json); + + case "ServiceJobMutationReturn": + return Fragment$basicMutationReturnFields$$ServiceJobMutationReturn + .fromJson(json); + + case "ServiceMutationReturn": + return Fragment$basicMutationReturnFields$$ServiceMutationReturn + .fromJson(json); + + case "TimezoneMutationReturn": + return Fragment$basicMutationReturnFields$$TimezoneMutationReturn + .fromJson(json); + + case "UserMutationReturn": + return Fragment$basicMutationReturnFields$$UserMutationReturn.fromJson( + json); + + default: + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + } final int code; @@ -26,36 +72,64 @@ class Fragment$basicMutationReturnFields { final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Fragment$basicMutationReturnFieldsToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; - return Object.hashAll([l$code, l$message, l$success, l$$__typename]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Fragment$basicMutationReturnFields) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -64,25 +138,35 @@ extension UtilityExtension$Fragment$basicMutationReturnFields on Fragment$basicMutationReturnFields { CopyWith$Fragment$basicMutationReturnFields< Fragment$basicMutationReturnFields> - get copyWith => - CopyWith$Fragment$basicMutationReturnFields(this, (i) => i); + get copyWith => CopyWith$Fragment$basicMutationReturnFields( + this, + (i) => i, + ); } abstract class CopyWith$Fragment$basicMutationReturnFields { factory CopyWith$Fragment$basicMutationReturnFields( - Fragment$basicMutationReturnFields instance, - TRes Function(Fragment$basicMutationReturnFields) then) = - _CopyWithImpl$Fragment$basicMutationReturnFields; + Fragment$basicMutationReturnFields instance, + TRes Function(Fragment$basicMutationReturnFields) then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields; factory CopyWith$Fragment$basicMutationReturnFields.stub(TRes res) = _CopyWithStubImpl$Fragment$basicMutationReturnFields; - TRes call({int? code, String? message, bool? success, String? $__typename}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); } class _CopyWithImpl$Fragment$basicMutationReturnFields implements CopyWith$Fragment$basicMutationReturnFields { - _CopyWithImpl$Fragment$basicMutationReturnFields(this._instance, this._then); + _CopyWithImpl$Fragment$basicMutationReturnFields( + this._instance, + this._then, + ); final Fragment$basicMutationReturnFields _instance; @@ -90,24 +174,25 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => _then(Fragment$basicMutationReturnFields( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Fragment$basicMutationReturnFields @@ -116,43 +201,54 @@ class _CopyWithStubImpl$Fragment$basicMutationReturnFields TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => _res; } const fragmentDefinitionbasicMutationReturnFields = FragmentDefinitionNode( - name: NameNode(value: 'basicMutationReturnFields'), - typeCondition: TypeConditionNode( - on: NamedTypeNode( - name: NameNode(value: 'MutationReturnInterface'), - isNonNull: false)), - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'code'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'message'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'success'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])); + name: NameNode(value: 'basicMutationReturnFields'), + typeCondition: TypeConditionNode( + on: NamedTypeNode( + name: NameNode(value: 'MutationReturnInterface'), + isNonNull: false, + )), + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'code'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'message'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'success'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), +); const documentNodeFragmentbasicMutationReturnFields = DocumentNode(definitions: [ fragmentDefinitionbasicMutationReturnFields, @@ -160,88 +256,1751 @@ const documentNodeFragmentbasicMutationReturnFields = extension ClientExtension$Fragment$basicMutationReturnFields on graphql.GraphQLClient { - void writeFragment$basicMutationReturnFields( - {required Fragment$basicMutationReturnFields data, - required Map idFields, - bool broadcast = true}) => + void writeFragment$basicMutationReturnFields({ + required Fragment$basicMutationReturnFields data, + required Map idFields, + bool broadcast = true, + }) => this.writeFragment( - graphql.FragmentRequest( - idFields: idFields, - fragment: const graphql.Fragment( - fragmentName: 'basicMutationReturnFields', - document: documentNodeFragmentbasicMutationReturnFields)), - data: data.toJson(), - broadcast: broadcast); - Fragment$basicMutationReturnFields? readFragment$basicMutationReturnFields( - {required Map idFields, bool optimistic = true}) { - final result = this.readFragment( graphql.FragmentRequest( - idFields: idFields, - fragment: const graphql.Fragment( - fragmentName: 'basicMutationReturnFields', - document: documentNodeFragmentbasicMutationReturnFields)), - optimistic: optimistic); + idFields: idFields, + fragment: const graphql.Fragment( + fragmentName: 'basicMutationReturnFields', + document: documentNodeFragmentbasicMutationReturnFields, + ), + ), + data: data.toJson(), + broadcast: broadcast, + ); + Fragment$basicMutationReturnFields? readFragment$basicMutationReturnFields({ + required Map idFields, + bool optimistic = true, + }) { + final result = this.readFragment( + graphql.FragmentRequest( + idFields: idFields, + fragment: const graphql.Fragment( + fragmentName: 'basicMutationReturnFields', + document: documentNodeFragmentbasicMutationReturnFields, + ), + ), + optimistic: optimistic, + ); return result == null ? null : Fragment$basicMutationReturnFields.fromJson(result); } } -@JsonSerializable(explicitToJson: true) -class Query$GetApiVersion { - Query$GetApiVersion({required this.api, required this.$__typename}); +class Fragment$basicMutationReturnFields$$ApiKeyMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$ApiKeyMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override - factory Query$GetApiVersion.fromJson(Map json) => - _$Query$GetApiVersionFromJson(json); + factory Fragment$basicMutationReturnFields$$ApiKeyMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } - final Query$GetApiVersion$api api; + final int code; + + final String message; + + final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$GetApiVersionToJson(this); - int get hashCode { - final l$api = api; + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; final l$$__typename = $__typename; - return Object.hashAll([l$api, l$$__typename]); + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Query$GetApiVersion) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) || + runtimeType != other.runtimeType) { return false; - final l$api = api; - final lOther$api = other.api; - if (l$api != lOther$api) return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn + on Fragment$basicMutationReturnFields$$ApiKeyMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + Fragment$basicMutationReturnFields$$ApiKeyMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + Fragment$basicMutationReturnFields$$ApiKeyMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$ApiKeyMutationReturn _instance; + + final TRes Function(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + on Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + instance, + TRes Function( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn + on Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn instance, + TRes Function( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn + _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$GenericJobButationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$GenericJobButationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$GenericJobButationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$GenericJobButationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$GenericJobButationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$GenericJobButationReturn + on Fragment$basicMutationReturnFields$$GenericJobButationReturn { + CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + Fragment$basicMutationReturnFields$$GenericJobButationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn( + Fragment$basicMutationReturnFields$$GenericJobButationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$GenericJobButationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$GenericJobButationReturn _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$GenericJobButationReturn) _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$GenericJobButationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$GenericMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$GenericMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$GenericMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$GenericMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Fragment$basicMutationReturnFields$$GenericMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$GenericMutationReturn + on Fragment$basicMutationReturnFields$$GenericMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn< + Fragment$basicMutationReturnFields$$GenericMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn( + Fragment$basicMutationReturnFields$$GenericMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$GenericMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$GenericMutationReturn _instance; + + final TRes Function(Fragment$basicMutationReturnFields$$GenericMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$GenericMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$ServiceJobMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$ServiceJobMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn + on Fragment$basicMutationReturnFields$$ServiceJobMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$ServiceJobMutationReturn _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$ServiceMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$ServiceMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$ServiceMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$ServiceMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Fragment$basicMutationReturnFields$$ServiceMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$ServiceMutationReturn + on Fragment$basicMutationReturnFields$$ServiceMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + Fragment$basicMutationReturnFields$$ServiceMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn( + Fragment$basicMutationReturnFields$$ServiceMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$ServiceMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$ServiceMutationReturn _instance; + + final TRes Function(Fragment$basicMutationReturnFields$$ServiceMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$ServiceMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$TimezoneMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$TimezoneMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$TimezoneMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$TimezoneMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$TimezoneMutationReturn + on Fragment$basicMutationReturnFields$$TimezoneMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + Fragment$basicMutationReturnFields$$TimezoneMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + Fragment$basicMutationReturnFields$$TimezoneMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$TimezoneMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$TimezoneMutationReturn _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$TimezoneMutationReturn) _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$UserMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$UserMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$UserMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$UserMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Fragment$basicMutationReturnFields$$UserMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$UserMutationReturn + on Fragment$basicMutationReturnFields$$UserMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn< + Fragment$basicMutationReturnFields$$UserMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn( + Fragment$basicMutationReturnFields$$UserMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$UserMutationReturn) then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$UserMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$UserMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$UserMutationReturn + implements + CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn { + _CopyWithImpl$Fragment$basicMutationReturnFields$$UserMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$UserMutationReturn _instance; + + final TRes Function(Fragment$basicMutationReturnFields$$UserMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$UserMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$UserMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$UserMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Query$GetApiVersion { + Query$GetApiVersion({ + required this.api, + required this.$__typename, + }); + + factory Query$GetApiVersion.fromJson(Map json) { + final l$api = json['api']; + final l$$__typename = json['__typename']; + return Query$GetApiVersion( + api: Query$GetApiVersion$api.fromJson((l$api as Map)), + $__typename: (l$$__typename as String), + ); + } + + final Query$GetApiVersion$api api; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$api = api; + _resultData['api'] = l$api.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$api = api; + final l$$__typename = $__typename; + return Object.hashAll([ + l$api, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Query$GetApiVersion) || runtimeType != other.runtimeType) { + return false; + } + final l$api = api; + final lOther$api = other.api; + if (l$api != lOther$api) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Query$GetApiVersion on Query$GetApiVersion { CopyWith$Query$GetApiVersion get copyWith => - CopyWith$Query$GetApiVersion(this, (i) => i); + CopyWith$Query$GetApiVersion( + this, + (i) => i, + ); } abstract class CopyWith$Query$GetApiVersion { - factory CopyWith$Query$GetApiVersion(Query$GetApiVersion instance, - TRes Function(Query$GetApiVersion) then) = - _CopyWithImpl$Query$GetApiVersion; + factory CopyWith$Query$GetApiVersion( + Query$GetApiVersion instance, + TRes Function(Query$GetApiVersion) then, + ) = _CopyWithImpl$Query$GetApiVersion; factory CopyWith$Query$GetApiVersion.stub(TRes res) = _CopyWithStubImpl$Query$GetApiVersion; - TRes call({Query$GetApiVersion$api? api, String? $__typename}); + TRes call({ + Query$GetApiVersion$api? api, + String? $__typename, + }); CopyWith$Query$GetApiVersion$api get api; } class _CopyWithImpl$Query$GetApiVersion implements CopyWith$Query$GetApiVersion { - _CopyWithImpl$Query$GetApiVersion(this._instance, this._then); + _CopyWithImpl$Query$GetApiVersion( + this._instance, + this._then, + ); final Query$GetApiVersion _instance; @@ -249,14 +2008,18 @@ class _CopyWithImpl$Query$GetApiVersion static const _undefined = {}; - TRes call({Object? api = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? api = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$GetApiVersion( - api: api == _undefined || api == null - ? _instance.api - : (api as Query$GetApiVersion$api), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + api: api == _undefined || api == null + ? _instance.api + : (api as Query$GetApiVersion$api), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Query$GetApiVersion$api get api { final local$api = _instance.api; return CopyWith$Query$GetApiVersion$api(local$api, (e) => call(api: e)); @@ -269,103 +2032,116 @@ class _CopyWithStubImpl$Query$GetApiVersion TRes _res; - call({Query$GetApiVersion$api? api, String? $__typename}) => _res; + call({ + Query$GetApiVersion$api? api, + String? $__typename, + }) => + _res; CopyWith$Query$GetApiVersion$api get api => CopyWith$Query$GetApiVersion$api.stub(_res); } const documentNodeQueryGetApiVersion = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'GetApiVersion'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'api'), + type: OperationType.query, + name: NameNode(value: 'GetApiVersion'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'api'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'version'), alias: null, arguments: [], directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'version'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + selectionSet: null, + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), ]); Query$GetApiVersion _parserFn$Query$GetApiVersion(Map data) => Query$GetApiVersion.fromJson(data); class Options$Query$GetApiVersion extends graphql.QueryOptions { - Options$Query$GetApiVersion( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - Duration? pollInterval, - graphql.Context? context}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - pollInterval: pollInterval, - context: context, - document: documentNodeQueryGetApiVersion, - parserFn: _parserFn$Query$GetApiVersion); + Options$Query$GetApiVersion({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Duration? pollInterval, + graphql.Context? context, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + pollInterval: pollInterval, + context: context, + document: documentNodeQueryGetApiVersion, + parserFn: _parserFn$Query$GetApiVersion, + ); } class WatchOptions$Query$GetApiVersion extends graphql.WatchQueryOptions { - WatchOptions$Query$GetApiVersion( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeQueryGetApiVersion, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Query$GetApiVersion); + WatchOptions$Query$GetApiVersion({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeQueryGetApiVersion, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Query$GetApiVersion, + ); } class FetchMoreOptions$Query$GetApiVersion extends graphql.FetchMoreOptions { FetchMoreOptions$Query$GetApiVersion( {required graphql.UpdateQuery updateQuery}) : super( - updateQuery: updateQuery, document: documentNodeQueryGetApiVersion); + updateQuery: updateQuery, + document: documentNodeQueryGetApiVersion, + ); } extension ClientExtension$Query$GetApiVersion on graphql.GraphQLClient { @@ -375,78 +2151,118 @@ extension ClientExtension$Query$GetApiVersion on graphql.GraphQLClient { graphql.ObservableQuery watchQuery$GetApiVersion( [WatchOptions$Query$GetApiVersion? options]) => this.watchQuery(options ?? WatchOptions$Query$GetApiVersion()); - void writeQuery$GetApiVersion( - {required Query$GetApiVersion data, bool broadcast = true}) => + void writeQuery$GetApiVersion({ + required Query$GetApiVersion data, + bool broadcast = true, + }) => this.writeQuery( - graphql.Request( - operation: - graphql.Operation(document: documentNodeQueryGetApiVersion)), - data: data.toJson(), - broadcast: broadcast); - Query$GetApiVersion? readQuery$GetApiVersion({bool optimistic = true}) { - final result = this.readQuery( graphql.Request( operation: graphql.Operation(document: documentNodeQueryGetApiVersion)), - optimistic: optimistic); + data: data.toJson(), + broadcast: broadcast, + ); + Query$GetApiVersion? readQuery$GetApiVersion({bool optimistic = true}) { + final result = this.readQuery( + graphql.Request( + operation: + graphql.Operation(document: documentNodeQueryGetApiVersion)), + optimistic: optimistic, + ); return result == null ? null : Query$GetApiVersion.fromJson(result); } } -@JsonSerializable(explicitToJson: true) class Query$GetApiVersion$api { - Query$GetApiVersion$api({required this.version, required this.$__typename}); + Query$GetApiVersion$api({ + required this.version, + required this.$__typename, + }); - @override - factory Query$GetApiVersion$api.fromJson(Map json) => - _$Query$GetApiVersion$apiFromJson(json); + factory Query$GetApiVersion$api.fromJson(Map json) { + final l$version = json['version']; + final l$$__typename = json['__typename']; + return Query$GetApiVersion$api( + version: (l$version as String), + $__typename: (l$$__typename as String), + ); + } final String version; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$GetApiVersion$apiToJson(this); + Map toJson() { + final _resultData = {}; + final l$version = version; + _resultData['version'] = l$version; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$version = version; final l$$__typename = $__typename; - return Object.hashAll([l$version, l$$__typename]); + return Object.hashAll([ + l$version, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Query$GetApiVersion$api) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Query$GetApiVersion$api) || + runtimeType != other.runtimeType) { return false; + } final l$version = version; final lOther$version = other.version; - if (l$version != lOther$version) return false; + if (l$version != lOther$version) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Query$GetApiVersion$api on Query$GetApiVersion$api { CopyWith$Query$GetApiVersion$api get copyWith => - CopyWith$Query$GetApiVersion$api(this, (i) => i); + CopyWith$Query$GetApiVersion$api( + this, + (i) => i, + ); } abstract class CopyWith$Query$GetApiVersion$api { - factory CopyWith$Query$GetApiVersion$api(Query$GetApiVersion$api instance, - TRes Function(Query$GetApiVersion$api) then) = - _CopyWithImpl$Query$GetApiVersion$api; + factory CopyWith$Query$GetApiVersion$api( + Query$GetApiVersion$api instance, + TRes Function(Query$GetApiVersion$api) then, + ) = _CopyWithImpl$Query$GetApiVersion$api; factory CopyWith$Query$GetApiVersion$api.stub(TRes res) = _CopyWithStubImpl$Query$GetApiVersion$api; - TRes call({String? version, String? $__typename}); + TRes call({ + String? version, + String? $__typename, + }); } class _CopyWithImpl$Query$GetApiVersion$api implements CopyWith$Query$GetApiVersion$api { - _CopyWithImpl$Query$GetApiVersion$api(this._instance, this._then); + _CopyWithImpl$Query$GetApiVersion$api( + this._instance, + this._then, + ); final Query$GetApiVersion$api _instance; @@ -454,14 +2270,18 @@ class _CopyWithImpl$Query$GetApiVersion$api static const _undefined = {}; - TRes call({Object? version = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? version = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$GetApiVersion$api( - version: version == _undefined || version == null - ? _instance.version - : (version as String), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + version: version == _undefined || version == null + ? _instance.version + : (version as String), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Query$GetApiVersion$api @@ -470,64 +2290,103 @@ class _CopyWithStubImpl$Query$GetApiVersion$api TRes _res; - call({String? version, String? $__typename}) => _res; + call({ + String? version, + String? $__typename, + }) => + _res; } -@JsonSerializable(explicitToJson: true) class Query$GetApiJobs { - Query$GetApiJobs({required this.jobs, required this.$__typename}); + Query$GetApiJobs({ + required this.jobs, + required this.$__typename, + }); - @override - factory Query$GetApiJobs.fromJson(Map json) => - _$Query$GetApiJobsFromJson(json); + factory Query$GetApiJobs.fromJson(Map json) { + final l$jobs = json['jobs']; + final l$$__typename = json['__typename']; + return Query$GetApiJobs( + jobs: Query$GetApiJobs$jobs.fromJson((l$jobs as Map)), + $__typename: (l$$__typename as String), + ); + } final Query$GetApiJobs$jobs jobs; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$GetApiJobsToJson(this); + Map toJson() { + final _resultData = {}; + final l$jobs = jobs; + _resultData['jobs'] = l$jobs.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$jobs = jobs; final l$$__typename = $__typename; - return Object.hashAll([l$jobs, l$$__typename]); + return Object.hashAll([ + l$jobs, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Query$GetApiJobs) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Query$GetApiJobs) || runtimeType != other.runtimeType) { return false; + } final l$jobs = jobs; final lOther$jobs = other.jobs; - if (l$jobs != lOther$jobs) return false; + if (l$jobs != lOther$jobs) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Query$GetApiJobs on Query$GetApiJobs { CopyWith$Query$GetApiJobs get copyWith => - CopyWith$Query$GetApiJobs(this, (i) => i); + CopyWith$Query$GetApiJobs( + this, + (i) => i, + ); } abstract class CopyWith$Query$GetApiJobs { factory CopyWith$Query$GetApiJobs( - Query$GetApiJobs instance, TRes Function(Query$GetApiJobs) then) = - _CopyWithImpl$Query$GetApiJobs; + Query$GetApiJobs instance, + TRes Function(Query$GetApiJobs) then, + ) = _CopyWithImpl$Query$GetApiJobs; factory CopyWith$Query$GetApiJobs.stub(TRes res) = _CopyWithStubImpl$Query$GetApiJobs; - TRes call({Query$GetApiJobs$jobs? jobs, String? $__typename}); + TRes call({ + Query$GetApiJobs$jobs? jobs, + String? $__typename, + }); CopyWith$Query$GetApiJobs$jobs get jobs; } class _CopyWithImpl$Query$GetApiJobs implements CopyWith$Query$GetApiJobs { - _CopyWithImpl$Query$GetApiJobs(this._instance, this._then); + _CopyWithImpl$Query$GetApiJobs( + this._instance, + this._then, + ); final Query$GetApiJobs _instance; @@ -535,14 +2394,18 @@ class _CopyWithImpl$Query$GetApiJobs static const _undefined = {}; - TRes call({Object? jobs = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? jobs = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$GetApiJobs( - jobs: jobs == _undefined || jobs == null - ? _instance.jobs - : (jobs as Query$GetApiJobs$jobs), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + jobs: jobs == _undefined || jobs == null + ? _instance.jobs + : (jobs as Query$GetApiJobs$jobs), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Query$GetApiJobs$jobs get jobs { final local$jobs = _instance.jobs; return CopyWith$Query$GetApiJobs$jobs(local$jobs, (e) => call(jobs: e)); @@ -555,173 +2418,199 @@ class _CopyWithStubImpl$Query$GetApiJobs TRes _res; - call({Query$GetApiJobs$jobs? jobs, String? $__typename}) => _res; + call({ + Query$GetApiJobs$jobs? jobs, + String? $__typename, + }) => + _res; CopyWith$Query$GetApiJobs$jobs get jobs => CopyWith$Query$GetApiJobs$jobs.stub(_res); } const documentNodeQueryGetApiJobs = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'GetApiJobs'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'jobs'), + type: OperationType.query, + name: NameNode(value: 'GetApiJobs'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'jobs'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'getJobs'), alias: null, arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ FieldNode( - name: NameNode(value: 'getJobs'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'createdAt'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'description'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'error'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'finishedAt'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'name'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'progress'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'result'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'status'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'statusText'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'uid'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'updatedAt'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), + name: NameNode(value: 'createdAt'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + name: NameNode(value: 'description'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'error'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'finishedAt'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'name'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'progress'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'result'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'status'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'statusText'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'uid'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'updatedAt'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), ]); Query$GetApiJobs _parserFn$Query$GetApiJobs(Map data) => Query$GetApiJobs.fromJson(data); class Options$Query$GetApiJobs extends graphql.QueryOptions { - Options$Query$GetApiJobs( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - Duration? pollInterval, - graphql.Context? context}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - pollInterval: pollInterval, - context: context, - document: documentNodeQueryGetApiJobs, - parserFn: _parserFn$Query$GetApiJobs); + Options$Query$GetApiJobs({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Duration? pollInterval, + graphql.Context? context, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + pollInterval: pollInterval, + context: context, + document: documentNodeQueryGetApiJobs, + parserFn: _parserFn$Query$GetApiJobs, + ); } class WatchOptions$Query$GetApiJobs extends graphql.WatchQueryOptions { - WatchOptions$Query$GetApiJobs( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeQueryGetApiJobs, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Query$GetApiJobs); + WatchOptions$Query$GetApiJobs({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeQueryGetApiJobs, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Query$GetApiJobs, + ); } class FetchMoreOptions$Query$GetApiJobs extends graphql.FetchMoreOptions { FetchMoreOptions$Query$GetApiJobs({required graphql.UpdateQuery updateQuery}) - : super(updateQuery: updateQuery, document: documentNodeQueryGetApiJobs); + : super( + updateQuery: updateQuery, + document: documentNodeQueryGetApiJobs, + ); } extension ClientExtension$Query$GetApiJobs on graphql.GraphQLClient { @@ -731,81 +2620,118 @@ extension ClientExtension$Query$GetApiJobs on graphql.GraphQLClient { graphql.ObservableQuery watchQuery$GetApiJobs( [WatchOptions$Query$GetApiJobs? options]) => this.watchQuery(options ?? WatchOptions$Query$GetApiJobs()); - void writeQuery$GetApiJobs( - {required Query$GetApiJobs data, bool broadcast = true}) => + void writeQuery$GetApiJobs({ + required Query$GetApiJobs data, + bool broadcast = true, + }) => this.writeQuery( - graphql.Request( - operation: - graphql.Operation(document: documentNodeQueryGetApiJobs)), - data: data.toJson(), - broadcast: broadcast); - Query$GetApiJobs? readQuery$GetApiJobs({bool optimistic = true}) { - final result = this.readQuery( graphql.Request( operation: graphql.Operation(document: documentNodeQueryGetApiJobs)), - optimistic: optimistic); + data: data.toJson(), + broadcast: broadcast, + ); + Query$GetApiJobs? readQuery$GetApiJobs({bool optimistic = true}) { + final result = this.readQuery( + graphql.Request( + operation: graphql.Operation(document: documentNodeQueryGetApiJobs)), + optimistic: optimistic, + ); return result == null ? null : Query$GetApiJobs.fromJson(result); } } -@JsonSerializable(explicitToJson: true) class Query$GetApiJobs$jobs { - Query$GetApiJobs$jobs({required this.getJobs, required this.$__typename}); + Query$GetApiJobs$jobs({ + required this.getJobs, + required this.$__typename, + }); - @override - factory Query$GetApiJobs$jobs.fromJson(Map json) => - _$Query$GetApiJobs$jobsFromJson(json); + factory Query$GetApiJobs$jobs.fromJson(Map json) { + final l$getJobs = json['getJobs']; + final l$$__typename = json['__typename']; + return Query$GetApiJobs$jobs( + getJobs: (l$getJobs as List) + .map((e) => Query$GetApiJobs$jobs$getJobs.fromJson( + (e as Map))) + .toList(), + $__typename: (l$$__typename as String), + ); + } final List getJobs; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$GetApiJobs$jobsToJson(this); + Map toJson() { + final _resultData = {}; + final l$getJobs = getJobs; + _resultData['getJobs'] = l$getJobs.map((e) => e.toJson()).toList(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$getJobs = getJobs; final l$$__typename = $__typename; - return Object.hashAll( - [Object.hashAll(l$getJobs.map((v) => v)), l$$__typename]); + return Object.hashAll([ + Object.hashAll(l$getJobs.map((v) => v)), + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Query$GetApiJobs$jobs) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Query$GetApiJobs$jobs) || runtimeType != other.runtimeType) { return false; + } final l$getJobs = getJobs; final lOther$getJobs = other.getJobs; - if (l$getJobs.length != lOther$getJobs.length) return false; + if (l$getJobs.length != lOther$getJobs.length) { + return false; + } for (int i = 0; i < l$getJobs.length; i++) { final l$getJobs$entry = l$getJobs[i]; final lOther$getJobs$entry = lOther$getJobs[i]; - if (l$getJobs$entry != lOther$getJobs$entry) return false; + if (l$getJobs$entry != lOther$getJobs$entry) { + return false; + } } - final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Query$GetApiJobs$jobs on Query$GetApiJobs$jobs { CopyWith$Query$GetApiJobs$jobs get copyWith => - CopyWith$Query$GetApiJobs$jobs(this, (i) => i); + CopyWith$Query$GetApiJobs$jobs( + this, + (i) => i, + ); } abstract class CopyWith$Query$GetApiJobs$jobs { - factory CopyWith$Query$GetApiJobs$jobs(Query$GetApiJobs$jobs instance, - TRes Function(Query$GetApiJobs$jobs) then) = - _CopyWithImpl$Query$GetApiJobs$jobs; + factory CopyWith$Query$GetApiJobs$jobs( + Query$GetApiJobs$jobs instance, + TRes Function(Query$GetApiJobs$jobs) then, + ) = _CopyWithImpl$Query$GetApiJobs$jobs; factory CopyWith$Query$GetApiJobs$jobs.stub(TRes res) = _CopyWithStubImpl$Query$GetApiJobs$jobs; - TRes call( - {List? getJobs, String? $__typename}); + TRes call({ + List? getJobs, + String? $__typename, + }); TRes getJobs( Iterable Function( Iterable< @@ -816,7 +2742,10 @@ abstract class CopyWith$Query$GetApiJobs$jobs { class _CopyWithImpl$Query$GetApiJobs$jobs implements CopyWith$Query$GetApiJobs$jobs { - _CopyWithImpl$Query$GetApiJobs$jobs(this._instance, this._then); + _CopyWithImpl$Query$GetApiJobs$jobs( + this._instance, + this._then, + ); final Query$GetApiJobs$jobs _instance; @@ -824,14 +2753,18 @@ class _CopyWithImpl$Query$GetApiJobs$jobs static const _undefined = {}; - TRes call({Object? getJobs = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? getJobs = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$GetApiJobs$jobs( - getJobs: getJobs == _undefined || getJobs == null - ? _instance.getJobs - : (getJobs as List), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + getJobs: getJobs == _undefined || getJobs == null + ? _instance.getJobs + : (getJobs as List), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); TRes getJobs( Iterable Function( Iterable< @@ -839,9 +2772,11 @@ class _CopyWithImpl$Query$GetApiJobs$jobs Query$GetApiJobs$jobs$getJobs>>) _fn) => call( - getJobs: _fn(_instance.getJobs.map( - (e) => CopyWith$Query$GetApiJobs$jobs$getJobs(e, (i) => i))) - .toList()); + getJobs: _fn(_instance.getJobs + .map((e) => CopyWith$Query$GetApiJobs$jobs$getJobs( + e, + (i) => i, + ))).toList()); } class _CopyWithStubImpl$Query$GetApiJobs$jobs @@ -850,40 +2785,65 @@ class _CopyWithStubImpl$Query$GetApiJobs$jobs TRes _res; - call({List? getJobs, String? $__typename}) => + call({ + List? getJobs, + String? $__typename, + }) => _res; getJobs(_fn) => _res; } -@JsonSerializable(explicitToJson: true) class Query$GetApiJobs$jobs$getJobs { - Query$GetApiJobs$jobs$getJobs( - {required this.createdAt, - required this.description, - this.error, - this.finishedAt, - required this.name, - this.progress, - this.result, - required this.status, - this.statusText, - required this.uid, - required this.updatedAt, - required this.$__typename}); + Query$GetApiJobs$jobs$getJobs({ + required this.createdAt, + required this.description, + this.error, + this.finishedAt, + required this.name, + this.progress, + this.result, + required this.status, + this.statusText, + required this.uid, + required this.updatedAt, + required this.$__typename, + }); - @override - factory Query$GetApiJobs$jobs$getJobs.fromJson(Map json) => - _$Query$GetApiJobs$jobs$getJobsFromJson(json); + factory Query$GetApiJobs$jobs$getJobs.fromJson(Map json) { + final l$createdAt = json['createdAt']; + final l$description = json['description']; + final l$error = json['error']; + final l$finishedAt = json['finishedAt']; + final l$name = json['name']; + final l$progress = json['progress']; + final l$result = json['result']; + final l$status = json['status']; + final l$statusText = json['statusText']; + final l$uid = json['uid']; + final l$updatedAt = json['updatedAt']; + final l$$__typename = json['__typename']; + return Query$GetApiJobs$jobs$getJobs( + createdAt: dateTimeFromJson(l$createdAt), + description: (l$description as String), + error: (l$error as String?), + finishedAt: l$finishedAt == null ? null : dateTimeFromJson(l$finishedAt), + name: (l$name as String), + progress: (l$progress as int?), + result: (l$result as String?), + status: (l$status as String), + statusText: (l$statusText as String?), + uid: (l$uid as String), + updatedAt: dateTimeFromJson(l$updatedAt), + $__typename: (l$$__typename as String), + ); + } - @JsonKey(fromJson: dateTimeFromJson, toJson: dateTimeToJson) final DateTime createdAt; final String description; final String? error; - @JsonKey( - fromJson: _nullable$dateTimeFromJson, toJson: _nullable$dateTimeToJson) final DateTime? finishedAt; final String name; @@ -898,13 +2858,41 @@ class Query$GetApiJobs$jobs$getJobs { final String uid; - @JsonKey(fromJson: dateTimeFromJson, toJson: dateTimeToJson) final DateTime updatedAt; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$GetApiJobs$jobs$getJobsToJson(this); + Map toJson() { + final _resultData = {}; + final l$createdAt = createdAt; + _resultData['createdAt'] = dateTimeToJson(l$createdAt); + final l$description = description; + _resultData['description'] = l$description; + final l$error = error; + _resultData['error'] = l$error; + final l$finishedAt = finishedAt; + _resultData['finishedAt'] = + l$finishedAt == null ? null : dateTimeToJson(l$finishedAt); + final l$name = name; + _resultData['name'] = l$name; + final l$progress = progress; + _resultData['progress'] = l$progress; + final l$result = result; + _resultData['result'] = l$result; + final l$status = status; + _resultData['status'] = l$status; + final l$statusText = statusText; + _resultData['statusText'] = l$statusText; + final l$uid = uid; + _resultData['uid'] = l$uid; + final l$updatedAt = updatedAt; + _resultData['updatedAt'] = dateTimeToJson(l$updatedAt); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$createdAt = createdAt; final l$description = description; @@ -930,51 +2918,79 @@ class Query$GetApiJobs$jobs$getJobs { l$statusText, l$uid, l$updatedAt, - l$$__typename + l$$__typename, ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$GetApiJobs$jobs$getJobs) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$createdAt = createdAt; final lOther$createdAt = other.createdAt; - if (l$createdAt != lOther$createdAt) return false; + if (l$createdAt != lOther$createdAt) { + return false; + } final l$description = description; final lOther$description = other.description; - if (l$description != lOther$description) return false; + if (l$description != lOther$description) { + return false; + } final l$error = error; final lOther$error = other.error; - if (l$error != lOther$error) return false; + if (l$error != lOther$error) { + return false; + } final l$finishedAt = finishedAt; final lOther$finishedAt = other.finishedAt; - if (l$finishedAt != lOther$finishedAt) return false; + if (l$finishedAt != lOther$finishedAt) { + return false; + } final l$name = name; final lOther$name = other.name; - if (l$name != lOther$name) return false; + if (l$name != lOther$name) { + return false; + } final l$progress = progress; final lOther$progress = other.progress; - if (l$progress != lOther$progress) return false; + if (l$progress != lOther$progress) { + return false; + } final l$result = result; final lOther$result = other.result; - if (l$result != lOther$result) return false; + if (l$result != lOther$result) { + return false; + } final l$status = status; final lOther$status = other.status; - if (l$status != lOther$status) return false; + if (l$status != lOther$status) { + return false; + } final l$statusText = statusText; final lOther$statusText = other.statusText; - if (l$statusText != lOther$statusText) return false; + if (l$statusText != lOther$statusText) { + return false; + } final l$uid = uid; final lOther$uid = other.uid; - if (l$uid != lOther$uid) return false; + if (l$uid != lOther$uid) { + return false; + } final l$updatedAt = updatedAt; final lOther$updatedAt = other.updatedAt; - if (l$updatedAt != lOther$updatedAt) return false; + if (l$updatedAt != lOther$updatedAt) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -982,36 +2998,43 @@ class Query$GetApiJobs$jobs$getJobs { extension UtilityExtension$Query$GetApiJobs$jobs$getJobs on Query$GetApiJobs$jobs$getJobs { CopyWith$Query$GetApiJobs$jobs$getJobs - get copyWith => CopyWith$Query$GetApiJobs$jobs$getJobs(this, (i) => i); + get copyWith => CopyWith$Query$GetApiJobs$jobs$getJobs( + this, + (i) => i, + ); } abstract class CopyWith$Query$GetApiJobs$jobs$getJobs { factory CopyWith$Query$GetApiJobs$jobs$getJobs( - Query$GetApiJobs$jobs$getJobs instance, - TRes Function(Query$GetApiJobs$jobs$getJobs) then) = - _CopyWithImpl$Query$GetApiJobs$jobs$getJobs; + Query$GetApiJobs$jobs$getJobs instance, + TRes Function(Query$GetApiJobs$jobs$getJobs) then, + ) = _CopyWithImpl$Query$GetApiJobs$jobs$getJobs; factory CopyWith$Query$GetApiJobs$jobs$getJobs.stub(TRes res) = _CopyWithStubImpl$Query$GetApiJobs$jobs$getJobs; - TRes call( - {DateTime? createdAt, - String? description, - String? error, - DateTime? finishedAt, - String? name, - int? progress, - String? result, - String? status, - String? statusText, - String? uid, - DateTime? updatedAt, - String? $__typename}); + TRes call({ + DateTime? createdAt, + String? description, + String? error, + DateTime? finishedAt, + String? name, + int? progress, + String? result, + String? status, + String? statusText, + String? uid, + DateTime? updatedAt, + String? $__typename, + }); } class _CopyWithImpl$Query$GetApiJobs$jobs$getJobs implements CopyWith$Query$GetApiJobs$jobs$getJobs { - _CopyWithImpl$Query$GetApiJobs$jobs$getJobs(this._instance, this._then); + _CopyWithImpl$Query$GetApiJobs$jobs$getJobs( + this._instance, + this._then, + ); final Query$GetApiJobs$jobs$getJobs _instance; @@ -1019,51 +3042,51 @@ class _CopyWithImpl$Query$GetApiJobs$jobs$getJobs static const _undefined = {}; - TRes call( - {Object? createdAt = _undefined, - Object? description = _undefined, - Object? error = _undefined, - Object? finishedAt = _undefined, - Object? name = _undefined, - Object? progress = _undefined, - Object? result = _undefined, - Object? status = _undefined, - Object? statusText = _undefined, - Object? uid = _undefined, - Object? updatedAt = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? createdAt = _undefined, + Object? description = _undefined, + Object? error = _undefined, + Object? finishedAt = _undefined, + Object? name = _undefined, + Object? progress = _undefined, + Object? result = _undefined, + Object? status = _undefined, + Object? statusText = _undefined, + Object? uid = _undefined, + Object? updatedAt = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$GetApiJobs$jobs$getJobs( - createdAt: createdAt == _undefined || createdAt == null - ? _instance.createdAt - : (createdAt as DateTime), - description: description == _undefined || description == null - ? _instance.description - : (description as String), - error: error == _undefined ? _instance.error : (error as String?), - finishedAt: finishedAt == _undefined - ? _instance.finishedAt - : (finishedAt as DateTime?), - name: name == _undefined || name == null - ? _instance.name - : (name as String), - progress: - progress == _undefined ? _instance.progress : (progress as int?), - result: result == _undefined ? _instance.result : (result as String?), - status: status == _undefined || status == null - ? _instance.status - : (status as String), - statusText: statusText == _undefined - ? _instance.statusText - : (statusText as String?), - uid: uid == _undefined || uid == null - ? _instance.uid - : (uid as String), - updatedAt: updatedAt == _undefined || updatedAt == null - ? _instance.updatedAt - : (updatedAt as DateTime), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + createdAt: createdAt == _undefined || createdAt == null + ? _instance.createdAt + : (createdAt as DateTime), + description: description == _undefined || description == null + ? _instance.description + : (description as String), + error: error == _undefined ? _instance.error : (error as String?), + finishedAt: finishedAt == _undefined + ? _instance.finishedAt + : (finishedAt as DateTime?), + name: name == _undefined || name == null + ? _instance.name + : (name as String), + progress: + progress == _undefined ? _instance.progress : (progress as int?), + result: result == _undefined ? _instance.result : (result as String?), + status: status == _undefined || status == null + ? _instance.status + : (status as String), + statusText: statusText == _undefined + ? _instance.statusText + : (statusText as String?), + uid: uid == _undefined || uid == null ? _instance.uid : (uid as String), + updatedAt: updatedAt == _undefined || updatedAt == null + ? _instance.updatedAt + : (updatedAt as DateTime), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Query$GetApiJobs$jobs$getJobs @@ -1072,58 +3095,82 @@ class _CopyWithStubImpl$Query$GetApiJobs$jobs$getJobs TRes _res; - call( - {DateTime? createdAt, - String? description, - String? error, - DateTime? finishedAt, - String? name, - int? progress, - String? result, - String? status, - String? statusText, - String? uid, - DateTime? updatedAt, - String? $__typename}) => + call({ + DateTime? createdAt, + String? description, + String? error, + DateTime? finishedAt, + String? name, + int? progress, + String? result, + String? status, + String? statusText, + String? uid, + DateTime? updatedAt, + String? $__typename, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Variables$Mutation$RemoveJob { - Variables$Mutation$RemoveJob({required this.jobId}); + factory Variables$Mutation$RemoveJob({required String jobId}) => + Variables$Mutation$RemoveJob._({ + r'jobId': jobId, + }); + + Variables$Mutation$RemoveJob._(this._$data); + + factory Variables$Mutation$RemoveJob.fromJson(Map data) { + final result$data = {}; + final l$jobId = data['jobId']; + result$data['jobId'] = (l$jobId as String); + return Variables$Mutation$RemoveJob._(result$data); + } + + Map _$data; + + String get jobId => (_$data['jobId'] as String); + Map toJson() { + final result$data = {}; + final l$jobId = jobId; + result$data['jobId'] = l$jobId; + return result$data; + } + + CopyWith$Variables$Mutation$RemoveJob + get copyWith => CopyWith$Variables$Mutation$RemoveJob( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$RemoveJob) || + runtimeType != other.runtimeType) { + return false; + } + final l$jobId = jobId; + final lOther$jobId = other.jobId; + if (l$jobId != lOther$jobId) { + return false; + } + return true; + } @override - factory Variables$Mutation$RemoveJob.fromJson(Map json) => - _$Variables$Mutation$RemoveJobFromJson(json); - - final String jobId; - - Map toJson() => _$Variables$Mutation$RemoveJobToJson(this); int get hashCode { final l$jobId = jobId; return Object.hashAll([l$jobId]); } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Variables$Mutation$RemoveJob) || - runtimeType != other.runtimeType) return false; - final l$jobId = jobId; - final lOther$jobId = other.jobId; - if (l$jobId != lOther$jobId) return false; - return true; - } - - CopyWith$Variables$Mutation$RemoveJob - get copyWith => CopyWith$Variables$Mutation$RemoveJob(this, (i) => i); } abstract class CopyWith$Variables$Mutation$RemoveJob { factory CopyWith$Variables$Mutation$RemoveJob( - Variables$Mutation$RemoveJob instance, - TRes Function(Variables$Mutation$RemoveJob) then) = - _CopyWithImpl$Variables$Mutation$RemoveJob; + Variables$Mutation$RemoveJob instance, + TRes Function(Variables$Mutation$RemoveJob) then, + ) = _CopyWithImpl$Variables$Mutation$RemoveJob; factory CopyWith$Variables$Mutation$RemoveJob.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$RemoveJob; @@ -1133,7 +3180,10 @@ abstract class CopyWith$Variables$Mutation$RemoveJob { class _CopyWithImpl$Variables$Mutation$RemoveJob implements CopyWith$Variables$Mutation$RemoveJob { - _CopyWithImpl$Variables$Mutation$RemoveJob(this._instance, this._then); + _CopyWithImpl$Variables$Mutation$RemoveJob( + this._instance, + this._then, + ); final Variables$Mutation$RemoveJob _instance; @@ -1141,10 +3191,11 @@ class _CopyWithImpl$Variables$Mutation$RemoveJob static const _undefined = {}; - TRes call({Object? jobId = _undefined}) => _then(Variables$Mutation$RemoveJob( - jobId: jobId == _undefined || jobId == null - ? _instance.jobId - : (jobId as String))); + TRes call({Object? jobId = _undefined}) => + _then(Variables$Mutation$RemoveJob._({ + ..._instance._$data, + if (jobId != _undefined && jobId != null) 'jobId': (jobId as String), + })); } class _CopyWithStubImpl$Variables$Mutation$RemoveJob @@ -1156,61 +3207,97 @@ class _CopyWithStubImpl$Variables$Mutation$RemoveJob call({String? jobId}) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$RemoveJob { - Mutation$RemoveJob({required this.removeJob, required this.$__typename}); + Mutation$RemoveJob({ + required this.removeJob, + required this.$__typename, + }); - @override - factory Mutation$RemoveJob.fromJson(Map json) => - _$Mutation$RemoveJobFromJson(json); + factory Mutation$RemoveJob.fromJson(Map json) { + final l$removeJob = json['removeJob']; + final l$$__typename = json['__typename']; + return Mutation$RemoveJob( + removeJob: Mutation$RemoveJob$removeJob.fromJson( + (l$removeJob as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$RemoveJob$removeJob removeJob; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$RemoveJobToJson(this); + Map toJson() { + final _resultData = {}; + final l$removeJob = removeJob; + _resultData['removeJob'] = l$removeJob.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$removeJob = removeJob; final l$$__typename = $__typename; - return Object.hashAll([l$removeJob, l$$__typename]); + return Object.hashAll([ + l$removeJob, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Mutation$RemoveJob) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Mutation$RemoveJob) || runtimeType != other.runtimeType) { return false; + } final l$removeJob = removeJob; final lOther$removeJob = other.removeJob; - if (l$removeJob != lOther$removeJob) return false; + if (l$removeJob != lOther$removeJob) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Mutation$RemoveJob on Mutation$RemoveJob { CopyWith$Mutation$RemoveJob get copyWith => - CopyWith$Mutation$RemoveJob(this, (i) => i); + CopyWith$Mutation$RemoveJob( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$RemoveJob { factory CopyWith$Mutation$RemoveJob( - Mutation$RemoveJob instance, TRes Function(Mutation$RemoveJob) then) = - _CopyWithImpl$Mutation$RemoveJob; + Mutation$RemoveJob instance, + TRes Function(Mutation$RemoveJob) then, + ) = _CopyWithImpl$Mutation$RemoveJob; factory CopyWith$Mutation$RemoveJob.stub(TRes res) = _CopyWithStubImpl$Mutation$RemoveJob; - TRes call({Mutation$RemoveJob$removeJob? removeJob, String? $__typename}); + TRes call({ + Mutation$RemoveJob$removeJob? removeJob, + String? $__typename, + }); CopyWith$Mutation$RemoveJob$removeJob get removeJob; } class _CopyWithImpl$Mutation$RemoveJob implements CopyWith$Mutation$RemoveJob { - _CopyWithImpl$Mutation$RemoveJob(this._instance, this._then); + _CopyWithImpl$Mutation$RemoveJob( + this._instance, + this._then, + ); final Mutation$RemoveJob _instance; @@ -1218,15 +3305,18 @@ class _CopyWithImpl$Mutation$RemoveJob static const _undefined = {}; - TRes call( - {Object? removeJob = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? removeJob = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$RemoveJob( - removeJob: removeJob == _undefined || removeJob == null - ? _instance.removeJob - : (removeJob as Mutation$RemoveJob$removeJob), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + removeJob: removeJob == _undefined || removeJob == null + ? _instance.removeJob + : (removeJob as Mutation$RemoveJob$removeJob), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$RemoveJob$removeJob get removeJob { final local$removeJob = _instance.removeJob; return CopyWith$Mutation$RemoveJob$removeJob( @@ -1240,89 +3330,107 @@ class _CopyWithStubImpl$Mutation$RemoveJob TRes _res; - call({Mutation$RemoveJob$removeJob? removeJob, String? $__typename}) => _res; + call({ + Mutation$RemoveJob$removeJob? removeJob, + String? $__typename, + }) => + _res; CopyWith$Mutation$RemoveJob$removeJob get removeJob => CopyWith$Mutation$RemoveJob$removeJob.stub(_res); } const documentNodeMutationRemoveJob = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'RemoveJob'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'jobId')), - type: - NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'removeJob'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'jobId'), - value: VariableNode(name: NameNode(value: 'jobId'))) - ], + type: OperationType.mutation, + name: NameNode(value: 'RemoveJob'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'jobId')), + type: NamedTypeNode( + name: NameNode(value: 'String'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'removeJob'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'jobId'), + value: VariableNode(name: NameNode(value: 'jobId')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$RemoveJob _parserFn$Mutation$RemoveJob(Map data) => Mutation$RemoveJob.fromJson(data); typedef OnMutationCompleted$Mutation$RemoveJob = FutureOr Function( - dynamic, Mutation$RemoveJob?); + dynamic, + Mutation$RemoveJob?, +); class Options$Mutation$RemoveJob extends graphql.MutationOptions { - Options$Mutation$RemoveJob( - {String? operationName, - required Variables$Mutation$RemoveJob variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$RemoveJob? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$RemoveJob({ + String? operationName, + required Variables$Mutation$RemoveJob variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$RemoveJob? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted(data, - data == null ? null : _parserFn$Mutation$RemoveJob(data)), - update: update, - onError: onError, - document: documentNodeMutationRemoveJob, - parserFn: _parserFn$Mutation$RemoveJob); + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( + data, + data == null ? null : _parserFn$Mutation$RemoveJob(data), + ), + update: update, + onError: onError, + document: documentNodeMutationRemoveJob, + parserFn: _parserFn$Mutation$RemoveJob, + ); final OnMutationCompleted$Mutation$RemoveJob? onCompletedWithParsed; @@ -1331,38 +3439,39 @@ class Options$Mutation$RemoveJob ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$RemoveJob extends graphql.WatchQueryOptions { - WatchOptions$Mutation$RemoveJob( - {String? operationName, - required Variables$Mutation$RemoveJob variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationRemoveJob, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$RemoveJob); + WatchOptions$Mutation$RemoveJob({ + String? operationName, + required Variables$Mutation$RemoveJob variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationRemoveJob, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$RemoveJob, + ); } extension ClientExtension$Mutation$RemoveJob on graphql.GraphQLClient { @@ -1374,18 +3483,27 @@ extension ClientExtension$Mutation$RemoveJob on graphql.GraphQLClient { this.watchMutation(options); } -@JsonSerializable(explicitToJson: true) class Mutation$RemoveJob$removeJob - implements Fragment$basicMutationReturnFields { - Mutation$RemoveJob$removeJob( - {required this.code, - required this.message, - required this.success, - required this.$__typename}); + implements Fragment$basicMutationReturnFields$$GenericMutationReturn { + Mutation$RemoveJob$removeJob({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override - factory Mutation$RemoveJob$removeJob.fromJson(Map json) => - _$Mutation$RemoveJob$removeJobFromJson(json); + factory Mutation$RemoveJob$removeJob.fromJson(Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Mutation$RemoveJob$removeJob( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } final int code; @@ -1393,35 +3511,64 @@ class Mutation$RemoveJob$removeJob final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$RemoveJob$removeJobToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; - return Object.hashAll([l$code, l$message, l$success, l$$__typename]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$RemoveJob$removeJob) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -1429,24 +3576,35 @@ class Mutation$RemoveJob$removeJob extension UtilityExtension$Mutation$RemoveJob$removeJob on Mutation$RemoveJob$removeJob { CopyWith$Mutation$RemoveJob$removeJob - get copyWith => CopyWith$Mutation$RemoveJob$removeJob(this, (i) => i); + get copyWith => CopyWith$Mutation$RemoveJob$removeJob( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$RemoveJob$removeJob { factory CopyWith$Mutation$RemoveJob$removeJob( - Mutation$RemoveJob$removeJob instance, - TRes Function(Mutation$RemoveJob$removeJob) then) = - _CopyWithImpl$Mutation$RemoveJob$removeJob; + Mutation$RemoveJob$removeJob instance, + TRes Function(Mutation$RemoveJob$removeJob) then, + ) = _CopyWithImpl$Mutation$RemoveJob$removeJob; factory CopyWith$Mutation$RemoveJob$removeJob.stub(TRes res) = _CopyWithStubImpl$Mutation$RemoveJob$removeJob; - TRes call({int? code, String? message, bool? success, String? $__typename}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); } class _CopyWithImpl$Mutation$RemoveJob$removeJob implements CopyWith$Mutation$RemoveJob$removeJob { - _CopyWithImpl$Mutation$RemoveJob$removeJob(this._instance, this._then); + _CopyWithImpl$Mutation$RemoveJob$removeJob( + this._instance, + this._then, + ); final Mutation$RemoveJob$removeJob _instance; @@ -1454,24 +3612,25 @@ class _CopyWithImpl$Mutation$RemoveJob$removeJob static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$RemoveJob$removeJob( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Mutation$RemoveJob$removeJob @@ -1480,42 +3639,73 @@ class _CopyWithStubImpl$Mutation$RemoveJob$removeJob TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$RunSystemRebuild { - Mutation$RunSystemRebuild( - {required this.runSystemRebuild, required this.$__typename}); + Mutation$RunSystemRebuild({ + required this.runSystemRebuild, + required this.$__typename, + }); - @override - factory Mutation$RunSystemRebuild.fromJson(Map json) => - _$Mutation$RunSystemRebuildFromJson(json); + factory Mutation$RunSystemRebuild.fromJson(Map json) { + final l$runSystemRebuild = json['runSystemRebuild']; + final l$$__typename = json['__typename']; + return Mutation$RunSystemRebuild( + runSystemRebuild: Mutation$RunSystemRebuild$runSystemRebuild.fromJson( + (l$runSystemRebuild as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$RunSystemRebuild$runSystemRebuild runSystemRebuild; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$RunSystemRebuildToJson(this); + Map toJson() { + final _resultData = {}; + final l$runSystemRebuild = runSystemRebuild; + _resultData['runSystemRebuild'] = l$runSystemRebuild.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$runSystemRebuild = runSystemRebuild; final l$$__typename = $__typename; - return Object.hashAll([l$runSystemRebuild, l$$__typename]); + return Object.hashAll([ + l$runSystemRebuild, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$RunSystemRebuild) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$runSystemRebuild = runSystemRebuild; final lOther$runSystemRebuild = other.runSystemRebuild; - if (l$runSystemRebuild != lOther$runSystemRebuild) return false; + if (l$runSystemRebuild != lOther$runSystemRebuild) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -1523,27 +3713,35 @@ class Mutation$RunSystemRebuild { extension UtilityExtension$Mutation$RunSystemRebuild on Mutation$RunSystemRebuild { CopyWith$Mutation$RunSystemRebuild get copyWith => - CopyWith$Mutation$RunSystemRebuild(this, (i) => i); + CopyWith$Mutation$RunSystemRebuild( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$RunSystemRebuild { - factory CopyWith$Mutation$RunSystemRebuild(Mutation$RunSystemRebuild instance, - TRes Function(Mutation$RunSystemRebuild) then) = - _CopyWithImpl$Mutation$RunSystemRebuild; + factory CopyWith$Mutation$RunSystemRebuild( + Mutation$RunSystemRebuild instance, + TRes Function(Mutation$RunSystemRebuild) then, + ) = _CopyWithImpl$Mutation$RunSystemRebuild; factory CopyWith$Mutation$RunSystemRebuild.stub(TRes res) = _CopyWithStubImpl$Mutation$RunSystemRebuild; - TRes call( - {Mutation$RunSystemRebuild$runSystemRebuild? runSystemRebuild, - String? $__typename}); + TRes call({ + Mutation$RunSystemRebuild$runSystemRebuild? runSystemRebuild, + String? $__typename, + }); CopyWith$Mutation$RunSystemRebuild$runSystemRebuild get runSystemRebuild; } class _CopyWithImpl$Mutation$RunSystemRebuild implements CopyWith$Mutation$RunSystemRebuild { - _CopyWithImpl$Mutation$RunSystemRebuild(this._instance, this._then); + _CopyWithImpl$Mutation$RunSystemRebuild( + this._instance, + this._then, + ); final Mutation$RunSystemRebuild _instance; @@ -1551,18 +3749,19 @@ class _CopyWithImpl$Mutation$RunSystemRebuild static const _undefined = {}; - TRes call( - {Object? runSystemRebuild = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? runSystemRebuild = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$RunSystemRebuild( - runSystemRebuild: - runSystemRebuild == _undefined || runSystemRebuild == null - ? _instance.runSystemRebuild - : (runSystemRebuild - as Mutation$RunSystemRebuild$runSystemRebuild), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + runSystemRebuild: runSystemRebuild == _undefined || + runSystemRebuild == null + ? _instance.runSystemRebuild + : (runSystemRebuild as Mutation$RunSystemRebuild$runSystemRebuild), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$RunSystemRebuild$runSystemRebuild get runSystemRebuild { final local$runSystemRebuild = _instance.runSystemRebuild; @@ -1577,9 +3776,10 @@ class _CopyWithStubImpl$Mutation$RunSystemRebuild TRes _res; - call( - {Mutation$RunSystemRebuild$runSystemRebuild? runSystemRebuild, - String? $__typename}) => + call({ + Mutation$RunSystemRebuild$runSystemRebuild? runSystemRebuild, + String? $__typename, + }) => _res; CopyWith$Mutation$RunSystemRebuild$runSystemRebuild get runSystemRebuild => @@ -1588,73 +3788,82 @@ class _CopyWithStubImpl$Mutation$RunSystemRebuild const documentNodeMutationRunSystemRebuild = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'RunSystemRebuild'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'runSystemRebuild'), - alias: null, - arguments: [], + type: OperationType.mutation, + name: NameNode(value: 'RunSystemRebuild'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'runSystemRebuild'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$RunSystemRebuild _parserFn$Mutation$RunSystemRebuild( Map data) => Mutation$RunSystemRebuild.fromJson(data); typedef OnMutationCompleted$Mutation$RunSystemRebuild = FutureOr Function( - dynamic, Mutation$RunSystemRebuild?); + dynamic, + Mutation$RunSystemRebuild?, +); class Options$Mutation$RunSystemRebuild extends graphql.MutationOptions { - Options$Mutation$RunSystemRebuild( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$RunSystemRebuild? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$RunSystemRebuild({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$RunSystemRebuild? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( data, data == null ? null - : _parserFn$Mutation$RunSystemRebuild(data)), - update: update, - onError: onError, - document: documentNodeMutationRunSystemRebuild, - parserFn: _parserFn$Mutation$RunSystemRebuild); + : _parserFn$Mutation$RunSystemRebuild(data), + ), + update: update, + onError: onError, + document: documentNodeMutationRunSystemRebuild, + parserFn: _parserFn$Mutation$RunSystemRebuild, + ); final OnMutationCompleted$Mutation$RunSystemRebuild? onCompletedWithParsed; @@ -1663,36 +3872,37 @@ class Options$Mutation$RunSystemRebuild ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$RunSystemRebuild extends graphql.WatchQueryOptions { - WatchOptions$Mutation$RunSystemRebuild( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationRunSystemRebuild, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$RunSystemRebuild); + WatchOptions$Mutation$RunSystemRebuild({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationRunSystemRebuild, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$RunSystemRebuild, + ); } extension ClientExtension$Mutation$RunSystemRebuild on graphql.GraphQLClient { @@ -1706,19 +3916,28 @@ extension ClientExtension$Mutation$RunSystemRebuild on graphql.GraphQLClient { this.watchMutation(options ?? WatchOptions$Mutation$RunSystemRebuild()); } -@JsonSerializable(explicitToJson: true) class Mutation$RunSystemRebuild$runSystemRebuild - implements Fragment$basicMutationReturnFields { - Mutation$RunSystemRebuild$runSystemRebuild( - {required this.code, - required this.message, - required this.success, - required this.$__typename}); + implements Fragment$basicMutationReturnFields$$GenericMutationReturn { + Mutation$RunSystemRebuild$runSystemRebuild({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override factory Mutation$RunSystemRebuild$runSystemRebuild.fromJson( - Map json) => - _$Mutation$RunSystemRebuild$runSystemRebuildFromJson(json); + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Mutation$RunSystemRebuild$runSystemRebuild( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } final int code; @@ -1726,36 +3945,64 @@ class Mutation$RunSystemRebuild$runSystemRebuild final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Mutation$RunSystemRebuild$runSystemRebuildToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; - return Object.hashAll([l$code, l$message, l$success, l$$__typename]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$RunSystemRebuild$runSystemRebuild) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -1764,26 +4011,35 @@ extension UtilityExtension$Mutation$RunSystemRebuild$runSystemRebuild on Mutation$RunSystemRebuild$runSystemRebuild { CopyWith$Mutation$RunSystemRebuild$runSystemRebuild< Mutation$RunSystemRebuild$runSystemRebuild> - get copyWith => - CopyWith$Mutation$RunSystemRebuild$runSystemRebuild(this, (i) => i); + get copyWith => CopyWith$Mutation$RunSystemRebuild$runSystemRebuild( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$RunSystemRebuild$runSystemRebuild { factory CopyWith$Mutation$RunSystemRebuild$runSystemRebuild( - Mutation$RunSystemRebuild$runSystemRebuild instance, - TRes Function(Mutation$RunSystemRebuild$runSystemRebuild) then) = - _CopyWithImpl$Mutation$RunSystemRebuild$runSystemRebuild; + Mutation$RunSystemRebuild$runSystemRebuild instance, + TRes Function(Mutation$RunSystemRebuild$runSystemRebuild) then, + ) = _CopyWithImpl$Mutation$RunSystemRebuild$runSystemRebuild; factory CopyWith$Mutation$RunSystemRebuild$runSystemRebuild.stub(TRes res) = _CopyWithStubImpl$Mutation$RunSystemRebuild$runSystemRebuild; - TRes call({int? code, String? message, bool? success, String? $__typename}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); } class _CopyWithImpl$Mutation$RunSystemRebuild$runSystemRebuild implements CopyWith$Mutation$RunSystemRebuild$runSystemRebuild { _CopyWithImpl$Mutation$RunSystemRebuild$runSystemRebuild( - this._instance, this._then); + this._instance, + this._then, + ); final Mutation$RunSystemRebuild$runSystemRebuild _instance; @@ -1791,24 +4047,25 @@ class _CopyWithImpl$Mutation$RunSystemRebuild$runSystemRebuild static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$RunSystemRebuild$runSystemRebuild( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Mutation$RunSystemRebuild$runSystemRebuild @@ -1817,42 +4074,73 @@ class _CopyWithStubImpl$Mutation$RunSystemRebuild$runSystemRebuild TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$RunSystemRollback { - Mutation$RunSystemRollback( - {required this.runSystemRollback, required this.$__typename}); + Mutation$RunSystemRollback({ + required this.runSystemRollback, + required this.$__typename, + }); - @override - factory Mutation$RunSystemRollback.fromJson(Map json) => - _$Mutation$RunSystemRollbackFromJson(json); + factory Mutation$RunSystemRollback.fromJson(Map json) { + final l$runSystemRollback = json['runSystemRollback']; + final l$$__typename = json['__typename']; + return Mutation$RunSystemRollback( + runSystemRollback: Mutation$RunSystemRollback$runSystemRollback.fromJson( + (l$runSystemRollback as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$RunSystemRollback$runSystemRollback runSystemRollback; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$RunSystemRollbackToJson(this); + Map toJson() { + final _resultData = {}; + final l$runSystemRollback = runSystemRollback; + _resultData['runSystemRollback'] = l$runSystemRollback.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$runSystemRollback = runSystemRollback; final l$$__typename = $__typename; - return Object.hashAll([l$runSystemRollback, l$$__typename]); + return Object.hashAll([ + l$runSystemRollback, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$RunSystemRollback) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$runSystemRollback = runSystemRollback; final lOther$runSystemRollback = other.runSystemRollback; - if (l$runSystemRollback != lOther$runSystemRollback) return false; + if (l$runSystemRollback != lOther$runSystemRollback) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -1860,28 +4148,35 @@ class Mutation$RunSystemRollback { extension UtilityExtension$Mutation$RunSystemRollback on Mutation$RunSystemRollback { CopyWith$Mutation$RunSystemRollback - get copyWith => CopyWith$Mutation$RunSystemRollback(this, (i) => i); + get copyWith => CopyWith$Mutation$RunSystemRollback( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$RunSystemRollback { factory CopyWith$Mutation$RunSystemRollback( - Mutation$RunSystemRollback instance, - TRes Function(Mutation$RunSystemRollback) then) = - _CopyWithImpl$Mutation$RunSystemRollback; + Mutation$RunSystemRollback instance, + TRes Function(Mutation$RunSystemRollback) then, + ) = _CopyWithImpl$Mutation$RunSystemRollback; factory CopyWith$Mutation$RunSystemRollback.stub(TRes res) = _CopyWithStubImpl$Mutation$RunSystemRollback; - TRes call( - {Mutation$RunSystemRollback$runSystemRollback? runSystemRollback, - String? $__typename}); + TRes call({ + Mutation$RunSystemRollback$runSystemRollback? runSystemRollback, + String? $__typename, + }); CopyWith$Mutation$RunSystemRollback$runSystemRollback get runSystemRollback; } class _CopyWithImpl$Mutation$RunSystemRollback implements CopyWith$Mutation$RunSystemRollback { - _CopyWithImpl$Mutation$RunSystemRollback(this._instance, this._then); + _CopyWithImpl$Mutation$RunSystemRollback( + this._instance, + this._then, + ); final Mutation$RunSystemRollback _instance; @@ -1889,18 +4184,20 @@ class _CopyWithImpl$Mutation$RunSystemRollback static const _undefined = {}; - TRes call( - {Object? runSystemRollback = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? runSystemRollback = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$RunSystemRollback( - runSystemRollback: - runSystemRollback == _undefined || runSystemRollback == null - ? _instance.runSystemRollback - : (runSystemRollback - as Mutation$RunSystemRollback$runSystemRollback), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + runSystemRollback: + runSystemRollback == _undefined || runSystemRollback == null + ? _instance.runSystemRollback + : (runSystemRollback + as Mutation$RunSystemRollback$runSystemRollback), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$RunSystemRollback$runSystemRollback get runSystemRollback { final local$runSystemRollback = _instance.runSystemRollback; @@ -1915,9 +4212,10 @@ class _CopyWithStubImpl$Mutation$RunSystemRollback TRes _res; - call( - {Mutation$RunSystemRollback$runSystemRollback? runSystemRollback, - String? $__typename}) => + call({ + Mutation$RunSystemRollback$runSystemRollback? runSystemRollback, + String? $__typename, + }) => _res; CopyWith$Mutation$RunSystemRollback$runSystemRollback get runSystemRollback => @@ -1926,73 +4224,83 @@ class _CopyWithStubImpl$Mutation$RunSystemRollback const documentNodeMutationRunSystemRollback = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'RunSystemRollback'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'runSystemRollback'), - alias: null, - arguments: [], + type: OperationType.mutation, + name: NameNode(value: 'RunSystemRollback'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'runSystemRollback'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$RunSystemRollback _parserFn$Mutation$RunSystemRollback( Map data) => Mutation$RunSystemRollback.fromJson(data); typedef OnMutationCompleted$Mutation$RunSystemRollback = FutureOr - Function(dynamic, Mutation$RunSystemRollback?); + Function( + dynamic, + Mutation$RunSystemRollback?, +); class Options$Mutation$RunSystemRollback extends graphql.MutationOptions { - Options$Mutation$RunSystemRollback( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$RunSystemRollback? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$RunSystemRollback({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$RunSystemRollback? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( data, data == null ? null - : _parserFn$Mutation$RunSystemRollback(data)), - update: update, - onError: onError, - document: documentNodeMutationRunSystemRollback, - parserFn: _parserFn$Mutation$RunSystemRollback); + : _parserFn$Mutation$RunSystemRollback(data), + ), + update: update, + onError: onError, + document: documentNodeMutationRunSystemRollback, + parserFn: _parserFn$Mutation$RunSystemRollback, + ); final OnMutationCompleted$Mutation$RunSystemRollback? onCompletedWithParsed; @@ -2001,36 +4309,37 @@ class Options$Mutation$RunSystemRollback ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$RunSystemRollback extends graphql.WatchQueryOptions { - WatchOptions$Mutation$RunSystemRollback( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationRunSystemRollback, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$RunSystemRollback); + WatchOptions$Mutation$RunSystemRollback({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationRunSystemRollback, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$RunSystemRollback, + ); } extension ClientExtension$Mutation$RunSystemRollback on graphql.GraphQLClient { @@ -2044,19 +4353,28 @@ extension ClientExtension$Mutation$RunSystemRollback on graphql.GraphQLClient { this.watchMutation(options ?? WatchOptions$Mutation$RunSystemRollback()); } -@JsonSerializable(explicitToJson: true) class Mutation$RunSystemRollback$runSystemRollback - implements Fragment$basicMutationReturnFields { - Mutation$RunSystemRollback$runSystemRollback( - {required this.code, - required this.message, - required this.success, - required this.$__typename}); + implements Fragment$basicMutationReturnFields$$GenericMutationReturn { + Mutation$RunSystemRollback$runSystemRollback({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override factory Mutation$RunSystemRollback$runSystemRollback.fromJson( - Map json) => - _$Mutation$RunSystemRollback$runSystemRollbackFromJson(json); + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Mutation$RunSystemRollback$runSystemRollback( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } final int code; @@ -2064,36 +4382,64 @@ class Mutation$RunSystemRollback$runSystemRollback final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Mutation$RunSystemRollback$runSystemRollbackToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; - return Object.hashAll([l$code, l$message, l$success, l$$__typename]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$RunSystemRollback$runSystemRollback) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -2102,26 +4448,35 @@ extension UtilityExtension$Mutation$RunSystemRollback$runSystemRollback on Mutation$RunSystemRollback$runSystemRollback { CopyWith$Mutation$RunSystemRollback$runSystemRollback< Mutation$RunSystemRollback$runSystemRollback> - get copyWith => - CopyWith$Mutation$RunSystemRollback$runSystemRollback(this, (i) => i); + get copyWith => CopyWith$Mutation$RunSystemRollback$runSystemRollback( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$RunSystemRollback$runSystemRollback { factory CopyWith$Mutation$RunSystemRollback$runSystemRollback( - Mutation$RunSystemRollback$runSystemRollback instance, - TRes Function(Mutation$RunSystemRollback$runSystemRollback) then) = - _CopyWithImpl$Mutation$RunSystemRollback$runSystemRollback; + Mutation$RunSystemRollback$runSystemRollback instance, + TRes Function(Mutation$RunSystemRollback$runSystemRollback) then, + ) = _CopyWithImpl$Mutation$RunSystemRollback$runSystemRollback; factory CopyWith$Mutation$RunSystemRollback$runSystemRollback.stub(TRes res) = _CopyWithStubImpl$Mutation$RunSystemRollback$runSystemRollback; - TRes call({int? code, String? message, bool? success, String? $__typename}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); } class _CopyWithImpl$Mutation$RunSystemRollback$runSystemRollback implements CopyWith$Mutation$RunSystemRollback$runSystemRollback { _CopyWithImpl$Mutation$RunSystemRollback$runSystemRollback( - this._instance, this._then); + this._instance, + this._then, + ); final Mutation$RunSystemRollback$runSystemRollback _instance; @@ -2129,24 +4484,25 @@ class _CopyWithImpl$Mutation$RunSystemRollback$runSystemRollback static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$RunSystemRollback$runSystemRollback( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Mutation$RunSystemRollback$runSystemRollback @@ -2155,42 +4511,73 @@ class _CopyWithStubImpl$Mutation$RunSystemRollback$runSystemRollback TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$RunSystemUpgrade { - Mutation$RunSystemUpgrade( - {required this.runSystemUpgrade, required this.$__typename}); + Mutation$RunSystemUpgrade({ + required this.runSystemUpgrade, + required this.$__typename, + }); - @override - factory Mutation$RunSystemUpgrade.fromJson(Map json) => - _$Mutation$RunSystemUpgradeFromJson(json); + factory Mutation$RunSystemUpgrade.fromJson(Map json) { + final l$runSystemUpgrade = json['runSystemUpgrade']; + final l$$__typename = json['__typename']; + return Mutation$RunSystemUpgrade( + runSystemUpgrade: Mutation$RunSystemUpgrade$runSystemUpgrade.fromJson( + (l$runSystemUpgrade as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$RunSystemUpgrade$runSystemUpgrade runSystemUpgrade; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$RunSystemUpgradeToJson(this); + Map toJson() { + final _resultData = {}; + final l$runSystemUpgrade = runSystemUpgrade; + _resultData['runSystemUpgrade'] = l$runSystemUpgrade.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$runSystemUpgrade = runSystemUpgrade; final l$$__typename = $__typename; - return Object.hashAll([l$runSystemUpgrade, l$$__typename]); + return Object.hashAll([ + l$runSystemUpgrade, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$RunSystemUpgrade) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$runSystemUpgrade = runSystemUpgrade; final lOther$runSystemUpgrade = other.runSystemUpgrade; - if (l$runSystemUpgrade != lOther$runSystemUpgrade) return false; + if (l$runSystemUpgrade != lOther$runSystemUpgrade) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -2198,27 +4585,35 @@ class Mutation$RunSystemUpgrade { extension UtilityExtension$Mutation$RunSystemUpgrade on Mutation$RunSystemUpgrade { CopyWith$Mutation$RunSystemUpgrade get copyWith => - CopyWith$Mutation$RunSystemUpgrade(this, (i) => i); + CopyWith$Mutation$RunSystemUpgrade( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$RunSystemUpgrade { - factory CopyWith$Mutation$RunSystemUpgrade(Mutation$RunSystemUpgrade instance, - TRes Function(Mutation$RunSystemUpgrade) then) = - _CopyWithImpl$Mutation$RunSystemUpgrade; + factory CopyWith$Mutation$RunSystemUpgrade( + Mutation$RunSystemUpgrade instance, + TRes Function(Mutation$RunSystemUpgrade) then, + ) = _CopyWithImpl$Mutation$RunSystemUpgrade; factory CopyWith$Mutation$RunSystemUpgrade.stub(TRes res) = _CopyWithStubImpl$Mutation$RunSystemUpgrade; - TRes call( - {Mutation$RunSystemUpgrade$runSystemUpgrade? runSystemUpgrade, - String? $__typename}); + TRes call({ + Mutation$RunSystemUpgrade$runSystemUpgrade? runSystemUpgrade, + String? $__typename, + }); CopyWith$Mutation$RunSystemUpgrade$runSystemUpgrade get runSystemUpgrade; } class _CopyWithImpl$Mutation$RunSystemUpgrade implements CopyWith$Mutation$RunSystemUpgrade { - _CopyWithImpl$Mutation$RunSystemUpgrade(this._instance, this._then); + _CopyWithImpl$Mutation$RunSystemUpgrade( + this._instance, + this._then, + ); final Mutation$RunSystemUpgrade _instance; @@ -2226,18 +4621,19 @@ class _CopyWithImpl$Mutation$RunSystemUpgrade static const _undefined = {}; - TRes call( - {Object? runSystemUpgrade = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? runSystemUpgrade = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$RunSystemUpgrade( - runSystemUpgrade: - runSystemUpgrade == _undefined || runSystemUpgrade == null - ? _instance.runSystemUpgrade - : (runSystemUpgrade - as Mutation$RunSystemUpgrade$runSystemUpgrade), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + runSystemUpgrade: runSystemUpgrade == _undefined || + runSystemUpgrade == null + ? _instance.runSystemUpgrade + : (runSystemUpgrade as Mutation$RunSystemUpgrade$runSystemUpgrade), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$RunSystemUpgrade$runSystemUpgrade get runSystemUpgrade { final local$runSystemUpgrade = _instance.runSystemUpgrade; @@ -2252,9 +4648,10 @@ class _CopyWithStubImpl$Mutation$RunSystemUpgrade TRes _res; - call( - {Mutation$RunSystemUpgrade$runSystemUpgrade? runSystemUpgrade, - String? $__typename}) => + call({ + Mutation$RunSystemUpgrade$runSystemUpgrade? runSystemUpgrade, + String? $__typename, + }) => _res; CopyWith$Mutation$RunSystemUpgrade$runSystemUpgrade get runSystemUpgrade => @@ -2263,73 +4660,82 @@ class _CopyWithStubImpl$Mutation$RunSystemUpgrade const documentNodeMutationRunSystemUpgrade = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'RunSystemUpgrade'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'runSystemUpgrade'), - alias: null, - arguments: [], + type: OperationType.mutation, + name: NameNode(value: 'RunSystemUpgrade'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'runSystemUpgrade'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$RunSystemUpgrade _parserFn$Mutation$RunSystemUpgrade( Map data) => Mutation$RunSystemUpgrade.fromJson(data); typedef OnMutationCompleted$Mutation$RunSystemUpgrade = FutureOr Function( - dynamic, Mutation$RunSystemUpgrade?); + dynamic, + Mutation$RunSystemUpgrade?, +); class Options$Mutation$RunSystemUpgrade extends graphql.MutationOptions { - Options$Mutation$RunSystemUpgrade( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$RunSystemUpgrade? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$RunSystemUpgrade({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$RunSystemUpgrade? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( data, data == null ? null - : _parserFn$Mutation$RunSystemUpgrade(data)), - update: update, - onError: onError, - document: documentNodeMutationRunSystemUpgrade, - parserFn: _parserFn$Mutation$RunSystemUpgrade); + : _parserFn$Mutation$RunSystemUpgrade(data), + ), + update: update, + onError: onError, + document: documentNodeMutationRunSystemUpgrade, + parserFn: _parserFn$Mutation$RunSystemUpgrade, + ); final OnMutationCompleted$Mutation$RunSystemUpgrade? onCompletedWithParsed; @@ -2338,36 +4744,37 @@ class Options$Mutation$RunSystemUpgrade ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$RunSystemUpgrade extends graphql.WatchQueryOptions { - WatchOptions$Mutation$RunSystemUpgrade( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationRunSystemUpgrade, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$RunSystemUpgrade); + WatchOptions$Mutation$RunSystemUpgrade({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationRunSystemUpgrade, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$RunSystemUpgrade, + ); } extension ClientExtension$Mutation$RunSystemUpgrade on graphql.GraphQLClient { @@ -2381,19 +4788,28 @@ extension ClientExtension$Mutation$RunSystemUpgrade on graphql.GraphQLClient { this.watchMutation(options ?? WatchOptions$Mutation$RunSystemUpgrade()); } -@JsonSerializable(explicitToJson: true) class Mutation$RunSystemUpgrade$runSystemUpgrade - implements Fragment$basicMutationReturnFields { - Mutation$RunSystemUpgrade$runSystemUpgrade( - {required this.code, - required this.message, - required this.success, - required this.$__typename}); + implements Fragment$basicMutationReturnFields$$GenericMutationReturn { + Mutation$RunSystemUpgrade$runSystemUpgrade({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override factory Mutation$RunSystemUpgrade$runSystemUpgrade.fromJson( - Map json) => - _$Mutation$RunSystemUpgrade$runSystemUpgradeFromJson(json); + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Mutation$RunSystemUpgrade$runSystemUpgrade( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } final int code; @@ -2401,36 +4817,64 @@ class Mutation$RunSystemUpgrade$runSystemUpgrade final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Mutation$RunSystemUpgrade$runSystemUpgradeToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; - return Object.hashAll([l$code, l$message, l$success, l$$__typename]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$RunSystemUpgrade$runSystemUpgrade) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -2439,26 +4883,35 @@ extension UtilityExtension$Mutation$RunSystemUpgrade$runSystemUpgrade on Mutation$RunSystemUpgrade$runSystemUpgrade { CopyWith$Mutation$RunSystemUpgrade$runSystemUpgrade< Mutation$RunSystemUpgrade$runSystemUpgrade> - get copyWith => - CopyWith$Mutation$RunSystemUpgrade$runSystemUpgrade(this, (i) => i); + get copyWith => CopyWith$Mutation$RunSystemUpgrade$runSystemUpgrade( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$RunSystemUpgrade$runSystemUpgrade { factory CopyWith$Mutation$RunSystemUpgrade$runSystemUpgrade( - Mutation$RunSystemUpgrade$runSystemUpgrade instance, - TRes Function(Mutation$RunSystemUpgrade$runSystemUpgrade) then) = - _CopyWithImpl$Mutation$RunSystemUpgrade$runSystemUpgrade; + Mutation$RunSystemUpgrade$runSystemUpgrade instance, + TRes Function(Mutation$RunSystemUpgrade$runSystemUpgrade) then, + ) = _CopyWithImpl$Mutation$RunSystemUpgrade$runSystemUpgrade; factory CopyWith$Mutation$RunSystemUpgrade$runSystemUpgrade.stub(TRes res) = _CopyWithStubImpl$Mutation$RunSystemUpgrade$runSystemUpgrade; - TRes call({int? code, String? message, bool? success, String? $__typename}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); } class _CopyWithImpl$Mutation$RunSystemUpgrade$runSystemUpgrade implements CopyWith$Mutation$RunSystemUpgrade$runSystemUpgrade { _CopyWithImpl$Mutation$RunSystemUpgrade$runSystemUpgrade( - this._instance, this._then); + this._instance, + this._then, + ); final Mutation$RunSystemUpgrade$runSystemUpgrade _instance; @@ -2466,24 +4919,25 @@ class _CopyWithImpl$Mutation$RunSystemUpgrade$runSystemUpgrade static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$RunSystemUpgrade$runSystemUpgrade( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Mutation$RunSystemUpgrade$runSystemUpgrade @@ -2492,43 +4946,75 @@ class _CopyWithStubImpl$Mutation$RunSystemUpgrade$runSystemUpgrade TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$PullRepositoryChanges { - Mutation$PullRepositoryChanges( - {required this.pullRepositoryChanges, required this.$__typename}); + Mutation$PullRepositoryChanges({ + required this.pullRepositoryChanges, + required this.$__typename, + }); - @override - factory Mutation$PullRepositoryChanges.fromJson(Map json) => - _$Mutation$PullRepositoryChangesFromJson(json); + factory Mutation$PullRepositoryChanges.fromJson(Map json) { + final l$pullRepositoryChanges = json['pullRepositoryChanges']; + final l$$__typename = json['__typename']; + return Mutation$PullRepositoryChanges( + pullRepositoryChanges: + Mutation$PullRepositoryChanges$pullRepositoryChanges.fromJson( + (l$pullRepositoryChanges as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$PullRepositoryChanges$pullRepositoryChanges pullRepositoryChanges; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$PullRepositoryChangesToJson(this); + Map toJson() { + final _resultData = {}; + final l$pullRepositoryChanges = pullRepositoryChanges; + _resultData['pullRepositoryChanges'] = l$pullRepositoryChanges.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$pullRepositoryChanges = pullRepositoryChanges; final l$$__typename = $__typename; - return Object.hashAll([l$pullRepositoryChanges, l$$__typename]); + return Object.hashAll([ + l$pullRepositoryChanges, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$PullRepositoryChanges) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$pullRepositoryChanges = pullRepositoryChanges; final lOther$pullRepositoryChanges = other.pullRepositoryChanges; - if (l$pullRepositoryChanges != lOther$pullRepositoryChanges) return false; + if (l$pullRepositoryChanges != lOther$pullRepositoryChanges) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -2536,29 +5022,35 @@ class Mutation$PullRepositoryChanges { extension UtilityExtension$Mutation$PullRepositoryChanges on Mutation$PullRepositoryChanges { CopyWith$Mutation$PullRepositoryChanges - get copyWith => CopyWith$Mutation$PullRepositoryChanges(this, (i) => i); + get copyWith => CopyWith$Mutation$PullRepositoryChanges( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$PullRepositoryChanges { factory CopyWith$Mutation$PullRepositoryChanges( - Mutation$PullRepositoryChanges instance, - TRes Function(Mutation$PullRepositoryChanges) then) = - _CopyWithImpl$Mutation$PullRepositoryChanges; + Mutation$PullRepositoryChanges instance, + TRes Function(Mutation$PullRepositoryChanges) then, + ) = _CopyWithImpl$Mutation$PullRepositoryChanges; factory CopyWith$Mutation$PullRepositoryChanges.stub(TRes res) = _CopyWithStubImpl$Mutation$PullRepositoryChanges; - TRes call( - {Mutation$PullRepositoryChanges$pullRepositoryChanges? - pullRepositoryChanges, - String? $__typename}); + TRes call({ + Mutation$PullRepositoryChanges$pullRepositoryChanges? pullRepositoryChanges, + String? $__typename, + }); CopyWith$Mutation$PullRepositoryChanges$pullRepositoryChanges get pullRepositoryChanges; } class _CopyWithImpl$Mutation$PullRepositoryChanges implements CopyWith$Mutation$PullRepositoryChanges { - _CopyWithImpl$Mutation$PullRepositoryChanges(this._instance, this._then); + _CopyWithImpl$Mutation$PullRepositoryChanges( + this._instance, + this._then, + ); final Mutation$PullRepositoryChanges _instance; @@ -2566,18 +5058,20 @@ class _CopyWithImpl$Mutation$PullRepositoryChanges static const _undefined = {}; - TRes call( - {Object? pullRepositoryChanges = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? pullRepositoryChanges = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$PullRepositoryChanges( - pullRepositoryChanges: pullRepositoryChanges == _undefined || - pullRepositoryChanges == null - ? _instance.pullRepositoryChanges - : (pullRepositoryChanges - as Mutation$PullRepositoryChanges$pullRepositoryChanges), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + pullRepositoryChanges: + pullRepositoryChanges == _undefined || pullRepositoryChanges == null + ? _instance.pullRepositoryChanges + : (pullRepositoryChanges + as Mutation$PullRepositoryChanges$pullRepositoryChanges), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$PullRepositoryChanges$pullRepositoryChanges get pullRepositoryChanges { final local$pullRepositoryChanges = _instance.pullRepositoryChanges; @@ -2592,10 +5086,10 @@ class _CopyWithStubImpl$Mutation$PullRepositoryChanges TRes _res; - call( - {Mutation$PullRepositoryChanges$pullRepositoryChanges? - pullRepositoryChanges, - String? $__typename}) => + call({ + Mutation$PullRepositoryChanges$pullRepositoryChanges? pullRepositoryChanges, + String? $__typename, + }) => _res; CopyWith$Mutation$PullRepositoryChanges$pullRepositoryChanges get pullRepositoryChanges => @@ -2605,73 +5099,83 @@ class _CopyWithStubImpl$Mutation$PullRepositoryChanges const documentNodeMutationPullRepositoryChanges = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'PullRepositoryChanges'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'pullRepositoryChanges'), - alias: null, - arguments: [], + type: OperationType.mutation, + name: NameNode(value: 'PullRepositoryChanges'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'pullRepositoryChanges'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$PullRepositoryChanges _parserFn$Mutation$PullRepositoryChanges( Map data) => Mutation$PullRepositoryChanges.fromJson(data); typedef OnMutationCompleted$Mutation$PullRepositoryChanges = FutureOr - Function(dynamic, Mutation$PullRepositoryChanges?); + Function( + dynamic, + Mutation$PullRepositoryChanges?, +); class Options$Mutation$PullRepositoryChanges extends graphql.MutationOptions { - Options$Mutation$PullRepositoryChanges( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$PullRepositoryChanges? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$PullRepositoryChanges({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$PullRepositoryChanges? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( data, data == null ? null - : _parserFn$Mutation$PullRepositoryChanges(data)), - update: update, - onError: onError, - document: documentNodeMutationPullRepositoryChanges, - parserFn: _parserFn$Mutation$PullRepositoryChanges); + : _parserFn$Mutation$PullRepositoryChanges(data), + ), + update: update, + onError: onError, + document: documentNodeMutationPullRepositoryChanges, + parserFn: _parserFn$Mutation$PullRepositoryChanges, + ); final OnMutationCompleted$Mutation$PullRepositoryChanges? onCompletedWithParsed; @@ -2681,36 +5185,37 @@ class Options$Mutation$PullRepositoryChanges ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$PullRepositoryChanges extends graphql.WatchQueryOptions { - WatchOptions$Mutation$PullRepositoryChanges( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationPullRepositoryChanges, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$PullRepositoryChanges); + WatchOptions$Mutation$PullRepositoryChanges({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationPullRepositoryChanges, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$PullRepositoryChanges, + ); } extension ClientExtension$Mutation$PullRepositoryChanges @@ -2727,19 +5232,28 @@ extension ClientExtension$Mutation$PullRepositoryChanges options ?? WatchOptions$Mutation$PullRepositoryChanges()); } -@JsonSerializable(explicitToJson: true) class Mutation$PullRepositoryChanges$pullRepositoryChanges - implements Fragment$basicMutationReturnFields { - Mutation$PullRepositoryChanges$pullRepositoryChanges( - {required this.code, - required this.message, - required this.success, - required this.$__typename}); + implements Fragment$basicMutationReturnFields$$GenericMutationReturn { + Mutation$PullRepositoryChanges$pullRepositoryChanges({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override factory Mutation$PullRepositoryChanges$pullRepositoryChanges.fromJson( - Map json) => - _$Mutation$PullRepositoryChanges$pullRepositoryChangesFromJson(json); + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Mutation$PullRepositoryChanges$pullRepositoryChanges( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } final int code; @@ -2747,36 +5261,64 @@ class Mutation$PullRepositoryChanges$pullRepositoryChanges final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Mutation$PullRepositoryChanges$pullRepositoryChangesToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; - return Object.hashAll([l$code, l$message, l$success, l$$__typename]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$PullRepositoryChanges$pullRepositoryChanges) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -2787,29 +5329,37 @@ extension UtilityExtension$Mutation$PullRepositoryChanges$pullRepositoryChanges Mutation$PullRepositoryChanges$pullRepositoryChanges> get copyWith => CopyWith$Mutation$PullRepositoryChanges$pullRepositoryChanges( - this, (i) => i); + this, + (i) => i, + ); } abstract class CopyWith$Mutation$PullRepositoryChanges$pullRepositoryChanges< TRes> { factory CopyWith$Mutation$PullRepositoryChanges$pullRepositoryChanges( - Mutation$PullRepositoryChanges$pullRepositoryChanges instance, - TRes Function(Mutation$PullRepositoryChanges$pullRepositoryChanges) - then) = - _CopyWithImpl$Mutation$PullRepositoryChanges$pullRepositoryChanges; + Mutation$PullRepositoryChanges$pullRepositoryChanges instance, + TRes Function(Mutation$PullRepositoryChanges$pullRepositoryChanges) then, + ) = _CopyWithImpl$Mutation$PullRepositoryChanges$pullRepositoryChanges; factory CopyWith$Mutation$PullRepositoryChanges$pullRepositoryChanges.stub( TRes res) = _CopyWithStubImpl$Mutation$PullRepositoryChanges$pullRepositoryChanges; - TRes call({int? code, String? message, bool? success, String? $__typename}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); } class _CopyWithImpl$Mutation$PullRepositoryChanges$pullRepositoryChanges implements CopyWith$Mutation$PullRepositoryChanges$pullRepositoryChanges { _CopyWithImpl$Mutation$PullRepositoryChanges$pullRepositoryChanges( - this._instance, this._then); + this._instance, + this._then, + ); final Mutation$PullRepositoryChanges$pullRepositoryChanges _instance; @@ -2818,24 +5368,25 @@ class _CopyWithImpl$Mutation$PullRepositoryChanges$pullRepositoryChanges static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$PullRepositoryChanges$pullRepositoryChanges( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Mutation$PullRepositoryChanges$pullRepositoryChanges< @@ -2847,67 +5398,106 @@ class _CopyWithStubImpl$Mutation$PullRepositoryChanges$pullRepositoryChanges< TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$RebootSystem { - Mutation$RebootSystem( - {required this.rebootSystem, required this.$__typename}); + Mutation$RebootSystem({ + required this.rebootSystem, + required this.$__typename, + }); - @override - factory Mutation$RebootSystem.fromJson(Map json) => - _$Mutation$RebootSystemFromJson(json); + factory Mutation$RebootSystem.fromJson(Map json) { + final l$rebootSystem = json['rebootSystem']; + final l$$__typename = json['__typename']; + return Mutation$RebootSystem( + rebootSystem: Mutation$RebootSystem$rebootSystem.fromJson( + (l$rebootSystem as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$RebootSystem$rebootSystem rebootSystem; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$RebootSystemToJson(this); + Map toJson() { + final _resultData = {}; + final l$rebootSystem = rebootSystem; + _resultData['rebootSystem'] = l$rebootSystem.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$rebootSystem = rebootSystem; final l$$__typename = $__typename; - return Object.hashAll([l$rebootSystem, l$$__typename]); + return Object.hashAll([ + l$rebootSystem, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Mutation$RebootSystem) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Mutation$RebootSystem) || runtimeType != other.runtimeType) { return false; + } final l$rebootSystem = rebootSystem; final lOther$rebootSystem = other.rebootSystem; - if (l$rebootSystem != lOther$rebootSystem) return false; + if (l$rebootSystem != lOther$rebootSystem) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Mutation$RebootSystem on Mutation$RebootSystem { CopyWith$Mutation$RebootSystem get copyWith => - CopyWith$Mutation$RebootSystem(this, (i) => i); + CopyWith$Mutation$RebootSystem( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$RebootSystem { - factory CopyWith$Mutation$RebootSystem(Mutation$RebootSystem instance, - TRes Function(Mutation$RebootSystem) then) = - _CopyWithImpl$Mutation$RebootSystem; + factory CopyWith$Mutation$RebootSystem( + Mutation$RebootSystem instance, + TRes Function(Mutation$RebootSystem) then, + ) = _CopyWithImpl$Mutation$RebootSystem; factory CopyWith$Mutation$RebootSystem.stub(TRes res) = _CopyWithStubImpl$Mutation$RebootSystem; - TRes call( - {Mutation$RebootSystem$rebootSystem? rebootSystem, String? $__typename}); + TRes call({ + Mutation$RebootSystem$rebootSystem? rebootSystem, + String? $__typename, + }); CopyWith$Mutation$RebootSystem$rebootSystem get rebootSystem; } class _CopyWithImpl$Mutation$RebootSystem implements CopyWith$Mutation$RebootSystem { - _CopyWithImpl$Mutation$RebootSystem(this._instance, this._then); + _CopyWithImpl$Mutation$RebootSystem( + this._instance, + this._then, + ); final Mutation$RebootSystem _instance; @@ -2915,16 +5505,18 @@ class _CopyWithImpl$Mutation$RebootSystem static const _undefined = {}; - TRes call( - {Object? rebootSystem = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? rebootSystem = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$RebootSystem( - rebootSystem: rebootSystem == _undefined || rebootSystem == null - ? _instance.rebootSystem - : (rebootSystem as Mutation$RebootSystem$rebootSystem), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + rebootSystem: rebootSystem == _undefined || rebootSystem == null + ? _instance.rebootSystem + : (rebootSystem as Mutation$RebootSystem$rebootSystem), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$RebootSystem$rebootSystem get rebootSystem { final local$rebootSystem = _instance.rebootSystem; return CopyWith$Mutation$RebootSystem$rebootSystem( @@ -2938,9 +5530,10 @@ class _CopyWithStubImpl$Mutation$RebootSystem TRes _res; - call( - {Mutation$RebootSystem$rebootSystem? rebootSystem, - String? $__typename}) => + call({ + Mutation$RebootSystem$rebootSystem? rebootSystem, + String? $__typename, + }) => _res; CopyWith$Mutation$RebootSystem$rebootSystem get rebootSystem => CopyWith$Mutation$RebootSystem$rebootSystem.stub(_res); @@ -2948,73 +5541,80 @@ class _CopyWithStubImpl$Mutation$RebootSystem const documentNodeMutationRebootSystem = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'RebootSystem'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'rebootSystem'), - alias: null, - arguments: [], + type: OperationType.mutation, + name: NameNode(value: 'RebootSystem'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'rebootSystem'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$RebootSystem _parserFn$Mutation$RebootSystem( Map data) => Mutation$RebootSystem.fromJson(data); typedef OnMutationCompleted$Mutation$RebootSystem = FutureOr Function( - dynamic, Mutation$RebootSystem?); + dynamic, + Mutation$RebootSystem?, +); class Options$Mutation$RebootSystem extends graphql.MutationOptions { - Options$Mutation$RebootSystem( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$RebootSystem? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$RebootSystem({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$RebootSystem? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( data, - data == null - ? null - : _parserFn$Mutation$RebootSystem(data)), - update: update, - onError: onError, - document: documentNodeMutationRebootSystem, - parserFn: _parserFn$Mutation$RebootSystem); + data == null ? null : _parserFn$Mutation$RebootSystem(data), + ), + update: update, + onError: onError, + document: documentNodeMutationRebootSystem, + parserFn: _parserFn$Mutation$RebootSystem, + ); final OnMutationCompleted$Mutation$RebootSystem? onCompletedWithParsed; @@ -3023,36 +5623,37 @@ class Options$Mutation$RebootSystem ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$RebootSystem extends graphql.WatchQueryOptions { - WatchOptions$Mutation$RebootSystem( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationRebootSystem, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$RebootSystem); + WatchOptions$Mutation$RebootSystem({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationRebootSystem, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$RebootSystem, + ); } extension ClientExtension$Mutation$RebootSystem on graphql.GraphQLClient { @@ -3064,19 +5665,28 @@ extension ClientExtension$Mutation$RebootSystem on graphql.GraphQLClient { this.watchMutation(options ?? WatchOptions$Mutation$RebootSystem()); } -@JsonSerializable(explicitToJson: true) class Mutation$RebootSystem$rebootSystem - implements Fragment$basicMutationReturnFields { - Mutation$RebootSystem$rebootSystem( - {required this.code, - required this.message, - required this.success, - required this.$__typename}); + implements Fragment$basicMutationReturnFields$$GenericMutationReturn { + Mutation$RebootSystem$rebootSystem({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override factory Mutation$RebootSystem$rebootSystem.fromJson( - Map json) => - _$Mutation$RebootSystem$rebootSystemFromJson(json); + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Mutation$RebootSystem$rebootSystem( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } final int code; @@ -3084,36 +5694,64 @@ class Mutation$RebootSystem$rebootSystem final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Mutation$RebootSystem$rebootSystemToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; - return Object.hashAll([l$code, l$message, l$success, l$$__typename]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$RebootSystem$rebootSystem) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -3122,25 +5760,35 @@ extension UtilityExtension$Mutation$RebootSystem$rebootSystem on Mutation$RebootSystem$rebootSystem { CopyWith$Mutation$RebootSystem$rebootSystem< Mutation$RebootSystem$rebootSystem> - get copyWith => - CopyWith$Mutation$RebootSystem$rebootSystem(this, (i) => i); + get copyWith => CopyWith$Mutation$RebootSystem$rebootSystem( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$RebootSystem$rebootSystem { factory CopyWith$Mutation$RebootSystem$rebootSystem( - Mutation$RebootSystem$rebootSystem instance, - TRes Function(Mutation$RebootSystem$rebootSystem) then) = - _CopyWithImpl$Mutation$RebootSystem$rebootSystem; + Mutation$RebootSystem$rebootSystem instance, + TRes Function(Mutation$RebootSystem$rebootSystem) then, + ) = _CopyWithImpl$Mutation$RebootSystem$rebootSystem; factory CopyWith$Mutation$RebootSystem$rebootSystem.stub(TRes res) = _CopyWithStubImpl$Mutation$RebootSystem$rebootSystem; - TRes call({int? code, String? message, bool? success, String? $__typename}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); } class _CopyWithImpl$Mutation$RebootSystem$rebootSystem implements CopyWith$Mutation$RebootSystem$rebootSystem { - _CopyWithImpl$Mutation$RebootSystem$rebootSystem(this._instance, this._then); + _CopyWithImpl$Mutation$RebootSystem$rebootSystem( + this._instance, + this._then, + ); final Mutation$RebootSystem$rebootSystem _instance; @@ -3148,24 +5796,25 @@ class _CopyWithImpl$Mutation$RebootSystem$rebootSystem static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$RebootSystem$rebootSystem( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Mutation$RebootSystem$rebootSystem @@ -3174,41 +5823,73 @@ class _CopyWithStubImpl$Mutation$RebootSystem$rebootSystem TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Query$SystemServerProvider { - Query$SystemServerProvider({required this.system, required this.$__typename}); + Query$SystemServerProvider({ + required this.system, + required this.$__typename, + }); - @override - factory Query$SystemServerProvider.fromJson(Map json) => - _$Query$SystemServerProviderFromJson(json); + factory Query$SystemServerProvider.fromJson(Map json) { + final l$system = json['system']; + final l$$__typename = json['__typename']; + return Query$SystemServerProvider( + system: Query$SystemServerProvider$system.fromJson( + (l$system as Map)), + $__typename: (l$$__typename as String), + ); + } final Query$SystemServerProvider$system system; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$SystemServerProviderToJson(this); + Map toJson() { + final _resultData = {}; + final l$system = system; + _resultData['system'] = l$system.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$system = system; final l$$__typename = $__typename; - return Object.hashAll([l$system, l$$__typename]); + return Object.hashAll([ + l$system, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$SystemServerProvider) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$system = system; final lOther$system = other.system; - if (l$system != lOther$system) return false; + if (l$system != lOther$system) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -3216,25 +5897,34 @@ class Query$SystemServerProvider { extension UtilityExtension$Query$SystemServerProvider on Query$SystemServerProvider { CopyWith$Query$SystemServerProvider - get copyWith => CopyWith$Query$SystemServerProvider(this, (i) => i); + get copyWith => CopyWith$Query$SystemServerProvider( + this, + (i) => i, + ); } abstract class CopyWith$Query$SystemServerProvider { factory CopyWith$Query$SystemServerProvider( - Query$SystemServerProvider instance, - TRes Function(Query$SystemServerProvider) then) = - _CopyWithImpl$Query$SystemServerProvider; + Query$SystemServerProvider instance, + TRes Function(Query$SystemServerProvider) then, + ) = _CopyWithImpl$Query$SystemServerProvider; factory CopyWith$Query$SystemServerProvider.stub(TRes res) = _CopyWithStubImpl$Query$SystemServerProvider; - TRes call({Query$SystemServerProvider$system? system, String? $__typename}); + TRes call({ + Query$SystemServerProvider$system? system, + String? $__typename, + }); CopyWith$Query$SystemServerProvider$system get system; } class _CopyWithImpl$Query$SystemServerProvider implements CopyWith$Query$SystemServerProvider { - _CopyWithImpl$Query$SystemServerProvider(this._instance, this._then); + _CopyWithImpl$Query$SystemServerProvider( + this._instance, + this._then, + ); final Query$SystemServerProvider _instance; @@ -3242,14 +5932,18 @@ class _CopyWithImpl$Query$SystemServerProvider static const _undefined = {}; - TRes call({Object? system = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? system = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$SystemServerProvider( - system: system == _undefined || system == null - ? _instance.system - : (system as Query$SystemServerProvider$system), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + system: system == _undefined || system == null + ? _instance.system + : (system as Query$SystemServerProvider$system), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Query$SystemServerProvider$system get system { final local$system = _instance.system; return CopyWith$Query$SystemServerProvider$system( @@ -3263,7 +5957,10 @@ class _CopyWithStubImpl$Query$SystemServerProvider TRes _res; - call({Query$SystemServerProvider$system? system, String? $__typename}) => + call({ + Query$SystemServerProvider$system? system, + String? $__typename, + }) => _res; CopyWith$Query$SystemServerProvider$system get system => CopyWith$Query$SystemServerProvider$system.stub(_res); @@ -3271,50 +5968,57 @@ class _CopyWithStubImpl$Query$SystemServerProvider const documentNodeQuerySystemServerProvider = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'SystemServerProvider'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'system'), + type: OperationType.query, + name: NameNode(value: 'SystemServerProvider'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'system'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'provider'), alias: null, arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ FieldNode( - name: NameNode(value: 'provider'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'provider'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), + name: NameNode(value: 'provider'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), ]); Query$SystemServerProvider _parserFn$Query$SystemServerProvider( Map data) => @@ -3322,52 +6026,54 @@ Query$SystemServerProvider _parserFn$Query$SystemServerProvider( class Options$Query$SystemServerProvider extends graphql.QueryOptions { - Options$Query$SystemServerProvider( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - Duration? pollInterval, - graphql.Context? context}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - pollInterval: pollInterval, - context: context, - document: documentNodeQuerySystemServerProvider, - parserFn: _parserFn$Query$SystemServerProvider); + Options$Query$SystemServerProvider({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Duration? pollInterval, + graphql.Context? context, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + pollInterval: pollInterval, + context: context, + document: documentNodeQuerySystemServerProvider, + parserFn: _parserFn$Query$SystemServerProvider, + ); } class WatchOptions$Query$SystemServerProvider extends graphql.WatchQueryOptions { - WatchOptions$Query$SystemServerProvider( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeQuerySystemServerProvider, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Query$SystemServerProvider); + WatchOptions$Query$SystemServerProvider({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeQuerySystemServerProvider, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Query$SystemServerProvider, + ); } class FetchMoreOptions$Query$SystemServerProvider @@ -3375,8 +6081,9 @@ class FetchMoreOptions$Query$SystemServerProvider FetchMoreOptions$Query$SystemServerProvider( {required graphql.UpdateQuery updateQuery}) : super( - updateQuery: updateQuery, - document: documentNodeQuerySystemServerProvider); + updateQuery: updateQuery, + document: documentNodeQuerySystemServerProvider, + ); } extension ClientExtension$Query$SystemServerProvider on graphql.GraphQLClient { @@ -3388,59 +6095,88 @@ extension ClientExtension$Query$SystemServerProvider on graphql.GraphQLClient { watchQuery$SystemServerProvider( [WatchOptions$Query$SystemServerProvider? options]) => this.watchQuery(options ?? WatchOptions$Query$SystemServerProvider()); - void writeQuery$SystemServerProvider( - {required Query$SystemServerProvider data, bool broadcast = true}) => + void writeQuery$SystemServerProvider({ + required Query$SystemServerProvider data, + bool broadcast = true, + }) => this.writeQuery( - graphql.Request( - operation: graphql.Operation( - document: documentNodeQuerySystemServerProvider)), - data: data.toJson(), - broadcast: broadcast); - Query$SystemServerProvider? readQuery$SystemServerProvider( - {bool optimistic = true}) { - final result = this.readQuery( graphql.Request( operation: graphql.Operation( document: documentNodeQuerySystemServerProvider)), - optimistic: optimistic); + data: data.toJson(), + broadcast: broadcast, + ); + Query$SystemServerProvider? readQuery$SystemServerProvider( + {bool optimistic = true}) { + final result = this.readQuery( + graphql.Request( + operation: graphql.Operation( + document: documentNodeQuerySystemServerProvider)), + optimistic: optimistic, + ); return result == null ? null : Query$SystemServerProvider.fromJson(result); } } -@JsonSerializable(explicitToJson: true) class Query$SystemServerProvider$system { - Query$SystemServerProvider$system( - {required this.provider, required this.$__typename}); + Query$SystemServerProvider$system({ + required this.provider, + required this.$__typename, + }); - @override factory Query$SystemServerProvider$system.fromJson( - Map json) => - _$Query$SystemServerProvider$systemFromJson(json); + Map json) { + final l$provider = json['provider']; + final l$$__typename = json['__typename']; + return Query$SystemServerProvider$system( + provider: Query$SystemServerProvider$system$provider.fromJson( + (l$provider as Map)), + $__typename: (l$$__typename as String), + ); + } final Query$SystemServerProvider$system$provider provider; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Query$SystemServerProvider$systemToJson(this); + Map toJson() { + final _resultData = {}; + final l$provider = provider; + _resultData['provider'] = l$provider.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$provider = provider; final l$$__typename = $__typename; - return Object.hashAll([l$provider, l$$__typename]); + return Object.hashAll([ + l$provider, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$SystemServerProvider$system) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$provider = provider; final lOther$provider = other.provider; - if (l$provider != lOther$provider) return false; + if (l$provider != lOther$provider) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -3448,28 +6184,34 @@ class Query$SystemServerProvider$system { extension UtilityExtension$Query$SystemServerProvider$system on Query$SystemServerProvider$system { CopyWith$Query$SystemServerProvider$system - get copyWith => - CopyWith$Query$SystemServerProvider$system(this, (i) => i); + get copyWith => CopyWith$Query$SystemServerProvider$system( + this, + (i) => i, + ); } abstract class CopyWith$Query$SystemServerProvider$system { factory CopyWith$Query$SystemServerProvider$system( - Query$SystemServerProvider$system instance, - TRes Function(Query$SystemServerProvider$system) then) = - _CopyWithImpl$Query$SystemServerProvider$system; + Query$SystemServerProvider$system instance, + TRes Function(Query$SystemServerProvider$system) then, + ) = _CopyWithImpl$Query$SystemServerProvider$system; factory CopyWith$Query$SystemServerProvider$system.stub(TRes res) = _CopyWithStubImpl$Query$SystemServerProvider$system; - TRes call( - {Query$SystemServerProvider$system$provider? provider, - String? $__typename}); + TRes call({ + Query$SystemServerProvider$system$provider? provider, + String? $__typename, + }); CopyWith$Query$SystemServerProvider$system$provider get provider; } class _CopyWithImpl$Query$SystemServerProvider$system implements CopyWith$Query$SystemServerProvider$system { - _CopyWithImpl$Query$SystemServerProvider$system(this._instance, this._then); + _CopyWithImpl$Query$SystemServerProvider$system( + this._instance, + this._then, + ); final Query$SystemServerProvider$system _instance; @@ -3477,15 +6219,18 @@ class _CopyWithImpl$Query$SystemServerProvider$system static const _undefined = {}; - TRes call( - {Object? provider = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? provider = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$SystemServerProvider$system( - provider: provider == _undefined || provider == null - ? _instance.provider - : (provider as Query$SystemServerProvider$system$provider), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + provider: provider == _undefined || provider == null + ? _instance.provider + : (provider as Query$SystemServerProvider$system$provider), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Query$SystemServerProvider$system$provider get provider { final local$provider = _instance.provider; return CopyWith$Query$SystemServerProvider$system$provider( @@ -3499,49 +6244,73 @@ class _CopyWithStubImpl$Query$SystemServerProvider$system TRes _res; - call( - {Query$SystemServerProvider$system$provider? provider, - String? $__typename}) => + call({ + Query$SystemServerProvider$system$provider? provider, + String? $__typename, + }) => _res; CopyWith$Query$SystemServerProvider$system$provider get provider => CopyWith$Query$SystemServerProvider$system$provider.stub(_res); } -@JsonSerializable(explicitToJson: true) class Query$SystemServerProvider$system$provider { - Query$SystemServerProvider$system$provider( - {required this.provider, required this.$__typename}); + Query$SystemServerProvider$system$provider({ + required this.provider, + required this.$__typename, + }); - @override factory Query$SystemServerProvider$system$provider.fromJson( - Map json) => - _$Query$SystemServerProvider$system$providerFromJson(json); + Map json) { + final l$provider = json['provider']; + final l$$__typename = json['__typename']; + return Query$SystemServerProvider$system$provider( + provider: fromJson$Enum$ServerProvider((l$provider as String)), + $__typename: (l$$__typename as String), + ); + } - @JsonKey(unknownEnumValue: Enum$ServerProvider.$unknown) final Enum$ServerProvider provider; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Query$SystemServerProvider$system$providerToJson(this); + Map toJson() { + final _resultData = {}; + final l$provider = provider; + _resultData['provider'] = toJson$Enum$ServerProvider(l$provider); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$provider = provider; final l$$__typename = $__typename; - return Object.hashAll([l$provider, l$$__typename]); + return Object.hashAll([ + l$provider, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$SystemServerProvider$system$provider) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$provider = provider; final lOther$provider = other.provider; - if (l$provider != lOther$provider) return false; + if (l$provider != lOther$provider) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -3550,26 +6319,33 @@ extension UtilityExtension$Query$SystemServerProvider$system$provider on Query$SystemServerProvider$system$provider { CopyWith$Query$SystemServerProvider$system$provider< Query$SystemServerProvider$system$provider> - get copyWith => - CopyWith$Query$SystemServerProvider$system$provider(this, (i) => i); + get copyWith => CopyWith$Query$SystemServerProvider$system$provider( + this, + (i) => i, + ); } abstract class CopyWith$Query$SystemServerProvider$system$provider { factory CopyWith$Query$SystemServerProvider$system$provider( - Query$SystemServerProvider$system$provider instance, - TRes Function(Query$SystemServerProvider$system$provider) then) = - _CopyWithImpl$Query$SystemServerProvider$system$provider; + Query$SystemServerProvider$system$provider instance, + TRes Function(Query$SystemServerProvider$system$provider) then, + ) = _CopyWithImpl$Query$SystemServerProvider$system$provider; factory CopyWith$Query$SystemServerProvider$system$provider.stub(TRes res) = _CopyWithStubImpl$Query$SystemServerProvider$system$provider; - TRes call({Enum$ServerProvider? provider, String? $__typename}); + TRes call({ + Enum$ServerProvider? provider, + String? $__typename, + }); } class _CopyWithImpl$Query$SystemServerProvider$system$provider implements CopyWith$Query$SystemServerProvider$system$provider { _CopyWithImpl$Query$SystemServerProvider$system$provider( - this._instance, this._then); + this._instance, + this._then, + ); final Query$SystemServerProvider$system$provider _instance; @@ -3577,15 +6353,18 @@ class _CopyWithImpl$Query$SystemServerProvider$system$provider static const _undefined = {}; - TRes call( - {Object? provider = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? provider = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$SystemServerProvider$system$provider( - provider: provider == _undefined || provider == null - ? _instance.provider - : (provider as Enum$ServerProvider), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + provider: provider == _undefined || provider == null + ? _instance.provider + : (provider as Enum$ServerProvider), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Query$SystemServerProvider$system$provider @@ -3594,64 +6373,105 @@ class _CopyWithStubImpl$Query$SystemServerProvider$system$provider TRes _res; - call({Enum$ServerProvider? provider, String? $__typename}) => _res; + call({ + Enum$ServerProvider? provider, + String? $__typename, + }) => + _res; } -@JsonSerializable(explicitToJson: true) class Query$SystemDnsProvider { - Query$SystemDnsProvider({required this.system, required this.$__typename}); + Query$SystemDnsProvider({ + required this.system, + required this.$__typename, + }); - @override - factory Query$SystemDnsProvider.fromJson(Map json) => - _$Query$SystemDnsProviderFromJson(json); + factory Query$SystemDnsProvider.fromJson(Map json) { + final l$system = json['system']; + final l$$__typename = json['__typename']; + return Query$SystemDnsProvider( + system: Query$SystemDnsProvider$system.fromJson( + (l$system as Map)), + $__typename: (l$$__typename as String), + ); + } final Query$SystemDnsProvider$system system; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$SystemDnsProviderToJson(this); + Map toJson() { + final _resultData = {}; + final l$system = system; + _resultData['system'] = l$system.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$system = system; final l$$__typename = $__typename; - return Object.hashAll([l$system, l$$__typename]); + return Object.hashAll([ + l$system, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Query$SystemDnsProvider) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Query$SystemDnsProvider) || + runtimeType != other.runtimeType) { return false; + } final l$system = system; final lOther$system = other.system; - if (l$system != lOther$system) return false; + if (l$system != lOther$system) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Query$SystemDnsProvider on Query$SystemDnsProvider { CopyWith$Query$SystemDnsProvider get copyWith => - CopyWith$Query$SystemDnsProvider(this, (i) => i); + CopyWith$Query$SystemDnsProvider( + this, + (i) => i, + ); } abstract class CopyWith$Query$SystemDnsProvider { - factory CopyWith$Query$SystemDnsProvider(Query$SystemDnsProvider instance, - TRes Function(Query$SystemDnsProvider) then) = - _CopyWithImpl$Query$SystemDnsProvider; + factory CopyWith$Query$SystemDnsProvider( + Query$SystemDnsProvider instance, + TRes Function(Query$SystemDnsProvider) then, + ) = _CopyWithImpl$Query$SystemDnsProvider; factory CopyWith$Query$SystemDnsProvider.stub(TRes res) = _CopyWithStubImpl$Query$SystemDnsProvider; - TRes call({Query$SystemDnsProvider$system? system, String? $__typename}); + TRes call({ + Query$SystemDnsProvider$system? system, + String? $__typename, + }); CopyWith$Query$SystemDnsProvider$system get system; } class _CopyWithImpl$Query$SystemDnsProvider implements CopyWith$Query$SystemDnsProvider { - _CopyWithImpl$Query$SystemDnsProvider(this._instance, this._then); + _CopyWithImpl$Query$SystemDnsProvider( + this._instance, + this._then, + ); final Query$SystemDnsProvider _instance; @@ -3659,14 +6479,18 @@ class _CopyWithImpl$Query$SystemDnsProvider static const _undefined = {}; - TRes call({Object? system = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? system = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$SystemDnsProvider( - system: system == _undefined || system == null - ? _instance.system - : (system as Query$SystemDnsProvider$system), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + system: system == _undefined || system == null + ? _instance.system + : (system as Query$SystemDnsProvider$system), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Query$SystemDnsProvider$system get system { final local$system = _instance.system; return CopyWith$Query$SystemDnsProvider$system( @@ -3680,57 +6504,68 @@ class _CopyWithStubImpl$Query$SystemDnsProvider TRes _res; - call({Query$SystemDnsProvider$system? system, String? $__typename}) => _res; + call({ + Query$SystemDnsProvider$system? system, + String? $__typename, + }) => + _res; CopyWith$Query$SystemDnsProvider$system get system => CopyWith$Query$SystemDnsProvider$system.stub(_res); } const documentNodeQuerySystemDnsProvider = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'SystemDnsProvider'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'system'), + type: OperationType.query, + name: NameNode(value: 'SystemDnsProvider'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'system'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'domainInfo'), alias: null, arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ FieldNode( - name: NameNode(value: 'domainInfo'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'provider'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), + name: NameNode(value: 'provider'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), ]); Query$SystemDnsProvider _parserFn$Query$SystemDnsProvider( Map data) => @@ -3738,52 +6573,54 @@ Query$SystemDnsProvider _parserFn$Query$SystemDnsProvider( class Options$Query$SystemDnsProvider extends graphql.QueryOptions { - Options$Query$SystemDnsProvider( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - Duration? pollInterval, - graphql.Context? context}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - pollInterval: pollInterval, - context: context, - document: documentNodeQuerySystemDnsProvider, - parserFn: _parserFn$Query$SystemDnsProvider); + Options$Query$SystemDnsProvider({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Duration? pollInterval, + graphql.Context? context, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + pollInterval: pollInterval, + context: context, + document: documentNodeQuerySystemDnsProvider, + parserFn: _parserFn$Query$SystemDnsProvider, + ); } class WatchOptions$Query$SystemDnsProvider extends graphql.WatchQueryOptions { - WatchOptions$Query$SystemDnsProvider( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeQuerySystemDnsProvider, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Query$SystemDnsProvider); + WatchOptions$Query$SystemDnsProvider({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeQuerySystemDnsProvider, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Query$SystemDnsProvider, + ); } class FetchMoreOptions$Query$SystemDnsProvider @@ -3791,8 +6628,9 @@ class FetchMoreOptions$Query$SystemDnsProvider FetchMoreOptions$Query$SystemDnsProvider( {required graphql.UpdateQuery updateQuery}) : super( - updateQuery: updateQuery, - document: documentNodeQuerySystemDnsProvider); + updateQuery: updateQuery, + document: documentNodeQuerySystemDnsProvider, + ); } extension ClientExtension$Query$SystemDnsProvider on graphql.GraphQLClient { @@ -3802,57 +6640,87 @@ extension ClientExtension$Query$SystemDnsProvider on graphql.GraphQLClient { graphql.ObservableQuery watchQuery$SystemDnsProvider( [WatchOptions$Query$SystemDnsProvider? options]) => this.watchQuery(options ?? WatchOptions$Query$SystemDnsProvider()); - void writeQuery$SystemDnsProvider( - {required Query$SystemDnsProvider data, bool broadcast = true}) => + void writeQuery$SystemDnsProvider({ + required Query$SystemDnsProvider data, + bool broadcast = true, + }) => this.writeQuery( - graphql.Request( - operation: graphql.Operation( - document: documentNodeQuerySystemDnsProvider)), - data: data.toJson(), - broadcast: broadcast); - Query$SystemDnsProvider? readQuery$SystemDnsProvider( - {bool optimistic = true}) { - final result = this.readQuery( graphql.Request( operation: graphql.Operation( document: documentNodeQuerySystemDnsProvider)), - optimistic: optimistic); + data: data.toJson(), + broadcast: broadcast, + ); + Query$SystemDnsProvider? readQuery$SystemDnsProvider( + {bool optimistic = true}) { + final result = this.readQuery( + graphql.Request( + operation: + graphql.Operation(document: documentNodeQuerySystemDnsProvider)), + optimistic: optimistic, + ); return result == null ? null : Query$SystemDnsProvider.fromJson(result); } } -@JsonSerializable(explicitToJson: true) class Query$SystemDnsProvider$system { - Query$SystemDnsProvider$system( - {required this.domainInfo, required this.$__typename}); + Query$SystemDnsProvider$system({ + required this.domainInfo, + required this.$__typename, + }); - @override - factory Query$SystemDnsProvider$system.fromJson(Map json) => - _$Query$SystemDnsProvider$systemFromJson(json); + factory Query$SystemDnsProvider$system.fromJson(Map json) { + final l$domainInfo = json['domainInfo']; + final l$$__typename = json['__typename']; + return Query$SystemDnsProvider$system( + domainInfo: Query$SystemDnsProvider$system$domainInfo.fromJson( + (l$domainInfo as Map)), + $__typename: (l$$__typename as String), + ); + } final Query$SystemDnsProvider$system$domainInfo domainInfo; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$SystemDnsProvider$systemToJson(this); + Map toJson() { + final _resultData = {}; + final l$domainInfo = domainInfo; + _resultData['domainInfo'] = l$domainInfo.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$domainInfo = domainInfo; final l$$__typename = $__typename; - return Object.hashAll([l$domainInfo, l$$__typename]); + return Object.hashAll([ + l$domainInfo, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$SystemDnsProvider$system) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$domainInfo = domainInfo; final lOther$domainInfo = other.domainInfo; - if (l$domainInfo != lOther$domainInfo) return false; + if (l$domainInfo != lOther$domainInfo) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -3860,27 +6728,34 @@ class Query$SystemDnsProvider$system { extension UtilityExtension$Query$SystemDnsProvider$system on Query$SystemDnsProvider$system { CopyWith$Query$SystemDnsProvider$system - get copyWith => CopyWith$Query$SystemDnsProvider$system(this, (i) => i); + get copyWith => CopyWith$Query$SystemDnsProvider$system( + this, + (i) => i, + ); } abstract class CopyWith$Query$SystemDnsProvider$system { factory CopyWith$Query$SystemDnsProvider$system( - Query$SystemDnsProvider$system instance, - TRes Function(Query$SystemDnsProvider$system) then) = - _CopyWithImpl$Query$SystemDnsProvider$system; + Query$SystemDnsProvider$system instance, + TRes Function(Query$SystemDnsProvider$system) then, + ) = _CopyWithImpl$Query$SystemDnsProvider$system; factory CopyWith$Query$SystemDnsProvider$system.stub(TRes res) = _CopyWithStubImpl$Query$SystemDnsProvider$system; - TRes call( - {Query$SystemDnsProvider$system$domainInfo? domainInfo, - String? $__typename}); + TRes call({ + Query$SystemDnsProvider$system$domainInfo? domainInfo, + String? $__typename, + }); CopyWith$Query$SystemDnsProvider$system$domainInfo get domainInfo; } class _CopyWithImpl$Query$SystemDnsProvider$system implements CopyWith$Query$SystemDnsProvider$system { - _CopyWithImpl$Query$SystemDnsProvider$system(this._instance, this._then); + _CopyWithImpl$Query$SystemDnsProvider$system( + this._instance, + this._then, + ); final Query$SystemDnsProvider$system _instance; @@ -3888,16 +6763,18 @@ class _CopyWithImpl$Query$SystemDnsProvider$system static const _undefined = {}; - TRes call( - {Object? domainInfo = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? domainInfo = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$SystemDnsProvider$system( - domainInfo: domainInfo == _undefined || domainInfo == null - ? _instance.domainInfo - : (domainInfo as Query$SystemDnsProvider$system$domainInfo), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + domainInfo: domainInfo == _undefined || domainInfo == null + ? _instance.domainInfo + : (domainInfo as Query$SystemDnsProvider$system$domainInfo), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Query$SystemDnsProvider$system$domainInfo get domainInfo { final local$domainInfo = _instance.domainInfo; return CopyWith$Query$SystemDnsProvider$system$domainInfo( @@ -3911,49 +6788,73 @@ class _CopyWithStubImpl$Query$SystemDnsProvider$system TRes _res; - call( - {Query$SystemDnsProvider$system$domainInfo? domainInfo, - String? $__typename}) => + call({ + Query$SystemDnsProvider$system$domainInfo? domainInfo, + String? $__typename, + }) => _res; CopyWith$Query$SystemDnsProvider$system$domainInfo get domainInfo => CopyWith$Query$SystemDnsProvider$system$domainInfo.stub(_res); } -@JsonSerializable(explicitToJson: true) class Query$SystemDnsProvider$system$domainInfo { - Query$SystemDnsProvider$system$domainInfo( - {required this.provider, required this.$__typename}); + Query$SystemDnsProvider$system$domainInfo({ + required this.provider, + required this.$__typename, + }); - @override factory Query$SystemDnsProvider$system$domainInfo.fromJson( - Map json) => - _$Query$SystemDnsProvider$system$domainInfoFromJson(json); + Map json) { + final l$provider = json['provider']; + final l$$__typename = json['__typename']; + return Query$SystemDnsProvider$system$domainInfo( + provider: fromJson$Enum$DnsProvider((l$provider as String)), + $__typename: (l$$__typename as String), + ); + } - @JsonKey(unknownEnumValue: Enum$DnsProvider.$unknown) final Enum$DnsProvider provider; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Query$SystemDnsProvider$system$domainInfoToJson(this); + Map toJson() { + final _resultData = {}; + final l$provider = provider; + _resultData['provider'] = toJson$Enum$DnsProvider(l$provider); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$provider = provider; final l$$__typename = $__typename; - return Object.hashAll([l$provider, l$$__typename]); + return Object.hashAll([ + l$provider, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$SystemDnsProvider$system$domainInfo) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$provider = provider; final lOther$provider = other.provider; - if (l$provider != lOther$provider) return false; + if (l$provider != lOther$provider) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -3962,26 +6863,33 @@ extension UtilityExtension$Query$SystemDnsProvider$system$domainInfo on Query$SystemDnsProvider$system$domainInfo { CopyWith$Query$SystemDnsProvider$system$domainInfo< Query$SystemDnsProvider$system$domainInfo> - get copyWith => - CopyWith$Query$SystemDnsProvider$system$domainInfo(this, (i) => i); + get copyWith => CopyWith$Query$SystemDnsProvider$system$domainInfo( + this, + (i) => i, + ); } abstract class CopyWith$Query$SystemDnsProvider$system$domainInfo { factory CopyWith$Query$SystemDnsProvider$system$domainInfo( - Query$SystemDnsProvider$system$domainInfo instance, - TRes Function(Query$SystemDnsProvider$system$domainInfo) then) = - _CopyWithImpl$Query$SystemDnsProvider$system$domainInfo; + Query$SystemDnsProvider$system$domainInfo instance, + TRes Function(Query$SystemDnsProvider$system$domainInfo) then, + ) = _CopyWithImpl$Query$SystemDnsProvider$system$domainInfo; factory CopyWith$Query$SystemDnsProvider$system$domainInfo.stub(TRes res) = _CopyWithStubImpl$Query$SystemDnsProvider$system$domainInfo; - TRes call({Enum$DnsProvider? provider, String? $__typename}); + TRes call({ + Enum$DnsProvider? provider, + String? $__typename, + }); } class _CopyWithImpl$Query$SystemDnsProvider$system$domainInfo implements CopyWith$Query$SystemDnsProvider$system$domainInfo { _CopyWithImpl$Query$SystemDnsProvider$system$domainInfo( - this._instance, this._then); + this._instance, + this._then, + ); final Query$SystemDnsProvider$system$domainInfo _instance; @@ -3989,15 +6897,18 @@ class _CopyWithImpl$Query$SystemDnsProvider$system$domainInfo static const _undefined = {}; - TRes call( - {Object? provider = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? provider = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$SystemDnsProvider$system$domainInfo( - provider: provider == _undefined || provider == null - ? _instance.provider - : (provider as Enum$DnsProvider), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + provider: provider == _undefined || provider == null + ? _instance.provider + : (provider as Enum$DnsProvider), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Query$SystemDnsProvider$system$domainInfo @@ -4006,64 +6917,103 @@ class _CopyWithStubImpl$Query$SystemDnsProvider$system$domainInfo TRes _res; - call({Enum$DnsProvider? provider, String? $__typename}) => _res; + call({ + Enum$DnsProvider? provider, + String? $__typename, + }) => + _res; } -@JsonSerializable(explicitToJson: true) class Query$GetApiTokens { - Query$GetApiTokens({required this.api, required this.$__typename}); + Query$GetApiTokens({ + required this.api, + required this.$__typename, + }); - @override - factory Query$GetApiTokens.fromJson(Map json) => - _$Query$GetApiTokensFromJson(json); + factory Query$GetApiTokens.fromJson(Map json) { + final l$api = json['api']; + final l$$__typename = json['__typename']; + return Query$GetApiTokens( + api: Query$GetApiTokens$api.fromJson((l$api as Map)), + $__typename: (l$$__typename as String), + ); + } final Query$GetApiTokens$api api; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$GetApiTokensToJson(this); + Map toJson() { + final _resultData = {}; + final l$api = api; + _resultData['api'] = l$api.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$api = api; final l$$__typename = $__typename; - return Object.hashAll([l$api, l$$__typename]); + return Object.hashAll([ + l$api, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Query$GetApiTokens) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Query$GetApiTokens) || runtimeType != other.runtimeType) { return false; + } final l$api = api; final lOther$api = other.api; - if (l$api != lOther$api) return false; + if (l$api != lOther$api) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Query$GetApiTokens on Query$GetApiTokens { CopyWith$Query$GetApiTokens get copyWith => - CopyWith$Query$GetApiTokens(this, (i) => i); + CopyWith$Query$GetApiTokens( + this, + (i) => i, + ); } abstract class CopyWith$Query$GetApiTokens { factory CopyWith$Query$GetApiTokens( - Query$GetApiTokens instance, TRes Function(Query$GetApiTokens) then) = - _CopyWithImpl$Query$GetApiTokens; + Query$GetApiTokens instance, + TRes Function(Query$GetApiTokens) then, + ) = _CopyWithImpl$Query$GetApiTokens; factory CopyWith$Query$GetApiTokens.stub(TRes res) = _CopyWithStubImpl$Query$GetApiTokens; - TRes call({Query$GetApiTokens$api? api, String? $__typename}); + TRes call({ + Query$GetApiTokens$api? api, + String? $__typename, + }); CopyWith$Query$GetApiTokens$api get api; } class _CopyWithImpl$Query$GetApiTokens implements CopyWith$Query$GetApiTokens { - _CopyWithImpl$Query$GetApiTokens(this._instance, this._then); + _CopyWithImpl$Query$GetApiTokens( + this._instance, + this._then, + ); final Query$GetApiTokens _instance; @@ -4071,14 +7021,18 @@ class _CopyWithImpl$Query$GetApiTokens static const _undefined = {}; - TRes call({Object? api = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? api = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$GetApiTokens( - api: api == _undefined || api == null - ? _instance.api - : (api as Query$GetApiTokens$api), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + api: api == _undefined || api == null + ? _instance.api + : (api as Query$GetApiTokens$api), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Query$GetApiTokens$api get api { final local$api = _instance.api; return CopyWith$Query$GetApiTokens$api(local$api, (e) => call(api: e)); @@ -4091,128 +7045,145 @@ class _CopyWithStubImpl$Query$GetApiTokens TRes _res; - call({Query$GetApiTokens$api? api, String? $__typename}) => _res; + call({ + Query$GetApiTokens$api? api, + String? $__typename, + }) => + _res; CopyWith$Query$GetApiTokens$api get api => CopyWith$Query$GetApiTokens$api.stub(_res); } const documentNodeQueryGetApiTokens = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'GetApiTokens'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'api'), + type: OperationType.query, + name: NameNode(value: 'GetApiTokens'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'api'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'devices'), alias: null, arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ FieldNode( - name: NameNode(value: 'devices'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'creationDate'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'isCaller'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'name'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), + name: NameNode(value: 'creationDate'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + name: NameNode(value: 'isCaller'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'name'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), ]); Query$GetApiTokens _parserFn$Query$GetApiTokens(Map data) => Query$GetApiTokens.fromJson(data); class Options$Query$GetApiTokens extends graphql.QueryOptions { - Options$Query$GetApiTokens( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - Duration? pollInterval, - graphql.Context? context}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - pollInterval: pollInterval, - context: context, - document: documentNodeQueryGetApiTokens, - parserFn: _parserFn$Query$GetApiTokens); + Options$Query$GetApiTokens({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Duration? pollInterval, + graphql.Context? context, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + pollInterval: pollInterval, + context: context, + document: documentNodeQueryGetApiTokens, + parserFn: _parserFn$Query$GetApiTokens, + ); } class WatchOptions$Query$GetApiTokens extends graphql.WatchQueryOptions { - WatchOptions$Query$GetApiTokens( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeQueryGetApiTokens, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Query$GetApiTokens); + WatchOptions$Query$GetApiTokens({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeQueryGetApiTokens, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Query$GetApiTokens, + ); } class FetchMoreOptions$Query$GetApiTokens extends graphql.FetchMoreOptions { FetchMoreOptions$Query$GetApiTokens( {required graphql.UpdateQuery updateQuery}) : super( - updateQuery: updateQuery, document: documentNodeQueryGetApiTokens); + updateQuery: updateQuery, + document: documentNodeQueryGetApiTokens, + ); } extension ClientExtension$Query$GetApiTokens on graphql.GraphQLClient { @@ -4222,81 +7193,120 @@ extension ClientExtension$Query$GetApiTokens on graphql.GraphQLClient { graphql.ObservableQuery watchQuery$GetApiTokens( [WatchOptions$Query$GetApiTokens? options]) => this.watchQuery(options ?? WatchOptions$Query$GetApiTokens()); - void writeQuery$GetApiTokens( - {required Query$GetApiTokens data, bool broadcast = true}) => + void writeQuery$GetApiTokens({ + required Query$GetApiTokens data, + bool broadcast = true, + }) => this.writeQuery( - graphql.Request( - operation: - graphql.Operation(document: documentNodeQueryGetApiTokens)), - data: data.toJson(), - broadcast: broadcast); - Query$GetApiTokens? readQuery$GetApiTokens({bool optimistic = true}) { - final result = this.readQuery( graphql.Request( operation: graphql.Operation(document: documentNodeQueryGetApiTokens)), - optimistic: optimistic); + data: data.toJson(), + broadcast: broadcast, + ); + Query$GetApiTokens? readQuery$GetApiTokens({bool optimistic = true}) { + final result = this.readQuery( + graphql.Request( + operation: + graphql.Operation(document: documentNodeQueryGetApiTokens)), + optimistic: optimistic, + ); return result == null ? null : Query$GetApiTokens.fromJson(result); } } -@JsonSerializable(explicitToJson: true) class Query$GetApiTokens$api { - Query$GetApiTokens$api({required this.devices, required this.$__typename}); + Query$GetApiTokens$api({ + required this.devices, + required this.$__typename, + }); - @override - factory Query$GetApiTokens$api.fromJson(Map json) => - _$Query$GetApiTokens$apiFromJson(json); + factory Query$GetApiTokens$api.fromJson(Map json) { + final l$devices = json['devices']; + final l$$__typename = json['__typename']; + return Query$GetApiTokens$api( + devices: (l$devices as List) + .map((e) => Query$GetApiTokens$api$devices.fromJson( + (e as Map))) + .toList(), + $__typename: (l$$__typename as String), + ); + } final List devices; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$GetApiTokens$apiToJson(this); + Map toJson() { + final _resultData = {}; + final l$devices = devices; + _resultData['devices'] = l$devices.map((e) => e.toJson()).toList(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$devices = devices; final l$$__typename = $__typename; - return Object.hashAll( - [Object.hashAll(l$devices.map((v) => v)), l$$__typename]); + return Object.hashAll([ + Object.hashAll(l$devices.map((v) => v)), + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Query$GetApiTokens$api) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Query$GetApiTokens$api) || + runtimeType != other.runtimeType) { return false; + } final l$devices = devices; final lOther$devices = other.devices; - if (l$devices.length != lOther$devices.length) return false; + if (l$devices.length != lOther$devices.length) { + return false; + } for (int i = 0; i < l$devices.length; i++) { final l$devices$entry = l$devices[i]; final lOther$devices$entry = lOther$devices[i]; - if (l$devices$entry != lOther$devices$entry) return false; + if (l$devices$entry != lOther$devices$entry) { + return false; + } } - final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Query$GetApiTokens$api on Query$GetApiTokens$api { CopyWith$Query$GetApiTokens$api get copyWith => - CopyWith$Query$GetApiTokens$api(this, (i) => i); + CopyWith$Query$GetApiTokens$api( + this, + (i) => i, + ); } abstract class CopyWith$Query$GetApiTokens$api { - factory CopyWith$Query$GetApiTokens$api(Query$GetApiTokens$api instance, - TRes Function(Query$GetApiTokens$api) then) = - _CopyWithImpl$Query$GetApiTokens$api; + factory CopyWith$Query$GetApiTokens$api( + Query$GetApiTokens$api instance, + TRes Function(Query$GetApiTokens$api) then, + ) = _CopyWithImpl$Query$GetApiTokens$api; factory CopyWith$Query$GetApiTokens$api.stub(TRes res) = _CopyWithStubImpl$Query$GetApiTokens$api; - TRes call( - {List? devices, String? $__typename}); + TRes call({ + List? devices, + String? $__typename, + }); TRes devices( Iterable Function( Iterable< @@ -4307,7 +7317,10 @@ abstract class CopyWith$Query$GetApiTokens$api { class _CopyWithImpl$Query$GetApiTokens$api implements CopyWith$Query$GetApiTokens$api { - _CopyWithImpl$Query$GetApiTokens$api(this._instance, this._then); + _CopyWithImpl$Query$GetApiTokens$api( + this._instance, + this._then, + ); final Query$GetApiTokens$api _instance; @@ -4315,14 +7328,18 @@ class _CopyWithImpl$Query$GetApiTokens$api static const _undefined = {}; - TRes call({Object? devices = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? devices = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$GetApiTokens$api( - devices: devices == _undefined || devices == null - ? _instance.devices - : (devices as List), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + devices: devices == _undefined || devices == null + ? _instance.devices + : (devices as List), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); TRes devices( Iterable Function( Iterable< @@ -4330,9 +7347,11 @@ class _CopyWithImpl$Query$GetApiTokens$api Query$GetApiTokens$api$devices>>) _fn) => call( - devices: _fn(_instance.devices.map( - (e) => CopyWith$Query$GetApiTokens$api$devices(e, (i) => i))) - .toList()); + devices: _fn(_instance.devices + .map((e) => CopyWith$Query$GetApiTokens$api$devices( + e, + (i) => i, + ))).toList()); } class _CopyWithStubImpl$Query$GetApiTokens$api @@ -4341,59 +7360,99 @@ class _CopyWithStubImpl$Query$GetApiTokens$api TRes _res; - call({List? devices, String? $__typename}) => + call({ + List? devices, + String? $__typename, + }) => _res; devices(_fn) => _res; } -@JsonSerializable(explicitToJson: true) class Query$GetApiTokens$api$devices { - Query$GetApiTokens$api$devices( - {required this.creationDate, - required this.isCaller, - required this.name, - required this.$__typename}); + Query$GetApiTokens$api$devices({ + required this.creationDate, + required this.isCaller, + required this.name, + required this.$__typename, + }); - @override - factory Query$GetApiTokens$api$devices.fromJson(Map json) => - _$Query$GetApiTokens$api$devicesFromJson(json); + factory Query$GetApiTokens$api$devices.fromJson(Map json) { + final l$creationDate = json['creationDate']; + final l$isCaller = json['isCaller']; + final l$name = json['name']; + final l$$__typename = json['__typename']; + return Query$GetApiTokens$api$devices( + creationDate: dateTimeFromJson(l$creationDate), + isCaller: (l$isCaller as bool), + name: (l$name as String), + $__typename: (l$$__typename as String), + ); + } - @JsonKey(fromJson: dateTimeFromJson, toJson: dateTimeToJson) final DateTime creationDate; final bool isCaller; final String name; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$GetApiTokens$api$devicesToJson(this); + Map toJson() { + final _resultData = {}; + final l$creationDate = creationDate; + _resultData['creationDate'] = dateTimeToJson(l$creationDate); + final l$isCaller = isCaller; + _resultData['isCaller'] = l$isCaller; + final l$name = name; + _resultData['name'] = l$name; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$creationDate = creationDate; final l$isCaller = isCaller; final l$name = name; final l$$__typename = $__typename; - return Object.hashAll([l$creationDate, l$isCaller, l$name, l$$__typename]); + return Object.hashAll([ + l$creationDate, + l$isCaller, + l$name, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$GetApiTokens$api$devices) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$creationDate = creationDate; final lOther$creationDate = other.creationDate; - if (l$creationDate != lOther$creationDate) return false; + if (l$creationDate != lOther$creationDate) { + return false; + } final l$isCaller = isCaller; final lOther$isCaller = other.isCaller; - if (l$isCaller != lOther$isCaller) return false; + if (l$isCaller != lOther$isCaller) { + return false; + } final l$name = name; final lOther$name = other.name; - if (l$name != lOther$name) return false; + if (l$name != lOther$name) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -4401,28 +7460,35 @@ class Query$GetApiTokens$api$devices { extension UtilityExtension$Query$GetApiTokens$api$devices on Query$GetApiTokens$api$devices { CopyWith$Query$GetApiTokens$api$devices - get copyWith => CopyWith$Query$GetApiTokens$api$devices(this, (i) => i); + get copyWith => CopyWith$Query$GetApiTokens$api$devices( + this, + (i) => i, + ); } abstract class CopyWith$Query$GetApiTokens$api$devices { factory CopyWith$Query$GetApiTokens$api$devices( - Query$GetApiTokens$api$devices instance, - TRes Function(Query$GetApiTokens$api$devices) then) = - _CopyWithImpl$Query$GetApiTokens$api$devices; + Query$GetApiTokens$api$devices instance, + TRes Function(Query$GetApiTokens$api$devices) then, + ) = _CopyWithImpl$Query$GetApiTokens$api$devices; factory CopyWith$Query$GetApiTokens$api$devices.stub(TRes res) = _CopyWithStubImpl$Query$GetApiTokens$api$devices; - TRes call( - {DateTime? creationDate, - bool? isCaller, - String? name, - String? $__typename}); + TRes call({ + DateTime? creationDate, + bool? isCaller, + String? name, + String? $__typename, + }); } class _CopyWithImpl$Query$GetApiTokens$api$devices implements CopyWith$Query$GetApiTokens$api$devices { - _CopyWithImpl$Query$GetApiTokens$api$devices(this._instance, this._then); + _CopyWithImpl$Query$GetApiTokens$api$devices( + this._instance, + this._then, + ); final Query$GetApiTokens$api$devices _instance; @@ -4430,24 +7496,26 @@ class _CopyWithImpl$Query$GetApiTokens$api$devices static const _undefined = {}; - TRes call( - {Object? creationDate = _undefined, - Object? isCaller = _undefined, - Object? name = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? creationDate = _undefined, + Object? isCaller = _undefined, + Object? name = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$GetApiTokens$api$devices( - creationDate: creationDate == _undefined || creationDate == null - ? _instance.creationDate - : (creationDate as DateTime), - isCaller: isCaller == _undefined || isCaller == null - ? _instance.isCaller - : (isCaller as bool), - name: name == _undefined || name == null - ? _instance.name - : (name as String), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + creationDate: creationDate == _undefined || creationDate == null + ? _instance.creationDate + : (creationDate as DateTime), + isCaller: isCaller == _undefined || isCaller == null + ? _instance.isCaller + : (isCaller as bool), + name: name == _undefined || name == null + ? _instance.name + : (name as String), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Query$GetApiTokens$api$devices @@ -4456,69 +7524,105 @@ class _CopyWithStubImpl$Query$GetApiTokens$api$devices TRes _res; - call( - {DateTime? creationDate, - bool? isCaller, - String? name, - String? $__typename}) => + call({ + DateTime? creationDate, + bool? isCaller, + String? name, + String? $__typename, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Query$RecoveryKey { - Query$RecoveryKey({required this.api, required this.$__typename}); + Query$RecoveryKey({ + required this.api, + required this.$__typename, + }); - @override - factory Query$RecoveryKey.fromJson(Map json) => - _$Query$RecoveryKeyFromJson(json); + factory Query$RecoveryKey.fromJson(Map json) { + final l$api = json['api']; + final l$$__typename = json['__typename']; + return Query$RecoveryKey( + api: Query$RecoveryKey$api.fromJson((l$api as Map)), + $__typename: (l$$__typename as String), + ); + } final Query$RecoveryKey$api api; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$RecoveryKeyToJson(this); + Map toJson() { + final _resultData = {}; + final l$api = api; + _resultData['api'] = l$api.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$api = api; final l$$__typename = $__typename; - return Object.hashAll([l$api, l$$__typename]); + return Object.hashAll([ + l$api, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Query$RecoveryKey) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Query$RecoveryKey) || runtimeType != other.runtimeType) { return false; + } final l$api = api; final lOther$api = other.api; - if (l$api != lOther$api) return false; + if (l$api != lOther$api) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Query$RecoveryKey on Query$RecoveryKey { CopyWith$Query$RecoveryKey get copyWith => - CopyWith$Query$RecoveryKey(this, (i) => i); + CopyWith$Query$RecoveryKey( + this, + (i) => i, + ); } abstract class CopyWith$Query$RecoveryKey { factory CopyWith$Query$RecoveryKey( - Query$RecoveryKey instance, TRes Function(Query$RecoveryKey) then) = - _CopyWithImpl$Query$RecoveryKey; + Query$RecoveryKey instance, + TRes Function(Query$RecoveryKey) then, + ) = _CopyWithImpl$Query$RecoveryKey; factory CopyWith$Query$RecoveryKey.stub(TRes res) = _CopyWithStubImpl$Query$RecoveryKey; - TRes call({Query$RecoveryKey$api? api, String? $__typename}); + TRes call({ + Query$RecoveryKey$api? api, + String? $__typename, + }); CopyWith$Query$RecoveryKey$api get api; } class _CopyWithImpl$Query$RecoveryKey implements CopyWith$Query$RecoveryKey { - _CopyWithImpl$Query$RecoveryKey(this._instance, this._then); + _CopyWithImpl$Query$RecoveryKey( + this._instance, + this._then, + ); final Query$RecoveryKey _instance; @@ -4526,14 +7630,18 @@ class _CopyWithImpl$Query$RecoveryKey static const _undefined = {}; - TRes call({Object? api = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? api = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$RecoveryKey( - api: api == _undefined || api == null - ? _instance.api - : (api as Query$RecoveryKey$api), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + api: api == _undefined || api == null + ? _instance.api + : (api as Query$RecoveryKey$api), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Query$RecoveryKey$api get api { final local$api = _instance.api; return CopyWith$Query$RecoveryKey$api(local$api, (e) => call(api: e)); @@ -4546,138 +7654,158 @@ class _CopyWithStubImpl$Query$RecoveryKey TRes _res; - call({Query$RecoveryKey$api? api, String? $__typename}) => _res; + call({ + Query$RecoveryKey$api? api, + String? $__typename, + }) => + _res; CopyWith$Query$RecoveryKey$api get api => CopyWith$Query$RecoveryKey$api.stub(_res); } const documentNodeQueryRecoveryKey = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'RecoveryKey'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'api'), + type: OperationType.query, + name: NameNode(value: 'RecoveryKey'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'api'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'recoveryKey'), alias: null, arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ FieldNode( - name: NameNode(value: 'recoveryKey'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'creationDate'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'exists'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'expirationDate'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'usesLeft'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'valid'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), + name: NameNode(value: 'creationDate'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + name: NameNode(value: 'exists'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'expirationDate'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'usesLeft'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'valid'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), ]); Query$RecoveryKey _parserFn$Query$RecoveryKey(Map data) => Query$RecoveryKey.fromJson(data); class Options$Query$RecoveryKey extends graphql.QueryOptions { - Options$Query$RecoveryKey( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - Duration? pollInterval, - graphql.Context? context}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - pollInterval: pollInterval, - context: context, - document: documentNodeQueryRecoveryKey, - parserFn: _parserFn$Query$RecoveryKey); + Options$Query$RecoveryKey({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Duration? pollInterval, + graphql.Context? context, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + pollInterval: pollInterval, + context: context, + document: documentNodeQueryRecoveryKey, + parserFn: _parserFn$Query$RecoveryKey, + ); } class WatchOptions$Query$RecoveryKey extends graphql.WatchQueryOptions { - WatchOptions$Query$RecoveryKey( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeQueryRecoveryKey, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Query$RecoveryKey); + WatchOptions$Query$RecoveryKey({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeQueryRecoveryKey, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Query$RecoveryKey, + ); } class FetchMoreOptions$Query$RecoveryKey extends graphql.FetchMoreOptions { FetchMoreOptions$Query$RecoveryKey({required graphql.UpdateQuery updateQuery}) - : super(updateQuery: updateQuery, document: documentNodeQueryRecoveryKey); + : super( + updateQuery: updateQuery, + document: documentNodeQueryRecoveryKey, + ); } extension ClientExtension$Query$RecoveryKey on graphql.GraphQLClient { @@ -4687,80 +7815,118 @@ extension ClientExtension$Query$RecoveryKey on graphql.GraphQLClient { graphql.ObservableQuery watchQuery$RecoveryKey( [WatchOptions$Query$RecoveryKey? options]) => this.watchQuery(options ?? WatchOptions$Query$RecoveryKey()); - void writeQuery$RecoveryKey( - {required Query$RecoveryKey data, bool broadcast = true}) => + void writeQuery$RecoveryKey({ + required Query$RecoveryKey data, + bool broadcast = true, + }) => this.writeQuery( - graphql.Request( - operation: - graphql.Operation(document: documentNodeQueryRecoveryKey)), - data: data.toJson(), - broadcast: broadcast); - Query$RecoveryKey? readQuery$RecoveryKey({bool optimistic = true}) { - final result = this.readQuery( graphql.Request( operation: graphql.Operation(document: documentNodeQueryRecoveryKey)), - optimistic: optimistic); + data: data.toJson(), + broadcast: broadcast, + ); + Query$RecoveryKey? readQuery$RecoveryKey({bool optimistic = true}) { + final result = this.readQuery( + graphql.Request( + operation: graphql.Operation(document: documentNodeQueryRecoveryKey)), + optimistic: optimistic, + ); return result == null ? null : Query$RecoveryKey.fromJson(result); } } -@JsonSerializable(explicitToJson: true) class Query$RecoveryKey$api { - Query$RecoveryKey$api({required this.recoveryKey, required this.$__typename}); + Query$RecoveryKey$api({ + required this.recoveryKey, + required this.$__typename, + }); - @override - factory Query$RecoveryKey$api.fromJson(Map json) => - _$Query$RecoveryKey$apiFromJson(json); + factory Query$RecoveryKey$api.fromJson(Map json) { + final l$recoveryKey = json['recoveryKey']; + final l$$__typename = json['__typename']; + return Query$RecoveryKey$api( + recoveryKey: Query$RecoveryKey$api$recoveryKey.fromJson( + (l$recoveryKey as Map)), + $__typename: (l$$__typename as String), + ); + } final Query$RecoveryKey$api$recoveryKey recoveryKey; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$RecoveryKey$apiToJson(this); + Map toJson() { + final _resultData = {}; + final l$recoveryKey = recoveryKey; + _resultData['recoveryKey'] = l$recoveryKey.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$recoveryKey = recoveryKey; final l$$__typename = $__typename; - return Object.hashAll([l$recoveryKey, l$$__typename]); + return Object.hashAll([ + l$recoveryKey, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Query$RecoveryKey$api) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Query$RecoveryKey$api) || runtimeType != other.runtimeType) { return false; + } final l$recoveryKey = recoveryKey; final lOther$recoveryKey = other.recoveryKey; - if (l$recoveryKey != lOther$recoveryKey) return false; + if (l$recoveryKey != lOther$recoveryKey) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Query$RecoveryKey$api on Query$RecoveryKey$api { CopyWith$Query$RecoveryKey$api get copyWith => - CopyWith$Query$RecoveryKey$api(this, (i) => i); + CopyWith$Query$RecoveryKey$api( + this, + (i) => i, + ); } abstract class CopyWith$Query$RecoveryKey$api { - factory CopyWith$Query$RecoveryKey$api(Query$RecoveryKey$api instance, - TRes Function(Query$RecoveryKey$api) then) = - _CopyWithImpl$Query$RecoveryKey$api; + factory CopyWith$Query$RecoveryKey$api( + Query$RecoveryKey$api instance, + TRes Function(Query$RecoveryKey$api) then, + ) = _CopyWithImpl$Query$RecoveryKey$api; factory CopyWith$Query$RecoveryKey$api.stub(TRes res) = _CopyWithStubImpl$Query$RecoveryKey$api; - TRes call( - {Query$RecoveryKey$api$recoveryKey? recoveryKey, String? $__typename}); + TRes call({ + Query$RecoveryKey$api$recoveryKey? recoveryKey, + String? $__typename, + }); CopyWith$Query$RecoveryKey$api$recoveryKey get recoveryKey; } class _CopyWithImpl$Query$RecoveryKey$api implements CopyWith$Query$RecoveryKey$api { - _CopyWithImpl$Query$RecoveryKey$api(this._instance, this._then); + _CopyWithImpl$Query$RecoveryKey$api( + this._instance, + this._then, + ); final Query$RecoveryKey$api _instance; @@ -4768,16 +7934,18 @@ class _CopyWithImpl$Query$RecoveryKey$api static const _undefined = {}; - TRes call( - {Object? recoveryKey = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? recoveryKey = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$RecoveryKey$api( - recoveryKey: recoveryKey == _undefined || recoveryKey == null - ? _instance.recoveryKey - : (recoveryKey as Query$RecoveryKey$api$recoveryKey), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + recoveryKey: recoveryKey == _undefined || recoveryKey == null + ? _instance.recoveryKey + : (recoveryKey as Query$RecoveryKey$api$recoveryKey), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Query$RecoveryKey$api$recoveryKey get recoveryKey { final local$recoveryKey = _instance.recoveryKey; return CopyWith$Query$RecoveryKey$api$recoveryKey( @@ -4791,46 +7959,77 @@ class _CopyWithStubImpl$Query$RecoveryKey$api TRes _res; - call({Query$RecoveryKey$api$recoveryKey? recoveryKey, String? $__typename}) => + call({ + Query$RecoveryKey$api$recoveryKey? recoveryKey, + String? $__typename, + }) => _res; CopyWith$Query$RecoveryKey$api$recoveryKey get recoveryKey => CopyWith$Query$RecoveryKey$api$recoveryKey.stub(_res); } -@JsonSerializable(explicitToJson: true) class Query$RecoveryKey$api$recoveryKey { - Query$RecoveryKey$api$recoveryKey( - {this.creationDate, - required this.exists, - this.expirationDate, - this.usesLeft, - required this.valid, - required this.$__typename}); + Query$RecoveryKey$api$recoveryKey({ + this.creationDate, + required this.exists, + this.expirationDate, + this.usesLeft, + required this.valid, + required this.$__typename, + }); - @override factory Query$RecoveryKey$api$recoveryKey.fromJson( - Map json) => - _$Query$RecoveryKey$api$recoveryKeyFromJson(json); + Map json) { + final l$creationDate = json['creationDate']; + final l$exists = json['exists']; + final l$expirationDate = json['expirationDate']; + final l$usesLeft = json['usesLeft']; + final l$valid = json['valid']; + final l$$__typename = json['__typename']; + return Query$RecoveryKey$api$recoveryKey( + creationDate: + l$creationDate == null ? null : dateTimeFromJson(l$creationDate), + exists: (l$exists as bool), + expirationDate: + l$expirationDate == null ? null : dateTimeFromJson(l$expirationDate), + usesLeft: (l$usesLeft as int?), + valid: (l$valid as bool), + $__typename: (l$$__typename as String), + ); + } - @JsonKey( - fromJson: _nullable$dateTimeFromJson, toJson: _nullable$dateTimeToJson) final DateTime? creationDate; final bool exists; - @JsonKey( - fromJson: _nullable$dateTimeFromJson, toJson: _nullable$dateTimeToJson) final DateTime? expirationDate; final int? usesLeft; final bool valid; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Query$RecoveryKey$api$recoveryKeyToJson(this); + Map toJson() { + final _resultData = {}; + final l$creationDate = creationDate; + _resultData['creationDate'] = + l$creationDate == null ? null : dateTimeToJson(l$creationDate); + final l$exists = exists; + _resultData['exists'] = l$exists; + final l$expirationDate = expirationDate; + _resultData['expirationDate'] = + l$expirationDate == null ? null : dateTimeToJson(l$expirationDate); + final l$usesLeft = usesLeft; + _resultData['usesLeft'] = l$usesLeft; + final l$valid = valid; + _resultData['valid'] = l$valid; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$creationDate = creationDate; final l$exists = exists; @@ -4844,33 +8043,49 @@ class Query$RecoveryKey$api$recoveryKey { l$expirationDate, l$usesLeft, l$valid, - l$$__typename + l$$__typename, ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$RecoveryKey$api$recoveryKey) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$creationDate = creationDate; final lOther$creationDate = other.creationDate; - if (l$creationDate != lOther$creationDate) return false; + if (l$creationDate != lOther$creationDate) { + return false; + } final l$exists = exists; final lOther$exists = other.exists; - if (l$exists != lOther$exists) return false; + if (l$exists != lOther$exists) { + return false; + } final l$expirationDate = expirationDate; final lOther$expirationDate = other.expirationDate; - if (l$expirationDate != lOther$expirationDate) return false; + if (l$expirationDate != lOther$expirationDate) { + return false; + } final l$usesLeft = usesLeft; final lOther$usesLeft = other.usesLeft; - if (l$usesLeft != lOther$usesLeft) return false; + if (l$usesLeft != lOther$usesLeft) { + return false; + } final l$valid = valid; final lOther$valid = other.valid; - if (l$valid != lOther$valid) return false; + if (l$valid != lOther$valid) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -4878,31 +8093,37 @@ class Query$RecoveryKey$api$recoveryKey { extension UtilityExtension$Query$RecoveryKey$api$recoveryKey on Query$RecoveryKey$api$recoveryKey { CopyWith$Query$RecoveryKey$api$recoveryKey - get copyWith => - CopyWith$Query$RecoveryKey$api$recoveryKey(this, (i) => i); + get copyWith => CopyWith$Query$RecoveryKey$api$recoveryKey( + this, + (i) => i, + ); } abstract class CopyWith$Query$RecoveryKey$api$recoveryKey { factory CopyWith$Query$RecoveryKey$api$recoveryKey( - Query$RecoveryKey$api$recoveryKey instance, - TRes Function(Query$RecoveryKey$api$recoveryKey) then) = - _CopyWithImpl$Query$RecoveryKey$api$recoveryKey; + Query$RecoveryKey$api$recoveryKey instance, + TRes Function(Query$RecoveryKey$api$recoveryKey) then, + ) = _CopyWithImpl$Query$RecoveryKey$api$recoveryKey; factory CopyWith$Query$RecoveryKey$api$recoveryKey.stub(TRes res) = _CopyWithStubImpl$Query$RecoveryKey$api$recoveryKey; - TRes call( - {DateTime? creationDate, - bool? exists, - DateTime? expirationDate, - int? usesLeft, - bool? valid, - String? $__typename}); + TRes call({ + DateTime? creationDate, + bool? exists, + DateTime? expirationDate, + int? usesLeft, + bool? valid, + String? $__typename, + }); } class _CopyWithImpl$Query$RecoveryKey$api$recoveryKey implements CopyWith$Query$RecoveryKey$api$recoveryKey { - _CopyWithImpl$Query$RecoveryKey$api$recoveryKey(this._instance, this._then); + _CopyWithImpl$Query$RecoveryKey$api$recoveryKey( + this._instance, + this._then, + ); final Query$RecoveryKey$api$recoveryKey _instance; @@ -4910,31 +8131,33 @@ class _CopyWithImpl$Query$RecoveryKey$api$recoveryKey static const _undefined = {}; - TRes call( - {Object? creationDate = _undefined, - Object? exists = _undefined, - Object? expirationDate = _undefined, - Object? usesLeft = _undefined, - Object? valid = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? creationDate = _undefined, + Object? exists = _undefined, + Object? expirationDate = _undefined, + Object? usesLeft = _undefined, + Object? valid = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$RecoveryKey$api$recoveryKey( - creationDate: creationDate == _undefined - ? _instance.creationDate - : (creationDate as DateTime?), - exists: exists == _undefined || exists == null - ? _instance.exists - : (exists as bool), - expirationDate: expirationDate == _undefined - ? _instance.expirationDate - : (expirationDate as DateTime?), - usesLeft: - usesLeft == _undefined ? _instance.usesLeft : (usesLeft as int?), - valid: valid == _undefined || valid == null - ? _instance.valid - : (valid as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + creationDate: creationDate == _undefined + ? _instance.creationDate + : (creationDate as DateTime?), + exists: exists == _undefined || exists == null + ? _instance.exists + : (exists as bool), + expirationDate: expirationDate == _undefined + ? _instance.expirationDate + : (expirationDate as DateTime?), + usesLeft: + usesLeft == _undefined ? _instance.usesLeft : (usesLeft as int?), + valid: valid == _undefined || valid == null + ? _instance.valid + : (valid as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Query$RecoveryKey$api$recoveryKey @@ -4943,56 +8166,90 @@ class _CopyWithStubImpl$Query$RecoveryKey$api$recoveryKey TRes _res; - call( - {DateTime? creationDate, - bool? exists, - DateTime? expirationDate, - int? usesLeft, - bool? valid, - String? $__typename}) => + call({ + DateTime? creationDate, + bool? exists, + DateTime? expirationDate, + int? usesLeft, + bool? valid, + String? $__typename, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Variables$Mutation$GetNewRecoveryApiKey { - Variables$Mutation$GetNewRecoveryApiKey({this.limits}); + factory Variables$Mutation$GetNewRecoveryApiKey( + {Input$RecoveryKeyLimitsInput? limits}) => + Variables$Mutation$GetNewRecoveryApiKey._({ + if (limits != null) r'limits': limits, + }); + + Variables$Mutation$GetNewRecoveryApiKey._(this._$data); - @override factory Variables$Mutation$GetNewRecoveryApiKey.fromJson( - Map json) => - _$Variables$Mutation$GetNewRecoveryApiKeyFromJson(json); - - final Input$RecoveryKeyLimitsInput? limits; - - Map toJson() => - _$Variables$Mutation$GetNewRecoveryApiKeyToJson(this); - int get hashCode { - final l$limits = limits; - return Object.hashAll([l$limits]); + Map data) { + final result$data = {}; + if (data.containsKey('limits')) { + final l$limits = data['limits']; + result$data['limits'] = l$limits == null + ? null + : Input$RecoveryKeyLimitsInput.fromJson( + (l$limits as Map)); + } + return Variables$Mutation$GetNewRecoveryApiKey._(result$data); } - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Variables$Mutation$GetNewRecoveryApiKey) || - runtimeType != other.runtimeType) return false; - final l$limits = limits; - final lOther$limits = other.limits; - if (l$limits != lOther$limits) return false; - return true; + Map _$data; + + Input$RecoveryKeyLimitsInput? get limits => + (_$data['limits'] as Input$RecoveryKeyLimitsInput?); + Map toJson() { + final result$data = {}; + if (_$data.containsKey('limits')) { + final l$limits = limits; + result$data['limits'] = l$limits?.toJson(); + } + return result$data; } CopyWith$Variables$Mutation$GetNewRecoveryApiKey< Variables$Mutation$GetNewRecoveryApiKey> - get copyWith => - CopyWith$Variables$Mutation$GetNewRecoveryApiKey(this, (i) => i); + get copyWith => CopyWith$Variables$Mutation$GetNewRecoveryApiKey( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$GetNewRecoveryApiKey) || + runtimeType != other.runtimeType) { + return false; + } + final l$limits = limits; + final lOther$limits = other.limits; + if (_$data.containsKey('limits') != other._$data.containsKey('limits')) { + return false; + } + if (l$limits != lOther$limits) { + return false; + } + return true; + } + + @override + int get hashCode { + final l$limits = limits; + return Object.hashAll([_$data.containsKey('limits') ? l$limits : const {}]); + } } abstract class CopyWith$Variables$Mutation$GetNewRecoveryApiKey { factory CopyWith$Variables$Mutation$GetNewRecoveryApiKey( - Variables$Mutation$GetNewRecoveryApiKey instance, - TRes Function(Variables$Mutation$GetNewRecoveryApiKey) then) = - _CopyWithImpl$Variables$Mutation$GetNewRecoveryApiKey; + Variables$Mutation$GetNewRecoveryApiKey instance, + TRes Function(Variables$Mutation$GetNewRecoveryApiKey) then, + ) = _CopyWithImpl$Variables$Mutation$GetNewRecoveryApiKey; factory CopyWith$Variables$Mutation$GetNewRecoveryApiKey.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$GetNewRecoveryApiKey; @@ -5003,7 +8260,9 @@ abstract class CopyWith$Variables$Mutation$GetNewRecoveryApiKey { class _CopyWithImpl$Variables$Mutation$GetNewRecoveryApiKey implements CopyWith$Variables$Mutation$GetNewRecoveryApiKey { _CopyWithImpl$Variables$Mutation$GetNewRecoveryApiKey( - this._instance, this._then); + this._instance, + this._then, + ); final Variables$Mutation$GetNewRecoveryApiKey _instance; @@ -5012,10 +8271,11 @@ class _CopyWithImpl$Variables$Mutation$GetNewRecoveryApiKey static const _undefined = {}; TRes call({Object? limits = _undefined}) => - _then(Variables$Mutation$GetNewRecoveryApiKey( - limits: limits == _undefined - ? _instance.limits - : (limits as Input$RecoveryKeyLimitsInput?))); + _then(Variables$Mutation$GetNewRecoveryApiKey._({ + ..._instance._$data, + if (limits != _undefined) + 'limits': (limits as Input$RecoveryKeyLimitsInput?), + })); } class _CopyWithStubImpl$Variables$Mutation$GetNewRecoveryApiKey @@ -5027,38 +8287,65 @@ class _CopyWithStubImpl$Variables$Mutation$GetNewRecoveryApiKey call({Input$RecoveryKeyLimitsInput? limits}) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$GetNewRecoveryApiKey { - Mutation$GetNewRecoveryApiKey( - {required this.getNewRecoveryApiKey, required this.$__typename}); + Mutation$GetNewRecoveryApiKey({ + required this.getNewRecoveryApiKey, + required this.$__typename, + }); - @override - factory Mutation$GetNewRecoveryApiKey.fromJson(Map json) => - _$Mutation$GetNewRecoveryApiKeyFromJson(json); + factory Mutation$GetNewRecoveryApiKey.fromJson(Map json) { + final l$getNewRecoveryApiKey = json['getNewRecoveryApiKey']; + final l$$__typename = json['__typename']; + return Mutation$GetNewRecoveryApiKey( + getNewRecoveryApiKey: + Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey.fromJson( + (l$getNewRecoveryApiKey as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey getNewRecoveryApiKey; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$GetNewRecoveryApiKeyToJson(this); + Map toJson() { + final _resultData = {}; + final l$getNewRecoveryApiKey = getNewRecoveryApiKey; + _resultData['getNewRecoveryApiKey'] = l$getNewRecoveryApiKey.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$getNewRecoveryApiKey = getNewRecoveryApiKey; final l$$__typename = $__typename; - return Object.hashAll([l$getNewRecoveryApiKey, l$$__typename]); + return Object.hashAll([ + l$getNewRecoveryApiKey, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$GetNewRecoveryApiKey) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$getNewRecoveryApiKey = getNewRecoveryApiKey; final lOther$getNewRecoveryApiKey = other.getNewRecoveryApiKey; - if (l$getNewRecoveryApiKey != lOther$getNewRecoveryApiKey) return false; + if (l$getNewRecoveryApiKey != lOther$getNewRecoveryApiKey) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -5066,28 +8353,35 @@ class Mutation$GetNewRecoveryApiKey { extension UtilityExtension$Mutation$GetNewRecoveryApiKey on Mutation$GetNewRecoveryApiKey { CopyWith$Mutation$GetNewRecoveryApiKey - get copyWith => CopyWith$Mutation$GetNewRecoveryApiKey(this, (i) => i); + get copyWith => CopyWith$Mutation$GetNewRecoveryApiKey( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$GetNewRecoveryApiKey { factory CopyWith$Mutation$GetNewRecoveryApiKey( - Mutation$GetNewRecoveryApiKey instance, - TRes Function(Mutation$GetNewRecoveryApiKey) then) = - _CopyWithImpl$Mutation$GetNewRecoveryApiKey; + Mutation$GetNewRecoveryApiKey instance, + TRes Function(Mutation$GetNewRecoveryApiKey) then, + ) = _CopyWithImpl$Mutation$GetNewRecoveryApiKey; factory CopyWith$Mutation$GetNewRecoveryApiKey.stub(TRes res) = _CopyWithStubImpl$Mutation$GetNewRecoveryApiKey; - TRes call( - {Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey? getNewRecoveryApiKey, - String? $__typename}); + TRes call({ + Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey? getNewRecoveryApiKey, + String? $__typename, + }); CopyWith$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey get getNewRecoveryApiKey; } class _CopyWithImpl$Mutation$GetNewRecoveryApiKey implements CopyWith$Mutation$GetNewRecoveryApiKey { - _CopyWithImpl$Mutation$GetNewRecoveryApiKey(this._instance, this._then); + _CopyWithImpl$Mutation$GetNewRecoveryApiKey( + this._instance, + this._then, + ); final Mutation$GetNewRecoveryApiKey _instance; @@ -5095,18 +8389,20 @@ class _CopyWithImpl$Mutation$GetNewRecoveryApiKey static const _undefined = {}; - TRes call( - {Object? getNewRecoveryApiKey = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? getNewRecoveryApiKey = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$GetNewRecoveryApiKey( - getNewRecoveryApiKey: - getNewRecoveryApiKey == _undefined || getNewRecoveryApiKey == null - ? _instance.getNewRecoveryApiKey - : (getNewRecoveryApiKey - as Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + getNewRecoveryApiKey: + getNewRecoveryApiKey == _undefined || getNewRecoveryApiKey == null + ? _instance.getNewRecoveryApiKey + : (getNewRecoveryApiKey + as Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey get getNewRecoveryApiKey { final local$getNewRecoveryApiKey = _instance.getNewRecoveryApiKey; @@ -5121,10 +8417,10 @@ class _CopyWithStubImpl$Mutation$GetNewRecoveryApiKey TRes _res; - call( - {Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey? - getNewRecoveryApiKey, - String? $__typename}) => + call({ + Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey? getNewRecoveryApiKey, + String? $__typename, + }) => _res; CopyWith$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey get getNewRecoveryApiKey => @@ -5134,93 +8430,107 @@ class _CopyWithStubImpl$Mutation$GetNewRecoveryApiKey const documentNodeMutationGetNewRecoveryApiKey = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'GetNewRecoveryApiKey'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'limits')), - type: NamedTypeNode( - name: NameNode(value: 'RecoveryKeyLimitsInput'), - isNonNull: false), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'getNewRecoveryApiKey'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'limits'), - value: VariableNode(name: NameNode(value: 'limits'))) - ], + type: OperationType.mutation, + name: NameNode(value: 'GetNewRecoveryApiKey'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'limits')), + type: NamedTypeNode( + name: NameNode(value: 'RecoveryKeyLimitsInput'), + isNonNull: false, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'getNewRecoveryApiKey'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'limits'), + value: VariableNode(name: NameNode(value: 'limits')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: 'key'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + ), + FieldNode( + name: NameNode(value: 'key'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$GetNewRecoveryApiKey _parserFn$Mutation$GetNewRecoveryApiKey( Map data) => Mutation$GetNewRecoveryApiKey.fromJson(data); typedef OnMutationCompleted$Mutation$GetNewRecoveryApiKey = FutureOr - Function(dynamic, Mutation$GetNewRecoveryApiKey?); + Function( + dynamic, + Mutation$GetNewRecoveryApiKey?, +); class Options$Mutation$GetNewRecoveryApiKey extends graphql.MutationOptions { - Options$Mutation$GetNewRecoveryApiKey( - {String? operationName, - Variables$Mutation$GetNewRecoveryApiKey? variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$GetNewRecoveryApiKey? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$GetNewRecoveryApiKey({ + String? operationName, + Variables$Mutation$GetNewRecoveryApiKey? variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$GetNewRecoveryApiKey? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - variables: variables?.toJson() ?? {}, - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted( + variables: variables?.toJson() ?? {}, + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( data, data == null ? null - : _parserFn$Mutation$GetNewRecoveryApiKey(data)), - update: update, - onError: onError, - document: documentNodeMutationGetNewRecoveryApiKey, - parserFn: _parserFn$Mutation$GetNewRecoveryApiKey); + : _parserFn$Mutation$GetNewRecoveryApiKey(data), + ), + update: update, + onError: onError, + document: documentNodeMutationGetNewRecoveryApiKey, + parserFn: _parserFn$Mutation$GetNewRecoveryApiKey, + ); final OnMutationCompleted$Mutation$GetNewRecoveryApiKey? onCompletedWithParsed; @@ -5230,38 +8540,39 @@ class Options$Mutation$GetNewRecoveryApiKey ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$GetNewRecoveryApiKey extends graphql.WatchQueryOptions { - WatchOptions$Mutation$GetNewRecoveryApiKey( - {String? operationName, - Variables$Mutation$GetNewRecoveryApiKey? variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - variables: variables?.toJson() ?? {}, - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationGetNewRecoveryApiKey, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$GetNewRecoveryApiKey); + WatchOptions$Mutation$GetNewRecoveryApiKey({ + String? operationName, + Variables$Mutation$GetNewRecoveryApiKey? variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables?.toJson() ?? {}, + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationGetNewRecoveryApiKey, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$GetNewRecoveryApiKey, + ); } extension ClientExtension$Mutation$GetNewRecoveryApiKey @@ -5277,20 +8588,31 @@ extension ClientExtension$Mutation$GetNewRecoveryApiKey options ?? WatchOptions$Mutation$GetNewRecoveryApiKey()); } -@JsonSerializable(explicitToJson: true) class Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey - implements Fragment$basicMutationReturnFields { - Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey( - {required this.code, - required this.message, - required this.success, - required this.$__typename, - this.key}); + implements Fragment$basicMutationReturnFields$$ApiKeyMutationReturn { + Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + this.key, + }); - @override factory Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey.fromJson( - Map json) => - _$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKeyFromJson(json); + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + final l$key = json['key']; + return Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + key: (l$key as String?), + ); + } final int code; @@ -5298,42 +8620,75 @@ class Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey final bool success; - @JsonKey(name: '__typename') final String $__typename; final String? key; - Map toJson() => - _$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKeyToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + final l$key = key; + _resultData['key'] = l$key; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; final l$key = key; - return Object.hashAll([l$code, l$message, l$success, l$$__typename, l$key]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + l$key, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } final l$key = key; final lOther$key = other.key; - if (l$key != lOther$key) return false; + if (l$key != lOther$key) { + return false; + } return true; } } @@ -5344,34 +8699,38 @@ extension UtilityExtension$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey> get copyWith => CopyWith$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey( - this, (i) => i); + this, + (i) => i, + ); } abstract class CopyWith$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey< TRes> { factory CopyWith$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey( - Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey instance, - TRes Function(Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey) - then) = - _CopyWithImpl$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey; + Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey instance, + TRes Function(Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey) then, + ) = _CopyWithImpl$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey; factory CopyWith$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey.stub( TRes res) = _CopyWithStubImpl$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey; - TRes call( - {int? code, - String? message, - bool? success, - String? $__typename, - String? key}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + String? key, + }); } class _CopyWithImpl$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey implements CopyWith$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey { _CopyWithImpl$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey( - this._instance, this._then); + this._instance, + this._then, + ); final Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey _instance; @@ -5379,26 +8738,27 @@ class _CopyWithImpl$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined, - Object? key = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + Object? key = _undefined, + }) => _then(Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String), - key: key == _undefined ? _instance.key : (key as String?))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + key: key == _undefined ? _instance.key : (key as String?), + )); } class _CopyWithStubImpl$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey @@ -5409,55 +8769,80 @@ class _CopyWithStubImpl$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey TRes _res; - call( - {int? code, - String? message, - bool? success, - String? $__typename, - String? key}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + String? key, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Variables$Mutation$UseRecoveryApiKey { - Variables$Mutation$UseRecoveryApiKey({required this.input}); + factory Variables$Mutation$UseRecoveryApiKey( + {required Input$UseRecoveryKeyInput input}) => + Variables$Mutation$UseRecoveryApiKey._({ + r'input': input, + }); + + Variables$Mutation$UseRecoveryApiKey._(this._$data); - @override factory Variables$Mutation$UseRecoveryApiKey.fromJson( - Map json) => - _$Variables$Mutation$UseRecoveryApiKeyFromJson(json); - - final Input$UseRecoveryKeyInput input; - - Map toJson() => - _$Variables$Mutation$UseRecoveryApiKeyToJson(this); - int get hashCode { - final l$input = input; - return Object.hashAll([l$input]); + Map data) { + final result$data = {}; + final l$input = data['input']; + result$data['input'] = + Input$UseRecoveryKeyInput.fromJson((l$input as Map)); + return Variables$Mutation$UseRecoveryApiKey._(result$data); } - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Variables$Mutation$UseRecoveryApiKey) || - runtimeType != other.runtimeType) return false; + Map _$data; + + Input$UseRecoveryKeyInput get input => + (_$data['input'] as Input$UseRecoveryKeyInput); + Map toJson() { + final result$data = {}; final l$input = input; - final lOther$input = other.input; - if (l$input != lOther$input) return false; - return true; + result$data['input'] = l$input.toJson(); + return result$data; } CopyWith$Variables$Mutation$UseRecoveryApiKey< Variables$Mutation$UseRecoveryApiKey> - get copyWith => - CopyWith$Variables$Mutation$UseRecoveryApiKey(this, (i) => i); + get copyWith => CopyWith$Variables$Mutation$UseRecoveryApiKey( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$UseRecoveryApiKey) || + runtimeType != other.runtimeType) { + return false; + } + final l$input = input; + final lOther$input = other.input; + if (l$input != lOther$input) { + return false; + } + return true; + } + + @override + int get hashCode { + final l$input = input; + return Object.hashAll([l$input]); + } } abstract class CopyWith$Variables$Mutation$UseRecoveryApiKey { factory CopyWith$Variables$Mutation$UseRecoveryApiKey( - Variables$Mutation$UseRecoveryApiKey instance, - TRes Function(Variables$Mutation$UseRecoveryApiKey) then) = - _CopyWithImpl$Variables$Mutation$UseRecoveryApiKey; + Variables$Mutation$UseRecoveryApiKey instance, + TRes Function(Variables$Mutation$UseRecoveryApiKey) then, + ) = _CopyWithImpl$Variables$Mutation$UseRecoveryApiKey; factory CopyWith$Variables$Mutation$UseRecoveryApiKey.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$UseRecoveryApiKey; @@ -5468,7 +8853,9 @@ abstract class CopyWith$Variables$Mutation$UseRecoveryApiKey { class _CopyWithImpl$Variables$Mutation$UseRecoveryApiKey implements CopyWith$Variables$Mutation$UseRecoveryApiKey { _CopyWithImpl$Variables$Mutation$UseRecoveryApiKey( - this._instance, this._then); + this._instance, + this._then, + ); final Variables$Mutation$UseRecoveryApiKey _instance; @@ -5477,10 +8864,11 @@ class _CopyWithImpl$Variables$Mutation$UseRecoveryApiKey static const _undefined = {}; TRes call({Object? input = _undefined}) => - _then(Variables$Mutation$UseRecoveryApiKey( - input: input == _undefined || input == null - ? _instance.input - : (input as Input$UseRecoveryKeyInput))); + _then(Variables$Mutation$UseRecoveryApiKey._({ + ..._instance._$data, + if (input != _undefined && input != null) + 'input': (input as Input$UseRecoveryKeyInput), + })); } class _CopyWithStubImpl$Variables$Mutation$UseRecoveryApiKey @@ -5492,38 +8880,64 @@ class _CopyWithStubImpl$Variables$Mutation$UseRecoveryApiKey call({Input$UseRecoveryKeyInput? input}) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$UseRecoveryApiKey { - Mutation$UseRecoveryApiKey( - {required this.useRecoveryApiKey, required this.$__typename}); + Mutation$UseRecoveryApiKey({ + required this.useRecoveryApiKey, + required this.$__typename, + }); - @override - factory Mutation$UseRecoveryApiKey.fromJson(Map json) => - _$Mutation$UseRecoveryApiKeyFromJson(json); + factory Mutation$UseRecoveryApiKey.fromJson(Map json) { + final l$useRecoveryApiKey = json['useRecoveryApiKey']; + final l$$__typename = json['__typename']; + return Mutation$UseRecoveryApiKey( + useRecoveryApiKey: Mutation$UseRecoveryApiKey$useRecoveryApiKey.fromJson( + (l$useRecoveryApiKey as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$UseRecoveryApiKey$useRecoveryApiKey useRecoveryApiKey; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$UseRecoveryApiKeyToJson(this); + Map toJson() { + final _resultData = {}; + final l$useRecoveryApiKey = useRecoveryApiKey; + _resultData['useRecoveryApiKey'] = l$useRecoveryApiKey.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$useRecoveryApiKey = useRecoveryApiKey; final l$$__typename = $__typename; - return Object.hashAll([l$useRecoveryApiKey, l$$__typename]); + return Object.hashAll([ + l$useRecoveryApiKey, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$UseRecoveryApiKey) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$useRecoveryApiKey = useRecoveryApiKey; final lOther$useRecoveryApiKey = other.useRecoveryApiKey; - if (l$useRecoveryApiKey != lOther$useRecoveryApiKey) return false; + if (l$useRecoveryApiKey != lOther$useRecoveryApiKey) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -5531,28 +8945,35 @@ class Mutation$UseRecoveryApiKey { extension UtilityExtension$Mutation$UseRecoveryApiKey on Mutation$UseRecoveryApiKey { CopyWith$Mutation$UseRecoveryApiKey - get copyWith => CopyWith$Mutation$UseRecoveryApiKey(this, (i) => i); + get copyWith => CopyWith$Mutation$UseRecoveryApiKey( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$UseRecoveryApiKey { factory CopyWith$Mutation$UseRecoveryApiKey( - Mutation$UseRecoveryApiKey instance, - TRes Function(Mutation$UseRecoveryApiKey) then) = - _CopyWithImpl$Mutation$UseRecoveryApiKey; + Mutation$UseRecoveryApiKey instance, + TRes Function(Mutation$UseRecoveryApiKey) then, + ) = _CopyWithImpl$Mutation$UseRecoveryApiKey; factory CopyWith$Mutation$UseRecoveryApiKey.stub(TRes res) = _CopyWithStubImpl$Mutation$UseRecoveryApiKey; - TRes call( - {Mutation$UseRecoveryApiKey$useRecoveryApiKey? useRecoveryApiKey, - String? $__typename}); + TRes call({ + Mutation$UseRecoveryApiKey$useRecoveryApiKey? useRecoveryApiKey, + String? $__typename, + }); CopyWith$Mutation$UseRecoveryApiKey$useRecoveryApiKey get useRecoveryApiKey; } class _CopyWithImpl$Mutation$UseRecoveryApiKey implements CopyWith$Mutation$UseRecoveryApiKey { - _CopyWithImpl$Mutation$UseRecoveryApiKey(this._instance, this._then); + _CopyWithImpl$Mutation$UseRecoveryApiKey( + this._instance, + this._then, + ); final Mutation$UseRecoveryApiKey _instance; @@ -5560,18 +8981,20 @@ class _CopyWithImpl$Mutation$UseRecoveryApiKey static const _undefined = {}; - TRes call( - {Object? useRecoveryApiKey = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? useRecoveryApiKey = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$UseRecoveryApiKey( - useRecoveryApiKey: - useRecoveryApiKey == _undefined || useRecoveryApiKey == null - ? _instance.useRecoveryApiKey - : (useRecoveryApiKey - as Mutation$UseRecoveryApiKey$useRecoveryApiKey), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + useRecoveryApiKey: + useRecoveryApiKey == _undefined || useRecoveryApiKey == null + ? _instance.useRecoveryApiKey + : (useRecoveryApiKey + as Mutation$UseRecoveryApiKey$useRecoveryApiKey), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$UseRecoveryApiKey$useRecoveryApiKey get useRecoveryApiKey { final local$useRecoveryApiKey = _instance.useRecoveryApiKey; @@ -5586,9 +9009,10 @@ class _CopyWithStubImpl$Mutation$UseRecoveryApiKey TRes _res; - call( - {Mutation$UseRecoveryApiKey$useRecoveryApiKey? useRecoveryApiKey, - String? $__typename}) => + call({ + Mutation$UseRecoveryApiKey$useRecoveryApiKey? useRecoveryApiKey, + String? $__typename, + }) => _res; CopyWith$Mutation$UseRecoveryApiKey$useRecoveryApiKey get useRecoveryApiKey => @@ -5597,92 +9021,107 @@ class _CopyWithStubImpl$Mutation$UseRecoveryApiKey const documentNodeMutationUseRecoveryApiKey = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'UseRecoveryApiKey'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'input')), - type: NamedTypeNode( - name: NameNode(value: 'UseRecoveryKeyInput'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'useRecoveryApiKey'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'input'), - value: VariableNode(name: NameNode(value: 'input'))) - ], + type: OperationType.mutation, + name: NameNode(value: 'UseRecoveryApiKey'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'input')), + type: NamedTypeNode( + name: NameNode(value: 'UseRecoveryKeyInput'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'useRecoveryApiKey'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'input'), + value: VariableNode(name: NameNode(value: 'input')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: 'token'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + ), + FieldNode( + name: NameNode(value: 'token'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$UseRecoveryApiKey _parserFn$Mutation$UseRecoveryApiKey( Map data) => Mutation$UseRecoveryApiKey.fromJson(data); typedef OnMutationCompleted$Mutation$UseRecoveryApiKey = FutureOr - Function(dynamic, Mutation$UseRecoveryApiKey?); + Function( + dynamic, + Mutation$UseRecoveryApiKey?, +); class Options$Mutation$UseRecoveryApiKey extends graphql.MutationOptions { - Options$Mutation$UseRecoveryApiKey( - {String? operationName, - required Variables$Mutation$UseRecoveryApiKey variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$UseRecoveryApiKey? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$UseRecoveryApiKey({ + String? operationName, + required Variables$Mutation$UseRecoveryApiKey variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$UseRecoveryApiKey? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( data, data == null ? null - : _parserFn$Mutation$UseRecoveryApiKey(data)), - update: update, - onError: onError, - document: documentNodeMutationUseRecoveryApiKey, - parserFn: _parserFn$Mutation$UseRecoveryApiKey); + : _parserFn$Mutation$UseRecoveryApiKey(data), + ), + update: update, + onError: onError, + document: documentNodeMutationUseRecoveryApiKey, + parserFn: _parserFn$Mutation$UseRecoveryApiKey, + ); final OnMutationCompleted$Mutation$UseRecoveryApiKey? onCompletedWithParsed; @@ -5691,38 +9130,39 @@ class Options$Mutation$UseRecoveryApiKey ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$UseRecoveryApiKey extends graphql.WatchQueryOptions { - WatchOptions$Mutation$UseRecoveryApiKey( - {String? operationName, - required Variables$Mutation$UseRecoveryApiKey variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationUseRecoveryApiKey, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$UseRecoveryApiKey); + WatchOptions$Mutation$UseRecoveryApiKey({ + String? operationName, + required Variables$Mutation$UseRecoveryApiKey variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationUseRecoveryApiKey, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$UseRecoveryApiKey, + ); } extension ClientExtension$Mutation$UseRecoveryApiKey on graphql.GraphQLClient { @@ -5736,20 +9176,32 @@ extension ClientExtension$Mutation$UseRecoveryApiKey on graphql.GraphQLClient { this.watchMutation(options); } -@JsonSerializable(explicitToJson: true) class Mutation$UseRecoveryApiKey$useRecoveryApiKey - implements Fragment$basicMutationReturnFields { - Mutation$UseRecoveryApiKey$useRecoveryApiKey( - {required this.code, - required this.message, - required this.success, - required this.$__typename, - this.token}); + implements + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn { + Mutation$UseRecoveryApiKey$useRecoveryApiKey({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + this.token, + }); - @override factory Mutation$UseRecoveryApiKey$useRecoveryApiKey.fromJson( - Map json) => - _$Mutation$UseRecoveryApiKey$useRecoveryApiKeyFromJson(json); + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + final l$token = json['token']; + return Mutation$UseRecoveryApiKey$useRecoveryApiKey( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + token: (l$token as String?), + ); + } final int code; @@ -5757,43 +9209,75 @@ class Mutation$UseRecoveryApiKey$useRecoveryApiKey final bool success; - @JsonKey(name: '__typename') final String $__typename; final String? token; - Map toJson() => - _$Mutation$UseRecoveryApiKey$useRecoveryApiKeyToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + final l$token = token; + _resultData['token'] = l$token; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; final l$token = token; - return Object.hashAll( - [l$code, l$message, l$success, l$$__typename, l$token]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + l$token, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$UseRecoveryApiKey$useRecoveryApiKey) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } final l$token = token; final lOther$token = other.token; - if (l$token != lOther$token) return false; + if (l$token != lOther$token) { + return false; + } return true; } } @@ -5802,31 +9286,36 @@ extension UtilityExtension$Mutation$UseRecoveryApiKey$useRecoveryApiKey on Mutation$UseRecoveryApiKey$useRecoveryApiKey { CopyWith$Mutation$UseRecoveryApiKey$useRecoveryApiKey< Mutation$UseRecoveryApiKey$useRecoveryApiKey> - get copyWith => - CopyWith$Mutation$UseRecoveryApiKey$useRecoveryApiKey(this, (i) => i); + get copyWith => CopyWith$Mutation$UseRecoveryApiKey$useRecoveryApiKey( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$UseRecoveryApiKey$useRecoveryApiKey { factory CopyWith$Mutation$UseRecoveryApiKey$useRecoveryApiKey( - Mutation$UseRecoveryApiKey$useRecoveryApiKey instance, - TRes Function(Mutation$UseRecoveryApiKey$useRecoveryApiKey) then) = - _CopyWithImpl$Mutation$UseRecoveryApiKey$useRecoveryApiKey; + Mutation$UseRecoveryApiKey$useRecoveryApiKey instance, + TRes Function(Mutation$UseRecoveryApiKey$useRecoveryApiKey) then, + ) = _CopyWithImpl$Mutation$UseRecoveryApiKey$useRecoveryApiKey; factory CopyWith$Mutation$UseRecoveryApiKey$useRecoveryApiKey.stub(TRes res) = _CopyWithStubImpl$Mutation$UseRecoveryApiKey$useRecoveryApiKey; - TRes call( - {int? code, - String? message, - bool? success, - String? $__typename, - String? token}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + String? token, + }); } class _CopyWithImpl$Mutation$UseRecoveryApiKey$useRecoveryApiKey implements CopyWith$Mutation$UseRecoveryApiKey$useRecoveryApiKey { _CopyWithImpl$Mutation$UseRecoveryApiKey$useRecoveryApiKey( - this._instance, this._then); + this._instance, + this._then, + ); final Mutation$UseRecoveryApiKey$useRecoveryApiKey _instance; @@ -5834,26 +9323,27 @@ class _CopyWithImpl$Mutation$UseRecoveryApiKey$useRecoveryApiKey static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined, - Object? token = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + Object? token = _undefined, + }) => _then(Mutation$UseRecoveryApiKey$useRecoveryApiKey( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String), - token: token == _undefined ? _instance.token : (token as String?))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + token: token == _undefined ? _instance.token : (token as String?), + )); } class _CopyWithStubImpl$Mutation$UseRecoveryApiKey$useRecoveryApiKey @@ -5862,48 +9352,76 @@ class _CopyWithStubImpl$Mutation$UseRecoveryApiKey$useRecoveryApiKey TRes _res; - call( - {int? code, - String? message, - bool? success, - String? $__typename, - String? token}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + String? token, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$RefreshDeviceApiToken { - Mutation$RefreshDeviceApiToken( - {required this.refreshDeviceApiToken, required this.$__typename}); + Mutation$RefreshDeviceApiToken({ + required this.refreshDeviceApiToken, + required this.$__typename, + }); - @override - factory Mutation$RefreshDeviceApiToken.fromJson(Map json) => - _$Mutation$RefreshDeviceApiTokenFromJson(json); + factory Mutation$RefreshDeviceApiToken.fromJson(Map json) { + final l$refreshDeviceApiToken = json['refreshDeviceApiToken']; + final l$$__typename = json['__typename']; + return Mutation$RefreshDeviceApiToken( + refreshDeviceApiToken: + Mutation$RefreshDeviceApiToken$refreshDeviceApiToken.fromJson( + (l$refreshDeviceApiToken as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$RefreshDeviceApiToken$refreshDeviceApiToken refreshDeviceApiToken; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$RefreshDeviceApiTokenToJson(this); + Map toJson() { + final _resultData = {}; + final l$refreshDeviceApiToken = refreshDeviceApiToken; + _resultData['refreshDeviceApiToken'] = l$refreshDeviceApiToken.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$refreshDeviceApiToken = refreshDeviceApiToken; final l$$__typename = $__typename; - return Object.hashAll([l$refreshDeviceApiToken, l$$__typename]); + return Object.hashAll([ + l$refreshDeviceApiToken, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$RefreshDeviceApiToken) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$refreshDeviceApiToken = refreshDeviceApiToken; final lOther$refreshDeviceApiToken = other.refreshDeviceApiToken; - if (l$refreshDeviceApiToken != lOther$refreshDeviceApiToken) return false; + if (l$refreshDeviceApiToken != lOther$refreshDeviceApiToken) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -5911,29 +9429,35 @@ class Mutation$RefreshDeviceApiToken { extension UtilityExtension$Mutation$RefreshDeviceApiToken on Mutation$RefreshDeviceApiToken { CopyWith$Mutation$RefreshDeviceApiToken - get copyWith => CopyWith$Mutation$RefreshDeviceApiToken(this, (i) => i); + get copyWith => CopyWith$Mutation$RefreshDeviceApiToken( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$RefreshDeviceApiToken { factory CopyWith$Mutation$RefreshDeviceApiToken( - Mutation$RefreshDeviceApiToken instance, - TRes Function(Mutation$RefreshDeviceApiToken) then) = - _CopyWithImpl$Mutation$RefreshDeviceApiToken; + Mutation$RefreshDeviceApiToken instance, + TRes Function(Mutation$RefreshDeviceApiToken) then, + ) = _CopyWithImpl$Mutation$RefreshDeviceApiToken; factory CopyWith$Mutation$RefreshDeviceApiToken.stub(TRes res) = _CopyWithStubImpl$Mutation$RefreshDeviceApiToken; - TRes call( - {Mutation$RefreshDeviceApiToken$refreshDeviceApiToken? - refreshDeviceApiToken, - String? $__typename}); + TRes call({ + Mutation$RefreshDeviceApiToken$refreshDeviceApiToken? refreshDeviceApiToken, + String? $__typename, + }); CopyWith$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken get refreshDeviceApiToken; } class _CopyWithImpl$Mutation$RefreshDeviceApiToken implements CopyWith$Mutation$RefreshDeviceApiToken { - _CopyWithImpl$Mutation$RefreshDeviceApiToken(this._instance, this._then); + _CopyWithImpl$Mutation$RefreshDeviceApiToken( + this._instance, + this._then, + ); final Mutation$RefreshDeviceApiToken _instance; @@ -5941,18 +9465,20 @@ class _CopyWithImpl$Mutation$RefreshDeviceApiToken static const _undefined = {}; - TRes call( - {Object? refreshDeviceApiToken = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? refreshDeviceApiToken = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$RefreshDeviceApiToken( - refreshDeviceApiToken: refreshDeviceApiToken == _undefined || - refreshDeviceApiToken == null - ? _instance.refreshDeviceApiToken - : (refreshDeviceApiToken - as Mutation$RefreshDeviceApiToken$refreshDeviceApiToken), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + refreshDeviceApiToken: + refreshDeviceApiToken == _undefined || refreshDeviceApiToken == null + ? _instance.refreshDeviceApiToken + : (refreshDeviceApiToken + as Mutation$RefreshDeviceApiToken$refreshDeviceApiToken), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken get refreshDeviceApiToken { final local$refreshDeviceApiToken = _instance.refreshDeviceApiToken; @@ -5967,10 +9493,10 @@ class _CopyWithStubImpl$Mutation$RefreshDeviceApiToken TRes _res; - call( - {Mutation$RefreshDeviceApiToken$refreshDeviceApiToken? - refreshDeviceApiToken, - String? $__typename}) => + call({ + Mutation$RefreshDeviceApiToken$refreshDeviceApiToken? refreshDeviceApiToken, + String? $__typename, + }) => _res; CopyWith$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken get refreshDeviceApiToken => @@ -5980,79 +9506,90 @@ class _CopyWithStubImpl$Mutation$RefreshDeviceApiToken const documentNodeMutationRefreshDeviceApiToken = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'RefreshDeviceApiToken'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'refreshDeviceApiToken'), + type: OperationType.mutation, + name: NameNode(value: 'RefreshDeviceApiToken'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'refreshDeviceApiToken'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: [], + ), + FieldNode( + name: NameNode(value: 'token'), alias: null, arguments: [], directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: 'token'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + selectionSet: null, + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$RefreshDeviceApiToken _parserFn$Mutation$RefreshDeviceApiToken( Map data) => Mutation$RefreshDeviceApiToken.fromJson(data); typedef OnMutationCompleted$Mutation$RefreshDeviceApiToken = FutureOr - Function(dynamic, Mutation$RefreshDeviceApiToken?); + Function( + dynamic, + Mutation$RefreshDeviceApiToken?, +); class Options$Mutation$RefreshDeviceApiToken extends graphql.MutationOptions { - Options$Mutation$RefreshDeviceApiToken( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$RefreshDeviceApiToken? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$RefreshDeviceApiToken({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$RefreshDeviceApiToken? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( data, data == null ? null - : _parserFn$Mutation$RefreshDeviceApiToken(data)), - update: update, - onError: onError, - document: documentNodeMutationRefreshDeviceApiToken, - parserFn: _parserFn$Mutation$RefreshDeviceApiToken); + : _parserFn$Mutation$RefreshDeviceApiToken(data), + ), + update: update, + onError: onError, + document: documentNodeMutationRefreshDeviceApiToken, + parserFn: _parserFn$Mutation$RefreshDeviceApiToken, + ); final OnMutationCompleted$Mutation$RefreshDeviceApiToken? onCompletedWithParsed; @@ -6062,36 +9599,37 @@ class Options$Mutation$RefreshDeviceApiToken ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$RefreshDeviceApiToken extends graphql.WatchQueryOptions { - WatchOptions$Mutation$RefreshDeviceApiToken( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationRefreshDeviceApiToken, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$RefreshDeviceApiToken); + WatchOptions$Mutation$RefreshDeviceApiToken({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationRefreshDeviceApiToken, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$RefreshDeviceApiToken, + ); } extension ClientExtension$Mutation$RefreshDeviceApiToken @@ -6108,20 +9646,32 @@ extension ClientExtension$Mutation$RefreshDeviceApiToken options ?? WatchOptions$Mutation$RefreshDeviceApiToken()); } -@JsonSerializable(explicitToJson: true) class Mutation$RefreshDeviceApiToken$refreshDeviceApiToken - implements Fragment$basicMutationReturnFields { - Mutation$RefreshDeviceApiToken$refreshDeviceApiToken( - {required this.code, - required this.message, - required this.success, - required this.$__typename, - this.token}); + implements + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn { + Mutation$RefreshDeviceApiToken$refreshDeviceApiToken({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + this.token, + }); - @override factory Mutation$RefreshDeviceApiToken$refreshDeviceApiToken.fromJson( - Map json) => - _$Mutation$RefreshDeviceApiToken$refreshDeviceApiTokenFromJson(json); + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + final l$token = json['token']; + return Mutation$RefreshDeviceApiToken$refreshDeviceApiToken( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + token: (l$token as String?), + ); + } final int code; @@ -6129,43 +9679,75 @@ class Mutation$RefreshDeviceApiToken$refreshDeviceApiToken final bool success; - @JsonKey(name: '__typename') final String $__typename; final String? token; - Map toJson() => - _$Mutation$RefreshDeviceApiToken$refreshDeviceApiTokenToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + final l$token = token; + _resultData['token'] = l$token; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; final l$token = token; - return Object.hashAll( - [l$code, l$message, l$success, l$$__typename, l$token]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + l$token, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$RefreshDeviceApiToken$refreshDeviceApiToken) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } final l$token = token; final lOther$token = other.token; - if (l$token != lOther$token) return false; + if (l$token != lOther$token) { + return false; + } return true; } } @@ -6176,34 +9758,38 @@ extension UtilityExtension$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken Mutation$RefreshDeviceApiToken$refreshDeviceApiToken> get copyWith => CopyWith$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken( - this, (i) => i); + this, + (i) => i, + ); } abstract class CopyWith$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken< TRes> { factory CopyWith$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken( - Mutation$RefreshDeviceApiToken$refreshDeviceApiToken instance, - TRes Function(Mutation$RefreshDeviceApiToken$refreshDeviceApiToken) - then) = - _CopyWithImpl$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken; + Mutation$RefreshDeviceApiToken$refreshDeviceApiToken instance, + TRes Function(Mutation$RefreshDeviceApiToken$refreshDeviceApiToken) then, + ) = _CopyWithImpl$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken; factory CopyWith$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken.stub( TRes res) = _CopyWithStubImpl$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken; - TRes call( - {int? code, - String? message, - bool? success, - String? $__typename, - String? token}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + String? token, + }); } class _CopyWithImpl$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken implements CopyWith$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken { _CopyWithImpl$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken( - this._instance, this._then); + this._instance, + this._then, + ); final Mutation$RefreshDeviceApiToken$refreshDeviceApiToken _instance; @@ -6212,26 +9798,27 @@ class _CopyWithImpl$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined, - Object? token = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + Object? token = _undefined, + }) => _then(Mutation$RefreshDeviceApiToken$refreshDeviceApiToken( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String), - token: token == _undefined ? _instance.token : (token as String?))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + token: token == _undefined ? _instance.token : (token as String?), + )); } class _CopyWithStubImpl$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken< @@ -6243,55 +9830,77 @@ class _CopyWithStubImpl$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken< TRes _res; - call( - {int? code, - String? message, - bool? success, - String? $__typename, - String? token}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + String? token, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Variables$Mutation$DeleteDeviceApiToken { - Variables$Mutation$DeleteDeviceApiToken({required this.device}); + factory Variables$Mutation$DeleteDeviceApiToken({required String device}) => + Variables$Mutation$DeleteDeviceApiToken._({ + r'device': device, + }); + + Variables$Mutation$DeleteDeviceApiToken._(this._$data); - @override factory Variables$Mutation$DeleteDeviceApiToken.fromJson( - Map json) => - _$Variables$Mutation$DeleteDeviceApiTokenFromJson(json); - - final String device; - - Map toJson() => - _$Variables$Mutation$DeleteDeviceApiTokenToJson(this); - int get hashCode { - final l$device = device; - return Object.hashAll([l$device]); + Map data) { + final result$data = {}; + final l$device = data['device']; + result$data['device'] = (l$device as String); + return Variables$Mutation$DeleteDeviceApiToken._(result$data); } - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Variables$Mutation$DeleteDeviceApiToken) || - runtimeType != other.runtimeType) return false; + Map _$data; + + String get device => (_$data['device'] as String); + Map toJson() { + final result$data = {}; final l$device = device; - final lOther$device = other.device; - if (l$device != lOther$device) return false; - return true; + result$data['device'] = l$device; + return result$data; } CopyWith$Variables$Mutation$DeleteDeviceApiToken< Variables$Mutation$DeleteDeviceApiToken> - get copyWith => - CopyWith$Variables$Mutation$DeleteDeviceApiToken(this, (i) => i); + get copyWith => CopyWith$Variables$Mutation$DeleteDeviceApiToken( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$DeleteDeviceApiToken) || + runtimeType != other.runtimeType) { + return false; + } + final l$device = device; + final lOther$device = other.device; + if (l$device != lOther$device) { + return false; + } + return true; + } + + @override + int get hashCode { + final l$device = device; + return Object.hashAll([l$device]); + } } abstract class CopyWith$Variables$Mutation$DeleteDeviceApiToken { factory CopyWith$Variables$Mutation$DeleteDeviceApiToken( - Variables$Mutation$DeleteDeviceApiToken instance, - TRes Function(Variables$Mutation$DeleteDeviceApiToken) then) = - _CopyWithImpl$Variables$Mutation$DeleteDeviceApiToken; + Variables$Mutation$DeleteDeviceApiToken instance, + TRes Function(Variables$Mutation$DeleteDeviceApiToken) then, + ) = _CopyWithImpl$Variables$Mutation$DeleteDeviceApiToken; factory CopyWith$Variables$Mutation$DeleteDeviceApiToken.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$DeleteDeviceApiToken; @@ -6302,7 +9911,9 @@ abstract class CopyWith$Variables$Mutation$DeleteDeviceApiToken { class _CopyWithImpl$Variables$Mutation$DeleteDeviceApiToken implements CopyWith$Variables$Mutation$DeleteDeviceApiToken { _CopyWithImpl$Variables$Mutation$DeleteDeviceApiToken( - this._instance, this._then); + this._instance, + this._then, + ); final Variables$Mutation$DeleteDeviceApiToken _instance; @@ -6311,10 +9922,11 @@ class _CopyWithImpl$Variables$Mutation$DeleteDeviceApiToken static const _undefined = {}; TRes call({Object? device = _undefined}) => - _then(Variables$Mutation$DeleteDeviceApiToken( - device: device == _undefined || device == null - ? _instance.device - : (device as String))); + _then(Variables$Mutation$DeleteDeviceApiToken._({ + ..._instance._$data, + if (device != _undefined && device != null) + 'device': (device as String), + })); } class _CopyWithStubImpl$Variables$Mutation$DeleteDeviceApiToken @@ -6326,38 +9938,65 @@ class _CopyWithStubImpl$Variables$Mutation$DeleteDeviceApiToken call({String? device}) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$DeleteDeviceApiToken { - Mutation$DeleteDeviceApiToken( - {required this.deleteDeviceApiToken, required this.$__typename}); + Mutation$DeleteDeviceApiToken({ + required this.deleteDeviceApiToken, + required this.$__typename, + }); - @override - factory Mutation$DeleteDeviceApiToken.fromJson(Map json) => - _$Mutation$DeleteDeviceApiTokenFromJson(json); + factory Mutation$DeleteDeviceApiToken.fromJson(Map json) { + final l$deleteDeviceApiToken = json['deleteDeviceApiToken']; + final l$$__typename = json['__typename']; + return Mutation$DeleteDeviceApiToken( + deleteDeviceApiToken: + Mutation$DeleteDeviceApiToken$deleteDeviceApiToken.fromJson( + (l$deleteDeviceApiToken as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$DeleteDeviceApiToken$deleteDeviceApiToken deleteDeviceApiToken; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$DeleteDeviceApiTokenToJson(this); + Map toJson() { + final _resultData = {}; + final l$deleteDeviceApiToken = deleteDeviceApiToken; + _resultData['deleteDeviceApiToken'] = l$deleteDeviceApiToken.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$deleteDeviceApiToken = deleteDeviceApiToken; final l$$__typename = $__typename; - return Object.hashAll([l$deleteDeviceApiToken, l$$__typename]); + return Object.hashAll([ + l$deleteDeviceApiToken, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$DeleteDeviceApiToken) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$deleteDeviceApiToken = deleteDeviceApiToken; final lOther$deleteDeviceApiToken = other.deleteDeviceApiToken; - if (l$deleteDeviceApiToken != lOther$deleteDeviceApiToken) return false; + if (l$deleteDeviceApiToken != lOther$deleteDeviceApiToken) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -6365,28 +10004,35 @@ class Mutation$DeleteDeviceApiToken { extension UtilityExtension$Mutation$DeleteDeviceApiToken on Mutation$DeleteDeviceApiToken { CopyWith$Mutation$DeleteDeviceApiToken - get copyWith => CopyWith$Mutation$DeleteDeviceApiToken(this, (i) => i); + get copyWith => CopyWith$Mutation$DeleteDeviceApiToken( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$DeleteDeviceApiToken { factory CopyWith$Mutation$DeleteDeviceApiToken( - Mutation$DeleteDeviceApiToken instance, - TRes Function(Mutation$DeleteDeviceApiToken) then) = - _CopyWithImpl$Mutation$DeleteDeviceApiToken; + Mutation$DeleteDeviceApiToken instance, + TRes Function(Mutation$DeleteDeviceApiToken) then, + ) = _CopyWithImpl$Mutation$DeleteDeviceApiToken; factory CopyWith$Mutation$DeleteDeviceApiToken.stub(TRes res) = _CopyWithStubImpl$Mutation$DeleteDeviceApiToken; - TRes call( - {Mutation$DeleteDeviceApiToken$deleteDeviceApiToken? deleteDeviceApiToken, - String? $__typename}); + TRes call({ + Mutation$DeleteDeviceApiToken$deleteDeviceApiToken? deleteDeviceApiToken, + String? $__typename, + }); CopyWith$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken get deleteDeviceApiToken; } class _CopyWithImpl$Mutation$DeleteDeviceApiToken implements CopyWith$Mutation$DeleteDeviceApiToken { - _CopyWithImpl$Mutation$DeleteDeviceApiToken(this._instance, this._then); + _CopyWithImpl$Mutation$DeleteDeviceApiToken( + this._instance, + this._then, + ); final Mutation$DeleteDeviceApiToken _instance; @@ -6394,18 +10040,20 @@ class _CopyWithImpl$Mutation$DeleteDeviceApiToken static const _undefined = {}; - TRes call( - {Object? deleteDeviceApiToken = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? deleteDeviceApiToken = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$DeleteDeviceApiToken( - deleteDeviceApiToken: - deleteDeviceApiToken == _undefined || deleteDeviceApiToken == null - ? _instance.deleteDeviceApiToken - : (deleteDeviceApiToken - as Mutation$DeleteDeviceApiToken$deleteDeviceApiToken), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + deleteDeviceApiToken: + deleteDeviceApiToken == _undefined || deleteDeviceApiToken == null + ? _instance.deleteDeviceApiToken + : (deleteDeviceApiToken + as Mutation$DeleteDeviceApiToken$deleteDeviceApiToken), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken get deleteDeviceApiToken { final local$deleteDeviceApiToken = _instance.deleteDeviceApiToken; @@ -6420,10 +10068,10 @@ class _CopyWithStubImpl$Mutation$DeleteDeviceApiToken TRes _res; - call( - {Mutation$DeleteDeviceApiToken$deleteDeviceApiToken? - deleteDeviceApiToken, - String? $__typename}) => + call({ + Mutation$DeleteDeviceApiToken$deleteDeviceApiToken? deleteDeviceApiToken, + String? $__typename, + }) => _res; CopyWith$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken get deleteDeviceApiToken => @@ -6433,86 +10081,100 @@ class _CopyWithStubImpl$Mutation$DeleteDeviceApiToken const documentNodeMutationDeleteDeviceApiToken = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'DeleteDeviceApiToken'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'device')), - type: - NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'deleteDeviceApiToken'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'device'), - value: VariableNode(name: NameNode(value: 'device'))) - ], + type: OperationType.mutation, + name: NameNode(value: 'DeleteDeviceApiToken'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'device')), + type: NamedTypeNode( + name: NameNode(value: 'String'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'deleteDeviceApiToken'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'device'), + value: VariableNode(name: NameNode(value: 'device')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$DeleteDeviceApiToken _parserFn$Mutation$DeleteDeviceApiToken( Map data) => Mutation$DeleteDeviceApiToken.fromJson(data); typedef OnMutationCompleted$Mutation$DeleteDeviceApiToken = FutureOr - Function(dynamic, Mutation$DeleteDeviceApiToken?); + Function( + dynamic, + Mutation$DeleteDeviceApiToken?, +); class Options$Mutation$DeleteDeviceApiToken extends graphql.MutationOptions { - Options$Mutation$DeleteDeviceApiToken( - {String? operationName, - required Variables$Mutation$DeleteDeviceApiToken variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$DeleteDeviceApiToken? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$DeleteDeviceApiToken({ + String? operationName, + required Variables$Mutation$DeleteDeviceApiToken variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$DeleteDeviceApiToken? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( data, data == null ? null - : _parserFn$Mutation$DeleteDeviceApiToken(data)), - update: update, - onError: onError, - document: documentNodeMutationDeleteDeviceApiToken, - parserFn: _parserFn$Mutation$DeleteDeviceApiToken); + : _parserFn$Mutation$DeleteDeviceApiToken(data), + ), + update: update, + onError: onError, + document: documentNodeMutationDeleteDeviceApiToken, + parserFn: _parserFn$Mutation$DeleteDeviceApiToken, + ); final OnMutationCompleted$Mutation$DeleteDeviceApiToken? onCompletedWithParsed; @@ -6522,38 +10184,39 @@ class Options$Mutation$DeleteDeviceApiToken ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$DeleteDeviceApiToken extends graphql.WatchQueryOptions { - WatchOptions$Mutation$DeleteDeviceApiToken( - {String? operationName, - required Variables$Mutation$DeleteDeviceApiToken variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationDeleteDeviceApiToken, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$DeleteDeviceApiToken); + WatchOptions$Mutation$DeleteDeviceApiToken({ + String? operationName, + required Variables$Mutation$DeleteDeviceApiToken variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationDeleteDeviceApiToken, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$DeleteDeviceApiToken, + ); } extension ClientExtension$Mutation$DeleteDeviceApiToken @@ -6568,19 +10231,28 @@ extension ClientExtension$Mutation$DeleteDeviceApiToken this.watchMutation(options); } -@JsonSerializable(explicitToJson: true) class Mutation$DeleteDeviceApiToken$deleteDeviceApiToken - implements Fragment$basicMutationReturnFields { - Mutation$DeleteDeviceApiToken$deleteDeviceApiToken( - {required this.code, - required this.message, - required this.success, - required this.$__typename}); + implements Fragment$basicMutationReturnFields$$GenericMutationReturn { + Mutation$DeleteDeviceApiToken$deleteDeviceApiToken({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override factory Mutation$DeleteDeviceApiToken$deleteDeviceApiToken.fromJson( - Map json) => - _$Mutation$DeleteDeviceApiToken$deleteDeviceApiTokenFromJson(json); + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Mutation$DeleteDeviceApiToken$deleteDeviceApiToken( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } final int code; @@ -6588,36 +10260,64 @@ class Mutation$DeleteDeviceApiToken$deleteDeviceApiToken final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Mutation$DeleteDeviceApiToken$deleteDeviceApiTokenToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; - return Object.hashAll([l$code, l$message, l$success, l$$__typename]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$DeleteDeviceApiToken$deleteDeviceApiToken) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -6628,29 +10328,37 @@ extension UtilityExtension$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken Mutation$DeleteDeviceApiToken$deleteDeviceApiToken> get copyWith => CopyWith$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken( - this, (i) => i); + this, + (i) => i, + ); } abstract class CopyWith$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken< TRes> { factory CopyWith$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken( - Mutation$DeleteDeviceApiToken$deleteDeviceApiToken instance, - TRes Function(Mutation$DeleteDeviceApiToken$deleteDeviceApiToken) - then) = - _CopyWithImpl$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken; + Mutation$DeleteDeviceApiToken$deleteDeviceApiToken instance, + TRes Function(Mutation$DeleteDeviceApiToken$deleteDeviceApiToken) then, + ) = _CopyWithImpl$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken; factory CopyWith$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken.stub( TRes res) = _CopyWithStubImpl$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken; - TRes call({int? code, String? message, bool? success, String? $__typename}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); } class _CopyWithImpl$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken implements CopyWith$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken { _CopyWithImpl$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken( - this._instance, this._then); + this._instance, + this._then, + ); final Mutation$DeleteDeviceApiToken$deleteDeviceApiToken _instance; @@ -6658,24 +10366,25 @@ class _CopyWithImpl$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$DeleteDeviceApiToken$deleteDeviceApiToken( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken @@ -6686,42 +10395,74 @@ class _CopyWithStubImpl$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$GetNewDeviceApiKey { - Mutation$GetNewDeviceApiKey( - {required this.getNewDeviceApiKey, required this.$__typename}); + Mutation$GetNewDeviceApiKey({ + required this.getNewDeviceApiKey, + required this.$__typename, + }); - @override - factory Mutation$GetNewDeviceApiKey.fromJson(Map json) => - _$Mutation$GetNewDeviceApiKeyFromJson(json); + factory Mutation$GetNewDeviceApiKey.fromJson(Map json) { + final l$getNewDeviceApiKey = json['getNewDeviceApiKey']; + final l$$__typename = json['__typename']; + return Mutation$GetNewDeviceApiKey( + getNewDeviceApiKey: + Mutation$GetNewDeviceApiKey$getNewDeviceApiKey.fromJson( + (l$getNewDeviceApiKey as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$GetNewDeviceApiKey$getNewDeviceApiKey getNewDeviceApiKey; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$GetNewDeviceApiKeyToJson(this); + Map toJson() { + final _resultData = {}; + final l$getNewDeviceApiKey = getNewDeviceApiKey; + _resultData['getNewDeviceApiKey'] = l$getNewDeviceApiKey.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$getNewDeviceApiKey = getNewDeviceApiKey; final l$$__typename = $__typename; - return Object.hashAll([l$getNewDeviceApiKey, l$$__typename]); + return Object.hashAll([ + l$getNewDeviceApiKey, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$GetNewDeviceApiKey) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$getNewDeviceApiKey = getNewDeviceApiKey; final lOther$getNewDeviceApiKey = other.getNewDeviceApiKey; - if (l$getNewDeviceApiKey != lOther$getNewDeviceApiKey) return false; + if (l$getNewDeviceApiKey != lOther$getNewDeviceApiKey) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -6729,28 +10470,35 @@ class Mutation$GetNewDeviceApiKey { extension UtilityExtension$Mutation$GetNewDeviceApiKey on Mutation$GetNewDeviceApiKey { CopyWith$Mutation$GetNewDeviceApiKey - get copyWith => CopyWith$Mutation$GetNewDeviceApiKey(this, (i) => i); + get copyWith => CopyWith$Mutation$GetNewDeviceApiKey( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$GetNewDeviceApiKey { factory CopyWith$Mutation$GetNewDeviceApiKey( - Mutation$GetNewDeviceApiKey instance, - TRes Function(Mutation$GetNewDeviceApiKey) then) = - _CopyWithImpl$Mutation$GetNewDeviceApiKey; + Mutation$GetNewDeviceApiKey instance, + TRes Function(Mutation$GetNewDeviceApiKey) then, + ) = _CopyWithImpl$Mutation$GetNewDeviceApiKey; factory CopyWith$Mutation$GetNewDeviceApiKey.stub(TRes res) = _CopyWithStubImpl$Mutation$GetNewDeviceApiKey; - TRes call( - {Mutation$GetNewDeviceApiKey$getNewDeviceApiKey? getNewDeviceApiKey, - String? $__typename}); + TRes call({ + Mutation$GetNewDeviceApiKey$getNewDeviceApiKey? getNewDeviceApiKey, + String? $__typename, + }); CopyWith$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey get getNewDeviceApiKey; } class _CopyWithImpl$Mutation$GetNewDeviceApiKey implements CopyWith$Mutation$GetNewDeviceApiKey { - _CopyWithImpl$Mutation$GetNewDeviceApiKey(this._instance, this._then); + _CopyWithImpl$Mutation$GetNewDeviceApiKey( + this._instance, + this._then, + ); final Mutation$GetNewDeviceApiKey _instance; @@ -6758,18 +10506,20 @@ class _CopyWithImpl$Mutation$GetNewDeviceApiKey static const _undefined = {}; - TRes call( - {Object? getNewDeviceApiKey = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? getNewDeviceApiKey = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$GetNewDeviceApiKey( - getNewDeviceApiKey: - getNewDeviceApiKey == _undefined || getNewDeviceApiKey == null - ? _instance.getNewDeviceApiKey - : (getNewDeviceApiKey - as Mutation$GetNewDeviceApiKey$getNewDeviceApiKey), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + getNewDeviceApiKey: + getNewDeviceApiKey == _undefined || getNewDeviceApiKey == null + ? _instance.getNewDeviceApiKey + : (getNewDeviceApiKey + as Mutation$GetNewDeviceApiKey$getNewDeviceApiKey), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey get getNewDeviceApiKey { final local$getNewDeviceApiKey = _instance.getNewDeviceApiKey; @@ -6784,9 +10534,10 @@ class _CopyWithStubImpl$Mutation$GetNewDeviceApiKey TRes _res; - call( - {Mutation$GetNewDeviceApiKey$getNewDeviceApiKey? getNewDeviceApiKey, - String? $__typename}) => + call({ + Mutation$GetNewDeviceApiKey$getNewDeviceApiKey? getNewDeviceApiKey, + String? $__typename, + }) => _res; CopyWith$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey get getNewDeviceApiKey => @@ -6795,79 +10546,90 @@ class _CopyWithStubImpl$Mutation$GetNewDeviceApiKey const documentNodeMutationGetNewDeviceApiKey = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'GetNewDeviceApiKey'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'getNewDeviceApiKey'), + type: OperationType.mutation, + name: NameNode(value: 'GetNewDeviceApiKey'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'getNewDeviceApiKey'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: [], + ), + FieldNode( + name: NameNode(value: 'key'), alias: null, arguments: [], directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: 'key'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + selectionSet: null, + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$GetNewDeviceApiKey _parserFn$Mutation$GetNewDeviceApiKey( Map data) => Mutation$GetNewDeviceApiKey.fromJson(data); typedef OnMutationCompleted$Mutation$GetNewDeviceApiKey = FutureOr - Function(dynamic, Mutation$GetNewDeviceApiKey?); + Function( + dynamic, + Mutation$GetNewDeviceApiKey?, +); class Options$Mutation$GetNewDeviceApiKey extends graphql.MutationOptions { - Options$Mutation$GetNewDeviceApiKey( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$GetNewDeviceApiKey? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$GetNewDeviceApiKey({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$GetNewDeviceApiKey? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( data, data == null ? null - : _parserFn$Mutation$GetNewDeviceApiKey(data)), - update: update, - onError: onError, - document: documentNodeMutationGetNewDeviceApiKey, - parserFn: _parserFn$Mutation$GetNewDeviceApiKey); + : _parserFn$Mutation$GetNewDeviceApiKey(data), + ), + update: update, + onError: onError, + document: documentNodeMutationGetNewDeviceApiKey, + parserFn: _parserFn$Mutation$GetNewDeviceApiKey, + ); final OnMutationCompleted$Mutation$GetNewDeviceApiKey? onCompletedWithParsed; @@ -6876,36 +10638,37 @@ class Options$Mutation$GetNewDeviceApiKey ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$GetNewDeviceApiKey extends graphql.WatchQueryOptions { - WatchOptions$Mutation$GetNewDeviceApiKey( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationGetNewDeviceApiKey, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$GetNewDeviceApiKey); + WatchOptions$Mutation$GetNewDeviceApiKey({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationGetNewDeviceApiKey, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$GetNewDeviceApiKey, + ); } extension ClientExtension$Mutation$GetNewDeviceApiKey on graphql.GraphQLClient { @@ -6919,20 +10682,31 @@ extension ClientExtension$Mutation$GetNewDeviceApiKey on graphql.GraphQLClient { this.watchMutation(options ?? WatchOptions$Mutation$GetNewDeviceApiKey()); } -@JsonSerializable(explicitToJson: true) class Mutation$GetNewDeviceApiKey$getNewDeviceApiKey - implements Fragment$basicMutationReturnFields { - Mutation$GetNewDeviceApiKey$getNewDeviceApiKey( - {required this.code, - required this.message, - required this.success, - required this.$__typename, - this.key}); + implements Fragment$basicMutationReturnFields$$ApiKeyMutationReturn { + Mutation$GetNewDeviceApiKey$getNewDeviceApiKey({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + this.key, + }); - @override factory Mutation$GetNewDeviceApiKey$getNewDeviceApiKey.fromJson( - Map json) => - _$Mutation$GetNewDeviceApiKey$getNewDeviceApiKeyFromJson(json); + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + final l$key = json['key']; + return Mutation$GetNewDeviceApiKey$getNewDeviceApiKey( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + key: (l$key as String?), + ); + } final int code; @@ -6940,42 +10714,75 @@ class Mutation$GetNewDeviceApiKey$getNewDeviceApiKey final bool success; - @JsonKey(name: '__typename') final String $__typename; final String? key; - Map toJson() => - _$Mutation$GetNewDeviceApiKey$getNewDeviceApiKeyToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + final l$key = key; + _resultData['key'] = l$key; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; final l$key = key; - return Object.hashAll([l$code, l$message, l$success, l$$__typename, l$key]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + l$key, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$GetNewDeviceApiKey$getNewDeviceApiKey) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } final l$key = key; final lOther$key = other.key; - if (l$key != lOther$key) return false; + if (l$key != lOther$key) { + return false; + } return true; } } @@ -6985,31 +10792,36 @@ extension UtilityExtension$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey CopyWith$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey< Mutation$GetNewDeviceApiKey$getNewDeviceApiKey> get copyWith => CopyWith$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey( - this, (i) => i); + this, + (i) => i, + ); } abstract class CopyWith$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey { factory CopyWith$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey( - Mutation$GetNewDeviceApiKey$getNewDeviceApiKey instance, - TRes Function(Mutation$GetNewDeviceApiKey$getNewDeviceApiKey) then) = - _CopyWithImpl$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey; + Mutation$GetNewDeviceApiKey$getNewDeviceApiKey instance, + TRes Function(Mutation$GetNewDeviceApiKey$getNewDeviceApiKey) then, + ) = _CopyWithImpl$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey; factory CopyWith$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey.stub( TRes res) = _CopyWithStubImpl$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey; - TRes call( - {int? code, - String? message, - bool? success, - String? $__typename, - String? key}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + String? key, + }); } class _CopyWithImpl$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey implements CopyWith$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey { _CopyWithImpl$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey( - this._instance, this._then); + this._instance, + this._then, + ); final Mutation$GetNewDeviceApiKey$getNewDeviceApiKey _instance; @@ -7017,26 +10829,27 @@ class _CopyWithImpl$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined, - Object? key = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + Object? key = _undefined, + }) => _then(Mutation$GetNewDeviceApiKey$getNewDeviceApiKey( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String), - key: key == _undefined ? _instance.key : (key as String?))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + key: key == _undefined ? _instance.key : (key as String?), + )); } class _CopyWithStubImpl$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey @@ -7045,51 +10858,78 @@ class _CopyWithStubImpl$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey TRes _res; - call( - {int? code, - String? message, - bool? success, - String? $__typename, - String? key}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + String? key, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$InvalidateNewDeviceApiKey { - Mutation$InvalidateNewDeviceApiKey( - {required this.invalidateNewDeviceApiKey, required this.$__typename}); + Mutation$InvalidateNewDeviceApiKey({ + required this.invalidateNewDeviceApiKey, + required this.$__typename, + }); - @override factory Mutation$InvalidateNewDeviceApiKey.fromJson( - Map json) => - _$Mutation$InvalidateNewDeviceApiKeyFromJson(json); + Map json) { + final l$invalidateNewDeviceApiKey = json['invalidateNewDeviceApiKey']; + final l$$__typename = json['__typename']; + return Mutation$InvalidateNewDeviceApiKey( + invalidateNewDeviceApiKey: + Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey.fromJson( + (l$invalidateNewDeviceApiKey as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey invalidateNewDeviceApiKey; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Mutation$InvalidateNewDeviceApiKeyToJson(this); + Map toJson() { + final _resultData = {}; + final l$invalidateNewDeviceApiKey = invalidateNewDeviceApiKey; + _resultData['invalidateNewDeviceApiKey'] = + l$invalidateNewDeviceApiKey.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$invalidateNewDeviceApiKey = invalidateNewDeviceApiKey; final l$$__typename = $__typename; - return Object.hashAll([l$invalidateNewDeviceApiKey, l$$__typename]); + return Object.hashAll([ + l$invalidateNewDeviceApiKey, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$InvalidateNewDeviceApiKey) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$invalidateNewDeviceApiKey = invalidateNewDeviceApiKey; final lOther$invalidateNewDeviceApiKey = other.invalidateNewDeviceApiKey; - if (l$invalidateNewDeviceApiKey != lOther$invalidateNewDeviceApiKey) + if (l$invalidateNewDeviceApiKey != lOther$invalidateNewDeviceApiKey) { return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -7098,30 +10938,36 @@ extension UtilityExtension$Mutation$InvalidateNewDeviceApiKey on Mutation$InvalidateNewDeviceApiKey { CopyWith$Mutation$InvalidateNewDeviceApiKey< Mutation$InvalidateNewDeviceApiKey> - get copyWith => - CopyWith$Mutation$InvalidateNewDeviceApiKey(this, (i) => i); + get copyWith => CopyWith$Mutation$InvalidateNewDeviceApiKey( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$InvalidateNewDeviceApiKey { factory CopyWith$Mutation$InvalidateNewDeviceApiKey( - Mutation$InvalidateNewDeviceApiKey instance, - TRes Function(Mutation$InvalidateNewDeviceApiKey) then) = - _CopyWithImpl$Mutation$InvalidateNewDeviceApiKey; + Mutation$InvalidateNewDeviceApiKey instance, + TRes Function(Mutation$InvalidateNewDeviceApiKey) then, + ) = _CopyWithImpl$Mutation$InvalidateNewDeviceApiKey; factory CopyWith$Mutation$InvalidateNewDeviceApiKey.stub(TRes res) = _CopyWithStubImpl$Mutation$InvalidateNewDeviceApiKey; - TRes call( - {Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey? - invalidateNewDeviceApiKey, - String? $__typename}); + TRes call({ + Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey? + invalidateNewDeviceApiKey, + String? $__typename, + }); CopyWith$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey get invalidateNewDeviceApiKey; } class _CopyWithImpl$Mutation$InvalidateNewDeviceApiKey implements CopyWith$Mutation$InvalidateNewDeviceApiKey { - _CopyWithImpl$Mutation$InvalidateNewDeviceApiKey(this._instance, this._then); + _CopyWithImpl$Mutation$InvalidateNewDeviceApiKey( + this._instance, + this._then, + ); final Mutation$InvalidateNewDeviceApiKey _instance; @@ -7129,18 +10975,20 @@ class _CopyWithImpl$Mutation$InvalidateNewDeviceApiKey static const _undefined = {}; - TRes call( - {Object? invalidateNewDeviceApiKey = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? invalidateNewDeviceApiKey = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$InvalidateNewDeviceApiKey( - invalidateNewDeviceApiKey: invalidateNewDeviceApiKey == _undefined || - invalidateNewDeviceApiKey == null - ? _instance.invalidateNewDeviceApiKey - : (invalidateNewDeviceApiKey - as Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + invalidateNewDeviceApiKey: invalidateNewDeviceApiKey == _undefined || + invalidateNewDeviceApiKey == null + ? _instance.invalidateNewDeviceApiKey + : (invalidateNewDeviceApiKey + as Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey get invalidateNewDeviceApiKey { final local$invalidateNewDeviceApiKey = _instance.invalidateNewDeviceApiKey; @@ -7156,10 +11004,11 @@ class _CopyWithStubImpl$Mutation$InvalidateNewDeviceApiKey TRes _res; - call( - {Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey? - invalidateNewDeviceApiKey, - String? $__typename}) => + call({ + Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey? + invalidateNewDeviceApiKey, + String? $__typename, + }) => _res; CopyWith$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey get invalidateNewDeviceApiKey => @@ -7170,73 +11019,83 @@ class _CopyWithStubImpl$Mutation$InvalidateNewDeviceApiKey const documentNodeMutationInvalidateNewDeviceApiKey = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'InvalidateNewDeviceApiKey'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'invalidateNewDeviceApiKey'), - alias: null, - arguments: [], + type: OperationType.mutation, + name: NameNode(value: 'InvalidateNewDeviceApiKey'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'invalidateNewDeviceApiKey'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$InvalidateNewDeviceApiKey _parserFn$Mutation$InvalidateNewDeviceApiKey( Map data) => Mutation$InvalidateNewDeviceApiKey.fromJson(data); typedef OnMutationCompleted$Mutation$InvalidateNewDeviceApiKey = FutureOr - Function(dynamic, Mutation$InvalidateNewDeviceApiKey?); + Function( + dynamic, + Mutation$InvalidateNewDeviceApiKey?, +); class Options$Mutation$InvalidateNewDeviceApiKey extends graphql.MutationOptions { - Options$Mutation$InvalidateNewDeviceApiKey( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$InvalidateNewDeviceApiKey? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$InvalidateNewDeviceApiKey({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$InvalidateNewDeviceApiKey? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( data, data == null ? null - : _parserFn$Mutation$InvalidateNewDeviceApiKey(data)), - update: update, - onError: onError, - document: documentNodeMutationInvalidateNewDeviceApiKey, - parserFn: _parserFn$Mutation$InvalidateNewDeviceApiKey); + : _parserFn$Mutation$InvalidateNewDeviceApiKey(data), + ), + update: update, + onError: onError, + document: documentNodeMutationInvalidateNewDeviceApiKey, + parserFn: _parserFn$Mutation$InvalidateNewDeviceApiKey, + ); final OnMutationCompleted$Mutation$InvalidateNewDeviceApiKey? onCompletedWithParsed; @@ -7246,36 +11105,37 @@ class Options$Mutation$InvalidateNewDeviceApiKey ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$InvalidateNewDeviceApiKey extends graphql.WatchQueryOptions { - WatchOptions$Mutation$InvalidateNewDeviceApiKey( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationInvalidateNewDeviceApiKey, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$InvalidateNewDeviceApiKey); + WatchOptions$Mutation$InvalidateNewDeviceApiKey({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationInvalidateNewDeviceApiKey, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$InvalidateNewDeviceApiKey, + ); } extension ClientExtension$Mutation$InvalidateNewDeviceApiKey @@ -7292,20 +11152,28 @@ extension ClientExtension$Mutation$InvalidateNewDeviceApiKey options ?? WatchOptions$Mutation$InvalidateNewDeviceApiKey()); } -@JsonSerializable(explicitToJson: true) class Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey - implements Fragment$basicMutationReturnFields { - Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey( - {required this.code, - required this.message, - required this.success, - required this.$__typename}); + implements Fragment$basicMutationReturnFields$$GenericMutationReturn { + Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override factory Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey.fromJson( - Map json) => - _$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKeyFromJson( - json); + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } final int code; @@ -7313,38 +11181,65 @@ class Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKeyToJson( - this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; - return Object.hashAll([l$code, l$message, l$success, l$$__typename]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -7355,23 +11250,29 @@ extension UtilityExtension$Mutation$InvalidateNewDeviceApiKey$invalidateNewDevic Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey> get copyWith => CopyWith$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey( - this, (i) => i); + this, + (i) => i, + ); } abstract class CopyWith$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey< TRes> { factory CopyWith$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey( - Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey instance, - TRes Function( - Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey) - then) = - _CopyWithImpl$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey; + Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey instance, + TRes Function(Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey) + then, + ) = _CopyWithImpl$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey; factory CopyWith$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey.stub( TRes res) = _CopyWithStubImpl$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey; - TRes call({int? code, String? message, bool? success, String? $__typename}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); } class _CopyWithImpl$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey< @@ -7380,7 +11281,9 @@ class _CopyWithImpl$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey CopyWith$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey< TRes> { _CopyWithImpl$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey( - this._instance, this._then); + this._instance, + this._then, + ); final Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey _instance; @@ -7389,24 +11292,25 @@ class _CopyWithImpl$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey< @@ -7419,50 +11323,79 @@ class _CopyWithStubImpl$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceAp TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Variables$Mutation$AuthorizeWithNewDeviceApiKey { - Variables$Mutation$AuthorizeWithNewDeviceApiKey({required this.input}); + factory Variables$Mutation$AuthorizeWithNewDeviceApiKey( + {required Input$UseNewDeviceKeyInput input}) => + Variables$Mutation$AuthorizeWithNewDeviceApiKey._({ + r'input': input, + }); + + Variables$Mutation$AuthorizeWithNewDeviceApiKey._(this._$data); - @override factory Variables$Mutation$AuthorizeWithNewDeviceApiKey.fromJson( - Map json) => - _$Variables$Mutation$AuthorizeWithNewDeviceApiKeyFromJson(json); - - final Input$UseNewDeviceKeyInput input; - - Map toJson() => - _$Variables$Mutation$AuthorizeWithNewDeviceApiKeyToJson(this); - int get hashCode { - final l$input = input; - return Object.hashAll([l$input]); + Map data) { + final result$data = {}; + final l$input = data['input']; + result$data['input'] = + Input$UseNewDeviceKeyInput.fromJson((l$input as Map)); + return Variables$Mutation$AuthorizeWithNewDeviceApiKey._(result$data); } - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Variables$Mutation$AuthorizeWithNewDeviceApiKey) || - runtimeType != other.runtimeType) return false; + Map _$data; + + Input$UseNewDeviceKeyInput get input => + (_$data['input'] as Input$UseNewDeviceKeyInput); + Map toJson() { + final result$data = {}; final l$input = input; - final lOther$input = other.input; - if (l$input != lOther$input) return false; - return true; + result$data['input'] = l$input.toJson(); + return result$data; } CopyWith$Variables$Mutation$AuthorizeWithNewDeviceApiKey< Variables$Mutation$AuthorizeWithNewDeviceApiKey> get copyWith => CopyWith$Variables$Mutation$AuthorizeWithNewDeviceApiKey( - this, (i) => i); + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$AuthorizeWithNewDeviceApiKey) || + runtimeType != other.runtimeType) { + return false; + } + final l$input = input; + final lOther$input = other.input; + if (l$input != lOther$input) { + return false; + } + return true; + } + + @override + int get hashCode { + final l$input = input; + return Object.hashAll([l$input]); + } } abstract class CopyWith$Variables$Mutation$AuthorizeWithNewDeviceApiKey { factory CopyWith$Variables$Mutation$AuthorizeWithNewDeviceApiKey( - Variables$Mutation$AuthorizeWithNewDeviceApiKey instance, - TRes Function(Variables$Mutation$AuthorizeWithNewDeviceApiKey) then) = - _CopyWithImpl$Variables$Mutation$AuthorizeWithNewDeviceApiKey; + Variables$Mutation$AuthorizeWithNewDeviceApiKey instance, + TRes Function(Variables$Mutation$AuthorizeWithNewDeviceApiKey) then, + ) = _CopyWithImpl$Variables$Mutation$AuthorizeWithNewDeviceApiKey; factory CopyWith$Variables$Mutation$AuthorizeWithNewDeviceApiKey.stub( TRes res) = @@ -7474,7 +11407,9 @@ abstract class CopyWith$Variables$Mutation$AuthorizeWithNewDeviceApiKey { class _CopyWithImpl$Variables$Mutation$AuthorizeWithNewDeviceApiKey implements CopyWith$Variables$Mutation$AuthorizeWithNewDeviceApiKey { _CopyWithImpl$Variables$Mutation$AuthorizeWithNewDeviceApiKey( - this._instance, this._then); + this._instance, + this._then, + ); final Variables$Mutation$AuthorizeWithNewDeviceApiKey _instance; @@ -7483,10 +11418,11 @@ class _CopyWithImpl$Variables$Mutation$AuthorizeWithNewDeviceApiKey static const _undefined = {}; TRes call({Object? input = _undefined}) => - _then(Variables$Mutation$AuthorizeWithNewDeviceApiKey( - input: input == _undefined || input == null - ? _instance.input - : (input as Input$UseNewDeviceKeyInput))); + _then(Variables$Mutation$AuthorizeWithNewDeviceApiKey._({ + ..._instance._$data, + if (input != _undefined && input != null) + 'input': (input as Input$UseNewDeviceKeyInput), + })); } class _CopyWithStubImpl$Variables$Mutation$AuthorizeWithNewDeviceApiKey @@ -7498,43 +11434,70 @@ class _CopyWithStubImpl$Variables$Mutation$AuthorizeWithNewDeviceApiKey call({Input$UseNewDeviceKeyInput? input}) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$AuthorizeWithNewDeviceApiKey { - Mutation$AuthorizeWithNewDeviceApiKey( - {required this.authorizeWithNewDeviceApiKey, required this.$__typename}); + Mutation$AuthorizeWithNewDeviceApiKey({ + required this.authorizeWithNewDeviceApiKey, + required this.$__typename, + }); - @override factory Mutation$AuthorizeWithNewDeviceApiKey.fromJson( - Map json) => - _$Mutation$AuthorizeWithNewDeviceApiKeyFromJson(json); + Map json) { + final l$authorizeWithNewDeviceApiKey = json['authorizeWithNewDeviceApiKey']; + final l$$__typename = json['__typename']; + return Mutation$AuthorizeWithNewDeviceApiKey( + authorizeWithNewDeviceApiKey: + Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey + .fromJson( + (l$authorizeWithNewDeviceApiKey as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey authorizeWithNewDeviceApiKey; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Mutation$AuthorizeWithNewDeviceApiKeyToJson(this); + Map toJson() { + final _resultData = {}; + final l$authorizeWithNewDeviceApiKey = authorizeWithNewDeviceApiKey; + _resultData['authorizeWithNewDeviceApiKey'] = + l$authorizeWithNewDeviceApiKey.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$authorizeWithNewDeviceApiKey = authorizeWithNewDeviceApiKey; final l$$__typename = $__typename; - return Object.hashAll([l$authorizeWithNewDeviceApiKey, l$$__typename]); + return Object.hashAll([ + l$authorizeWithNewDeviceApiKey, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$AuthorizeWithNewDeviceApiKey) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$authorizeWithNewDeviceApiKey = authorizeWithNewDeviceApiKey; final lOther$authorizeWithNewDeviceApiKey = other.authorizeWithNewDeviceApiKey; - if (l$authorizeWithNewDeviceApiKey != lOther$authorizeWithNewDeviceApiKey) + if (l$authorizeWithNewDeviceApiKey != lOther$authorizeWithNewDeviceApiKey) { return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -7543,23 +11506,26 @@ extension UtilityExtension$Mutation$AuthorizeWithNewDeviceApiKey on Mutation$AuthorizeWithNewDeviceApiKey { CopyWith$Mutation$AuthorizeWithNewDeviceApiKey< Mutation$AuthorizeWithNewDeviceApiKey> - get copyWith => - CopyWith$Mutation$AuthorizeWithNewDeviceApiKey(this, (i) => i); + get copyWith => CopyWith$Mutation$AuthorizeWithNewDeviceApiKey( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$AuthorizeWithNewDeviceApiKey { factory CopyWith$Mutation$AuthorizeWithNewDeviceApiKey( - Mutation$AuthorizeWithNewDeviceApiKey instance, - TRes Function(Mutation$AuthorizeWithNewDeviceApiKey) then) = - _CopyWithImpl$Mutation$AuthorizeWithNewDeviceApiKey; + Mutation$AuthorizeWithNewDeviceApiKey instance, + TRes Function(Mutation$AuthorizeWithNewDeviceApiKey) then, + ) = _CopyWithImpl$Mutation$AuthorizeWithNewDeviceApiKey; factory CopyWith$Mutation$AuthorizeWithNewDeviceApiKey.stub(TRes res) = _CopyWithStubImpl$Mutation$AuthorizeWithNewDeviceApiKey; - TRes call( - {Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey? - authorizeWithNewDeviceApiKey, - String? $__typename}); + TRes call({ + Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey? + authorizeWithNewDeviceApiKey, + String? $__typename, + }); CopyWith$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey< TRes> get authorizeWithNewDeviceApiKey; } @@ -7567,7 +11533,9 @@ abstract class CopyWith$Mutation$AuthorizeWithNewDeviceApiKey { class _CopyWithImpl$Mutation$AuthorizeWithNewDeviceApiKey implements CopyWith$Mutation$AuthorizeWithNewDeviceApiKey { _CopyWithImpl$Mutation$AuthorizeWithNewDeviceApiKey( - this._instance, this._then); + this._instance, + this._then, + ); final Mutation$AuthorizeWithNewDeviceApiKey _instance; @@ -7575,19 +11543,21 @@ class _CopyWithImpl$Mutation$AuthorizeWithNewDeviceApiKey static const _undefined = {}; - TRes call( - {Object? authorizeWithNewDeviceApiKey = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? authorizeWithNewDeviceApiKey = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$AuthorizeWithNewDeviceApiKey( - authorizeWithNewDeviceApiKey: authorizeWithNewDeviceApiKey == - _undefined || - authorizeWithNewDeviceApiKey == null - ? _instance.authorizeWithNewDeviceApiKey - : (authorizeWithNewDeviceApiKey - as Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + authorizeWithNewDeviceApiKey: authorizeWithNewDeviceApiKey == + _undefined || + authorizeWithNewDeviceApiKey == null + ? _instance.authorizeWithNewDeviceApiKey + : (authorizeWithNewDeviceApiKey + as Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey< TRes> get authorizeWithNewDeviceApiKey { final local$authorizeWithNewDeviceApiKey = @@ -7604,10 +11574,11 @@ class _CopyWithStubImpl$Mutation$AuthorizeWithNewDeviceApiKey TRes _res; - call( - {Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey? - authorizeWithNewDeviceApiKey, - String? $__typename}) => + call({ + Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey? + authorizeWithNewDeviceApiKey, + String? $__typename, + }) => _res; CopyWith$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey< TRes> @@ -7619,51 +11590,61 @@ class _CopyWithStubImpl$Mutation$AuthorizeWithNewDeviceApiKey const documentNodeMutationAuthorizeWithNewDeviceApiKey = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'AuthorizeWithNewDeviceApiKey'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'input')), - type: NamedTypeNode( - name: NameNode(value: 'UseNewDeviceKeyInput'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'authorizeWithNewDeviceApiKey'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'input'), - value: VariableNode(name: NameNode(value: 'input'))) - ], + type: OperationType.mutation, + name: NameNode(value: 'AuthorizeWithNewDeviceApiKey'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'input')), + type: NamedTypeNode( + name: NameNode(value: 'UseNewDeviceKeyInput'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'authorizeWithNewDeviceApiKey'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'input'), + value: VariableNode(name: NameNode(value: 'input')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: 'token'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + ), + FieldNode( + name: NameNode(value: 'token'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$AuthorizeWithNewDeviceApiKey @@ -7671,42 +11652,46 @@ Mutation$AuthorizeWithNewDeviceApiKey Map data) => Mutation$AuthorizeWithNewDeviceApiKey.fromJson(data); typedef OnMutationCompleted$Mutation$AuthorizeWithNewDeviceApiKey - = FutureOr Function(dynamic, Mutation$AuthorizeWithNewDeviceApiKey?); + = FutureOr Function( + dynamic, + Mutation$AuthorizeWithNewDeviceApiKey?, +); class Options$Mutation$AuthorizeWithNewDeviceApiKey extends graphql.MutationOptions { - Options$Mutation$AuthorizeWithNewDeviceApiKey( - {String? operationName, - required Variables$Mutation$AuthorizeWithNewDeviceApiKey variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$AuthorizeWithNewDeviceApiKey? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$AuthorizeWithNewDeviceApiKey({ + String? operationName, + required Variables$Mutation$AuthorizeWithNewDeviceApiKey variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$AuthorizeWithNewDeviceApiKey? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( data, data == null ? null - : _parserFn$Mutation$AuthorizeWithNewDeviceApiKey( - data)), - update: update, - onError: onError, - document: documentNodeMutationAuthorizeWithNewDeviceApiKey, - parserFn: _parserFn$Mutation$AuthorizeWithNewDeviceApiKey); + : _parserFn$Mutation$AuthorizeWithNewDeviceApiKey(data), + ), + update: update, + onError: onError, + document: documentNodeMutationAuthorizeWithNewDeviceApiKey, + parserFn: _parserFn$Mutation$AuthorizeWithNewDeviceApiKey, + ); final OnMutationCompleted$Mutation$AuthorizeWithNewDeviceApiKey? onCompletedWithParsed; @@ -7716,38 +11701,39 @@ class Options$Mutation$AuthorizeWithNewDeviceApiKey ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$AuthorizeWithNewDeviceApiKey extends graphql.WatchQueryOptions { - WatchOptions$Mutation$AuthorizeWithNewDeviceApiKey( - {String? operationName, - required Variables$Mutation$AuthorizeWithNewDeviceApiKey variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationAuthorizeWithNewDeviceApiKey, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$AuthorizeWithNewDeviceApiKey); + WatchOptions$Mutation$AuthorizeWithNewDeviceApiKey({ + String? operationName, + required Variables$Mutation$AuthorizeWithNewDeviceApiKey variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationAuthorizeWithNewDeviceApiKey, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$AuthorizeWithNewDeviceApiKey, + ); } extension ClientExtension$Mutation$AuthorizeWithNewDeviceApiKey @@ -7762,21 +11748,32 @@ extension ClientExtension$Mutation$AuthorizeWithNewDeviceApiKey this.watchMutation(options); } -@JsonSerializable(explicitToJson: true) class Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey - implements Fragment$basicMutationReturnFields { - Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey( - {required this.code, - required this.message, - required this.success, - required this.$__typename, - this.token}); + implements + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn { + Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + this.token, + }); - @override factory Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey.fromJson( - Map json) => - _$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKeyFromJson( - json); + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + final l$token = json['token']; + return Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + token: (l$token as String?), + ); + } final int code; @@ -7784,45 +11781,76 @@ class Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey final bool success; - @JsonKey(name: '__typename') final String $__typename; final String? token; - Map toJson() => - _$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKeyToJson( - this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + final l$token = token; + _resultData['token'] = l$token; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; final l$token = token; - return Object.hashAll( - [l$code, l$message, l$success, l$$__typename, l$token]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + l$token, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } final l$token = token; final lOther$token = other.token; - if (l$token != lOther$token) return false; + if (l$token != lOther$token) { + return false; + } return true; } } @@ -7833,29 +11861,31 @@ extension UtilityExtension$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNe Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey> get copyWith => CopyWith$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey( - this, (i) => i); + this, + (i) => i, + ); } abstract class CopyWith$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey< TRes> { factory CopyWith$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey( - Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey - instance, - TRes Function( - Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey) - then) = - _CopyWithImpl$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey; + Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey instance, + TRes Function( + Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey) + then, + ) = _CopyWithImpl$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey; factory CopyWith$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey.stub( TRes res) = _CopyWithStubImpl$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey; - TRes call( - {int? code, - String? message, - bool? success, - String? $__typename, - String? token}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + String? token, + }); } class _CopyWithImpl$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey< @@ -7864,7 +11894,9 @@ class _CopyWithImpl$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDevice CopyWith$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey< TRes> { _CopyWithImpl$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey( - this._instance, this._then); + this._instance, + this._then, + ); final Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey _instance; @@ -7874,26 +11906,27 @@ class _CopyWithImpl$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDevice static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined, - Object? token = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + Object? token = _undefined, + }) => _then(Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String), - token: token == _undefined ? _instance.token : (token as String?))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + token: token == _undefined ? _instance.token : (token as String?), + )); } class _CopyWithStubImpl$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey< @@ -7906,16 +11939,12 @@ class _CopyWithStubImpl$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDe TRes _res; - call( - {int? code, - String? message, - bool? success, - String? $__typename, - String? token}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + String? token, + }) => _res; } - -DateTime? _nullable$dateTimeFromJson(dynamic data) => - data == null ? null : dateTimeFromJson(data); -dynamic _nullable$dateTimeToJson(DateTime? data) => - data == null ? null : dateTimeToJson(data); diff --git a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.g.dart b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.g.dart deleted file mode 100644 index 0d658310..00000000 --- a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.g.dart +++ /dev/null @@ -1,849 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'server_api.graphql.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -Fragment$basicMutationReturnFields _$Fragment$basicMutationReturnFieldsFromJson( - Map json) => - Fragment$basicMutationReturnFields( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Fragment$basicMutationReturnFieldsToJson( - Fragment$basicMutationReturnFields instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - }; - -Query$GetApiVersion _$Query$GetApiVersionFromJson(Map json) => - Query$GetApiVersion( - api: - Query$GetApiVersion$api.fromJson(json['api'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Query$GetApiVersionToJson( - Query$GetApiVersion instance) => - { - 'api': instance.api.toJson(), - '__typename': instance.$__typename, - }; - -Query$GetApiVersion$api _$Query$GetApiVersion$apiFromJson( - Map json) => - Query$GetApiVersion$api( - version: json['version'] as String, - $__typename: json['__typename'] as String, - ); - -Map _$Query$GetApiVersion$apiToJson( - Query$GetApiVersion$api instance) => - { - 'version': instance.version, - '__typename': instance.$__typename, - }; - -Query$GetApiJobs _$Query$GetApiJobsFromJson(Map json) => - Query$GetApiJobs( - jobs: - Query$GetApiJobs$jobs.fromJson(json['jobs'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Query$GetApiJobsToJson(Query$GetApiJobs instance) => - { - 'jobs': instance.jobs.toJson(), - '__typename': instance.$__typename, - }; - -Query$GetApiJobs$jobs _$Query$GetApiJobs$jobsFromJson( - Map json) => - Query$GetApiJobs$jobs( - getJobs: (json['getJobs'] as List) - .map((e) => - Query$GetApiJobs$jobs$getJobs.fromJson(e as Map)) - .toList(), - $__typename: json['__typename'] as String, - ); - -Map _$Query$GetApiJobs$jobsToJson( - Query$GetApiJobs$jobs instance) => - { - 'getJobs': instance.getJobs.map((e) => e.toJson()).toList(), - '__typename': instance.$__typename, - }; - -Query$GetApiJobs$jobs$getJobs _$Query$GetApiJobs$jobs$getJobsFromJson( - Map json) => - Query$GetApiJobs$jobs$getJobs( - createdAt: dateTimeFromJson(json['createdAt']), - description: json['description'] as String, - error: json['error'] as String?, - finishedAt: _nullable$dateTimeFromJson(json['finishedAt']), - name: json['name'] as String, - progress: json['progress'] as int?, - result: json['result'] as String?, - status: json['status'] as String, - statusText: json['statusText'] as String?, - uid: json['uid'] as String, - updatedAt: dateTimeFromJson(json['updatedAt']), - $__typename: json['__typename'] as String, - ); - -Map _$Query$GetApiJobs$jobs$getJobsToJson( - Query$GetApiJobs$jobs$getJobs instance) => - { - 'createdAt': dateTimeToJson(instance.createdAt), - 'description': instance.description, - 'error': instance.error, - 'finishedAt': _nullable$dateTimeToJson(instance.finishedAt), - 'name': instance.name, - 'progress': instance.progress, - 'result': instance.result, - 'status': instance.status, - 'statusText': instance.statusText, - 'uid': instance.uid, - 'updatedAt': dateTimeToJson(instance.updatedAt), - '__typename': instance.$__typename, - }; - -Variables$Mutation$RemoveJob _$Variables$Mutation$RemoveJobFromJson( - Map json) => - Variables$Mutation$RemoveJob( - jobId: json['jobId'] as String, - ); - -Map _$Variables$Mutation$RemoveJobToJson( - Variables$Mutation$RemoveJob instance) => - { - 'jobId': instance.jobId, - }; - -Mutation$RemoveJob _$Mutation$RemoveJobFromJson(Map json) => - Mutation$RemoveJob( - removeJob: Mutation$RemoveJob$removeJob.fromJson( - json['removeJob'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$RemoveJobToJson(Mutation$RemoveJob instance) => - { - 'removeJob': instance.removeJob.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$RemoveJob$removeJob _$Mutation$RemoveJob$removeJobFromJson( - Map json) => - Mutation$RemoveJob$removeJob( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$RemoveJob$removeJobToJson( - Mutation$RemoveJob$removeJob instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - }; - -Mutation$RunSystemRebuild _$Mutation$RunSystemRebuildFromJson( - Map json) => - Mutation$RunSystemRebuild( - runSystemRebuild: Mutation$RunSystemRebuild$runSystemRebuild.fromJson( - json['runSystemRebuild'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$RunSystemRebuildToJson( - Mutation$RunSystemRebuild instance) => - { - 'runSystemRebuild': instance.runSystemRebuild.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$RunSystemRebuild$runSystemRebuild - _$Mutation$RunSystemRebuild$runSystemRebuildFromJson( - Map json) => - Mutation$RunSystemRebuild$runSystemRebuild( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$RunSystemRebuild$runSystemRebuildToJson( - Mutation$RunSystemRebuild$runSystemRebuild instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - }; - -Mutation$RunSystemRollback _$Mutation$RunSystemRollbackFromJson( - Map json) => - Mutation$RunSystemRollback( - runSystemRollback: Mutation$RunSystemRollback$runSystemRollback.fromJson( - json['runSystemRollback'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$RunSystemRollbackToJson( - Mutation$RunSystemRollback instance) => - { - 'runSystemRollback': instance.runSystemRollback.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$RunSystemRollback$runSystemRollback - _$Mutation$RunSystemRollback$runSystemRollbackFromJson( - Map json) => - Mutation$RunSystemRollback$runSystemRollback( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$RunSystemRollback$runSystemRollbackToJson( - Mutation$RunSystemRollback$runSystemRollback instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - }; - -Mutation$RunSystemUpgrade _$Mutation$RunSystemUpgradeFromJson( - Map json) => - Mutation$RunSystemUpgrade( - runSystemUpgrade: Mutation$RunSystemUpgrade$runSystemUpgrade.fromJson( - json['runSystemUpgrade'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$RunSystemUpgradeToJson( - Mutation$RunSystemUpgrade instance) => - { - 'runSystemUpgrade': instance.runSystemUpgrade.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$RunSystemUpgrade$runSystemUpgrade - _$Mutation$RunSystemUpgrade$runSystemUpgradeFromJson( - Map json) => - Mutation$RunSystemUpgrade$runSystemUpgrade( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$RunSystemUpgrade$runSystemUpgradeToJson( - Mutation$RunSystemUpgrade$runSystemUpgrade instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - }; - -Mutation$PullRepositoryChanges _$Mutation$PullRepositoryChangesFromJson( - Map json) => - Mutation$PullRepositoryChanges( - pullRepositoryChanges: - Mutation$PullRepositoryChanges$pullRepositoryChanges.fromJson( - json['pullRepositoryChanges'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$PullRepositoryChangesToJson( - Mutation$PullRepositoryChanges instance) => - { - 'pullRepositoryChanges': instance.pullRepositoryChanges.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$PullRepositoryChanges$pullRepositoryChanges - _$Mutation$PullRepositoryChanges$pullRepositoryChangesFromJson( - Map json) => - Mutation$PullRepositoryChanges$pullRepositoryChanges( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); - -Map - _$Mutation$PullRepositoryChanges$pullRepositoryChangesToJson( - Mutation$PullRepositoryChanges$pullRepositoryChanges instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - }; - -Mutation$RebootSystem _$Mutation$RebootSystemFromJson( - Map json) => - Mutation$RebootSystem( - rebootSystem: Mutation$RebootSystem$rebootSystem.fromJson( - json['rebootSystem'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$RebootSystemToJson( - Mutation$RebootSystem instance) => - { - 'rebootSystem': instance.rebootSystem.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$RebootSystem$rebootSystem _$Mutation$RebootSystem$rebootSystemFromJson( - Map json) => - Mutation$RebootSystem$rebootSystem( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$RebootSystem$rebootSystemToJson( - Mutation$RebootSystem$rebootSystem instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - }; - -Query$SystemServerProvider _$Query$SystemServerProviderFromJson( - Map json) => - Query$SystemServerProvider( - system: Query$SystemServerProvider$system.fromJson( - json['system'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Query$SystemServerProviderToJson( - Query$SystemServerProvider instance) => - { - 'system': instance.system.toJson(), - '__typename': instance.$__typename, - }; - -Query$SystemServerProvider$system _$Query$SystemServerProvider$systemFromJson( - Map json) => - Query$SystemServerProvider$system( - provider: Query$SystemServerProvider$system$provider.fromJson( - json['provider'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Query$SystemServerProvider$systemToJson( - Query$SystemServerProvider$system instance) => - { - 'provider': instance.provider.toJson(), - '__typename': instance.$__typename, - }; - -Query$SystemServerProvider$system$provider - _$Query$SystemServerProvider$system$providerFromJson( - Map json) => - Query$SystemServerProvider$system$provider( - provider: $enumDecode(_$Enum$ServerProviderEnumMap, json['provider'], - unknownValue: Enum$ServerProvider.$unknown), - $__typename: json['__typename'] as String, - ); - -Map _$Query$SystemServerProvider$system$providerToJson( - Query$SystemServerProvider$system$provider instance) => - { - 'provider': _$Enum$ServerProviderEnumMap[instance.provider]!, - '__typename': instance.$__typename, - }; - -const _$Enum$ServerProviderEnumMap = { - Enum$ServerProvider.HETZNER: 'HETZNER', - Enum$ServerProvider.DIGITALOCEAN: 'DIGITALOCEAN', - Enum$ServerProvider.$unknown: r'$unknown', -}; - -Query$SystemDnsProvider _$Query$SystemDnsProviderFromJson( - Map json) => - Query$SystemDnsProvider( - system: Query$SystemDnsProvider$system.fromJson( - json['system'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Query$SystemDnsProviderToJson( - Query$SystemDnsProvider instance) => - { - 'system': instance.system.toJson(), - '__typename': instance.$__typename, - }; - -Query$SystemDnsProvider$system _$Query$SystemDnsProvider$systemFromJson( - Map json) => - Query$SystemDnsProvider$system( - domainInfo: Query$SystemDnsProvider$system$domainInfo.fromJson( - json['domainInfo'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Query$SystemDnsProvider$systemToJson( - Query$SystemDnsProvider$system instance) => - { - 'domainInfo': instance.domainInfo.toJson(), - '__typename': instance.$__typename, - }; - -Query$SystemDnsProvider$system$domainInfo - _$Query$SystemDnsProvider$system$domainInfoFromJson( - Map json) => - Query$SystemDnsProvider$system$domainInfo( - provider: $enumDecode(_$Enum$DnsProviderEnumMap, json['provider'], - unknownValue: Enum$DnsProvider.$unknown), - $__typename: json['__typename'] as String, - ); - -Map _$Query$SystemDnsProvider$system$domainInfoToJson( - Query$SystemDnsProvider$system$domainInfo instance) => - { - 'provider': _$Enum$DnsProviderEnumMap[instance.provider]!, - '__typename': instance.$__typename, - }; - -const _$Enum$DnsProviderEnumMap = { - Enum$DnsProvider.CLOUDFLARE: 'CLOUDFLARE', - Enum$DnsProvider.DIGITALOCEAN: 'DIGITALOCEAN', - Enum$DnsProvider.$unknown: r'$unknown', -}; - -Query$GetApiTokens _$Query$GetApiTokensFromJson(Map json) => - Query$GetApiTokens( - api: Query$GetApiTokens$api.fromJson(json['api'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Query$GetApiTokensToJson(Query$GetApiTokens instance) => - { - 'api': instance.api.toJson(), - '__typename': instance.$__typename, - }; - -Query$GetApiTokens$api _$Query$GetApiTokens$apiFromJson( - Map json) => - Query$GetApiTokens$api( - devices: (json['devices'] as List) - .map((e) => Query$GetApiTokens$api$devices.fromJson( - e as Map)) - .toList(), - $__typename: json['__typename'] as String, - ); - -Map _$Query$GetApiTokens$apiToJson( - Query$GetApiTokens$api instance) => - { - 'devices': instance.devices.map((e) => e.toJson()).toList(), - '__typename': instance.$__typename, - }; - -Query$GetApiTokens$api$devices _$Query$GetApiTokens$api$devicesFromJson( - Map json) => - Query$GetApiTokens$api$devices( - creationDate: dateTimeFromJson(json['creationDate']), - isCaller: json['isCaller'] as bool, - name: json['name'] as String, - $__typename: json['__typename'] as String, - ); - -Map _$Query$GetApiTokens$api$devicesToJson( - Query$GetApiTokens$api$devices instance) => - { - 'creationDate': dateTimeToJson(instance.creationDate), - 'isCaller': instance.isCaller, - 'name': instance.name, - '__typename': instance.$__typename, - }; - -Query$RecoveryKey _$Query$RecoveryKeyFromJson(Map json) => - Query$RecoveryKey( - api: Query$RecoveryKey$api.fromJson(json['api'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Query$RecoveryKeyToJson(Query$RecoveryKey instance) => - { - 'api': instance.api.toJson(), - '__typename': instance.$__typename, - }; - -Query$RecoveryKey$api _$Query$RecoveryKey$apiFromJson( - Map json) => - Query$RecoveryKey$api( - recoveryKey: Query$RecoveryKey$api$recoveryKey.fromJson( - json['recoveryKey'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Query$RecoveryKey$apiToJson( - Query$RecoveryKey$api instance) => - { - 'recoveryKey': instance.recoveryKey.toJson(), - '__typename': instance.$__typename, - }; - -Query$RecoveryKey$api$recoveryKey _$Query$RecoveryKey$api$recoveryKeyFromJson( - Map json) => - Query$RecoveryKey$api$recoveryKey( - creationDate: _nullable$dateTimeFromJson(json['creationDate']), - exists: json['exists'] as bool, - expirationDate: _nullable$dateTimeFromJson(json['expirationDate']), - usesLeft: json['usesLeft'] as int?, - valid: json['valid'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Query$RecoveryKey$api$recoveryKeyToJson( - Query$RecoveryKey$api$recoveryKey instance) => - { - 'creationDate': _nullable$dateTimeToJson(instance.creationDate), - 'exists': instance.exists, - 'expirationDate': _nullable$dateTimeToJson(instance.expirationDate), - 'usesLeft': instance.usesLeft, - 'valid': instance.valid, - '__typename': instance.$__typename, - }; - -Variables$Mutation$GetNewRecoveryApiKey - _$Variables$Mutation$GetNewRecoveryApiKeyFromJson( - Map json) => - Variables$Mutation$GetNewRecoveryApiKey( - limits: json['limits'] == null - ? null - : Input$RecoveryKeyLimitsInput.fromJson( - json['limits'] as Map), - ); - -Map _$Variables$Mutation$GetNewRecoveryApiKeyToJson( - Variables$Mutation$GetNewRecoveryApiKey instance) => - { - 'limits': instance.limits?.toJson(), - }; - -Mutation$GetNewRecoveryApiKey _$Mutation$GetNewRecoveryApiKeyFromJson( - Map json) => - Mutation$GetNewRecoveryApiKey( - getNewRecoveryApiKey: - Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey.fromJson( - json['getNewRecoveryApiKey'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$GetNewRecoveryApiKeyToJson( - Mutation$GetNewRecoveryApiKey instance) => - { - 'getNewRecoveryApiKey': instance.getNewRecoveryApiKey.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey - _$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKeyFromJson( - Map json) => - Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - key: json['key'] as String?, - ); - -Map _$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKeyToJson( - Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - 'key': instance.key, - }; - -Variables$Mutation$UseRecoveryApiKey - _$Variables$Mutation$UseRecoveryApiKeyFromJson(Map json) => - Variables$Mutation$UseRecoveryApiKey( - input: Input$UseRecoveryKeyInput.fromJson( - json['input'] as Map), - ); - -Map _$Variables$Mutation$UseRecoveryApiKeyToJson( - Variables$Mutation$UseRecoveryApiKey instance) => - { - 'input': instance.input.toJson(), - }; - -Mutation$UseRecoveryApiKey _$Mutation$UseRecoveryApiKeyFromJson( - Map json) => - Mutation$UseRecoveryApiKey( - useRecoveryApiKey: Mutation$UseRecoveryApiKey$useRecoveryApiKey.fromJson( - json['useRecoveryApiKey'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$UseRecoveryApiKeyToJson( - Mutation$UseRecoveryApiKey instance) => - { - 'useRecoveryApiKey': instance.useRecoveryApiKey.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$UseRecoveryApiKey$useRecoveryApiKey - _$Mutation$UseRecoveryApiKey$useRecoveryApiKeyFromJson( - Map json) => - Mutation$UseRecoveryApiKey$useRecoveryApiKey( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - token: json['token'] as String?, - ); - -Map _$Mutation$UseRecoveryApiKey$useRecoveryApiKeyToJson( - Mutation$UseRecoveryApiKey$useRecoveryApiKey instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - 'token': instance.token, - }; - -Mutation$RefreshDeviceApiToken _$Mutation$RefreshDeviceApiTokenFromJson( - Map json) => - Mutation$RefreshDeviceApiToken( - refreshDeviceApiToken: - Mutation$RefreshDeviceApiToken$refreshDeviceApiToken.fromJson( - json['refreshDeviceApiToken'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$RefreshDeviceApiTokenToJson( - Mutation$RefreshDeviceApiToken instance) => - { - 'refreshDeviceApiToken': instance.refreshDeviceApiToken.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$RefreshDeviceApiToken$refreshDeviceApiToken - _$Mutation$RefreshDeviceApiToken$refreshDeviceApiTokenFromJson( - Map json) => - Mutation$RefreshDeviceApiToken$refreshDeviceApiToken( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - token: json['token'] as String?, - ); - -Map - _$Mutation$RefreshDeviceApiToken$refreshDeviceApiTokenToJson( - Mutation$RefreshDeviceApiToken$refreshDeviceApiToken instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - 'token': instance.token, - }; - -Variables$Mutation$DeleteDeviceApiToken - _$Variables$Mutation$DeleteDeviceApiTokenFromJson( - Map json) => - Variables$Mutation$DeleteDeviceApiToken( - device: json['device'] as String, - ); - -Map _$Variables$Mutation$DeleteDeviceApiTokenToJson( - Variables$Mutation$DeleteDeviceApiToken instance) => - { - 'device': instance.device, - }; - -Mutation$DeleteDeviceApiToken _$Mutation$DeleteDeviceApiTokenFromJson( - Map json) => - Mutation$DeleteDeviceApiToken( - deleteDeviceApiToken: - Mutation$DeleteDeviceApiToken$deleteDeviceApiToken.fromJson( - json['deleteDeviceApiToken'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$DeleteDeviceApiTokenToJson( - Mutation$DeleteDeviceApiToken instance) => - { - 'deleteDeviceApiToken': instance.deleteDeviceApiToken.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$DeleteDeviceApiToken$deleteDeviceApiToken - _$Mutation$DeleteDeviceApiToken$deleteDeviceApiTokenFromJson( - Map json) => - Mutation$DeleteDeviceApiToken$deleteDeviceApiToken( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$DeleteDeviceApiToken$deleteDeviceApiTokenToJson( - Mutation$DeleteDeviceApiToken$deleteDeviceApiToken instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - }; - -Mutation$GetNewDeviceApiKey _$Mutation$GetNewDeviceApiKeyFromJson( - Map json) => - Mutation$GetNewDeviceApiKey( - getNewDeviceApiKey: - Mutation$GetNewDeviceApiKey$getNewDeviceApiKey.fromJson( - json['getNewDeviceApiKey'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$GetNewDeviceApiKeyToJson( - Mutation$GetNewDeviceApiKey instance) => - { - 'getNewDeviceApiKey': instance.getNewDeviceApiKey.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$GetNewDeviceApiKey$getNewDeviceApiKey - _$Mutation$GetNewDeviceApiKey$getNewDeviceApiKeyFromJson( - Map json) => - Mutation$GetNewDeviceApiKey$getNewDeviceApiKey( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - key: json['key'] as String?, - ); - -Map _$Mutation$GetNewDeviceApiKey$getNewDeviceApiKeyToJson( - Mutation$GetNewDeviceApiKey$getNewDeviceApiKey instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - 'key': instance.key, - }; - -Mutation$InvalidateNewDeviceApiKey _$Mutation$InvalidateNewDeviceApiKeyFromJson( - Map json) => - Mutation$InvalidateNewDeviceApiKey( - invalidateNewDeviceApiKey: - Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey.fromJson( - json['invalidateNewDeviceApiKey'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$InvalidateNewDeviceApiKeyToJson( - Mutation$InvalidateNewDeviceApiKey instance) => - { - 'invalidateNewDeviceApiKey': instance.invalidateNewDeviceApiKey.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey - _$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKeyFromJson( - Map json) => - Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); - -Map - _$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKeyToJson( - Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey - instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - }; - -Variables$Mutation$AuthorizeWithNewDeviceApiKey - _$Variables$Mutation$AuthorizeWithNewDeviceApiKeyFromJson( - Map json) => - Variables$Mutation$AuthorizeWithNewDeviceApiKey( - input: Input$UseNewDeviceKeyInput.fromJson( - json['input'] as Map), - ); - -Map _$Variables$Mutation$AuthorizeWithNewDeviceApiKeyToJson( - Variables$Mutation$AuthorizeWithNewDeviceApiKey instance) => - { - 'input': instance.input.toJson(), - }; - -Mutation$AuthorizeWithNewDeviceApiKey - _$Mutation$AuthorizeWithNewDeviceApiKeyFromJson( - Map json) => - Mutation$AuthorizeWithNewDeviceApiKey( - authorizeWithNewDeviceApiKey: - Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey - .fromJson(json['authorizeWithNewDeviceApiKey'] - as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$AuthorizeWithNewDeviceApiKeyToJson( - Mutation$AuthorizeWithNewDeviceApiKey instance) => - { - 'authorizeWithNewDeviceApiKey': - instance.authorizeWithNewDeviceApiKey.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey - _$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKeyFromJson( - Map json) => - Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - token: json['token'] as String?, - ); - -Map - _$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKeyToJson( - Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey - instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - 'token': instance.token, - }; diff --git a/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart index 5d036afa..8da4e347 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart @@ -1,23 +1,69 @@ import 'dart:async'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; -import 'package:json_annotation/json_annotation.dart'; import 'schema.graphql.dart'; import 'services.graphql.dart'; -part 'server_settings.graphql.g.dart'; -@JsonSerializable(explicitToJson: true) class Fragment$basicMutationReturnFields { - Fragment$basicMutationReturnFields( - {required this.code, - required this.message, - required this.success, - required this.$__typename}); + Fragment$basicMutationReturnFields({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override factory Fragment$basicMutationReturnFields.fromJson( - Map json) => - _$Fragment$basicMutationReturnFieldsFromJson(json); + Map json) { + switch (json["__typename"] as String) { + case "ApiKeyMutationReturn": + return Fragment$basicMutationReturnFields$$ApiKeyMutationReturn + .fromJson(json); + + case "AutoUpgradeSettingsMutationReturn": + return Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + .fromJson(json); + + case "DeviceApiTokenMutationReturn": + return Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn + .fromJson(json); + + case "GenericJobButationReturn": + return Fragment$basicMutationReturnFields$$GenericJobButationReturn + .fromJson(json); + + case "GenericMutationReturn": + return Fragment$basicMutationReturnFields$$GenericMutationReturn + .fromJson(json); + + case "ServiceJobMutationReturn": + return Fragment$basicMutationReturnFields$$ServiceJobMutationReturn + .fromJson(json); + + case "ServiceMutationReturn": + return Fragment$basicMutationReturnFields$$ServiceMutationReturn + .fromJson(json); + + case "TimezoneMutationReturn": + return Fragment$basicMutationReturnFields$$TimezoneMutationReturn + .fromJson(json); + + case "UserMutationReturn": + return Fragment$basicMutationReturnFields$$UserMutationReturn.fromJson( + json); + + default: + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + } final int code; @@ -25,36 +71,64 @@ class Fragment$basicMutationReturnFields { final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Fragment$basicMutationReturnFieldsToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; - return Object.hashAll([l$code, l$message, l$success, l$$__typename]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Fragment$basicMutationReturnFields) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -63,25 +137,35 @@ extension UtilityExtension$Fragment$basicMutationReturnFields on Fragment$basicMutationReturnFields { CopyWith$Fragment$basicMutationReturnFields< Fragment$basicMutationReturnFields> - get copyWith => - CopyWith$Fragment$basicMutationReturnFields(this, (i) => i); + get copyWith => CopyWith$Fragment$basicMutationReturnFields( + this, + (i) => i, + ); } abstract class CopyWith$Fragment$basicMutationReturnFields { factory CopyWith$Fragment$basicMutationReturnFields( - Fragment$basicMutationReturnFields instance, - TRes Function(Fragment$basicMutationReturnFields) then) = - _CopyWithImpl$Fragment$basicMutationReturnFields; + Fragment$basicMutationReturnFields instance, + TRes Function(Fragment$basicMutationReturnFields) then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields; factory CopyWith$Fragment$basicMutationReturnFields.stub(TRes res) = _CopyWithStubImpl$Fragment$basicMutationReturnFields; - TRes call({int? code, String? message, bool? success, String? $__typename}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); } class _CopyWithImpl$Fragment$basicMutationReturnFields implements CopyWith$Fragment$basicMutationReturnFields { - _CopyWithImpl$Fragment$basicMutationReturnFields(this._instance, this._then); + _CopyWithImpl$Fragment$basicMutationReturnFields( + this._instance, + this._then, + ); final Fragment$basicMutationReturnFields _instance; @@ -89,24 +173,25 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => _then(Fragment$basicMutationReturnFields( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Fragment$basicMutationReturnFields @@ -115,43 +200,54 @@ class _CopyWithStubImpl$Fragment$basicMutationReturnFields TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => _res; } const fragmentDefinitionbasicMutationReturnFields = FragmentDefinitionNode( - name: NameNode(value: 'basicMutationReturnFields'), - typeCondition: TypeConditionNode( - on: NamedTypeNode( - name: NameNode(value: 'MutationReturnInterface'), - isNonNull: false)), - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'code'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'message'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'success'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])); + name: NameNode(value: 'basicMutationReturnFields'), + typeCondition: TypeConditionNode( + on: NamedTypeNode( + name: NameNode(value: 'MutationReturnInterface'), + isNonNull: false, + )), + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'code'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'message'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'success'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), +); const documentNodeFragmentbasicMutationReturnFields = DocumentNode(definitions: [ fragmentDefinitionbasicMutationReturnFields, @@ -159,88 +255,1752 @@ const documentNodeFragmentbasicMutationReturnFields = extension ClientExtension$Fragment$basicMutationReturnFields on graphql.GraphQLClient { - void writeFragment$basicMutationReturnFields( - {required Fragment$basicMutationReturnFields data, - required Map idFields, - bool broadcast = true}) => + void writeFragment$basicMutationReturnFields({ + required Fragment$basicMutationReturnFields data, + required Map idFields, + bool broadcast = true, + }) => this.writeFragment( - graphql.FragmentRequest( - idFields: idFields, - fragment: const graphql.Fragment( - fragmentName: 'basicMutationReturnFields', - document: documentNodeFragmentbasicMutationReturnFields)), - data: data.toJson(), - broadcast: broadcast); - Fragment$basicMutationReturnFields? readFragment$basicMutationReturnFields( - {required Map idFields, bool optimistic = true}) { - final result = this.readFragment( graphql.FragmentRequest( - idFields: idFields, - fragment: const graphql.Fragment( - fragmentName: 'basicMutationReturnFields', - document: documentNodeFragmentbasicMutationReturnFields)), - optimistic: optimistic); + idFields: idFields, + fragment: const graphql.Fragment( + fragmentName: 'basicMutationReturnFields', + document: documentNodeFragmentbasicMutationReturnFields, + ), + ), + data: data.toJson(), + broadcast: broadcast, + ); + Fragment$basicMutationReturnFields? readFragment$basicMutationReturnFields({ + required Map idFields, + bool optimistic = true, + }) { + final result = this.readFragment( + graphql.FragmentRequest( + idFields: idFields, + fragment: const graphql.Fragment( + fragmentName: 'basicMutationReturnFields', + document: documentNodeFragmentbasicMutationReturnFields, + ), + ), + optimistic: optimistic, + ); return result == null ? null : Fragment$basicMutationReturnFields.fromJson(result); } } -@JsonSerializable(explicitToJson: true) -class Query$SystemSettings { - Query$SystemSettings({required this.system, required this.$__typename}); +class Fragment$basicMutationReturnFields$$ApiKeyMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$ApiKeyMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override - factory Query$SystemSettings.fromJson(Map json) => - _$Query$SystemSettingsFromJson(json); + factory Fragment$basicMutationReturnFields$$ApiKeyMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } - final Query$SystemSettings$system system; + final int code; + + final String message; + + final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$SystemSettingsToJson(this); - int get hashCode { - final l$system = system; + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; final l$$__typename = $__typename; - return Object.hashAll([l$system, l$$__typename]); + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Query$SystemSettings) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) || + runtimeType != other.runtimeType) { return false; - final l$system = system; - final lOther$system = other.system; - if (l$system != lOther$system) return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn + on Fragment$basicMutationReturnFields$$ApiKeyMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + Fragment$basicMutationReturnFields$$ApiKeyMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + Fragment$basicMutationReturnFields$$ApiKeyMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$ApiKeyMutationReturn _instance; + + final TRes Function(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + on Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + instance, + TRes Function( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn + on Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn instance, + TRes Function( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn + _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$GenericJobButationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$GenericJobButationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$GenericJobButationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$GenericJobButationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$GenericJobButationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$GenericJobButationReturn + on Fragment$basicMutationReturnFields$$GenericJobButationReturn { + CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + Fragment$basicMutationReturnFields$$GenericJobButationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn( + Fragment$basicMutationReturnFields$$GenericJobButationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$GenericJobButationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$GenericJobButationReturn _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$GenericJobButationReturn) _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$GenericJobButationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$GenericMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$GenericMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$GenericMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$GenericMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Fragment$basicMutationReturnFields$$GenericMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$GenericMutationReturn + on Fragment$basicMutationReturnFields$$GenericMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn< + Fragment$basicMutationReturnFields$$GenericMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn( + Fragment$basicMutationReturnFields$$GenericMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$GenericMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$GenericMutationReturn _instance; + + final TRes Function(Fragment$basicMutationReturnFields$$GenericMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$GenericMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$ServiceJobMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$ServiceJobMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn + on Fragment$basicMutationReturnFields$$ServiceJobMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$ServiceJobMutationReturn _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$ServiceMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$ServiceMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$ServiceMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$ServiceMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Fragment$basicMutationReturnFields$$ServiceMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$ServiceMutationReturn + on Fragment$basicMutationReturnFields$$ServiceMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + Fragment$basicMutationReturnFields$$ServiceMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn( + Fragment$basicMutationReturnFields$$ServiceMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$ServiceMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$ServiceMutationReturn _instance; + + final TRes Function(Fragment$basicMutationReturnFields$$ServiceMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$ServiceMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$TimezoneMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$TimezoneMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$TimezoneMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$TimezoneMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$TimezoneMutationReturn + on Fragment$basicMutationReturnFields$$TimezoneMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + Fragment$basicMutationReturnFields$$TimezoneMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + Fragment$basicMutationReturnFields$$TimezoneMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$TimezoneMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$TimezoneMutationReturn _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$TimezoneMutationReturn) _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$UserMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$UserMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$UserMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$UserMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Fragment$basicMutationReturnFields$$UserMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$UserMutationReturn + on Fragment$basicMutationReturnFields$$UserMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn< + Fragment$basicMutationReturnFields$$UserMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn( + Fragment$basicMutationReturnFields$$UserMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$UserMutationReturn) then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$UserMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$UserMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$UserMutationReturn + implements + CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn { + _CopyWithImpl$Fragment$basicMutationReturnFields$$UserMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$UserMutationReturn _instance; + + final TRes Function(Fragment$basicMutationReturnFields$$UserMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$UserMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$UserMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$UserMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Query$SystemSettings { + Query$SystemSettings({ + required this.system, + required this.$__typename, + }); + + factory Query$SystemSettings.fromJson(Map json) { + final l$system = json['system']; + final l$$__typename = json['__typename']; + return Query$SystemSettings( + system: Query$SystemSettings$system.fromJson( + (l$system as Map)), + $__typename: (l$$__typename as String), + ); + } + + final Query$SystemSettings$system system; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$system = system; + _resultData['system'] = l$system.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$system = system; + final l$$__typename = $__typename; + return Object.hashAll([ + l$system, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Query$SystemSettings) || runtimeType != other.runtimeType) { + return false; + } + final l$system = system; + final lOther$system = other.system; + if (l$system != lOther$system) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Query$SystemSettings on Query$SystemSettings { CopyWith$Query$SystemSettings get copyWith => - CopyWith$Query$SystemSettings(this, (i) => i); + CopyWith$Query$SystemSettings( + this, + (i) => i, + ); } abstract class CopyWith$Query$SystemSettings { - factory CopyWith$Query$SystemSettings(Query$SystemSettings instance, - TRes Function(Query$SystemSettings) then) = - _CopyWithImpl$Query$SystemSettings; + factory CopyWith$Query$SystemSettings( + Query$SystemSettings instance, + TRes Function(Query$SystemSettings) then, + ) = _CopyWithImpl$Query$SystemSettings; factory CopyWith$Query$SystemSettings.stub(TRes res) = _CopyWithStubImpl$Query$SystemSettings; - TRes call({Query$SystemSettings$system? system, String? $__typename}); + TRes call({ + Query$SystemSettings$system? system, + String? $__typename, + }); CopyWith$Query$SystemSettings$system get system; } class _CopyWithImpl$Query$SystemSettings implements CopyWith$Query$SystemSettings { - _CopyWithImpl$Query$SystemSettings(this._instance, this._then); + _CopyWithImpl$Query$SystemSettings( + this._instance, + this._then, + ); final Query$SystemSettings _instance; @@ -248,14 +2008,18 @@ class _CopyWithImpl$Query$SystemSettings static const _undefined = {}; - TRes call({Object? system = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? system = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$SystemSettings( - system: system == _undefined || system == null - ? _instance.system - : (system as Query$SystemSettings$system), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + system: system == _undefined || system == null + ? _instance.system + : (system as Query$SystemSettings$system), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Query$SystemSettings$system get system { final local$system = _instance.system; return CopyWith$Query$SystemSettings$system( @@ -269,107 +2033,126 @@ class _CopyWithStubImpl$Query$SystemSettings TRes _res; - call({Query$SystemSettings$system? system, String? $__typename}) => _res; + call({ + Query$SystemSettings$system? system, + String? $__typename, + }) => + _res; CopyWith$Query$SystemSettings$system get system => CopyWith$Query$SystemSettings$system.stub(_res); } const documentNodeQuerySystemSettings = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'SystemSettings'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'system'), + type: OperationType.query, + name: NameNode(value: 'SystemSettings'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'system'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'settings'), alias: null, arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ FieldNode( - name: NameNode(value: 'settings'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'autoUpgrade'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'allowReboot'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'enable'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( - name: NameNode(value: 'ssh'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'enable'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'passwordAuthentication'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( - name: NameNode(value: 'timezone'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), + name: NameNode(value: 'autoUpgrade'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'allowReboot'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'enable'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + name: NameNode(value: 'ssh'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'enable'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'passwordAuthentication'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: 'timezone'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), ]); Query$SystemSettings _parserFn$Query$SystemSettings( Map data) => @@ -377,60 +2160,63 @@ Query$SystemSettings _parserFn$Query$SystemSettings( class Options$Query$SystemSettings extends graphql.QueryOptions { - Options$Query$SystemSettings( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - Duration? pollInterval, - graphql.Context? context}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - pollInterval: pollInterval, - context: context, - document: documentNodeQuerySystemSettings, - parserFn: _parserFn$Query$SystemSettings); + Options$Query$SystemSettings({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Duration? pollInterval, + graphql.Context? context, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + pollInterval: pollInterval, + context: context, + document: documentNodeQuerySystemSettings, + parserFn: _parserFn$Query$SystemSettings, + ); } class WatchOptions$Query$SystemSettings extends graphql.WatchQueryOptions { - WatchOptions$Query$SystemSettings( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeQuerySystemSettings, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Query$SystemSettings); + WatchOptions$Query$SystemSettings({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeQuerySystemSettings, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Query$SystemSettings, + ); } class FetchMoreOptions$Query$SystemSettings extends graphql.FetchMoreOptions { FetchMoreOptions$Query$SystemSettings( {required graphql.UpdateQuery updateQuery}) : super( - updateQuery: updateQuery, - document: documentNodeQuerySystemSettings); + updateQuery: updateQuery, + document: documentNodeQuerySystemSettings, + ); } extension ClientExtension$Query$SystemSettings on graphql.GraphQLClient { @@ -440,56 +2226,86 @@ extension ClientExtension$Query$SystemSettings on graphql.GraphQLClient { graphql.ObservableQuery watchQuery$SystemSettings( [WatchOptions$Query$SystemSettings? options]) => this.watchQuery(options ?? WatchOptions$Query$SystemSettings()); - void writeQuery$SystemSettings( - {required Query$SystemSettings data, bool broadcast = true}) => + void writeQuery$SystemSettings({ + required Query$SystemSettings data, + bool broadcast = true, + }) => this.writeQuery( - graphql.Request( - operation: - graphql.Operation(document: documentNodeQuerySystemSettings)), - data: data.toJson(), - broadcast: broadcast); - Query$SystemSettings? readQuery$SystemSettings({bool optimistic = true}) { - final result = this.readQuery( graphql.Request( operation: graphql.Operation(document: documentNodeQuerySystemSettings)), - optimistic: optimistic); + data: data.toJson(), + broadcast: broadcast, + ); + Query$SystemSettings? readQuery$SystemSettings({bool optimistic = true}) { + final result = this.readQuery( + graphql.Request( + operation: + graphql.Operation(document: documentNodeQuerySystemSettings)), + optimistic: optimistic, + ); return result == null ? null : Query$SystemSettings.fromJson(result); } } -@JsonSerializable(explicitToJson: true) class Query$SystemSettings$system { - Query$SystemSettings$system( - {required this.settings, required this.$__typename}); + Query$SystemSettings$system({ + required this.settings, + required this.$__typename, + }); - @override - factory Query$SystemSettings$system.fromJson(Map json) => - _$Query$SystemSettings$systemFromJson(json); + factory Query$SystemSettings$system.fromJson(Map json) { + final l$settings = json['settings']; + final l$$__typename = json['__typename']; + return Query$SystemSettings$system( + settings: Query$SystemSettings$system$settings.fromJson( + (l$settings as Map)), + $__typename: (l$$__typename as String), + ); + } final Query$SystemSettings$system$settings settings; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$SystemSettings$systemToJson(this); + Map toJson() { + final _resultData = {}; + final l$settings = settings; + _resultData['settings'] = l$settings.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$settings = settings; final l$$__typename = $__typename; - return Object.hashAll([l$settings, l$$__typename]); + return Object.hashAll([ + l$settings, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$SystemSettings$system) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$settings = settings; final lOther$settings = other.settings; - if (l$settings != lOther$settings) return false; + if (l$settings != lOther$settings) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -497,26 +2313,34 @@ class Query$SystemSettings$system { extension UtilityExtension$Query$SystemSettings$system on Query$SystemSettings$system { CopyWith$Query$SystemSettings$system - get copyWith => CopyWith$Query$SystemSettings$system(this, (i) => i); + get copyWith => CopyWith$Query$SystemSettings$system( + this, + (i) => i, + ); } abstract class CopyWith$Query$SystemSettings$system { factory CopyWith$Query$SystemSettings$system( - Query$SystemSettings$system instance, - TRes Function(Query$SystemSettings$system) then) = - _CopyWithImpl$Query$SystemSettings$system; + Query$SystemSettings$system instance, + TRes Function(Query$SystemSettings$system) then, + ) = _CopyWithImpl$Query$SystemSettings$system; factory CopyWith$Query$SystemSettings$system.stub(TRes res) = _CopyWithStubImpl$Query$SystemSettings$system; - TRes call( - {Query$SystemSettings$system$settings? settings, String? $__typename}); + TRes call({ + Query$SystemSettings$system$settings? settings, + String? $__typename, + }); CopyWith$Query$SystemSettings$system$settings get settings; } class _CopyWithImpl$Query$SystemSettings$system implements CopyWith$Query$SystemSettings$system { - _CopyWithImpl$Query$SystemSettings$system(this._instance, this._then); + _CopyWithImpl$Query$SystemSettings$system( + this._instance, + this._then, + ); final Query$SystemSettings$system _instance; @@ -524,15 +2348,18 @@ class _CopyWithImpl$Query$SystemSettings$system static const _undefined = {}; - TRes call( - {Object? settings = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? settings = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$SystemSettings$system( - settings: settings == _undefined || settings == null - ? _instance.settings - : (settings as Query$SystemSettings$system$settings), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + settings: settings == _undefined || settings == null + ? _instance.settings + : (settings as Query$SystemSettings$system$settings), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Query$SystemSettings$system$settings get settings { final local$settings = _instance.settings; return CopyWith$Query$SystemSettings$system$settings( @@ -546,24 +2373,38 @@ class _CopyWithStubImpl$Query$SystemSettings$system TRes _res; - call({Query$SystemSettings$system$settings? settings, String? $__typename}) => + call({ + Query$SystemSettings$system$settings? settings, + String? $__typename, + }) => _res; CopyWith$Query$SystemSettings$system$settings get settings => CopyWith$Query$SystemSettings$system$settings.stub(_res); } -@JsonSerializable(explicitToJson: true) class Query$SystemSettings$system$settings { - Query$SystemSettings$system$settings( - {required this.autoUpgrade, - required this.ssh, - required this.timezone, - required this.$__typename}); + Query$SystemSettings$system$settings({ + required this.autoUpgrade, + required this.ssh, + required this.timezone, + required this.$__typename, + }); - @override factory Query$SystemSettings$system$settings.fromJson( - Map json) => - _$Query$SystemSettings$system$settingsFromJson(json); + Map json) { + final l$autoUpgrade = json['autoUpgrade']; + final l$ssh = json['ssh']; + final l$timezone = json['timezone']; + final l$$__typename = json['__typename']; + return Query$SystemSettings$system$settings( + autoUpgrade: Query$SystemSettings$system$settings$autoUpgrade.fromJson( + (l$autoUpgrade as Map)), + ssh: Query$SystemSettings$system$settings$ssh.fromJson( + (l$ssh as Map)), + timezone: (l$timezone as String), + $__typename: (l$$__typename as String), + ); + } final Query$SystemSettings$system$settings$autoUpgrade autoUpgrade; @@ -571,36 +2412,64 @@ class Query$SystemSettings$system$settings { final String timezone; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Query$SystemSettings$system$settingsToJson(this); + Map toJson() { + final _resultData = {}; + final l$autoUpgrade = autoUpgrade; + _resultData['autoUpgrade'] = l$autoUpgrade.toJson(); + final l$ssh = ssh; + _resultData['ssh'] = l$ssh.toJson(); + final l$timezone = timezone; + _resultData['timezone'] = l$timezone; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$autoUpgrade = autoUpgrade; final l$ssh = ssh; final l$timezone = timezone; final l$$__typename = $__typename; - return Object.hashAll([l$autoUpgrade, l$ssh, l$timezone, l$$__typename]); + return Object.hashAll([ + l$autoUpgrade, + l$ssh, + l$timezone, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$SystemSettings$system$settings) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$autoUpgrade = autoUpgrade; final lOther$autoUpgrade = other.autoUpgrade; - if (l$autoUpgrade != lOther$autoUpgrade) return false; + if (l$autoUpgrade != lOther$autoUpgrade) { + return false; + } final l$ssh = ssh; final lOther$ssh = other.ssh; - if (l$ssh != lOther$ssh) return false; + if (l$ssh != lOther$ssh) { + return false; + } final l$timezone = timezone; final lOther$timezone = other.timezone; - if (l$timezone != lOther$timezone) return false; + if (l$timezone != lOther$timezone) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -609,24 +2478,27 @@ extension UtilityExtension$Query$SystemSettings$system$settings on Query$SystemSettings$system$settings { CopyWith$Query$SystemSettings$system$settings< Query$SystemSettings$system$settings> - get copyWith => - CopyWith$Query$SystemSettings$system$settings(this, (i) => i); + get copyWith => CopyWith$Query$SystemSettings$system$settings( + this, + (i) => i, + ); } abstract class CopyWith$Query$SystemSettings$system$settings { factory CopyWith$Query$SystemSettings$system$settings( - Query$SystemSettings$system$settings instance, - TRes Function(Query$SystemSettings$system$settings) then) = - _CopyWithImpl$Query$SystemSettings$system$settings; + Query$SystemSettings$system$settings instance, + TRes Function(Query$SystemSettings$system$settings) then, + ) = _CopyWithImpl$Query$SystemSettings$system$settings; factory CopyWith$Query$SystemSettings$system$settings.stub(TRes res) = _CopyWithStubImpl$Query$SystemSettings$system$settings; - TRes call( - {Query$SystemSettings$system$settings$autoUpgrade? autoUpgrade, - Query$SystemSettings$system$settings$ssh? ssh, - String? timezone, - String? $__typename}); + TRes call({ + Query$SystemSettings$system$settings$autoUpgrade? autoUpgrade, + Query$SystemSettings$system$settings$ssh? ssh, + String? timezone, + String? $__typename, + }); CopyWith$Query$SystemSettings$system$settings$autoUpgrade get autoUpgrade; CopyWith$Query$SystemSettings$system$settings$ssh get ssh; @@ -635,7 +2507,9 @@ abstract class CopyWith$Query$SystemSettings$system$settings { class _CopyWithImpl$Query$SystemSettings$system$settings implements CopyWith$Query$SystemSettings$system$settings { _CopyWithImpl$Query$SystemSettings$system$settings( - this._instance, this._then); + this._instance, + this._then, + ); final Query$SystemSettings$system$settings _instance; @@ -643,25 +2517,26 @@ class _CopyWithImpl$Query$SystemSettings$system$settings static const _undefined = {}; - TRes call( - {Object? autoUpgrade = _undefined, - Object? ssh = _undefined, - Object? timezone = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? autoUpgrade = _undefined, + Object? ssh = _undefined, + Object? timezone = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$SystemSettings$system$settings( - autoUpgrade: autoUpgrade == _undefined || autoUpgrade == null - ? _instance.autoUpgrade - : (autoUpgrade - as Query$SystemSettings$system$settings$autoUpgrade), - ssh: ssh == _undefined || ssh == null - ? _instance.ssh - : (ssh as Query$SystemSettings$system$settings$ssh), - timezone: timezone == _undefined || timezone == null - ? _instance.timezone - : (timezone as String), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + autoUpgrade: autoUpgrade == _undefined || autoUpgrade == null + ? _instance.autoUpgrade + : (autoUpgrade as Query$SystemSettings$system$settings$autoUpgrade), + ssh: ssh == _undefined || ssh == null + ? _instance.ssh + : (ssh as Query$SystemSettings$system$settings$ssh), + timezone: timezone == _undefined || timezone == null + ? _instance.timezone + : (timezone as String), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Query$SystemSettings$system$settings$autoUpgrade get autoUpgrade { final local$autoUpgrade = _instance.autoUpgrade; @@ -682,11 +2557,12 @@ class _CopyWithStubImpl$Query$SystemSettings$system$settings TRes _res; - call( - {Query$SystemSettings$system$settings$autoUpgrade? autoUpgrade, - Query$SystemSettings$system$settings$ssh? ssh, - String? timezone, - String? $__typename}) => + call({ + Query$SystemSettings$system$settings$autoUpgrade? autoUpgrade, + Query$SystemSettings$system$settings$ssh? ssh, + String? timezone, + String? $__typename, + }) => _res; CopyWith$Query$SystemSettings$system$settings$autoUpgrade get autoUpgrade => @@ -695,48 +2571,78 @@ class _CopyWithStubImpl$Query$SystemSettings$system$settings CopyWith$Query$SystemSettings$system$settings$ssh.stub(_res); } -@JsonSerializable(explicitToJson: true) class Query$SystemSettings$system$settings$autoUpgrade { - Query$SystemSettings$system$settings$autoUpgrade( - {required this.allowReboot, - required this.enable, - required this.$__typename}); + Query$SystemSettings$system$settings$autoUpgrade({ + required this.allowReboot, + required this.enable, + required this.$__typename, + }); - @override factory Query$SystemSettings$system$settings$autoUpgrade.fromJson( - Map json) => - _$Query$SystemSettings$system$settings$autoUpgradeFromJson(json); + Map json) { + final l$allowReboot = json['allowReboot']; + final l$enable = json['enable']; + final l$$__typename = json['__typename']; + return Query$SystemSettings$system$settings$autoUpgrade( + allowReboot: (l$allowReboot as bool), + enable: (l$enable as bool), + $__typename: (l$$__typename as String), + ); + } final bool allowReboot; final bool enable; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Query$SystemSettings$system$settings$autoUpgradeToJson(this); + Map toJson() { + final _resultData = {}; + final l$allowReboot = allowReboot; + _resultData['allowReboot'] = l$allowReboot; + final l$enable = enable; + _resultData['enable'] = l$enable; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$allowReboot = allowReboot; final l$enable = enable; final l$$__typename = $__typename; - return Object.hashAll([l$allowReboot, l$enable, l$$__typename]); + return Object.hashAll([ + l$allowReboot, + l$enable, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$SystemSettings$system$settings$autoUpgrade) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$allowReboot = allowReboot; final lOther$allowReboot = other.allowReboot; - if (l$allowReboot != lOther$allowReboot) return false; + if (l$allowReboot != lOther$allowReboot) { + return false; + } final l$enable = enable; final lOther$enable = other.enable; - if (l$enable != lOther$enable) return false; + if (l$enable != lOther$enable) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -746,27 +2652,34 @@ extension UtilityExtension$Query$SystemSettings$system$settings$autoUpgrade CopyWith$Query$SystemSettings$system$settings$autoUpgrade< Query$SystemSettings$system$settings$autoUpgrade> get copyWith => CopyWith$Query$SystemSettings$system$settings$autoUpgrade( - this, (i) => i); + this, + (i) => i, + ); } abstract class CopyWith$Query$SystemSettings$system$settings$autoUpgrade { factory CopyWith$Query$SystemSettings$system$settings$autoUpgrade( - Query$SystemSettings$system$settings$autoUpgrade instance, - TRes Function(Query$SystemSettings$system$settings$autoUpgrade) - then) = - _CopyWithImpl$Query$SystemSettings$system$settings$autoUpgrade; + Query$SystemSettings$system$settings$autoUpgrade instance, + TRes Function(Query$SystemSettings$system$settings$autoUpgrade) then, + ) = _CopyWithImpl$Query$SystemSettings$system$settings$autoUpgrade; factory CopyWith$Query$SystemSettings$system$settings$autoUpgrade.stub( TRes res) = _CopyWithStubImpl$Query$SystemSettings$system$settings$autoUpgrade; - TRes call({bool? allowReboot, bool? enable, String? $__typename}); + TRes call({ + bool? allowReboot, + bool? enable, + String? $__typename, + }); } class _CopyWithImpl$Query$SystemSettings$system$settings$autoUpgrade implements CopyWith$Query$SystemSettings$system$settings$autoUpgrade { _CopyWithImpl$Query$SystemSettings$system$settings$autoUpgrade( - this._instance, this._then); + this._instance, + this._then, + ); final Query$SystemSettings$system$settings$autoUpgrade _instance; @@ -774,20 +2687,22 @@ class _CopyWithImpl$Query$SystemSettings$system$settings$autoUpgrade static const _undefined = {}; - TRes call( - {Object? allowReboot = _undefined, - Object? enable = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? allowReboot = _undefined, + Object? enable = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$SystemSettings$system$settings$autoUpgrade( - allowReboot: allowReboot == _undefined || allowReboot == null - ? _instance.allowReboot - : (allowReboot as bool), - enable: enable == _undefined || enable == null - ? _instance.enable - : (enable as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + allowReboot: allowReboot == _undefined || allowReboot == null + ? _instance.allowReboot + : (allowReboot as bool), + enable: enable == _undefined || enable == null + ? _instance.enable + : (enable as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Query$SystemSettings$system$settings$autoUpgrade @@ -796,51 +2711,86 @@ class _CopyWithStubImpl$Query$SystemSettings$system$settings$autoUpgrade TRes _res; - call({bool? allowReboot, bool? enable, String? $__typename}) => _res; + call({ + bool? allowReboot, + bool? enable, + String? $__typename, + }) => + _res; } -@JsonSerializable(explicitToJson: true) class Query$SystemSettings$system$settings$ssh { - Query$SystemSettings$system$settings$ssh( - {required this.enable, - required this.passwordAuthentication, - required this.$__typename}); + Query$SystemSettings$system$settings$ssh({ + required this.enable, + required this.passwordAuthentication, + required this.$__typename, + }); - @override factory Query$SystemSettings$system$settings$ssh.fromJson( - Map json) => - _$Query$SystemSettings$system$settings$sshFromJson(json); + Map json) { + final l$enable = json['enable']; + final l$passwordAuthentication = json['passwordAuthentication']; + final l$$__typename = json['__typename']; + return Query$SystemSettings$system$settings$ssh( + enable: (l$enable as bool), + passwordAuthentication: (l$passwordAuthentication as bool), + $__typename: (l$$__typename as String), + ); + } final bool enable; final bool passwordAuthentication; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Query$SystemSettings$system$settings$sshToJson(this); + Map toJson() { + final _resultData = {}; + final l$enable = enable; + _resultData['enable'] = l$enable; + final l$passwordAuthentication = passwordAuthentication; + _resultData['passwordAuthentication'] = l$passwordAuthentication; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$enable = enable; final l$passwordAuthentication = passwordAuthentication; final l$$__typename = $__typename; - return Object.hashAll([l$enable, l$passwordAuthentication, l$$__typename]); + return Object.hashAll([ + l$enable, + l$passwordAuthentication, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$SystemSettings$system$settings$ssh) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$enable = enable; final lOther$enable = other.enable; - if (l$enable != lOther$enable) return false; + if (l$enable != lOther$enable) { + return false; + } final l$passwordAuthentication = passwordAuthentication; final lOther$passwordAuthentication = other.passwordAuthentication; - if (l$passwordAuthentication != lOther$passwordAuthentication) return false; + if (l$passwordAuthentication != lOther$passwordAuthentication) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -849,26 +2799,34 @@ extension UtilityExtension$Query$SystemSettings$system$settings$ssh on Query$SystemSettings$system$settings$ssh { CopyWith$Query$SystemSettings$system$settings$ssh< Query$SystemSettings$system$settings$ssh> - get copyWith => - CopyWith$Query$SystemSettings$system$settings$ssh(this, (i) => i); + get copyWith => CopyWith$Query$SystemSettings$system$settings$ssh( + this, + (i) => i, + ); } abstract class CopyWith$Query$SystemSettings$system$settings$ssh { factory CopyWith$Query$SystemSettings$system$settings$ssh( - Query$SystemSettings$system$settings$ssh instance, - TRes Function(Query$SystemSettings$system$settings$ssh) then) = - _CopyWithImpl$Query$SystemSettings$system$settings$ssh; + Query$SystemSettings$system$settings$ssh instance, + TRes Function(Query$SystemSettings$system$settings$ssh) then, + ) = _CopyWithImpl$Query$SystemSettings$system$settings$ssh; factory CopyWith$Query$SystemSettings$system$settings$ssh.stub(TRes res) = _CopyWithStubImpl$Query$SystemSettings$system$settings$ssh; - TRes call({bool? enable, bool? passwordAuthentication, String? $__typename}); + TRes call({ + bool? enable, + bool? passwordAuthentication, + String? $__typename, + }); } class _CopyWithImpl$Query$SystemSettings$system$settings$ssh implements CopyWith$Query$SystemSettings$system$settings$ssh { _CopyWithImpl$Query$SystemSettings$system$settings$ssh( - this._instance, this._then); + this._instance, + this._then, + ); final Query$SystemSettings$system$settings$ssh _instance; @@ -876,21 +2834,23 @@ class _CopyWithImpl$Query$SystemSettings$system$settings$ssh static const _undefined = {}; - TRes call( - {Object? enable = _undefined, - Object? passwordAuthentication = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? enable = _undefined, + Object? passwordAuthentication = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$SystemSettings$system$settings$ssh( - enable: enable == _undefined || enable == null - ? _instance.enable - : (enable as bool), - passwordAuthentication: passwordAuthentication == _undefined || - passwordAuthentication == null - ? _instance.passwordAuthentication - : (passwordAuthentication as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + enable: enable == _undefined || enable == null + ? _instance.enable + : (enable as bool), + passwordAuthentication: passwordAuthentication == _undefined || + passwordAuthentication == null + ? _instance.passwordAuthentication + : (passwordAuthentication as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Query$SystemSettings$system$settings$ssh @@ -899,41 +2859,72 @@ class _CopyWithStubImpl$Query$SystemSettings$system$settings$ssh TRes _res; - call({bool? enable, bool? passwordAuthentication, String? $__typename}) => + call({ + bool? enable, + bool? passwordAuthentication, + String? $__typename, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Query$SystemIsUsingBinds { - Query$SystemIsUsingBinds({required this.system, required this.$__typename}); + Query$SystemIsUsingBinds({ + required this.system, + required this.$__typename, + }); - @override - factory Query$SystemIsUsingBinds.fromJson(Map json) => - _$Query$SystemIsUsingBindsFromJson(json); + factory Query$SystemIsUsingBinds.fromJson(Map json) { + final l$system = json['system']; + final l$$__typename = json['__typename']; + return Query$SystemIsUsingBinds( + system: Query$SystemIsUsingBinds$system.fromJson( + (l$system as Map)), + $__typename: (l$$__typename as String), + ); + } final Query$SystemIsUsingBinds$system system; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$SystemIsUsingBindsToJson(this); + Map toJson() { + final _resultData = {}; + final l$system = system; + _resultData['system'] = l$system.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$system = system; final l$$__typename = $__typename; - return Object.hashAll([l$system, l$$__typename]); + return Object.hashAll([ + l$system, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$SystemIsUsingBinds) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$system = system; final lOther$system = other.system; - if (l$system != lOther$system) return false; + if (l$system != lOther$system) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -941,24 +2932,34 @@ class Query$SystemIsUsingBinds { extension UtilityExtension$Query$SystemIsUsingBinds on Query$SystemIsUsingBinds { CopyWith$Query$SystemIsUsingBinds get copyWith => - CopyWith$Query$SystemIsUsingBinds(this, (i) => i); + CopyWith$Query$SystemIsUsingBinds( + this, + (i) => i, + ); } abstract class CopyWith$Query$SystemIsUsingBinds { - factory CopyWith$Query$SystemIsUsingBinds(Query$SystemIsUsingBinds instance, - TRes Function(Query$SystemIsUsingBinds) then) = - _CopyWithImpl$Query$SystemIsUsingBinds; + factory CopyWith$Query$SystemIsUsingBinds( + Query$SystemIsUsingBinds instance, + TRes Function(Query$SystemIsUsingBinds) then, + ) = _CopyWithImpl$Query$SystemIsUsingBinds; factory CopyWith$Query$SystemIsUsingBinds.stub(TRes res) = _CopyWithStubImpl$Query$SystemIsUsingBinds; - TRes call({Query$SystemIsUsingBinds$system? system, String? $__typename}); + TRes call({ + Query$SystemIsUsingBinds$system? system, + String? $__typename, + }); CopyWith$Query$SystemIsUsingBinds$system get system; } class _CopyWithImpl$Query$SystemIsUsingBinds implements CopyWith$Query$SystemIsUsingBinds { - _CopyWithImpl$Query$SystemIsUsingBinds(this._instance, this._then); + _CopyWithImpl$Query$SystemIsUsingBinds( + this._instance, + this._then, + ); final Query$SystemIsUsingBinds _instance; @@ -966,14 +2967,18 @@ class _CopyWithImpl$Query$SystemIsUsingBinds static const _undefined = {}; - TRes call({Object? system = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? system = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$SystemIsUsingBinds( - system: system == _undefined || system == null - ? _instance.system - : (system as Query$SystemIsUsingBinds$system), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + system: system == _undefined || system == null + ? _instance.system + : (system as Query$SystemIsUsingBinds$system), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Query$SystemIsUsingBinds$system get system { final local$system = _instance.system; return CopyWith$Query$SystemIsUsingBinds$system( @@ -987,57 +2992,68 @@ class _CopyWithStubImpl$Query$SystemIsUsingBinds TRes _res; - call({Query$SystemIsUsingBinds$system? system, String? $__typename}) => _res; + call({ + Query$SystemIsUsingBinds$system? system, + String? $__typename, + }) => + _res; CopyWith$Query$SystemIsUsingBinds$system get system => CopyWith$Query$SystemIsUsingBinds$system.stub(_res); } const documentNodeQuerySystemIsUsingBinds = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'SystemIsUsingBinds'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'system'), + type: OperationType.query, + name: NameNode(value: 'SystemIsUsingBinds'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'system'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'info'), alias: null, arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ FieldNode( - name: NameNode(value: 'info'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'usingBinds'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), + name: NameNode(value: 'usingBinds'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), ]); Query$SystemIsUsingBinds _parserFn$Query$SystemIsUsingBinds( Map data) => @@ -1045,52 +3061,54 @@ Query$SystemIsUsingBinds _parserFn$Query$SystemIsUsingBinds( class Options$Query$SystemIsUsingBinds extends graphql.QueryOptions { - Options$Query$SystemIsUsingBinds( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - Duration? pollInterval, - graphql.Context? context}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - pollInterval: pollInterval, - context: context, - document: documentNodeQuerySystemIsUsingBinds, - parserFn: _parserFn$Query$SystemIsUsingBinds); + Options$Query$SystemIsUsingBinds({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Duration? pollInterval, + graphql.Context? context, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + pollInterval: pollInterval, + context: context, + document: documentNodeQuerySystemIsUsingBinds, + parserFn: _parserFn$Query$SystemIsUsingBinds, + ); } class WatchOptions$Query$SystemIsUsingBinds extends graphql.WatchQueryOptions { - WatchOptions$Query$SystemIsUsingBinds( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeQuerySystemIsUsingBinds, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Query$SystemIsUsingBinds); + WatchOptions$Query$SystemIsUsingBinds({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeQuerySystemIsUsingBinds, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Query$SystemIsUsingBinds, + ); } class FetchMoreOptions$Query$SystemIsUsingBinds @@ -1098,8 +3116,9 @@ class FetchMoreOptions$Query$SystemIsUsingBinds FetchMoreOptions$Query$SystemIsUsingBinds( {required graphql.UpdateQuery updateQuery}) : super( - updateQuery: updateQuery, - document: documentNodeQuerySystemIsUsingBinds); + updateQuery: updateQuery, + document: documentNodeQuerySystemIsUsingBinds, + ); } extension ClientExtension$Query$SystemIsUsingBinds on graphql.GraphQLClient { @@ -1111,58 +3130,87 @@ extension ClientExtension$Query$SystemIsUsingBinds on graphql.GraphQLClient { watchQuery$SystemIsUsingBinds( [WatchOptions$Query$SystemIsUsingBinds? options]) => this.watchQuery(options ?? WatchOptions$Query$SystemIsUsingBinds()); - void writeQuery$SystemIsUsingBinds( - {required Query$SystemIsUsingBinds data, bool broadcast = true}) => + void writeQuery$SystemIsUsingBinds({ + required Query$SystemIsUsingBinds data, + bool broadcast = true, + }) => this.writeQuery( - graphql.Request( - operation: graphql.Operation( - document: documentNodeQuerySystemIsUsingBinds)), - data: data.toJson(), - broadcast: broadcast); - Query$SystemIsUsingBinds? readQuery$SystemIsUsingBinds( - {bool optimistic = true}) { - final result = this.readQuery( graphql.Request( operation: graphql.Operation( document: documentNodeQuerySystemIsUsingBinds)), - optimistic: optimistic); + data: data.toJson(), + broadcast: broadcast, + ); + Query$SystemIsUsingBinds? readQuery$SystemIsUsingBinds( + {bool optimistic = true}) { + final result = this.readQuery( + graphql.Request( + operation: + graphql.Operation(document: documentNodeQuerySystemIsUsingBinds)), + optimistic: optimistic, + ); return result == null ? null : Query$SystemIsUsingBinds.fromJson(result); } } -@JsonSerializable(explicitToJson: true) class Query$SystemIsUsingBinds$system { - Query$SystemIsUsingBinds$system( - {required this.info, required this.$__typename}); + Query$SystemIsUsingBinds$system({ + required this.info, + required this.$__typename, + }); - @override - factory Query$SystemIsUsingBinds$system.fromJson(Map json) => - _$Query$SystemIsUsingBinds$systemFromJson(json); + factory Query$SystemIsUsingBinds$system.fromJson(Map json) { + final l$info = json['info']; + final l$$__typename = json['__typename']; + return Query$SystemIsUsingBinds$system( + info: Query$SystemIsUsingBinds$system$info.fromJson( + (l$info as Map)), + $__typename: (l$$__typename as String), + ); + } final Query$SystemIsUsingBinds$system$info info; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Query$SystemIsUsingBinds$systemToJson(this); + Map toJson() { + final _resultData = {}; + final l$info = info; + _resultData['info'] = l$info.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$info = info; final l$$__typename = $__typename; - return Object.hashAll([l$info, l$$__typename]); + return Object.hashAll([ + l$info, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$SystemIsUsingBinds$system) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$info = info; final lOther$info = other.info; - if (l$info != lOther$info) return false; + if (l$info != lOther$info) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -1170,25 +3218,34 @@ class Query$SystemIsUsingBinds$system { extension UtilityExtension$Query$SystemIsUsingBinds$system on Query$SystemIsUsingBinds$system { CopyWith$Query$SystemIsUsingBinds$system - get copyWith => CopyWith$Query$SystemIsUsingBinds$system(this, (i) => i); + get copyWith => CopyWith$Query$SystemIsUsingBinds$system( + this, + (i) => i, + ); } abstract class CopyWith$Query$SystemIsUsingBinds$system { factory CopyWith$Query$SystemIsUsingBinds$system( - Query$SystemIsUsingBinds$system instance, - TRes Function(Query$SystemIsUsingBinds$system) then) = - _CopyWithImpl$Query$SystemIsUsingBinds$system; + Query$SystemIsUsingBinds$system instance, + TRes Function(Query$SystemIsUsingBinds$system) then, + ) = _CopyWithImpl$Query$SystemIsUsingBinds$system; factory CopyWith$Query$SystemIsUsingBinds$system.stub(TRes res) = _CopyWithStubImpl$Query$SystemIsUsingBinds$system; - TRes call({Query$SystemIsUsingBinds$system$info? info, String? $__typename}); + TRes call({ + Query$SystemIsUsingBinds$system$info? info, + String? $__typename, + }); CopyWith$Query$SystemIsUsingBinds$system$info get info; } class _CopyWithImpl$Query$SystemIsUsingBinds$system implements CopyWith$Query$SystemIsUsingBinds$system { - _CopyWithImpl$Query$SystemIsUsingBinds$system(this._instance, this._then); + _CopyWithImpl$Query$SystemIsUsingBinds$system( + this._instance, + this._then, + ); final Query$SystemIsUsingBinds$system _instance; @@ -1196,14 +3253,18 @@ class _CopyWithImpl$Query$SystemIsUsingBinds$system static const _undefined = {}; - TRes call({Object? info = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? info = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$SystemIsUsingBinds$system( - info: info == _undefined || info == null - ? _instance.info - : (info as Query$SystemIsUsingBinds$system$info), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + info: info == _undefined || info == null + ? _instance.info + : (info as Query$SystemIsUsingBinds$system$info), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Query$SystemIsUsingBinds$system$info get info { final local$info = _instance.info; return CopyWith$Query$SystemIsUsingBinds$system$info( @@ -1217,46 +3278,73 @@ class _CopyWithStubImpl$Query$SystemIsUsingBinds$system TRes _res; - call({Query$SystemIsUsingBinds$system$info? info, String? $__typename}) => + call({ + Query$SystemIsUsingBinds$system$info? info, + String? $__typename, + }) => _res; CopyWith$Query$SystemIsUsingBinds$system$info get info => CopyWith$Query$SystemIsUsingBinds$system$info.stub(_res); } -@JsonSerializable(explicitToJson: true) class Query$SystemIsUsingBinds$system$info { - Query$SystemIsUsingBinds$system$info( - {required this.usingBinds, required this.$__typename}); + Query$SystemIsUsingBinds$system$info({ + required this.usingBinds, + required this.$__typename, + }); - @override factory Query$SystemIsUsingBinds$system$info.fromJson( - Map json) => - _$Query$SystemIsUsingBinds$system$infoFromJson(json); + Map json) { + final l$usingBinds = json['usingBinds']; + final l$$__typename = json['__typename']; + return Query$SystemIsUsingBinds$system$info( + usingBinds: (l$usingBinds as bool), + $__typename: (l$$__typename as String), + ); + } final bool usingBinds; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Query$SystemIsUsingBinds$system$infoToJson(this); + Map toJson() { + final _resultData = {}; + final l$usingBinds = usingBinds; + _resultData['usingBinds'] = l$usingBinds; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$usingBinds = usingBinds; final l$$__typename = $__typename; - return Object.hashAll([l$usingBinds, l$$__typename]); + return Object.hashAll([ + l$usingBinds, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$SystemIsUsingBinds$system$info) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$usingBinds = usingBinds; final lOther$usingBinds = other.usingBinds; - if (l$usingBinds != lOther$usingBinds) return false; + if (l$usingBinds != lOther$usingBinds) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -1265,26 +3353,33 @@ extension UtilityExtension$Query$SystemIsUsingBinds$system$info on Query$SystemIsUsingBinds$system$info { CopyWith$Query$SystemIsUsingBinds$system$info< Query$SystemIsUsingBinds$system$info> - get copyWith => - CopyWith$Query$SystemIsUsingBinds$system$info(this, (i) => i); + get copyWith => CopyWith$Query$SystemIsUsingBinds$system$info( + this, + (i) => i, + ); } abstract class CopyWith$Query$SystemIsUsingBinds$system$info { factory CopyWith$Query$SystemIsUsingBinds$system$info( - Query$SystemIsUsingBinds$system$info instance, - TRes Function(Query$SystemIsUsingBinds$system$info) then) = - _CopyWithImpl$Query$SystemIsUsingBinds$system$info; + Query$SystemIsUsingBinds$system$info instance, + TRes Function(Query$SystemIsUsingBinds$system$info) then, + ) = _CopyWithImpl$Query$SystemIsUsingBinds$system$info; factory CopyWith$Query$SystemIsUsingBinds$system$info.stub(TRes res) = _CopyWithStubImpl$Query$SystemIsUsingBinds$system$info; - TRes call({bool? usingBinds, String? $__typename}); + TRes call({ + bool? usingBinds, + String? $__typename, + }); } class _CopyWithImpl$Query$SystemIsUsingBinds$system$info implements CopyWith$Query$SystemIsUsingBinds$system$info { _CopyWithImpl$Query$SystemIsUsingBinds$system$info( - this._instance, this._then); + this._instance, + this._then, + ); final Query$SystemIsUsingBinds$system$info _instance; @@ -1292,16 +3387,18 @@ class _CopyWithImpl$Query$SystemIsUsingBinds$system$info static const _undefined = {}; - TRes call( - {Object? usingBinds = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? usingBinds = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$SystemIsUsingBinds$system$info( - usingBinds: usingBinds == _undefined || usingBinds == null - ? _instance.usingBinds - : (usingBinds as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + usingBinds: usingBinds == _undefined || usingBinds == null + ? _instance.usingBinds + : (usingBinds as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Query$SystemIsUsingBinds$system$info @@ -1310,64 +3407,104 @@ class _CopyWithStubImpl$Query$SystemIsUsingBinds$system$info TRes _res; - call({bool? usingBinds, String? $__typename}) => _res; + call({ + bool? usingBinds, + String? $__typename, + }) => + _res; } -@JsonSerializable(explicitToJson: true) class Query$DomainInfo { - Query$DomainInfo({required this.system, required this.$__typename}); + Query$DomainInfo({ + required this.system, + required this.$__typename, + }); - @override - factory Query$DomainInfo.fromJson(Map json) => - _$Query$DomainInfoFromJson(json); + factory Query$DomainInfo.fromJson(Map json) { + final l$system = json['system']; + final l$$__typename = json['__typename']; + return Query$DomainInfo( + system: + Query$DomainInfo$system.fromJson((l$system as Map)), + $__typename: (l$$__typename as String), + ); + } final Query$DomainInfo$system system; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$DomainInfoToJson(this); + Map toJson() { + final _resultData = {}; + final l$system = system; + _resultData['system'] = l$system.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$system = system; final l$$__typename = $__typename; - return Object.hashAll([l$system, l$$__typename]); + return Object.hashAll([ + l$system, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Query$DomainInfo) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Query$DomainInfo) || runtimeType != other.runtimeType) { return false; + } final l$system = system; final lOther$system = other.system; - if (l$system != lOther$system) return false; + if (l$system != lOther$system) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Query$DomainInfo on Query$DomainInfo { CopyWith$Query$DomainInfo get copyWith => - CopyWith$Query$DomainInfo(this, (i) => i); + CopyWith$Query$DomainInfo( + this, + (i) => i, + ); } abstract class CopyWith$Query$DomainInfo { factory CopyWith$Query$DomainInfo( - Query$DomainInfo instance, TRes Function(Query$DomainInfo) then) = - _CopyWithImpl$Query$DomainInfo; + Query$DomainInfo instance, + TRes Function(Query$DomainInfo) then, + ) = _CopyWithImpl$Query$DomainInfo; factory CopyWith$Query$DomainInfo.stub(TRes res) = _CopyWithStubImpl$Query$DomainInfo; - TRes call({Query$DomainInfo$system? system, String? $__typename}); + TRes call({ + Query$DomainInfo$system? system, + String? $__typename, + }); CopyWith$Query$DomainInfo$system get system; } class _CopyWithImpl$Query$DomainInfo implements CopyWith$Query$DomainInfo { - _CopyWithImpl$Query$DomainInfo(this._instance, this._then); + _CopyWithImpl$Query$DomainInfo( + this._instance, + this._then, + ); final Query$DomainInfo _instance; @@ -1375,14 +3512,18 @@ class _CopyWithImpl$Query$DomainInfo static const _undefined = {}; - TRes call({Object? system = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? system = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$DomainInfo( - system: system == _undefined || system == null - ? _instance.system - : (system as Query$DomainInfo$system), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + system: system == _undefined || system == null + ? _instance.system + : (system as Query$DomainInfo$system), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Query$DomainInfo$system get system { final local$system = _instance.system; return CopyWith$Query$DomainInfo$system( @@ -1396,142 +3537,163 @@ class _CopyWithStubImpl$Query$DomainInfo TRes _res; - call({Query$DomainInfo$system? system, String? $__typename}) => _res; + call({ + Query$DomainInfo$system? system, + String? $__typename, + }) => + _res; CopyWith$Query$DomainInfo$system get system => CopyWith$Query$DomainInfo$system.stub(_res); } const documentNodeQueryDomainInfo = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'DomainInfo'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'system'), + type: OperationType.query, + name: NameNode(value: 'DomainInfo'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'system'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'domainInfo'), alias: null, arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ FieldNode( - name: NameNode(value: 'domainInfo'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'domain'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'hostname'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'provider'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'requiredDnsRecords'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'dnsRecordFields'), - directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), + name: NameNode(value: 'domain'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + name: NameNode(value: 'hostname'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'provider'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'requiredDnsRecords'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'dnsRecordFields'), + directives: [], + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitiondnsRecordFields, ]); Query$DomainInfo _parserFn$Query$DomainInfo(Map data) => Query$DomainInfo.fromJson(data); class Options$Query$DomainInfo extends graphql.QueryOptions { - Options$Query$DomainInfo( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - Duration? pollInterval, - graphql.Context? context}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - pollInterval: pollInterval, - context: context, - document: documentNodeQueryDomainInfo, - parserFn: _parserFn$Query$DomainInfo); + Options$Query$DomainInfo({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Duration? pollInterval, + graphql.Context? context, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + pollInterval: pollInterval, + context: context, + document: documentNodeQueryDomainInfo, + parserFn: _parserFn$Query$DomainInfo, + ); } class WatchOptions$Query$DomainInfo extends graphql.WatchQueryOptions { - WatchOptions$Query$DomainInfo( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeQueryDomainInfo, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Query$DomainInfo); + WatchOptions$Query$DomainInfo({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeQueryDomainInfo, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Query$DomainInfo, + ); } class FetchMoreOptions$Query$DomainInfo extends graphql.FetchMoreOptions { FetchMoreOptions$Query$DomainInfo({required graphql.UpdateQuery updateQuery}) - : super(updateQuery: updateQuery, document: documentNodeQueryDomainInfo); + : super( + updateQuery: updateQuery, + document: documentNodeQueryDomainInfo, + ); } extension ClientExtension$Query$DomainInfo on graphql.GraphQLClient { @@ -1541,81 +3703,119 @@ extension ClientExtension$Query$DomainInfo on graphql.GraphQLClient { graphql.ObservableQuery watchQuery$DomainInfo( [WatchOptions$Query$DomainInfo? options]) => this.watchQuery(options ?? WatchOptions$Query$DomainInfo()); - void writeQuery$DomainInfo( - {required Query$DomainInfo data, bool broadcast = true}) => + void writeQuery$DomainInfo({ + required Query$DomainInfo data, + bool broadcast = true, + }) => this.writeQuery( - graphql.Request( - operation: - graphql.Operation(document: documentNodeQueryDomainInfo)), - data: data.toJson(), - broadcast: broadcast); - Query$DomainInfo? readQuery$DomainInfo({bool optimistic = true}) { - final result = this.readQuery( graphql.Request( operation: graphql.Operation(document: documentNodeQueryDomainInfo)), - optimistic: optimistic); + data: data.toJson(), + broadcast: broadcast, + ); + Query$DomainInfo? readQuery$DomainInfo({bool optimistic = true}) { + final result = this.readQuery( + graphql.Request( + operation: graphql.Operation(document: documentNodeQueryDomainInfo)), + optimistic: optimistic, + ); return result == null ? null : Query$DomainInfo.fromJson(result); } } -@JsonSerializable(explicitToJson: true) class Query$DomainInfo$system { - Query$DomainInfo$system( - {required this.domainInfo, required this.$__typename}); + Query$DomainInfo$system({ + required this.domainInfo, + required this.$__typename, + }); - @override - factory Query$DomainInfo$system.fromJson(Map json) => - _$Query$DomainInfo$systemFromJson(json); + factory Query$DomainInfo$system.fromJson(Map json) { + final l$domainInfo = json['domainInfo']; + final l$$__typename = json['__typename']; + return Query$DomainInfo$system( + domainInfo: Query$DomainInfo$system$domainInfo.fromJson( + (l$domainInfo as Map)), + $__typename: (l$$__typename as String), + ); + } final Query$DomainInfo$system$domainInfo domainInfo; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$DomainInfo$systemToJson(this); + Map toJson() { + final _resultData = {}; + final l$domainInfo = domainInfo; + _resultData['domainInfo'] = l$domainInfo.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$domainInfo = domainInfo; final l$$__typename = $__typename; - return Object.hashAll([l$domainInfo, l$$__typename]); + return Object.hashAll([ + l$domainInfo, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Query$DomainInfo$system) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Query$DomainInfo$system) || + runtimeType != other.runtimeType) { return false; + } final l$domainInfo = domainInfo; final lOther$domainInfo = other.domainInfo; - if (l$domainInfo != lOther$domainInfo) return false; + if (l$domainInfo != lOther$domainInfo) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Query$DomainInfo$system on Query$DomainInfo$system { CopyWith$Query$DomainInfo$system get copyWith => - CopyWith$Query$DomainInfo$system(this, (i) => i); + CopyWith$Query$DomainInfo$system( + this, + (i) => i, + ); } abstract class CopyWith$Query$DomainInfo$system { - factory CopyWith$Query$DomainInfo$system(Query$DomainInfo$system instance, - TRes Function(Query$DomainInfo$system) then) = - _CopyWithImpl$Query$DomainInfo$system; + factory CopyWith$Query$DomainInfo$system( + Query$DomainInfo$system instance, + TRes Function(Query$DomainInfo$system) then, + ) = _CopyWithImpl$Query$DomainInfo$system; factory CopyWith$Query$DomainInfo$system.stub(TRes res) = _CopyWithStubImpl$Query$DomainInfo$system; - TRes call( - {Query$DomainInfo$system$domainInfo? domainInfo, String? $__typename}); + TRes call({ + Query$DomainInfo$system$domainInfo? domainInfo, + String? $__typename, + }); CopyWith$Query$DomainInfo$system$domainInfo get domainInfo; } class _CopyWithImpl$Query$DomainInfo$system implements CopyWith$Query$DomainInfo$system { - _CopyWithImpl$Query$DomainInfo$system(this._instance, this._then); + _CopyWithImpl$Query$DomainInfo$system( + this._instance, + this._then, + ); final Query$DomainInfo$system _instance; @@ -1623,16 +3823,18 @@ class _CopyWithImpl$Query$DomainInfo$system static const _undefined = {}; - TRes call( - {Object? domainInfo = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? domainInfo = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$DomainInfo$system( - domainInfo: domainInfo == _undefined || domainInfo == null - ? _instance.domainInfo - : (domainInfo as Query$DomainInfo$system$domainInfo), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + domainInfo: domainInfo == _undefined || domainInfo == null + ? _instance.domainInfo + : (domainInfo as Query$DomainInfo$system$domainInfo), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Query$DomainInfo$system$domainInfo get domainInfo { final local$domainInfo = _instance.domainInfo; return CopyWith$Query$DomainInfo$system$domainInfo( @@ -1646,40 +3848,70 @@ class _CopyWithStubImpl$Query$DomainInfo$system TRes _res; - call({Query$DomainInfo$system$domainInfo? domainInfo, String? $__typename}) => + call({ + Query$DomainInfo$system$domainInfo? domainInfo, + String? $__typename, + }) => _res; CopyWith$Query$DomainInfo$system$domainInfo get domainInfo => CopyWith$Query$DomainInfo$system$domainInfo.stub(_res); } -@JsonSerializable(explicitToJson: true) class Query$DomainInfo$system$domainInfo { - Query$DomainInfo$system$domainInfo( - {required this.domain, - required this.hostname, - required this.provider, - required this.requiredDnsRecords, - required this.$__typename}); + Query$DomainInfo$system$domainInfo({ + required this.domain, + required this.hostname, + required this.provider, + required this.requiredDnsRecords, + required this.$__typename, + }); - @override factory Query$DomainInfo$system$domainInfo.fromJson( - Map json) => - _$Query$DomainInfo$system$domainInfoFromJson(json); + Map json) { + final l$domain = json['domain']; + final l$hostname = json['hostname']; + final l$provider = json['provider']; + final l$requiredDnsRecords = json['requiredDnsRecords']; + final l$$__typename = json['__typename']; + return Query$DomainInfo$system$domainInfo( + domain: (l$domain as String), + hostname: (l$hostname as String), + provider: fromJson$Enum$DnsProvider((l$provider as String)), + requiredDnsRecords: (l$requiredDnsRecords as List) + .map((e) => + Fragment$dnsRecordFields.fromJson((e as Map))) + .toList(), + $__typename: (l$$__typename as String), + ); + } final String domain; final String hostname; - @JsonKey(unknownEnumValue: Enum$DnsProvider.$unknown) final Enum$DnsProvider provider; final List requiredDnsRecords; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Query$DomainInfo$system$domainInfoToJson(this); + Map toJson() { + final _resultData = {}; + final l$domain = domain; + _resultData['domain'] = l$domain; + final l$hostname = hostname; + _resultData['hostname'] = l$hostname; + final l$provider = provider; + _resultData['provider'] = toJson$Enum$DnsProvider(l$provider); + final l$requiredDnsRecords = requiredDnsRecords; + _resultData['requiredDnsRecords'] = + l$requiredDnsRecords.map((e) => e.toJson()).toList(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$domain = domain; final l$hostname = hostname; @@ -1691,38 +3923,51 @@ class Query$DomainInfo$system$domainInfo { l$hostname, l$provider, Object.hashAll(l$requiredDnsRecords.map((v) => v)), - l$$__typename + l$$__typename, ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$DomainInfo$system$domainInfo) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$domain = domain; final lOther$domain = other.domain; - if (l$domain != lOther$domain) return false; + if (l$domain != lOther$domain) { + return false; + } final l$hostname = hostname; final lOther$hostname = other.hostname; - if (l$hostname != lOther$hostname) return false; + if (l$hostname != lOther$hostname) { + return false; + } final l$provider = provider; final lOther$provider = other.provider; - if (l$provider != lOther$provider) return false; + if (l$provider != lOther$provider) { + return false; + } final l$requiredDnsRecords = requiredDnsRecords; final lOther$requiredDnsRecords = other.requiredDnsRecords; - if (l$requiredDnsRecords.length != lOther$requiredDnsRecords.length) + if (l$requiredDnsRecords.length != lOther$requiredDnsRecords.length) { return false; + } for (int i = 0; i < l$requiredDnsRecords.length; i++) { final l$requiredDnsRecords$entry = l$requiredDnsRecords[i]; final lOther$requiredDnsRecords$entry = lOther$requiredDnsRecords[i]; - if (l$requiredDnsRecords$entry != lOther$requiredDnsRecords$entry) + if (l$requiredDnsRecords$entry != lOther$requiredDnsRecords$entry) { return false; + } } - final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -1731,25 +3976,28 @@ extension UtilityExtension$Query$DomainInfo$system$domainInfo on Query$DomainInfo$system$domainInfo { CopyWith$Query$DomainInfo$system$domainInfo< Query$DomainInfo$system$domainInfo> - get copyWith => - CopyWith$Query$DomainInfo$system$domainInfo(this, (i) => i); + get copyWith => CopyWith$Query$DomainInfo$system$domainInfo( + this, + (i) => i, + ); } abstract class CopyWith$Query$DomainInfo$system$domainInfo { factory CopyWith$Query$DomainInfo$system$domainInfo( - Query$DomainInfo$system$domainInfo instance, - TRes Function(Query$DomainInfo$system$domainInfo) then) = - _CopyWithImpl$Query$DomainInfo$system$domainInfo; + Query$DomainInfo$system$domainInfo instance, + TRes Function(Query$DomainInfo$system$domainInfo) then, + ) = _CopyWithImpl$Query$DomainInfo$system$domainInfo; factory CopyWith$Query$DomainInfo$system$domainInfo.stub(TRes res) = _CopyWithStubImpl$Query$DomainInfo$system$domainInfo; - TRes call( - {String? domain, - String? hostname, - Enum$DnsProvider? provider, - List? requiredDnsRecords, - String? $__typename}); + TRes call({ + String? domain, + String? hostname, + Enum$DnsProvider? provider, + List? requiredDnsRecords, + String? $__typename, + }); TRes requiredDnsRecords( Iterable Function( Iterable< @@ -1759,7 +4007,10 @@ abstract class CopyWith$Query$DomainInfo$system$domainInfo { class _CopyWithImpl$Query$DomainInfo$system$domainInfo implements CopyWith$Query$DomainInfo$system$domainInfo { - _CopyWithImpl$Query$DomainInfo$system$domainInfo(this._instance, this._then); + _CopyWithImpl$Query$DomainInfo$system$domainInfo( + this._instance, + this._then, + ); final Query$DomainInfo$system$domainInfo _instance; @@ -1767,29 +4018,31 @@ class _CopyWithImpl$Query$DomainInfo$system$domainInfo static const _undefined = {}; - TRes call( - {Object? domain = _undefined, - Object? hostname = _undefined, - Object? provider = _undefined, - Object? requiredDnsRecords = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? domain = _undefined, + Object? hostname = _undefined, + Object? provider = _undefined, + Object? requiredDnsRecords = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$DomainInfo$system$domainInfo( - domain: domain == _undefined || domain == null - ? _instance.domain - : (domain as String), - hostname: hostname == _undefined || hostname == null - ? _instance.hostname - : (hostname as String), - provider: provider == _undefined || provider == null - ? _instance.provider - : (provider as Enum$DnsProvider), - requiredDnsRecords: - requiredDnsRecords == _undefined || requiredDnsRecords == null - ? _instance.requiredDnsRecords - : (requiredDnsRecords as List), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + domain: domain == _undefined || domain == null + ? _instance.domain + : (domain as String), + hostname: hostname == _undefined || hostname == null + ? _instance.hostname + : (hostname as String), + provider: provider == _undefined || provider == null + ? _instance.provider + : (provider as Enum$DnsProvider), + requiredDnsRecords: + requiredDnsRecords == _undefined || requiredDnsRecords == null + ? _instance.requiredDnsRecords + : (requiredDnsRecords as List), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); TRes requiredDnsRecords( Iterable Function( Iterable< @@ -1798,8 +4051,10 @@ class _CopyWithImpl$Query$DomainInfo$system$domainInfo _fn) => call( requiredDnsRecords: _fn(_instance.requiredDnsRecords - .map((e) => CopyWith$Fragment$dnsRecordFields(e, (i) => i))) - .toList()); + .map((e) => CopyWith$Fragment$dnsRecordFields( + e, + (i) => i, + ))).toList()); } class _CopyWithStubImpl$Query$DomainInfo$system$domainInfo @@ -1808,55 +4063,77 @@ class _CopyWithStubImpl$Query$DomainInfo$system$domainInfo TRes _res; - call( - {String? domain, - String? hostname, - Enum$DnsProvider? provider, - List? requiredDnsRecords, - String? $__typename}) => + call({ + String? domain, + String? hostname, + Enum$DnsProvider? provider, + List? requiredDnsRecords, + String? $__typename, + }) => _res; requiredDnsRecords(_fn) => _res; } -@JsonSerializable(explicitToJson: true) class Variables$Mutation$ChangeTimezone { - Variables$Mutation$ChangeTimezone({required this.timezone}); + factory Variables$Mutation$ChangeTimezone({required String timezone}) => + Variables$Mutation$ChangeTimezone._({ + r'timezone': timezone, + }); + + Variables$Mutation$ChangeTimezone._(this._$data); + + factory Variables$Mutation$ChangeTimezone.fromJson( + Map data) { + final result$data = {}; + final l$timezone = data['timezone']; + result$data['timezone'] = (l$timezone as String); + return Variables$Mutation$ChangeTimezone._(result$data); + } + + Map _$data; + + String get timezone => (_$data['timezone'] as String); + Map toJson() { + final result$data = {}; + final l$timezone = timezone; + result$data['timezone'] = l$timezone; + return result$data; + } + + CopyWith$Variables$Mutation$ChangeTimezone + get copyWith => CopyWith$Variables$Mutation$ChangeTimezone( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$ChangeTimezone) || + runtimeType != other.runtimeType) { + return false; + } + final l$timezone = timezone; + final lOther$timezone = other.timezone; + if (l$timezone != lOther$timezone) { + return false; + } + return true; + } @override - factory Variables$Mutation$ChangeTimezone.fromJson( - Map json) => - _$Variables$Mutation$ChangeTimezoneFromJson(json); - - final String timezone; - - Map toJson() => - _$Variables$Mutation$ChangeTimezoneToJson(this); int get hashCode { final l$timezone = timezone; return Object.hashAll([l$timezone]); } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Variables$Mutation$ChangeTimezone) || - runtimeType != other.runtimeType) return false; - final l$timezone = timezone; - final lOther$timezone = other.timezone; - if (l$timezone != lOther$timezone) return false; - return true; - } - - CopyWith$Variables$Mutation$ChangeTimezone - get copyWith => - CopyWith$Variables$Mutation$ChangeTimezone(this, (i) => i); } abstract class CopyWith$Variables$Mutation$ChangeTimezone { factory CopyWith$Variables$Mutation$ChangeTimezone( - Variables$Mutation$ChangeTimezone instance, - TRes Function(Variables$Mutation$ChangeTimezone) then) = - _CopyWithImpl$Variables$Mutation$ChangeTimezone; + Variables$Mutation$ChangeTimezone instance, + TRes Function(Variables$Mutation$ChangeTimezone) then, + ) = _CopyWithImpl$Variables$Mutation$ChangeTimezone; factory CopyWith$Variables$Mutation$ChangeTimezone.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$ChangeTimezone; @@ -1866,7 +4143,10 @@ abstract class CopyWith$Variables$Mutation$ChangeTimezone { class _CopyWithImpl$Variables$Mutation$ChangeTimezone implements CopyWith$Variables$Mutation$ChangeTimezone { - _CopyWithImpl$Variables$Mutation$ChangeTimezone(this._instance, this._then); + _CopyWithImpl$Variables$Mutation$ChangeTimezone( + this._instance, + this._then, + ); final Variables$Mutation$ChangeTimezone _instance; @@ -1875,10 +4155,11 @@ class _CopyWithImpl$Variables$Mutation$ChangeTimezone static const _undefined = {}; TRes call({Object? timezone = _undefined}) => - _then(Variables$Mutation$ChangeTimezone( - timezone: timezone == _undefined || timezone == null - ? _instance.timezone - : (timezone as String))); + _then(Variables$Mutation$ChangeTimezone._({ + ..._instance._$data, + if (timezone != _undefined && timezone != null) + 'timezone': (timezone as String), + })); } class _CopyWithStubImpl$Variables$Mutation$ChangeTimezone @@ -1890,64 +4171,98 @@ class _CopyWithStubImpl$Variables$Mutation$ChangeTimezone call({String? timezone}) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$ChangeTimezone { - Mutation$ChangeTimezone( - {required this.changeTimezone, required this.$__typename}); + Mutation$ChangeTimezone({ + required this.changeTimezone, + required this.$__typename, + }); - @override - factory Mutation$ChangeTimezone.fromJson(Map json) => - _$Mutation$ChangeTimezoneFromJson(json); + factory Mutation$ChangeTimezone.fromJson(Map json) { + final l$changeTimezone = json['changeTimezone']; + final l$$__typename = json['__typename']; + return Mutation$ChangeTimezone( + changeTimezone: Mutation$ChangeTimezone$changeTimezone.fromJson( + (l$changeTimezone as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$ChangeTimezone$changeTimezone changeTimezone; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$ChangeTimezoneToJson(this); + Map toJson() { + final _resultData = {}; + final l$changeTimezone = changeTimezone; + _resultData['changeTimezone'] = l$changeTimezone.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$changeTimezone = changeTimezone; final l$$__typename = $__typename; - return Object.hashAll([l$changeTimezone, l$$__typename]); + return Object.hashAll([ + l$changeTimezone, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Mutation$ChangeTimezone) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Mutation$ChangeTimezone) || + runtimeType != other.runtimeType) { return false; + } final l$changeTimezone = changeTimezone; final lOther$changeTimezone = other.changeTimezone; - if (l$changeTimezone != lOther$changeTimezone) return false; + if (l$changeTimezone != lOther$changeTimezone) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Mutation$ChangeTimezone on Mutation$ChangeTimezone { CopyWith$Mutation$ChangeTimezone get copyWith => - CopyWith$Mutation$ChangeTimezone(this, (i) => i); + CopyWith$Mutation$ChangeTimezone( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$ChangeTimezone { - factory CopyWith$Mutation$ChangeTimezone(Mutation$ChangeTimezone instance, - TRes Function(Mutation$ChangeTimezone) then) = - _CopyWithImpl$Mutation$ChangeTimezone; + factory CopyWith$Mutation$ChangeTimezone( + Mutation$ChangeTimezone instance, + TRes Function(Mutation$ChangeTimezone) then, + ) = _CopyWithImpl$Mutation$ChangeTimezone; factory CopyWith$Mutation$ChangeTimezone.stub(TRes res) = _CopyWithStubImpl$Mutation$ChangeTimezone; - TRes call( - {Mutation$ChangeTimezone$changeTimezone? changeTimezone, - String? $__typename}); + TRes call({ + Mutation$ChangeTimezone$changeTimezone? changeTimezone, + String? $__typename, + }); CopyWith$Mutation$ChangeTimezone$changeTimezone get changeTimezone; } class _CopyWithImpl$Mutation$ChangeTimezone implements CopyWith$Mutation$ChangeTimezone { - _CopyWithImpl$Mutation$ChangeTimezone(this._instance, this._then); + _CopyWithImpl$Mutation$ChangeTimezone( + this._instance, + this._then, + ); final Mutation$ChangeTimezone _instance; @@ -1955,16 +4270,18 @@ class _CopyWithImpl$Mutation$ChangeTimezone static const _undefined = {}; - TRes call( - {Object? changeTimezone = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? changeTimezone = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$ChangeTimezone( - changeTimezone: changeTimezone == _undefined || changeTimezone == null - ? _instance.changeTimezone - : (changeTimezone as Mutation$ChangeTimezone$changeTimezone), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + changeTimezone: changeTimezone == _undefined || changeTimezone == null + ? _instance.changeTimezone + : (changeTimezone as Mutation$ChangeTimezone$changeTimezone), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$ChangeTimezone$changeTimezone get changeTimezone { final local$changeTimezone = _instance.changeTimezone; return CopyWith$Mutation$ChangeTimezone$changeTimezone( @@ -1978,9 +4295,10 @@ class _CopyWithStubImpl$Mutation$ChangeTimezone TRes _res; - call( - {Mutation$ChangeTimezone$changeTimezone? changeTimezone, - String? $__typename}) => + call({ + Mutation$ChangeTimezone$changeTimezone? changeTimezone, + String? $__typename, + }) => _res; CopyWith$Mutation$ChangeTimezone$changeTimezone get changeTimezone => CopyWith$Mutation$ChangeTimezone$changeTimezone.stub(_res); @@ -1988,92 +4306,106 @@ class _CopyWithStubImpl$Mutation$ChangeTimezone const documentNodeMutationChangeTimezone = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'ChangeTimezone'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'timezone')), - type: - NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'changeTimezone'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'timezone'), - value: VariableNode(name: NameNode(value: 'timezone'))) - ], + type: OperationType.mutation, + name: NameNode(value: 'ChangeTimezone'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'timezone')), + type: NamedTypeNode( + name: NameNode(value: 'String'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'changeTimezone'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'timezone'), + value: VariableNode(name: NameNode(value: 'timezone')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: 'timezone'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + ), + FieldNode( + name: NameNode(value: 'timezone'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$ChangeTimezone _parserFn$Mutation$ChangeTimezone( Map data) => Mutation$ChangeTimezone.fromJson(data); typedef OnMutationCompleted$Mutation$ChangeTimezone = FutureOr Function( - dynamic, Mutation$ChangeTimezone?); + dynamic, + Mutation$ChangeTimezone?, +); class Options$Mutation$ChangeTimezone extends graphql.MutationOptions { - Options$Mutation$ChangeTimezone( - {String? operationName, - required Variables$Mutation$ChangeTimezone variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$ChangeTimezone? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$ChangeTimezone({ + String? operationName, + required Variables$Mutation$ChangeTimezone variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$ChangeTimezone? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( data, data == null ? null - : _parserFn$Mutation$ChangeTimezone(data)), - update: update, - onError: onError, - document: documentNodeMutationChangeTimezone, - parserFn: _parserFn$Mutation$ChangeTimezone); + : _parserFn$Mutation$ChangeTimezone(data), + ), + update: update, + onError: onError, + document: documentNodeMutationChangeTimezone, + parserFn: _parserFn$Mutation$ChangeTimezone, + ); final OnMutationCompleted$Mutation$ChangeTimezone? onCompletedWithParsed; @@ -2082,38 +4414,39 @@ class Options$Mutation$ChangeTimezone ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$ChangeTimezone extends graphql.WatchQueryOptions { - WatchOptions$Mutation$ChangeTimezone( - {String? operationName, - required Variables$Mutation$ChangeTimezone variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationChangeTimezone, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$ChangeTimezone); + WatchOptions$Mutation$ChangeTimezone({ + String? operationName, + required Variables$Mutation$ChangeTimezone variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationChangeTimezone, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$ChangeTimezone, + ); } extension ClientExtension$Mutation$ChangeTimezone on graphql.GraphQLClient { @@ -2125,20 +4458,31 @@ extension ClientExtension$Mutation$ChangeTimezone on graphql.GraphQLClient { this.watchMutation(options); } -@JsonSerializable(explicitToJson: true) class Mutation$ChangeTimezone$changeTimezone - implements Fragment$basicMutationReturnFields { - Mutation$ChangeTimezone$changeTimezone( - {required this.code, - required this.message, - required this.success, - required this.$__typename, - this.timezone}); + implements Fragment$basicMutationReturnFields$$TimezoneMutationReturn { + Mutation$ChangeTimezone$changeTimezone({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + this.timezone, + }); - @override factory Mutation$ChangeTimezone$changeTimezone.fromJson( - Map json) => - _$Mutation$ChangeTimezone$changeTimezoneFromJson(json); + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + final l$timezone = json['timezone']; + return Mutation$ChangeTimezone$changeTimezone( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + timezone: (l$timezone as String?), + ); + } final int code; @@ -2146,43 +4490,75 @@ class Mutation$ChangeTimezone$changeTimezone final bool success; - @JsonKey(name: '__typename') final String $__typename; final String? timezone; - Map toJson() => - _$Mutation$ChangeTimezone$changeTimezoneToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + final l$timezone = timezone; + _resultData['timezone'] = l$timezone; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; final l$timezone = timezone; - return Object.hashAll( - [l$code, l$message, l$success, l$$__typename, l$timezone]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + l$timezone, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$ChangeTimezone$changeTimezone) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } final l$timezone = timezone; final lOther$timezone = other.timezone; - if (l$timezone != lOther$timezone) return false; + if (l$timezone != lOther$timezone) { + return false; + } return true; } } @@ -2191,31 +4567,36 @@ extension UtilityExtension$Mutation$ChangeTimezone$changeTimezone on Mutation$ChangeTimezone$changeTimezone { CopyWith$Mutation$ChangeTimezone$changeTimezone< Mutation$ChangeTimezone$changeTimezone> - get copyWith => - CopyWith$Mutation$ChangeTimezone$changeTimezone(this, (i) => i); + get copyWith => CopyWith$Mutation$ChangeTimezone$changeTimezone( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$ChangeTimezone$changeTimezone { factory CopyWith$Mutation$ChangeTimezone$changeTimezone( - Mutation$ChangeTimezone$changeTimezone instance, - TRes Function(Mutation$ChangeTimezone$changeTimezone) then) = - _CopyWithImpl$Mutation$ChangeTimezone$changeTimezone; + Mutation$ChangeTimezone$changeTimezone instance, + TRes Function(Mutation$ChangeTimezone$changeTimezone) then, + ) = _CopyWithImpl$Mutation$ChangeTimezone$changeTimezone; factory CopyWith$Mutation$ChangeTimezone$changeTimezone.stub(TRes res) = _CopyWithStubImpl$Mutation$ChangeTimezone$changeTimezone; - TRes call( - {int? code, - String? message, - bool? success, - String? $__typename, - String? timezone}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + String? timezone, + }); } class _CopyWithImpl$Mutation$ChangeTimezone$changeTimezone implements CopyWith$Mutation$ChangeTimezone$changeTimezone { _CopyWithImpl$Mutation$ChangeTimezone$changeTimezone( - this._instance, this._then); + this._instance, + this._then, + ); final Mutation$ChangeTimezone$changeTimezone _instance; @@ -2223,28 +4604,28 @@ class _CopyWithImpl$Mutation$ChangeTimezone$changeTimezone static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined, - Object? timezone = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + Object? timezone = _undefined, + }) => _then(Mutation$ChangeTimezone$changeTimezone( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String), - timezone: timezone == _undefined - ? _instance.timezone - : (timezone as String?))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + timezone: + timezone == _undefined ? _instance.timezone : (timezone as String?), + )); } class _CopyWithStubImpl$Mutation$ChangeTimezone$changeTimezone @@ -2253,55 +4634,80 @@ class _CopyWithStubImpl$Mutation$ChangeTimezone$changeTimezone TRes _res; - call( - {int? code, - String? message, - bool? success, - String? $__typename, - String? timezone}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + String? timezone, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Variables$Mutation$ChangeAutoUpgradeSettings { - Variables$Mutation$ChangeAutoUpgradeSettings({required this.settings}); + factory Variables$Mutation$ChangeAutoUpgradeSettings( + {required Input$AutoUpgradeSettingsInput settings}) => + Variables$Mutation$ChangeAutoUpgradeSettings._({ + r'settings': settings, + }); + + Variables$Mutation$ChangeAutoUpgradeSettings._(this._$data); - @override factory Variables$Mutation$ChangeAutoUpgradeSettings.fromJson( - Map json) => - _$Variables$Mutation$ChangeAutoUpgradeSettingsFromJson(json); - - final Input$AutoUpgradeSettingsInput settings; - - Map toJson() => - _$Variables$Mutation$ChangeAutoUpgradeSettingsToJson(this); - int get hashCode { - final l$settings = settings; - return Object.hashAll([l$settings]); + Map data) { + final result$data = {}; + final l$settings = data['settings']; + result$data['settings'] = Input$AutoUpgradeSettingsInput.fromJson( + (l$settings as Map)); + return Variables$Mutation$ChangeAutoUpgradeSettings._(result$data); } - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Variables$Mutation$ChangeAutoUpgradeSettings) || - runtimeType != other.runtimeType) return false; + Map _$data; + + Input$AutoUpgradeSettingsInput get settings => + (_$data['settings'] as Input$AutoUpgradeSettingsInput); + Map toJson() { + final result$data = {}; final l$settings = settings; - final lOther$settings = other.settings; - if (l$settings != lOther$settings) return false; - return true; + result$data['settings'] = l$settings.toJson(); + return result$data; } CopyWith$Variables$Mutation$ChangeAutoUpgradeSettings< Variables$Mutation$ChangeAutoUpgradeSettings> - get copyWith => - CopyWith$Variables$Mutation$ChangeAutoUpgradeSettings(this, (i) => i); + get copyWith => CopyWith$Variables$Mutation$ChangeAutoUpgradeSettings( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$ChangeAutoUpgradeSettings) || + runtimeType != other.runtimeType) { + return false; + } + final l$settings = settings; + final lOther$settings = other.settings; + if (l$settings != lOther$settings) { + return false; + } + return true; + } + + @override + int get hashCode { + final l$settings = settings; + return Object.hashAll([l$settings]); + } } abstract class CopyWith$Variables$Mutation$ChangeAutoUpgradeSettings { factory CopyWith$Variables$Mutation$ChangeAutoUpgradeSettings( - Variables$Mutation$ChangeAutoUpgradeSettings instance, - TRes Function(Variables$Mutation$ChangeAutoUpgradeSettings) then) = - _CopyWithImpl$Variables$Mutation$ChangeAutoUpgradeSettings; + Variables$Mutation$ChangeAutoUpgradeSettings instance, + TRes Function(Variables$Mutation$ChangeAutoUpgradeSettings) then, + ) = _CopyWithImpl$Variables$Mutation$ChangeAutoUpgradeSettings; factory CopyWith$Variables$Mutation$ChangeAutoUpgradeSettings.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$ChangeAutoUpgradeSettings; @@ -2312,7 +4718,9 @@ abstract class CopyWith$Variables$Mutation$ChangeAutoUpgradeSettings { class _CopyWithImpl$Variables$Mutation$ChangeAutoUpgradeSettings implements CopyWith$Variables$Mutation$ChangeAutoUpgradeSettings { _CopyWithImpl$Variables$Mutation$ChangeAutoUpgradeSettings( - this._instance, this._then); + this._instance, + this._then, + ); final Variables$Mutation$ChangeAutoUpgradeSettings _instance; @@ -2321,10 +4729,11 @@ class _CopyWithImpl$Variables$Mutation$ChangeAutoUpgradeSettings static const _undefined = {}; TRes call({Object? settings = _undefined}) => - _then(Variables$Mutation$ChangeAutoUpgradeSettings( - settings: settings == _undefined || settings == null - ? _instance.settings - : (settings as Input$AutoUpgradeSettingsInput))); + _then(Variables$Mutation$ChangeAutoUpgradeSettings._({ + ..._instance._$data, + if (settings != _undefined && settings != null) + 'settings': (settings as Input$AutoUpgradeSettingsInput), + })); } class _CopyWithStubImpl$Variables$Mutation$ChangeAutoUpgradeSettings @@ -2336,42 +4745,68 @@ class _CopyWithStubImpl$Variables$Mutation$ChangeAutoUpgradeSettings call({Input$AutoUpgradeSettingsInput? settings}) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$ChangeAutoUpgradeSettings { - Mutation$ChangeAutoUpgradeSettings( - {required this.changeAutoUpgradeSettings, required this.$__typename}); + Mutation$ChangeAutoUpgradeSettings({ + required this.changeAutoUpgradeSettings, + required this.$__typename, + }); - @override factory Mutation$ChangeAutoUpgradeSettings.fromJson( - Map json) => - _$Mutation$ChangeAutoUpgradeSettingsFromJson(json); + Map json) { + final l$changeAutoUpgradeSettings = json['changeAutoUpgradeSettings']; + final l$$__typename = json['__typename']; + return Mutation$ChangeAutoUpgradeSettings( + changeAutoUpgradeSettings: + Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings.fromJson( + (l$changeAutoUpgradeSettings as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings changeAutoUpgradeSettings; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Mutation$ChangeAutoUpgradeSettingsToJson(this); + Map toJson() { + final _resultData = {}; + final l$changeAutoUpgradeSettings = changeAutoUpgradeSettings; + _resultData['changeAutoUpgradeSettings'] = + l$changeAutoUpgradeSettings.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$changeAutoUpgradeSettings = changeAutoUpgradeSettings; final l$$__typename = $__typename; - return Object.hashAll([l$changeAutoUpgradeSettings, l$$__typename]); + return Object.hashAll([ + l$changeAutoUpgradeSettings, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$ChangeAutoUpgradeSettings) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$changeAutoUpgradeSettings = changeAutoUpgradeSettings; final lOther$changeAutoUpgradeSettings = other.changeAutoUpgradeSettings; - if (l$changeAutoUpgradeSettings != lOther$changeAutoUpgradeSettings) + if (l$changeAutoUpgradeSettings != lOther$changeAutoUpgradeSettings) { return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -2380,30 +4815,36 @@ extension UtilityExtension$Mutation$ChangeAutoUpgradeSettings on Mutation$ChangeAutoUpgradeSettings { CopyWith$Mutation$ChangeAutoUpgradeSettings< Mutation$ChangeAutoUpgradeSettings> - get copyWith => - CopyWith$Mutation$ChangeAutoUpgradeSettings(this, (i) => i); + get copyWith => CopyWith$Mutation$ChangeAutoUpgradeSettings( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$ChangeAutoUpgradeSettings { factory CopyWith$Mutation$ChangeAutoUpgradeSettings( - Mutation$ChangeAutoUpgradeSettings instance, - TRes Function(Mutation$ChangeAutoUpgradeSettings) then) = - _CopyWithImpl$Mutation$ChangeAutoUpgradeSettings; + Mutation$ChangeAutoUpgradeSettings instance, + TRes Function(Mutation$ChangeAutoUpgradeSettings) then, + ) = _CopyWithImpl$Mutation$ChangeAutoUpgradeSettings; factory CopyWith$Mutation$ChangeAutoUpgradeSettings.stub(TRes res) = _CopyWithStubImpl$Mutation$ChangeAutoUpgradeSettings; - TRes call( - {Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings? - changeAutoUpgradeSettings, - String? $__typename}); + TRes call({ + Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings? + changeAutoUpgradeSettings, + String? $__typename, + }); CopyWith$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings get changeAutoUpgradeSettings; } class _CopyWithImpl$Mutation$ChangeAutoUpgradeSettings implements CopyWith$Mutation$ChangeAutoUpgradeSettings { - _CopyWithImpl$Mutation$ChangeAutoUpgradeSettings(this._instance, this._then); + _CopyWithImpl$Mutation$ChangeAutoUpgradeSettings( + this._instance, + this._then, + ); final Mutation$ChangeAutoUpgradeSettings _instance; @@ -2411,18 +4852,20 @@ class _CopyWithImpl$Mutation$ChangeAutoUpgradeSettings static const _undefined = {}; - TRes call( - {Object? changeAutoUpgradeSettings = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? changeAutoUpgradeSettings = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$ChangeAutoUpgradeSettings( - changeAutoUpgradeSettings: changeAutoUpgradeSettings == _undefined || - changeAutoUpgradeSettings == null - ? _instance.changeAutoUpgradeSettings - : (changeAutoUpgradeSettings - as Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + changeAutoUpgradeSettings: changeAutoUpgradeSettings == _undefined || + changeAutoUpgradeSettings == null + ? _instance.changeAutoUpgradeSettings + : (changeAutoUpgradeSettings + as Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings get changeAutoUpgradeSettings { final local$changeAutoUpgradeSettings = _instance.changeAutoUpgradeSettings; @@ -2438,10 +4881,11 @@ class _CopyWithStubImpl$Mutation$ChangeAutoUpgradeSettings TRes _res; - call( - {Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings? - changeAutoUpgradeSettings, - String? $__typename}) => + call({ + Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings? + changeAutoUpgradeSettings, + String? $__typename, + }) => _res; CopyWith$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings get changeAutoUpgradeSettings => @@ -2452,99 +4896,114 @@ class _CopyWithStubImpl$Mutation$ChangeAutoUpgradeSettings const documentNodeMutationChangeAutoUpgradeSettings = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'ChangeAutoUpgradeSettings'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'settings')), - type: NamedTypeNode( - name: NameNode(value: 'AutoUpgradeSettingsInput'), - isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'changeAutoUpgradeSettings'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'settings'), - value: VariableNode(name: NameNode(value: 'settings'))) - ], + type: OperationType.mutation, + name: NameNode(value: 'ChangeAutoUpgradeSettings'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'settings')), + type: NamedTypeNode( + name: NameNode(value: 'AutoUpgradeSettingsInput'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'changeAutoUpgradeSettings'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'settings'), + value: VariableNode(name: NameNode(value: 'settings')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: 'allowReboot'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'enableAutoUpgrade'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + ), + FieldNode( + name: NameNode(value: 'allowReboot'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'enableAutoUpgrade'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$ChangeAutoUpgradeSettings _parserFn$Mutation$ChangeAutoUpgradeSettings( Map data) => Mutation$ChangeAutoUpgradeSettings.fromJson(data); typedef OnMutationCompleted$Mutation$ChangeAutoUpgradeSettings = FutureOr - Function(dynamic, Mutation$ChangeAutoUpgradeSettings?); + Function( + dynamic, + Mutation$ChangeAutoUpgradeSettings?, +); class Options$Mutation$ChangeAutoUpgradeSettings extends graphql.MutationOptions { - Options$Mutation$ChangeAutoUpgradeSettings( - {String? operationName, - required Variables$Mutation$ChangeAutoUpgradeSettings variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$ChangeAutoUpgradeSettings? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$ChangeAutoUpgradeSettings({ + String? operationName, + required Variables$Mutation$ChangeAutoUpgradeSettings variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$ChangeAutoUpgradeSettings? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( data, data == null ? null - : _parserFn$Mutation$ChangeAutoUpgradeSettings(data)), - update: update, - onError: onError, - document: documentNodeMutationChangeAutoUpgradeSettings, - parserFn: _parserFn$Mutation$ChangeAutoUpgradeSettings); + : _parserFn$Mutation$ChangeAutoUpgradeSettings(data), + ), + update: update, + onError: onError, + document: documentNodeMutationChangeAutoUpgradeSettings, + parserFn: _parserFn$Mutation$ChangeAutoUpgradeSettings, + ); final OnMutationCompleted$Mutation$ChangeAutoUpgradeSettings? onCompletedWithParsed; @@ -2554,38 +5013,39 @@ class Options$Mutation$ChangeAutoUpgradeSettings ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$ChangeAutoUpgradeSettings extends graphql.WatchQueryOptions { - WatchOptions$Mutation$ChangeAutoUpgradeSettings( - {String? operationName, - required Variables$Mutation$ChangeAutoUpgradeSettings variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationChangeAutoUpgradeSettings, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$ChangeAutoUpgradeSettings); + WatchOptions$Mutation$ChangeAutoUpgradeSettings({ + String? operationName, + required Variables$Mutation$ChangeAutoUpgradeSettings variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationChangeAutoUpgradeSettings, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$ChangeAutoUpgradeSettings, + ); } extension ClientExtension$Mutation$ChangeAutoUpgradeSettings @@ -2600,22 +5060,35 @@ extension ClientExtension$Mutation$ChangeAutoUpgradeSettings this.watchMutation(options); } -@JsonSerializable(explicitToJson: true) class Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings - implements Fragment$basicMutationReturnFields { - Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings( - {required this.code, - required this.message, - required this.success, - required this.$__typename, - required this.allowReboot, - required this.enableAutoUpgrade}); + implements + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn { + Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + required this.allowReboot, + required this.enableAutoUpgrade, + }); - @override factory Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings.fromJson( - Map json) => - _$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettingsFromJson( - json); + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + final l$allowReboot = json['allowReboot']; + final l$enableAutoUpgrade = json['enableAutoUpgrade']; + return Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + allowReboot: (l$allowReboot as bool), + enableAutoUpgrade: (l$enableAutoUpgrade as bool), + ); + } final int code; @@ -2623,16 +5096,30 @@ class Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings final bool success; - @JsonKey(name: '__typename') final String $__typename; final bool allowReboot; final bool enableAutoUpgrade; - Map toJson() => - _$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettingsToJson( - this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + final l$allowReboot = allowReboot; + _resultData['allowReboot'] = l$allowReboot; + final l$enableAutoUpgrade = enableAutoUpgrade; + _resultData['enableAutoUpgrade'] = l$enableAutoUpgrade; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; @@ -2646,34 +5133,50 @@ class Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings l$success, l$$__typename, l$allowReboot, - l$enableAutoUpgrade + l$enableAutoUpgrade, ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } final l$allowReboot = allowReboot; final lOther$allowReboot = other.allowReboot; - if (l$allowReboot != lOther$allowReboot) return false; + if (l$allowReboot != lOther$allowReboot) { + return false; + } final l$enableAutoUpgrade = enableAutoUpgrade; final lOther$enableAutoUpgrade = other.enableAutoUpgrade; - if (l$enableAutoUpgrade != lOther$enableAutoUpgrade) return false; + if (l$enableAutoUpgrade != lOther$enableAutoUpgrade) { + return false; + } return true; } } @@ -2684,29 +5187,31 @@ extension UtilityExtension$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeS Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings> get copyWith => CopyWith$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings( - this, (i) => i); + this, + (i) => i, + ); } abstract class CopyWith$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings< TRes> { factory CopyWith$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings( - Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings instance, - TRes Function( - Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings) - then) = - _CopyWithImpl$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings; + Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings instance, + TRes Function(Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings) + then, + ) = _CopyWithImpl$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings; factory CopyWith$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings.stub( TRes res) = _CopyWithStubImpl$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings; - TRes call( - {int? code, - String? message, - bool? success, - String? $__typename, - bool? allowReboot, - bool? enableAutoUpgrade}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + bool? allowReboot, + bool? enableAutoUpgrade, + }); } class _CopyWithImpl$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings< @@ -2715,7 +5220,9 @@ class _CopyWithImpl$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings CopyWith$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings< TRes> { _CopyWithImpl$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings( - this._instance, this._then); + this._instance, + this._then, + ); final Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings _instance; @@ -2724,33 +5231,34 @@ class _CopyWithImpl$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined, - Object? allowReboot = _undefined, - Object? enableAutoUpgrade = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + Object? allowReboot = _undefined, + Object? enableAutoUpgrade = _undefined, + }) => _then(Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String), - allowReboot: allowReboot == _undefined || allowReboot == null - ? _instance.allowReboot - : (allowReboot as bool), - enableAutoUpgrade: - enableAutoUpgrade == _undefined || enableAutoUpgrade == null - ? _instance.enableAutoUpgrade - : (enableAutoUpgrade as bool))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + allowReboot: allowReboot == _undefined || allowReboot == null + ? _instance.allowReboot + : (allowReboot as bool), + enableAutoUpgrade: + enableAutoUpgrade == _undefined || enableAutoUpgrade == null + ? _instance.enableAutoUpgrade + : (enableAutoUpgrade as bool), + )); } class _CopyWithStubImpl$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings< @@ -2763,12 +5271,13 @@ class _CopyWithStubImpl$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSett TRes _res; - call( - {int? code, - String? message, - bool? success, - String? $__typename, - bool? allowReboot, - bool? enableAutoUpgrade}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + bool? allowReboot, + bool? enableAutoUpgrade, + }) => _res; } diff --git a/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.g.dart b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.g.dart deleted file mode 100644 index 6f4cb2d4..00000000 --- a/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.g.dart +++ /dev/null @@ -1,316 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'server_settings.graphql.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -Fragment$basicMutationReturnFields _$Fragment$basicMutationReturnFieldsFromJson( - Map json) => - Fragment$basicMutationReturnFields( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Fragment$basicMutationReturnFieldsToJson( - Fragment$basicMutationReturnFields instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - }; - -Query$SystemSettings _$Query$SystemSettingsFromJson( - Map json) => - Query$SystemSettings( - system: Query$SystemSettings$system.fromJson( - json['system'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Query$SystemSettingsToJson( - Query$SystemSettings instance) => - { - 'system': instance.system.toJson(), - '__typename': instance.$__typename, - }; - -Query$SystemSettings$system _$Query$SystemSettings$systemFromJson( - Map json) => - Query$SystemSettings$system( - settings: Query$SystemSettings$system$settings.fromJson( - json['settings'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Query$SystemSettings$systemToJson( - Query$SystemSettings$system instance) => - { - 'settings': instance.settings.toJson(), - '__typename': instance.$__typename, - }; - -Query$SystemSettings$system$settings - _$Query$SystemSettings$system$settingsFromJson(Map json) => - Query$SystemSettings$system$settings( - autoUpgrade: - Query$SystemSettings$system$settings$autoUpgrade.fromJson( - json['autoUpgrade'] as Map), - ssh: Query$SystemSettings$system$settings$ssh.fromJson( - json['ssh'] as Map), - timezone: json['timezone'] as String, - $__typename: json['__typename'] as String, - ); - -Map _$Query$SystemSettings$system$settingsToJson( - Query$SystemSettings$system$settings instance) => - { - 'autoUpgrade': instance.autoUpgrade.toJson(), - 'ssh': instance.ssh.toJson(), - 'timezone': instance.timezone, - '__typename': instance.$__typename, - }; - -Query$SystemSettings$system$settings$autoUpgrade - _$Query$SystemSettings$system$settings$autoUpgradeFromJson( - Map json) => - Query$SystemSettings$system$settings$autoUpgrade( - allowReboot: json['allowReboot'] as bool, - enable: json['enable'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Query$SystemSettings$system$settings$autoUpgradeToJson( - Query$SystemSettings$system$settings$autoUpgrade instance) => - { - 'allowReboot': instance.allowReboot, - 'enable': instance.enable, - '__typename': instance.$__typename, - }; - -Query$SystemSettings$system$settings$ssh - _$Query$SystemSettings$system$settings$sshFromJson( - Map json) => - Query$SystemSettings$system$settings$ssh( - enable: json['enable'] as bool, - passwordAuthentication: json['passwordAuthentication'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Query$SystemSettings$system$settings$sshToJson( - Query$SystemSettings$system$settings$ssh instance) => - { - 'enable': instance.enable, - 'passwordAuthentication': instance.passwordAuthentication, - '__typename': instance.$__typename, - }; - -Query$SystemIsUsingBinds _$Query$SystemIsUsingBindsFromJson( - Map json) => - Query$SystemIsUsingBinds( - system: Query$SystemIsUsingBinds$system.fromJson( - json['system'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Query$SystemIsUsingBindsToJson( - Query$SystemIsUsingBinds instance) => - { - 'system': instance.system.toJson(), - '__typename': instance.$__typename, - }; - -Query$SystemIsUsingBinds$system _$Query$SystemIsUsingBinds$systemFromJson( - Map json) => - Query$SystemIsUsingBinds$system( - info: Query$SystemIsUsingBinds$system$info.fromJson( - json['info'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Query$SystemIsUsingBinds$systemToJson( - Query$SystemIsUsingBinds$system instance) => - { - 'info': instance.info.toJson(), - '__typename': instance.$__typename, - }; - -Query$SystemIsUsingBinds$system$info - _$Query$SystemIsUsingBinds$system$infoFromJson(Map json) => - Query$SystemIsUsingBinds$system$info( - usingBinds: json['usingBinds'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Query$SystemIsUsingBinds$system$infoToJson( - Query$SystemIsUsingBinds$system$info instance) => - { - 'usingBinds': instance.usingBinds, - '__typename': instance.$__typename, - }; - -Query$DomainInfo _$Query$DomainInfoFromJson(Map json) => - Query$DomainInfo( - system: Query$DomainInfo$system.fromJson( - json['system'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Query$DomainInfoToJson(Query$DomainInfo instance) => - { - 'system': instance.system.toJson(), - '__typename': instance.$__typename, - }; - -Query$DomainInfo$system _$Query$DomainInfo$systemFromJson( - Map json) => - Query$DomainInfo$system( - domainInfo: Query$DomainInfo$system$domainInfo.fromJson( - json['domainInfo'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Query$DomainInfo$systemToJson( - Query$DomainInfo$system instance) => - { - 'domainInfo': instance.domainInfo.toJson(), - '__typename': instance.$__typename, - }; - -Query$DomainInfo$system$domainInfo _$Query$DomainInfo$system$domainInfoFromJson( - Map json) => - Query$DomainInfo$system$domainInfo( - domain: json['domain'] as String, - hostname: json['hostname'] as String, - provider: $enumDecode(_$Enum$DnsProviderEnumMap, json['provider'], - unknownValue: Enum$DnsProvider.$unknown), - requiredDnsRecords: (json['requiredDnsRecords'] as List) - .map((e) => - Fragment$dnsRecordFields.fromJson(e as Map)) - .toList(), - $__typename: json['__typename'] as String, - ); - -Map _$Query$DomainInfo$system$domainInfoToJson( - Query$DomainInfo$system$domainInfo instance) => - { - 'domain': instance.domain, - 'hostname': instance.hostname, - 'provider': _$Enum$DnsProviderEnumMap[instance.provider]!, - 'requiredDnsRecords': - instance.requiredDnsRecords.map((e) => e.toJson()).toList(), - '__typename': instance.$__typename, - }; - -const _$Enum$DnsProviderEnumMap = { - Enum$DnsProvider.CLOUDFLARE: 'CLOUDFLARE', - Enum$DnsProvider.DIGITALOCEAN: 'DIGITALOCEAN', - Enum$DnsProvider.$unknown: r'$unknown', -}; - -Variables$Mutation$ChangeTimezone _$Variables$Mutation$ChangeTimezoneFromJson( - Map json) => - Variables$Mutation$ChangeTimezone( - timezone: json['timezone'] as String, - ); - -Map _$Variables$Mutation$ChangeTimezoneToJson( - Variables$Mutation$ChangeTimezone instance) => - { - 'timezone': instance.timezone, - }; - -Mutation$ChangeTimezone _$Mutation$ChangeTimezoneFromJson( - Map json) => - Mutation$ChangeTimezone( - changeTimezone: Mutation$ChangeTimezone$changeTimezone.fromJson( - json['changeTimezone'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$ChangeTimezoneToJson( - Mutation$ChangeTimezone instance) => - { - 'changeTimezone': instance.changeTimezone.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$ChangeTimezone$changeTimezone - _$Mutation$ChangeTimezone$changeTimezoneFromJson( - Map json) => - Mutation$ChangeTimezone$changeTimezone( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - timezone: json['timezone'] as String?, - ); - -Map _$Mutation$ChangeTimezone$changeTimezoneToJson( - Mutation$ChangeTimezone$changeTimezone instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - 'timezone': instance.timezone, - }; - -Variables$Mutation$ChangeAutoUpgradeSettings - _$Variables$Mutation$ChangeAutoUpgradeSettingsFromJson( - Map json) => - Variables$Mutation$ChangeAutoUpgradeSettings( - settings: Input$AutoUpgradeSettingsInput.fromJson( - json['settings'] as Map), - ); - -Map _$Variables$Mutation$ChangeAutoUpgradeSettingsToJson( - Variables$Mutation$ChangeAutoUpgradeSettings instance) => - { - 'settings': instance.settings.toJson(), - }; - -Mutation$ChangeAutoUpgradeSettings _$Mutation$ChangeAutoUpgradeSettingsFromJson( - Map json) => - Mutation$ChangeAutoUpgradeSettings( - changeAutoUpgradeSettings: - Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings.fromJson( - json['changeAutoUpgradeSettings'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$ChangeAutoUpgradeSettingsToJson( - Mutation$ChangeAutoUpgradeSettings instance) => - { - 'changeAutoUpgradeSettings': instance.changeAutoUpgradeSettings.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings - _$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettingsFromJson( - Map json) => - Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - allowReboot: json['allowReboot'] as bool, - enableAutoUpgrade: json['enableAutoUpgrade'] as bool, - ); - -Map - _$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettingsToJson( - Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings - instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - 'allowReboot': instance.allowReboot, - 'enableAutoUpgrade': instance.enableAutoUpgrade, - }; diff --git a/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart index a31058c4..1501d709 100644 --- a/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart @@ -1,23 +1,69 @@ import 'dart:async'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; -import 'package:json_annotation/json_annotation.dart'; import 'package:selfprivacy/utils/scalars.dart'; import 'schema.graphql.dart'; -part 'services.graphql.g.dart'; -@JsonSerializable(explicitToJson: true) class Fragment$basicMutationReturnFields { - Fragment$basicMutationReturnFields( - {required this.code, - required this.message, - required this.success, - required this.$__typename}); + Fragment$basicMutationReturnFields({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override factory Fragment$basicMutationReturnFields.fromJson( - Map json) => - _$Fragment$basicMutationReturnFieldsFromJson(json); + Map json) { + switch (json["__typename"] as String) { + case "ApiKeyMutationReturn": + return Fragment$basicMutationReturnFields$$ApiKeyMutationReturn + .fromJson(json); + + case "AutoUpgradeSettingsMutationReturn": + return Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + .fromJson(json); + + case "DeviceApiTokenMutationReturn": + return Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn + .fromJson(json); + + case "GenericJobButationReturn": + return Fragment$basicMutationReturnFields$$GenericJobButationReturn + .fromJson(json); + + case "GenericMutationReturn": + return Fragment$basicMutationReturnFields$$GenericMutationReturn + .fromJson(json); + + case "ServiceJobMutationReturn": + return Fragment$basicMutationReturnFields$$ServiceJobMutationReturn + .fromJson(json); + + case "ServiceMutationReturn": + return Fragment$basicMutationReturnFields$$ServiceMutationReturn + .fromJson(json); + + case "TimezoneMutationReturn": + return Fragment$basicMutationReturnFields$$TimezoneMutationReturn + .fromJson(json); + + case "UserMutationReturn": + return Fragment$basicMutationReturnFields$$UserMutationReturn.fromJson( + json); + + default: + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + } final int code; @@ -25,36 +71,64 @@ class Fragment$basicMutationReturnFields { final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Fragment$basicMutationReturnFieldsToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; - return Object.hashAll([l$code, l$message, l$success, l$$__typename]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Fragment$basicMutationReturnFields) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -63,25 +137,35 @@ extension UtilityExtension$Fragment$basicMutationReturnFields on Fragment$basicMutationReturnFields { CopyWith$Fragment$basicMutationReturnFields< Fragment$basicMutationReturnFields> - get copyWith => - CopyWith$Fragment$basicMutationReturnFields(this, (i) => i); + get copyWith => CopyWith$Fragment$basicMutationReturnFields( + this, + (i) => i, + ); } abstract class CopyWith$Fragment$basicMutationReturnFields { factory CopyWith$Fragment$basicMutationReturnFields( - Fragment$basicMutationReturnFields instance, - TRes Function(Fragment$basicMutationReturnFields) then) = - _CopyWithImpl$Fragment$basicMutationReturnFields; + Fragment$basicMutationReturnFields instance, + TRes Function(Fragment$basicMutationReturnFields) then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields; factory CopyWith$Fragment$basicMutationReturnFields.stub(TRes res) = _CopyWithStubImpl$Fragment$basicMutationReturnFields; - TRes call({int? code, String? message, bool? success, String? $__typename}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); } class _CopyWithImpl$Fragment$basicMutationReturnFields implements CopyWith$Fragment$basicMutationReturnFields { - _CopyWithImpl$Fragment$basicMutationReturnFields(this._instance, this._then); + _CopyWithImpl$Fragment$basicMutationReturnFields( + this._instance, + this._then, + ); final Fragment$basicMutationReturnFields _instance; @@ -89,24 +173,25 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => _then(Fragment$basicMutationReturnFields( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Fragment$basicMutationReturnFields @@ -115,43 +200,54 @@ class _CopyWithStubImpl$Fragment$basicMutationReturnFields TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => _res; } const fragmentDefinitionbasicMutationReturnFields = FragmentDefinitionNode( - name: NameNode(value: 'basicMutationReturnFields'), - typeCondition: TypeConditionNode( - on: NamedTypeNode( - name: NameNode(value: 'MutationReturnInterface'), - isNonNull: false)), - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'code'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'message'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'success'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])); + name: NameNode(value: 'basicMutationReturnFields'), + typeCondition: TypeConditionNode( + on: NamedTypeNode( + name: NameNode(value: 'MutationReturnInterface'), + isNonNull: false, + )), + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'code'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'message'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'success'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), +); const documentNodeFragmentbasicMutationReturnFields = DocumentNode(definitions: [ fragmentDefinitionbasicMutationReturnFields, @@ -159,88 +255,1752 @@ const documentNodeFragmentbasicMutationReturnFields = extension ClientExtension$Fragment$basicMutationReturnFields on graphql.GraphQLClient { - void writeFragment$basicMutationReturnFields( - {required Fragment$basicMutationReturnFields data, - required Map idFields, - bool broadcast = true}) => + void writeFragment$basicMutationReturnFields({ + required Fragment$basicMutationReturnFields data, + required Map idFields, + bool broadcast = true, + }) => this.writeFragment( - graphql.FragmentRequest( - idFields: idFields, - fragment: const graphql.Fragment( - fragmentName: 'basicMutationReturnFields', - document: documentNodeFragmentbasicMutationReturnFields)), - data: data.toJson(), - broadcast: broadcast); - Fragment$basicMutationReturnFields? readFragment$basicMutationReturnFields( - {required Map idFields, bool optimistic = true}) { - final result = this.readFragment( graphql.FragmentRequest( - idFields: idFields, - fragment: const graphql.Fragment( - fragmentName: 'basicMutationReturnFields', - document: documentNodeFragmentbasicMutationReturnFields)), - optimistic: optimistic); + idFields: idFields, + fragment: const graphql.Fragment( + fragmentName: 'basicMutationReturnFields', + document: documentNodeFragmentbasicMutationReturnFields, + ), + ), + data: data.toJson(), + broadcast: broadcast, + ); + Fragment$basicMutationReturnFields? readFragment$basicMutationReturnFields({ + required Map idFields, + bool optimistic = true, + }) { + final result = this.readFragment( + graphql.FragmentRequest( + idFields: idFields, + fragment: const graphql.Fragment( + fragmentName: 'basicMutationReturnFields', + document: documentNodeFragmentbasicMutationReturnFields, + ), + ), + optimistic: optimistic, + ); return result == null ? null : Fragment$basicMutationReturnFields.fromJson(result); } } -@JsonSerializable(explicitToJson: true) -class Query$AllServices { - Query$AllServices({required this.services, required this.$__typename}); +class Fragment$basicMutationReturnFields$$ApiKeyMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$ApiKeyMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override - factory Query$AllServices.fromJson(Map json) => - _$Query$AllServicesFromJson(json); + factory Fragment$basicMutationReturnFields$$ApiKeyMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } - final Query$AllServices$services services; + final int code; + + final String message; + + final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$AllServicesToJson(this); - int get hashCode { - final l$services = services; + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; final l$$__typename = $__typename; - return Object.hashAll([l$services, l$$__typename]); + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Query$AllServices) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) || + runtimeType != other.runtimeType) { return false; - final l$services = services; - final lOther$services = other.services; - if (l$services != lOther$services) return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn + on Fragment$basicMutationReturnFields$$ApiKeyMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + Fragment$basicMutationReturnFields$$ApiKeyMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + Fragment$basicMutationReturnFields$$ApiKeyMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$ApiKeyMutationReturn _instance; + + final TRes Function(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + on Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + instance, + TRes Function( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn + on Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn instance, + TRes Function( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn + _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$GenericJobButationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$GenericJobButationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$GenericJobButationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$GenericJobButationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$GenericJobButationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$GenericJobButationReturn + on Fragment$basicMutationReturnFields$$GenericJobButationReturn { + CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + Fragment$basicMutationReturnFields$$GenericJobButationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn( + Fragment$basicMutationReturnFields$$GenericJobButationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$GenericJobButationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$GenericJobButationReturn _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$GenericJobButationReturn) _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$GenericJobButationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$GenericMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$GenericMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$GenericMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$GenericMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Fragment$basicMutationReturnFields$$GenericMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$GenericMutationReturn + on Fragment$basicMutationReturnFields$$GenericMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn< + Fragment$basicMutationReturnFields$$GenericMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn( + Fragment$basicMutationReturnFields$$GenericMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$GenericMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$GenericMutationReturn _instance; + + final TRes Function(Fragment$basicMutationReturnFields$$GenericMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$GenericMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$ServiceJobMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$ServiceJobMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn + on Fragment$basicMutationReturnFields$$ServiceJobMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$ServiceJobMutationReturn _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$ServiceMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$ServiceMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$ServiceMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$ServiceMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Fragment$basicMutationReturnFields$$ServiceMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$ServiceMutationReturn + on Fragment$basicMutationReturnFields$$ServiceMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + Fragment$basicMutationReturnFields$$ServiceMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn( + Fragment$basicMutationReturnFields$$ServiceMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$ServiceMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$ServiceMutationReturn _instance; + + final TRes Function(Fragment$basicMutationReturnFields$$ServiceMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$ServiceMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$TimezoneMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$TimezoneMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$TimezoneMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$TimezoneMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$TimezoneMutationReturn + on Fragment$basicMutationReturnFields$$TimezoneMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + Fragment$basicMutationReturnFields$$TimezoneMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + Fragment$basicMutationReturnFields$$TimezoneMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$TimezoneMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$TimezoneMutationReturn _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$TimezoneMutationReturn) _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$UserMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$UserMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$UserMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$UserMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Fragment$basicMutationReturnFields$$UserMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$UserMutationReturn + on Fragment$basicMutationReturnFields$$UserMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn< + Fragment$basicMutationReturnFields$$UserMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn( + Fragment$basicMutationReturnFields$$UserMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$UserMutationReturn) then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$UserMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$UserMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$UserMutationReturn + implements + CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn { + _CopyWithImpl$Fragment$basicMutationReturnFields$$UserMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$UserMutationReturn _instance; + + final TRes Function(Fragment$basicMutationReturnFields$$UserMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$UserMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$UserMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$UserMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Query$AllServices { + Query$AllServices({ + required this.services, + required this.$__typename, + }); + + factory Query$AllServices.fromJson(Map json) { + final l$services = json['services']; + final l$$__typename = json['__typename']; + return Query$AllServices( + services: Query$AllServices$services.fromJson( + (l$services as Map)), + $__typename: (l$$__typename as String), + ); + } + + final Query$AllServices$services services; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$services = services; + _resultData['services'] = l$services.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$services = services; + final l$$__typename = $__typename; + return Object.hashAll([ + l$services, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Query$AllServices) || runtimeType != other.runtimeType) { + return false; + } + final l$services = services; + final lOther$services = other.services; + if (l$services != lOther$services) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Query$AllServices on Query$AllServices { CopyWith$Query$AllServices get copyWith => - CopyWith$Query$AllServices(this, (i) => i); + CopyWith$Query$AllServices( + this, + (i) => i, + ); } abstract class CopyWith$Query$AllServices { factory CopyWith$Query$AllServices( - Query$AllServices instance, TRes Function(Query$AllServices) then) = - _CopyWithImpl$Query$AllServices; + Query$AllServices instance, + TRes Function(Query$AllServices) then, + ) = _CopyWithImpl$Query$AllServices; factory CopyWith$Query$AllServices.stub(TRes res) = _CopyWithStubImpl$Query$AllServices; - TRes call({Query$AllServices$services? services, String? $__typename}); + TRes call({ + Query$AllServices$services? services, + String? $__typename, + }); CopyWith$Query$AllServices$services get services; } class _CopyWithImpl$Query$AllServices implements CopyWith$Query$AllServices { - _CopyWithImpl$Query$AllServices(this._instance, this._then); + _CopyWithImpl$Query$AllServices( + this._instance, + this._then, + ); final Query$AllServices _instance; @@ -248,15 +2008,18 @@ class _CopyWithImpl$Query$AllServices static const _undefined = {}; - TRes call( - {Object? services = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? services = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$AllServices( - services: services == _undefined || services == null - ? _instance.services - : (services as Query$AllServices$services), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + services: services == _undefined || services == null + ? _instance.services + : (services as Query$AllServices$services), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Query$AllServices$services get services { final local$services = _instance.services; return CopyWith$Query$AllServices$services( @@ -270,165 +2033,194 @@ class _CopyWithStubImpl$Query$AllServices TRes _res; - call({Query$AllServices$services? services, String? $__typename}) => _res; + call({ + Query$AllServices$services? services, + String? $__typename, + }) => + _res; CopyWith$Query$AllServices$services get services => CopyWith$Query$AllServices$services.stub(_res); } const documentNodeQueryAllServices = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'AllServices'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'services'), + type: OperationType.query, + name: NameNode(value: 'AllServices'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'services'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'allServices'), alias: null, arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ FieldNode( - name: NameNode(value: 'allServices'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'description'), + name: NameNode(value: 'description'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'displayName'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'dnsRecords'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'dnsRecordFields'), + directives: [], + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: 'id'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'isEnabled'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'isMovable'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'isRequired'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'status'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'storageUsage'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'title'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'usedSpace'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'volume'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'name'), alias: null, arguments: [], directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'displayName'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'dnsRecords'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'dnsRecordFields'), - directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( - name: NameNode(value: 'id'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'isEnabled'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'isMovable'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'isRequired'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'status'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'storageUsage'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'title'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'usedSpace'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'volume'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'name'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( - name: NameNode(value: 'svgIcon'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'url'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( + selectionSet: null, + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + name: NameNode(value: 'svgIcon'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'url'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitiondnsRecordFields, ]); Query$AllServices _parserFn$Query$AllServices(Map data) => @@ -436,57 +2228,62 @@ Query$AllServices _parserFn$Query$AllServices(Map data) => class Options$Query$AllServices extends graphql.QueryOptions { - Options$Query$AllServices( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - Duration? pollInterval, - graphql.Context? context}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - pollInterval: pollInterval, - context: context, - document: documentNodeQueryAllServices, - parserFn: _parserFn$Query$AllServices); + Options$Query$AllServices({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Duration? pollInterval, + graphql.Context? context, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + pollInterval: pollInterval, + context: context, + document: documentNodeQueryAllServices, + parserFn: _parserFn$Query$AllServices, + ); } class WatchOptions$Query$AllServices extends graphql.WatchQueryOptions { - WatchOptions$Query$AllServices( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeQueryAllServices, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Query$AllServices); + WatchOptions$Query$AllServices({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeQueryAllServices, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Query$AllServices, + ); } class FetchMoreOptions$Query$AllServices extends graphql.FetchMoreOptions { FetchMoreOptions$Query$AllServices({required graphql.UpdateQuery updateQuery}) - : super(updateQuery: updateQuery, document: documentNodeQueryAllServices); + : super( + updateQuery: updateQuery, + document: documentNodeQueryAllServices, + ); } extension ClientExtension$Query$AllServices on graphql.GraphQLClient { @@ -496,63 +2293,94 @@ extension ClientExtension$Query$AllServices on graphql.GraphQLClient { graphql.ObservableQuery watchQuery$AllServices( [WatchOptions$Query$AllServices? options]) => this.watchQuery(options ?? WatchOptions$Query$AllServices()); - void writeQuery$AllServices( - {required Query$AllServices data, bool broadcast = true}) => + void writeQuery$AllServices({ + required Query$AllServices data, + bool broadcast = true, + }) => this.writeQuery( - graphql.Request( - operation: - graphql.Operation(document: documentNodeQueryAllServices)), - data: data.toJson(), - broadcast: broadcast); - Query$AllServices? readQuery$AllServices({bool optimistic = true}) { - final result = this.readQuery( graphql.Request( operation: graphql.Operation(document: documentNodeQueryAllServices)), - optimistic: optimistic); + data: data.toJson(), + broadcast: broadcast, + ); + Query$AllServices? readQuery$AllServices({bool optimistic = true}) { + final result = this.readQuery( + graphql.Request( + operation: graphql.Operation(document: documentNodeQueryAllServices)), + optimistic: optimistic, + ); return result == null ? null : Query$AllServices.fromJson(result); } } -@JsonSerializable(explicitToJson: true) class Query$AllServices$services { - Query$AllServices$services( - {required this.allServices, required this.$__typename}); + Query$AllServices$services({ + required this.allServices, + required this.$__typename, + }); - @override - factory Query$AllServices$services.fromJson(Map json) => - _$Query$AllServices$servicesFromJson(json); + factory Query$AllServices$services.fromJson(Map json) { + final l$allServices = json['allServices']; + final l$$__typename = json['__typename']; + return Query$AllServices$services( + allServices: (l$allServices as List) + .map((e) => Query$AllServices$services$allServices.fromJson( + (e as Map))) + .toList(), + $__typename: (l$$__typename as String), + ); + } final List allServices; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$AllServices$servicesToJson(this); + Map toJson() { + final _resultData = {}; + final l$allServices = allServices; + _resultData['allServices'] = l$allServices.map((e) => e.toJson()).toList(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$allServices = allServices; final l$$__typename = $__typename; - return Object.hashAll( - [Object.hashAll(l$allServices.map((v) => v)), l$$__typename]); + return Object.hashAll([ + Object.hashAll(l$allServices.map((v) => v)), + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$AllServices$services) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$allServices = allServices; final lOther$allServices = other.allServices; - if (l$allServices.length != lOther$allServices.length) return false; + if (l$allServices.length != lOther$allServices.length) { + return false; + } for (int i = 0; i < l$allServices.length; i++) { final l$allServices$entry = l$allServices[i]; final lOther$allServices$entry = lOther$allServices[i]; - if (l$allServices$entry != lOther$allServices$entry) return false; + if (l$allServices$entry != lOther$allServices$entry) { + return false; + } } - final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -560,21 +2388,25 @@ class Query$AllServices$services { extension UtilityExtension$Query$AllServices$services on Query$AllServices$services { CopyWith$Query$AllServices$services - get copyWith => CopyWith$Query$AllServices$services(this, (i) => i); + get copyWith => CopyWith$Query$AllServices$services( + this, + (i) => i, + ); } abstract class CopyWith$Query$AllServices$services { factory CopyWith$Query$AllServices$services( - Query$AllServices$services instance, - TRes Function(Query$AllServices$services) then) = - _CopyWithImpl$Query$AllServices$services; + Query$AllServices$services instance, + TRes Function(Query$AllServices$services) then, + ) = _CopyWithImpl$Query$AllServices$services; factory CopyWith$Query$AllServices$services.stub(TRes res) = _CopyWithStubImpl$Query$AllServices$services; - TRes call( - {List? allServices, - String? $__typename}); + TRes call({ + List? allServices, + String? $__typename, + }); TRes allServices( Iterable Function( Iterable< @@ -585,7 +2417,10 @@ abstract class CopyWith$Query$AllServices$services { class _CopyWithImpl$Query$AllServices$services implements CopyWith$Query$AllServices$services { - _CopyWithImpl$Query$AllServices$services(this._instance, this._then); + _CopyWithImpl$Query$AllServices$services( + this._instance, + this._then, + ); final Query$AllServices$services _instance; @@ -593,16 +2428,18 @@ class _CopyWithImpl$Query$AllServices$services static const _undefined = {}; - TRes call( - {Object? allServices = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? allServices = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$AllServices$services( - allServices: allServices == _undefined || allServices == null - ? _instance.allServices - : (allServices as List), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + allServices: allServices == _undefined || allServices == null + ? _instance.allServices + : (allServices as List), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); TRes allServices( Iterable Function( Iterable< @@ -610,9 +2447,11 @@ class _CopyWithImpl$Query$AllServices$services Query$AllServices$services$allServices>>) _fn) => call( - allServices: _fn(_instance.allServices.map((e) => - CopyWith$Query$AllServices$services$allServices(e, (i) => i))) - .toList()); + allServices: _fn(_instance.allServices + .map((e) => CopyWith$Query$AllServices$services$allServices( + e, + (i) => i, + ))).toList()); } class _CopyWithStubImpl$Query$AllServices$services @@ -621,33 +2460,64 @@ class _CopyWithStubImpl$Query$AllServices$services TRes _res; - call( - {List? allServices, - String? $__typename}) => + call({ + List? allServices, + String? $__typename, + }) => _res; allServices(_fn) => _res; } -@JsonSerializable(explicitToJson: true) class Query$AllServices$services$allServices { - Query$AllServices$services$allServices( - {required this.description, - required this.displayName, - this.dnsRecords, - required this.id, - required this.isEnabled, - required this.isMovable, - required this.isRequired, - required this.status, - required this.storageUsage, - required this.svgIcon, - this.url, - required this.$__typename}); + Query$AllServices$services$allServices({ + required this.description, + required this.displayName, + this.dnsRecords, + required this.id, + required this.isEnabled, + required this.isMovable, + required this.isRequired, + required this.status, + required this.storageUsage, + required this.svgIcon, + this.url, + required this.$__typename, + }); - @override factory Query$AllServices$services$allServices.fromJson( - Map json) => - _$Query$AllServices$services$allServicesFromJson(json); + Map json) { + final l$description = json['description']; + final l$displayName = json['displayName']; + final l$dnsRecords = json['dnsRecords']; + final l$id = json['id']; + final l$isEnabled = json['isEnabled']; + final l$isMovable = json['isMovable']; + final l$isRequired = json['isRequired']; + final l$status = json['status']; + final l$storageUsage = json['storageUsage']; + final l$svgIcon = json['svgIcon']; + final l$url = json['url']; + final l$$__typename = json['__typename']; + return Query$AllServices$services$allServices( + description: (l$description as String), + displayName: (l$displayName as String), + dnsRecords: (l$dnsRecords as List?) + ?.map((e) => + Fragment$dnsRecordFields.fromJson((e as Map))) + .toList(), + id: (l$id as String), + isEnabled: (l$isEnabled as bool), + isMovable: (l$isMovable as bool), + isRequired: (l$isRequired as bool), + status: fromJson$Enum$ServiceStatusEnum((l$status as String)), + storageUsage: + Query$AllServices$services$allServices$storageUsage.fromJson( + (l$storageUsage as Map)), + svgIcon: (l$svgIcon as String), + url: (l$url as String?), + $__typename: (l$$__typename as String), + ); + } final String description; @@ -663,7 +2533,6 @@ class Query$AllServices$services$allServices { final bool isRequired; - @JsonKey(unknownEnumValue: Enum$ServiceStatusEnum.$unknown) final Enum$ServiceStatusEnum status; final Query$AllServices$services$allServices$storageUsage storageUsage; @@ -672,11 +2541,38 @@ class Query$AllServices$services$allServices { final String? url; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Query$AllServices$services$allServicesToJson(this); + Map toJson() { + final _resultData = {}; + final l$description = description; + _resultData['description'] = l$description; + final l$displayName = displayName; + _resultData['displayName'] = l$displayName; + final l$dnsRecords = dnsRecords; + _resultData['dnsRecords'] = l$dnsRecords?.map((e) => e.toJson()).toList(); + final l$id = id; + _resultData['id'] = l$id; + final l$isEnabled = isEnabled; + _resultData['isEnabled'] = l$isEnabled; + final l$isMovable = isMovable; + _resultData['isMovable'] = l$isMovable; + final l$isRequired = isRequired; + _resultData['isRequired'] = l$isRequired; + final l$status = status; + _resultData['status'] = toJson$Enum$ServiceStatusEnum(l$status); + final l$storageUsage = storageUsage; + _resultData['storageUsage'] = l$storageUsage.toJson(); + final l$svgIcon = svgIcon; + _resultData['svgIcon'] = l$svgIcon; + final l$url = url; + _resultData['url'] = l$url; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$description = description; final l$displayName = displayName; @@ -702,61 +2598,90 @@ class Query$AllServices$services$allServices { l$storageUsage, l$svgIcon, l$url, - l$$__typename + l$$__typename, ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$AllServices$services$allServices) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$description = description; final lOther$description = other.description; - if (l$description != lOther$description) return false; + if (l$description != lOther$description) { + return false; + } final l$displayName = displayName; final lOther$displayName = other.displayName; - if (l$displayName != lOther$displayName) return false; + if (l$displayName != lOther$displayName) { + return false; + } final l$dnsRecords = dnsRecords; final lOther$dnsRecords = other.dnsRecords; if (l$dnsRecords != null && lOther$dnsRecords != null) { - if (l$dnsRecords.length != lOther$dnsRecords.length) return false; + if (l$dnsRecords.length != lOther$dnsRecords.length) { + return false; + } for (int i = 0; i < l$dnsRecords.length; i++) { final l$dnsRecords$entry = l$dnsRecords[i]; final lOther$dnsRecords$entry = lOther$dnsRecords[i]; - if (l$dnsRecords$entry != lOther$dnsRecords$entry) return false; + if (l$dnsRecords$entry != lOther$dnsRecords$entry) { + return false; + } } } else if (l$dnsRecords != lOther$dnsRecords) { return false; } - final l$id = id; final lOther$id = other.id; - if (l$id != lOther$id) return false; + if (l$id != lOther$id) { + return false; + } final l$isEnabled = isEnabled; final lOther$isEnabled = other.isEnabled; - if (l$isEnabled != lOther$isEnabled) return false; + if (l$isEnabled != lOther$isEnabled) { + return false; + } final l$isMovable = isMovable; final lOther$isMovable = other.isMovable; - if (l$isMovable != lOther$isMovable) return false; + if (l$isMovable != lOther$isMovable) { + return false; + } final l$isRequired = isRequired; final lOther$isRequired = other.isRequired; - if (l$isRequired != lOther$isRequired) return false; + if (l$isRequired != lOther$isRequired) { + return false; + } final l$status = status; final lOther$status = other.status; - if (l$status != lOther$status) return false; + if (l$status != lOther$status) { + return false; + } final l$storageUsage = storageUsage; final lOther$storageUsage = other.storageUsage; - if (l$storageUsage != lOther$storageUsage) return false; + if (l$storageUsage != lOther$storageUsage) { + return false; + } final l$svgIcon = svgIcon; final lOther$svgIcon = other.svgIcon; - if (l$svgIcon != lOther$svgIcon) return false; + if (l$svgIcon != lOther$svgIcon) { + return false; + } final l$url = url; final lOther$url = other.url; - if (l$url != lOther$url) return false; + if (l$url != lOther$url) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -765,32 +2690,35 @@ extension UtilityExtension$Query$AllServices$services$allServices on Query$AllServices$services$allServices { CopyWith$Query$AllServices$services$allServices< Query$AllServices$services$allServices> - get copyWith => - CopyWith$Query$AllServices$services$allServices(this, (i) => i); + get copyWith => CopyWith$Query$AllServices$services$allServices( + this, + (i) => i, + ); } abstract class CopyWith$Query$AllServices$services$allServices { factory CopyWith$Query$AllServices$services$allServices( - Query$AllServices$services$allServices instance, - TRes Function(Query$AllServices$services$allServices) then) = - _CopyWithImpl$Query$AllServices$services$allServices; + Query$AllServices$services$allServices instance, + TRes Function(Query$AllServices$services$allServices) then, + ) = _CopyWithImpl$Query$AllServices$services$allServices; factory CopyWith$Query$AllServices$services$allServices.stub(TRes res) = _CopyWithStubImpl$Query$AllServices$services$allServices; - TRes call( - {String? description, - String? displayName, - List? dnsRecords, - String? id, - bool? isEnabled, - bool? isMovable, - bool? isRequired, - Enum$ServiceStatusEnum? status, - Query$AllServices$services$allServices$storageUsage? storageUsage, - String? svgIcon, - String? url, - String? $__typename}); + TRes call({ + String? description, + String? displayName, + List? dnsRecords, + String? id, + bool? isEnabled, + bool? isMovable, + bool? isRequired, + Enum$ServiceStatusEnum? status, + Query$AllServices$services$allServices$storageUsage? storageUsage, + String? svgIcon, + String? url, + String? $__typename, + }); TRes dnsRecords( Iterable? Function( Iterable< @@ -803,7 +2731,9 @@ abstract class CopyWith$Query$AllServices$services$allServices { class _CopyWithImpl$Query$AllServices$services$allServices implements CopyWith$Query$AllServices$services$allServices { _CopyWithImpl$Query$AllServices$services$allServices( - this._instance, this._then); + this._instance, + this._then, + ); final Query$AllServices$services$allServices _instance; @@ -811,53 +2741,55 @@ class _CopyWithImpl$Query$AllServices$services$allServices static const _undefined = {}; - TRes call( - {Object? description = _undefined, - Object? displayName = _undefined, - Object? dnsRecords = _undefined, - Object? id = _undefined, - Object? isEnabled = _undefined, - Object? isMovable = _undefined, - Object? isRequired = _undefined, - Object? status = _undefined, - Object? storageUsage = _undefined, - Object? svgIcon = _undefined, - Object? url = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? description = _undefined, + Object? displayName = _undefined, + Object? dnsRecords = _undefined, + Object? id = _undefined, + Object? isEnabled = _undefined, + Object? isMovable = _undefined, + Object? isRequired = _undefined, + Object? status = _undefined, + Object? storageUsage = _undefined, + Object? svgIcon = _undefined, + Object? url = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$AllServices$services$allServices( - description: description == _undefined || description == null - ? _instance.description - : (description as String), - displayName: displayName == _undefined || displayName == null - ? _instance.displayName - : (displayName as String), - dnsRecords: dnsRecords == _undefined - ? _instance.dnsRecords - : (dnsRecords as List?), - id: id == _undefined || id == null ? _instance.id : (id as String), - isEnabled: isEnabled == _undefined || isEnabled == null - ? _instance.isEnabled - : (isEnabled as bool), - isMovable: isMovable == _undefined || isMovable == null - ? _instance.isMovable - : (isMovable as bool), - isRequired: isRequired == _undefined || isRequired == null - ? _instance.isRequired - : (isRequired as bool), - status: status == _undefined || status == null - ? _instance.status - : (status as Enum$ServiceStatusEnum), - storageUsage: storageUsage == _undefined || storageUsage == null - ? _instance.storageUsage - : (storageUsage - as Query$AllServices$services$allServices$storageUsage), - svgIcon: svgIcon == _undefined || svgIcon == null - ? _instance.svgIcon - : (svgIcon as String), - url: url == _undefined ? _instance.url : (url as String?), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + description: description == _undefined || description == null + ? _instance.description + : (description as String), + displayName: displayName == _undefined || displayName == null + ? _instance.displayName + : (displayName as String), + dnsRecords: dnsRecords == _undefined + ? _instance.dnsRecords + : (dnsRecords as List?), + id: id == _undefined || id == null ? _instance.id : (id as String), + isEnabled: isEnabled == _undefined || isEnabled == null + ? _instance.isEnabled + : (isEnabled as bool), + isMovable: isMovable == _undefined || isMovable == null + ? _instance.isMovable + : (isMovable as bool), + isRequired: isRequired == _undefined || isRequired == null + ? _instance.isRequired + : (isRequired as bool), + status: status == _undefined || status == null + ? _instance.status + : (status as Enum$ServiceStatusEnum), + storageUsage: storageUsage == _undefined || storageUsage == null + ? _instance.storageUsage + : (storageUsage + as Query$AllServices$services$allServices$storageUsage), + svgIcon: svgIcon == _undefined || svgIcon == null + ? _instance.svgIcon + : (svgIcon as String), + url: url == _undefined ? _instance.url : (url as String?), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); TRes dnsRecords( Iterable? Function( Iterable< @@ -866,8 +2798,10 @@ class _CopyWithImpl$Query$AllServices$services$allServices _fn) => call( dnsRecords: _fn(_instance.dnsRecords - ?.map((e) => CopyWith$Fragment$dnsRecordFields(e, (i) => i))) - ?.toList()); + ?.map((e) => CopyWith$Fragment$dnsRecordFields( + e, + (i) => i, + )))?.toList()); CopyWith$Query$AllServices$services$allServices$storageUsage get storageUsage { final local$storageUsage = _instance.storageUsage; @@ -882,19 +2816,20 @@ class _CopyWithStubImpl$Query$AllServices$services$allServices TRes _res; - call( - {String? description, - String? displayName, - List? dnsRecords, - String? id, - bool? isEnabled, - bool? isMovable, - bool? isRequired, - Enum$ServiceStatusEnum? status, - Query$AllServices$services$allServices$storageUsage? storageUsage, - String? svgIcon, - String? url, - String? $__typename}) => + call({ + String? description, + String? displayName, + List? dnsRecords, + String? id, + bool? isEnabled, + bool? isMovable, + bool? isRequired, + Enum$ServiceStatusEnum? status, + Query$AllServices$services$allServices$storageUsage? storageUsage, + String? svgIcon, + String? url, + String? $__typename, + }) => _res; dnsRecords(_fn) => _res; CopyWith$Query$AllServices$services$allServices$storageUsage @@ -903,18 +2838,30 @@ class _CopyWithStubImpl$Query$AllServices$services$allServices _res); } -@JsonSerializable(explicitToJson: true) class Query$AllServices$services$allServices$storageUsage { - Query$AllServices$services$allServices$storageUsage( - {required this.title, - required this.usedSpace, - this.volume, - required this.$__typename}); + Query$AllServices$services$allServices$storageUsage({ + required this.title, + required this.usedSpace, + this.volume, + required this.$__typename, + }); - @override factory Query$AllServices$services$allServices$storageUsage.fromJson( - Map json) => - _$Query$AllServices$services$allServices$storageUsageFromJson(json); + Map json) { + final l$title = json['title']; + final l$usedSpace = json['usedSpace']; + final l$volume = json['volume']; + final l$$__typename = json['__typename']; + return Query$AllServices$services$allServices$storageUsage( + title: (l$title as String), + usedSpace: (l$usedSpace as String), + volume: l$volume == null + ? null + : Query$AllServices$services$allServices$storageUsage$volume.fromJson( + (l$volume as Map)), + $__typename: (l$$__typename as String), + ); + } final String title; @@ -922,36 +2869,64 @@ class Query$AllServices$services$allServices$storageUsage { final Query$AllServices$services$allServices$storageUsage$volume? volume; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Query$AllServices$services$allServices$storageUsageToJson(this); + Map toJson() { + final _resultData = {}; + final l$title = title; + _resultData['title'] = l$title; + final l$usedSpace = usedSpace; + _resultData['usedSpace'] = l$usedSpace; + final l$volume = volume; + _resultData['volume'] = l$volume?.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$title = title; final l$usedSpace = usedSpace; final l$volume = volume; final l$$__typename = $__typename; - return Object.hashAll([l$title, l$usedSpace, l$volume, l$$__typename]); + return Object.hashAll([ + l$title, + l$usedSpace, + l$volume, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$AllServices$services$allServices$storageUsage) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$title = title; final lOther$title = other.title; - if (l$title != lOther$title) return false; + if (l$title != lOther$title) { + return false; + } final l$usedSpace = usedSpace; final lOther$usedSpace = other.usedSpace; - if (l$usedSpace != lOther$usedSpace) return false; + if (l$usedSpace != lOther$usedSpace) { + return false; + } final l$volume = volume; final lOther$volume = other.volume; - if (l$volume != lOther$volume) return false; + if (l$volume != lOther$volume) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -962,26 +2937,28 @@ extension UtilityExtension$Query$AllServices$services$allServices$storageUsage Query$AllServices$services$allServices$storageUsage> get copyWith => CopyWith$Query$AllServices$services$allServices$storageUsage( - this, (i) => i); + this, + (i) => i, + ); } abstract class CopyWith$Query$AllServices$services$allServices$storageUsage< TRes> { factory CopyWith$Query$AllServices$services$allServices$storageUsage( - Query$AllServices$services$allServices$storageUsage instance, - TRes Function(Query$AllServices$services$allServices$storageUsage) - then) = - _CopyWithImpl$Query$AllServices$services$allServices$storageUsage; + Query$AllServices$services$allServices$storageUsage instance, + TRes Function(Query$AllServices$services$allServices$storageUsage) then, + ) = _CopyWithImpl$Query$AllServices$services$allServices$storageUsage; factory CopyWith$Query$AllServices$services$allServices$storageUsage.stub( TRes res) = _CopyWithStubImpl$Query$AllServices$services$allServices$storageUsage; - TRes call( - {String? title, - String? usedSpace, - Query$AllServices$services$allServices$storageUsage$volume? volume, - String? $__typename}); + TRes call({ + String? title, + String? usedSpace, + Query$AllServices$services$allServices$storageUsage$volume? volume, + String? $__typename, + }); CopyWith$Query$AllServices$services$allServices$storageUsage$volume get volume; } @@ -990,7 +2967,9 @@ class _CopyWithImpl$Query$AllServices$services$allServices$storageUsage implements CopyWith$Query$AllServices$services$allServices$storageUsage { _CopyWithImpl$Query$AllServices$services$allServices$storageUsage( - this._instance, this._then); + this._instance, + this._then, + ); final Query$AllServices$services$allServices$storageUsage _instance; @@ -999,25 +2978,27 @@ class _CopyWithImpl$Query$AllServices$services$allServices$storageUsage static const _undefined = {}; - TRes call( - {Object? title = _undefined, - Object? usedSpace = _undefined, - Object? volume = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? title = _undefined, + Object? usedSpace = _undefined, + Object? volume = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$AllServices$services$allServices$storageUsage( - title: title == _undefined || title == null - ? _instance.title - : (title as String), - usedSpace: usedSpace == _undefined || usedSpace == null - ? _instance.usedSpace - : (usedSpace as String), - volume: volume == _undefined - ? _instance.volume - : (volume - as Query$AllServices$services$allServices$storageUsage$volume?), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + title: title == _undefined || title == null + ? _instance.title + : (title as String), + usedSpace: usedSpace == _undefined || usedSpace == null + ? _instance.usedSpace + : (usedSpace as String), + volume: volume == _undefined + ? _instance.volume + : (volume + as Query$AllServices$services$allServices$storageUsage$volume?), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Query$AllServices$services$allServices$storageUsage$volume get volume { final local$volume = _instance.volume; @@ -1038,11 +3019,12 @@ class _CopyWithStubImpl$Query$AllServices$services$allServices$storageUsage< TRes _res; - call( - {String? title, - String? usedSpace, - Query$AllServices$services$allServices$storageUsage$volume? volume, - String? $__typename}) => + call({ + String? title, + String? usedSpace, + Query$AllServices$services$allServices$storageUsage$volume? volume, + String? $__typename, + }) => _res; CopyWith$Query$AllServices$services$allServices$storageUsage$volume get volume => @@ -1050,42 +3032,65 @@ class _CopyWithStubImpl$Query$AllServices$services$allServices$storageUsage< .stub(_res); } -@JsonSerializable(explicitToJson: true) class Query$AllServices$services$allServices$storageUsage$volume { - Query$AllServices$services$allServices$storageUsage$volume( - {required this.name, required this.$__typename}); + Query$AllServices$services$allServices$storageUsage$volume({ + required this.name, + required this.$__typename, + }); - @override factory Query$AllServices$services$allServices$storageUsage$volume.fromJson( - Map json) => - _$Query$AllServices$services$allServices$storageUsage$volumeFromJson( - json); + Map json) { + final l$name = json['name']; + final l$$__typename = json['__typename']; + return Query$AllServices$services$allServices$storageUsage$volume( + name: (l$name as String), + $__typename: (l$$__typename as String), + ); + } final String name; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Query$AllServices$services$allServices$storageUsage$volumeToJson(this); + Map toJson() { + final _resultData = {}; + final l$name = name; + _resultData['name'] = l$name; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$name = name; final l$$__typename = $__typename; - return Object.hashAll([l$name, l$$__typename]); + return Object.hashAll([ + l$name, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Query$AllServices$services$allServices$storageUsage$volume) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$name = name; final lOther$name = other.name; - if (l$name != lOther$name) return false; + if (l$name != lOther$name) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -1096,23 +3101,27 @@ extension UtilityExtension$Query$AllServices$services$allServices$storageUsage$v Query$AllServices$services$allServices$storageUsage$volume> get copyWith => CopyWith$Query$AllServices$services$allServices$storageUsage$volume( - this, (i) => i); + this, + (i) => i, + ); } abstract class CopyWith$Query$AllServices$services$allServices$storageUsage$volume< TRes> { factory CopyWith$Query$AllServices$services$allServices$storageUsage$volume( - Query$AllServices$services$allServices$storageUsage$volume instance, - TRes Function( - Query$AllServices$services$allServices$storageUsage$volume) - then) = - _CopyWithImpl$Query$AllServices$services$allServices$storageUsage$volume; + Query$AllServices$services$allServices$storageUsage$volume instance, + TRes Function(Query$AllServices$services$allServices$storageUsage$volume) + then, + ) = _CopyWithImpl$Query$AllServices$services$allServices$storageUsage$volume; factory CopyWith$Query$AllServices$services$allServices$storageUsage$volume.stub( TRes res) = _CopyWithStubImpl$Query$AllServices$services$allServices$storageUsage$volume; - TRes call({String? name, String? $__typename}); + TRes call({ + String? name, + String? $__typename, + }); } class _CopyWithImpl$Query$AllServices$services$allServices$storageUsage$volume< @@ -1121,7 +3130,9 @@ class _CopyWithImpl$Query$AllServices$services$allServices$storageUsage$volume< CopyWith$Query$AllServices$services$allServices$storageUsage$volume< TRes> { _CopyWithImpl$Query$AllServices$services$allServices$storageUsage$volume( - this._instance, this._then); + this._instance, + this._then, + ); final Query$AllServices$services$allServices$storageUsage$volume _instance; @@ -1130,14 +3141,18 @@ class _CopyWithImpl$Query$AllServices$services$allServices$storageUsage$volume< static const _undefined = {}; - TRes call({Object? name = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? name = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$AllServices$services$allServices$storageUsage$volume( - name: name == _undefined || name == null - ? _instance.name - : (name as String), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + name: name == _undefined || name == null + ? _instance.name + : (name as String), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Query$AllServices$services$allServices$storageUsage$volume< @@ -1150,47 +3165,72 @@ class _CopyWithStubImpl$Query$AllServices$services$allServices$storageUsage$volu TRes _res; - call({String? name, String? $__typename}) => _res; + call({ + String? name, + String? $__typename, + }) => + _res; } -@JsonSerializable(explicitToJson: true) class Variables$Mutation$EnableService { - Variables$Mutation$EnableService({required this.serviceId}); + factory Variables$Mutation$EnableService({required String serviceId}) => + Variables$Mutation$EnableService._({ + r'serviceId': serviceId, + }); + + Variables$Mutation$EnableService._(this._$data); + + factory Variables$Mutation$EnableService.fromJson(Map data) { + final result$data = {}; + final l$serviceId = data['serviceId']; + result$data['serviceId'] = (l$serviceId as String); + return Variables$Mutation$EnableService._(result$data); + } + + Map _$data; + + String get serviceId => (_$data['serviceId'] as String); + Map toJson() { + final result$data = {}; + final l$serviceId = serviceId; + result$data['serviceId'] = l$serviceId; + return result$data; + } + + CopyWith$Variables$Mutation$EnableService + get copyWith => CopyWith$Variables$Mutation$EnableService( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$EnableService) || + runtimeType != other.runtimeType) { + return false; + } + final l$serviceId = serviceId; + final lOther$serviceId = other.serviceId; + if (l$serviceId != lOther$serviceId) { + return false; + } + return true; + } @override - factory Variables$Mutation$EnableService.fromJson( - Map json) => - _$Variables$Mutation$EnableServiceFromJson(json); - - final String serviceId; - - Map toJson() => - _$Variables$Mutation$EnableServiceToJson(this); int get hashCode { final l$serviceId = serviceId; return Object.hashAll([l$serviceId]); } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Variables$Mutation$EnableService) || - runtimeType != other.runtimeType) return false; - final l$serviceId = serviceId; - final lOther$serviceId = other.serviceId; - if (l$serviceId != lOther$serviceId) return false; - return true; - } - - CopyWith$Variables$Mutation$EnableService - get copyWith => CopyWith$Variables$Mutation$EnableService(this, (i) => i); } abstract class CopyWith$Variables$Mutation$EnableService { factory CopyWith$Variables$Mutation$EnableService( - Variables$Mutation$EnableService instance, - TRes Function(Variables$Mutation$EnableService) then) = - _CopyWithImpl$Variables$Mutation$EnableService; + Variables$Mutation$EnableService instance, + TRes Function(Variables$Mutation$EnableService) then, + ) = _CopyWithImpl$Variables$Mutation$EnableService; factory CopyWith$Variables$Mutation$EnableService.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$EnableService; @@ -1200,7 +3240,10 @@ abstract class CopyWith$Variables$Mutation$EnableService { class _CopyWithImpl$Variables$Mutation$EnableService implements CopyWith$Variables$Mutation$EnableService { - _CopyWithImpl$Variables$Mutation$EnableService(this._instance, this._then); + _CopyWithImpl$Variables$Mutation$EnableService( + this._instance, + this._then, + ); final Variables$Mutation$EnableService _instance; @@ -1209,10 +3252,11 @@ class _CopyWithImpl$Variables$Mutation$EnableService static const _undefined = {}; TRes call({Object? serviceId = _undefined}) => - _then(Variables$Mutation$EnableService( - serviceId: serviceId == _undefined || serviceId == null - ? _instance.serviceId - : (serviceId as String))); + _then(Variables$Mutation$EnableService._({ + ..._instance._$data, + if (serviceId != _undefined && serviceId != null) + 'serviceId': (serviceId as String), + })); } class _CopyWithStubImpl$Variables$Mutation$EnableService @@ -1224,64 +3268,98 @@ class _CopyWithStubImpl$Variables$Mutation$EnableService call({String? serviceId}) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$EnableService { - Mutation$EnableService( - {required this.enableService, required this.$__typename}); + Mutation$EnableService({ + required this.enableService, + required this.$__typename, + }); - @override - factory Mutation$EnableService.fromJson(Map json) => - _$Mutation$EnableServiceFromJson(json); + factory Mutation$EnableService.fromJson(Map json) { + final l$enableService = json['enableService']; + final l$$__typename = json['__typename']; + return Mutation$EnableService( + enableService: Mutation$EnableService$enableService.fromJson( + (l$enableService as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$EnableService$enableService enableService; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$EnableServiceToJson(this); + Map toJson() { + final _resultData = {}; + final l$enableService = enableService; + _resultData['enableService'] = l$enableService.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$enableService = enableService; final l$$__typename = $__typename; - return Object.hashAll([l$enableService, l$$__typename]); + return Object.hashAll([ + l$enableService, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Mutation$EnableService) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Mutation$EnableService) || + runtimeType != other.runtimeType) { return false; + } final l$enableService = enableService; final lOther$enableService = other.enableService; - if (l$enableService != lOther$enableService) return false; + if (l$enableService != lOther$enableService) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Mutation$EnableService on Mutation$EnableService { CopyWith$Mutation$EnableService get copyWith => - CopyWith$Mutation$EnableService(this, (i) => i); + CopyWith$Mutation$EnableService( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$EnableService { - factory CopyWith$Mutation$EnableService(Mutation$EnableService instance, - TRes Function(Mutation$EnableService) then) = - _CopyWithImpl$Mutation$EnableService; + factory CopyWith$Mutation$EnableService( + Mutation$EnableService instance, + TRes Function(Mutation$EnableService) then, + ) = _CopyWithImpl$Mutation$EnableService; factory CopyWith$Mutation$EnableService.stub(TRes res) = _CopyWithStubImpl$Mutation$EnableService; - TRes call( - {Mutation$EnableService$enableService? enableService, - String? $__typename}); + TRes call({ + Mutation$EnableService$enableService? enableService, + String? $__typename, + }); CopyWith$Mutation$EnableService$enableService get enableService; } class _CopyWithImpl$Mutation$EnableService implements CopyWith$Mutation$EnableService { - _CopyWithImpl$Mutation$EnableService(this._instance, this._then); + _CopyWithImpl$Mutation$EnableService( + this._instance, + this._then, + ); final Mutation$EnableService _instance; @@ -1289,16 +3367,18 @@ class _CopyWithImpl$Mutation$EnableService static const _undefined = {}; - TRes call( - {Object? enableService = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? enableService = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$EnableService( - enableService: enableService == _undefined || enableService == null - ? _instance.enableService - : (enableService as Mutation$EnableService$enableService), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + enableService: enableService == _undefined || enableService == null + ? _instance.enableService + : (enableService as Mutation$EnableService$enableService), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$EnableService$enableService get enableService { final local$enableService = _instance.enableService; return CopyWith$Mutation$EnableService$enableService( @@ -1312,9 +3392,10 @@ class _CopyWithStubImpl$Mutation$EnableService TRes _res; - call( - {Mutation$EnableService$enableService? enableService, - String? $__typename}) => + call({ + Mutation$EnableService$enableService? enableService, + String? $__typename, + }) => _res; CopyWith$Mutation$EnableService$enableService get enableService => CopyWith$Mutation$EnableService$enableService.stub(_res); @@ -1322,86 +3403,99 @@ class _CopyWithStubImpl$Mutation$EnableService const documentNodeMutationEnableService = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'EnableService'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'serviceId')), - type: - NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'enableService'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'serviceId'), - value: VariableNode(name: NameNode(value: 'serviceId'))) - ], + type: OperationType.mutation, + name: NameNode(value: 'EnableService'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'serviceId')), + type: NamedTypeNode( + name: NameNode(value: 'String'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'enableService'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'serviceId'), + value: VariableNode(name: NameNode(value: 'serviceId')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$EnableService _parserFn$Mutation$EnableService( Map data) => Mutation$EnableService.fromJson(data); typedef OnMutationCompleted$Mutation$EnableService = FutureOr Function( - dynamic, Mutation$EnableService?); + dynamic, + Mutation$EnableService?, +); class Options$Mutation$EnableService extends graphql.MutationOptions { - Options$Mutation$EnableService( - {String? operationName, - required Variables$Mutation$EnableService variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$EnableService? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$EnableService({ + String? operationName, + required Variables$Mutation$EnableService variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$EnableService? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( data, data == null ? null - : _parserFn$Mutation$EnableService(data)), - update: update, - onError: onError, - document: documentNodeMutationEnableService, - parserFn: _parserFn$Mutation$EnableService); + : _parserFn$Mutation$EnableService(data), + ), + update: update, + onError: onError, + document: documentNodeMutationEnableService, + parserFn: _parserFn$Mutation$EnableService, + ); final OnMutationCompleted$Mutation$EnableService? onCompletedWithParsed; @@ -1410,38 +3504,39 @@ class Options$Mutation$EnableService ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$EnableService extends graphql.WatchQueryOptions { - WatchOptions$Mutation$EnableService( - {String? operationName, - required Variables$Mutation$EnableService variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationEnableService, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$EnableService); + WatchOptions$Mutation$EnableService({ + String? operationName, + required Variables$Mutation$EnableService variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationEnableService, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$EnableService, + ); } extension ClientExtension$Mutation$EnableService on graphql.GraphQLClient { @@ -1453,19 +3548,28 @@ extension ClientExtension$Mutation$EnableService on graphql.GraphQLClient { this.watchMutation(options); } -@JsonSerializable(explicitToJson: true) class Mutation$EnableService$enableService - implements Fragment$basicMutationReturnFields { - Mutation$EnableService$enableService( - {required this.code, - required this.message, - required this.success, - required this.$__typename}); + implements Fragment$basicMutationReturnFields$$ServiceMutationReturn { + Mutation$EnableService$enableService({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override factory Mutation$EnableService$enableService.fromJson( - Map json) => - _$Mutation$EnableService$enableServiceFromJson(json); + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Mutation$EnableService$enableService( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } final int code; @@ -1473,36 +3577,64 @@ class Mutation$EnableService$enableService final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Mutation$EnableService$enableServiceToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; - return Object.hashAll([l$code, l$message, l$success, l$$__typename]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$EnableService$enableService) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -1511,26 +3643,35 @@ extension UtilityExtension$Mutation$EnableService$enableService on Mutation$EnableService$enableService { CopyWith$Mutation$EnableService$enableService< Mutation$EnableService$enableService> - get copyWith => - CopyWith$Mutation$EnableService$enableService(this, (i) => i); + get copyWith => CopyWith$Mutation$EnableService$enableService( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$EnableService$enableService { factory CopyWith$Mutation$EnableService$enableService( - Mutation$EnableService$enableService instance, - TRes Function(Mutation$EnableService$enableService) then) = - _CopyWithImpl$Mutation$EnableService$enableService; + Mutation$EnableService$enableService instance, + TRes Function(Mutation$EnableService$enableService) then, + ) = _CopyWithImpl$Mutation$EnableService$enableService; factory CopyWith$Mutation$EnableService$enableService.stub(TRes res) = _CopyWithStubImpl$Mutation$EnableService$enableService; - TRes call({int? code, String? message, bool? success, String? $__typename}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); } class _CopyWithImpl$Mutation$EnableService$enableService implements CopyWith$Mutation$EnableService$enableService { _CopyWithImpl$Mutation$EnableService$enableService( - this._instance, this._then); + this._instance, + this._then, + ); final Mutation$EnableService$enableService _instance; @@ -1538,24 +3679,25 @@ class _CopyWithImpl$Mutation$EnableService$enableService static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$EnableService$enableService( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Mutation$EnableService$enableService @@ -1564,49 +3706,75 @@ class _CopyWithStubImpl$Mutation$EnableService$enableService TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Variables$Mutation$DisableService { - Variables$Mutation$DisableService({required this.serviceId}); + factory Variables$Mutation$DisableService({required String serviceId}) => + Variables$Mutation$DisableService._({ + r'serviceId': serviceId, + }); + + Variables$Mutation$DisableService._(this._$data); + + factory Variables$Mutation$DisableService.fromJson( + Map data) { + final result$data = {}; + final l$serviceId = data['serviceId']; + result$data['serviceId'] = (l$serviceId as String); + return Variables$Mutation$DisableService._(result$data); + } + + Map _$data; + + String get serviceId => (_$data['serviceId'] as String); + Map toJson() { + final result$data = {}; + final l$serviceId = serviceId; + result$data['serviceId'] = l$serviceId; + return result$data; + } + + CopyWith$Variables$Mutation$DisableService + get copyWith => CopyWith$Variables$Mutation$DisableService( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$DisableService) || + runtimeType != other.runtimeType) { + return false; + } + final l$serviceId = serviceId; + final lOther$serviceId = other.serviceId; + if (l$serviceId != lOther$serviceId) { + return false; + } + return true; + } @override - factory Variables$Mutation$DisableService.fromJson( - Map json) => - _$Variables$Mutation$DisableServiceFromJson(json); - - final String serviceId; - - Map toJson() => - _$Variables$Mutation$DisableServiceToJson(this); int get hashCode { final l$serviceId = serviceId; return Object.hashAll([l$serviceId]); } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Variables$Mutation$DisableService) || - runtimeType != other.runtimeType) return false; - final l$serviceId = serviceId; - final lOther$serviceId = other.serviceId; - if (l$serviceId != lOther$serviceId) return false; - return true; - } - - CopyWith$Variables$Mutation$DisableService - get copyWith => - CopyWith$Variables$Mutation$DisableService(this, (i) => i); } abstract class CopyWith$Variables$Mutation$DisableService { factory CopyWith$Variables$Mutation$DisableService( - Variables$Mutation$DisableService instance, - TRes Function(Variables$Mutation$DisableService) then) = - _CopyWithImpl$Variables$Mutation$DisableService; + Variables$Mutation$DisableService instance, + TRes Function(Variables$Mutation$DisableService) then, + ) = _CopyWithImpl$Variables$Mutation$DisableService; factory CopyWith$Variables$Mutation$DisableService.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$DisableService; @@ -1616,7 +3784,10 @@ abstract class CopyWith$Variables$Mutation$DisableService { class _CopyWithImpl$Variables$Mutation$DisableService implements CopyWith$Variables$Mutation$DisableService { - _CopyWithImpl$Variables$Mutation$DisableService(this._instance, this._then); + _CopyWithImpl$Variables$Mutation$DisableService( + this._instance, + this._then, + ); final Variables$Mutation$DisableService _instance; @@ -1625,10 +3796,11 @@ class _CopyWithImpl$Variables$Mutation$DisableService static const _undefined = {}; TRes call({Object? serviceId = _undefined}) => - _then(Variables$Mutation$DisableService( - serviceId: serviceId == _undefined || serviceId == null - ? _instance.serviceId - : (serviceId as String))); + _then(Variables$Mutation$DisableService._({ + ..._instance._$data, + if (serviceId != _undefined && serviceId != null) + 'serviceId': (serviceId as String), + })); } class _CopyWithStubImpl$Variables$Mutation$DisableService @@ -1640,64 +3812,98 @@ class _CopyWithStubImpl$Variables$Mutation$DisableService call({String? serviceId}) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$DisableService { - Mutation$DisableService( - {required this.disableService, required this.$__typename}); + Mutation$DisableService({ + required this.disableService, + required this.$__typename, + }); - @override - factory Mutation$DisableService.fromJson(Map json) => - _$Mutation$DisableServiceFromJson(json); + factory Mutation$DisableService.fromJson(Map json) { + final l$disableService = json['disableService']; + final l$$__typename = json['__typename']; + return Mutation$DisableService( + disableService: Mutation$DisableService$disableService.fromJson( + (l$disableService as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$DisableService$disableService disableService; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$DisableServiceToJson(this); + Map toJson() { + final _resultData = {}; + final l$disableService = disableService; + _resultData['disableService'] = l$disableService.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$disableService = disableService; final l$$__typename = $__typename; - return Object.hashAll([l$disableService, l$$__typename]); + return Object.hashAll([ + l$disableService, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Mutation$DisableService) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Mutation$DisableService) || + runtimeType != other.runtimeType) { return false; + } final l$disableService = disableService; final lOther$disableService = other.disableService; - if (l$disableService != lOther$disableService) return false; + if (l$disableService != lOther$disableService) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Mutation$DisableService on Mutation$DisableService { CopyWith$Mutation$DisableService get copyWith => - CopyWith$Mutation$DisableService(this, (i) => i); + CopyWith$Mutation$DisableService( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$DisableService { - factory CopyWith$Mutation$DisableService(Mutation$DisableService instance, - TRes Function(Mutation$DisableService) then) = - _CopyWithImpl$Mutation$DisableService; + factory CopyWith$Mutation$DisableService( + Mutation$DisableService instance, + TRes Function(Mutation$DisableService) then, + ) = _CopyWithImpl$Mutation$DisableService; factory CopyWith$Mutation$DisableService.stub(TRes res) = _CopyWithStubImpl$Mutation$DisableService; - TRes call( - {Mutation$DisableService$disableService? disableService, - String? $__typename}); + TRes call({ + Mutation$DisableService$disableService? disableService, + String? $__typename, + }); CopyWith$Mutation$DisableService$disableService get disableService; } class _CopyWithImpl$Mutation$DisableService implements CopyWith$Mutation$DisableService { - _CopyWithImpl$Mutation$DisableService(this._instance, this._then); + _CopyWithImpl$Mutation$DisableService( + this._instance, + this._then, + ); final Mutation$DisableService _instance; @@ -1705,16 +3911,18 @@ class _CopyWithImpl$Mutation$DisableService static const _undefined = {}; - TRes call( - {Object? disableService = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? disableService = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$DisableService( - disableService: disableService == _undefined || disableService == null - ? _instance.disableService - : (disableService as Mutation$DisableService$disableService), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + disableService: disableService == _undefined || disableService == null + ? _instance.disableService + : (disableService as Mutation$DisableService$disableService), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$DisableService$disableService get disableService { final local$disableService = _instance.disableService; return CopyWith$Mutation$DisableService$disableService( @@ -1728,9 +3936,10 @@ class _CopyWithStubImpl$Mutation$DisableService TRes _res; - call( - {Mutation$DisableService$disableService? disableService, - String? $__typename}) => + call({ + Mutation$DisableService$disableService? disableService, + String? $__typename, + }) => _res; CopyWith$Mutation$DisableService$disableService get disableService => CopyWith$Mutation$DisableService$disableService.stub(_res); @@ -1738,86 +3947,99 @@ class _CopyWithStubImpl$Mutation$DisableService const documentNodeMutationDisableService = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'DisableService'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'serviceId')), - type: - NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'disableService'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'serviceId'), - value: VariableNode(name: NameNode(value: 'serviceId'))) - ], + type: OperationType.mutation, + name: NameNode(value: 'DisableService'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'serviceId')), + type: NamedTypeNode( + name: NameNode(value: 'String'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'disableService'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'serviceId'), + value: VariableNode(name: NameNode(value: 'serviceId')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$DisableService _parserFn$Mutation$DisableService( Map data) => Mutation$DisableService.fromJson(data); typedef OnMutationCompleted$Mutation$DisableService = FutureOr Function( - dynamic, Mutation$DisableService?); + dynamic, + Mutation$DisableService?, +); class Options$Mutation$DisableService extends graphql.MutationOptions { - Options$Mutation$DisableService( - {String? operationName, - required Variables$Mutation$DisableService variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$DisableService? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$DisableService({ + String? operationName, + required Variables$Mutation$DisableService variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$DisableService? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( data, data == null ? null - : _parserFn$Mutation$DisableService(data)), - update: update, - onError: onError, - document: documentNodeMutationDisableService, - parserFn: _parserFn$Mutation$DisableService); + : _parserFn$Mutation$DisableService(data), + ), + update: update, + onError: onError, + document: documentNodeMutationDisableService, + parserFn: _parserFn$Mutation$DisableService, + ); final OnMutationCompleted$Mutation$DisableService? onCompletedWithParsed; @@ -1826,38 +4048,39 @@ class Options$Mutation$DisableService ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$DisableService extends graphql.WatchQueryOptions { - WatchOptions$Mutation$DisableService( - {String? operationName, - required Variables$Mutation$DisableService variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationDisableService, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$DisableService); + WatchOptions$Mutation$DisableService({ + String? operationName, + required Variables$Mutation$DisableService variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationDisableService, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$DisableService, + ); } extension ClientExtension$Mutation$DisableService on graphql.GraphQLClient { @@ -1869,19 +4092,28 @@ extension ClientExtension$Mutation$DisableService on graphql.GraphQLClient { this.watchMutation(options); } -@JsonSerializable(explicitToJson: true) class Mutation$DisableService$disableService - implements Fragment$basicMutationReturnFields { - Mutation$DisableService$disableService( - {required this.code, - required this.message, - required this.success, - required this.$__typename}); + implements Fragment$basicMutationReturnFields$$ServiceMutationReturn { + Mutation$DisableService$disableService({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override factory Mutation$DisableService$disableService.fromJson( - Map json) => - _$Mutation$DisableService$disableServiceFromJson(json); + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Mutation$DisableService$disableService( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } final int code; @@ -1889,36 +4121,64 @@ class Mutation$DisableService$disableService final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Mutation$DisableService$disableServiceToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; - return Object.hashAll([l$code, l$message, l$success, l$$__typename]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$DisableService$disableService) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -1927,26 +4187,35 @@ extension UtilityExtension$Mutation$DisableService$disableService on Mutation$DisableService$disableService { CopyWith$Mutation$DisableService$disableService< Mutation$DisableService$disableService> - get copyWith => - CopyWith$Mutation$DisableService$disableService(this, (i) => i); + get copyWith => CopyWith$Mutation$DisableService$disableService( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$DisableService$disableService { factory CopyWith$Mutation$DisableService$disableService( - Mutation$DisableService$disableService instance, - TRes Function(Mutation$DisableService$disableService) then) = - _CopyWithImpl$Mutation$DisableService$disableService; + Mutation$DisableService$disableService instance, + TRes Function(Mutation$DisableService$disableService) then, + ) = _CopyWithImpl$Mutation$DisableService$disableService; factory CopyWith$Mutation$DisableService$disableService.stub(TRes res) = _CopyWithStubImpl$Mutation$DisableService$disableService; - TRes call({int? code, String? message, bool? success, String? $__typename}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); } class _CopyWithImpl$Mutation$DisableService$disableService implements CopyWith$Mutation$DisableService$disableService { _CopyWithImpl$Mutation$DisableService$disableService( - this._instance, this._then); + this._instance, + this._then, + ); final Mutation$DisableService$disableService _instance; @@ -1954,24 +4223,25 @@ class _CopyWithImpl$Mutation$DisableService$disableService static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$DisableService$disableService( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Mutation$DisableService$disableService @@ -1980,46 +4250,74 @@ class _CopyWithStubImpl$Mutation$DisableService$disableService TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Variables$Mutation$StopService { - Variables$Mutation$StopService({required this.serviceId}); + factory Variables$Mutation$StopService({required String serviceId}) => + Variables$Mutation$StopService._({ + r'serviceId': serviceId, + }); + + Variables$Mutation$StopService._(this._$data); + + factory Variables$Mutation$StopService.fromJson(Map data) { + final result$data = {}; + final l$serviceId = data['serviceId']; + result$data['serviceId'] = (l$serviceId as String); + return Variables$Mutation$StopService._(result$data); + } + + Map _$data; + + String get serviceId => (_$data['serviceId'] as String); + Map toJson() { + final result$data = {}; + final l$serviceId = serviceId; + result$data['serviceId'] = l$serviceId; + return result$data; + } + + CopyWith$Variables$Mutation$StopService + get copyWith => CopyWith$Variables$Mutation$StopService( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$StopService) || + runtimeType != other.runtimeType) { + return false; + } + final l$serviceId = serviceId; + final lOther$serviceId = other.serviceId; + if (l$serviceId != lOther$serviceId) { + return false; + } + return true; + } @override - factory Variables$Mutation$StopService.fromJson(Map json) => - _$Variables$Mutation$StopServiceFromJson(json); - - final String serviceId; - - Map toJson() => _$Variables$Mutation$StopServiceToJson(this); int get hashCode { final l$serviceId = serviceId; return Object.hashAll([l$serviceId]); } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Variables$Mutation$StopService) || - runtimeType != other.runtimeType) return false; - final l$serviceId = serviceId; - final lOther$serviceId = other.serviceId; - if (l$serviceId != lOther$serviceId) return false; - return true; - } - - CopyWith$Variables$Mutation$StopService - get copyWith => CopyWith$Variables$Mutation$StopService(this, (i) => i); } abstract class CopyWith$Variables$Mutation$StopService { factory CopyWith$Variables$Mutation$StopService( - Variables$Mutation$StopService instance, - TRes Function(Variables$Mutation$StopService) then) = - _CopyWithImpl$Variables$Mutation$StopService; + Variables$Mutation$StopService instance, + TRes Function(Variables$Mutation$StopService) then, + ) = _CopyWithImpl$Variables$Mutation$StopService; factory CopyWith$Variables$Mutation$StopService.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$StopService; @@ -2029,7 +4327,10 @@ abstract class CopyWith$Variables$Mutation$StopService { class _CopyWithImpl$Variables$Mutation$StopService implements CopyWith$Variables$Mutation$StopService { - _CopyWithImpl$Variables$Mutation$StopService(this._instance, this._then); + _CopyWithImpl$Variables$Mutation$StopService( + this._instance, + this._then, + ); final Variables$Mutation$StopService _instance; @@ -2038,10 +4339,11 @@ class _CopyWithImpl$Variables$Mutation$StopService static const _undefined = {}; TRes call({Object? serviceId = _undefined}) => - _then(Variables$Mutation$StopService( - serviceId: serviceId == _undefined || serviceId == null - ? _instance.serviceId - : (serviceId as String))); + _then(Variables$Mutation$StopService._({ + ..._instance._$data, + if (serviceId != _undefined && serviceId != null) + 'serviceId': (serviceId as String), + })); } class _CopyWithStubImpl$Variables$Mutation$StopService @@ -2053,62 +4355,97 @@ class _CopyWithStubImpl$Variables$Mutation$StopService call({String? serviceId}) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$StopService { - Mutation$StopService({required this.stopService, required this.$__typename}); + Mutation$StopService({ + required this.stopService, + required this.$__typename, + }); - @override - factory Mutation$StopService.fromJson(Map json) => - _$Mutation$StopServiceFromJson(json); + factory Mutation$StopService.fromJson(Map json) { + final l$stopService = json['stopService']; + final l$$__typename = json['__typename']; + return Mutation$StopService( + stopService: Mutation$StopService$stopService.fromJson( + (l$stopService as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$StopService$stopService stopService; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$StopServiceToJson(this); + Map toJson() { + final _resultData = {}; + final l$stopService = stopService; + _resultData['stopService'] = l$stopService.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$stopService = stopService; final l$$__typename = $__typename; - return Object.hashAll([l$stopService, l$$__typename]); + return Object.hashAll([ + l$stopService, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Mutation$StopService) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Mutation$StopService) || runtimeType != other.runtimeType) { return false; + } final l$stopService = stopService; final lOther$stopService = other.stopService; - if (l$stopService != lOther$stopService) return false; + if (l$stopService != lOther$stopService) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Mutation$StopService on Mutation$StopService { CopyWith$Mutation$StopService get copyWith => - CopyWith$Mutation$StopService(this, (i) => i); + CopyWith$Mutation$StopService( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$StopService { - factory CopyWith$Mutation$StopService(Mutation$StopService instance, - TRes Function(Mutation$StopService) then) = - _CopyWithImpl$Mutation$StopService; + factory CopyWith$Mutation$StopService( + Mutation$StopService instance, + TRes Function(Mutation$StopService) then, + ) = _CopyWithImpl$Mutation$StopService; factory CopyWith$Mutation$StopService.stub(TRes res) = _CopyWithStubImpl$Mutation$StopService; - TRes call( - {Mutation$StopService$stopService? stopService, String? $__typename}); + TRes call({ + Mutation$StopService$stopService? stopService, + String? $__typename, + }); CopyWith$Mutation$StopService$stopService get stopService; } class _CopyWithImpl$Mutation$StopService implements CopyWith$Mutation$StopService { - _CopyWithImpl$Mutation$StopService(this._instance, this._then); + _CopyWithImpl$Mutation$StopService( + this._instance, + this._then, + ); final Mutation$StopService _instance; @@ -2116,16 +4453,18 @@ class _CopyWithImpl$Mutation$StopService static const _undefined = {}; - TRes call( - {Object? stopService = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? stopService = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$StopService( - stopService: stopService == _undefined || stopService == null - ? _instance.stopService - : (stopService as Mutation$StopService$stopService), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + stopService: stopService == _undefined || stopService == null + ? _instance.stopService + : (stopService as Mutation$StopService$stopService), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$StopService$stopService get stopService { final local$stopService = _instance.stopService; return CopyWith$Mutation$StopService$stopService( @@ -2139,7 +4478,10 @@ class _CopyWithStubImpl$Mutation$StopService TRes _res; - call({Mutation$StopService$stopService? stopService, String? $__typename}) => + call({ + Mutation$StopService$stopService? stopService, + String? $__typename, + }) => _res; CopyWith$Mutation$StopService$stopService get stopService => CopyWith$Mutation$StopService$stopService.stub(_res); @@ -2147,83 +4489,97 @@ class _CopyWithStubImpl$Mutation$StopService const documentNodeMutationStopService = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'StopService'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'serviceId')), - type: - NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'stopService'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'serviceId'), - value: VariableNode(name: NameNode(value: 'serviceId'))) - ], + type: OperationType.mutation, + name: NameNode(value: 'StopService'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'serviceId')), + type: NamedTypeNode( + name: NameNode(value: 'String'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'stopService'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'serviceId'), + value: VariableNode(name: NameNode(value: 'serviceId')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$StopService _parserFn$Mutation$StopService( Map data) => Mutation$StopService.fromJson(data); typedef OnMutationCompleted$Mutation$StopService = FutureOr Function( - dynamic, Mutation$StopService?); + dynamic, + Mutation$StopService?, +); class Options$Mutation$StopService extends graphql.MutationOptions { - Options$Mutation$StopService( - {String? operationName, - required Variables$Mutation$StopService variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$StopService? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$StopService({ + String? operationName, + required Variables$Mutation$StopService variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$StopService? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted(data, - data == null ? null : _parserFn$Mutation$StopService(data)), - update: update, - onError: onError, - document: documentNodeMutationStopService, - parserFn: _parserFn$Mutation$StopService); + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( + data, + data == null ? null : _parserFn$Mutation$StopService(data), + ), + update: update, + onError: onError, + document: documentNodeMutationStopService, + parserFn: _parserFn$Mutation$StopService, + ); final OnMutationCompleted$Mutation$StopService? onCompletedWithParsed; @@ -2232,38 +4588,39 @@ class Options$Mutation$StopService ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$StopService extends graphql.WatchQueryOptions { - WatchOptions$Mutation$StopService( - {String? operationName, - required Variables$Mutation$StopService variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationStopService, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$StopService); + WatchOptions$Mutation$StopService({ + String? operationName, + required Variables$Mutation$StopService variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationStopService, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$StopService, + ); } extension ClientExtension$Mutation$StopService on graphql.GraphQLClient { @@ -2275,19 +4632,27 @@ extension ClientExtension$Mutation$StopService on graphql.GraphQLClient { this.watchMutation(options); } -@JsonSerializable(explicitToJson: true) class Mutation$StopService$stopService - implements Fragment$basicMutationReturnFields { - Mutation$StopService$stopService( - {required this.code, - required this.message, - required this.success, - required this.$__typename}); + implements Fragment$basicMutationReturnFields$$ServiceMutationReturn { + Mutation$StopService$stopService({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override - factory Mutation$StopService$stopService.fromJson( - Map json) => - _$Mutation$StopService$stopServiceFromJson(json); + factory Mutation$StopService$stopService.fromJson(Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Mutation$StopService$stopService( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } final int code; @@ -2295,36 +4660,64 @@ class Mutation$StopService$stopService final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Mutation$StopService$stopServiceToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; - return Object.hashAll([l$code, l$message, l$success, l$$__typename]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$StopService$stopService) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -2332,24 +4725,35 @@ class Mutation$StopService$stopService extension UtilityExtension$Mutation$StopService$stopService on Mutation$StopService$stopService { CopyWith$Mutation$StopService$stopService - get copyWith => CopyWith$Mutation$StopService$stopService(this, (i) => i); + get copyWith => CopyWith$Mutation$StopService$stopService( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$StopService$stopService { factory CopyWith$Mutation$StopService$stopService( - Mutation$StopService$stopService instance, - TRes Function(Mutation$StopService$stopService) then) = - _CopyWithImpl$Mutation$StopService$stopService; + Mutation$StopService$stopService instance, + TRes Function(Mutation$StopService$stopService) then, + ) = _CopyWithImpl$Mutation$StopService$stopService; factory CopyWith$Mutation$StopService$stopService.stub(TRes res) = _CopyWithStubImpl$Mutation$StopService$stopService; - TRes call({int? code, String? message, bool? success, String? $__typename}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); } class _CopyWithImpl$Mutation$StopService$stopService implements CopyWith$Mutation$StopService$stopService { - _CopyWithImpl$Mutation$StopService$stopService(this._instance, this._then); + _CopyWithImpl$Mutation$StopService$stopService( + this._instance, + this._then, + ); final Mutation$StopService$stopService _instance; @@ -2357,24 +4761,25 @@ class _CopyWithImpl$Mutation$StopService$stopService static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$StopService$stopService( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Mutation$StopService$stopService @@ -2383,47 +4788,74 @@ class _CopyWithStubImpl$Mutation$StopService$stopService TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Variables$Mutation$StartService { - Variables$Mutation$StartService({required this.serviceId}); + factory Variables$Mutation$StartService({required String serviceId}) => + Variables$Mutation$StartService._({ + r'serviceId': serviceId, + }); + + Variables$Mutation$StartService._(this._$data); + + factory Variables$Mutation$StartService.fromJson(Map data) { + final result$data = {}; + final l$serviceId = data['serviceId']; + result$data['serviceId'] = (l$serviceId as String); + return Variables$Mutation$StartService._(result$data); + } + + Map _$data; + + String get serviceId => (_$data['serviceId'] as String); + Map toJson() { + final result$data = {}; + final l$serviceId = serviceId; + result$data['serviceId'] = l$serviceId; + return result$data; + } + + CopyWith$Variables$Mutation$StartService + get copyWith => CopyWith$Variables$Mutation$StartService( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$StartService) || + runtimeType != other.runtimeType) { + return false; + } + final l$serviceId = serviceId; + final lOther$serviceId = other.serviceId; + if (l$serviceId != lOther$serviceId) { + return false; + } + return true; + } @override - factory Variables$Mutation$StartService.fromJson(Map json) => - _$Variables$Mutation$StartServiceFromJson(json); - - final String serviceId; - - Map toJson() => - _$Variables$Mutation$StartServiceToJson(this); int get hashCode { final l$serviceId = serviceId; return Object.hashAll([l$serviceId]); } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Variables$Mutation$StartService) || - runtimeType != other.runtimeType) return false; - final l$serviceId = serviceId; - final lOther$serviceId = other.serviceId; - if (l$serviceId != lOther$serviceId) return false; - return true; - } - - CopyWith$Variables$Mutation$StartService - get copyWith => CopyWith$Variables$Mutation$StartService(this, (i) => i); } abstract class CopyWith$Variables$Mutation$StartService { factory CopyWith$Variables$Mutation$StartService( - Variables$Mutation$StartService instance, - TRes Function(Variables$Mutation$StartService) then) = - _CopyWithImpl$Variables$Mutation$StartService; + Variables$Mutation$StartService instance, + TRes Function(Variables$Mutation$StartService) then, + ) = _CopyWithImpl$Variables$Mutation$StartService; factory CopyWith$Variables$Mutation$StartService.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$StartService; @@ -2433,7 +4865,10 @@ abstract class CopyWith$Variables$Mutation$StartService { class _CopyWithImpl$Variables$Mutation$StartService implements CopyWith$Variables$Mutation$StartService { - _CopyWithImpl$Variables$Mutation$StartService(this._instance, this._then); + _CopyWithImpl$Variables$Mutation$StartService( + this._instance, + this._then, + ); final Variables$Mutation$StartService _instance; @@ -2442,10 +4877,11 @@ class _CopyWithImpl$Variables$Mutation$StartService static const _undefined = {}; TRes call({Object? serviceId = _undefined}) => - _then(Variables$Mutation$StartService( - serviceId: serviceId == _undefined || serviceId == null - ? _instance.serviceId - : (serviceId as String))); + _then(Variables$Mutation$StartService._({ + ..._instance._$data, + if (serviceId != _undefined && serviceId != null) + 'serviceId': (serviceId as String), + })); } class _CopyWithStubImpl$Variables$Mutation$StartService @@ -2457,63 +4893,97 @@ class _CopyWithStubImpl$Variables$Mutation$StartService call({String? serviceId}) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$StartService { - Mutation$StartService( - {required this.startService, required this.$__typename}); + Mutation$StartService({ + required this.startService, + required this.$__typename, + }); - @override - factory Mutation$StartService.fromJson(Map json) => - _$Mutation$StartServiceFromJson(json); + factory Mutation$StartService.fromJson(Map json) { + final l$startService = json['startService']; + final l$$__typename = json['__typename']; + return Mutation$StartService( + startService: Mutation$StartService$startService.fromJson( + (l$startService as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$StartService$startService startService; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$StartServiceToJson(this); + Map toJson() { + final _resultData = {}; + final l$startService = startService; + _resultData['startService'] = l$startService.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$startService = startService; final l$$__typename = $__typename; - return Object.hashAll([l$startService, l$$__typename]); + return Object.hashAll([ + l$startService, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Mutation$StartService) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Mutation$StartService) || runtimeType != other.runtimeType) { return false; + } final l$startService = startService; final lOther$startService = other.startService; - if (l$startService != lOther$startService) return false; + if (l$startService != lOther$startService) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Mutation$StartService on Mutation$StartService { CopyWith$Mutation$StartService get copyWith => - CopyWith$Mutation$StartService(this, (i) => i); + CopyWith$Mutation$StartService( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$StartService { - factory CopyWith$Mutation$StartService(Mutation$StartService instance, - TRes Function(Mutation$StartService) then) = - _CopyWithImpl$Mutation$StartService; + factory CopyWith$Mutation$StartService( + Mutation$StartService instance, + TRes Function(Mutation$StartService) then, + ) = _CopyWithImpl$Mutation$StartService; factory CopyWith$Mutation$StartService.stub(TRes res) = _CopyWithStubImpl$Mutation$StartService; - TRes call( - {Mutation$StartService$startService? startService, String? $__typename}); + TRes call({ + Mutation$StartService$startService? startService, + String? $__typename, + }); CopyWith$Mutation$StartService$startService get startService; } class _CopyWithImpl$Mutation$StartService implements CopyWith$Mutation$StartService { - _CopyWithImpl$Mutation$StartService(this._instance, this._then); + _CopyWithImpl$Mutation$StartService( + this._instance, + this._then, + ); final Mutation$StartService _instance; @@ -2521,16 +4991,18 @@ class _CopyWithImpl$Mutation$StartService static const _undefined = {}; - TRes call( - {Object? startService = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? startService = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$StartService( - startService: startService == _undefined || startService == null - ? _instance.startService - : (startService as Mutation$StartService$startService), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + startService: startService == _undefined || startService == null + ? _instance.startService + : (startService as Mutation$StartService$startService), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$StartService$startService get startService { final local$startService = _instance.startService; return CopyWith$Mutation$StartService$startService( @@ -2544,9 +5016,10 @@ class _CopyWithStubImpl$Mutation$StartService TRes _res; - call( - {Mutation$StartService$startService? startService, - String? $__typename}) => + call({ + Mutation$StartService$startService? startService, + String? $__typename, + }) => _res; CopyWith$Mutation$StartService$startService get startService => CopyWith$Mutation$StartService$startService.stub(_res); @@ -2554,86 +5027,97 @@ class _CopyWithStubImpl$Mutation$StartService const documentNodeMutationStartService = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'StartService'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'serviceId')), - type: - NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'startService'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'serviceId'), - value: VariableNode(name: NameNode(value: 'serviceId'))) - ], + type: OperationType.mutation, + name: NameNode(value: 'StartService'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'serviceId')), + type: NamedTypeNode( + name: NameNode(value: 'String'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'startService'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'serviceId'), + value: VariableNode(name: NameNode(value: 'serviceId')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$StartService _parserFn$Mutation$StartService( Map data) => Mutation$StartService.fromJson(data); typedef OnMutationCompleted$Mutation$StartService = FutureOr Function( - dynamic, Mutation$StartService?); + dynamic, + Mutation$StartService?, +); class Options$Mutation$StartService extends graphql.MutationOptions { - Options$Mutation$StartService( - {String? operationName, - required Variables$Mutation$StartService variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$StartService? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$StartService({ + String? operationName, + required Variables$Mutation$StartService variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$StartService? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( data, - data == null - ? null - : _parserFn$Mutation$StartService(data)), - update: update, - onError: onError, - document: documentNodeMutationStartService, - parserFn: _parserFn$Mutation$StartService); + data == null ? null : _parserFn$Mutation$StartService(data), + ), + update: update, + onError: onError, + document: documentNodeMutationStartService, + parserFn: _parserFn$Mutation$StartService, + ); final OnMutationCompleted$Mutation$StartService? onCompletedWithParsed; @@ -2642,38 +5126,39 @@ class Options$Mutation$StartService ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$StartService extends graphql.WatchQueryOptions { - WatchOptions$Mutation$StartService( - {String? operationName, - required Variables$Mutation$StartService variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationStartService, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$StartService); + WatchOptions$Mutation$StartService({ + String? operationName, + required Variables$Mutation$StartService variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationStartService, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$StartService, + ); } extension ClientExtension$Mutation$StartService on graphql.GraphQLClient { @@ -2685,19 +5170,28 @@ extension ClientExtension$Mutation$StartService on graphql.GraphQLClient { this.watchMutation(options); } -@JsonSerializable(explicitToJson: true) class Mutation$StartService$startService - implements Fragment$basicMutationReturnFields { - Mutation$StartService$startService( - {required this.code, - required this.message, - required this.success, - required this.$__typename}); + implements Fragment$basicMutationReturnFields$$ServiceMutationReturn { + Mutation$StartService$startService({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override factory Mutation$StartService$startService.fromJson( - Map json) => - _$Mutation$StartService$startServiceFromJson(json); + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Mutation$StartService$startService( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } final int code; @@ -2705,36 +5199,64 @@ class Mutation$StartService$startService final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Mutation$StartService$startServiceToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; - return Object.hashAll([l$code, l$message, l$success, l$$__typename]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$StartService$startService) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -2743,25 +5265,35 @@ extension UtilityExtension$Mutation$StartService$startService on Mutation$StartService$startService { CopyWith$Mutation$StartService$startService< Mutation$StartService$startService> - get copyWith => - CopyWith$Mutation$StartService$startService(this, (i) => i); + get copyWith => CopyWith$Mutation$StartService$startService( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$StartService$startService { factory CopyWith$Mutation$StartService$startService( - Mutation$StartService$startService instance, - TRes Function(Mutation$StartService$startService) then) = - _CopyWithImpl$Mutation$StartService$startService; + Mutation$StartService$startService instance, + TRes Function(Mutation$StartService$startService) then, + ) = _CopyWithImpl$Mutation$StartService$startService; factory CopyWith$Mutation$StartService$startService.stub(TRes res) = _CopyWithStubImpl$Mutation$StartService$startService; - TRes call({int? code, String? message, bool? success, String? $__typename}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); } class _CopyWithImpl$Mutation$StartService$startService implements CopyWith$Mutation$StartService$startService { - _CopyWithImpl$Mutation$StartService$startService(this._instance, this._then); + _CopyWithImpl$Mutation$StartService$startService( + this._instance, + this._then, + ); final Mutation$StartService$startService _instance; @@ -2769,24 +5301,25 @@ class _CopyWithImpl$Mutation$StartService$startService static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$StartService$startService( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Mutation$StartService$startService @@ -2795,49 +5328,75 @@ class _CopyWithStubImpl$Mutation$StartService$startService TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Variables$Mutation$RestartService { - Variables$Mutation$RestartService({required this.serviceId}); + factory Variables$Mutation$RestartService({required String serviceId}) => + Variables$Mutation$RestartService._({ + r'serviceId': serviceId, + }); + + Variables$Mutation$RestartService._(this._$data); + + factory Variables$Mutation$RestartService.fromJson( + Map data) { + final result$data = {}; + final l$serviceId = data['serviceId']; + result$data['serviceId'] = (l$serviceId as String); + return Variables$Mutation$RestartService._(result$data); + } + + Map _$data; + + String get serviceId => (_$data['serviceId'] as String); + Map toJson() { + final result$data = {}; + final l$serviceId = serviceId; + result$data['serviceId'] = l$serviceId; + return result$data; + } + + CopyWith$Variables$Mutation$RestartService + get copyWith => CopyWith$Variables$Mutation$RestartService( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$RestartService) || + runtimeType != other.runtimeType) { + return false; + } + final l$serviceId = serviceId; + final lOther$serviceId = other.serviceId; + if (l$serviceId != lOther$serviceId) { + return false; + } + return true; + } @override - factory Variables$Mutation$RestartService.fromJson( - Map json) => - _$Variables$Mutation$RestartServiceFromJson(json); - - final String serviceId; - - Map toJson() => - _$Variables$Mutation$RestartServiceToJson(this); int get hashCode { final l$serviceId = serviceId; return Object.hashAll([l$serviceId]); } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Variables$Mutation$RestartService) || - runtimeType != other.runtimeType) return false; - final l$serviceId = serviceId; - final lOther$serviceId = other.serviceId; - if (l$serviceId != lOther$serviceId) return false; - return true; - } - - CopyWith$Variables$Mutation$RestartService - get copyWith => - CopyWith$Variables$Mutation$RestartService(this, (i) => i); } abstract class CopyWith$Variables$Mutation$RestartService { factory CopyWith$Variables$Mutation$RestartService( - Variables$Mutation$RestartService instance, - TRes Function(Variables$Mutation$RestartService) then) = - _CopyWithImpl$Variables$Mutation$RestartService; + Variables$Mutation$RestartService instance, + TRes Function(Variables$Mutation$RestartService) then, + ) = _CopyWithImpl$Variables$Mutation$RestartService; factory CopyWith$Variables$Mutation$RestartService.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$RestartService; @@ -2847,7 +5406,10 @@ abstract class CopyWith$Variables$Mutation$RestartService { class _CopyWithImpl$Variables$Mutation$RestartService implements CopyWith$Variables$Mutation$RestartService { - _CopyWithImpl$Variables$Mutation$RestartService(this._instance, this._then); + _CopyWithImpl$Variables$Mutation$RestartService( + this._instance, + this._then, + ); final Variables$Mutation$RestartService _instance; @@ -2856,10 +5418,11 @@ class _CopyWithImpl$Variables$Mutation$RestartService static const _undefined = {}; TRes call({Object? serviceId = _undefined}) => - _then(Variables$Mutation$RestartService( - serviceId: serviceId == _undefined || serviceId == null - ? _instance.serviceId - : (serviceId as String))); + _then(Variables$Mutation$RestartService._({ + ..._instance._$data, + if (serviceId != _undefined && serviceId != null) + 'serviceId': (serviceId as String), + })); } class _CopyWithStubImpl$Variables$Mutation$RestartService @@ -2871,64 +5434,98 @@ class _CopyWithStubImpl$Variables$Mutation$RestartService call({String? serviceId}) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$RestartService { - Mutation$RestartService( - {required this.restartService, required this.$__typename}); + Mutation$RestartService({ + required this.restartService, + required this.$__typename, + }); - @override - factory Mutation$RestartService.fromJson(Map json) => - _$Mutation$RestartServiceFromJson(json); + factory Mutation$RestartService.fromJson(Map json) { + final l$restartService = json['restartService']; + final l$$__typename = json['__typename']; + return Mutation$RestartService( + restartService: Mutation$RestartService$restartService.fromJson( + (l$restartService as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$RestartService$restartService restartService; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$RestartServiceToJson(this); + Map toJson() { + final _resultData = {}; + final l$restartService = restartService; + _resultData['restartService'] = l$restartService.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$restartService = restartService; final l$$__typename = $__typename; - return Object.hashAll([l$restartService, l$$__typename]); + return Object.hashAll([ + l$restartService, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Mutation$RestartService) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Mutation$RestartService) || + runtimeType != other.runtimeType) { return false; + } final l$restartService = restartService; final lOther$restartService = other.restartService; - if (l$restartService != lOther$restartService) return false; + if (l$restartService != lOther$restartService) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Mutation$RestartService on Mutation$RestartService { CopyWith$Mutation$RestartService get copyWith => - CopyWith$Mutation$RestartService(this, (i) => i); + CopyWith$Mutation$RestartService( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$RestartService { - factory CopyWith$Mutation$RestartService(Mutation$RestartService instance, - TRes Function(Mutation$RestartService) then) = - _CopyWithImpl$Mutation$RestartService; + factory CopyWith$Mutation$RestartService( + Mutation$RestartService instance, + TRes Function(Mutation$RestartService) then, + ) = _CopyWithImpl$Mutation$RestartService; factory CopyWith$Mutation$RestartService.stub(TRes res) = _CopyWithStubImpl$Mutation$RestartService; - TRes call( - {Mutation$RestartService$restartService? restartService, - String? $__typename}); + TRes call({ + Mutation$RestartService$restartService? restartService, + String? $__typename, + }); CopyWith$Mutation$RestartService$restartService get restartService; } class _CopyWithImpl$Mutation$RestartService implements CopyWith$Mutation$RestartService { - _CopyWithImpl$Mutation$RestartService(this._instance, this._then); + _CopyWithImpl$Mutation$RestartService( + this._instance, + this._then, + ); final Mutation$RestartService _instance; @@ -2936,16 +5533,18 @@ class _CopyWithImpl$Mutation$RestartService static const _undefined = {}; - TRes call( - {Object? restartService = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? restartService = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$RestartService( - restartService: restartService == _undefined || restartService == null - ? _instance.restartService - : (restartService as Mutation$RestartService$restartService), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + restartService: restartService == _undefined || restartService == null + ? _instance.restartService + : (restartService as Mutation$RestartService$restartService), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$RestartService$restartService get restartService { final local$restartService = _instance.restartService; return CopyWith$Mutation$RestartService$restartService( @@ -2959,9 +5558,10 @@ class _CopyWithStubImpl$Mutation$RestartService TRes _res; - call( - {Mutation$RestartService$restartService? restartService, - String? $__typename}) => + call({ + Mutation$RestartService$restartService? restartService, + String? $__typename, + }) => _res; CopyWith$Mutation$RestartService$restartService get restartService => CopyWith$Mutation$RestartService$restartService.stub(_res); @@ -2969,86 +5569,99 @@ class _CopyWithStubImpl$Mutation$RestartService const documentNodeMutationRestartService = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'RestartService'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'serviceId')), - type: - NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'restartService'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'serviceId'), - value: VariableNode(name: NameNode(value: 'serviceId'))) - ], + type: OperationType.mutation, + name: NameNode(value: 'RestartService'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'serviceId')), + type: NamedTypeNode( + name: NameNode(value: 'String'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'restartService'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'serviceId'), + value: VariableNode(name: NameNode(value: 'serviceId')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$RestartService _parserFn$Mutation$RestartService( Map data) => Mutation$RestartService.fromJson(data); typedef OnMutationCompleted$Mutation$RestartService = FutureOr Function( - dynamic, Mutation$RestartService?); + dynamic, + Mutation$RestartService?, +); class Options$Mutation$RestartService extends graphql.MutationOptions { - Options$Mutation$RestartService( - {String? operationName, - required Variables$Mutation$RestartService variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$RestartService? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$RestartService({ + String? operationName, + required Variables$Mutation$RestartService variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$RestartService? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( data, data == null ? null - : _parserFn$Mutation$RestartService(data)), - update: update, - onError: onError, - document: documentNodeMutationRestartService, - parserFn: _parserFn$Mutation$RestartService); + : _parserFn$Mutation$RestartService(data), + ), + update: update, + onError: onError, + document: documentNodeMutationRestartService, + parserFn: _parserFn$Mutation$RestartService, + ); final OnMutationCompleted$Mutation$RestartService? onCompletedWithParsed; @@ -3057,38 +5670,39 @@ class Options$Mutation$RestartService ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$RestartService extends graphql.WatchQueryOptions { - WatchOptions$Mutation$RestartService( - {String? operationName, - required Variables$Mutation$RestartService variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationRestartService, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$RestartService); + WatchOptions$Mutation$RestartService({ + String? operationName, + required Variables$Mutation$RestartService variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationRestartService, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$RestartService, + ); } extension ClientExtension$Mutation$RestartService on graphql.GraphQLClient { @@ -3100,19 +5714,28 @@ extension ClientExtension$Mutation$RestartService on graphql.GraphQLClient { this.watchMutation(options); } -@JsonSerializable(explicitToJson: true) class Mutation$RestartService$restartService - implements Fragment$basicMutationReturnFields { - Mutation$RestartService$restartService( - {required this.code, - required this.message, - required this.success, - required this.$__typename}); + implements Fragment$basicMutationReturnFields$$ServiceMutationReturn { + Mutation$RestartService$restartService({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override factory Mutation$RestartService$restartService.fromJson( - Map json) => - _$Mutation$RestartService$restartServiceFromJson(json); + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Mutation$RestartService$restartService( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } final int code; @@ -3120,36 +5743,64 @@ class Mutation$RestartService$restartService final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Mutation$RestartService$restartServiceToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; - return Object.hashAll([l$code, l$message, l$success, l$$__typename]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$RestartService$restartService) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -3158,26 +5809,35 @@ extension UtilityExtension$Mutation$RestartService$restartService on Mutation$RestartService$restartService { CopyWith$Mutation$RestartService$restartService< Mutation$RestartService$restartService> - get copyWith => - CopyWith$Mutation$RestartService$restartService(this, (i) => i); + get copyWith => CopyWith$Mutation$RestartService$restartService( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$RestartService$restartService { factory CopyWith$Mutation$RestartService$restartService( - Mutation$RestartService$restartService instance, - TRes Function(Mutation$RestartService$restartService) then) = - _CopyWithImpl$Mutation$RestartService$restartService; + Mutation$RestartService$restartService instance, + TRes Function(Mutation$RestartService$restartService) then, + ) = _CopyWithImpl$Mutation$RestartService$restartService; factory CopyWith$Mutation$RestartService$restartService.stub(TRes res) = _CopyWithStubImpl$Mutation$RestartService$restartService; - TRes call({int? code, String? message, bool? success, String? $__typename}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); } class _CopyWithImpl$Mutation$RestartService$restartService implements CopyWith$Mutation$RestartService$restartService { _CopyWithImpl$Mutation$RestartService$restartService( - this._instance, this._then); + this._instance, + this._then, + ); final Mutation$RestartService$restartService _instance; @@ -3185,24 +5845,25 @@ class _CopyWithImpl$Mutation$RestartService$restartService static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$RestartService$restartService( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Mutation$RestartService$restartService @@ -3211,46 +5872,77 @@ class _CopyWithStubImpl$Mutation$RestartService$restartService TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Variables$Mutation$MoveService { - Variables$Mutation$MoveService({required this.input}); + factory Variables$Mutation$MoveService( + {required Input$MoveServiceInput input}) => + Variables$Mutation$MoveService._({ + r'input': input, + }); + + Variables$Mutation$MoveService._(this._$data); + + factory Variables$Mutation$MoveService.fromJson(Map data) { + final result$data = {}; + final l$input = data['input']; + result$data['input'] = + Input$MoveServiceInput.fromJson((l$input as Map)); + return Variables$Mutation$MoveService._(result$data); + } + + Map _$data; + + Input$MoveServiceInput get input => + (_$data['input'] as Input$MoveServiceInput); + Map toJson() { + final result$data = {}; + final l$input = input; + result$data['input'] = l$input.toJson(); + return result$data; + } + + CopyWith$Variables$Mutation$MoveService + get copyWith => CopyWith$Variables$Mutation$MoveService( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$MoveService) || + runtimeType != other.runtimeType) { + return false; + } + final l$input = input; + final lOther$input = other.input; + if (l$input != lOther$input) { + return false; + } + return true; + } @override - factory Variables$Mutation$MoveService.fromJson(Map json) => - _$Variables$Mutation$MoveServiceFromJson(json); - - final Input$MoveServiceInput input; - - Map toJson() => _$Variables$Mutation$MoveServiceToJson(this); int get hashCode { final l$input = input; return Object.hashAll([l$input]); } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Variables$Mutation$MoveService) || - runtimeType != other.runtimeType) return false; - final l$input = input; - final lOther$input = other.input; - if (l$input != lOther$input) return false; - return true; - } - - CopyWith$Variables$Mutation$MoveService - get copyWith => CopyWith$Variables$Mutation$MoveService(this, (i) => i); } abstract class CopyWith$Variables$Mutation$MoveService { factory CopyWith$Variables$Mutation$MoveService( - Variables$Mutation$MoveService instance, - TRes Function(Variables$Mutation$MoveService) then) = - _CopyWithImpl$Variables$Mutation$MoveService; + Variables$Mutation$MoveService instance, + TRes Function(Variables$Mutation$MoveService) then, + ) = _CopyWithImpl$Variables$Mutation$MoveService; factory CopyWith$Variables$Mutation$MoveService.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$MoveService; @@ -3260,7 +5952,10 @@ abstract class CopyWith$Variables$Mutation$MoveService { class _CopyWithImpl$Variables$Mutation$MoveService implements CopyWith$Variables$Mutation$MoveService { - _CopyWithImpl$Variables$Mutation$MoveService(this._instance, this._then); + _CopyWithImpl$Variables$Mutation$MoveService( + this._instance, + this._then, + ); final Variables$Mutation$MoveService _instance; @@ -3269,10 +5964,11 @@ class _CopyWithImpl$Variables$Mutation$MoveService static const _undefined = {}; TRes call({Object? input = _undefined}) => - _then(Variables$Mutation$MoveService( - input: input == _undefined || input == null - ? _instance.input - : (input as Input$MoveServiceInput))); + _then(Variables$Mutation$MoveService._({ + ..._instance._$data, + if (input != _undefined && input != null) + 'input': (input as Input$MoveServiceInput), + })); } class _CopyWithStubImpl$Variables$Mutation$MoveService @@ -3284,62 +5980,97 @@ class _CopyWithStubImpl$Variables$Mutation$MoveService call({Input$MoveServiceInput? input}) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$MoveService { - Mutation$MoveService({required this.moveService, required this.$__typename}); + Mutation$MoveService({ + required this.moveService, + required this.$__typename, + }); - @override - factory Mutation$MoveService.fromJson(Map json) => - _$Mutation$MoveServiceFromJson(json); + factory Mutation$MoveService.fromJson(Map json) { + final l$moveService = json['moveService']; + final l$$__typename = json['__typename']; + return Mutation$MoveService( + moveService: Mutation$MoveService$moveService.fromJson( + (l$moveService as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$MoveService$moveService moveService; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$MoveServiceToJson(this); + Map toJson() { + final _resultData = {}; + final l$moveService = moveService; + _resultData['moveService'] = l$moveService.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$moveService = moveService; final l$$__typename = $__typename; - return Object.hashAll([l$moveService, l$$__typename]); + return Object.hashAll([ + l$moveService, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Mutation$MoveService) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Mutation$MoveService) || runtimeType != other.runtimeType) { return false; + } final l$moveService = moveService; final lOther$moveService = other.moveService; - if (l$moveService != lOther$moveService) return false; + if (l$moveService != lOther$moveService) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Mutation$MoveService on Mutation$MoveService { CopyWith$Mutation$MoveService get copyWith => - CopyWith$Mutation$MoveService(this, (i) => i); + CopyWith$Mutation$MoveService( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$MoveService { - factory CopyWith$Mutation$MoveService(Mutation$MoveService instance, - TRes Function(Mutation$MoveService) then) = - _CopyWithImpl$Mutation$MoveService; + factory CopyWith$Mutation$MoveService( + Mutation$MoveService instance, + TRes Function(Mutation$MoveService) then, + ) = _CopyWithImpl$Mutation$MoveService; factory CopyWith$Mutation$MoveService.stub(TRes res) = _CopyWithStubImpl$Mutation$MoveService; - TRes call( - {Mutation$MoveService$moveService? moveService, String? $__typename}); + TRes call({ + Mutation$MoveService$moveService? moveService, + String? $__typename, + }); CopyWith$Mutation$MoveService$moveService get moveService; } class _CopyWithImpl$Mutation$MoveService implements CopyWith$Mutation$MoveService { - _CopyWithImpl$Mutation$MoveService(this._instance, this._then); + _CopyWithImpl$Mutation$MoveService( + this._instance, + this._then, + ); final Mutation$MoveService _instance; @@ -3347,16 +6078,18 @@ class _CopyWithImpl$Mutation$MoveService static const _undefined = {}; - TRes call( - {Object? moveService = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? moveService = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$MoveService( - moveService: moveService == _undefined || moveService == null - ? _instance.moveService - : (moveService as Mutation$MoveService$moveService), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + moveService: moveService == _undefined || moveService == null + ? _instance.moveService + : (moveService as Mutation$MoveService$moveService), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$MoveService$moveService get moveService { final local$moveService = _instance.moveService; return CopyWith$Mutation$MoveService$moveService( @@ -3370,7 +6103,10 @@ class _CopyWithStubImpl$Mutation$MoveService TRes _res; - call({Mutation$MoveService$moveService? moveService, String? $__typename}) => + call({ + Mutation$MoveService$moveService? moveService, + String? $__typename, + }) => _res; CopyWith$Mutation$MoveService$moveService get moveService => CopyWith$Mutation$MoveService$moveService.stub(_res); @@ -3378,162 +6114,189 @@ class _CopyWithStubImpl$Mutation$MoveService const documentNodeMutationMoveService = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'MoveService'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'input')), - type: NamedTypeNode( - name: NameNode(value: 'MoveServiceInput'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'moveService'), + type: OperationType.mutation, + name: NameNode(value: 'MoveService'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'input')), + type: NamedTypeNode( + name: NameNode(value: 'MoveServiceInput'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'moveService'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'input'), + value: VariableNode(name: NameNode(value: 'input')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: [], + ), + FieldNode( + name: NameNode(value: 'job'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'input'), - value: VariableNode(name: NameNode(value: 'input'))) - ], + arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), FieldNode( - name: NameNode(value: 'job'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'createdAt'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'description'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'error'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'finishedAt'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'name'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'progress'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'result'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'status'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'statusText'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'uid'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'updatedAt'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), + name: NameNode(value: 'createdAt'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + name: NameNode(value: 'description'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'error'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'finishedAt'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'name'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'progress'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'result'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'status'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'statusText'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'uid'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'updatedAt'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$MoveService _parserFn$Mutation$MoveService( Map data) => Mutation$MoveService.fromJson(data); typedef OnMutationCompleted$Mutation$MoveService = FutureOr Function( - dynamic, Mutation$MoveService?); + dynamic, + Mutation$MoveService?, +); class Options$Mutation$MoveService extends graphql.MutationOptions { - Options$Mutation$MoveService( - {String? operationName, - required Variables$Mutation$MoveService variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$MoveService? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$MoveService({ + String? operationName, + required Variables$Mutation$MoveService variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$MoveService? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted(data, - data == null ? null : _parserFn$Mutation$MoveService(data)), - update: update, - onError: onError, - document: documentNodeMutationMoveService, - parserFn: _parserFn$Mutation$MoveService); + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( + data, + data == null ? null : _parserFn$Mutation$MoveService(data), + ), + update: update, + onError: onError, + document: documentNodeMutationMoveService, + parserFn: _parserFn$Mutation$MoveService, + ); final OnMutationCompleted$Mutation$MoveService? onCompletedWithParsed; @@ -3542,38 +6305,39 @@ class Options$Mutation$MoveService ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$MoveService extends graphql.WatchQueryOptions { - WatchOptions$Mutation$MoveService( - {String? operationName, - required Variables$Mutation$MoveService variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationMoveService, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$MoveService); + WatchOptions$Mutation$MoveService({ + String? operationName, + required Variables$Mutation$MoveService variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationMoveService, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$MoveService, + ); } extension ClientExtension$Mutation$MoveService on graphql.GraphQLClient { @@ -3585,20 +6349,33 @@ extension ClientExtension$Mutation$MoveService on graphql.GraphQLClient { this.watchMutation(options); } -@JsonSerializable(explicitToJson: true) class Mutation$MoveService$moveService - implements Fragment$basicMutationReturnFields { - Mutation$MoveService$moveService( - {required this.code, - required this.message, - required this.success, - required this.$__typename, - this.job}); + implements Fragment$basicMutationReturnFields$$ServiceJobMutationReturn { + Mutation$MoveService$moveService({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + this.job, + }); - @override - factory Mutation$MoveService$moveService.fromJson( - Map json) => - _$Mutation$MoveService$moveServiceFromJson(json); + factory Mutation$MoveService$moveService.fromJson(Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + final l$job = json['job']; + return Mutation$MoveService$moveService( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + job: l$job == null + ? null + : Mutation$MoveService$moveService$job.fromJson( + (l$job as Map)), + ); + } final int code; @@ -3606,42 +6383,75 @@ class Mutation$MoveService$moveService final bool success; - @JsonKey(name: '__typename') final String $__typename; final Mutation$MoveService$moveService$job? job; - Map toJson() => - _$Mutation$MoveService$moveServiceToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + final l$job = job; + _resultData['job'] = l$job?.toJson(); + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; final l$job = job; - return Object.hashAll([l$code, l$message, l$success, l$$__typename, l$job]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + l$job, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$MoveService$moveService) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } final l$job = job; final lOther$job = other.job; - if (l$job != lOther$job) return false; + if (l$job != lOther$job) { + return false; + } return true; } } @@ -3649,30 +6459,37 @@ class Mutation$MoveService$moveService extension UtilityExtension$Mutation$MoveService$moveService on Mutation$MoveService$moveService { CopyWith$Mutation$MoveService$moveService - get copyWith => CopyWith$Mutation$MoveService$moveService(this, (i) => i); + get copyWith => CopyWith$Mutation$MoveService$moveService( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$MoveService$moveService { factory CopyWith$Mutation$MoveService$moveService( - Mutation$MoveService$moveService instance, - TRes Function(Mutation$MoveService$moveService) then) = - _CopyWithImpl$Mutation$MoveService$moveService; + Mutation$MoveService$moveService instance, + TRes Function(Mutation$MoveService$moveService) then, + ) = _CopyWithImpl$Mutation$MoveService$moveService; factory CopyWith$Mutation$MoveService$moveService.stub(TRes res) = _CopyWithStubImpl$Mutation$MoveService$moveService; - TRes call( - {int? code, - String? message, - bool? success, - String? $__typename, - Mutation$MoveService$moveService$job? job}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + Mutation$MoveService$moveService$job? job, + }); CopyWith$Mutation$MoveService$moveService$job get job; } class _CopyWithImpl$Mutation$MoveService$moveService implements CopyWith$Mutation$MoveService$moveService { - _CopyWithImpl$Mutation$MoveService$moveService(this._instance, this._then); + _CopyWithImpl$Mutation$MoveService$moveService( + this._instance, + this._then, + ); final Mutation$MoveService$moveService _instance; @@ -3680,28 +6497,29 @@ class _CopyWithImpl$Mutation$MoveService$moveService static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined, - Object? job = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + Object? job = _undefined, + }) => _then(Mutation$MoveService$moveService( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String), - job: job == _undefined - ? _instance.job - : (job as Mutation$MoveService$moveService$job?))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + job: job == _undefined + ? _instance.job + : (job as Mutation$MoveService$moveService$job?), + )); CopyWith$Mutation$MoveService$moveService$job get job { final local$job = _instance.job; return local$job == null @@ -3717,47 +6535,70 @@ class _CopyWithStubImpl$Mutation$MoveService$moveService TRes _res; - call( - {int? code, - String? message, - bool? success, - String? $__typename, - Mutation$MoveService$moveService$job? job}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + Mutation$MoveService$moveService$job? job, + }) => _res; CopyWith$Mutation$MoveService$moveService$job get job => CopyWith$Mutation$MoveService$moveService$job.stub(_res); } -@JsonSerializable(explicitToJson: true) class Mutation$MoveService$moveService$job { - Mutation$MoveService$moveService$job( - {required this.createdAt, - required this.description, - this.error, - this.finishedAt, - required this.name, - this.progress, - this.result, - required this.status, - this.statusText, - required this.uid, - required this.updatedAt, - required this.$__typename}); + Mutation$MoveService$moveService$job({ + required this.createdAt, + required this.description, + this.error, + this.finishedAt, + required this.name, + this.progress, + this.result, + required this.status, + this.statusText, + required this.uid, + required this.updatedAt, + required this.$__typename, + }); - @override factory Mutation$MoveService$moveService$job.fromJson( - Map json) => - _$Mutation$MoveService$moveService$jobFromJson(json); + Map json) { + final l$createdAt = json['createdAt']; + final l$description = json['description']; + final l$error = json['error']; + final l$finishedAt = json['finishedAt']; + final l$name = json['name']; + final l$progress = json['progress']; + final l$result = json['result']; + final l$status = json['status']; + final l$statusText = json['statusText']; + final l$uid = json['uid']; + final l$updatedAt = json['updatedAt']; + final l$$__typename = json['__typename']; + return Mutation$MoveService$moveService$job( + createdAt: dateTimeFromJson(l$createdAt), + description: (l$description as String), + error: (l$error as String?), + finishedAt: l$finishedAt == null ? null : dateTimeFromJson(l$finishedAt), + name: (l$name as String), + progress: (l$progress as int?), + result: (l$result as String?), + status: (l$status as String), + statusText: (l$statusText as String?), + uid: (l$uid as String), + updatedAt: dateTimeFromJson(l$updatedAt), + $__typename: (l$$__typename as String), + ); + } - @JsonKey(fromJson: dateTimeFromJson, toJson: dateTimeToJson) final DateTime createdAt; final String description; final String? error; - @JsonKey( - fromJson: _nullable$dateTimeFromJson, toJson: _nullable$dateTimeToJson) final DateTime? finishedAt; final String name; @@ -3772,14 +6613,41 @@ class Mutation$MoveService$moveService$job { final String uid; - @JsonKey(fromJson: dateTimeFromJson, toJson: dateTimeToJson) final DateTime updatedAt; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Mutation$MoveService$moveService$jobToJson(this); + Map toJson() { + final _resultData = {}; + final l$createdAt = createdAt; + _resultData['createdAt'] = dateTimeToJson(l$createdAt); + final l$description = description; + _resultData['description'] = l$description; + final l$error = error; + _resultData['error'] = l$error; + final l$finishedAt = finishedAt; + _resultData['finishedAt'] = + l$finishedAt == null ? null : dateTimeToJson(l$finishedAt); + final l$name = name; + _resultData['name'] = l$name; + final l$progress = progress; + _resultData['progress'] = l$progress; + final l$result = result; + _resultData['result'] = l$result; + final l$status = status; + _resultData['status'] = l$status; + final l$statusText = statusText; + _resultData['statusText'] = l$statusText; + final l$uid = uid; + _resultData['uid'] = l$uid; + final l$updatedAt = updatedAt; + _resultData['updatedAt'] = dateTimeToJson(l$updatedAt); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$createdAt = createdAt; final l$description = description; @@ -3805,51 +6673,79 @@ class Mutation$MoveService$moveService$job { l$statusText, l$uid, l$updatedAt, - l$$__typename + l$$__typename, ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$MoveService$moveService$job) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$createdAt = createdAt; final lOther$createdAt = other.createdAt; - if (l$createdAt != lOther$createdAt) return false; + if (l$createdAt != lOther$createdAt) { + return false; + } final l$description = description; final lOther$description = other.description; - if (l$description != lOther$description) return false; + if (l$description != lOther$description) { + return false; + } final l$error = error; final lOther$error = other.error; - if (l$error != lOther$error) return false; + if (l$error != lOther$error) { + return false; + } final l$finishedAt = finishedAt; final lOther$finishedAt = other.finishedAt; - if (l$finishedAt != lOther$finishedAt) return false; + if (l$finishedAt != lOther$finishedAt) { + return false; + } final l$name = name; final lOther$name = other.name; - if (l$name != lOther$name) return false; + if (l$name != lOther$name) { + return false; + } final l$progress = progress; final lOther$progress = other.progress; - if (l$progress != lOther$progress) return false; + if (l$progress != lOther$progress) { + return false; + } final l$result = result; final lOther$result = other.result; - if (l$result != lOther$result) return false; + if (l$result != lOther$result) { + return false; + } final l$status = status; final lOther$status = other.status; - if (l$status != lOther$status) return false; + if (l$status != lOther$status) { + return false; + } final l$statusText = statusText; final lOther$statusText = other.statusText; - if (l$statusText != lOther$statusText) return false; + if (l$statusText != lOther$statusText) { + return false; + } final l$uid = uid; final lOther$uid = other.uid; - if (l$uid != lOther$uid) return false; + if (l$uid != lOther$uid) { + return false; + } final l$updatedAt = updatedAt; final lOther$updatedAt = other.updatedAt; - if (l$updatedAt != lOther$updatedAt) return false; + if (l$updatedAt != lOther$updatedAt) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -3858,38 +6754,43 @@ extension UtilityExtension$Mutation$MoveService$moveService$job on Mutation$MoveService$moveService$job { CopyWith$Mutation$MoveService$moveService$job< Mutation$MoveService$moveService$job> - get copyWith => - CopyWith$Mutation$MoveService$moveService$job(this, (i) => i); + get copyWith => CopyWith$Mutation$MoveService$moveService$job( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$MoveService$moveService$job { factory CopyWith$Mutation$MoveService$moveService$job( - Mutation$MoveService$moveService$job instance, - TRes Function(Mutation$MoveService$moveService$job) then) = - _CopyWithImpl$Mutation$MoveService$moveService$job; + Mutation$MoveService$moveService$job instance, + TRes Function(Mutation$MoveService$moveService$job) then, + ) = _CopyWithImpl$Mutation$MoveService$moveService$job; factory CopyWith$Mutation$MoveService$moveService$job.stub(TRes res) = _CopyWithStubImpl$Mutation$MoveService$moveService$job; - TRes call( - {DateTime? createdAt, - String? description, - String? error, - DateTime? finishedAt, - String? name, - int? progress, - String? result, - String? status, - String? statusText, - String? uid, - DateTime? updatedAt, - String? $__typename}); + TRes call({ + DateTime? createdAt, + String? description, + String? error, + DateTime? finishedAt, + String? name, + int? progress, + String? result, + String? status, + String? statusText, + String? uid, + DateTime? updatedAt, + String? $__typename, + }); } class _CopyWithImpl$Mutation$MoveService$moveService$job implements CopyWith$Mutation$MoveService$moveService$job { _CopyWithImpl$Mutation$MoveService$moveService$job( - this._instance, this._then); + this._instance, + this._then, + ); final Mutation$MoveService$moveService$job _instance; @@ -3897,51 +6798,51 @@ class _CopyWithImpl$Mutation$MoveService$moveService$job static const _undefined = {}; - TRes call( - {Object? createdAt = _undefined, - Object? description = _undefined, - Object? error = _undefined, - Object? finishedAt = _undefined, - Object? name = _undefined, - Object? progress = _undefined, - Object? result = _undefined, - Object? status = _undefined, - Object? statusText = _undefined, - Object? uid = _undefined, - Object? updatedAt = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? createdAt = _undefined, + Object? description = _undefined, + Object? error = _undefined, + Object? finishedAt = _undefined, + Object? name = _undefined, + Object? progress = _undefined, + Object? result = _undefined, + Object? status = _undefined, + Object? statusText = _undefined, + Object? uid = _undefined, + Object? updatedAt = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$MoveService$moveService$job( - createdAt: createdAt == _undefined || createdAt == null - ? _instance.createdAt - : (createdAt as DateTime), - description: description == _undefined || description == null - ? _instance.description - : (description as String), - error: error == _undefined ? _instance.error : (error as String?), - finishedAt: finishedAt == _undefined - ? _instance.finishedAt - : (finishedAt as DateTime?), - name: name == _undefined || name == null - ? _instance.name - : (name as String), - progress: - progress == _undefined ? _instance.progress : (progress as int?), - result: result == _undefined ? _instance.result : (result as String?), - status: status == _undefined || status == null - ? _instance.status - : (status as String), - statusText: statusText == _undefined - ? _instance.statusText - : (statusText as String?), - uid: uid == _undefined || uid == null - ? _instance.uid - : (uid as String), - updatedAt: updatedAt == _undefined || updatedAt == null - ? _instance.updatedAt - : (updatedAt as DateTime), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + createdAt: createdAt == _undefined || createdAt == null + ? _instance.createdAt + : (createdAt as DateTime), + description: description == _undefined || description == null + ? _instance.description + : (description as String), + error: error == _undefined ? _instance.error : (error as String?), + finishedAt: finishedAt == _undefined + ? _instance.finishedAt + : (finishedAt as DateTime?), + name: name == _undefined || name == null + ? _instance.name + : (name as String), + progress: + progress == _undefined ? _instance.progress : (progress as int?), + result: result == _undefined ? _instance.result : (result as String?), + status: status == _undefined || status == null + ? _instance.status + : (status as String), + statusText: statusText == _undefined + ? _instance.statusText + : (statusText as String?), + uid: uid == _undefined || uid == null ? _instance.uid : (uid as String), + updatedAt: updatedAt == _undefined || updatedAt == null + ? _instance.updatedAt + : (updatedAt as DateTime), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Mutation$MoveService$moveService$job @@ -3950,23 +6851,19 @@ class _CopyWithStubImpl$Mutation$MoveService$moveService$job TRes _res; - call( - {DateTime? createdAt, - String? description, - String? error, - DateTime? finishedAt, - String? name, - int? progress, - String? result, - String? status, - String? statusText, - String? uid, - DateTime? updatedAt, - String? $__typename}) => + call({ + DateTime? createdAt, + String? description, + String? error, + DateTime? finishedAt, + String? name, + int? progress, + String? result, + String? status, + String? statusText, + String? uid, + DateTime? updatedAt, + String? $__typename, + }) => _res; } - -DateTime? _nullable$dateTimeFromJson(dynamic data) => - data == null ? null : dateTimeFromJson(data); -dynamic _nullable$dateTimeToJson(DateTime? data) => - data == null ? null : dateTimeToJson(data); diff --git a/lib/logic/api_maps/graphql_maps/schema/services.graphql.g.dart b/lib/logic/api_maps/graphql_maps/schema/services.graphql.g.dart deleted file mode 100644 index 52663401..00000000 --- a/lib/logic/api_maps/graphql_maps/schema/services.graphql.g.dart +++ /dev/null @@ -1,458 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'services.graphql.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -Fragment$basicMutationReturnFields _$Fragment$basicMutationReturnFieldsFromJson( - Map json) => - Fragment$basicMutationReturnFields( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Fragment$basicMutationReturnFieldsToJson( - Fragment$basicMutationReturnFields instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - }; - -Query$AllServices _$Query$AllServicesFromJson(Map json) => - Query$AllServices( - services: Query$AllServices$services.fromJson( - json['services'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Query$AllServicesToJson(Query$AllServices instance) => - { - 'services': instance.services.toJson(), - '__typename': instance.$__typename, - }; - -Query$AllServices$services _$Query$AllServices$servicesFromJson( - Map json) => - Query$AllServices$services( - allServices: (json['allServices'] as List) - .map((e) => Query$AllServices$services$allServices.fromJson( - e as Map)) - .toList(), - $__typename: json['__typename'] as String, - ); - -Map _$Query$AllServices$servicesToJson( - Query$AllServices$services instance) => - { - 'allServices': instance.allServices.map((e) => e.toJson()).toList(), - '__typename': instance.$__typename, - }; - -Query$AllServices$services$allServices - _$Query$AllServices$services$allServicesFromJson( - Map json) => - Query$AllServices$services$allServices( - description: json['description'] as String, - displayName: json['displayName'] as String, - dnsRecords: (json['dnsRecords'] as List?) - ?.map((e) => - Fragment$dnsRecordFields.fromJson(e as Map)) - .toList(), - id: json['id'] as String, - isEnabled: json['isEnabled'] as bool, - isMovable: json['isMovable'] as bool, - isRequired: json['isRequired'] as bool, - status: $enumDecode(_$Enum$ServiceStatusEnumEnumMap, json['status'], - unknownValue: Enum$ServiceStatusEnum.$unknown), - storageUsage: - Query$AllServices$services$allServices$storageUsage.fromJson( - json['storageUsage'] as Map), - svgIcon: json['svgIcon'] as String, - url: json['url'] as String?, - $__typename: json['__typename'] as String, - ); - -Map _$Query$AllServices$services$allServicesToJson( - Query$AllServices$services$allServices instance) => - { - 'description': instance.description, - 'displayName': instance.displayName, - 'dnsRecords': instance.dnsRecords?.map((e) => e.toJson()).toList(), - 'id': instance.id, - 'isEnabled': instance.isEnabled, - 'isMovable': instance.isMovable, - 'isRequired': instance.isRequired, - 'status': _$Enum$ServiceStatusEnumEnumMap[instance.status]!, - 'storageUsage': instance.storageUsage.toJson(), - 'svgIcon': instance.svgIcon, - 'url': instance.url, - '__typename': instance.$__typename, - }; - -const _$Enum$ServiceStatusEnumEnumMap = { - Enum$ServiceStatusEnum.ACTIVATING: 'ACTIVATING', - Enum$ServiceStatusEnum.ACTIVE: 'ACTIVE', - Enum$ServiceStatusEnum.DEACTIVATING: 'DEACTIVATING', - Enum$ServiceStatusEnum.FAILED: 'FAILED', - Enum$ServiceStatusEnum.INACTIVE: 'INACTIVE', - Enum$ServiceStatusEnum.OFF: 'OFF', - Enum$ServiceStatusEnum.RELOADING: 'RELOADING', - Enum$ServiceStatusEnum.$unknown: r'$unknown', -}; - -Query$AllServices$services$allServices$storageUsage - _$Query$AllServices$services$allServices$storageUsageFromJson( - Map json) => - Query$AllServices$services$allServices$storageUsage( - title: json['title'] as String, - usedSpace: json['usedSpace'] as String, - volume: json['volume'] == null - ? null - : Query$AllServices$services$allServices$storageUsage$volume - .fromJson(json['volume'] as Map), - $__typename: json['__typename'] as String, - ); - -Map - _$Query$AllServices$services$allServices$storageUsageToJson( - Query$AllServices$services$allServices$storageUsage instance) => - { - 'title': instance.title, - 'usedSpace': instance.usedSpace, - 'volume': instance.volume?.toJson(), - '__typename': instance.$__typename, - }; - -Query$AllServices$services$allServices$storageUsage$volume - _$Query$AllServices$services$allServices$storageUsage$volumeFromJson( - Map json) => - Query$AllServices$services$allServices$storageUsage$volume( - name: json['name'] as String, - $__typename: json['__typename'] as String, - ); - -Map _$Query$AllServices$services$allServices$storageUsage$volumeToJson( - Query$AllServices$services$allServices$storageUsage$volume instance) => - { - 'name': instance.name, - '__typename': instance.$__typename, - }; - -Variables$Mutation$EnableService _$Variables$Mutation$EnableServiceFromJson( - Map json) => - Variables$Mutation$EnableService( - serviceId: json['serviceId'] as String, - ); - -Map _$Variables$Mutation$EnableServiceToJson( - Variables$Mutation$EnableService instance) => - { - 'serviceId': instance.serviceId, - }; - -Mutation$EnableService _$Mutation$EnableServiceFromJson( - Map json) => - Mutation$EnableService( - enableService: Mutation$EnableService$enableService.fromJson( - json['enableService'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$EnableServiceToJson( - Mutation$EnableService instance) => - { - 'enableService': instance.enableService.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$EnableService$enableService - _$Mutation$EnableService$enableServiceFromJson(Map json) => - Mutation$EnableService$enableService( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$EnableService$enableServiceToJson( - Mutation$EnableService$enableService instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - }; - -Variables$Mutation$DisableService _$Variables$Mutation$DisableServiceFromJson( - Map json) => - Variables$Mutation$DisableService( - serviceId: json['serviceId'] as String, - ); - -Map _$Variables$Mutation$DisableServiceToJson( - Variables$Mutation$DisableService instance) => - { - 'serviceId': instance.serviceId, - }; - -Mutation$DisableService _$Mutation$DisableServiceFromJson( - Map json) => - Mutation$DisableService( - disableService: Mutation$DisableService$disableService.fromJson( - json['disableService'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$DisableServiceToJson( - Mutation$DisableService instance) => - { - 'disableService': instance.disableService.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$DisableService$disableService - _$Mutation$DisableService$disableServiceFromJson( - Map json) => - Mutation$DisableService$disableService( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$DisableService$disableServiceToJson( - Mutation$DisableService$disableService instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - }; - -Variables$Mutation$StopService _$Variables$Mutation$StopServiceFromJson( - Map json) => - Variables$Mutation$StopService( - serviceId: json['serviceId'] as String, - ); - -Map _$Variables$Mutation$StopServiceToJson( - Variables$Mutation$StopService instance) => - { - 'serviceId': instance.serviceId, - }; - -Mutation$StopService _$Mutation$StopServiceFromJson( - Map json) => - Mutation$StopService( - stopService: Mutation$StopService$stopService.fromJson( - json['stopService'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$StopServiceToJson( - Mutation$StopService instance) => - { - 'stopService': instance.stopService.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$StopService$stopService _$Mutation$StopService$stopServiceFromJson( - Map json) => - Mutation$StopService$stopService( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$StopService$stopServiceToJson( - Mutation$StopService$stopService instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - }; - -Variables$Mutation$StartService _$Variables$Mutation$StartServiceFromJson( - Map json) => - Variables$Mutation$StartService( - serviceId: json['serviceId'] as String, - ); - -Map _$Variables$Mutation$StartServiceToJson( - Variables$Mutation$StartService instance) => - { - 'serviceId': instance.serviceId, - }; - -Mutation$StartService _$Mutation$StartServiceFromJson( - Map json) => - Mutation$StartService( - startService: Mutation$StartService$startService.fromJson( - json['startService'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$StartServiceToJson( - Mutation$StartService instance) => - { - 'startService': instance.startService.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$StartService$startService _$Mutation$StartService$startServiceFromJson( - Map json) => - Mutation$StartService$startService( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$StartService$startServiceToJson( - Mutation$StartService$startService instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - }; - -Variables$Mutation$RestartService _$Variables$Mutation$RestartServiceFromJson( - Map json) => - Variables$Mutation$RestartService( - serviceId: json['serviceId'] as String, - ); - -Map _$Variables$Mutation$RestartServiceToJson( - Variables$Mutation$RestartService instance) => - { - 'serviceId': instance.serviceId, - }; - -Mutation$RestartService _$Mutation$RestartServiceFromJson( - Map json) => - Mutation$RestartService( - restartService: Mutation$RestartService$restartService.fromJson( - json['restartService'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$RestartServiceToJson( - Mutation$RestartService instance) => - { - 'restartService': instance.restartService.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$RestartService$restartService - _$Mutation$RestartService$restartServiceFromJson( - Map json) => - Mutation$RestartService$restartService( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$RestartService$restartServiceToJson( - Mutation$RestartService$restartService instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - }; - -Variables$Mutation$MoveService _$Variables$Mutation$MoveServiceFromJson( - Map json) => - Variables$Mutation$MoveService( - input: Input$MoveServiceInput.fromJson( - json['input'] as Map), - ); - -Map _$Variables$Mutation$MoveServiceToJson( - Variables$Mutation$MoveService instance) => - { - 'input': instance.input.toJson(), - }; - -Mutation$MoveService _$Mutation$MoveServiceFromJson( - Map json) => - Mutation$MoveService( - moveService: Mutation$MoveService$moveService.fromJson( - json['moveService'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$MoveServiceToJson( - Mutation$MoveService instance) => - { - 'moveService': instance.moveService.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$MoveService$moveService _$Mutation$MoveService$moveServiceFromJson( - Map json) => - Mutation$MoveService$moveService( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - job: json['job'] == null - ? null - : Mutation$MoveService$moveService$job.fromJson( - json['job'] as Map), - ); - -Map _$Mutation$MoveService$moveServiceToJson( - Mutation$MoveService$moveService instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - 'job': instance.job?.toJson(), - }; - -Mutation$MoveService$moveService$job - _$Mutation$MoveService$moveService$jobFromJson(Map json) => - Mutation$MoveService$moveService$job( - createdAt: dateTimeFromJson(json['createdAt']), - description: json['description'] as String, - error: json['error'] as String?, - finishedAt: _nullable$dateTimeFromJson(json['finishedAt']), - name: json['name'] as String, - progress: json['progress'] as int?, - result: json['result'] as String?, - status: json['status'] as String, - statusText: json['statusText'] as String?, - uid: json['uid'] as String, - updatedAt: dateTimeFromJson(json['updatedAt']), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$MoveService$moveService$jobToJson( - Mutation$MoveService$moveService$job instance) => - { - 'createdAt': dateTimeToJson(instance.createdAt), - 'description': instance.description, - 'error': instance.error, - 'finishedAt': _nullable$dateTimeToJson(instance.finishedAt), - 'name': instance.name, - 'progress': instance.progress, - 'result': instance.result, - 'status': instance.status, - 'statusText': instance.statusText, - 'uid': instance.uid, - 'updatedAt': dateTimeToJson(instance.updatedAt), - '__typename': instance.$__typename, - }; diff --git a/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart index 18a15aa9..dbc8eccc 100644 --- a/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart @@ -1,23 +1,69 @@ import 'dart:async'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; -import 'package:json_annotation/json_annotation.dart'; import 'schema.graphql.dart'; import 'services.graphql.dart'; -part 'users.graphql.g.dart'; -@JsonSerializable(explicitToJson: true) class Fragment$basicMutationReturnFields { - Fragment$basicMutationReturnFields( - {required this.code, - required this.message, - required this.success, - required this.$__typename}); + Fragment$basicMutationReturnFields({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override factory Fragment$basicMutationReturnFields.fromJson( - Map json) => - _$Fragment$basicMutationReturnFieldsFromJson(json); + Map json) { + switch (json["__typename"] as String) { + case "ApiKeyMutationReturn": + return Fragment$basicMutationReturnFields$$ApiKeyMutationReturn + .fromJson(json); + + case "AutoUpgradeSettingsMutationReturn": + return Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + .fromJson(json); + + case "DeviceApiTokenMutationReturn": + return Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn + .fromJson(json); + + case "GenericJobButationReturn": + return Fragment$basicMutationReturnFields$$GenericJobButationReturn + .fromJson(json); + + case "GenericMutationReturn": + return Fragment$basicMutationReturnFields$$GenericMutationReturn + .fromJson(json); + + case "ServiceJobMutationReturn": + return Fragment$basicMutationReturnFields$$ServiceJobMutationReturn + .fromJson(json); + + case "ServiceMutationReturn": + return Fragment$basicMutationReturnFields$$ServiceMutationReturn + .fromJson(json); + + case "TimezoneMutationReturn": + return Fragment$basicMutationReturnFields$$TimezoneMutationReturn + .fromJson(json); + + case "UserMutationReturn": + return Fragment$basicMutationReturnFields$$UserMutationReturn.fromJson( + json); + + default: + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + } final int code; @@ -25,36 +71,64 @@ class Fragment$basicMutationReturnFields { final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Fragment$basicMutationReturnFieldsToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; - return Object.hashAll([l$code, l$message, l$success, l$$__typename]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Fragment$basicMutationReturnFields) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -63,25 +137,35 @@ extension UtilityExtension$Fragment$basicMutationReturnFields on Fragment$basicMutationReturnFields { CopyWith$Fragment$basicMutationReturnFields< Fragment$basicMutationReturnFields> - get copyWith => - CopyWith$Fragment$basicMutationReturnFields(this, (i) => i); + get copyWith => CopyWith$Fragment$basicMutationReturnFields( + this, + (i) => i, + ); } abstract class CopyWith$Fragment$basicMutationReturnFields { factory CopyWith$Fragment$basicMutationReturnFields( - Fragment$basicMutationReturnFields instance, - TRes Function(Fragment$basicMutationReturnFields) then) = - _CopyWithImpl$Fragment$basicMutationReturnFields; + Fragment$basicMutationReturnFields instance, + TRes Function(Fragment$basicMutationReturnFields) then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields; factory CopyWith$Fragment$basicMutationReturnFields.stub(TRes res) = _CopyWithStubImpl$Fragment$basicMutationReturnFields; - TRes call({int? code, String? message, bool? success, String? $__typename}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); } class _CopyWithImpl$Fragment$basicMutationReturnFields implements CopyWith$Fragment$basicMutationReturnFields { - _CopyWithImpl$Fragment$basicMutationReturnFields(this._instance, this._then); + _CopyWithImpl$Fragment$basicMutationReturnFields( + this._instance, + this._then, + ); final Fragment$basicMutationReturnFields _instance; @@ -89,24 +173,25 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => _then(Fragment$basicMutationReturnFields( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Fragment$basicMutationReturnFields @@ -115,43 +200,54 @@ class _CopyWithStubImpl$Fragment$basicMutationReturnFields TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => _res; } const fragmentDefinitionbasicMutationReturnFields = FragmentDefinitionNode( - name: NameNode(value: 'basicMutationReturnFields'), - typeCondition: TypeConditionNode( - on: NamedTypeNode( - name: NameNode(value: 'MutationReturnInterface'), - isNonNull: false)), - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'code'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'message'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'success'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])); + name: NameNode(value: 'basicMutationReturnFields'), + typeCondition: TypeConditionNode( + on: NamedTypeNode( + name: NameNode(value: 'MutationReturnInterface'), + isNonNull: false, + )), + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'code'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'message'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'success'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), +); const documentNodeFragmentbasicMutationReturnFields = DocumentNode(definitions: [ fragmentDefinitionbasicMutationReturnFields, @@ -159,56 +255,1704 @@ const documentNodeFragmentbasicMutationReturnFields = extension ClientExtension$Fragment$basicMutationReturnFields on graphql.GraphQLClient { - void writeFragment$basicMutationReturnFields( - {required Fragment$basicMutationReturnFields data, - required Map idFields, - bool broadcast = true}) => + void writeFragment$basicMutationReturnFields({ + required Fragment$basicMutationReturnFields data, + required Map idFields, + bool broadcast = true, + }) => this.writeFragment( - graphql.FragmentRequest( - idFields: idFields, - fragment: const graphql.Fragment( - fragmentName: 'basicMutationReturnFields', - document: documentNodeFragmentbasicMutationReturnFields)), - data: data.toJson(), - broadcast: broadcast); - Fragment$basicMutationReturnFields? readFragment$basicMutationReturnFields( - {required Map idFields, bool optimistic = true}) { - final result = this.readFragment( graphql.FragmentRequest( - idFields: idFields, - fragment: const graphql.Fragment( - fragmentName: 'basicMutationReturnFields', - document: documentNodeFragmentbasicMutationReturnFields)), - optimistic: optimistic); + idFields: idFields, + fragment: const graphql.Fragment( + fragmentName: 'basicMutationReturnFields', + document: documentNodeFragmentbasicMutationReturnFields, + ), + ), + data: data.toJson(), + broadcast: broadcast, + ); + Fragment$basicMutationReturnFields? readFragment$basicMutationReturnFields({ + required Map idFields, + bool optimistic = true, + }) { + final result = this.readFragment( + graphql.FragmentRequest( + idFields: idFields, + fragment: const graphql.Fragment( + fragmentName: 'basicMutationReturnFields', + document: documentNodeFragmentbasicMutationReturnFields, + ), + ), + optimistic: optimistic, + ); return result == null ? null : Fragment$basicMutationReturnFields.fromJson(result); } } -@JsonSerializable(explicitToJson: true) -class Fragment$userFields { - Fragment$userFields( - {required this.username, - required this.userType, - required this.sshKeys, - required this.$__typename}); +class Fragment$basicMutationReturnFields$$ApiKeyMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$ApiKeyMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$ApiKeyMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } @override - factory Fragment$userFields.fromJson(Map json) => - _$Fragment$userFieldsFromJson(json); + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn + on Fragment$basicMutationReturnFields$$ApiKeyMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + Fragment$basicMutationReturnFields$$ApiKeyMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + Fragment$basicMutationReturnFields$$ApiKeyMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$ApiKeyMutationReturn _instance; + + final TRes Function(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + on Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + instance, + TRes Function( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn + _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn + on Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn instance, + TRes Function( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn + _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$GenericJobButationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$GenericJobButationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$GenericJobButationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$GenericJobButationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$GenericJobButationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$GenericJobButationReturn + on Fragment$basicMutationReturnFields$$GenericJobButationReturn { + CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + Fragment$basicMutationReturnFields$$GenericJobButationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn( + Fragment$basicMutationReturnFields$$GenericJobButationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$GenericJobButationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$GenericJobButationReturn _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$GenericJobButationReturn) _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$GenericJobButationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$GenericJobButationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$GenericMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$GenericMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$GenericMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$GenericMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Fragment$basicMutationReturnFields$$GenericMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$GenericMutationReturn + on Fragment$basicMutationReturnFields$$GenericMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn< + Fragment$basicMutationReturnFields$$GenericMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn( + Fragment$basicMutationReturnFields$$GenericMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$GenericMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$GenericMutationReturn _instance; + + final TRes Function(Fragment$basicMutationReturnFields$$GenericMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$GenericMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$GenericMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$ServiceJobMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$ServiceJobMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn + on Fragment$basicMutationReturnFields$$ServiceJobMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$ServiceJobMutationReturn _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$ServiceMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$ServiceMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$ServiceMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$ServiceMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Fragment$basicMutationReturnFields$$ServiceMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$ServiceMutationReturn + on Fragment$basicMutationReturnFields$$ServiceMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + Fragment$basicMutationReturnFields$$ServiceMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn( + Fragment$basicMutationReturnFields$$ServiceMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$ServiceMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$ServiceMutationReturn _instance; + + final TRes Function(Fragment$basicMutationReturnFields$$ServiceMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$ServiceMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$ServiceMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$TimezoneMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$TimezoneMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$TimezoneMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$basicMutationReturnFields$$TimezoneMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$TimezoneMutationReturn + on Fragment$basicMutationReturnFields$$TimezoneMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + Fragment$basicMutationReturnFields$$TimezoneMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + Fragment$basicMutationReturnFields$$TimezoneMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$TimezoneMutationReturn) + then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> { + _CopyWithImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$TimezoneMutationReturn _instance; + + final TRes Function( + Fragment$basicMutationReturnFields$$TimezoneMutationReturn) _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< + TRes> { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$basicMutationReturnFields$$UserMutationReturn + implements Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields$$UserMutationReturn({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); + + factory Fragment$basicMutationReturnFields$$UserMutationReturn.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Fragment$basicMutationReturnFields$$UserMutationReturn( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Fragment$basicMutationReturnFields$$UserMutationReturn) || + runtimeType != other.runtimeType) { + return false; + } + final l$code = code; + final lOther$code = other.code; + if (l$code != lOther$code) { + return false; + } + final l$message = message; + final lOther$message = other.message; + if (l$message != lOther$message) { + return false; + } + final l$success = success; + final lOther$success = other.success; + if (l$success != lOther$success) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$basicMutationReturnFields$$UserMutationReturn + on Fragment$basicMutationReturnFields$$UserMutationReturn { + CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn< + Fragment$basicMutationReturnFields$$UserMutationReturn> + get copyWith => + CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn< + TRes> { + factory CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn( + Fragment$basicMutationReturnFields$$UserMutationReturn instance, + TRes Function(Fragment$basicMutationReturnFields$$UserMutationReturn) then, + ) = _CopyWithImpl$Fragment$basicMutationReturnFields$$UserMutationReturn; + + factory CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn.stub( + TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$UserMutationReturn; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicMutationReturnFields$$UserMutationReturn + implements + CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn { + _CopyWithImpl$Fragment$basicMutationReturnFields$$UserMutationReturn( + this._instance, + this._then, + ); + + final Fragment$basicMutationReturnFields$$UserMutationReturn _instance; + + final TRes Function(Fragment$basicMutationReturnFields$$UserMutationReturn) + _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicMutationReturnFields$$UserMutationReturn( + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$UserMutationReturn< + TRes> + implements + CopyWith$Fragment$basicMutationReturnFields$$UserMutationReturn { + _CopyWithStubImpl$Fragment$basicMutationReturnFields$$UserMutationReturn( + this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => + _res; +} + +class Fragment$userFields { + Fragment$userFields({ + required this.username, + required this.userType, + required this.sshKeys, + required this.$__typename, + }); + + factory Fragment$userFields.fromJson(Map json) { + final l$username = json['username']; + final l$userType = json['userType']; + final l$sshKeys = json['sshKeys']; + final l$$__typename = json['__typename']; + return Fragment$userFields( + username: (l$username as String), + userType: fromJson$Enum$UserType((l$userType as String)), + sshKeys: (l$sshKeys as List).map((e) => (e as String)).toList(), + $__typename: (l$$__typename as String), + ); + } final String username; - @JsonKey(unknownEnumValue: Enum$UserType.$unknown) final Enum$UserType userType; final List sshKeys; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Fragment$userFieldsToJson(this); + Map toJson() { + final _resultData = {}; + final l$username = username; + _resultData['username'] = l$username; + final l$userType = userType; + _resultData['userType'] = toJson$Enum$UserType(l$userType); + final l$sshKeys = sshKeys; + _resultData['sshKeys'] = l$sshKeys.map((e) => e).toList(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$username = username; final l$userType = userType; @@ -218,60 +1962,80 @@ class Fragment$userFields { l$username, l$userType, Object.hashAll(l$sshKeys.map((v) => v)), - l$$__typename + l$$__typename, ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Fragment$userFields) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Fragment$userFields) || runtimeType != other.runtimeType) { return false; + } final l$username = username; final lOther$username = other.username; - if (l$username != lOther$username) return false; + if (l$username != lOther$username) { + return false; + } final l$userType = userType; final lOther$userType = other.userType; - if (l$userType != lOther$userType) return false; + if (l$userType != lOther$userType) { + return false; + } final l$sshKeys = sshKeys; final lOther$sshKeys = other.sshKeys; - if (l$sshKeys.length != lOther$sshKeys.length) return false; + if (l$sshKeys.length != lOther$sshKeys.length) { + return false; + } for (int i = 0; i < l$sshKeys.length; i++) { final l$sshKeys$entry = l$sshKeys[i]; final lOther$sshKeys$entry = lOther$sshKeys[i]; - if (l$sshKeys$entry != lOther$sshKeys$entry) return false; + if (l$sshKeys$entry != lOther$sshKeys$entry) { + return false; + } } - final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Fragment$userFields on Fragment$userFields { CopyWith$Fragment$userFields get copyWith => - CopyWith$Fragment$userFields(this, (i) => i); + CopyWith$Fragment$userFields( + this, + (i) => i, + ); } abstract class CopyWith$Fragment$userFields { - factory CopyWith$Fragment$userFields(Fragment$userFields instance, - TRes Function(Fragment$userFields) then) = - _CopyWithImpl$Fragment$userFields; + factory CopyWith$Fragment$userFields( + Fragment$userFields instance, + TRes Function(Fragment$userFields) then, + ) = _CopyWithImpl$Fragment$userFields; factory CopyWith$Fragment$userFields.stub(TRes res) = _CopyWithStubImpl$Fragment$userFields; - TRes call( - {String? username, - Enum$UserType? userType, - List? sshKeys, - String? $__typename}); + TRes call({ + String? username, + Enum$UserType? userType, + List? sshKeys, + String? $__typename, + }); } class _CopyWithImpl$Fragment$userFields implements CopyWith$Fragment$userFields { - _CopyWithImpl$Fragment$userFields(this._instance, this._then); + _CopyWithImpl$Fragment$userFields( + this._instance, + this._then, + ); final Fragment$userFields _instance; @@ -279,24 +2043,26 @@ class _CopyWithImpl$Fragment$userFields static const _undefined = {}; - TRes call( - {Object? username = _undefined, - Object? userType = _undefined, - Object? sshKeys = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? username = _undefined, + Object? userType = _undefined, + Object? sshKeys = _undefined, + Object? $__typename = _undefined, + }) => _then(Fragment$userFields( - username: username == _undefined || username == null - ? _instance.username - : (username as String), - userType: userType == _undefined || userType == null - ? _instance.userType - : (userType as Enum$UserType), - sshKeys: sshKeys == _undefined || sshKeys == null - ? _instance.sshKeys - : (sshKeys as List), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + username: username == _undefined || username == null + ? _instance.username + : (username as String), + userType: userType == _undefined || userType == null + ? _instance.userType + : (userType as Enum$UserType), + sshKeys: sshKeys == _undefined || sshKeys == null + ? _instance.sshKeys + : (sshKeys as List), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Fragment$userFields @@ -305,130 +2071,183 @@ class _CopyWithStubImpl$Fragment$userFields TRes _res; - call( - {String? username, - Enum$UserType? userType, - List? sshKeys, - String? $__typename}) => + call({ + String? username, + Enum$UserType? userType, + List? sshKeys, + String? $__typename, + }) => _res; } const fragmentDefinitionuserFields = FragmentDefinitionNode( - name: NameNode(value: 'userFields'), - typeCondition: TypeConditionNode( - on: NamedTypeNode(name: NameNode(value: 'User'), isNonNull: false)), - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'username'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'userType'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'sshKeys'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])); + name: NameNode(value: 'userFields'), + typeCondition: TypeConditionNode( + on: NamedTypeNode( + name: NameNode(value: 'User'), + isNonNull: false, + )), + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'username'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'userType'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'sshKeys'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), +); const documentNodeFragmentuserFields = DocumentNode(definitions: [ fragmentDefinitionuserFields, ]); extension ClientExtension$Fragment$userFields on graphql.GraphQLClient { - void writeFragment$userFields( - {required Fragment$userFields data, - required Map idFields, - bool broadcast = true}) => + void writeFragment$userFields({ + required Fragment$userFields data, + required Map idFields, + bool broadcast = true, + }) => this.writeFragment( - graphql.FragmentRequest( - idFields: idFields, - fragment: const graphql.Fragment( - fragmentName: 'userFields', - document: documentNodeFragmentuserFields)), - data: data.toJson(), - broadcast: broadcast); - Fragment$userFields? readFragment$userFields( - {required Map idFields, bool optimistic = true}) { - final result = this.readFragment( graphql.FragmentRequest( - idFields: idFields, - fragment: const graphql.Fragment( - fragmentName: 'userFields', - document: documentNodeFragmentuserFields)), - optimistic: optimistic); + idFields: idFields, + fragment: const graphql.Fragment( + fragmentName: 'userFields', + document: documentNodeFragmentuserFields, + ), + ), + data: data.toJson(), + broadcast: broadcast, + ); + Fragment$userFields? readFragment$userFields({ + required Map idFields, + bool optimistic = true, + }) { + final result = this.readFragment( + graphql.FragmentRequest( + idFields: idFields, + fragment: const graphql.Fragment( + fragmentName: 'userFields', + document: documentNodeFragmentuserFields, + ), + ), + optimistic: optimistic, + ); return result == null ? null : Fragment$userFields.fromJson(result); } } -@JsonSerializable(explicitToJson: true) class Query$AllUsers { - Query$AllUsers({required this.users, required this.$__typename}); + Query$AllUsers({ + required this.users, + required this.$__typename, + }); - @override - factory Query$AllUsers.fromJson(Map json) => - _$Query$AllUsersFromJson(json); + factory Query$AllUsers.fromJson(Map json) { + final l$users = json['users']; + final l$$__typename = json['__typename']; + return Query$AllUsers( + users: Query$AllUsers$users.fromJson((l$users as Map)), + $__typename: (l$$__typename as String), + ); + } final Query$AllUsers$users users; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$AllUsersToJson(this); + Map toJson() { + final _resultData = {}; + final l$users = users; + _resultData['users'] = l$users.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$users = users; final l$$__typename = $__typename; - return Object.hashAll([l$users, l$$__typename]); + return Object.hashAll([ + l$users, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Query$AllUsers) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Query$AllUsers) || runtimeType != other.runtimeType) { return false; + } final l$users = users; final lOther$users = other.users; - if (l$users != lOther$users) return false; + if (l$users != lOther$users) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Query$AllUsers on Query$AllUsers { CopyWith$Query$AllUsers get copyWith => - CopyWith$Query$AllUsers(this, (i) => i); + CopyWith$Query$AllUsers( + this, + (i) => i, + ); } abstract class CopyWith$Query$AllUsers { factory CopyWith$Query$AllUsers( - Query$AllUsers instance, TRes Function(Query$AllUsers) then) = - _CopyWithImpl$Query$AllUsers; + Query$AllUsers instance, + TRes Function(Query$AllUsers) then, + ) = _CopyWithImpl$Query$AllUsers; factory CopyWith$Query$AllUsers.stub(TRes res) = _CopyWithStubImpl$Query$AllUsers; - TRes call({Query$AllUsers$users? users, String? $__typename}); + TRes call({ + Query$AllUsers$users? users, + String? $__typename, + }); CopyWith$Query$AllUsers$users get users; } class _CopyWithImpl$Query$AllUsers implements CopyWith$Query$AllUsers { - _CopyWithImpl$Query$AllUsers(this._instance, this._then); + _CopyWithImpl$Query$AllUsers( + this._instance, + this._then, + ); final Query$AllUsers _instance; @@ -436,14 +2255,18 @@ class _CopyWithImpl$Query$AllUsers static const _undefined = {}; - TRes call({Object? users = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? users = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$AllUsers( - users: users == _undefined || users == null - ? _instance.users - : (users as Query$AllUsers$users), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + users: users == _undefined || users == null + ? _instance.users + : (users as Query$AllUsers$users), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Query$AllUsers$users get users { final local$users = _instance.users; return CopyWith$Query$AllUsers$users(local$users, (e) => call(users: e)); @@ -456,129 +2279,154 @@ class _CopyWithStubImpl$Query$AllUsers TRes _res; - call({Query$AllUsers$users? users, String? $__typename}) => _res; + call({ + Query$AllUsers$users? users, + String? $__typename, + }) => + _res; CopyWith$Query$AllUsers$users get users => CopyWith$Query$AllUsers$users.stub(_res); } const documentNodeQueryAllUsers = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'AllUsers'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'users'), + type: OperationType.query, + name: NameNode(value: 'AllUsers'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'users'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'allUsers'), alias: null, arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'userFields'), + directives: [], + ), FieldNode( - name: NameNode(value: 'allUsers'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'userFields'), directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: 'getUser'), + alias: NameNode(value: 'rootUser'), + arguments: [ + ArgumentNode( + name: NameNode(value: 'username'), + value: StringValueNode( + value: 'root', + isBlock: false, + ), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'userFields'), + directives: [], + ), FieldNode( - name: NameNode(value: 'getUser'), - alias: NameNode(value: 'rootUser'), - arguments: [ - ArgumentNode( - name: NameNode(value: 'username'), - value: StringValueNode(value: 'root', isBlock: false)) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'userFields'), directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionuserFields, ]); Query$AllUsers _parserFn$Query$AllUsers(Map data) => Query$AllUsers.fromJson(data); class Options$Query$AllUsers extends graphql.QueryOptions { - Options$Query$AllUsers( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - Duration? pollInterval, - graphql.Context? context}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - pollInterval: pollInterval, - context: context, - document: documentNodeQueryAllUsers, - parserFn: _parserFn$Query$AllUsers); + Options$Query$AllUsers({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Duration? pollInterval, + graphql.Context? context, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + pollInterval: pollInterval, + context: context, + document: documentNodeQueryAllUsers, + parserFn: _parserFn$Query$AllUsers, + ); } class WatchOptions$Query$AllUsers extends graphql.WatchQueryOptions { - WatchOptions$Query$AllUsers( - {String? operationName, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeQueryAllUsers, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Query$AllUsers); + WatchOptions$Query$AllUsers({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeQueryAllUsers, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Query$AllUsers, + ); } class FetchMoreOptions$Query$AllUsers extends graphql.FetchMoreOptions { FetchMoreOptions$Query$AllUsers({required graphql.UpdateQuery updateQuery}) - : super(updateQuery: updateQuery, document: documentNodeQueryAllUsers); + : super( + updateQuery: updateQuery, + document: documentNodeQueryAllUsers, + ); } extension ClientExtension$Query$AllUsers on graphql.GraphQLClient { @@ -588,89 +2436,133 @@ extension ClientExtension$Query$AllUsers on graphql.GraphQLClient { graphql.ObservableQuery watchQuery$AllUsers( [WatchOptions$Query$AllUsers? options]) => this.watchQuery(options ?? WatchOptions$Query$AllUsers()); - void writeQuery$AllUsers( - {required Query$AllUsers data, bool broadcast = true}) => + void writeQuery$AllUsers({ + required Query$AllUsers data, + bool broadcast = true, + }) => this.writeQuery( - graphql.Request( - operation: - graphql.Operation(document: documentNodeQueryAllUsers)), - data: data.toJson(), - broadcast: broadcast); - Query$AllUsers? readQuery$AllUsers({bool optimistic = true}) { - final result = this.readQuery( graphql.Request( operation: graphql.Operation(document: documentNodeQueryAllUsers)), - optimistic: optimistic); + data: data.toJson(), + broadcast: broadcast, + ); + Query$AllUsers? readQuery$AllUsers({bool optimistic = true}) { + final result = this.readQuery( + graphql.Request( + operation: graphql.Operation(document: documentNodeQueryAllUsers)), + optimistic: optimistic, + ); return result == null ? null : Query$AllUsers.fromJson(result); } } -@JsonSerializable(explicitToJson: true) class Query$AllUsers$users { - Query$AllUsers$users( - {required this.allUsers, this.rootUser, required this.$__typename}); + Query$AllUsers$users({ + required this.allUsers, + this.rootUser, + required this.$__typename, + }); - @override - factory Query$AllUsers$users.fromJson(Map json) => - _$Query$AllUsers$usersFromJson(json); + factory Query$AllUsers$users.fromJson(Map json) { + final l$allUsers = json['allUsers']; + final l$rootUser = json['rootUser']; + final l$$__typename = json['__typename']; + return Query$AllUsers$users( + allUsers: (l$allUsers as List) + .map((e) => Fragment$userFields.fromJson((e as Map))) + .toList(), + rootUser: l$rootUser == null + ? null + : Fragment$userFields.fromJson((l$rootUser as Map)), + $__typename: (l$$__typename as String), + ); + } final List allUsers; final Fragment$userFields? rootUser; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$AllUsers$usersToJson(this); + Map toJson() { + final _resultData = {}; + final l$allUsers = allUsers; + _resultData['allUsers'] = l$allUsers.map((e) => e.toJson()).toList(); + final l$rootUser = rootUser; + _resultData['rootUser'] = l$rootUser?.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$allUsers = allUsers; final l$rootUser = rootUser; final l$$__typename = $__typename; - return Object.hashAll( - [Object.hashAll(l$allUsers.map((v) => v)), l$rootUser, l$$__typename]); + return Object.hashAll([ + Object.hashAll(l$allUsers.map((v) => v)), + l$rootUser, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Query$AllUsers$users) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Query$AllUsers$users) || runtimeType != other.runtimeType) { return false; + } final l$allUsers = allUsers; final lOther$allUsers = other.allUsers; - if (l$allUsers.length != lOther$allUsers.length) return false; + if (l$allUsers.length != lOther$allUsers.length) { + return false; + } for (int i = 0; i < l$allUsers.length; i++) { final l$allUsers$entry = l$allUsers[i]; final lOther$allUsers$entry = lOther$allUsers[i]; - if (l$allUsers$entry != lOther$allUsers$entry) return false; + if (l$allUsers$entry != lOther$allUsers$entry) { + return false; + } } - final l$rootUser = rootUser; final lOther$rootUser = other.rootUser; - if (l$rootUser != lOther$rootUser) return false; + if (l$rootUser != lOther$rootUser) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Query$AllUsers$users on Query$AllUsers$users { CopyWith$Query$AllUsers$users get copyWith => - CopyWith$Query$AllUsers$users(this, (i) => i); + CopyWith$Query$AllUsers$users( + this, + (i) => i, + ); } abstract class CopyWith$Query$AllUsers$users { - factory CopyWith$Query$AllUsers$users(Query$AllUsers$users instance, - TRes Function(Query$AllUsers$users) then) = - _CopyWithImpl$Query$AllUsers$users; + factory CopyWith$Query$AllUsers$users( + Query$AllUsers$users instance, + TRes Function(Query$AllUsers$users) then, + ) = _CopyWithImpl$Query$AllUsers$users; factory CopyWith$Query$AllUsers$users.stub(TRes res) = _CopyWithStubImpl$Query$AllUsers$users; - TRes call( - {List? allUsers, - Fragment$userFields? rootUser, - String? $__typename}); + TRes call({ + List? allUsers, + Fragment$userFields? rootUser, + String? $__typename, + }); TRes allUsers( Iterable Function( Iterable>) @@ -680,7 +2572,10 @@ abstract class CopyWith$Query$AllUsers$users { class _CopyWithImpl$Query$AllUsers$users implements CopyWith$Query$AllUsers$users { - _CopyWithImpl$Query$AllUsers$users(this._instance, this._then); + _CopyWithImpl$Query$AllUsers$users( + this._instance, + this._then, + ); final Query$AllUsers$users _instance; @@ -688,27 +2583,32 @@ class _CopyWithImpl$Query$AllUsers$users static const _undefined = {}; - TRes call( - {Object? allUsers = _undefined, - Object? rootUser = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? allUsers = _undefined, + Object? rootUser = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$AllUsers$users( - allUsers: allUsers == _undefined || allUsers == null - ? _instance.allUsers - : (allUsers as List), - rootUser: rootUser == _undefined - ? _instance.rootUser - : (rootUser as Fragment$userFields?), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + allUsers: allUsers == _undefined || allUsers == null + ? _instance.allUsers + : (allUsers as List), + rootUser: rootUser == _undefined + ? _instance.rootUser + : (rootUser as Fragment$userFields?), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); TRes allUsers( Iterable Function( Iterable>) _fn) => call( - allUsers: _fn(_instance.allUsers - .map((e) => CopyWith$Fragment$userFields(e, (i) => i))).toList()); + allUsers: + _fn(_instance.allUsers.map((e) => CopyWith$Fragment$userFields( + e, + (i) => i, + ))).toList()); CopyWith$Fragment$userFields get rootUser { final local$rootUser = _instance.rootUser; return local$rootUser == null @@ -724,51 +2624,76 @@ class _CopyWithStubImpl$Query$AllUsers$users TRes _res; - call( - {List? allUsers, - Fragment$userFields? rootUser, - String? $__typename}) => + call({ + List? allUsers, + Fragment$userFields? rootUser, + String? $__typename, + }) => _res; allUsers(_fn) => _res; CopyWith$Fragment$userFields get rootUser => CopyWith$Fragment$userFields.stub(_res); } -@JsonSerializable(explicitToJson: true) class Variables$Query$GetUser { - Variables$Query$GetUser({required this.username}); + factory Variables$Query$GetUser({required String username}) => + Variables$Query$GetUser._({ + r'username': username, + }); + + Variables$Query$GetUser._(this._$data); + + factory Variables$Query$GetUser.fromJson(Map data) { + final result$data = {}; + final l$username = data['username']; + result$data['username'] = (l$username as String); + return Variables$Query$GetUser._(result$data); + } + + Map _$data; + + String get username => (_$data['username'] as String); + Map toJson() { + final result$data = {}; + final l$username = username; + result$data['username'] = l$username; + return result$data; + } + + CopyWith$Variables$Query$GetUser get copyWith => + CopyWith$Variables$Query$GetUser( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Query$GetUser) || + runtimeType != other.runtimeType) { + return false; + } + final l$username = username; + final lOther$username = other.username; + if (l$username != lOther$username) { + return false; + } + return true; + } @override - factory Variables$Query$GetUser.fromJson(Map json) => - _$Variables$Query$GetUserFromJson(json); - - final String username; - - Map toJson() => _$Variables$Query$GetUserToJson(this); int get hashCode { final l$username = username; return Object.hashAll([l$username]); } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Variables$Query$GetUser) || runtimeType != other.runtimeType) - return false; - final l$username = username; - final lOther$username = other.username; - if (l$username != lOther$username) return false; - return true; - } - - CopyWith$Variables$Query$GetUser get copyWith => - CopyWith$Variables$Query$GetUser(this, (i) => i); } abstract class CopyWith$Variables$Query$GetUser { - factory CopyWith$Variables$Query$GetUser(Variables$Query$GetUser instance, - TRes Function(Variables$Query$GetUser) then) = - _CopyWithImpl$Variables$Query$GetUser; + factory CopyWith$Variables$Query$GetUser( + Variables$Query$GetUser instance, + TRes Function(Variables$Query$GetUser) then, + ) = _CopyWithImpl$Variables$Query$GetUser; factory CopyWith$Variables$Query$GetUser.stub(TRes res) = _CopyWithStubImpl$Variables$Query$GetUser; @@ -778,7 +2703,10 @@ abstract class CopyWith$Variables$Query$GetUser { class _CopyWithImpl$Variables$Query$GetUser implements CopyWith$Variables$Query$GetUser { - _CopyWithImpl$Variables$Query$GetUser(this._instance, this._then); + _CopyWithImpl$Variables$Query$GetUser( + this._instance, + this._then, + ); final Variables$Query$GetUser _instance; @@ -786,10 +2714,12 @@ class _CopyWithImpl$Variables$Query$GetUser static const _undefined = {}; - TRes call({Object? username = _undefined}) => _then(Variables$Query$GetUser( - username: username == _undefined || username == null - ? _instance.username - : (username as String))); + TRes call({Object? username = _undefined}) => + _then(Variables$Query$GetUser._({ + ..._instance._$data, + if (username != _undefined && username != null) + 'username': (username as String), + })); } class _CopyWithStubImpl$Variables$Query$GetUser @@ -801,61 +2731,95 @@ class _CopyWithStubImpl$Variables$Query$GetUser call({String? username}) => _res; } -@JsonSerializable(explicitToJson: true) class Query$GetUser { - Query$GetUser({required this.users, required this.$__typename}); + Query$GetUser({ + required this.users, + required this.$__typename, + }); - @override - factory Query$GetUser.fromJson(Map json) => - _$Query$GetUserFromJson(json); + factory Query$GetUser.fromJson(Map json) { + final l$users = json['users']; + final l$$__typename = json['__typename']; + return Query$GetUser( + users: Query$GetUser$users.fromJson((l$users as Map)), + $__typename: (l$$__typename as String), + ); + } final Query$GetUser$users users; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$GetUserToJson(this); + Map toJson() { + final _resultData = {}; + final l$users = users; + _resultData['users'] = l$users.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$users = users; final l$$__typename = $__typename; - return Object.hashAll([l$users, l$$__typename]); + return Object.hashAll([ + l$users, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Query$GetUser) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Query$GetUser) || runtimeType != other.runtimeType) { return false; + } final l$users = users; final lOther$users = other.users; - if (l$users != lOther$users) return false; + if (l$users != lOther$users) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Query$GetUser on Query$GetUser { - CopyWith$Query$GetUser get copyWith => - CopyWith$Query$GetUser(this, (i) => i); + CopyWith$Query$GetUser get copyWith => CopyWith$Query$GetUser( + this, + (i) => i, + ); } abstract class CopyWith$Query$GetUser { factory CopyWith$Query$GetUser( - Query$GetUser instance, TRes Function(Query$GetUser) then) = - _CopyWithImpl$Query$GetUser; + Query$GetUser instance, + TRes Function(Query$GetUser) then, + ) = _CopyWithImpl$Query$GetUser; factory CopyWith$Query$GetUser.stub(TRes res) = _CopyWithStubImpl$Query$GetUser; - TRes call({Query$GetUser$users? users, String? $__typename}); + TRes call({ + Query$GetUser$users? users, + String? $__typename, + }); CopyWith$Query$GetUser$users get users; } class _CopyWithImpl$Query$GetUser implements CopyWith$Query$GetUser { - _CopyWithImpl$Query$GetUser(this._instance, this._then); + _CopyWithImpl$Query$GetUser( + this._instance, + this._then, + ); final Query$GetUser _instance; @@ -863,14 +2827,18 @@ class _CopyWithImpl$Query$GetUser static const _undefined = {}; - TRes call({Object? users = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? users = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$GetUser( - users: users == _undefined || users == null - ? _instance.users - : (users as Query$GetUser$users), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + users: users == _undefined || users == null + ? _instance.users + : (users as Query$GetUser$users), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Query$GetUser$users get users { final local$users = _instance.users; return CopyWith$Query$GetUser$users(local$users, (e) => call(users: e)); @@ -883,130 +2851,149 @@ class _CopyWithStubImpl$Query$GetUser TRes _res; - call({Query$GetUser$users? users, String? $__typename}) => _res; + call({ + Query$GetUser$users? users, + String? $__typename, + }) => + _res; CopyWith$Query$GetUser$users get users => CopyWith$Query$GetUser$users.stub(_res); } const documentNodeQueryGetUser = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'GetUser'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'username')), - type: - NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'users'), + type: OperationType.query, + name: NameNode(value: 'GetUser'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'username')), + type: NamedTypeNode( + name: NameNode(value: 'String'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'users'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'getUser'), alias: null, - arguments: [], + arguments: [ + ArgumentNode( + name: NameNode(value: 'username'), + value: VariableNode(name: NameNode(value: 'username')), + ) + ], directives: [], selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'userFields'), + directives: [], + ), FieldNode( - name: NameNode(value: 'getUser'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'username'), - value: VariableNode(name: NameNode(value: 'username'))) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'userFields'), directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionuserFields, ]); Query$GetUser _parserFn$Query$GetUser(Map data) => Query$GetUser.fromJson(data); class Options$Query$GetUser extends graphql.QueryOptions { - Options$Query$GetUser( - {String? operationName, - required Variables$Query$GetUser variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - Duration? pollInterval, - graphql.Context? context}) - : super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - pollInterval: pollInterval, - context: context, - document: documentNodeQueryGetUser, - parserFn: _parserFn$Query$GetUser); + Options$Query$GetUser({ + String? operationName, + required Variables$Query$GetUser variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Duration? pollInterval, + graphql.Context? context, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + pollInterval: pollInterval, + context: context, + document: documentNodeQueryGetUser, + parserFn: _parserFn$Query$GetUser, + ); } class WatchOptions$Query$GetUser extends graphql.WatchQueryOptions { - WatchOptions$Query$GetUser( - {String? operationName, - required Variables$Query$GetUser variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeQueryGetUser, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Query$GetUser); + WatchOptions$Query$GetUser({ + String? operationName, + required Variables$Query$GetUser variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeQueryGetUser, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Query$GetUser, + ); } class FetchMoreOptions$Query$GetUser extends graphql.FetchMoreOptions { - FetchMoreOptions$Query$GetUser( - {required graphql.UpdateQuery updateQuery, - required Variables$Query$GetUser variables}) - : super( - updateQuery: updateQuery, - variables: variables.toJson(), - document: documentNodeQueryGetUser); + FetchMoreOptions$Query$GetUser({ + required graphql.UpdateQuery updateQuery, + required Variables$Query$GetUser variables, + }) : super( + updateQuery: updateQuery, + variables: variables.toJson(), + document: documentNodeQueryGetUser, + ); } extension ClientExtension$Query$GetUser on graphql.GraphQLClient { @@ -1016,82 +3003,126 @@ extension ClientExtension$Query$GetUser on graphql.GraphQLClient { graphql.ObservableQuery watchQuery$GetUser( WatchOptions$Query$GetUser options) => this.watchQuery(options); - void writeQuery$GetUser( - {required Query$GetUser data, - required Variables$Query$GetUser variables, - bool broadcast = true}) => + void writeQuery$GetUser({ + required Query$GetUser data, + required Variables$Query$GetUser variables, + bool broadcast = true, + }) => this.writeQuery( - graphql.Request( - operation: graphql.Operation(document: documentNodeQueryGetUser), - variables: variables.toJson()), - data: data.toJson(), - broadcast: broadcast); - Query$GetUser? readQuery$GetUser( - {required Variables$Query$GetUser variables, bool optimistic = true}) { - final result = this.readQuery( graphql.Request( - operation: graphql.Operation(document: documentNodeQueryGetUser), - variables: variables.toJson()), - optimistic: optimistic); + operation: graphql.Operation(document: documentNodeQueryGetUser), + variables: variables.toJson(), + ), + data: data.toJson(), + broadcast: broadcast, + ); + Query$GetUser? readQuery$GetUser({ + required Variables$Query$GetUser variables, + bool optimistic = true, + }) { + final result = this.readQuery( + graphql.Request( + operation: graphql.Operation(document: documentNodeQueryGetUser), + variables: variables.toJson(), + ), + optimistic: optimistic, + ); return result == null ? null : Query$GetUser.fromJson(result); } } -@JsonSerializable(explicitToJson: true) class Query$GetUser$users { - Query$GetUser$users({this.getUser, required this.$__typename}); + Query$GetUser$users({ + this.getUser, + required this.$__typename, + }); - @override - factory Query$GetUser$users.fromJson(Map json) => - _$Query$GetUser$usersFromJson(json); + factory Query$GetUser$users.fromJson(Map json) { + final l$getUser = json['getUser']; + final l$$__typename = json['__typename']; + return Query$GetUser$users( + getUser: l$getUser == null + ? null + : Fragment$userFields.fromJson((l$getUser as Map)), + $__typename: (l$$__typename as String), + ); + } final Fragment$userFields? getUser; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$GetUser$usersToJson(this); + Map toJson() { + final _resultData = {}; + final l$getUser = getUser; + _resultData['getUser'] = l$getUser?.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$getUser = getUser; final l$$__typename = $__typename; - return Object.hashAll([l$getUser, l$$__typename]); + return Object.hashAll([ + l$getUser, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Query$GetUser$users) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Query$GetUser$users) || runtimeType != other.runtimeType) { return false; + } final l$getUser = getUser; final lOther$getUser = other.getUser; - if (l$getUser != lOther$getUser) return false; + if (l$getUser != lOther$getUser) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Query$GetUser$users on Query$GetUser$users { CopyWith$Query$GetUser$users get copyWith => - CopyWith$Query$GetUser$users(this, (i) => i); + CopyWith$Query$GetUser$users( + this, + (i) => i, + ); } abstract class CopyWith$Query$GetUser$users { - factory CopyWith$Query$GetUser$users(Query$GetUser$users instance, - TRes Function(Query$GetUser$users) then) = - _CopyWithImpl$Query$GetUser$users; + factory CopyWith$Query$GetUser$users( + Query$GetUser$users instance, + TRes Function(Query$GetUser$users) then, + ) = _CopyWithImpl$Query$GetUser$users; factory CopyWith$Query$GetUser$users.stub(TRes res) = _CopyWithStubImpl$Query$GetUser$users; - TRes call({Fragment$userFields? getUser, String? $__typename}); + TRes call({ + Fragment$userFields? getUser, + String? $__typename, + }); CopyWith$Fragment$userFields get getUser; } class _CopyWithImpl$Query$GetUser$users implements CopyWith$Query$GetUser$users { - _CopyWithImpl$Query$GetUser$users(this._instance, this._then); + _CopyWithImpl$Query$GetUser$users( + this._instance, + this._then, + ); final Query$GetUser$users _instance; @@ -1099,14 +3130,18 @@ class _CopyWithImpl$Query$GetUser$users static const _undefined = {}; - TRes call({Object? getUser = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? getUser = _undefined, + Object? $__typename = _undefined, + }) => _then(Query$GetUser$users( - getUser: getUser == _undefined - ? _instance.getUser - : (getUser as Fragment$userFields?), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + getUser: getUser == _undefined + ? _instance.getUser + : (getUser as Fragment$userFields?), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Fragment$userFields get getUser { final local$getUser = _instance.getUser; return local$getUser == null @@ -1121,47 +3156,77 @@ class _CopyWithStubImpl$Query$GetUser$users TRes _res; - call({Fragment$userFields? getUser, String? $__typename}) => _res; + call({ + Fragment$userFields? getUser, + String? $__typename, + }) => + _res; CopyWith$Fragment$userFields get getUser => CopyWith$Fragment$userFields.stub(_res); } -@JsonSerializable(explicitToJson: true) class Variables$Mutation$CreateUser { - Variables$Mutation$CreateUser({required this.user}); + factory Variables$Mutation$CreateUser( + {required Input$UserMutationInput user}) => + Variables$Mutation$CreateUser._({ + r'user': user, + }); + + Variables$Mutation$CreateUser._(this._$data); + + factory Variables$Mutation$CreateUser.fromJson(Map data) { + final result$data = {}; + final l$user = data['user']; + result$data['user'] = + Input$UserMutationInput.fromJson((l$user as Map)); + return Variables$Mutation$CreateUser._(result$data); + } + + Map _$data; + + Input$UserMutationInput get user => + (_$data['user'] as Input$UserMutationInput); + Map toJson() { + final result$data = {}; + final l$user = user; + result$data['user'] = l$user.toJson(); + return result$data; + } + + CopyWith$Variables$Mutation$CreateUser + get copyWith => CopyWith$Variables$Mutation$CreateUser( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$CreateUser) || + runtimeType != other.runtimeType) { + return false; + } + final l$user = user; + final lOther$user = other.user; + if (l$user != lOther$user) { + return false; + } + return true; + } @override - factory Variables$Mutation$CreateUser.fromJson(Map json) => - _$Variables$Mutation$CreateUserFromJson(json); - - final Input$UserMutationInput user; - - Map toJson() => _$Variables$Mutation$CreateUserToJson(this); int get hashCode { final l$user = user; return Object.hashAll([l$user]); } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Variables$Mutation$CreateUser) || - runtimeType != other.runtimeType) return false; - final l$user = user; - final lOther$user = other.user; - if (l$user != lOther$user) return false; - return true; - } - - CopyWith$Variables$Mutation$CreateUser - get copyWith => CopyWith$Variables$Mutation$CreateUser(this, (i) => i); } abstract class CopyWith$Variables$Mutation$CreateUser { factory CopyWith$Variables$Mutation$CreateUser( - Variables$Mutation$CreateUser instance, - TRes Function(Variables$Mutation$CreateUser) then) = - _CopyWithImpl$Variables$Mutation$CreateUser; + Variables$Mutation$CreateUser instance, + TRes Function(Variables$Mutation$CreateUser) then, + ) = _CopyWithImpl$Variables$Mutation$CreateUser; factory CopyWith$Variables$Mutation$CreateUser.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$CreateUser; @@ -1171,7 +3236,10 @@ abstract class CopyWith$Variables$Mutation$CreateUser { class _CopyWithImpl$Variables$Mutation$CreateUser implements CopyWith$Variables$Mutation$CreateUser { - _CopyWithImpl$Variables$Mutation$CreateUser(this._instance, this._then); + _CopyWithImpl$Variables$Mutation$CreateUser( + this._instance, + this._then, + ); final Variables$Mutation$CreateUser _instance; @@ -1179,10 +3247,12 @@ class _CopyWithImpl$Variables$Mutation$CreateUser static const _undefined = {}; - TRes call({Object? user = _undefined}) => _then(Variables$Mutation$CreateUser( - user: user == _undefined || user == null - ? _instance.user - : (user as Input$UserMutationInput))); + TRes call({Object? user = _undefined}) => + _then(Variables$Mutation$CreateUser._({ + ..._instance._$data, + if (user != _undefined && user != null) + 'user': (user as Input$UserMutationInput), + })); } class _CopyWithStubImpl$Variables$Mutation$CreateUser @@ -1194,61 +3264,97 @@ class _CopyWithStubImpl$Variables$Mutation$CreateUser call({Input$UserMutationInput? user}) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$CreateUser { - Mutation$CreateUser({required this.createUser, required this.$__typename}); + Mutation$CreateUser({ + required this.createUser, + required this.$__typename, + }); - @override - factory Mutation$CreateUser.fromJson(Map json) => - _$Mutation$CreateUserFromJson(json); + factory Mutation$CreateUser.fromJson(Map json) { + final l$createUser = json['createUser']; + final l$$__typename = json['__typename']; + return Mutation$CreateUser( + createUser: Mutation$CreateUser$createUser.fromJson( + (l$createUser as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$CreateUser$createUser createUser; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$CreateUserToJson(this); + Map toJson() { + final _resultData = {}; + final l$createUser = createUser; + _resultData['createUser'] = l$createUser.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$createUser = createUser; final l$$__typename = $__typename; - return Object.hashAll([l$createUser, l$$__typename]); + return Object.hashAll([ + l$createUser, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Mutation$CreateUser) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Mutation$CreateUser) || runtimeType != other.runtimeType) { return false; + } final l$createUser = createUser; final lOther$createUser = other.createUser; - if (l$createUser != lOther$createUser) return false; + if (l$createUser != lOther$createUser) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Mutation$CreateUser on Mutation$CreateUser { CopyWith$Mutation$CreateUser get copyWith => - CopyWith$Mutation$CreateUser(this, (i) => i); + CopyWith$Mutation$CreateUser( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$CreateUser { - factory CopyWith$Mutation$CreateUser(Mutation$CreateUser instance, - TRes Function(Mutation$CreateUser) then) = - _CopyWithImpl$Mutation$CreateUser; + factory CopyWith$Mutation$CreateUser( + Mutation$CreateUser instance, + TRes Function(Mutation$CreateUser) then, + ) = _CopyWithImpl$Mutation$CreateUser; factory CopyWith$Mutation$CreateUser.stub(TRes res) = _CopyWithStubImpl$Mutation$CreateUser; - TRes call({Mutation$CreateUser$createUser? createUser, String? $__typename}); + TRes call({ + Mutation$CreateUser$createUser? createUser, + String? $__typename, + }); CopyWith$Mutation$CreateUser$createUser get createUser; } class _CopyWithImpl$Mutation$CreateUser implements CopyWith$Mutation$CreateUser { - _CopyWithImpl$Mutation$CreateUser(this._instance, this._then); + _CopyWithImpl$Mutation$CreateUser( + this._instance, + this._then, + ); final Mutation$CreateUser _instance; @@ -1256,16 +3362,18 @@ class _CopyWithImpl$Mutation$CreateUser static const _undefined = {}; - TRes call( - {Object? createUser = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? createUser = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$CreateUser( - createUser: createUser == _undefined || createUser == null - ? _instance.createUser - : (createUser as Mutation$CreateUser$createUser), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + createUser: createUser == _undefined || createUser == null + ? _instance.createUser + : (createUser as Mutation$CreateUser$createUser), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$CreateUser$createUser get createUser { final local$createUser = _instance.createUser; return CopyWith$Mutation$CreateUser$createUser( @@ -1279,7 +3387,10 @@ class _CopyWithStubImpl$Mutation$CreateUser TRes _res; - call({Mutation$CreateUser$createUser? createUser, String? $__typename}) => + call({ + Mutation$CreateUser$createUser? createUser, + String? $__typename, + }) => _res; CopyWith$Mutation$CreateUser$createUser get createUser => CopyWith$Mutation$CreateUser$createUser.stub(_res); @@ -1287,98 +3398,116 @@ class _CopyWithStubImpl$Mutation$CreateUser const documentNodeMutationCreateUser = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'CreateUser'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'user')), - type: NamedTypeNode( - name: NameNode(value: 'UserMutationInput'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'createUser'), + type: OperationType.mutation, + name: NameNode(value: 'CreateUser'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'user')), + type: NamedTypeNode( + name: NameNode(value: 'UserMutationInput'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'createUser'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'user'), + value: VariableNode(name: NameNode(value: 'user')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: [], + ), + FieldNode( + name: NameNode(value: 'user'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'user'), - value: VariableNode(name: NameNode(value: 'user'))) - ], + arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), + name: NameNode(value: 'userFields'), + directives: [], + ), FieldNode( - name: NameNode(value: 'user'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'userFields'), directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, fragmentDefinitionuserFields, ]); Mutation$CreateUser _parserFn$Mutation$CreateUser(Map data) => Mutation$CreateUser.fromJson(data); typedef OnMutationCompleted$Mutation$CreateUser = FutureOr Function( - dynamic, Mutation$CreateUser?); + dynamic, + Mutation$CreateUser?, +); class Options$Mutation$CreateUser extends graphql.MutationOptions { - Options$Mutation$CreateUser( - {String? operationName, - required Variables$Mutation$CreateUser variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$CreateUser? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$CreateUser({ + String? operationName, + required Variables$Mutation$CreateUser variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$CreateUser? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted(data, - data == null ? null : _parserFn$Mutation$CreateUser(data)), - update: update, - onError: onError, - document: documentNodeMutationCreateUser, - parserFn: _parserFn$Mutation$CreateUser); + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( + data, + data == null ? null : _parserFn$Mutation$CreateUser(data), + ), + update: update, + onError: onError, + document: documentNodeMutationCreateUser, + parserFn: _parserFn$Mutation$CreateUser, + ); final OnMutationCompleted$Mutation$CreateUser? onCompletedWithParsed; @@ -1387,38 +3516,39 @@ class Options$Mutation$CreateUser ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$CreateUser extends graphql.WatchQueryOptions { - WatchOptions$Mutation$CreateUser( - {String? operationName, - required Variables$Mutation$CreateUser variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationCreateUser, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$CreateUser); + WatchOptions$Mutation$CreateUser({ + String? operationName, + required Variables$Mutation$CreateUser variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationCreateUser, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$CreateUser, + ); } extension ClientExtension$Mutation$CreateUser on graphql.GraphQLClient { @@ -1430,19 +3560,32 @@ extension ClientExtension$Mutation$CreateUser on graphql.GraphQLClient { this.watchMutation(options); } -@JsonSerializable(explicitToJson: true) class Mutation$CreateUser$createUser - implements Fragment$basicMutationReturnFields { - Mutation$CreateUser$createUser( - {required this.code, - required this.message, - required this.success, - required this.$__typename, - this.user}); + implements Fragment$basicMutationReturnFields$$UserMutationReturn { + Mutation$CreateUser$createUser({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + this.user, + }); - @override - factory Mutation$CreateUser$createUser.fromJson(Map json) => - _$Mutation$CreateUser$createUserFromJson(json); + factory Mutation$CreateUser$createUser.fromJson(Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + final l$user = json['user']; + return Mutation$CreateUser$createUser( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + user: l$user == null + ? null + : Fragment$userFields.fromJson((l$user as Map)), + ); + } final int code; @@ -1450,42 +3593,75 @@ class Mutation$CreateUser$createUser final bool success; - @JsonKey(name: '__typename') final String $__typename; final Fragment$userFields? user; - Map toJson() => _$Mutation$CreateUser$createUserToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + final l$user = user; + _resultData['user'] = l$user?.toJson(); + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; final l$user = user; - return Object.hashAll( - [l$code, l$message, l$success, l$$__typename, l$user]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + l$user, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$CreateUser$createUser) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } final l$user = user; final lOther$user = other.user; - if (l$user != lOther$user) return false; + if (l$user != lOther$user) { + return false; + } return true; } } @@ -1493,30 +3669,37 @@ class Mutation$CreateUser$createUser extension UtilityExtension$Mutation$CreateUser$createUser on Mutation$CreateUser$createUser { CopyWith$Mutation$CreateUser$createUser - get copyWith => CopyWith$Mutation$CreateUser$createUser(this, (i) => i); + get copyWith => CopyWith$Mutation$CreateUser$createUser( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$CreateUser$createUser { factory CopyWith$Mutation$CreateUser$createUser( - Mutation$CreateUser$createUser instance, - TRes Function(Mutation$CreateUser$createUser) then) = - _CopyWithImpl$Mutation$CreateUser$createUser; + Mutation$CreateUser$createUser instance, + TRes Function(Mutation$CreateUser$createUser) then, + ) = _CopyWithImpl$Mutation$CreateUser$createUser; factory CopyWith$Mutation$CreateUser$createUser.stub(TRes res) = _CopyWithStubImpl$Mutation$CreateUser$createUser; - TRes call( - {int? code, - String? message, - bool? success, - String? $__typename, - Fragment$userFields? user}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + Fragment$userFields? user, + }); CopyWith$Fragment$userFields get user; } class _CopyWithImpl$Mutation$CreateUser$createUser implements CopyWith$Mutation$CreateUser$createUser { - _CopyWithImpl$Mutation$CreateUser$createUser(this._instance, this._then); + _CopyWithImpl$Mutation$CreateUser$createUser( + this._instance, + this._then, + ); final Mutation$CreateUser$createUser _instance; @@ -1524,28 +3707,29 @@ class _CopyWithImpl$Mutation$CreateUser$createUser static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined, - Object? user = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + Object? user = _undefined, + }) => _then(Mutation$CreateUser$createUser( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String), - user: user == _undefined - ? _instance.user - : (user as Fragment$userFields?))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + user: user == _undefined + ? _instance.user + : (user as Fragment$userFields?), + )); CopyWith$Fragment$userFields get user { final local$user = _instance.user; return local$user == null @@ -1560,53 +3744,77 @@ class _CopyWithStubImpl$Mutation$CreateUser$createUser TRes _res; - call( - {int? code, - String? message, - bool? success, - String? $__typename, - Fragment$userFields? user}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + Fragment$userFields? user, + }) => _res; CopyWith$Fragment$userFields get user => CopyWith$Fragment$userFields.stub(_res); } -@JsonSerializable(explicitToJson: true) class Variables$Mutation$DeleteUser { - Variables$Mutation$DeleteUser({required this.username}); + factory Variables$Mutation$DeleteUser({required String username}) => + Variables$Mutation$DeleteUser._({ + r'username': username, + }); + + Variables$Mutation$DeleteUser._(this._$data); + + factory Variables$Mutation$DeleteUser.fromJson(Map data) { + final result$data = {}; + final l$username = data['username']; + result$data['username'] = (l$username as String); + return Variables$Mutation$DeleteUser._(result$data); + } + + Map _$data; + + String get username => (_$data['username'] as String); + Map toJson() { + final result$data = {}; + final l$username = username; + result$data['username'] = l$username; + return result$data; + } + + CopyWith$Variables$Mutation$DeleteUser + get copyWith => CopyWith$Variables$Mutation$DeleteUser( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$DeleteUser) || + runtimeType != other.runtimeType) { + return false; + } + final l$username = username; + final lOther$username = other.username; + if (l$username != lOther$username) { + return false; + } + return true; + } @override - factory Variables$Mutation$DeleteUser.fromJson(Map json) => - _$Variables$Mutation$DeleteUserFromJson(json); - - final String username; - - Map toJson() => _$Variables$Mutation$DeleteUserToJson(this); int get hashCode { final l$username = username; return Object.hashAll([l$username]); } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Variables$Mutation$DeleteUser) || - runtimeType != other.runtimeType) return false; - final l$username = username; - final lOther$username = other.username; - if (l$username != lOther$username) return false; - return true; - } - - CopyWith$Variables$Mutation$DeleteUser - get copyWith => CopyWith$Variables$Mutation$DeleteUser(this, (i) => i); } abstract class CopyWith$Variables$Mutation$DeleteUser { factory CopyWith$Variables$Mutation$DeleteUser( - Variables$Mutation$DeleteUser instance, - TRes Function(Variables$Mutation$DeleteUser) then) = - _CopyWithImpl$Variables$Mutation$DeleteUser; + Variables$Mutation$DeleteUser instance, + TRes Function(Variables$Mutation$DeleteUser) then, + ) = _CopyWithImpl$Variables$Mutation$DeleteUser; factory CopyWith$Variables$Mutation$DeleteUser.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$DeleteUser; @@ -1616,7 +3824,10 @@ abstract class CopyWith$Variables$Mutation$DeleteUser { class _CopyWithImpl$Variables$Mutation$DeleteUser implements CopyWith$Variables$Mutation$DeleteUser { - _CopyWithImpl$Variables$Mutation$DeleteUser(this._instance, this._then); + _CopyWithImpl$Variables$Mutation$DeleteUser( + this._instance, + this._then, + ); final Variables$Mutation$DeleteUser _instance; @@ -1624,11 +3835,12 @@ class _CopyWithImpl$Variables$Mutation$DeleteUser static const _undefined = {}; - TRes call({Object? username = _undefined}) => _then( - Variables$Mutation$DeleteUser( - username: username == _undefined || username == null - ? _instance.username - : (username as String))); + TRes call({Object? username = _undefined}) => + _then(Variables$Mutation$DeleteUser._({ + ..._instance._$data, + if (username != _undefined && username != null) + 'username': (username as String), + })); } class _CopyWithStubImpl$Variables$Mutation$DeleteUser @@ -1640,61 +3852,97 @@ class _CopyWithStubImpl$Variables$Mutation$DeleteUser call({String? username}) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$DeleteUser { - Mutation$DeleteUser({required this.deleteUser, required this.$__typename}); + Mutation$DeleteUser({ + required this.deleteUser, + required this.$__typename, + }); - @override - factory Mutation$DeleteUser.fromJson(Map json) => - _$Mutation$DeleteUserFromJson(json); + factory Mutation$DeleteUser.fromJson(Map json) { + final l$deleteUser = json['deleteUser']; + final l$$__typename = json['__typename']; + return Mutation$DeleteUser( + deleteUser: Mutation$DeleteUser$deleteUser.fromJson( + (l$deleteUser as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$DeleteUser$deleteUser deleteUser; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$DeleteUserToJson(this); + Map toJson() { + final _resultData = {}; + final l$deleteUser = deleteUser; + _resultData['deleteUser'] = l$deleteUser.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$deleteUser = deleteUser; final l$$__typename = $__typename; - return Object.hashAll([l$deleteUser, l$$__typename]); + return Object.hashAll([ + l$deleteUser, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Mutation$DeleteUser) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Mutation$DeleteUser) || runtimeType != other.runtimeType) { return false; + } final l$deleteUser = deleteUser; final lOther$deleteUser = other.deleteUser; - if (l$deleteUser != lOther$deleteUser) return false; + if (l$deleteUser != lOther$deleteUser) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Mutation$DeleteUser on Mutation$DeleteUser { CopyWith$Mutation$DeleteUser get copyWith => - CopyWith$Mutation$DeleteUser(this, (i) => i); + CopyWith$Mutation$DeleteUser( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$DeleteUser { - factory CopyWith$Mutation$DeleteUser(Mutation$DeleteUser instance, - TRes Function(Mutation$DeleteUser) then) = - _CopyWithImpl$Mutation$DeleteUser; + factory CopyWith$Mutation$DeleteUser( + Mutation$DeleteUser instance, + TRes Function(Mutation$DeleteUser) then, + ) = _CopyWithImpl$Mutation$DeleteUser; factory CopyWith$Mutation$DeleteUser.stub(TRes res) = _CopyWithStubImpl$Mutation$DeleteUser; - TRes call({Mutation$DeleteUser$deleteUser? deleteUser, String? $__typename}); + TRes call({ + Mutation$DeleteUser$deleteUser? deleteUser, + String? $__typename, + }); CopyWith$Mutation$DeleteUser$deleteUser get deleteUser; } class _CopyWithImpl$Mutation$DeleteUser implements CopyWith$Mutation$DeleteUser { - _CopyWithImpl$Mutation$DeleteUser(this._instance, this._then); + _CopyWithImpl$Mutation$DeleteUser( + this._instance, + this._then, + ); final Mutation$DeleteUser _instance; @@ -1702,16 +3950,18 @@ class _CopyWithImpl$Mutation$DeleteUser static const _undefined = {}; - TRes call( - {Object? deleteUser = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? deleteUser = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$DeleteUser( - deleteUser: deleteUser == _undefined || deleteUser == null - ? _instance.deleteUser - : (deleteUser as Mutation$DeleteUser$deleteUser), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + deleteUser: deleteUser == _undefined || deleteUser == null + ? _instance.deleteUser + : (deleteUser as Mutation$DeleteUser$deleteUser), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$DeleteUser$deleteUser get deleteUser { final local$deleteUser = _instance.deleteUser; return CopyWith$Mutation$DeleteUser$deleteUser( @@ -1725,7 +3975,10 @@ class _CopyWithStubImpl$Mutation$DeleteUser TRes _res; - call({Mutation$DeleteUser$deleteUser? deleteUser, String? $__typename}) => + call({ + Mutation$DeleteUser$deleteUser? deleteUser, + String? $__typename, + }) => _res; CopyWith$Mutation$DeleteUser$deleteUser get deleteUser => CopyWith$Mutation$DeleteUser$deleteUser.stub(_res); @@ -1733,82 +3986,96 @@ class _CopyWithStubImpl$Mutation$DeleteUser const documentNodeMutationDeleteUser = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'DeleteUser'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'username')), - type: - NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'deleteUser'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'username'), - value: VariableNode(name: NameNode(value: 'username'))) - ], + type: OperationType.mutation, + name: NameNode(value: 'DeleteUser'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'username')), + type: NamedTypeNode( + name: NameNode(value: 'String'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'deleteUser'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'username'), + value: VariableNode(name: NameNode(value: 'username')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, ]); Mutation$DeleteUser _parserFn$Mutation$DeleteUser(Map data) => Mutation$DeleteUser.fromJson(data); typedef OnMutationCompleted$Mutation$DeleteUser = FutureOr Function( - dynamic, Mutation$DeleteUser?); + dynamic, + Mutation$DeleteUser?, +); class Options$Mutation$DeleteUser extends graphql.MutationOptions { - Options$Mutation$DeleteUser( - {String? operationName, - required Variables$Mutation$DeleteUser variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$DeleteUser? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$DeleteUser({ + String? operationName, + required Variables$Mutation$DeleteUser variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$DeleteUser? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted(data, - data == null ? null : _parserFn$Mutation$DeleteUser(data)), - update: update, - onError: onError, - document: documentNodeMutationDeleteUser, - parserFn: _parserFn$Mutation$DeleteUser); + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( + data, + data == null ? null : _parserFn$Mutation$DeleteUser(data), + ), + update: update, + onError: onError, + document: documentNodeMutationDeleteUser, + parserFn: _parserFn$Mutation$DeleteUser, + ); final OnMutationCompleted$Mutation$DeleteUser? onCompletedWithParsed; @@ -1817,38 +4084,39 @@ class Options$Mutation$DeleteUser ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$DeleteUser extends graphql.WatchQueryOptions { - WatchOptions$Mutation$DeleteUser( - {String? operationName, - required Variables$Mutation$DeleteUser variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationDeleteUser, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$DeleteUser); + WatchOptions$Mutation$DeleteUser({ + String? operationName, + required Variables$Mutation$DeleteUser variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationDeleteUser, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$DeleteUser, + ); } extension ClientExtension$Mutation$DeleteUser on graphql.GraphQLClient { @@ -1860,18 +4128,27 @@ extension ClientExtension$Mutation$DeleteUser on graphql.GraphQLClient { this.watchMutation(options); } -@JsonSerializable(explicitToJson: true) class Mutation$DeleteUser$deleteUser - implements Fragment$basicMutationReturnFields { - Mutation$DeleteUser$deleteUser( - {required this.code, - required this.message, - required this.success, - required this.$__typename}); + implements Fragment$basicMutationReturnFields$$GenericMutationReturn { + Mutation$DeleteUser$deleteUser({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + }); - @override - factory Mutation$DeleteUser$deleteUser.fromJson(Map json) => - _$Mutation$DeleteUser$deleteUserFromJson(json); + factory Mutation$DeleteUser$deleteUser.fromJson(Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + return Mutation$DeleteUser$deleteUser( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + ); + } final int code; @@ -1879,35 +4156,64 @@ class Mutation$DeleteUser$deleteUser final bool success; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$DeleteUser$deleteUserToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; - return Object.hashAll([l$code, l$message, l$success, l$$__typename]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$DeleteUser$deleteUser) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } @@ -1915,24 +4221,35 @@ class Mutation$DeleteUser$deleteUser extension UtilityExtension$Mutation$DeleteUser$deleteUser on Mutation$DeleteUser$deleteUser { CopyWith$Mutation$DeleteUser$deleteUser - get copyWith => CopyWith$Mutation$DeleteUser$deleteUser(this, (i) => i); + get copyWith => CopyWith$Mutation$DeleteUser$deleteUser( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$DeleteUser$deleteUser { factory CopyWith$Mutation$DeleteUser$deleteUser( - Mutation$DeleteUser$deleteUser instance, - TRes Function(Mutation$DeleteUser$deleteUser) then) = - _CopyWithImpl$Mutation$DeleteUser$deleteUser; + Mutation$DeleteUser$deleteUser instance, + TRes Function(Mutation$DeleteUser$deleteUser) then, + ) = _CopyWithImpl$Mutation$DeleteUser$deleteUser; factory CopyWith$Mutation$DeleteUser$deleteUser.stub(TRes res) = _CopyWithStubImpl$Mutation$DeleteUser$deleteUser; - TRes call({int? code, String? message, bool? success, String? $__typename}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + }); } class _CopyWithImpl$Mutation$DeleteUser$deleteUser implements CopyWith$Mutation$DeleteUser$deleteUser { - _CopyWithImpl$Mutation$DeleteUser$deleteUser(this._instance, this._then); + _CopyWithImpl$Mutation$DeleteUser$deleteUser( + this._instance, + this._then, + ); final Mutation$DeleteUser$deleteUser _instance; @@ -1940,24 +4257,25 @@ class _CopyWithImpl$Mutation$DeleteUser$deleteUser static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$DeleteUser$deleteUser( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); } class _CopyWithStubImpl$Mutation$DeleteUser$deleteUser @@ -1966,46 +4284,77 @@ class _CopyWithStubImpl$Mutation$DeleteUser$deleteUser TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + }) => _res; } -@JsonSerializable(explicitToJson: true) class Variables$Mutation$UpdateUser { - Variables$Mutation$UpdateUser({required this.user}); + factory Variables$Mutation$UpdateUser( + {required Input$UserMutationInput user}) => + Variables$Mutation$UpdateUser._({ + r'user': user, + }); + + Variables$Mutation$UpdateUser._(this._$data); + + factory Variables$Mutation$UpdateUser.fromJson(Map data) { + final result$data = {}; + final l$user = data['user']; + result$data['user'] = + Input$UserMutationInput.fromJson((l$user as Map)); + return Variables$Mutation$UpdateUser._(result$data); + } + + Map _$data; + + Input$UserMutationInput get user => + (_$data['user'] as Input$UserMutationInput); + Map toJson() { + final result$data = {}; + final l$user = user; + result$data['user'] = l$user.toJson(); + return result$data; + } + + CopyWith$Variables$Mutation$UpdateUser + get copyWith => CopyWith$Variables$Mutation$UpdateUser( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$UpdateUser) || + runtimeType != other.runtimeType) { + return false; + } + final l$user = user; + final lOther$user = other.user; + if (l$user != lOther$user) { + return false; + } + return true; + } @override - factory Variables$Mutation$UpdateUser.fromJson(Map json) => - _$Variables$Mutation$UpdateUserFromJson(json); - - final Input$UserMutationInput user; - - Map toJson() => _$Variables$Mutation$UpdateUserToJson(this); int get hashCode { final l$user = user; return Object.hashAll([l$user]); } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Variables$Mutation$UpdateUser) || - runtimeType != other.runtimeType) return false; - final l$user = user; - final lOther$user = other.user; - if (l$user != lOther$user) return false; - return true; - } - - CopyWith$Variables$Mutation$UpdateUser - get copyWith => CopyWith$Variables$Mutation$UpdateUser(this, (i) => i); } abstract class CopyWith$Variables$Mutation$UpdateUser { factory CopyWith$Variables$Mutation$UpdateUser( - Variables$Mutation$UpdateUser instance, - TRes Function(Variables$Mutation$UpdateUser) then) = - _CopyWithImpl$Variables$Mutation$UpdateUser; + Variables$Mutation$UpdateUser instance, + TRes Function(Variables$Mutation$UpdateUser) then, + ) = _CopyWithImpl$Variables$Mutation$UpdateUser; factory CopyWith$Variables$Mutation$UpdateUser.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$UpdateUser; @@ -2015,7 +4364,10 @@ abstract class CopyWith$Variables$Mutation$UpdateUser { class _CopyWithImpl$Variables$Mutation$UpdateUser implements CopyWith$Variables$Mutation$UpdateUser { - _CopyWithImpl$Variables$Mutation$UpdateUser(this._instance, this._then); + _CopyWithImpl$Variables$Mutation$UpdateUser( + this._instance, + this._then, + ); final Variables$Mutation$UpdateUser _instance; @@ -2023,10 +4375,12 @@ class _CopyWithImpl$Variables$Mutation$UpdateUser static const _undefined = {}; - TRes call({Object? user = _undefined}) => _then(Variables$Mutation$UpdateUser( - user: user == _undefined || user == null - ? _instance.user - : (user as Input$UserMutationInput))); + TRes call({Object? user = _undefined}) => + _then(Variables$Mutation$UpdateUser._({ + ..._instance._$data, + if (user != _undefined && user != null) + 'user': (user as Input$UserMutationInput), + })); } class _CopyWithStubImpl$Variables$Mutation$UpdateUser @@ -2038,61 +4392,97 @@ class _CopyWithStubImpl$Variables$Mutation$UpdateUser call({Input$UserMutationInput? user}) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$UpdateUser { - Mutation$UpdateUser({required this.updateUser, required this.$__typename}); + Mutation$UpdateUser({ + required this.updateUser, + required this.$__typename, + }); - @override - factory Mutation$UpdateUser.fromJson(Map json) => - _$Mutation$UpdateUserFromJson(json); + factory Mutation$UpdateUser.fromJson(Map json) { + final l$updateUser = json['updateUser']; + final l$$__typename = json['__typename']; + return Mutation$UpdateUser( + updateUser: Mutation$UpdateUser$updateUser.fromJson( + (l$updateUser as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$UpdateUser$updateUser updateUser; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$UpdateUserToJson(this); + Map toJson() { + final _resultData = {}; + final l$updateUser = updateUser; + _resultData['updateUser'] = l$updateUser.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$updateUser = updateUser; final l$$__typename = $__typename; - return Object.hashAll([l$updateUser, l$$__typename]); + return Object.hashAll([ + l$updateUser, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Mutation$UpdateUser) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Mutation$UpdateUser) || runtimeType != other.runtimeType) { return false; + } final l$updateUser = updateUser; final lOther$updateUser = other.updateUser; - if (l$updateUser != lOther$updateUser) return false; + if (l$updateUser != lOther$updateUser) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Mutation$UpdateUser on Mutation$UpdateUser { CopyWith$Mutation$UpdateUser get copyWith => - CopyWith$Mutation$UpdateUser(this, (i) => i); + CopyWith$Mutation$UpdateUser( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$UpdateUser { - factory CopyWith$Mutation$UpdateUser(Mutation$UpdateUser instance, - TRes Function(Mutation$UpdateUser) then) = - _CopyWithImpl$Mutation$UpdateUser; + factory CopyWith$Mutation$UpdateUser( + Mutation$UpdateUser instance, + TRes Function(Mutation$UpdateUser) then, + ) = _CopyWithImpl$Mutation$UpdateUser; factory CopyWith$Mutation$UpdateUser.stub(TRes res) = _CopyWithStubImpl$Mutation$UpdateUser; - TRes call({Mutation$UpdateUser$updateUser? updateUser, String? $__typename}); + TRes call({ + Mutation$UpdateUser$updateUser? updateUser, + String? $__typename, + }); CopyWith$Mutation$UpdateUser$updateUser get updateUser; } class _CopyWithImpl$Mutation$UpdateUser implements CopyWith$Mutation$UpdateUser { - _CopyWithImpl$Mutation$UpdateUser(this._instance, this._then); + _CopyWithImpl$Mutation$UpdateUser( + this._instance, + this._then, + ); final Mutation$UpdateUser _instance; @@ -2100,16 +4490,18 @@ class _CopyWithImpl$Mutation$UpdateUser static const _undefined = {}; - TRes call( - {Object? updateUser = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? updateUser = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$UpdateUser( - updateUser: updateUser == _undefined || updateUser == null - ? _instance.updateUser - : (updateUser as Mutation$UpdateUser$updateUser), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + updateUser: updateUser == _undefined || updateUser == null + ? _instance.updateUser + : (updateUser as Mutation$UpdateUser$updateUser), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$UpdateUser$updateUser get updateUser { final local$updateUser = _instance.updateUser; return CopyWith$Mutation$UpdateUser$updateUser( @@ -2123,7 +4515,10 @@ class _CopyWithStubImpl$Mutation$UpdateUser TRes _res; - call({Mutation$UpdateUser$updateUser? updateUser, String? $__typename}) => + call({ + Mutation$UpdateUser$updateUser? updateUser, + String? $__typename, + }) => _res; CopyWith$Mutation$UpdateUser$updateUser get updateUser => CopyWith$Mutation$UpdateUser$updateUser.stub(_res); @@ -2131,98 +4526,116 @@ class _CopyWithStubImpl$Mutation$UpdateUser const documentNodeMutationUpdateUser = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'UpdateUser'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'user')), - type: NamedTypeNode( - name: NameNode(value: 'UserMutationInput'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'updateUser'), + type: OperationType.mutation, + name: NameNode(value: 'UpdateUser'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'user')), + type: NamedTypeNode( + name: NameNode(value: 'UserMutationInput'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'updateUser'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'user'), + value: VariableNode(name: NameNode(value: 'user')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: [], + ), + FieldNode( + name: NameNode(value: 'user'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'user'), - value: VariableNode(name: NameNode(value: 'user'))) - ], + arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), + name: NameNode(value: 'userFields'), + directives: [], + ), FieldNode( - name: NameNode(value: 'user'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'userFields'), directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, fragmentDefinitionuserFields, ]); Mutation$UpdateUser _parserFn$Mutation$UpdateUser(Map data) => Mutation$UpdateUser.fromJson(data); typedef OnMutationCompleted$Mutation$UpdateUser = FutureOr Function( - dynamic, Mutation$UpdateUser?); + dynamic, + Mutation$UpdateUser?, +); class Options$Mutation$UpdateUser extends graphql.MutationOptions { - Options$Mutation$UpdateUser( - {String? operationName, - required Variables$Mutation$UpdateUser variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$UpdateUser? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$UpdateUser({ + String? operationName, + required Variables$Mutation$UpdateUser variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$UpdateUser? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted(data, - data == null ? null : _parserFn$Mutation$UpdateUser(data)), - update: update, - onError: onError, - document: documentNodeMutationUpdateUser, - parserFn: _parserFn$Mutation$UpdateUser); + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( + data, + data == null ? null : _parserFn$Mutation$UpdateUser(data), + ), + update: update, + onError: onError, + document: documentNodeMutationUpdateUser, + parserFn: _parserFn$Mutation$UpdateUser, + ); final OnMutationCompleted$Mutation$UpdateUser? onCompletedWithParsed; @@ -2231,38 +4644,39 @@ class Options$Mutation$UpdateUser ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$UpdateUser extends graphql.WatchQueryOptions { - WatchOptions$Mutation$UpdateUser( - {String? operationName, - required Variables$Mutation$UpdateUser variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationUpdateUser, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$UpdateUser); + WatchOptions$Mutation$UpdateUser({ + String? operationName, + required Variables$Mutation$UpdateUser variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationUpdateUser, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$UpdateUser, + ); } extension ClientExtension$Mutation$UpdateUser on graphql.GraphQLClient { @@ -2274,19 +4688,32 @@ extension ClientExtension$Mutation$UpdateUser on graphql.GraphQLClient { this.watchMutation(options); } -@JsonSerializable(explicitToJson: true) class Mutation$UpdateUser$updateUser - implements Fragment$basicMutationReturnFields { - Mutation$UpdateUser$updateUser( - {required this.code, - required this.message, - required this.success, - required this.$__typename, - this.user}); + implements Fragment$basicMutationReturnFields$$UserMutationReturn { + Mutation$UpdateUser$updateUser({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + this.user, + }); - @override - factory Mutation$UpdateUser$updateUser.fromJson(Map json) => - _$Mutation$UpdateUser$updateUserFromJson(json); + factory Mutation$UpdateUser$updateUser.fromJson(Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + final l$user = json['user']; + return Mutation$UpdateUser$updateUser( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + user: l$user == null + ? null + : Fragment$userFields.fromJson((l$user as Map)), + ); + } final int code; @@ -2294,42 +4721,75 @@ class Mutation$UpdateUser$updateUser final bool success; - @JsonKey(name: '__typename') final String $__typename; final Fragment$userFields? user; - Map toJson() => _$Mutation$UpdateUser$updateUserToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + final l$user = user; + _resultData['user'] = l$user?.toJson(); + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; final l$user = user; - return Object.hashAll( - [l$code, l$message, l$success, l$$__typename, l$user]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + l$user, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$UpdateUser$updateUser) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } final l$user = user; final lOther$user = other.user; - if (l$user != lOther$user) return false; + if (l$user != lOther$user) { + return false; + } return true; } } @@ -2337,30 +4797,37 @@ class Mutation$UpdateUser$updateUser extension UtilityExtension$Mutation$UpdateUser$updateUser on Mutation$UpdateUser$updateUser { CopyWith$Mutation$UpdateUser$updateUser - get copyWith => CopyWith$Mutation$UpdateUser$updateUser(this, (i) => i); + get copyWith => CopyWith$Mutation$UpdateUser$updateUser( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$UpdateUser$updateUser { factory CopyWith$Mutation$UpdateUser$updateUser( - Mutation$UpdateUser$updateUser instance, - TRes Function(Mutation$UpdateUser$updateUser) then) = - _CopyWithImpl$Mutation$UpdateUser$updateUser; + Mutation$UpdateUser$updateUser instance, + TRes Function(Mutation$UpdateUser$updateUser) then, + ) = _CopyWithImpl$Mutation$UpdateUser$updateUser; factory CopyWith$Mutation$UpdateUser$updateUser.stub(TRes res) = _CopyWithStubImpl$Mutation$UpdateUser$updateUser; - TRes call( - {int? code, - String? message, - bool? success, - String? $__typename, - Fragment$userFields? user}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + Fragment$userFields? user, + }); CopyWith$Fragment$userFields get user; } class _CopyWithImpl$Mutation$UpdateUser$updateUser implements CopyWith$Mutation$UpdateUser$updateUser { - _CopyWithImpl$Mutation$UpdateUser$updateUser(this._instance, this._then); + _CopyWithImpl$Mutation$UpdateUser$updateUser( + this._instance, + this._then, + ); final Mutation$UpdateUser$updateUser _instance; @@ -2368,28 +4835,29 @@ class _CopyWithImpl$Mutation$UpdateUser$updateUser static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined, - Object? user = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + Object? user = _undefined, + }) => _then(Mutation$UpdateUser$updateUser( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String), - user: user == _undefined - ? _instance.user - : (user as Fragment$userFields?))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + user: user == _undefined + ? _instance.user + : (user as Fragment$userFields?), + )); CopyWith$Fragment$userFields get user { final local$user = _instance.user; return local$user == null @@ -2404,53 +4872,80 @@ class _CopyWithStubImpl$Mutation$UpdateUser$updateUser TRes _res; - call( - {int? code, - String? message, - bool? success, - String? $__typename, - Fragment$userFields? user}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + Fragment$userFields? user, + }) => _res; CopyWith$Fragment$userFields get user => CopyWith$Fragment$userFields.stub(_res); } -@JsonSerializable(explicitToJson: true) class Variables$Mutation$AddSshKey { - Variables$Mutation$AddSshKey({required this.sshInput}); + factory Variables$Mutation$AddSshKey( + {required Input$SshMutationInput sshInput}) => + Variables$Mutation$AddSshKey._({ + r'sshInput': sshInput, + }); + + Variables$Mutation$AddSshKey._(this._$data); + + factory Variables$Mutation$AddSshKey.fromJson(Map data) { + final result$data = {}; + final l$sshInput = data['sshInput']; + result$data['sshInput'] = + Input$SshMutationInput.fromJson((l$sshInput as Map)); + return Variables$Mutation$AddSshKey._(result$data); + } + + Map _$data; + + Input$SshMutationInput get sshInput => + (_$data['sshInput'] as Input$SshMutationInput); + Map toJson() { + final result$data = {}; + final l$sshInput = sshInput; + result$data['sshInput'] = l$sshInput.toJson(); + return result$data; + } + + CopyWith$Variables$Mutation$AddSshKey + get copyWith => CopyWith$Variables$Mutation$AddSshKey( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$AddSshKey) || + runtimeType != other.runtimeType) { + return false; + } + final l$sshInput = sshInput; + final lOther$sshInput = other.sshInput; + if (l$sshInput != lOther$sshInput) { + return false; + } + return true; + } @override - factory Variables$Mutation$AddSshKey.fromJson(Map json) => - _$Variables$Mutation$AddSshKeyFromJson(json); - - final Input$SshMutationInput sshInput; - - Map toJson() => _$Variables$Mutation$AddSshKeyToJson(this); int get hashCode { final l$sshInput = sshInput; return Object.hashAll([l$sshInput]); } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Variables$Mutation$AddSshKey) || - runtimeType != other.runtimeType) return false; - final l$sshInput = sshInput; - final lOther$sshInput = other.sshInput; - if (l$sshInput != lOther$sshInput) return false; - return true; - } - - CopyWith$Variables$Mutation$AddSshKey - get copyWith => CopyWith$Variables$Mutation$AddSshKey(this, (i) => i); } abstract class CopyWith$Variables$Mutation$AddSshKey { factory CopyWith$Variables$Mutation$AddSshKey( - Variables$Mutation$AddSshKey instance, - TRes Function(Variables$Mutation$AddSshKey) then) = - _CopyWithImpl$Variables$Mutation$AddSshKey; + Variables$Mutation$AddSshKey instance, + TRes Function(Variables$Mutation$AddSshKey) then, + ) = _CopyWithImpl$Variables$Mutation$AddSshKey; factory CopyWith$Variables$Mutation$AddSshKey.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$AddSshKey; @@ -2460,7 +4955,10 @@ abstract class CopyWith$Variables$Mutation$AddSshKey { class _CopyWithImpl$Variables$Mutation$AddSshKey implements CopyWith$Variables$Mutation$AddSshKey { - _CopyWithImpl$Variables$Mutation$AddSshKey(this._instance, this._then); + _CopyWithImpl$Variables$Mutation$AddSshKey( + this._instance, + this._then, + ); final Variables$Mutation$AddSshKey _instance; @@ -2469,10 +4967,11 @@ class _CopyWithImpl$Variables$Mutation$AddSshKey static const _undefined = {}; TRes call({Object? sshInput = _undefined}) => - _then(Variables$Mutation$AddSshKey( - sshInput: sshInput == _undefined || sshInput == null - ? _instance.sshInput - : (sshInput as Input$SshMutationInput))); + _then(Variables$Mutation$AddSshKey._({ + ..._instance._$data, + if (sshInput != _undefined && sshInput != null) + 'sshInput': (sshInput as Input$SshMutationInput), + })); } class _CopyWithStubImpl$Variables$Mutation$AddSshKey @@ -2484,61 +4983,97 @@ class _CopyWithStubImpl$Variables$Mutation$AddSshKey call({Input$SshMutationInput? sshInput}) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$AddSshKey { - Mutation$AddSshKey({required this.addSshKey, required this.$__typename}); + Mutation$AddSshKey({ + required this.addSshKey, + required this.$__typename, + }); - @override - factory Mutation$AddSshKey.fromJson(Map json) => - _$Mutation$AddSshKeyFromJson(json); + factory Mutation$AddSshKey.fromJson(Map json) { + final l$addSshKey = json['addSshKey']; + final l$$__typename = json['__typename']; + return Mutation$AddSshKey( + addSshKey: Mutation$AddSshKey$addSshKey.fromJson( + (l$addSshKey as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$AddSshKey$addSshKey addSshKey; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$AddSshKeyToJson(this); + Map toJson() { + final _resultData = {}; + final l$addSshKey = addSshKey; + _resultData['addSshKey'] = l$addSshKey.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$addSshKey = addSshKey; final l$$__typename = $__typename; - return Object.hashAll([l$addSshKey, l$$__typename]); + return Object.hashAll([ + l$addSshKey, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Mutation$AddSshKey) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Mutation$AddSshKey) || runtimeType != other.runtimeType) { return false; + } final l$addSshKey = addSshKey; final lOther$addSshKey = other.addSshKey; - if (l$addSshKey != lOther$addSshKey) return false; + if (l$addSshKey != lOther$addSshKey) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Mutation$AddSshKey on Mutation$AddSshKey { CopyWith$Mutation$AddSshKey get copyWith => - CopyWith$Mutation$AddSshKey(this, (i) => i); + CopyWith$Mutation$AddSshKey( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$AddSshKey { factory CopyWith$Mutation$AddSshKey( - Mutation$AddSshKey instance, TRes Function(Mutation$AddSshKey) then) = - _CopyWithImpl$Mutation$AddSshKey; + Mutation$AddSshKey instance, + TRes Function(Mutation$AddSshKey) then, + ) = _CopyWithImpl$Mutation$AddSshKey; factory CopyWith$Mutation$AddSshKey.stub(TRes res) = _CopyWithStubImpl$Mutation$AddSshKey; - TRes call({Mutation$AddSshKey$addSshKey? addSshKey, String? $__typename}); + TRes call({ + Mutation$AddSshKey$addSshKey? addSshKey, + String? $__typename, + }); CopyWith$Mutation$AddSshKey$addSshKey get addSshKey; } class _CopyWithImpl$Mutation$AddSshKey implements CopyWith$Mutation$AddSshKey { - _CopyWithImpl$Mutation$AddSshKey(this._instance, this._then); + _CopyWithImpl$Mutation$AddSshKey( + this._instance, + this._then, + ); final Mutation$AddSshKey _instance; @@ -2546,15 +5081,18 @@ class _CopyWithImpl$Mutation$AddSshKey static const _undefined = {}; - TRes call( - {Object? addSshKey = _undefined, Object? $__typename = _undefined}) => + TRes call({ + Object? addSshKey = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$AddSshKey( - addSshKey: addSshKey == _undefined || addSshKey == null - ? _instance.addSshKey - : (addSshKey as Mutation$AddSshKey$addSshKey), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + addSshKey: addSshKey == _undefined || addSshKey == null + ? _instance.addSshKey + : (addSshKey as Mutation$AddSshKey$addSshKey), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$AddSshKey$addSshKey get addSshKey { final local$addSshKey = _instance.addSshKey; return CopyWith$Mutation$AddSshKey$addSshKey( @@ -2568,105 +5106,127 @@ class _CopyWithStubImpl$Mutation$AddSshKey TRes _res; - call({Mutation$AddSshKey$addSshKey? addSshKey, String? $__typename}) => _res; + call({ + Mutation$AddSshKey$addSshKey? addSshKey, + String? $__typename, + }) => + _res; CopyWith$Mutation$AddSshKey$addSshKey get addSshKey => CopyWith$Mutation$AddSshKey$addSshKey.stub(_res); } const documentNodeMutationAddSshKey = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'AddSshKey'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'sshInput')), - type: NamedTypeNode( - name: NameNode(value: 'SshMutationInput'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'addSshKey'), + type: OperationType.mutation, + name: NameNode(value: 'AddSshKey'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'sshInput')), + type: NamedTypeNode( + name: NameNode(value: 'SshMutationInput'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'addSshKey'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'sshInput'), + value: VariableNode(name: NameNode(value: 'sshInput')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: [], + ), + FieldNode( + name: NameNode(value: 'user'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'sshInput'), - value: VariableNode(name: NameNode(value: 'sshInput'))) - ], + arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), + name: NameNode(value: 'userFields'), + directives: [], + ), FieldNode( - name: NameNode(value: 'user'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'userFields'), directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, fragmentDefinitionuserFields, ]); Mutation$AddSshKey _parserFn$Mutation$AddSshKey(Map data) => Mutation$AddSshKey.fromJson(data); typedef OnMutationCompleted$Mutation$AddSshKey = FutureOr Function( - dynamic, Mutation$AddSshKey?); + dynamic, + Mutation$AddSshKey?, +); class Options$Mutation$AddSshKey extends graphql.MutationOptions { - Options$Mutation$AddSshKey( - {String? operationName, - required Variables$Mutation$AddSshKey variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$AddSshKey? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$AddSshKey({ + String? operationName, + required Variables$Mutation$AddSshKey variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$AddSshKey? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted(data, - data == null ? null : _parserFn$Mutation$AddSshKey(data)), - update: update, - onError: onError, - document: documentNodeMutationAddSshKey, - parserFn: _parserFn$Mutation$AddSshKey); + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( + data, + data == null ? null : _parserFn$Mutation$AddSshKey(data), + ), + update: update, + onError: onError, + document: documentNodeMutationAddSshKey, + parserFn: _parserFn$Mutation$AddSshKey, + ); final OnMutationCompleted$Mutation$AddSshKey? onCompletedWithParsed; @@ -2675,38 +5235,39 @@ class Options$Mutation$AddSshKey ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$AddSshKey extends graphql.WatchQueryOptions { - WatchOptions$Mutation$AddSshKey( - {String? operationName, - required Variables$Mutation$AddSshKey variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationAddSshKey, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$AddSshKey); + WatchOptions$Mutation$AddSshKey({ + String? operationName, + required Variables$Mutation$AddSshKey variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationAddSshKey, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$AddSshKey, + ); } extension ClientExtension$Mutation$AddSshKey on graphql.GraphQLClient { @@ -2718,19 +5279,32 @@ extension ClientExtension$Mutation$AddSshKey on graphql.GraphQLClient { this.watchMutation(options); } -@JsonSerializable(explicitToJson: true) class Mutation$AddSshKey$addSshKey - implements Fragment$basicMutationReturnFields { - Mutation$AddSshKey$addSshKey( - {required this.code, - required this.message, - required this.success, - required this.$__typename, - this.user}); + implements Fragment$basicMutationReturnFields$$UserMutationReturn { + Mutation$AddSshKey$addSshKey({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + this.user, + }); - @override - factory Mutation$AddSshKey$addSshKey.fromJson(Map json) => - _$Mutation$AddSshKey$addSshKeyFromJson(json); + factory Mutation$AddSshKey$addSshKey.fromJson(Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + final l$user = json['user']; + return Mutation$AddSshKey$addSshKey( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + user: l$user == null + ? null + : Fragment$userFields.fromJson((l$user as Map)), + ); + } final int code; @@ -2738,42 +5312,75 @@ class Mutation$AddSshKey$addSshKey final bool success; - @JsonKey(name: '__typename') final String $__typename; final Fragment$userFields? user; - Map toJson() => _$Mutation$AddSshKey$addSshKeyToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + final l$user = user; + _resultData['user'] = l$user?.toJson(); + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; final l$user = user; - return Object.hashAll( - [l$code, l$message, l$success, l$$__typename, l$user]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + l$user, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$AddSshKey$addSshKey) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } final l$user = user; final lOther$user = other.user; - if (l$user != lOther$user) return false; + if (l$user != lOther$user) { + return false; + } return true; } } @@ -2781,30 +5388,37 @@ class Mutation$AddSshKey$addSshKey extension UtilityExtension$Mutation$AddSshKey$addSshKey on Mutation$AddSshKey$addSshKey { CopyWith$Mutation$AddSshKey$addSshKey - get copyWith => CopyWith$Mutation$AddSshKey$addSshKey(this, (i) => i); + get copyWith => CopyWith$Mutation$AddSshKey$addSshKey( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$AddSshKey$addSshKey { factory CopyWith$Mutation$AddSshKey$addSshKey( - Mutation$AddSshKey$addSshKey instance, - TRes Function(Mutation$AddSshKey$addSshKey) then) = - _CopyWithImpl$Mutation$AddSshKey$addSshKey; + Mutation$AddSshKey$addSshKey instance, + TRes Function(Mutation$AddSshKey$addSshKey) then, + ) = _CopyWithImpl$Mutation$AddSshKey$addSshKey; factory CopyWith$Mutation$AddSshKey$addSshKey.stub(TRes res) = _CopyWithStubImpl$Mutation$AddSshKey$addSshKey; - TRes call( - {int? code, - String? message, - bool? success, - String? $__typename, - Fragment$userFields? user}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + Fragment$userFields? user, + }); CopyWith$Fragment$userFields get user; } class _CopyWithImpl$Mutation$AddSshKey$addSshKey implements CopyWith$Mutation$AddSshKey$addSshKey { - _CopyWithImpl$Mutation$AddSshKey$addSshKey(this._instance, this._then); + _CopyWithImpl$Mutation$AddSshKey$addSshKey( + this._instance, + this._then, + ); final Mutation$AddSshKey$addSshKey _instance; @@ -2812,28 +5426,29 @@ class _CopyWithImpl$Mutation$AddSshKey$addSshKey static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined, - Object? user = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + Object? user = _undefined, + }) => _then(Mutation$AddSshKey$addSshKey( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String), - user: user == _undefined - ? _instance.user - : (user as Fragment$userFields?))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + user: user == _undefined + ? _instance.user + : (user as Fragment$userFields?), + )); CopyWith$Fragment$userFields get user { final local$user = _instance.user; return local$user == null @@ -2848,54 +5463,80 @@ class _CopyWithStubImpl$Mutation$AddSshKey$addSshKey TRes _res; - call( - {int? code, - String? message, - bool? success, - String? $__typename, - Fragment$userFields? user}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + Fragment$userFields? user, + }) => _res; CopyWith$Fragment$userFields get user => CopyWith$Fragment$userFields.stub(_res); } -@JsonSerializable(explicitToJson: true) class Variables$Mutation$RemoveSshKey { - Variables$Mutation$RemoveSshKey({required this.sshInput}); + factory Variables$Mutation$RemoveSshKey( + {required Input$SshMutationInput sshInput}) => + Variables$Mutation$RemoveSshKey._({ + r'sshInput': sshInput, + }); + + Variables$Mutation$RemoveSshKey._(this._$data); + + factory Variables$Mutation$RemoveSshKey.fromJson(Map data) { + final result$data = {}; + final l$sshInput = data['sshInput']; + result$data['sshInput'] = + Input$SshMutationInput.fromJson((l$sshInput as Map)); + return Variables$Mutation$RemoveSshKey._(result$data); + } + + Map _$data; + + Input$SshMutationInput get sshInput => + (_$data['sshInput'] as Input$SshMutationInput); + Map toJson() { + final result$data = {}; + final l$sshInput = sshInput; + result$data['sshInput'] = l$sshInput.toJson(); + return result$data; + } + + CopyWith$Variables$Mutation$RemoveSshKey + get copyWith => CopyWith$Variables$Mutation$RemoveSshKey( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$RemoveSshKey) || + runtimeType != other.runtimeType) { + return false; + } + final l$sshInput = sshInput; + final lOther$sshInput = other.sshInput; + if (l$sshInput != lOther$sshInput) { + return false; + } + return true; + } @override - factory Variables$Mutation$RemoveSshKey.fromJson(Map json) => - _$Variables$Mutation$RemoveSshKeyFromJson(json); - - final Input$SshMutationInput sshInput; - - Map toJson() => - _$Variables$Mutation$RemoveSshKeyToJson(this); int get hashCode { final l$sshInput = sshInput; return Object.hashAll([l$sshInput]); } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Variables$Mutation$RemoveSshKey) || - runtimeType != other.runtimeType) return false; - final l$sshInput = sshInput; - final lOther$sshInput = other.sshInput; - if (l$sshInput != lOther$sshInput) return false; - return true; - } - - CopyWith$Variables$Mutation$RemoveSshKey - get copyWith => CopyWith$Variables$Mutation$RemoveSshKey(this, (i) => i); } abstract class CopyWith$Variables$Mutation$RemoveSshKey { factory CopyWith$Variables$Mutation$RemoveSshKey( - Variables$Mutation$RemoveSshKey instance, - TRes Function(Variables$Mutation$RemoveSshKey) then) = - _CopyWithImpl$Variables$Mutation$RemoveSshKey; + Variables$Mutation$RemoveSshKey instance, + TRes Function(Variables$Mutation$RemoveSshKey) then, + ) = _CopyWithImpl$Variables$Mutation$RemoveSshKey; factory CopyWith$Variables$Mutation$RemoveSshKey.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$RemoveSshKey; @@ -2905,7 +5546,10 @@ abstract class CopyWith$Variables$Mutation$RemoveSshKey { class _CopyWithImpl$Variables$Mutation$RemoveSshKey implements CopyWith$Variables$Mutation$RemoveSshKey { - _CopyWithImpl$Variables$Mutation$RemoveSshKey(this._instance, this._then); + _CopyWithImpl$Variables$Mutation$RemoveSshKey( + this._instance, + this._then, + ); final Variables$Mutation$RemoveSshKey _instance; @@ -2914,10 +5558,11 @@ class _CopyWithImpl$Variables$Mutation$RemoveSshKey static const _undefined = {}; TRes call({Object? sshInput = _undefined}) => - _then(Variables$Mutation$RemoveSshKey( - sshInput: sshInput == _undefined || sshInput == null - ? _instance.sshInput - : (sshInput as Input$SshMutationInput))); + _then(Variables$Mutation$RemoveSshKey._({ + ..._instance._$data, + if (sshInput != _undefined && sshInput != null) + 'sshInput': (sshInput as Input$SshMutationInput), + })); } class _CopyWithStubImpl$Variables$Mutation$RemoveSshKey @@ -2929,63 +5574,97 @@ class _CopyWithStubImpl$Variables$Mutation$RemoveSshKey call({Input$SshMutationInput? sshInput}) => _res; } -@JsonSerializable(explicitToJson: true) class Mutation$RemoveSshKey { - Mutation$RemoveSshKey( - {required this.removeSshKey, required this.$__typename}); + Mutation$RemoveSshKey({ + required this.removeSshKey, + required this.$__typename, + }); - @override - factory Mutation$RemoveSshKey.fromJson(Map json) => - _$Mutation$RemoveSshKeyFromJson(json); + factory Mutation$RemoveSshKey.fromJson(Map json) { + final l$removeSshKey = json['removeSshKey']; + final l$$__typename = json['__typename']; + return Mutation$RemoveSshKey( + removeSshKey: Mutation$RemoveSshKey$removeSshKey.fromJson( + (l$removeSshKey as Map)), + $__typename: (l$$__typename as String), + ); + } final Mutation$RemoveSshKey$removeSshKey removeSshKey; - @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$RemoveSshKeyToJson(this); + Map toJson() { + final _resultData = {}; + final l$removeSshKey = removeSshKey; + _resultData['removeSshKey'] = l$removeSshKey.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override int get hashCode { final l$removeSshKey = removeSshKey; final l$$__typename = $__typename; - return Object.hashAll([l$removeSshKey, l$$__typename]); + return Object.hashAll([ + l$removeSshKey, + l$$__typename, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Mutation$RemoveSshKey) || runtimeType != other.runtimeType) + if (identical(this, other)) { + return true; + } + if (!(other is Mutation$RemoveSshKey) || runtimeType != other.runtimeType) { return false; + } final l$removeSshKey = removeSshKey; final lOther$removeSshKey = other.removeSshKey; - if (l$removeSshKey != lOther$removeSshKey) return false; + if (l$removeSshKey != lOther$removeSshKey) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } return true; } } extension UtilityExtension$Mutation$RemoveSshKey on Mutation$RemoveSshKey { CopyWith$Mutation$RemoveSshKey get copyWith => - CopyWith$Mutation$RemoveSshKey(this, (i) => i); + CopyWith$Mutation$RemoveSshKey( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$RemoveSshKey { - factory CopyWith$Mutation$RemoveSshKey(Mutation$RemoveSshKey instance, - TRes Function(Mutation$RemoveSshKey) then) = - _CopyWithImpl$Mutation$RemoveSshKey; + factory CopyWith$Mutation$RemoveSshKey( + Mutation$RemoveSshKey instance, + TRes Function(Mutation$RemoveSshKey) then, + ) = _CopyWithImpl$Mutation$RemoveSshKey; factory CopyWith$Mutation$RemoveSshKey.stub(TRes res) = _CopyWithStubImpl$Mutation$RemoveSshKey; - TRes call( - {Mutation$RemoveSshKey$removeSshKey? removeSshKey, String? $__typename}); + TRes call({ + Mutation$RemoveSshKey$removeSshKey? removeSshKey, + String? $__typename, + }); CopyWith$Mutation$RemoveSshKey$removeSshKey get removeSshKey; } class _CopyWithImpl$Mutation$RemoveSshKey implements CopyWith$Mutation$RemoveSshKey { - _CopyWithImpl$Mutation$RemoveSshKey(this._instance, this._then); + _CopyWithImpl$Mutation$RemoveSshKey( + this._instance, + this._then, + ); final Mutation$RemoveSshKey _instance; @@ -2993,16 +5672,18 @@ class _CopyWithImpl$Mutation$RemoveSshKey static const _undefined = {}; - TRes call( - {Object? removeSshKey = _undefined, - Object? $__typename = _undefined}) => + TRes call({ + Object? removeSshKey = _undefined, + Object? $__typename = _undefined, + }) => _then(Mutation$RemoveSshKey( - removeSshKey: removeSshKey == _undefined || removeSshKey == null - ? _instance.removeSshKey - : (removeSshKey as Mutation$RemoveSshKey$removeSshKey), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); + removeSshKey: removeSshKey == _undefined || removeSshKey == null + ? _instance.removeSshKey + : (removeSshKey as Mutation$RemoveSshKey$removeSshKey), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); CopyWith$Mutation$RemoveSshKey$removeSshKey get removeSshKey { final local$removeSshKey = _instance.removeSshKey; return CopyWith$Mutation$RemoveSshKey$removeSshKey( @@ -3016,9 +5697,10 @@ class _CopyWithStubImpl$Mutation$RemoveSshKey TRes _res; - call( - {Mutation$RemoveSshKey$removeSshKey? removeSshKey, - String? $__typename}) => + call({ + Mutation$RemoveSshKey$removeSshKey? removeSshKey, + String? $__typename, + }) => _res; CopyWith$Mutation$RemoveSshKey$removeSshKey get removeSshKey => CopyWith$Mutation$RemoveSshKey$removeSshKey.stub(_res); @@ -3026,60 +5708,73 @@ class _CopyWithStubImpl$Mutation$RemoveSshKey const documentNodeMutationRemoveSshKey = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'RemoveSshKey'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'sshInput')), - type: NamedTypeNode( - name: NameNode(value: 'SshMutationInput'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'removeSshKey'), + type: OperationType.mutation, + name: NameNode(value: 'RemoveSshKey'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'sshInput')), + type: NamedTypeNode( + name: NameNode(value: 'SshMutationInput'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'removeSshKey'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'sshInput'), + value: VariableNode(name: NameNode(value: 'sshInput')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: [], + ), + FieldNode( + name: NameNode(value: 'user'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'sshInput'), - value: VariableNode(name: NameNode(value: 'sshInput'))) - ], + arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), + name: NameNode(value: 'userFields'), + directives: [], + ), FieldNode( - name: NameNode(value: 'user'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'userFields'), directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), fragmentDefinitionbasicMutationReturnFields, fragmentDefinitionuserFields, ]); @@ -3087,41 +5782,43 @@ Mutation$RemoveSshKey _parserFn$Mutation$RemoveSshKey( Map data) => Mutation$RemoveSshKey.fromJson(data); typedef OnMutationCompleted$Mutation$RemoveSshKey = FutureOr Function( - dynamic, Mutation$RemoveSshKey?); + dynamic, + Mutation$RemoveSshKey?, +); class Options$Mutation$RemoveSshKey extends graphql.MutationOptions { - Options$Mutation$RemoveSshKey( - {String? operationName, - required Variables$Mutation$RemoveSshKey variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - OnMutationCompleted$Mutation$RemoveSshKey? onCompleted, - graphql.OnMutationUpdate? update, - graphql.OnError? onError}) - : onCompletedWithParsed = onCompleted, + Options$Mutation$RemoveSshKey({ + String? operationName, + required Variables$Mutation$RemoveSshKey variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$RemoveSshKey? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( data, - data == null - ? null - : _parserFn$Mutation$RemoveSshKey(data)), - update: update, - onError: onError, - document: documentNodeMutationRemoveSshKey, - parserFn: _parserFn$Mutation$RemoveSshKey); + data == null ? null : _parserFn$Mutation$RemoveSshKey(data), + ), + update: update, + onError: onError, + document: documentNodeMutationRemoveSshKey, + parserFn: _parserFn$Mutation$RemoveSshKey, + ); final OnMutationCompleted$Mutation$RemoveSshKey? onCompletedWithParsed; @@ -3130,38 +5827,39 @@ class Options$Mutation$RemoveSshKey ...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed + onCompletedWithParsed, ]; } class WatchOptions$Mutation$RemoveSshKey extends graphql.WatchQueryOptions { - WatchOptions$Mutation$RemoveSshKey( - {String? operationName, - required Variables$Mutation$RemoveSshKey variables, - graphql.FetchPolicy? fetchPolicy, - graphql.ErrorPolicy? errorPolicy, - graphql.CacheRereadPolicy? cacheRereadPolicy, - Object? optimisticResult, - graphql.Context? context, - Duration? pollInterval, - bool? eagerlyFetchResults, - bool carryForwardDataOnException = true, - bool fetchResults = false}) - : super( - variables: variables.toJson(), - operationName: operationName, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, - context: context, - document: documentNodeMutationRemoveSshKey, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Mutation$RemoveSshKey); + WatchOptions$Mutation$RemoveSshKey({ + String? operationName, + required Variables$Mutation$RemoveSshKey variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationRemoveSshKey, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$RemoveSshKey, + ); } extension ClientExtension$Mutation$RemoveSshKey on graphql.GraphQLClient { @@ -3173,20 +5871,33 @@ extension ClientExtension$Mutation$RemoveSshKey on graphql.GraphQLClient { this.watchMutation(options); } -@JsonSerializable(explicitToJson: true) class Mutation$RemoveSshKey$removeSshKey - implements Fragment$basicMutationReturnFields { - Mutation$RemoveSshKey$removeSshKey( - {required this.code, - required this.message, - required this.success, - required this.$__typename, - this.user}); + implements Fragment$basicMutationReturnFields$$UserMutationReturn { + Mutation$RemoveSshKey$removeSshKey({ + required this.code, + required this.message, + required this.success, + required this.$__typename, + this.user, + }); - @override factory Mutation$RemoveSshKey$removeSshKey.fromJson( - Map json) => - _$Mutation$RemoveSshKey$removeSshKeyFromJson(json); + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + final l$user = json['user']; + return Mutation$RemoveSshKey$removeSshKey( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + user: l$user == null + ? null + : Fragment$userFields.fromJson((l$user as Map)), + ); + } final int code; @@ -3194,43 +5905,75 @@ class Mutation$RemoveSshKey$removeSshKey final bool success; - @JsonKey(name: '__typename') final String $__typename; final Fragment$userFields? user; - Map toJson() => - _$Mutation$RemoveSshKey$removeSshKeyToJson(this); + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + final l$user = user; + _resultData['user'] = l$user?.toJson(); + return _resultData; + } + + @override int get hashCode { final l$code = code; final l$message = message; final l$success = success; final l$$__typename = $__typename; final l$user = user; - return Object.hashAll( - [l$code, l$message, l$success, l$$__typename, l$user]); + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + l$user, + ]); } @override bool operator ==(Object other) { - if (identical(this, other)) return true; + if (identical(this, other)) { + return true; + } if (!(other is Mutation$RemoveSshKey$removeSshKey) || - runtimeType != other.runtimeType) return false; + runtimeType != other.runtimeType) { + return false; + } final l$code = code; final lOther$code = other.code; - if (l$code != lOther$code) return false; + if (l$code != lOther$code) { + return false; + } final l$message = message; final lOther$message = other.message; - if (l$message != lOther$message) return false; + if (l$message != lOther$message) { + return false; + } final l$success = success; final lOther$success = other.success; - if (l$success != lOther$success) return false; + if (l$success != lOther$success) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; + if (l$$__typename != lOther$$__typename) { + return false; + } final l$user = user; final lOther$user = other.user; - if (l$user != lOther$user) return false; + if (l$user != lOther$user) { + return false; + } return true; } } @@ -3239,31 +5982,37 @@ extension UtilityExtension$Mutation$RemoveSshKey$removeSshKey on Mutation$RemoveSshKey$removeSshKey { CopyWith$Mutation$RemoveSshKey$removeSshKey< Mutation$RemoveSshKey$removeSshKey> - get copyWith => - CopyWith$Mutation$RemoveSshKey$removeSshKey(this, (i) => i); + get copyWith => CopyWith$Mutation$RemoveSshKey$removeSshKey( + this, + (i) => i, + ); } abstract class CopyWith$Mutation$RemoveSshKey$removeSshKey { factory CopyWith$Mutation$RemoveSshKey$removeSshKey( - Mutation$RemoveSshKey$removeSshKey instance, - TRes Function(Mutation$RemoveSshKey$removeSshKey) then) = - _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey; + Mutation$RemoveSshKey$removeSshKey instance, + TRes Function(Mutation$RemoveSshKey$removeSshKey) then, + ) = _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey; factory CopyWith$Mutation$RemoveSshKey$removeSshKey.stub(TRes res) = _CopyWithStubImpl$Mutation$RemoveSshKey$removeSshKey; - TRes call( - {int? code, - String? message, - bool? success, - String? $__typename, - Fragment$userFields? user}); + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + Fragment$userFields? user, + }); CopyWith$Fragment$userFields get user; } class _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey implements CopyWith$Mutation$RemoveSshKey$removeSshKey { - _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey(this._instance, this._then); + _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey( + this._instance, + this._then, + ); final Mutation$RemoveSshKey$removeSshKey _instance; @@ -3271,28 +6020,29 @@ class _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey static const _undefined = {}; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined, - Object? user = _undefined}) => + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + Object? user = _undefined, + }) => _then(Mutation$RemoveSshKey$removeSshKey( - code: code == _undefined || code == null - ? _instance.code - : (code as int), - message: message == _undefined || message == null - ? _instance.message - : (message as String), - success: success == _undefined || success == null - ? _instance.success - : (success as bool), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String), - user: user == _undefined - ? _instance.user - : (user as Fragment$userFields?))); + code: + code == _undefined || code == null ? _instance.code : (code as int), + message: message == _undefined || message == null + ? _instance.message + : (message as String), + success: success == _undefined || success == null + ? _instance.success + : (success as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + user: user == _undefined + ? _instance.user + : (user as Fragment$userFields?), + )); CopyWith$Fragment$userFields get user { final local$user = _instance.user; return local$user == null @@ -3307,12 +6057,13 @@ class _CopyWithStubImpl$Mutation$RemoveSshKey$removeSshKey TRes _res; - call( - {int? code, - String? message, - bool? success, - String? $__typename, - Fragment$userFields? user}) => + call({ + int? code, + String? message, + bool? success, + String? $__typename, + Fragment$userFields? user, + }) => _res; CopyWith$Fragment$userFields get user => CopyWith$Fragment$userFields.stub(_res); diff --git a/lib/logic/api_maps/graphql_maps/schema/users.graphql.g.dart b/lib/logic/api_maps/graphql_maps/schema/users.graphql.g.dart deleted file mode 100644 index 7fb93e4e..00000000 --- a/lib/logic/api_maps/graphql_maps/schema/users.graphql.g.dart +++ /dev/null @@ -1,366 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'users.graphql.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -Fragment$basicMutationReturnFields _$Fragment$basicMutationReturnFieldsFromJson( - Map json) => - Fragment$basicMutationReturnFields( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Fragment$basicMutationReturnFieldsToJson( - Fragment$basicMutationReturnFields instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - }; - -Fragment$userFields _$Fragment$userFieldsFromJson(Map json) => - Fragment$userFields( - username: json['username'] as String, - userType: $enumDecode(_$Enum$UserTypeEnumMap, json['userType'], - unknownValue: Enum$UserType.$unknown), - sshKeys: - (json['sshKeys'] as List).map((e) => e as String).toList(), - $__typename: json['__typename'] as String, - ); - -Map _$Fragment$userFieldsToJson( - Fragment$userFields instance) => - { - 'username': instance.username, - 'userType': _$Enum$UserTypeEnumMap[instance.userType]!, - 'sshKeys': instance.sshKeys, - '__typename': instance.$__typename, - }; - -const _$Enum$UserTypeEnumMap = { - Enum$UserType.NORMAL: 'NORMAL', - Enum$UserType.PRIMARY: 'PRIMARY', - Enum$UserType.ROOT: 'ROOT', - Enum$UserType.$unknown: r'$unknown', -}; - -Query$AllUsers _$Query$AllUsersFromJson(Map json) => - Query$AllUsers( - users: - Query$AllUsers$users.fromJson(json['users'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Query$AllUsersToJson(Query$AllUsers instance) => - { - 'users': instance.users.toJson(), - '__typename': instance.$__typename, - }; - -Query$AllUsers$users _$Query$AllUsers$usersFromJson( - Map json) => - Query$AllUsers$users( - allUsers: (json['allUsers'] as List) - .map((e) => Fragment$userFields.fromJson(e as Map)) - .toList(), - rootUser: json['rootUser'] == null - ? null - : Fragment$userFields.fromJson( - json['rootUser'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Query$AllUsers$usersToJson( - Query$AllUsers$users instance) => - { - 'allUsers': instance.allUsers.map((e) => e.toJson()).toList(), - 'rootUser': instance.rootUser?.toJson(), - '__typename': instance.$__typename, - }; - -Variables$Query$GetUser _$Variables$Query$GetUserFromJson( - Map json) => - Variables$Query$GetUser( - username: json['username'] as String, - ); - -Map _$Variables$Query$GetUserToJson( - Variables$Query$GetUser instance) => - { - 'username': instance.username, - }; - -Query$GetUser _$Query$GetUserFromJson(Map json) => - Query$GetUser( - users: - Query$GetUser$users.fromJson(json['users'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Query$GetUserToJson(Query$GetUser instance) => - { - 'users': instance.users.toJson(), - '__typename': instance.$__typename, - }; - -Query$GetUser$users _$Query$GetUser$usersFromJson(Map json) => - Query$GetUser$users( - getUser: json['getUser'] == null - ? null - : Fragment$userFields.fromJson( - json['getUser'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Query$GetUser$usersToJson( - Query$GetUser$users instance) => - { - 'getUser': instance.getUser?.toJson(), - '__typename': instance.$__typename, - }; - -Variables$Mutation$CreateUser _$Variables$Mutation$CreateUserFromJson( - Map json) => - Variables$Mutation$CreateUser( - user: Input$UserMutationInput.fromJson( - json['user'] as Map), - ); - -Map _$Variables$Mutation$CreateUserToJson( - Variables$Mutation$CreateUser instance) => - { - 'user': instance.user.toJson(), - }; - -Mutation$CreateUser _$Mutation$CreateUserFromJson(Map json) => - Mutation$CreateUser( - createUser: Mutation$CreateUser$createUser.fromJson( - json['createUser'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$CreateUserToJson( - Mutation$CreateUser instance) => - { - 'createUser': instance.createUser.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$CreateUser$createUser _$Mutation$CreateUser$createUserFromJson( - Map json) => - Mutation$CreateUser$createUser( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - user: json['user'] == null - ? null - : Fragment$userFields.fromJson(json['user'] as Map), - ); - -Map _$Mutation$CreateUser$createUserToJson( - Mutation$CreateUser$createUser instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - 'user': instance.user?.toJson(), - }; - -Variables$Mutation$DeleteUser _$Variables$Mutation$DeleteUserFromJson( - Map json) => - Variables$Mutation$DeleteUser( - username: json['username'] as String, - ); - -Map _$Variables$Mutation$DeleteUserToJson( - Variables$Mutation$DeleteUser instance) => - { - 'username': instance.username, - }; - -Mutation$DeleteUser _$Mutation$DeleteUserFromJson(Map json) => - Mutation$DeleteUser( - deleteUser: Mutation$DeleteUser$deleteUser.fromJson( - json['deleteUser'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$DeleteUserToJson( - Mutation$DeleteUser instance) => - { - 'deleteUser': instance.deleteUser.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$DeleteUser$deleteUser _$Mutation$DeleteUser$deleteUserFromJson( - Map json) => - Mutation$DeleteUser$deleteUser( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$DeleteUser$deleteUserToJson( - Mutation$DeleteUser$deleteUser instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - }; - -Variables$Mutation$UpdateUser _$Variables$Mutation$UpdateUserFromJson( - Map json) => - Variables$Mutation$UpdateUser( - user: Input$UserMutationInput.fromJson( - json['user'] as Map), - ); - -Map _$Variables$Mutation$UpdateUserToJson( - Variables$Mutation$UpdateUser instance) => - { - 'user': instance.user.toJson(), - }; - -Mutation$UpdateUser _$Mutation$UpdateUserFromJson(Map json) => - Mutation$UpdateUser( - updateUser: Mutation$UpdateUser$updateUser.fromJson( - json['updateUser'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$UpdateUserToJson( - Mutation$UpdateUser instance) => - { - 'updateUser': instance.updateUser.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$UpdateUser$updateUser _$Mutation$UpdateUser$updateUserFromJson( - Map json) => - Mutation$UpdateUser$updateUser( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - user: json['user'] == null - ? null - : Fragment$userFields.fromJson(json['user'] as Map), - ); - -Map _$Mutation$UpdateUser$updateUserToJson( - Mutation$UpdateUser$updateUser instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - 'user': instance.user?.toJson(), - }; - -Variables$Mutation$AddSshKey _$Variables$Mutation$AddSshKeyFromJson( - Map json) => - Variables$Mutation$AddSshKey( - sshInput: Input$SshMutationInput.fromJson( - json['sshInput'] as Map), - ); - -Map _$Variables$Mutation$AddSshKeyToJson( - Variables$Mutation$AddSshKey instance) => - { - 'sshInput': instance.sshInput.toJson(), - }; - -Mutation$AddSshKey _$Mutation$AddSshKeyFromJson(Map json) => - Mutation$AddSshKey( - addSshKey: Mutation$AddSshKey$addSshKey.fromJson( - json['addSshKey'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$AddSshKeyToJson(Mutation$AddSshKey instance) => - { - 'addSshKey': instance.addSshKey.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$AddSshKey$addSshKey _$Mutation$AddSshKey$addSshKeyFromJson( - Map json) => - Mutation$AddSshKey$addSshKey( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - user: json['user'] == null - ? null - : Fragment$userFields.fromJson(json['user'] as Map), - ); - -Map _$Mutation$AddSshKey$addSshKeyToJson( - Mutation$AddSshKey$addSshKey instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - 'user': instance.user?.toJson(), - }; - -Variables$Mutation$RemoveSshKey _$Variables$Mutation$RemoveSshKeyFromJson( - Map json) => - Variables$Mutation$RemoveSshKey( - sshInput: Input$SshMutationInput.fromJson( - json['sshInput'] as Map), - ); - -Map _$Variables$Mutation$RemoveSshKeyToJson( - Variables$Mutation$RemoveSshKey instance) => - { - 'sshInput': instance.sshInput.toJson(), - }; - -Mutation$RemoveSshKey _$Mutation$RemoveSshKeyFromJson( - Map json) => - Mutation$RemoveSshKey( - removeSshKey: Mutation$RemoveSshKey$removeSshKey.fromJson( - json['removeSshKey'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$RemoveSshKeyToJson( - Mutation$RemoveSshKey instance) => - { - 'removeSshKey': instance.removeSshKey.toJson(), - '__typename': instance.$__typename, - }; - -Mutation$RemoveSshKey$removeSshKey _$Mutation$RemoveSshKey$removeSshKeyFromJson( - Map json) => - Mutation$RemoveSshKey$removeSshKey( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - user: json['user'] == null - ? null - : Fragment$userFields.fromJson(json['user'] as Map), - ); - -Map _$Mutation$RemoveSshKey$removeSshKeyToJson( - Mutation$RemoveSshKey$removeSshKey instance) => - { - 'code': instance.code, - 'message': instance.message, - 'success': instance.success, - '__typename': instance.$__typename, - 'user': instance.user?.toJson(), - }; diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean.dart index 438e92bf..60039365 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean.dart @@ -343,7 +343,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { base64.encode(utf8.encode(rootUser.password ?? 'PASS')); final String formattedHostname = getHostnameFromDomain(domainName); - const String infectBranch = 'providers/digital-ocean'; + const String infectBranch = 'testing/digital-ocean'; final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false'; final String dnsProviderType = dnsProviderToInfectName(dnsProvider); From efe4f620ee36315f17ac31928e2c999d5a2baa50 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 7 Feb 2023 20:51:15 +0400 Subject: [PATCH 19/96] chore: Transfer some methords from api to provider --- .../server_installation_cubit.dart | 18 ++++++++---------- lib/logic/providers/server_provider.dart | 7 +++++++ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index e6ad9be1..d6928e40 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -113,22 +113,21 @@ class ServerInstallationCubit extends Cubit { } Future> fetchAvailableLocations() async { - if (ApiController.currentServerProviderApiFactory == null) { + if (ProvidersController.currentServerProvider == null) { return []; } - final APIGenericResult apiResult = await ApiController - .currentServerProviderApiFactory! - .getServerProvider() + final APIGenericResult apiResponse = await ProvidersController + .currentServerProvider! .getAvailableLocations(); - if (!apiResult.success) { + if (!apiResponse.success) { getIt().showSnackBar( 'initializing.could_not_connect'.tr(), ); } - return apiResult.data; + return apiResponse.data; } Future> fetchAvailableTypesByLocation( @@ -138,10 +137,9 @@ class ServerInstallationCubit extends Cubit { return []; } - final APIGenericResult apiResult = await ApiController - .currentServerProviderApiFactory! - .getServerProvider() - .getServerTypesByLocation(location: location); + final APIGenericResult apiResult = await ProvidersController + .currentServerProvider! + .getServerTypes(location: location); if (!apiResult.success) { getIt().showSnackBar( diff --git a/lib/logic/providers/server_provider.dart b/lib/logic/providers/server_provider.dart index 15475715..aca7f477 100644 --- a/lib/logic/providers/server_provider.dart +++ b/lib/logic/providers/server_provider.dart @@ -1,5 +1,12 @@ import 'package:selfprivacy/logic/api_maps/api_generic_result.dart'; +import 'package:selfprivacy/logic/models/server_provider_location.dart'; +import 'package:selfprivacy/logic/models/server_type.dart'; abstract class ServerProvider { Future> isApiTokenValid(final String apiToken); + Future>> + getAvailableLocations(); + Future>> getServerTypes({ + required final ServerProviderLocation location, + }); } From bad692656797cc962385d2ed815054835555a98d Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 13 Feb 2023 18:13:32 +0400 Subject: [PATCH 20/96] chore: Continue refactoring - Rename APIGenericResult to GenericResult - Wrap all provider functions results with GenericResult - Move basic server commands and getters to business logic layer from API on Hetzner --- ...eneric_result.dart => generic_result.dart} | 4 +- .../graphql_maps/server_api/jobs_api.dart | 6 +- .../graphql_maps/server_api/server_api.dart | 68 +-- .../graphql_maps/server_api/services_api.dart | 36 +- .../graphql_maps/server_api/users_api.dart | 30 +- .../graphql_maps/server_api/volume_api.dart | 8 +- lib/logic/api_maps/rest_maps/backblaze.dart | 10 +- .../dns_providers/cloudflare/cloudflare.dart | 18 +- .../digital_ocean_dns/digital_ocean_dns.dart | 18 +- .../rest_maps/dns_providers/dns_provider.dart | 10 +- .../digital_ocean/digital_ocean_api.dart | 50 +-- .../server_providers/hetzner/hetzner_api.dart | 315 ++++---------- .../server_providers/server_provider.dart | 45 +- .../server_providers/volume_provider.dart | 19 +- lib/logic/cubit/devices/devices_cubit.dart | 7 +- .../initializing/backblaze_form_cubit.dart | 4 +- .../recovery_key/recovery_key_cubit.dart | 4 +- .../server_installation_cubit.dart | 27 +- .../server_installation_repository.dart | 25 +- lib/logic/cubit/users/users_cubit.dart | 10 +- lib/logic/models/server_metadata.dart | 4 +- lib/logic/providers/server_provider.dart | 14 +- .../providers/server_providers/hetzner.dart | 389 +++++++++++++++++- lib/ui/pages/server_details/text_details.dart | 2 +- 24 files changed, 634 insertions(+), 489 deletions(-) rename lib/logic/api_maps/{api_generic_result.dart => generic_result.dart} (85%) diff --git a/lib/logic/api_maps/api_generic_result.dart b/lib/logic/api_maps/generic_result.dart similarity index 85% rename from lib/logic/api_maps/api_generic_result.dart rename to lib/logic/api_maps/generic_result.dart index 81e1760a..5ce31561 100644 --- a/lib/logic/api_maps/api_generic_result.dart +++ b/lib/logic/api_maps/generic_result.dart @@ -1,5 +1,5 @@ -class APIGenericResult { - APIGenericResult({ +class GenericResult { + GenericResult({ required this.success, required this.data, this.message, diff --git a/lib/logic/api_maps/graphql_maps/server_api/jobs_api.dart b/lib/logic/api_maps/graphql_maps/server_api/jobs_api.dart index c14aa98d..03bfd1b3 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/jobs_api.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/jobs_api.dart @@ -22,13 +22,13 @@ mixin JobsApi on ApiMap { return jobsList; } - Future> removeApiJob(final String uid) async { + Future> removeApiJob(final String uid) async { try { final GraphQLClient client = await getClient(); final variables = Variables$Mutation$RemoveJob(jobId: uid); final mutation = Options$Mutation$RemoveJob(variables: variables); final response = await client.mutate$RemoveJob(mutation); - return APIGenericResult( + return GenericResult( data: response.parsedData?.removeJob.success ?? false, success: true, code: response.parsedData?.removeJob.code ?? 0, @@ -36,7 +36,7 @@ mixin JobsApi on ApiMap { ); } catch (e) { print(e); - return APIGenericResult( + return GenericResult( data: false, success: false, code: 0, diff --git a/lib/logic/api_maps/graphql_maps/server_api/server_api.dart b/lib/logic/api_maps/graphql_maps/server_api/server_api.dart index 9f863b1f..966b17bd 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/server_api.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/server_api.dart @@ -1,6 +1,6 @@ import 'package:graphql/client.dart'; import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/api_generic_result.dart'; +import 'package:selfprivacy/logic/api_maps/generic_result.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/api_map.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/schema.graphql.dart'; @@ -24,7 +24,7 @@ import 'package:selfprivacy/logic/models/service.dart'; import 'package:selfprivacy/logic/models/ssh_settings.dart'; import 'package:selfprivacy/logic/models/system_settings.dart'; -export 'package:selfprivacy/logic/api_maps/api_generic_result.dart'; +export 'package:selfprivacy/logic/api_maps/generic_result.dart'; part 'jobs_api.dart'; part 'server_actions_api.dart'; @@ -205,7 +205,7 @@ class ServerApi extends ApiMap return settings; } - Future> getRecoveryTokenStatus() async { + Future> getRecoveryTokenStatus() async { RecoveryKeyStatus? key; QueryResult response; String? error; @@ -222,18 +222,18 @@ class ServerApi extends ApiMap print(e); } - return APIGenericResult( + return GenericResult( success: error == null, data: key, message: error, ); } - Future> generateRecoveryToken( + Future> generateRecoveryToken( final DateTime? expirationDate, final int? numberOfUses, ) async { - APIGenericResult key; + GenericResult key; QueryResult response; try { @@ -254,19 +254,19 @@ class ServerApi extends ApiMap ); if (response.hasException) { print(response.exception.toString()); - key = APIGenericResult( + key = GenericResult( success: false, data: '', message: response.exception.toString(), ); } - key = APIGenericResult( + key = GenericResult( success: true, data: response.parsedData!.getNewRecoveryApiKey.key!, ); } catch (e) { print(e); - key = APIGenericResult( + key = GenericResult( success: false, data: '', message: e.toString(), @@ -299,8 +299,8 @@ class ServerApi extends ApiMap return records; } - Future>> getApiTokens() async { - APIGenericResult> tokens; + Future>> getApiTokens() async { + GenericResult> tokens; QueryResult response; try { @@ -309,7 +309,7 @@ class ServerApi extends ApiMap if (response.hasException) { final message = response.exception.toString(); print(message); - tokens = APIGenericResult>( + tokens = GenericResult>( success: false, data: [], message: message, @@ -323,13 +323,13 @@ class ServerApi extends ApiMap ApiToken.fromGraphQL(device), ) .toList(); - tokens = APIGenericResult>( + tokens = GenericResult>( success: true, data: parsed, ); } catch (e) { print(e); - tokens = APIGenericResult>( + tokens = GenericResult>( success: false, data: [], message: e.toString(), @@ -339,8 +339,8 @@ class ServerApi extends ApiMap return tokens; } - Future> deleteApiToken(final String name) async { - APIGenericResult returnable; + Future> deleteApiToken(final String name) async { + GenericResult returnable; QueryResult response; try { @@ -357,19 +357,19 @@ class ServerApi extends ApiMap ); if (response.hasException) { print(response.exception.toString()); - returnable = APIGenericResult( + returnable = GenericResult( success: false, data: null, message: response.exception.toString(), ); } - returnable = APIGenericResult( + returnable = GenericResult( success: true, data: null, ); } catch (e) { print(e); - returnable = APIGenericResult( + returnable = GenericResult( success: false, data: null, message: e.toString(), @@ -379,8 +379,8 @@ class ServerApi extends ApiMap return returnable; } - Future> createDeviceToken() async { - APIGenericResult token; + Future> createDeviceToken() async { + GenericResult token; QueryResult response; try { @@ -392,19 +392,19 @@ class ServerApi extends ApiMap ); if (response.hasException) { print(response.exception.toString()); - token = APIGenericResult( + token = GenericResult( success: false, data: '', message: response.exception.toString(), ); } - token = APIGenericResult( + token = GenericResult( success: true, data: response.parsedData!.getNewDeviceApiKey.key!, ); } catch (e) { print(e); - token = APIGenericResult( + token = GenericResult( success: false, data: '', message: e.toString(), @@ -416,10 +416,10 @@ class ServerApi extends ApiMap Future isHttpServerWorking() async => (await getApiVersion()) != null; - Future> authorizeDevice( + Future> authorizeDevice( final DeviceToken deviceToken, ) async { - APIGenericResult token; + GenericResult token; QueryResult response; try { @@ -441,19 +441,19 @@ class ServerApi extends ApiMap ); if (response.hasException) { print(response.exception.toString()); - token = APIGenericResult( + token = GenericResult( success: false, data: '', message: response.exception.toString(), ); } - token = APIGenericResult( + token = GenericResult( success: true, data: response.parsedData!.authorizeWithNewDeviceApiKey.token!, ); } catch (e) { print(e); - token = APIGenericResult( + token = GenericResult( success: false, data: '', message: e.toString(), @@ -463,10 +463,10 @@ class ServerApi extends ApiMap return token; } - Future> useRecoveryToken( + Future> useRecoveryToken( final DeviceToken deviceToken, ) async { - APIGenericResult token; + GenericResult token; QueryResult response; try { @@ -488,19 +488,19 @@ class ServerApi extends ApiMap ); if (response.hasException) { print(response.exception.toString()); - token = APIGenericResult( + token = GenericResult( success: false, data: '', message: response.exception.toString(), ); } - token = APIGenericResult( + token = GenericResult( success: true, data: response.parsedData!.useRecoveryApiKey.token!, ); } catch (e) { print(e); - token = APIGenericResult( + token = GenericResult( success: false, data: '', message: e.toString(), diff --git a/lib/logic/api_maps/graphql_maps/server_api/services_api.dart b/lib/logic/api_maps/graphql_maps/server_api/services_api.dart index adfe806f..9d39f137 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/services_api.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/services_api.dart @@ -20,7 +20,7 @@ mixin ServicesApi on ApiMap { return services; } - Future> enableService( + Future> enableService( final String serviceId, ) async { try { @@ -28,7 +28,7 @@ mixin ServicesApi on ApiMap { final variables = Variables$Mutation$EnableService(serviceId: serviceId); final mutation = Options$Mutation$EnableService(variables: variables); final response = await client.mutate$EnableService(mutation); - return APIGenericResult( + return GenericResult( data: response.parsedData?.enableService.success ?? false, success: true, code: response.parsedData?.enableService.code ?? 0, @@ -36,7 +36,7 @@ mixin ServicesApi on ApiMap { ); } catch (e) { print(e); - return APIGenericResult( + return GenericResult( data: false, success: false, code: 0, @@ -45,7 +45,7 @@ mixin ServicesApi on ApiMap { } } - Future> disableService( + Future> disableService( final String serviceId, ) async { try { @@ -53,7 +53,7 @@ mixin ServicesApi on ApiMap { final variables = Variables$Mutation$DisableService(serviceId: serviceId); final mutation = Options$Mutation$DisableService(variables: variables); final response = await client.mutate$DisableService(mutation); - return APIGenericResult( + return GenericResult( data: null, success: response.parsedData?.disableService.success ?? false, code: response.parsedData?.disableService.code ?? 0, @@ -61,7 +61,7 @@ mixin ServicesApi on ApiMap { ); } catch (e) { print(e); - return APIGenericResult( + return GenericResult( data: null, success: false, code: 0, @@ -70,7 +70,7 @@ mixin ServicesApi on ApiMap { } } - Future> stopService( + Future> stopService( final String serviceId, ) async { try { @@ -78,7 +78,7 @@ mixin ServicesApi on ApiMap { final variables = Variables$Mutation$StopService(serviceId: serviceId); final mutation = Options$Mutation$StopService(variables: variables); final response = await client.mutate$StopService(mutation); - return APIGenericResult( + return GenericResult( data: response.parsedData?.stopService.success ?? false, success: true, code: response.parsedData?.stopService.code ?? 0, @@ -86,7 +86,7 @@ mixin ServicesApi on ApiMap { ); } catch (e) { print(e); - return APIGenericResult( + return GenericResult( data: false, success: false, code: 0, @@ -95,13 +95,13 @@ mixin ServicesApi on ApiMap { } } - Future startService(final String serviceId) async { + Future startService(final String serviceId) async { try { final GraphQLClient client = await getClient(); final variables = Variables$Mutation$StartService(serviceId: serviceId); final mutation = Options$Mutation$StartService(variables: variables); final response = await client.mutate$StartService(mutation); - return APIGenericResult( + return GenericResult( data: null, success: response.parsedData?.startService.success ?? false, code: response.parsedData?.startService.code ?? 0, @@ -109,7 +109,7 @@ mixin ServicesApi on ApiMap { ); } catch (e) { print(e); - return APIGenericResult( + return GenericResult( data: null, success: false, code: 0, @@ -118,7 +118,7 @@ mixin ServicesApi on ApiMap { } } - Future> restartService( + Future> restartService( final String serviceId, ) async { try { @@ -126,7 +126,7 @@ mixin ServicesApi on ApiMap { final variables = Variables$Mutation$RestartService(serviceId: serviceId); final mutation = Options$Mutation$RestartService(variables: variables); final response = await client.mutate$RestartService(mutation); - return APIGenericResult( + return GenericResult( data: response.parsedData?.restartService.success ?? false, success: true, code: response.parsedData?.restartService.code ?? 0, @@ -134,7 +134,7 @@ mixin ServicesApi on ApiMap { ); } catch (e) { print(e); - return APIGenericResult( + return GenericResult( data: false, success: false, code: 0, @@ -143,7 +143,7 @@ mixin ServicesApi on ApiMap { } } - Future> moveService( + Future> moveService( final String serviceId, final String destination, ) async { @@ -158,7 +158,7 @@ mixin ServicesApi on ApiMap { final mutation = Options$Mutation$MoveService(variables: variables); final response = await client.mutate$MoveService(mutation); final jobJson = response.parsedData?.moveService.job?.toJson(); - return APIGenericResult( + return GenericResult( success: true, code: response.parsedData?.moveService.code ?? 0, message: response.parsedData?.moveService.message, @@ -166,7 +166,7 @@ mixin ServicesApi on ApiMap { ); } catch (e) { print(e); - return APIGenericResult( + return GenericResult( success: false, code: 0, message: e.toString(), diff --git a/lib/logic/api_maps/graphql_maps/server_api/users_api.dart b/lib/logic/api_maps/graphql_maps/server_api/users_api.dart index f1851353..cca78798 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/users_api.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/users_api.dart @@ -45,7 +45,7 @@ mixin UsersApi on ApiMap { return user; } - Future> createUser( + Future> createUser( final String username, final String password, ) async { @@ -56,7 +56,7 @@ mixin UsersApi on ApiMap { ); final mutation = Options$Mutation$CreateUser(variables: variables); final response = await client.mutate$CreateUser(mutation); - return APIGenericResult( + return GenericResult( success: true, code: response.parsedData?.createUser.code ?? 500, message: response.parsedData?.createUser.message, @@ -66,7 +66,7 @@ mixin UsersApi on ApiMap { ); } catch (e) { print(e); - return APIGenericResult( + return GenericResult( success: false, code: 0, message: e.toString(), @@ -75,7 +75,7 @@ mixin UsersApi on ApiMap { } } - Future> deleteUser( + Future> deleteUser( final String username, ) async { try { @@ -83,7 +83,7 @@ mixin UsersApi on ApiMap { final variables = Variables$Mutation$DeleteUser(username: username); final mutation = Options$Mutation$DeleteUser(variables: variables); final response = await client.mutate$DeleteUser(mutation); - return APIGenericResult( + return GenericResult( data: response.parsedData?.deleteUser.success ?? false, success: true, code: response.parsedData?.deleteUser.code ?? 500, @@ -91,7 +91,7 @@ mixin UsersApi on ApiMap { ); } catch (e) { print(e); - return APIGenericResult( + return GenericResult( data: false, success: false, code: 500, @@ -100,7 +100,7 @@ mixin UsersApi on ApiMap { } } - Future> updateUser( + Future> updateUser( final String username, final String password, ) async { @@ -111,7 +111,7 @@ mixin UsersApi on ApiMap { ); final mutation = Options$Mutation$UpdateUser(variables: variables); final response = await client.mutate$UpdateUser(mutation); - return APIGenericResult( + return GenericResult( success: true, code: response.parsedData?.updateUser.code ?? 500, message: response.parsedData?.updateUser.message, @@ -121,7 +121,7 @@ mixin UsersApi on ApiMap { ); } catch (e) { print(e); - return APIGenericResult( + return GenericResult( data: null, success: false, code: 0, @@ -130,7 +130,7 @@ mixin UsersApi on ApiMap { } } - Future> addSshKey( + Future> addSshKey( final String username, final String sshKey, ) async { @@ -144,7 +144,7 @@ mixin UsersApi on ApiMap { ); final mutation = Options$Mutation$AddSshKey(variables: variables); final response = await client.mutate$AddSshKey(mutation); - return APIGenericResult( + return GenericResult( success: true, code: response.parsedData?.addSshKey.code ?? 500, message: response.parsedData?.addSshKey.message, @@ -154,7 +154,7 @@ mixin UsersApi on ApiMap { ); } catch (e) { print(e); - return APIGenericResult( + return GenericResult( data: null, success: false, code: 0, @@ -163,7 +163,7 @@ mixin UsersApi on ApiMap { } } - Future> removeSshKey( + Future> removeSshKey( final String username, final String sshKey, ) async { @@ -177,7 +177,7 @@ mixin UsersApi on ApiMap { ); final mutation = Options$Mutation$RemoveSshKey(variables: variables); final response = await client.mutate$RemoveSshKey(mutation); - return APIGenericResult( + return GenericResult( success: response.parsedData?.removeSshKey.success ?? false, code: response.parsedData?.removeSshKey.code ?? 500, message: response.parsedData?.removeSshKey.message, @@ -187,7 +187,7 @@ mixin UsersApi on ApiMap { ); } catch (e) { print(e); - return APIGenericResult( + return GenericResult( data: null, success: false, code: 0, diff --git a/lib/logic/api_maps/graphql_maps/server_api/volume_api.dart b/lib/logic/api_maps/graphql_maps/server_api/volume_api.dart index e830cabd..3459e6f9 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/volume_api.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/volume_api.dart @@ -57,10 +57,10 @@ mixin VolumeApi on ApiMap { } } - Future> migrateToBinds( + Future> migrateToBinds( final Map serviceToDisk, ) async { - APIGenericResult? mutation; + GenericResult? mutation; try { final GraphQLClient client = await getClient(); @@ -78,7 +78,7 @@ mixin VolumeApi on ApiMap { await client.mutate$MigrateToBinds( migrateMutation, ); - mutation = mutation = APIGenericResult( + mutation = mutation = GenericResult( success: true, code: result.parsedData!.migrateToBinds.code, message: result.parsedData!.migrateToBinds.message, @@ -86,7 +86,7 @@ mixin VolumeApi on ApiMap { ); } catch (e) { print(e); - mutation = APIGenericResult( + mutation = GenericResult( success: false, code: 0, message: e.toString(), diff --git a/lib/logic/api_maps/rest_maps/backblaze.dart b/lib/logic/api_maps/rest_maps/backblaze.dart index 8ea94803..6fe5cd8e 100644 --- a/lib/logic/api_maps/rest_maps/backblaze.dart +++ b/lib/logic/api_maps/rest_maps/backblaze.dart @@ -2,11 +2,11 @@ import 'dart:io'; import 'package:dio/dio.dart'; import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/api_generic_result.dart'; +import 'package:selfprivacy/logic/api_maps/generic_result.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; import 'package:selfprivacy/logic/models/hive/backblaze_credential.dart'; -export 'package:selfprivacy/logic/api_maps/api_generic_result.dart'; +export 'package:selfprivacy/logic/api_maps/generic_result.dart'; class BackblazeApiAuth { BackblazeApiAuth({required this.authorizationToken, required this.apiUrl}); @@ -74,7 +74,7 @@ class BackblazeApi extends ApiMap { ); } - Future> isApiTokenValid( + Future> isApiTokenValid( final String encodedApiKey, ) async { final Dio client = await getClient(); @@ -99,7 +99,7 @@ class BackblazeApi extends ApiMap { } } on DioError catch (e) { print(e); - return APIGenericResult( + return GenericResult( data: false, success: false, message: e.toString(), @@ -108,7 +108,7 @@ class BackblazeApi extends ApiMap { close(client); } - return APIGenericResult( + return GenericResult( data: isTokenValid, success: true, ); diff --git a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart index 1da08c40..d9ac5c6c 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart @@ -46,7 +46,7 @@ class CloudflareApi extends DnsProviderApi { String rootAddress = 'https://api.cloudflare.com/client/v4'; @override - Future> isApiTokenValid(final String token) async { + Future> isApiTokenValid(final String token) async { bool isValid = false; Response? response; String message = ''; @@ -70,7 +70,7 @@ class CloudflareApi extends DnsProviderApi { } if (response == null) { - return APIGenericResult( + return GenericResult( data: isValid, success: false, message: message, @@ -85,7 +85,7 @@ class CloudflareApi extends DnsProviderApi { throw Exception('code: ${response.statusCode}'); } - return APIGenericResult( + return GenericResult( data: isValid, success: true, message: response.statusMessage, @@ -113,7 +113,7 @@ class CloudflareApi extends DnsProviderApi { } @override - Future> removeSimilarRecords({ + Future> removeSimilarRecords({ required final ServerDomain domain, final String? ip4, }) async { @@ -139,7 +139,7 @@ class CloudflareApi extends DnsProviderApi { await Future.wait(allDeleteFutures); } catch (e) { print(e); - return APIGenericResult( + return GenericResult( success: false, data: null, message: e.toString(), @@ -148,7 +148,7 @@ class CloudflareApi extends DnsProviderApi { close(client); } - return APIGenericResult(success: true, data: null); + return GenericResult(success: true, data: null); } @override @@ -272,7 +272,7 @@ class CloudflareApi extends DnsProviderApi { } @override - Future> createMultipleDnsRecords({ + Future> createMultipleDnsRecords({ required final ServerDomain domain, final String? ip4, }) async { @@ -298,7 +298,7 @@ class CloudflareApi extends DnsProviderApi { rethrow; } catch (e) { print(e); - return APIGenericResult( + return GenericResult( success: false, data: null, message: e.toString(), @@ -307,7 +307,7 @@ class CloudflareApi extends DnsProviderApi { close(client); } - return APIGenericResult(success: true, data: null); + return GenericResult(success: true, data: null); } @override diff --git a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart index b5b33f98..fd2b2e02 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart @@ -46,7 +46,7 @@ class DigitalOceanDnsApi extends DnsProviderApi { String rootAddress = 'https://api.digitalocean.com/v2'; @override - Future> isApiTokenValid(final String token) async { + Future> isApiTokenValid(final String token) async { bool isValid = false; Response? response; String message = ''; @@ -70,7 +70,7 @@ class DigitalOceanDnsApi extends DnsProviderApi { } if (response == null) { - return APIGenericResult( + return GenericResult( data: isValid, success: false, message: message, @@ -85,7 +85,7 @@ class DigitalOceanDnsApi extends DnsProviderApi { throw Exception('code: ${response.statusCode}'); } - return APIGenericResult( + return GenericResult( data: isValid, success: true, message: response.statusMessage, @@ -97,7 +97,7 @@ class DigitalOceanDnsApi extends DnsProviderApi { Future getZoneId(final String domain) async => domain; @override - Future> removeSimilarRecords({ + Future> removeSimilarRecords({ required final ServerDomain domain, final String? ip4, }) async { @@ -118,7 +118,7 @@ class DigitalOceanDnsApi extends DnsProviderApi { await Future.wait(allDeleteFutures); } catch (e) { print(e); - return APIGenericResult( + return GenericResult( success: false, data: null, message: e.toString(), @@ -127,7 +127,7 @@ class DigitalOceanDnsApi extends DnsProviderApi { close(client); } - return APIGenericResult(success: true, data: null); + return GenericResult(success: true, data: null); } @override @@ -262,7 +262,7 @@ class DigitalOceanDnsApi extends DnsProviderApi { } @override - Future> createMultipleDnsRecords({ + Future> createMultipleDnsRecords({ required final ServerDomain domain, final String? ip4, }) async { @@ -292,7 +292,7 @@ class DigitalOceanDnsApi extends DnsProviderApi { rethrow; } catch (e) { print(e); - return APIGenericResult( + return GenericResult( success: false, data: null, message: e.toString(), @@ -301,7 +301,7 @@ class DigitalOceanDnsApi extends DnsProviderApi { close(client); } - return APIGenericResult(success: true, data: null); + return GenericResult(success: true, data: null); } @override diff --git a/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart b/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart index 0d010242..299928b0 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart @@ -1,10 +1,10 @@ -import 'package:selfprivacy/logic/api_maps/api_generic_result.dart'; +import 'package:selfprivacy/logic/api_maps/generic_result.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desired_dns_record.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; -export 'package:selfprivacy/logic/api_maps/api_generic_result.dart'; +export 'package:selfprivacy/logic/api_maps/generic_result.dart'; export 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desired_dns_record.dart'; class DomainNotFoundException implements Exception { @@ -21,11 +21,11 @@ abstract class DnsProviderApi extends ApiMap { final String? ipAddress, final String? dkimPublicKey, }); - Future> removeSimilarRecords({ + Future> removeSimilarRecords({ required final ServerDomain domain, final String? ip4, }); - Future> createMultipleDnsRecords({ + Future> createMultipleDnsRecords({ required final ServerDomain domain, final String? ip4, }); @@ -36,7 +36,7 @@ abstract class DnsProviderApi extends ApiMap { Future getZoneId(final String domain); Future> domainList(); - Future> isApiTokenValid(final String token); + Future> isApiTokenValid(final String token); RegExp getApiTokenValidation(); List getProjectDnsRecords( diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart index 540b39c5..3d05d4db 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart @@ -60,7 +60,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { String get displayProviderName => 'Digital Ocean'; @override - Future> isApiTokenValid(final String token) async { + Future> isApiTokenValid(final String token) async { bool isValid = false; Response? response; String message = ''; @@ -84,7 +84,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { } if (response == null) { - return APIGenericResult( + return GenericResult( data: isValid, success: false, message: message, @@ -99,7 +99,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { throw Exception('code: ${response.statusCode}'); } - return APIGenericResult( + return GenericResult( data: isValid, success: true, message: response.statusMessage, @@ -115,7 +115,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { ); @override - Future> createVolume() async { + Future> createVolume() async { ServerVolume? volume; Response? createVolumeResponse; @@ -147,7 +147,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { ); } catch (e) { print(e); - return APIGenericResult( + return GenericResult( data: null, success: false, message: e.toString(), @@ -156,7 +156,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { client.close(); } - return APIGenericResult( + return GenericResult( data: volume, success: true, code: createVolumeResponse.statusCode, @@ -230,7 +230,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { } @override - Future> attachVolume( + Future> attachVolume( final ServerVolume volume, final int serverId, ) async { @@ -252,7 +252,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { attachVolumeResponse.data['action']['status'].toString() != 'error'; } catch (e) { print(e); - return APIGenericResult( + return GenericResult( data: false, success: false, message: e.toString(), @@ -261,7 +261,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { close(client); } - return APIGenericResult( + return GenericResult( data: success, success: true, code: attachVolumeResponse.statusCode, @@ -327,7 +327,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { } @override - Future> createServer({ + Future> createServer({ required final String dnsApiToken, required final User rootUser, required final String domainName, @@ -399,7 +399,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { } } catch (e) { print(e); - return APIGenericResult( + return GenericResult( success: false, data: null, message: e.toString(), @@ -408,7 +408,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { close(client); } - return APIGenericResult( + return GenericResult( data: serverDetails, success: true, code: serverCreateResponse.statusCode, @@ -417,7 +417,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { } @override - Future> deleteServer({ + Future> deleteServer({ required final String domainName, }) async { final Dio client = await getClient(); @@ -431,7 +431,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { ); } catch (e) { print(e); - return APIGenericResult( + return GenericResult( data: false, success: false, message: e.toString(), @@ -446,7 +446,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { ); } catch (e) { print(e); - return APIGenericResult( + return GenericResult( data: false, success: false, message: e.toString(), @@ -464,7 +464,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { await Future.wait(laterFutures); } catch (e) { print(e); - return APIGenericResult( + return GenericResult( success: false, data: false, message: e.toString(), @@ -473,7 +473,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { close(client); } - return APIGenericResult( + return GenericResult( success: true, data: true, ); @@ -762,7 +762,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { } @override - Future>> + Future>> getAvailableLocations() async { List locations = []; @@ -784,7 +784,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { .toList(); } catch (e) { print(e); - return APIGenericResult( + return GenericResult( data: [], success: false, message: e.toString(), @@ -793,11 +793,11 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { close(client); } - return APIGenericResult(data: locations, success: true); + return GenericResult(data: locations, success: true); } @override - Future>> getServerTypesByLocation({ + Future>> getAvailableServerTypes({ required final ServerProviderLocation location, }) async { final List types = []; @@ -830,7 +830,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { } } catch (e) { print(e); - return APIGenericResult( + return GenericResult( data: [], success: false, message: e.toString(), @@ -839,17 +839,17 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { close(client); } - return APIGenericResult(data: types, success: true); + return GenericResult(data: types, success: true); } @override - Future> createReverseDns({ + Future> createReverseDns({ required final ServerHostingDetails serverDetails, required final ServerDomain domain, }) async { /// TODO remove from provider interface const bool success = true; - return APIGenericResult(success: success, data: null); + return GenericResult(success: success, data: null); } @override diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart index cfd9eb40..f43fc050 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart @@ -17,7 +17,6 @@ import 'package:selfprivacy/logic/models/price.dart'; import 'package:selfprivacy/logic/models/server_basic_info.dart'; import 'package:selfprivacy/logic/models/server_metadata.dart'; import 'package:selfprivacy/logic/models/server_provider_location.dart'; -import 'package:selfprivacy/logic/models/server_type.dart'; import 'package:selfprivacy/utils/extensions/string_extensions.dart'; import 'package:selfprivacy/utils/network_utils.dart'; import 'package:selfprivacy/utils/password_generator.dart'; @@ -60,8 +59,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { @override String get displayProviderName => 'Hetzner'; - @override - Future> isApiTokenValid(final String token) async { + Future> isApiTokenValid(final String token) async { bool isValid = false; Response? response; String message = ''; @@ -85,7 +83,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { } if (response == null) { - return APIGenericResult( + return GenericResult( data: isValid, success: false, message: message, @@ -100,21 +98,19 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { throw Exception('code: ${response.statusCode}'); } - return APIGenericResult( + return GenericResult( data: isValid, success: true, message: response.statusMessage, ); } - @override ProviderApiTokenValidation getApiTokenValidation() => ProviderApiTokenValidation( regexp: RegExp(r'\s+|[-!$%^&*()@+|~=`{}\[\]:<>?,.\/]'), length: 64, ); - @override Future getPricePerGb() async { double? price; @@ -140,8 +136,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { ); } - @override - Future> createVolume() async { + Future> createVolume() async { ServerVolume? volume; Response? createVolumeResponse; @@ -172,7 +167,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { ); } catch (e) { print(e); - return APIGenericResult( + return GenericResult( data: null, success: false, message: e.toString(), @@ -181,7 +176,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { client.close(); } - return APIGenericResult( + return GenericResult( data: volume, success: true, code: createVolumeResponse.statusCode, @@ -189,7 +184,6 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { ); } - @override Future> getVolumes({final String? status}) async { final List volumes = []; @@ -257,7 +251,6 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { return volume; } - @override Future deleteVolume(final ServerVolume volume) async { final Dio client = await getClient(); try { @@ -269,8 +262,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { } } - @override - Future> attachVolume( + Future> attachVolume( final ServerVolume volume, final int serverId, ) async { @@ -294,7 +286,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { client.close(); } - return APIGenericResult( + return GenericResult( data: success, success: true, code: attachVolumeResponse?.statusCode, @@ -302,7 +294,6 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { ); } - @override Future detachVolume(final ServerVolume volume) async { bool success = false; @@ -323,7 +314,6 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { return success; } - @override Future resizeVolume( final ServerVolume volume, final DiskSize size, @@ -350,19 +340,17 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { return success; } - @override - Future> createServer({ + Future> createServer({ required final String dnsApiToken, required final User rootUser, required final String domainName, required final String serverType, required final DnsProviderType dnsProvider, }) async { - final APIGenericResult newVolumeResponse = - await createVolume(); + final GenericResult newVolumeResponse = await createVolume(); if (!newVolumeResponse.success || newVolumeResponse.data == null) { - return APIGenericResult( + return GenericResult( data: null, success: false, message: newVolumeResponse.message, @@ -379,7 +367,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { ); } - Future> createServerWithVolume({ + Future> createServerWithVolume({ required final String dnsApiToken, required final User rootUser, required final String domainName, @@ -457,7 +445,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { apiResultMessage = 'uniqueness_error'; } - return APIGenericResult( + return GenericResult( data: serverDetails, success: success && hetznerError == null, code: serverCreateResponse?.statusCode ?? @@ -466,8 +454,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { ); } - @override - Future> deleteServer({ + Future> deleteServer({ required final String domainName, }) async { final Dio client = await getClient(); @@ -494,7 +481,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { await Future.wait(laterFutures); } catch (e) { print(e); - return APIGenericResult( + return GenericResult( success: false, data: false, message: e.toString(), @@ -503,45 +490,55 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { close(client); } - return APIGenericResult( + return GenericResult( success: true, data: true, ); } - @override - Future restart() async { - final ServerHostingDetails server = getIt().serverDetails!; - + Future> restart(final int serverId) async { final Dio client = await getClient(); try { - await client.post('/servers/${server.id}/actions/reset'); + await client.post('/servers/$serverId/actions/reset'); } catch (e) { print(e); + return GenericResult( + success: false, + data: null, + message: e.toString(), + ); } finally { close(client); } - return server.copyWith(startTime: DateTime.now()); + return GenericResult( + success: true, + data: null, + ); } - @override - Future powerOn() async { - final ServerHostingDetails server = getIt().serverDetails!; - + Future> powerOn(final int serverId) async { final Dio client = await getClient(); try { - await client.post('/servers/${server.id}/actions/poweron'); + await client.post('/servers/$serverId/actions/poweron'); } catch (e) { print(e); + return GenericResult( + success: false, + data: null, + message: e.toString(), + ); } finally { close(client); } - return server.copyWith(startTime: DateTime.now()); + return GenericResult( + success: true, + data: null, + ); } - Future> requestRawMetrics( + Future>> getMetrics( final int serverId, final DateTime start, final DateTime end, @@ -562,127 +559,20 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { metrics = res.data['metrics']; } catch (e) { print(e); + return GenericResult( + success: false, + data: {}, + message: e.toString(), + ); } finally { close(client); } - return metrics; + return GenericResult(data: metrics, success: true); } - List serializeTimeSeries( - final Map json, - final String type, - ) { - final List list = json['time_series'][type]['values']; - return list - .map((final el) => TimeSeriesData(el[0], double.parse(el[1]))) - .toList(); - } - - @override - Future getMetrics( - final int serverId, - final DateTime start, - final DateTime end, - ) async { - ServerMetrics? metrics; - - final Map rawCpuMetrics = await requestRawMetrics( - serverId, - start, - end, - 'cpu', - ); - final Map rawNetworkMetrics = await requestRawMetrics( - serverId, - start, - end, - 'network', - ); - - if (rawNetworkMetrics.isEmpty || rawCpuMetrics.isEmpty) { - return metrics; - } - - metrics = ServerMetrics( - cpu: serializeTimeSeries( - rawCpuMetrics, - 'cpu', - ), - bandwidthIn: serializeTimeSeries( - rawNetworkMetrics, - 'network.0.bandwidth.in', - ), - bandwidthOut: serializeTimeSeries( - rawNetworkMetrics, - 'network.0.bandwidth.out', - ), - end: end, - start: start, - stepsInSecond: rawCpuMetrics['step'], - ); - - return metrics; - } - - @override - Future> getMetadata(final int serverId) async { - List metadata = []; - - final Dio client = await getClient(); - try { - final Response response = await client.get('/servers/$serverId'); - final hetznerInfo = HetznerServerInfo.fromJson(response.data!['server']); - metadata = [ - ServerMetadataEntity( - type: MetadataType.id, - name: 'server.server_id'.tr(), - value: hetznerInfo.id.toString(), - ), - ServerMetadataEntity( - type: MetadataType.status, - name: 'server.status'.tr(), - value: hetznerInfo.status.toString().split('.')[1].capitalize(), - ), - ServerMetadataEntity( - type: MetadataType.cpu, - name: 'server.cpu'.tr(), - value: 'server.core_count'.plural(hetznerInfo.serverType.cores), - ), - ServerMetadataEntity( - type: MetadataType.ram, - name: 'server.ram'.tr(), - value: '${hetznerInfo.serverType.memory.toString()} GB', - ), - ServerMetadataEntity( - type: MetadataType.cost, - name: 'server.monthly_cost'.tr(), - value: hetznerInfo.serverType.prices[1].monthly.toStringAsFixed(2), - ), - ServerMetadataEntity( - type: MetadataType.location, - name: 'server.location'.tr(), - value: - '${hetznerInfo.location.city}, ${hetznerInfo.location.country}', - ), - ServerMetadataEntity( - type: MetadataType.other, - name: 'server.provider'.tr(), - value: displayProviderName, - ), - ]; - } catch (e) { - print(e); - } finally { - close(client); - } - - return metadata; - } - - @override - Future> getServers() async { - List servers = []; + Future>> getServers() async { + List servers = []; final Dio client = await getClient(); try { @@ -691,53 +581,22 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { .map( (final e) => HetznerServerInfo.fromJson(e), ) - .toList() - .where( - (final server) => server.publicNet.ipv4 != null, - ) - .map( - (final server) => ServerBasicInfo( - id: server.id, - name: server.name, - ip: server.publicNet.ipv4.ip, - reverseDns: server.publicNet.ipv4.reverseDns, - created: server.created, - ), - ) .toList(); } catch (e) { print(e); + return GenericResult( + success: false, + data: [], + message: e.toString(), + ); } finally { close(client); } - print(servers); - return servers; + return GenericResult(data: servers, success: true); } - String? getEmojiFlag(final String query) { - String? emoji; - - switch (query.toLowerCase()) { - case 'de': - emoji = '🇩🇪'; - break; - - case 'fi': - emoji = '🇫🇮'; - break; - - case 'us': - emoji = '🇺🇸'; - break; - } - - return emoji; - } - - @override - Future>> - getAvailableLocations() async { + Future> getAvailableLocations() async { List locations = []; final Dio client = await getClient(); @@ -746,19 +605,10 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { '/locations', ); - locations = response.data!['locations'] - .map( - (final location) => ServerProviderLocation( - title: location['city'], - description: location['description'], - flag: getEmojiFlag(location['country']), - identifier: location['name'], - ), - ) - .toList(); + locations = response.data!['locations']; } catch (e) { print(e); - return APIGenericResult( + return GenericResult( success: false, data: [], message: e.toString(), @@ -767,44 +617,21 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { close(client); } - return APIGenericResult(success: true, data: locations); + return GenericResult(success: true, data: locations); } - @override - Future>> getServerTypesByLocation({ - required final ServerProviderLocation location, - }) async { - final List types = []; + Future> getAvailableServerTypes() async { + List types = []; final Dio client = await getClient(); try { final Response response = await client.get( '/server_types', ); - final rawTypes = response.data!['server_types']; - for (final rawType in rawTypes) { - for (final rawPrice in rawType['prices']) { - if (rawPrice['location'].toString() == location.identifier) { - types.add( - ServerType( - title: rawType['description'], - identifier: rawType['name'], - ram: rawType['memory'], - cores: rawType['cores'], - disk: DiskSize(byte: rawType['disk'] * 1024 * 1024 * 1024), - price: Price( - value: double.parse(rawPrice['price_monthly']['gross']), - currency: 'EUR', - ), - location: location, - ), - ); - } - } - } + types = response.data!['server_types']; } catch (e) { print(e); - return APIGenericResult( + return GenericResult( data: [], success: false, message: e.toString(), @@ -813,26 +640,26 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { close(client); } - return APIGenericResult(data: types, success: true); + return GenericResult(data: types, success: true); } - @override - Future> createReverseDns({ - required final ServerHostingDetails serverDetails, - required final ServerDomain domain, + Future> createReverseDns({ + required final int serverId, + required final String ip4, + required final String dnsPtr, }) async { final Dio client = await getClient(); try { await client.post( - '/servers/${serverDetails.id}/actions/change_dns_ptr', + '/servers/$serverId/actions/change_dns_ptr', data: { - 'ip': serverDetails.ip4, - 'dns_ptr': domain.domainName, + 'ip': ip4, + 'dns_ptr': dnsPtr, }, ); } catch (e) { print(e); - return APIGenericResult( + return GenericResult( success: false, data: null, message: e.toString(), @@ -841,6 +668,6 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { close(client); } - return APIGenericResult(success: true, data: null); + return GenericResult(success: true, data: null); } } diff --git a/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart b/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart index 99516535..99c6b1ac 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart @@ -1,15 +1,6 @@ -import 'package:selfprivacy/logic/api_maps/api_generic_result.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; -import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; -import 'package:selfprivacy/logic/models/hive/user.dart'; -import 'package:selfprivacy/logic/models/metrics.dart'; -import 'package:selfprivacy/logic/models/server_basic_info.dart'; -import 'package:selfprivacy/logic/models/server_metadata.dart'; -import 'package:selfprivacy/logic/models/server_provider_location.dart'; -import 'package:selfprivacy/logic/models/server_type.dart'; - -export 'package:selfprivacy/logic/api_maps/api_generic_result.dart'; +export 'package:selfprivacy/logic/api_maps/generic_result.dart'; class ProviderApiTokenValidation { ProviderApiTokenValidation({ @@ -21,40 +12,6 @@ class ProviderApiTokenValidation { } abstract class ServerProviderApi extends ApiMap { - Future> getServers(); - Future>> - getAvailableLocations(); - Future>> getServerTypesByLocation({ - required final ServerProviderLocation location, - }); - - Future restart(); - Future powerOn(); - - Future> deleteServer({ - required final String domainName, - }); - Future> createServer({ - required final String dnsApiToken, - required final User rootUser, - required final String domainName, - required final String serverType, - required final DnsProviderType dnsProvider, - }); - Future> createReverseDns({ - required final ServerHostingDetails serverDetails, - required final ServerDomain domain, - }); - - Future> isApiTokenValid(final String token); - ProviderApiTokenValidation getApiTokenValidation(); - Future> getMetadata(final int serverId); - Future getMetrics( - final int serverId, - final DateTime start, - final DateTime end, - ); - String dnsProviderToInfectName(final DnsProviderType dnsProvider) { String dnsProviderType; switch (dnsProvider) { diff --git a/lib/logic/api_maps/rest_maps/server_providers/volume_provider.dart b/lib/logic/api_maps/rest_maps/server_providers/volume_provider.dart index 5e01d268..5ddacd6d 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/volume_provider.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/volume_provider.dart @@ -1,20 +1,5 @@ -import 'package:selfprivacy/logic/api_maps/api_generic_result.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; -import 'package:selfprivacy/logic/models/disk_size.dart'; -import 'package:selfprivacy/logic/models/hive/server_details.dart'; -import 'package:selfprivacy/logic/models/price.dart'; -export 'package:selfprivacy/logic/api_maps/api_generic_result.dart'; +export 'package:selfprivacy/logic/api_maps/generic_result.dart'; -mixin VolumeProviderApi on ApiMap { - Future> createVolume(); - Future> getVolumes({final String? status}); - Future> attachVolume( - final ServerVolume volume, - final int serverId, - ); - Future detachVolume(final ServerVolume volume); - Future resizeVolume(final ServerVolume volume, final DiskSize size); - Future deleteVolume(final ServerVolume volume); - Future getPricePerGb(); -} +mixin VolumeProviderApi on ApiMap {} diff --git a/lib/logic/cubit/devices/devices_cubit.dart b/lib/logic/cubit/devices/devices_cubit.dart index 5e5c145c..10ad943d 100644 --- a/lib/logic/cubit/devices/devices_cubit.dart +++ b/lib/logic/cubit/devices/devices_cubit.dart @@ -35,7 +35,7 @@ class ApiDevicesCubit } Future?> _getApiTokens() async { - final APIGenericResult> response = await api.getApiTokens(); + final GenericResult> response = await api.getApiTokens(); if (response.success) { return response.data; } else { @@ -44,8 +44,7 @@ class ApiDevicesCubit } Future deleteDevice(final ApiToken device) async { - final APIGenericResult response = - await api.deleteApiToken(device.name); + final GenericResult response = await api.deleteApiToken(device.name); if (response.success) { emit( ApiDevicesState( @@ -60,7 +59,7 @@ class ApiDevicesCubit } Future getNewDeviceKey() async { - final APIGenericResult response = await api.createDeviceToken(); + final GenericResult response = await api.createDeviceToken(); if (response.success) { return response.data; } else { diff --git a/lib/logic/cubit/forms/setup/initializing/backblaze_form_cubit.dart b/lib/logic/cubit/forms/setup/initializing/backblaze_form_cubit.dart index 21d17a84..af20a8aa 100644 --- a/lib/logic/cubit/forms/setup/initializing/backblaze_form_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/backblaze_form_cubit.dart @@ -40,7 +40,7 @@ class BackblazeFormCubit extends FormCubit { @override FutureOr asyncValidation() async { - late APIGenericResult backblazeResponse; + late GenericResult backblazeResponse; final BackblazeApi apiClient = BackblazeApi(isWithToken: false); try { @@ -51,7 +51,7 @@ class BackblazeFormCubit extends FormCubit { backblazeResponse = await apiClient.isApiTokenValid(encodedApiKey); } catch (e) { addError(e); - backblazeResponse = APIGenericResult( + backblazeResponse = GenericResult( success: false, data: false, message: e.toString(), diff --git a/lib/logic/cubit/recovery_key/recovery_key_cubit.dart b/lib/logic/cubit/recovery_key/recovery_key_cubit.dart index 56800be3..76a572d1 100644 --- a/lib/logic/cubit/recovery_key/recovery_key_cubit.dart +++ b/lib/logic/cubit/recovery_key/recovery_key_cubit.dart @@ -32,7 +32,7 @@ class RecoveryKeyCubit } Future _getRecoveryKeyStatus() async { - final APIGenericResult response = + final GenericResult response = await api.getRecoveryTokenStatus(); if (response.success) { return response.data; @@ -57,7 +57,7 @@ class RecoveryKeyCubit final DateTime? expirationDate, final int? numberOfUses, }) async { - final APIGenericResult response = + final GenericResult response = await api.generateRecoveryToken(expirationDate, numberOfUses); if (response.success) { refresh(); diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index d6928e40..17d90764 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -77,8 +77,8 @@ class ServerInstallationCubit extends Cubit { Future isServerProviderApiTokenValid( final String providerToken, ) async { - final APIGenericResult apiResponse = - await ProvidersController.currentServerProvider!.isApiTokenValid( + final GenericResult apiResponse = + await ProvidersController.currentServerProvider!.tryInitApiByToken( providerToken, ); @@ -95,7 +95,7 @@ class ServerInstallationCubit extends Cubit { Future isDnsProviderApiTokenValid( final String providerToken, ) async { - final APIGenericResult apiResponse = + final GenericResult apiResponse = await ApiController.currentDnsProviderApiFactory! .getDnsProvider( settings: const DnsProviderApiSettings(isWithToken: false), @@ -117,7 +117,7 @@ class ServerInstallationCubit extends Cubit { return []; } - final APIGenericResult apiResponse = await ProvidersController + final GenericResult apiResponse = await ProvidersController .currentServerProvider! .getAvailableLocations(); @@ -137,7 +137,7 @@ class ServerInstallationCubit extends Cubit { return []; } - final APIGenericResult apiResult = await ProvidersController + final GenericResult apiResult = await ProvidersController .currentServerProvider! .getServerTypes(location: location); @@ -173,21 +173,8 @@ class ServerInstallationCubit extends Cubit { void setServerType(final ServerType serverType) async { await repository.saveServerType(serverType); - ApiController.initServerProviderApiFactory( - ServerProviderSettings( - provider: getIt().serverProvider!, - location: serverType.location.identifier, - ), - ); - - // All server providers support volumes for now, - // so it's safe to initialize. - ApiController.initVolumeProviderApiFactory( - ServerProviderSettings( - provider: getIt().serverProvider!, - location: serverType.location.identifier, - ), - ); + await ProvidersController.currentServerProvider! + .trySetServerType(serverType); emit( (state as ServerInstallationNotFinished).copyWith( diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 50eb7998..d60b2119 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -259,7 +259,7 @@ class ServerInstallationRepository { actionButtonOnPressed: () async { ServerHostingDetails? serverDetails; try { - final APIGenericResult createResult = await api.createServer( + final GenericResult createResult = await api.createServer( dnsProvider: getIt().dnsProvider!, dnsApiToken: cloudFlareKey, rootUser: rootUser, @@ -283,7 +283,7 @@ class ServerInstallationRepository { } try { - final APIGenericResult createServerResult = + final GenericResult createServerResult = await api.createServer( dnsProvider: getIt().dnsProvider!, dnsApiToken: cloudFlareKey, @@ -309,7 +309,7 @@ class ServerInstallationRepository { ServerHostingDetails? serverDetails; try { - final APIGenericResult createResult = await api.createServer( + final GenericResult createResult = await api.createServer( dnsProvider: getIt().dnsProvider!, dnsApiToken: cloudFlareKey, rootUser: rootUser, @@ -366,7 +366,7 @@ class ServerInstallationRepository { ); } - final APIGenericResult removingResult = + final GenericResult removingResult = await dnsProviderApi.removeSimilarRecords( ip4: serverDetails.ip4, domain: domain, @@ -380,7 +380,7 @@ class ServerInstallationRepository { bool createdSuccessfully = false; String errorMessage = 'domain.error'.tr(); try { - final APIGenericResult createResult = + final GenericResult createResult = await dnsProviderApi.createMultipleDnsRecords( ip4: serverDetails.ip4, domain: domain, @@ -397,8 +397,7 @@ class ServerInstallationRepository { return false; } - final APIGenericResult createReverseResult = - await serverApi.createReverseDns( + final GenericResult createReverseResult = await serverApi.createReverseDns( serverDetails: serverDetails, domain: domain, ); @@ -520,7 +519,7 @@ class ServerInstallationRepository { overrideDomain: serverDomain.domainName, ); final String serverIp = await getServerIpFromDomain(serverDomain); - final APIGenericResult result = await serverApi.authorizeDevice( + final GenericResult result = await serverApi.authorizeDevice( DeviceToken(device: await getDeviceName(), token: newDeviceKey), ); @@ -557,7 +556,7 @@ class ServerInstallationRepository { overrideDomain: serverDomain.domainName, ); final String serverIp = await getServerIpFromDomain(serverDomain); - final APIGenericResult result = await serverApi.useRecoveryToken( + final GenericResult result = await serverApi.useRecoveryToken( DeviceToken(device: await getDeviceName(), token: recoveryKey), ); @@ -618,9 +617,9 @@ class ServerInstallationRepository { ); } } - final APIGenericResult deviceAuthKey = + final GenericResult deviceAuthKey = await serverApi.createDeviceToken(); - final APIGenericResult result = await serverApi.authorizeDevice( + final GenericResult result = await serverApi.authorizeDevice( DeviceToken(device: await getDeviceName(), token: deviceAuthKey.data), ); @@ -771,7 +770,7 @@ class ServerInstallationRepository { } Future deleteServer(final ServerDomain serverDomain) async { - final APIGenericResult deletionResult = await ApiController + final GenericResult deletionResult = await ApiController .currentServerProviderApiFactory! .getServerProvider() .deleteServer( @@ -797,7 +796,7 @@ class ServerInstallationRepository { await box.put(BNames.isLoading, false); await box.put(BNames.serverDetails, null); - final APIGenericResult removalResult = await ApiController + final GenericResult removalResult = await ApiController .currentDnsProviderApiFactory! .getDnsProvider() .removeSimilarRecords(domain: serverDomain); diff --git a/lib/logic/cubit/users/users_cubit.dart b/lib/logic/cubit/users/users_cubit.dart index 001ce8d0..de31cdcd 100644 --- a/lib/logic/cubit/users/users_cubit.dart +++ b/lib/logic/cubit/users/users_cubit.dart @@ -78,7 +78,7 @@ class UsersCubit extends ServerInstallationDependendCubit { return; } // If API returned error, do nothing - final APIGenericResult result = + final GenericResult result = await api.createUser(user.login, password); if (result.data == null) { getIt() @@ -101,7 +101,7 @@ class UsersCubit extends ServerInstallationDependendCubit { return; } final List loadedUsers = List.from(state.users); - final APIGenericResult result = await api.deleteUser(user.login); + final GenericResult result = await api.deleteUser(user.login); if (result.success && result.data) { loadedUsers.removeWhere((final User u) => u.login == user.login); await box.clear(); @@ -128,7 +128,7 @@ class UsersCubit extends ServerInstallationDependendCubit { .showSnackBar('users.could_not_change_password'.tr()); return; } - final APIGenericResult result = + final GenericResult result = await api.updateUser(user.login, newPassword); if (result.data == null) { getIt().showSnackBar( @@ -138,7 +138,7 @@ class UsersCubit extends ServerInstallationDependendCubit { } Future addSshKey(final User user, final String publicKey) async { - final APIGenericResult result = + final GenericResult result = await api.addSshKey(user.login, publicKey); if (result.data != null) { final User updatedUser = result.data!; @@ -157,7 +157,7 @@ class UsersCubit extends ServerInstallationDependendCubit { } Future deleteSshKey(final User user, final String publicKey) async { - final APIGenericResult result = + final GenericResult result = await api.removeSshKey(user.login, publicKey); if (result.data != null) { final User updatedUser = result.data!; diff --git a/lib/logic/models/server_metadata.dart b/lib/logic/models/server_metadata.dart index 0275a2ef..553fcbb5 100644 --- a/lib/logic/models/server_metadata.dart +++ b/lib/logic/models/server_metadata.dart @@ -19,11 +19,11 @@ enum MetadataType { class ServerMetadataEntity { ServerMetadataEntity({ - required this.name, + required this.trId, required this.value, this.type = MetadataType.other, }); final MetadataType type; - final String name; + final String trId; final String value; } diff --git a/lib/logic/providers/server_provider.dart b/lib/logic/providers/server_provider.dart index aca7f477..e5c1c1bf 100644 --- a/lib/logic/providers/server_provider.dart +++ b/lib/logic/providers/server_provider.dart @@ -1,12 +1,16 @@ -import 'package:selfprivacy/logic/api_maps/api_generic_result.dart'; +import 'package:selfprivacy/logic/api_maps/generic_result.dart'; import 'package:selfprivacy/logic/models/server_provider_location.dart'; import 'package:selfprivacy/logic/models/server_type.dart'; +export 'package:selfprivacy/logic/api_maps/generic_result.dart'; + abstract class ServerProvider { - Future> isApiTokenValid(final String apiToken); - Future>> - getAvailableLocations(); - Future>> getServerTypes({ + Future> trySetServerType(final ServerType type); + Future> tryInitApiByToken(final String token); + Future>> getAvailableLocations(); + Future>> getServerTypes({ required final ServerProviderLocation location, }); + + GenericResult get success => GenericResult(success: true, data: true); } diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index 2e4ff1e8..fdc8f11e 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -1,3 +1,390 @@ +import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart'; +import 'package:selfprivacy/logic/models/disk_size.dart'; +import 'package:selfprivacy/logic/models/hive/server_details.dart'; +import 'package:selfprivacy/logic/models/hive/server_domain.dart'; +import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart'; +import 'package:selfprivacy/logic/models/metrics.dart'; +import 'package:selfprivacy/logic/models/price.dart'; +import 'package:selfprivacy/logic/models/server_basic_info.dart'; +import 'package:selfprivacy/logic/models/server_metadata.dart'; +import 'package:selfprivacy/logic/models/server_provider_location.dart'; +import 'package:selfprivacy/logic/models/server_type.dart'; import 'package:selfprivacy/logic/providers/server_provider.dart'; +import 'package:selfprivacy/utils/extensions/string_extensions.dart'; -class HetznerServerProvider extends ServerProvider {} +class ApiAdapter { + ApiAdapter({final String? region, final bool isWithToken = true}) + : _api = HetznerApi( + region: region, + isWithToken: isWithToken, + ); + + HetznerApi api({final bool getInitialized = true}) => getInitialized + ? _api + : HetznerApi( + region: _api.region, + isWithToken: false, + ); + + final HetznerApi _api; +} + +class HetznerServerProvider extends ServerProvider { + HetznerServerProvider() : _adapter = ApiAdapter(); + HetznerServerProvider.load( + final ServerType serverType, + final bool isAuthotized, + ) : _adapter = ApiAdapter( + isWithToken: isAuthotized, + region: serverType.location.identifier, + ); + + ApiAdapter _adapter; + + @override + Future> trySetServerType(final ServerType type) async { + final bool apiInitialized = _adapter.api().isWithToken; + if (!apiInitialized) { + return GenericResult( + success: true, + data: false, + message: 'Not authorized!', + ); + } + + _adapter = ApiAdapter( + isWithToken: true, + region: type.location.identifier, + ); + return success; + } + + @override + Future> tryInitApiByToken(final String token) async { + final api = _adapter.api(getInitialized: false); + final result = await api.isApiTokenValid(token); + if (!result.data || !result.success) { + return result; + } + + _adapter = ApiAdapter(region: api.region, isWithToken: true); + return result; + } + + String? getEmojiFlag(final String query) { + String? emoji; + + switch (query.toLowerCase()) { + case 'de': + emoji = '🇩🇪'; + break; + + case 'fi': + emoji = '🇫🇮'; + break; + + case 'us': + emoji = '🇺🇸'; + break; + } + + return emoji; + } + + @override + Future>> + getAvailableLocations() async { + final List locations = []; + final result = await _adapter.api().getAvailableLocations(); + if (result.data.isEmpty || !result.success) { + return GenericResult( + success: result.success, + data: locations, + code: result.code, + message: result.message, + ); + } + + final List rawLocations = result.data; + for (final rawLocation in rawLocations) { + ServerProviderLocation? location; + try { + location = ServerProviderLocation( + title: rawLocation['city'], + description: rawLocation['description'], + flag: getEmojiFlag(rawLocation['country']), + identifier: rawLocation['name'], + ); + } catch (e) { + continue; + } + locations.add(location); + } + + return GenericResult(success: true, data: locations); + } + + @override + Future>> getServerTypes({ + required final ServerProviderLocation location, + }) async { + final List types = []; + final result = await _adapter.api().getAvailableServerTypes(); + if (result.data.isEmpty || !result.success) { + return GenericResult( + success: result.success, + data: types, + code: result.code, + message: result.message, + ); + } + + final List rawTypes = result.data; + for (final rawType in rawTypes) { + for (final rawPrice in rawType['prices']) { + if (rawPrice['location'].toString() == location.identifier) { + types.add( + ServerType( + title: rawType['description'], + identifier: rawType['name'], + ram: rawType['memory'], + cores: rawType['cores'], + disk: DiskSize(byte: rawType['disk'] * 1024 * 1024 * 1024), + price: Price( + value: double.parse(rawPrice['price_monthly']['gross']), + currency: 'EUR', + ), + location: location, + ), + ); + } + } + } + + return GenericResult(success: true, data: types); + } + + Future> createReverseDns({ + required final ServerHostingDetails serverDetails, + required final ServerDomain domain, + }) async => + _adapter.api().createReverseDns( + serverId: serverDetails.id, + ip4: serverDetails.ip4, + dnsPtr: domain.domainName, + ); + + Future>> getServers() async { + final List servers = []; + final result = await _adapter.api().getServers(); + if (result.data.isEmpty || !result.success) { + return GenericResult( + success: result.success, + data: servers, + code: result.code, + message: result.message, + ); + } + + final List hetznerServers = result.data; + for (final hetznerServer in hetznerServers) { + if (hetznerServer.publicNet.ipv4 == null) { + continue; + } + + ServerBasicInfo? server; + try { + server = ServerBasicInfo( + id: hetznerServer.id, + name: hetznerServer.name, + ip: hetznerServer.publicNet.ipv4!.ip, + reverseDns: hetznerServer.publicNet.ipv4!.reverseDns, + created: hetznerServer.created, + ); + } catch (e) { + continue; + } + + servers.add(server); + } + + return GenericResult(success: true, data: servers); + } + + Future>> getMetadata( + final int serverId, + ) async { + List metadata = []; + final result = await _adapter.api().getServers(); + if (result.data.isEmpty || !result.success) { + return GenericResult( + success: false, + data: metadata, + code: result.code, + message: result.message, + ); + } + + final List servers = result.data; + try { + final HetznerServerInfo server = servers.firstWhere( + (final server) => server.id == serverId, + ); + + metadata = [ + ServerMetadataEntity( + type: MetadataType.id, + trId: 'server.server_id', + value: server.id.toString(), + ), + ServerMetadataEntity( + type: MetadataType.status, + trId: 'server.status', + value: server.status.toString().split('.')[1].capitalize(), + ), + ServerMetadataEntity( + type: MetadataType.cpu, + trId: 'server.cpu', + value: server.serverType.cores.toString(), + ), + ServerMetadataEntity( + type: MetadataType.ram, + trId: 'server.ram', + value: '${server.serverType.memory.toString()} GB', + ), + ServerMetadataEntity( + type: MetadataType.cost, + trId: 'server.monthly_cost', + value: server.serverType.prices[1].monthly.toStringAsFixed(2), + ), + ServerMetadataEntity( + type: MetadataType.location, + trId: 'server.location', + value: '${server.location.city}, ${server.location.country}', + ), + ServerMetadataEntity( + type: MetadataType.other, + trId: 'server.provider', + value: _adapter.api().displayProviderName, + ), + ]; + } catch (e) { + return GenericResult( + success: false, + data: [], + message: e.toString(), + ); + } + + return GenericResult(success: true, data: metadata); + } + + Future> getMetrics( + final int serverId, + final DateTime start, + final DateTime end, + ) async { + ServerMetrics? metrics; + + List serializeTimeSeries( + final Map json, + final String type, + ) { + final List list = json['time_series'][type]['values']; + return list + .map((final el) => TimeSeriesData(el[0], double.parse(el[1]))) + .toList(); + } + + final cpuResult = await _adapter.api().getMetrics( + serverId, + start, + end, + 'cpu', + ); + if (cpuResult.data.isEmpty || !cpuResult.success) { + return GenericResult( + success: false, + data: metrics, + code: cpuResult.code, + message: cpuResult.message, + ); + } + + final netResult = await _adapter.api().getMetrics( + serverId, + start, + end, + 'network', + ); + + if (cpuResult.data.isEmpty || !netResult.success) { + return GenericResult( + success: false, + data: metrics, + code: netResult.code, + message: netResult.message, + ); + } + + metrics = ServerMetrics( + cpu: serializeTimeSeries( + cpuResult.data, + 'cpu', + ), + bandwidthIn: serializeTimeSeries( + netResult.data, + 'network.0.bandwidth.in', + ), + bandwidthOut: serializeTimeSeries( + netResult.data, + 'network.0.bandwidth.out', + ), + end: end, + start: start, + stepsInSecond: cpuResult.data['step'], + ); + + return GenericResult(data: metrics, success: true); + } + + Future> restart(final int serverId) async { + DateTime? timestamp; + final result = await _adapter.api().restart(serverId); + if (!result.success) { + return GenericResult( + success: false, + data: timestamp, + code: result.code, + message: result.message, + ); + } + + timestamp = DateTime.now(); + + return GenericResult( + success: true, + data: timestamp, + ); + } + + Future> powerOn(final int serverId) async { + DateTime? timestamp; + final result = await _adapter.api().powerOn(serverId); + if (!result.success) { + return GenericResult( + success: false, + data: timestamp, + code: result.code, + message: result.message, + ); + } + + timestamp = DateTime.now(); + + return GenericResult( + success: true, + data: timestamp, + ); + } +} diff --git a/lib/ui/pages/server_details/text_details.dart b/lib/ui/pages/server_details/text_details.dart index 5f447901..d8911b8c 100644 --- a/lib/ui/pages/server_details/text_details.dart +++ b/lib/ui/pages/server_details/text_details.dart @@ -27,7 +27,7 @@ class _TextDetails extends StatelessWidget { .map( (final metadata) => ListTileOnSurfaceVariant( leadingIcon: metadata.type.icon, - title: metadata.name, + title: metadata.trId.tr(), subtitle: metadata.value, ), ) From 8da7341ccbae89f21d770fbf6b0d2ecc865c8968 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 21 Feb 2023 13:11:04 +0400 Subject: [PATCH 21/96] chore: Implement basics of hetzner installation logic --- assets/translations/en.json | 3 +- .../server_providers/hetzner/hetzner_api.dart | 89 ++++++--- .../server_installation_cubit.dart | 4 +- .../models/callback_dialogue_branching.dart | 21 ++ .../models/launch_installation_data.dart | 19 ++ lib/logic/providers/server_provider.dart | 2 +- .../providers/server_providers/hetzner.dart | 181 +++++++++++++++++- 7 files changed, 287 insertions(+), 32 deletions(-) create mode 100644 lib/logic/models/callback_dialogue_branching.dart create mode 100644 lib/logic/models/launch_installation_data.dart diff --git a/assets/translations/en.json b/assets/translations/en.json index 6aee165c..ca95a6d0 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -429,6 +429,7 @@ "modals": { "dns_removal_error": "Couldn't remove DNS records.", "server_deletion_error": "Couldn't delete active server.", + "volume_creation_error": "Couldn't create volume.", "server_validators_error": "Couldn't fetch available servers.", "already_exists": "Such server already exists.", "unexpected_error": "Unexpected error during placement from the provider side.", @@ -479,4 +480,4 @@ "length_not_equal": "Length is [], should be {}", "length_longer": "Length is [], should be shorter than or equal to {}" } -} +} \ No newline at end of file diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart index f43fc050..fa244393 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart @@ -340,34 +340,72 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { return success; } - Future> createServer({ + Future createServer({ required final String dnsApiToken, + required final String dnsProviderType, + required final String serverApiToken, required final User rootUser, + required final String base64Password, + required final String databasePassword, required final String domainName, + required final String hostName, + required final int volumeId, required final String serverType, - required final DnsProviderType dnsProvider, }) async { - final GenericResult newVolumeResponse = await createVolume(); + final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false'; - if (!newVolumeResponse.success || newVolumeResponse.data == null) { - return GenericResult( - data: null, - success: false, - message: newVolumeResponse.message, - code: newVolumeResponse.code, - ); + Response? serverCreateResponse; + DioError? hetznerError; + bool success = false; + final Dio client = await getClient(); + try { + final Map data = { + 'name': hostName, + 'server_type': serverType, + 'start_after_create': false, + 'image': 'ubuntu-20.04', + 'volumes': [volumeId], + 'networks': [], + 'user_data': '#cloud-config\n' + 'runcmd:\n' + '- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/providers/hetzner/nixos-infect | ' + "STAGING_ACME='$stagingAcme' PROVIDER=$infectProviderName DNS_PROVIDER_TYPE=$dnsProviderType " + "NIX_CHANNEL=nixos-21.05 DOMAIN='$domainName' LUSER='${rootUser.login}' ENCODED_PASSWORD='$base64Password' " + 'CF_TOKEN=$dnsApiToken DB_PASSWORD=$databasePassword API_TOKEN=$serverApiToken HOSTNAME=$hostName bash 2>&1 | ' + 'tee /tmp/infect.log', + 'labels': {}, + 'automount': true, + 'location': region!, + }; + print('Decoded data: $data'); + + serverCreateResponse = await client.post('/servers', data: data); + success = true; + } on DioError catch (e) { + print(e); + hetznerError = e; + } catch (e) { + print(e); + } finally { + close(client); } - return createServerWithVolume( - dnsApiToken: dnsApiToken, - rootUser: rootUser, - domainName: domainName, - volume: newVolumeResponse.data!, - serverType: serverType, - dnsProvider: dnsProvider, + + String? apiResultMessage = serverCreateResponse?.statusMessage; + if (hetznerError != null && + hetznerError.response!.data['error']['code'] == 'uniqueness_error') { + apiResultMessage = 'uniqueness_error'; + } + + return GenericResult( + data: serverCreateResponse?.data, + success: success && hetznerError == null, + code: serverCreateResponse?.statusCode ?? + hetznerError?.response?.statusCode, + message: apiResultMessage, ); } - Future> createServerWithVolume({ + Future> skldfjalkdsjflkasd({ required final String dnsApiToken, required final User rootUser, required final String domainName, @@ -375,8 +413,6 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { required final String serverType, required final DnsProviderType dnsProvider, }) async { - final Dio client = await getClient(); - final String dbPassword = StringGenerators.dbPassword(); final int volumeId = volume.id; @@ -388,14 +424,11 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { base64.encode(utf8.encode(rootUser.password ?? 'PASS')); final String dnsProviderType = dnsProviderToInfectName(dnsProvider); - final String userdataString = - "#cloud-config\nruncmd:\n- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/$infectBranch/nixos-infect | STAGING_ACME='$stagingAcme' PROVIDER=$infectProviderName DNS_PROVIDER_TYPE=$dnsProviderType NIX_CHANNEL=nixos-21.05 DOMAIN='$domainName' LUSER='${rootUser.login}' ENCODED_PASSWORD='$base64Password' CF_TOKEN=$dnsApiToken DB_PASSWORD=$dbPassword API_TOKEN=$apiToken HOSTNAME=$hostname bash 2>&1 | tee /tmp/infect.log"; - Response? serverCreateResponse; ServerHostingDetails? serverDetails; DioError? hetznerError; bool success = false; - + final Dio client = await getClient(); try { final Map data = { 'name': hostname, @@ -404,7 +437,13 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { 'image': 'ubuntu-20.04', 'volumes': [volumeId], 'networks': [], - 'user_data': userdataString, + 'user_data': '#cloud-config\n' + 'runcmd:\n' + '- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/$infectBranch/nixos-infect | ' + "STAGING_ACME='$stagingAcme' PROVIDER=$infectProviderName DNS_PROVIDER_TYPE=$dnsProviderType " + "NIX_CHANNEL=nixos-21.05 DOMAIN='$domainName' LUSER='${rootUser.login}' ENCODED_PASSWORD='$base64Password' " + 'CF_TOKEN=$dnsApiToken DB_PASSWORD=$dbPassword API_TOKEN=$apiToken HOSTNAME=$hostname bash 2>&1 | ' + 'tee /tmp/infect.log', 'labels': {}, 'automount': true, 'location': region!, diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 17d90764..9758c545 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -9,8 +9,6 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/api_controller.dart'; import 'package:selfprivacy/logic/providers/provider_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart'; import 'package:selfprivacy/logic/providers/providers_controller.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_api_settings.dart'; import 'package:selfprivacy/logic/models/hive/backblaze_credential.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; @@ -174,7 +172,7 @@ class ServerInstallationCubit extends Cubit { await repository.saveServerType(serverType); await ProvidersController.currentServerProvider! - .trySetServerType(serverType); + .trySetServerLocation(serverType); emit( (state as ServerInstallationNotFinished).copyWith( diff --git a/lib/logic/models/callback_dialogue_branching.dart b/lib/logic/models/callback_dialogue_branching.dart new file mode 100644 index 00000000..614a7c22 --- /dev/null +++ b/lib/logic/models/callback_dialogue_branching.dart @@ -0,0 +1,21 @@ +import 'package:selfprivacy/logic/api_maps/generic_result.dart'; + +class CallbackDialogueBranching { + CallbackDialogueBranching({ + required this.title, + required this.description, + required this.choices, + }); + final String title; + final String description; + final List choices; +} + +class CallbackDialogueChoice { + CallbackDialogueChoice({ + required this.title, + required this.callback, + }); + final String title; + final Future> Function()? callback; +} diff --git a/lib/logic/models/launch_installation_data.dart b/lib/logic/models/launch_installation_data.dart new file mode 100644 index 00000000..14e1e592 --- /dev/null +++ b/lib/logic/models/launch_installation_data.dart @@ -0,0 +1,19 @@ +import 'package:selfprivacy/logic/models/hive/server_domain.dart'; +import 'package:selfprivacy/logic/models/hive/user.dart'; +import 'package:selfprivacy/logic/models/server_type.dart'; + +class LaunchInstallationData { + LaunchInstallationData({ + required this.rootUser, + required this.dnsApiToken, + required this.dnsProviderType, + required this.domainName, + required this.serverType, + }); + + final User rootUser; + final String dnsApiToken; + final String domainName; + final DnsProviderType dnsProviderType; + final ServerType serverType; +} diff --git a/lib/logic/providers/server_provider.dart b/lib/logic/providers/server_provider.dart index e5c1c1bf..642c779a 100644 --- a/lib/logic/providers/server_provider.dart +++ b/lib/logic/providers/server_provider.dart @@ -5,7 +5,7 @@ import 'package:selfprivacy/logic/models/server_type.dart'; export 'package:selfprivacy/logic/api_maps/generic_result.dart'; abstract class ServerProvider { - Future> trySetServerType(final ServerType type); + Future> trySetServerLocation(final String location); Future> tryInitApiByToken(final String token); Future>> getAvailableLocations(); Future>> getServerTypes({ diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index fdc8f11e..f1453448 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -1,8 +1,14 @@ +import 'dart:convert'; + +import 'package:easy_localization/easy_localization.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart'; +import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; +import 'package:selfprivacy/logic/models/callback_dialogue_branching.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart'; +import 'package:selfprivacy/logic/models/launch_installation_data.dart'; import 'package:selfprivacy/logic/models/metrics.dart'; import 'package:selfprivacy/logic/models/price.dart'; import 'package:selfprivacy/logic/models/server_basic_info.dart'; @@ -11,6 +17,8 @@ import 'package:selfprivacy/logic/models/server_provider_location.dart'; import 'package:selfprivacy/logic/models/server_type.dart'; import 'package:selfprivacy/logic/providers/server_provider.dart'; import 'package:selfprivacy/utils/extensions/string_extensions.dart'; +import 'package:selfprivacy/utils/network_utils.dart'; +import 'package:selfprivacy/utils/password_generator.dart'; class ApiAdapter { ApiAdapter({final String? region, final bool isWithToken = true}) @@ -42,7 +50,9 @@ class HetznerServerProvider extends ServerProvider { ApiAdapter _adapter; @override - Future> trySetServerType(final ServerType type) async { + Future> trySetServerLocation( + final String location, + ) async { final bool apiInitialized = _adapter.api().isWithToken; if (!apiInitialized) { return GenericResult( @@ -54,7 +64,7 @@ class HetznerServerProvider extends ServerProvider { _adapter = ApiAdapter( isWithToken: true, - region: type.location.identifier, + region: location, ); return success; } @@ -302,6 +312,7 @@ class HetznerServerProvider extends ServerProvider { end, 'cpu', ); + if (cpuResult.data.isEmpty || !cpuResult.success) { return GenericResult( success: false, @@ -387,4 +398,170 @@ class HetznerServerProvider extends ServerProvider { data: timestamp, ); } + + String dnsProviderToInfectName(final DnsProviderType dnsProvider) { + String dnsProviderType; + switch (dnsProvider) { + case DnsProviderType.digitalOcean: + dnsProviderType = 'DIGITALOCEAN'; + break; + case DnsProviderType.cloudflare: + default: + dnsProviderType = 'CLOUDFLARE'; + break; + } + return dnsProviderType; + } + + Future> launchInstallation( + final LaunchInstallationData installationData, + ) async { + final volumeResult = await _adapter.api().createVolume(); + + if (!volumeResult.success || volumeResult.data == null) { + return GenericResult( + data: CallbackDialogueBranching( + choices: [ + CallbackDialogueChoice( + title: 'basis.cancel'.tr(), + callback: null, + ), + CallbackDialogueChoice( + title: 'basis.try_again'.tr(), + callback: () async => launchInstallation(installationData), + ), + ], + description: + volumeResult.message ?? 'modals.volume_creation_error'.tr(), + title: 'modals.unexpected_error'.tr(), + ), + success: false, + message: volumeResult.message, + code: volumeResult.code, + ); + } + + final volume = volumeResult.data!; + final serverApiToken = StringGenerators.apiToken(); + final hostname = getHostnameFromDomain(installationData.domainName); + + final serverResult = await _adapter.api().createServer( + dnsApiToken: installationData.dnsApiToken, + rootUser: installationData.rootUser, + domainName: installationData.domainName, + serverType: installationData.serverType.identifier, + dnsProviderType: + dnsProviderToInfectName(installationData.dnsProviderType), + hostName: hostname, + volumeId: volume.id, + base64Password: base64.encode( + utf8.encode(installationData.rootUser.password ?? 'PASS'), + ), + databasePassword: StringGenerators.dbPassword(), + serverApiToken: serverApiToken, + ); + + if (!serverResult.success || serverResult.data == null) { + await _adapter.api().deleteVolume(volume); + await Future.delayed(const Duration(seconds: 5)); + if (serverResult.message != null && + serverResult.message == 'uniqueness_error') { + return GenericResult( + data: CallbackDialogueBranching( + choices: [ + CallbackDialogueChoice( + title: 'basis.cancel'.tr(), + callback: null, + ), + CallbackDialogueChoice( + title: 'basis.yes'.tr(), + callback: () async { + final deleting = await deleteServer(hostname); + if (deleting.success) { + return launchInstallation(installationData); + } + + return deleting; + }, + ), + ], + description: volumeResult.message ?? 'modals.destroy_server'.tr(), + title: 'modals.already_exists'.tr(), + ), + success: false, + message: volumeResult.message, + code: volumeResult.code, + ); + } else { + return GenericResult( + data: CallbackDialogueBranching( + choices: [ + CallbackDialogueChoice( + title: 'basis.cancel'.tr(), + callback: null, + ), + CallbackDialogueChoice( + title: 'basis.try_again'.tr(), + callback: () async => launchInstallation(installationData), + ), + ], + description: + volumeResult.message ?? 'recovering.generic_error'.tr(), + title: 'modals.unexpected_error'.tr(), + ), + success: false, + message: volumeResult.message, + code: volumeResult.code, + ); + } + } + + final serverDetails = ServerHostingDetails( + id: serverResult.data['server']['id'], + ip4: serverResult.data['server']['public_net']['ipv4']['ip'], + createTime: DateTime.now(), + volume: volume, + apiToken: serverApiToken, + provider: ServerProviderType.hetzner, + ); + + final createDnsResult = await _adapter.api().createReverseDns( + serverId: serverDetails.id, + ip4: serverDetails.ip4, + dnsPtr: installationData.domainName, + ); + + if (!createDnsResult.success) { + return GenericResult( + data: CallbackDialogueBranching( + choices: [ + CallbackDialogueChoice( + title: 'basis.cancel'.tr(), + callback: null, + ), + CallbackDialogueChoice( + title: 'basis.try_again'.tr(), + callback: () async { + final deletion = await deleteServer(hostname); + if (deletion.success) { + return launchInstallation(installationData); + } + + return deletion; + }, + ), + ], + description: volumeResult.message ?? 'recovering.generic_error'.tr(), + title: 'modals.unexpected_error'.tr(), + ), + success: false, + message: volumeResult.message, + code: volumeResult.code, + ); + } + } + + Future> deleteServer( + final String hostname, + ) async {} } From ef04b5bf57a60e7af85d5018731cf742f538b5ba Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 22 Feb 2023 21:03:58 +0400 Subject: [PATCH 22/96] chore: Implement server installation on businness logic layer for hetzner --- .../server_installation_cubit.dart | 60 ++++++++----------- .../models/launch_installation_data.dart | 5 ++ .../providers/server_providers/hetzner.dart | 28 +++++++-- 3 files changed, 53 insertions(+), 40 deletions(-) diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 9758c545..896ef717 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -172,7 +172,7 @@ class ServerInstallationCubit extends Cubit { await repository.saveServerType(serverType); await ProvidersController.currentServerProvider! - .trySetServerLocation(serverType); + .trySetServerLocation(serverType.identifier); emit( (state as ServerInstallationNotFinished).copyWith( @@ -223,42 +223,30 @@ class ServerInstallationCubit extends Cubit { emit((state as ServerInstallationNotFinished).copyWith(rootUser: rootUser)); } + Future onCreateServerSuccess( + final ServerHostingDetails serverDetails, + ) async { + await repository.saveServerDetails(serverDetails); + // TODO dns; + emit( + (state as ServerInstallationNotFinished).copyWith( + isLoading: false, + serverDetails: serverDetails, + ), + ); + runDelayed(startServerIfDnsIsOkay, const Duration(seconds: 30), null); + } + void createServerAndSetDnsRecords() async { - final ServerInstallationNotFinished stateCopy = - state as ServerInstallationNotFinished; - void onCancel() => emit( - (state as ServerInstallationNotFinished).copyWith(isLoading: false), - ); - - Future onSuccess(final ServerHostingDetails serverDetails) async { - await repository.createDnsRecords( - serverDetails, - state.serverDomain!, - onCancel: onCancel, - ); - - emit( - (state as ServerInstallationNotFinished).copyWith( - isLoading: false, - serverDetails: serverDetails, - ), - ); - runDelayed(startServerIfDnsIsOkay, const Duration(seconds: 30), null); - } - - try { - emit((state as ServerInstallationNotFinished).copyWith(isLoading: true)); - await repository.createServer( - state.rootUser!, - state.serverDomain!.domainName, - state.dnsApiToken!, - state.backblazeCredential!, - onCancel: onCancel, - onSuccess: onSuccess, - ); - } catch (e) { - emit(stateCopy); - } + emit((state as ServerInstallationNotFinished).copyWith(isLoading: true)); + await repository.createServer( + state.rootUser!, + state.serverDomain!.domainName, + state.dnsApiToken!, + state.backblazeCredential!, + onCancel: clearAppConfig, + onSuccess: onCreateServerSuccess, + ); } void startServerIfDnsIsOkay({ diff --git a/lib/logic/models/launch_installation_data.dart b/lib/logic/models/launch_installation_data.dart index 14e1e592..f955eed7 100644 --- a/lib/logic/models/launch_installation_data.dart +++ b/lib/logic/models/launch_installation_data.dart @@ -1,3 +1,4 @@ +import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; import 'package:selfprivacy/logic/models/server_type.dart'; @@ -9,6 +10,8 @@ class LaunchInstallationData { required this.dnsProviderType, required this.domainName, required this.serverType, + required this.errorCallback, + required this.successCallback, }); final User rootUser; @@ -16,4 +19,6 @@ class LaunchInstallationData { final String domainName; final DnsProviderType dnsProviderType; final ServerType serverType; + final Function() errorCallback; + final Function(ServerHostingDetails details) successCallback; } diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index f1453448..6cd5f4f6 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -424,7 +424,7 @@ class HetznerServerProvider extends ServerProvider { choices: [ CallbackDialogueChoice( title: 'basis.cancel'.tr(), - callback: null, + callback: await installationData.errorCallback(), ), CallbackDialogueChoice( title: 'basis.try_again'.tr(), @@ -471,7 +471,7 @@ class HetznerServerProvider extends ServerProvider { choices: [ CallbackDialogueChoice( title: 'basis.cancel'.tr(), - callback: null, + callback: installationData.errorCallback(), ), CallbackDialogueChoice( title: 'basis.yes'.tr(), @@ -498,7 +498,14 @@ class HetznerServerProvider extends ServerProvider { choices: [ CallbackDialogueChoice( title: 'basis.cancel'.tr(), - callback: null, + callback: () async { + final deletion = await deleteServer(hostname); + if (deletion.success) { + installationData.errorCallback(); + } + + return deletion; + }, ), CallbackDialogueChoice( title: 'basis.try_again'.tr(), @@ -537,13 +544,23 @@ class HetznerServerProvider extends ServerProvider { choices: [ CallbackDialogueChoice( title: 'basis.cancel'.tr(), - callback: null, + callback: () async { + final deletion = await deleteServer(hostname); + if (deletion.success) { + installationData.errorCallback(); + } + + return deletion; + }, ), CallbackDialogueChoice( title: 'basis.try_again'.tr(), callback: () async { + await _adapter.api().deleteVolume(volume); + await Future.delayed(const Duration(seconds: 5)); final deletion = await deleteServer(hostname); if (deletion.success) { + await Future.delayed(const Duration(seconds: 5)); return launchInstallation(installationData); } @@ -559,6 +576,9 @@ class HetznerServerProvider extends ServerProvider { code: volumeResult.code, ); } + + await installationData.successCallback(serverDetails); + return GenericResult(success: true, data: null); } Future> deleteServer( From 62c0030f8e55aeb7449a8dd1500e875fb2454566 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 22 Feb 2023 21:58:59 +0400 Subject: [PATCH 23/96] chore: Implement server installation logic on cubit layer --- .../server_installation_cubit.dart | 55 +++++++-- .../server_installation_repository.dart | 115 ++---------------- .../models/launch_installation_data.dart | 5 +- lib/logic/providers/server_provider.dart | 7 ++ .../providers/server_providers/hetzner.dart | 5 +- 5 files changed, 69 insertions(+), 118 deletions(-) diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 896ef717..1ccaf714 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -6,6 +6,8 @@ import 'package:equatable/equatable.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server_api.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/api_controller.dart'; +import 'package:selfprivacy/logic/models/callback_dialogue_branching.dart'; +import 'package:selfprivacy/logic/models/launch_installation_data.dart'; import 'package:selfprivacy/logic/providers/provider_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart'; import 'package:selfprivacy/logic/providers/providers_controller.dart'; @@ -18,6 +20,7 @@ import 'package:selfprivacy/logic/models/server_basic_info.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_repository.dart'; import 'package:selfprivacy/logic/models/server_provider_location.dart'; import 'package:selfprivacy/logic/models/server_type.dart'; +import 'package:selfprivacy/ui/helpers/modals.dart'; export 'package:provider/provider.dart'; @@ -239,14 +242,52 @@ class ServerInstallationCubit extends Cubit { void createServerAndSetDnsRecords() async { emit((state as ServerInstallationNotFinished).copyWith(isLoading: true)); - await repository.createServer( - state.rootUser!, - state.serverDomain!.domainName, - state.dnsApiToken!, - state.backblazeCredential!, - onCancel: clearAppConfig, - onSuccess: onCreateServerSuccess, + + final installationData = LaunchInstallationData( + rootUser: state.rootUser!, + dnsApiToken: state.dnsApiToken!, + dnsProviderType: state.serverDomain!.provider, + domainName: state.serverDomain!.domainName, + serverTypeId: state.serverTypeIdentificator!, + errorCallback: clearAppConfig, + successCallback: onCreateServerSuccess, ); + + final result = + await ProvidersController.currentServerProvider!.launchInstallation( + installationData, + ); + + if (!result.success && result.data != null) { + bool dialoguesResolved = false; + CallbackDialogueBranching branching = result.data!; + while (!dialoguesResolved) { + showPopUpAlert( + alertTitle: branching.title, + description: branching.description, + actionButtonTitle: branching.choices[1].title, + actionButtonOnPressed: () async { + final branchingResult = await branching.choices[1].callback!(); + if (branchingResult.data == null) { + dialoguesResolved = true; + return; + } + + branching = branchingResult.data!; + }, + cancelButtonTitle: branching.choices[0].title, + cancelButtonOnPressed: () async { + final branchingResult = await branching.choices[0].callback!(); + if (branchingResult.data == null) { + dialoguesResolved = true; + return; + } + + branching = branchingResult.data!; + }, + ); + } + } } void startServerIfDnsIsOkay({ diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index d60b2119..3d3f62a8 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -25,6 +25,7 @@ import 'package:selfprivacy/logic/models/json/dns_records.dart'; import 'package:selfprivacy/logic/models/message.dart'; import 'package:selfprivacy/logic/models/server_basic_info.dart'; import 'package:selfprivacy/logic/models/server_type.dart'; +import 'package:selfprivacy/logic/providers/providers_controller.dart'; import 'package:selfprivacy/ui/helpers/modals.dart'; import 'package:selfprivacy/utils/network_utils.dart'; @@ -168,13 +169,15 @@ class ServerInstallationRepository { Future startServer( final ServerHostingDetails server, ) async { - ServerHostingDetails serverDetails; + final result = await ProvidersController.currentServerProvider!.powerOn( + server.id, + ); - serverDetails = await ApiController.currentServerProviderApiFactory! - .getServerProvider() - .powerOn(); + if (result.success && result.data != null) { + server.copyWith(startTime: result.data); + } - return serverDetails; + return server; } Future getDomainId(final String token, final String domain) async { @@ -239,108 +242,6 @@ class ServerInstallationRepository { return matches; } - Future createServer( - final User rootUser, - final String domainName, - final String cloudFlareKey, - final BackblazeCredential backblazeCredential, { - required final void Function() onCancel, - required final Future Function(ServerHostingDetails serverDetails) - onSuccess, - }) async { - final ServerProviderApi api = - ApiController.currentServerProviderApiFactory!.getServerProvider(); - - void showInstallationErrorPopUp() { - showPopUpAlert( - alertTitle: 'modals.unexpected_error'.tr(), - description: 'modals.try_again'.tr(), - actionButtonTitle: 'modals.yes'.tr(), - actionButtonOnPressed: () async { - ServerHostingDetails? serverDetails; - try { - final GenericResult createResult = await api.createServer( - dnsProvider: getIt().dnsProvider!, - dnsApiToken: cloudFlareKey, - rootUser: rootUser, - domainName: domainName, - serverType: getIt().serverType!, - ); - serverDetails = createResult.data; - } catch (e) { - print(e); - } - - if (serverDetails == null) { - print('Server is not initialized!'); - return; - } - await saveServerDetails(serverDetails); - onSuccess(serverDetails); - }, - cancelButtonOnPressed: onCancel, - ); - } - - try { - final GenericResult createServerResult = - await api.createServer( - dnsProvider: getIt().dnsProvider!, - dnsApiToken: cloudFlareKey, - rootUser: rootUser, - domainName: domainName, - serverType: getIt().serverType!, - ); - - if (createServerResult.data == null) { - const String e = 'Server is not initialized!'; - print(e); - } - - if (createServerResult.message == 'uniqueness_error') { - showPopUpAlert( - alertTitle: 'modals.already_exists'.tr(), - description: 'modals.destroy_server'.tr(), - actionButtonTitle: 'modals.yes'.tr(), - actionButtonOnPressed: () async { - await api.deleteServer( - domainName: domainName, - ); - - ServerHostingDetails? serverDetails; - try { - final GenericResult createResult = await api.createServer( - dnsProvider: getIt().dnsProvider!, - dnsApiToken: cloudFlareKey, - rootUser: rootUser, - domainName: domainName, - serverType: getIt().serverType!, - ); - serverDetails = createResult.data; - } catch (e) { - print(e); - } - - if (serverDetails == null) { - print('Server is not initialized!'); - return; - } - await saveServerDetails(serverDetails); - onSuccess(serverDetails); - }, - cancelButtonOnPressed: onCancel, - ); - return; - } - - saveServerDetails(createServerResult.data!); - onSuccess(createServerResult.data!); - } catch (e) { - print(e); - showInstallationErrorPopUp(); - } - } - Future createDnsRecords( final ServerHostingDetails serverDetails, final ServerDomain domain, { diff --git a/lib/logic/models/launch_installation_data.dart b/lib/logic/models/launch_installation_data.dart index f955eed7..c7956ea1 100644 --- a/lib/logic/models/launch_installation_data.dart +++ b/lib/logic/models/launch_installation_data.dart @@ -1,7 +1,6 @@ import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; -import 'package:selfprivacy/logic/models/server_type.dart'; class LaunchInstallationData { LaunchInstallationData({ @@ -9,7 +8,7 @@ class LaunchInstallationData { required this.dnsApiToken, required this.dnsProviderType, required this.domainName, - required this.serverType, + required this.serverTypeId, required this.errorCallback, required this.successCallback, }); @@ -18,7 +17,7 @@ class LaunchInstallationData { final String dnsApiToken; final String domainName; final DnsProviderType dnsProviderType; - final ServerType serverType; + final String serverTypeId; final Function() errorCallback; final Function(ServerHostingDetails details) successCallback; } diff --git a/lib/logic/providers/server_provider.dart b/lib/logic/providers/server_provider.dart index 642c779a..b92faa97 100644 --- a/lib/logic/providers/server_provider.dart +++ b/lib/logic/providers/server_provider.dart @@ -1,4 +1,6 @@ import 'package:selfprivacy/logic/api_maps/generic_result.dart'; +import 'package:selfprivacy/logic/models/callback_dialogue_branching.dart'; +import 'package:selfprivacy/logic/models/launch_installation_data.dart'; import 'package:selfprivacy/logic/models/server_provider_location.dart'; import 'package:selfprivacy/logic/models/server_type.dart'; @@ -11,6 +13,11 @@ abstract class ServerProvider { Future>> getServerTypes({ required final ServerProviderLocation location, }); + Future> launchInstallation( + final LaunchInstallationData installationData, + ); + Future> powerOn(final int serverId); + Future> restart(final int serverId); GenericResult get success => GenericResult(success: true, data: true); } diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index 6cd5f4f6..4b2377e6 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -359,6 +359,7 @@ class HetznerServerProvider extends ServerProvider { return GenericResult(data: metrics, success: true); } + @override Future> restart(final int serverId) async { DateTime? timestamp; final result = await _adapter.api().restart(serverId); @@ -379,6 +380,7 @@ class HetznerServerProvider extends ServerProvider { ); } + @override Future> powerOn(final int serverId) async { DateTime? timestamp; final result = await _adapter.api().powerOn(serverId); @@ -413,6 +415,7 @@ class HetznerServerProvider extends ServerProvider { return dnsProviderType; } + @override Future> launchInstallation( final LaunchInstallationData installationData, ) async { @@ -449,7 +452,7 @@ class HetznerServerProvider extends ServerProvider { dnsApiToken: installationData.dnsApiToken, rootUser: installationData.rootUser, domainName: installationData.domainName, - serverType: installationData.serverType.identifier, + serverType: installationData.serverTypeId, dnsProviderType: dnsProviderToInfectName(installationData.dnsProviderType), hostName: hostname, From 97e9e9d9cbbb2bf627677fd05024070d22b12627 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 28 Feb 2023 07:00:52 +0400 Subject: [PATCH 24/96] chore: Adapt MetricsRepository to new ProvidersControllers model --- .../server_providers/hetzner/hetzner_api.dart | 97 +------------------ .../cubit/metrics/metrics_repository.dart | 21 ++-- .../server_installation_cubit.dart | 3 +- .../server_installation_repository.dart | 25 +++-- lib/logic/providers/server_provider.dart | 6 ++ .../providers/server_providers/hetzner.dart | 1 + 6 files changed, 36 insertions(+), 117 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart index fa244393..42ec94bb 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart @@ -1,23 +1,16 @@ -import 'dart:convert'; import 'dart:io'; import 'package:dio/dio.dart'; -import 'package:easy_localization/easy_localization.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/volume_provider.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; import 'package:selfprivacy/logic/api_maps/staging_options.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; -import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; -import 'package:selfprivacy/logic/models/metrics.dart'; import 'package:selfprivacy/logic/models/price.dart'; -import 'package:selfprivacy/logic/models/server_basic_info.dart'; -import 'package:selfprivacy/logic/models/server_metadata.dart'; import 'package:selfprivacy/logic/models/server_provider_location.dart'; -import 'package:selfprivacy/utils/extensions/string_extensions.dart'; import 'package:selfprivacy/utils/network_utils.dart'; import 'package:selfprivacy/utils/password_generator.dart'; @@ -353,10 +346,10 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { required final String serverType, }) async { final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false'; - Response? serverCreateResponse; DioError? hetznerError; bool success = false; + final Dio client = await getClient(); try { final Map data = { @@ -405,94 +398,6 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { ); } - Future> skldfjalkdsjflkasd({ - required final String dnsApiToken, - required final User rootUser, - required final String domainName, - required final ServerVolume volume, - required final String serverType, - required final DnsProviderType dnsProvider, - }) async { - final String dbPassword = StringGenerators.dbPassword(); - final int volumeId = volume.id; - - final String apiToken = StringGenerators.apiToken(); - final String hostname = getHostnameFromDomain(domainName); - const String infectBranch = 'providers/hetzner'; - final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false'; - final String base64Password = - base64.encode(utf8.encode(rootUser.password ?? 'PASS')); - final String dnsProviderType = dnsProviderToInfectName(dnsProvider); - - Response? serverCreateResponse; - ServerHostingDetails? serverDetails; - DioError? hetznerError; - bool success = false; - final Dio client = await getClient(); - try { - final Map data = { - 'name': hostname, - 'server_type': serverType, - 'start_after_create': false, - 'image': 'ubuntu-20.04', - 'volumes': [volumeId], - 'networks': [], - 'user_data': '#cloud-config\n' - 'runcmd:\n' - '- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/$infectBranch/nixos-infect | ' - "STAGING_ACME='$stagingAcme' PROVIDER=$infectProviderName DNS_PROVIDER_TYPE=$dnsProviderType " - "NIX_CHANNEL=nixos-21.05 DOMAIN='$domainName' LUSER='${rootUser.login}' ENCODED_PASSWORD='$base64Password' " - 'CF_TOKEN=$dnsApiToken DB_PASSWORD=$dbPassword API_TOKEN=$apiToken HOSTNAME=$hostname bash 2>&1 | ' - 'tee /tmp/infect.log', - 'labels': {}, - 'automount': true, - 'location': region!, - }; - print('Decoded data: $data'); - - serverCreateResponse = await client.post( - '/servers', - data: data, - ); - print(serverCreateResponse.data); - serverDetails = ServerHostingDetails( - id: serverCreateResponse.data['server']['id'], - ip4: serverCreateResponse.data['server']['public_net']['ipv4']['ip'], - createTime: DateTime.now(), - volume: volume, - apiToken: apiToken, - provider: ServerProviderType.hetzner, - ); - success = true; - } on DioError catch (e) { - print(e); - hetznerError = e; - } catch (e) { - print(e); - } finally { - client.close(); - } - - if (!success) { - await Future.delayed(const Duration(seconds: 10)); - await deleteVolume(volume); - } - - String? apiResultMessage = serverCreateResponse?.statusMessage; - if (hetznerError != null && - hetznerError.response!.data['error']['code'] == 'uniqueness_error') { - apiResultMessage = 'uniqueness_error'; - } - - return GenericResult( - data: serverDetails, - success: success && hetznerError == null, - code: serverCreateResponse?.statusCode ?? - hetznerError?.response?.statusCode, - message: apiResultMessage, - ); - } - Future> deleteServer({ required final String domainName, }) async { diff --git a/lib/logic/cubit/metrics/metrics_repository.dart b/lib/logic/cubit/metrics/metrics_repository.dart index 71c298bf..0c6a82ef 100644 --- a/lib/logic/cubit/metrics/metrics_repository.dart +++ b/lib/logic/cubit/metrics/metrics_repository.dart @@ -1,9 +1,8 @@ import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/api_controller.dart'; import 'package:selfprivacy/logic/common_enum/common_enum.dart'; import 'package:selfprivacy/logic/cubit/metrics/metrics_cubit.dart'; -import 'package:selfprivacy/logic/models/metrics.dart'; +import 'package:selfprivacy/logic/providers/providers_controller.dart'; class MetricsLoadException implements Exception { MetricsLoadException(this.message); @@ -12,8 +11,7 @@ class MetricsLoadException implements Exception { class MetricsRepository { Future getMetrics(final Period period) async { - final providerApiFactory = ApiController.currentServerProviderApiFactory; - if (providerApiFactory == null) { + if (ProvidersController.currentServerProvider == null) { throw MetricsLoadException('Server Provider data is null'); } @@ -33,20 +31,19 @@ class MetricsRepository { } final serverId = getIt().serverDetails!.id; - final ServerMetrics? metrics = - await providerApiFactory.getServerProvider().getMetrics( - serverId, - start, - end, - ); + final result = await ProvidersController.currentServerProvider!.getMetrics( + serverId, + start, + end, + ); - if (metrics == null) { + if (result.data == null || !result.success) { throw MetricsLoadException('Metrics data is null'); } return MetricsLoaded( period: period, - metrics: metrics, + metrics: result.data!, ); } } diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 1ccaf714..435d84af 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -134,7 +134,7 @@ class ServerInstallationCubit extends Cubit { Future> fetchAvailableTypesByLocation( final ServerProviderLocation location, ) async { - if (ApiController.currentServerProviderApiFactory == null) { + if (ProvidersController.currentServerProvider == null) { return []; } @@ -754,6 +754,7 @@ class ServerInstallationCubit extends Cubit { void clearAppConfig() { closeTimer(); ApiController.clearProviderApiFactories(); + ProvidersController.clearProviders(); repository.clearAppConfig(); emit(const ServerInstallationEmpty()); } diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 3d3f62a8..528b713f 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -332,15 +332,24 @@ class ServerInstallationRepository { return api.isHttpServerWorking(); } - Future restart() async => - ApiController.currentServerProviderApiFactory! - .getServerProvider() - .restart(); + Future restart() async { + final server = getIt().serverDetails!; - Future powerOn() async => - ApiController.currentServerProviderApiFactory! - .getServerProvider() - .powerOn(); + final result = await ProvidersController.currentServerProvider!.restart( + server.id, + ); + + if (result.success && result.data != null) { + server.copyWith(startTime: result.data); + } + + return server; + } + + Future powerOn() async { + final server = getIt().serverDetails!; + return startServer(server); + } Future getRecoveryCapabilities( final ServerDomain serverDomain, diff --git a/lib/logic/providers/server_provider.dart b/lib/logic/providers/server_provider.dart index b92faa97..519307e8 100644 --- a/lib/logic/providers/server_provider.dart +++ b/lib/logic/providers/server_provider.dart @@ -1,6 +1,7 @@ import 'package:selfprivacy/logic/api_maps/generic_result.dart'; import 'package:selfprivacy/logic/models/callback_dialogue_branching.dart'; import 'package:selfprivacy/logic/models/launch_installation_data.dart'; +import 'package:selfprivacy/logic/models/metrics.dart'; import 'package:selfprivacy/logic/models/server_provider_location.dart'; import 'package:selfprivacy/logic/models/server_type.dart'; @@ -18,6 +19,11 @@ abstract class ServerProvider { ); Future> powerOn(final int serverId); Future> restart(final int serverId); + Future> getMetrics( + final int serverId, + final DateTime start, + final DateTime end, + ); GenericResult get success => GenericResult(success: true, data: true); } diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index 4b2377e6..20a4ca95 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -289,6 +289,7 @@ class HetznerServerProvider extends ServerProvider { return GenericResult(success: true, data: metadata); } + @override Future> getMetrics( final int serverId, final DateTime start, From cd59c19c9cf7187c0ad730fa5959700c464926ef Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 1 Mar 2023 06:53:51 +0400 Subject: [PATCH 25/96] chore: Start implementing Digital Ocean provider layer --- .../digital_ocean/digital_ocean_api.dart | 83 +-------- .../server_providers/server_provider.dart | 15 -- .../server_providers/digital_ocean.dart | 176 +++++++++++++++++- .../providers/server_providers/hetzner.dart | 1 - 4 files changed, 180 insertions(+), 95 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart index 7cd379ee..e1996dc4 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart @@ -59,7 +59,6 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { @override String get displayProviderName => 'Digital Ocean'; - @override Future> isApiTokenValid(final String token) async { bool isValid = false; Response? response; @@ -724,46 +723,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { return servers; } - String? getEmojiFlag(final String query) { - String? emoji; - - switch (query.toLowerCase().substring(0, 3)) { - case 'fra': - emoji = '🇩🇪'; - break; - - case 'ams': - emoji = '🇳🇱'; - break; - - case 'sgp': - emoji = '🇸🇬'; - break; - - case 'lon': - emoji = '🇬🇧'; - break; - - case 'tor': - emoji = '🇨🇦'; - break; - - case 'blr': - emoji = '🇮🇳'; - break; - - case 'nyc': - case 'sfo': - emoji = '🇺🇸'; - break; - } - - return emoji; - } - - @override - Future>> - getAvailableLocations() async { + Future> getAvailableLocations() async { List locations = []; final Dio client = await getClient(); @@ -772,16 +732,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { '/regions', ); - locations = response.data!['regions'] - .map( - (final location) => ServerProviderLocation( - title: location['slug'], - description: location['name'], - flag: getEmojiFlag(location['slug']), - identifier: location['slug'], - ), - ) - .toList(); + locations = response.data!['regions']; } catch (e) { print(e); return GenericResult( @@ -796,39 +747,15 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { return GenericResult(data: locations, success: true); } - @override - Future>> getAvailableServerTypes({ - required final ServerProviderLocation location, - }) async { - final List types = []; + Future> getAvailableServerTypes() async { + List types = []; final Dio client = await getClient(); try { final Response response = await client.get( '/sizes', ); - final rawSizes = response.data!['sizes']; - for (final rawSize in rawSizes) { - for (final rawRegion in rawSize['regions']) { - final ramMb = rawSize['memory'].toDouble(); - if (rawRegion.toString() == location.identifier && ramMb > 1024) { - types.add( - ServerType( - title: rawSize['description'], - identifier: rawSize['slug'], - ram: ramMb / 1024, - cores: rawSize['vcpus'], - disk: DiskSize(byte: rawSize['disk'] * 1024 * 1024 * 1024), - price: Price( - value: rawSize['price_monthly'], - currency: 'USD', - ), - location: location, - ), - ); - } - } - } + types = response.data!['sizes']; } catch (e) { print(e); return GenericResult( diff --git a/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart b/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart index 99c6b1ac..88250ab3 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart @@ -1,5 +1,4 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; -import 'package:selfprivacy/logic/models/hive/server_domain.dart'; export 'package:selfprivacy/logic/api_maps/generic_result.dart'; class ProviderApiTokenValidation { @@ -12,20 +11,6 @@ class ProviderApiTokenValidation { } abstract class ServerProviderApi extends ApiMap { - String dnsProviderToInfectName(final DnsProviderType dnsProvider) { - String dnsProviderType; - switch (dnsProvider) { - case DnsProviderType.digitalOcean: - dnsProviderType = 'DIGITALOCEAN'; - break; - case DnsProviderType.cloudflare: - default: - dnsProviderType = 'CLOUDFLARE'; - break; - } - return dnsProviderType; - } - /// Provider name key which lets infect understand what kind of installation /// it requires, for example 'digitaloceal' for Digital Ocean String get infectProviderName; diff --git a/lib/logic/providers/server_providers/digital_ocean.dart b/lib/logic/providers/server_providers/digital_ocean.dart index 4a26c49e..d94418cd 100644 --- a/lib/logic/providers/server_providers/digital_ocean.dart +++ b/lib/logic/providers/server_providers/digital_ocean.dart @@ -1,3 +1,177 @@ +import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart'; +import 'package:selfprivacy/logic/models/server_provider_location.dart'; +import 'package:selfprivacy/logic/models/server_type.dart'; import 'package:selfprivacy/logic/providers/server_provider.dart'; -class DigitalOceanServerProvider extends ServerProvider {} +class ApiAdapter { + ApiAdapter({final String? region, final bool isWithToken = true}) + : _api = DigitalOceanApi( + region: region, + isWithToken: isWithToken, + ); + + DigitalOceanApi api({final bool getInitialized = true}) => getInitialized + ? _api + : DigitalOceanApi( + region: _api.region, + isWithToken: false, + ); + + final DigitalOceanApi _api; +} + +class DigitalOceanServerProvider extends ServerProvider { + DigitalOceanServerProvider() : _adapter = ApiAdapter(); + DigitalOceanServerProvider.load( + final ServerType serverType, + final bool isAuthotized, + ) : _adapter = ApiAdapter( + isWithToken: isAuthotized, + region: serverType.location.identifier, + ); + + ApiAdapter _adapter; + + @override + Future> trySetServerLocation( + final String location, + ) async { + final bool apiInitialized = _adapter.api().isWithToken; + if (!apiInitialized) { + return GenericResult( + success: true, + data: false, + message: 'Not authorized!', + ); + } + + _adapter = ApiAdapter( + isWithToken: true, + region: location, + ); + return success; + } + + @override + Future> tryInitApiByToken(final String token) async { + final api = _adapter.api(getInitialized: false); + final result = await api.isApiTokenValid(token); + if (!result.data || !result.success) { + return result; + } + + _adapter = ApiAdapter(region: api.region, isWithToken: true); + return result; + } + + String? getEmojiFlag(final String query) { + String? emoji; + + switch (query.toLowerCase().substring(0, 3)) { + case 'fra': + emoji = '🇩🇪'; + break; + + case 'ams': + emoji = '🇳🇱'; + break; + + case 'sgp': + emoji = '🇸🇬'; + break; + + case 'lon': + emoji = '🇬🇧'; + break; + + case 'tor': + emoji = '🇨🇦'; + break; + + case 'blr': + emoji = '🇮🇳'; + break; + + case 'nyc': + case 'sfo': + emoji = '🇺🇸'; + break; + } + + return emoji; + } + + @override + Future>> + getAvailableLocations() async { + final List locations = []; + final result = await _adapter.api().getAvailableLocations(); + if (result.data.isEmpty || !result.success) { + return GenericResult( + success: result.success, + data: locations, + code: result.code, + message: result.message, + ); + } + + final List rawLocations = result.data; + for (final rawLocation in rawLocations) { + ServerProviderLocation? location; + try { + location = ServerProviderLocation( + title: rawLocation['slug'], + description: rawLocation['name'], + flag: getEmojiFlag(rawLocation['slug']), + identifier: rawLocation['slug'], + ); + } catch (e) { + continue; + } + locations.add(location); + } + + return GenericResult(success: true, data: locations); + } + + @override + Future>> getServerTypes({ + required final ServerProviderLocation location, + }) async { + final List types = []; + final result = await _adapter.api().getAvailableServerTypes(); + if (result.data.isEmpty || !result.success) { + return GenericResult( + success: result.success, + data: types, + code: result.code, + message: result.message, + ); + } + + final List rawTypes = result.data; + for (final rawSize in rawSizes) { + for (final rawRegion in rawSize['regions']) { + final ramMb = rawSize['memory'].toDouble(); + if (rawRegion.toString() == location.identifier && ramMb > 1024) { + types.add( + ServerType( + title: rawSize['description'], + identifier: rawSize['slug'], + ram: ramMb / 1024, + cores: rawSize['vcpus'], + disk: DiskSize(byte: rawSize['disk'] * 1024 * 1024 * 1024), + price: Price( + value: rawSize['price_monthly'], + currency: 'USD', + ), + location: location, + ), + ); + } + } + } + + return GenericResult(success: true, data: types); + } +} diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index 20a4ca95..43d60aec 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -2,7 +2,6 @@ import 'dart:convert'; import 'package:easy_localization/easy_localization.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart'; -import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/models/callback_dialogue_branching.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; From 76536f81154499415b3063614f5aef642d7dccfd Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 3 Mar 2023 03:01:09 +0400 Subject: [PATCH 26/96] chore: Move basic functionality of Digital Ocean to provider layer --- .../digital_ocean/digital_ocean_api.dart | 264 ++++-------------- .../server_providers/hetzner/hetzner_api.dart | 10 +- .../server_providers/digital_ocean.dart | 247 +++++++++++++++- .../providers/server_providers/hetzner.dart | 10 - 4 files changed, 308 insertions(+), 223 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart index e1996dc4..3f886597 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart @@ -2,7 +2,6 @@ import 'dart:convert'; import 'dart:io'; import 'package:dio/dio.dart'; -import 'package:easy_localization/easy_localization.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/volume_provider.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; @@ -11,13 +10,9 @@ import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; -import 'package:selfprivacy/logic/models/metrics.dart'; import 'package:selfprivacy/logic/models/price.dart'; import 'package:selfprivacy/logic/models/server_basic_info.dart'; -import 'package:selfprivacy/logic/models/server_metadata.dart'; import 'package:selfprivacy/logic/models/server_provider_location.dart'; -import 'package:selfprivacy/logic/models/server_type.dart'; -import 'package:selfprivacy/utils/extensions/string_extensions.dart'; import 'package:selfprivacy/utils/network_utils.dart'; import 'package:selfprivacy/utils/password_generator.dart'; @@ -107,13 +102,11 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { /// Hardcoded on their documentation and there is no pricing API at all /// Probably we should scrap the doc page manually - @override Future getPricePerGb() async => Price( value: 0.10, currency: 'USD', ); - @override Future> createVolume() async { ServerVolume? volume; @@ -163,7 +156,6 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { ); } - @override Future> getVolumes({final String? status}) async { final List volumes = []; @@ -216,7 +208,6 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { return requestedVolume; } - @override Future deleteVolume(final ServerVolume volume) async { final Dio client = await getClient(); try { @@ -228,7 +219,6 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { } } - @override Future> attachVolume( final ServerVolume volume, final int serverId, @@ -268,7 +258,6 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { ); } - @override Future detachVolume(final ServerVolume volume) async { bool success = false; @@ -295,7 +284,6 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { return success; } - @override Future resizeVolume( final ServerVolume volume, final DiskSize size, @@ -325,7 +313,6 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { return success; } - @override Future> createServer({ required final String dnsApiToken, required final User rootUser, @@ -472,132 +459,65 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { close(client); } - return GenericResult( - success: true, - data: true, - ); + return GenericResult(success: true, data: true); } - @override - Future restart() async { - final ServerHostingDetails server = getIt().serverDetails!; - + Future> restart(final int serverId) async { final Dio client = await getClient(); try { await client.post( - '/droplets/${server.id}/actions', + '/droplets/$serverId/actions', data: { 'type': 'reboot', }, ); } catch (e) { print(e); + return GenericResult( + success: false, + data: null, + message: e.toString(), + ); } finally { close(client); } - return server.copyWith(startTime: DateTime.now()); + return GenericResult(success: true, data: null); } - @override - Future powerOn() async { - final ServerHostingDetails server = getIt().serverDetails!; - + Future> powerOn(final int serverId) async { final Dio client = await getClient(); try { await client.post( - '/droplets/${server.id}/actions', + '/droplets/$serverId/actions', data: { 'type': 'power_on', }, ); } catch (e) { print(e); + return GenericResult( + success: false, + data: null, + message: e.toString(), + ); } finally { close(client); } - return server.copyWith(startTime: DateTime.now()); + return GenericResult(success: true, data: null); } - /// Digital Ocean returns a map of lists of /proc/stat values, - /// so here we are trying to implement average CPU - /// load calculation for each point in time on a given interval. - /// - /// For each point of time: - /// - /// `Average Load = 100 * (1 - (Idle Load / Total Load))` - /// - /// For more info please proceed to read: - /// https://rosettacode.org/wiki/Linux_CPU_utilization - List calculateCpuLoadMetrics(final List rawProcStatMetrics) { - final List cpuLoads = []; - - final int pointsInTime = (rawProcStatMetrics[0]['values'] as List).length; - for (int i = 0; i < pointsInTime; ++i) { - double currentMetricLoad = 0.0; - double? currentMetricIdle; - for (final rawProcStat in rawProcStatMetrics) { - final String rawProcValue = rawProcStat['values'][i][1]; - // Converting MBit into bit - final double procValue = double.parse(rawProcValue) * 1000000; - currentMetricLoad += procValue; - if (currentMetricIdle == null && - rawProcStat['metric']['mode'] == 'idle') { - currentMetricIdle = procValue; - } - } - currentMetricIdle ??= 0.0; - currentMetricLoad = 100.0 * (1 - (currentMetricIdle / currentMetricLoad)); - cpuLoads.add( - TimeSeriesData( - rawProcStatMetrics[0]['values'][i][0], - currentMetricLoad, - ), - ); - } - - return cpuLoads; - } - - @override - Future getMetrics( + Future> getMetricsCpu( final int serverId, final DateTime start, final DateTime end, ) async { - ServerMetrics? metrics; + List metrics = []; - const int step = 15; final Dio client = await getClient(); try { - Response response = await client.get( - '/monitoring/metrics/droplet/bandwidth', - queryParameters: { - 'start': '${(start.microsecondsSinceEpoch / 1000000).round()}', - 'end': '${(end.microsecondsSinceEpoch / 1000000).round()}', - 'host_id': '$serverId', - 'interface': 'public', - 'direction': 'inbound', - }, - ); - - final List inbound = response.data['data']['result'][0]['values']; - - response = await client.get( - '/monitoring/metrics/droplet/bandwidth', - queryParameters: { - 'start': '${(start.microsecondsSinceEpoch / 1000000).round()}', - 'end': '${(end.microsecondsSinceEpoch / 1000000).round()}', - 'host_id': '$serverId', - 'interface': 'public', - 'direction': 'outbound', - }, - ); - - final List outbound = response.data['data']['result'][0]['values']; - - response = await client.get( + final Response response = await client.get( '/monitoring/metrics/droplet/cpu', queryParameters: { 'start': '${(start.microsecondsSinceEpoch / 1000000).round()}', @@ -605,122 +525,75 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { 'host_id': '$serverId', }, ); - - metrics = ServerMetrics( - bandwidthIn: inbound - .map( - (final el) => TimeSeriesData(el[0], double.parse(el[1]) * 100000), - ) - .toList(), - bandwidthOut: outbound - .map( - (final el) => TimeSeriesData(el[0], double.parse(el[1]) * 100000), - ) - .toList(), - cpu: calculateCpuLoadMetrics(response.data['data']['result']), - start: start, - end: end, - stepsInSecond: step, - ); + metrics = response.data['data']['result']; } catch (e) { print(e); + return GenericResult( + success: false, + data: [], + message: e.toString(), + ); } finally { close(client); } - return metrics; + return GenericResult(success: true, data: metrics); } - @override - Future> getMetadata(final int serverId) async { - List metadata = []; + Future> getMetricsBandwidth( + final int serverId, + final DateTime start, + final DateTime end, + final bool isInbound, + ) async { + List metrics = []; final Dio client = await getClient(); try { - final Response response = await client.get('/droplets/$serverId'); - final droplet = response.data!['droplet']; - metadata = [ - ServerMetadataEntity( - type: MetadataType.id, - name: 'server.server_id'.tr(), - value: droplet['id'].toString(), - ), - ServerMetadataEntity( - type: MetadataType.status, - name: 'server.status'.tr(), - value: droplet['status'].toString().capitalize(), - ), - ServerMetadataEntity( - type: MetadataType.cpu, - name: 'server.cpu'.tr(), - value: 'server.core_count'.plural(droplet['vcpus']), - ), - ServerMetadataEntity( - type: MetadataType.ram, - name: 'server.ram'.tr(), - value: "${droplet['memory'].toString()} MB", - ), - ServerMetadataEntity( - type: MetadataType.cost, - name: 'server.monthly_cost'.tr(), - value: droplet['size']['price_monthly'].toString(), - ), - ServerMetadataEntity( - type: MetadataType.location, - name: 'server.location'.tr(), - value: - '${droplet['region']['name']} ${getEmojiFlag(droplet['region']['slug'].toString()) ?? ''}', - ), - ServerMetadataEntity( - type: MetadataType.other, - name: 'server.provider'.tr(), - value: displayProviderName, - ), - ]; + final Response response = await client.get( + '/monitoring/metrics/droplet/bandwidth', + queryParameters: { + 'start': '${(start.microsecondsSinceEpoch / 1000000).round()}', + 'end': '${(end.microsecondsSinceEpoch / 1000000).round()}', + 'host_id': '$serverId', + 'interface': 'public', + 'direction': isInbound ? 'inbound' : 'outbound', + }, + ); + metrics = response.data['data']['result'][0]['values']; } catch (e) { print(e); + return GenericResult( + success: false, + data: [], + message: e.toString(), + ); } finally { close(client); } - return metadata; + return GenericResult(success: true, data: metrics); } - @override - Future> getServers() async { - List servers = []; + Future> getServers() async { + List servers = []; final Dio client = await getClient(); try { final Response response = await client.get('/droplets'); - servers = response.data!['droplets'].map( - (final server) { - String ipv4 = '0.0.0.0'; - if (server['networks']['v4'].isNotEmpty) { - for (final v4 in server['networks']['v4']) { - if (v4['type'].toString() == 'public') { - ipv4 = v4['ip_address'].toString(); - } - } - } - - return ServerBasicInfo( - id: server['id'], - reverseDns: server['name'], - created: DateTime.now(), - ip: ipv4, - name: server['name'], - ); - }, - ).toList(); + servers = response.data; } catch (e) { print(e); + return GenericResult( + success: false, + data: servers, + message: e.toString(), + ); } finally { close(client); } - print(servers); - return servers; + return GenericResult(success: true, data: servers); } Future> getAvailableLocations() async { @@ -769,21 +642,4 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { return GenericResult(data: types, success: true); } - - @override - Future> createReverseDns({ - required final ServerHostingDetails serverDetails, - required final ServerDomain domain, - }) async { - /// TODO remove from provider interface - const bool success = true; - return GenericResult(success: success, data: null); - } - - @override - ProviderApiTokenValidation getApiTokenValidation() => - ProviderApiTokenValidation( - regexp: RegExp(r'\s+|[-!$%^&*()@+|~=`{}\[\]:<>?,.\/]'), - length: 71, - ); } diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart index 42ec94bb..d1051b76 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart @@ -455,10 +455,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { close(client); } - return GenericResult( - success: true, - data: null, - ); + return GenericResult(success: true, data: null); } Future> powerOn(final int serverId) async { @@ -476,10 +473,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { close(client); } - return GenericResult( - success: true, - data: null, - ); + return GenericResult(success: true, data: null); } Future>> getMetrics( diff --git a/lib/logic/providers/server_providers/digital_ocean.dart b/lib/logic/providers/server_providers/digital_ocean.dart index d94418cd..9538c6a4 100644 --- a/lib/logic/providers/server_providers/digital_ocean.dart +++ b/lib/logic/providers/server_providers/digital_ocean.dart @@ -1,7 +1,13 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart'; +import 'package:selfprivacy/logic/models/disk_size.dart'; +import 'package:selfprivacy/logic/models/metrics.dart'; +import 'package:selfprivacy/logic/models/price.dart'; +import 'package:selfprivacy/logic/models/server_basic_info.dart'; +import 'package:selfprivacy/logic/models/server_metadata.dart'; import 'package:selfprivacy/logic/models/server_provider_location.dart'; import 'package:selfprivacy/logic/models/server_type.dart'; import 'package:selfprivacy/logic/providers/server_provider.dart'; +import 'package:selfprivacy/utils/extensions/string_extensions.dart'; class ApiAdapter { ApiAdapter({final String? region, final bool isWithToken = true}) @@ -149,7 +155,7 @@ class DigitalOceanServerProvider extends ServerProvider { ); } - final List rawTypes = result.data; + final List rawSizes = result.data; for (final rawSize in rawSizes) { for (final rawRegion in rawSize['regions']) { final ramMb = rawSize['memory'].toDouble(); @@ -174,4 +180,243 @@ class DigitalOceanServerProvider extends ServerProvider { return GenericResult(success: true, data: types); } + + Future>> getServers() async { + final List servers = []; + final result = await _adapter.api().getServers(); + if (result.data.isEmpty || !result.success) { + return GenericResult( + success: result.success, + data: servers, + code: result.code, + message: result.message, + ); + } + + final List rawServers = result.data; + rawServers.map( + (final server) { + String ipv4 = '0.0.0.0'; + if (server['networks']['v4'].isNotEmpty) { + for (final v4 in server['networks']['v4']) { + if (v4['type'].toString() == 'public') { + ipv4 = v4['ip_address'].toString(); + } + } + } + + return ServerBasicInfo( + id: server['id'], + reverseDns: server['name'], + created: DateTime.now(), + ip: ipv4, + name: server['name'], + ); + }, + ).toList(); + + return GenericResult(success: true, data: servers); + } + + Future>> getMetadata( + final int serverId, + ) async { + List metadata = []; + final result = await _adapter.api().getServers(); + if (result.data.isEmpty || !result.success) { + return GenericResult( + success: false, + data: metadata, + code: result.code, + message: result.message, + ); + } + + final List servers = result.data; + try { + final droplet = servers.firstWhere( + (final server) => server['id'] == serverId, + ); + + metadata = [ + ServerMetadataEntity( + type: MetadataType.id, + trId: 'server.server_id', + value: droplet['id'].toString(), + ), + ServerMetadataEntity( + type: MetadataType.status, + trId: 'server.status', + value: droplet['status'].toString().capitalize(), + ), + ServerMetadataEntity( + type: MetadataType.cpu, + trId: 'server.cpu', + value: droplet['vcpus'].toString(), + ), + ServerMetadataEntity( + type: MetadataType.ram, + trId: 'server.ram', + value: "${droplet['memory'].toString()} MB", + ), + ServerMetadataEntity( + type: MetadataType.cost, + trId: 'server.monthly_cost', + value: droplet['size']['price_monthly'].toString(), + ), + ServerMetadataEntity( + type: MetadataType.location, + trId: 'server.location', + value: + '${droplet['region']['name']} ${getEmojiFlag(droplet['region']['slug'].toString()) ?? ''}', + ), + ServerMetadataEntity( + type: MetadataType.other, + trId: 'server.provider', + value: _adapter.api().displayProviderName, + ), + ]; + } catch (e) { + return GenericResult( + success: false, + data: [], + message: e.toString(), + ); + } + + return GenericResult(success: true, data: metadata); + } + + /// Digital Ocean returns a map of lists of /proc/stat values, + /// so here we are trying to implement average CPU + /// load calculation for each point in time on a given interval. + /// + /// For each point of time: + /// + /// `Average Load = 100 * (1 - (Idle Load / Total Load))` + /// + /// For more info please proceed to read: + /// https://rosettacode.org/wiki/Linux_CPU_utilization + List calculateCpuLoadMetrics(final List rawProcStatMetrics) { + final List cpuLoads = []; + + final int pointsInTime = (rawProcStatMetrics[0]['values'] as List).length; + for (int i = 0; i < pointsInTime; ++i) { + double currentMetricLoad = 0.0; + double? currentMetricIdle; + for (final rawProcStat in rawProcStatMetrics) { + final String rawProcValue = rawProcStat['values'][i][1]; + // Converting MBit into bit + final double procValue = double.parse(rawProcValue) * 1000000; + currentMetricLoad += procValue; + if (currentMetricIdle == null && + rawProcStat['metric']['mode'] == 'idle') { + currentMetricIdle = procValue; + } + } + currentMetricIdle ??= 0.0; + currentMetricLoad = 100.0 * (1 - (currentMetricIdle / currentMetricLoad)); + cpuLoads.add( + TimeSeriesData( + rawProcStatMetrics[0]['values'][i][0], + currentMetricLoad, + ), + ); + } + + return cpuLoads; + } + + @override + Future> getMetrics( + final int serverId, + final DateTime start, + final DateTime end, + ) async { + ServerMetrics? metrics; + + const int step = 15; + final inboundResult = await _adapter.api().getMetricsBandwidth( + serverId, + start, + end, + true, + ); + + if (inboundResult.data.isEmpty || !inboundResult.success) { + return GenericResult( + success: false, + data: null, + code: inboundResult.code, + message: inboundResult.message, + ); + } + + final outboundResult = await _adapter.api().getMetricsBandwidth( + serverId, + start, + end, + false, + ); + + if (outboundResult.data.isEmpty || !outboundResult.success) { + return GenericResult( + success: false, + data: null, + code: outboundResult.code, + message: outboundResult.message, + ); + } + + final cpuResult = await _adapter.api().getMetricsCpu(serverId, start, end); + + if (cpuResult.data.isEmpty || !cpuResult.success) { + return GenericResult( + success: false, + data: null, + code: cpuResult.code, + message: cpuResult.message, + ); + } + + metrics = ServerMetrics( + bandwidthIn: inboundResult.data + .map( + (final el) => TimeSeriesData(el[0], double.parse(el[1]) * 100000), + ) + .toList(), + bandwidthOut: outboundResult.data + .map( + (final el) => TimeSeriesData(el[0], double.parse(el[1]) * 100000), + ) + .toList(), + cpu: calculateCpuLoadMetrics(cpuResult.data), + start: start, + end: end, + stepsInSecond: step, + ); + + return GenericResult(success: true, data: metrics); + } + + @override + Future> restart(final int serverId) async { + DateTime? timestamp; + final result = await _adapter.api().restart(serverId); + if (!result.success) { + return GenericResult( + success: false, + data: timestamp, + code: result.code, + message: result.message, + ); + } + + timestamp = DateTime.now(); + + return GenericResult( + success: true, + data: timestamp, + ); + } } diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index 43d60aec..41669a76 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -173,16 +173,6 @@ class HetznerServerProvider extends ServerProvider { return GenericResult(success: true, data: types); } - Future> createReverseDns({ - required final ServerHostingDetails serverDetails, - required final ServerDomain domain, - }) async => - _adapter.api().createReverseDns( - serverId: serverDetails.id, - ip4: serverDetails.ip4, - dnsPtr: domain.domainName, - ); - Future>> getServers() async { final List servers = []; final result = await _adapter.api().getServers(); From bc9ab447f0e1478677a98699aee412e28fad7a36 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Thu, 9 Mar 2023 13:06:15 +0400 Subject: [PATCH 27/96] chore: Implement server deletion for hetzner on provider layer --- .../server_providers/hetzner/hetzner_api.dart | 60 +++++++++---------- .../providers/server_providers/hetzner.dart | 60 ++++++++++++++++++- 2 files changed, 85 insertions(+), 35 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart index d1051b76..65e509c4 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart @@ -244,15 +244,25 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { return volume; } - Future deleteVolume(final ServerVolume volume) async { + Future> deleteVolume(final int volumeId) async { final Dio client = await getClient(); try { - await client.delete('/volumes/${volume.id}'); + await client.delete('/volumes/$volumeId'); } catch (e) { print(e); + return GenericResult( + success: false, + data: null, + message: e.toString(), + ); } finally { client.close(); } + + return GenericResult( + success: true, + data: null, + ); } Future> attachVolume( @@ -287,24 +297,32 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { ); } - Future detachVolume(final ServerVolume volume) async { + Future> detachVolume(final int volumeId) async { bool success = false; final Response detachVolumeResponse; final Dio client = await getClient(); try { detachVolumeResponse = await client.post( - '/volumes/${volume.id}/actions/detach', + '/volumes/$volumeId/actions/detach', ); success = detachVolumeResponse.data['action']['status'].toString() != 'error'; } catch (e) { print(e); + return GenericResult( + success: false, + data: false, + message: e.toString(), + ); } finally { client.close(); } - return success; + return GenericResult( + success: false, + data: success, + ); } Future resizeVolume( @@ -398,46 +416,24 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { ); } - Future> deleteServer({ - required final String domainName, + Future> deleteServer({ + required final int serverId, }) async { final Dio client = await getClient(); try { - final String hostname = getHostnameFromDomain(domainName); - - final Response serversReponse = await client.get('/servers'); - final List servers = serversReponse.data['servers']; - final Map server = - servers.firstWhere((final el) => el['name'] == hostname); - final List volumes = server['volumes']; - final List laterFutures = []; - - for (final volumeId in volumes) { - await client.post('/volumes/$volumeId/actions/detach'); - } - await Future.delayed(const Duration(seconds: 10)); - - for (final volumeId in volumes) { - laterFutures.add(client.delete('/volumes/$volumeId')); - } - laterFutures.add(client.delete('/servers/${server['id']}')); - - await Future.wait(laterFutures); + await client.delete('/servers/$serverId'); } catch (e) { print(e); return GenericResult( success: false, - data: false, + data: null, message: e.toString(), ); } finally { close(client); } - return GenericResult( - success: true, - data: true, - ); + return GenericResult(success: true, data: null); } Future> restart(final int serverId) async { diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index 41669a76..1a1c2524 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -455,7 +455,7 @@ class HetznerServerProvider extends ServerProvider { ); if (!serverResult.success || serverResult.data == null) { - await _adapter.api().deleteVolume(volume); + await _adapter.api().deleteVolume(volume.id); await Future.delayed(const Duration(seconds: 5)); if (serverResult.message != null && serverResult.message == 'uniqueness_error') { @@ -549,7 +549,7 @@ class HetznerServerProvider extends ServerProvider { CallbackDialogueChoice( title: 'basis.try_again'.tr(), callback: () async { - await _adapter.api().deleteVolume(volume); + await _adapter.api().deleteVolume(volume.id); await Future.delayed(const Duration(seconds: 5)); final deletion = await deleteServer(hostname); if (deletion.success) { @@ -576,5 +576,59 @@ class HetznerServerProvider extends ServerProvider { Future> deleteServer( final String hostname, - ) async {} + ) async { + final serversResult = await _adapter.api().getServers(); + try { + final servers = serversResult.data; + HetznerServerInfo? foundServer; + for (final server in servers) { + if (server.name == hostname) { + foundServer = server; + break; + } + } + + for (final volumeId in foundServer!.volumes) { + await _adapter.api().detachVolume(volumeId); + } + + await Future.delayed(const Duration(seconds: 10)); + final List laterFutures = []; + + for (final volumeId in foundServer.volumes) { + laterFutures.add(_adapter.api().deleteVolume(volumeId)); + } + laterFutures.add(_adapter.api().deleteVolume(foundServer.id)); + + await Future.wait(laterFutures); + } catch (e) { + print(e); + return GenericResult( + success: false, + data: CallbackDialogueBranching( + choices: [ + CallbackDialogueChoice( + title: 'basis.cancel'.tr(), + callback: null, + ), + CallbackDialogueChoice( + title: 'basis.try_again'.tr(), + callback: () async { + await Future.delayed(const Duration(seconds: 5)); + return deleteServer(hostname); + }, + ), + ], + description: 'modals.try_again'.tr(), + title: 'modals.server_deletion_error'.tr(), + ), + message: e.toString(), + ); + } + + return GenericResult( + success: true, + data: null, + ); + } } From 7b543f9030221e2d7892cb1925efc7f734e1e3fe Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 10 Mar 2023 00:47:02 +0400 Subject: [PATCH 28/96] chore: Implement server deletion for digital ocean on provider level --- .../digital_ocean/digital_ocean_api.dart | 50 ++------------- .../server_providers/digital_ocean.dart | 64 +++++++++++++++++++ .../providers/server_providers/hetzner.dart | 2 +- 3 files changed, 69 insertions(+), 47 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart index 3f886597..fabeac24 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart @@ -402,64 +402,22 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { ); } - @override - Future> deleteServer({ - required final String domainName, - }) async { + Future> deleteServer(final int serverId) async { final Dio client = await getClient(); - - final String hostname = getHostnameFromDomain(domainName); - final servers = await getServers(); - final ServerBasicInfo serverToRemove; try { - serverToRemove = servers.firstWhere( - (final el) => el.name == hostname, - ); - } catch (e) { - print(e); - return GenericResult( - data: false, - success: false, - message: e.toString(), - ); - } - - final volumes = await getVolumes(); - final ServerVolume volumeToRemove; - try { - volumeToRemove = volumes.firstWhere( - (final el) => el.serverId == serverToRemove.id, - ); - } catch (e) { - print(e); - return GenericResult( - data: false, - success: false, - message: e.toString(), - ); - } - - final List laterFutures = []; - - await detachVolume(volumeToRemove); - await Future.delayed(const Duration(seconds: 10)); - - try { - laterFutures.add(deleteVolume(volumeToRemove)); - laterFutures.add(client.delete('/droplets/${serverToRemove.id}')); - await Future.wait(laterFutures); + await client.delete('/droplets/$serverId'); } catch (e) { print(e); return GenericResult( success: false, - data: false, + data: null, message: e.toString(), ); } finally { close(client); } - return GenericResult(success: true, data: true); + return GenericResult(success: true, data: null); } Future> restart(final int serverId) async { diff --git a/lib/logic/providers/server_providers/digital_ocean.dart b/lib/logic/providers/server_providers/digital_ocean.dart index 9538c6a4..b8bc3ab1 100644 --- a/lib/logic/providers/server_providers/digital_ocean.dart +++ b/lib/logic/providers/server_providers/digital_ocean.dart @@ -1,5 +1,8 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart'; +import 'package:selfprivacy/logic/models/callback_dialogue_branching.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; +import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/metrics.dart'; import 'package:selfprivacy/logic/models/price.dart'; import 'package:selfprivacy/logic/models/server_basic_info.dart'; @@ -8,6 +11,7 @@ import 'package:selfprivacy/logic/models/server_provider_location.dart'; import 'package:selfprivacy/logic/models/server_type.dart'; import 'package:selfprivacy/logic/providers/server_provider.dart'; import 'package:selfprivacy/utils/extensions/string_extensions.dart'; +import 'package:selfprivacy/utils/network_utils.dart'; class ApiAdapter { ApiAdapter({final String? region, final bool isWithToken = true}) @@ -419,4 +423,64 @@ class DigitalOceanServerProvider extends ServerProvider { data: timestamp, ); } + + Future> deleteServer( + final String hostname, + ) async { + final String deletionName = getHostnameFromDomain(hostname); + final serversResult = await getServers(); + try { + final servers = serversResult.data; + ServerBasicInfo? foundServer; + for (final server in servers) { + if (server.name == deletionName) { + foundServer = server; + break; + } + } + + final volumes = await _adapter.api().getVolumes(); + final ServerVolume volumeToRemove; + volumeToRemove = volumes.firstWhere( + (final el) => el.serverId == foundServer!.id, + ); + + await _adapter.api().detachVolume(volumeToRemove); + + await Future.delayed(const Duration(seconds: 10)); + final List laterFutures = []; + laterFutures.add(_adapter.api().deleteVolume(volumeToRemove)); + laterFutures.add(_adapter.api().deleteServer(foundServer!.id)); + + await Future.wait(laterFutures); + } catch (e) { + print(e); + return GenericResult( + success: false, + data: CallbackDialogueBranching( + choices: [ + CallbackDialogueChoice( + title: 'basis.cancel'.tr(), + callback: null, + ), + CallbackDialogueChoice( + title: 'basis.try_again'.tr(), + callback: () async { + await Future.delayed(const Duration(seconds: 5)); + return deleteServer(hostname); + }, + ), + ], + description: 'modals.try_again'.tr(), + title: 'modals.server_deletion_error'.tr(), + ), + message: e.toString(), + ); + } + + return GenericResult( + success: true, + data: null, + ); + } } diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index 1a1c2524..400701ff 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -598,7 +598,7 @@ class HetznerServerProvider extends ServerProvider { for (final volumeId in foundServer.volumes) { laterFutures.add(_adapter.api().deleteVolume(volumeId)); } - laterFutures.add(_adapter.api().deleteVolume(foundServer.id)); + laterFutures.add(_adapter.api().deleteServer(serverId: foundServer.id)); await Future.wait(laterFutures); } catch (e) { From dde6f7e80d20a68bb838970f22e09fda50a08ccf Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 20 Mar 2023 12:22:43 -0300 Subject: [PATCH 29/96] chore: Move volume functions to provider layer for Hetzner --- .../server_providers/hetzner/hetzner_api.dart | 60 +++------ .../providers/server_providers/hetzner.dart | 120 ++++++++++++++++++ 2 files changed, 140 insertions(+), 40 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart index 65e509c4..8e67b188 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart @@ -11,7 +11,6 @@ import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; import 'package:selfprivacy/logic/models/price.dart'; import 'package:selfprivacy/logic/models/server_provider_location.dart'; -import 'package:selfprivacy/utils/network_utils.dart'; import 'package:selfprivacy/utils/password_generator.dart'; class HetznerApi extends ServerProviderApi with VolumeProviderApi { @@ -129,9 +128,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { ); } - Future> createVolume() async { - ServerVolume? volume; - + Future createVolume() async { Response? createVolumeResponse; final Dio client = await getClient(); try { @@ -146,18 +143,6 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { 'format': 'ext4' }, ); - final volumeId = createVolumeResponse.data['volume']['id']; - final volumeSize = createVolumeResponse.data['volume']['size']; - final volumeServer = createVolumeResponse.data['volume']['server']; - final volumeName = createVolumeResponse.data['volume']['name']; - final volumeDevice = createVolumeResponse.data['volume']['linux_device']; - volume = ServerVolume( - id: volumeId, - name: volumeName, - sizeByte: volumeSize, - serverId: volumeServer, - linuxDevice: volumeDevice, - ); } catch (e) { print(e); return GenericResult( @@ -170,17 +155,17 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { } return GenericResult( - data: volume, + data: createVolumeResponse.data, success: true, code: createVolumeResponse.statusCode, message: createVolumeResponse.statusMessage, ); } - Future> getVolumes({final String? status}) async { - final List volumes = []; + Future> getVolumes({final String? status}) async { + List volumes = []; - final Response getVolumesResonse; + Response? getVolumesResonse; final Dio client = await getClient(); try { getVolumesResonse = await client.get( @@ -189,29 +174,24 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { 'status': status, }, ); - final List rawVolumes = getVolumesResonse.data['volumes']; - for (final rawVolume in rawVolumes) { - final int volumeId = rawVolume['id']; - final int volumeSize = rawVolume['size'] * 1024 * 1024 * 1024; - final volumeServer = rawVolume['server']; - final String volumeName = rawVolume['name']; - final volumeDevice = rawVolume['linux_device']; - final volume = ServerVolume( - id: volumeId, - name: volumeName, - sizeByte: volumeSize, - serverId: volumeServer, - linuxDevice: volumeDevice, - ); - volumes.add(volume); - } + volumes = getVolumesResonse.data['volumes']; } catch (e) { print(e); + return GenericResult( + data: [], + success: false, + message: e.toString(), + ); } finally { client.close(); } - return volumes; + return GenericResult( + data: volumes, + success: true, + code: getVolumesResonse.statusCode, + message: getVolumesResonse.statusMessage, + ); } Future getVolume( @@ -244,7 +224,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { return volume; } - Future> deleteVolume(final int volumeId) async { + Future> deleteVolume(final int volumeId) async { final Dio client = await getClient(); try { await client.delete('/volumes/$volumeId'); @@ -252,7 +232,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { print(e); return GenericResult( success: false, - data: null, + data: false, message: e.toString(), ); } finally { @@ -261,7 +241,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { return GenericResult( success: true, - data: null, + data: true, ); } diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index 400701ff..33894f3d 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -631,4 +631,124 @@ class HetznerServerProvider extends ServerProvider { data: null, ); } + + Future> createVolume() async { + ServerVolume? volume; + + final result = await _adapter.api().createVolume(); + + if (!result.success || result.data == null) { + return GenericResult( + data: null, + success: false, + message: result.message, + code: result.code, + ); + } + + try { + final volumeId = result.data['volume']['id']; + final volumeSize = result.data['volume']['size']; + final volumeServer = result.data['volume']['server']; + final volumeName = result.data['volume']['name']; + final volumeDevice = result.data['volume']['linux_device']; + volume = ServerVolume( + id: volumeId, + name: volumeName, + sizeByte: volumeSize, + serverId: volumeServer, + linuxDevice: volumeDevice, + ); + } catch (e) { + print(e); + return GenericResult( + data: null, + success: false, + message: e.toString(), + ); + } + + return GenericResult( + data: volume, + success: true, + code: result.code, + message: result.message, + ); + } + + Future>> getVolumes({ + final String? status, + }) async { + final List volumes = []; + + final result = await _adapter.api().getVolumes(); + + if (!result.success) { + return GenericResult( + data: [], + success: false, + message: result.message, + code: result.code, + ); + } + + try { + for (final rawVolume in result.data) { + final int volumeId = rawVolume['id']; + final int volumeSize = rawVolume['size'] * 1024 * 1024 * 1024; + final volumeServer = rawVolume['server']; + final String volumeName = rawVolume['name']; + final volumeDevice = rawVolume['linux_device']; + final volume = ServerVolume( + id: volumeId, + name: volumeName, + sizeByte: volumeSize, + serverId: volumeServer, + linuxDevice: volumeDevice, + ); + volumes.add(volume); + } + } catch (e) { + return GenericResult( + data: [], + success: false, + message: e.toString(), + ); + } + + return GenericResult( + data: volumes, + success: true, + code: result.code, + message: result.message, + ); + } + + Future> deleteVolume(final int volumeId) async => + _adapter.api().deleteVolume(volumeId); + + Future> attachVolume( + final ServerVolume volume, + final int serverId, + ) async => + _adapter.api().attachVolume( + volume, + serverId, + ); + + Future> detachVolume( + final int volumeId, + ) async => + _adapter.api().detachVolume( + volumeId, + ); + + Future resizeVolume( + final ServerVolume volume, + final DiskSize size, + ) async => + _adapter.api().resizeVolume( + volume, + size, + ); } From 4e4b61609fc9a61fe86bb294e30d9c7f97893e78 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 21 Mar 2023 13:08:46 -0300 Subject: [PATCH 30/96] chore: Move volume functions to provider layer for Digital Ocean --- .../digital_ocean/digital_ocean_api.dart | 119 ++++++------- .../server_providers/digital_ocean.dart | 163 +++++++++++++++++- 2 files changed, 215 insertions(+), 67 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart index fabeac24..0d25dc2b 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart @@ -107,13 +107,10 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { currency: 'USD', ); - Future> createVolume() async { - ServerVolume? volume; - + Future createVolume() async { Response? createVolumeResponse; final Dio client = await getClient(); try { - final List volumes = await getVolumes(); await Future.delayed(const Duration(seconds: 6)); createVolumeResponse = await client.post( @@ -126,17 +123,6 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { 'filesystem_type': 'ext4', }, ); - final volumeId = createVolumeResponse.data['volume']['id']; - final volumeSize = createVolumeResponse.data['volume']['size_gigabytes']; - final volumeName = createVolumeResponse.data['volume']['name']; - volume = ServerVolume( - id: volumes.length, - name: volumeName, - sizeByte: volumeSize, - serverId: null, - linuxDevice: '/dev/disk/by-id/scsi-0DO_Volume_$volumeName', - uuid: volumeId, - ); } catch (e) { print(e); return GenericResult( @@ -149,17 +135,17 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { } return GenericResult( - data: volume, + data: createVolumeResponse.data, success: true, code: createVolumeResponse.statusCode, message: createVolumeResponse.statusMessage, ); } - Future> getVolumes({final String? status}) async { - final List volumes = []; + Future> getVolumes({final String? status}) async { + List volumes = []; - final Response getVolumesResponse; + Response? getVolumesResponse; final Dio client = await getClient(); try { getVolumesResponse = await client.get( @@ -168,59 +154,47 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { 'status': status, }, ); - final List rawVolumes = getVolumesResponse.data['volumes']; - int id = 0; - for (final rawVolume in rawVolumes) { - final volumeId = rawVolume['id']; - final int volumeSize = rawVolume['size_gigabytes'] * 1024 * 1024 * 1024; - final volumeDropletIds = rawVolume['droplet_ids']; - final String volumeName = rawVolume['name']; - final volume = ServerVolume( - id: id++, - name: volumeName, - sizeByte: volumeSize, - serverId: volumeDropletIds.isNotEmpty ? volumeDropletIds[0] : null, - linuxDevice: 'scsi-0DO_Volume_$volumeName', - uuid: volumeId, - ); - volumes.add(volume); - } + volumes = getVolumesResponse.data['volumes']; } catch (e) { print(e); + return GenericResult( + data: [], + success: false, + message: e.toString(), + ); } finally { client.close(); } - return volumes; + return GenericResult( + data: volumes, + success: false, + ); } - Future getVolume(final String volumeUuid) async { - ServerVolume? requestedVolume; - - final List volumes = await getVolumes(); - - for (final volume in volumes) { - if (volume.uuid == volumeUuid) { - requestedVolume = volume; - } - } - - return requestedVolume; - } - - Future deleteVolume(final ServerVolume volume) async { + Future> deleteVolume(final String uuid) async { final Dio client = await getClient(); try { - await client.delete('/volumes/${volume.uuid}'); + await client.delete('/volumes/$uuid'); } catch (e) { print(e); + return GenericResult( + data: null, + success: false, + message: e.toString(), + ); } finally { client.close(); } + + return GenericResult( + data: null, + success: true, + ); } Future> attachVolume( - final ServerVolume volume, + final String name, final int serverId, ) async { bool success = false; @@ -232,7 +206,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { '/volumes/actions', data: { 'type': 'attach', - 'volume_name': volume.name, + 'volume_name': name, 'region': region, 'droplet_id': serverId, }, @@ -258,7 +232,10 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { ); } - Future detachVolume(final ServerVolume volume) async { + Future> detachVolume( + final String name, + final int serverId, + ) async { bool success = false; final Response detachVolumeResponse; @@ -268,8 +245,8 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { '/volumes/actions', data: { 'type': 'detach', - 'volume_name': volume.name, - 'droplet_id': volume.serverId, + 'volume_name': name, + 'droplet_id': serverId, 'region': region, }, ); @@ -277,15 +254,23 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { detachVolumeResponse.data['action']['status'].toString() != 'error'; } catch (e) { print(e); + return GenericResult( + data: false, + success: false, + message: e.toString(), + ); } finally { client.close(); } - return success; + return GenericResult( + data: success, + success: true, + ); } - Future resizeVolume( - final ServerVolume volume, + Future> resizeVolume( + final String name, final DiskSize size, ) async { bool success = false; @@ -297,7 +282,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { '/volumes/actions', data: { 'type': 'resize', - 'volume_name': volume.name, + 'volume_name': name, 'size_gigabytes': size.gibibyte, 'region': region, }, @@ -306,11 +291,19 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { resizeVolumeResponse.data['action']['status'].toString() != 'error'; } catch (e) { print(e); + return GenericResult( + data: false, + success: false, + message: e.toString(), + ); } finally { client.close(); } - return success; + return GenericResult( + data: success, + success: true, + ); } Future> createServer({ diff --git a/lib/logic/providers/server_providers/digital_ocean.dart b/lib/logic/providers/server_providers/digital_ocean.dart index b8bc3ab1..df7af648 100644 --- a/lib/logic/providers/server_providers/digital_ocean.dart +++ b/lib/logic/providers/server_providers/digital_ocean.dart @@ -439,17 +439,20 @@ class DigitalOceanServerProvider extends ServerProvider { } } - final volumes = await _adapter.api().getVolumes(); + final volumes = await getVolumes(); final ServerVolume volumeToRemove; - volumeToRemove = volumes.firstWhere( + volumeToRemove = volumes.data.firstWhere( (final el) => el.serverId == foundServer!.id, ); - await _adapter.api().detachVolume(volumeToRemove); + await _adapter.api().detachVolume( + volumeToRemove.name, + volumeToRemove.serverId!, + ); await Future.delayed(const Duration(seconds: 10)); final List laterFutures = []; - laterFutures.add(_adapter.api().deleteVolume(volumeToRemove)); + laterFutures.add(_adapter.api().deleteVolume(volumeToRemove.uuid!)); laterFutures.add(_adapter.api().deleteServer(foundServer!.id)); await Future.wait(laterFutures); @@ -483,4 +486,156 @@ class DigitalOceanServerProvider extends ServerProvider { data: null, ); } + + Future>> getVolumes({ + final String? status, + }) async { + final List volumes = []; + + final result = await _adapter.api().getVolumes(); + + if (!result.success || result.data.isEmpty) { + return GenericResult( + data: [], + success: false, + code: result.code, + message: result.message, + ); + } + + try { + int id = 0; + for (final rawVolume in result.data) { + final volumeId = rawVolume['id']; + final int volumeSize = rawVolume['size_gigabytes'] * 1024 * 1024 * 1024; + final volumeDropletIds = rawVolume['droplet_ids']; + final String volumeName = rawVolume['name']; + final volume = ServerVolume( + id: id++, + name: volumeName, + sizeByte: volumeSize, + serverId: volumeDropletIds.isNotEmpty ? volumeDropletIds[0] : null, + linuxDevice: 'scsi-0DO_Volume_$volumeName', + uuid: volumeId, + ); + volumes.add(volume); + } + } catch (e) { + print(e); + return GenericResult( + data: [], + success: false, + message: e.toString(), + ); + } + + return GenericResult( + data: volumes, + success: true, + ); + } + + Future> createVolume() async { + ServerVolume? volume; + + final result = await _adapter.api().createVolume(); + + if (!result.success || result.data == null) { + return GenericResult( + data: null, + success: false, + code: result.code, + message: result.message, + ); + } + + final getVolumesResult = await _adapter.api().getVolumes(); + + if (!getVolumesResult.success || getVolumesResult.data.isEmpty) { + return GenericResult( + data: null, + success: false, + code: result.code, + message: result.message, + ); + } + + final volumeId = result.data['volume']['id']; + final volumeSize = result.data['volume']['size_gigabytes']; + final volumeName = result.data['volume']['name']; + volume = ServerVolume( + id: getVolumesResult.data.length, + name: volumeName, + sizeByte: volumeSize, + serverId: null, + linuxDevice: '/dev/disk/by-id/scsi-0DO_Volume_$volumeName', + uuid: volumeId, + ); + + return GenericResult( + data: volume, + success: true, + ); + } + + Future> getVolume( + final String volumeUuid, + ) async { + ServerVolume? requestedVolume; + + final result = await getVolumes(); + + if (!result.success || result.data.isEmpty) { + return GenericResult( + data: null, + success: false, + code: result.code, + message: result.message, + ); + } + + for (final volume in result.data) { + if (volume.uuid == volumeUuid) { + requestedVolume = volume; + } + } + + return GenericResult( + data: requestedVolume, + success: true, + ); + } + + Future> deleteVolume( + final ServerVolume volume, + ) async => + _adapter.api().deleteVolume( + volume.uuid!, + ); + + Future> attachVolume( + final ServerVolume volume, + final int serverId, + ) async => + _adapter.api().attachVolume( + volume.name, + serverId, + ); + + Future> detachVolume( + final ServerVolume volume, + ) async => + _adapter.api().detachVolume( + volume.name, + volume.serverId!, + ); + + Future> resizeVolume( + final ServerVolume volume, + final DiskSize size, + ) async => + _adapter.api().resizeVolume( + volume.name, + size, + ); } From 7b2540640fd9ab133e4eac7dde06de472514651a Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 22 Mar 2023 21:28:16 -0300 Subject: [PATCH 31/96] chore: Rewrite server installation function on api level for Digital Ocean --- .../digital_ocean/digital_ocean_api.dart | 56 ++++++++++++++++- lib/logic/providers/server_provider.dart | 1 + .../server_providers/digital_ocean.dart | 60 +++++++++++++++++++ 3 files changed, 116 insertions(+), 1 deletion(-) diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart index 0d25dc2b..264f227d 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart @@ -306,7 +306,61 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { ); } - Future> createServer({ + Future createServer({ + required final String dnsApiToken, + required final String dnsProviderType, + required final String serverApiToken, + required final User rootUser, + required final String base64Password, + required final String databasePassword, + required final String domainName, + required final String hostName, + required final int volumeId, + required final String serverType, + }) async { + final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false'; + + Response? serverCreateResponse; + final Dio client = await getClient(); + try { + final Map data = { + 'name': hostName, + 'size': serverType, + 'image': 'ubuntu-20-04-x64', + 'user_data': '#cloud-config\n' + 'runcmd:\n' + '- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/providers/digital-ocean/nixos-infect | ' + "PROVIDER=$infectProviderName DNS_PROVIDER_TYPE=$dnsProviderType STAGING_ACME='$stagingAcme' DOMAIN='$domainName' " + "LUSER='${rootUser.login}' ENCODED_PASSWORD='$base64Password' CF_TOKEN=$dnsApiToken DB_PASSWORD=$databasePassword " + 'API_TOKEN=$serverApiToken HOSTNAME=$hostName bash 2>&1 | tee /tmp/infect.log', + 'region': region!, + }; + print('Decoded data: $data'); + + serverCreateResponse = await client.post( + '/droplets', + data: data, + ); + } catch (e) { + print(e); + return GenericResult( + success: false, + data: null, + message: e.toString(), + ); + } finally { + close(client); + } + + return GenericResult( + data: serverCreateResponse, + success: true, + code: serverCreateResponse.statusCode, + message: serverCreateResponse.statusMessage, + ); + } + + Future> creatfgdfeServer({ required final String dnsApiToken, required final User rootUser, required final String domainName, diff --git a/lib/logic/providers/server_provider.dart b/lib/logic/providers/server_provider.dart index 519307e8..7a2f4a02 100644 --- a/lib/logic/providers/server_provider.dart +++ b/lib/logic/providers/server_provider.dart @@ -6,6 +6,7 @@ import 'package:selfprivacy/logic/models/server_provider_location.dart'; import 'package:selfprivacy/logic/models/server_type.dart'; export 'package:selfprivacy/logic/api_maps/generic_result.dart'; +export 'package:selfprivacy/logic/models/launch_installation_data.dart'; abstract class ServerProvider { Future> trySetServerLocation(final String location); diff --git a/lib/logic/providers/server_providers/digital_ocean.dart b/lib/logic/providers/server_providers/digital_ocean.dart index df7af648..4393f80e 100644 --- a/lib/logic/providers/server_providers/digital_ocean.dart +++ b/lib/logic/providers/server_providers/digital_ocean.dart @@ -1,8 +1,11 @@ +import 'dart:convert'; + import 'package:easy_localization/easy_localization.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart'; import 'package:selfprivacy/logic/models/callback_dialogue_branching.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; +import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/metrics.dart'; import 'package:selfprivacy/logic/models/price.dart'; import 'package:selfprivacy/logic/models/server_basic_info.dart'; @@ -12,6 +15,7 @@ import 'package:selfprivacy/logic/models/server_type.dart'; import 'package:selfprivacy/logic/providers/server_provider.dart'; import 'package:selfprivacy/utils/extensions/string_extensions.dart'; import 'package:selfprivacy/utils/network_utils.dart'; +import 'package:selfprivacy/utils/password_generator.dart'; class ApiAdapter { ApiAdapter({final String? region, final bool isWithToken = true}) @@ -111,6 +115,62 @@ class DigitalOceanServerProvider extends ServerProvider { return emoji; } + String dnsProviderToInfectName(final DnsProviderType dnsProvider) { + String dnsProviderType; + switch (dnsProvider) { + case DnsProviderType.digitalOcean: + dnsProviderType = 'DIGITALOCEAN'; + break; + case DnsProviderType.cloudflare: + default: + dnsProviderType = 'CLOUDFLARE'; + break; + } + return dnsProviderType; + } + + @override + Future> launchInstallation( + final LaunchInstallationData installationData, + ) async { + final serverResult = await _adapter.api().createServer( + dnsApiToken: installationData.dnsApiToken, + rootUser: installationData.rootUser, + domainName: installationData.domainName, + serverType: installationData.serverTypeId, + dnsProviderType: + dnsProviderToInfectName(installationData.dnsProviderType), + hostName: getHostnameFromDomain(installationData.domainName), + base64Password: base64.encode( + utf8.encode(installationData.rootUser.password ?? 'PASS'), + ), + databasePassword: StringGenerators.dbPassword(), + serverApiToken: StringGenerators.apiToken(), + ); + + if (!serverResult.success || serverResult.data == null) { + GenericResult( + data: CallbackDialogueBranching( + choices: [ + CallbackDialogueChoice( + title: 'basis.cancel'.tr(), + callback: await installationData.errorCallback(), + ), + CallbackDialogueChoice( + title: 'basis.try_again'.tr(), + callback: () async => launchInstallation(installationData), + ), + ], + description: serverResult.message ?? 'recovering.generic_error'.tr(), + title: 'modals.unexpected_error'.tr(), + ), + success: false, + message: serverResult.message, + code: serverResult.code, + ); + } + } + @override Future>> getAvailableLocations() async { From f6591cbfc65f7d9dec193f54987afe447f4096d2 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 19 Apr 2023 10:41:30 -0300 Subject: [PATCH 32/96] chore: Implement server installation for Digital Ocean --- .../digital_ocean/digital_ocean_api.dart | 95 ------------------- .../server_providers/digital_ocean.dart | 67 ++++++++++++- 2 files changed, 65 insertions(+), 97 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart index 264f227d..f6ba941a 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart @@ -1,4 +1,3 @@ -import 'dart:convert'; import 'dart:io'; import 'package:dio/dio.dart'; @@ -7,13 +6,9 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/volume_pro import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; import 'package:selfprivacy/logic/api_maps/staging_options.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; -import 'package:selfprivacy/logic/models/hive/server_domain.dart'; -import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; import 'package:selfprivacy/logic/models/price.dart'; -import 'package:selfprivacy/logic/models/server_basic_info.dart'; import 'package:selfprivacy/logic/models/server_provider_location.dart'; -import 'package:selfprivacy/utils/network_utils.dart'; import 'package:selfprivacy/utils/password_generator.dart'; class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { @@ -315,7 +310,6 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { required final String databasePassword, required final String domainName, required final String hostName, - required final int volumeId, required final String serverType, }) async { final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false'; @@ -360,95 +354,6 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { ); } - Future> creatfgdfeServer({ - required final String dnsApiToken, - required final User rootUser, - required final String domainName, - required final String serverType, - required final DnsProviderType dnsProvider, - }) async { - ServerHostingDetails? serverDetails; - - final String dbPassword = StringGenerators.dbPassword(); - final String apiToken = StringGenerators.apiToken(); - - final String base64Password = - base64.encode(utf8.encode(rootUser.password ?? 'PASS')); - - final String formattedHostname = getHostnameFromDomain(domainName); - const String infectBranch = 'testing/digital-ocean'; - final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false'; - final String dnsProviderType = dnsProviderToInfectName(dnsProvider); - - final String userdataString = - "#cloud-config\nruncmd:\n- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/$infectBranch/nixos-infect | PROVIDER=$infectProviderName DNS_PROVIDER_TYPE=$dnsProviderType STAGING_ACME='$stagingAcme' DOMAIN='$domainName' LUSER='${rootUser.login}' ENCODED_PASSWORD='$base64Password' CF_TOKEN=$dnsApiToken DB_PASSWORD=$dbPassword API_TOKEN=$apiToken HOSTNAME=$formattedHostname bash 2>&1 | tee /tmp/infect.log"; - print(userdataString); - - Response? serverCreateResponse; - final Dio client = await getClient(); - try { - final Map data = { - 'name': formattedHostname, - 'size': serverType, - 'image': 'ubuntu-20-04-x64', - 'user_data': userdataString, - 'region': region!, - }; - print('Decoded data: $data'); - - serverCreateResponse = await client.post( - '/droplets', - data: data, - ); - - final int serverId = serverCreateResponse.data['droplet']['id']; - final ServerVolume? newVolume = (await createVolume()).data; - final bool attachedVolume = - (await attachVolume(newVolume!, serverId)).data; - - String? ipv4; - int attempts = 0; - while (attempts < 5 && ipv4 == null) { - await Future.delayed(const Duration(seconds: 20)); - final List servers = await getServers(); - for (final server in servers) { - if (server.name == formattedHostname && server.ip != '0.0.0.0') { - ipv4 = server.ip; - break; - } - } - ++attempts; - } - - if (attachedVolume && ipv4 != null) { - serverDetails = ServerHostingDetails( - id: serverId, - ip4: ipv4, - createTime: DateTime.now(), - volume: newVolume, - apiToken: apiToken, - provider: ServerProviderType.digitalOcean, - ); - } - } catch (e) { - print(e); - return GenericResult( - success: false, - data: null, - message: e.toString(), - ); - } finally { - close(client); - } - - return GenericResult( - data: serverDetails, - success: true, - code: serverCreateResponse.statusCode, - message: serverCreateResponse.statusMessage, - ); - } - Future> deleteServer(final int serverId) async { final Dio client = await getClient(); try { diff --git a/lib/logic/providers/server_providers/digital_ocean.dart b/lib/logic/providers/server_providers/digital_ocean.dart index 4393f80e..c883ac8c 100644 --- a/lib/logic/providers/server_providers/digital_ocean.dart +++ b/lib/logic/providers/server_providers/digital_ocean.dart @@ -133,6 +133,9 @@ class DigitalOceanServerProvider extends ServerProvider { Future> launchInstallation( final LaunchInstallationData installationData, ) async { + ServerHostingDetails? serverDetails; + final serverApiToken = StringGenerators.apiToken(); + final hostname = getHostnameFromDomain(installationData.domainName); final serverResult = await _adapter.api().createServer( dnsApiToken: installationData.dnsApiToken, rootUser: installationData.rootUser, @@ -140,12 +143,12 @@ class DigitalOceanServerProvider extends ServerProvider { serverType: installationData.serverTypeId, dnsProviderType: dnsProviderToInfectName(installationData.dnsProviderType), - hostName: getHostnameFromDomain(installationData.domainName), + hostName: hostname, base64Password: base64.encode( utf8.encode(installationData.rootUser.password ?? 'PASS'), ), databasePassword: StringGenerators.dbPassword(), - serverApiToken: StringGenerators.apiToken(), + serverApiToken: serverApiToken, ); if (!serverResult.success || serverResult.data == null) { @@ -169,6 +172,66 @@ class DigitalOceanServerProvider extends ServerProvider { code: serverResult.code, ); } + + try { + final int dropletId = serverResult.data['droplet']['id']; + final ServerVolume? newVolume = (await createVolume()).data; + final bool attachedVolume = + (await attachVolume(newVolume!, dropletId)).data; + + String? ipv4; + int attempts = 0; + while (attempts < 5 && ipv4 == null) { + await Future.delayed(const Duration(seconds: 20)); + final servers = await getServers(); + for (final server in servers.data) { + if (server.name == hostname && server.ip != '0.0.0.0') { + ipv4 = server.ip; + break; + } + } + ++attempts; + } + + if (attachedVolume && ipv4 != null) { + serverDetails = ServerHostingDetails( + id: dropletId, + ip4: ipv4, + createTime: DateTime.now(), + volume: newVolume, + apiToken: serverApiToken, + provider: ServerProviderType.digitalOcean, + ); + } + } catch (e) { + return GenericResult( + success: false, + data: CallbackDialogueBranching( + choices: [ + CallbackDialogueChoice( + title: 'basis.cancel'.tr(), + callback: null, + ), + CallbackDialogueChoice( + title: 'basis.try_again'.tr(), + callback: () async { + await Future.delayed(const Duration(seconds: 5)); + final deletion = await deleteServer(hostname); + return deletion.success + ? await launchInstallation(installationData) + : deletion; + }, + ), + ], + description: 'modals.try_again'.tr(), + title: 'modals.server_deletion_error'.tr(), + ), + message: e.toString(), + ); + } + + await installationData.successCallback(serverDetails!); + return GenericResult(success: true, data: null); } @override From 3b49805c9c6077ea1a16a055bffe11c0cec97725 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 24 Apr 2023 12:09:23 -0300 Subject: [PATCH 33/96] chore: Move volume api to abstract server provider interface --- .../api_maps/rest_maps/api_controller.dart | 23 --------- .../digital_ocean/digital_ocean_api.dart | 7 --- .../server_providers/hetzner/hetzner_api.dart | 12 ++++- .../provider_volume_cubit.dart | 50 +++++++++---------- lib/logic/providers/server_provider.dart | 16 ++++++ .../server_providers/digital_ocean.dart | 35 +++++++++++++ .../providers/server_providers/hetzner.dart | 22 +++++--- lib/ui/router/router.gr.dart | 3 +- 8 files changed, 101 insertions(+), 67 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/api_controller.dart b/lib/logic/api_maps/rest_maps/api_controller.dart index 73fd8e5c..8e58ee6f 100644 --- a/lib/logic/api_maps/rest_maps/api_controller.dart +++ b/lib/logic/api_maps/rest_maps/api_controller.dart @@ -1,22 +1,10 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_creator.dart'; import 'package:selfprivacy/logic/providers/provider_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_factory.dart'; class ApiController { - static VolumeProviderApiFactory? get currentVolumeProviderApiFactory => - _volumeProviderApiFactory; static DnsProviderApiFactory? get currentDnsProviderApiFactory => _dnsProviderApiFactory; - static ServerProviderApiFactory? get currentServerProviderApiFactory => - _serverProviderApiFactory; - - static void initVolumeProviderApiFactory( - final ServerProviderSettings settings, - ) { - _volumeProviderApiFactory = - VolumeApiFactoryCreator.createVolumeProviderApiFactory(settings); - } static void initDnsProviderApiFactory( final DnsProviderFactorySettings settings, @@ -25,20 +13,9 @@ class ApiController { ApiFactoryCreator.createDnsProviderApiFactory(settings); } - static void initServerProviderApiFactory( - final ServerProviderSettings settings, - ) { - _serverProviderApiFactory = - ApiFactoryCreator.createServerProviderApiFactory(settings); - } - static void clearProviderApiFactories() { - _volumeProviderApiFactory = null; _dnsProviderApiFactory = null; - _serverProviderApiFactory = null; } - static VolumeProviderApiFactory? _volumeProviderApiFactory; static DnsProviderApiFactory? _dnsProviderApiFactory; - static ServerProviderApiFactory? _serverProviderApiFactory; } diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart index f6ba941a..e6c5f1b4 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart @@ -95,13 +95,6 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { ); } - /// Hardcoded on their documentation and there is no pricing API at all - /// Probably we should scrap the doc page manually - Future getPricePerGb() async => Price( - value: 0.10, - currency: 'USD', - ); - Future createVolume() async { Response? createVolumeResponse; final Dio client = await getClient(); diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart index 8e67b188..c2883aba 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart @@ -305,7 +305,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { ); } - Future resizeVolume( + Future> resizeVolume( final ServerVolume volume, final DiskSize size, ) async { @@ -324,11 +324,19 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { resizeVolumeResponse.data['action']['status'].toString() != 'error'; } catch (e) { print(e); + return GenericResult( + data: false, + success: false, + message: e.toString(), + ); } finally { client.close(); } - return success; + return GenericResult( + data: success, + success: true, + ); } Future createServer({ diff --git a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart index 48617545..d2315c99 100644 --- a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart +++ b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart @@ -10,6 +10,7 @@ import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/disk_status.dart'; import 'package:selfprivacy/logic/models/price.dart'; +import 'package:selfprivacy/logic/providers/providers_controller.dart'; part 'provider_volume_state.dart'; @@ -27,9 +28,7 @@ class ApiProviderVolumeCubit } Future getPricePerGb() async => - ApiController.currentVolumeProviderApiFactory! - .getVolumeProvider() - .getPricePerGb(); + ProvidersController.currentServerProvider!.getPricePerGb(); Future refresh() async { emit(const ApiProviderVolumeState([], LoadingStatus.refreshing, false)); @@ -41,29 +40,31 @@ class ApiProviderVolumeCubit return emit(const ApiProviderVolumeState([], LoadingStatus.error, false)); } - final List volumes = await ApiController - .currentVolumeProviderApiFactory! - .getVolumeProvider() - .getVolumes(); + final volumesResult = + await ProvidersController.currentServerProvider!.getVolumes(); - if (volumes.isEmpty) { + if (!volumesResult.success || volumesResult.data.isEmpty) { return emit(const ApiProviderVolumeState([], LoadingStatus.error, false)); } - emit(ApiProviderVolumeState(volumes, LoadingStatus.success, false)); + emit( + ApiProviderVolumeState( + volumesResult.data, + LoadingStatus.success, + false, + ), + ); } Future attachVolume(final DiskVolume volume) async { final ServerHostingDetails server = getIt().serverDetails!; - await ApiController.currentVolumeProviderApiFactory! - .getVolumeProvider() + await ProvidersController.currentServerProvider! .attachVolume(volume.providerVolume!, server.id); unawaited(refresh()); } Future detachVolume(final DiskVolume volume) async { - await ApiController.currentVolumeProviderApiFactory! - .getVolumeProvider() + await ProvidersController.currentServerProvider! .detachVolume(volume.providerVolume!); unawaited(refresh()); } @@ -77,14 +78,13 @@ class ApiProviderVolumeCubit 'Starting resize', ); emit(state.copyWith(isResizing: true)); - final bool resized = await ApiController.currentVolumeProviderApiFactory! - .getVolumeProvider() - .resizeVolume( - volume.providerVolume!, - newSize, - ); + final resizedResult = + await ProvidersController.currentServerProvider!.resizeVolume( + volume.providerVolume!, + newSize, + ); - if (!resized) { + if (!resizedResult.success || !resizedResult.data) { getIt().showSnackBar( 'storage.extending_volume_error'.tr(), ); @@ -115,11 +115,8 @@ class ApiProviderVolumeCubit } Future createVolume() async { - final ServerVolume? volume = (await ApiController - .currentVolumeProviderApiFactory! - .getVolumeProvider() - .createVolume()) - .data; + final ServerVolume? volume = + (await ProvidersController.currentServerProvider!.createVolume()).data; final diskVolume = DiskVolume(providerVolume: volume); await attachVolume(diskVolume); @@ -131,8 +128,7 @@ class ApiProviderVolumeCubit } Future deleteVolume(final DiskVolume volume) async { - await ApiController.currentVolumeProviderApiFactory! - .getVolumeProvider() + await ProvidersController.currentServerProvider! .deleteVolume(volume.providerVolume!); unawaited(refresh()); } diff --git a/lib/logic/providers/server_provider.dart b/lib/logic/providers/server_provider.dart index 7a2f4a02..781f0d2b 100644 --- a/lib/logic/providers/server_provider.dart +++ b/lib/logic/providers/server_provider.dart @@ -1,7 +1,10 @@ import 'package:selfprivacy/logic/api_maps/generic_result.dart'; import 'package:selfprivacy/logic/models/callback_dialogue_branching.dart'; +import 'package:selfprivacy/logic/models/disk_size.dart'; +import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/launch_installation_data.dart'; import 'package:selfprivacy/logic/models/metrics.dart'; +import 'package:selfprivacy/logic/models/price.dart'; import 'package:selfprivacy/logic/models/server_provider_location.dart'; import 'package:selfprivacy/logic/models/server_type.dart'; @@ -26,5 +29,18 @@ abstract class ServerProvider { final DateTime end, ); + Future getPricePerGb(); + Future>> getVolumes({final String? status}); + Future> createVolume(); + Future> deleteVolume(final ServerVolume volume); + Future> resizeVolume( + final ServerVolume volume, + final DiskSize size, + ); + Future> attachVolume( + final ServerVolume volume, + final int serverId, + ); + Future> detachVolume(final ServerVolume volume); GenericResult get success => GenericResult(success: true, data: true); } diff --git a/lib/logic/providers/server_providers/digital_ocean.dart b/lib/logic/providers/server_providers/digital_ocean.dart index c883ac8c..16dac0c6 100644 --- a/lib/logic/providers/server_providers/digital_ocean.dart +++ b/lib/logic/providers/server_providers/digital_ocean.dart @@ -610,6 +610,7 @@ class DigitalOceanServerProvider extends ServerProvider { ); } + @override Future>> getVolumes({ final String? status, }) async { @@ -658,6 +659,7 @@ class DigitalOceanServerProvider extends ServerProvider { ); } + @override Future> createVolume() async { ServerVolume? volume; @@ -729,6 +731,7 @@ class DigitalOceanServerProvider extends ServerProvider { ); } + @override Future> deleteVolume( final ServerVolume volume, ) async => @@ -736,6 +739,7 @@ class DigitalOceanServerProvider extends ServerProvider { volume.uuid!, ); + @override Future> attachVolume( final ServerVolume volume, final int serverId, @@ -745,6 +749,7 @@ class DigitalOceanServerProvider extends ServerProvider { serverId, ); + @override Future> detachVolume( final ServerVolume volume, ) async => @@ -753,6 +758,7 @@ class DigitalOceanServerProvider extends ServerProvider { volume.serverId!, ); + @override Future> resizeVolume( final ServerVolume volume, final DiskSize size, @@ -761,4 +767,33 @@ class DigitalOceanServerProvider extends ServerProvider { volume.name, size, ); + + /// Hardcoded on their documentation and there is no pricing API at all + /// Probably we should scrap the doc page manually + @override + Future getPricePerGb() async => Price( + value: 0.10, + currency: 'USD', + ); + + @override + Future> powerOn(final int serverId) async { + DateTime? timestamp; + final result = await _adapter.api().powerOn(serverId); + if (!result.success) { + return GenericResult( + success: false, + data: timestamp, + code: result.code, + message: result.message, + ); + } + + timestamp = DateTime.now(); + + return GenericResult( + success: true, + data: timestamp, + ); + } } diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index 33894f3d..7b59c2a3 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -7,7 +7,6 @@ import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart'; -import 'package:selfprivacy/logic/models/launch_installation_data.dart'; import 'package:selfprivacy/logic/models/metrics.dart'; import 'package:selfprivacy/logic/models/price.dart'; import 'package:selfprivacy/logic/models/server_basic_info.dart'; @@ -434,7 +433,7 @@ class HetznerServerProvider extends ServerProvider { ); } - final volume = volumeResult.data!; + final volume = volumeResult.data; final serverApiToken = StringGenerators.apiToken(); final hostname = getHostnameFromDomain(installationData.domainName); @@ -632,6 +631,7 @@ class HetznerServerProvider extends ServerProvider { ); } + @override Future> createVolume() async { ServerVolume? volume; @@ -676,6 +676,7 @@ class HetznerServerProvider extends ServerProvider { ); } + @override Future>> getVolumes({ final String? status, }) async { @@ -724,9 +725,11 @@ class HetznerServerProvider extends ServerProvider { ); } - Future> deleteVolume(final int volumeId) async => - _adapter.api().deleteVolume(volumeId); + @override + Future> deleteVolume(final ServerVolume volume) async => + _adapter.api().deleteVolume(volume.id); + @override Future> attachVolume( final ServerVolume volume, final int serverId, @@ -736,14 +739,16 @@ class HetznerServerProvider extends ServerProvider { serverId, ); + @override Future> detachVolume( - final int volumeId, + final ServerVolume volume, ) async => _adapter.api().detachVolume( - volumeId, + volume.id, ); - Future resizeVolume( + @override + Future> resizeVolume( final ServerVolume volume, final DiskSize size, ) async => @@ -751,4 +756,7 @@ class HetznerServerProvider extends ServerProvider { volume, size, ); + + @override + Future getPricePerGb() async => _adapter.api().getPricePerGb(); } diff --git a/lib/ui/router/router.gr.dart b/lib/ui/router/router.gr.dart index 675056f3..e5b0449f 100644 --- a/lib/ui/router/router.gr.dart +++ b/lib/ui/router/router.gr.dart @@ -10,7 +10,8 @@ part of 'router.dart'; abstract class _$RootRouter extends RootStackRouter { - _$RootRouter([GlobalKey? navigatorKey]) : super(navigatorKey); + _$RootRouter([GlobalKey? navigatorKey]) + : super(navigatorKey: navigatorKey); @override final Map pagesMap = { From 4aa13dd63a0cec58dcde9b347573f8af36ffacb2 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 24 Apr 2023 13:45:16 -0300 Subject: [PATCH 34/96] chore: resolve ui conflicts and make it build --- .../provider_volume_cubit.dart | 3 +- .../server_detailed_info_repository.dart | 9 ++-- .../server_installation_repository.dart | 48 ++++--------------- lib/logic/providers/server_provider.dart | 10 ++++ .../providers/server_providers/hetzner.dart | 2 + lib/ui/router/router.gr.dart | 3 +- 6 files changed, 27 insertions(+), 48 deletions(-) diff --git a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart index d2315c99..43bd7005 100644 --- a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart +++ b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart @@ -3,7 +3,6 @@ import 'dart:async'; import 'package:easy_localization/easy_localization.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server_api.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/api_controller.dart'; import 'package:selfprivacy/logic/common_enum/common_enum.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; @@ -36,7 +35,7 @@ class ApiProviderVolumeCubit } Future _refetch() async { - if (ApiController.currentVolumeProviderApiFactory == null) { + if (ProvidersController.currentServerProvider == null) { return emit(const ApiProviderVolumeState([], LoadingStatus.error, false)); } diff --git a/lib/logic/cubit/server_detailed_info/server_detailed_info_repository.dart b/lib/logic/cubit/server_detailed_info/server_detailed_info_repository.dart index ca6848bc..3bad75eb 100644 --- a/lib/logic/cubit/server_detailed_info/server_detailed_info_repository.dart +++ b/lib/logic/cubit/server_detailed_info/server_detailed_info_repository.dart @@ -1,23 +1,22 @@ import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server_api.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/api_controller.dart'; import 'package:selfprivacy/logic/models/auto_upgrade_settings.dart'; import 'package:selfprivacy/logic/models/server_metadata.dart'; import 'package:selfprivacy/logic/models/timezone_settings.dart'; +import 'package:selfprivacy/logic/providers/providers_controller.dart'; class ServerDetailsRepository { ServerApi server = ServerApi(); Future load() async { - final serverProviderApi = ApiController.currentServerProviderApiFactory; + final serverProviderApi = ProvidersController.currentServerProvider; final settings = await server.getSystemSettings(); final serverId = getIt().serverDetails!.id; - final metadata = - await serverProviderApi!.getServerProvider().getMetadata(serverId); + final metadata = await serverProviderApi?.getMetadata(serverId); return ServerDetailsRepositoryDto( autoUpgradeSettings: settings.autoUpgradeSettings, - metadata: metadata, + metadata: metadata!.data, serverTimezone: TimeZoneSettings.fromString( settings.timezone, ), diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 29b298bd..838fe6c9 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -61,16 +61,7 @@ class ServerInstallationRepository { if (serverProvider != null || (serverDetails != null && serverDetails.provider != ServerProviderType.unknown)) { - ApiController.initServerProviderApiFactory( - ServerProviderSettings( - provider: serverProvider ?? serverDetails!.provider, - location: location, - ), - ); - - // All current providers support volumes - // so it's safe to hardcode for now - ApiController.initVolumeProviderApiFactory( + ProvidersController.initServerProvider( ServerProviderSettings( provider: serverProvider ?? serverDetails!.provider, location: location, @@ -250,8 +241,7 @@ class ServerInstallationRepository { }) async { final DnsProviderApi dnsProviderApi = ApiController.currentDnsProviderApiFactory!.getDnsProvider(); - final ServerProviderApi serverApi = - ApiController.currentServerProviderApiFactory!.getServerProvider(); + final serverProvider = ProvidersController.currentServerProvider!; void showDomainErrorPopUp(final String error) { showPopUpAlert( @@ -260,8 +250,8 @@ class ServerInstallationRepository { cancelButtonOnPressed: onCancel, actionButtonTitle: 'basis.delete'.tr(), actionButtonOnPressed: () async { - await serverApi.deleteServer( - domainName: domain.domainName, + await serverProvider.deleteServer( + domain.domainName, ); onCancel(); }, @@ -299,16 +289,6 @@ class ServerInstallationRepository { return false; } - final GenericResult createReverseResult = await serverApi.createReverseDns( - serverDetails: serverDetails, - domain: domain, - ); - - if (!createReverseResult.success) { - showDomainErrorPopUp(errorMessage); - return false; - } - return true; } @@ -586,9 +566,7 @@ class ServerInstallationRepository { } Future> getServersOnProviderAccount() async => - ApiController.currentServerProviderApiFactory! - .getServerProvider() - .getServers(); + (await ProvidersController.currentServerProvider!.getServers()).data; Future saveServerDetails( final ServerHostingDetails serverDetails, @@ -681,12 +659,10 @@ class ServerInstallationRepository { } Future deleteServer(final ServerDomain serverDomain) async { - final GenericResult deletionResult = await ApiController - .currentServerProviderApiFactory! - .getServerProvider() - .deleteServer( - domainName: serverDomain.domainName, - ); + final deletionResult = + await ProvidersController.currentServerProvider!.deleteServer( + serverDomain.domainName, + ); if (!deletionResult.success) { getIt() @@ -694,12 +670,6 @@ class ServerInstallationRepository { return false; } - if (!deletionResult.data) { - getIt() - .showSnackBar('modals.server_deletion_error'.tr()); - return false; - } - await box.put(BNames.hasFinalChecked, false); await box.put(BNames.isServerStarted, false); await box.put(BNames.isServerResetedFirstTime, false); diff --git a/lib/logic/providers/server_provider.dart b/lib/logic/providers/server_provider.dart index 781f0d2b..ffb64e12 100644 --- a/lib/logic/providers/server_provider.dart +++ b/lib/logic/providers/server_provider.dart @@ -5,6 +5,8 @@ import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/launch_installation_data.dart'; import 'package:selfprivacy/logic/models/metrics.dart'; import 'package:selfprivacy/logic/models/price.dart'; +import 'package:selfprivacy/logic/models/server_basic_info.dart'; +import 'package:selfprivacy/logic/models/server_metadata.dart'; import 'package:selfprivacy/logic/models/server_provider_location.dart'; import 'package:selfprivacy/logic/models/server_type.dart'; @@ -12,12 +14,17 @@ export 'package:selfprivacy/logic/api_maps/generic_result.dart'; export 'package:selfprivacy/logic/models/launch_installation_data.dart'; abstract class ServerProvider { + Future>> getServers(); Future> trySetServerLocation(final String location); Future> tryInitApiByToken(final String token); Future>> getAvailableLocations(); Future>> getServerTypes({ required final ServerProviderLocation location, }); + + Future> deleteServer( + final String hostname, + ); Future> launchInstallation( final LaunchInstallationData installationData, ); @@ -42,5 +49,8 @@ abstract class ServerProvider { final int serverId, ); Future> detachVolume(final ServerVolume volume); + Future>> getMetadata( + final int serverId, + ); GenericResult get success => GenericResult(success: true, data: true); } diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index 7b59c2a3..dc1548b1 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -209,6 +209,7 @@ class HetznerServerProvider extends ServerProvider { return GenericResult(success: true, data: servers); } + @override Future>> getMetadata( final int serverId, ) async { @@ -573,6 +574,7 @@ class HetznerServerProvider extends ServerProvider { return GenericResult(success: true, data: null); } + @override Future> deleteServer( final String hostname, ) async { diff --git a/lib/ui/router/router.gr.dart b/lib/ui/router/router.gr.dart index e5b0449f..ee569a83 100644 --- a/lib/ui/router/router.gr.dart +++ b/lib/ui/router/router.gr.dart @@ -10,8 +10,7 @@ part of 'router.dart'; abstract class _$RootRouter extends RootStackRouter { - _$RootRouter([GlobalKey? navigatorKey]) - : super(navigatorKey: navigatorKey); + _$RootRouter([GlobalKey? navigatorKey]) : super(navigatorKey: navigatorKey); @override final Map pagesMap = { From d282f37b71bef37e50f30af49a76876279090573 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 25 Apr 2023 16:04:19 -0300 Subject: [PATCH 35/96] fix: Return correct adapters for Hive and make it run --- lib/config/hive_config.dart | 2 ++ lib/ui/router/router.gr.dart | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/config/hive_config.dart b/lib/config/hive_config.dart index efb5520c..afaae80b 100644 --- a/lib/config/hive_config.dart +++ b/lib/config/hive_config.dart @@ -19,6 +19,8 @@ class HiveConfig { Hive.registerAdapter(BackblazeBucketAdapter()); Hive.registerAdapter(ServerVolumeAdapter()); Hive.registerAdapter(UserTypeAdapter()); + Hive.registerAdapter(DnsProviderTypeAdapter()); + Hive.registerAdapter(ServerProviderTypeAdapter()); await Hive.openBox(BNames.appSettingsBox); diff --git a/lib/ui/router/router.gr.dart b/lib/ui/router/router.gr.dart index ee569a83..675056f3 100644 --- a/lib/ui/router/router.gr.dart +++ b/lib/ui/router/router.gr.dart @@ -10,7 +10,7 @@ part of 'router.dart'; abstract class _$RootRouter extends RootStackRouter { - _$RootRouter([GlobalKey? navigatorKey]) : super(navigatorKey: navigatorKey); + _$RootRouter([GlobalKey? navigatorKey]) : super(navigatorKey); @override final Map pagesMap = { From 4c2cfca4c4f73bbf305c362bda7ed5cde0ed1da0 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 25 Apr 2023 16:20:23 -0300 Subject: [PATCH 36/96] fix: Change server location type for Hetzner --- .../rest_maps/server_providers/hetzner/hetzner_api.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart index c2883aba..44bfb66b 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart @@ -519,7 +519,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { } Future> getAvailableLocations() async { - List locations = []; + List locations = []; final Dio client = await getClient(); try { From 1e9f1f88a7302d65f780096516b476c898d3f85e Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 25 Apr 2023 16:44:43 -0300 Subject: [PATCH 37/96] fix: Hetzner installation issues - Replace serverType id with locaiton id - Replaces id accessing in volume from .id to [id] --- .../rest_maps/server_providers/hetzner/hetzner_api.dart | 1 - .../server_installation/server_installation_cubit.dart | 2 +- lib/logic/providers/server_providers/hetzner.dart | 9 +++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart index 44bfb66b..d09cce18 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart @@ -10,7 +10,6 @@ import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; import 'package:selfprivacy/logic/models/price.dart'; -import 'package:selfprivacy/logic/models/server_provider_location.dart'; import 'package:selfprivacy/utils/password_generator.dart'; class HetznerApi extends ServerProviderApi with VolumeProviderApi { diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index db5f1131..68da2c81 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -175,7 +175,7 @@ class ServerInstallationCubit extends Cubit { await repository.saveServerType(serverType); await ProvidersController.currentServerProvider! - .trySetServerLocation(serverType.identifier); + .trySetServerLocation(serverType.location.identifier); emit( (state as ServerInstallationNotFinished).copyWith( diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index dc1548b1..cc3b05d1 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -172,6 +172,7 @@ class HetznerServerProvider extends ServerProvider { return GenericResult(success: true, data: types); } + @override Future>> getServers() async { final List servers = []; final result = await _adapter.api().getServers(); @@ -434,7 +435,7 @@ class HetznerServerProvider extends ServerProvider { ); } - final volume = volumeResult.data; + final volume = volumeResult.data['volume']; final serverApiToken = StringGenerators.apiToken(); final hostname = getHostnameFromDomain(installationData.domainName); @@ -446,7 +447,7 @@ class HetznerServerProvider extends ServerProvider { dnsProviderType: dnsProviderToInfectName(installationData.dnsProviderType), hostName: hostname, - volumeId: volume.id, + volumeId: volume['id'], base64Password: base64.encode( utf8.encode(installationData.rootUser.password ?? 'PASS'), ), @@ -455,7 +456,7 @@ class HetznerServerProvider extends ServerProvider { ); if (!serverResult.success || serverResult.data == null) { - await _adapter.api().deleteVolume(volume.id); + await _adapter.api().deleteVolume(volume['id']); await Future.delayed(const Duration(seconds: 5)); if (serverResult.message != null && serverResult.message == 'uniqueness_error') { @@ -549,7 +550,7 @@ class HetznerServerProvider extends ServerProvider { CallbackDialogueChoice( title: 'basis.try_again'.tr(), callback: () async { - await _adapter.api().deleteVolume(volume.id); + await _adapter.api().deleteVolume(volume['id']); await Future.delayed(const Duration(seconds: 5)); final deletion = await deleteServer(hostname); if (deletion.success) { From 854febc5d2f0896e28d2db1f965a5eaad4a2e3cf Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 26 Apr 2023 14:35:57 -0300 Subject: [PATCH 38/96] fix: Replace hardcoded string from Hetzner to Cloudflare for DNS providers page --- lib/ui/pages/setup/initializing/dns_provider_picker.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ui/pages/setup/initializing/dns_provider_picker.dart b/lib/ui/pages/setup/initializing/dns_provider_picker.dart index 28dabb9e..92f1a36d 100644 --- a/lib/ui/pages/setup/initializing/dns_provider_picker.dart +++ b/lib/ui/pages/setup/initializing/dns_provider_picker.dart @@ -194,7 +194,7 @@ class ProviderSelectionPage extends StatelessWidget { ), const SizedBox(width: 16), Text( - 'Hetzner Cloud', + 'Cloudflare', style: Theme.of(context).textTheme.titleMedium, ), ], From b2428383398b61dd8c6fd1d90f5107173e15dedc Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 26 Apr 2023 14:39:33 -0300 Subject: [PATCH 39/96] fix: Make launchInstall return correct object for volume --- lib/logic/providers/server_providers/hetzner.dart | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index cc3b05d1..b9d2296a 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -521,7 +521,13 @@ class HetznerServerProvider extends ServerProvider { id: serverResult.data['server']['id'], ip4: serverResult.data['server']['public_net']['ipv4']['ip'], createTime: DateTime.now(), - volume: volume, + volume: ServerVolume( + id: volume['id'], + name: volume['name'], + sizeByte: volume['size'], + serverId: volume['server'], + linuxDevice: volume['linux_device'], + ), apiToken: serverApiToken, provider: ServerProviderType.hetzner, ); From da4b38b78767a828fd5de16de1362cad3d2d88f6 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 28 Apr 2023 14:19:52 -0300 Subject: [PATCH 40/96] fix: Move DNS entries creation step to server provider layer --- .../server_installation_cubit.dart | 5 +++-- lib/logic/models/launch_installation_data.dart | 7 +++++-- .../server_providers/digital_ocean.dart | 9 +++++++-- .../providers/server_providers/hetzner.dart | 17 ++++++++++++++--- 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 68da2c81..04bfa830 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -230,7 +230,6 @@ class ServerInstallationCubit extends Cubit { final ServerHostingDetails serverDetails, ) async { await repository.saveServerDetails(serverDetails); - // TODO dns; emit( (state as ServerInstallationNotFinished).copyWith( isLoading: false, @@ -247,10 +246,12 @@ class ServerInstallationCubit extends Cubit { rootUser: state.rootUser!, dnsApiToken: state.dnsApiToken!, dnsProviderType: state.serverDomain!.provider, - domainName: state.serverDomain!.domainName, + serverDomain: state.serverDomain!, serverTypeId: state.serverTypeIdentificator!, errorCallback: clearAppConfig, successCallback: onCreateServerSuccess, + dnsProviderApi: + ApiController.currentDnsProviderApiFactory!.getDnsProvider(), ); final result = diff --git a/lib/logic/models/launch_installation_data.dart b/lib/logic/models/launch_installation_data.dart index c7956ea1..9a394923 100644 --- a/lib/logic/models/launch_installation_data.dart +++ b/lib/logic/models/launch_installation_data.dart @@ -1,3 +1,4 @@ +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; @@ -7,7 +8,8 @@ class LaunchInstallationData { required this.rootUser, required this.dnsApiToken, required this.dnsProviderType, - required this.domainName, + required this.dnsProviderApi, + required this.serverDomain, required this.serverTypeId, required this.errorCallback, required this.successCallback, @@ -15,8 +17,9 @@ class LaunchInstallationData { final User rootUser; final String dnsApiToken; - final String domainName; + final ServerDomain serverDomain; final DnsProviderType dnsProviderType; + final DnsProviderApi dnsProviderApi; final String serverTypeId; final Function() errorCallback; final Function(ServerHostingDetails details) successCallback; diff --git a/lib/logic/providers/server_providers/digital_ocean.dart b/lib/logic/providers/server_providers/digital_ocean.dart index 16dac0c6..906a5525 100644 --- a/lib/logic/providers/server_providers/digital_ocean.dart +++ b/lib/logic/providers/server_providers/digital_ocean.dart @@ -135,11 +135,13 @@ class DigitalOceanServerProvider extends ServerProvider { ) async { ServerHostingDetails? serverDetails; final serverApiToken = StringGenerators.apiToken(); - final hostname = getHostnameFromDomain(installationData.domainName); + final hostname = getHostnameFromDomain( + installationData.serverDomain.domainName, + ); final serverResult = await _adapter.api().createServer( dnsApiToken: installationData.dnsApiToken, rootUser: installationData.rootUser, - domainName: installationData.domainName, + domainName: installationData.serverDomain.domainName, serverType: installationData.serverTypeId, dnsProviderType: dnsProviderToInfectName(installationData.dnsProviderType), @@ -308,6 +310,7 @@ class DigitalOceanServerProvider extends ServerProvider { return GenericResult(success: true, data: types); } + @override Future>> getServers() async { final List servers = []; final result = await _adapter.api().getServers(); @@ -345,6 +348,7 @@ class DigitalOceanServerProvider extends ServerProvider { return GenericResult(success: true, data: servers); } + @override Future>> getMetadata( final int serverId, ) async { @@ -547,6 +551,7 @@ class DigitalOceanServerProvider extends ServerProvider { ); } + @override Future> deleteServer( final String hostname, ) async { diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index b9d2296a..e58223b7 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -437,12 +437,14 @@ class HetznerServerProvider extends ServerProvider { final volume = volumeResult.data['volume']; final serverApiToken = StringGenerators.apiToken(); - final hostname = getHostnameFromDomain(installationData.domainName); + final hostname = getHostnameFromDomain( + installationData.serverDomain.domainName, + ); final serverResult = await _adapter.api().createServer( dnsApiToken: installationData.dnsApiToken, rootUser: installationData.rootUser, - domainName: installationData.domainName, + domainName: installationData.serverDomain.domainName, serverType: installationData.serverTypeId, dnsProviderType: dnsProviderToInfectName(installationData.dnsProviderType), @@ -535,7 +537,7 @@ class HetznerServerProvider extends ServerProvider { final createDnsResult = await _adapter.api().createReverseDns( serverId: serverDetails.id, ip4: serverDetails.ip4, - dnsPtr: installationData.domainName, + dnsPtr: installationData.serverDomain.domainName, ); if (!createDnsResult.success) { @@ -578,6 +580,15 @@ class HetznerServerProvider extends ServerProvider { } await installationData.successCallback(serverDetails); + await installationData.dnsProviderApi.removeSimilarRecords( + ip4: serverDetails.ip4, + domain: installationData.serverDomain, + ); + await installationData.dnsProviderApi.createMultipleDnsRecords( + ip4: serverDetails.ip4, + domain: installationData.serverDomain, + ); + return GenericResult(success: true, data: null); } From 0d55361a9bb2e43f1842167bef04aa44acd51f20 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 2 May 2023 17:05:55 -0300 Subject: [PATCH 41/96] fix: Improve installation failure dialogues --- .../server_installation_cubit.dart | 48 +++++++++---------- .../server_providers/digital_ocean.dart | 8 ++-- .../providers/server_providers/hetzner.dart | 16 +++---- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 04bfa830..940f6ede 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -262,32 +262,32 @@ class ServerInstallationCubit extends Cubit { if (!result.success && result.data != null) { bool dialoguesResolved = false; CallbackDialogueBranching branching = result.data!; - while (!dialoguesResolved) { - showPopUpAlert( - alertTitle: branching.title, - description: branching.description, - actionButtonTitle: branching.choices[1].title, - actionButtonOnPressed: () async { - final branchingResult = await branching.choices[1].callback!(); - if (branchingResult.data == null) { - dialoguesResolved = true; - return; - } + //while (!dialoguesResolved) { + showPopUpAlert( + alertTitle: branching.title, + description: branching.description, + actionButtonTitle: branching.choices[1].title, + actionButtonOnPressed: () async { + final branchingResult = await branching.choices[1].callback!(); + if (branchingResult.data == null) { + dialoguesResolved = true; + return; + } - branching = branchingResult.data!; - }, - cancelButtonTitle: branching.choices[0].title, - cancelButtonOnPressed: () async { - final branchingResult = await branching.choices[0].callback!(); - if (branchingResult.data == null) { - dialoguesResolved = true; - return; - } + branching = branchingResult.data!; + }, + cancelButtonTitle: branching.choices[0].title, + cancelButtonOnPressed: () async { + final branchingResult = await branching.choices[0].callback!(); + if (branchingResult.data == null) { + dialoguesResolved = true; + return; + } - branching = branchingResult.data!; - }, - ); - } + branching = branchingResult.data!; + }, + ); + //} } } diff --git a/lib/logic/providers/server_providers/digital_ocean.dart b/lib/logic/providers/server_providers/digital_ocean.dart index 906a5525..97317144 100644 --- a/lib/logic/providers/server_providers/digital_ocean.dart +++ b/lib/logic/providers/server_providers/digital_ocean.dart @@ -159,10 +159,10 @@ class DigitalOceanServerProvider extends ServerProvider { choices: [ CallbackDialogueChoice( title: 'basis.cancel'.tr(), - callback: await installationData.errorCallback(), + callback: () async => await installationData.errorCallback(), ), CallbackDialogueChoice( - title: 'basis.try_again'.tr(), + title: 'modals.try_again'.tr(), callback: () async => launchInstallation(installationData), ), ], @@ -215,7 +215,7 @@ class DigitalOceanServerProvider extends ServerProvider { callback: null, ), CallbackDialogueChoice( - title: 'basis.try_again'.tr(), + title: 'modals.try_again'.tr(), callback: () async { await Future.delayed(const Duration(seconds: 5)); final deletion = await deleteServer(hostname); @@ -595,7 +595,7 @@ class DigitalOceanServerProvider extends ServerProvider { callback: null, ), CallbackDialogueChoice( - title: 'basis.try_again'.tr(), + title: 'modals.try_again'.tr(), callback: () async { await Future.delayed(const Duration(seconds: 5)); return deleteServer(hostname); diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index e58223b7..7d4221fa 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -418,10 +418,10 @@ class HetznerServerProvider extends ServerProvider { choices: [ CallbackDialogueChoice( title: 'basis.cancel'.tr(), - callback: await installationData.errorCallback(), + callback: () async => await installationData.errorCallback(), ), CallbackDialogueChoice( - title: 'basis.try_again'.tr(), + title: 'modals.try_again'.tr(), callback: () async => launchInstallation(installationData), ), ], @@ -467,10 +467,10 @@ class HetznerServerProvider extends ServerProvider { choices: [ CallbackDialogueChoice( title: 'basis.cancel'.tr(), - callback: installationData.errorCallback(), + callback: () async => installationData.errorCallback(), ), CallbackDialogueChoice( - title: 'basis.yes'.tr(), + title: 'modals.yes'.tr(), callback: () async { final deleting = await deleteServer(hostname); if (deleting.success) { @@ -481,7 +481,7 @@ class HetznerServerProvider extends ServerProvider { }, ), ], - description: volumeResult.message ?? 'modals.destroy_server'.tr(), + description: 'modals.destroy_server'.tr(), title: 'modals.already_exists'.tr(), ), success: false, @@ -504,7 +504,7 @@ class HetznerServerProvider extends ServerProvider { }, ), CallbackDialogueChoice( - title: 'basis.try_again'.tr(), + title: 'modals.try_again'.tr(), callback: () async => launchInstallation(installationData), ), ], @@ -556,7 +556,7 @@ class HetznerServerProvider extends ServerProvider { }, ), CallbackDialogueChoice( - title: 'basis.try_again'.tr(), + title: 'modals.try_again'.tr(), callback: () async { await _adapter.api().deleteVolume(volume['id']); await Future.delayed(const Duration(seconds: 5)); @@ -631,7 +631,7 @@ class HetznerServerProvider extends ServerProvider { callback: null, ), CallbackDialogueChoice( - title: 'basis.try_again'.tr(), + title: 'modals.try_again'.tr(), callback: () async { await Future.delayed(const Duration(seconds: 5)); return deleteServer(hostname); From 30385c24702cdea9a98a9108535ae516126479e5 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 2 May 2023 23:42:18 -0300 Subject: [PATCH 42/96] refactor: Create empty DnsProvider interfaces --- .../api_maps/rest_maps/api_controller.dart | 2 +- .../rest_maps/api_factory_creator.dart | 2 +- lib/logic/api_maps/staging_options.dart | 2 +- .../server_installation_cubit.dart | 2 +- .../server_installation_repository.dart | 2 +- .../providers/dns_providers/cloudflare.dart | 3 +++ .../dns_providers/digital_ocean.dart | 3 +++ .../providers/dns_providers/dns_provider.dart | 1 + .../dns_providers/dns_provider_factory.dart | 25 +++++++++++++++++++ lib/logic/providers/provider_settings.dart | 4 +-- lib/logic/providers/providers_controller.dart | 20 ++++++++++++--- .../server_providers/digital_ocean.dart | 2 +- .../providers/server_providers/hetzner.dart | 2 +- .../server_provider.dart | 0 .../server_provider_factory.dart | 2 +- 15 files changed, 59 insertions(+), 13 deletions(-) create mode 100644 lib/logic/providers/dns_providers/cloudflare.dart create mode 100644 lib/logic/providers/dns_providers/digital_ocean.dart create mode 100644 lib/logic/providers/dns_providers/dns_provider.dart create mode 100644 lib/logic/providers/dns_providers/dns_provider_factory.dart rename lib/logic/providers/{ => server_providers}/server_provider.dart (100%) diff --git a/lib/logic/api_maps/rest_maps/api_controller.dart b/lib/logic/api_maps/rest_maps/api_controller.dart index 8e58ee6f..9cee1fe9 100644 --- a/lib/logic/api_maps/rest_maps/api_controller.dart +++ b/lib/logic/api_maps/rest_maps/api_controller.dart @@ -7,7 +7,7 @@ class ApiController { _dnsProviderApiFactory; static void initDnsProviderApiFactory( - final DnsProviderFactorySettings settings, + final DnsProviderSettings settings, ) { _dnsProviderApiFactory = ApiFactoryCreator.createDnsProviderApiFactory(settings); diff --git a/lib/logic/api_maps/rest_maps/api_factory_creator.dart b/lib/logic/api_maps/rest_maps/api_factory_creator.dart index 97bb3acd..69cfa766 100644 --- a/lib/logic/api_maps/rest_maps/api_factory_creator.dart +++ b/lib/logic/api_maps/rest_maps/api_factory_creator.dart @@ -28,7 +28,7 @@ class ApiFactoryCreator { } static DnsProviderApiFactory createDnsProviderApiFactory( - final DnsProviderFactorySettings settings, + final DnsProviderSettings settings, ) { switch (settings.provider) { case DnsProviderType.cloudflare: diff --git a/lib/logic/api_maps/staging_options.dart b/lib/logic/api_maps/staging_options.dart index 7d3084b7..26b07e53 100644 --- a/lib/logic/api_maps/staging_options.dart +++ b/lib/logic/api_maps/staging_options.dart @@ -4,5 +4,5 @@ class StagingOptions { /// Whether we request for staging temprorary certificates. /// Hardcode to 'true' in the middle of testing to not /// get your domain banned by constant certificate renewal - static bool get stagingAcme => false; + static bool get stagingAcme => true; } diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 940f6ede..dd8dd998 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -69,7 +69,7 @@ class ServerInstallationCubit extends Cubit { void setDnsProviderType(final DnsProviderType providerType) async { await repository.saveDnsProviderType(providerType); ApiController.initDnsProviderApiFactory( - DnsProviderFactorySettings( + DnsProviderSettings( provider: providerType, ), ); diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 838fe6c9..55231904 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -73,7 +73,7 @@ class ServerInstallationRepository { (serverDomain != null && serverDomain.provider != ServerProviderType.unknown)) { ApiController.initDnsProviderApiFactory( - DnsProviderFactorySettings( + DnsProviderSettings( provider: dnsProvider ?? serverDomain!.provider, ), ); diff --git a/lib/logic/providers/dns_providers/cloudflare.dart b/lib/logic/providers/dns_providers/cloudflare.dart new file mode 100644 index 00000000..6f973a88 --- /dev/null +++ b/lib/logic/providers/dns_providers/cloudflare.dart @@ -0,0 +1,3 @@ +import 'package:selfprivacy/logic/providers/dns_providers/dns_provider.dart'; + +class CloudflareDnsProvider extends DnsProvider {} diff --git a/lib/logic/providers/dns_providers/digital_ocean.dart b/lib/logic/providers/dns_providers/digital_ocean.dart new file mode 100644 index 00000000..2a8df75b --- /dev/null +++ b/lib/logic/providers/dns_providers/digital_ocean.dart @@ -0,0 +1,3 @@ +import 'package:selfprivacy/logic/providers/dns_providers/dns_provider.dart'; + +class DigitalOceanDnsProvider extends DnsProvider {} diff --git a/lib/logic/providers/dns_providers/dns_provider.dart b/lib/logic/providers/dns_providers/dns_provider.dart new file mode 100644 index 00000000..9aa1f99d --- /dev/null +++ b/lib/logic/providers/dns_providers/dns_provider.dart @@ -0,0 +1 @@ +abstract class DnsProvider {} diff --git a/lib/logic/providers/dns_providers/dns_provider_factory.dart b/lib/logic/providers/dns_providers/dns_provider_factory.dart new file mode 100644 index 00000000..a5adebc9 --- /dev/null +++ b/lib/logic/providers/dns_providers/dns_provider_factory.dart @@ -0,0 +1,25 @@ +import 'package:selfprivacy/logic/models/hive/server_domain.dart'; +import 'package:selfprivacy/logic/providers/dns_providers/cloudflare.dart'; +import 'package:selfprivacy/logic/providers/dns_providers/digital_ocean.dart'; +import 'package:selfprivacy/logic/providers/dns_providers/dns_provider.dart'; +import 'package:selfprivacy/logic/providers/provider_settings.dart'; + +class UnknownProviderException implements Exception { + UnknownProviderException(this.message); + final String message; +} + +class DnsProviderFactory { + static DnsProvider createDnsProviderInterface( + final DnsProviderSettings settings, + ) { + switch (settings.provider) { + case DnsProviderType.cloudflare: + return CloudflareDnsProvider(); + case DnsProviderType.digitalOcean: + return DigitalOceanDnsProvider(); + case DnsProviderType.unknown: + throw UnknownProviderException('Unknown server provider'); + } + } +} diff --git a/lib/logic/providers/provider_settings.dart b/lib/logic/providers/provider_settings.dart index 8145cff7..8ffe79e6 100644 --- a/lib/logic/providers/provider_settings.dart +++ b/lib/logic/providers/provider_settings.dart @@ -11,8 +11,8 @@ class ServerProviderSettings { final String? location; } -class DnsProviderFactorySettings { - DnsProviderFactorySettings({ +class DnsProviderSettings { + DnsProviderSettings({ required this.provider, }); diff --git a/lib/logic/providers/providers_controller.dart b/lib/logic/providers/providers_controller.dart index bd72a59e..dab74221 100644 --- a/lib/logic/providers/providers_controller.dart +++ b/lib/logic/providers/providers_controller.dart @@ -1,20 +1,34 @@ +import 'package:selfprivacy/logic/providers/dns_providers/dns_provider.dart'; +import 'package:selfprivacy/logic/providers/dns_providers/dns_provider_factory.dart'; import 'package:selfprivacy/logic/providers/provider_settings.dart'; -import 'package:selfprivacy/logic/providers/server_provider.dart'; +import 'package:selfprivacy/logic/providers/server_providers/server_provider.dart'; import 'package:selfprivacy/logic/providers/server_providers/server_provider_factory.dart'; class ProvidersController { static ServerProvider? get currentServerProvider => _serverProvider; + static DnsProvider? get currentDnsProvider => _dnsProvider; static void initServerProvider( final ServerProviderSettings settings, ) { - _serverProvider = - ServerProviderFactory.createServerProviderInterface(settings); + _serverProvider = ServerProviderFactory.createServerProviderInterface( + settings, + ); + } + + static void initDnsProvider( + final DnsProviderSettings settings, + ) { + _dnsProvider = DnsProviderFactory.createDnsProviderInterface( + settings, + ); } static void clearProviders() { _serverProvider = null; + _dnsProvider = null; } static ServerProvider? _serverProvider; + static DnsProvider? _dnsProvider; } diff --git a/lib/logic/providers/server_providers/digital_ocean.dart b/lib/logic/providers/server_providers/digital_ocean.dart index 97317144..01b27ef1 100644 --- a/lib/logic/providers/server_providers/digital_ocean.dart +++ b/lib/logic/providers/server_providers/digital_ocean.dart @@ -12,7 +12,7 @@ import 'package:selfprivacy/logic/models/server_basic_info.dart'; import 'package:selfprivacy/logic/models/server_metadata.dart'; import 'package:selfprivacy/logic/models/server_provider_location.dart'; import 'package:selfprivacy/logic/models/server_type.dart'; -import 'package:selfprivacy/logic/providers/server_provider.dart'; +import 'package:selfprivacy/logic/providers/server_providers/server_provider.dart'; import 'package:selfprivacy/utils/extensions/string_extensions.dart'; import 'package:selfprivacy/utils/network_utils.dart'; import 'package:selfprivacy/utils/password_generator.dart'; diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index 7d4221fa..9e6cce8b 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -13,7 +13,7 @@ import 'package:selfprivacy/logic/models/server_basic_info.dart'; import 'package:selfprivacy/logic/models/server_metadata.dart'; import 'package:selfprivacy/logic/models/server_provider_location.dart'; import 'package:selfprivacy/logic/models/server_type.dart'; -import 'package:selfprivacy/logic/providers/server_provider.dart'; +import 'package:selfprivacy/logic/providers/server_providers/server_provider.dart'; import 'package:selfprivacy/utils/extensions/string_extensions.dart'; import 'package:selfprivacy/utils/network_utils.dart'; import 'package:selfprivacy/utils/password_generator.dart'; diff --git a/lib/logic/providers/server_provider.dart b/lib/logic/providers/server_providers/server_provider.dart similarity index 100% rename from lib/logic/providers/server_provider.dart rename to lib/logic/providers/server_providers/server_provider.dart diff --git a/lib/logic/providers/server_providers/server_provider_factory.dart b/lib/logic/providers/server_providers/server_provider_factory.dart index 2d35ecba..786b1c02 100644 --- a/lib/logic/providers/server_providers/server_provider_factory.dart +++ b/lib/logic/providers/server_providers/server_provider_factory.dart @@ -1,6 +1,6 @@ import 'package:selfprivacy/logic/providers/provider_settings.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; -import 'package:selfprivacy/logic/providers/server_provider.dart'; +import 'package:selfprivacy/logic/providers/server_providers/server_provider.dart'; import 'package:selfprivacy/logic/providers/server_providers/digital_ocean.dart'; import 'package:selfprivacy/logic/providers/server_providers/hetzner.dart'; From 5cbf399a584bb8163aa65c970d5e4df37479f8db Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 2 May 2023 23:49:13 -0300 Subject: [PATCH 43/96] fix: Remove accidental hardcode for staging options --- lib/logic/api_maps/staging_options.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/logic/api_maps/staging_options.dart b/lib/logic/api_maps/staging_options.dart index 26b07e53..7d3084b7 100644 --- a/lib/logic/api_maps/staging_options.dart +++ b/lib/logic/api_maps/staging_options.dart @@ -4,5 +4,5 @@ class StagingOptions { /// Whether we request for staging temprorary certificates. /// Hardcode to 'true' in the middle of testing to not /// get your domain banned by constant certificate renewal - static bool get stagingAcme => true; + static bool get stagingAcme => false; } From 72a04a54b3c05a62b2f23c26bb20f7a93c5858b9 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 3 May 2023 00:01:44 -0300 Subject: [PATCH 44/96] refactor: Remove low level ApiController and replace Dns interfaces --- .../api_maps/rest_maps/api_controller.dart | 21 ------- .../rest_maps/api_factory_creator.dart | 57 ------------------- .../digital_ocean/digital_ocean_api.dart | 1 - .../cubit/dns_records/dns_records_cubit.dart | 48 ++++++++-------- .../initializing/domain_setup_cubit.dart | 12 ++-- .../server_installation_cubit.dart | 16 ++---- .../server_installation_repository.dart | 25 ++++---- .../models/launch_installation_data.dart | 6 +- .../providers/server_providers/hetzner.dart | 4 +- 9 files changed, 49 insertions(+), 141 deletions(-) delete mode 100644 lib/logic/api_maps/rest_maps/api_controller.dart delete mode 100644 lib/logic/api_maps/rest_maps/api_factory_creator.dart diff --git a/lib/logic/api_maps/rest_maps/api_controller.dart b/lib/logic/api_maps/rest_maps/api_controller.dart deleted file mode 100644 index 9cee1fe9..00000000 --- a/lib/logic/api_maps/rest_maps/api_controller.dart +++ /dev/null @@ -1,21 +0,0 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_creator.dart'; -import 'package:selfprivacy/logic/providers/provider_settings.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart'; - -class ApiController { - static DnsProviderApiFactory? get currentDnsProviderApiFactory => - _dnsProviderApiFactory; - - static void initDnsProviderApiFactory( - final DnsProviderSettings settings, - ) { - _dnsProviderApiFactory = - ApiFactoryCreator.createDnsProviderApiFactory(settings); - } - - static void clearProviderApiFactories() { - _dnsProviderApiFactory = null; - } - - static DnsProviderApiFactory? _dnsProviderApiFactory; -} diff --git a/lib/logic/api_maps/rest_maps/api_factory_creator.dart b/lib/logic/api_maps/rest_maps/api_factory_creator.dart deleted file mode 100644 index 69cfa766..00000000 --- a/lib/logic/api_maps/rest_maps/api_factory_creator.dart +++ /dev/null @@ -1,57 +0,0 @@ -import 'package:selfprivacy/logic/providers/provider_settings.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_factory.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_factory.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api_factory.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api_factory.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_factory.dart'; -import 'package:selfprivacy/logic/models/hive/server_details.dart'; -import 'package:selfprivacy/logic/models/hive/server_domain.dart'; - -class UnknownApiProviderException implements Exception { - UnknownApiProviderException(this.message); - final String message; -} - -class ApiFactoryCreator { - static ServerProviderApiFactory createServerProviderApiFactory( - final ServerProviderSettings settings, - ) { - switch (settings.provider) { - case ServerProviderType.hetzner: - return HetznerApiFactory(region: settings.location); - case ServerProviderType.digitalOcean: - return DigitalOceanApiFactory(region: settings.location); - case ServerProviderType.unknown: - throw UnknownApiProviderException('Unknown server provider'); - } - } - - static DnsProviderApiFactory createDnsProviderApiFactory( - final DnsProviderSettings settings, - ) { - switch (settings.provider) { - case DnsProviderType.cloudflare: - return CloudflareApiFactory(); - case DnsProviderType.digitalOcean: - return DigitalOceanDnsApiFactory(); - case DnsProviderType.unknown: - throw UnknownApiProviderException('Unknown DNS provider'); - } - } -} - -class VolumeApiFactoryCreator { - static VolumeProviderApiFactory createVolumeProviderApiFactory( - final ServerProviderSettings settings, - ) { - switch (settings.provider) { - case ServerProviderType.hetzner: - return HetznerApiFactory(); - case ServerProviderType.digitalOcean: - return DigitalOceanApiFactory(); - case ServerProviderType.unknown: - throw UnknownApiProviderException('Unknown volume provider'); - } - } -} diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart index e6c5f1b4..990a06e4 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart @@ -7,7 +7,6 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_pro import 'package:selfprivacy/logic/api_maps/staging_options.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; -import 'package:selfprivacy/logic/models/price.dart'; import 'package:selfprivacy/logic/models/server_provider_location.dart'; import 'package:selfprivacy/utils/password_generator.dart'; diff --git a/lib/logic/cubit/dns_records/dns_records_cubit.dart b/lib/logic/cubit/dns_records/dns_records_cubit.dart index 589fb1ff..3905ff33 100644 --- a/lib/logic/cubit/dns_records/dns_records_cubit.dart +++ b/lib/logic/cubit/dns_records/dns_records_cubit.dart @@ -1,11 +1,11 @@ import 'package:cubit_form/cubit_form.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/api_controller.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server_api.dart'; +import 'package:selfprivacy/logic/providers/providers_controller.dart'; import 'package:selfprivacy/utils/network_utils.dart'; part 'dns_records_state.dart'; @@ -25,14 +25,12 @@ class DnsRecordsCubit emit( DnsRecordsState( dnsState: DnsRecordsStatus.refreshing, - dnsRecords: ApiController.currentDnsProviderApiFactory! - .getDnsProvider() - .getDesiredDnsRecords( - domainName: - serverInstallationCubit.state.serverDomain?.domainName, - dkimPublicKey: '', - ipAddress: '', - ), + dnsRecords: + ProvidersController.currentDnsProvider!.getDesiredDnsRecords( + domainName: serverInstallationCubit.state.serverDomain?.domainName, + dkimPublicKey: '', + ipAddress: '', + ), ), ); @@ -41,20 +39,17 @@ class DnsRecordsCubit final String? ipAddress = serverInstallationCubit.state.serverDetails?.ip4; if (domain != null && ipAddress != null) { - final List records = await ApiController - .currentDnsProviderApiFactory! - .getDnsProvider() + final List records = await ProvidersController + .currentDnsProvider! .getDnsRecords(domain: domain); final String? dkimPublicKey = extractDkimRecord(await api.getDnsRecords())?.content; - final List desiredRecords = ApiController - .currentDnsProviderApiFactory! - .getDnsProvider() - .getDesiredDnsRecords( - domainName: domain.domainName, - ipAddress: ipAddress, - dkimPublicKey: dkimPublicKey, - ); + final List desiredRecords = + ProvidersController.currentDnsProvider!.getDesiredDnsRecords( + domainName: domain.domainName, + ipAddress: ipAddress, + dkimPublicKey: dkimPublicKey, + ); final List foundRecords = []; for (final DesiredDnsRecord desiredRecord in desiredRecords) { if (desiredRecord.description == 'record.dkim') { @@ -128,10 +123,10 @@ class DnsRecordsCubit emit(state.copyWith(dnsState: DnsRecordsStatus.refreshing)); final ServerDomain? domain = serverInstallationCubit.state.serverDomain; final String? ipAddress = serverInstallationCubit.state.serverDetails?.ip4; - final DnsProviderApi dnsProviderApi = - ApiController.currentDnsProviderApiFactory!.getDnsProvider(); - await dnsProviderApi.removeSimilarRecords(domain: domain!); - await dnsProviderApi.createMultipleDnsRecords( + await ProvidersController.currentDnsProvider!.removeSimilarRecords( + domain: domain!, + ); + await ProvidersController.currentDnsProvider!.createMultipleDnsRecords( domain: domain, ip4: ipAddress, ); @@ -139,7 +134,10 @@ class DnsRecordsCubit final List records = await api.getDnsRecords(); final DnsRecord? dkimRecord = extractDkimRecord(records); if (dkimRecord != null) { - await dnsProviderApi.setDnsRecord(dkimRecord, domain); + await ProvidersController.currentDnsProvider!.setDnsRecord( + dkimRecord, + domain, + ); } await load(); diff --git a/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart b/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart index 0afe77c2..cb6e1a6e 100644 --- a/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart @@ -1,7 +1,7 @@ import 'package:cubit_form/cubit_form.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/api_controller.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; +import 'package:selfprivacy/logic/providers/providers_controller.dart'; class DomainSetupCubit extends Cubit { DomainSetupCubit(this.serverInstallationCubit) : super(Initial()); @@ -10,9 +10,8 @@ class DomainSetupCubit extends Cubit { Future load() async { emit(Loading(LoadingTypes.loadingDomain)); - final List list = await ApiController.currentDnsProviderApiFactory! - .getDnsProvider() - .domainList(); + final List list = + await ProvidersController.currentDnsProvider!.domainList(); if (list.isEmpty) { emit(Empty()); } else if (list.length == 1) { @@ -28,9 +27,8 @@ class DomainSetupCubit extends Cubit { emit(Loading(LoadingTypes.saving)); - final String? zoneId = await ApiController.currentDnsProviderApiFactory! - .getDnsProvider() - .getZoneId(domainName); + final String? zoneId = + await ProvidersController.currentDnsProvider!.getZoneId(domainName); if (zoneId != null) { final ServerDomain domain = ServerDomain( diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index dd8dd998..ca8b0958 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -5,11 +5,9 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:equatable/equatable.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server_api.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/api_controller.dart'; import 'package:selfprivacy/logic/models/callback_dialogue_branching.dart'; import 'package:selfprivacy/logic/models/launch_installation_data.dart'; import 'package:selfprivacy/logic/providers/provider_settings.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart'; import 'package:selfprivacy/logic/providers/providers_controller.dart'; import 'package:selfprivacy/logic/models/hive/backblaze_credential.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; @@ -68,7 +66,7 @@ class ServerInstallationCubit extends Cubit { void setDnsProviderType(final DnsProviderType providerType) async { await repository.saveDnsProviderType(providerType); - ApiController.initDnsProviderApiFactory( + ProvidersController.initDnsProvider( DnsProviderSettings( provider: providerType, ), @@ -97,11 +95,9 @@ class ServerInstallationCubit extends Cubit { final String providerToken, ) async { final GenericResult apiResponse = - await ApiController.currentDnsProviderApiFactory! - .getDnsProvider( - settings: const DnsProviderApiSettings(isWithToken: false), - ) - .isApiTokenValid(providerToken); + await ProvidersController.currentDnsProvider!.tryInitApiByToken( + providerToken, + ); if (!apiResponse.success) { getIt().showSnackBar( @@ -250,8 +246,7 @@ class ServerInstallationCubit extends Cubit { serverTypeId: state.serverTypeIdentificator!, errorCallback: clearAppConfig, successCallback: onCreateServerSuccess, - dnsProviderApi: - ApiController.currentDnsProviderApiFactory!.getDnsProvider(), + dnsProvider: ProvidersController.currentDnsProvider!, ); final result = @@ -754,7 +749,6 @@ class ServerInstallationCubit extends Cubit { void clearAppConfig() { closeTimer(); - ApiController.clearProviderApiFactories(); ProvidersController.clearProviders(); repository.clearAppConfig(); emit(const ServerInstallationEmpty()); diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 55231904..6c352a88 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -10,12 +10,10 @@ import 'package:hive/hive.dart'; import 'package:pub_semver/pub_semver.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/config/hive_config.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/api_controller.dart'; import 'package:selfprivacy/logic/providers/provider_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server_api.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/models/hive/backblaze_credential.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; @@ -72,7 +70,7 @@ class ServerInstallationRepository { if (dnsProvider != null || (serverDomain != null && serverDomain.provider != ServerProviderType.unknown)) { - ApiController.initDnsProviderApiFactory( + ProvidersController.initDnsProvider( DnsProviderSettings( provider: dnsProvider ?? serverDomain!.provider, ), @@ -239,8 +237,6 @@ class ServerInstallationRepository { final ServerDomain domain, { required final void Function() onCancel, }) async { - final DnsProviderApi dnsProviderApi = - ApiController.currentDnsProviderApiFactory!.getDnsProvider(); final serverProvider = ProvidersController.currentServerProvider!; void showDomainErrorPopUp(final String error) { @@ -259,7 +255,7 @@ class ServerInstallationRepository { } final GenericResult removingResult = - await dnsProviderApi.removeSimilarRecords( + await ProvidersController.currentDnsProvider!.removeSimilarRecords( ip4: serverDetails.ip4, domain: domain, ); @@ -272,8 +268,9 @@ class ServerInstallationRepository { bool createdSuccessfully = false; String errorMessage = 'domain.error'.tr(); try { - final GenericResult createResult = - await dnsProviderApi.createMultipleDnsRecords( + final GenericResult createResult = await ProvidersController + .currentDnsProvider! + .createMultipleDnsRecords( ip4: serverDetails.ip4, domain: domain, ); @@ -293,8 +290,6 @@ class ServerInstallationRepository { } Future createDkimRecord(final ServerDomain cloudFlareDomain) async { - final DnsProviderApi dnsProviderApi = - ApiController.currentDnsProviderApiFactory!.getDnsProvider(); final ServerApi api = ServerApi(); late DnsRecord record; @@ -305,7 +300,10 @@ class ServerInstallationRepository { rethrow; } - await dnsProviderApi.setDnsRecord(record, cloudFlareDomain); + await ProvidersController.currentDnsProvider!.setDnsRecord( + record, + cloudFlareDomain, + ); } Future isHttpServerWorking() async { @@ -677,9 +675,8 @@ class ServerInstallationRepository { await box.put(BNames.isLoading, false); await box.put(BNames.serverDetails, null); - final GenericResult removalResult = await ApiController - .currentDnsProviderApiFactory! - .getDnsProvider() + final GenericResult removalResult = await ProvidersController + .currentDnsProvider! .removeSimilarRecords(domain: serverDomain); if (!removalResult.success) { diff --git a/lib/logic/models/launch_installation_data.dart b/lib/logic/models/launch_installation_data.dart index 9a394923..37638835 100644 --- a/lib/logic/models/launch_installation_data.dart +++ b/lib/logic/models/launch_installation_data.dart @@ -1,14 +1,14 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; +import 'package:selfprivacy/logic/providers/dns_providers/dns_provider.dart'; class LaunchInstallationData { LaunchInstallationData({ required this.rootUser, required this.dnsApiToken, required this.dnsProviderType, - required this.dnsProviderApi, + required this.dnsProvider, required this.serverDomain, required this.serverTypeId, required this.errorCallback, @@ -19,7 +19,7 @@ class LaunchInstallationData { final String dnsApiToken; final ServerDomain serverDomain; final DnsProviderType dnsProviderType; - final DnsProviderApi dnsProviderApi; + final DnsProvider dnsProvider; final String serverTypeId; final Function() errorCallback; final Function(ServerHostingDetails details) successCallback; diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index 9e6cce8b..dedcabfe 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -580,11 +580,11 @@ class HetznerServerProvider extends ServerProvider { } await installationData.successCallback(serverDetails); - await installationData.dnsProviderApi.removeSimilarRecords( + await installationData.dnsProvider.removeSimilarRecords( ip4: serverDetails.ip4, domain: installationData.serverDomain, ); - await installationData.dnsProviderApi.createMultipleDnsRecords( + await installationData.dnsProvider.createMultipleDnsRecords( ip4: serverDetails.ip4, domain: installationData.serverDomain, ); From 234064ed72820d6721279b267c94ae7e86d51d6c Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 9 May 2023 03:15:48 -0300 Subject: [PATCH 45/96] feat: Implement infrastructure for new DNS provider deSEC --- assets/images/logos/desec.svg | 89 +++++ lib/config/hive_config.dart | 3 + .../rest_maps/api_factory_creator.dart | 3 + .../rest_maps/dns_providers/desec/desec.dart | 287 ++++++++++++++++ .../dns_providers/desec/desec_factory.dart | 16 + .../server_installation_cubit.dart | 9 + .../server_installation_repository.dart | 4 + lib/logic/get_it/api_config.dart | 10 + lib/logic/models/hive/server_domain.dart | 2 + .../initializing/dns_provider_picker.dart | 307 ++++++++++++++++++ .../setup/initializing/initializing.dart | 60 +--- 11 files changed, 742 insertions(+), 48 deletions(-) create mode 100644 assets/images/logos/desec.svg create mode 100644 lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart create mode 100644 lib/logic/api_maps/rest_maps/dns_providers/desec/desec_factory.dart create mode 100644 lib/ui/pages/setup/initializing/dns_provider_picker.dart diff --git a/assets/images/logos/desec.svg b/assets/images/logos/desec.svg new file mode 100644 index 00000000..cb54b268 --- /dev/null +++ b/assets/images/logos/desec.svg @@ -0,0 +1,89 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/lib/config/hive_config.dart b/lib/config/hive_config.dart index b6ba018c..44b03f26 100644 --- a/lib/config/hive_config.dart +++ b/lib/config/hive_config.dart @@ -93,6 +93,9 @@ class BNames { /// A String field of [serverInstallationBox] box. static String serverProvider = 'serverProvider'; + /// A String field of [serverInstallationBox] box. + static String dnsProvider = 'dnsProvider'; + /// A String field of [serverLocation] box. static String serverLocation = 'serverLocation'; diff --git a/lib/logic/api_maps/rest_maps/api_factory_creator.dart b/lib/logic/api_maps/rest_maps/api_factory_creator.dart index 25518f3c..c1762429 100644 --- a/lib/logic/api_maps/rest_maps/api_factory_creator.dart +++ b/lib/logic/api_maps/rest_maps/api_factory_creator.dart @@ -1,5 +1,6 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_factory.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desec/desec_factory.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_factory.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_factory.dart'; @@ -30,6 +31,8 @@ class ApiFactoryCreator { final DnsProviderApiFactorySettings settings, ) { switch (settings.provider) { + case DnsProvider.desec: + return DesecApiFactory(); case DnsProvider.cloudflare: return CloudflareApiFactory(); case DnsProvider.unknown: diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart new file mode 100644 index 00000000..1906be55 --- /dev/null +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart @@ -0,0 +1,287 @@ +import 'dart:io'; + +import 'package:dio/dio.dart'; +import 'package:selfprivacy/config/get_it_config.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; +import 'package:selfprivacy/logic/models/hive/server_domain.dart'; +import 'package:selfprivacy/logic/models/json/dns_records.dart'; + +class DesecApi extends DnsProviderApi { + DesecApi({ + this.hasLogger = false, + this.isWithToken = true, + this.customToken, + }); + @override + final bool hasLogger; + @override + final bool isWithToken; + + final String? customToken; + + @override + RegExp getApiTokenValidation() => + RegExp(r'\s+|[!$%^&*()@+|~=`{}\[\]:<>?,.\/]'); + + @override + BaseOptions get options { + final BaseOptions options = BaseOptions(baseUrl: rootAddress); + if (isWithToken) { + final String? token = getIt().cloudFlareKey; + assert(token != null); + options.headers = {'Authorization': 'Bearer $token'}; + } + + if (customToken != null) { + options.headers = {'Authorization': 'Bearer $customToken'}; + } + + if (validateStatus != null) { + options.validateStatus = validateStatus!; + } + return options; + } + + @override + String rootAddress = 'https://desec.io/api/v1/domains/'; + + @override + Future> isApiTokenValid(final String token) async { + bool isValid = false; + Response? response; + String message = ''; + final Dio client = await getClient(); + try { + response = await client.get( + '', + options: Options( + followRedirects: false, + validateStatus: (final status) => + status != null && (status >= 200 || status == 401), + headers: {'Authorization': 'Token $token'}, + ), + ); + } catch (e) { + print(e); + isValid = false; + message = e.toString(); + } finally { + close(client); + } + + if (response == null) { + return APIGenericResult( + data: isValid, + success: false, + message: message, + ); + } + + if (response.statusCode == HttpStatus.ok) { + isValid = true; + } else if (response.statusCode == HttpStatus.unauthorized) { + isValid = false; + } else { + throw Exception('code: ${response.statusCode}'); + } + + return APIGenericResult( + data: isValid, + success: true, + message: response.statusMessage, + ); + } + + @override + Future getZoneId(final String domain) async => domain; + + @override + Future> removeSimilarRecords({ + required final ServerDomain domain, + final String? ip4, + }) async { + final String domainName = domain.domainName; + final String url = '/$domainName/rrsets/'; + + final Dio client = await getClient(); + try { + final Response response = await client.get(url); + + final List records = response.data['result'] ?? []; + await client.put(url, data: records); + } catch (e) { + print(e); + return APIGenericResult( + success: false, + data: null, + message: e.toString(), + ); + } finally { + close(client); + } + + return APIGenericResult(success: true, data: null); + } + + @override + Future> getDnsRecords({ + required final ServerDomain domain, + }) async { + Response response; + final String domainName = domain.domainName; + final List allRecords = []; + + final String url = '/$domainName/rrsets/'; + + final Dio client = await getClient(); + try { + response = await client.get(url); + final List records = response.data['result'] ?? []; + + for (final record in records) { + allRecords.add( + DnsRecord( + name: record['subname'], + type: record['type'], + content: record['records'], + ttl: record['ttl'], + ), + ); + } + } catch (e) { + print(e); + } finally { + close(client); + } + + return allRecords; + } + + @override + Future> createMultipleDnsRecords({ + required final ServerDomain domain, + final String? ip4, + }) async { + final String domainName = domain.domainName; + final List listDnsRecords = projectDnsRecords(domainName, ip4); + final List allCreateFutures = []; + + final Dio client = await getClient(); + try { + for (final DnsRecord record in listDnsRecords) { + allCreateFutures.add( + client.post( + '/$domainName/rrsets/', + data: record.toJson(), + ), + ); + } + await Future.wait(allCreateFutures); + } on DioError catch (e) { + print(e.message); + rethrow; + } catch (e) { + print(e); + return APIGenericResult( + success: false, + data: null, + message: e.toString(), + ); + } finally { + close(client); + } + + return APIGenericResult(success: true, data: null); + } + + List projectDnsRecords( + final String? domainName, + final String? ip4, + ) { + final DnsRecord domainA = + DnsRecord(type: 'A', name: domainName, content: ip4); + + final DnsRecord mx = DnsRecord(type: 'MX', name: '@', content: domainName); + final DnsRecord apiA = DnsRecord(type: 'A', name: 'api', content: ip4); + final DnsRecord cloudA = DnsRecord(type: 'A', name: 'cloud', content: ip4); + final DnsRecord gitA = DnsRecord(type: 'A', name: 'git', content: ip4); + final DnsRecord meetA = DnsRecord(type: 'A', name: 'meet', content: ip4); + final DnsRecord passwordA = + DnsRecord(type: 'A', name: 'password', content: ip4); + final DnsRecord socialA = + DnsRecord(type: 'A', name: 'social', content: ip4); + final DnsRecord vpn = DnsRecord(type: 'A', name: 'vpn', content: ip4); + + final DnsRecord txt1 = DnsRecord( + type: 'TXT', + name: '_dmarc', + content: 'v=DMARC1; p=none', + ttl: 18000, + ); + + final DnsRecord txt2 = DnsRecord( + type: 'TXT', + name: domainName, + content: 'v=spf1 a mx ip4:$ip4 -all', + ttl: 18000, + ); + + return [ + domainA, + apiA, + cloudA, + gitA, + meetA, + passwordA, + socialA, + mx, + txt1, + txt2, + vpn + ]; + } + + @override + Future setDnsRecord( + final DnsRecord record, + final ServerDomain domain, + ) async { + final String domainZoneId = domain.zoneId; + final String url = '$rootAddress/zones/$domainZoneId/dns_records'; + + final Dio client = await getClient(); + try { + await client.post( + url, + data: record.toJson(), + ); + } catch (e) { + print(e); + } finally { + close(client); + } + } + + @override + Future> domainList() async { + final String url = '$rootAddress/zones'; + List domains = []; + + final Dio client = await getClient(); + try { + final Response response = await client.get( + url, + queryParameters: {'per_page': 50}, + ); + domains = response.data['result'] + .map((final el) => el['name'] as String) + .toList(); + } catch (e) { + print(e); + } finally { + close(client); + } + + return domains; + } +} diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_factory.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_factory.dart new file mode 100644 index 00000000..6c10259b --- /dev/null +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_factory.dart @@ -0,0 +1,16 @@ +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desec/desec.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart'; + +class DesecApiFactory extends DnsProviderApiFactory { + @override + DnsProviderApi getDnsProvider({ + final DnsProviderApiSettings settings = const DnsProviderApiSettings(), + }) => + DesecApi( + hasLogger: settings.hasLogger, + isWithToken: settings.isWithToken, + customToken: settings.customToken, + ); +} diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 5638b765..06df6d5a 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -66,6 +66,15 @@ class ServerInstallationCubit extends Cubit { ); } + void setDnsProviderType(final DnsProvider providerType) async { + await repository.saveDnsProviderType(providerType); + ApiController.initDnsProviderApiFactory( + DnsProviderApiFactorySettings( + provider: providerType, + ), + ); + } + ProviderApiTokenValidation serverProviderApiTokenValidation() => ApiController.currentServerProviderApiFactory! .getServerProvider() diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 5d45e7b9..851b2be5 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -706,6 +706,10 @@ class ServerInstallationRepository { getIt().init(); } + Future saveDnsProviderType(final DnsProvider type) async { + await getIt().storeDnsProviderType(type); + } + Future saveBackblazeKey( final BackblazeCredential backblazeCredential, ) async { diff --git a/lib/logic/get_it/api_config.dart b/lib/logic/get_it/api_config.dart index 434c9b32..11d73a85 100644 --- a/lib/logic/get_it/api_config.dart +++ b/lib/logic/get_it/api_config.dart @@ -14,6 +14,8 @@ class ApiConfigModel { String? get serverType => _serverType; String? get cloudFlareKey => _cloudFlareKey; ServerProvider? get serverProvider => _serverProvider; + DnsProvider? get dnsProvider => _dnsProvider; + BackblazeCredential? get backblazeCredential => _backblazeCredential; ServerDomain? get serverDomain => _serverDomain; BackblazeBucket? get backblazeBucket => _backblazeBucket; @@ -23,6 +25,7 @@ class ApiConfigModel { String? _cloudFlareKey; String? _serverType; ServerProvider? _serverProvider; + DnsProvider? _dnsProvider; ServerHostingDetails? _serverDetails; BackblazeCredential? _backblazeCredential; ServerDomain? _serverDomain; @@ -33,6 +36,11 @@ class ApiConfigModel { _serverProvider = value; } + Future storeDnsProviderType(final DnsProvider value) async { + await _box.put(BNames.dnsProvider, value); + _dnsProvider = value; + } + Future storeServerProviderKey(final String value) async { await _box.put(BNames.hetznerKey, value); _serverProviderKey = value; @@ -75,6 +83,7 @@ class ApiConfigModel { void clear() { _serverProviderKey = null; + _dnsProvider = null; _serverLocation = null; _cloudFlareKey = null; _backblazeCredential = null; @@ -95,5 +104,6 @@ class ApiConfigModel { _backblazeBucket = _box.get(BNames.backblazeBucket); _serverType = _box.get(BNames.serverTypeIdentifier); _serverProvider = _box.get(BNames.serverProvider); + _dnsProvider = _box.get(BNames.dnsProvider); } } diff --git a/lib/logic/models/hive/server_domain.dart b/lib/logic/models/hive/server_domain.dart index 9b5d32c1..913fcd42 100644 --- a/lib/logic/models/hive/server_domain.dart +++ b/lib/logic/models/hive/server_domain.dart @@ -29,4 +29,6 @@ enum DnsProvider { unknown, @HiveField(1) cloudflare, + @HiveField(2) + desec } diff --git a/lib/ui/pages/setup/initializing/dns_provider_picker.dart b/lib/ui/pages/setup/initializing/dns_provider_picker.dart new file mode 100644 index 00000000..cb0d2111 --- /dev/null +++ b/lib/ui/pages/setup/initializing/dns_provider_picker.dart @@ -0,0 +1,307 @@ +import 'package:cubit_form/cubit_form.dart'; +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:selfprivacy/config/brand_theme.dart'; +import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; +import 'package:selfprivacy/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart'; +import 'package:selfprivacy/logic/models/hive/server_domain.dart'; +import 'package:selfprivacy/ui/components/brand_md/brand_md.dart'; +import 'package:selfprivacy/ui/components/buttons/brand_button.dart'; +import 'package:selfprivacy/ui/components/buttons/outlined_button.dart'; +import 'package:selfprivacy/ui/components/cards/outlined_card.dart'; +import 'package:selfprivacy/utils/launch_url.dart'; + +class DnsProviderPicker extends StatefulWidget { + const DnsProviderPicker({ + required this.formCubit, + required this.serverInstallationCubit, + super.key, + }); + + final DnsProviderFormCubit formCubit; + final ServerInstallationCubit serverInstallationCubit; + + @override + State createState() => _DnsProviderPickerState(); +} + +class _DnsProviderPickerState extends State { + DnsProvider selectedProvider = DnsProvider.unknown; + + void setProvider(final DnsProvider provider) { + setState(() { + selectedProvider = provider; + }); + } + + @override + Widget build(final BuildContext context) { + switch (selectedProvider) { + case DnsProvider.unknown: + return ProviderSelectionPage( + serverInstallationCubit: widget.serverInstallationCubit, + callback: setProvider, + ); + + case DnsProvider.cloudflare: + return ProviderInputDataPage( + providerCubit: widget.formCubit, + providerInfo: ProviderPageInfo( + providerType: DnsProvider.cloudflare, + pathToHow: 'how_cloudflare', + image: Image.asset( + 'assets/images/logos/cloudflare.png', + width: 150, + ), + ), + ); + + case DnsProvider.desec: + return ProviderInputDataPage( + providerCubit: widget.formCubit, + providerInfo: ProviderPageInfo( + providerType: DnsProvider.desec, + pathToHow: 'how_digital_ocean_dns', + image: Image.asset( + 'assets/images/logos/digital_ocean.png', + width: 150, + ), + ), + ); + } + } +} + +class ProviderPageInfo { + const ProviderPageInfo({ + required this.providerType, + required this.pathToHow, + required this.image, + }); + + final String pathToHow; + final Image image; + final DnsProvider providerType; +} + +class ProviderInputDataPage extends StatelessWidget { + const ProviderInputDataPage({ + required this.providerInfo, + required this.providerCubit, + super.key, + }); + + final ProviderPageInfo providerInfo; + final DnsProviderFormCubit providerCubit; + + @override + Widget build(final BuildContext context) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'initializing.connect_to_dns'.tr(), + style: Theme.of(context).textTheme.headlineSmall, + ), + const SizedBox(height: 16), + Text( + 'initializing.connect_to_server_provider_text'.tr(), + style: Theme.of(context).textTheme.bodyMedium, + ), + const SizedBox(height: 32), + CubitFormTextField( + formFieldCubit: providerCubit.apiKey, + textAlign: TextAlign.center, + scrollPadding: const EdgeInsets.only(bottom: 70), + decoration: const InputDecoration( + hintText: 'Provider API Token', + ), + ), + const SizedBox(height: 32), + BrandButton.rised( + text: 'basis.connect'.tr(), + onPressed: () => providerCubit.trySubmit(), + ), + const SizedBox(height: 10), + BrandOutlinedButton( + child: Text('initializing.how'.tr()), + onPressed: () => showModalBottomSheet( + context: context, + isScrollControlled: true, + backgroundColor: Colors.transparent, + builder: (final BuildContext context) => Padding( + padding: paddingH15V0, + child: ListView( + padding: const EdgeInsets.symmetric(vertical: 16), + children: [ + BrandMarkdown( + fileName: providerInfo.pathToHow, + ), + ], + ), + ), + ), + ), + ], + ); +} + +class ProviderSelectionPage extends StatelessWidget { + const ProviderSelectionPage({ + required this.callback, + required this.serverInstallationCubit, + super.key, + }); + + final Function callback; + final ServerInstallationCubit serverInstallationCubit; + + @override + Widget build(final BuildContext context) => SizedBox( + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'initializing.select_dns'.tr(), + style: Theme.of(context).textTheme.headlineSmall, + ), + const SizedBox(height: 10), + Text( + 'initializing.select_provider'.tr(), + style: Theme.of(context).textTheme.bodyMedium, + ), + const SizedBox(height: 10), + OutlinedCard( + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + width: 40, + height: 40, + padding: const EdgeInsets.all(10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(40), + color: const Color.fromARGB(255, 241, 215, 166), + ), + child: SvgPicture.asset( + 'assets/images/logos/cloudflare.svg', + ), + ), + const SizedBox(width: 16), + Text( + 'Hetzner Cloud', + style: Theme.of(context).textTheme.titleMedium, + ), + ], + ), + const SizedBox(height: 16), + Text( + 'initializing.select_provider_price_title'.tr(), + style: Theme.of(context).textTheme.bodyLarge, + ), + Text( + 'initializing.select_provider_price_free'.tr(), + style: Theme.of(context).textTheme.bodySmall, + ), + const SizedBox(height: 16), + Text( + 'initializing.select_provider_payment_title'.tr(), + style: Theme.of(context).textTheme.bodyLarge, + ), + Text( + 'initializing.select_provider_payment_text_cloudflare' + .tr(), + style: Theme.of(context).textTheme.bodySmall, + ), + const SizedBox(height: 16), + BrandButton.rised( + text: 'basis.select'.tr(), + onPressed: () { + serverInstallationCubit + .setDnsProviderType(DnsProvider.cloudflare); + callback(DnsProvider.cloudflare); + }, + ), + // Outlined button that will open website + BrandOutlinedButton( + onPressed: () => + launchURL('https://dash.cloudflare.com/'), + title: 'initializing.select_provider_site_button'.tr(), + ), + ], + ), + ), + ), + const SizedBox(height: 16), + OutlinedCard( + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + width: 40, + height: 40, + padding: const EdgeInsets.all(10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(40), + color: const Color.fromARGB(255, 245, 229, 82), + ), + child: SvgPicture.asset( + 'assets/images/logos/desec.svg', + ), + ), + const SizedBox(width: 16), + Text( + 'deSEC', + style: Theme.of(context).textTheme.titleMedium, + ), + ], + ), + const SizedBox(height: 16), + Text( + 'initializing.select_provider_price_title'.tr(), + style: Theme.of(context).textTheme.bodyLarge, + ), + Text( + 'initializing.select_provider_price_free'.tr(), + style: Theme.of(context).textTheme.bodySmall, + ), + const SizedBox(height: 16), + Text( + 'initializing.select_provider_payment_title'.tr(), + style: Theme.of(context).textTheme.bodyLarge, + ), + Text( + 'initializing.select_provider_payment_text_do'.tr(), + style: Theme.of(context).textTheme.bodySmall, + ), + const SizedBox(height: 16), + BrandButton.rised( + text: 'basis.select'.tr(), + onPressed: () { + serverInstallationCubit + .setDnsProviderType(DnsProvider.desec); + callback(DnsProvider.desec); + }, + ), + // Outlined button that will open website + BrandOutlinedButton( + onPressed: () => launchURL('https://desec.io/'), + title: 'initializing.select_provider_site_button'.tr(), + ), + ], + ), + ), + ), + ], + ), + ); +} diff --git a/lib/ui/pages/setup/initializing/initializing.dart b/lib/ui/pages/setup/initializing/initializing.dart index 199203c3..749fbdc9 100644 --- a/lib/ui/pages/setup/initializing/initializing.dart +++ b/lib/ui/pages/setup/initializing/initializing.dart @@ -17,6 +17,7 @@ import 'package:selfprivacy/ui/components/drawers/progress_drawer.dart'; import 'package:selfprivacy/ui/components/progress_bar/progress_bar.dart'; import 'package:selfprivacy/ui/components/drawers/support_drawer.dart'; import 'package:selfprivacy/ui/layouts/responsive_layout_with_infobox.dart'; +import 'package:selfprivacy/ui/pages/setup/initializing/dns_provider_picker.dart'; import 'package:selfprivacy/ui/pages/setup/initializing/server_provider_picker.dart'; import 'package:selfprivacy/ui/pages/setup/initializing/server_type_picker.dart'; import 'package:selfprivacy/ui/pages/setup/recovering/recovery_routing.dart'; @@ -39,7 +40,7 @@ class InitializingPage extends StatelessWidget { actualInitializingPage = [ () => _stepServerProviderToken(cubit), () => _stepServerType(cubit), - () => _stepCloudflare(cubit), + () => _stepDnsProviderToken(cubit), () => _stepBackblaze(cubit), () => _stepDomain(cubit), () => _stepUser(cubit), @@ -238,56 +239,19 @@ class InitializingPage extends StatelessWidget { ), ); - Widget _stepCloudflare(final ServerInstallationCubit initializingCubit) => + Widget _stepDnsProviderToken( + final ServerInstallationCubit initializingCubit, + ) => BlocProvider( create: (final context) => DnsProviderFormCubit(initializingCubit), child: Builder( - builder: (final context) => ResponsiveLayoutWithInfobox( - topChild: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - '${'initializing.connect_to_server_provider'.tr()}Cloudflare', - style: Theme.of(context).textTheme.headlineSmall, - ), - const SizedBox(height: 16), - Text( - 'initializing.manage_domain_dns'.tr(), - style: Theme.of(context).textTheme.bodyMedium, - ), - ], - ), - primaryColumn: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - CubitFormTextField( - formFieldCubit: context.read().apiKey, - textAlign: TextAlign.center, - scrollPadding: const EdgeInsets.only(bottom: 70), - decoration: InputDecoration( - hintText: 'initializing.cloudflare_api_token'.tr(), - ), - ), - const SizedBox(height: 32), - BrandButton.filled( - onPressed: () => - context.read().trySubmit(), - text: 'basis.connect'.tr(), - ), - const SizedBox(height: 10), - BrandOutlinedButton( - onPressed: () { - context.read().showArticle( - article: 'how_cloudflare', - context: context, - ); - Scaffold.of(context).openEndDrawer(); - }, - title: 'initializing.how'.tr(), - ), - ], - ), - ), + builder: (final context) { + final providerCubit = context.watch(); + return DnsProviderPicker( + formCubit: providerCubit, + serverInstallationCubit: initializingCubit, + ); + }, ), ); From af90ddd78a5579462cea73b2246183ec80b4bb9a Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 12 May 2023 03:07:43 -0300 Subject: [PATCH 46/96] feat: Implement deSEC API support --- .../rest_maps/dns_providers/desec/desec.dart | 40 ++++++++++++++----- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart index 1906be55..63c7acba 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart @@ -172,7 +172,18 @@ class DesecApi extends DnsProviderApi { allCreateFutures.add( client.post( '/$domainName/rrsets/', - data: record.toJson(), + data: record.name == null + ? { + 'type': record.type, + 'ttl': record.ttl, + 'records': [record.content], + } + : { + 'subname': record.name, + 'type': record.type, + 'ttl': record.ttl, + 'records': [record.content], + }, ), ); } @@ -198,10 +209,9 @@ class DesecApi extends DnsProviderApi { final String? domainName, final String? ip4, ) { - final DnsRecord domainA = - DnsRecord(type: 'A', name: domainName, content: ip4); + final DnsRecord domainA = DnsRecord(type: 'A', name: null, content: ip4); - final DnsRecord mx = DnsRecord(type: 'MX', name: '@', content: domainName); + final DnsRecord mx = DnsRecord(type: 'MX', name: null, content: domainName); final DnsRecord apiA = DnsRecord(type: 'A', name: 'api', content: ip4); final DnsRecord cloudA = DnsRecord(type: 'A', name: 'cloud', content: ip4); final DnsRecord gitA = DnsRecord(type: 'A', name: 'git', content: ip4); @@ -221,7 +231,7 @@ class DesecApi extends DnsProviderApi { final DnsRecord txt2 = DnsRecord( type: 'TXT', - name: domainName, + name: null, content: 'v=spf1 a mx ip4:$ip4 -all', ttl: 18000, ); @@ -246,14 +256,24 @@ class DesecApi extends DnsProviderApi { final DnsRecord record, final ServerDomain domain, ) async { - final String domainZoneId = domain.zoneId; - final String url = '$rootAddress/zones/$domainZoneId/dns_records'; + final String url = '/${domain.domainName}/rrsets/'; final Dio client = await getClient(); try { await client.post( url, - data: record.toJson(), + data: record.name == null + ? { + 'type': record.type, + 'ttl': record.ttl, + 'records': [record.content], + } + : { + 'subname': record.name, + 'type': record.type, + 'ttl': record.ttl, + 'records': [record.content], + }, ); } catch (e) { print(e); @@ -264,14 +284,12 @@ class DesecApi extends DnsProviderApi { @override Future> domainList() async { - final String url = '$rootAddress/zones'; List domains = []; final Dio client = await getClient(); try { final Response response = await client.get( - url, - queryParameters: {'per_page': 50}, + '', ); domains = response.data['result'] .map((final el) => el['name'] as String) From 56dd40e90e7eba31abf8a8435445c9782cbd415e Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 12 May 2023 16:32:19 -0300 Subject: [PATCH 47/96] fix: Adjust graphql schemas to new dns provider - fix runtime bugs --- .../schema/disk_volumes.graphql.dart | 1 + .../graphql_maps/schema/schema.graphql | 3 +- .../graphql_maps/schema/schema.graphql.dart | 6 +- .../graphql_maps/schema/server_api.graphql | 9 + .../schema/server_api.graphql.dart | 546 +++++++++++++++++- .../schema/server_settings.graphql.dart | 2 +- .../graphql_maps/schema/services.graphql.dart | 1 - .../graphql_maps/schema/users.graphql.dart | 2 +- .../graphql_maps/server_api/server_api.dart | 20 + .../dns_providers/cloudflare/cloudflare.dart | 2 +- .../rest_maps/dns_providers/desec/desec.dart | 12 +- .../digital_ocean/digital_ocean.dart | 4 +- .../server_providers/hetzner/hetzner.dart | 6 +- .../server_providers/server_provider.dart | 15 + .../initializing/dns_provider_form_cubit.dart | 4 +- .../server_installation_cubit.dart | 37 +- .../server_installation_repository.dart | 45 +- .../server_installation_state.dart | 40 +- lib/logic/get_it/api_config.dart | 12 +- lib/logic/models/hive/server_domain.dart | 14 +- lib/logic/models/hive/server_domain.g.dart | 5 + ...udflare.dart => recovery_confirm_dns.dart} | 4 +- .../setup/recovering/recovery_routing.dart | 6 +- lib/ui/router/router.gr.dart | 526 ++++++++--------- 24 files changed, 968 insertions(+), 354 deletions(-) rename lib/ui/pages/setup/recovering/{recovery_confirm_cloudflare.dart => recovery_confirm_dns.dart} (96%) diff --git a/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart index 22409ef9..9ffbfe0b 100644 --- a/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart @@ -3,6 +3,7 @@ import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; import 'package:selfprivacy/utils/scalars.dart'; import 'schema.graphql.dart'; +import 'services.graphql.dart'; class Fragment$basicMutationReturnFields { Fragment$basicMutationReturnFields({ diff --git a/lib/logic/api_maps/graphql_maps/schema/schema.graphql b/lib/logic/api_maps/graphql_maps/schema/schema.graphql index ed167742..89bc30c8 100644 --- a/lib/logic/api_maps/graphql_maps/schema/schema.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql @@ -75,7 +75,8 @@ type DeviceApiTokenMutationReturn implements MutationReturnInterface { } enum DnsProvider { - CLOUDFLARE + CLOUDFLARE, + DESEC } type DnsRecord { diff --git a/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart index 1b92ccad..8548e4dd 100644 --- a/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart @@ -1096,12 +1096,14 @@ class _CopyWithStubImpl$Input$UserMutationInput _res; } -enum Enum$DnsProvider { CLOUDFLARE, $unknown } +enum Enum$DnsProvider { CLOUDFLARE, DESEC, $unknown } String toJson$Enum$DnsProvider(Enum$DnsProvider e) { switch (e) { case Enum$DnsProvider.CLOUDFLARE: return r'CLOUDFLARE'; + case Enum$DnsProvider.DESEC: + return r'DESEC'; case Enum$DnsProvider.$unknown: return r'$unknown'; } @@ -1111,6 +1113,8 @@ Enum$DnsProvider fromJson$Enum$DnsProvider(String value) { switch (value) { case r'CLOUDFLARE': return Enum$DnsProvider.CLOUDFLARE; + case r'DESEC': + return Enum$DnsProvider.DESEC; default: return Enum$DnsProvider.$unknown; } diff --git a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql index d4339094..35df3749 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql @@ -72,6 +72,15 @@ query SystemServerProvider { } } +query SystemDnsProvider { + system { + domainInfo { + provider + } + } +} + + query GetApiTokens { api { devices { diff --git a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart index 4bb33228..4eda2c92 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart @@ -1,9 +1,9 @@ import 'dart:async'; -import 'disk_volumes.graphql.dart'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; import 'package:selfprivacy/utils/scalars.dart'; import 'schema.graphql.dart'; +import 'services.graphql.dart'; class Fragment$basicMutationReturnFields { Fragment$basicMutationReturnFields({ @@ -6380,6 +6380,550 @@ class _CopyWithStubImpl$Query$SystemServerProvider$system$provider _res; } +class Query$SystemDnsProvider { + Query$SystemDnsProvider({ + required this.system, + required this.$__typename, + }); + + factory Query$SystemDnsProvider.fromJson(Map json) { + final l$system = json['system']; + final l$$__typename = json['__typename']; + return Query$SystemDnsProvider( + system: Query$SystemDnsProvider$system.fromJson( + (l$system as Map)), + $__typename: (l$$__typename as String), + ); + } + + final Query$SystemDnsProvider$system system; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$system = system; + _resultData['system'] = l$system.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$system = system; + final l$$__typename = $__typename; + return Object.hashAll([ + l$system, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Query$SystemDnsProvider) || + runtimeType != other.runtimeType) { + return false; + } + final l$system = system; + final lOther$system = other.system; + if (l$system != lOther$system) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Query$SystemDnsProvider on Query$SystemDnsProvider { + CopyWith$Query$SystemDnsProvider get copyWith => + CopyWith$Query$SystemDnsProvider( + this, + (i) => i, + ); +} + +abstract class CopyWith$Query$SystemDnsProvider { + factory CopyWith$Query$SystemDnsProvider( + Query$SystemDnsProvider instance, + TRes Function(Query$SystemDnsProvider) then, + ) = _CopyWithImpl$Query$SystemDnsProvider; + + factory CopyWith$Query$SystemDnsProvider.stub(TRes res) = + _CopyWithStubImpl$Query$SystemDnsProvider; + + TRes call({ + Query$SystemDnsProvider$system? system, + String? $__typename, + }); + CopyWith$Query$SystemDnsProvider$system get system; +} + +class _CopyWithImpl$Query$SystemDnsProvider + implements CopyWith$Query$SystemDnsProvider { + _CopyWithImpl$Query$SystemDnsProvider( + this._instance, + this._then, + ); + + final Query$SystemDnsProvider _instance; + + final TRes Function(Query$SystemDnsProvider) _then; + + static const _undefined = {}; + + TRes call({ + Object? system = _undefined, + Object? $__typename = _undefined, + }) => + _then(Query$SystemDnsProvider( + system: system == _undefined || system == null + ? _instance.system + : (system as Query$SystemDnsProvider$system), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); + CopyWith$Query$SystemDnsProvider$system get system { + final local$system = _instance.system; + return CopyWith$Query$SystemDnsProvider$system( + local$system, (e) => call(system: e)); + } +} + +class _CopyWithStubImpl$Query$SystemDnsProvider + implements CopyWith$Query$SystemDnsProvider { + _CopyWithStubImpl$Query$SystemDnsProvider(this._res); + + TRes _res; + + call({ + Query$SystemDnsProvider$system? system, + String? $__typename, + }) => + _res; + CopyWith$Query$SystemDnsProvider$system get system => + CopyWith$Query$SystemDnsProvider$system.stub(_res); +} + +const documentNodeQuerySystemDnsProvider = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.query, + name: NameNode(value: 'SystemDnsProvider'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'system'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'domainInfo'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'provider'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), +]); +Query$SystemDnsProvider _parserFn$Query$SystemDnsProvider( + Map data) => + Query$SystemDnsProvider.fromJson(data); + +class Options$Query$SystemDnsProvider + extends graphql.QueryOptions { + Options$Query$SystemDnsProvider({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Duration? pollInterval, + graphql.Context? context, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + pollInterval: pollInterval, + context: context, + document: documentNodeQuerySystemDnsProvider, + parserFn: _parserFn$Query$SystemDnsProvider, + ); +} + +class WatchOptions$Query$SystemDnsProvider + extends graphql.WatchQueryOptions { + WatchOptions$Query$SystemDnsProvider({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeQuerySystemDnsProvider, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Query$SystemDnsProvider, + ); +} + +class FetchMoreOptions$Query$SystemDnsProvider + extends graphql.FetchMoreOptions { + FetchMoreOptions$Query$SystemDnsProvider( + {required graphql.UpdateQuery updateQuery}) + : super( + updateQuery: updateQuery, + document: documentNodeQuerySystemDnsProvider, + ); +} + +extension ClientExtension$Query$SystemDnsProvider on graphql.GraphQLClient { + Future> query$SystemDnsProvider( + [Options$Query$SystemDnsProvider? options]) async => + await this.query(options ?? Options$Query$SystemDnsProvider()); + graphql.ObservableQuery watchQuery$SystemDnsProvider( + [WatchOptions$Query$SystemDnsProvider? options]) => + this.watchQuery(options ?? WatchOptions$Query$SystemDnsProvider()); + void writeQuery$SystemDnsProvider({ + required Query$SystemDnsProvider data, + bool broadcast = true, + }) => + this.writeQuery( + graphql.Request( + operation: graphql.Operation( + document: documentNodeQuerySystemDnsProvider)), + data: data.toJson(), + broadcast: broadcast, + ); + Query$SystemDnsProvider? readQuery$SystemDnsProvider( + {bool optimistic = true}) { + final result = this.readQuery( + graphql.Request( + operation: + graphql.Operation(document: documentNodeQuerySystemDnsProvider)), + optimistic: optimistic, + ); + return result == null ? null : Query$SystemDnsProvider.fromJson(result); + } +} + +class Query$SystemDnsProvider$system { + Query$SystemDnsProvider$system({ + required this.domainInfo, + required this.$__typename, + }); + + factory Query$SystemDnsProvider$system.fromJson(Map json) { + final l$domainInfo = json['domainInfo']; + final l$$__typename = json['__typename']; + return Query$SystemDnsProvider$system( + domainInfo: Query$SystemDnsProvider$system$domainInfo.fromJson( + (l$domainInfo as Map)), + $__typename: (l$$__typename as String), + ); + } + + final Query$SystemDnsProvider$system$domainInfo domainInfo; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$domainInfo = domainInfo; + _resultData['domainInfo'] = l$domainInfo.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$domainInfo = domainInfo; + final l$$__typename = $__typename; + return Object.hashAll([ + l$domainInfo, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Query$SystemDnsProvider$system) || + runtimeType != other.runtimeType) { + return false; + } + final l$domainInfo = domainInfo; + final lOther$domainInfo = other.domainInfo; + if (l$domainInfo != lOther$domainInfo) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Query$SystemDnsProvider$system + on Query$SystemDnsProvider$system { + CopyWith$Query$SystemDnsProvider$system + get copyWith => CopyWith$Query$SystemDnsProvider$system( + this, + (i) => i, + ); +} + +abstract class CopyWith$Query$SystemDnsProvider$system { + factory CopyWith$Query$SystemDnsProvider$system( + Query$SystemDnsProvider$system instance, + TRes Function(Query$SystemDnsProvider$system) then, + ) = _CopyWithImpl$Query$SystemDnsProvider$system; + + factory CopyWith$Query$SystemDnsProvider$system.stub(TRes res) = + _CopyWithStubImpl$Query$SystemDnsProvider$system; + + TRes call({ + Query$SystemDnsProvider$system$domainInfo? domainInfo, + String? $__typename, + }); + CopyWith$Query$SystemDnsProvider$system$domainInfo get domainInfo; +} + +class _CopyWithImpl$Query$SystemDnsProvider$system + implements CopyWith$Query$SystemDnsProvider$system { + _CopyWithImpl$Query$SystemDnsProvider$system( + this._instance, + this._then, + ); + + final Query$SystemDnsProvider$system _instance; + + final TRes Function(Query$SystemDnsProvider$system) _then; + + static const _undefined = {}; + + TRes call({ + Object? domainInfo = _undefined, + Object? $__typename = _undefined, + }) => + _then(Query$SystemDnsProvider$system( + domainInfo: domainInfo == _undefined || domainInfo == null + ? _instance.domainInfo + : (domainInfo as Query$SystemDnsProvider$system$domainInfo), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); + CopyWith$Query$SystemDnsProvider$system$domainInfo get domainInfo { + final local$domainInfo = _instance.domainInfo; + return CopyWith$Query$SystemDnsProvider$system$domainInfo( + local$domainInfo, (e) => call(domainInfo: e)); + } +} + +class _CopyWithStubImpl$Query$SystemDnsProvider$system + implements CopyWith$Query$SystemDnsProvider$system { + _CopyWithStubImpl$Query$SystemDnsProvider$system(this._res); + + TRes _res; + + call({ + Query$SystemDnsProvider$system$domainInfo? domainInfo, + String? $__typename, + }) => + _res; + CopyWith$Query$SystemDnsProvider$system$domainInfo get domainInfo => + CopyWith$Query$SystemDnsProvider$system$domainInfo.stub(_res); +} + +class Query$SystemDnsProvider$system$domainInfo { + Query$SystemDnsProvider$system$domainInfo({ + required this.provider, + required this.$__typename, + }); + + factory Query$SystemDnsProvider$system$domainInfo.fromJson( + Map json) { + final l$provider = json['provider']; + final l$$__typename = json['__typename']; + return Query$SystemDnsProvider$system$domainInfo( + provider: fromJson$Enum$DnsProvider((l$provider as String)), + $__typename: (l$$__typename as String), + ); + } + + final Enum$DnsProvider provider; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$provider = provider; + _resultData['provider'] = toJson$Enum$DnsProvider(l$provider); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$provider = provider; + final l$$__typename = $__typename; + return Object.hashAll([ + l$provider, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Query$SystemDnsProvider$system$domainInfo) || + runtimeType != other.runtimeType) { + return false; + } + final l$provider = provider; + final lOther$provider = other.provider; + if (l$provider != lOther$provider) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Query$SystemDnsProvider$system$domainInfo + on Query$SystemDnsProvider$system$domainInfo { + CopyWith$Query$SystemDnsProvider$system$domainInfo< + Query$SystemDnsProvider$system$domainInfo> + get copyWith => CopyWith$Query$SystemDnsProvider$system$domainInfo( + this, + (i) => i, + ); +} + +abstract class CopyWith$Query$SystemDnsProvider$system$domainInfo { + factory CopyWith$Query$SystemDnsProvider$system$domainInfo( + Query$SystemDnsProvider$system$domainInfo instance, + TRes Function(Query$SystemDnsProvider$system$domainInfo) then, + ) = _CopyWithImpl$Query$SystemDnsProvider$system$domainInfo; + + factory CopyWith$Query$SystemDnsProvider$system$domainInfo.stub(TRes res) = + _CopyWithStubImpl$Query$SystemDnsProvider$system$domainInfo; + + TRes call({ + Enum$DnsProvider? provider, + String? $__typename, + }); +} + +class _CopyWithImpl$Query$SystemDnsProvider$system$domainInfo + implements CopyWith$Query$SystemDnsProvider$system$domainInfo { + _CopyWithImpl$Query$SystemDnsProvider$system$domainInfo( + this._instance, + this._then, + ); + + final Query$SystemDnsProvider$system$domainInfo _instance; + + final TRes Function(Query$SystemDnsProvider$system$domainInfo) _then; + + static const _undefined = {}; + + TRes call({ + Object? provider = _undefined, + Object? $__typename = _undefined, + }) => + _then(Query$SystemDnsProvider$system$domainInfo( + provider: provider == _undefined || provider == null + ? _instance.provider + : (provider as Enum$DnsProvider), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Query$SystemDnsProvider$system$domainInfo + implements CopyWith$Query$SystemDnsProvider$system$domainInfo { + _CopyWithStubImpl$Query$SystemDnsProvider$system$domainInfo(this._res); + + TRes _res; + + call({ + Enum$DnsProvider? provider, + String? $__typename, + }) => + _res; +} + class Query$GetApiTokens { Query$GetApiTokens({ required this.api, diff --git a/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart index 14996423..8da4e347 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart @@ -1,8 +1,8 @@ import 'dart:async'; -import 'disk_volumes.graphql.dart'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; import 'schema.graphql.dart'; +import 'services.graphql.dart'; class Fragment$basicMutationReturnFields { Fragment$basicMutationReturnFields({ diff --git a/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart index dfea309c..1501d709 100644 --- a/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart @@ -1,5 +1,4 @@ import 'dart:async'; -import 'disk_volumes.graphql.dart'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; import 'package:selfprivacy/utils/scalars.dart'; diff --git a/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart index c2d0027f..dbc8eccc 100644 --- a/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart @@ -1,8 +1,8 @@ import 'dart:async'; -import 'disk_volumes.graphql.dart'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; import 'schema.graphql.dart'; +import 'services.graphql.dart'; class Fragment$basicMutationReturnFields { Fragment$basicMutationReturnFields({ diff --git a/lib/logic/api_maps/graphql_maps/server_api/server_api.dart b/lib/logic/api_maps/graphql_maps/server_api/server_api.dart index bb703103..51da63ac 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/server_api.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/server_api.dart @@ -11,6 +11,7 @@ import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/users.graphql.dar import 'package:selfprivacy/logic/models/auto_upgrade_settings.dart'; import 'package:selfprivacy/logic/models/hive/backblaze_bucket.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; +import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; import 'package:selfprivacy/logic/models/json/api_token.dart'; import 'package:selfprivacy/logic/models/json/backup.dart'; @@ -87,6 +88,25 @@ class ServerApi extends ApiMap return providerType; } + Future getDnsProviderType() async { + QueryResult response; + DnsProvider providerType = DnsProvider.unknown; + + try { + final GraphQLClient client = await getClient(); + response = await client.query$SystemDnsProvider(); + if (response.hasException) { + print(response.exception.toString()); + } + providerType = DnsProvider.fromGraphQL( + response.parsedData!.system.domainInfo.provider, + ); + } catch (e) { + print(e); + } + return providerType; + } + Future isUsingBinds() async { QueryResult response; bool usesBinds = false; diff --git a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart index 14cf5c96..04ff622b 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart @@ -27,7 +27,7 @@ class CloudflareApi extends DnsProviderApi { BaseOptions get options { final BaseOptions options = BaseOptions(baseUrl: rootAddress); if (isWithToken) { - final String? token = getIt().cloudFlareKey; + final String? token = getIt().dnsProviderKey; assert(token != null); options.headers = {'Authorization': 'Bearer $token'}; } diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart index 63c7acba..4e55bbfa 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart @@ -27,13 +27,13 @@ class DesecApi extends DnsProviderApi { BaseOptions get options { final BaseOptions options = BaseOptions(baseUrl: rootAddress); if (isWithToken) { - final String? token = getIt().cloudFlareKey; + final String? token = getIt().dnsProviderKey; assert(token != null); - options.headers = {'Authorization': 'Bearer $token'}; + options.headers = {'Authorization': 'Token $token'}; } if (customToken != null) { - options.headers = {'Authorization': 'Bearer $customToken'}; + options.headers = {'Authorization': 'Token $customToken'}; } if (validateStatus != null) { @@ -107,7 +107,7 @@ class DesecApi extends DnsProviderApi { try { final Response response = await client.get(url); - final List records = response.data['result'] ?? []; + final List records = response.data; await client.put(url, data: records); } catch (e) { print(e); @@ -136,7 +136,7 @@ class DesecApi extends DnsProviderApi { final Dio client = await getClient(); try { response = await client.get(url); - final List records = response.data['result'] ?? []; + final List records = response.data; for (final record in records) { allRecords.add( @@ -291,7 +291,7 @@ class DesecApi extends DnsProviderApi { final Response response = await client.get( '', ); - domains = response.data['result'] + domains = response.data .map((final el) => el['name'] as String) .toList(); } catch (e) { diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean.dart index b2f4c624..21861dd8 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean.dart @@ -332,6 +332,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { required final User rootUser, required final String domainName, required final String serverType, + required final DnsProvider dnsProvider, }) async { ServerHostingDetails? serverDetails; @@ -344,9 +345,10 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { final String formattedHostname = getHostnameFromDomain(domainName); const String infectBranch = 'providers/digital-ocean'; final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false'; + final String dnsProviderType = dnsProviderToInfectName(dnsProvider); final String userdataString = - "#cloud-config\nruncmd:\n- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/$infectBranch/nixos-infect | PROVIDER=$infectProviderName STAGING_ACME='$stagingAcme' DOMAIN='$domainName' LUSER='${rootUser.login}' ENCODED_PASSWORD='$base64Password' CF_TOKEN=$dnsApiToken DB_PASSWORD=$dbPassword API_TOKEN=$apiToken HOSTNAME=$formattedHostname bash 2>&1 | tee /tmp/infect.log"; + "#cloud-config\nruncmd:\n- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/$infectBranch/nixos-infect | DNS_PROVIDER_TYPE=$dnsProviderType PROVIDER=$infectProviderName STAGING_ACME='$stagingAcme' DOMAIN='$domainName' LUSER='${rootUser.login}' ENCODED_PASSWORD='$base64Password' CF_TOKEN=$dnsApiToken DB_PASSWORD=$dbPassword API_TOKEN=$apiToken HOSTNAME=$formattedHostname bash 2>&1 | tee /tmp/infect.log"; print(userdataString); Response? serverCreateResponse; diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart index 7f51c768..c2228030 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart @@ -356,6 +356,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { required final User rootUser, required final String domainName, required final String serverType, + required final DnsProvider dnsProvider, }) async { final APIGenericResult newVolumeResponse = await createVolume(); @@ -374,6 +375,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { domainName: domainName, volume: newVolumeResponse.data!, serverType: serverType, + dnsProvider: dnsProvider, ); } @@ -383,6 +385,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { required final String domainName, required final ServerVolume volume, required final String serverType, + required final DnsProvider dnsProvider, }) async { final Dio client = await getClient(); @@ -395,9 +398,10 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false'; final String base64Password = base64.encode(utf8.encode(rootUser.password ?? 'PASS')); + final String dnsProviderType = dnsProviderToInfectName(dnsProvider); final String userdataString = - "#cloud-config\nruncmd:\n- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/$infectBranch/nixos-infect | STAGING_ACME='$stagingAcme' PROVIDER=$infectProviderName NIX_CHANNEL=nixos-21.05 DOMAIN='$domainName' LUSER='${rootUser.login}' ENCODED_PASSWORD='$base64Password' CF_TOKEN=$dnsApiToken DB_PASSWORD=$dbPassword API_TOKEN=$apiToken HOSTNAME=$hostname bash 2>&1 | tee /tmp/infect.log"; + "#cloud-config\nruncmd:\n- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/$infectBranch/nixos-infect | DNS_PROVIDER_TYPE=$dnsProviderType STAGING_ACME='$stagingAcme' PROVIDER=$infectProviderName NIX_CHANNEL=nixos-21.05 DOMAIN='$domainName' LUSER='${rootUser.login}' ENCODED_PASSWORD='$base64Password' CF_TOKEN=$dnsApiToken DB_PASSWORD=$dbPassword API_TOKEN=$apiToken HOSTNAME=$hostname bash 2>&1 | tee /tmp/infect.log"; Response? serverCreateResponse; ServerHostingDetails? serverDetails; diff --git a/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart b/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart index c858d67b..ae7911d0 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart @@ -39,6 +39,7 @@ abstract class ServerProviderApi extends ApiMap { required final User rootUser, required final String domainName, required final String serverType, + required final DnsProvider dnsProvider, }); Future> createReverseDns({ required final ServerHostingDetails serverDetails, @@ -54,6 +55,20 @@ abstract class ServerProviderApi extends ApiMap { final DateTime end, ); + String dnsProviderToInfectName(final DnsProvider dnsProvider) { + String dnsProviderType; + switch (dnsProvider) { + case DnsProvider.desec: + dnsProviderType = 'DESEC'; + break; + case DnsProvider.cloudflare: + default: + dnsProviderType = 'CLOUDFLARE'; + break; + } + return dnsProviderType; + } + /// Provider name key which lets infect understand what kind of installation /// it requires, for example 'digitaloceal' for Digital Ocean String get infectProviderName; diff --git a/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart b/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart index 553c3492..edb97de6 100644 --- a/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart @@ -3,7 +3,6 @@ import 'dart:async'; import 'package:cubit_form/cubit_form.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; -import 'package:selfprivacy/logic/cubit/forms/validations/validations.dart'; class DnsProviderFormCubit extends FormCubit { DnsProviderFormCubit(this.initializingCubit) { @@ -11,7 +10,6 @@ class DnsProviderFormCubit extends FormCubit { initalValue: '', validations: [ RequiredStringValidation('validations.required'.tr()), - LengthStringNotEqualValidation(40) ], ); @@ -20,7 +18,7 @@ class DnsProviderFormCubit extends FormCubit { @override FutureOr onSubmit() async { - initializingCubit.setCloudflareKey(apiKey.state.value); + initializingCubit.setDnsApiToken(apiKey.state.value); } final ServerInstallationCubit initializingCubit; diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 06df6d5a..cc5bffcc 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -110,16 +110,6 @@ class ServerInstallationCubit extends Cubit { Future isDnsProviderApiTokenValid( final String providerToken, ) async { - if (ApiController.currentDnsProviderApiFactory == null) { - // No other DNS provider is supported for now, - // so it's safe to hardcode Cloudflare - ApiController.initDnsProviderApiFactory( - DnsProviderApiFactorySettings( - provider: DnsProvider.cloudflare, - ), - ); - } - final APIGenericResult apiResponse = await ApiController.currentDnsProviderApiFactory! .getDnsProvider( @@ -223,16 +213,16 @@ class ServerInstallationCubit extends Cubit { ); } - void setCloudflareKey(final String cloudFlareKey) async { + void setDnsApiToken(final String dnsApiToken) async { if (state is ServerInstallationRecovery) { - setAndValidateCloudflareToken(cloudFlareKey); + setAndValidateDnsApiToken(dnsApiToken); return; } - await repository.saveCloudFlareKey(cloudFlareKey); + await repository.saveDnsProviderKey(dnsApiToken); emit( (state as ServerInstallationNotFinished) - .copyWith(cloudFlareKey: cloudFlareKey), + .copyWith(dnsApiToken: dnsApiToken), ); } @@ -293,7 +283,7 @@ class ServerInstallationCubit extends Cubit { await repository.createServer( state.rootUser!, state.serverDomain!.domainName, - state.cloudFlareKey!, + state.dnsApiToken!, state.backblazeCredential!, onCancel: onCancel, onSuccess: onSuccess, @@ -595,7 +585,7 @@ class ServerInstallationCubit extends Cubit { ), ); break; - case RecoveryStep.cloudflareToken: + case RecoveryStep.dnsProviderToken: repository.deleteServerDetails(); emit( dataState.copyWith( @@ -691,12 +681,12 @@ class ServerInstallationCubit extends Cubit { emit( dataState.copyWith( serverDetails: serverDetails, - currentStep: RecoveryStep.cloudflareToken, + currentStep: RecoveryStep.dnsProviderToken, ), ); } - Future setAndValidateCloudflareToken(final String token) async { + Future setAndValidateDnsApiToken(final String token) async { final ServerInstallationRecovery dataState = state as ServerInstallationRecovery; final ServerDomain? serverDomain = dataState.serverDomain; @@ -714,10 +704,13 @@ class ServerInstallationCubit extends Cubit { ServerDomain( domainName: serverDomain.domainName, zoneId: zoneId, - provider: DnsProvider.cloudflare, + provider: await ServerApi( + customToken: token, + isWithToken: true, + ).getDnsProviderType(), ), ); - await repository.saveCloudFlareKey(token); + await repository.saveDnsProviderKey(token); emit( dataState.copyWith( serverDomain: ServerDomain( @@ -725,7 +718,7 @@ class ServerInstallationCubit extends Cubit { zoneId: zoneId, provider: DnsProvider.cloudflare, ), - cloudFlareKey: token, + dnsApiToken: token, currentStep: RecoveryStep.backblazeToken, ), ); @@ -776,7 +769,7 @@ class ServerInstallationCubit extends Cubit { ServerInstallationNotFinished( providerApiToken: state.providerApiToken, serverDomain: state.serverDomain, - cloudFlareKey: state.cloudFlareKey, + dnsApiToken: state.dnsApiToken, backblazeCredential: state.backblazeCredential, rootUser: state.rootUser, serverDetails: null, diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 851b2be5..ff167518 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -45,7 +45,7 @@ class ServerInstallationRepository { Future load() async { final String? providerApiToken = getIt().serverProviderKey; final String? location = getIt().serverLocation; - final String? cloudflareToken = getIt().cloudFlareKey; + final String? dnsApiToken = getIt().dnsProviderKey; final String? serverTypeIdentificator = getIt().serverType; final ServerDomain? serverDomain = getIt().serverDomain; final ServerProvider? serverProvider = @@ -54,6 +54,7 @@ class ServerInstallationRepository { getIt().backblazeCredential; final ServerHostingDetails? serverDetails = getIt().serverDetails; + final DnsProvider? dnsProvider = getIt().dnsProvider; if (serverProvider != null || (serverDetails != null && @@ -75,18 +76,21 @@ class ServerInstallationRepository { ); } - // No other DNS provider is supported for now, so it's fine. - ApiController.initDnsProviderApiFactory( - DnsProviderApiFactorySettings( - provider: DnsProvider.cloudflare, - ), - ); + if (dnsProvider != null || + (serverDomain != null && + serverDomain.provider != DnsProvider.unknown)) { + ApiController.initDnsProviderApiFactory( + DnsProviderApiFactorySettings( + provider: dnsProvider ?? serverDomain!.provider, + ), + ); + } if (box.get(BNames.hasFinalChecked, defaultValue: false)) { return ServerInstallationFinished( providerApiToken: providerApiToken!, serverTypeIdentificator: serverTypeIdentificator ?? '', - cloudFlareKey: cloudflareToken!, + dnsApiToken: dnsApiToken!, serverDomain: serverDomain!, backblazeCredential: backblazeCredential!, serverDetails: serverDetails!, @@ -103,14 +107,14 @@ class ServerInstallationRepository { serverDomain != null) { return ServerInstallationRecovery( providerApiToken: providerApiToken, - cloudFlareKey: cloudflareToken, + dnsApiToken: dnsApiToken, serverDomain: serverDomain, backblazeCredential: backblazeCredential, serverDetails: serverDetails, rootUser: box.get(BNames.rootUser), currentStep: _getCurrentRecoveryStep( providerApiToken, - cloudflareToken, + dnsApiToken, serverDomain, serverDetails, ), @@ -120,7 +124,7 @@ class ServerInstallationRepository { return ServerInstallationNotFinished( providerApiToken: providerApiToken, - cloudFlareKey: cloudflareToken, + dnsApiToken: dnsApiToken, serverDomain: serverDomain, backblazeCredential: backblazeCredential, serverDetails: serverDetails, @@ -147,7 +151,7 @@ class ServerInstallationRepository { if (serverDomain.provider != DnsProvider.unknown) { return RecoveryStep.backblazeToken; } - return RecoveryStep.cloudflareToken; + return RecoveryStep.dnsProviderToken; } return RecoveryStep.serverSelection; } @@ -238,7 +242,7 @@ class ServerInstallationRepository { Future createServer( final User rootUser, final String domainName, - final String cloudFlareKey, + final String dnsApiToken, final BackblazeCredential backblazeCredential, { required final void Function() onCancel, required final Future Function(ServerHostingDetails serverDetails) @@ -256,7 +260,8 @@ class ServerInstallationRepository { ServerHostingDetails? serverDetails; try { final APIGenericResult createResult = await api.createServer( - dnsApiToken: cloudFlareKey, + dnsProvider: getIt().dnsProvider!, + dnsApiToken: dnsApiToken, rootUser: rootUser, domainName: domainName, serverType: getIt().serverType!, @@ -280,7 +285,8 @@ class ServerInstallationRepository { try { final APIGenericResult createServerResult = await api.createServer( - dnsApiToken: cloudFlareKey, + dnsProvider: getIt().dnsProvider!, + dnsApiToken: dnsApiToken, rootUser: rootUser, domainName: domainName, serverType: getIt().serverType!, @@ -304,7 +310,8 @@ class ServerInstallationRepository { ServerHostingDetails? serverDetails; try { final APIGenericResult createResult = await api.createServer( - dnsApiToken: cloudFlareKey, + dnsProvider: getIt().dnsProvider!, + dnsApiToken: dnsApiToken, rootUser: rootUser, domainName: domainName, serverType: getIt().serverType!, @@ -721,11 +728,11 @@ class ServerInstallationRepository { getIt().init(); } - Future saveCloudFlareKey(final String key) async { - await getIt().storeCloudFlareKey(key); + Future saveDnsProviderKey(final String key) async { + await getIt().storeDnsProviderKey(key); } - Future deleteCloudFlareKey() async { + Future deleteDnsProviderKey() async { await box.delete(BNames.cloudFlareKey); getIt().init(); } diff --git a/lib/logic/cubit/server_installation/server_installation_state.dart b/lib/logic/cubit/server_installation/server_installation_state.dart index 331c3e2a..5ceaafdd 100644 --- a/lib/logic/cubit/server_installation/server_installation_state.dart +++ b/lib/logic/cubit/server_installation/server_installation_state.dart @@ -4,7 +4,7 @@ abstract class ServerInstallationState extends Equatable { const ServerInstallationState({ required this.providerApiToken, required this.serverTypeIdentificator, - required this.cloudFlareKey, + required this.dnsApiToken, required this.backblazeCredential, required this.serverDomain, required this.rootUser, @@ -18,7 +18,7 @@ abstract class ServerInstallationState extends Equatable { List get props => [ providerApiToken, serverTypeIdentificator, - cloudFlareKey, + dnsApiToken, backblazeCredential, serverDomain, rootUser, @@ -28,7 +28,7 @@ abstract class ServerInstallationState extends Equatable { ]; final String? providerApiToken; - final String? cloudFlareKey; + final String? dnsApiToken; final String? serverTypeIdentificator; final BackblazeCredential? backblazeCredential; final ServerDomain? serverDomain; @@ -40,7 +40,7 @@ abstract class ServerInstallationState extends Equatable { bool get isServerProviderApiKeyFilled => providerApiToken != null; bool get isServerTypeFilled => serverTypeIdentificator != null; - bool get isDnsProviderFilled => cloudFlareKey != null; + bool get isDnsProviderFilled => dnsApiToken != null; bool get isBackupsProviderFilled => backblazeCredential != null; bool get isDomainSelected => serverDomain != null; bool get isPrimaryUserFilled => rootUser != null; @@ -87,7 +87,7 @@ class TimerState extends ServerInstallationNotFinished { }) : super( providerApiToken: dataState.providerApiToken, serverTypeIdentificator: dataState.serverTypeIdentificator, - cloudFlareKey: dataState.cloudFlareKey, + dnsApiToken: dataState.dnsApiToken, backblazeCredential: dataState.backblazeCredential, serverDomain: dataState.serverDomain, rootUser: dataState.rootUser, @@ -114,7 +114,7 @@ enum ServerSetupProgress { nothingYet, serverProviderFilled, servertTypeFilled, - cloudFlareFilled, + dnsProviderFilled, backblazeFilled, domainFilled, userFilled, @@ -133,7 +133,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { required this.dnsMatches, super.providerApiToken, super.serverTypeIdentificator, - super.cloudFlareKey, + super.dnsApiToken, super.backblazeCredential, super.serverDomain, super.rootUser, @@ -146,7 +146,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { List get props => [ providerApiToken, serverTypeIdentificator, - cloudFlareKey, + dnsApiToken, backblazeCredential, serverDomain, rootUser, @@ -160,7 +160,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { ServerInstallationNotFinished copyWith({ final String? providerApiToken, final String? serverTypeIdentificator, - final String? cloudFlareKey, + final String? dnsApiToken, final BackblazeCredential? backblazeCredential, final ServerDomain? serverDomain, final User? rootUser, @@ -175,7 +175,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { providerApiToken: providerApiToken ?? this.providerApiToken, serverTypeIdentificator: serverTypeIdentificator ?? this.serverTypeIdentificator, - cloudFlareKey: cloudFlareKey ?? this.cloudFlareKey, + dnsApiToken: dnsApiToken ?? this.dnsApiToken, backblazeCredential: backblazeCredential ?? this.backblazeCredential, serverDomain: serverDomain ?? this.serverDomain, rootUser: rootUser ?? this.rootUser, @@ -192,7 +192,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { ServerInstallationFinished finish() => ServerInstallationFinished( providerApiToken: providerApiToken!, serverTypeIdentificator: serverTypeIdentificator ?? '', - cloudFlareKey: cloudFlareKey!, + dnsApiToken: dnsApiToken!, backblazeCredential: backblazeCredential!, serverDomain: serverDomain!, rootUser: rootUser!, @@ -208,7 +208,7 @@ class ServerInstallationEmpty extends ServerInstallationNotFinished { : super( providerApiToken: null, serverTypeIdentificator: null, - cloudFlareKey: null, + dnsApiToken: null, backblazeCredential: null, serverDomain: null, rootUser: null, @@ -225,7 +225,7 @@ class ServerInstallationFinished extends ServerInstallationState { const ServerInstallationFinished({ required String super.providerApiToken, required String super.serverTypeIdentificator, - required String super.cloudFlareKey, + required String super.dnsApiToken, required BackblazeCredential super.backblazeCredential, required ServerDomain super.serverDomain, required User super.rootUser, @@ -239,7 +239,7 @@ class ServerInstallationFinished extends ServerInstallationState { List get props => [ providerApiToken, serverTypeIdentificator, - cloudFlareKey, + dnsApiToken, backblazeCredential, serverDomain, rootUser, @@ -256,7 +256,7 @@ enum RecoveryStep { oldToken, serverProviderToken, serverSelection, - cloudflareToken, + dnsProviderToken, backblazeToken, } @@ -278,7 +278,7 @@ class ServerInstallationRecovery extends ServerInstallationState { required this.recoveryCapabilities, super.providerApiToken, super.serverTypeIdentificator, - super.cloudFlareKey, + super.dnsApiToken, super.backblazeCredential, super.serverDomain, super.rootUser, @@ -295,7 +295,7 @@ class ServerInstallationRecovery extends ServerInstallationState { List get props => [ providerApiToken, serverTypeIdentificator, - cloudFlareKey, + dnsApiToken, backblazeCredential, serverDomain, rootUser, @@ -308,7 +308,7 @@ class ServerInstallationRecovery extends ServerInstallationState { ServerInstallationRecovery copyWith({ final String? providerApiToken, final String? serverTypeIdentificator, - final String? cloudFlareKey, + final String? dnsApiToken, final BackblazeCredential? backblazeCredential, final ServerDomain? serverDomain, final User? rootUser, @@ -320,7 +320,7 @@ class ServerInstallationRecovery extends ServerInstallationState { providerApiToken: providerApiToken ?? this.providerApiToken, serverTypeIdentificator: serverTypeIdentificator ?? this.serverTypeIdentificator, - cloudFlareKey: cloudFlareKey ?? this.cloudFlareKey, + dnsApiToken: dnsApiToken ?? this.dnsApiToken, backblazeCredential: backblazeCredential ?? this.backblazeCredential, serverDomain: serverDomain ?? this.serverDomain, rootUser: rootUser ?? this.rootUser, @@ -332,7 +332,7 @@ class ServerInstallationRecovery extends ServerInstallationState { ServerInstallationFinished finish() => ServerInstallationFinished( providerApiToken: providerApiToken!, serverTypeIdentificator: serverTypeIdentificator ?? '', - cloudFlareKey: cloudFlareKey!, + dnsApiToken: dnsApiToken!, backblazeCredential: backblazeCredential!, serverDomain: serverDomain!, rootUser: rootUser!, diff --git a/lib/logic/get_it/api_config.dart b/lib/logic/get_it/api_config.dart index 11d73a85..ba49b9b3 100644 --- a/lib/logic/get_it/api_config.dart +++ b/lib/logic/get_it/api_config.dart @@ -12,7 +12,7 @@ class ApiConfigModel { String? get serverProviderKey => _serverProviderKey; String? get serverLocation => _serverLocation; String? get serverType => _serverType; - String? get cloudFlareKey => _cloudFlareKey; + String? get dnsProviderKey => _dnsProviderKey; ServerProvider? get serverProvider => _serverProvider; DnsProvider? get dnsProvider => _dnsProvider; @@ -22,7 +22,7 @@ class ApiConfigModel { String? _serverProviderKey; String? _serverLocation; - String? _cloudFlareKey; + String? _dnsProviderKey; String? _serverType; ServerProvider? _serverProvider; DnsProvider? _dnsProvider; @@ -46,9 +46,9 @@ class ApiConfigModel { _serverProviderKey = value; } - Future storeCloudFlareKey(final String value) async { + Future storeDnsProviderKey(final String value) async { await _box.put(BNames.cloudFlareKey, value); - _cloudFlareKey = value; + _dnsProviderKey = value; } Future storeServerTypeIdentifier(final String typeIdentifier) async { @@ -85,7 +85,7 @@ class ApiConfigModel { _serverProviderKey = null; _dnsProvider = null; _serverLocation = null; - _cloudFlareKey = null; + _dnsProviderKey = null; _backblazeCredential = null; _serverDomain = null; _serverDetails = null; @@ -97,7 +97,7 @@ class ApiConfigModel { void init() { _serverProviderKey = _box.get(BNames.hetznerKey); _serverLocation = _box.get(BNames.serverLocation); - _cloudFlareKey = _box.get(BNames.cloudFlareKey); + _dnsProviderKey = _box.get(BNames.cloudFlareKey); _backblazeCredential = _box.get(BNames.backblazeCredential); _serverDomain = _box.get(BNames.serverDomain); _serverDetails = _box.get(BNames.serverDetails); diff --git a/lib/logic/models/hive/server_domain.dart b/lib/logic/models/hive/server_domain.dart index 913fcd42..de3ef92a 100644 --- a/lib/logic/models/hive/server_domain.dart +++ b/lib/logic/models/hive/server_domain.dart @@ -1,4 +1,5 @@ import 'package:hive/hive.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/schema.graphql.dart'; part 'server_domain.g.dart'; @@ -30,5 +31,16 @@ enum DnsProvider { @HiveField(1) cloudflare, @HiveField(2) - desec + desec; + + factory DnsProvider.fromGraphQL(final Enum$DnsProvider provider) { + switch (provider) { + case Enum$DnsProvider.CLOUDFLARE: + return cloudflare; + case Enum$DnsProvider.DESEC: + return desec; + default: + return unknown; + } + } } diff --git a/lib/logic/models/hive/server_domain.g.dart b/lib/logic/models/hive/server_domain.g.dart index 3265db6b..6770d9bc 100644 --- a/lib/logic/models/hive/server_domain.g.dart +++ b/lib/logic/models/hive/server_domain.g.dart @@ -58,6 +58,8 @@ class DnsProviderAdapter extends TypeAdapter { return DnsProvider.unknown; case 1: return DnsProvider.cloudflare; + case 2: + return DnsProvider.desec; default: return DnsProvider.unknown; } @@ -72,6 +74,9 @@ class DnsProviderAdapter extends TypeAdapter { case DnsProvider.cloudflare: writer.writeByte(1); break; + case DnsProvider.desec: + writer.writeByte(2); + break; } } diff --git a/lib/ui/pages/setup/recovering/recovery_confirm_cloudflare.dart b/lib/ui/pages/setup/recovering/recovery_confirm_dns.dart similarity index 96% rename from lib/ui/pages/setup/recovering/recovery_confirm_cloudflare.dart rename to lib/ui/pages/setup/recovering/recovery_confirm_dns.dart index 93c889a5..9dcad056 100644 --- a/lib/ui/pages/setup/recovering/recovery_confirm_cloudflare.dart +++ b/lib/ui/pages/setup/recovering/recovery_confirm_dns.dart @@ -7,8 +7,8 @@ import 'package:selfprivacy/logic/cubit/support_system/support_system_cubit.dart import 'package:selfprivacy/ui/components/buttons/brand_button.dart'; import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart'; -class RecoveryConfirmCloudflare extends StatelessWidget { - const RecoveryConfirmCloudflare({super.key}); +class RecoveryConfirmDns extends StatelessWidget { + const RecoveryConfirmDns({super.key}); @override Widget build(final BuildContext context) { diff --git a/lib/ui/pages/setup/recovering/recovery_routing.dart b/lib/ui/pages/setup/recovering/recovery_routing.dart index 14c3f9a7..be5eb2ea 100644 --- a/lib/ui/pages/setup/recovering/recovery_routing.dart +++ b/lib/ui/pages/setup/recovering/recovery_routing.dart @@ -12,7 +12,7 @@ import 'package:selfprivacy/ui/pages/setup/recovering/recover_by_old_token.dart' import 'package:selfprivacy/ui/pages/setup/recovering/recover_by_recovery_key.dart'; import 'package:selfprivacy/ui/pages/setup/recovering/recover_by_new_device_key.dart'; import 'package:selfprivacy/ui/pages/setup/recovering/recovery_confirm_backblaze.dart'; -import 'package:selfprivacy/ui/pages/setup/recovering/recovery_confirm_cloudflare.dart'; +import 'package:selfprivacy/ui/pages/setup/recovering/recovery_confirm_dns.dart'; import 'package:selfprivacy/ui/pages/setup/recovering/recovery_confirm_server.dart'; import 'package:selfprivacy/ui/pages/setup/recovering/recovery_server_provider_connected.dart'; import 'package:selfprivacy/ui/pages/setup/recovering/recovery_method_select.dart'; @@ -55,8 +55,8 @@ class RecoveryRouting extends StatelessWidget { case RecoveryStep.serverSelection: currentPage = const RecoveryConfirmServer(); break; - case RecoveryStep.cloudflareToken: - currentPage = const RecoveryConfirmCloudflare(); + case RecoveryStep.dnsProviderToken: + currentPage = const RecoveryConfirmDns(); break; case RecoveryStep.backblazeToken: currentPage = const RecoveryConfirmBackblaze(); diff --git a/lib/ui/router/router.gr.dart b/lib/ui/router/router.gr.dart index 328c5f76..675056f3 100644 --- a/lib/ui/router/router.gr.dart +++ b/lib/ui/router/router.gr.dart @@ -14,52 +14,16 @@ abstract class _$RootRouter extends RootStackRouter { @override final Map pagesMap = { - AboutApplicationRoute.name: (routeData) { + BackupDetailsRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: const AboutApplicationPage(), + child: const BackupDetailsPage(), ); }, - AppSettingsRoute.name: (routeData) { + RootRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: const AppSettingsPage(), - ); - }, - DeveloperSettingsRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const DeveloperSettingsPage(), - ); - }, - ConsoleRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const ConsolePage(), - ); - }, - MoreRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const MorePage(), - ); - }, - OnboardingRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const OnboardingPage(), - ); - }, - ProvidersRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const ProvidersPage(), - ); - }, - ServerDetailsRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const ServerDetailsScreen(), + child: WrappedRoute(child: const RootPage()), ); }, ServiceRoute.name: (routeData) { @@ -78,6 +42,12 @@ abstract class _$RootRouter extends RootStackRouter { child: const ServicesPage(), ); }, + ServerDetailsRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const ServerDetailsScreen(), + ); + }, UsersRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, @@ -100,10 +70,46 @@ abstract class _$RootRouter extends RootStackRouter { ), ); }, - BackupDetailsRoute.name: (routeData) { + AppSettingsRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: const BackupDetailsPage(), + child: const AppSettingsPage(), + ); + }, + DeveloperSettingsRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const DeveloperSettingsPage(), + ); + }, + MoreRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const MorePage(), + ); + }, + AboutApplicationRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const AboutApplicationPage(), + ); + }, + ConsoleRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const ConsolePage(), + ); + }, + ProvidersRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const ProvidersPage(), + ); + }, + RecoveryKeyRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const RecoveryKeyPage(), ); }, DnsDetailsRoute.name: (routeData) { @@ -124,26 +130,12 @@ abstract class _$RootRouter extends RootStackRouter { child: const InitializingPage(), ); }, - RecoveryKeyRoute.name: (routeData) { + ServerStorageRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: const RecoveryKeyPage(), - ); - }, - DevicesRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const DevicesScreen(), - ); - }, - ServicesMigrationRoute.name: (routeData) { - final args = routeData.argsAs(); - return AutoRoutePage( - routeData: routeData, - child: ServicesMigrationPage( - services: args.services, + child: ServerStoragePage( diskStatus: args.diskStatus, - isMigration: args.isMigration, key: args.key, ), ); @@ -159,133 +151,57 @@ abstract class _$RootRouter extends RootStackRouter { ), ); }, - ServerStorageRoute.name: (routeData) { - final args = routeData.argsAs(); + ServicesMigrationRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: ServerStoragePage( + child: ServicesMigrationPage( + services: args.services, diskStatus: args.diskStatus, + isMigration: args.isMigration, key: args.key, ), ); }, - RootRoute.name: (routeData) { + DevicesRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: WrappedRoute(child: const RootPage()), + child: const DevicesScreen(), + ); + }, + OnboardingRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const OnboardingPage(), ); }, }; } /// generated route for -/// [AboutApplicationPage] -class AboutApplicationRoute extends PageRouteInfo { - const AboutApplicationRoute({List? children}) +/// [BackupDetailsPage] +class BackupDetailsRoute extends PageRouteInfo { + const BackupDetailsRoute({List? children}) : super( - AboutApplicationRoute.name, + BackupDetailsRoute.name, initialChildren: children, ); - static const String name = 'AboutApplicationRoute'; + static const String name = 'BackupDetailsRoute'; static const PageInfo page = PageInfo(name); } /// generated route for -/// [AppSettingsPage] -class AppSettingsRoute extends PageRouteInfo { - const AppSettingsRoute({List? children}) +/// [RootPage] +class RootRoute extends PageRouteInfo { + const RootRoute({List? children}) : super( - AppSettingsRoute.name, + RootRoute.name, initialChildren: children, ); - static const String name = 'AppSettingsRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [DeveloperSettingsPage] -class DeveloperSettingsRoute extends PageRouteInfo { - const DeveloperSettingsRoute({List? children}) - : super( - DeveloperSettingsRoute.name, - initialChildren: children, - ); - - static const String name = 'DeveloperSettingsRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [ConsolePage] -class ConsoleRoute extends PageRouteInfo { - const ConsoleRoute({List? children}) - : super( - ConsoleRoute.name, - initialChildren: children, - ); - - static const String name = 'ConsoleRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [MorePage] -class MoreRoute extends PageRouteInfo { - const MoreRoute({List? children}) - : super( - MoreRoute.name, - initialChildren: children, - ); - - static const String name = 'MoreRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [OnboardingPage] -class OnboardingRoute extends PageRouteInfo { - const OnboardingRoute({List? children}) - : super( - OnboardingRoute.name, - initialChildren: children, - ); - - static const String name = 'OnboardingRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [ProvidersPage] -class ProvidersRoute extends PageRouteInfo { - const ProvidersRoute({List? children}) - : super( - ProvidersRoute.name, - initialChildren: children, - ); - - static const String name = 'ProvidersRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [ServerDetailsScreen] -class ServerDetailsRoute extends PageRouteInfo { - const ServerDetailsRoute({List? children}) - : super( - ServerDetailsRoute.name, - initialChildren: children, - ); - - static const String name = 'ServerDetailsRoute'; + static const String name = 'RootRoute'; static const PageInfo page = PageInfo(name); } @@ -342,6 +258,20 @@ class ServicesRoute extends PageRouteInfo { static const PageInfo page = PageInfo(name); } +/// generated route for +/// [ServerDetailsScreen] +class ServerDetailsRoute extends PageRouteInfo { + const ServerDetailsRoute({List? children}) + : super( + ServerDetailsRoute.name, + initialChildren: children, + ); + + static const String name = 'ServerDetailsRoute'; + + static const PageInfo page = PageInfo(name); +} + /// generated route for /// [UsersPage] class UsersRoute extends PageRouteInfo { @@ -409,15 +339,99 @@ class UserDetailsRouteArgs { } /// generated route for -/// [BackupDetailsPage] -class BackupDetailsRoute extends PageRouteInfo { - const BackupDetailsRoute({List? children}) +/// [AppSettingsPage] +class AppSettingsRoute extends PageRouteInfo { + const AppSettingsRoute({List? children}) : super( - BackupDetailsRoute.name, + AppSettingsRoute.name, initialChildren: children, ); - static const String name = 'BackupDetailsRoute'; + static const String name = 'AppSettingsRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [DeveloperSettingsPage] +class DeveloperSettingsRoute extends PageRouteInfo { + const DeveloperSettingsRoute({List? children}) + : super( + DeveloperSettingsRoute.name, + initialChildren: children, + ); + + static const String name = 'DeveloperSettingsRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [MorePage] +class MoreRoute extends PageRouteInfo { + const MoreRoute({List? children}) + : super( + MoreRoute.name, + initialChildren: children, + ); + + static const String name = 'MoreRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [AboutApplicationPage] +class AboutApplicationRoute extends PageRouteInfo { + const AboutApplicationRoute({List? children}) + : super( + AboutApplicationRoute.name, + initialChildren: children, + ); + + static const String name = 'AboutApplicationRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [ConsolePage] +class ConsoleRoute extends PageRouteInfo { + const ConsoleRoute({List? children}) + : super( + ConsoleRoute.name, + initialChildren: children, + ); + + static const String name = 'ConsoleRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [ProvidersPage] +class ProvidersRoute extends PageRouteInfo { + const ProvidersRoute({List? children}) + : super( + ProvidersRoute.name, + initialChildren: children, + ); + + static const String name = 'ProvidersRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [RecoveryKeyPage] +class RecoveryKeyRoute extends PageRouteInfo { + const RecoveryKeyRoute({List? children}) + : super( + RecoveryKeyRoute.name, + initialChildren: children, + ); + + static const String name = 'RecoveryKeyRoute'; static const PageInfo page = PageInfo(name); } @@ -465,31 +479,84 @@ class InitializingRoute extends PageRouteInfo { } /// generated route for -/// [RecoveryKeyPage] -class RecoveryKeyRoute extends PageRouteInfo { - const RecoveryKeyRoute({List? children}) - : super( - RecoveryKeyRoute.name, +/// [ServerStoragePage] +class ServerStorageRoute extends PageRouteInfo { + ServerStorageRoute({ + required DiskStatus diskStatus, + Key? key, + List? children, + }) : super( + ServerStorageRoute.name, + args: ServerStorageRouteArgs( + diskStatus: diskStatus, + key: key, + ), initialChildren: children, ); - static const String name = 'RecoveryKeyRoute'; + static const String name = 'ServerStorageRoute'; - static const PageInfo page = PageInfo(name); + static const PageInfo page = + PageInfo(name); +} + +class ServerStorageRouteArgs { + const ServerStorageRouteArgs({ + required this.diskStatus, + this.key, + }); + + final DiskStatus diskStatus; + + final Key? key; + + @override + String toString() { + return 'ServerStorageRouteArgs{diskStatus: $diskStatus, key: $key}'; + } } /// generated route for -/// [DevicesScreen] -class DevicesRoute extends PageRouteInfo { - const DevicesRoute({List? children}) - : super( - DevicesRoute.name, +/// [ExtendingVolumePage] +class ExtendingVolumeRoute extends PageRouteInfo { + ExtendingVolumeRoute({ + required DiskVolume diskVolumeToResize, + required DiskStatus diskStatus, + Key? key, + List? children, + }) : super( + ExtendingVolumeRoute.name, + args: ExtendingVolumeRouteArgs( + diskVolumeToResize: diskVolumeToResize, + diskStatus: diskStatus, + key: key, + ), initialChildren: children, ); - static const String name = 'DevicesRoute'; + static const String name = 'ExtendingVolumeRoute'; - static const PageInfo page = PageInfo(name); + static const PageInfo page = + PageInfo(name); +} + +class ExtendingVolumeRouteArgs { + const ExtendingVolumeRouteArgs({ + required this.diskVolumeToResize, + required this.diskStatus, + this.key, + }); + + final DiskVolume diskVolumeToResize; + + final DiskStatus diskStatus; + + final Key? key; + + @override + String toString() { + return 'ExtendingVolumeRouteArgs{diskVolumeToResize: $diskVolumeToResize, diskStatus: $diskStatus, key: $key}'; + } } /// generated route for @@ -541,96 +608,29 @@ class ServicesMigrationRouteArgs { } /// generated route for -/// [ExtendingVolumePage] -class ExtendingVolumeRoute extends PageRouteInfo { - ExtendingVolumeRoute({ - required DiskVolume diskVolumeToResize, - required DiskStatus diskStatus, - Key? key, - List? children, - }) : super( - ExtendingVolumeRoute.name, - args: ExtendingVolumeRouteArgs( - diskVolumeToResize: diskVolumeToResize, - diskStatus: diskStatus, - key: key, - ), - initialChildren: children, - ); - - static const String name = 'ExtendingVolumeRoute'; - - static const PageInfo page = - PageInfo(name); -} - -class ExtendingVolumeRouteArgs { - const ExtendingVolumeRouteArgs({ - required this.diskVolumeToResize, - required this.diskStatus, - this.key, - }); - - final DiskVolume diskVolumeToResize; - - final DiskStatus diskStatus; - - final Key? key; - - @override - String toString() { - return 'ExtendingVolumeRouteArgs{diskVolumeToResize: $diskVolumeToResize, diskStatus: $diskStatus, key: $key}'; - } -} - -/// generated route for -/// [ServerStoragePage] -class ServerStorageRoute extends PageRouteInfo { - ServerStorageRoute({ - required DiskStatus diskStatus, - Key? key, - List? children, - }) : super( - ServerStorageRoute.name, - args: ServerStorageRouteArgs( - diskStatus: diskStatus, - key: key, - ), - initialChildren: children, - ); - - static const String name = 'ServerStorageRoute'; - - static const PageInfo page = - PageInfo(name); -} - -class ServerStorageRouteArgs { - const ServerStorageRouteArgs({ - required this.diskStatus, - this.key, - }); - - final DiskStatus diskStatus; - - final Key? key; - - @override - String toString() { - return 'ServerStorageRouteArgs{diskStatus: $diskStatus, key: $key}'; - } -} - -/// generated route for -/// [RootPage] -class RootRoute extends PageRouteInfo { - const RootRoute({List? children}) +/// [DevicesScreen] +class DevicesRoute extends PageRouteInfo { + const DevicesRoute({List? children}) : super( - RootRoute.name, + DevicesRoute.name, initialChildren: children, ); - static const String name = 'RootRoute'; + static const String name = 'DevicesRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [OnboardingPage] +class OnboardingRoute extends PageRouteInfo { + const OnboardingRoute({List? children}) + : super( + OnboardingRoute.name, + initialChildren: children, + ); + + static const String name = 'OnboardingRoute'; static const PageInfo page = PageInfo(name); } From e9665ad75d1dcc2cd4768801a6f939eebcd53917 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 16 May 2023 11:06:01 -0300 Subject: [PATCH 48/96] feat: Implement polymorphic DNS check for DNS API --- .../dns_providers/cloudflare/cloudflare.dart | 144 +++++++++++ .../rest_maps/dns_providers/desec/desec.dart | 226 +++++++++++++++--- .../rest_maps/dns_providers/dns_provider.dart | 12 +- .../server_providers/hetzner/hetzner.dart | 2 +- .../cubit/dns_records/dns_records_cubit.dart | 92 +++---- lib/utils/network_utils.dart | 81 ------- 6 files changed, 385 insertions(+), 172 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart index 04ff622b..eb22e4d8 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart @@ -5,6 +5,7 @@ import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; +import 'package:selfprivacy/utils/network_utils.dart'; class CloudflareApi extends DnsProviderApi { CloudflareApi({ @@ -317,4 +318,147 @@ class CloudflareApi extends DnsProviderApi { return domains; } + + @override + Future>> validateDnsRecords( + final ServerDomain domain, + final String ip4, + final String dkimPublicKey, + ) async { + final List records = await getDnsRecords(domain: domain); + final List foundRecords = []; + try { + final List desiredRecords = + getDesiredDnsRecords(domain.domainName, ip4, dkimPublicKey); + for (final DesiredDnsRecord record in desiredRecords) { + if (record.description == 'record.dkim') { + final DnsRecord foundRecord = records.firstWhere( + (final r) => (r.name == record.name) && r.type == record.type, + orElse: () => DnsRecord( + name: record.name, + type: record.type, + content: '', + ttl: 800, + proxied: false, + ), + ); + // remove all spaces and tabulators from + // the foundRecord.content and the record.content + // to compare them + final String? foundContent = + foundRecord.content?.replaceAll(RegExp(r'\s+'), ''); + final String content = record.content.replaceAll(RegExp(r'\s+'), ''); + if (foundContent == content) { + foundRecords.add(record.copyWith(isSatisfied: true)); + } else { + foundRecords.add(record.copyWith(isSatisfied: false)); + } + } else { + if (records.any( + (final r) => + (r.name == record.name) && + r.type == record.type && + r.content == record.content, + )) { + foundRecords.add(record.copyWith(isSatisfied: true)); + } else { + foundRecords.add(record.copyWith(isSatisfied: false)); + } + } + } + } catch (e) { + print(e); + return APIGenericResult( + data: [], + success: false, + message: e.toString(), + ); + } + return APIGenericResult( + data: foundRecords, + success: true, + ); + } + + @override + List getDesiredDnsRecords( + final String? domainName, + final String? ip4, + final String? dkimPublicKey, + ) { + if (domainName == null || ip4 == null) { + return []; + } + return [ + DesiredDnsRecord( + name: domainName, + content: ip4, + description: 'record.root', + ), + DesiredDnsRecord( + name: 'api.$domainName', + content: ip4, + description: 'record.api', + ), + DesiredDnsRecord( + name: 'cloud.$domainName', + content: ip4, + description: 'record.cloud', + ), + DesiredDnsRecord( + name: 'git.$domainName', + content: ip4, + description: 'record.git', + ), + DesiredDnsRecord( + name: 'meet.$domainName', + content: ip4, + description: 'record.meet', + ), + DesiredDnsRecord( + name: 'social.$domainName', + content: ip4, + description: 'record.social', + ), + DesiredDnsRecord( + name: 'password.$domainName', + content: ip4, + description: 'record.password', + ), + DesiredDnsRecord( + name: 'vpn.$domainName', + content: ip4, + description: 'record.vpn', + ), + DesiredDnsRecord( + name: domainName, + content: domainName, + description: 'record.mx', + type: 'MX', + category: DnsRecordsCategory.email, + ), + DesiredDnsRecord( + name: '_dmarc.$domainName', + content: 'v=DMARC1; p=none', + description: 'record.dmarc', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + DesiredDnsRecord( + name: domainName, + content: 'v=spf1 a mx ip4:$ip4 -all', + description: 'record.spf', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + if (dkimPublicKey != null) + DesiredDnsRecord( + name: 'selector._domainkey.$domainName', + content: dkimPublicKey, + description: 'record.dkim', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + ]; + } } diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart index 4e55bbfa..91eed57a 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart @@ -5,6 +5,7 @@ import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; +import 'package:selfprivacy/utils/network_utils.dart'; class DesecApi extends DnsProviderApi { DesecApi({ @@ -61,6 +62,7 @@ class DesecApi extends DnsProviderApi { headers: {'Authorization': 'Token $token'}, ), ); + await Future.delayed(const Duration(seconds: 1)); } catch (e) { print(e); isValid = false; @@ -102,13 +104,29 @@ class DesecApi extends DnsProviderApi { }) async { final String domainName = domain.domainName; final String url = '/$domainName/rrsets/'; + final List listDnsRecords = projectDnsRecords(domainName, ip4); final Dio client = await getClient(); try { - final Response response = await client.get(url); - - final List records = response.data; - await client.put(url, data: records); + final List bulkRecords = []; + for (final DnsRecord record in listDnsRecords) { + bulkRecords.add( + record.name == null + ? { + 'type': record.type, + 'ttl': record.ttl, + 'records': [], + } + : { + 'subname': record.name, + 'type': record.type, + 'ttl': record.ttl, + 'records': [], + }, + ); + } + await client.put(url, data: bulkRecords); + await Future.delayed(const Duration(seconds: 1)); } catch (e) { print(e); return APIGenericResult( @@ -136,14 +154,18 @@ class DesecApi extends DnsProviderApi { final Dio client = await getClient(); try { response = await client.get(url); + await Future.delayed(const Duration(seconds: 1)); final List records = response.data; for (final record in records) { + final String? content = (record['records'] is List) + ? record['records'][0] + : record['records']; allRecords.add( DnsRecord( name: record['subname'], type: record['type'], - content: record['records'], + content: content, ttl: record['ttl'], ), ); @@ -164,30 +186,31 @@ class DesecApi extends DnsProviderApi { }) async { final String domainName = domain.domainName; final List listDnsRecords = projectDnsRecords(domainName, ip4); - final List allCreateFutures = []; final Dio client = await getClient(); try { + final List bulkRecords = []; for (final DnsRecord record in listDnsRecords) { - allCreateFutures.add( - client.post( - '/$domainName/rrsets/', - data: record.name == null - ? { - 'type': record.type, - 'ttl': record.ttl, - 'records': [record.content], - } - : { - 'subname': record.name, - 'type': record.type, - 'ttl': record.ttl, - 'records': [record.content], - }, - ), + bulkRecords.add( + record.name == null + ? { + 'type': record.type, + 'ttl': record.ttl, + 'records': [record.content], + } + : { + 'subname': record.name, + 'type': record.type, + 'ttl': record.ttl, + 'records': [record.content], + }, ); } - await Future.wait(allCreateFutures); + await client.post( + '/$domainName/rrsets/', + data: bulkRecords, + ); + await Future.delayed(const Duration(seconds: 1)); } on DioError catch (e) { print(e.message); rethrow; @@ -209,9 +232,10 @@ class DesecApi extends DnsProviderApi { final String? domainName, final String? ip4, ) { - final DnsRecord domainA = DnsRecord(type: 'A', name: null, content: ip4); + final DnsRecord domainA = DnsRecord(type: 'A', name: '', content: ip4); - final DnsRecord mx = DnsRecord(type: 'MX', name: null, content: domainName); + final DnsRecord mx = + DnsRecord(type: 'MX', name: '', content: '10 $domainName.'); final DnsRecord apiA = DnsRecord(type: 'A', name: 'api', content: ip4); final DnsRecord cloudA = DnsRecord(type: 'A', name: 'cloud', content: ip4); final DnsRecord gitA = DnsRecord(type: 'A', name: 'git', content: ip4); @@ -225,14 +249,14 @@ class DesecApi extends DnsProviderApi { final DnsRecord txt1 = DnsRecord( type: 'TXT', name: '_dmarc', - content: 'v=DMARC1; p=none', + content: '"v=DMARC1; p=none"', ttl: 18000, ); final DnsRecord txt2 = DnsRecord( type: 'TXT', - name: null, - content: 'v=spf1 a mx ip4:$ip4 -all', + name: '', + content: '"v=spf1 a mx ip4:$ip4 -all"', ttl: 18000, ); @@ -275,6 +299,7 @@ class DesecApi extends DnsProviderApi { 'records': [record.content], }, ); + await Future.delayed(const Duration(seconds: 1)); } catch (e) { print(e); } finally { @@ -291,6 +316,7 @@ class DesecApi extends DnsProviderApi { final Response response = await client.get( '', ); + await Future.delayed(const Duration(seconds: 1)); domains = response.data .map((final el) => el['name'] as String) .toList(); @@ -302,4 +328,148 @@ class DesecApi extends DnsProviderApi { return domains; } + + @override + Future>> validateDnsRecords( + final ServerDomain domain, + final String ip4, + final String dkimPublicKey, + ) async { + final List records = await getDnsRecords(domain: domain); + final List foundRecords = []; + try { + final List desiredRecords = + getDesiredDnsRecords(domain.domainName, ip4, dkimPublicKey); + for (final DesiredDnsRecord record in desiredRecords) { + if (record.description == 'record.dkim') { + final DnsRecord foundRecord = records.firstWhere( + (final r) => (r.name == record.name) && r.type == record.type, + orElse: () => DnsRecord( + name: record.name, + type: record.type, + content: '', + ttl: 800, + proxied: false, + ), + ); + // remove all spaces and tabulators from + // the foundRecord.content and the record.content + // to compare them + final String? foundContent = + foundRecord.content?.replaceAll(RegExp(r'\s+'), ''); + final String content = record.content.replaceAll(RegExp(r'\s+'), ''); + if (foundContent == content) { + foundRecords.add(record.copyWith(isSatisfied: true)); + } else { + foundRecords.add(record.copyWith(isSatisfied: false)); + } + } else { + if (records.any( + (final r) => + ('${r.name}.${domain.domainName}' == record.name || + record.name == '') && + r.type == record.type && + r.content == record.content, + )) { + foundRecords.add(record.copyWith(isSatisfied: true)); + } else { + foundRecords.add(record.copyWith(isSatisfied: false)); + } + } + } + } catch (e) { + print(e); + return APIGenericResult( + data: [], + success: false, + message: e.toString(), + ); + } + return APIGenericResult( + data: foundRecords, + success: true, + ); + } + + @override + List getDesiredDnsRecords( + final String? domainName, + final String? ip4, + final String? dkimPublicKey, + ) { + if (domainName == null || ip4 == null) { + return []; + } + return [ + DesiredDnsRecord( + name: '', + content: ip4, + description: 'record.root', + ), + DesiredDnsRecord( + name: 'api.$domainName', + content: ip4, + description: 'record.api', + ), + DesiredDnsRecord( + name: 'cloud.$domainName', + content: ip4, + description: 'record.cloud', + ), + DesiredDnsRecord( + name: 'git.$domainName', + content: ip4, + description: 'record.git', + ), + DesiredDnsRecord( + name: 'meet.$domainName', + content: ip4, + description: 'record.meet', + ), + DesiredDnsRecord( + name: 'social.$domainName', + content: ip4, + description: 'record.social', + ), + DesiredDnsRecord( + name: 'password.$domainName', + content: ip4, + description: 'record.password', + ), + DesiredDnsRecord( + name: 'vpn.$domainName', + content: ip4, + description: 'record.vpn', + ), + DesiredDnsRecord( + name: '', + content: '10 $domainName.', + description: 'record.mx', + type: 'MX', + category: DnsRecordsCategory.email, + ), + DesiredDnsRecord( + name: '_dmarc.$domainName', + content: '"v=DMARC1; p=none"', + description: 'record.dmarc', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + DesiredDnsRecord( + name: '', + content: '"v=spf1 a mx ip4:$ip4 -all"', + description: 'record.spf', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + if (dkimPublicKey != null) + DesiredDnsRecord( + name: 'selector._domainkey.$domainName', + content: dkimPublicKey, + description: 'record.dkim', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + ]; + } } diff --git a/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart b/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart index 106d185c..b85f94d1 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart @@ -2,6 +2,7 @@ import 'package:selfprivacy/logic/api_maps/api_generic_result.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; +import 'package:selfprivacy/utils/network_utils.dart'; export 'package:selfprivacy/logic/api_maps/api_generic_result.dart'; @@ -26,9 +27,18 @@ abstract class DnsProviderApi extends ApiMap { final DnsRecord record, final ServerDomain domain, ); + Future>> validateDnsRecords( + final ServerDomain domain, + final String ip4, + final String dkimPublicKey, + ); + List getDesiredDnsRecords( + final String? domainName, + final String? ip4, + final String? dkimPublicKey, + ); Future getZoneId(final String domain); Future> domainList(); - Future> isApiTokenValid(final String token); RegExp getApiTokenValidation(); } diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart index c2228030..f9a2104e 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart @@ -394,7 +394,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { final String apiToken = StringGenerators.apiToken(); final String hostname = getHostnameFromDomain(domainName); - const String infectBranch = 'providers/hetzner'; + const String infectBranch = 'testing/desec'; final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false'; final String base64Password = base64.encode(utf8.encode(rootUser.password ?? 'PASS')); diff --git a/lib/logic/cubit/dns_records/dns_records_cubit.dart b/lib/logic/cubit/dns_records/dns_records_cubit.dart index 3403dc68..de87910d 100644 --- a/lib/logic/cubit/dns_records/dns_records_cubit.dart +++ b/lib/logic/cubit/dns_records/dns_records_cubit.dart @@ -25,11 +25,13 @@ class DnsRecordsCubit emit( DnsRecordsState( dnsState: DnsRecordsStatus.refreshing, - dnsRecords: getDesiredDnsRecords( - serverInstallationCubit.state.serverDomain?.domainName, - '', - '', - ), + dnsRecords: ApiController.currentDnsProviderApiFactory! + .getDnsProvider() + .getDesiredDnsRecords( + serverInstallationCubit.state.serverDomain?.domainName, + '', + '', + ), ), ); @@ -37,64 +39,32 @@ class DnsRecordsCubit final ServerDomain? domain = serverInstallationCubit.state.serverDomain; final String? ipAddress = serverInstallationCubit.state.serverDetails?.ip4; - if (domain != null && ipAddress != null) { - final List records = await ApiController - .currentDnsProviderApiFactory! - .getDnsProvider() - .getDnsRecords(domain: domain); - final String? dkimPublicKey = - extractDkimRecord(await api.getDnsRecords())?.content; - final List desiredRecords = - getDesiredDnsRecords(domain.domainName, ipAddress, dkimPublicKey); - final List foundRecords = []; - for (final DesiredDnsRecord record in desiredRecords) { - if (record.description == 'record.dkim') { - final DnsRecord foundRecord = records.firstWhere( - (final r) => r.name == record.name && r.type == record.type, - orElse: () => DnsRecord( - name: record.name, - type: record.type, - content: '', - ttl: 800, - proxied: false, - ), - ); - // remove all spaces and tabulators from - // the foundRecord.content and the record.content - // to compare them - final String? foundContent = - foundRecord.content?.replaceAll(RegExp(r'\s+'), ''); - final String content = - record.content.replaceAll(RegExp(r'\s+'), ''); - if (foundContent == content) { - foundRecords.add(record.copyWith(isSatisfied: true)); - } else { - foundRecords.add(record.copyWith(isSatisfied: false)); - } - } else { - if (records.any( - (final r) => - r.name == record.name && - r.type == record.type && - r.content == record.content, - )) { - foundRecords.add(record.copyWith(isSatisfied: true)); - } else { - foundRecords.add(record.copyWith(isSatisfied: false)); - } - } - } - emit( - DnsRecordsState( - dnsRecords: foundRecords, - dnsState: foundRecords.any((final r) => r.isSatisfied == false) - ? DnsRecordsStatus.error - : DnsRecordsStatus.good, - ), - ); - } else { + if (domain == null && ipAddress == null) { emit(const DnsRecordsState()); + return; } + + final foundRecords = await ApiController.currentDnsProviderApiFactory! + .getDnsProvider() + .validateDnsRecords( + domain!, + ipAddress!, + extractDkimRecord(await api.getDnsRecords())?.content ?? '', + ); + + if (!foundRecords.success || foundRecords.data.isEmpty) { + emit(const DnsRecordsState()); + return; + } + + emit( + DnsRecordsState( + dnsRecords: foundRecords.data, + dnsState: foundRecords.data.any((final r) => r.isSatisfied == false) + ? DnsRecordsStatus.error + : DnsRecordsStatus.good, + ), + ); } } diff --git a/lib/utils/network_utils.dart b/lib/utils/network_utils.dart index fc06ecb8..3b7f9219 100644 --- a/lib/utils/network_utils.dart +++ b/lib/utils/network_utils.dart @@ -41,87 +41,6 @@ class DesiredDnsRecord { ); } -List getDesiredDnsRecords( - final String? domainName, - final String? ipAddress, - final String? dkimPublicKey, -) { - if (domainName == null || ipAddress == null) { - return []; - } - return [ - DesiredDnsRecord( - name: domainName, - content: ipAddress, - description: 'record.root', - ), - DesiredDnsRecord( - name: 'api.$domainName', - content: ipAddress, - description: 'record.api', - ), - DesiredDnsRecord( - name: 'cloud.$domainName', - content: ipAddress, - description: 'record.cloud', - ), - DesiredDnsRecord( - name: 'git.$domainName', - content: ipAddress, - description: 'record.git', - ), - DesiredDnsRecord( - name: 'meet.$domainName', - content: ipAddress, - description: 'record.meet', - ), - DesiredDnsRecord( - name: 'social.$domainName', - content: ipAddress, - description: 'record.social', - ), - DesiredDnsRecord( - name: 'password.$domainName', - content: ipAddress, - description: 'record.password', - ), - DesiredDnsRecord( - name: 'vpn.$domainName', - content: ipAddress, - description: 'record.vpn', - ), - DesiredDnsRecord( - name: domainName, - content: domainName, - description: 'record.mx', - type: 'MX', - category: DnsRecordsCategory.email, - ), - DesiredDnsRecord( - name: '_dmarc.$domainName', - content: 'v=DMARC1; p=none', - description: 'record.dmarc', - type: 'TXT', - category: DnsRecordsCategory.email, - ), - DesiredDnsRecord( - name: domainName, - content: 'v=spf1 a mx ip4:$ipAddress -all', - description: 'record.spf', - type: 'TXT', - category: DnsRecordsCategory.email, - ), - if (dkimPublicKey != null) - DesiredDnsRecord( - name: 'selector._domainkey.$domainName', - content: dkimPublicKey, - description: 'record.dkim', - type: 'TXT', - category: DnsRecordsCategory.email, - ), - ]; -} - DnsRecord? extractDkimRecord(final List records) { DnsRecord? dkimRecord; From 6ddc2328f04111c868c49d2f372854fa8ad1fade Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 16 May 2023 12:49:55 -0300 Subject: [PATCH 49/96] feat: Implement proper DKIM creation for deSEC --- assets/translations/en.json | 4 +++- assets/translations/ru.json | 4 +++- .../rest_maps/dns_providers/desec/desec.dart | 19 ++++++++++++++----- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index 0d825bff..b902c3a2 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -286,11 +286,13 @@ "select_provider_countries_text_hetzner": "Germany, Finland, USA", "select_provider_countries_text_do": "USA, Netherlands, Singapore, UK, Germany, Canada, India, Australia", "select_provider_price_title": "Average price", + "select_provider_price_free": "Free", "select_provider_price_text_hetzner": "€8 per month for a relatively small server and 50GB of disk storage", "select_provider_price_text_do": "$17 per month for a relatively small server and 50GB of disk storage", "select_provider_payment_title": "Payment methods", "select_provider_payment_text_hetzner": "Credit cards, SWIFT, SEPA, PayPal", "select_provider_payment_text_do": "Credit cards, Google Pay, PayPal", + "select_provider_payment_text_cloudflare": "Credit cards", "select_provider_email_notice": "E-mail hosting won't be available for new clients. Nevertheless it will be unlocked as soon as you complete your first payment.", "select_provider_site_button": "Visit site", "connect_to_server_provider": "Now log in ", @@ -506,4 +508,4 @@ "reset_onboarding_description": "Reset onboarding switch to show onboarding screen again", "cubit_statuses": "Cubit loading statuses" } -} +} \ No newline at end of file diff --git a/assets/translations/ru.json b/assets/translations/ru.json index 35498bd9..6b624c70 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -280,10 +280,12 @@ "select_provider_countries_text_hetzner": "Германия, Финляндия, США", "select_provider_countries_text_do": "США, Нидерланды, Сингапур, Великобритания, Германия, Канада, Индия, Австралия", "select_provider_price_title": "Средняя цена", + "select_provider_price_free": "Бесплатно", "select_provider_price_text_hetzner": "€8 в месяц за небольшой сервер и 50GB места на диске", "select_provider_price_text_do": "$17 в месяц за небольшой сервер и 50GB места на диске", "select_provider_payment_title": "Методы оплаты", "select_provider_payment_text_hetzner": "Банковские карты, SWIFT, SEPA, PayPal", + "select_provider_payment_text_cloudflare": "Банковские карты", "select_provider_payment_text_do": "Банковские карты, Google Pay, PayPal", "select_provider_email_notice": "Хостинг электронной почты недоступен для новых клиентов. Разблокировать можно будет после первой оплаты.", "select_provider_site_button": "Посетить сайт", @@ -473,4 +475,4 @@ "length_not_equal": "Длина строки [], должна быть равна {}", "length_longer": "Длина строки [], должна быть меньше либо равна {}" } -} +} \ No newline at end of file diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart index 91eed57a..0a8197dc 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart @@ -196,13 +196,13 @@ class DesecApi extends DnsProviderApi { ? { 'type': record.type, 'ttl': record.ttl, - 'records': [record.content], + 'records': [extractContent(record)], } : { 'subname': record.name, 'type': record.type, 'ttl': record.ttl, - 'records': [record.content], + 'records': [extractContent(record)], }, ); } @@ -275,6 +275,15 @@ class DesecApi extends DnsProviderApi { ]; } + String? extractContent(final DnsRecord record) { + String? content = record.content; + if (record.type == 'TXT' && content != null && !content.startsWith('"')) { + content = '"$content"'; + } + + return content; + } + @override Future setDnsRecord( final DnsRecord record, @@ -290,13 +299,13 @@ class DesecApi extends DnsProviderApi { ? { 'type': record.type, 'ttl': record.ttl, - 'records': [record.content], + 'records': [extractContent(record)], } : { 'subname': record.name, 'type': record.type, 'ttl': record.ttl, - 'records': [record.content], + 'records': [extractContent(record)], }, ); await Future.delayed(const Duration(seconds: 1)); @@ -465,7 +474,7 @@ class DesecApi extends DnsProviderApi { if (dkimPublicKey != null) DesiredDnsRecord( name: 'selector._domainkey.$domainName', - content: dkimPublicKey, + content: '"$dkimPublicKey"', description: 'record.dkim', type: 'TXT', category: DnsRecordsCategory.email, From 732f39ef48d2eee8b65a1103755505a68ccd30f1 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 16 May 2023 14:58:51 -0300 Subject: [PATCH 50/96] chore: Add assets for deSEC --- assets/images/logos/cloudflare.svg | 1 + assets/markdown/how_desec-en.md | 9 +++++++++ assets/markdown/how_desec-ru.md | 9 +++++++++ assets/translations/en.json | 8 ++++---- assets/translations/ru.json | 8 ++++---- 5 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 assets/images/logos/cloudflare.svg create mode 100644 assets/markdown/how_desec-en.md create mode 100644 assets/markdown/how_desec-ru.md diff --git a/assets/images/logos/cloudflare.svg b/assets/images/logos/cloudflare.svg new file mode 100644 index 00000000..7099a7e9 --- /dev/null +++ b/assets/images/logos/cloudflare.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/markdown/how_desec-en.md b/assets/markdown/how_desec-en.md new file mode 100644 index 00000000..c86d3855 --- /dev/null +++ b/assets/markdown/how_desec-en.md @@ -0,0 +1,9 @@ +### How to get deSEC API Token +1. Log in at: https://desec.io/login +2. Go to **Domains** page at: https://desec.io/domains +3. Go to **Token management** tab. +4. Click on the round "plus" button in the upper right corner. +5. **"Generate New Token"** dialogue must be displayed. Enter any **Token name** you wish. *Advanced settings* are not required, so do not touch anything there. +6. Click on **Save**. +7. Make sure you **save** the token's **secret value** as it will only be displayed once. +8. Now you can safely **close** the dialogue. \ No newline at end of file diff --git a/assets/markdown/how_desec-ru.md b/assets/markdown/how_desec-ru.md new file mode 100644 index 00000000..a93acc77 --- /dev/null +++ b/assets/markdown/how_desec-ru.md @@ -0,0 +1,9 @@ +### Как получить deSEC API Токен +1. Авторизуемся в deSEC: https://desec.io/login +2. Переходим на страницу **Domains** по ссылке: https://desec.io/domains +3. Переходим на вкладку **Token management**. +4. Нажимаем на большую кнопку с плюсом в правом верхнем углу страницы. +5. Должен был появиться **"Generate New Token"** диалог. Вводим любое имя токена в **Token name**. *Advanced settings* необязательны, так что ничего там не трогаем. +6. Кликаем **Save**. +7. Обязательно сохраняем "**secret value**" ключ токена, потому что он отображается исключительно один раз. +8. Теперь спокойно закрываем диалог, нажав **close**. \ No newline at end of file diff --git a/assets/translations/en.json b/assets/translations/en.json index b902c3a2..653e33f8 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -313,13 +313,13 @@ "choose_server_type_storage": "{} GB of system storage", "choose_server_type_payment_per_month": "{} per month", "no_server_types_found": "No available server types found. Make sure your account is accessible and try to change your server location.", - "cloudflare_bad_key_error": "Cloudflare API key is invalid", + "cloudflare_bad_key_error": "DNS Provider API key is invalid", "backblaze_bad_key_error": "Backblaze storage information is invalid", "select_dns": "Now let's select a DNS provider", "manage_domain_dns": "To manage your domain's DNS", "use_this_domain": "Use this domain?", "use_this_domain_text": "The token you provided gives access to the following domain", - "cloudflare_api_token": "CloudFlare API Token", + "cloudflare_api_token": "DNS Provider API Token", "connect_backblaze_storage": "Connect Backblaze storage", "no_connected_domains": "No connected domains at the moment", "loading_domain_list": "Loading domain list", @@ -390,8 +390,8 @@ "modal_confirmation_dns_invalid": "Reverse DNS points to another domain", "modal_confirmation_ip_valid": "IP is the same as in DNS record", "modal_confirmation_ip_invalid": "IP is not the same as in DNS record", - "confirm_cloudflare": "Connect to CloudFlare", - "confirm_cloudflare_description": "Enter a Cloudflare token with access to {}:", + "confirm_cloudflare": "Connect to your DNS Provider", + "confirm_cloudflare_description": "Enter a token of your DNS Provider with access to {}:", "confirm_backblaze": "Connect to Backblaze", "confirm_backblaze_description": "Enter a Backblaze token with access to backup storage:" }, diff --git a/assets/translations/ru.json b/assets/translations/ru.json index 6b624c70..b4bdd938 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -307,12 +307,12 @@ "choose_server_type_storage": "{} GB системного хранилища", "choose_server_type_payment_per_month": "{} в месяц", "no_server_types_found": "Не найдено доступных типов сервера! Пожалуйста, убедитесь, что у вас есть доступ к провайдеру сервера...", - "cloudflare_bad_key_error": "Cloudflare API ключ неверен", + "cloudflare_bad_key_error": "API ключ неверен", "backblaze_bad_key_error": "Информация о Backblaze хранилище неверна", "manage_domain_dns": "Для управления DNS вашего домена", "use_this_domain": "Используем этот домен?", "use_this_domain_text": "Указанный вами токен даёт контроль над этим доменом", - "cloudflare_api_token": "CloudFlare API ключ", + "cloudflare_api_token": "API ключ DNS провайдера", "connect_backblaze_storage": "Подключите облачное хранилище Backblaze", "no_connected_domains": "На данный момент подлюченных доменов нет", "loading_domain_list": "Загружаем список доменов", @@ -368,8 +368,8 @@ "modal_confirmation_dns_invalid": "Обратный DNS указывает на другой домен", "modal_confirmation_ip_valid": "IP совпадает с указанным в DNS записи", "modal_confirmation_ip_invalid": "IP не совпадает с указанным в DNS записи", - "confirm_cloudflare": "Подключение к Cloudflare", - "confirm_cloudflare_description": "Введите токен Cloudflare, который имеет права на {}:", + "confirm_cloudflare": "Подключение к DNS Провайдеру", + "confirm_cloudflare_description": "Введите токен DNS Провайдера, который имеет права на {}:", "confirm_backblaze_description": "Введите токен Backblaze, который имеет права на хранилище резервных копий:", "confirm_backblaze": "Подключение к Backblaze", "server_provider_connected": "Подключение к вашему серверному провайдеру", From ce017c6ea8460a250f4d56248dbad204bb48d6b4 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 16 May 2023 15:03:31 -0300 Subject: [PATCH 51/96] fix: Make minor improvements for deSEC --- .../rest_maps/dns_providers/desec/desec.dart | 4 ++- .../initializing/dns_provider_picker.dart | 35 +++++++------------ .../recovery_server_provider_connected.dart | 4 +-- 3 files changed, 17 insertions(+), 26 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart index 0a8197dc..aea1d0da 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart @@ -352,7 +352,9 @@ class DesecApi extends DnsProviderApi { for (final DesiredDnsRecord record in desiredRecords) { if (record.description == 'record.dkim') { final DnsRecord foundRecord = records.firstWhere( - (final r) => (r.name == record.name) && r.type == record.type, + (final r) => + ('${r.name}.${domain.domainName}' == record.name) && + r.type == record.type, orElse: () => DnsRecord( name: record.name, type: record.type, diff --git a/lib/ui/pages/setup/initializing/dns_provider_picker.dart b/lib/ui/pages/setup/initializing/dns_provider_picker.dart index cb0d2111..7ee580a7 100644 --- a/lib/ui/pages/setup/initializing/dns_provider_picker.dart +++ b/lib/ui/pages/setup/initializing/dns_provider_picker.dart @@ -5,6 +5,7 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:selfprivacy/config/brand_theme.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; import 'package:selfprivacy/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart'; +import 'package:selfprivacy/logic/cubit/support_system/support_system_cubit.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/ui/components/brand_md/brand_md.dart'; import 'package:selfprivacy/ui/components/buttons/brand_button.dart'; @@ -51,7 +52,7 @@ class _DnsProviderPickerState extends State { providerType: DnsProvider.cloudflare, pathToHow: 'how_cloudflare', image: Image.asset( - 'assets/images/logos/cloudflare.png', + 'assets/images/logos/cloudflare.svg', width: 150, ), ), @@ -62,9 +63,9 @@ class _DnsProviderPickerState extends State { providerCubit: widget.formCubit, providerInfo: ProviderPageInfo( providerType: DnsProvider.desec, - pathToHow: 'how_digital_ocean_dns', + pathToHow: 'how_desec', image: Image.asset( - 'assets/images/logos/digital_ocean.png', + 'assets/images/logos/desec.svg', width: 150, ), ), @@ -100,7 +101,7 @@ class ProviderInputDataPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - 'initializing.connect_to_dns'.tr(), + 'initializing.cloudflare_api_token'.tr(), style: Theme.of(context).textTheme.headlineSmall, ), const SizedBox(height: 16), @@ -125,22 +126,12 @@ class ProviderInputDataPage extends StatelessWidget { const SizedBox(height: 10), BrandOutlinedButton( child: Text('initializing.how'.tr()), - onPressed: () => showModalBottomSheet( - context: context, - isScrollControlled: true, - backgroundColor: Colors.transparent, - builder: (final BuildContext context) => Padding( - padding: paddingH15V0, - child: ListView( - padding: const EdgeInsets.symmetric(vertical: 16), - children: [ - BrandMarkdown( - fileName: providerInfo.pathToHow, - ), - ], - ), - ), - ), + onPressed: () { + context.read().showArticle( + article: providerInfo.pathToHow, + context: context, + ); + }, ), ], ); @@ -186,7 +177,7 @@ class ProviderSelectionPage extends StatelessWidget { padding: const EdgeInsets.all(10), decoration: BoxDecoration( borderRadius: BorderRadius.circular(40), - color: const Color.fromARGB(255, 241, 215, 166), + color: const Color.fromARGB(255, 244, 128, 31), ), child: SvgPicture.asset( 'assets/images/logos/cloudflare.svg', @@ -194,7 +185,7 @@ class ProviderSelectionPage extends StatelessWidget { ), const SizedBox(width: 16), Text( - 'Hetzner Cloud', + 'Cloudflare', style: Theme.of(context).textTheme.titleMedium, ), ], diff --git a/lib/ui/pages/setup/recovering/recovery_server_provider_connected.dart b/lib/ui/pages/setup/recovering/recovery_server_provider_connected.dart index 91999fb9..93d0eb87 100644 --- a/lib/ui/pages/setup/recovering/recovery_server_provider_connected.dart +++ b/lib/ui/pages/setup/recovering/recovery_server_provider_connected.dart @@ -45,9 +45,7 @@ class RecoveryServerProviderConnected extends StatelessWidget { ), const SizedBox(height: 16), BrandButton.filled( - onPressed: formCubitState.isSubmitting - ? null - : () => context.read().trySubmit(), + onPressed: () => context.read().trySubmit(), child: Text('basis.continue'.tr()), ), const SizedBox(height: 16), From 232699bdb1efdad9693906fc9d252ce1fd6d685f Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 16 May 2023 15:49:03 -0300 Subject: [PATCH 52/96] feat: Implement proper access recovery for DNS providers --- lib/logic/api_maps/graphql_maps/api_map.dart | 2 +- lib/logic/api_maps/staging_options.dart | 12 +++++++++-- .../cubit/dns_records/dns_records_cubit.dart | 3 +++ .../server_installation_cubit.dart | 18 ++++++++++++----- .../server_installation_repository.dart | 20 +++++++++++-------- 5 files changed, 39 insertions(+), 16 deletions(-) diff --git a/lib/logic/api_maps/graphql_maps/api_map.dart b/lib/logic/api_maps/graphql_maps/api_map.dart index a633866e..34e39b7a 100644 --- a/lib/logic/api_maps/graphql_maps/api_map.dart +++ b/lib/logic/api_maps/graphql_maps/api_map.dart @@ -56,7 +56,7 @@ class ResponseLoggingParser extends ResponseParser { abstract class ApiMap { Future getClient() async { IOClient? ioClient; - if (StagingOptions.stagingAcme) { + if (StagingOptions.stagingAcme || !StagingOptions.verifyCertificate) { final HttpClient httpClient = HttpClient(); httpClient.badCertificateCallback = ( final cert, diff --git a/lib/logic/api_maps/staging_options.dart b/lib/logic/api_maps/staging_options.dart index 7d3084b7..a4e98fe8 100644 --- a/lib/logic/api_maps/staging_options.dart +++ b/lib/logic/api_maps/staging_options.dart @@ -1,8 +1,16 @@ -/// Controls staging environment for network, is used during manual -/// integration testing and such +/// Controls staging environment for network class StagingOptions { /// Whether we request for staging temprorary certificates. /// Hardcode to 'true' in the middle of testing to not /// get your domain banned by constant certificate renewal + /// + /// If set to 'true', the 'verifyCertificate' becomes useless static bool get stagingAcme => false; + + /// Should we consider CERTIFICATE_VERIFY_FAILED code an error + /// For now it's just a global variable and DNS API + /// classes can change it at will + /// + /// Doesn't matter if 'statingAcme' is set to 'true' + static bool verifyCertificate = false; } diff --git a/lib/logic/cubit/dns_records/dns_records_cubit.dart b/lib/logic/cubit/dns_records/dns_records_cubit.dart index de87910d..2e57f0f7 100644 --- a/lib/logic/cubit/dns_records/dns_records_cubit.dart +++ b/lib/logic/cubit/dns_records/dns_records_cubit.dart @@ -1,7 +1,10 @@ import 'package:cubit_form/cubit_form.dart'; +import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/api_controller.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; +import 'package:selfprivacy/logic/get_it/api_config.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index cc5bffcc..fa0a04e1 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -541,13 +541,20 @@ class ServerInstallationCubit extends Cubit { customToken: serverDetails.apiToken, isWithToken: true, ).getServerProviderType(); - if (provider == ServerProvider.unknown) { + final dnsProvider = await ServerApi( + customToken: serverDetails.apiToken, + isWithToken: true, + ).getDnsProviderType(); + if (provider == ServerProvider.unknown || + dnsProvider == DnsProvider.unknown) { getIt() .showSnackBar('recovering.generic_error'.tr()); return; } await repository.saveServerDetails(serverDetails); + await repository.saveDnsProviderType(dnsProvider); setServerProviderType(provider); + setDnsProviderType(dnsProvider); emit( dataState.copyWith( serverDetails: serverDetails, @@ -700,14 +707,15 @@ class ServerInstallationCubit extends Cubit { .showSnackBar('recovering.domain_not_available_on_token'.tr()); return; } + final dnsProviderType = await ServerApi( + customToken: dataState.serverDetails!.apiToken, + isWithToken: true, + ).getDnsProviderType(); await repository.saveDomain( ServerDomain( domainName: serverDomain.domainName, zoneId: zoneId, - provider: await ServerApi( - customToken: token, - isWithToken: true, - ).getDnsProviderType(), + provider: dnsProviderType, ), ); await repository.saveDnsProviderKey(token); diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index ff167518..bc92f645 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -15,6 +15,7 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider. import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server_api.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; +import 'package:selfprivacy/logic/api_maps/staging_options.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/models/hive/backblaze_credential.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; @@ -76,17 +77,20 @@ class ServerInstallationRepository { ); } - if (dnsProvider != null || - (serverDomain != null && - serverDomain.provider != DnsProvider.unknown)) { - ApiController.initDnsProviderApiFactory( - DnsProviderApiFactorySettings( - provider: dnsProvider ?? serverDomain!.provider, - ), - ); + if (ApiController.currentDnsProviderApiFactory == null) { + if (dnsProvider != null || + (serverDomain != null && + serverDomain.provider != DnsProvider.unknown)) { + ApiController.initDnsProviderApiFactory( + DnsProviderApiFactorySettings( + provider: dnsProvider ?? serverDomain!.provider, + ), + ); + } } if (box.get(BNames.hasFinalChecked, defaultValue: false)) { + StagingOptions.verifyCertificate = true; return ServerInstallationFinished( providerApiToken: providerApiToken!, serverTypeIdentificator: serverTypeIdentificator ?? '', From 4afcedebb70f84f8c7395f6277d5a6c3317c3954 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 16 May 2023 16:55:26 -0300 Subject: [PATCH 53/96] feat: Remove certificate check during installation --- .../rest_maps/dns_providers/desec/desec.dart | 62 ++++++++----------- .../server_providers/hetzner/hetzner.dart | 2 +- .../cubit/dns_records/dns_records_cubit.dart | 18 +++--- .../server_installation_cubit.dart | 3 + 4 files changed, 38 insertions(+), 47 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart index aea1d0da..c1a8f43b 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart @@ -111,20 +111,22 @@ class DesecApi extends DnsProviderApi { final List bulkRecords = []; for (final DnsRecord record in listDnsRecords) { bulkRecords.add( - record.name == null - ? { - 'type': record.type, - 'ttl': record.ttl, - 'records': [], - } - : { - 'subname': record.name, - 'type': record.type, - 'ttl': record.ttl, - 'records': [], - }, + { + 'subname': record.name, + 'type': record.type, + 'ttl': record.ttl, + 'records': [], + }, ); } + bulkRecords.add( + { + 'subname': 'selector._domainkey', + 'type': 'TXT', + 'ttl': 18000, + 'records': [], + }, + ); await client.put(url, data: bulkRecords); await Future.delayed(const Duration(seconds: 1)); } catch (e) { @@ -192,18 +194,12 @@ class DesecApi extends DnsProviderApi { final List bulkRecords = []; for (final DnsRecord record in listDnsRecords) { bulkRecords.add( - record.name == null - ? { - 'type': record.type, - 'ttl': record.ttl, - 'records': [extractContent(record)], - } - : { - 'subname': record.name, - 'type': record.type, - 'ttl': record.ttl, - 'records': [extractContent(record)], - }, + { + 'subname': record.name, + 'type': record.type, + 'ttl': record.ttl, + 'records': [extractContent(record)], + }, ); } await client.post( @@ -295,18 +291,12 @@ class DesecApi extends DnsProviderApi { try { await client.post( url, - data: record.name == null - ? { - 'type': record.type, - 'ttl': record.ttl, - 'records': [extractContent(record)], - } - : { - 'subname': record.name, - 'type': record.type, - 'ttl': record.ttl, - 'records': [extractContent(record)], - }, + data: { + 'subname': record.name, + 'type': record.type, + 'ttl': record.ttl, + 'records': [extractContent(record)], + }, ); await Future.delayed(const Duration(seconds: 1)); } catch (e) { diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart index f9a2104e..c2228030 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart @@ -394,7 +394,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { final String apiToken = StringGenerators.apiToken(); final String hostname = getHostnameFromDomain(domainName); - const String infectBranch = 'testing/desec'; + const String infectBranch = 'providers/hetzner'; final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false'; final String base64Password = base64.encode(utf8.encode(rootUser.password ?? 'PASS')); diff --git a/lib/logic/cubit/dns_records/dns_records_cubit.dart b/lib/logic/cubit/dns_records/dns_records_cubit.dart index 2e57f0f7..472ed954 100644 --- a/lib/logic/cubit/dns_records/dns_records_cubit.dart +++ b/lib/logic/cubit/dns_records/dns_records_cubit.dart @@ -1,10 +1,7 @@ import 'package:cubit_form/cubit_form.dart'; -import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/api_controller.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; -import 'package:selfprivacy/logic/get_it/api_config.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; @@ -28,13 +25,14 @@ class DnsRecordsCubit emit( DnsRecordsState( dnsState: DnsRecordsStatus.refreshing, - dnsRecords: ApiController.currentDnsProviderApiFactory! - .getDnsProvider() - .getDesiredDnsRecords( - serverInstallationCubit.state.serverDomain?.domainName, - '', - '', - ), + dnsRecords: ApiController.currentDnsProviderApiFactory + ?.getDnsProvider() + .getDesiredDnsRecords( + serverInstallationCubit.state.serverDomain?.domainName, + '', + '', + ) ?? + [], ), ); diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index fa0a04e1..47952c9a 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -10,6 +10,7 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_api_settings.dart'; +import 'package:selfprivacy/logic/api_maps/staging_options.dart'; import 'package:selfprivacy/logic/models/hive/backblaze_credential.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; @@ -436,6 +437,7 @@ class ServerInstallationCubit extends Cubit { emit(TimerState(dataState: dataState, isLoading: true)); final bool isServerWorking = await repository.isHttpServerWorking(); + StagingOptions.verifyCertificate = true; if (isServerWorking) { bool dkimCreated = true; @@ -758,6 +760,7 @@ class ServerInstallationCubit extends Cubit { void clearAppConfig() { closeTimer(); ApiController.clearProviderApiFactories(); + StagingOptions.verifyCertificate = false; repository.clearAppConfig(); emit(const ServerInstallationEmpty()); } From d276a8f7084915708cca11a7dc2c1bf2931f69d4 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Thu, 18 May 2023 19:06:13 -0300 Subject: [PATCH 54/96] fix: Remove price lists for DNS and move deSEC onto above Cloudflare --- .../initializing/dns_provider_picker.dart | 133 ++++++++---------- 1 file changed, 56 insertions(+), 77 deletions(-) diff --git a/lib/ui/pages/setup/initializing/dns_provider_picker.dart b/lib/ui/pages/setup/initializing/dns_provider_picker.dart index 7ee580a7..7e494af4 100644 --- a/lib/ui/pages/setup/initializing/dns_provider_picker.dart +++ b/lib/ui/pages/setup/initializing/dns_provider_picker.dart @@ -2,12 +2,10 @@ import 'package:cubit_form/cubit_form.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:selfprivacy/config/brand_theme.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; import 'package:selfprivacy/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart'; import 'package:selfprivacy/logic/cubit/support_system/support_system_cubit.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; -import 'package:selfprivacy/ui/components/brand_md/brand_md.dart'; import 'package:selfprivacy/ui/components/buttons/brand_button.dart'; import 'package:selfprivacy/ui/components/buttons/outlined_button.dart'; import 'package:selfprivacy/ui/components/cards/outlined_card.dart'; @@ -163,72 +161,6 @@ class ProviderSelectionPage extends StatelessWidget { style: Theme.of(context).textTheme.bodyMedium, ), const SizedBox(height: 10), - OutlinedCard( - child: Padding( - padding: const EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Container( - width: 40, - height: 40, - padding: const EdgeInsets.all(10), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(40), - color: const Color.fromARGB(255, 244, 128, 31), - ), - child: SvgPicture.asset( - 'assets/images/logos/cloudflare.svg', - ), - ), - const SizedBox(width: 16), - Text( - 'Cloudflare', - style: Theme.of(context).textTheme.titleMedium, - ), - ], - ), - const SizedBox(height: 16), - Text( - 'initializing.select_provider_price_title'.tr(), - style: Theme.of(context).textTheme.bodyLarge, - ), - Text( - 'initializing.select_provider_price_free'.tr(), - style: Theme.of(context).textTheme.bodySmall, - ), - const SizedBox(height: 16), - Text( - 'initializing.select_provider_payment_title'.tr(), - style: Theme.of(context).textTheme.bodyLarge, - ), - Text( - 'initializing.select_provider_payment_text_cloudflare' - .tr(), - style: Theme.of(context).textTheme.bodySmall, - ), - const SizedBox(height: 16), - BrandButton.rised( - text: 'basis.select'.tr(), - onPressed: () { - serverInstallationCubit - .setDnsProviderType(DnsProvider.cloudflare); - callback(DnsProvider.cloudflare); - }, - ), - // Outlined button that will open website - BrandOutlinedButton( - onPressed: () => - launchURL('https://dash.cloudflare.com/'), - title: 'initializing.select_provider_site_button'.tr(), - ), - ], - ), - ), - ), - const SizedBox(height: 16), OutlinedCard( child: Padding( padding: const EdgeInsets.all(16.0), @@ -266,15 +198,6 @@ class ProviderSelectionPage extends StatelessWidget { style: Theme.of(context).textTheme.bodySmall, ), const SizedBox(height: 16), - Text( - 'initializing.select_provider_payment_title'.tr(), - style: Theme.of(context).textTheme.bodyLarge, - ), - Text( - 'initializing.select_provider_payment_text_do'.tr(), - style: Theme.of(context).textTheme.bodySmall, - ), - const SizedBox(height: 16), BrandButton.rised( text: 'basis.select'.tr(), onPressed: () { @@ -292,6 +215,62 @@ class ProviderSelectionPage extends StatelessWidget { ), ), ), + const SizedBox(height: 16), + OutlinedCard( + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + width: 40, + height: 40, + padding: const EdgeInsets.all(10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(40), + color: const Color.fromARGB(255, 244, 128, 31), + ), + child: SvgPicture.asset( + 'assets/images/logos/cloudflare.svg', + ), + ), + const SizedBox(width: 16), + Text( + 'Cloudflare', + style: Theme.of(context).textTheme.titleMedium, + ), + ], + ), + const SizedBox(height: 16), + Text( + 'initializing.select_provider_price_title'.tr(), + style: Theme.of(context).textTheme.bodyLarge, + ), + Text( + 'initializing.select_provider_price_free'.tr(), + style: Theme.of(context).textTheme.bodySmall, + ), + const SizedBox(height: 16), + BrandButton.rised( + text: 'basis.select'.tr(), + onPressed: () { + serverInstallationCubit + .setDnsProviderType(DnsProvider.cloudflare); + callback(DnsProvider.cloudflare); + }, + ), + // Outlined button that will open website + BrandOutlinedButton( + onPressed: () => + launchURL('https://dash.cloudflare.com/'), + title: 'initializing.select_provider_site_button'.tr(), + ), + ], + ), + ), + ), ], ), ); From f48b8bfa443c6293d7a77f5e03104c7d406ccaaf Mon Sep 17 00:00:00 2001 From: def Date: Fri, 19 May 2023 12:53:53 +0300 Subject: [PATCH 55/96] update desec markdown --- assets/markdown/how_desec-en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/markdown/how_desec-en.md b/assets/markdown/how_desec-en.md index c86d3855..b5bac67c 100644 --- a/assets/markdown/how_desec-en.md +++ b/assets/markdown/how_desec-en.md @@ -5,5 +5,5 @@ 4. Click on the round "plus" button in the upper right corner. 5. **"Generate New Token"** dialogue must be displayed. Enter any **Token name** you wish. *Advanced settings* are not required, so do not touch anything there. 6. Click on **Save**. -7. Make sure you **save** the token's **secret value** as it will only be displayed once. +7. Make sure you save the token's "**secret value**" as it will only be displayed once. 8. Now you can safely **close** the dialogue. \ No newline at end of file From 4bb26559aa100467bc19deaad8dde082748d72bb Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 22 May 2023 23:40:25 -0300 Subject: [PATCH 56/96] chore: Move business logic from API for desec dns provider --- .../desec/{desec.dart => desec_api.dart} | 161 ++---------- ...ec_factory.dart => desec_api_factory.dart} | 2 +- lib/logic/providers/dns_providers/desec.dart | 237 +++++++++++++++++- 3 files changed, 255 insertions(+), 145 deletions(-) rename lib/logic/api_maps/rest_maps/dns_providers/desec/{desec.dart => desec_api.dart} (69%) rename lib/logic/api_maps/rest_maps/dns_providers/desec/{desec_factory.dart => desec_api_factory.dart} (96%) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart similarity index 69% rename from lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart rename to lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart index 8298b08d..b2fc0e30 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart @@ -45,7 +45,6 @@ class DesecApi extends DnsProviderApi { @override String rootAddress = 'https://desec.io/api/v1/domains/'; - @override Future> isApiTokenValid(final String token) async { bool isValid = false; Response? response; @@ -93,40 +92,16 @@ class DesecApi extends DnsProviderApi { ); } - @override - Future getZoneId(final String domain) async => domain; - - @override - Future> removeSimilarRecords({ + Future> updateRecords({ required final ServerDomain domain, - final String? ip4, + required final List records, }) async { final String domainName = domain.domainName; final String url = '/$domainName/rrsets/'; - final List listDnsRecords = projectDnsRecords(domainName, ip4); final Dio client = await getClient(); try { - final List bulkRecords = []; - for (final DnsRecord record in listDnsRecords) { - bulkRecords.add( - { - 'subname': record.name, - 'type': record.type, - 'ttl': record.ttl, - 'records': [], - }, - ); - } - bulkRecords.add( - { - 'subname': 'selector._domainkey', - 'type': 'TXT', - 'ttl': 18000, - 'records': [], - }, - ); - await client.put(url, data: bulkRecords); + await client.put(url, data: records); await Future.delayed(const Duration(seconds: 1)); } catch (e) { print(e); @@ -142,13 +117,12 @@ class DesecApi extends DnsProviderApi { return GenericResult(success: true, data: null); } - @override - Future> getDnsRecords({ + Future>> getDnsRecords({ required final ServerDomain domain, }) async { - Response response; + Response? response; final String domainName = domain.domainName; - final List allRecords = []; + List allRecords = []; final String url = '/$domainName/rrsets/'; @@ -156,59 +130,33 @@ class DesecApi extends DnsProviderApi { try { response = await client.get(url); await Future.delayed(const Duration(seconds: 1)); - final List records = response.data; - - for (final record in records) { - final String? content = (record['records'] is List) - ? record['records'][0] - : record['records']; - allRecords.add( - DnsRecord( - name: record['subname'], - type: record['type'], - content: content, - ttl: record['ttl'], - ), - ); - } + allRecords = response.data; } catch (e) { print(e); + return GenericResult( + data: allRecords, + success: false, + message: e.toString(), + code: response?.statusCode, + ); } finally { close(client); } - return allRecords; + return GenericResult(data: allRecords, success: true); } - @override - Future> createMultipleDnsRecords({ + Future> createRecords({ required final ServerDomain domain, - final String? ip4, + required final List records, }) async { final String domainName = domain.domainName; - final List listDnsRecords = projectDnsRecords(domainName, ip4); + final String url = '/$domainName/rrsets/'; final Dio client = await getClient(); try { - final List bulkRecords = []; - for (final DnsRecord record in listDnsRecords) { - bulkRecords.add( - { - 'subname': record.name, - 'type': record.type, - 'ttl': record.ttl, - 'records': [extractContent(record)], - }, - ); - } - await client.post( - '/$domainName/rrsets/', - data: bulkRecords, - ); + await client.post(url, data: records); await Future.delayed(const Duration(seconds: 1)); - } on DioError catch (e) { - print(e.message); - rethrow; } catch (e) { print(e); return GenericResult( @@ -223,53 +171,6 @@ class DesecApi extends DnsProviderApi { return GenericResult(success: true, data: null); } - List projectDnsRecords( - final String? domainName, - final String? ip4, - ) { - final DnsRecord domainA = DnsRecord(type: 'A', name: '', content: ip4); - - final DnsRecord mx = - DnsRecord(type: 'MX', name: '', content: '10 $domainName.'); - final DnsRecord apiA = DnsRecord(type: 'A', name: 'api', content: ip4); - final DnsRecord cloudA = DnsRecord(type: 'A', name: 'cloud', content: ip4); - final DnsRecord gitA = DnsRecord(type: 'A', name: 'git', content: ip4); - final DnsRecord meetA = DnsRecord(type: 'A', name: 'meet', content: ip4); - final DnsRecord passwordA = - DnsRecord(type: 'A', name: 'password', content: ip4); - final DnsRecord socialA = - DnsRecord(type: 'A', name: 'social', content: ip4); - final DnsRecord vpn = DnsRecord(type: 'A', name: 'vpn', content: ip4); - - final DnsRecord txt1 = DnsRecord( - type: 'TXT', - name: '_dmarc', - content: '"v=DMARC1; p=none"', - ttl: 18000, - ); - - final DnsRecord txt2 = DnsRecord( - type: 'TXT', - name: '', - content: '"v=spf1 a mx ip4:$ip4 -all"', - ttl: 18000, - ); - - return [ - domainA, - apiA, - cloudA, - gitA, - meetA, - passwordA, - socialA, - mx, - txt1, - txt2, - vpn - ]; - } - String? extractContent(final DnsRecord record) { String? content = record.content; if (record.type == 'TXT' && content != null && !content.startsWith('"')) { @@ -279,32 +180,6 @@ class DesecApi extends DnsProviderApi { return content; } - @override - Future setDnsRecord( - final DnsRecord record, - final ServerDomain domain, - ) async { - final String url = '/${domain.domainName}/rrsets/'; - - final Dio client = await getClient(); - try { - await client.post( - url, - data: { - 'subname': record.name, - 'type': record.type, - 'ttl': record.ttl, - 'records': [extractContent(record)], - }, - ); - await Future.delayed(const Duration(seconds: 1)); - } catch (e) { - print(e); - } finally { - close(client); - } - } - @override Future> domainList() async { List domains = []; diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_factory.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api_factory.dart similarity index 96% rename from lib/logic/api_maps/rest_maps/dns_providers/desec/desec_factory.dart rename to lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api_factory.dart index 6c10259b..11a9c37b 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_factory.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api_factory.dart @@ -1,4 +1,4 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desec/desec.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart'; diff --git a/lib/logic/providers/dns_providers/desec.dart b/lib/logic/providers/dns_providers/desec.dart index c7a5bab8..922a743c 100644 --- a/lib/logic/providers/dns_providers/desec.dart +++ b/lib/logic/providers/dns_providers/desec.dart @@ -1,3 +1,238 @@ +import 'package:selfprivacy/logic/api_maps/generic_result.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart'; +import 'package:selfprivacy/logic/models/hive/server_domain.dart'; +import 'package:selfprivacy/logic/models/json/dns_records.dart'; import 'package:selfprivacy/logic/providers/dns_providers/dns_provider.dart'; -class DesecDnsProvider extends DnsProvider {} +class ApiAdapter { + ApiAdapter({final bool isWithToken = true}) + : _api = DesecApi( + isWithToken: isWithToken, + ); + + DesecApi api({final bool getInitialized = true}) => getInitialized + ? _api + : DesecApi( + isWithToken: false, + ); + + final DesecApi _api; +} + +class DesecDnsProvider extends DnsProvider { + DesecDnsProvider() : _adapter = ApiAdapter(); + DesecDnsProvider.load( + final bool isAuthotized, + ) : _adapter = ApiAdapter( + isWithToken: isAuthotized, + ); + + ApiAdapter _adapter; + + @override + Future> tryInitApiByToken(final String token) async { + final api = _adapter.api(getInitialized: false); + final result = await api.isApiTokenValid(token); + if (!result.data || !result.success) { + return result; + } + + _adapter = ApiAdapter(isWithToken: true); + return result; + } + + @override + Future> getZoneId(final String domain) async => + GenericResult( + data: domain, + success: true, + ); + + @override + Future> removeDomainRecords({ + required final ServerDomain domain, + final String? ip4, + }) async { + final List listDnsRecords = projectDnsRecords( + domain.domainName, + ip4, + ); + + final List bulkRecords = []; + for (final DnsRecord record in listDnsRecords) { + bulkRecords.add( + { + 'subname': record.name, + 'type': record.type, + 'ttl': record.ttl, + 'records': [], + }, + ); + } + bulkRecords.add( + { + 'subname': 'selector._domainkey', + 'type': 'TXT', + 'ttl': 18000, + 'records': [], + }, + ); + + return _adapter.api().updateRecords( + domain: domain, + records: bulkRecords, + ); + } + + @override + Future>> getDnsRecords({ + required final ServerDomain domain, + }) async { + final List records = []; + final result = await _adapter.api().getDnsRecords(domain: domain); + if (result.data.isEmpty || !result.success) { + return GenericResult( + success: result.success, + data: records, + code: result.code, + message: result.message, + ); + } + + try { + for (final record in result.data) { + final String? content = (record['records'] is List) + ? record['records'][0] + : record['records']; + records.add( + DnsRecord( + name: record['subname'], + type: record['type'], + content: content, + ttl: record['ttl'], + ), + ); + } + } catch (e) { + print(e); + return GenericResult( + success: false, + data: records, + message: e.toString(), + ); + } + + return GenericResult(success: true, data: records); + } + + List projectDnsRecords( + final String? domainName, + final String? ip4, + ) { + final DnsRecord domainA = DnsRecord(type: 'A', name: '', content: ip4); + + final DnsRecord mx = + DnsRecord(type: 'MX', name: '', content: '10 $domainName.'); + final DnsRecord apiA = DnsRecord(type: 'A', name: 'api', content: ip4); + final DnsRecord cloudA = DnsRecord(type: 'A', name: 'cloud', content: ip4); + final DnsRecord gitA = DnsRecord(type: 'A', name: 'git', content: ip4); + final DnsRecord meetA = DnsRecord(type: 'A', name: 'meet', content: ip4); + final DnsRecord passwordA = + DnsRecord(type: 'A', name: 'password', content: ip4); + final DnsRecord socialA = + DnsRecord(type: 'A', name: 'social', content: ip4); + final DnsRecord vpn = DnsRecord(type: 'A', name: 'vpn', content: ip4); + + final DnsRecord txt1 = DnsRecord( + type: 'TXT', + name: '_dmarc', + content: '"v=DMARC1; p=none"', + ttl: 18000, + ); + + final DnsRecord txt2 = DnsRecord( + type: 'TXT', + name: '', + content: '"v=spf1 a mx ip4:$ip4 -all"', + ttl: 18000, + ); + + return [ + domainA, + apiA, + cloudA, + gitA, + meetA, + passwordA, + socialA, + mx, + txt1, + txt2, + vpn + ]; + } + + @override + Future> createDomainRecords({ + required final ServerDomain domain, + final String? ip4, + }) async { + final List listDnsRecords = projectDnsRecords( + domain.domainName, + ip4, + ); + + final List bulkRecords = []; + for (final DnsRecord record in listDnsRecords) { + bulkRecords.add( + { + 'subname': record.name, + 'type': record.type, + 'ttl': record.ttl, + 'records': [extractContent(record)], + }, + ); + } + + return _adapter.api().createRecords( + domain: domain, + records: bulkRecords, + ); + } + + @override + Future> setDnsRecord( + final DnsRecord record, + final ServerDomain domain, + ) async { + final result = await _adapter.api().createRecords( + domain: domain, + records: [ + { + 'subname': record.name, + 'type': record.type, + 'ttl': record.ttl, + 'records': [extractContent(record)], + }, + ], + ); + + if (!result.success) { + return GenericResult( + success: result.success, + data: null, + code: result.code, + message: result.message, + ); + } + } + + String? extractContent(final DnsRecord record) { + String? content = record.content; + if (record.type == 'TXT' && content != null && !content.startsWith('"')) { + content = '"$content"'; + } + + return content; + } +} From eebbf9834989a53bf409556b928f40d4ea0cc01f Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 24 May 2023 23:47:43 -0300 Subject: [PATCH 57/96] chore: Move domain list getter to dns provider layer for desec --- .../dns_providers/desec/desec_api.dart | 24 ++++++++---- lib/logic/providers/dns_providers/desec.dart | 37 +++++++++++++++---- 2 files changed, 46 insertions(+), 15 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart index b2fc0e30..3e0368cd 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart @@ -181,25 +181,35 @@ class DesecApi extends DnsProviderApi { } @override - Future> domainList() async { - List domains = []; + Future> getDomains() async { + List domains = []; + late final Response? response; final Dio client = await getClient(); try { - final Response response = await client.get( + response = await client.get( '', ); await Future.delayed(const Duration(seconds: 1)); - domains = response.data - .map((final el) => el['name'] as String) - .toList(); + domains = response.data; } catch (e) { print(e); + return GenericResult( + success: false, + data: domains, + code: response?.statusCode, + message: response?.statusMessage, + ); } finally { close(client); } - return domains; + return GenericResult( + success: true, + data: domains, + code: response.statusCode, + message: response.statusMessage, + ); } @override diff --git a/lib/logic/providers/dns_providers/desec.dart b/lib/logic/providers/dns_providers/desec.dart index 922a743c..1dc7cfa2 100644 --- a/lib/logic/providers/dns_providers/desec.dart +++ b/lib/logic/providers/dns_providers/desec.dart @@ -217,14 +217,10 @@ class DesecDnsProvider extends DnsProvider { ], ); - if (!result.success) { - return GenericResult( - success: result.success, - data: null, - code: result.code, - message: result.message, - ); - } + return GenericResult( + success: true, + data: null, + ); } String? extractContent(final DnsRecord record) { @@ -235,4 +231,29 @@ class DesecDnsProvider extends DnsProvider { return content; } + + @override + Future>> domainList() async { + List domains = []; + final result = await _adapter.api().getDomains(); + if (result.data.isEmpty || !result.success) { + return GenericResult( + success: result.success, + data: domains, + code: result.code, + message: result.message, + ); + } + + domains = result.data + .map( + (final el) => el['name'] as String, + ) + .toList(); + + return GenericResult( + success: true, + data: domains, + ); + } } From 8863dc8b2c5f4914a831ca2fc5517b5835fda040 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 24 May 2023 23:51:40 -0300 Subject: [PATCH 58/96] chore: Move DNS validation to provider layer for desec --- .../dns_providers/desec/desec_api.dart | 147 ---------------- lib/logic/providers/dns_providers/desec.dart | 157 ++++++++++++++++++ 2 files changed, 157 insertions(+), 147 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart index 3e0368cd..a7d70c71 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart @@ -180,7 +180,6 @@ class DesecApi extends DnsProviderApi { return content; } - @override Future> getDomains() async { List domains = []; @@ -211,150 +210,4 @@ class DesecApi extends DnsProviderApi { message: response.statusMessage, ); } - - @override - Future>> validateDnsRecords( - final ServerDomain domain, - final String ip4, - final String dkimPublicKey, - ) async { - final List records = await getDnsRecords(domain: domain); - final List foundRecords = []; - try { - final List desiredRecords = - getDesiredDnsRecords(domain.domainName, ip4, dkimPublicKey); - for (final DesiredDnsRecord record in desiredRecords) { - if (record.description == 'record.dkim') { - final DnsRecord foundRecord = records.firstWhere( - (final r) => - ('${r.name}.${domain.domainName}' == record.name) && - r.type == record.type, - orElse: () => DnsRecord( - name: record.name, - type: record.type, - content: '', - ttl: 800, - proxied: false, - ), - ); - // remove all spaces and tabulators from - // the foundRecord.content and the record.content - // to compare them - final String? foundContent = - foundRecord.content?.replaceAll(RegExp(r'\s+'), ''); - final String content = record.content.replaceAll(RegExp(r'\s+'), ''); - if (foundContent == content) { - foundRecords.add(record.copyWith(isSatisfied: true)); - } else { - foundRecords.add(record.copyWith(isSatisfied: false)); - } - } else { - if (records.any( - (final r) => - ('${r.name}.${domain.domainName}' == record.name || - record.name == '') && - r.type == record.type && - r.content == record.content, - )) { - foundRecords.add(record.copyWith(isSatisfied: true)); - } else { - foundRecords.add(record.copyWith(isSatisfied: false)); - } - } - } - } catch (e) { - print(e); - return GenericResult( - data: [], - success: false, - message: e.toString(), - ); - } - return GenericResult( - data: foundRecords, - success: true, - ); - } - - @override - List getDesiredDnsRecords( - final String? domainName, - final String? ip4, - final String? dkimPublicKey, - ) { - if (domainName == null || ip4 == null) { - return []; - } - return [ - DesiredDnsRecord( - name: '', - content: ip4, - description: 'record.root', - ), - DesiredDnsRecord( - name: 'api.$domainName', - content: ip4, - description: 'record.api', - ), - DesiredDnsRecord( - name: 'cloud.$domainName', - content: ip4, - description: 'record.cloud', - ), - DesiredDnsRecord( - name: 'git.$domainName', - content: ip4, - description: 'record.git', - ), - DesiredDnsRecord( - name: 'meet.$domainName', - content: ip4, - description: 'record.meet', - ), - DesiredDnsRecord( - name: 'social.$domainName', - content: ip4, - description: 'record.social', - ), - DesiredDnsRecord( - name: 'password.$domainName', - content: ip4, - description: 'record.password', - ), - DesiredDnsRecord( - name: 'vpn.$domainName', - content: ip4, - description: 'record.vpn', - ), - DesiredDnsRecord( - name: '', - content: '10 $domainName.', - description: 'record.mx', - type: 'MX', - category: DnsRecordsCategory.email, - ), - DesiredDnsRecord( - name: '_dmarc.$domainName', - content: '"v=DMARC1; p=none"', - description: 'record.dmarc', - type: 'TXT', - category: DnsRecordsCategory.email, - ), - DesiredDnsRecord( - name: '', - content: '"v=spf1 a mx ip4:$ip4 -all"', - description: 'record.spf', - type: 'TXT', - category: DnsRecordsCategory.email, - ), - if (dkimPublicKey != null) - DesiredDnsRecord( - name: 'selector._domainkey.$domainName', - content: '"$dkimPublicKey"', - description: 'record.dkim', - type: 'TXT', - category: DnsRecordsCategory.email, - ), - ]; - } } diff --git a/lib/logic/providers/dns_providers/desec.dart b/lib/logic/providers/dns_providers/desec.dart index 1dc7cfa2..81110b01 100644 --- a/lib/logic/providers/dns_providers/desec.dart +++ b/lib/logic/providers/dns_providers/desec.dart @@ -1,5 +1,6 @@ import 'package:selfprivacy/logic/api_maps/generic_result.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desired_dns_record.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; import 'package:selfprivacy/logic/providers/dns_providers/dns_provider.dart'; @@ -256,4 +257,160 @@ class DesecDnsProvider extends DnsProvider { data: domains, ); } + + @override + Future>> validateDnsRecords( + final ServerDomain domain, + final String ip4, + final String dkimPublicKey, + ) async { + final result = await getDnsRecords(domain: domain); + if (result.data.isEmpty || !result.success) { + return GenericResult( + success: result.success, + data: [], + code: result.code, + message: result.message, + ); + } + + final records = result.data; + final List foundRecords = []; + try { + final List desiredRecords = + getDesiredDnsRecords(domain.domainName, ip4, dkimPublicKey); + for (final DesiredDnsRecord record in desiredRecords) { + if (record.description == 'record.dkim') { + final DnsRecord foundRecord = records.firstWhere( + (final r) => + ('${r.name}.${domain.domainName}' == record.name) && + r.type == record.type, + orElse: () => DnsRecord( + name: record.name, + type: record.type, + content: '', + ttl: 800, + proxied: false, + ), + ); + // remove all spaces and tabulators from + // the foundRecord.content and the record.content + // to compare them + final String? foundContent = + foundRecord.content?.replaceAll(RegExp(r'\s+'), ''); + final String content = record.content.replaceAll(RegExp(r'\s+'), ''); + if (foundContent == content) { + foundRecords.add(record.copyWith(isSatisfied: true)); + } else { + foundRecords.add(record.copyWith(isSatisfied: false)); + } + } else { + if (records.any( + (final r) => + ('${r.name}.${domain.domainName}' == record.name || + record.name == '') && + r.type == record.type && + r.content == record.content, + )) { + foundRecords.add(record.copyWith(isSatisfied: true)); + } else { + foundRecords.add(record.copyWith(isSatisfied: false)); + } + } + } + } catch (e) { + print(e); + return GenericResult( + data: [], + success: false, + message: e.toString(), + ); + } + return GenericResult( + data: foundRecords, + success: true, + ); + } + + @override + List getDesiredDnsRecords( + final String? domainName, + final String? ip4, + final String? dkimPublicKey, + ) { + if (domainName == null || ip4 == null) { + return []; + } + return [ + DesiredDnsRecord( + name: '', + content: ip4, + description: 'record.root', + ), + DesiredDnsRecord( + name: 'api.$domainName', + content: ip4, + description: 'record.api', + ), + DesiredDnsRecord( + name: 'cloud.$domainName', + content: ip4, + description: 'record.cloud', + ), + DesiredDnsRecord( + name: 'git.$domainName', + content: ip4, + description: 'record.git', + ), + DesiredDnsRecord( + name: 'meet.$domainName', + content: ip4, + description: 'record.meet', + ), + DesiredDnsRecord( + name: 'social.$domainName', + content: ip4, + description: 'record.social', + ), + DesiredDnsRecord( + name: 'password.$domainName', + content: ip4, + description: 'record.password', + ), + DesiredDnsRecord( + name: 'vpn.$domainName', + content: ip4, + description: 'record.vpn', + ), + DesiredDnsRecord( + name: '', + content: '10 $domainName.', + description: 'record.mx', + type: 'MX', + category: DnsRecordsCategory.email, + ), + DesiredDnsRecord( + name: '_dmarc.$domainName', + content: '"v=DMARC1; p=none"', + description: 'record.dmarc', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + DesiredDnsRecord( + name: '', + content: '"v=spf1 a mx ip4:$ip4 -all"', + description: 'record.spf', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + if (dkimPublicKey != null) + DesiredDnsRecord( + name: 'selector._domainkey.$domainName', + content: '"$dkimPublicKey"', + description: 'record.dkim', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + ]; + } } From 509b2ac7c7185fabaa275e04ec2216945bc3be7f Mon Sep 17 00:00:00 2001 From: NaiJi Date: Thu, 25 May 2023 00:02:10 -0300 Subject: [PATCH 59/96] chore: Move DNS provider methods to the abstract interface --- .../dns_providers/desec/desec_api.dart | 4 - .../rest_maps/dns_providers/dns_provider.dart | 87 +------------------ lib/logic/providers/dns_providers/desec.dart | 3 +- .../providers/dns_providers/dns_provider.dart | 37 +++++++- 4 files changed, 38 insertions(+), 93 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart index a7d70c71..db24707a 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart @@ -19,10 +19,6 @@ class DesecApi extends DnsProviderApi { final String? customToken; - @override - RegExp getApiTokenValidation() => - RegExp(r'\s+|[!$%^&*()@+|~=`{}\[\]:<>?,.\/]'); - @override BaseOptions get options { final BaseOptions options = BaseOptions(baseUrl: rootAddress); diff --git a/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart b/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart index af9d3e6b..3d74d5db 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart @@ -1,10 +1,4 @@ -import 'package:selfprivacy/logic/api_maps/generic_result.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desired_dns_record.dart'; -import 'package:selfprivacy/logic/models/hive/server_domain.dart'; -import 'package:selfprivacy/logic/models/json/dns_records.dart'; -import 'package:selfprivacy/utils/network_utils.dart'; - export 'package:selfprivacy/logic/api_maps/generic_result.dart'; export 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desired_dns_record.dart'; @@ -13,83 +7,4 @@ class DomainNotFoundException implements Exception { final String message; } -abstract class DnsProviderApi extends ApiMap { - Future> getDnsRecords({ - required final ServerDomain domain, - }); - - Future> removeSimilarRecords({ - required final ServerDomain domain, - final String? ip4, - }); - Future> createMultipleDnsRecords({ - required final ServerDomain domain, - final String? ip4, - }); - Future setDnsRecord( - final DnsRecord record, - final ServerDomain domain, - ); - Future>> validateDnsRecords( - final ServerDomain domain, - final String ip4, - final String dkimPublicKey, - ); - List getDesiredDnsRecords( - final String? domainName, - final String? ip4, - final String? dkimPublicKey, - ); - Future getZoneId(final String domain); - Future> domainList(); - - Future> isApiTokenValid(final String token); - RegExp getApiTokenValidation(); - - List getProjectDnsRecords( - final String? domainName, - final String? ip4, - ) { - final DnsRecord domainA = - DnsRecord(type: 'A', name: domainName, content: ip4); - - final DnsRecord mx = DnsRecord(type: 'MX', name: '@', content: domainName); - final DnsRecord apiA = DnsRecord(type: 'A', name: 'api', content: ip4); - final DnsRecord cloudA = DnsRecord(type: 'A', name: 'cloud', content: ip4); - final DnsRecord gitA = DnsRecord(type: 'A', name: 'git', content: ip4); - final DnsRecord meetA = DnsRecord(type: 'A', name: 'meet', content: ip4); - final DnsRecord passwordA = - DnsRecord(type: 'A', name: 'password', content: ip4); - final DnsRecord socialA = - DnsRecord(type: 'A', name: 'social', content: ip4); - final DnsRecord vpn = DnsRecord(type: 'A', name: 'vpn', content: ip4); - - final DnsRecord txt1 = DnsRecord( - type: 'TXT', - name: '_dmarc', - content: 'v=DMARC1; p=none', - ttl: 18000, - ); - - final DnsRecord txt2 = DnsRecord( - type: 'TXT', - name: domainName, - content: 'v=spf1 a mx ip4:$ip4 -all', - ttl: 18000, - ); - - return [ - domainA, - apiA, - cloudA, - gitA, - meetA, - passwordA, - socialA, - mx, - txt1, - txt2, - vpn - ]; - } -} +abstract class DnsProviderApi extends ApiMap {} diff --git a/lib/logic/providers/dns_providers/desec.dart b/lib/logic/providers/dns_providers/desec.dart index 81110b01..fe09fd3c 100644 --- a/lib/logic/providers/dns_providers/desec.dart +++ b/lib/logic/providers/dns_providers/desec.dart @@ -1,4 +1,3 @@ -import 'package:selfprivacy/logic/api_maps/generic_result.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desired_dns_record.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; @@ -219,7 +218,7 @@ class DesecDnsProvider extends DnsProvider { ); return GenericResult( - success: true, + success: result.success, data: null, ); } diff --git a/lib/logic/providers/dns_providers/dns_provider.dart b/lib/logic/providers/dns_providers/dns_provider.dart index 9aa1f99d..14e31c32 100644 --- a/lib/logic/providers/dns_providers/dns_provider.dart +++ b/lib/logic/providers/dns_providers/dns_provider.dart @@ -1 +1,36 @@ -abstract class DnsProvider {} +import 'package:selfprivacy/logic/api_maps/generic_result.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desired_dns_record.dart'; +import 'package:selfprivacy/logic/models/hive/server_domain.dart'; +import 'package:selfprivacy/logic/models/json/dns_records.dart'; +export 'package:selfprivacy/logic/api_maps/generic_result.dart'; + +abstract class DnsProvider { + Future> tryInitApiByToken(final String token); + Future> getZoneId(final String domain); + Future> removeDomainRecords({ + required final ServerDomain domain, + final String? ip4, + }); + Future>> getDnsRecords({ + required final ServerDomain domain, + }); + Future> createDomainRecords({ + required final ServerDomain domain, + final String? ip4, + }); + Future> setDnsRecord( + final DnsRecord record, + final ServerDomain domain, + ); + Future>> domainList(); + Future>> validateDnsRecords( + final ServerDomain domain, + final String ip4, + final String dkimPublicKey, + ); + List getDesiredDnsRecords( + final String? domainName, + final String? ip4, + final String? dkimPublicKey, + ); +} From 78320946092d506dda031607a2b8469d3ab25273 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Thu, 25 May 2023 00:15:58 -0300 Subject: [PATCH 60/96] chore: Create cloudflare dns provider interface and separate it from api --- .../{cloudflare.dart => cloudflare_api.dart} | 77 +++++++++++++---- ...ctory.dart => cloudflare_api_factory.dart} | 2 +- .../providers/dns_providers/cloudflare.dart | 85 ++++++++++++++++++- 3 files changed, 144 insertions(+), 20 deletions(-) rename lib/logic/api_maps/rest_maps/dns_providers/cloudflare/{cloudflare.dart => cloudflare_api.dart} (85%) rename lib/logic/api_maps/rest_maps/dns_providers/cloudflare/{cloudflare_factory.dart => cloudflare_api_factory.dart} (95%) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart similarity index 85% rename from lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart rename to lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart index 5df05a48..f063faba 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart @@ -19,10 +19,6 @@ class CloudflareApi extends DnsProviderApi { final String? customToken; - @override - RegExp getApiTokenValidation() => - RegExp(r'\s+|[!$%^&*()@+|~=`{}\[\]:<>?,.\/]'); - @override BaseOptions get options { final BaseOptions options = BaseOptions(baseUrl: rootAddress); @@ -45,7 +41,6 @@ class CloudflareApi extends DnsProviderApi { @override String rootAddress = 'https://api.cloudflare.com/client/v4'; - @override Future> isApiTokenValid(final String token) async { bool isValid = false; Response? response; @@ -92,27 +87,32 @@ class CloudflareApi extends DnsProviderApi { ); } - @override - Future getZoneId(final String domain) async { - String? zoneId; + Future>> getZones(final String domain) async { + List zones = []; + late final Response? response; final Dio client = await getClient(); try { - final Response response = await client.get( + response = await client.get( '/zones', queryParameters: {'name': domain}, ); - zoneId = response.data['result'][0]['id']; + zones = response.data['result']; } catch (e) { print(e); + GenericResult( + success: false, + data: zones, + code: response?.statusCode, + message: response?.statusMessage, + ); } finally { close(client); } - return zoneId; + return GenericResult(success: true, data: zones); } - @override Future> removeSimilarRecords({ required final ServerDomain domain, final String? ip4, @@ -151,7 +151,6 @@ class CloudflareApi extends DnsProviderApi { return GenericResult(success: true, data: null); } - @override Future> getDnsRecords({ required final ServerDomain domain, }) async { @@ -189,7 +188,6 @@ class CloudflareApi extends DnsProviderApi { return allRecords; } - @override Future> createMultipleDnsRecords({ required final ServerDomain domain, final String? ip4, @@ -228,7 +226,6 @@ class CloudflareApi extends DnsProviderApi { return GenericResult(success: true, data: null); } - @override Future setDnsRecord( final DnsRecord record, final ServerDomain domain, @@ -249,7 +246,6 @@ class CloudflareApi extends DnsProviderApi { } } - @override Future> domainList() async { final String url = '$rootAddress/zones'; List domains = []; @@ -272,7 +268,6 @@ class CloudflareApi extends DnsProviderApi { return domains; } - @override Future>> validateDnsRecords( final ServerDomain domain, final String ip4, @@ -333,7 +328,6 @@ class CloudflareApi extends DnsProviderApi { ); } - @override List getDesiredDnsRecords( final String? domainName, final String? ip4, @@ -414,4 +408,51 @@ class CloudflareApi extends DnsProviderApi { ), ]; } + + List getProjectDnsRecords( + final String? domainName, + final String? ip4, + ) { + final DnsRecord domainA = + DnsRecord(type: 'A', name: domainName, content: ip4); + + final DnsRecord mx = DnsRecord(type: 'MX', name: '@', content: domainName); + final DnsRecord apiA = DnsRecord(type: 'A', name: 'api', content: ip4); + final DnsRecord cloudA = DnsRecord(type: 'A', name: 'cloud', content: ip4); + final DnsRecord gitA = DnsRecord(type: 'A', name: 'git', content: ip4); + final DnsRecord meetA = DnsRecord(type: 'A', name: 'meet', content: ip4); + final DnsRecord passwordA = + DnsRecord(type: 'A', name: 'password', content: ip4); + final DnsRecord socialA = + DnsRecord(type: 'A', name: 'social', content: ip4); + final DnsRecord vpn = DnsRecord(type: 'A', name: 'vpn', content: ip4); + + final DnsRecord txt1 = DnsRecord( + type: 'TXT', + name: '_dmarc', + content: 'v=DMARC1; p=none', + ttl: 18000, + ); + + final DnsRecord txt2 = DnsRecord( + type: 'TXT', + name: domainName, + content: 'v=spf1 a mx ip4:$ip4 -all', + ttl: 18000, + ); + + return [ + domainA, + apiA, + cloudA, + gitA, + meetA, + passwordA, + socialA, + mx, + txt1, + txt2, + vpn + ]; + } } diff --git a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_factory.dart b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api_factory.dart similarity index 95% rename from lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_factory.dart rename to lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api_factory.dart index ccb58e6a..ba5bd703 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_factory.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api_factory.dart @@ -1,4 +1,4 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart'; diff --git a/lib/logic/providers/dns_providers/cloudflare.dart b/lib/logic/providers/dns_providers/cloudflare.dart index 6f973a88..192fdd96 100644 --- a/lib/logic/providers/dns_providers/cloudflare.dart +++ b/lib/logic/providers/dns_providers/cloudflare.dart @@ -1,3 +1,86 @@ +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart'; import 'package:selfprivacy/logic/providers/dns_providers/dns_provider.dart'; -class CloudflareDnsProvider extends DnsProvider {} +class ApiAdapter { + ApiAdapter({final bool isWithToken = true}) + : _api = CloudflareApi( + isWithToken: isWithToken, + ); + + CloudflareApi api({final bool getInitialized = true}) => getInitialized + ? _api + : CloudflareApi( + isWithToken: false, + ); + + final CloudflareApi _api; +} + +class CloudflareDnsProvider extends DnsProvider { + CloudflareDnsProvider() : _adapter = ApiAdapter(); + CloudflareDnsProvider.load( + final bool isAuthotized, + ) : _adapter = ApiAdapter( + isWithToken: isAuthotized, + ); + + ApiAdapter _adapter; + + @override + Future> tryInitApiByToken(final String token) async { + final api = _adapter.api(getInitialized: false); + final result = await api.isApiTokenValid(token); + if (!result.data || !result.success) { + return result; + } + + _adapter = ApiAdapter(isWithToken: true); + return result; + } + + @override + Future> getZoneId(final String domain) async { + String? id; + final result = await _adapter.api().getZones(domain); + if (result.data.isEmpty || !result.success) { + return GenericResult( + success: result.success, + data: id, + code: result.code, + message: result.message, + ); + } + + id = result.data[0]['id']; + + return GenericResult(success: true, data: id); + } + + @override + Future> removeDomainRecords({ + required final ServerDomain domain, + final String? ip4, + }) async {} + Future>> getDnsRecords({ + required final ServerDomain domain, + }); + Future> createDomainRecords({ + required final ServerDomain domain, + final String? ip4, + }); + Future> setDnsRecord( + final DnsRecord record, + final ServerDomain domain, + ); + Future>> domainList(); + Future>> validateDnsRecords( + final ServerDomain domain, + final String ip4, + final String dkimPublicKey, + ); + List getDesiredDnsRecords( + final String? domainName, + final String? ip4, + final String? dkimPublicKey, + ); +} From 8123632cc102f7ee5c29d67f16dfc6e034c4f1ee Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 29 May 2023 23:18:02 -0300 Subject: [PATCH 61/96] feat: Implement Cloudflare DNS provider layer and separate from API --- .../cloudflare/cloudflare_api.dart | 249 ++-------------- .../providers/dns_providers/cloudflare.dart | 281 +++++++++++++++++- 2 files changed, 303 insertions(+), 227 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart index f063faba..ad3fd460 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart @@ -115,26 +115,19 @@ class CloudflareApi extends DnsProviderApi { Future> removeSimilarRecords({ required final ServerDomain domain, - final String? ip4, + required final List records, }) async { - final String domainName = domain.domainName; final String domainZoneId = domain.zoneId; - final String url = '/zones/$domainZoneId/dns_records'; final Dio client = await getClient(); try { - final Response response = await client.get(url); - - final List records = response.data['result'] ?? []; final List allDeleteFutures = []; for (final record in records) { - if (record['zone_name'] == domainName) { - allDeleteFutures.add( - client.delete('$url/${record["id"]}'), - ); - } + allDeleteFutures.add( + client.delete('$url/${record["id"]}'), + ); } await Future.wait(allDeleteFutures); } catch (e) { @@ -151,13 +144,13 @@ class CloudflareApi extends DnsProviderApi { return GenericResult(success: true, data: null); } - Future> getDnsRecords({ + Future> getDnsRecords({ required final ServerDomain domain, }) async { Response response; final String domainName = domain.domainName; final String domainZoneId = domain.zoneId; - final List allRecords = []; + final List allRecords = []; final String url = '/zones/$domainZoneId/dns_records'; @@ -168,39 +161,33 @@ class CloudflareApi extends DnsProviderApi { for (final record in records) { if (record['zone_name'] == domainName) { - allRecords.add( - DnsRecord( - name: record['name'], - type: record['type'], - content: record['content'], - ttl: record['ttl'], - proxied: record['proxied'], - ), - ); + allRecords.add(record); } } } catch (e) { print(e); + return GenericResult( + data: [], + success: false, + message: e.toString(), + ); } finally { close(client); } - return allRecords; + return GenericResult(data: allRecords, success: true); } Future> createMultipleDnsRecords({ required final ServerDomain domain, - final String? ip4, + required final List records, }) async { - final String domainName = domain.domainName; final String domainZoneId = domain.zoneId; - final List listDnsRecords = - getProjectDnsRecords(domainName, ip4); final List allCreateFutures = []; final Dio client = await getClient(); try { - for (final DnsRecord record in listDnsRecords) { + for (final DnsRecord record in records) { allCreateFutures.add( client.post( '/zones/$domainZoneId/dns_records', @@ -246,213 +233,35 @@ class CloudflareApi extends DnsProviderApi { } } - Future> domainList() async { + Future> getDomains() async { final String url = '$rootAddress/zones'; - List domains = []; + List domains = []; + late final Response? response; final Dio client = await getClient(); try { - final Response response = await client.get( + response = await client.get( url, queryParameters: {'per_page': 50}, ); - domains = response.data['result'] - .map((final el) => el['name'] as String) - .toList(); + domains = response.data['result']; } catch (e) { print(e); + return GenericResult( + success: false, + data: domains, + code: response?.statusCode, + message: response?.statusMessage, + ); } finally { close(client); } - return domains; - } - - Future>> validateDnsRecords( - final ServerDomain domain, - final String ip4, - final String dkimPublicKey, - ) async { - final List records = await getDnsRecords(domain: domain); - final List foundRecords = []; - try { - final List desiredRecords = - getDesiredDnsRecords(domain.domainName, ip4, dkimPublicKey); - for (final DesiredDnsRecord record in desiredRecords) { - if (record.description == 'record.dkim') { - final DnsRecord foundRecord = records.firstWhere( - (final r) => (r.name == record.name) && r.type == record.type, - orElse: () => DnsRecord( - name: record.name, - type: record.type, - content: '', - ttl: 800, - proxied: false, - ), - ); - // remove all spaces and tabulators from - // the foundRecord.content and the record.content - // to compare them - final String? foundContent = - foundRecord.content?.replaceAll(RegExp(r'\s+'), ''); - final String content = record.content.replaceAll(RegExp(r'\s+'), ''); - if (foundContent == content) { - foundRecords.add(record.copyWith(isSatisfied: true)); - } else { - foundRecords.add(record.copyWith(isSatisfied: false)); - } - } else { - if (records.any( - (final r) => - (r.name == record.name) && - r.type == record.type && - r.content == record.content, - )) { - foundRecords.add(record.copyWith(isSatisfied: true)); - } else { - foundRecords.add(record.copyWith(isSatisfied: false)); - } - } - } - } catch (e) { - print(e); - return GenericResult( - data: [], - success: false, - message: e.toString(), - ); - } return GenericResult( - data: foundRecords, success: true, + data: domains, + code: response.statusCode, + message: response.statusMessage, ); } - - List getDesiredDnsRecords( - final String? domainName, - final String? ip4, - final String? dkimPublicKey, - ) { - if (domainName == null || ip4 == null) { - return []; - } - return [ - DesiredDnsRecord( - name: domainName, - content: ip4, - description: 'record.root', - ), - DesiredDnsRecord( - name: 'api.$domainName', - content: ip4, - description: 'record.api', - ), - DesiredDnsRecord( - name: 'cloud.$domainName', - content: ip4, - description: 'record.cloud', - ), - DesiredDnsRecord( - name: 'git.$domainName', - content: ip4, - description: 'record.git', - ), - DesiredDnsRecord( - name: 'meet.$domainName', - content: ip4, - description: 'record.meet', - ), - DesiredDnsRecord( - name: 'social.$domainName', - content: ip4, - description: 'record.social', - ), - DesiredDnsRecord( - name: 'password.$domainName', - content: ip4, - description: 'record.password', - ), - DesiredDnsRecord( - name: 'vpn.$domainName', - content: ip4, - description: 'record.vpn', - ), - DesiredDnsRecord( - name: domainName, - content: domainName, - description: 'record.mx', - type: 'MX', - category: DnsRecordsCategory.email, - ), - DesiredDnsRecord( - name: '_dmarc.$domainName', - content: 'v=DMARC1; p=none', - description: 'record.dmarc', - type: 'TXT', - category: DnsRecordsCategory.email, - ), - DesiredDnsRecord( - name: domainName, - content: 'v=spf1 a mx ip4:$ip4 -all', - description: 'record.spf', - type: 'TXT', - category: DnsRecordsCategory.email, - ), - if (dkimPublicKey != null) - DesiredDnsRecord( - name: 'selector._domainkey.$domainName', - content: dkimPublicKey, - description: 'record.dkim', - type: 'TXT', - category: DnsRecordsCategory.email, - ), - ]; - } - - List getProjectDnsRecords( - final String? domainName, - final String? ip4, - ) { - final DnsRecord domainA = - DnsRecord(type: 'A', name: domainName, content: ip4); - - final DnsRecord mx = DnsRecord(type: 'MX', name: '@', content: domainName); - final DnsRecord apiA = DnsRecord(type: 'A', name: 'api', content: ip4); - final DnsRecord cloudA = DnsRecord(type: 'A', name: 'cloud', content: ip4); - final DnsRecord gitA = DnsRecord(type: 'A', name: 'git', content: ip4); - final DnsRecord meetA = DnsRecord(type: 'A', name: 'meet', content: ip4); - final DnsRecord passwordA = - DnsRecord(type: 'A', name: 'password', content: ip4); - final DnsRecord socialA = - DnsRecord(type: 'A', name: 'social', content: ip4); - final DnsRecord vpn = DnsRecord(type: 'A', name: 'vpn', content: ip4); - - final DnsRecord txt1 = DnsRecord( - type: 'TXT', - name: '_dmarc', - content: 'v=DMARC1; p=none', - ttl: 18000, - ); - - final DnsRecord txt2 = DnsRecord( - type: 'TXT', - name: domainName, - content: 'v=spf1 a mx ip4:$ip4 -all', - ttl: 18000, - ); - - return [ - domainA, - apiA, - cloudA, - gitA, - meetA, - passwordA, - socialA, - mx, - txt1, - txt2, - vpn - ]; - } } diff --git a/lib/logic/providers/dns_providers/cloudflare.dart b/lib/logic/providers/dns_providers/cloudflare.dart index 192fdd96..bd01b240 100644 --- a/lib/logic/providers/dns_providers/cloudflare.dart +++ b/lib/logic/providers/dns_providers/cloudflare.dart @@ -1,4 +1,7 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; +import 'package:selfprivacy/logic/models/hive/server_domain.dart'; +import 'package:selfprivacy/logic/models/json/dns_records.dart'; import 'package:selfprivacy/logic/providers/dns_providers/dns_provider.dart'; class ApiAdapter { @@ -60,27 +63,291 @@ class CloudflareDnsProvider extends DnsProvider { Future> removeDomainRecords({ required final ServerDomain domain, final String? ip4, - }) async {} + }) async { + final result = await _adapter.api().getDnsRecords(domain: domain); + if (result.data.isEmpty || !result.success) { + return GenericResult( + success: result.success, + data: null, + code: result.code, + message: result.message, + ); + } + + return _adapter.api().removeSimilarRecords( + domain: domain, + records: result.data, + ); + } + + @override Future>> getDnsRecords({ required final ServerDomain domain, - }); + }) async { + final List records = []; + final result = await _adapter.api().getDnsRecords(domain: domain); + if (result.data.isEmpty || !result.success) { + return GenericResult( + success: result.success, + data: records, + code: result.code, + message: result.message, + ); + } + + for (final rawRecord in result.data) { + records.add( + DnsRecord( + name: rawRecord['name'], + type: rawRecord['type'], + content: rawRecord['content'], + ttl: rawRecord['ttl'], + proxied: rawRecord['proxied'], + ), + ); + } + + return GenericResult( + success: result.success, + data: records, + ); + } + + @override Future> createDomainRecords({ required final ServerDomain domain, final String? ip4, - }); + }) { + final records = getProjectDnsRecords(domain.domainName, ip4); + return _adapter.api().createMultipleDnsRecords( + domain: domain, + records: records, + ); + } + + @override Future> setDnsRecord( final DnsRecord record, final ServerDomain domain, - ); - Future>> domainList(); + ) async => + _adapter.api().createMultipleDnsRecords( + domain: domain, + records: [record], + ); + + @override + Future>> domainList() async { + List domains = []; + final result = await _adapter.api().getDomains(); + if (result.data.isEmpty || !result.success) { + return GenericResult( + success: result.success, + data: domains, + code: result.code, + message: result.message, + ); + } + + domains = result.data + .map( + (final el) => el['name'] as String, + ) + .toList(); + + return GenericResult( + success: true, + data: domains, + ); + } + + @override Future>> validateDnsRecords( final ServerDomain domain, final String ip4, final String dkimPublicKey, - ); + ) async { + final GenericResult> records = + await getDnsRecords(domain: domain); + final List foundRecords = []; + try { + final List desiredRecords = + getDesiredDnsRecords(domain.domainName, ip4, dkimPublicKey); + for (final DesiredDnsRecord record in desiredRecords) { + if (record.description == 'record.dkim') { + final DnsRecord foundRecord = records.data.firstWhere( + (final r) => (r.name == record.name) && r.type == record.type, + orElse: () => DnsRecord( + name: record.name, + type: record.type, + content: '', + ttl: 800, + proxied: false, + ), + ); + // remove all spaces and tabulators from + // the foundRecord.content and the record.content + // to compare them + final String? foundContent = + foundRecord.content?.replaceAll(RegExp(r'\s+'), ''); + final String content = record.content.replaceAll(RegExp(r'\s+'), ''); + if (foundContent == content) { + foundRecords.add(record.copyWith(isSatisfied: true)); + } else { + foundRecords.add(record.copyWith(isSatisfied: false)); + } + } else { + if (records.data.any( + (final r) => + (r.name == record.name) && + r.type == record.type && + r.content == record.content, + )) { + foundRecords.add(record.copyWith(isSatisfied: true)); + } else { + foundRecords.add(record.copyWith(isSatisfied: false)); + } + } + } + } catch (e) { + print(e); + return GenericResult( + data: [], + success: false, + message: e.toString(), + ); + } + return GenericResult( + data: foundRecords, + success: true, + ); + } + + @override List getDesiredDnsRecords( final String? domainName, final String? ip4, final String? dkimPublicKey, - ); + ) { + if (domainName == null || ip4 == null) { + return []; + } + return [ + DesiredDnsRecord( + name: domainName, + content: ip4, + description: 'record.root', + ), + DesiredDnsRecord( + name: 'api.$domainName', + content: ip4, + description: 'record.api', + ), + DesiredDnsRecord( + name: 'cloud.$domainName', + content: ip4, + description: 'record.cloud', + ), + DesiredDnsRecord( + name: 'git.$domainName', + content: ip4, + description: 'record.git', + ), + DesiredDnsRecord( + name: 'meet.$domainName', + content: ip4, + description: 'record.meet', + ), + DesiredDnsRecord( + name: 'social.$domainName', + content: ip4, + description: 'record.social', + ), + DesiredDnsRecord( + name: 'password.$domainName', + content: ip4, + description: 'record.password', + ), + DesiredDnsRecord( + name: 'vpn.$domainName', + content: ip4, + description: 'record.vpn', + ), + DesiredDnsRecord( + name: domainName, + content: domainName, + description: 'record.mx', + type: 'MX', + category: DnsRecordsCategory.email, + ), + DesiredDnsRecord( + name: '_dmarc.$domainName', + content: 'v=DMARC1; p=none', + description: 'record.dmarc', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + DesiredDnsRecord( + name: domainName, + content: 'v=spf1 a mx ip4:$ip4 -all', + description: 'record.spf', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + if (dkimPublicKey != null) + DesiredDnsRecord( + name: 'selector._domainkey.$domainName', + content: dkimPublicKey, + description: 'record.dkim', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + ]; + } + + List getProjectDnsRecords( + final String? domainName, + final String? ip4, + ) { + final DnsRecord domainA = + DnsRecord(type: 'A', name: domainName, content: ip4); + + final DnsRecord mx = DnsRecord(type: 'MX', name: '@', content: domainName); + final DnsRecord apiA = DnsRecord(type: 'A', name: 'api', content: ip4); + final DnsRecord cloudA = DnsRecord(type: 'A', name: 'cloud', content: ip4); + final DnsRecord gitA = DnsRecord(type: 'A', name: 'git', content: ip4); + final DnsRecord meetA = DnsRecord(type: 'A', name: 'meet', content: ip4); + final DnsRecord passwordA = + DnsRecord(type: 'A', name: 'password', content: ip4); + final DnsRecord socialA = + DnsRecord(type: 'A', name: 'social', content: ip4); + final DnsRecord vpn = DnsRecord(type: 'A', name: 'vpn', content: ip4); + + final DnsRecord txt1 = DnsRecord( + type: 'TXT', + name: '_dmarc', + content: 'v=DMARC1; p=none', + ttl: 18000, + ); + + final DnsRecord txt2 = DnsRecord( + type: 'TXT', + name: domainName, + content: 'v=spf1 a mx ip4:$ip4 -all', + ttl: 18000, + ); + + return [ + domainA, + apiA, + cloudA, + gitA, + meetA, + passwordA, + socialA, + mx, + txt1, + txt2, + vpn + ]; + } } From b0769b8ed0ff8b4d67952ccb978b767db429053a Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 30 May 2023 00:04:29 -0300 Subject: [PATCH 62/96] chore: Separate business logic from API layer for Digital Ocean DNS --- ...an_dns.dart => digital_ocean_dns_api.dart} | 191 ++-------- ...art => digital_ocean_dns_api_factory.dart} | 2 +- .../dns_providers/digital_ocean.dart | 3 - .../dns_providers/digital_ocean_dns.dart | 356 ++++++++++++++++++ .../dns_providers/dns_provider_factory.dart | 2 +- 5 files changed, 384 insertions(+), 170 deletions(-) rename lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/{digital_ocean_dns.dart => digital_ocean_dns_api.dart} (51%) rename lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/{digital_ocean_dns_factory.dart => digital_ocean_dns_api_factory.dart} (93%) delete mode 100644 lib/logic/providers/dns_providers/digital_ocean.dart create mode 100644 lib/logic/providers/dns_providers/digital_ocean_dns.dart diff --git a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart similarity index 51% rename from lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart rename to lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart index 9a33bdfb..b0e94f41 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart @@ -92,28 +92,19 @@ class DigitalOceanDnsApi extends DnsProviderApi { ); } - @override - // TODO: Remove from DnsProviderInterface, stub for now - Future getZoneId(final String domain) async => domain; - - @override Future> removeSimilarRecords({ required final ServerDomain domain, - final String? ip4, + required final List records, }) async { final String domainName = domain.domainName; final Dio client = await getClient(); try { - const String ignoreType = 'SOA'; final List allDeleteFutures = []; - final List records = await getDnsRecords(domain: domain); for (final record in records) { - if (record.type != ignoreType) { - allDeleteFutures.add( - client.delete('/domains/$domainName/records/${record.id}'), - ); - } + allDeleteFutures.add( + client.delete('/domains/$domainName/records/${record.id}'), + ); } await Future.wait(allDeleteFutures); } catch (e) { @@ -130,13 +121,12 @@ class DigitalOceanDnsApi extends DnsProviderApi { return GenericResult(success: true, data: null); } - @override - Future> getDnsRecords({ + Future> getDnsRecords({ required final ServerDomain domain, }) async { Response response; final String domainName = domain.domainName; - final List allRecords = []; + List allRecords = []; /// Default amount is 20, but we will eventually overflow it, /// so I hardcode it to the maximum available amount in advance just in case @@ -148,144 +138,38 @@ class DigitalOceanDnsApi extends DnsProviderApi { final Dio client = await getClient(); try { response = await client.get(url); - final List records = response.data['domain_records'] ?? []; - - for (final record in records) { - allRecords.add( - DnsRecord( - id: record['id'], - name: record['name'], - type: record['type'], - content: record['data'], - ttl: record['ttl'], - proxied: false, - ), - ); - } + allRecords = response.data['domain_records'] ?? []; } catch (e) { print(e); + GenericResult( + data: allRecords, + success: false, + message: e.toString(), + ); } finally { close(client); } - return allRecords; + return GenericResult(data: allRecords, success: true); } - Future>> validateDnsRecords( - final ServerDomain domain, - final String ip4, - final String dkimPublicKey, - ); - - @override - List getDesiredDnsRecords( - final String? domainName, - final String? ip4, - final String? dkimPublicKey, - ) { - if (domainName == null || ip4 == null) { - return []; - } - return [ - DesiredDnsRecord( - name: '@', - content: ip4, - description: 'record.root', - displayName: domainName, - ), - DesiredDnsRecord( - name: 'api', - content: ip4, - description: 'record.api', - displayName: 'api.$domainName', - ), - DesiredDnsRecord( - name: 'cloud', - content: ip4, - description: 'record.cloud', - displayName: 'cloud.$domainName', - ), - DesiredDnsRecord( - name: 'git', - content: ip4, - description: 'record.git', - displayName: 'git.$domainName', - ), - DesiredDnsRecord( - name: 'meet', - content: ip4, - description: 'record.meet', - displayName: 'meet.$domainName', - ), - DesiredDnsRecord( - name: 'social', - content: ip4, - description: 'record.social', - displayName: 'social.$domainName', - ), - DesiredDnsRecord( - name: 'password', - content: ip4, - description: 'record.password', - displayName: 'password.$domainName', - ), - DesiredDnsRecord( - name: 'vpn', - content: ip4, - description: 'record.vpn', - displayName: 'vpn.$domainName', - ), - const DesiredDnsRecord( - name: '@', - content: '@', - description: 'record.mx', - type: 'MX', - category: DnsRecordsCategory.email, - ), - const DesiredDnsRecord( - name: '_dmarc', - content: 'v=DMARC1; p=none', - description: 'record.dmarc', - type: 'TXT', - category: DnsRecordsCategory.email, - ), - DesiredDnsRecord( - name: '@', - content: 'v=spf1 a mx ip4:$ip4 -all', - description: 'record.spf', - type: 'TXT', - category: DnsRecordsCategory.email, - ), - if (dkimPublicKey != null) - DesiredDnsRecord( - name: 'selector._domainkey', - content: dkimPublicKey, - description: 'record.dkim', - type: 'TXT', - category: DnsRecordsCategory.email, - ), - ]; - } - - @override Future> createMultipleDnsRecords({ required final ServerDomain domain, - final String? ip4, + required final List records, }) async { final String domainName = domain.domainName; - final List dnsRecords = getProjectDnsRecords(domainName, ip4); final List allCreateFutures = []; final Dio client = await getClient(); try { - for (final DnsRecord record in dnsRecords) { + for (final DnsRecord record in records) { allCreateFutures.add( client.post( '/domains/$domainName/records', data: { 'type': record.type, - 'name': record.name == domainName ? '@' : record.name, - 'data': record.type == 'MX' ? '@' : record.content, + 'name': record.name, + 'data': record.content, 'ttl': record.ttl, 'priority': record.priority, }, @@ -310,47 +194,24 @@ class DigitalOceanDnsApi extends DnsProviderApi { return GenericResult(success: true, data: null); } - @override - Future setDnsRecord( - final DnsRecord record, - final ServerDomain domain, - ) async { - final Dio client = await getClient(); - try { - final domainName = domain.domainName; - await client.post( - '/domains/$domainName/records', - data: { - 'type': record.type, - 'name': record.name, - 'data': record.content, - 'ttl': record.ttl, - 'priority': record.priority, - }, - ); - } catch (e) { - print(e); - } finally { - close(client); - } - } - - @override - Future> domainList() async { - List domains = []; + Future> domainList() async { + List domains = []; final Dio client = await getClient(); try { final Response response = await client.get('/domains'); - domains = response.data['domains'] - .map((final el) => el['name'] as String) - .toList(); + domains = response.data['domains']; } catch (e) { print(e); + return GenericResult( + data: domains, + success: false, + message: e.toString(), + ); } finally { close(client); } - return domains; + return GenericResult(data: domains, success: true); } } diff --git a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_factory.dart b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api_factory.dart similarity index 93% rename from lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_factory.dart rename to lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api_factory.dart index 715a4178..4be2c74b 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_factory.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api_factory.dart @@ -1,4 +1,4 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart'; diff --git a/lib/logic/providers/dns_providers/digital_ocean.dart b/lib/logic/providers/dns_providers/digital_ocean.dart deleted file mode 100644 index 2a8df75b..00000000 --- a/lib/logic/providers/dns_providers/digital_ocean.dart +++ /dev/null @@ -1,3 +0,0 @@ -import 'package:selfprivacy/logic/providers/dns_providers/dns_provider.dart'; - -class DigitalOceanDnsProvider extends DnsProvider {} diff --git a/lib/logic/providers/dns_providers/digital_ocean_dns.dart b/lib/logic/providers/dns_providers/digital_ocean_dns.dart new file mode 100644 index 00000000..ca34ad16 --- /dev/null +++ b/lib/logic/providers/dns_providers/digital_ocean_dns.dart @@ -0,0 +1,356 @@ +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; +import 'package:selfprivacy/logic/models/hive/server_domain.dart'; +import 'package:selfprivacy/logic/models/json/dns_records.dart'; +import 'package:selfprivacy/logic/providers/dns_providers/dns_provider.dart'; + +class ApiAdapter { + ApiAdapter({final bool isWithToken = true}) + : _api = DigitalOceanDnsApi( + isWithToken: isWithToken, + ); + + DigitalOceanDnsApi api({final bool getInitialized = true}) => getInitialized + ? _api + : DigitalOceanDnsApi( + isWithToken: false, + ); + + final DigitalOceanDnsApi _api; +} + +class DigitalOceanDnsProvider extends DnsProvider { + DigitalOceanDnsProvider() : _adapter = ApiAdapter(); + DigitalOceanDnsProvider.load( + final bool isAuthotized, + ) : _adapter = ApiAdapter( + isWithToken: isAuthotized, + ); + + ApiAdapter _adapter; + + @override + Future> tryInitApiByToken(final String token) async { + final api = _adapter.api(getInitialized: false); + final result = await api.isApiTokenValid(token); + if (!result.data || !result.success) { + return result; + } + + _adapter = ApiAdapter(isWithToken: true); + return result; + } + + @override + Future> getZoneId(final String domain) async => + GenericResult( + data: domain, + success: true, + ); + + @override + Future> removeDomainRecords({ + required final ServerDomain domain, + final String? ip4, + }) async { + final result = await _adapter.api().getDnsRecords(domain: domain); + if (result.data.isEmpty || !result.success) { + return GenericResult( + success: result.success, + data: null, + code: result.code, + message: result.message, + ); + } + + const ignoreType = 'SOA'; + final filteredRecords = []; + for (final record in result.data) { + if (record['type'] != ignoreType) { + filteredRecords.add(record); + } + } + + return _adapter.api().removeSimilarRecords( + domain: domain, + records: filteredRecords, + ); + } + + @override + Future>> getDnsRecords({ + required final ServerDomain domain, + }) async { + final List records = []; + final result = await _adapter.api().getDnsRecords(domain: domain); + if (result.data.isEmpty || !result.success) { + return GenericResult( + success: result.success, + data: records, + code: result.code, + message: result.message, + ); + } + + for (final rawRecord in result.data) { + records.add( + DnsRecord( + id: rawRecord['id'], + name: rawRecord['name'], + type: rawRecord['type'], + content: rawRecord['data'], + ttl: rawRecord['ttl'], + proxied: false, + ), + ); + } + + return GenericResult(data: records, success: true); + } + + @override + Future> createDomainRecords({ + required final ServerDomain domain, + final String? ip4, + }) async => + _adapter.api().createMultipleDnsRecords( + domain: domain, + records: getProjectDnsRecords( + domain.domainName, + ip4, + ), + ); + + @override + Future> setDnsRecord( + final DnsRecord record, + final ServerDomain domain, + ) async => + _adapter.api().createMultipleDnsRecords( + domain: domain, + records: [record], + ); + + @override + Future>> domainList() async { + List domains = []; + final result = await _adapter.api().domainList(); + if (result.data.isEmpty || !result.success) { + return GenericResult( + success: result.success, + data: domains, + code: result.code, + message: result.message, + ); + } + + domains = result.data + .map( + (final el) => el['name'] as String, + ) + .toList(); + + return GenericResult( + success: true, + data: domains, + ); + } + + @override + Future>> validateDnsRecords( + final ServerDomain domain, + final String ip4, + final String dkimPublicKey, + ) async { + final GenericResult> records = + await getDnsRecords(domain: domain); + final List foundRecords = []; + try { + final List desiredRecords = + getDesiredDnsRecords(domain.domainName, ip4, dkimPublicKey); + for (final DesiredDnsRecord record in desiredRecords) { + if (record.description == 'record.dkim') { + final DnsRecord foundRecord = records.data.firstWhere( + (final r) => (r.name == record.name) && r.type == record.type, + orElse: () => DnsRecord( + name: record.name, + type: record.type, + content: '', + ttl: 800, + proxied: false, + ), + ); + // remove all spaces and tabulators from + // the foundRecord.content and the record.content + // to compare them + final String? foundContent = + foundRecord.content?.replaceAll(RegExp(r'\s+'), ''); + final String content = record.content.replaceAll(RegExp(r'\s+'), ''); + if (foundContent == content) { + foundRecords.add(record.copyWith(isSatisfied: true)); + } else { + foundRecords.add(record.copyWith(isSatisfied: false)); + } + } else { + if (records.data.any( + (final r) => + (r.name == record.name) && + r.type == record.type && + r.content == record.content, + )) { + foundRecords.add(record.copyWith(isSatisfied: true)); + } else { + foundRecords.add(record.copyWith(isSatisfied: false)); + } + } + } + } catch (e) { + print(e); + return GenericResult( + data: [], + success: false, + message: e.toString(), + ); + } + return GenericResult( + data: foundRecords, + success: true, + ); + } + + List getProjectDnsRecords( + final String? domainName, + final String? ip4, + ) { + final DnsRecord domainA = DnsRecord(type: 'A', name: '@', content: ip4); + + final DnsRecord mx = DnsRecord(type: 'MX', name: '@', content: '@'); + final DnsRecord apiA = DnsRecord(type: 'A', name: 'api', content: ip4); + final DnsRecord cloudA = DnsRecord(type: 'A', name: 'cloud', content: ip4); + final DnsRecord gitA = DnsRecord(type: 'A', name: 'git', content: ip4); + final DnsRecord meetA = DnsRecord(type: 'A', name: 'meet', content: ip4); + final DnsRecord passwordA = + DnsRecord(type: 'A', name: 'password', content: ip4); + final DnsRecord socialA = + DnsRecord(type: 'A', name: 'social', content: ip4); + final DnsRecord vpn = DnsRecord(type: 'A', name: 'vpn', content: ip4); + + final DnsRecord txt1 = DnsRecord( + type: 'TXT', + name: '_dmarc', + content: 'v=DMARC1; p=none', + ttl: 18000, + ); + + final DnsRecord txt2 = DnsRecord( + type: 'TXT', + name: domainName, + content: 'v=spf1 a mx ip4:$ip4 -all', + ttl: 18000, + ); + + return [ + domainA, + apiA, + cloudA, + gitA, + meetA, + passwordA, + socialA, + mx, + txt1, + txt2, + vpn + ]; + } + + @override + List getDesiredDnsRecords( + final String? domainName, + final String? ip4, + final String? dkimPublicKey, + ) { + if (domainName == null || ip4 == null) { + return []; + } + return [ + DesiredDnsRecord( + name: '@', + content: ip4, + description: 'record.root', + displayName: domainName, + ), + DesiredDnsRecord( + name: 'api', + content: ip4, + description: 'record.api', + displayName: 'api.$domainName', + ), + DesiredDnsRecord( + name: 'cloud', + content: ip4, + description: 'record.cloud', + displayName: 'cloud.$domainName', + ), + DesiredDnsRecord( + name: 'git', + content: ip4, + description: 'record.git', + displayName: 'git.$domainName', + ), + DesiredDnsRecord( + name: 'meet', + content: ip4, + description: 'record.meet', + displayName: 'meet.$domainName', + ), + DesiredDnsRecord( + name: 'social', + content: ip4, + description: 'record.social', + displayName: 'social.$domainName', + ), + DesiredDnsRecord( + name: 'password', + content: ip4, + description: 'record.password', + displayName: 'password.$domainName', + ), + DesiredDnsRecord( + name: 'vpn', + content: ip4, + description: 'record.vpn', + displayName: 'vpn.$domainName', + ), + const DesiredDnsRecord( + name: '@', + content: '@', + description: 'record.mx', + type: 'MX', + category: DnsRecordsCategory.email, + ), + const DesiredDnsRecord( + name: '_dmarc', + content: 'v=DMARC1; p=none', + description: 'record.dmarc', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + DesiredDnsRecord( + name: '@', + content: 'v=spf1 a mx ip4:$ip4 -all', + description: 'record.spf', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + if (dkimPublicKey != null) + DesiredDnsRecord( + name: 'selector._domainkey', + content: dkimPublicKey, + description: 'record.dkim', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + ]; + } +} diff --git a/lib/logic/providers/dns_providers/dns_provider_factory.dart b/lib/logic/providers/dns_providers/dns_provider_factory.dart index b42854b7..a2b1694e 100644 --- a/lib/logic/providers/dns_providers/dns_provider_factory.dart +++ b/lib/logic/providers/dns_providers/dns_provider_factory.dart @@ -1,7 +1,7 @@ import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/providers/dns_providers/cloudflare.dart'; import 'package:selfprivacy/logic/providers/dns_providers/desec.dart'; -import 'package:selfprivacy/logic/providers/dns_providers/digital_ocean.dart'; +import 'package:selfprivacy/logic/providers/dns_providers/digital_ocean_dns.dart'; import 'package:selfprivacy/logic/providers/dns_providers/dns_provider.dart'; import 'package:selfprivacy/logic/providers/provider_settings.dart'; From d114d1477f666ea3a09536b0b803a4adfe483b95 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 30 May 2023 12:48:18 -0300 Subject: [PATCH 63/96] fix: Adapt usage of DNS provider interface to refactoring --- .../digital_ocean_dns_api.dart | 2 - .../cubit/dns_records/dns_records_cubit.dart | 24 +++--- .../initializing/domain_setup_cubit.dart | 15 ++-- .../server_installation_cubit.dart | 5 -- .../server_installation_repository.dart | 33 +++----- .../providers/server_providers/hetzner.dart | 4 +- .../initializing/dns_provider_picker.dart | 2 - .../recovery_server_provider_connected.dart | 80 +++++++++---------- 8 files changed, 70 insertions(+), 95 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart index b0e94f41..42274a88 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart @@ -19,7 +19,6 @@ class DigitalOceanDnsApi extends DnsProviderApi { final String? customToken; - @override RegExp getApiTokenValidation() => RegExp(r'\s+|[!$%^&*()@+|~=`{}\[\]:<>?,.\/]'); @@ -45,7 +44,6 @@ class DigitalOceanDnsApi extends DnsProviderApi { @override String rootAddress = 'https://api.digitalocean.com/v2'; - @override Future> isApiTokenValid(final String token) async { bool isValid = false; Response? response; diff --git a/lib/logic/cubit/dns_records/dns_records_cubit.dart b/lib/logic/cubit/dns_records/dns_records_cubit.dart index 4a2deea4..91067d06 100644 --- a/lib/logic/cubit/dns_records/dns_records_cubit.dart +++ b/lib/logic/cubit/dns_records/dns_records_cubit.dart @@ -25,14 +25,13 @@ class DnsRecordsCubit emit( DnsRecordsState( dnsState: DnsRecordsStatus.refreshing, - dnsRecords: ApiController.currentDnsProviderApiFactory - ?.getDnsProvider() - .getDesiredDnsRecords( + dnsRecords: + ProvidersController.currentDnsProvider?.getDesiredDnsRecords( serverInstallationCubit.state.serverDomain?.domainName, '', '', ) ?? - [], + [], ), ); @@ -45,13 +44,12 @@ class DnsRecordsCubit return; } - final foundRecords = await ApiController.currentDnsProviderApiFactory! - .getDnsProvider() - .validateDnsRecords( - domain!, - ipAddress!, - extractDkimRecord(await api.getDnsRecords())?.content ?? '', - ); + final foundRecords = + await ProvidersController.currentDnsProvider!.validateDnsRecords( + domain!, + ipAddress!, + extractDkimRecord(await api.getDnsRecords())?.content ?? '', + ); if (!foundRecords.success || foundRecords.data.isEmpty) { emit(const DnsRecordsState()); @@ -89,10 +87,10 @@ class DnsRecordsCubit emit(state.copyWith(dnsState: DnsRecordsStatus.refreshing)); final ServerDomain? domain = serverInstallationCubit.state.serverDomain; final String? ipAddress = serverInstallationCubit.state.serverDetails?.ip4; - await ProvidersController.currentDnsProvider!.removeSimilarRecords( + await ProvidersController.currentDnsProvider!.removeDomainRecords( domain: domain!, ); - await ProvidersController.currentDnsProvider!.createMultipleDnsRecords( + await ProvidersController.currentDnsProvider!.createDomainRecords( domain: domain, ip4: ipAddress, ); diff --git a/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart b/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart index cb6e1a6e..1437a6e2 100644 --- a/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart @@ -1,4 +1,5 @@ import 'package:cubit_form/cubit_form.dart'; +import 'package:selfprivacy/logic/api_maps/generic_result.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/providers/providers_controller.dart'; @@ -10,12 +11,12 @@ class DomainSetupCubit extends Cubit { Future load() async { emit(Loading(LoadingTypes.loadingDomain)); - final List list = + final GenericResult> result = await ProvidersController.currentDnsProvider!.domainList(); - if (list.isEmpty) { + if (!result.success || result.data.isEmpty) { emit(Empty()); - } else if (list.length == 1) { - emit(Loaded(list.first)); + } else if (result.data.length == 1) { + emit(Loaded(result.data.first)); } else { emit(MoreThenOne()); } @@ -27,13 +28,13 @@ class DomainSetupCubit extends Cubit { emit(Loading(LoadingTypes.saving)); - final String? zoneId = + final GenericResult zoneIdResult = await ProvidersController.currentDnsProvider!.getZoneId(domainName); - if (zoneId != null) { + if (zoneIdResult.success || zoneIdResult.data != null) { final ServerDomain domain = ServerDomain( domainName: domainName, - zoneId: zoneId, + zoneId: zoneIdResult.data!, provider: DnsProviderType.cloudflare, ); diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 52740b64..4a011248 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -9,8 +9,6 @@ import 'package:selfprivacy/logic/models/callback_dialogue_branching.dart'; import 'package:selfprivacy/logic/models/launch_installation_data.dart'; import 'package:selfprivacy/logic/providers/provider_settings.dart'; import 'package:selfprivacy/logic/providers/providers_controller.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; import 'package:selfprivacy/logic/api_maps/staging_options.dart'; import 'package:selfprivacy/logic/models/hive/backblaze_credential.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; @@ -258,7 +256,6 @@ class ServerInstallationCubit extends Cubit { ); if (!result.success && result.data != null) { - bool dialoguesResolved = false; CallbackDialogueBranching branching = result.data!; //while (!dialoguesResolved) { showPopUpAlert( @@ -268,7 +265,6 @@ class ServerInstallationCubit extends Cubit { actionButtonOnPressed: () async { final branchingResult = await branching.choices[1].callback!(); if (branchingResult.data == null) { - dialoguesResolved = true; return; } @@ -278,7 +274,6 @@ class ServerInstallationCubit extends Cubit { cancelButtonOnPressed: () async { final branchingResult = await branching.choices[0].callback!(); if (branchingResult.data == null) { - dialoguesResolved = true; return; } diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index fb3470ed..ddd42954 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -12,8 +12,6 @@ import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/config/hive_config.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; import 'package:selfprivacy/logic/providers/provider_settings.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server_api.dart'; import 'package:selfprivacy/logic/api_maps/staging_options.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; @@ -173,16 +171,14 @@ class ServerInstallationRepository { } Future getDomainId(final String token, final String domain) async { - final DnsProviderApi dnsProviderApi = - ApiController.currentDnsProviderApiFactory!.getDnsProvider( - settings: DnsProviderApiSettings( - isWithToken: false, - customToken: token, - ), - ); - - final String? domainId = await dnsProviderApi.getZoneId(domain); - return domainId; + final result = + await ProvidersController.currentDnsProvider!.tryInitApiByToken(token); + return result.success + ? (await ProvidersController.currentDnsProvider!.getZoneId( + domain, + )) + .data + : null; } Future> isDnsAddressesMatch( @@ -257,7 +253,7 @@ class ServerInstallationRepository { } final GenericResult removingResult = - await ProvidersController.currentDnsProvider!.removeSimilarRecords( + await ProvidersController.currentDnsProvider!.removeDomainRecords( ip4: serverDetails.ip4, domain: domain, ); @@ -270,9 +266,8 @@ class ServerInstallationRepository { bool createdSuccessfully = false; String errorMessage = 'domain.error'.tr(); try { - final GenericResult createResult = await ProvidersController - .currentDnsProvider! - .createMultipleDnsRecords( + final GenericResult createResult = + await ProvidersController.currentDnsProvider!.createDomainRecords( ip4: serverDetails.ip4, domain: domain, ); @@ -605,10 +600,6 @@ class ServerInstallationRepository { getIt().init(); } - Future saveDnsProviderType(final DnsProvider type) async { - await getIt().storeDnsProviderType(type); - } - Future saveBackblazeKey( final BackblazeCredential backblazeCredential, ) async { @@ -683,7 +674,7 @@ class ServerInstallationRepository { final GenericResult removalResult = await ProvidersController .currentDnsProvider! - .removeSimilarRecords(domain: serverDomain); + .removeDomainRecords(domain: serverDomain); if (!removalResult.success) { getIt().showSnackBar('modals.dns_removal_error'.tr()); diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index dedcabfe..ad6f4d4a 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -580,11 +580,11 @@ class HetznerServerProvider extends ServerProvider { } await installationData.successCallback(serverDetails); - await installationData.dnsProvider.removeSimilarRecords( + await installationData.dnsProvider.removeDomainRecords( ip4: serverDetails.ip4, domain: installationData.serverDomain, ); - await installationData.dnsProvider.createMultipleDnsRecords( + await installationData.dnsProvider.createDomainRecords( ip4: serverDetails.ip4, domain: installationData.serverDomain, ); diff --git a/lib/ui/pages/setup/initializing/dns_provider_picker.dart b/lib/ui/pages/setup/initializing/dns_provider_picker.dart index 32ca7c37..e7407cf2 100644 --- a/lib/ui/pages/setup/initializing/dns_provider_picker.dart +++ b/lib/ui/pages/setup/initializing/dns_provider_picker.dart @@ -10,8 +10,6 @@ import 'package:selfprivacy/ui/components/brand_md/brand_md.dart'; import 'package:selfprivacy/ui/components/buttons/brand_button.dart'; import 'package:selfprivacy/ui/components/buttons/outlined_button.dart'; import 'package:selfprivacy/ui/components/cards/outlined_card.dart'; -import 'package:selfprivacy/utils/network_utils.dart'; -import 'package:selfprivacy/utils/launch_url.dart'; import 'package:url_launcher/url_launcher_string.dart'; class DnsProviderPicker extends StatefulWidget { diff --git a/lib/ui/pages/setup/recovering/recovery_server_provider_connected.dart b/lib/ui/pages/setup/recovering/recovery_server_provider_connected.dart index d8a9e8cb..82c29ba2 100644 --- a/lib/ui/pages/setup/recovering/recovery_server_provider_connected.dart +++ b/lib/ui/pages/setup/recovering/recovery_server_provider_connected.dart @@ -19,51 +19,45 @@ class RecoveryServerProviderConnected extends StatelessWidget { create: (final BuildContext context) => ServerProviderFormCubit(appConfig), child: Builder( - builder: (final BuildContext context) { - final FormCubitState formCubitState = - context.watch().state; - - return BrandHeroScreen( - heroTitle: 'recovering.server_provider_connected'.tr(), - heroSubtitle: 'recovering.server_provider_connected_description'.tr( - args: [appConfig.state.serverDomain?.domainName ?? 'your domain'], + builder: (final BuildContext context) => BrandHeroScreen( + heroTitle: 'recovering.server_provider_connected'.tr(), + heroSubtitle: 'recovering.server_provider_connected_description'.tr( + args: [appConfig.state.serverDomain?.domainName ?? 'your domain'], + ), + hasBackButton: true, + hasFlashButton: false, + ignoreBreakpoints: true, + hasSupportDrawer: true, + onBackButtonPressed: () { + Navigator.of(context).popUntil((final route) => route.isFirst); + }, + children: [ + CubitFormTextField( + formFieldCubit: context.read().apiKey, + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: + 'recovering.server_provider_connected_placeholder'.tr(), + ), ), - hasBackButton: true, - hasFlashButton: false, - ignoreBreakpoints: true, - hasSupportDrawer: true, - onBackButtonPressed: () { - Navigator.of(context).popUntil((final route) => route.isFirst); - }, - children: [ - CubitFormTextField( - formFieldCubit: context.read().apiKey, - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: - 'recovering.server_provider_connected_placeholder'.tr(), - ), + const SizedBox(height: 16), + BrandButton.filled( + onPressed: () => + context.read().trySubmit(), + child: Text('basis.continue'.tr()), + ), + const SizedBox(height: 16), + Builder( + builder: (final context) => BrandButton.text( + title: 'initializing.how'.tr(), + onPressed: () => context.read().showArticle( + article: 'how_hetzner', + context: context, + ), ), - const SizedBox(height: 16), - BrandButton.filled( - onPressed: () => - context.read().trySubmit(), - child: Text('basis.continue'.tr()), - ), - const SizedBox(height: 16), - Builder( - builder: (final context) => BrandButton.text( - title: 'initializing.how'.tr(), - onPressed: () => - context.read().showArticle( - article: 'how_hetzner', - context: context, - ), - ), - ), - ], - ); - }, + ), + ], + ), ), ); } From f81bf968fdda69bacf264652c9efdff94799ae1d Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 2 Jun 2023 01:36:33 -0300 Subject: [PATCH 64/96] fix: Add forced JSON content type to REST APIs --- .../rest_maps/dns_providers/cloudflare/cloudflare_api.dart | 6 +++++- .../api_maps/rest_maps/dns_providers/desec/desec_api.dart | 6 +++++- .../digital_ocean_dns/digital_ocean_dns_api.dart | 6 +++++- .../server_providers/digital_ocean/digital_ocean_api.dart | 6 +++++- .../rest_maps/server_providers/hetzner/hetzner_api.dart | 6 +++++- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart index ad3fd460..50ecd7a7 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart @@ -21,7 +21,11 @@ class CloudflareApi extends DnsProviderApi { @override BaseOptions get options { - final BaseOptions options = BaseOptions(baseUrl: rootAddress); + final BaseOptions options = BaseOptions( + baseUrl: rootAddress, + contentType: Headers.jsonContentType, + responseType: ResponseType.json, + ); if (isWithToken) { final String? token = getIt().dnsProviderKey; assert(token != null); diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart index db24707a..f8915c5a 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart @@ -21,7 +21,11 @@ class DesecApi extends DnsProviderApi { @override BaseOptions get options { - final BaseOptions options = BaseOptions(baseUrl: rootAddress); + final BaseOptions options = BaseOptions( + baseUrl: rootAddress, + contentType: Headers.jsonContentType, + responseType: ResponseType.json, + ); if (isWithToken) { final String? token = getIt().dnsProviderKey; assert(token != null); diff --git a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart index 42274a88..a6927e24 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart @@ -24,7 +24,11 @@ class DigitalOceanDnsApi extends DnsProviderApi { @override BaseOptions get options { - final BaseOptions options = BaseOptions(baseUrl: rootAddress); + final BaseOptions options = BaseOptions( + baseUrl: rootAddress, + contentType: Headers.jsonContentType, + responseType: ResponseType.json, + ); if (isWithToken) { final String? token = getIt().dnsProviderKey; assert(token != null); diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart index 990a06e4..2a4153c1 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart @@ -25,7 +25,11 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { @override BaseOptions get options { - final BaseOptions options = BaseOptions(baseUrl: rootAddress); + final BaseOptions options = BaseOptions( + baseUrl: rootAddress, + contentType: Headers.jsonContentType, + responseType: ResponseType.json, + ); if (isWithToken) { final String? token = getIt().serverProviderKey; assert(token != null); diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart index d09cce18..4fdd18da 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart @@ -27,7 +27,11 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { @override BaseOptions get options { - final BaseOptions options = BaseOptions(baseUrl: rootAddress); + final BaseOptions options = BaseOptions( + baseUrl: rootAddress, + contentType: Headers.jsonContentType, + responseType: ResponseType.json, + ); if (isWithToken) { final String? token = getIt().serverProviderKey; assert(token != null); From 3a40b5ed323e045e7297eb9472dbe9e59225dee1 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 2 Jun 2023 02:15:13 -0300 Subject: [PATCH 65/96] fix: Add missing DNS providers to different installation steps --- .../providers/server_providers/hetzner.dart | 3 + .../initializing/dns_provider_picker.dart | 58 +++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index ad6f4d4a..ce0bd416 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -398,6 +398,9 @@ class HetznerServerProvider extends ServerProvider { case DnsProviderType.digitalOcean: dnsProviderType = 'DIGITALOCEAN'; break; + case DnsProviderType.desec: + dnsProviderType = 'DESEC'; + break; case DnsProviderType.cloudflare: default: dnsProviderType = 'CLOUDFLARE'; diff --git a/lib/ui/pages/setup/initializing/dns_provider_picker.dart b/lib/ui/pages/setup/initializing/dns_provider_picker.dart index e7407cf2..889367fa 100644 --- a/lib/ui/pages/setup/initializing/dns_provider_picker.dart +++ b/lib/ui/pages/setup/initializing/dns_provider_picker.dart @@ -174,6 +174,8 @@ class ProviderSelectionPage extends StatelessWidget { width: double.infinity, child: Column( crossAxisAlignment: CrossAxisAlignment.start, + + /// TODO: Remove obvious repetition children: [ Text( 'initializing.select_dns'.tr(), @@ -295,6 +297,62 @@ class ProviderSelectionPage extends StatelessWidget { ), ), ), + const SizedBox(height: 16), + OutlinedCard( + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + width: 40, + height: 40, + padding: const EdgeInsets.all(10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(40), + color: const Color.fromARGB(255, 1, 126, 251), + ), + child: SvgPicture.asset( + 'assets/images/logos/digital_ocean.svg', + ), + ), + const SizedBox(width: 16), + Text( + 'Digital Ocean', + style: Theme.of(context).textTheme.titleMedium, + ), + ], + ), + const SizedBox(height: 16), + Text( + 'initializing.select_provider_price_title'.tr(), + style: Theme.of(context).textTheme.bodyLarge, + ), + Text( + 'initializing.select_provider_price_free'.tr(), + style: Theme.of(context).textTheme.bodySmall, + ), + const SizedBox(height: 16), + BrandButton.rised( + text: 'basis.select'.tr(), + onPressed: () { + serverInstallationCubit + .setDnsProviderType(DnsProviderType.digitalOcean); + callback(DnsProviderType.digitalOcean); + }, + ), + // Outlined button that will open website + BrandOutlinedButton( + onPressed: () => + launchUrlString('https://cloud.digitalocean.com/'), + title: 'initializing.select_provider_site_button'.tr(), + ), + ], + ), + ), + ), ], ), ); From 040fc43e1f5513c9cf11d9f0a45bf18bf2949c3d Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 2 Jun 2023 02:44:34 -0300 Subject: [PATCH 66/96] fix: Add DNS provider type to provider classes to fix wrong domain type --- .../cubit/forms/setup/initializing/domain_setup_cubit.dart | 5 +++-- lib/logic/providers/dns_providers/cloudflare.dart | 3 +++ lib/logic/providers/dns_providers/desec.dart | 3 +++ lib/logic/providers/dns_providers/digital_ocean_dns.dart | 3 +++ lib/logic/providers/dns_providers/dns_provider.dart | 1 + lib/logic/providers/server_providers/digital_ocean.dart | 3 +++ lib/logic/providers/server_providers/hetzner.dart | 3 +++ lib/logic/providers/server_providers/server_provider.dart | 1 + 8 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart b/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart index 1437a6e2..8c66deb7 100644 --- a/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart @@ -28,14 +28,15 @@ class DomainSetupCubit extends Cubit { emit(Loading(LoadingTypes.saving)); + final dnsProvider = ProvidersController.currentDnsProvider!; final GenericResult zoneIdResult = - await ProvidersController.currentDnsProvider!.getZoneId(domainName); + await dnsProvider.getZoneId(domainName); if (zoneIdResult.success || zoneIdResult.data != null) { final ServerDomain domain = ServerDomain( domainName: domainName, zoneId: zoneIdResult.data!, - provider: DnsProviderType.cloudflare, + provider: dnsProvider.type, ); serverInstallationCubit.setDomain(domain); diff --git a/lib/logic/providers/dns_providers/cloudflare.dart b/lib/logic/providers/dns_providers/cloudflare.dart index bd01b240..1f53761d 100644 --- a/lib/logic/providers/dns_providers/cloudflare.dart +++ b/lib/logic/providers/dns_providers/cloudflare.dart @@ -29,6 +29,9 @@ class CloudflareDnsProvider extends DnsProvider { ApiAdapter _adapter; + @override + DnsProviderType get type => DnsProviderType.cloudflare; + @override Future> tryInitApiByToken(final String token) async { final api = _adapter.api(getInitialized: false); diff --git a/lib/logic/providers/dns_providers/desec.dart b/lib/logic/providers/dns_providers/desec.dart index fe09fd3c..7111c0ba 100644 --- a/lib/logic/providers/dns_providers/desec.dart +++ b/lib/logic/providers/dns_providers/desec.dart @@ -29,6 +29,9 @@ class DesecDnsProvider extends DnsProvider { ApiAdapter _adapter; + @override + DnsProviderType get type => DnsProviderType.desec; + @override Future> tryInitApiByToken(final String token) async { final api = _adapter.api(getInitialized: false); diff --git a/lib/logic/providers/dns_providers/digital_ocean_dns.dart b/lib/logic/providers/dns_providers/digital_ocean_dns.dart index ca34ad16..b231c414 100644 --- a/lib/logic/providers/dns_providers/digital_ocean_dns.dart +++ b/lib/logic/providers/dns_providers/digital_ocean_dns.dart @@ -29,6 +29,9 @@ class DigitalOceanDnsProvider extends DnsProvider { ApiAdapter _adapter; + @override + DnsProviderType get type => DnsProviderType.digitalOcean; + @override Future> tryInitApiByToken(final String token) async { final api = _adapter.api(getInitialized: false); diff --git a/lib/logic/providers/dns_providers/dns_provider.dart b/lib/logic/providers/dns_providers/dns_provider.dart index 14e31c32..60976f68 100644 --- a/lib/logic/providers/dns_providers/dns_provider.dart +++ b/lib/logic/providers/dns_providers/dns_provider.dart @@ -5,6 +5,7 @@ import 'package:selfprivacy/logic/models/json/dns_records.dart'; export 'package:selfprivacy/logic/api_maps/generic_result.dart'; abstract class DnsProvider { + DnsProviderType get type; Future> tryInitApiByToken(final String token); Future> getZoneId(final String domain); Future> removeDomainRecords({ diff --git a/lib/logic/providers/server_providers/digital_ocean.dart b/lib/logic/providers/server_providers/digital_ocean.dart index 01b27ef1..a745434d 100644 --- a/lib/logic/providers/server_providers/digital_ocean.dart +++ b/lib/logic/providers/server_providers/digital_ocean.dart @@ -46,6 +46,9 @@ class DigitalOceanServerProvider extends ServerProvider { ApiAdapter _adapter; + @override + ServerProviderType get type => ServerProviderType.digitalOcean; + @override Future> trySetServerLocation( final String location, diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index ce0bd416..7bacb8a2 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -47,6 +47,9 @@ class HetznerServerProvider extends ServerProvider { ApiAdapter _adapter; + @override + ServerProviderType get type => ServerProviderType.hetzner; + @override Future> trySetServerLocation( final String location, diff --git a/lib/logic/providers/server_providers/server_provider.dart b/lib/logic/providers/server_providers/server_provider.dart index ffb64e12..f1004192 100644 --- a/lib/logic/providers/server_providers/server_provider.dart +++ b/lib/logic/providers/server_providers/server_provider.dart @@ -14,6 +14,7 @@ export 'package:selfprivacy/logic/api_maps/generic_result.dart'; export 'package:selfprivacy/logic/models/launch_installation_data.dart'; abstract class ServerProvider { + ServerProviderType get type; Future>> getServers(); Future> trySetServerLocation(final String location); Future> tryInitApiByToken(final String token); From 4da4ed6afd653048acc29c46e9de379856a94325 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 2 Jun 2023 19:04:23 -0300 Subject: [PATCH 67/96] feat: Move current installation dialogue error to installation state --- .../server_installation_cubit.dart | 29 +++---------------- .../server_installation_repository.dart | 1 + .../server_installation_state.dart | 18 +++++++++++- 3 files changed, 22 insertions(+), 26 deletions(-) diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 4a011248..6fa7d569 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -19,7 +19,6 @@ import 'package:selfprivacy/logic/models/server_basic_info.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_repository.dart'; import 'package:selfprivacy/logic/models/server_provider_location.dart'; import 'package:selfprivacy/logic/models/server_type.dart'; -import 'package:selfprivacy/ui/helpers/modals.dart'; export 'package:provider/provider.dart'; @@ -256,31 +255,11 @@ class ServerInstallationCubit extends Cubit { ); if (!result.success && result.data != null) { - CallbackDialogueBranching branching = result.data!; - //while (!dialoguesResolved) { - showPopUpAlert( - alertTitle: branching.title, - description: branching.description, - actionButtonTitle: branching.choices[1].title, - actionButtonOnPressed: () async { - final branchingResult = await branching.choices[1].callback!(); - if (branchingResult.data == null) { - return; - } - - branching = branchingResult.data!; - }, - cancelButtonTitle: branching.choices[0].title, - cancelButtonOnPressed: () async { - final branchingResult = await branching.choices[0].callback!(); - if (branchingResult.data == null) { - return; - } - - branching = branchingResult.data!; - }, + emit( + (state as ServerInstallationNotFinished).copyWith( + installationDialoguePopUp: result.data, + ), ); - //} } } diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 9b3fa46b..9444718e 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -79,6 +79,7 @@ class ServerInstallationRepository { if (box.get(BNames.hasFinalChecked, defaultValue: false)) { StagingOptions.verifyCertificate = true; return ServerInstallationFinished( + installationDialoguePopUp: null, providerApiToken: providerApiToken!, serverTypeIdentificator: serverTypeIdentificator ?? '', dnsApiToken: dnsApiToken!, diff --git a/lib/logic/cubit/server_installation/server_installation_state.dart b/lib/logic/cubit/server_installation/server_installation_state.dart index 5ceaafdd..c6356c36 100644 --- a/lib/logic/cubit/server_installation/server_installation_state.dart +++ b/lib/logic/cubit/server_installation/server_installation_state.dart @@ -12,6 +12,7 @@ abstract class ServerInstallationState extends Equatable { required this.isServerStarted, required this.isServerResetedFirstTime, required this.isServerResetedSecondTime, + required this.installationDialoguePopUp, }); @override @@ -25,6 +26,7 @@ abstract class ServerInstallationState extends Equatable { serverDetails, isServerStarted, isServerResetedFirstTime, + installationDialoguePopUp ]; final String? providerApiToken; @@ -37,6 +39,7 @@ abstract class ServerInstallationState extends Equatable { final bool isServerStarted; final bool isServerResetedFirstTime; final bool isServerResetedSecondTime; + final CallbackDialogueBranching? installationDialoguePopUp; bool get isServerProviderApiKeyFilled => providerApiToken != null; bool get isServerTypeFilled => serverTypeIdentificator != null; @@ -96,6 +99,7 @@ class TimerState extends ServerInstallationNotFinished { isServerResetedFirstTime: dataState.isServerResetedFirstTime, isServerResetedSecondTime: dataState.isServerResetedSecondTime, dnsMatches: dataState.dnsMatches, + installationDialoguePopUp: dataState.installationDialoguePopUp, ); final ServerInstallationNotFinished dataState; @@ -138,6 +142,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { super.serverDomain, super.rootUser, super.serverDetails, + super.installationDialoguePopUp, }); final bool isLoading; final Map? dnsMatches; @@ -155,6 +160,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { isServerResetedFirstTime, isLoading, dnsMatches, + installationDialoguePopUp, ]; ServerInstallationNotFinished copyWith({ @@ -170,6 +176,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { final bool? isServerResetedSecondTime, final bool? isLoading, final Map? dnsMatches, + final CallbackDialogueBranching? installationDialoguePopUp, }) => ServerInstallationNotFinished( providerApiToken: providerApiToken ?? this.providerApiToken, @@ -187,6 +194,8 @@ class ServerInstallationNotFinished extends ServerInstallationState { isServerResetedSecondTime ?? this.isServerResetedSecondTime, isLoading: isLoading ?? this.isLoading, dnsMatches: dnsMatches ?? this.dnsMatches, + installationDialoguePopUp: + installationDialoguePopUp ?? this.installationDialoguePopUp, ); ServerInstallationFinished finish() => ServerInstallationFinished( @@ -200,6 +209,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { isServerStarted: isServerStarted, isServerResetedFirstTime: isServerResetedFirstTime, isServerResetedSecondTime: isServerResetedSecondTime, + installationDialoguePopUp: installationDialoguePopUp, ); } @@ -218,6 +228,7 @@ class ServerInstallationEmpty extends ServerInstallationNotFinished { isServerResetedSecondTime: false, isLoading: false, dnsMatches: null, + installationDialoguePopUp: null, ); } @@ -233,6 +244,7 @@ class ServerInstallationFinished extends ServerInstallationState { required super.isServerStarted, required super.isServerResetedFirstTime, required super.isServerResetedSecondTime, + required super.installationDialoguePopUp, }); @override @@ -246,6 +258,7 @@ class ServerInstallationFinished extends ServerInstallationState { serverDetails, isServerStarted, isServerResetedFirstTime, + installationDialoguePopUp, ]; } @@ -287,6 +300,7 @@ class ServerInstallationRecovery extends ServerInstallationState { isServerStarted: true, isServerResetedFirstTime: true, isServerResetedSecondTime: true, + installationDialoguePopUp: null, ); final RecoveryStep currentStep; final ServerRecoveryCapabilities recoveryCapabilities; @@ -302,7 +316,8 @@ class ServerInstallationRecovery extends ServerInstallationState { serverDetails, isServerStarted, isServerResetedFirstTime, - currentStep + currentStep, + installationDialoguePopUp ]; ServerInstallationRecovery copyWith({ @@ -340,5 +355,6 @@ class ServerInstallationRecovery extends ServerInstallationState { isServerStarted: true, isServerResetedFirstTime: true, isServerResetedSecondTime: true, + installationDialoguePopUp: null, ); } From ffa13aee04d6f5e9a6acb813acabc1bd79200b60 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 6 Jun 2023 23:35:57 -0300 Subject: [PATCH 68/96] chore: Implement HetznerVolume model and use it instead dynamic json --- .../server_providers/hetzner/hetzner_api.dart | 6 ++-- .../models/json/hetzner_server_info.dart | 21 ++++++++++++ .../models/json/hetzner_server_info.g.dart | 18 ++++++++++ .../providers/server_providers/hetzner.dart | 33 ++++++++----------- 4 files changed, 57 insertions(+), 21 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart index 4fdd18da..abfc488b 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart @@ -131,8 +131,9 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { ); } - Future createVolume() async { + Future> createVolume() async { Response? createVolumeResponse; + HetznerVolume? volume; final Dio client = await getClient(); try { createVolumeResponse = await client.post( @@ -146,6 +147,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { 'format': 'ext4' }, ); + volume = HetznerVolume.fromJson(createVolumeResponse.data); } catch (e) { print(e); return GenericResult( @@ -158,7 +160,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { } return GenericResult( - data: createVolumeResponse.data, + data: volume, success: true, code: createVolumeResponse.statusCode, message: createVolumeResponse.statusMessage, diff --git a/lib/logic/models/json/hetzner_server_info.dart b/lib/logic/models/json/hetzner_server_info.dart index 6e28f1cf..31d60509 100644 --- a/lib/logic/models/json/hetzner_server_info.dart +++ b/lib/logic/models/json/hetzner_server_info.dart @@ -113,3 +113,24 @@ class HetznerLocation { static HetznerLocation fromJson(final Map json) => _$HetznerLocationFromJson(json); } + +@JsonSerializable() +class HetznerVolume { + HetznerVolume( + this.id, + this.sizeByte, + this.serverId, + this.name, + this.linuxDevice, + ); + final int id; + final int sizeByte; + final int? serverId; + final String name; + + @JsonKey(name: 'linux_device') + final String? linuxDevice; + + static HetznerVolume fromJson(final Map json) => + _$HetznerVolumeFromJson(json); +} diff --git a/lib/logic/models/json/hetzner_server_info.g.dart b/lib/logic/models/json/hetzner_server_info.g.dart index 5201a1c5..7cc08abc 100644 --- a/lib/logic/models/json/hetzner_server_info.g.dart +++ b/lib/logic/models/json/hetzner_server_info.g.dart @@ -119,3 +119,21 @@ Map _$HetznerLocationToJson(HetznerLocation instance) => 'description': instance.description, 'network_zone': instance.zone, }; + +HetznerVolume _$HetznerVolumeFromJson(Map json) => + HetznerVolume( + json['id'] as int, + json['sizeByte'] as int, + json['serverId'] as int?, + json['name'] as String, + json['linux_device'] as String?, + ); + +Map _$HetznerVolumeToJson(HetznerVolume instance) => + { + 'id': instance.id, + 'sizeByte': instance.sizeByte, + 'serverId': instance.serverId, + 'name': instance.name, + 'linux_device': instance.linuxDevice, + }; diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index 7bacb8a2..fae15b5b 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -441,7 +441,7 @@ class HetznerServerProvider extends ServerProvider { ); } - final volume = volumeResult.data['volume']; + final volume = volumeResult.data!; final serverApiToken = StringGenerators.apiToken(); final hostname = getHostnameFromDomain( installationData.serverDomain.domainName, @@ -455,7 +455,7 @@ class HetznerServerProvider extends ServerProvider { dnsProviderType: dnsProviderToInfectName(installationData.dnsProviderType), hostName: hostname, - volumeId: volume['id'], + volumeId: volume.id, base64Password: base64.encode( utf8.encode(installationData.rootUser.password ?? 'PASS'), ), @@ -464,7 +464,7 @@ class HetznerServerProvider extends ServerProvider { ); if (!serverResult.success || serverResult.data == null) { - await _adapter.api().deleteVolume(volume['id']); + await _adapter.api().deleteVolume(volume.id); await Future.delayed(const Duration(seconds: 5)); if (serverResult.message != null && serverResult.message == 'uniqueness_error') { @@ -530,11 +530,11 @@ class HetznerServerProvider extends ServerProvider { ip4: serverResult.data['server']['public_net']['ipv4']['ip'], createTime: DateTime.now(), volume: ServerVolume( - id: volume['id'], - name: volume['name'], - sizeByte: volume['size'], - serverId: volume['server'], - linuxDevice: volume['linux_device'], + id: volume.id, + name: volume.name, + sizeByte: volume.sizeByte, + serverId: volume.serverId, + linuxDevice: volume.linuxDevice, ), apiToken: serverApiToken, provider: ServerProviderType.hetzner, @@ -564,7 +564,7 @@ class HetznerServerProvider extends ServerProvider { CallbackDialogueChoice( title: 'modals.try_again'.tr(), callback: () async { - await _adapter.api().deleteVolume(volume['id']); + await _adapter.api().deleteVolume(volume.id); await Future.delayed(const Duration(seconds: 5)); final deletion = await deleteServer(hostname); if (deletion.success) { @@ -673,17 +673,12 @@ class HetznerServerProvider extends ServerProvider { } try { - final volumeId = result.data['volume']['id']; - final volumeSize = result.data['volume']['size']; - final volumeServer = result.data['volume']['server']; - final volumeName = result.data['volume']['name']; - final volumeDevice = result.data['volume']['linux_device']; volume = ServerVolume( - id: volumeId, - name: volumeName, - sizeByte: volumeSize, - serverId: volumeServer, - linuxDevice: volumeDevice, + id: result.data!.id, + name: result.data!.name, + sizeByte: result.data!.sizeByte, + serverId: result.data!.serverId, + linuxDevice: result.data!.linuxDevice, ); } catch (e) { print(e); From 2a66d246c76a24c9a5fe963ccdbf46884413b12f Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 7 Jun 2023 00:03:34 -0300 Subject: [PATCH 69/96] chore: Replace dynamic blobs with HetznerServerType --- .../server_providers/hetzner/hetzner_api.dart | 48 ++++++++++--------- .../models/json/hetzner_server_info.dart | 20 +++++++- .../providers/server_providers/hetzner.dart | 32 ++++++------- 3 files changed, 60 insertions(+), 40 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart index abfc488b..6cddfa22 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart @@ -147,7 +147,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { 'format': 'ext4' }, ); - volume = HetznerVolume.fromJson(createVolumeResponse.data); + volume = HetznerVolume.fromJson(createVolumeResponse.data['volume']); } catch (e) { print(e); return GenericResult( @@ -167,8 +167,10 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { ); } - Future> getVolumes({final String? status}) async { - List volumes = []; + Future>> getVolumes({ + final String? status, + }) async { + final List volumes = []; Response? getVolumesResonse; final Dio client = await getClient(); @@ -179,7 +181,9 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { 'status': status, }, ); - volumes = getVolumesResonse.data['volumes']; + for (final volume in getVolumesResonse.data['volumes']) { + volumes.add(HetznerVolume.fromJson(volume)); + } } catch (e) { print(e); return GenericResult( @@ -199,34 +203,31 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { ); } - Future getVolume( + Future> getVolume( final String volumeId, ) async { - ServerVolume? volume; + HetznerVolume? volume; final Response getVolumeResponse; final Dio client = await getClient(); try { getVolumeResponse = await client.get('/volumes/$volumeId'); - final int responseVolumeId = getVolumeResponse.data['volume']['id']; - final int volumeSize = getVolumeResponse.data['volume']['size']; - final int volumeServer = getVolumeResponse.data['volume']['server']; - final String volumeName = getVolumeResponse.data['volume']['name']; - final volumeDevice = getVolumeResponse.data['volume']['linux_device']; - volume = ServerVolume( - id: responseVolumeId, - name: volumeName, - sizeByte: volumeSize, - serverId: volumeServer, - linuxDevice: volumeDevice, - ); + volume = HetznerVolume.fromJson(getVolumeResponse.data['volume']); } catch (e) { print(e); + return GenericResult( + data: null, + success: false, + message: e.toString(), + ); } finally { client.close(); } - return volume; + return GenericResult( + data: volume, + success: true, + ); } Future> deleteVolume(final int volumeId) async { @@ -547,15 +548,18 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { return GenericResult(success: true, data: locations); } - Future> getAvailableServerTypes() async { - List types = []; + Future>> + getAvailableServerTypes() async { + final List types = []; final Dio client = await getClient(); try { final Response response = await client.get( '/server_types', ); - types = response.data!['server_types']; + for (final type in response.data!['server_types']) { + types.add(HetznerServerTypeInfo.fromJson(type)); + } } catch (e) { print(e); return GenericResult( diff --git a/lib/logic/models/json/hetzner_server_info.dart b/lib/logic/models/json/hetzner_server_info.dart index 31d60509..96838b4e 100644 --- a/lib/logic/models/json/hetzner_server_info.dart +++ b/lib/logic/models/json/hetzner_server_info.dart @@ -72,11 +72,21 @@ enum ServerStatus { @JsonSerializable() class HetznerServerTypeInfo { - HetznerServerTypeInfo(this.cores, this.memory, this.disk, this.prices); + HetznerServerTypeInfo( + this.cores, + this.memory, + this.disk, + this.prices, + this.name, + this.description, + ); final int cores; final num memory; final int disk; + final String name; + final String description; + final List prices; static HetznerServerTypeInfo fromJson(final Map json) => @@ -85,7 +95,11 @@ class HetznerServerTypeInfo { @JsonSerializable() class HetznerPriceInfo { - HetznerPriceInfo(this.hourly, this.monthly); + HetznerPriceInfo( + this.hourly, + this.monthly, + this.location, + ); @JsonKey(name: 'price_hourly', fromJson: HetznerPriceInfo.getPrice) final double hourly; @@ -93,6 +107,8 @@ class HetznerPriceInfo { @JsonKey(name: 'price_monthly', fromJson: HetznerPriceInfo.getPrice) final double monthly; + final String location; + static HetznerPriceInfo fromJson(final Map json) => _$HetznerPriceInfoFromJson(json); diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index fae15b5b..ceec065f 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -150,19 +150,19 @@ class HetznerServerProvider extends ServerProvider { ); } - final List rawTypes = result.data; + final rawTypes = result.data; for (final rawType in rawTypes) { - for (final rawPrice in rawType['prices']) { - if (rawPrice['location'].toString() == location.identifier) { + for (final rawPrice in rawType.prices) { + if (rawPrice.location == location.identifier) { types.add( ServerType( - title: rawType['description'], - identifier: rawType['name'], - ram: rawType['memory'], - cores: rawType['cores'], - disk: DiskSize(byte: rawType['disk'] * 1024 * 1024 * 1024), + title: rawType.description, + identifier: rawType.name, + ram: rawType.memory.toDouble(), + cores: rawType.cores, + disk: DiskSize(byte: rawType.disk * 1024 * 1024 * 1024), price: Price( - value: double.parse(rawPrice['price_monthly']['gross']), + value: rawPrice.monthly, currency: 'EUR', ), location: location, @@ -532,7 +532,7 @@ class HetznerServerProvider extends ServerProvider { volume: ServerVolume( id: volume.id, name: volume.name, - sizeByte: volume.sizeByte, + sizeByte: volume.sizeByte * 1024 * 1024 * 1024, serverId: volume.serverId, linuxDevice: volume.linuxDevice, ), @@ -676,7 +676,7 @@ class HetznerServerProvider extends ServerProvider { volume = ServerVolume( id: result.data!.id, name: result.data!.name, - sizeByte: result.data!.sizeByte, + sizeByte: result.data!.sizeByte * 1024 * 1024 * 1024, serverId: result.data!.serverId, linuxDevice: result.data!.linuxDevice, ); @@ -716,11 +716,11 @@ class HetznerServerProvider extends ServerProvider { try { for (final rawVolume in result.data) { - final int volumeId = rawVolume['id']; - final int volumeSize = rawVolume['size'] * 1024 * 1024 * 1024; - final volumeServer = rawVolume['server']; - final String volumeName = rawVolume['name']; - final volumeDevice = rawVolume['linux_device']; + final int volumeId = rawVolume.id; + final int volumeSize = rawVolume.sizeByte * 1024 * 1024 * 1024; + final volumeServer = rawVolume.serverId; + final String volumeName = rawVolume.name; + final volumeDevice = rawVolume.linuxDevice; final volume = ServerVolume( id: volumeId, name: volumeName, From 49fe40bb38637c4c6e6c19ee94ffcc8d2bf9b481 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 7 Jun 2023 00:09:39 -0300 Subject: [PATCH 70/96] chore: Implement better Price abstraction for Hetzner server provider --- .../server_providers/hetzner/hetzner_api.dart | 20 +++++----- .../providers/server_providers/hetzner.dart | 37 +++++++++++++++++-- .../server_providers/server_provider.dart | 2 +- 3 files changed, 44 insertions(+), 15 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart index 6cddfa22..9b8fd30b 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart @@ -7,9 +7,7 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_pro import 'package:selfprivacy/logic/api_maps/staging_options.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart'; -import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; -import 'package:selfprivacy/logic/models/price.dart'; import 'package:selfprivacy/utils/password_generator.dart'; class HetznerApi extends ServerProviderApi with VolumeProviderApi { @@ -106,7 +104,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { length: 64, ); - Future getPricePerGb() async { + Future> getPricePerGb() async { double? price; final Response pricingResponse; @@ -119,16 +117,16 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { price = double.parse(volumePrice); } catch (e) { print(e); + return GenericResult( + success: false, + data: price, + message: e.toString(), + ); } finally { client.close(); } - return price == null - ? null - : Price( - value: price, - currency: 'EUR', - ); + return GenericResult(success: true, data: price); } Future> createVolume() async { @@ -252,7 +250,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { } Future> attachVolume( - final ServerVolume volume, + final HetznerVolume volume, final int serverId, ) async { bool success = false; @@ -312,7 +310,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { } Future> resizeVolume( - final ServerVolume volume, + final HetznerVolume volume, final DiskSize size, ) async { bool success = false; diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index ceec065f..b9a3bbc8 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -756,7 +756,13 @@ class HetznerServerProvider extends ServerProvider { final int serverId, ) async => _adapter.api().attachVolume( - volume, + HetznerVolume( + volume.id, + volume.sizeByte, + volume.serverId, + volume.name, + volume.linuxDevice, + ), serverId, ); @@ -774,10 +780,35 @@ class HetznerServerProvider extends ServerProvider { final DiskSize size, ) async => _adapter.api().resizeVolume( - volume, + HetznerVolume( + volume.id, + volume.sizeByte, + volume.serverId, + volume.name, + volume.linuxDevice, + ), size, ); @override - Future getPricePerGb() async => _adapter.api().getPricePerGb(); + Future> getPricePerGb() async { + final result = await _adapter.api().getPricePerGb(); + + if (!result.success || result.data == null) { + return GenericResult( + data: null, + success: false, + message: result.message, + code: result.code, + ); + } + + return GenericResult( + success: true, + data: Price( + value: result.data!, + currency: 'EUR', + ), + ); + } } diff --git a/lib/logic/providers/server_providers/server_provider.dart b/lib/logic/providers/server_providers/server_provider.dart index f1004192..b48662bf 100644 --- a/lib/logic/providers/server_providers/server_provider.dart +++ b/lib/logic/providers/server_providers/server_provider.dart @@ -37,7 +37,7 @@ abstract class ServerProvider { final DateTime end, ); - Future getPricePerGb(); + Future> getPricePerGb(); Future>> getVolumes({final String? status}); Future> createVolume(); Future> deleteVolume(final ServerVolume volume); From fa4939d7c62db219577283aed3c8f068f5b54e11 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 7 Jun 2023 00:11:36 -0300 Subject: [PATCH 71/96] chore: Implement better Price abstraction for Digital Ocean server provider --- .../cubit/provider_volumes/provider_volume_cubit.dart | 2 +- lib/logic/providers/server_providers/digital_ocean.dart | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart index 43bd7005..46137c59 100644 --- a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart +++ b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart @@ -27,7 +27,7 @@ class ApiProviderVolumeCubit } Future getPricePerGb() async => - ProvidersController.currentServerProvider!.getPricePerGb(); + (await ProvidersController.currentServerProvider!.getPricePerGb()).data; Future refresh() async { emit(const ApiProviderVolumeState([], LoadingStatus.refreshing, false)); diff --git a/lib/logic/providers/server_providers/digital_ocean.dart b/lib/logic/providers/server_providers/digital_ocean.dart index a745434d..67808d6e 100644 --- a/lib/logic/providers/server_providers/digital_ocean.dart +++ b/lib/logic/providers/server_providers/digital_ocean.dart @@ -779,9 +779,12 @@ class DigitalOceanServerProvider extends ServerProvider { /// Hardcoded on their documentation and there is no pricing API at all /// Probably we should scrap the doc page manually @override - Future getPricePerGb() async => Price( - value: 0.10, - currency: 'USD', + Future> getPricePerGb() async => GenericResult( + success: true, + data: Price( + value: 0.10, + currency: 'USD', + ), ); @override From 875a9e2e86d755a31e9e250ca64956f31c5138da Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 7 Jun 2023 00:20:42 -0300 Subject: [PATCH 72/96] chore: Replace dynamic blobs with HetznerServerInfo --- .../rest_maps/server_providers/hetzner/hetzner_api.dart | 8 ++++++-- lib/logic/providers/server_providers/hetzner.dart | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart index 9b8fd30b..f0f87bce 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart @@ -343,7 +343,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { ); } - Future createServer({ + Future> createServer({ required final String dnsApiToken, required final String dnsProviderType, required final String serverApiToken, @@ -357,6 +357,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { }) async { final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false'; Response? serverCreateResponse; + HetznerServerInfo? serverInfo; DioError? hetznerError; bool success = false; @@ -383,6 +384,9 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { print('Decoded data: $data'); serverCreateResponse = await client.post('/servers', data: data); + serverInfo = HetznerServerInfo.fromJson( + serverCreateResponse.data['server'], + ); success = true; } on DioError catch (e) { print(e); @@ -400,7 +404,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { } return GenericResult( - data: serverCreateResponse?.data, + data: serverInfo, success: success && hetznerError == null, code: serverCreateResponse?.statusCode ?? hetznerError?.response?.statusCode, diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index b9a3bbc8..c74b83cc 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -526,8 +526,8 @@ class HetznerServerProvider extends ServerProvider { } final serverDetails = ServerHostingDetails( - id: serverResult.data['server']['id'], - ip4: serverResult.data['server']['public_net']['ipv4']['ip'], + id: serverResult.data!.id, + ip4: serverResult.data!.publicNet.ipv4!.ip, createTime: DateTime.now(), volume: ServerVolume( id: volume.id, From f42e415633792f8eb3dea326af7502d64fb91e0b Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 7 Jun 2023 00:25:34 -0300 Subject: [PATCH 73/96] chore: Replace dynamic blobs with HetznerLocation --- .../server_providers/hetzner/hetzner_api.dart | 13 ++++++------- lib/logic/models/json/hetzner_server_info.dart | 9 ++++++++- lib/logic/providers/server_providers/hetzner.dart | 10 +++++----- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart index f0f87bce..7dc1bd28 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart @@ -526,16 +526,15 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { return GenericResult(data: servers, success: true); } - Future> getAvailableLocations() async { - List locations = []; + Future>> getAvailableLocations() async { + final List locations = []; final Dio client = await getClient(); try { - final Response response = await client.get( - '/locations', - ); - - locations = response.data!['locations']; + final Response response = await client.get('/locations'); + for (final location in response.data!['locations']) { + locations.add(HetznerLocation.fromJson(location)); + } } catch (e) { print(e); return GenericResult( diff --git a/lib/logic/models/json/hetzner_server_info.dart b/lib/logic/models/json/hetzner_server_info.dart index 96838b4e..0078a6ff 100644 --- a/lib/logic/models/json/hetzner_server_info.dart +++ b/lib/logic/models/json/hetzner_server_info.dart @@ -118,7 +118,14 @@ class HetznerPriceInfo { @JsonSerializable() class HetznerLocation { - HetznerLocation(this.country, this.city, this.description, this.zone); + HetznerLocation( + this.country, + this.city, + this.description, + this.zone, + this.name, + ); + final String name; final String country; final String city; final String description; diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index c74b83cc..e9fcccbf 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -116,15 +116,15 @@ class HetznerServerProvider extends ServerProvider { ); } - final List rawLocations = result.data; + final List rawLocations = result.data; for (final rawLocation in rawLocations) { ServerProviderLocation? location; try { location = ServerProviderLocation( - title: rawLocation['city'], - description: rawLocation['description'], - flag: getEmojiFlag(rawLocation['country']), - identifier: rawLocation['name'], + title: rawLocation.city, + description: rawLocation.description, + flag: getEmojiFlag(rawLocation.country), + identifier: rawLocation.name, ); } catch (e) { continue; From 140acaee49cd73dcc0446db34ed9bee9403a4d60 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 7 Jun 2023 03:22:27 -0300 Subject: [PATCH 74/96] chore: Implement basic Digital Ocean server models --- .../digital_ocean/digital_ocean_api.dart | 35 ++++++++++------ .../json/digital_ocean_server_info.dart | 39 +++++++++++++++++ .../json/digital_ocean_server_info.g.dart | 37 ++++++++++++++++ .../models/json/hetzner_server_info.g.dart | 8 ++++ .../server_providers/digital_ocean.dart | 42 +++++++++---------- 5 files changed, 128 insertions(+), 33 deletions(-) create mode 100644 lib/logic/models/json/digital_ocean_server_info.dart create mode 100644 lib/logic/models/json/digital_ocean_server_info.g.dart diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart index 2a4153c1..19d99a6c 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart @@ -7,7 +7,7 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_pro import 'package:selfprivacy/logic/api_maps/staging_options.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; -import 'package:selfprivacy/logic/models/server_provider_location.dart'; +import 'package:selfprivacy/logic/models/json/digital_ocean_server_info.dart'; import 'package:selfprivacy/utils/password_generator.dart'; class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { @@ -98,7 +98,8 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { ); } - Future createVolume() async { + Future> createVolume() async { + DigitalOceanVolume? volume; Response? createVolumeResponse; final Dio client = await getClient(); try { @@ -114,6 +115,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { 'filesystem_type': 'ext4', }, ); + volume = DigitalOceanVolume.fromJson(createVolumeResponse.data['volume']); } catch (e) { print(e); return GenericResult( @@ -126,15 +128,17 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { } return GenericResult( - data: createVolumeResponse.data, + data: volume, success: true, code: createVolumeResponse.statusCode, message: createVolumeResponse.statusMessage, ); } - Future> getVolumes({final String? status}) async { - List volumes = []; + Future>> getVolumes({ + final String? status, + }) async { + final List volumes = []; Response? getVolumesResponse; final Dio client = await getClient(); @@ -145,7 +149,9 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { 'status': status, }, ); - volumes = getVolumesResponse.data['volumes']; + for (final volume in getVolumesResponse.data['volumes']) { + volumes.add(DigitalOceanVolume.fromJson(volume)); + } } catch (e) { print(e); return GenericResult( @@ -159,7 +165,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { return GenericResult( data: volumes, - success: false, + success: true, ); } @@ -297,7 +303,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { ); } - Future createServer({ + Future> createServer({ required final String dnsApiToken, required final String dnsProviderType, required final String serverApiToken, @@ -310,6 +316,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { }) async { final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false'; + int? dropletId; Response? serverCreateResponse; final Dio client = await getClient(); try { @@ -331,6 +338,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { '/droplets', data: data, ); + dropletId = serverCreateResponse.data['droplet']['id']; } catch (e) { print(e); return GenericResult( @@ -343,7 +351,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { } return GenericResult( - data: serverCreateResponse, + data: dropletId, success: true, code: serverCreateResponse.statusCode, message: serverCreateResponse.statusMessage, @@ -502,8 +510,9 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { return GenericResult(success: true, data: servers); } - Future> getAvailableLocations() async { - List locations = []; + Future>> + getAvailableLocations() async { + final List locations = []; final Dio client = await getClient(); try { @@ -511,7 +520,9 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { '/regions', ); - locations = response.data!['regions']; + for (final region in response.data!['regions']) { + locations.add(DigitalOceanLocation.fromJson(region)); + } } catch (e) { print(e); return GenericResult( diff --git a/lib/logic/models/json/digital_ocean_server_info.dart b/lib/logic/models/json/digital_ocean_server_info.dart new file mode 100644 index 00000000..ee9e9162 --- /dev/null +++ b/lib/logic/models/json/digital_ocean_server_info.dart @@ -0,0 +1,39 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'digital_ocean_server_info.g.dart'; + +@JsonSerializable() +class DigitalOceanVolume { + DigitalOceanVolume( + this.id, + this.name, + this.sizeGigabytes, + this.dropletIds, + ); + + final String id; + final String name; + + @JsonKey(name: 'droplet_ids') + final List dropletIds; + + @JsonKey(name: 'size_gigabytes') + final int sizeGigabytes; + + static DigitalOceanVolume fromJson(final Map json) => + _$DigitalOceanVolumeFromJson(json); +} + +@JsonSerializable() +class DigitalOceanLocation { + DigitalOceanLocation( + this.slug, + this.name, + ); + + final String slug; + final String name; + + static DigitalOceanLocation fromJson(final Map json) => + _$DigitalOceanLocationFromJson(json); +} diff --git a/lib/logic/models/json/digital_ocean_server_info.g.dart b/lib/logic/models/json/digital_ocean_server_info.g.dart new file mode 100644 index 00000000..6a6a9b45 --- /dev/null +++ b/lib/logic/models/json/digital_ocean_server_info.g.dart @@ -0,0 +1,37 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'digital_ocean_server_info.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DigitalOceanVolume _$DigitalOceanVolumeFromJson(Map json) => + DigitalOceanVolume( + json['id'] as String, + json['name'] as String, + json['size_gigabytes'] as int, + (json['droplet_ids'] as List).map((e) => e as int).toList(), + ); + +Map _$DigitalOceanVolumeToJson(DigitalOceanVolume instance) => + { + 'id': instance.id, + 'name': instance.name, + 'droplet_ids': instance.dropletIds, + 'size_gigabytes': instance.sizeGigabytes, + }; + +DigitalOceanLocation _$DigitalOceanLocationFromJson( + Map json) => + DigitalOceanLocation( + json['slug'] as String, + json['name'] as String, + ); + +Map _$DigitalOceanLocationToJson( + DigitalOceanLocation instance) => + { + 'slug': instance.slug, + 'name': instance.name, + }; diff --git a/lib/logic/models/json/hetzner_server_info.g.dart b/lib/logic/models/json/hetzner_server_info.g.dart index 7cc08abc..74607bad 100644 --- a/lib/logic/models/json/hetzner_server_info.g.dart +++ b/lib/logic/models/json/hetzner_server_info.g.dart @@ -81,6 +81,8 @@ HetznerServerTypeInfo _$HetznerServerTypeInfoFromJson( (json['prices'] as List) .map((e) => HetznerPriceInfo.fromJson(e as Map)) .toList(), + json['name'] as String, + json['description'] as String, ); Map _$HetznerServerTypeInfoToJson( @@ -89,6 +91,8 @@ Map _$HetznerServerTypeInfoToJson( 'cores': instance.cores, 'memory': instance.memory, 'disk': instance.disk, + 'name': instance.name, + 'description': instance.description, 'prices': instance.prices, }; @@ -96,12 +100,14 @@ HetznerPriceInfo _$HetznerPriceInfoFromJson(Map json) => HetznerPriceInfo( HetznerPriceInfo.getPrice(json['price_hourly'] as Map), HetznerPriceInfo.getPrice(json['price_monthly'] as Map), + json['location'] as String, ); Map _$HetznerPriceInfoToJson(HetznerPriceInfo instance) => { 'price_hourly': instance.hourly, 'price_monthly': instance.monthly, + 'location': instance.location, }; HetznerLocation _$HetznerLocationFromJson(Map json) => @@ -110,10 +116,12 @@ HetznerLocation _$HetznerLocationFromJson(Map json) => json['city'] as String, json['description'] as String, json['network_zone'] as String, + json['name'] as String, ); Map _$HetznerLocationToJson(HetznerLocation instance) => { + 'name': instance.name, 'country': instance.country, 'city': instance.city, 'description': instance.description, diff --git a/lib/logic/providers/server_providers/digital_ocean.dart b/lib/logic/providers/server_providers/digital_ocean.dart index 67808d6e..53c24df7 100644 --- a/lib/logic/providers/server_providers/digital_ocean.dart +++ b/lib/logic/providers/server_providers/digital_ocean.dart @@ -6,6 +6,7 @@ import 'package:selfprivacy/logic/models/callback_dialogue_branching.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; +import 'package:selfprivacy/logic/models/json/digital_ocean_server_info.dart'; import 'package:selfprivacy/logic/models/metrics.dart'; import 'package:selfprivacy/logic/models/price.dart'; import 'package:selfprivacy/logic/models/server_basic_info.dart'; @@ -179,10 +180,13 @@ class DigitalOceanServerProvider extends ServerProvider { } try { - final int dropletId = serverResult.data['droplet']['id']; - final ServerVolume? newVolume = (await createVolume()).data; - final bool attachedVolume = - (await attachVolume(newVolume!, dropletId)).data; + final int dropletId = serverResult.data!; + final newVolume = (await createVolume()).data; + final bool attachedVolume = (await _adapter.api().attachVolume( + newVolume!.name, + dropletId, + )) + .data; String? ipv4; int attempts = 0; @@ -253,15 +257,15 @@ class DigitalOceanServerProvider extends ServerProvider { ); } - final List rawLocations = result.data; + final List rawLocations = result.data; for (final rawLocation in rawLocations) { ServerProviderLocation? location; try { location = ServerProviderLocation( - title: rawLocation['slug'], - description: rawLocation['name'], - flag: getEmojiFlag(rawLocation['slug']), - identifier: rawLocation['slug'], + title: rawLocation.slug, + description: rawLocation.name, + flag: getEmojiFlag(rawLocation.slug), + identifier: rawLocation.slug, ); } catch (e) { continue; @@ -638,17 +642,15 @@ class DigitalOceanServerProvider extends ServerProvider { try { int id = 0; for (final rawVolume in result.data) { - final volumeId = rawVolume['id']; - final int volumeSize = rawVolume['size_gigabytes'] * 1024 * 1024 * 1024; - final volumeDropletIds = rawVolume['droplet_ids']; - final String volumeName = rawVolume['name']; + final String volumeName = rawVolume.name; final volume = ServerVolume( id: id++, name: volumeName, - sizeByte: volumeSize, - serverId: volumeDropletIds.isNotEmpty ? volumeDropletIds[0] : null, + sizeByte: rawVolume.sizeGigabytes * 1024 * 1024 * 1024, + serverId: + rawVolume.dropletIds.isNotEmpty ? rawVolume.dropletIds[0] : null, linuxDevice: 'scsi-0DO_Volume_$volumeName', - uuid: volumeId, + uuid: rawVolume.id, ); volumes.add(volume); } @@ -693,16 +695,14 @@ class DigitalOceanServerProvider extends ServerProvider { ); } - final volumeId = result.data['volume']['id']; - final volumeSize = result.data['volume']['size_gigabytes']; - final volumeName = result.data['volume']['name']; + final String volumeName = result.data!.name; volume = ServerVolume( id: getVolumesResult.data.length, name: volumeName, - sizeByte: volumeSize, + sizeByte: result.data!.sizeGigabytes, serverId: null, linuxDevice: '/dev/disk/by-id/scsi-0DO_Volume_$volumeName', - uuid: volumeId, + uuid: result.data!.id, ); return GenericResult( From 9d62d3af8e69bc001b6a6d3c60cb80c95fef6702 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 9 Jun 2023 04:10:15 -0300 Subject: [PATCH 75/96] chore: Merge master into refactoring --- lib/logic/api_maps/rest_maps/backblaze.dart | 6 +- .../server_installation_repository.dart | 69 ++++++------------- pubspec.lock | 8 --- pubspec.yaml | 1 - 4 files changed, 27 insertions(+), 57 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/backblaze.dart b/lib/logic/api_maps/rest_maps/backblaze.dart index 6fe5cd8e..6ce8914e 100644 --- a/lib/logic/api_maps/rest_maps/backblaze.dart +++ b/lib/logic/api_maps/rest_maps/backblaze.dart @@ -30,7 +30,11 @@ class BackblazeApi extends ApiMap { @override BaseOptions get options { - final BaseOptions options = BaseOptions(baseUrl: rootAddress); + final BaseOptions options = BaseOptions( + baseUrl: rootAddress, + contentType: Headers.jsonContentType, + responseType: ResponseType.json, + ); if (isWithToken) { final BackblazeCredential? backblazeCredential = getIt().backblazeCredential; diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 9444718e..a9122b33 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'dart:io'; -import 'package:basic_utils/basic_utils.dart'; import 'package:device_info_plus/device_info_plus.dart'; import 'package:dio/dio.dart'; import 'package:easy_localization/easy_localization.dart'; @@ -20,7 +19,6 @@ import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; import 'package:selfprivacy/logic/models/json/device_token.dart'; -import 'package:selfprivacy/logic/models/message.dart'; import 'package:selfprivacy/logic/models/server_basic_info.dart'; import 'package:selfprivacy/logic/models/server_type.dart'; import 'package:selfprivacy/logic/providers/providers_controller.dart'; @@ -187,46 +185,20 @@ class ServerInstallationRepository { final String? ip4, final Map skippedMatches, ) async { - final List addresses = [ - '$domainName', - 'api.$domainName', - 'cloud.$domainName', - 'meet.$domainName', - 'password.$domainName' - ]; - final Map matches = {}; - - for (final String address in addresses) { - if (skippedMatches[address] ?? false) { - matches[address] = true; - continue; - } - final List? lookupRecordRes = await DnsUtils.lookupRecord( - address, - RRecordType.A, - provider: DnsApiProvider.CLOUDFLARE, - ); - getIt.get().addMessage( - Message( - text: - 'DnsLookup: address: $address, $RRecordType, provider: CLOUDFLARE, ip4: $ip4', - ), - ); - getIt.get().addMessage( - Message( - text: - 'DnsLookup: ${lookupRecordRes == null ? 'empty' : (lookupRecordRes[0].data != ip4 ? 'wrong ip4' : 'right ip4')}', - ), - ); - if (lookupRecordRes == null || - lookupRecordRes.isEmpty || - lookupRecordRes[0].data != ip4) { - matches[address] = false; - } else { - matches[address] = true; - } - } + await InternetAddress.lookup(domainName!).then( + (final records) { + for (final record in records) { + if (skippedMatches[record.host] ?? false) { + matches[record.host] = true; + continue; + } + if (record.address == ip4!) { + matches[record.host] = true; + } + } + }, + ); return matches; } @@ -351,15 +323,18 @@ class ServerInstallationRepository { } Future getServerIpFromDomain(final ServerDomain serverDomain) async { - final List? lookup = await DnsUtils.lookupRecord( - serverDomain.domainName, - RRecordType.A, - provider: DnsApiProvider.CLOUDFLARE, + String? domain; + await InternetAddress.lookup(serverDomain.domainName).then( + (final records) { + for (final record in records) { + domain = record.address; + } + }, ); - if (lookup == null || lookup.isEmpty) { + if (domain == null || domain!.isEmpty) { throw IpNotFoundException('No IP found for domain $serverDomain'); } - return lookup[0].data; + return domain!; } Future getDeviceName() async { diff --git a/pubspec.lock b/pubspec.lock index bd81200b..d812a890 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -73,14 +73,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.0" - basic_utils: - dependency: "direct main" - description: - name: basic_utils - sha256: "8815477fcf58499e42326bd858e391442425fa57db9a45e48e15224c62049262" - url: "https://pub.dev" - source: hosted - version: "5.5.4" bloc: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index b0554aba..4e5e35d7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,6 @@ dependencies: animations: ^2.0.7 auto_route: ^7.3.2 auto_size_text: ^3.0.0 - basic_utils: ^5.5.4 crypt: ^4.3.0 cubit_form: ^2.0.1 device_info_plus: ^9.0.2 From 55f62f120085ed17a221264fd003e9eeec8699a0 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 9 Jun 2023 05:11:42 -0300 Subject: [PATCH 76/96] fix: Change sizeByte field to size for HetznerVolume --- lib/logic/models/json/hetzner_server_info.dart | 4 ++-- lib/logic/models/json/hetzner_server_info.g.dart | 4 ++-- lib/logic/providers/server_providers/hetzner.dart | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/logic/models/json/hetzner_server_info.dart b/lib/logic/models/json/hetzner_server_info.dart index 0078a6ff..b0706599 100644 --- a/lib/logic/models/json/hetzner_server_info.dart +++ b/lib/logic/models/json/hetzner_server_info.dart @@ -141,13 +141,13 @@ class HetznerLocation { class HetznerVolume { HetznerVolume( this.id, - this.sizeByte, + this.size, this.serverId, this.name, this.linuxDevice, ); final int id; - final int sizeByte; + final int size; final int? serverId; final String name; diff --git a/lib/logic/models/json/hetzner_server_info.g.dart b/lib/logic/models/json/hetzner_server_info.g.dart index 74607bad..b73a0a9d 100644 --- a/lib/logic/models/json/hetzner_server_info.g.dart +++ b/lib/logic/models/json/hetzner_server_info.g.dart @@ -131,7 +131,7 @@ Map _$HetznerLocationToJson(HetznerLocation instance) => HetznerVolume _$HetznerVolumeFromJson(Map json) => HetznerVolume( json['id'] as int, - json['sizeByte'] as int, + json['size'] as int, json['serverId'] as int?, json['name'] as String, json['linux_device'] as String?, @@ -140,7 +140,7 @@ HetznerVolume _$HetznerVolumeFromJson(Map json) => Map _$HetznerVolumeToJson(HetznerVolume instance) => { 'id': instance.id, - 'sizeByte': instance.sizeByte, + 'size': instance.size, 'serverId': instance.serverId, 'name': instance.name, 'linux_device': instance.linuxDevice, diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index e9fcccbf..032bd90f 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -532,7 +532,7 @@ class HetznerServerProvider extends ServerProvider { volume: ServerVolume( id: volume.id, name: volume.name, - sizeByte: volume.sizeByte * 1024 * 1024 * 1024, + sizeByte: volume.size * 1024 * 1024 * 1024, serverId: volume.serverId, linuxDevice: volume.linuxDevice, ), @@ -676,7 +676,7 @@ class HetznerServerProvider extends ServerProvider { volume = ServerVolume( id: result.data!.id, name: result.data!.name, - sizeByte: result.data!.sizeByte * 1024 * 1024 * 1024, + sizeByte: result.data!.size * 1024 * 1024 * 1024, serverId: result.data!.serverId, linuxDevice: result.data!.linuxDevice, ); @@ -717,7 +717,7 @@ class HetznerServerProvider extends ServerProvider { try { for (final rawVolume in result.data) { final int volumeId = rawVolume.id; - final int volumeSize = rawVolume.sizeByte * 1024 * 1024 * 1024; + final int volumeSize = rawVolume.size * 1024 * 1024 * 1024; final volumeServer = rawVolume.serverId; final String volumeName = rawVolume.name; final volumeDevice = rawVolume.linuxDevice; From bfd67bac8d1f718925b3579859402e801e151f14 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 9 Jun 2023 06:13:16 -0300 Subject: [PATCH 77/96] fix: Change .id field to ['id'] for DnsRecord in Digital Ocean DNS --- .../dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart index a6927e24..992e6766 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart @@ -105,7 +105,7 @@ class DigitalOceanDnsApi extends DnsProviderApi { final List allDeleteFutures = []; for (final record in records) { allDeleteFutures.add( - client.delete('/domains/$domainName/records/${record.id}'), + client.delete("/domains/$domainName/records/${record['id']}"), ); } await Future.wait(allDeleteFutures); From 8d8e8cf265521c20e00d38c18650fbe0c9797e1f Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 9 Jun 2023 07:19:24 -0300 Subject: [PATCH 78/96] fix: Change spf1 record from domainName to '@' for Digital Ocean DNS --- lib/logic/providers/dns_providers/digital_ocean_dns.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/logic/providers/dns_providers/digital_ocean_dns.dart b/lib/logic/providers/dns_providers/digital_ocean_dns.dart index b231c414..e72c48fc 100644 --- a/lib/logic/providers/dns_providers/digital_ocean_dns.dart +++ b/lib/logic/providers/dns_providers/digital_ocean_dns.dart @@ -247,7 +247,7 @@ class DigitalOceanDnsProvider extends DnsProvider { final DnsRecord txt2 = DnsRecord( type: 'TXT', - name: domainName, + name: '@', content: 'v=spf1 a mx ip4:$ip4 -all', ttl: 18000, ); From f6424200e20525e7a2cc72b73537feedbdedf153 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 12 Jun 2023 23:48:29 -0300 Subject: [PATCH 79/96] chore: Implement basic DigitalOceanServerType model --- .../digital_ocean/digital_ocean_api.dart | 11 +++++--- .../server_providers/hetzner/hetzner_api.dart | 2 +- .../json/digital_ocean_server_info.dart | 26 +++++++++++++++++++ .../json/digital_ocean_server_info.g.dart | 24 +++++++++++++++++ .../server_providers/digital_ocean.dart | 19 +++++++------- 5 files changed, 67 insertions(+), 15 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart index 19d99a6c..f95047ae 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart @@ -326,7 +326,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { 'image': 'ubuntu-20-04-x64', 'user_data': '#cloud-config\n' 'runcmd:\n' - '- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/providers/digital-ocean/nixos-infect | ' + '- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/testing/final-digital-ocean/nixos-infect | ' "PROVIDER=$infectProviderName DNS_PROVIDER_TYPE=$dnsProviderType STAGING_ACME='$stagingAcme' DOMAIN='$domainName' " "LUSER='${rootUser.login}' ENCODED_PASSWORD='$base64Password' CF_TOKEN=$dnsApiToken DB_PASSWORD=$databasePassword " 'API_TOKEN=$serverApiToken HOSTNAME=$hostName bash 2>&1 | tee /tmp/infect.log', @@ -537,15 +537,18 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { return GenericResult(data: locations, success: true); } - Future> getAvailableServerTypes() async { - List types = []; + Future>> + getAvailableServerTypes() async { + final List types = []; final Dio client = await getClient(); try { final Response response = await client.get( '/sizes', ); - types = response.data!['sizes']; + for (final size in response.data!['sizes']) { + types.add(DigitalOceanServerType.fromJson(size)); + } } catch (e) { print(e); return GenericResult( diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart index 7dc1bd28..77507cb7 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart @@ -372,7 +372,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { 'networks': [], 'user_data': '#cloud-config\n' 'runcmd:\n' - '- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/providers/hetzner/nixos-infect | ' + '- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/testing/final-hetzner/nixos-infect | ' "STAGING_ACME='$stagingAcme' PROVIDER=$infectProviderName DNS_PROVIDER_TYPE=$dnsProviderType " "NIX_CHANNEL=nixos-21.05 DOMAIN='$domainName' LUSER='${rootUser.login}' ENCODED_PASSWORD='$base64Password' " 'CF_TOKEN=$dnsApiToken DB_PASSWORD=$databasePassword API_TOKEN=$serverApiToken HOSTNAME=$hostName bash 2>&1 | ' diff --git a/lib/logic/models/json/digital_ocean_server_info.dart b/lib/logic/models/json/digital_ocean_server_info.dart index ee9e9162..2a6ace8c 100644 --- a/lib/logic/models/json/digital_ocean_server_info.dart +++ b/lib/logic/models/json/digital_ocean_server_info.dart @@ -37,3 +37,29 @@ class DigitalOceanLocation { static DigitalOceanLocation fromJson(final Map json) => _$DigitalOceanLocationFromJson(json); } + +@JsonSerializable() +class DigitalOceanServerType { + DigitalOceanServerType( + this.regions, + this.memory, + this.description, + this.disk, + this.priceMonthly, + this.slug, + this.vcpus, + ); + + final List regions; + final double memory; + final String slug; + final String description; + final int vcpus; + final int disk; + + @JsonKey(name: 'price_monthly') + final double priceMonthly; + + static DigitalOceanServerType fromJson(final Map json) => + _$DigitalOceanServerTypeFromJson(json); +} diff --git a/lib/logic/models/json/digital_ocean_server_info.g.dart b/lib/logic/models/json/digital_ocean_server_info.g.dart index 6a6a9b45..a0e707c9 100644 --- a/lib/logic/models/json/digital_ocean_server_info.g.dart +++ b/lib/logic/models/json/digital_ocean_server_info.g.dart @@ -35,3 +35,27 @@ Map _$DigitalOceanLocationToJson( 'slug': instance.slug, 'name': instance.name, }; + +DigitalOceanServerType _$DigitalOceanServerTypeFromJson( + Map json) => + DigitalOceanServerType( + (json['regions'] as List).map((e) => e as String).toList(), + (json['memory'] as num).toDouble(), + json['description'] as String, + json['disk'] as int, + (json['price_monthly'] as num).toDouble(), + json['slug'] as String, + json['vcpus'] as int, + ); + +Map _$DigitalOceanServerTypeToJson( + DigitalOceanServerType instance) => + { + 'regions': instance.regions, + 'memory': instance.memory, + 'slug': instance.slug, + 'description': instance.description, + 'vcpus': instance.vcpus, + 'disk': instance.disk, + 'price_monthly': instance.priceMonthly, + }; diff --git a/lib/logic/providers/server_providers/digital_ocean.dart b/lib/logic/providers/server_providers/digital_ocean.dart index 53c24df7..98b67a90 100644 --- a/lib/logic/providers/server_providers/digital_ocean.dart +++ b/lib/logic/providers/server_providers/digital_ocean.dart @@ -291,20 +291,19 @@ class DigitalOceanServerProvider extends ServerProvider { ); } - final List rawSizes = result.data; + final List rawSizes = result.data; for (final rawSize in rawSizes) { - for (final rawRegion in rawSize['regions']) { - final ramMb = rawSize['memory'].toDouble(); - if (rawRegion.toString() == location.identifier && ramMb > 1024) { + for (final rawRegion in rawSize.regions) { + if (rawRegion == location.identifier && rawSize.memory > 1024) { types.add( ServerType( - title: rawSize['description'], - identifier: rawSize['slug'], - ram: ramMb / 1024, - cores: rawSize['vcpus'], - disk: DiskSize(byte: rawSize['disk'] * 1024 * 1024 * 1024), + title: rawSize.description, + identifier: rawSize.slug, + ram: rawSize.memory / 1024, + cores: rawSize.vcpus, + disk: DiskSize(byte: rawSize.disk * 1024 * 1024 * 1024), price: Price( - value: rawSize['price_monthly'], + value: rawSize.priceMonthly, currency: 'USD', ), location: location, From 65283306a9a4085026d42736c161cc621aad6755 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 13 Jun 2023 23:36:02 -0300 Subject: [PATCH 80/96] fix: Make dropletIds field for DigitalOceanVolume optional --- lib/logic/models/json/digital_ocean_server_info.dart | 2 +- lib/logic/models/json/digital_ocean_server_info.g.dart | 2 +- lib/logic/providers/server_providers/digital_ocean.dart | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/logic/models/json/digital_ocean_server_info.dart b/lib/logic/models/json/digital_ocean_server_info.dart index 2a6ace8c..9351761d 100644 --- a/lib/logic/models/json/digital_ocean_server_info.dart +++ b/lib/logic/models/json/digital_ocean_server_info.dart @@ -15,7 +15,7 @@ class DigitalOceanVolume { final String name; @JsonKey(name: 'droplet_ids') - final List dropletIds; + final List? dropletIds; @JsonKey(name: 'size_gigabytes') final int sizeGigabytes; diff --git a/lib/logic/models/json/digital_ocean_server_info.g.dart b/lib/logic/models/json/digital_ocean_server_info.g.dart index a0e707c9..9610dbce 100644 --- a/lib/logic/models/json/digital_ocean_server_info.g.dart +++ b/lib/logic/models/json/digital_ocean_server_info.g.dart @@ -11,7 +11,7 @@ DigitalOceanVolume _$DigitalOceanVolumeFromJson(Map json) => json['id'] as String, json['name'] as String, json['size_gigabytes'] as int, - (json['droplet_ids'] as List).map((e) => e as int).toList(), + (json['droplet_ids'] as List?)?.map((e) => e as int).toList(), ); Map _$DigitalOceanVolumeToJson(DigitalOceanVolume instance) => diff --git a/lib/logic/providers/server_providers/digital_ocean.dart b/lib/logic/providers/server_providers/digital_ocean.dart index 98b67a90..209f33e5 100644 --- a/lib/logic/providers/server_providers/digital_ocean.dart +++ b/lib/logic/providers/server_providers/digital_ocean.dart @@ -647,7 +647,9 @@ class DigitalOceanServerProvider extends ServerProvider { name: volumeName, sizeByte: rawVolume.sizeGigabytes * 1024 * 1024 * 1024, serverId: - rawVolume.dropletIds.isNotEmpty ? rawVolume.dropletIds[0] : null, + (rawVolume.dropletIds != null && rawVolume.dropletIds!.isNotEmpty) + ? rawVolume.dropletIds![0] + : null, linuxDevice: 'scsi-0DO_Volume_$volumeName', uuid: rawVolume.id, ); From 2b1f6a12ea1ed7e81cedb4964d9e77fd9f3f6660 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 13 Jun 2023 23:47:06 -0300 Subject: [PATCH 81/96] fix: Change JSON parsing for Digital Ocean droplets --- .../server_providers/digital_ocean/digital_ocean_api.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart index f95047ae..46138b0c 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart @@ -495,7 +495,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { final Dio client = await getClient(); try { final Response response = await client.get('/droplets'); - servers = response.data; + servers = response.data['droplets']; } catch (e) { print(e); return GenericResult( From 69707f543f150446a3e6467d46541aa6ca3c496c Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 14 Jun 2023 14:56:07 -0300 Subject: [PATCH 82/96] fix: Properly convert Digital Ocean droplets to ServerBasicInfo --- .../server_providers/digital_ocean/digital_ocean_api.dart | 2 +- .../rest_maps/server_providers/hetzner/hetzner_api.dart | 2 +- lib/logic/providers/server_providers/digital_ocean.dart | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart index 46138b0c..1fcb46c5 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart @@ -326,7 +326,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { 'image': 'ubuntu-20-04-x64', 'user_data': '#cloud-config\n' 'runcmd:\n' - '- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/testing/final-digital-ocean/nixos-infect | ' + '- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/providers/digital-ocean/nixos-infect | ' "PROVIDER=$infectProviderName DNS_PROVIDER_TYPE=$dnsProviderType STAGING_ACME='$stagingAcme' DOMAIN='$domainName' " "LUSER='${rootUser.login}' ENCODED_PASSWORD='$base64Password' CF_TOKEN=$dnsApiToken DB_PASSWORD=$databasePassword " 'API_TOKEN=$serverApiToken HOSTNAME=$hostName bash 2>&1 | tee /tmp/infect.log', diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart index 77507cb7..7dc1bd28 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart @@ -372,7 +372,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { 'networks': [], 'user_data': '#cloud-config\n' 'runcmd:\n' - '- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/testing/final-hetzner/nixos-infect | ' + '- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/providers/hetzner/nixos-infect | ' "STAGING_ACME='$stagingAcme' PROVIDER=$infectProviderName DNS_PROVIDER_TYPE=$dnsProviderType " "NIX_CHANNEL=nixos-21.05 DOMAIN='$domainName' LUSER='${rootUser.login}' ENCODED_PASSWORD='$base64Password' " 'CF_TOKEN=$dnsApiToken DB_PASSWORD=$databasePassword API_TOKEN=$serverApiToken HOSTNAME=$hostName bash 2>&1 | ' diff --git a/lib/logic/providers/server_providers/digital_ocean.dart b/lib/logic/providers/server_providers/digital_ocean.dart index 209f33e5..66e474de 100644 --- a/lib/logic/providers/server_providers/digital_ocean.dart +++ b/lib/logic/providers/server_providers/digital_ocean.dart @@ -318,7 +318,7 @@ class DigitalOceanServerProvider extends ServerProvider { @override Future>> getServers() async { - final List servers = []; + List servers = []; final result = await _adapter.api().getServers(); if (result.data.isEmpty || !result.success) { return GenericResult( @@ -330,7 +330,7 @@ class DigitalOceanServerProvider extends ServerProvider { } final List rawServers = result.data; - rawServers.map( + servers = rawServers.map( (final server) { String ipv4 = '0.0.0.0'; if (server['networks']['v4'].isNotEmpty) { From 085c71748de5cf402b273023a69dec4e2182f8ff Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 14 Jun 2023 15:11:51 -0300 Subject: [PATCH 83/96] fix: Add currency to price tag on server info page --- lib/logic/providers/server_providers/digital_ocean.dart | 7 ++++--- lib/logic/providers/server_providers/hetzner.dart | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/logic/providers/server_providers/digital_ocean.dart b/lib/logic/providers/server_providers/digital_ocean.dart index 66e474de..65a7b124 100644 --- a/lib/logic/providers/server_providers/digital_ocean.dart +++ b/lib/logic/providers/server_providers/digital_ocean.dart @@ -46,6 +46,7 @@ class DigitalOceanServerProvider extends ServerProvider { ); ApiAdapter _adapter; + final String currency = 'USD'; @override ServerProviderType get type => ServerProviderType.digitalOcean; @@ -304,7 +305,7 @@ class DigitalOceanServerProvider extends ServerProvider { disk: DiskSize(byte: rawSize.disk * 1024 * 1024 * 1024), price: Price( value: rawSize.priceMonthly, - currency: 'USD', + currency: currency, ), location: location, ), @@ -399,7 +400,7 @@ class DigitalOceanServerProvider extends ServerProvider { ServerMetadataEntity( type: MetadataType.cost, trId: 'server.monthly_cost', - value: droplet['size']['price_monthly'].toString(), + value: '${droplet['size']['price_monthly']} $currency', ), ServerMetadataEntity( type: MetadataType.location, @@ -784,7 +785,7 @@ class DigitalOceanServerProvider extends ServerProvider { success: true, data: Price( value: 0.10, - currency: 'USD', + currency: currency, ), ); diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index 032bd90f..192674f5 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -46,6 +46,7 @@ class HetznerServerProvider extends ServerProvider { ); ApiAdapter _adapter; + final String currency = 'EUR'; @override ServerProviderType get type => ServerProviderType.hetzner; @@ -163,7 +164,7 @@ class HetznerServerProvider extends ServerProvider { disk: DiskSize(byte: rawType.disk * 1024 * 1024 * 1024), price: Price( value: rawPrice.monthly, - currency: 'EUR', + currency: currency, ), location: location, ), @@ -258,7 +259,8 @@ class HetznerServerProvider extends ServerProvider { ServerMetadataEntity( type: MetadataType.cost, trId: 'server.monthly_cost', - value: server.serverType.prices[1].monthly.toStringAsFixed(2), + value: + '${server.serverType.prices[1].monthly.toStringAsFixed(2)} $currency', ), ServerMetadataEntity( type: MetadataType.location, @@ -807,7 +809,7 @@ class HetznerServerProvider extends ServerProvider { success: true, data: Price( value: result.data!, - currency: 'EUR', + currency: currency, ), ); } From b46c53674b57b0e02a5591e8dac92423e739ab03 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Thu, 15 Jun 2023 13:48:23 -0300 Subject: [PATCH 84/96] feat: Implement new dialogue stub onChange --- .../server_installation_cubit.dart | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 6fa7d569..50c6b09a 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -19,6 +19,7 @@ import 'package:selfprivacy/logic/models/server_basic_info.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_repository.dart'; import 'package:selfprivacy/logic/models/server_provider_location.dart'; import 'package:selfprivacy/logic/models/server_type.dart'; +import 'package:selfprivacy/ui/helpers/modals.dart'; export 'package:provider/provider.dart'; @@ -723,6 +724,33 @@ class ServerInstallationCubit extends Cubit { @override void onChange(final Change change) { + if (change.currentState.installationDialoguePopUp != null && + change.currentState.installationDialoguePopUp != + state.installationDialoguePopUp) { + final branching = change.currentState.installationDialoguePopUp; + showPopUpAlert( + alertTitle: branching!.title, + description: branching.description, + actionButtonTitle: branching.choices[1].title, + actionButtonOnPressed: () async { + final branchingResult = await branching.choices[1].callback!(); + emit( + (state as ServerInstallationNotFinished).copyWith( + installationDialoguePopUp: branchingResult.data, + ), + ); + }, + cancelButtonTitle: branching.choices[0].title, + cancelButtonOnPressed: () async { + final branchingResult = await branching.choices[0].callback!(); + emit( + (state as ServerInstallationNotFinished).copyWith( + installationDialoguePopUp: branchingResult.data, + ), + ); + }, + ); + } super.onChange(change); } From 53e72504f7a269f8cdb388cdcea214c7884eb468 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 16 Jun 2023 05:59:48 +0300 Subject: [PATCH 85/96] refactor: Allow changing values for TLS settings --- assets/translations/en.json | 8 +++++--- assets/translations/ru.json | 6 +++--- lib/logic/api_maps/graphql_maps/api_map.dart | 4 ++-- .../digital_ocean/digital_ocean_api.dart | 4 ++-- .../server_providers/hetzner/hetzner_api.dart | 4 ++-- .../{staging_options.dart => tls_options.dart} | 4 ++-- .../server_installation_cubit.dart | 6 +++--- .../server_installation_repository.dart | 4 ++-- .../more/app_settings/developer_settings.dart | 17 ++++++++++++++--- 9 files changed, 35 insertions(+), 22 deletions(-) rename lib/logic/api_maps/{staging_options.dart => tls_options.dart} (89%) diff --git a/assets/translations/en.json b/assets/translations/en.json index 0ac7562e..b45e6ac2 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -493,7 +493,7 @@ "required": "Required", "already_exist": "Already exists", "invalid_format": "Invalid format", - "invalid_format_password": "Must not contain empty characters", + "invalid_format_password": "Password must not contain spaces", "invalid_format_ssh": "Must follow the SSH key format", "root_name": "Cannot be 'root'", "length_not_equal": "Length is [], should be {}", @@ -507,10 +507,12 @@ "subtitle": "These settings are for debugging only. Don't change them unless you know what you're doing.", "server_setup": "Server setup", "use_staging_acme": "Use staging ACME server", - "use_staging_acme_description": "Rebuild your app to change this value.", + "use_staging_acme_description": "Applies when setting up a new server.", + "ignore_tls": "Do not verify TLS certificates", + "ignore_tls_description": "App will not verify TLS certificates when connecting to the server.", "routing": "App routing", "reset_onboarding": "Reset onboarding switch", "reset_onboarding_description": "Reset onboarding switch to show onboarding screen again", "cubit_statuses": "Cubit loading statuses" } -} \ No newline at end of file +} diff --git a/assets/translations/ru.json b/assets/translations/ru.json index 8fdf0054..9b0c93ad 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -310,7 +310,7 @@ "no_server_types_found": "Не найдено доступных типов сервера! Пожалуйста, убедитесь, что у вас есть доступ к провайдеру сервера...", "dns_provider_bad_key_error": "API ключ неверен", "backblaze_bad_key_error": "Информация о Backblaze хранилище неверна", - "connect_to_dns": "Подключите DNS провайдер", + "connect_to_dns": "Подключите DNS провайдера", "connect_to_dns_provider_text": "С помощью API токена приложение SelfPrivacy настроит DNS записи", "manage_domain_dns": "Для управления DNS вашего домена", "use_this_domain": "Используем этот домен?", @@ -472,10 +472,10 @@ "required": "Обязательное поле", "already_exist": "Уже существует", "invalid_format": "Неверный формат", - "invalid_format_password": "Должен не содержать пустые символы", + "invalid_format_password": "Пароль не должен содержать пробелы", "invalid_format_ssh": "Должен следовать формату SSH ключей", "root_name": "Имя пользователя не может быть 'root'", "length_not_equal": "Длина строки [], должна быть равна {}", "length_longer": "Длина строки [], должна быть меньше либо равна {}" } -} \ No newline at end of file +} diff --git a/lib/logic/api_maps/graphql_maps/api_map.dart b/lib/logic/api_maps/graphql_maps/api_map.dart index 34e39b7a..32359f93 100644 --- a/lib/logic/api_maps/graphql_maps/api_map.dart +++ b/lib/logic/api_maps/graphql_maps/api_map.dart @@ -3,7 +3,7 @@ import 'dart:io'; import 'package:graphql_flutter/graphql_flutter.dart'; import 'package:http/io_client.dart'; import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/staging_options.dart'; +import 'package:selfprivacy/logic/api_maps/tls_options.dart'; import 'package:selfprivacy/logic/models/message.dart'; void _logToAppConsole(final T objectToLog) { @@ -56,7 +56,7 @@ class ResponseLoggingParser extends ResponseParser { abstract class ApiMap { Future getClient() async { IOClient? ioClient; - if (StagingOptions.stagingAcme || !StagingOptions.verifyCertificate) { + if (TlsOptions.stagingAcme || !TlsOptions.verifyCertificate) { final HttpClient httpClient = HttpClient(); httpClient.badCertificateCallback = ( final cert, diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart index 1fcb46c5..976ddb6b 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart @@ -4,7 +4,7 @@ import 'package:dio/dio.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/volume_provider.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; -import 'package:selfprivacy/logic/api_maps/staging_options.dart'; +import 'package:selfprivacy/logic/api_maps/tls_options.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; import 'package:selfprivacy/logic/models/json/digital_ocean_server_info.dart'; @@ -314,7 +314,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { required final String hostName, required final String serverType, }) async { - final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false'; + final String stagingAcme = TlsOptions.stagingAcme ? 'true' : 'false'; int? dropletId; Response? serverCreateResponse; diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart index 7dc1bd28..338c96dd 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart @@ -4,7 +4,7 @@ import 'package:dio/dio.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/volume_provider.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; -import 'package:selfprivacy/logic/api_maps/staging_options.dart'; +import 'package:selfprivacy/logic/api_maps/tls_options.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; @@ -355,7 +355,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { required final int volumeId, required final String serverType, }) async { - final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false'; + final String stagingAcme = TlsOptions.stagingAcme ? 'true' : 'false'; Response? serverCreateResponse; HetznerServerInfo? serverInfo; DioError? hetznerError; diff --git a/lib/logic/api_maps/staging_options.dart b/lib/logic/api_maps/tls_options.dart similarity index 89% rename from lib/logic/api_maps/staging_options.dart rename to lib/logic/api_maps/tls_options.dart index a4e98fe8..b216841c 100644 --- a/lib/logic/api_maps/staging_options.dart +++ b/lib/logic/api_maps/tls_options.dart @@ -1,11 +1,11 @@ /// Controls staging environment for network -class StagingOptions { +class TlsOptions { /// Whether we request for staging temprorary certificates. /// Hardcode to 'true' in the middle of testing to not /// get your domain banned by constant certificate renewal /// /// If set to 'true', the 'verifyCertificate' becomes useless - static bool get stagingAcme => false; + static bool stagingAcme = false; /// Should we consider CERTIFICATE_VERIFY_FAILED code an error /// For now it's just a global variable and DNS API diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 50c6b09a..714179ca 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -9,7 +9,7 @@ import 'package:selfprivacy/logic/models/callback_dialogue_branching.dart'; import 'package:selfprivacy/logic/models/launch_installation_data.dart'; import 'package:selfprivacy/logic/providers/provider_settings.dart'; import 'package:selfprivacy/logic/providers/providers_controller.dart'; -import 'package:selfprivacy/logic/api_maps/staging_options.dart'; +import 'package:selfprivacy/logic/api_maps/tls_options.dart'; import 'package:selfprivacy/logic/models/hive/backblaze_credential.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; @@ -407,7 +407,7 @@ class ServerInstallationCubit extends Cubit { emit(TimerState(dataState: dataState, isLoading: true)); final bool isServerWorking = await repository.isHttpServerWorking(); - StagingOptions.verifyCertificate = true; + TlsOptions.verifyCertificate = true; if (isServerWorking) { bool dkimCreated = true; @@ -757,7 +757,7 @@ class ServerInstallationCubit extends Cubit { void clearAppConfig() { closeTimer(); ProvidersController.clearProviders(); - StagingOptions.verifyCertificate = false; + TlsOptions.verifyCertificate = false; repository.clearAppConfig(); emit(const ServerInstallationEmpty()); } diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index a9122b33..96fa4d8d 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -12,7 +12,7 @@ import 'package:selfprivacy/config/hive_config.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; import 'package:selfprivacy/logic/providers/provider_settings.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server_api.dart'; -import 'package:selfprivacy/logic/api_maps/staging_options.dart'; +import 'package:selfprivacy/logic/api_maps/tls_options.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/models/hive/backblaze_credential.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; @@ -75,7 +75,7 @@ class ServerInstallationRepository { } if (box.get(BNames.hasFinalChecked, defaultValue: false)) { - StagingOptions.verifyCertificate = true; + TlsOptions.verifyCertificate = true; return ServerInstallationFinished( installationDialoguePopUp: null, providerApiToken: providerApiToken!, diff --git a/lib/ui/pages/more/app_settings/developer_settings.dart b/lib/ui/pages/more/app_settings/developer_settings.dart index 220cb791..c2a34916 100644 --- a/lib/ui/pages/more/app_settings/developer_settings.dart +++ b/lib/ui/pages/more/app_settings/developer_settings.dart @@ -1,6 +1,6 @@ import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; -import 'package:selfprivacy/logic/api_maps/staging_options.dart'; +import 'package:selfprivacy/logic/api_maps/tls_options.dart'; import 'package:selfprivacy/logic/cubit/app_settings/app_settings_cubit.dart'; import 'package:selfprivacy/logic/cubit/devices/devices_cubit.dart'; import 'package:selfprivacy/logic/cubit/recovery_key/recovery_key_cubit.dart'; @@ -37,8 +37,19 @@ class _DeveloperSettingsPageState extends State { title: Text('developer_settings.use_staging_acme'.tr()), subtitle: Text('developer_settings.use_staging_acme_description'.tr()), - value: StagingOptions.stagingAcme, - onChanged: null, + value: TlsOptions.stagingAcme, + onChanged: (final bool value) => setState( + () => TlsOptions.stagingAcme = value, + ), + ), + SwitchListTile( + title: Text('developer_settings.ignore_tls'.tr()), + subtitle: + Text('developer_settings.ignore_tls_description'.tr()), + value: TlsOptions.verifyCertificate, + onChanged: (final bool value) => setState( + () => TlsOptions.verifyCertificate = value, + ), ), Padding( padding: const EdgeInsets.all(16), From c87b8345503af6ba3a5deb081568ad1c902ed80b Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 16 Jun 2023 06:00:08 +0300 Subject: [PATCH 86/96] fix: dialogs during server setup --- .../server_installation/server_installation_cubit.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 714179ca..7b972acb 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -724,10 +724,10 @@ class ServerInstallationCubit extends Cubit { @override void onChange(final Change change) { - if (change.currentState.installationDialoguePopUp != null && + if (change.nextState.installationDialoguePopUp != null && change.currentState.installationDialoguePopUp != - state.installationDialoguePopUp) { - final branching = change.currentState.installationDialoguePopUp; + change.nextState.installationDialoguePopUp) { + final branching = change.nextState.installationDialoguePopUp; showPopUpAlert( alertTitle: branching!.title, description: branching.description, From 4adcca5746e1446e39f79b68d044562b160d08d1 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 16 Jun 2023 00:52:04 -0300 Subject: [PATCH 87/96] fix: Resolve timer conflicts on emultiple emits --- .../server_installation_cubit.dart | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 7b972acb..cf83fb81 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -231,6 +231,7 @@ class ServerInstallationCubit extends Cubit { (state as ServerInstallationNotFinished).copyWith( isLoading: false, serverDetails: serverDetails, + installationDialoguePopUp: null, ), ); runDelayed(startServerIfDnsIsOkay, const Duration(seconds: 30), null); @@ -734,20 +735,24 @@ class ServerInstallationCubit extends Cubit { actionButtonTitle: branching.choices[1].title, actionButtonOnPressed: () async { final branchingResult = await branching.choices[1].callback!(); - emit( - (state as ServerInstallationNotFinished).copyWith( - installationDialoguePopUp: branchingResult.data, - ), - ); + if (!branchingResult.success) { + emit( + (state as ServerInstallationNotFinished).copyWith( + installationDialoguePopUp: branchingResult.data, + ), + ); + } }, cancelButtonTitle: branching.choices[0].title, cancelButtonOnPressed: () async { final branchingResult = await branching.choices[0].callback!(); - emit( - (state as ServerInstallationNotFinished).copyWith( - installationDialoguePopUp: branchingResult.data, - ), - ); + if (!branchingResult.success) { + emit( + (state as ServerInstallationNotFinished).copyWith( + installationDialoguePopUp: branchingResult.data, + ), + ); + } }, ); } From 6337889ab76cf67b0aecd3e4fa5f71b756f0f106 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 19 Jun 2023 11:59:11 -0300 Subject: [PATCH 88/96] chore: Remove unneeded files --- .../cloudflare/cloudflare_api_factory.dart | 16 --------- .../desec/desec_api_factory.dart | 16 --------- .../digital_ocean_dns_api_factory.dart | 16 --------- .../dns_provider_api_settings.dart | 10 ------ .../dns_providers/dns_provider_factory.dart | 8 ----- .../rest_maps/provider_api_settings.dart | 8 ----- .../digital_ocean_api_factory.dart | 34 ------------------- .../hetzner/hetzner_api_factory.dart | 34 ------------------- .../server_provider_api_settings.dart | 11 ------ .../server_provider_factory.dart | 15 -------- 10 files changed, 168 deletions(-) delete mode 100644 lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api_factory.dart delete mode 100644 lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api_factory.dart delete mode 100644 lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api_factory.dart delete mode 100644 lib/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart delete mode 100644 lib/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart delete mode 100644 lib/logic/api_maps/rest_maps/provider_api_settings.dart delete mode 100644 lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api_factory.dart delete mode 100644 lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api_factory.dart delete mode 100644 lib/logic/api_maps/rest_maps/server_providers/server_provider_api_settings.dart delete mode 100644 lib/logic/api_maps/rest_maps/server_providers/server_provider_factory.dart diff --git a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api_factory.dart b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api_factory.dart deleted file mode 100644 index ba5bd703..00000000 --- a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api_factory.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart'; - -class CloudflareApiFactory extends DnsProviderApiFactory { - @override - DnsProviderApi getDnsProvider({ - final DnsProviderApiSettings settings = const DnsProviderApiSettings(), - }) => - CloudflareApi( - hasLogger: settings.hasLogger, - isWithToken: settings.isWithToken, - customToken: settings.customToken, - ); -} diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api_factory.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api_factory.dart deleted file mode 100644 index 11a9c37b..00000000 --- a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api_factory.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart'; - -class DesecApiFactory extends DnsProviderApiFactory { - @override - DnsProviderApi getDnsProvider({ - final DnsProviderApiSettings settings = const DnsProviderApiSettings(), - }) => - DesecApi( - hasLogger: settings.hasLogger, - isWithToken: settings.isWithToken, - customToken: settings.customToken, - ); -} diff --git a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api_factory.dart b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api_factory.dart deleted file mode 100644 index 4be2c74b..00000000 --- a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api_factory.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart'; - -class DigitalOceanDnsApiFactory extends DnsProviderApiFactory { - @override - DnsProviderApi getDnsProvider({ - final DnsProviderApiSettings settings = const DnsProviderApiSettings(), - }) => - DigitalOceanDnsApi( - hasLogger: settings.hasLogger, - isWithToken: settings.isWithToken, - customToken: settings.customToken, - ); -} diff --git a/lib/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart b/lib/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart deleted file mode 100644 index 6b737df5..00000000 --- a/lib/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/provider_api_settings.dart'; - -class DnsProviderApiSettings extends ProviderApiSettings { - const DnsProviderApiSettings({ - super.hasLogger = false, - super.isWithToken = true, - this.customToken, - }); - final String? customToken; -} diff --git a/lib/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart b/lib/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart deleted file mode 100644 index fb573135..00000000 --- a/lib/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart +++ /dev/null @@ -1,8 +0,0 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart'; - -abstract class DnsProviderApiFactory { - DnsProviderApi getDnsProvider({ - final DnsProviderApiSettings settings, - }); -} diff --git a/lib/logic/api_maps/rest_maps/provider_api_settings.dart b/lib/logic/api_maps/rest_maps/provider_api_settings.dart deleted file mode 100644 index 9e601d2a..00000000 --- a/lib/logic/api_maps/rest_maps/provider_api_settings.dart +++ /dev/null @@ -1,8 +0,0 @@ -class ProviderApiSettings { - const ProviderApiSettings({ - this.hasLogger = false, - this.isWithToken = true, - }); - final bool hasLogger; - final bool isWithToken; -} diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api_factory.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api_factory.dart deleted file mode 100644 index 6383c4ab..00000000 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api_factory.dart +++ /dev/null @@ -1,34 +0,0 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_api_settings.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_factory.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/volume_provider.dart'; - -class DigitalOceanApiFactory extends ServerProviderApiFactory - with VolumeProviderApiFactory { - DigitalOceanApiFactory({this.region}); - - final String? region; - - @override - ServerProviderApi getServerProvider({ - final ServerProviderApiSettings settings = - const ServerProviderApiSettings(), - }) => - DigitalOceanApi( - region: settings.region ?? region, - hasLogger: settings.hasLogger, - isWithToken: settings.isWithToken, - ); - - @override - VolumeProviderApi getVolumeProvider({ - final ServerProviderApiSettings settings = - const ServerProviderApiSettings(), - }) => - DigitalOceanApi( - region: settings.region ?? region, - hasLogger: settings.hasLogger, - isWithToken: settings.isWithToken, - ); -} diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api_factory.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api_factory.dart deleted file mode 100644 index 6824d385..00000000 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api_factory.dart +++ /dev/null @@ -1,34 +0,0 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_api_settings.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_factory.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/volume_provider.dart'; - -class HetznerApiFactory extends ServerProviderApiFactory - with VolumeProviderApiFactory { - HetznerApiFactory({this.region}); - - final String? region; - - @override - ServerProviderApi getServerProvider({ - final ServerProviderApiSettings settings = - const ServerProviderApiSettings(), - }) => - HetznerApi( - region: settings.region ?? region, - hasLogger: settings.hasLogger, - isWithToken: settings.isWithToken, - ); - - @override - VolumeProviderApi getVolumeProvider({ - final ServerProviderApiSettings settings = - const ServerProviderApiSettings(), - }) => - HetznerApi( - region: settings.region ?? region, - hasLogger: settings.hasLogger, - isWithToken: settings.isWithToken, - ); -} diff --git a/lib/logic/api_maps/rest_maps/server_providers/server_provider_api_settings.dart b/lib/logic/api_maps/rest_maps/server_providers/server_provider_api_settings.dart deleted file mode 100644 index 3931b45b..00000000 --- a/lib/logic/api_maps/rest_maps/server_providers/server_provider_api_settings.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/provider_api_settings.dart'; - -class ServerProviderApiSettings extends ProviderApiSettings { - const ServerProviderApiSettings({ - this.region, - super.hasLogger = false, - super.isWithToken = true, - }); - - final String? region; -} diff --git a/lib/logic/api_maps/rest_maps/server_providers/server_provider_factory.dart b/lib/logic/api_maps/rest_maps/server_providers/server_provider_factory.dart deleted file mode 100644 index dbbb8035..00000000 --- a/lib/logic/api_maps/rest_maps/server_providers/server_provider_factory.dart +++ /dev/null @@ -1,15 +0,0 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_api_settings.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/volume_provider.dart'; - -abstract class ServerProviderApiFactory { - ServerProviderApi getServerProvider({ - final ServerProviderApiSettings settings, - }); -} - -mixin VolumeProviderApiFactory { - VolumeProviderApi getVolumeProvider({ - final ServerProviderApiSettings settings, - }); -} From 0502e68cc1a71842a85e07ebe682f9e81bb5cd52 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 19 Jun 2023 12:12:15 -0300 Subject: [PATCH 89/96] chore: Remove unused function --- .../server_installation_repository.dart | 56 ------------------- 1 file changed, 56 deletions(-) diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 96fa4d8d..2a9707fe 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -203,62 +203,6 @@ class ServerInstallationRepository { return matches; } - Future createDnsRecords( - final ServerHostingDetails serverDetails, - final ServerDomain domain, { - required final void Function() onCancel, - }) async { - final serverProvider = ProvidersController.currentServerProvider!; - - void showDomainErrorPopUp(final String error) { - showPopUpAlert( - alertTitle: error, - description: 'modals.delete_server_volume'.tr(), - cancelButtonOnPressed: onCancel, - actionButtonTitle: 'basis.delete'.tr(), - actionButtonOnPressed: () async { - await serverProvider.deleteServer( - domain.domainName, - ); - onCancel(); - }, - ); - } - - final GenericResult removingResult = - await ProvidersController.currentDnsProvider!.removeDomainRecords( - ip4: serverDetails.ip4, - domain: domain, - ); - - if (!removingResult.success) { - showDomainErrorPopUp('domain.error'.tr()); - return false; - } - - bool createdSuccessfully = false; - String errorMessage = 'domain.error'.tr(); - try { - final GenericResult createResult = - await ProvidersController.currentDnsProvider!.createDomainRecords( - ip4: serverDetails.ip4, - domain: domain, - ); - createdSuccessfully = createResult.success; - } on DioError catch (e) { - if (e.response!.data['errors'][0]['code'] == 1038) { - errorMessage = 'modals.you_cant_use_this_api'.tr(); - } - } - - if (!createdSuccessfully) { - showDomainErrorPopUp(errorMessage); - return false; - } - - return true; - } - Future createDkimRecord(final ServerDomain cloudFlareDomain) async { final ServerApi api = ServerApi(); From e418a58e5b9db28d39dc309494819bff5d85870a Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 19 Jun 2023 14:42:48 -0300 Subject: [PATCH 90/96] chore: Remove unused ApiTokenvalidatoin --- .../digital_ocean_dns/digital_ocean_dns_api.dart | 3 --- .../server_providers/hetzner/hetzner_api.dart | 6 ------ .../rest_maps/server_providers/server_provider.dart | 9 --------- .../setup/initializing/server_provider_form_cubit.dart | 3 --- .../server_installation/server_installation_cubit.dart | 10 +++++++++- .../server_installation_repository.dart | 2 -- lib/logic/models/launch_installation_data.dart | 3 --- lib/logic/providers/server_providers/hetzner.dart | 9 --------- 8 files changed, 9 insertions(+), 36 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart index 992e6766..8f0a8b3d 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart @@ -19,9 +19,6 @@ class DigitalOceanDnsApi extends DnsProviderApi { final String? customToken; - RegExp getApiTokenValidation() => - RegExp(r'\s+|[!$%^&*()@+|~=`{}\[\]:<>?,.\/]'); - @override BaseOptions get options { final BaseOptions options = BaseOptions( diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart index 338c96dd..b8ec3c26 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart @@ -98,12 +98,6 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { ); } - ProviderApiTokenValidation getApiTokenValidation() => - ProviderApiTokenValidation( - regexp: RegExp(r'\s+|[-!$%^&*()@+|~=`{}\[\]:<>?,.\/]'), - length: 64, - ); - Future> getPricePerGb() async { double? price; diff --git a/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart b/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart index 88250ab3..d4988c99 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart @@ -1,15 +1,6 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; export 'package:selfprivacy/logic/api_maps/generic_result.dart'; -class ProviderApiTokenValidation { - ProviderApiTokenValidation({ - required this.length, - required this.regexp, - }); - final int length; - final RegExp regexp; -} - abstract class ServerProviderApi extends ApiMap { /// Provider name key which lets infect understand what kind of installation /// it requires, for example 'digitaloceal' for Digital Ocean diff --git a/lib/logic/cubit/forms/setup/initializing/server_provider_form_cubit.dart b/lib/logic/cubit/forms/setup/initializing/server_provider_form_cubit.dart index 97144d29..5df3e31a 100644 --- a/lib/logic/cubit/forms/setup/initializing/server_provider_form_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/server_provider_form_cubit.dart @@ -6,13 +6,10 @@ import 'package:selfprivacy/logic/cubit/server_installation/server_installation_ class ServerProviderFormCubit extends FormCubit { ServerProviderFormCubit(this.serverInstallationCubit) { - //final int tokenLength = - // serverInstallationCubit.serverProviderApiTokenValidation().length; apiKey = FieldCubit( initalValue: '', validations: [ RequiredStringValidation('validations.required'.tr()), - //LengthStringNotEqualValidation(tokenLength), ], ); diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index cf83fb81..7730c5a3 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -227,6 +227,15 @@ class ServerInstallationCubit extends Cubit { final ServerHostingDetails serverDetails, ) async { await repository.saveServerDetails(serverDetails); + await ProvidersController.currentDnsProvider!.removeDomainRecords( + ip4: serverDetails.ip4, + domain: state.serverDomain!, + ); + await ProvidersController.currentDnsProvider!.createDomainRecords( + ip4: serverDetails.ip4, + domain: state.serverDomain!, + ); + emit( (state as ServerInstallationNotFinished).copyWith( isLoading: false, @@ -248,7 +257,6 @@ class ServerInstallationCubit extends Cubit { serverTypeId: state.serverTypeIdentificator!, errorCallback: clearAppConfig, successCallback: onCreateServerSuccess, - dnsProvider: ProvidersController.currentDnsProvider!, ); final result = diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 2a9707fe..7c45bc20 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:io'; import 'package:device_info_plus/device_info_plus.dart'; -import 'package:dio/dio.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/foundation.dart'; import 'package:hive/hive.dart'; @@ -22,7 +21,6 @@ import 'package:selfprivacy/logic/models/json/device_token.dart'; import 'package:selfprivacy/logic/models/server_basic_info.dart'; import 'package:selfprivacy/logic/models/server_type.dart'; import 'package:selfprivacy/logic/providers/providers_controller.dart'; -import 'package:selfprivacy/ui/helpers/modals.dart'; import 'package:selfprivacy/utils/network_utils.dart'; class IpNotFoundException implements Exception { diff --git a/lib/logic/models/launch_installation_data.dart b/lib/logic/models/launch_installation_data.dart index 37638835..c1f32ee6 100644 --- a/lib/logic/models/launch_installation_data.dart +++ b/lib/logic/models/launch_installation_data.dart @@ -1,14 +1,12 @@ import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; -import 'package:selfprivacy/logic/providers/dns_providers/dns_provider.dart'; class LaunchInstallationData { LaunchInstallationData({ required this.rootUser, required this.dnsApiToken, required this.dnsProviderType, - required this.dnsProvider, required this.serverDomain, required this.serverTypeId, required this.errorCallback, @@ -19,7 +17,6 @@ class LaunchInstallationData { final String dnsApiToken; final ServerDomain serverDomain; final DnsProviderType dnsProviderType; - final DnsProvider dnsProvider; final String serverTypeId; final Function() errorCallback; final Function(ServerHostingDetails details) successCallback; diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index 192674f5..874f4f59 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -588,15 +588,6 @@ class HetznerServerProvider extends ServerProvider { } await installationData.successCallback(serverDetails); - await installationData.dnsProvider.removeDomainRecords( - ip4: serverDetails.ip4, - domain: installationData.serverDomain, - ); - await installationData.dnsProvider.createDomainRecords( - ip4: serverDetails.ip4, - domain: installationData.serverDomain, - ); - return GenericResult(success: true, data: null); } From 0d49b89e438d99e31d84d1a047dc8484cabf74c6 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 19 Jun 2023 14:52:07 -0300 Subject: [PATCH 91/96] chore: Remove unused function for Cloudflare provider --- .../cloudflare/cloudflare_api.dart | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart index 50ecd7a7..983ab3a4 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart @@ -217,26 +217,6 @@ class CloudflareApi extends DnsProviderApi { return GenericResult(success: true, data: null); } - Future setDnsRecord( - final DnsRecord record, - final ServerDomain domain, - ) async { - final String domainZoneId = domain.zoneId; - final String url = '$rootAddress/zones/$domainZoneId/dns_records'; - - final Dio client = await getClient(); - try { - await client.post( - url, - data: record.toJson(), - ); - } catch (e) { - print(e); - } finally { - close(client); - } - } - Future> getDomains() async { final String url = '$rootAddress/zones'; List domains = []; From 3fedb175533ffd3b8910ab7fb9f5af24d2d4755b Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 19 Jun 2023 14:59:46 -0300 Subject: [PATCH 92/96] chore: Remove unused function from Desec API --- .../rest_maps/dns_providers/desec/desec_api.dart | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart index f8915c5a..46b11532 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart @@ -4,7 +4,6 @@ import 'package:dio/dio.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; -import 'package:selfprivacy/logic/models/json/dns_records.dart'; class DesecApi extends DnsProviderApi { DesecApi({ @@ -171,15 +170,6 @@ class DesecApi extends DnsProviderApi { return GenericResult(success: true, data: null); } - String? extractContent(final DnsRecord record) { - String? content = record.content; - if (record.type == 'TXT' && content != null && !content.startsWith('"')) { - content = '"$content"'; - } - - return content; - } - Future> getDomains() async { List domains = []; From f9da202093716a0397136c5d12e9dc156a965091 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 19 Jun 2023 15:09:26 -0300 Subject: [PATCH 93/96] chore: Remove unused abstractions --- .../dns_providers/cloudflare/cloudflare_api.dart | 5 +++-- .../rest_maps/dns_providers/desec/desec_api.dart | 5 +++-- .../digital_ocean_dns/digital_ocean_dns_api.dart | 5 +++-- .../api_maps/rest_maps/dns_providers/dns_provider.dart | 10 ---------- .../digital_ocean/digital_ocean_api.dart | 3 +-- .../server_providers/hetzner/hetzner_api.dart | 3 +-- .../rest_maps/server_providers/volume_provider.dart | 5 ----- lib/logic/cubit/dns_records/dns_records_cubit.dart | 2 +- lib/logic/providers/dns_providers/cloudflare.dart | 2 +- .../providers/dns_providers/digital_ocean_dns.dart | 2 +- 10 files changed, 14 insertions(+), 28 deletions(-) delete mode 100644 lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart delete mode 100644 lib/logic/api_maps/rest_maps/server_providers/volume_provider.dart diff --git a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart index 983ab3a4..9ff01bf7 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart @@ -2,11 +2,12 @@ import 'dart:io'; import 'package:dio/dio.dart'; import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; +import 'package:selfprivacy/logic/api_maps/generic_result.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; -class CloudflareApi extends DnsProviderApi { +class CloudflareApi extends ApiMap { CloudflareApi({ this.hasLogger = false, this.isWithToken = true, diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart index 46b11532..cab65b6a 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart @@ -2,10 +2,11 @@ import 'dart:io'; import 'package:dio/dio.dart'; import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; +import 'package:selfprivacy/logic/api_maps/generic_result.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; -class DesecApi extends DnsProviderApi { +class DesecApi extends ApiMap { DesecApi({ this.hasLogger = false, this.isWithToken = true, diff --git a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart index 8f0a8b3d..76f9e78e 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart @@ -2,11 +2,12 @@ import 'dart:io'; import 'package:dio/dio.dart'; import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; +import 'package:selfprivacy/logic/api_maps/generic_result.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; -class DigitalOceanDnsApi extends DnsProviderApi { +class DigitalOceanDnsApi extends ApiMap { DigitalOceanDnsApi({ this.hasLogger = false, this.isWithToken = true, diff --git a/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart b/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart deleted file mode 100644 index 3d74d5db..00000000 --- a/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; -export 'package:selfprivacy/logic/api_maps/generic_result.dart'; -export 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desired_dns_record.dart'; - -class DomainNotFoundException implements Exception { - DomainNotFoundException(this.message); - final String message; -} - -abstract class DnsProviderApi extends ApiMap {} diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart index 976ddb6b..b3e39e66 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart @@ -2,7 +2,6 @@ import 'dart:io'; import 'package:dio/dio.dart'; import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/volume_provider.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; import 'package:selfprivacy/logic/api_maps/tls_options.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; @@ -10,7 +9,7 @@ import 'package:selfprivacy/logic/models/hive/user.dart'; import 'package:selfprivacy/logic/models/json/digital_ocean_server_info.dart'; import 'package:selfprivacy/utils/password_generator.dart'; -class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { +class DigitalOceanApi extends ServerProviderApi { DigitalOceanApi({ required this.region, this.hasLogger = true, diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart index b8ec3c26..2d4907e2 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart @@ -2,7 +2,6 @@ import 'dart:io'; import 'package:dio/dio.dart'; import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/volume_provider.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; import 'package:selfprivacy/logic/api_maps/tls_options.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; @@ -10,7 +9,7 @@ import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; import 'package:selfprivacy/utils/password_generator.dart'; -class HetznerApi extends ServerProviderApi with VolumeProviderApi { +class HetznerApi extends ServerProviderApi { HetznerApi({ this.region, this.hasLogger = true, diff --git a/lib/logic/api_maps/rest_maps/server_providers/volume_provider.dart b/lib/logic/api_maps/rest_maps/server_providers/volume_provider.dart deleted file mode 100644 index 5ddacd6d..00000000 --- a/lib/logic/api_maps/rest_maps/server_providers/volume_provider.dart +++ /dev/null @@ -1,5 +0,0 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; - -export 'package:selfprivacy/logic/api_maps/generic_result.dart'; - -mixin VolumeProviderApi on ApiMap {} diff --git a/lib/logic/cubit/dns_records/dns_records_cubit.dart b/lib/logic/cubit/dns_records/dns_records_cubit.dart index 91067d06..3fc2d199 100644 --- a/lib/logic/cubit/dns_records/dns_records_cubit.dart +++ b/lib/logic/cubit/dns_records/dns_records_cubit.dart @@ -1,5 +1,5 @@ import 'package:cubit_form/cubit_form.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desired_dns_record.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; diff --git a/lib/logic/providers/dns_providers/cloudflare.dart b/lib/logic/providers/dns_providers/cloudflare.dart index 1f53761d..abd4f1ba 100644 --- a/lib/logic/providers/dns_providers/cloudflare.dart +++ b/lib/logic/providers/dns_providers/cloudflare.dart @@ -1,5 +1,5 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desired_dns_record.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; import 'package:selfprivacy/logic/providers/dns_providers/dns_provider.dart'; diff --git a/lib/logic/providers/dns_providers/digital_ocean_dns.dart b/lib/logic/providers/dns_providers/digital_ocean_dns.dart index e72c48fc..7f852a44 100644 --- a/lib/logic/providers/dns_providers/digital_ocean_dns.dart +++ b/lib/logic/providers/dns_providers/digital_ocean_dns.dart @@ -1,5 +1,5 @@ +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desired_dns_record.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; import 'package:selfprivacy/logic/providers/dns_providers/dns_provider.dart'; From 215ad3579dae1c90e1a8a6be0e80083b30ccf0de Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 19 Jun 2023 15:15:24 -0300 Subject: [PATCH 94/96] chore: Rename ApiMaps to RestApiMap and GraphQLApiMap --- .../graphql_maps/{api_map.dart => graphql_api_map.dart} | 2 +- lib/logic/api_maps/graphql_maps/server_api/jobs_api.dart | 2 +- .../api_maps/graphql_maps/server_api/server_actions_api.dart | 2 +- lib/logic/api_maps/graphql_maps/server_api/server_api.dart | 2 +- lib/logic/api_maps/graphql_maps/server_api/services_api.dart | 2 +- lib/logic/api_maps/graphql_maps/server_api/users_api.dart | 2 +- lib/logic/api_maps/graphql_maps/server_api/volume_api.dart | 2 +- lib/logic/api_maps/rest_maps/backblaze.dart | 2 +- .../rest_maps/dns_providers/cloudflare/cloudflare_api.dart | 2 +- lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart | 2 +- .../dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart | 2 +- .../api_maps/rest_maps/{api_map.dart => rest_api_map.dart} | 2 +- .../api_maps/rest_maps/server_providers/server_provider.dart | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) rename lib/logic/api_maps/graphql_maps/{api_map.dart => graphql_api_map.dart} (99%) rename lib/logic/api_maps/rest_maps/{api_map.dart => rest_api_map.dart} (99%) diff --git a/lib/logic/api_maps/graphql_maps/api_map.dart b/lib/logic/api_maps/graphql_maps/graphql_api_map.dart similarity index 99% rename from lib/logic/api_maps/graphql_maps/api_map.dart rename to lib/logic/api_maps/graphql_maps/graphql_api_map.dart index 32359f93..2c11c127 100644 --- a/lib/logic/api_maps/graphql_maps/api_map.dart +++ b/lib/logic/api_maps/graphql_maps/graphql_api_map.dart @@ -53,7 +53,7 @@ class ResponseLoggingParser extends ResponseParser { } } -abstract class ApiMap { +abstract class GraphQLApiMap { Future getClient() async { IOClient? ioClient; if (TlsOptions.stagingAcme || !TlsOptions.verifyCertificate) { diff --git a/lib/logic/api_maps/graphql_maps/server_api/jobs_api.dart b/lib/logic/api_maps/graphql_maps/server_api/jobs_api.dart index 03bfd1b3..8ed73a5d 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/jobs_api.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/jobs_api.dart @@ -1,6 +1,6 @@ part of 'server_api.dart'; -mixin JobsApi on ApiMap { +mixin JobsApi on GraphQLApiMap { Future> getServerJobs() async { QueryResult response; List jobsList = []; diff --git a/lib/logic/api_maps/graphql_maps/server_api/server_actions_api.dart b/lib/logic/api_maps/graphql_maps/server_api/server_actions_api.dart index 65e77b98..f6fd5201 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/server_actions_api.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/server_actions_api.dart @@ -1,6 +1,6 @@ part of 'server_api.dart'; -mixin ServerActionsApi on ApiMap { +mixin ServerActionsApi on GraphQLApiMap { Future _commonBoolRequest(final Function graphQLMethod) async { QueryResult response; bool result = false; diff --git a/lib/logic/api_maps/graphql_maps/server_api/server_api.dart b/lib/logic/api_maps/graphql_maps/server_api/server_api.dart index 966b17bd..8f0e55e3 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/server_api.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/server_api.dart @@ -32,7 +32,7 @@ part 'services_api.dart'; part 'users_api.dart'; part 'volume_api.dart'; -class ServerApi extends ApiMap +class ServerApi extends GraphQLApiMap with VolumeApi, JobsApi, ServerActionsApi, ServicesApi, UsersApi { ServerApi({ this.hasLogger = false, diff --git a/lib/logic/api_maps/graphql_maps/server_api/services_api.dart b/lib/logic/api_maps/graphql_maps/server_api/services_api.dart index 9d39f137..1632533b 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/services_api.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/services_api.dart @@ -1,6 +1,6 @@ part of 'server_api.dart'; -mixin ServicesApi on ApiMap { +mixin ServicesApi on GraphQLApiMap { Future> getAllServices() async { QueryResult response; List services = []; diff --git a/lib/logic/api_maps/graphql_maps/server_api/users_api.dart b/lib/logic/api_maps/graphql_maps/server_api/users_api.dart index cca78798..11327290 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/users_api.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/users_api.dart @@ -1,6 +1,6 @@ part of 'server_api.dart'; -mixin UsersApi on ApiMap { +mixin UsersApi on GraphQLApiMap { Future> getAllUsers() async { QueryResult response; List users = []; diff --git a/lib/logic/api_maps/graphql_maps/server_api/volume_api.dart b/lib/logic/api_maps/graphql_maps/server_api/volume_api.dart index 3459e6f9..a7d23ba8 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/volume_api.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/volume_api.dart @@ -1,6 +1,6 @@ part of 'server_api.dart'; -mixin VolumeApi on ApiMap { +mixin VolumeApi on GraphQLApiMap { Future> getServerDiskVolumes() async { QueryResult response; List volumes = []; diff --git a/lib/logic/api_maps/rest_maps/backblaze.dart b/lib/logic/api_maps/rest_maps/backblaze.dart index 6ce8914e..aaa5ca6b 100644 --- a/lib/logic/api_maps/rest_maps/backblaze.dart +++ b/lib/logic/api_maps/rest_maps/backblaze.dart @@ -25,7 +25,7 @@ class BackblazeApplicationKey { final String applicationKey; } -class BackblazeApi extends ApiMap { +class BackblazeApi extends RestApiMap { BackblazeApi({this.hasLogger = false, this.isWithToken = true}); @override diff --git a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart index 9ff01bf7..eb4f9ad4 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart @@ -7,7 +7,7 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; -class CloudflareApi extends ApiMap { +class CloudflareApi extends RestApiMap { CloudflareApi({ this.hasLogger = false, this.isWithToken = true, diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart index cab65b6a..b6e04f99 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart @@ -6,7 +6,7 @@ import 'package:selfprivacy/logic/api_maps/generic_result.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; -class DesecApi extends ApiMap { +class DesecApi extends RestApiMap { DesecApi({ this.hasLogger = false, this.isWithToken = true, diff --git a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart index 76f9e78e..6e148c70 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart @@ -7,7 +7,7 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; -class DigitalOceanDnsApi extends ApiMap { +class DigitalOceanDnsApi extends RestApiMap { DigitalOceanDnsApi({ this.hasLogger = false, this.isWithToken = true, diff --git a/lib/logic/api_maps/rest_maps/api_map.dart b/lib/logic/api_maps/rest_maps/rest_api_map.dart similarity index 99% rename from lib/logic/api_maps/rest_maps/api_map.dart rename to lib/logic/api_maps/rest_maps/rest_api_map.dart index 86f53e25..547ce4aa 100644 --- a/lib/logic/api_maps/rest_maps/api_map.dart +++ b/lib/logic/api_maps/rest_maps/rest_api_map.dart @@ -8,7 +8,7 @@ import 'package:pretty_dio_logger/pretty_dio_logger.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/models/message.dart'; -abstract class ApiMap { +abstract class RestApiMap { Future getClient({final BaseOptions? customOptions}) async { final Dio dio = Dio(customOptions ?? (await options)); if (hasLogger) { diff --git a/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart b/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart index d4988c99..2dc455d0 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart @@ -1,7 +1,7 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; export 'package:selfprivacy/logic/api_maps/generic_result.dart'; -abstract class ServerProviderApi extends ApiMap { +abstract class ServerProviderApi extends RestApiMap { /// Provider name key which lets infect understand what kind of installation /// it requires, for example 'digitaloceal' for Digital Ocean String get infectProviderName; From 9552df1ec230ea8b8a77e313135edb9fd01cd3ee Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 19 Jun 2023 15:17:15 -0300 Subject: [PATCH 95/96] chore: Remove unused abstraction for ServerProvider --- .../api_maps/graphql_maps/server_api/server_api.dart | 2 +- lib/logic/api_maps/rest_maps/backblaze.dart | 2 +- .../dns_providers/cloudflare/cloudflare_api.dart | 2 +- .../rest_maps/dns_providers/desec/desec_api.dart | 2 +- .../digital_ocean_dns/digital_ocean_dns_api.dart | 2 +- .../digital_ocean/digital_ocean_api.dart | 9 +++------ .../server_providers/hetzner/hetzner_api.dart | 9 +++------ .../rest_maps/server_providers/server_provider.dart | 12 ------------ 8 files changed, 11 insertions(+), 29 deletions(-) delete mode 100644 lib/logic/api_maps/rest_maps/server_providers/server_provider.dart diff --git a/lib/logic/api_maps/graphql_maps/server_api/server_api.dart b/lib/logic/api_maps/graphql_maps/server_api/server_api.dart index 8f0e55e3..91d4eeed 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/server_api.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/server_api.dart @@ -1,7 +1,7 @@ import 'package:graphql/client.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/generic_result.dart'; -import 'package:selfprivacy/logic/api_maps/graphql_maps/api_map.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/graphql_api_map.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/schema.graphql.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_api.graphql.dart'; diff --git a/lib/logic/api_maps/rest_maps/backblaze.dart b/lib/logic/api_maps/rest_maps/backblaze.dart index aaa5ca6b..7169f5cb 100644 --- a/lib/logic/api_maps/rest_maps/backblaze.dart +++ b/lib/logic/api_maps/rest_maps/backblaze.dart @@ -3,7 +3,7 @@ import 'dart:io'; import 'package:dio/dio.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/generic_result.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/rest_api_map.dart'; import 'package:selfprivacy/logic/models/hive/backblaze_credential.dart'; export 'package:selfprivacy/logic/api_maps/generic_result.dart'; diff --git a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart index eb4f9ad4..9fe74841 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_api.dart @@ -3,7 +3,7 @@ import 'dart:io'; import 'package:dio/dio.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/generic_result.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/rest_api_map.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart index b6e04f99..e5eff146 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_api.dart @@ -3,7 +3,7 @@ import 'dart:io'; import 'package:dio/dio.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/generic_result.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/rest_api_map.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; class DesecApi extends RestApiMap { diff --git a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart index 6e148c70..348edc77 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/digital_ocean_dns/digital_ocean_dns_api.dart @@ -3,7 +3,7 @@ import 'dart:io'; import 'package:dio/dio.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/generic_result.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/rest_api_map.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart index b3e39e66..807d03a0 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart @@ -2,14 +2,15 @@ import 'dart:io'; import 'package:dio/dio.dart'; import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; +import 'package:selfprivacy/logic/api_maps/generic_result.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/rest_api_map.dart'; import 'package:selfprivacy/logic/api_maps/tls_options.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; import 'package:selfprivacy/logic/models/json/digital_ocean_server_info.dart'; import 'package:selfprivacy/utils/password_generator.dart'; -class DigitalOceanApi extends ServerProviderApi { +class DigitalOceanApi extends RestApiMap { DigitalOceanApi({ required this.region, this.hasLogger = true, @@ -44,11 +45,7 @@ class DigitalOceanApi extends ServerProviderApi { @override String get rootAddress => 'https://api.digitalocean.com/v2'; - - @override String get infectProviderName => 'digitalocean'; - - @override String get displayProviderName => 'Digital Ocean'; Future> isApiTokenValid(final String token) async { diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart index 2d4907e2..b320d4f5 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart @@ -2,14 +2,15 @@ import 'dart:io'; import 'package:dio/dio.dart'; import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; +import 'package:selfprivacy/logic/api_maps/generic_result.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/rest_api_map.dart'; import 'package:selfprivacy/logic/api_maps/tls_options.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; import 'package:selfprivacy/utils/password_generator.dart'; -class HetznerApi extends ServerProviderApi { +class HetznerApi extends RestApiMap { HetznerApi({ this.region, this.hasLogger = true, @@ -44,11 +45,7 @@ class HetznerApi extends ServerProviderApi { @override String get rootAddress => 'https://api.hetzner.cloud/v1'; - - @override String get infectProviderName => 'hetzner'; - - @override String get displayProviderName => 'Hetzner'; Future> isApiTokenValid(final String token) async { diff --git a/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart b/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart deleted file mode 100644 index 2dc455d0..00000000 --- a/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; -export 'package:selfprivacy/logic/api_maps/generic_result.dart'; - -abstract class ServerProviderApi extends RestApiMap { - /// Provider name key which lets infect understand what kind of installation - /// it requires, for example 'digitaloceal' for Digital Ocean - String get infectProviderName; - - /// Actual provider name to render on information page for user, - /// for example 'Digital Ocean' for Digital Ocean - String get displayProviderName; -} From a2ed839927de6209bb3741e78e54c8cee2672c2d Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 19 Jun 2023 17:00:50 -0300 Subject: [PATCH 96/96] chore: Remove unused image from DNS Picket --- .../initializing/dns_provider_picker.dart | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/lib/ui/pages/setup/initializing/dns_provider_picker.dart b/lib/ui/pages/setup/initializing/dns_provider_picker.dart index 889367fa..a05b1233 100644 --- a/lib/ui/pages/setup/initializing/dns_provider_picker.dart +++ b/lib/ui/pages/setup/initializing/dns_provider_picker.dart @@ -47,39 +47,27 @@ class _DnsProviderPickerState extends State { case DnsProviderType.cloudflare: return ProviderInputDataPage( providerCubit: widget.formCubit, - providerInfo: ProviderPageInfo( + providerInfo: const ProviderPageInfo( providerType: DnsProviderType.cloudflare, pathToHow: 'how_cloudflare', - image: Image.asset( - 'assets/images/logos/cloudflare.png', - width: 150, - ), ), ); case DnsProviderType.digitalOcean: return ProviderInputDataPage( providerCubit: widget.formCubit, - providerInfo: ProviderPageInfo( + providerInfo: const ProviderPageInfo( providerType: DnsProviderType.digitalOcean, pathToHow: 'how_digital_ocean_dns', - image: Image.asset( - 'assets/images/logos/digital_ocean.png', - width: 150, - ), ), ); case DnsProviderType.desec: return ProviderInputDataPage( providerCubit: widget.formCubit, - providerInfo: ProviderPageInfo( + providerInfo: const ProviderPageInfo( providerType: DnsProviderType.desec, pathToHow: 'how_desec', - image: Image.asset( - 'assets/images/logos/desec.svg', - width: 150, - ), ), ); } @@ -90,11 +78,9 @@ class ProviderPageInfo { const ProviderPageInfo({ required this.providerType, required this.pathToHow, - required this.image, }); final String pathToHow; - final Image image; final DnsProviderType providerType; }