From 313cfc718793bb76fcc89fb3fdc31657d964c32d Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 15 Jun 2022 04:55:45 +0300 Subject: [PATCH 001/115] Bug fix error processing for installation cubits --- assets/translations/en.json | 3 +++ assets/translations/ru.json | 3 +++ .../initializing/backblaze_form_cubit.dart | 5 +++-- .../initializing/cloudflare_form_cubit.dart | 4 +++- .../initializing/hetzner_form_cubit.dart | 4 +++- .../server_installation_repository.dart | 19 ++++++++++++------- 6 files changed, 27 insertions(+), 11 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index 46cee9b8..c0e95639 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -259,6 +259,9 @@ "1": "Connect a server", "2": "A place where your data and SelfPrivacy services will reside:", "how": "How to obtain API token", + "hetzner_bad_key_error": "Hetzner API key is invalid", + "cloudflare_bad_key_error": "Cloudflare API key is invalid", + "backblaze_bad_key_error": "Backblaze storage information is invalid", "3": "Connect CloudFlare", "4": "To manage your domain's DNS", "5": "CloudFlare API Token", diff --git a/assets/translations/ru.json b/assets/translations/ru.json index 68665e26..e2048024 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -260,6 +260,9 @@ "1": "Подключите сервер", "2": "Здесь будут жить наши данные и SelfPrivacy-сервисы", "how": "Как получить API Token", + "hetzner_bad_key_error": "Hetzner API ключ неверен", + "cloudflare_bad_key_error": "Cloudflare API ключ неверен", + "backblaze_bad_key_error": "Информация о Backblaze хранилище неверна", "3": "Подключите CloudFlare", "4": "Для управления DNS вашего домена", "5": "CloudFlare API Token", 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 4769286d..04d2993e 100644 --- a/lib/logic/cubit/forms/setup/initializing/backblaze_form_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/backblaze_form_cubit.dart @@ -55,10 +55,11 @@ class BackblazeFormCubit extends FormCubit { } if (!isKeyValid) { - keyId.setError('bad key'); - applicationKey.setError('bad key'); + keyId.setError('initializing.backblaze_bad_key_error'.tr()); + applicationKey.setError('initializing.backblaze_bad_key_error'.tr()); return false; } + return true; } } diff --git a/lib/logic/cubit/forms/setup/initializing/cloudflare_form_cubit.dart b/lib/logic/cubit/forms/setup/initializing/cloudflare_form_cubit.dart index 01d26835..6a4b3b30 100644 --- a/lib/logic/cubit/forms/setup/initializing/cloudflare_form_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/cloudflare_form_cubit.dart @@ -42,12 +42,14 @@ class CloudFlareFormCubit extends FormCubit { isKeyValid = await apiClient.isValid(apiKey.state.value); } catch (e) { addError(e); + isKeyValid = false; } if (!isKeyValid) { - apiKey.setError('bad key'); + apiKey.setError('initializing.cloudflare_bad_key_error'.tr()); return false; } + return true; } } diff --git a/lib/logic/cubit/forms/setup/initializing/hetzner_form_cubit.dart b/lib/logic/cubit/forms/setup/initializing/hetzner_form_cubit.dart index b8f47e10..11465d9d 100644 --- a/lib/logic/cubit/forms/setup/initializing/hetzner_form_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/hetzner_form_cubit.dart @@ -42,12 +42,14 @@ class HetznerFormCubit extends FormCubit { isKeyValid = await apiClient.isValid(apiKey.state.value); } catch (e) { addError(e); + isKeyValid = false; } if (!isKeyValid) { - apiKey.setError('bad key'); + apiKey.setError('initializing.hetzner_bad_key_error'.tr()); return false; } + return true; } } diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 5d4db8fe..2a0f84f4 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -242,13 +242,18 @@ class ServerInstallationRepository { domainName: domainName, ); - final ServerHostingDetails? serverDetails = - await hetznerApi.createServer( - cloudFlareKey: cloudFlareKey, - rootUser: rootUser, - domainName: domainName, - dataBase: dataBase, - ); + ServerHostingDetails? serverDetails; + try { + serverDetails = await hetznerApi.createServer( + cloudFlareKey: cloudFlareKey, + rootUser: rootUser, + domainName: domainName, + dataBase: dataBase, + ); + } catch (e) { + print(e); + } + if (serverDetails == null) { print('Server is not initialized!'); return; From 6a22e2db6fded6cc6aa7db291d54321c018723ab Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 15 Jun 2022 06:23:54 +0300 Subject: [PATCH 002/115] Fix revert routing errors --- .../server_installation_cubit.dart | 18 ++++++++++++++++++ .../server_installation_repository.dart | 15 +++++++++++++++ lib/logic/get_it/api_config.dart | 2 -- .../recovering/recovery_confirm_backblaze.dart | 2 ++ .../recovery_confirm_cloudflare.dart | 2 ++ .../recovering/recovery_confirm_server.dart | 2 ++ .../recovery_hentzner_connected.dart | 2 ++ 7 files changed, 41 insertions(+), 2 deletions(-) diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index ef83104d..36928f08 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -411,6 +411,7 @@ class ServerInstallationCubit extends Cubit { case RecoveryStep.recoveryKey: case RecoveryStep.newDeviceKey: case RecoveryStep.oldToken: + case RecoveryStep.hetznerToken: emit( dataState.copyWith( currentStep: RecoveryStep.selecting, @@ -425,6 +426,23 @@ class ServerInstallationCubit extends Cubit { ), ); break; + case RecoveryStep.cloudflareToken: + repository.deleteDomain(); + repository.deleteServerDetails(); + emit( + dataState.copyWith( + currentStep: RecoveryStep.serverSelection, + ), + ); + break; + case RecoveryStep.backblazeToken: + repository.deleteBackblazeKey(); + emit( + dataState.copyWith( + currentStep: RecoveryStep.cloudflareToken, + ), + ); + break; // We won't revert steps after client is authorized default: break; diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 2a0f84f4..e6eaf3c6 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -603,6 +603,11 @@ class ServerInstallationRepository { await getIt().storeServerDetails(serverDetails); } + Future deleteServerDetails() async { + await box.delete(BNames.serverDetails); + getIt().init(); + } + Future saveHetznerKey(final String key) async { print('saved'); await getIt().storeHetznerKey(key); @@ -619,10 +624,20 @@ class ServerInstallationRepository { await getIt().storeBackblazeCredential(backblazeCredential); } + Future deleteBackblazeKey() async { + await box.delete(BNames.backblazeCredential); + getIt().init(); + } + Future saveCloudFlareKey(final String key) async { await getIt().storeCloudFlareKey(key); } + Future deleteCloudFlareKey() async { + await box.delete(BNames.cloudFlareKey); + getIt().init(); + } + Future saveDomain(final ServerDomain serverDomain) async { await getIt().storeServerDomain(serverDomain); } diff --git a/lib/logic/get_it/api_config.dart b/lib/logic/get_it/api_config.dart index 3f3e5ac0..ec2feb55 100644 --- a/lib/logic/get_it/api_config.dart +++ b/lib/logic/get_it/api_config.dart @@ -34,7 +34,6 @@ class ApiConfigModel { Future storeBackblazeCredential(final BackblazeCredential value) async { await _box.put(BNames.backblazeCredential, value); - _backblazeCredential = value; } @@ -64,7 +63,6 @@ class ApiConfigModel { void init() { _hetznerKey = _box.get(BNames.hetznerKey); - _cloudFlareKey = _box.get(BNames.cloudFlareKey); _backblazeCredential = _box.get(BNames.backblazeCredential); _serverDomain = _box.get(BNames.serverDomain); diff --git a/lib/ui/pages/setup/recovering/recovery_confirm_backblaze.dart b/lib/ui/pages/setup/recovering/recovery_confirm_backblaze.dart index 2b558727..02b68acf 100644 --- a/lib/ui/pages/setup/recovering/recovery_confirm_backblaze.dart +++ b/lib/ui/pages/setup/recovering/recovery_confirm_backblaze.dart @@ -28,6 +28,8 @@ class RecoveryConfirmBackblaze extends StatelessWidget { heroTitle: 'recovering.confirm_backblaze'.tr(), heroSubtitle: 'recovering.confirm_backblaze_description'.tr(), hasBackButton: true, + onBackButtonPressed: + context.read().revertRecoveryStep, hasFlashButton: false, children: [ CubitFormTextField( diff --git a/lib/ui/pages/setup/recovering/recovery_confirm_cloudflare.dart b/lib/ui/pages/setup/recovering/recovery_confirm_cloudflare.dart index 8cbdbe6c..0e12b51e 100644 --- a/lib/ui/pages/setup/recovering/recovery_confirm_cloudflare.dart +++ b/lib/ui/pages/setup/recovering/recovery_confirm_cloudflare.dart @@ -31,6 +31,8 @@ class RecoveryConfirmCloudflare extends StatelessWidget { ), hasBackButton: true, hasFlashButton: false, + onBackButtonPressed: + context.read().revertRecoveryStep, children: [ CubitFormTextField( formFieldCubit: context.read().apiKey, diff --git a/lib/ui/pages/setup/recovering/recovery_confirm_server.dart b/lib/ui/pages/setup/recovering/recovery_confirm_server.dart index 110425ef..19fcbb6b 100644 --- a/lib/ui/pages/setup/recovering/recovery_confirm_server.dart +++ b/lib/ui/pages/setup/recovering/recovery_confirm_server.dart @@ -39,6 +39,8 @@ class _RecoveryConfirmServerState extends State { ? 'recovering.choose_server_description'.tr() : 'recovering.confirm_server_description'.tr(), hasBackButton: true, + onBackButtonPressed: + context.read().revertRecoveryStep, hasFlashButton: false, children: [ FutureBuilder>( diff --git a/lib/ui/pages/setup/recovering/recovery_hentzner_connected.dart b/lib/ui/pages/setup/recovering/recovery_hentzner_connected.dart index e1812b32..36b5f130 100644 --- a/lib/ui/pages/setup/recovering/recovery_hentzner_connected.dart +++ b/lib/ui/pages/setup/recovering/recovery_hentzner_connected.dart @@ -32,6 +32,8 @@ class RecoveryHetznerConnected extends StatelessWidget { ), hasBackButton: true, hasFlashButton: false, + onBackButtonPressed: + context.read().revertRecoveryStep, children: [ CubitFormTextField( formFieldCubit: context.read().apiKey, From 9d4f7b4786189692fb2d1893495ed1a216d76a2e Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 15 Jun 2022 06:27:05 +0300 Subject: [PATCH 003/115] Add changelog for 0.6.1 --- fastlane/metadata/android/en-US/changelogs/0.6.1.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 fastlane/metadata/android/en-US/changelogs/0.6.1.txt diff --git a/fastlane/metadata/android/en-US/changelogs/0.6.1.txt b/fastlane/metadata/android/en-US/changelogs/0.6.1.txt new file mode 100644 index 00000000..0f5c3964 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/0.6.1.txt @@ -0,0 +1,3 @@ +- Fixed routing errors and broken "back" buttons on recovery stages +- Fixed broken validation on api token fields +- Minor improvements \ No newline at end of file From 7870cf9f990a0044acaf5b0de0e76c22ae8bb848 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 15 Jun 2022 07:06:57 +0300 Subject: [PATCH 004/115] Update pubsec version to 0.6.1 --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 71a5f2f9..1e052155 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: selfprivacy description: selfprivacy.org publish_to: 'none' -version: 0.6.0+15 +version: 0.6.1+15 environment: sdk: '>=2.17.0 <3.0.0' From 0feb9bc299333ccae1dd0e800e4026eec9725ca0 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 15 Jun 2022 07:51:32 +0300 Subject: [PATCH 005/115] Return to main page on backbutton press for some recovery pages --- .../server_installation_cubit.dart | 18 ------------------ .../recovering/recovery_confirm_backblaze.dart | 5 +++-- .../recovering/recovery_confirm_server.dart | 5 +++-- .../recovery_hentzner_connected.dart | 5 +++-- 4 files changed, 9 insertions(+), 24 deletions(-) diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 36928f08..05198229 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -411,23 +411,13 @@ class ServerInstallationCubit extends Cubit { case RecoveryStep.recoveryKey: case RecoveryStep.newDeviceKey: case RecoveryStep.oldToken: - case RecoveryStep.hetznerToken: emit( dataState.copyWith( currentStep: RecoveryStep.selecting, ), ); break; - case RecoveryStep.serverSelection: - repository.deleteHetznerKey(); - emit( - dataState.copyWith( - currentStep: RecoveryStep.hetznerToken, - ), - ); - break; case RecoveryStep.cloudflareToken: - repository.deleteDomain(); repository.deleteServerDetails(); emit( dataState.copyWith( @@ -435,14 +425,6 @@ class ServerInstallationCubit extends Cubit { ), ); break; - case RecoveryStep.backblazeToken: - repository.deleteBackblazeKey(); - emit( - dataState.copyWith( - currentStep: RecoveryStep.cloudflareToken, - ), - ); - break; // We won't revert steps after client is authorized default: break; diff --git a/lib/ui/pages/setup/recovering/recovery_confirm_backblaze.dart b/lib/ui/pages/setup/recovering/recovery_confirm_backblaze.dart index 02b68acf..cbd40ff0 100644 --- a/lib/ui/pages/setup/recovering/recovery_confirm_backblaze.dart +++ b/lib/ui/pages/setup/recovering/recovery_confirm_backblaze.dart @@ -28,8 +28,9 @@ class RecoveryConfirmBackblaze extends StatelessWidget { heroTitle: 'recovering.confirm_backblaze'.tr(), heroSubtitle: 'recovering.confirm_backblaze_description'.tr(), hasBackButton: true, - onBackButtonPressed: - context.read().revertRecoveryStep, + onBackButtonPressed: () { + Navigator.of(context).popUntil((final route) => route.isFirst); + }, hasFlashButton: false, children: [ CubitFormTextField( diff --git a/lib/ui/pages/setup/recovering/recovery_confirm_server.dart b/lib/ui/pages/setup/recovering/recovery_confirm_server.dart index 19fcbb6b..063bd890 100644 --- a/lib/ui/pages/setup/recovering/recovery_confirm_server.dart +++ b/lib/ui/pages/setup/recovering/recovery_confirm_server.dart @@ -39,8 +39,9 @@ class _RecoveryConfirmServerState extends State { ? 'recovering.choose_server_description'.tr() : 'recovering.confirm_server_description'.tr(), hasBackButton: true, - onBackButtonPressed: - context.read().revertRecoveryStep, + onBackButtonPressed: () { + Navigator.of(context).popUntil((final route) => route.isFirst); + }, hasFlashButton: false, children: [ FutureBuilder>( diff --git a/lib/ui/pages/setup/recovering/recovery_hentzner_connected.dart b/lib/ui/pages/setup/recovering/recovery_hentzner_connected.dart index 36b5f130..6976283c 100644 --- a/lib/ui/pages/setup/recovering/recovery_hentzner_connected.dart +++ b/lib/ui/pages/setup/recovering/recovery_hentzner_connected.dart @@ -32,8 +32,9 @@ class RecoveryHetznerConnected extends StatelessWidget { ), hasBackButton: true, hasFlashButton: false, - onBackButtonPressed: - context.read().revertRecoveryStep, + onBackButtonPressed: () { + Navigator.of(context).popUntil((final route) => route.isFirst); + }, children: [ CubitFormTextField( formFieldCubit: context.read().apiKey, From 7e2319bf21eaa1239cbd1f8ab80d4986a281fd21 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 22 Jun 2022 22:42:38 +0300 Subject: [PATCH 006/115] Force domain to lowercase on recovery pages --- .../forms/setup/recovering/recovery_domain_form_cubit.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/logic/cubit/forms/setup/recovering/recovery_domain_form_cubit.dart b/lib/logic/cubit/forms/setup/recovering/recovery_domain_form_cubit.dart index 664b87b8..2d029bec 100644 --- a/lib/logic/cubit/forms/setup/recovering/recovery_domain_form_cubit.dart +++ b/lib/logic/cubit/forms/setup/recovering/recovery_domain_form_cubit.dart @@ -18,8 +18,9 @@ class RecoveryDomainFormCubit extends FormCubit { @override FutureOr onSubmit() async { - initializingCubit - .submitDomainForAccessRecovery(serverDomainField.state.value); + initializingCubit.submitDomainForAccessRecovery( + serverDomainField.state.value.toLowerCase(), + ); } @override From 352351663f096fc41c01c7081b2d8dd2447f70c2 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 24 Jun 2022 00:34:09 +0300 Subject: [PATCH 007/115] Implement endpoints for hetzner volumes --- lib/logic/api_maps/hetzner.dart | 172 ++++++++++++++++-- .../server_installation_repository.dart | 9 +- 2 files changed, 163 insertions(+), 18 deletions(-) diff --git a/lib/logic/api_maps/hetzner.dart b/lib/logic/api_maps/hetzner.dart index 4de4f36f..d672b358 100644 --- a/lib/logic/api_maps/hetzner.dart +++ b/lib/logic/api_maps/hetzner.dart @@ -56,24 +56,162 @@ class HetznerApi extends ApiMap { } } - Future createVolume() async { + Future createVolume() async { + ServerVolume? volume; + + final Response dbCreateResponse; final Dio client = await getClient(); - final Response dbCreateResponse = await client.post( - '/volumes', - data: { - 'size': 10, - 'name': StringGenerators.dbStorageName(), - 'labels': {'labelkey': 'value'}, - 'location': 'fsn1', - 'automount': false, - 'format': 'ext4' - }, - ); - final dbId = dbCreateResponse.data['volume']['id']; - return ServerVolume( - id: dbId, - name: dbCreateResponse.data['volume']['name'], - ); + try { + dbCreateResponse = await client.post( + '/volumes', + data: { + 'size': 10, + 'name': StringGenerators.dbStorageName(), + 'labels': {'labelkey': 'value'}, + 'location': 'fsn1', + 'automount': false, + 'format': 'ext4' + }, + ); + final dbId = dbCreateResponse.data['volume']['id']; + final dbName = dbCreateResponse.data['volume']['name']; + volume = ServerVolume( + id: dbId, + name: dbName, + ); + } catch (e) { + print(e); + } finally { + client.close(); + } + + return volume; + } + + Future> getVolumes(final String? status) async { + final List volumes = []; + + final Response dbGetResponse; + final Dio client = await getClient(); + try { + dbGetResponse = await client.get( + '/volumes', + queryParameters: { + 'status': status, + }, + ); + final List rawVolumes = dbGetResponse.data['volumes']; + for (final rawVolume in rawVolumes) { + final int dbId = rawVolume['id']; + final String dbName = rawVolume['name']; + final volume = ServerVolume( + id: dbId, + name: dbName, + ); + volumes.add(volume); + } + } catch (e) { + print(e); + } finally { + client.close(); + } + + return volumes; + } + + Future getVolume(final int id) async { + ServerVolume? volume; + + final Response dbGetResponse; + final Dio client = await getClient(); + try { + dbGetResponse = await client.get('/volumes/$id'); + final int dbId = dbGetResponse.data['volume']['id']; + final String dbName = dbGetResponse.data['volume']['name']; + volume = ServerVolume( + id: dbId, + name: dbName, + ); + } catch (e) { + print(e); + } finally { + client.close(); + } + + return volume; + } + + void deleteVolume(final int id) async { + final Dio client = await getClient(); + try { + await client.delete('/volumes/$id'); + } catch (e) { + print(e); + } finally { + client.close(); + } + } + + Future attachVolume(final int volumeId, final int serverId) async { + bool success = false; + + final Response dbPostResponse; + final Dio client = await getClient(); + try { + dbPostResponse = await client.post( + '/volumes/$volumeId/actions/attach', + data: { + 'automount': true, + 'server': serverId, + }, + ); + success = dbPostResponse.data['action']['status'].toString() != 'error'; + } catch (e) { + print(e); + } finally { + client.close(); + } + + return success; + } + + Future detachVolume(final int volumeId) async { + bool success = false; + + final Response dbPostResponse; + final Dio client = await getClient(); + try { + dbPostResponse = await client.post('/volumes/$volumeId/actions/detach'); + success = dbPostResponse.data['action']['status'].toString() != 'error'; + } catch (e) { + print(e); + } finally { + client.close(); + } + + return success; + } + + Future resizeVolume(final int volumeId, final int sizeGb) async { + bool success = false; + + final Response dbPostResponse; + final Dio client = await getClient(); + try { + dbPostResponse = await client.post( + '/volumes/$volumeId/actions/resize', + data: { + 'size': sizeGb, + }, + ); + success = dbPostResponse.data['action']['status'].toString() != 'error'; + } catch (e) { + print(e); + } finally { + client.close(); + } + + return success; } Future createServer({ diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index e6eaf3c6..ad23f698 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -212,7 +212,13 @@ class ServerInstallationRepository { late ServerVolume dataBase; try { - dataBase = await hetznerApi.createVolume(); + final ServerVolume? createdVolume = await hetznerApi.createVolume(); + if (createdVolume == null) { + print('Volume is not created!'); + return; + } + + dataBase = createdVolume; final ServerHostingDetails? serverDetails = await hetznerApi.createServer( cloudFlareKey: cloudFlareKey, @@ -220,6 +226,7 @@ class ServerInstallationRepository { domainName: domainName, dataBase: dataBase, ); + if (serverDetails == null) { print('Server is not initialized!'); return; From 0a919907c8291aaadda240899061cefe65f036fe Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 27 Jun 2022 10:07:11 +0300 Subject: [PATCH 008/115] Implement hetzner volumes cubit --- lib/logic/api_maps/hetzner.dart | 14 +++- lib/logic/cubit/devices/devices_cubit.dart | 11 ++- .../server_installation_cubit.dart | 2 + .../server_installation_repository.dart | 8 +++ lib/logic/cubit/volumes/volumes_cubit.dart | 70 +++++++++++++++++++ lib/logic/cubit/volumes/volumes_state.dart | 23 ++++++ lib/logic/models/hive/server_details.dart | 6 ++ 7 files changed, 127 insertions(+), 7 deletions(-) create mode 100644 lib/logic/cubit/volumes/volumes_cubit.dart create mode 100644 lib/logic/cubit/volumes/volumes_state.dart diff --git a/lib/logic/api_maps/hetzner.dart b/lib/logic/api_maps/hetzner.dart index d672b358..361b369a 100644 --- a/lib/logic/api_maps/hetzner.dart +++ b/lib/logic/api_maps/hetzner.dart @@ -74,10 +74,14 @@ class HetznerApi extends ApiMap { }, ); final dbId = dbCreateResponse.data['volume']['id']; + final dbSize = dbCreateResponse.data['volume']['size']; + final dbServer = dbCreateResponse.data['volume']['server']; final dbName = dbCreateResponse.data['volume']['name']; volume = ServerVolume( id: dbId, name: dbName, + sizeGb: dbSize, + serverId: dbServer, ); } catch (e) { print(e); @@ -88,7 +92,7 @@ class HetznerApi extends ApiMap { return volume; } - Future> getVolumes(final String? status) async { + Future> getVolumes({final String? status}) async { final List volumes = []; final Response dbGetResponse; @@ -103,10 +107,14 @@ class HetznerApi extends ApiMap { final List rawVolumes = dbGetResponse.data['volumes']; for (final rawVolume in rawVolumes) { final int dbId = rawVolume['id']; + final int dbSize = rawVolume['size']; + final dbServer = rawVolume['server']; final String dbName = rawVolume['name']; final volume = ServerVolume( id: dbId, name: dbName, + sizeGb: dbSize, + serverId: dbServer, ); volumes.add(volume); } @@ -127,10 +135,14 @@ class HetznerApi extends ApiMap { try { dbGetResponse = await client.get('/volumes/$id'); final int dbId = dbGetResponse.data['volume']['id']; + final int dbSize = dbGetResponse.data['volume']['size']; + final int dbServer = dbGetResponse.data['volume']['server']; final String dbName = dbGetResponse.data['volume']['name']; volume = ServerVolume( id: dbId, name: dbName, + sizeGb: dbSize, + serverId: dbServer, ); } catch (e) { print(e); diff --git a/lib/logic/cubit/devices/devices_cubit.dart b/lib/logic/cubit/devices/devices_cubit.dart index f0380635..a7e80e17 100644 --- a/lib/logic/cubit/devices/devices_cubit.dart +++ b/lib/logic/cubit/devices/devices_cubit.dart @@ -16,17 +16,16 @@ class ApiDevicesCubit @override void load() async { if (serverInstallationCubit.state is ServerInstallationFinished) { - final List? devices = await _getApiTokens(); - if (devices != null) { - emit(ApiDevicesState(devices, LoadingStatus.success)); - } else { - emit(const ApiDevicesState([], LoadingStatus.error)); - } + _refetch(); } } Future refresh() async { emit(const ApiDevicesState([], LoadingStatus.refreshing)); + _refetch(); + } + + void _refetch() async { final List? devices = await _getApiTokens(); if (devices != null) { emit(ApiDevicesState(devices, LoadingStatus.success)); diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 05198229..2c982ff2 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -491,6 +491,8 @@ class ServerInstallationCubit extends Cubit { volume: ServerVolume( id: server.volumeId, name: 'recovered_volume', + sizeGb: 10, // ????? + serverId: server.id, ), apiToken: dataState.serverDetails!.apiToken, provider: ServerProvider.hetzner, diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index ad23f698..bdf08afe 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -451,6 +451,8 @@ class ServerInstallationRepository { volume: ServerVolume( id: 0, name: '', + sizeGb: 10, + serverId: 0, ), provider: ServerProvider.unknown, id: 0, @@ -485,6 +487,8 @@ class ServerInstallationRepository { volume: ServerVolume( id: 0, name: '', + sizeGb: 10, + serverId: 0, ), provider: ServerProvider.unknown, id: 0, @@ -519,6 +523,8 @@ class ServerInstallationRepository { volume: ServerVolume( id: 0, name: '', + serverId: 0, + sizeGb: 10, ), provider: ServerProvider.unknown, id: 0, @@ -544,6 +550,8 @@ class ServerInstallationRepository { volume: ServerVolume( id: 0, name: '', + sizeGb: 10, + serverId: 0, ), provider: ServerProvider.unknown, id: 0, diff --git a/lib/logic/cubit/volumes/volumes_cubit.dart b/lib/logic/cubit/volumes/volumes_cubit.dart new file mode 100644 index 00000000..5444ae4d --- /dev/null +++ b/lib/logic/cubit/volumes/volumes_cubit.dart @@ -0,0 +1,70 @@ +import 'package:selfprivacy/config/get_it_config.dart'; +import 'package:selfprivacy/logic/api_maps/hetzner.dart'; +import 'package:selfprivacy/logic/api_maps/server.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/hive/server_details.dart'; + +part 'volumes_state.dart'; + +class ApiVolumesCubit + extends ServerInstallationDependendCubit { + ApiVolumesCubit(final ServerInstallationCubit serverInstallationCubit) + : super(serverInstallationCubit, const ApiVolumesState.initial()); + + final ServerApi api = ServerApi(); + + @override + void load() async { + if (serverInstallationCubit.state is ServerInstallationFinished) { + _refetch(); + } + } + + void refresh() async { + emit(const ApiVolumesState([], LoadingStatus.refreshing)); + _refetch(); + } + + void _refetch() async { + final List volumes = await HetznerApi().getVolumes(); + if (volumes.isNotEmpty) { + emit(ApiVolumesState(volumes, LoadingStatus.success)); + } else { + emit(const ApiVolumesState([], LoadingStatus.error)); + } + } + + void attachVolume(final ServerVolume volume) async { + final ServerHostingDetails server = getIt().serverDetails!; + HetznerApi().attachVolume(volume.id, server.id); + refresh(); + } + + void detachVolume(final ServerVolume volume) async { + HetznerApi().detachVolume(volume.id); + refresh(); + } + + void resizeVolume(final ServerVolume volume, final int newSizeGb) { + if (volume.sizeGb < newSizeGb) { + HetznerApi().resizeVolume(volume.id, newSizeGb); + refresh(); + } + } + + void createVolume() async { + HetznerApi().createVolume(); + refresh(); + } + + void deleteVolume(final ServerVolume volume) async { + HetznerApi().deleteVolume(volume.id); + refresh(); + } + + @override + void clear() { + emit(const ApiVolumesState.initial()); + } +} diff --git a/lib/logic/cubit/volumes/volumes_state.dart b/lib/logic/cubit/volumes/volumes_state.dart new file mode 100644 index 00000000..cdc14272 --- /dev/null +++ b/lib/logic/cubit/volumes/volumes_state.dart @@ -0,0 +1,23 @@ +part of 'volumes_cubit.dart'; + +class ApiVolumesState extends ServerInstallationDependendState { + const ApiVolumesState(this._volumes, this.status); + + const ApiVolumesState.initial() : this(const [], LoadingStatus.uninitialized); + final List _volumes; + final LoadingStatus status; + + List get volumes => _volumes; + + ApiVolumesState copyWith({ + final List? volumes, + final LoadingStatus? status, + }) => + ApiVolumesState( + volumes ?? _volumes, + status ?? this.status, + ); + + @override + List get props => [_volumes]; +} diff --git a/lib/logic/models/hive/server_details.dart b/lib/logic/models/hive/server_details.dart index 5188e62e..5924f807 100644 --- a/lib/logic/models/hive/server_details.dart +++ b/lib/logic/models/hive/server_details.dart @@ -55,12 +55,18 @@ class ServerVolume { ServerVolume({ required this.id, required this.name, + required this.sizeGb, + required this.serverId, }); @HiveField(1) int id; @HiveField(2) String name; + @HiveField(3, defaultValue: 10) + int sizeGb; + @HiveField(4, defaultValue: null) + int? serverId; } @HiveType(typeId: 101) From 5fd8a6859763bc8aba5c838172de745582ce24e0 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 28 Jun 2022 21:06:52 +0300 Subject: [PATCH 009/115] Change volume size from Gb to Byte --- lib/logic/api_maps/hetzner.dart | 6 +++--- .../server_installation/server_installation_cubit.dart | 2 +- .../server_installation_repository.dart | 8 ++++---- lib/logic/cubit/volumes/volumes_cubit.dart | 2 +- lib/logic/models/hive/server_details.dart | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/logic/api_maps/hetzner.dart b/lib/logic/api_maps/hetzner.dart index 361b369a..3345633f 100644 --- a/lib/logic/api_maps/hetzner.dart +++ b/lib/logic/api_maps/hetzner.dart @@ -80,7 +80,7 @@ class HetznerApi extends ApiMap { volume = ServerVolume( id: dbId, name: dbName, - sizeGb: dbSize, + sizeByte: dbSize, serverId: dbServer, ); } catch (e) { @@ -113,7 +113,7 @@ class HetznerApi extends ApiMap { final volume = ServerVolume( id: dbId, name: dbName, - sizeGb: dbSize, + sizeByte: dbSize, serverId: dbServer, ); volumes.add(volume); @@ -141,7 +141,7 @@ class HetznerApi extends ApiMap { volume = ServerVolume( id: dbId, name: dbName, - sizeGb: dbSize, + sizeByte: dbSize, serverId: dbServer, ); } catch (e) { diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 2c982ff2..30bc828b 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -491,7 +491,7 @@ class ServerInstallationCubit extends Cubit { volume: ServerVolume( id: server.volumeId, name: 'recovered_volume', - sizeGb: 10, // ????? + sizeByte: 0, serverId: server.id, ), apiToken: dataState.serverDetails!.apiToken, diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index bdf08afe..842c1db2 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -451,7 +451,7 @@ class ServerInstallationRepository { volume: ServerVolume( id: 0, name: '', - sizeGb: 10, + sizeByte: 0, serverId: 0, ), provider: ServerProvider.unknown, @@ -487,7 +487,7 @@ class ServerInstallationRepository { volume: ServerVolume( id: 0, name: '', - sizeGb: 10, + sizeByte: 0, serverId: 0, ), provider: ServerProvider.unknown, @@ -524,7 +524,7 @@ class ServerInstallationRepository { id: 0, name: '', serverId: 0, - sizeGb: 10, + sizeByte: 0, ), provider: ServerProvider.unknown, id: 0, @@ -550,7 +550,7 @@ class ServerInstallationRepository { volume: ServerVolume( id: 0, name: '', - sizeGb: 10, + sizeByte: 0, serverId: 0, ), provider: ServerProvider.unknown, diff --git a/lib/logic/cubit/volumes/volumes_cubit.dart b/lib/logic/cubit/volumes/volumes_cubit.dart index 5444ae4d..8fcc6d55 100644 --- a/lib/logic/cubit/volumes/volumes_cubit.dart +++ b/lib/logic/cubit/volumes/volumes_cubit.dart @@ -47,7 +47,7 @@ class ApiVolumesCubit } void resizeVolume(final ServerVolume volume, final int newSizeGb) { - if (volume.sizeGb < newSizeGb) { + if (volume.sizeByte < newSizeGb) { HetznerApi().resizeVolume(volume.id, newSizeGb); refresh(); } diff --git a/lib/logic/models/hive/server_details.dart b/lib/logic/models/hive/server_details.dart index 5924f807..44c8d5b3 100644 --- a/lib/logic/models/hive/server_details.dart +++ b/lib/logic/models/hive/server_details.dart @@ -55,7 +55,7 @@ class ServerVolume { ServerVolume({ required this.id, required this.name, - required this.sizeGb, + required this.sizeByte, required this.serverId, }); @@ -63,8 +63,8 @@ class ServerVolume { int id; @HiveField(2) String name; - @HiveField(3, defaultValue: 10) - int sizeGb; + @HiveField(3, defaultValue: 10737418240) // 10 Gb + int sizeByte; @HiveField(4, defaultValue: null) int? serverId; } From 37b7e9f839f8ddd47e48b57db589aff28b3c20ab Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 12 Jul 2022 15:54:16 +0300 Subject: [PATCH 010/115] Implement Provider Api Abstractions --- build.yaml | 13 +- .../schema/get_api_tokens.graphql | 9 + .../schema/get_api_tokens.graphql.g.dart | 34 ++++ .../schema/get_api_version.graphql | 5 + .../schema/get_api_version.graphql.g.dart | 22 +++ .../graphql_maps/schema/schema.graphql | 151 +++++++++++++++ .../graphql_maps/schema/schema.graphql.g.dart | 28 +++ .../rest_maps/api_factory_creator.dart | 39 ++++ .../api_maps/{ => rest_maps}/api_map.dart | 0 .../api_maps/{ => rest_maps}/backblaze.dart | 2 +- .../api_maps/{ => rest_maps}/cloudflare.dart | 2 +- .../providers/hetzner}/hetzner.dart | 151 ++++++++++----- .../providers/hetzner/hetzner_factory.dart | 25 +++ .../rest_maps/providers/provider.dart | 32 ++++ .../rest_maps/providers/provider_factory.dart | 20 ++ .../rest_maps/providers/volume_provider.dart | 17 ++ .../api_maps/{ => rest_maps}/server.dart | 2 +- lib/logic/cubit/backups/backups_cubit.dart | 4 +- lib/logic/cubit/devices/devices_cubit.dart | 2 +- .../cubit/dns_records/dns_records_cubit.dart | 4 +- .../initializing/backblaze_form_cubit.dart | 2 +- .../initializing/cloudflare_form_cubit.dart | 2 +- .../setup/initializing/domain_cloudflare.dart | 2 +- .../initializing/hetzner_form_cubit.dart | 13 +- .../recovery_domain_form_cubit.dart | 2 +- .../hetzner_metrics_repository.dart | 2 +- lib/logic/cubit/jobs/jobs_cubit.dart | 2 +- .../recovery_key/recovery_key_cubit.dart | 2 +- .../server_detailed_info_cubit.dart | 2 +- .../server_detailed_info_repository.dart | 8 +- .../server_detailed_info_state.dart | 2 +- .../server_installation_cubit.dart | 60 +++++- .../server_installation_repository.dart | 140 +++++++++----- .../server_installation_state.dart | 38 ++-- lib/logic/cubit/services/services_cubit.dart | 2 +- lib/logic/cubit/users/users_cubit.dart | 2 +- lib/logic/cubit/volumes/volumes_cubit.dart | 30 +-- lib/logic/models/hive/server_details.g.dart | 10 +- lib/logic/models/hive/user.g.dart | 10 +- .../models/json/hetzner_server_info.dart | 115 ------------ .../models/json/provider_server_info.dart | 115 ++++++++++++ ...nfo.g.dart => provider_server_info.g.dart} | 39 ++-- lib/ui/pages/setup/initializing.dart | 14 +- .../recovery_hentzner_connected.dart | 8 +- lib/utils/scalars.dart | 7 + pubspec.lock | 175 ++++++++++++++++++ pubspec.yaml | 4 + .../flutter/generated_plugin_registrant.cc | 3 + windows/flutter/generated_plugins.cmake | 1 + 49 files changed, 1058 insertions(+), 316 deletions(-) create mode 100644 lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql create mode 100644 lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql.g.dart create mode 100644 lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql create mode 100644 lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql.g.dart create mode 100644 lib/logic/api_maps/graphql_maps/schema/schema.graphql create mode 100644 lib/logic/api_maps/graphql_maps/schema/schema.graphql.g.dart create mode 100644 lib/logic/api_maps/rest_maps/api_factory_creator.dart rename lib/logic/api_maps/{ => rest_maps}/api_map.dart (100%) rename lib/logic/api_maps/{ => rest_maps}/backblaze.dart (98%) rename lib/logic/api_maps/{ => rest_maps}/cloudflare.dart (99%) rename lib/logic/api_maps/{ => rest_maps/providers/hetzner}/hetzner.dart (78%) create mode 100644 lib/logic/api_maps/rest_maps/providers/hetzner/hetzner_factory.dart create mode 100644 lib/logic/api_maps/rest_maps/providers/provider.dart create mode 100644 lib/logic/api_maps/rest_maps/providers/provider_factory.dart create mode 100644 lib/logic/api_maps/rest_maps/providers/volume_provider.dart rename lib/logic/api_maps/{ => rest_maps}/server.dart (99%) delete mode 100644 lib/logic/models/json/hetzner_server_info.dart create mode 100644 lib/logic/models/json/provider_server_info.dart rename lib/logic/models/json/{hetzner_server_info.g.dart => provider_server_info.g.dart} (58%) create mode 100644 lib/utils/scalars.dart diff --git a/build.yaml b/build.yaml index 709b623e..15417c7c 100644 --- a/build.yaml +++ b/build.yaml @@ -1,7 +1,18 @@ targets: $default: builders: + graphql_codegen: + options: + scalars: + DateTime: + type: DateTime + fromJsonFunctionName: dateTimeFromJson + toJsonFunctionName: dateTimeToJson + import: package:selfprivacy/utils/scalars.dart + clients: + - graphql + - graphql_flutter json_serializable: options: create_factory: true - create_to_json: false \ No newline at end of file + create_to_json: false diff --git a/lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql b/lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql new file mode 100644 index 00000000..df9569c0 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql @@ -0,0 +1,9 @@ +query GetApiTokensQuery { + api { + devices { + creationDate + isCaller + name + } + } +} \ No newline at end of file diff --git a/lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql.g.dart b/lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql.g.dart new file mode 100644 index 00000000..508d8010 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql.g.dart @@ -0,0 +1,34 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'get_api_tokens.graphql.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Query$GetApiTokensQuery _$Query$GetApiTokensQueryFromJson( + Map json) => + Query$GetApiTokensQuery( + api: Query$GetApiTokensQuery$api.fromJson( + json['api'] as Map), + $__typename: json['__typename'] as String, + ); + +Query$GetApiTokensQuery$api _$Query$GetApiTokensQuery$apiFromJson( + Map json) => + Query$GetApiTokensQuery$api( + devices: (json['devices'] as List) + .map((e) => Query$GetApiTokensQuery$api$devices.fromJson( + e as Map)) + .toList(), + $__typename: json['__typename'] as String, + ); + +Query$GetApiTokensQuery$api$devices + _$Query$GetApiTokensQuery$api$devicesFromJson(Map json) => + Query$GetApiTokensQuery$api$devices( + creationDate: dateTimeFromJson(json['creationDate']), + isCaller: json['isCaller'] as bool, + name: json['name'] as String, + $__typename: json['__typename'] as String, + ); diff --git a/lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql b/lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql new file mode 100644 index 00000000..cbfeb870 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql @@ -0,0 +1,5 @@ +query GetApiVersionQuery { + api { + version + } +} \ No newline at end of file diff --git a/lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql.g.dart b/lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql.g.dart new file mode 100644 index 00000000..c0b5a378 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql.g.dart @@ -0,0 +1,22 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'get_api_version.graphql.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Query$GetApiVersionQuery _$Query$GetApiVersionQueryFromJson( + Map json) => + Query$GetApiVersionQuery( + api: Query$GetApiVersionQuery$api.fromJson( + json['api'] as Map), + $__typename: json['__typename'] as String, + ); + +Query$GetApiVersionQuery$api _$Query$GetApiVersionQuery$apiFromJson( + Map json) => + Query$GetApiVersionQuery$api( + version: json['version'] as String, + $__typename: json['__typename'] as String, + ); diff --git a/lib/logic/api_maps/graphql_maps/schema/schema.graphql b/lib/logic/api_maps/graphql_maps/schema/schema.graphql new file mode 100644 index 00000000..c4b3246d --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql @@ -0,0 +1,151 @@ +scalar DateTime + +type Alert { + severity: Severity! + title: String! + message: String! + timestamp: DateTime +} + +type Api { + version: String! + devices: [ApiDevice!]! + recoveryKey: ApiRecoveryKeyStatus! +} + +type ApiDevice { + name: String! + creationDate: DateTime! + isCaller: Boolean! +} + +type ApiKeyMutationReturn implements MutationReturnInterface { + success: Boolean! + message: String! + code: Int! + key: String +} + +type ApiRecoveryKeyStatus { + exists: Boolean! + valid: Boolean! + creationDate: DateTime + expirationDate: DateTime + usesLeft: Int +} + +type AutoUpgradeOptions { + enable: Boolean! + allowReboot: Boolean! +} + +type DeviceApiTokenMutationReturn implements MutationReturnInterface { + success: Boolean! + message: String! + code: Int! + token: String +} + +enum DnsProvider { + CLOUDFLARE +} + +type DnsRecord { + recordType: String! + name: String! + content: String! + ttl: Int! + priority: Int +} + +type GenericMutationReturn implements MutationReturnInterface { + success: Boolean! + message: String! + code: Int! +} + +type Mutation { + getNewRecoveryApiKey(limits: RecoveryKeyLimitsInput!): ApiKeyMutationReturn! + useRecoveryApiKey(input: UseRecoveryKeyInput!): DeviceApiTokenMutationReturn! + refreshDeviceApiToken: DeviceApiTokenMutationReturn! + deleteDeviceApiToken(device: String!): GenericMutationReturn! + getNewDeviceApiKey: ApiKeyMutationReturn! + invalidateNewDeviceApiKey: GenericMutationReturn! + authorizeWithNewDeviceApiKey(input: UseNewDeviceKeyInput!): DeviceApiTokenMutationReturn! +} + +interface MutationReturnInterface { + success: Boolean! + message: String! + code: Int! +} + +type Query { + system: System! + api: Api! +} + +input RecoveryKeyLimitsInput { + expirationDate: DateTime + uses: Int +} + +enum ServerProvider { + HETZNER +} + +enum Severity { + INFO + WARNING + ERROR + CRITICAL + SUCCESS +} + +type SshSettings { + enable: Boolean! + passwordAuthentication: Boolean! + rootSshKeys: [String!]! +} + +type System { + status: Alert! + domain: SystemDomainInfo! + settings: SystemSettings! + info: SystemInfo! + provider: SystemProviderInfo! + busy: Boolean! +} + +type SystemDomainInfo { + domain: String! + hostname: String! + provider: DnsProvider! + requiredDnsRecords: [DnsRecord!]! +} + +type SystemInfo { + systemVersion: String! + pythonVersion: String! +} + +type SystemProviderInfo { + provider: ServerProvider! + id: String! +} + +type SystemSettings { + autoUpgrade: AutoUpgradeOptions! + ssh: SshSettings! + timezone: String! +} + +input UseNewDeviceKeyInput { + key: String! + deviceName: String! +} + +input UseRecoveryKeyInput { + key: String! + deviceName: String! +} 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 new file mode 100644 index 00000000..84a4c38f --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.g.dart @@ -0,0 +1,28 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'schema.graphql.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Input$RecoveryKeyLimitsInput _$Input$RecoveryKeyLimitsInputFromJson( + Map json) => + Input$RecoveryKeyLimitsInput( + expirationDate: _nullable$dateTimeFromJson(json['expirationDate']), + uses: json['uses'] as int?, + ); + +Input$UseNewDeviceKeyInput _$Input$UseNewDeviceKeyInputFromJson( + Map json) => + Input$UseNewDeviceKeyInput( + key: json['key'] as String, + deviceName: json['deviceName'] as String, + ); + +Input$UseRecoveryKeyInput _$Input$UseRecoveryKeyInputFromJson( + Map json) => + Input$UseRecoveryKeyInput( + key: json['key'] as String, + deviceName: json['deviceName'] as String, + ); diff --git a/lib/logic/api_maps/rest_maps/api_factory_creator.dart b/lib/logic/api_maps/rest_maps/api_factory_creator.dart new file mode 100644 index 00000000..0343f402 --- /dev/null +++ b/lib/logic/api_maps/rest_maps/api_factory_creator.dart @@ -0,0 +1,39 @@ +import 'package:selfprivacy/logic/api_maps/rest_maps/providers/hetzner/hetzner_factory.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/providers/provider_factory.dart'; +import 'package:selfprivacy/logic/models/hive/server_details.dart'; + +class ApiFactoryCreator { + static ProviderApiFactory createProviderApiFactory( + final ServerProvider provider, + ) { + switch (provider) { + case ServerProvider.hetzner: + case ServerProvider.unknown: // ?? :) + return HetznerApiFactory(); + } + } + + // createDnsApiFactory + + // createStorageApiFactory + + // etc . . . +} + +class VolumeApiFactoryCreator { + static VolumeProviderApiFactory createVolumeProviderApiFactory( + final ServerProvider provider, + ) { + switch (provider) { + case ServerProvider.hetzner: + case ServerProvider.unknown: // ?? :) + return HetznerApiFactory(); + } + } + + // createDnsApiFactory + + // createStorageApiFactory + + // etc . . . +} diff --git a/lib/logic/api_maps/api_map.dart b/lib/logic/api_maps/rest_maps/api_map.dart similarity index 100% rename from lib/logic/api_maps/api_map.dart rename to lib/logic/api_maps/rest_maps/api_map.dart diff --git a/lib/logic/api_maps/backblaze.dart b/lib/logic/api_maps/rest_maps/backblaze.dart similarity index 98% rename from lib/logic/api_maps/backblaze.dart rename to lib/logic/api_maps/rest_maps/backblaze.dart index 8d827e78..5140311d 100644 --- a/lib/logic/api_maps/backblaze.dart +++ b/lib/logic/api_maps/rest_maps/backblaze.dart @@ -2,7 +2,7 @@ import 'dart:io'; import 'package:dio/dio.dart'; import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/api_map.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; import 'package:selfprivacy/logic/models/hive/backblaze_credential.dart'; class BackblazeApiAuth { diff --git a/lib/logic/api_maps/cloudflare.dart b/lib/logic/api_maps/rest_maps/cloudflare.dart similarity index 99% rename from lib/logic/api_maps/cloudflare.dart rename to lib/logic/api_maps/rest_maps/cloudflare.dart index 9141d5fe..2b78c6fe 100644 --- a/lib/logic/api_maps/cloudflare.dart +++ b/lib/logic/api_maps/rest_maps/cloudflare.dart @@ -2,7 +2,7 @@ import 'dart:io'; import 'package:dio/dio.dart'; import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/api_map.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'; diff --git a/lib/logic/api_maps/hetzner.dart b/lib/logic/api_maps/rest_maps/providers/hetzner/hetzner.dart similarity index 78% rename from lib/logic/api_maps/hetzner.dart rename to lib/logic/api_maps/rest_maps/providers/hetzner/hetzner.dart index 3345633f..57582fee 100644 --- a/lib/logic/api_maps/hetzner.dart +++ b/lib/logic/api_maps/rest_maps/providers/hetzner/hetzner.dart @@ -3,18 +3,15 @@ import 'dart:io'; import 'package:dio/dio.dart'; import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/api_map.dart'; -import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/providers/volume_provider.dart'; +import 'package:selfprivacy/logic/models/hive/server_domain.dart'; +import 'package:selfprivacy/logic/models/json/provider_server_info.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; import 'package:selfprivacy/utils/password_generator.dart'; -class HetznerApi extends ApiMap { - HetznerApi({this.hasLogger = false, this.isWithToken = true}); - @override - bool hasLogger; - @override - bool isWithToken; +class HetznerApi extends VolumeProviderApi { + HetznerApi({final super.hasLogger = false, final super.isWithToken = true}); @override BaseOptions get options { @@ -35,27 +32,43 @@ class HetznerApi extends ApiMap { @override String rootAddress = 'https://api.hetzner.cloud/v1'; - Future isValid(final String token) async { - validateStatus = (final int? status) => - status == HttpStatus.ok || status == HttpStatus.unauthorized; + @override + Future isApiTokenValid(final String token) async { + bool isValid = false; + Response? response; final Dio client = await getClient(); - final Response response = await client.get( - '/servers', - options: Options( - headers: {'Authorization': 'Bearer $token'}, - ), - ); - close(client); - - if (response.statusCode == HttpStatus.ok) { - return true; - } else if (response.statusCode == HttpStatus.unauthorized) { - return false; - } else { - throw Exception('code: ${response.statusCode}'); + try { + response = await client.get( + '/servers', + options: Options( + headers: {'Authorization': 'Bearer $token'}, + ), + ); + } catch (e) { + print(e); + isValid = false; + } finally { + close(client); } + + if (response != null) { + if (response.statusCode == HttpStatus.ok) { + isValid = true; + } else if (response.statusCode == HttpStatus.unauthorized) { + isValid = false; + } else { + throw Exception('code: ${response.statusCode}'); + } + } + + return isValid; } + @override + RegExp getApiTokenValidation() => + RegExp(r'\s+|[-!$%^&*()@+|~=`{}\[\]:<>?,.\/]'); + + @override Future createVolume() async { ServerVolume? volume; @@ -92,6 +105,7 @@ class HetznerApi extends ApiMap { return volume; } + @override Future> getVolumes({final String? status}) async { final List volumes = []; @@ -127,6 +141,7 @@ class HetznerApi extends ApiMap { return volumes; } + @override Future getVolume(final int id) async { ServerVolume? volume; @@ -153,7 +168,8 @@ class HetznerApi extends ApiMap { return volume; } - void deleteVolume(final int id) async { + @override + Future deleteVolume(final int id) async { final Dio client = await getClient(); try { await client.delete('/volumes/$id'); @@ -164,6 +180,7 @@ class HetznerApi extends ApiMap { } } + @override Future attachVolume(final int volumeId, final int serverId) async { bool success = false; @@ -187,6 +204,7 @@ class HetznerApi extends ApiMap { return success; } + @override Future detachVolume(final int volumeId) async { bool success = false; @@ -204,6 +222,7 @@ class HetznerApi extends ApiMap { return success; } + @override Future resizeVolume(final int volumeId, final int sizeGb) async { bool success = false; @@ -226,8 +245,35 @@ class HetznerApi extends ApiMap { return success; } + @override Future createServer({ - required final String cloudFlareKey, + required final String dnsApiToken, + required final User rootUser, + required final String domainName, + }) async { + ServerHostingDetails? details; + + final ServerVolume? newVolume = await createVolume(); + if (newVolume == null) { + return details; + } + + details = await createServerByVolume( + dnsApiToken: dnsApiToken, + rootUser: rootUser, + domainName: domainName, + dataBase: newVolume, + ); + + if (details == null) { + deleteVolume(newVolume.id); + } + + return details; + } + + Future createServerByVolume({ + required final String dnsApiToken, required final User rootUser, required final String domainName, required final ServerVolume dataBase, @@ -250,7 +296,7 @@ class HetznerApi extends ApiMap { /// check the branch name, it could be "development" or "master". /// final String userdataString = - "#cloud-config\nruncmd:\n- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/master/nixos-infect | PROVIDER=hetzner NIX_CHANNEL=nixos-21.05 DOMAIN='$domainName' LUSER='${rootUser.login}' ENCODED_PASSWORD='$base64Password' CF_TOKEN=$cloudFlareKey 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/master/nixos-infect | PROVIDER=hetzner 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"; print(userdataString); final Map data = { @@ -285,6 +331,7 @@ class HetznerApi extends ApiMap { ); } on DioError catch (e) { print(e); + deleteVolume(dataBase.id); rethrow; } catch (e) { print(e); @@ -312,7 +359,8 @@ class HetznerApi extends ApiMap { return hostname; } - Future deleteSelfprivacyServerAndAllVolumes({ + @override + Future deleteServer({ required final String domainName, }) async { final Dio client = await getClient(); @@ -339,22 +387,34 @@ class HetznerApi extends ApiMap { close(client); } - Future reset() async { + @override + Future restart() async { final ServerHostingDetails server = getIt().serverDetails!; final Dio client = await getClient(); - await client.post('/servers/${server.id}/actions/reset'); - close(client); + try { + await client.post('/servers/${server.id}/actions/reset'); + } catch (e) { + print(e); + } finally { + close(client); + } return server.copyWith(startTime: DateTime.now()); } + @override Future powerOn() async { final ServerHostingDetails server = getIt().serverDetails!; final Dio client = await getClient(); - await client.post('/servers/${server.id}/actions/poweron'); - close(client); + try { + await client.post('/servers/${server.id}/actions/poweron'); + } catch (e) { + print(e); + } finally { + close(client); + } return server.copyWith(startTime: DateTime.now()); } @@ -381,41 +441,40 @@ class HetznerApi extends ApiMap { return res.data; } - Future getInfo() async { + Future getInfo() async { final ServerHostingDetails? hetznerServer = getIt().serverDetails; final Dio client = await getClient(); final Response response = await client.get('/servers/${hetznerServer!.id}'); close(client); - return HetznerServerInfo.fromJson(response.data!['server']); + return ProviderServerInfo.fromJson(response.data!['server']); } - Future> getServers() async { + @override + Future> getServers() async { final Dio client = await getClient(); final Response response = await client.get('/servers'); close(client); return (response.data!['servers'] as List) // ignore: unnecessary_lambdas - .map((final e) => HetznerServerInfo.fromJson(e)) + .map((final e) => ProviderServerInfo.fromJson(e)) .toList(); } + @override Future createReverseDns({ - required final String ip4, - required final String domainName, + required final ServerHostingDetails serverDetails, + required final ServerDomain domain, }) async { - final ServerHostingDetails? hetznerServer = - getIt().serverDetails; - final Dio client = await getClient(); try { await client.post( - '/servers/${hetznerServer!.id}/actions/change_dns_ptr', + '/servers/${serverDetails.id}/actions/change_dns_ptr', data: { - 'ip': ip4, - 'dns_ptr': domainName, + 'ip': serverDetails.ip4, + 'dns_ptr': domain.domainName, }, ); } catch (e) { diff --git a/lib/logic/api_maps/rest_maps/providers/hetzner/hetzner_factory.dart b/lib/logic/api_maps/rest_maps/providers/hetzner/hetzner_factory.dart new file mode 100644 index 00000000..e047da13 --- /dev/null +++ b/lib/logic/api_maps/rest_maps/providers/hetzner/hetzner_factory.dart @@ -0,0 +1,25 @@ +import 'package:selfprivacy/logic/api_maps/rest_maps/providers/hetzner/hetzner.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/providers/provider.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/providers/provider_factory.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/providers/volume_provider.dart'; + +class HetznerApiFactory extends ProviderApiFactory + with VolumeProviderApiFactory { + @override + ProviderApi getProvider({ + final ProviderApiSettings settings = const ProviderApiSettings(), + }) => + HetznerApi( + hasLogger: settings.hasLogger, + isWithToken: settings.isWithToken, + ); + + @override + VolumeProviderApi getVolumeProvider({ + final ProviderApiSettings settings = const ProviderApiSettings(), + }) => + HetznerApi( + hasLogger: settings.hasLogger, + isWithToken: settings.isWithToken, + ); +} diff --git a/lib/logic/api_maps/rest_maps/providers/provider.dart b/lib/logic/api_maps/rest_maps/providers/provider.dart new file mode 100644 index 00000000..c431379e --- /dev/null +++ b/lib/logic/api_maps/rest_maps/providers/provider.dart @@ -0,0 +1,32 @@ +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/json/provider_server_info.dart'; + +abstract class ProviderApi extends ApiMap { + ProviderApi({this.hasLogger = false, this.isWithToken = true}); + @override + bool hasLogger; + @override + bool isWithToken; + + Future> getServers(); + + Future restart(); + Future powerOn(); + + Future deleteServer({required final String domainName}); + Future createServer({ + required final String dnsApiToken, + required final User rootUser, + required final String domainName, + }); + Future createReverseDns({ + required final ServerHostingDetails serverDetails, + required final ServerDomain domain, + }); + + Future isApiTokenValid(final String token); + RegExp getApiTokenValidation(); +} diff --git a/lib/logic/api_maps/rest_maps/providers/provider_factory.dart b/lib/logic/api_maps/rest_maps/providers/provider_factory.dart new file mode 100644 index 00000000..a899b28c --- /dev/null +++ b/lib/logic/api_maps/rest_maps/providers/provider_factory.dart @@ -0,0 +1,20 @@ +import 'package:selfprivacy/logic/api_maps/rest_maps/providers/provider.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/providers/volume_provider.dart'; + +class ProviderApiSettings { + const ProviderApiSettings({this.hasLogger = false, this.isWithToken = true}); + final bool hasLogger; + final bool isWithToken; +} + +abstract class ProviderApiFactory { + ProviderApi getProvider({ + final ProviderApiSettings settings = const ProviderApiSettings(), + }); +} + +mixin VolumeProviderApiFactory { + VolumeProviderApi getVolumeProvider({ + final ProviderApiSettings settings = const ProviderApiSettings(), + }); +} diff --git a/lib/logic/api_maps/rest_maps/providers/volume_provider.dart b/lib/logic/api_maps/rest_maps/providers/volume_provider.dart new file mode 100644 index 00000000..cf598f18 --- /dev/null +++ b/lib/logic/api_maps/rest_maps/providers/volume_provider.dart @@ -0,0 +1,17 @@ +import 'package:selfprivacy/logic/api_maps/rest_maps/providers/provider.dart'; +import 'package:selfprivacy/logic/models/hive/server_details.dart'; + +abstract class VolumeProviderApi extends ProviderApi { + VolumeProviderApi({ + final super.hasLogger = false, + final super.isWithToken = true, + }); + + Future createVolume(); + Future> getVolumes({final String? status}); + Future getVolume(final int id); + Future attachVolume(final int volumeId, final int serverId); + Future detachVolume(final int volumeId); + Future resizeVolume(final int volumeId, final int sizeGb); + Future deleteVolume(final int id); +} diff --git a/lib/logic/api_maps/server.dart b/lib/logic/api_maps/rest_maps/server.dart similarity index 99% rename from lib/logic/api_maps/server.dart rename to lib/logic/api_maps/rest_maps/server.dart index 67a0739c..3cb2ed73 100644 --- a/lib/logic/api_maps/server.dart +++ b/lib/logic/api_maps/rest_maps/server.dart @@ -15,7 +15,7 @@ import 'package:selfprivacy/logic/models/json/device_token.dart'; import 'package:selfprivacy/logic/models/json/recovery_token_status.dart'; import 'package:selfprivacy/logic/models/timezone_settings.dart'; -import 'package:selfprivacy/logic/api_maps/api_map.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; class ApiResponse { ApiResponse({ diff --git a/lib/logic/cubit/backups/backups_cubit.dart b/lib/logic/cubit/backups/backups_cubit.dart index 63cdfb3e..bb89bb49 100644 --- a/lib/logic/cubit/backups/backups_cubit.dart +++ b/lib/logic/cubit/backups/backups_cubit.dart @@ -2,8 +2,8 @@ import 'dart:async'; import 'package:easy_localization/easy_localization.dart'; import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/backblaze.dart'; -import 'package:selfprivacy/logic/api_maps/server.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/backblaze.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; import 'package:selfprivacy/logic/models/hive/backblaze_bucket.dart'; import 'package:selfprivacy/logic/models/json/backup.dart'; diff --git a/lib/logic/cubit/devices/devices_cubit.dart b/lib/logic/cubit/devices/devices_cubit.dart index a7e80e17..6aa71400 100644 --- a/lib/logic/cubit/devices/devices_cubit.dart +++ b/lib/logic/cubit/devices/devices_cubit.dart @@ -1,5 +1,5 @@ import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/server.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server.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/json/api_token.dart'; diff --git a/lib/logic/cubit/dns_records/dns_records_cubit.dart b/lib/logic/cubit/dns_records/dns_records_cubit.dart index 0590b065..8d8ae496 100644 --- a/lib/logic/cubit/dns_records/dns_records_cubit.dart +++ b/lib/logic/cubit/dns_records/dns_records_cubit.dart @@ -3,8 +3,8 @@ import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_depe import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; -import 'package:selfprivacy/logic/api_maps/cloudflare.dart'; -import 'package:selfprivacy/logic/api_maps/server.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/cloudflare.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server.dart'; part 'dns_records_state.dart'; 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 04d2993e..2a9f4662 100644 --- a/lib/logic/cubit/forms/setup/initializing/backblaze_form_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/backblaze_form_cubit.dart @@ -1,6 +1,6 @@ import 'dart:async'; import 'package:cubit_form/cubit_form.dart'; -import 'package:selfprivacy/logic/api_maps/backblaze.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/backblaze.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/models/hive/backblaze_credential.dart'; import 'package:easy_localization/easy_localization.dart'; diff --git a/lib/logic/cubit/forms/setup/initializing/cloudflare_form_cubit.dart b/lib/logic/cubit/forms/setup/initializing/cloudflare_form_cubit.dart index 6a4b3b30..20c99f38 100644 --- a/lib/logic/cubit/forms/setup/initializing/cloudflare_form_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/cloudflare_form_cubit.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'package:cubit_form/cubit_form.dart'; import 'package:easy_localization/easy_localization.dart'; -import 'package:selfprivacy/logic/api_maps/cloudflare.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/cloudflare.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/cubit/forms/validations/validations.dart'; diff --git a/lib/logic/cubit/forms/setup/initializing/domain_cloudflare.dart b/lib/logic/cubit/forms/setup/initializing/domain_cloudflare.dart index 89b50a62..b38e8313 100644 --- a/lib/logic/cubit/forms/setup/initializing/domain_cloudflare.dart +++ b/lib/logic/cubit/forms/setup/initializing/domain_cloudflare.dart @@ -1,5 +1,5 @@ import 'package:cubit_form/cubit_form.dart'; -import 'package:selfprivacy/logic/api_maps/cloudflare.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/cloudflare.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; diff --git a/lib/logic/cubit/forms/setup/initializing/hetzner_form_cubit.dart b/lib/logic/cubit/forms/setup/initializing/hetzner_form_cubit.dart index 11465d9d..24910ad1 100644 --- a/lib/logic/cubit/forms/setup/initializing/hetzner_form_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/hetzner_form_cubit.dart @@ -2,13 +2,13 @@ import 'dart:async'; import 'package:cubit_form/cubit_form.dart'; import 'package:easy_localization/easy_localization.dart'; -import 'package:selfprivacy/logic/api_maps/hetzner.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/cubit/forms/validations/validations.dart'; -class HetznerFormCubit extends FormCubit { - HetznerFormCubit(this.serverInstallationCubit) { - final RegExp regExp = RegExp(r'\s+|[-!$%^&*()@+|~=`{}\[\]:<>?,.\/]'); +class ProviderFormCubit extends FormCubit { + ProviderFormCubit(this.serverInstallationCubit) { + final RegExp regExp = + serverInstallationCubit.getProviderApiTokenValidation(); apiKey = FieldCubit( initalValue: '', validations: [ @@ -30,16 +30,15 @@ class HetznerFormCubit extends FormCubit { } final ServerInstallationCubit serverInstallationCubit; - late final FieldCubit apiKey; @override FutureOr asyncValidation() async { late bool isKeyValid; - final HetznerApi apiClient = HetznerApi(isWithToken: false); try { - isKeyValid = await apiClient.isValid(apiKey.state.value); + isKeyValid = await serverInstallationCubit + .isProviderApiTokenValid(apiKey.state.value); } catch (e) { addError(e); isKeyValid = false; diff --git a/lib/logic/cubit/forms/setup/recovering/recovery_domain_form_cubit.dart b/lib/logic/cubit/forms/setup/recovering/recovery_domain_form_cubit.dart index 2d029bec..400fdff4 100644 --- a/lib/logic/cubit/forms/setup/recovering/recovery_domain_form_cubit.dart +++ b/lib/logic/cubit/forms/setup/recovering/recovery_domain_form_cubit.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'package:cubit_form/cubit_form.dart'; import 'package:easy_localization/easy_localization.dart'; -import 'package:selfprivacy/logic/api_maps/server.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/cubit/forms/factories/field_cubit_factory.dart'; diff --git a/lib/logic/cubit/hetzner_metrics/hetzner_metrics_repository.dart b/lib/logic/cubit/hetzner_metrics/hetzner_metrics_repository.dart index de7f3d43..9b09d7f6 100644 --- a/lib/logic/cubit/hetzner_metrics/hetzner_metrics_repository.dart +++ b/lib/logic/cubit/hetzner_metrics/hetzner_metrics_repository.dart @@ -1,4 +1,4 @@ -import 'package:selfprivacy/logic/api_maps/hetzner.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/providers/hetzner/hetzner.dart'; import 'package:selfprivacy/logic/common_enum/common_enum.dart'; import 'package:selfprivacy/logic/models/hetzner_metrics.dart'; diff --git a/lib/logic/cubit/jobs/jobs_cubit.dart b/lib/logic/cubit/jobs/jobs_cubit.dart index 6de64677..8485621f 100644 --- a/lib/logic/cubit/jobs/jobs_cubit.dart +++ b/lib/logic/cubit/jobs/jobs_cubit.dart @@ -2,7 +2,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/server.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server.dart'; import 'package:selfprivacy/logic/cubit/services/services_cubit.dart'; import 'package:selfprivacy/logic/cubit/users/users_cubit.dart'; import 'package:selfprivacy/logic/models/job.dart'; diff --git a/lib/logic/cubit/recovery_key/recovery_key_cubit.dart b/lib/logic/cubit/recovery_key/recovery_key_cubit.dart index abd7b2fa..9692ca4b 100644 --- a/lib/logic/cubit/recovery_key/recovery_key_cubit.dart +++ b/lib/logic/cubit/recovery_key/recovery_key_cubit.dart @@ -1,4 +1,4 @@ -import 'package:selfprivacy/logic/api_maps/server.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server.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/json/recovery_token_status.dart'; diff --git a/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart b/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart index 613069b0..3de8970f 100644 --- a/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart +++ b/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart @@ -3,7 +3,7 @@ import 'package:equatable/equatable.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/cubit/server_detailed_info/server_detailed_info_repository.dart'; import 'package:selfprivacy/logic/models/json/auto_upgrade_settings.dart'; -import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart'; +import 'package:selfprivacy/logic/models/json/provider_server_info.dart'; import 'package:selfprivacy/logic/models/timezone_settings.dart'; part 'server_detailed_info_state.dart'; 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 97dc6292..9dc2d46e 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,7 +1,7 @@ -import 'package:selfprivacy/logic/api_maps/hetzner.dart'; -import 'package:selfprivacy/logic/api_maps/server.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/providers/hetzner/hetzner.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server.dart'; import 'package:selfprivacy/logic/models/json/auto_upgrade_settings.dart'; -import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart'; +import 'package:selfprivacy/logic/models/json/provider_server_info.dart'; import 'package:selfprivacy/logic/models/timezone_settings.dart'; class ServerDetailsRepository { @@ -24,7 +24,7 @@ class ServerDetailsRepositoryDto { required this.serverTimezone, required this.autoUpgradeSettings, }); - final HetznerServerInfo hetznerServerInfo; + final ProviderServerInfo hetznerServerInfo; final TimeZoneSettings serverTimezone; diff --git a/lib/logic/cubit/server_detailed_info/server_detailed_info_state.dart b/lib/logic/cubit/server_detailed_info/server_detailed_info_state.dart index ef226c1e..d4cd113a 100644 --- a/lib/logic/cubit/server_detailed_info/server_detailed_info_state.dart +++ b/lib/logic/cubit/server_detailed_info/server_detailed_info_state.dart @@ -22,7 +22,7 @@ class Loaded extends ServerDetailsState { required this.autoUpgradeSettings, required this.checkTime, }); - final HetznerServerInfo serverInfo; + final ProviderServerInfo serverInfo; final TimeZoneSettings serverTimezone; diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 30bc828b..7261fec2 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -4,6 +4,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; 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/rest_maps/providers/provider_factory.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'; @@ -49,13 +50,37 @@ class ServerInstallationCubit extends Cubit { } } + RegExp getProviderApiTokenValidation() { + if (repository.providerApiFactory == null) { + print( + "validateProviderApiToken: Factory for API provider doesn't exist!", + ); + return RegExp(r''); + } + + return repository.providerApiFactory!.getProvider().getApiTokenValidation(); + } + + Future isProviderApiTokenValid(final String providerToken) async { + if (repository.providerApiFactory == null) { + print( + "validateProviderApiToken: Factory for API provider doesn't exist!", + ); + return false; + } + + return repository.providerApiFactory! + .getProvider(settings: const ProviderApiSettings(isWithToken: false)) + .isApiTokenValid(providerToken); + } + void setHetznerKey(final String hetznerKey) async { await repository.saveHetznerKey(hetznerKey); if (state is ServerInstallationRecovery) { emit( (state as ServerInstallationRecovery).copyWith( - hetznerKey: hetznerKey, + providerApiToken: hetznerKey, currentStep: RecoveryStep.serverSelection, ), ); @@ -63,7 +88,9 @@ class ServerInstallationCubit extends Cubit { } emit( - (state as ServerInstallationNotFinished).copyWith(hetznerKey: hetznerKey), + (state as ServerInstallationNotFinished).copyWith( + providerApiToken: hetznerKey, + ), ); } @@ -116,12 +143,16 @@ class ServerInstallationCubit extends Cubit { ); Future onSuccess(final ServerHostingDetails serverDetails) async { - await repository.createDnsRecords( + final bool dnsRecordsCreated = await repository.createDnsRecords( serverDetails.ip4, state.serverDomain!, onCancel: onCancel, ); + if (dnsRecordsCreated) { + repository.onCreationSuccess(serverDetails, state.serverDomain!); + } + emit( (state as ServerInstallationNotFinished).copyWith( isLoading: false, @@ -164,9 +195,24 @@ class ServerInstallationCubit extends Cubit { ); if (matches.values.every((final bool value) => value)) { - final ServerHostingDetails server = await repository.startServer( + final ServerHostingDetails? server = await repository.startServer( dataState.serverDetails!, ); + + if (server == null) { + final ServerInstallationNotFinished newState = dataState.copyWith( + isLoading: false, + dnsMatches: matches, + ); + emit(newState); + runDelayed( + startServerIfDnsIsOkay, + const Duration(seconds: 30), + newState, + ); + return; + } + await repository.saveServerDetails(server); await repository.saveIsServerStarted(true); @@ -464,7 +510,7 @@ class ServerInstallationCubit extends Cubit { final ServerInstallationRecovery dataState = state as ServerInstallationRecovery; final List servers = - await repository.getServersOnHetznerAccount(); + await repository.getServersOnProviderAccount(); final Iterable validated = servers.map( (final ServerBasicInfo server) => ServerBasicInfoWithValidators.fromServerBasicInfo( @@ -566,7 +612,7 @@ class ServerInstallationCubit extends Cubit { print('================================'); print('ServerInstallationState changed!'); print('Current type: ${change.nextState.runtimeType}'); - print('Hetzner key: ${change.nextState.hetznerKey}'); + print('Hetzner key: ${change.nextState.providerApiToken}'); print('Cloudflare key: ${change.nextState.cloudFlareKey}'); print('Domain: ${change.nextState.serverDomain}'); print('BackblazeCredential: ${change.nextState.backblazeCredential}'); @@ -599,7 +645,7 @@ class ServerInstallationCubit extends Cubit { await repository.deleteServerRelatedRecords(); emit( ServerInstallationNotFinished( - hetznerKey: state.hetznerKey, + providerApiToken: state.providerApiToken, serverDomain: state.serverDomain, cloudFlareKey: state.cloudFlareKey, backblazeCredential: state.backblazeCredential, diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 842c1db2..920dcbf9 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -9,16 +9,18 @@ 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/cloudflare.dart'; -import 'package:selfprivacy/logic/api_maps/hetzner.dart'; -import 'package:selfprivacy/logic/api_maps/server.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_creator.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/cloudflare.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/providers/provider.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/providers/provider_factory.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server.dart'; import 'package:selfprivacy/logic/common_enum/common_enum.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'; import 'package:selfprivacy/logic/models/hive/user.dart'; import 'package:selfprivacy/logic/models/json/device_token.dart'; -import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart'; +import 'package:selfprivacy/logic/models/json/provider_server_info.dart'; import 'package:selfprivacy/logic/models/message.dart'; import 'package:selfprivacy/logic/models/server_basic_info.dart'; import 'package:selfprivacy/ui/components/action_button/action_button.dart'; @@ -39,9 +41,13 @@ class ServerAuthorizationException implements Exception { class ServerInstallationRepository { Box box = Hive.box(BNames.serverInstallationBox); Box usersBox = Hive.box(BNames.usersBox); + ProviderApiFactory? providerApiFactory = + ApiFactoryCreator.createProviderApiFactory( + ServerProvider.hetzner, // HARDCODE FOR NOW!!! + ); // Remove when provider selection is implemented. Future load() async { - final String? hetznerToken = getIt().hetznerKey; + final String? providerApiToken = getIt().hetznerKey; final String? cloudflareToken = getIt().cloudFlareKey; final ServerDomain? serverDomain = getIt().serverDomain; final BackblazeCredential? backblazeCredential = @@ -49,9 +55,14 @@ class ServerInstallationRepository { final ServerHostingDetails? serverDetails = getIt().serverDetails; + if (serverDetails != null) { + providerApiFactory = + ApiFactoryCreator.createProviderApiFactory(serverDetails.provider); + } + if (box.get(BNames.hasFinalChecked, defaultValue: false)) { return ServerInstallationFinished( - hetznerKey: hetznerToken!, + providerApiToken: providerApiToken!, cloudFlareKey: cloudflareToken!, serverDomain: serverDomain!, backblazeCredential: backblazeCredential!, @@ -68,14 +79,14 @@ class ServerInstallationRepository { if (box.get(BNames.isRecoveringServer, defaultValue: false) && serverDomain != null) { return ServerInstallationRecovery( - hetznerKey: hetznerToken, + providerApiToken: providerApiToken, cloudFlareKey: cloudflareToken, serverDomain: serverDomain, backblazeCredential: backblazeCredential, serverDetails: serverDetails, rootUser: box.get(BNames.rootUser), currentStep: _getCurrentRecoveryStep( - hetznerToken, + providerApiToken, cloudflareToken, serverDomain, serverDetails, @@ -85,7 +96,7 @@ class ServerInstallationRepository { } return ServerInstallationNotFinished( - hetznerKey: hetznerToken, + providerApiToken: providerApiToken, cloudFlareKey: cloudflareToken, serverDomain: serverDomain, backblazeCredential: backblazeCredential, @@ -127,11 +138,18 @@ class ServerInstallationRepository { usersBox.clear(); } - Future startServer( + Future startServer( final ServerHostingDetails hetznerServer, ) async { - final HetznerApi hetznerApi = HetznerApi(); - final ServerHostingDetails serverDetails = await hetznerApi.powerOn(); + ServerHostingDetails? details; + + if (providerApiFactory == null) { + print("startServer: Factory for API provider doesn't exist!"); + return details; + } + + final ProviderApi api = providerApiFactory!.getProvider(); + final ServerHostingDetails serverDetails = await api.powerOn(); return serverDetails; } @@ -208,23 +226,17 @@ class ServerInstallationRepository { required final Future Function(ServerHostingDetails serverDetails) onSuccess, }) async { - final HetznerApi hetznerApi = HetznerApi(); - late ServerVolume dataBase; + if (providerApiFactory == null) { + print("createServer: Factory for API provider doesn't exist!"); + return; + } + final ProviderApi api = providerApiFactory!.getProvider(); try { - final ServerVolume? createdVolume = await hetznerApi.createVolume(); - if (createdVolume == null) { - print('Volume is not created!'); - return; - } - - dataBase = createdVolume; - - final ServerHostingDetails? serverDetails = await hetznerApi.createServer( - cloudFlareKey: cloudFlareKey, + final ServerHostingDetails? serverDetails = await api.createServer( + dnsApiToken: cloudFlareKey, rootUser: rootUser, domainName: domainName, - dataBase: dataBase, ); if (serverDetails == null) { @@ -245,17 +257,16 @@ class ServerInstallationRepository { text: 'basis.delete'.tr(), isRed: true, onPressed: () async { - await hetznerApi.deleteSelfprivacyServerAndAllVolumes( + await api.deleteServer( domainName: domainName, ); ServerHostingDetails? serverDetails; try { - serverDetails = await hetznerApi.createServer( - cloudFlareKey: cloudFlareKey, + serverDetails = await api.createServer( + dnsApiToken: cloudFlareKey, rootUser: rootUser, domainName: domainName, - dataBase: dataBase, ); } catch (e) { print(e); @@ -280,25 +291,45 @@ class ServerInstallationRepository { } } - Future createDnsRecords( + Future onCreationSuccess( + final ServerHostingDetails serverDetails, + final ServerDomain domain, + ) async { + if (providerApiFactory == null) { + print("onCreationSuccess: Factory for API provider doesn't exist!"); + return; + } + final ProviderApi api = providerApiFactory!.getProvider(); + return api.createReverseDns( + serverDetails: serverDetails, + domain: domain, + ); + } + + Future createDnsRecords( final String ip4, - final ServerDomain cloudFlareDomain, { + final ServerDomain domain, { required final void Function() onCancel, }) async { final CloudflareApi cloudflareApi = CloudflareApi(); + if (providerApiFactory == null) { + print("createServer: Factory for API provider doesn't exist!"); + return false; + } + final ProviderApi api = providerApiFactory!.getProvider(); + await cloudflareApi.removeSimilarRecords( ip4: ip4, - cloudFlareDomain: cloudFlareDomain, + cloudFlareDomain: domain, ); try { await cloudflareApi.createMultipleDnsRecords( ip4: ip4, - cloudFlareDomain: cloudFlareDomain, + cloudFlareDomain: domain, ); } on DioError catch (e) { - final HetznerApi hetznerApi = HetznerApi(); final NavigationService nav = getIt.get(); nav.showPopUpDialog( BrandAlert( @@ -311,8 +342,8 @@ class ServerInstallationRepository { text: 'basis.delete'.tr(), isRed: true, onPressed: () async { - await hetznerApi.deleteSelfprivacyServerAndAllVolumes( - domainName: cloudFlareDomain.domainName, + await api.deleteServer( + domainName: domain.domainName, ); onCancel(); @@ -325,12 +356,10 @@ class ServerInstallationRepository { ], ), ); + return false; } - await HetznerApi().createReverseDns( - ip4: ip4, - domainName: cloudFlareDomain.domainName, - ); + return true; } Future createDkimRecord(final ServerDomain cloudFlareDomain) async { @@ -354,13 +383,13 @@ class ServerInstallationRepository { } Future restart() async { - final HetznerApi hetznerApi = HetznerApi(); - return hetznerApi.reset(); + final ProviderApi api = providerApiFactory!.getProvider(); + return api.restart(); } Future powerOn() async { - final HetznerApi hetznerApi = HetznerApi(); - return hetznerApi.powerOn(); + final ProviderApi api = providerApiFactory!.getProvider(); + return api.powerOn(); } Future getRecoveryCapabilities( @@ -595,12 +624,19 @@ class ServerInstallationRepository { } } - Future> getServersOnHetznerAccount() async { - final HetznerApi hetznerApi = HetznerApi(); - final List servers = await hetznerApi.getServers(); + Future> getServersOnProviderAccount() async { + if (providerApiFactory == null) { + print( + 'getServersOnProviderAccount: ' + "Factory for API provider doesn't exist!", + ); + return []; + } + final ProviderApi api = providerApiFactory!.getProvider(); + final List servers = await api.getServers(); return servers .map( - (final HetznerServerInfo server) => ServerBasicInfo( + (final ProviderServerInfo server) => ServerBasicInfo( id: server.id, name: server.name, ip: server.publicNet.ipv4.ip, @@ -687,10 +723,14 @@ class ServerInstallationRepository { } Future deleteServer(final ServerDomain serverDomain) async { - final HetznerApi hetznerApi = HetznerApi(); + if (providerApiFactory == null) { + print("deleteServer: Factory for API provider doesn't exist!"); + return; + } + final ProviderApi api = providerApiFactory!.getProvider(); final CloudflareApi cloudFlare = CloudflareApi(); - await hetznerApi.deleteSelfprivacyServerAndAllVolumes( + await api.deleteServer( domainName: serverDomain.domainName, ); diff --git a/lib/logic/cubit/server_installation/server_installation_state.dart b/lib/logic/cubit/server_installation/server_installation_state.dart index b3128e71..5bb59275 100644 --- a/lib/logic/cubit/server_installation/server_installation_state.dart +++ b/lib/logic/cubit/server_installation/server_installation_state.dart @@ -2,7 +2,7 @@ part of '../server_installation/server_installation_cubit.dart'; abstract class ServerInstallationState extends Equatable { const ServerInstallationState({ - required this.hetznerKey, + required this.providerApiToken, required this.cloudFlareKey, required this.backblazeCredential, required this.serverDomain, @@ -15,7 +15,7 @@ abstract class ServerInstallationState extends Equatable { @override List get props => [ - hetznerKey, + providerApiToken, cloudFlareKey, backblazeCredential, serverDomain, @@ -25,7 +25,7 @@ abstract class ServerInstallationState extends Equatable { isServerResetedFirstTime, ]; - final String? hetznerKey; + final String? providerApiToken; final String? cloudFlareKey; final BackblazeCredential? backblazeCredential; final ServerDomain? serverDomain; @@ -35,7 +35,7 @@ abstract class ServerInstallationState extends Equatable { final bool isServerResetedFirstTime; final bool isServerResetedSecondTime; - bool get isHetznerFilled => hetznerKey != null; + bool get isProviderFilled => providerApiToken != null; bool get isCloudFlareFilled => cloudFlareKey != null; bool get isBackblazeFilled => backblazeCredential != null; bool get isDomainFilled => serverDomain != null; @@ -58,7 +58,7 @@ abstract class ServerInstallationState extends Equatable { List get _fulfilementList { final List res = [ - isHetznerFilled, + isProviderFilled, isCloudFlareFilled, isBackblazeFilled, isDomainFilled, @@ -80,7 +80,7 @@ class TimerState extends ServerInstallationNotFinished { this.timerStart, this.duration, }) : super( - hetznerKey: dataState.hetznerKey, + providerApiToken: dataState.providerApiToken, cloudFlareKey: dataState.cloudFlareKey, backblazeCredential: dataState.backblazeCredential, serverDomain: dataState.serverDomain, @@ -124,7 +124,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { required final super.isServerResetedSecondTime, required final this.isLoading, required this.dnsMatches, - final super.hetznerKey, + final super.providerApiToken, final super.cloudFlareKey, final super.backblazeCredential, final super.serverDomain, @@ -136,7 +136,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { @override List get props => [ - hetznerKey, + providerApiToken, cloudFlareKey, backblazeCredential, serverDomain, @@ -149,7 +149,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { ]; ServerInstallationNotFinished copyWith({ - final String? hetznerKey, + final String? providerApiToken, final String? cloudFlareKey, final BackblazeCredential? backblazeCredential, final ServerDomain? serverDomain, @@ -162,7 +162,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { final Map? dnsMatches, }) => ServerInstallationNotFinished( - hetznerKey: hetznerKey ?? this.hetznerKey, + providerApiToken: providerApiToken ?? this.providerApiToken, cloudFlareKey: cloudFlareKey ?? this.cloudFlareKey, backblazeCredential: backblazeCredential ?? this.backblazeCredential, serverDomain: serverDomain ?? this.serverDomain, @@ -178,7 +178,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { ); ServerInstallationFinished finish() => ServerInstallationFinished( - hetznerKey: hetznerKey!, + providerApiToken: providerApiToken!, cloudFlareKey: cloudFlareKey!, backblazeCredential: backblazeCredential!, serverDomain: serverDomain!, @@ -193,7 +193,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { class ServerInstallationEmpty extends ServerInstallationNotFinished { const ServerInstallationEmpty() : super( - hetznerKey: null, + providerApiToken: null, cloudFlareKey: null, backblazeCredential: null, serverDomain: null, @@ -209,7 +209,7 @@ class ServerInstallationEmpty extends ServerInstallationNotFinished { class ServerInstallationFinished extends ServerInstallationState { const ServerInstallationFinished({ - required final String super.hetznerKey, + required final String super.providerApiToken, required final String super.cloudFlareKey, required final BackblazeCredential super.backblazeCredential, required final ServerDomain super.serverDomain, @@ -222,7 +222,7 @@ class ServerInstallationFinished extends ServerInstallationState { @override List get props => [ - hetznerKey, + providerApiToken, cloudFlareKey, backblazeCredential, serverDomain, @@ -260,7 +260,7 @@ class ServerInstallationRecovery extends ServerInstallationState { const ServerInstallationRecovery({ required this.currentStep, required this.recoveryCapabilities, - final super.hetznerKey, + final super.providerApiToken, final super.cloudFlareKey, final super.backblazeCredential, final super.serverDomain, @@ -276,7 +276,7 @@ class ServerInstallationRecovery extends ServerInstallationState { @override List get props => [ - hetznerKey, + providerApiToken, cloudFlareKey, backblazeCredential, serverDomain, @@ -288,7 +288,7 @@ class ServerInstallationRecovery extends ServerInstallationState { ]; ServerInstallationRecovery copyWith({ - final String? hetznerKey, + final String? providerApiToken, final String? cloudFlareKey, final BackblazeCredential? backblazeCredential, final ServerDomain? serverDomain, @@ -298,7 +298,7 @@ class ServerInstallationRecovery extends ServerInstallationState { final ServerRecoveryCapabilities? recoveryCapabilities, }) => ServerInstallationRecovery( - hetznerKey: hetznerKey ?? this.hetznerKey, + providerApiToken: providerApiToken ?? this.providerApiToken, cloudFlareKey: cloudFlareKey ?? this.cloudFlareKey, backblazeCredential: backblazeCredential ?? this.backblazeCredential, serverDomain: serverDomain ?? this.serverDomain, @@ -309,7 +309,7 @@ class ServerInstallationRecovery extends ServerInstallationState { ); ServerInstallationFinished finish() => ServerInstallationFinished( - hetznerKey: hetznerKey!, + providerApiToken: providerApiToken!, cloudFlareKey: cloudFlareKey!, backblazeCredential: backblazeCredential!, serverDomain: serverDomain!, diff --git a/lib/logic/cubit/services/services_cubit.dart b/lib/logic/cubit/services/services_cubit.dart index f83a2a9a..19160af1 100644 --- a/lib/logic/cubit/services/services_cubit.dart +++ b/lib/logic/cubit/services/services_cubit.dart @@ -1,4 +1,4 @@ -import 'package:selfprivacy/logic/api_maps/server.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server.dart'; import 'package:selfprivacy/logic/common_enum/common_enum.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; diff --git a/lib/logic/cubit/users/users_cubit.dart b/lib/logic/cubit/users/users_cubit.dart index 9b86c109..3ce0d18e 100644 --- a/lib/logic/cubit/users/users_cubit.dart +++ b/lib/logic/cubit/users/users_cubit.dart @@ -3,7 +3,7 @@ import 'package:selfprivacy/config/hive_config.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; -import 'package:selfprivacy/logic/api_maps/server.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server.dart'; export 'package:provider/provider.dart'; diff --git a/lib/logic/cubit/volumes/volumes_cubit.dart b/lib/logic/cubit/volumes/volumes_cubit.dart index 8fcc6d55..d724e121 100644 --- a/lib/logic/cubit/volumes/volumes_cubit.dart +++ b/lib/logic/cubit/volumes/volumes_cubit.dart @@ -1,6 +1,6 @@ import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/hetzner.dart'; -import 'package:selfprivacy/logic/api_maps/server.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_creator.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/providers/provider_factory.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/hive/server_details.dart'; @@ -12,7 +12,10 @@ class ApiVolumesCubit ApiVolumesCubit(final ServerInstallationCubit serverInstallationCubit) : super(serverInstallationCubit, const ApiVolumesState.initial()); - final ServerApi api = ServerApi(); + final VolumeProviderApiFactory providerApi = + VolumeApiFactoryCreator.createVolumeProviderApiFactory( + getIt().serverDetails!.provider, + ); @override void load() async { @@ -27,7 +30,8 @@ class ApiVolumesCubit } void _refetch() async { - final List volumes = await HetznerApi().getVolumes(); + final List volumes = + await providerApi.getVolumeProvider().getVolumes(); if (volumes.isNotEmpty) { emit(ApiVolumesState(volumes, LoadingStatus.success)); } else { @@ -37,29 +41,29 @@ class ApiVolumesCubit void attachVolume(final ServerVolume volume) async { final ServerHostingDetails server = getIt().serverDetails!; - HetznerApi().attachVolume(volume.id, server.id); + await providerApi.getVolumeProvider().attachVolume(volume.id, server.id); refresh(); } void detachVolume(final ServerVolume volume) async { - HetznerApi().detachVolume(volume.id); + await providerApi.getVolumeProvider().detachVolume(volume.id); refresh(); } - void resizeVolume(final ServerVolume volume, final int newSizeGb) { - if (volume.sizeByte < newSizeGb) { - HetznerApi().resizeVolume(volume.id, newSizeGb); - refresh(); - } + void resizeVolume(final ServerVolume volume, final int newSizeGb) async { + //if (volume.sizeByte < newSizeGb) { + await providerApi.getVolumeProvider().resizeVolume(volume.id, newSizeGb); + refresh(); + //} } void createVolume() async { - HetznerApi().createVolume(); + await providerApi.getVolumeProvider().createVolume(); refresh(); } void deleteVolume(final ServerVolume volume) async { - HetznerApi().deleteVolume(volume.id); + await providerApi.getVolumeProvider().deleteVolume(volume.id); refresh(); } diff --git a/lib/logic/models/hive/server_details.g.dart b/lib/logic/models/hive/server_details.g.dart index f10628e7..d4ea9b01 100644 --- a/lib/logic/models/hive/server_details.g.dart +++ b/lib/logic/models/hive/server_details.g.dart @@ -73,17 +73,23 @@ class ServerVolumeAdapter extends TypeAdapter { return ServerVolume( id: fields[1] as int, name: fields[2] as String, + sizeByte: fields[3] == null ? 10737418240 : fields[3] as int, + serverId: fields[4] as int?, ); } @override void write(BinaryWriter writer, ServerVolume obj) { writer - ..writeByte(2) + ..writeByte(4) ..writeByte(1) ..write(obj.id) ..writeByte(2) - ..write(obj.name); + ..write(obj.name) + ..writeByte(3) + ..write(obj.sizeByte) + ..writeByte(4) + ..write(obj.serverId); } @override diff --git a/lib/logic/models/hive/user.g.dart b/lib/logic/models/hive/user.g.dart index d9b28d65..a1889dc1 100644 --- a/lib/logic/models/hive/user.g.dart +++ b/lib/logic/models/hive/user.g.dart @@ -11,9 +11,9 @@ class UserAdapter extends TypeAdapter { final int typeId = 1; @override - User read(final BinaryReader reader) { - final int numOfFields = reader.readByte(); - final Map fields = { + User read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), }; return User( @@ -26,7 +26,7 @@ class UserAdapter extends TypeAdapter { } @override - void write(final BinaryWriter writer, final User obj) { + void write(BinaryWriter writer, User obj) { writer ..writeByte(5) ..writeByte(0) @@ -45,7 +45,7 @@ class UserAdapter extends TypeAdapter { int get hashCode => typeId.hashCode; @override - bool operator ==(final Object other) => + bool operator ==(Object other) => identical(this, other) || other is UserAdapter && runtimeType == other.runtimeType && diff --git a/lib/logic/models/json/hetzner_server_info.dart b/lib/logic/models/json/hetzner_server_info.dart deleted file mode 100644 index ccf036a1..00000000 --- a/lib/logic/models/json/hetzner_server_info.dart +++ /dev/null @@ -1,115 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; - -part 'hetzner_server_info.g.dart'; - -@JsonSerializable() -class HetznerServerInfo { - HetznerServerInfo( - this.id, - this.name, - this.status, - this.created, - this.serverType, - this.location, - this.publicNet, - this.volumes, - ); - final int id; - final String name; - final ServerStatus status; - final DateTime created; - final List volumes; - - @JsonKey(name: 'server_type') - final HetznerServerTypeInfo serverType; - - @JsonKey(name: 'datacenter', fromJson: HetznerServerInfo.locationFromJson) - final HetznerLocation location; - - @JsonKey(name: 'public_net') - final HetznerPublicNetInfo publicNet; - - static HetznerLocation locationFromJson(final Map json) => - HetznerLocation.fromJson(json['location']); - - static HetznerServerInfo fromJson(final Map json) => - _$HetznerServerInfoFromJson(json); -} - -@JsonSerializable() -class HetznerPublicNetInfo { - HetznerPublicNetInfo(this.ipv4); - final HetznerIp4 ipv4; - - static HetznerPublicNetInfo fromJson(final Map json) => - _$HetznerPublicNetInfoFromJson(json); -} - -@JsonSerializable() -class HetznerIp4 { - HetznerIp4(this.id, this.ip, this.blocked, this.reverseDns); - final bool blocked; - @JsonKey(name: 'dns_ptr') - final String reverseDns; - final int id; - final String ip; - - static HetznerIp4 fromJson(final Map json) => - _$HetznerIp4FromJson(json); -} - -enum ServerStatus { - running, - initializing, - starting, - stopping, - off, - deleting, - migrating, - rebuilding, - unknown, -} - -@JsonSerializable() -class HetznerServerTypeInfo { - HetznerServerTypeInfo(this.cores, this.memory, this.disk, this.prices); - final int cores; - final num memory; - final int disk; - - final List prices; - - static HetznerServerTypeInfo fromJson(final Map json) => - _$HetznerServerTypeInfoFromJson(json); -} - -@JsonSerializable() -class HetznerPriceInfo { - HetznerPriceInfo(this.hourly, this.monthly); - - @JsonKey(name: 'price_hourly', fromJson: HetznerPriceInfo.getPrice) - final double hourly; - - @JsonKey(name: 'price_monthly', fromJson: HetznerPriceInfo.getPrice) - final double monthly; - - static HetznerPriceInfo fromJson(final Map json) => - _$HetznerPriceInfoFromJson(json); - - static double getPrice(final Map json) => - double.parse(json['gross'] as String); -} - -@JsonSerializable() -class HetznerLocation { - HetznerLocation(this.country, this.city, this.description, this.zone); - final String country; - final String city; - final String description; - - @JsonKey(name: 'network_zone') - final String zone; - - static HetznerLocation fromJson(final Map json) => - _$HetznerLocationFromJson(json); -} diff --git a/lib/logic/models/json/provider_server_info.dart b/lib/logic/models/json/provider_server_info.dart new file mode 100644 index 00000000..cc0166db --- /dev/null +++ b/lib/logic/models/json/provider_server_info.dart @@ -0,0 +1,115 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'provider_server_info.g.dart'; + +@JsonSerializable() +class ProviderServerInfo { + ProviderServerInfo( + this.id, + this.name, + this.status, + this.created, + this.serverType, + this.location, + this.publicNet, + this.volumes, + ); + final int id; + final String name; + final ServerStatus status; + final DateTime created; + final List volumes; + + @JsonKey(name: 'server_type') + final ProviderServerTypeInfo serverType; + + @JsonKey(name: 'datacenter', fromJson: ProviderServerInfo.locationFromJson) + final ProviderLocation location; + + @JsonKey(name: 'public_net') + final ProviderPublicNetInfo publicNet; + + static ProviderLocation locationFromJson(final Map json) => + ProviderLocation.fromJson(json['location']); + + static ProviderServerInfo fromJson(final Map json) => + _$ProviderServerInfoFromJson(json); +} + +@JsonSerializable() +class ProviderPublicNetInfo { + ProviderPublicNetInfo(this.ipv4); + final ProviderIp4 ipv4; + + static ProviderPublicNetInfo fromJson(final Map json) => + _$ProviderPublicNetInfoFromJson(json); +} + +@JsonSerializable() +class ProviderIp4 { + ProviderIp4(this.id, this.ip, this.blocked, this.reverseDns); + final bool blocked; + @JsonKey(name: 'dns_ptr') + final String reverseDns; + final int id; + final String ip; + + static ProviderIp4 fromJson(final Map json) => + _$ProviderIp4FromJson(json); +} + +enum ServerStatus { + running, + initializing, + starting, + stopping, + off, + deleting, + migrating, + rebuilding, + unknown, +} + +@JsonSerializable() +class ProviderServerTypeInfo { + ProviderServerTypeInfo(this.cores, this.memory, this.disk, this.prices); + final int cores; + final num memory; + final int disk; + + final List prices; + + static ProviderServerTypeInfo fromJson(final Map json) => + _$ProviderServerTypeInfoFromJson(json); +} + +@JsonSerializable() +class ProviderPriceInfo { + ProviderPriceInfo(this.hourly, this.monthly); + + @JsonKey(name: 'price_hourly', fromJson: ProviderPriceInfo.getPrice) + final double hourly; + + @JsonKey(name: 'price_monthly', fromJson: ProviderPriceInfo.getPrice) + final double monthly; + + static ProviderPriceInfo fromJson(final Map json) => + _$ProviderPriceInfoFromJson(json); + + static double getPrice(final Map json) => + double.parse(json['gross'] as String); +} + +@JsonSerializable() +class ProviderLocation { + ProviderLocation(this.country, this.city, this.description, this.zone); + final String country; + final String city; + final String description; + + @JsonKey(name: 'network_zone') + final String zone; + + static ProviderLocation fromJson(final Map json) => + _$ProviderLocationFromJson(json); +} diff --git a/lib/logic/models/json/hetzner_server_info.g.dart b/lib/logic/models/json/provider_server_info.g.dart similarity index 58% rename from lib/logic/models/json/hetzner_server_info.g.dart rename to lib/logic/models/json/provider_server_info.g.dart index e8c21917..6a4f7aac 100644 --- a/lib/logic/models/json/hetzner_server_info.g.dart +++ b/lib/logic/models/json/provider_server_info.g.dart @@ -1,21 +1,22 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'hetzner_server_info.dart'; +part of 'provider_server_info.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** -HetznerServerInfo _$HetznerServerInfoFromJson(Map json) => - HetznerServerInfo( +ProviderServerInfo _$ProviderServerInfoFromJson(Map json) => + ProviderServerInfo( json['id'] as int, json['name'] as String, $enumDecode(_$ServerStatusEnumMap, json['status']), DateTime.parse(json['created'] as String), - HetznerServerTypeInfo.fromJson( + ProviderServerTypeInfo.fromJson( json['server_type'] as Map), - HetznerServerInfo.locationFromJson(json['datacenter'] as Map), - HetznerPublicNetInfo.fromJson(json['public_net'] as Map), + ProviderServerInfo.locationFromJson(json['datacenter'] as Map), + ProviderPublicNetInfo.fromJson( + json['public_net'] as Map), (json['volumes'] as List).map((e) => e as int).toList(), ); @@ -31,38 +32,38 @@ const _$ServerStatusEnumMap = { ServerStatus.unknown: 'unknown', }; -HetznerPublicNetInfo _$HetznerPublicNetInfoFromJson( +ProviderPublicNetInfo _$ProviderPublicNetInfoFromJson( Map json) => - HetznerPublicNetInfo( - HetznerIp4.fromJson(json['ipv4'] as Map), + ProviderPublicNetInfo( + ProviderIp4.fromJson(json['ipv4'] as Map), ); -HetznerIp4 _$HetznerIp4FromJson(Map json) => HetznerIp4( +ProviderIp4 _$ProviderIp4FromJson(Map json) => ProviderIp4( json['id'] as int, json['ip'] as String, json['blocked'] as bool, json['dns_ptr'] as String, ); -HetznerServerTypeInfo _$HetznerServerTypeInfoFromJson( +ProviderServerTypeInfo _$ProviderServerTypeInfoFromJson( Map json) => - HetznerServerTypeInfo( + ProviderServerTypeInfo( json['cores'] as int, json['memory'] as num, json['disk'] as int, (json['prices'] as List) - .map((e) => HetznerPriceInfo.fromJson(e as Map)) + .map((e) => ProviderPriceInfo.fromJson(e as Map)) .toList(), ); -HetznerPriceInfo _$HetznerPriceInfoFromJson(Map json) => - HetznerPriceInfo( - HetznerPriceInfo.getPrice(json['price_hourly'] as Map), - HetznerPriceInfo.getPrice(json['price_monthly'] as Map), +ProviderPriceInfo _$ProviderPriceInfoFromJson(Map json) => + ProviderPriceInfo( + ProviderPriceInfo.getPrice(json['price_hourly'] as Map), + ProviderPriceInfo.getPrice(json['price_monthly'] as Map), ); -HetznerLocation _$HetznerLocationFromJson(Map json) => - HetznerLocation( +ProviderLocation _$ProviderLocationFromJson(Map json) => + ProviderLocation( json['country'] as String, json['city'] as String, json['description'] as String, diff --git a/lib/ui/pages/setup/initializing.dart b/lib/ui/pages/setup/initializing.dart index 9c92f161..6025d621 100644 --- a/lib/ui/pages/setup/initializing.dart +++ b/lib/ui/pages/setup/initializing.dart @@ -21,7 +21,9 @@ import 'package:selfprivacy/ui/pages/setup/recovering/recovery_routing.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; class InitializingPage extends StatelessWidget { - const InitializingPage({final super.key}); + const InitializingPage({ + final super.key, + }); @override Widget build(final BuildContext context) { @@ -135,10 +137,12 @@ class InitializingPage extends StatelessWidget { Widget _stepHetzner(final ServerInstallationCubit serverInstallationCubit) => BlocProvider( - create: (final context) => HetznerFormCubit(serverInstallationCubit), + create: (final context) => ProviderFormCubit( + serverInstallationCubit, + ), child: Builder( builder: (final context) { - final formCubitState = context.watch().state; + final formCubitState = context.watch().state; return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -152,7 +156,7 @@ class InitializingPage extends StatelessWidget { BrandText.body2('initializing.2'.tr()), const Spacer(), CubitFormTextField( - formFieldCubit: context.read().apiKey, + formFieldCubit: context.read().apiKey, textAlign: TextAlign.center, scrollPadding: const EdgeInsets.only(bottom: 70), decoration: const InputDecoration( @@ -163,7 +167,7 @@ class InitializingPage extends StatelessWidget { BrandButton.rised( onPressed: formCubitState.isSubmitting ? null - : () => context.read().trySubmit(), + : () => context.read().trySubmit(), text: 'basis.connect'.tr(), ), const SizedBox(height: 10), diff --git a/lib/ui/pages/setup/recovering/recovery_hentzner_connected.dart b/lib/ui/pages/setup/recovering/recovery_hentzner_connected.dart index 6976283c..819cbea2 100644 --- a/lib/ui/pages/setup/recovering/recovery_hentzner_connected.dart +++ b/lib/ui/pages/setup/recovering/recovery_hentzner_connected.dart @@ -19,11 +19,11 @@ class RecoveryHetznerConnected extends StatelessWidget { context.watch(); return BlocProvider( - create: (final BuildContext context) => HetznerFormCubit(appConfig), + create: (final BuildContext context) => ProviderFormCubit(appConfig), child: Builder( builder: (final BuildContext context) { final FormCubitState formCubitState = - context.watch().state; + context.watch().state; return BrandHeroScreen( heroTitle: 'recovering.hetzner_connected'.tr(), @@ -37,7 +37,7 @@ class RecoveryHetznerConnected extends StatelessWidget { }, children: [ CubitFormTextField( - formFieldCubit: context.read().apiKey, + formFieldCubit: context.read().apiKey, decoration: InputDecoration( border: const OutlineInputBorder(), labelText: 'recovering.hetzner_connected_placeholder'.tr(), @@ -48,7 +48,7 @@ class RecoveryHetznerConnected extends StatelessWidget { title: 'more.continue'.tr(), onPressed: formCubitState.isSubmitting ? null - : () => context.read().trySubmit(), + : () => context.read().trySubmit(), ), const SizedBox(height: 16), BrandButton.text( diff --git a/lib/utils/scalars.dart b/lib/utils/scalars.dart new file mode 100644 index 00000000..71a571e7 --- /dev/null +++ b/lib/utils/scalars.dart @@ -0,0 +1,7 @@ +String dateTimeToJson(DateTime data) { + return data.toIso8601String(); +} + +DateTime dateTimeFromJson(dynamic data) { + return DateTime.parse(data as String); +} diff --git a/pubspec.lock b/pubspec.lock index e3faf1b6..cb308ae6 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -169,6 +169,48 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.16.0" + connectivity_plus: + dependency: transitive + description: + name: connectivity_plus + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.5" + connectivity_plus_linux: + dependency: transitive + description: + name: connectivity_plus_linux + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.1" + connectivity_plus_macos: + dependency: transitive + description: + name: connectivity_plus_macos + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.4" + connectivity_plus_platform_interface: + dependency: transitive + description: + name: connectivity_plus_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.1" + connectivity_plus_web: + dependency: transitive + description: + name: connectivity_plus_web + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.2" + connectivity_plus_windows: + dependency: transitive + description: + name: connectivity_plus_windows + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.2" convert: dependency: transitive description: @@ -218,6 +260,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.2.3" + dbus: + dependency: transitive + description: + name: dbus + url: "https://pub.dartlang.org" + source: hosted + version: "0.7.3" device_info_plus: dependency: "direct main" description: @@ -356,6 +405,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "8.0.1" + flutter_hooks: + dependency: transitive + description: + name: flutter_hooks + url: "https://pub.dartlang.org" + source: hosted + version: "0.18.5+1" flutter_launcher_icons: dependency: "direct dev" description: @@ -462,6 +518,90 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.2" + gql: + dependency: "direct main" + description: + name: gql + url: "https://pub.dartlang.org" + source: hosted + version: "0.13.1" + gql_code_builder: + dependency: transitive + description: + name: gql_code_builder + url: "https://pub.dartlang.org" + source: hosted + version: "0.5.1" + gql_dedupe_link: + dependency: transitive + description: + name: gql_dedupe_link + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" + gql_error_link: + dependency: transitive + description: + name: gql_error_link + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.2" + gql_exec: + dependency: transitive + description: + name: gql_exec + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.0" + gql_http_link: + dependency: transitive + description: + name: gql_http_link + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.2" + gql_link: + dependency: transitive + description: + name: gql_link + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.2" + gql_transform_link: + dependency: transitive + description: + name: gql_transform_link + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.2" + graphql: + dependency: "direct main" + description: + name: graphql + url: "https://pub.dartlang.org" + source: hosted + version: "5.1.1" + graphql_codegen: + dependency: "direct main" + description: + name: graphql_codegen + url: "https://pub.dartlang.org" + source: hosted + version: "0.9.0" + graphql_codegen_config: + dependency: transitive + description: + name: graphql_codegen_config + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.6" + graphql_flutter: + dependency: "direct main" + description: + name: graphql_flutter + url: "https://pub.dartlang.org" + source: hosted + version: "5.1.0" graphs: dependency: transitive description: @@ -672,6 +812,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.0" + nm: + dependency: transitive + description: + name: nm + url: "https://pub.dartlang.org" + source: hosted + version: "0.5.0" node_preamble: dependency: transitive description: @@ -679,6 +826,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.1" + normalize: + dependency: transitive + description: + name: normalize + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.0+1" package_config: dependency: transitive description: @@ -826,6 +980,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.1.0" + recase: + dependency: transitive + description: + name: recase + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.0" + rxdart: + dependency: transitive + description: + name: rxdart + url: "https://pub.dartlang.org" + source: hosted + version: "0.27.4" share_plus: dependency: "direct main" description: @@ -1153,6 +1321,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.0.1" + uuid: + dependency: transitive + description: + name: uuid + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.6" vector_math: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 1e052155..f5367d99 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -26,6 +26,10 @@ dependencies: flutter_markdown: ^0.6.9 flutter_secure_storage: ^5.0.2 get_it: ^7.2.0 + gql: ^0.13.1 + graphql: ^5.1.1 + graphql_codegen: ^0.9.0 + graphql_flutter: ^5.1.0 gtk_theme_fl: ^0.0.1 hive: ^2.0.5 hive_flutter: ^1.1.0 diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 37b7695e..070eb3b5 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,11 +6,14 @@ #include "generated_plugin_registrant.h" +#include #include #include #include void RegisterPlugins(flutter::PluginRegistry* registry) { + ConnectivityPlusWindowsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin")); FlutterSecureStorageWindowsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin")); SystemThemePluginRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index a1aaa278..a26e37b0 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + connectivity_plus_windows flutter_secure_storage_windows system_theme url_launcher_windows From 9993b09e7f80d26518edbcf3762f8c574a5b8ffc Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 13 Jul 2022 14:58:23 +0300 Subject: [PATCH 011/115] Turn VolumeApiProvider into a mixin --- build.yaml | 1 - .../rest_maps/providers/hetzner/hetzner.dart | 56 ++++++--- .../providers/hetzner/hetzner_factory.dart | 2 +- .../rest_maps/providers/provider.dart | 12 +- .../rest_maps/providers/provider_factory.dart | 2 +- .../rest_maps/providers/volume_provider.dart | 9 +- ...rm_cubit.dart => provider_form_cubit.dart} | 0 .../server_detailed_info_cubit.dart | 2 +- .../server_detailed_info_repository.dart | 4 +- .../server_detailed_info_state.dart | 2 +- .../server_installation_cubit.dart | 37 ++---- .../server_installation_repository.dart | 91 ++++---------- .../models/json/hetzner_server_info.dart | 115 ++++++++++++++++++ ...info.g.dart => hetzner_server_info.g.dart} | 39 +++--- .../models/json/provider_server_info.dart | 115 ------------------ lib/ui/pages/setup/initializing.dart | 2 +- .../recovery_hentzner_connected.dart | 2 +- lib/utils/scalars.dart | 2 + 18 files changed, 220 insertions(+), 273 deletions(-) rename lib/logic/cubit/forms/setup/initializing/{hetzner_form_cubit.dart => provider_form_cubit.dart} (100%) create mode 100644 lib/logic/models/json/hetzner_server_info.dart rename lib/logic/models/json/{provider_server_info.g.dart => hetzner_server_info.g.dart} (58%) delete mode 100644 lib/logic/models/json/provider_server_info.dart diff --git a/build.yaml b/build.yaml index 15417c7c..2fb31704 100644 --- a/build.yaml +++ b/build.yaml @@ -11,7 +11,6 @@ targets: import: package:selfprivacy/utils/scalars.dart clients: - graphql - - graphql_flutter json_serializable: options: create_factory: true diff --git a/lib/logic/api_maps/rest_maps/providers/hetzner/hetzner.dart b/lib/logic/api_maps/rest_maps/providers/hetzner/hetzner.dart index 57582fee..3b0dfd42 100644 --- a/lib/logic/api_maps/rest_maps/providers/hetzner/hetzner.dart +++ b/lib/logic/api_maps/rest_maps/providers/hetzner/hetzner.dart @@ -4,14 +4,20 @@ import 'dart:io'; import 'package:dio/dio.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/providers/volume_provider.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/providers/provider.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; -import 'package:selfprivacy/logic/models/json/provider_server_info.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/server_basic_info.dart'; import 'package:selfprivacy/utils/password_generator.dart'; -class HetznerApi extends VolumeProviderApi { - HetznerApi({final super.hasLogger = false, final super.isWithToken = true}); +class HetznerApi extends ServerProviderApi with VolumeProviderApi { + HetznerApi({final this.hasLogger = false, final this.isWithToken = true}); + @override + bool hasLogger; + @override + bool isWithToken; @override BaseOptions get options { @@ -258,7 +264,7 @@ class HetznerApi extends VolumeProviderApi { return details; } - details = await createServerByVolume( + details = await createServerWithVolume( dnsApiToken: dnsApiToken, rootUser: rootUser, domainName: domainName, @@ -272,7 +278,7 @@ class HetznerApi extends VolumeProviderApi { return details; } - Future createServerByVolume({ + Future createServerWithVolume({ required final String dnsApiToken, required final User rootUser, required final String domainName, @@ -441,26 +447,46 @@ class HetznerApi extends VolumeProviderApi { return res.data; } - Future getInfo() async { + Future getInfo() async { final ServerHostingDetails? hetznerServer = getIt().serverDetails; final Dio client = await getClient(); final Response response = await client.get('/servers/${hetznerServer!.id}'); close(client); - return ProviderServerInfo.fromJson(response.data!['server']); + return HetznerServerInfo.fromJson(response.data!['server']); } @override - Future> getServers() async { - final Dio client = await getClient(); - final Response response = await client.get('/servers'); - close(client); + Future> getServers() async { + List servers = []; - return (response.data!['servers'] as List) - // ignore: unnecessary_lambdas - .map((final e) => ProviderServerInfo.fromJson(e)) - .toList(); + final Dio client = await getClient(); + try { + final Response response = await client.get('/servers'); + servers = (response.data!['servers'] as List) + .map( + (final e) => HetznerServerInfo.fromJson(e), + ) + .toList() + .map( + (final HetznerServerInfo server) => ServerBasicInfo( + id: server.id, + name: server.name, + ip: server.publicNet.ipv4.ip, + reverseDns: server.publicNet.ipv4.reverseDns, + created: server.created, + volumeId: server.volumes.isNotEmpty ? server.volumes[0] : 0, + ), + ) + .toList(); + } catch (e) { + print(e); + } finally { + close(client); + } + + return servers; } @override diff --git a/lib/logic/api_maps/rest_maps/providers/hetzner/hetzner_factory.dart b/lib/logic/api_maps/rest_maps/providers/hetzner/hetzner_factory.dart index e047da13..301d4b61 100644 --- a/lib/logic/api_maps/rest_maps/providers/hetzner/hetzner_factory.dart +++ b/lib/logic/api_maps/rest_maps/providers/hetzner/hetzner_factory.dart @@ -6,7 +6,7 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/providers/volume_provider.d class HetznerApiFactory extends ProviderApiFactory with VolumeProviderApiFactory { @override - ProviderApi getProvider({ + ServerProviderApi getProvider({ final ProviderApiSettings settings = const ProviderApiSettings(), }) => HetznerApi( diff --git a/lib/logic/api_maps/rest_maps/providers/provider.dart b/lib/logic/api_maps/rest_maps/providers/provider.dart index c431379e..010ebd75 100644 --- a/lib/logic/api_maps/rest_maps/providers/provider.dart +++ b/lib/logic/api_maps/rest_maps/providers/provider.dart @@ -2,16 +2,10 @@ 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/json/provider_server_info.dart'; +import 'package:selfprivacy/logic/models/server_basic_info.dart'; -abstract class ProviderApi extends ApiMap { - ProviderApi({this.hasLogger = false, this.isWithToken = true}); - @override - bool hasLogger; - @override - bool isWithToken; - - Future> getServers(); +abstract class ServerProviderApi extends ApiMap { + Future> getServers(); Future restart(); Future powerOn(); diff --git a/lib/logic/api_maps/rest_maps/providers/provider_factory.dart b/lib/logic/api_maps/rest_maps/providers/provider_factory.dart index a899b28c..b238d299 100644 --- a/lib/logic/api_maps/rest_maps/providers/provider_factory.dart +++ b/lib/logic/api_maps/rest_maps/providers/provider_factory.dart @@ -8,7 +8,7 @@ class ProviderApiSettings { } abstract class ProviderApiFactory { - ProviderApi getProvider({ + ServerProviderApi getProvider({ final ProviderApiSettings settings = const ProviderApiSettings(), }); } diff --git a/lib/logic/api_maps/rest_maps/providers/volume_provider.dart b/lib/logic/api_maps/rest_maps/providers/volume_provider.dart index cf598f18..63a692dd 100644 --- a/lib/logic/api_maps/rest_maps/providers/volume_provider.dart +++ b/lib/logic/api_maps/rest_maps/providers/volume_provider.dart @@ -1,12 +1,7 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/providers/provider.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; -abstract class VolumeProviderApi extends ProviderApi { - VolumeProviderApi({ - final super.hasLogger = false, - final super.isWithToken = true, - }); - +mixin VolumeProviderApi on ApiMap { Future createVolume(); Future> getVolumes({final String? status}); Future getVolume(final int id); diff --git a/lib/logic/cubit/forms/setup/initializing/hetzner_form_cubit.dart b/lib/logic/cubit/forms/setup/initializing/provider_form_cubit.dart similarity index 100% rename from lib/logic/cubit/forms/setup/initializing/hetzner_form_cubit.dart rename to lib/logic/cubit/forms/setup/initializing/provider_form_cubit.dart diff --git a/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart b/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart index 3de8970f..613069b0 100644 --- a/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart +++ b/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart @@ -3,7 +3,7 @@ import 'package:equatable/equatable.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/cubit/server_detailed_info/server_detailed_info_repository.dart'; import 'package:selfprivacy/logic/models/json/auto_upgrade_settings.dart'; -import 'package:selfprivacy/logic/models/json/provider_server_info.dart'; +import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart'; import 'package:selfprivacy/logic/models/timezone_settings.dart'; part 'server_detailed_info_state.dart'; 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 9dc2d46e..8fd3e711 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,7 +1,7 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/providers/hetzner/hetzner.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server.dart'; import 'package:selfprivacy/logic/models/json/auto_upgrade_settings.dart'; -import 'package:selfprivacy/logic/models/json/provider_server_info.dart'; +import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart'; import 'package:selfprivacy/logic/models/timezone_settings.dart'; class ServerDetailsRepository { @@ -24,7 +24,7 @@ class ServerDetailsRepositoryDto { required this.serverTimezone, required this.autoUpgradeSettings, }); - final ProviderServerInfo hetznerServerInfo; + final HetznerServerInfo hetznerServerInfo; final TimeZoneSettings serverTimezone; diff --git a/lib/logic/cubit/server_detailed_info/server_detailed_info_state.dart b/lib/logic/cubit/server_detailed_info/server_detailed_info_state.dart index d4cd113a..ef226c1e 100644 --- a/lib/logic/cubit/server_detailed_info/server_detailed_info_state.dart +++ b/lib/logic/cubit/server_detailed_info/server_detailed_info_state.dart @@ -22,7 +22,7 @@ class Loaded extends ServerDetailsState { required this.autoUpgradeSettings, required this.checkTime, }); - final ProviderServerInfo serverInfo; + final HetznerServerInfo serverInfo; final TimeZoneSettings serverTimezone; diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 7261fec2..e6402836 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -50,29 +50,14 @@ class ServerInstallationCubit extends Cubit { } } - RegExp getProviderApiTokenValidation() { - if (repository.providerApiFactory == null) { - print( - "validateProviderApiToken: Factory for API provider doesn't exist!", - ); - return RegExp(r''); - } + RegExp getProviderApiTokenValidation() => repository.serverProviderApiFactory! + .getProvider() + .getApiTokenValidation(); - return repository.providerApiFactory!.getProvider().getApiTokenValidation(); - } - - Future isProviderApiTokenValid(final String providerToken) async { - if (repository.providerApiFactory == null) { - print( - "validateProviderApiToken: Factory for API provider doesn't exist!", - ); - return false; - } - - return repository.providerApiFactory! - .getProvider(settings: const ProviderApiSettings(isWithToken: false)) - .isApiTokenValid(providerToken); - } + Future isProviderApiTokenValid(final String providerToken) async => + repository.serverProviderApiFactory! + .getProvider(settings: const ProviderApiSettings(isWithToken: false)) + .isApiTokenValid(providerToken); void setHetznerKey(final String hetznerKey) async { await repository.saveHetznerKey(hetznerKey); @@ -143,16 +128,12 @@ class ServerInstallationCubit extends Cubit { ); Future onSuccess(final ServerHostingDetails serverDetails) async { - final bool dnsRecordsCreated = await repository.createDnsRecords( - serverDetails.ip4, + await repository.createDnsRecords( + serverDetails, state.serverDomain!, onCancel: onCancel, ); - if (dnsRecordsCreated) { - repository.onCreationSuccess(serverDetails, state.serverDomain!); - } - emit( (state as ServerInstallationNotFinished).copyWith( isLoading: false, diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 920dcbf9..a91432dc 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -20,7 +20,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/json/provider_server_info.dart'; import 'package:selfprivacy/logic/models/message.dart'; import 'package:selfprivacy/logic/models/server_basic_info.dart'; import 'package:selfprivacy/ui/components/action_button/action_button.dart'; @@ -41,7 +40,7 @@ class ServerAuthorizationException implements Exception { class ServerInstallationRepository { Box box = Hive.box(BNames.serverInstallationBox); Box usersBox = Hive.box(BNames.usersBox); - ProviderApiFactory? providerApiFactory = + ProviderApiFactory? serverProviderApiFactory = ApiFactoryCreator.createProviderApiFactory( ServerProvider.hetzner, // HARDCODE FOR NOW!!! ); // Remove when provider selection is implemented. @@ -56,7 +55,7 @@ class ServerInstallationRepository { getIt().serverDetails; if (serverDetails != null) { - providerApiFactory = + serverProviderApiFactory = ApiFactoryCreator.createProviderApiFactory(serverDetails.provider); } @@ -141,15 +140,10 @@ class ServerInstallationRepository { Future startServer( final ServerHostingDetails hetznerServer, ) async { - ServerHostingDetails? details; + ServerHostingDetails? serverDetails; - if (providerApiFactory == null) { - print("startServer: Factory for API provider doesn't exist!"); - return details; - } - - final ProviderApi api = providerApiFactory!.getProvider(); - final ServerHostingDetails serverDetails = await api.powerOn(); + final ServerProviderApi api = serverProviderApiFactory!.getProvider(); + serverDetails = await api.powerOn(); return serverDetails; } @@ -226,12 +220,7 @@ class ServerInstallationRepository { required final Future Function(ServerHostingDetails serverDetails) onSuccess, }) async { - if (providerApiFactory == null) { - print("createServer: Factory for API provider doesn't exist!"); - return; - } - - final ProviderApi api = providerApiFactory!.getProvider(); + final ServerProviderApi api = serverProviderApiFactory!.getProvider(); try { final ServerHostingDetails? serverDetails = await api.createServer( dnsApiToken: cloudFlareKey, @@ -291,42 +280,22 @@ class ServerInstallationRepository { } } - Future onCreationSuccess( - final ServerHostingDetails serverDetails, - final ServerDomain domain, - ) async { - if (providerApiFactory == null) { - print("onCreationSuccess: Factory for API provider doesn't exist!"); - return; - } - final ProviderApi api = providerApiFactory!.getProvider(); - return api.createReverseDns( - serverDetails: serverDetails, - domain: domain, - ); - } - Future createDnsRecords( - final String ip4, + final ServerHostingDetails serverDetails, final ServerDomain domain, { required final void Function() onCancel, }) async { final CloudflareApi cloudflareApi = CloudflareApi(); - - if (providerApiFactory == null) { - print("createServer: Factory for API provider doesn't exist!"); - return false; - } - final ProviderApi api = providerApiFactory!.getProvider(); + final ServerProviderApi serverApi = serverProviderApiFactory!.getProvider(); await cloudflareApi.removeSimilarRecords( - ip4: ip4, + ip4: serverDetails.ip4, cloudFlareDomain: domain, ); try { await cloudflareApi.createMultipleDnsRecords( - ip4: ip4, + ip4: serverDetails.ip4, cloudFlareDomain: domain, ); } on DioError catch (e) { @@ -342,7 +311,7 @@ class ServerInstallationRepository { text: 'basis.delete'.tr(), isRed: true, onPressed: () async { - await api.deleteServer( + await serverApi.deleteServer( domainName: domain.domainName, ); @@ -359,6 +328,11 @@ class ServerInstallationRepository { return false; } + await serverApi.createReverseDns( + serverDetails: serverDetails, + domain: domain, + ); + return true; } @@ -383,12 +357,12 @@ class ServerInstallationRepository { } Future restart() async { - final ProviderApi api = providerApiFactory!.getProvider(); + final ServerProviderApi api = serverProviderApiFactory!.getProvider(); return api.restart(); } Future powerOn() async { - final ProviderApi api = providerApiFactory!.getProvider(); + final ServerProviderApi api = serverProviderApiFactory!.getProvider(); return api.powerOn(); } @@ -625,27 +599,8 @@ class ServerInstallationRepository { } Future> getServersOnProviderAccount() async { - if (providerApiFactory == null) { - print( - 'getServersOnProviderAccount: ' - "Factory for API provider doesn't exist!", - ); - return []; - } - final ProviderApi api = providerApiFactory!.getProvider(); - final List servers = await api.getServers(); - return servers - .map( - (final ProviderServerInfo server) => ServerBasicInfo( - id: server.id, - name: server.name, - ip: server.publicNet.ipv4.ip, - reverseDns: server.publicNet.ipv4.reverseDns, - created: server.created, - volumeId: server.volumes.isNotEmpty ? server.volumes[0] : 0, - ), - ) - .toList(); + final ServerProviderApi api = serverProviderApiFactory!.getProvider(); + return api.getServers(); } Future saveServerDetails( @@ -723,11 +678,7 @@ class ServerInstallationRepository { } Future deleteServer(final ServerDomain serverDomain) async { - if (providerApiFactory == null) { - print("deleteServer: Factory for API provider doesn't exist!"); - return; - } - final ProviderApi api = providerApiFactory!.getProvider(); + final ServerProviderApi api = serverProviderApiFactory!.getProvider(); final CloudflareApi cloudFlare = CloudflareApi(); await api.deleteServer( diff --git a/lib/logic/models/json/hetzner_server_info.dart b/lib/logic/models/json/hetzner_server_info.dart new file mode 100644 index 00000000..ccf036a1 --- /dev/null +++ b/lib/logic/models/json/hetzner_server_info.dart @@ -0,0 +1,115 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'hetzner_server_info.g.dart'; + +@JsonSerializable() +class HetznerServerInfo { + HetznerServerInfo( + this.id, + this.name, + this.status, + this.created, + this.serverType, + this.location, + this.publicNet, + this.volumes, + ); + final int id; + final String name; + final ServerStatus status; + final DateTime created; + final List volumes; + + @JsonKey(name: 'server_type') + final HetznerServerTypeInfo serverType; + + @JsonKey(name: 'datacenter', fromJson: HetznerServerInfo.locationFromJson) + final HetznerLocation location; + + @JsonKey(name: 'public_net') + final HetznerPublicNetInfo publicNet; + + static HetznerLocation locationFromJson(final Map json) => + HetznerLocation.fromJson(json['location']); + + static HetznerServerInfo fromJson(final Map json) => + _$HetznerServerInfoFromJson(json); +} + +@JsonSerializable() +class HetznerPublicNetInfo { + HetznerPublicNetInfo(this.ipv4); + final HetznerIp4 ipv4; + + static HetznerPublicNetInfo fromJson(final Map json) => + _$HetznerPublicNetInfoFromJson(json); +} + +@JsonSerializable() +class HetznerIp4 { + HetznerIp4(this.id, this.ip, this.blocked, this.reverseDns); + final bool blocked; + @JsonKey(name: 'dns_ptr') + final String reverseDns; + final int id; + final String ip; + + static HetznerIp4 fromJson(final Map json) => + _$HetznerIp4FromJson(json); +} + +enum ServerStatus { + running, + initializing, + starting, + stopping, + off, + deleting, + migrating, + rebuilding, + unknown, +} + +@JsonSerializable() +class HetznerServerTypeInfo { + HetznerServerTypeInfo(this.cores, this.memory, this.disk, this.prices); + final int cores; + final num memory; + final int disk; + + final List prices; + + static HetznerServerTypeInfo fromJson(final Map json) => + _$HetznerServerTypeInfoFromJson(json); +} + +@JsonSerializable() +class HetznerPriceInfo { + HetznerPriceInfo(this.hourly, this.monthly); + + @JsonKey(name: 'price_hourly', fromJson: HetznerPriceInfo.getPrice) + final double hourly; + + @JsonKey(name: 'price_monthly', fromJson: HetznerPriceInfo.getPrice) + final double monthly; + + static HetznerPriceInfo fromJson(final Map json) => + _$HetznerPriceInfoFromJson(json); + + static double getPrice(final Map json) => + double.parse(json['gross'] as String); +} + +@JsonSerializable() +class HetznerLocation { + HetznerLocation(this.country, this.city, this.description, this.zone); + final String country; + final String city; + final String description; + + @JsonKey(name: 'network_zone') + final String zone; + + static HetznerLocation fromJson(final Map json) => + _$HetznerLocationFromJson(json); +} diff --git a/lib/logic/models/json/provider_server_info.g.dart b/lib/logic/models/json/hetzner_server_info.g.dart similarity index 58% rename from lib/logic/models/json/provider_server_info.g.dart rename to lib/logic/models/json/hetzner_server_info.g.dart index 6a4f7aac..e8c21917 100644 --- a/lib/logic/models/json/provider_server_info.g.dart +++ b/lib/logic/models/json/hetzner_server_info.g.dart @@ -1,22 +1,21 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'provider_server_info.dart'; +part of 'hetzner_server_info.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** -ProviderServerInfo _$ProviderServerInfoFromJson(Map json) => - ProviderServerInfo( +HetznerServerInfo _$HetznerServerInfoFromJson(Map json) => + HetznerServerInfo( json['id'] as int, json['name'] as String, $enumDecode(_$ServerStatusEnumMap, json['status']), DateTime.parse(json['created'] as String), - ProviderServerTypeInfo.fromJson( + HetznerServerTypeInfo.fromJson( json['server_type'] as Map), - ProviderServerInfo.locationFromJson(json['datacenter'] as Map), - ProviderPublicNetInfo.fromJson( - json['public_net'] as Map), + HetznerServerInfo.locationFromJson(json['datacenter'] as Map), + HetznerPublicNetInfo.fromJson(json['public_net'] as Map), (json['volumes'] as List).map((e) => e as int).toList(), ); @@ -32,38 +31,38 @@ const _$ServerStatusEnumMap = { ServerStatus.unknown: 'unknown', }; -ProviderPublicNetInfo _$ProviderPublicNetInfoFromJson( +HetznerPublicNetInfo _$HetznerPublicNetInfoFromJson( Map json) => - ProviderPublicNetInfo( - ProviderIp4.fromJson(json['ipv4'] as Map), + HetznerPublicNetInfo( + HetznerIp4.fromJson(json['ipv4'] as Map), ); -ProviderIp4 _$ProviderIp4FromJson(Map json) => ProviderIp4( +HetznerIp4 _$HetznerIp4FromJson(Map json) => HetznerIp4( json['id'] as int, json['ip'] as String, json['blocked'] as bool, json['dns_ptr'] as String, ); -ProviderServerTypeInfo _$ProviderServerTypeInfoFromJson( +HetznerServerTypeInfo _$HetznerServerTypeInfoFromJson( Map json) => - ProviderServerTypeInfo( + HetznerServerTypeInfo( json['cores'] as int, json['memory'] as num, json['disk'] as int, (json['prices'] as List) - .map((e) => ProviderPriceInfo.fromJson(e as Map)) + .map((e) => HetznerPriceInfo.fromJson(e as Map)) .toList(), ); -ProviderPriceInfo _$ProviderPriceInfoFromJson(Map json) => - ProviderPriceInfo( - ProviderPriceInfo.getPrice(json['price_hourly'] as Map), - ProviderPriceInfo.getPrice(json['price_monthly'] as Map), +HetznerPriceInfo _$HetznerPriceInfoFromJson(Map json) => + HetznerPriceInfo( + HetznerPriceInfo.getPrice(json['price_hourly'] as Map), + HetznerPriceInfo.getPrice(json['price_monthly'] as Map), ); -ProviderLocation _$ProviderLocationFromJson(Map json) => - ProviderLocation( +HetznerLocation _$HetznerLocationFromJson(Map json) => + HetznerLocation( json['country'] as String, json['city'] as String, json['description'] as String, diff --git a/lib/logic/models/json/provider_server_info.dart b/lib/logic/models/json/provider_server_info.dart deleted file mode 100644 index cc0166db..00000000 --- a/lib/logic/models/json/provider_server_info.dart +++ /dev/null @@ -1,115 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; - -part 'provider_server_info.g.dart'; - -@JsonSerializable() -class ProviderServerInfo { - ProviderServerInfo( - this.id, - this.name, - this.status, - this.created, - this.serverType, - this.location, - this.publicNet, - this.volumes, - ); - final int id; - final String name; - final ServerStatus status; - final DateTime created; - final List volumes; - - @JsonKey(name: 'server_type') - final ProviderServerTypeInfo serverType; - - @JsonKey(name: 'datacenter', fromJson: ProviderServerInfo.locationFromJson) - final ProviderLocation location; - - @JsonKey(name: 'public_net') - final ProviderPublicNetInfo publicNet; - - static ProviderLocation locationFromJson(final Map json) => - ProviderLocation.fromJson(json['location']); - - static ProviderServerInfo fromJson(final Map json) => - _$ProviderServerInfoFromJson(json); -} - -@JsonSerializable() -class ProviderPublicNetInfo { - ProviderPublicNetInfo(this.ipv4); - final ProviderIp4 ipv4; - - static ProviderPublicNetInfo fromJson(final Map json) => - _$ProviderPublicNetInfoFromJson(json); -} - -@JsonSerializable() -class ProviderIp4 { - ProviderIp4(this.id, this.ip, this.blocked, this.reverseDns); - final bool blocked; - @JsonKey(name: 'dns_ptr') - final String reverseDns; - final int id; - final String ip; - - static ProviderIp4 fromJson(final Map json) => - _$ProviderIp4FromJson(json); -} - -enum ServerStatus { - running, - initializing, - starting, - stopping, - off, - deleting, - migrating, - rebuilding, - unknown, -} - -@JsonSerializable() -class ProviderServerTypeInfo { - ProviderServerTypeInfo(this.cores, this.memory, this.disk, this.prices); - final int cores; - final num memory; - final int disk; - - final List prices; - - static ProviderServerTypeInfo fromJson(final Map json) => - _$ProviderServerTypeInfoFromJson(json); -} - -@JsonSerializable() -class ProviderPriceInfo { - ProviderPriceInfo(this.hourly, this.monthly); - - @JsonKey(name: 'price_hourly', fromJson: ProviderPriceInfo.getPrice) - final double hourly; - - @JsonKey(name: 'price_monthly', fromJson: ProviderPriceInfo.getPrice) - final double monthly; - - static ProviderPriceInfo fromJson(final Map json) => - _$ProviderPriceInfoFromJson(json); - - static double getPrice(final Map json) => - double.parse(json['gross'] as String); -} - -@JsonSerializable() -class ProviderLocation { - ProviderLocation(this.country, this.city, this.description, this.zone); - final String country; - final String city; - final String description; - - @JsonKey(name: 'network_zone') - final String zone; - - static ProviderLocation fromJson(final Map json) => - _$ProviderLocationFromJson(json); -} diff --git a/lib/ui/pages/setup/initializing.dart b/lib/ui/pages/setup/initializing.dart index 6025d621..01b3cb35 100644 --- a/lib/ui/pages/setup/initializing.dart +++ b/lib/ui/pages/setup/initializing.dart @@ -7,7 +7,7 @@ import 'package:selfprivacy/logic/cubit/forms/factories/field_cubit_factory.dart import 'package:selfprivacy/logic/cubit/forms/setup/initializing/backblaze_form_cubit.dart'; import 'package:selfprivacy/logic/cubit/forms/setup/initializing/cloudflare_form_cubit.dart'; import 'package:selfprivacy/logic/cubit/forms/setup/initializing/domain_cloudflare.dart'; -import 'package:selfprivacy/logic/cubit/forms/setup/initializing/hetzner_form_cubit.dart'; +import 'package:selfprivacy/logic/cubit/forms/setup/initializing/provider_form_cubit.dart'; import 'package:selfprivacy/logic/cubit/forms/setup/initializing/root_user_form_cubit.dart'; import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart'; import 'package:selfprivacy/ui/components/brand_button/brand_button.dart'; diff --git a/lib/ui/pages/setup/recovering/recovery_hentzner_connected.dart b/lib/ui/pages/setup/recovering/recovery_hentzner_connected.dart index 819cbea2..5ee461a7 100644 --- a/lib/ui/pages/setup/recovering/recovery_hentzner_connected.dart +++ b/lib/ui/pages/setup/recovering/recovery_hentzner_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/hetzner_form_cubit.dart'; +import 'package:selfprivacy/logic/cubit/forms/setup/initializing/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'; diff --git a/lib/utils/scalars.dart b/lib/utils/scalars.dart index 71a571e7..278fb80a 100644 --- a/lib/utils/scalars.dart +++ b/lib/utils/scalars.dart @@ -1,3 +1,5 @@ +// ignore_for_file: prefer_final_parameters, prefer_expression_function_bodies + String dateTimeToJson(DateTime data) { return data.toIso8601String(); } From dac310f9138ebda065073375c1a7a88c87e881f9 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Thu, 14 Jul 2022 16:34:08 +0300 Subject: [PATCH 012/115] Implement Dns Provider Api Abstractions --- .../rest_maps/api_factory_creator.dart | 41 +++++---- .../cloudflare}/cloudflare.dart | 84 +++++++++++-------- .../cloudflare/cloudflare_factory.dart | 15 ++++ .../rest_maps/dns_providers/dns_provider.dart | 31 +++++++ .../dns_providers/dns_provider_factory.dart | 17 ++++ .../rest_maps/provider_api_settings.dart | 5 ++ .../providers/hetzner/hetzner_factory.dart | 25 ------ .../rest_maps/providers/provider_factory.dart | 20 ----- .../hetzner/hetzner.dart | 4 +- .../hetzner/hetzner_factory.dart | 26 ++++++ .../server_provider.dart} | 0 .../server_provider_factory.dart | 15 ++++ .../volume_provider.dart | 0 .../cubit/dns_records/dns_records_cubit.dart | 27 ++++-- ...ubit.dart => dns_provider_form_cubit.dart} | 12 ++- ...loudflare.dart => domain_setup_cubit.dart} | 14 ++-- .../initializing/provider_form_cubit.dart | 4 +- .../hetzner_metrics_repository.dart | 2 +- .../server_detailed_info_repository.dart | 2 +- .../server_installation_cubit.dart | 29 +++++-- .../server_installation_repository.dart | 78 ++++++++++------- lib/logic/cubit/volumes/volumes_cubit.dart | 2 +- lib/ui/pages/setup/initializing.dart | 12 +-- .../recovery_confirm_cloudflare.dart | 10 +-- 24 files changed, 305 insertions(+), 170 deletions(-) rename lib/logic/api_maps/rest_maps/{ => dns_providers/cloudflare}/cloudflare.dart (79%) create mode 100644 lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_factory.dart create mode 100644 lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart create mode 100644 lib/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart create mode 100644 lib/logic/api_maps/rest_maps/provider_api_settings.dart delete mode 100644 lib/logic/api_maps/rest_maps/providers/hetzner/hetzner_factory.dart delete mode 100644 lib/logic/api_maps/rest_maps/providers/provider_factory.dart rename lib/logic/api_maps/rest_maps/{providers => server_providers}/hetzner/hetzner.dart (98%) create mode 100644 lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_factory.dart rename lib/logic/api_maps/rest_maps/{providers/provider.dart => server_providers/server_provider.dart} (100%) create mode 100644 lib/logic/api_maps/rest_maps/server_providers/server_provider_factory.dart rename lib/logic/api_maps/rest_maps/{providers => server_providers}/volume_provider.dart (100%) rename lib/logic/cubit/forms/setup/initializing/{cloudflare_form_cubit.dart => dns_provider_form_cubit.dart} (75%) rename lib/logic/cubit/forms/setup/initializing/{domain_cloudflare.dart => domain_setup_cubit.dart} (83%) 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 0343f402..18b4ea33 100644 --- a/lib/logic/api_maps/rest_maps/api_factory_creator.dart +++ b/lib/logic/api_maps/rest_maps/api_factory_creator.dart @@ -1,23 +1,37 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/providers/hetzner/hetzner_factory.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/providers/provider_factory.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/dns_provider_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/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 ProviderApiFactory createProviderApiFactory( + static ServerProviderApiFactory createServerProviderApiFactory( final ServerProvider provider, ) { switch (provider) { case ServerProvider.hetzner: - case ServerProvider.unknown: // ?? :) return HetznerApiFactory(); + case ServerProvider.unknown: + throw UnknownApiProviderException('Unknown server provider'); } } - // createDnsApiFactory - - // createStorageApiFactory - - // etc . . . + static DnsProviderApiFactory createDnsProviderApiFactory( + final DnsProvider provider, + ) { + switch (provider) { + case DnsProvider.cloudflare: + return CloudflareApiFactory(); + case DnsProvider.unknown: + throw UnknownApiProviderException('Unknown DNS provider'); + } + } } class VolumeApiFactoryCreator { @@ -26,14 +40,9 @@ class VolumeApiFactoryCreator { ) { switch (provider) { case ServerProvider.hetzner: - case ServerProvider.unknown: // ?? :) return HetznerApiFactory(); + case ServerProvider.unknown: + throw UnknownApiProviderException('Unknown volume provider'); } } - - // createDnsApiFactory - - // createStorageApiFactory - - // etc . . . } diff --git a/lib/logic/api_maps/rest_maps/cloudflare.dart b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart similarity index 79% rename from lib/logic/api_maps/rest_maps/cloudflare.dart rename to lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart index 2b78c6fe..46dc72ac 100644 --- a/lib/logic/api_maps/rest_maps/cloudflare.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart @@ -2,16 +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/api_map.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 DomainNotFoundException implements Exception { - DomainNotFoundException(this.message); - final String message; -} - -class CloudflareApi extends ApiMap { +class CloudflareApi extends DnsProviderApi { CloudflareApi({ this.hasLogger = false, this.isWithToken = true, @@ -24,6 +19,10 @@ class CloudflareApi extends ApiMap { final String? customToken; + @override + RegExp getApiTokenValidation() => + RegExp(r'\s+|[!$%^&*()@+|~=`{}\[\]:<>?,.\/]'); + @override BaseOptions get options { final BaseOptions options = BaseOptions(baseUrl: rootAddress); @@ -46,27 +45,37 @@ class CloudflareApi extends ApiMap { @override String rootAddress = 'https://api.cloudflare.com/client/v4'; - Future isValid(final String token) async { - validateStatus = (final status) => - status == HttpStatus.ok || status == HttpStatus.unauthorized; - + @override + Future isApiTokenValid(final String token) async { + bool isValid = false; + Response? response; final Dio client = await getClient(); - final Response response = await client.get( - '/user/tokens/verify', - options: Options(headers: {'Authorization': 'Bearer $token'}), - ); - - close(client); - - if (response.statusCode == HttpStatus.ok) { - return true; - } else if (response.statusCode == HttpStatus.unauthorized) { - return false; - } else { - throw Exception('code: ${response.statusCode}'); + try { + response = await client.get( + '/user/tokens/verify', + options: Options(headers: {'Authorization': 'Bearer $token'}), + ); + } catch (e) { + print(e); + isValid = false; + } finally { + close(client); } + + if (response != null) { + if (response.statusCode == HttpStatus.ok) { + isValid = true; + } else if (response.statusCode == HttpStatus.unauthorized) { + isValid = false; + } else { + throw Exception('code: ${response.statusCode}'); + } + } + + return isValid; } + @override Future getZoneId(final String domain) async { validateStatus = (final status) => status == HttpStatus.ok || status == HttpStatus.forbidden; @@ -85,12 +94,13 @@ class CloudflareApi extends ApiMap { } } + @override Future removeSimilarRecords({ - required final ServerDomain cloudFlareDomain, + required final ServerDomain domain, final String? ip4, }) async { - final String domainName = cloudFlareDomain.domainName; - final String domainZoneId = cloudFlareDomain.zoneId; + final String domainName = domain.domainName; + final String domainZoneId = domain.zoneId; final String url = '/zones/$domainZoneId/dns_records'; @@ -112,11 +122,12 @@ class CloudflareApi extends ApiMap { close(client); } + @override Future> getDnsRecords({ - required final ServerDomain cloudFlareDomain, + required final ServerDomain domain, }) async { - final String domainName = cloudFlareDomain.domainName; - final String domainZoneId = cloudFlareDomain.zoneId; + final String domainName = domain.domainName; + final String domainZoneId = domain.zoneId; final String url = '/zones/$domainZoneId/dns_records'; @@ -144,12 +155,13 @@ class CloudflareApi extends ApiMap { return allRecords; } + @override Future createMultipleDnsRecords({ - required final ServerDomain cloudFlareDomain, + required final ServerDomain domain, final String? ip4, }) async { - final String domainName = cloudFlareDomain.domainName; - final String domainZoneId = cloudFlareDomain.zoneId; + final String domainName = domain.domainName; + final String domainZoneId = domain.zoneId; final List listDnsRecords = projectDnsRecords(domainName, ip4); final List allCreateFutures = []; @@ -219,11 +231,12 @@ class CloudflareApi extends ApiMap { ]; } + @override Future setDkim( final String dkimRecordString, - final ServerDomain cloudFlareDomain, + final ServerDomain domain, ) async { - final String domainZoneId = cloudFlareDomain.zoneId; + final String domainZoneId = domain.zoneId; final String url = '$rootAddress/zones/$domainZoneId/dns_records'; final DnsRecord dkimRecord = DnsRecord( @@ -242,6 +255,7 @@ class CloudflareApi extends ApiMap { client.close(); } + @override Future> domainList() async { final String url = '$rootAddress/zones'; final Dio client = await getClient(); 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_factory.dart new file mode 100644 index 00000000..9266471b --- /dev/null +++ b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_factory.dart @@ -0,0 +1,15 @@ +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.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_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/dns_provider.dart b/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart new file mode 100644 index 00000000..5c2a9369 --- /dev/null +++ b/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart @@ -0,0 +1,31 @@ +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 DomainNotFoundException implements Exception { + DomainNotFoundException(this.message); + 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 setDkim( + final String dkimRecordString, + final ServerDomain domain, + ); + Future getZoneId(final String domain); + Future> domainList(); + + Future isApiTokenValid(final String token); + RegExp getApiTokenValidation(); +} 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 new file mode 100644 index 00000000..01f59e98 --- /dev/null +++ b/lib/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart @@ -0,0 +1,17 @@ +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/provider_api_settings.dart'; + +class DnsProviderApiSettings extends ProviderApiSettings { + const DnsProviderApiSettings({ + final super.hasLogger = false, + final super.isWithToken = true, + final this.customToken, + }); + final String? customToken; +} + +abstract class DnsProviderApiFactory { + DnsProviderApi getDnsProvider({ + final DnsProviderApiSettings settings = const DnsProviderApiSettings(), + }); +} diff --git a/lib/logic/api_maps/rest_maps/provider_api_settings.dart b/lib/logic/api_maps/rest_maps/provider_api_settings.dart new file mode 100644 index 00000000..4350fbe7 --- /dev/null +++ b/lib/logic/api_maps/rest_maps/provider_api_settings.dart @@ -0,0 +1,5 @@ +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/providers/hetzner/hetzner_factory.dart b/lib/logic/api_maps/rest_maps/providers/hetzner/hetzner_factory.dart deleted file mode 100644 index 301d4b61..00000000 --- a/lib/logic/api_maps/rest_maps/providers/hetzner/hetzner_factory.dart +++ /dev/null @@ -1,25 +0,0 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/providers/hetzner/hetzner.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/providers/provider.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/providers/provider_factory.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/providers/volume_provider.dart'; - -class HetznerApiFactory extends ProviderApiFactory - with VolumeProviderApiFactory { - @override - ServerProviderApi getProvider({ - final ProviderApiSettings settings = const ProviderApiSettings(), - }) => - HetznerApi( - hasLogger: settings.hasLogger, - isWithToken: settings.isWithToken, - ); - - @override - VolumeProviderApi getVolumeProvider({ - final ProviderApiSettings settings = const ProviderApiSettings(), - }) => - HetznerApi( - hasLogger: settings.hasLogger, - isWithToken: settings.isWithToken, - ); -} diff --git a/lib/logic/api_maps/rest_maps/providers/provider_factory.dart b/lib/logic/api_maps/rest_maps/providers/provider_factory.dart deleted file mode 100644 index b238d299..00000000 --- a/lib/logic/api_maps/rest_maps/providers/provider_factory.dart +++ /dev/null @@ -1,20 +0,0 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/providers/provider.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/providers/volume_provider.dart'; - -class ProviderApiSettings { - const ProviderApiSettings({this.hasLogger = false, this.isWithToken = true}); - final bool hasLogger; - final bool isWithToken; -} - -abstract class ProviderApiFactory { - ServerProviderApi getProvider({ - final ProviderApiSettings settings = const ProviderApiSettings(), - }); -} - -mixin VolumeProviderApiFactory { - VolumeProviderApi getVolumeProvider({ - final ProviderApiSettings settings = const ProviderApiSettings(), - }); -} diff --git a/lib/logic/api_maps/rest_maps/providers/hetzner/hetzner.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart similarity index 98% rename from lib/logic/api_maps/rest_maps/providers/hetzner/hetzner.dart rename to lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart index 3b0dfd42..fa75db17 100644 --- a/lib/logic/api_maps/rest_maps/providers/hetzner/hetzner.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart @@ -3,8 +3,8 @@ import 'dart:io'; import 'package:dio/dio.dart'; import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/providers/volume_provider.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/providers/provider.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/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart'; import 'package:selfprivacy/logic/models/hive/server_details.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_factory.dart new file mode 100644 index 00000000..60f61d1b --- /dev/null +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_factory.dart @@ -0,0 +1,26 @@ +import 'package:selfprivacy/logic/api_maps/rest_maps/provider_api_settings.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.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_factory.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/volume_provider.dart'; + +class HetznerApiFactory extends ServerProviderApiFactory + with VolumeProviderApiFactory { + @override + ServerProviderApi getServerProvider({ + final ProviderApiSettings settings = const ProviderApiSettings(), + }) => + HetznerApi( + hasLogger: settings.hasLogger, + isWithToken: settings.isWithToken, + ); + + @override + VolumeProviderApi getVolumeProvider({ + final ProviderApiSettings settings = const ProviderApiSettings(), + }) => + HetznerApi( + hasLogger: settings.hasLogger, + isWithToken: settings.isWithToken, + ); +} diff --git a/lib/logic/api_maps/rest_maps/providers/provider.dart b/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart similarity index 100% rename from lib/logic/api_maps/rest_maps/providers/provider.dart rename to lib/logic/api_maps/rest_maps/server_providers/server_provider.dart 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 new file mode 100644 index 00000000..10f4c40f --- /dev/null +++ b/lib/logic/api_maps/rest_maps/server_providers/server_provider_factory.dart @@ -0,0 +1,15 @@ +import 'package:selfprivacy/logic/api_maps/rest_maps/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/volume_provider.dart'; + +abstract class ServerProviderApiFactory { + ServerProviderApi getServerProvider({ + final ProviderApiSettings settings = const ProviderApiSettings(), + }); +} + +mixin VolumeProviderApiFactory { + VolumeProviderApi getVolumeProvider({ + final ProviderApiSettings settings = const ProviderApiSettings(), + }); +} diff --git a/lib/logic/api_maps/rest_maps/providers/volume_provider.dart b/lib/logic/api_maps/rest_maps/server_providers/volume_provider.dart similarity index 100% rename from lib/logic/api_maps/rest_maps/providers/volume_provider.dart rename to lib/logic/api_maps/rest_maps/server_providers/volume_provider.dart diff --git a/lib/logic/cubit/dns_records/dns_records_cubit.dart b/lib/logic/cubit/dns_records/dns_records_cubit.dart index 8d8ae496..e0ab4d42 100644 --- a/lib/logic/cubit/dns_records/dns_records_cubit.dart +++ b/lib/logic/cubit/dns_records/dns_records_cubit.dart @@ -1,9 +1,11 @@ import 'package:cubit_form/cubit_form.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_creator.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_factory.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/rest_maps/cloudflare.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server.dart'; part 'dns_records_state.dart'; @@ -16,8 +18,12 @@ class DnsRecordsCubit const DnsRecordsState(dnsState: DnsRecordsStatus.refreshing), ); + DnsProviderApiFactory? dnsProviderApiFactory = + ApiFactoryCreator.createDnsProviderApiFactory( + DnsProvider.cloudflare, // TODO: HARDCODE FOR NOW!!! + ); // TODO: Remove when provider selection is implemented. + final ServerApi api = ServerApi(); - final CloudflareApi cloudflare = CloudflareApi(); @override Future load() async { @@ -31,14 +37,15 @@ class DnsRecordsCubit ), ), ); - print('Loading DNS status'); + if (serverInstallationCubit.state is ServerInstallationFinished) { final ServerDomain? domain = serverInstallationCubit.state.serverDomain; final String? ipAddress = serverInstallationCubit.state.serverDetails?.ip4; if (domain != null && ipAddress != null) { - final List records = - await cloudflare.getDnsRecords(cloudFlareDomain: domain); + final List records = await dnsProviderApiFactory! + .getDnsProvider() + .getDnsRecords(domain: domain); final String? dkimPublicKey = await api.getDkim(); final List desiredRecords = _getDesiredDnsRecords(domain.domainName, ipAddress, dkimPublicKey); @@ -116,12 +123,14 @@ class DnsRecordsCubit final ServerDomain? domain = serverInstallationCubit.state.serverDomain; final String? ipAddress = serverInstallationCubit.state.serverDetails?.ip4; final String? dkimPublicKey = await api.getDkim(); - await cloudflare.removeSimilarRecords(cloudFlareDomain: domain!); - await cloudflare.createMultipleDnsRecords( - cloudFlareDomain: domain, + final DnsProviderApi dnsProviderApi = + dnsProviderApiFactory!.getDnsProvider(); + await dnsProviderApi.removeSimilarRecords(domain: domain!); + await dnsProviderApi.createMultipleDnsRecords( + domain: domain, ip4: ipAddress, ); - await cloudflare.setDkim(dkimPublicKey ?? '', domain); + await dnsProviderApi.setDkim(dkimPublicKey ?? '', domain); await load(); } diff --git a/lib/logic/cubit/forms/setup/initializing/cloudflare_form_cubit.dart b/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart similarity index 75% rename from lib/logic/cubit/forms/setup/initializing/cloudflare_form_cubit.dart rename to lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart index 20c99f38..d27d7053 100644 --- a/lib/logic/cubit/forms/setup/initializing/cloudflare_form_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart @@ -2,13 +2,12 @@ import 'dart:async'; import 'package:cubit_form/cubit_form.dart'; import 'package:easy_localization/easy_localization.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/cloudflare.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/cubit/forms/validations/validations.dart'; -class CloudFlareFormCubit extends FormCubit { - CloudFlareFormCubit(this.initializingCubit) { - final RegExp regExp = RegExp(r'\s+|[!$%^&*()@+|~=`{}\[\]:<>?,.\/]'); +class DnsProviderFormCubit extends FormCubit { + DnsProviderFormCubit(this.initializingCubit) { + final RegExp regExp = initializingCubit.getDnsProviderApiTokenValidation(); apiKey = FieldCubit( initalValue: '', validations: [ @@ -30,16 +29,15 @@ class CloudFlareFormCubit extends FormCubit { } final ServerInstallationCubit initializingCubit; - late final FieldCubit apiKey; @override FutureOr asyncValidation() async { late bool isKeyValid; - final CloudflareApi apiClient = CloudflareApi(isWithToken: false); try { - isKeyValid = await apiClient.isValid(apiKey.state.value); + isKeyValid = await initializingCubit + .isDnsProviderApiTokenValid(apiKey.state.value); } catch (e) { addError(e); isKeyValid = false; diff --git a/lib/logic/cubit/forms/setup/initializing/domain_cloudflare.dart b/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart similarity index 83% rename from lib/logic/cubit/forms/setup/initializing/domain_cloudflare.dart rename to lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart index b38e8313..4a14b862 100644 --- a/lib/logic/cubit/forms/setup/initializing/domain_cloudflare.dart +++ b/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart @@ -1,5 +1,4 @@ import 'package:cubit_form/cubit_form.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/cloudflare.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; @@ -10,9 +9,10 @@ class DomainSetupCubit extends Cubit { Future load() async { emit(Loading(LoadingTypes.loadingDomain)); - final CloudflareApi api = CloudflareApi(); - - final List list = await api.domainList(); + final List list = await serverInstallationCubit + .repository.dnsProviderApiFactory! + .getDnsProvider() + .domainList(); if (list.isEmpty) { emit(Empty()); } else if (list.length == 1) { @@ -28,11 +28,13 @@ class DomainSetupCubit extends Cubit { Future saveDomain() async { assert(state is Loaded, 'wrong state'); final String domainName = (state as Loaded).domain; - final CloudflareApi api = CloudflareApi(); emit(Loading(LoadingTypes.saving)); - final String zoneId = await api.getZoneId(domainName); + final String zoneId = await serverInstallationCubit + .repository.dnsProviderApiFactory! + .getDnsProvider() + .getZoneId(domainName); final ServerDomain domain = ServerDomain( domainName: domainName, diff --git a/lib/logic/cubit/forms/setup/initializing/provider_form_cubit.dart b/lib/logic/cubit/forms/setup/initializing/provider_form_cubit.dart index 24910ad1..9f3b5d58 100644 --- a/lib/logic/cubit/forms/setup/initializing/provider_form_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/provider_form_cubit.dart @@ -8,7 +8,7 @@ import 'package:selfprivacy/logic/cubit/forms/validations/validations.dart'; class ProviderFormCubit extends FormCubit { ProviderFormCubit(this.serverInstallationCubit) { final RegExp regExp = - serverInstallationCubit.getProviderApiTokenValidation(); + serverInstallationCubit.getServerProviderApiTokenValidation(); apiKey = FieldCubit( initalValue: '', validations: [ @@ -38,7 +38,7 @@ class ProviderFormCubit extends FormCubit { try { isKeyValid = await serverInstallationCubit - .isProviderApiTokenValid(apiKey.state.value); + .isServerProviderApiTokenValid(apiKey.state.value); } catch (e) { addError(e); isKeyValid = false; diff --git a/lib/logic/cubit/hetzner_metrics/hetzner_metrics_repository.dart b/lib/logic/cubit/hetzner_metrics/hetzner_metrics_repository.dart index 9b09d7f6..0fb780ae 100644 --- a/lib/logic/cubit/hetzner_metrics/hetzner_metrics_repository.dart +++ b/lib/logic/cubit/hetzner_metrics/hetzner_metrics_repository.dart @@ -1,4 +1,4 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/providers/hetzner/hetzner.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart'; import 'package:selfprivacy/logic/common_enum/common_enum.dart'; import 'package:selfprivacy/logic/models/hetzner_metrics.dart'; 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 8fd3e711..e5858d2d 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,4 +1,4 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/providers/hetzner/hetzner.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server.dart'; import 'package:selfprivacy/logic/models/json/auto_upgrade_settings.dart'; import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart'; diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index e6402836..6899240f 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -4,7 +4,8 @@ import 'package:flutter_bloc/flutter_bloc.dart'; 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/rest_maps/providers/provider_factory.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/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'; @@ -50,13 +51,31 @@ class ServerInstallationCubit extends Cubit { } } - RegExp getProviderApiTokenValidation() => repository.serverProviderApiFactory! - .getProvider() + RegExp getServerProviderApiTokenValidation() => + repository.serverProviderApiFactory! + .getServerProvider() + .getApiTokenValidation(); + + RegExp getDnsProviderApiTokenValidation() => repository.dnsProviderApiFactory! + .getDnsProvider() .getApiTokenValidation(); - Future isProviderApiTokenValid(final String providerToken) async => + Future isServerProviderApiTokenValid( + final String providerToken, + ) async => repository.serverProviderApiFactory! - .getProvider(settings: const ProviderApiSettings(isWithToken: false)) + .getServerProvider( + settings: const ProviderApiSettings(isWithToken: false), + ) + .isApiTokenValid(providerToken); + + Future isDnsProviderApiTokenValid( + final String providerToken, + ) async => + repository.dnsProviderApiFactory! + .getDnsProvider( + settings: const DnsProviderApiSettings(isWithToken: false), + ) .isApiTokenValid(providerToken); void setHetznerKey(final String hetznerKey) async { diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index a91432dc..1c94a2d0 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -10,9 +10,10 @@ 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_factory_creator.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/cloudflare.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/providers/provider.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/providers/provider_factory.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_factory.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_factory.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server.dart'; import 'package:selfprivacy/logic/common_enum/common_enum.dart'; import 'package:selfprivacy/logic/models/hive/backblaze_credential.dart'; @@ -40,10 +41,14 @@ class ServerAuthorizationException implements Exception { class ServerInstallationRepository { Box box = Hive.box(BNames.serverInstallationBox); Box usersBox = Hive.box(BNames.usersBox); - ProviderApiFactory? serverProviderApiFactory = - ApiFactoryCreator.createProviderApiFactory( - ServerProvider.hetzner, // HARDCODE FOR NOW!!! - ); // Remove when provider selection is implemented. + ServerProviderApiFactory? serverProviderApiFactory = + ApiFactoryCreator.createServerProviderApiFactory( + ServerProvider.hetzner, // TODO: HARDCODE FOR NOW!!! + ); // TODO: Remove when provider selection is implemented. + DnsProviderApiFactory? dnsProviderApiFactory = + ApiFactoryCreator.createDnsProviderApiFactory( + DnsProvider.cloudflare, // TODO: HARDCODE FOR NOW!!! + ); Future load() async { final String? providerApiToken = getIt().hetznerKey; @@ -54,9 +59,18 @@ class ServerInstallationRepository { final ServerHostingDetails? serverDetails = getIt().serverDetails; - if (serverDetails != null) { + if (serverDetails != null && + serverDetails.provider != ServerProvider.unknown) { serverProviderApiFactory = - ApiFactoryCreator.createProviderApiFactory(serverDetails.provider); + ApiFactoryCreator.createServerProviderApiFactory( + serverDetails.provider, + ); + } + + if (serverDomain != null && serverDomain.provider != DnsProvider.unknown) { + dnsProviderApiFactory = ApiFactoryCreator.createDnsProviderApiFactory( + serverDomain.provider, + ); } if (box.get(BNames.hasFinalChecked, defaultValue: false)) { @@ -142,20 +156,22 @@ class ServerInstallationRepository { ) async { ServerHostingDetails? serverDetails; - final ServerProviderApi api = serverProviderApiFactory!.getProvider(); + final ServerProviderApi api = serverProviderApiFactory!.getServerProvider(); serverDetails = await api.powerOn(); return serverDetails; } Future getDomainId(final String token, final String domain) async { - final CloudflareApi cloudflareApi = CloudflareApi( - isWithToken: false, - customToken: token, + final DnsProviderApi dnsProviderApi = dnsProviderApiFactory!.getDnsProvider( + settings: DnsProviderApiSettings( + isWithToken: false, + customToken: token, + ), ); try { - final String domainId = await cloudflareApi.getZoneId(domain); + final String domainId = await dnsProviderApi.getZoneId(domain); return domainId; } on DomainNotFoundException { return null; @@ -220,7 +236,7 @@ class ServerInstallationRepository { required final Future Function(ServerHostingDetails serverDetails) onSuccess, }) async { - final ServerProviderApi api = serverProviderApiFactory!.getProvider(); + final ServerProviderApi api = serverProviderApiFactory!.getServerProvider(); try { final ServerHostingDetails? serverDetails = await api.createServer( dnsApiToken: cloudFlareKey, @@ -285,18 +301,20 @@ class ServerInstallationRepository { final ServerDomain domain, { required final void Function() onCancel, }) async { - final CloudflareApi cloudflareApi = CloudflareApi(); - final ServerProviderApi serverApi = serverProviderApiFactory!.getProvider(); + final DnsProviderApi dnsProviderApi = + dnsProviderApiFactory!.getDnsProvider(); + final ServerProviderApi serverApi = + serverProviderApiFactory!.getServerProvider(); - await cloudflareApi.removeSimilarRecords( + await dnsProviderApi.removeSimilarRecords( ip4: serverDetails.ip4, - cloudFlareDomain: domain, + domain: domain, ); try { - await cloudflareApi.createMultipleDnsRecords( + await dnsProviderApi.createMultipleDnsRecords( ip4: serverDetails.ip4, - cloudFlareDomain: domain, + domain: domain, ); } on DioError catch (e) { final NavigationService nav = getIt.get(); @@ -337,12 +355,13 @@ class ServerInstallationRepository { } Future createDkimRecord(final ServerDomain cloudFlareDomain) async { - final CloudflareApi cloudflareApi = CloudflareApi(); + final DnsProviderApi dnsProviderApi = + dnsProviderApiFactory!.getDnsProvider(); final ServerApi api = ServerApi(); final String? dkimRecordString = await api.getDkim(); - await cloudflareApi.setDkim(dkimRecordString ?? '', cloudFlareDomain); + await dnsProviderApi.setDkim(dkimRecordString ?? '', cloudFlareDomain); } Future isHttpServerWorking() async { @@ -357,12 +376,12 @@ class ServerInstallationRepository { } Future restart() async { - final ServerProviderApi api = serverProviderApiFactory!.getProvider(); + final ServerProviderApi api = serverProviderApiFactory!.getServerProvider(); return api.restart(); } Future powerOn() async { - final ServerProviderApi api = serverProviderApiFactory!.getProvider(); + final ServerProviderApi api = serverProviderApiFactory!.getServerProvider(); return api.powerOn(); } @@ -599,7 +618,7 @@ class ServerInstallationRepository { } Future> getServersOnProviderAccount() async { - final ServerProviderApi api = serverProviderApiFactory!.getProvider(); + final ServerProviderApi api = serverProviderApiFactory!.getServerProvider(); return api.getServers(); } @@ -678,8 +697,9 @@ class ServerInstallationRepository { } Future deleteServer(final ServerDomain serverDomain) async { - final ServerProviderApi api = serverProviderApiFactory!.getProvider(); - final CloudflareApi cloudFlare = CloudflareApi(); + final ServerProviderApi api = serverProviderApiFactory!.getServerProvider(); + final DnsProviderApi dnsProviderApi = + dnsProviderApiFactory!.getDnsProvider(); await api.deleteServer( domainName: serverDomain.domainName, @@ -692,7 +712,7 @@ class ServerInstallationRepository { await box.put(BNames.isLoading, false); await box.put(BNames.serverDetails, null); - await cloudFlare.removeSimilarRecords(cloudFlareDomain: serverDomain); + await dnsProviderApi.removeSimilarRecords(domain: serverDomain); } Future deleteServerRelatedRecords() async { diff --git a/lib/logic/cubit/volumes/volumes_cubit.dart b/lib/logic/cubit/volumes/volumes_cubit.dart index d724e121..2645e502 100644 --- a/lib/logic/cubit/volumes/volumes_cubit.dart +++ b/lib/logic/cubit/volumes/volumes_cubit.dart @@ -1,6 +1,6 @@ import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_creator.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/providers/provider_factory.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_factory.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/hive/server_details.dart'; diff --git a/lib/ui/pages/setup/initializing.dart b/lib/ui/pages/setup/initializing.dart index 01b3cb35..b4a504b8 100644 --- a/lib/ui/pages/setup/initializing.dart +++ b/lib/ui/pages/setup/initializing.dart @@ -5,8 +5,8 @@ import 'package:selfprivacy/config/brand_theme.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'; -import 'package:selfprivacy/logic/cubit/forms/setup/initializing/cloudflare_form_cubit.dart'; -import 'package:selfprivacy/logic/cubit/forms/setup/initializing/domain_cloudflare.dart'; +import 'package:selfprivacy/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart'; +import 'package:selfprivacy/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart'; import 'package:selfprivacy/logic/cubit/forms/setup/initializing/provider_form_cubit.dart'; import 'package:selfprivacy/logic/cubit/forms/setup/initializing/root_user_form_cubit.dart'; import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart'; @@ -195,10 +195,10 @@ class InitializingPage extends StatelessWidget { Widget _stepCloudflare(final ServerInstallationCubit initializingCubit) => BlocProvider( - create: (final context) => CloudFlareFormCubit(initializingCubit), + create: (final context) => DnsProviderFormCubit(initializingCubit), child: Builder( builder: (final context) { - final formCubitState = context.watch().state; + final formCubitState = context.watch().state; return Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -213,7 +213,7 @@ class InitializingPage extends StatelessWidget { BrandText.body2('initializing.4'.tr()), const Spacer(), CubitFormTextField( - formFieldCubit: context.read().apiKey, + formFieldCubit: context.read().apiKey, textAlign: TextAlign.center, scrollPadding: const EdgeInsets.only(bottom: 70), decoration: InputDecoration( @@ -224,7 +224,7 @@ class InitializingPage extends StatelessWidget { BrandButton.rised( onPressed: formCubitState.isSubmitting ? null - : () => context.read().trySubmit(), + : () => context.read().trySubmit(), text: 'basis.connect'.tr(), ), const SizedBox(height: 10), diff --git a/lib/ui/pages/setup/recovering/recovery_confirm_cloudflare.dart b/lib/ui/pages/setup/recovering/recovery_confirm_cloudflare.dart index 0e12b51e..b7891bc1 100644 --- a/lib/ui/pages/setup/recovering/recovery_confirm_cloudflare.dart +++ b/lib/ui/pages/setup/recovering/recovery_confirm_cloudflare.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/cloudflare_form_cubit.dart'; +import 'package:selfprivacy/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart'; import 'package:selfprivacy/ui/components/brand_button/brand_button.dart'; @@ -18,11 +18,11 @@ class RecoveryConfirmCloudflare extends StatelessWidget { context.watch(); return BlocProvider( - create: (final BuildContext context) => CloudFlareFormCubit(appConfig), + create: (final BuildContext context) => DnsProviderFormCubit(appConfig), child: Builder( builder: (final BuildContext context) { final FormCubitState formCubitState = - context.watch().state; + context.watch().state; return BrandHeroScreen( heroTitle: 'recovering.confirm_cloudflare'.tr(), @@ -35,7 +35,7 @@ class RecoveryConfirmCloudflare extends StatelessWidget { context.read().revertRecoveryStep, children: [ CubitFormTextField( - formFieldCubit: context.read().apiKey, + formFieldCubit: context.read().apiKey, decoration: InputDecoration( border: const OutlineInputBorder(), labelText: 'initializing.5'.tr(), @@ -45,7 +45,7 @@ class RecoveryConfirmCloudflare extends StatelessWidget { BrandButton.rised( onPressed: formCubitState.isSubmitting ? null - : () => context.read().trySubmit(), + : () => context.read().trySubmit(), text: 'basis.connect'.tr(), ), const SizedBox(height: 16), From dab2c569ec044c1216abf274ccfa57f5746e105b Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 22 Jul 2022 19:22:10 +0300 Subject: [PATCH 013/115] Fix installation Timer errors Co-authored-by: Inex Code --- assets/translations/en.json | 2 +- lib/logic/api_maps/rest_maps/server.dart | 17 ++++++--- .../server_providers/hetzner/hetzner.dart | 1 + .../cubit/forms/user/ssh_form_cubit.dart | 3 +- .../server_installation_cubit.dart | 36 +++++++++---------- .../server_installation_repository.dart | 22 ++++++------ .../server_installation_state.dart | 20 +++++------ lib/ui/pages/providers/providers.dart | 2 +- lib/ui/pages/setup/initializing.dart | 4 +-- lib/utils/ui_helpers.dart | 2 +- 10 files changed, 58 insertions(+), 51 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index c0e95639..4f32320e 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -284,7 +284,7 @@ "22": "Create master account", "23": "Enter a nickname and strong password", "finish": "Everything is initialized", - "checks": "Checks have been completed \n{} ouf of {}" + "checks": "Checks have been completed \n{} out of {}" }, "recovering": { "recovery_main_header": "Connect to an existing server", diff --git a/lib/logic/api_maps/rest_maps/server.dart b/lib/logic/api_maps/rest_maps/server.dart index 3cb2ed73..c0ef23b0 100644 --- a/lib/logic/api_maps/rest_maps/server.dart +++ b/lib/logic/api_maps/rest_maps/server.dart @@ -46,7 +46,10 @@ class ServerApi extends ApiMap { @override BaseOptions get options { - BaseOptions options = BaseOptions(); + BaseOptions options = BaseOptions( + connectTimeout: 10000, + receiveTimeout: 10000, + ); if (isWithToken) { final ServerDomain? cloudFlareDomain = @@ -56,6 +59,8 @@ class ServerApi extends ApiMap { options = BaseOptions( baseUrl: 'https://api.$domainName', + connectTimeout: 10000, + receiveTimeout: 10000, headers: { 'Authorization': 'Bearer $apiToken', }, @@ -65,6 +70,8 @@ class ServerApi extends ApiMap { if (overrideDomain != null) { options = BaseOptions( baseUrl: 'https://api.$overrideDomain', + connectTimeout: 10000, + receiveTimeout: 10000, headers: customToken != null ? {'Authorization': 'Bearer $customToken'} : null, @@ -619,7 +626,7 @@ class ServerApi extends ApiMap { } } - Future getDkim() async { + Future getDkim() async { Response response; final Dio client = await getClient(); @@ -627,13 +634,13 @@ class ServerApi extends ApiMap { response = await client.get('/services/mailserver/dkim'); } on DioError catch (e) { print(e.message); - return null; + throw Exception('No DKIM key found'); } finally { close(client); } if (response.statusCode == null) { - return null; + throw Exception('No DKIM key found'); } if (response.statusCode == HttpStatus.notFound || response.data == null) { @@ -641,7 +648,7 @@ class ServerApi extends ApiMap { } if (response.statusCode != HttpStatus.ok) { - return ''; + throw Exception('No DKIM key found'); } final Codec base64toString = utf8.fuse(base64); 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 fa75db17..0a2c3c73 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 @@ -341,6 +341,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { rethrow; } catch (e) { print(e); + deleteVolume(dataBase.id); } finally { client.close(); } diff --git a/lib/logic/cubit/forms/user/ssh_form_cubit.dart b/lib/logic/cubit/forms/user/ssh_form_cubit.dart index ba38a642..b6493ee7 100644 --- a/lib/logic/cubit/forms/user/ssh_form_cubit.dart +++ b/lib/logic/cubit/forms/user/ssh_form_cubit.dart @@ -41,7 +41,8 @@ class SshFormCubit extends FormCubit { @override FutureOr onSubmit() { print(key.state.isValid); - jobsCubit.addJob(CreateSSHKeyJob(user: user, publicKey: key.state.value)); + jobsCubit + .addJob(CreateSSHKeyJob(user: user, publicKey: key.state.value.trim())); } late FieldCubit key; diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 6899240f..39f5bf61 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -195,24 +195,10 @@ class ServerInstallationCubit extends Cubit { ); if (matches.values.every((final bool value) => value)) { - final ServerHostingDetails? server = await repository.startServer( + final ServerHostingDetails server = await repository.startServer( dataState.serverDetails!, ); - if (server == null) { - final ServerInstallationNotFinished newState = dataState.copyWith( - isLoading: false, - dnsMatches: matches, - ); - emit(newState); - runDelayed( - startServerIfDnsIsOkay, - const Duration(seconds: 30), - newState, - ); - return; - } - await repository.saveServerDetails(server); await repository.saveIsServerStarted(true); @@ -338,10 +324,22 @@ class ServerInstallationCubit extends Cubit { final bool isServerWorking = await repository.isHttpServerWorking(); if (isServerWorking) { - await repository.createDkimRecord(dataState.serverDomain!); - await repository.saveHasFinalChecked(true); - - emit(dataState.finish()); + bool dkimCreated = true; + try { + await repository.createDkimRecord(dataState.serverDomain!); + } catch (e) { + dkimCreated = false; + } + if (dkimCreated) { + await repository.saveHasFinalChecked(true); + emit(dataState.finish()); + } else { + runDelayed( + finishCheckIfServerIsOkay, + const Duration(seconds: 60), + dataState, + ); + } } else { runDelayed( finishCheckIfServerIsOkay, diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 1c94a2d0..6236052a 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -151,10 +151,10 @@ class ServerInstallationRepository { usersBox.clear(); } - Future startServer( + Future startServer( final ServerHostingDetails hetznerServer, ) async { - ServerHostingDetails? serverDetails; + ServerHostingDetails serverDetails; final ServerProviderApi api = serverProviderApiFactory!.getServerProvider(); serverDetails = await api.powerOn(); @@ -359,20 +359,20 @@ class ServerInstallationRepository { dnsProviderApiFactory!.getDnsProvider(); final ServerApi api = ServerApi(); - final String? dkimRecordString = await api.getDkim(); + String dkimRecordString = ''; + try { + dkimRecordString = await api.getDkim(); + } catch (e) { + print(e); + rethrow; + } - await dnsProviderApi.setDkim(dkimRecordString ?? '', cloudFlareDomain); + await dnsProviderApi.setDkim(dkimRecordString, cloudFlareDomain); } Future isHttpServerWorking() async { final ServerApi api = ServerApi(); - final bool isHttpServerWorking = await api.isHttpServerWorking(); - try { - await api.getDkim(); - } catch (e) { - return false; - } - return isHttpServerWorking; + return api.isHttpServerWorking(); } Future restart() async { diff --git a/lib/logic/cubit/server_installation/server_installation_state.dart b/lib/logic/cubit/server_installation/server_installation_state.dart index 5bb59275..bb04c07d 100644 --- a/lib/logic/cubit/server_installation/server_installation_state.dart +++ b/lib/logic/cubit/server_installation/server_installation_state.dart @@ -35,11 +35,11 @@ abstract class ServerInstallationState extends Equatable { final bool isServerResetedFirstTime; final bool isServerResetedSecondTime; - bool get isProviderFilled => providerApiToken != null; - bool get isCloudFlareFilled => cloudFlareKey != null; - bool get isBackblazeFilled => backblazeCredential != null; - bool get isDomainFilled => serverDomain != null; - bool get isUserFilled => rootUser != null; + bool get isServerProviderFilled => providerApiToken != null; + bool get isDnsProviderFilled => cloudFlareKey != null; + bool get isBackupsProviderFilled => backblazeCredential != null; + bool get isDomainSelected => serverDomain != null; + bool get isPrimaryUserFilled => rootUser != null; bool get isServerCreated => serverDetails != null; bool get isFullyInitilized => _fulfilementList.every((final el) => el!); @@ -58,11 +58,11 @@ abstract class ServerInstallationState extends Equatable { List get _fulfilementList { final List res = [ - isProviderFilled, - isCloudFlareFilled, - isBackblazeFilled, - isDomainFilled, - isUserFilled, + isServerProviderFilled, + isDnsProviderFilled, + isBackupsProviderFilled, + isDomainSelected, + isPrimaryUserFilled, isServerCreated, isServerStarted, isServerResetedFirstTime, diff --git a/lib/ui/pages/providers/providers.dart b/lib/ui/pages/providers/providers.dart index 97e4aeeb..640e620f 100644 --- a/lib/ui/pages/providers/providers.dart +++ b/lib/ui/pages/providers/providers.dart @@ -104,7 +104,7 @@ class _Card extends StatelessWidget { context.watch().state; final String domainName = - appConfig.isDomainFilled ? appConfig.serverDomain!.domainName : ''; + appConfig.isDomainSelected ? appConfig.serverDomain!.domainName : ''; switch (provider.type) { case ProviderType.server: diff --git a/lib/ui/pages/setup/initializing.dart b/lib/ui/pages/setup/initializing.dart index b4a504b8..2cde89ce 100644 --- a/lib/ui/pages/setup/initializing.dart +++ b/lib/ui/pages/setup/initializing.dart @@ -42,7 +42,7 @@ class InitializingPage extends StatelessWidget { () => _stepCheck(cubit), () => _stepCheck(cubit), () => _stepCheck(cubit), - () => Center(child: Text('initializing.finish'.tr())) + () => _stepCheck(cubit) ][cubit.state.progress.index](); return BlocListener( @@ -60,7 +60,7 @@ class InitializingPage extends StatelessWidget { children: [ Padding( padding: paddingH15V0.copyWith(top: 10, bottom: 10), - child: cubit.state.isFullyInitilized + child: cubit.state is ServerInstallationFinished ? const SizedBox( height: 80, ) diff --git a/lib/utils/ui_helpers.dart b/lib/utils/ui_helpers.dart index c34721e1..f4d58a05 100644 --- a/lib/utils/ui_helpers.dart +++ b/lib/utils/ui_helpers.dart @@ -4,5 +4,5 @@ import 'package:selfprivacy/logic/cubit/server_installation/server_installation_ class UiHelpers { static String getDomainName(final ServerInstallationState config) => - config.isDomainFilled ? config.serverDomain!.domainName : 'example.com'; + config.isDomainSelected ? config.serverDomain!.domainName : 'example.com'; } From d8ea5286214ede7a7fcf26a8961a3b1f2e91ca47 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 25 Jul 2022 03:03:19 +0300 Subject: [PATCH 014/115] Add magic sleep before deleteVolume on creation failure It seems Hetzner fails to accept our deleteVolume request so quickly after failing. We need to wait for about 10 seconds, I guess. The same magic sleep happens on deleteServer pack of requests. Please have patience... --- .../server_providers/hetzner/hetzner.dart | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) 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 0a2c3c73..4c9664bb 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 @@ -271,10 +271,6 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { dataBase: newVolume, ); - if (details == null) { - deleteVolume(newVolume.id); - } - return details; } @@ -320,6 +316,8 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { print('Decoded data: $data'); ServerHostingDetails? serverDetails; + DioError? hetznerError; + bool success = false; try { final Response serverCreateResponse = await client.post( @@ -335,17 +333,25 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { apiToken: apiToken, provider: ServerProvider.hetzner, ); + success = true; } on DioError catch (e) { print(e); - deleteVolume(dataBase.id); - rethrow; + hetznerError = e; } catch (e) { print(e); - deleteVolume(dataBase.id); } finally { client.close(); } + if (!success) { + await Future.delayed(const Duration(seconds: 10)); + await deleteVolume(dbId); + } + + if (hetznerError != null) { + throw hetznerError; + } + return serverDetails; } From 7ead9a29ea9ec615cee6577f7b2de7f084e79c65 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 25 Jul 2022 17:06:55 +0300 Subject: [PATCH 015/115] Implement basic graphql api map structure --- assets/translations/en.json | 3 +- assets/translations/ru.json | 3 +- build.yaml | 2 +- lib/logic/api_maps/graphql_maps/api_map.dart | 25 + .../schema/get_api_tokens.graphql.dart | 474 ++++++++++++++++++ .../schema/get_api_tokens.graphql.g.dart | 23 + .../schema/get_api_version.graphql.dart | 301 +++++++++++ .../schema/get_api_version.graphql.g.dart | 14 + .../graphql_maps/schema/schema.graphql.dart | 274 ++++++++++ .../graphql_maps/schema/schema.graphql.g.dart | 21 + .../api_maps/graphql_maps/schema/server.dart | 39 ++ lib/logic/api_maps/rest_maps/server.dart | 5 +- lib/logic/models/json/api_token.g.dart | 6 + lib/logic/models/json/backup.g.dart | 12 + lib/logic/models/json/device_token.g.dart | 6 + .../models/json/hetzner_server_info.g.dart | 49 ++ .../models/json/recovery_token_status.g.dart | 9 + lib/ui/pages/more/info/info.dart | 25 +- pubspec.lock | 82 +-- pubspec.yaml | 18 +- .../flutter/generated_plugin_registrant.cc | 3 + windows/flutter/generated_plugins.cmake | 1 + 22 files changed, 1321 insertions(+), 74 deletions(-) create mode 100644 lib/logic/api_maps/graphql_maps/api_map.dart create mode 100644 lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql.dart create mode 100644 lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql.dart create mode 100644 lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart create mode 100644 lib/logic/api_maps/graphql_maps/schema/server.dart diff --git a/assets/translations/en.json b/assets/translations/en.json index c0e95639..4fdb0626 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -52,7 +52,8 @@ "copied_ssh": "SSH copied to clipboard", "delete_ssh_text": "Delete SSH key?", "about_app_page": { - "text": "Application version v.{}" + "application_version_text": "Application version v.{}", + "api_version_text": "Server API version v.{}" }, "settings": { "title": "Application settings", diff --git a/assets/translations/ru.json b/assets/translations/ru.json index e2048024..a93e122a 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -52,7 +52,8 @@ "copied_ssh": "SSH ключ cкопирован в буфер", "delete_ssh_text": "Удалить SSH ключ?", "about_app_page": { - "text": "Версия приложения: v.{}" + "application_version_text": "Версия приложения v.{}", + "api_version_text": "Версия API сервера v.{}" }, "settings": { "title": "Настройки приложения", diff --git a/build.yaml b/build.yaml index 2fb31704..993e8dd4 100644 --- a/build.yaml +++ b/build.yaml @@ -14,4 +14,4 @@ targets: json_serializable: options: create_factory: true - create_to_json: false + create_to_json: true diff --git a/lib/logic/api_maps/graphql_maps/api_map.dart b/lib/logic/api_maps/graphql_maps/api_map.dart new file mode 100644 index 00000000..90d6a349 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/api_map.dart @@ -0,0 +1,25 @@ +import 'package:graphql_flutter/graphql_flutter.dart'; + +abstract class ApiMap { + Future getClient() async { + final httpLink = HttpLink( + 'https://api.$rootAddress/graphql', + ); + + final Link graphQLLink = isWithToken + ? AuthLink( + getToken: () async => authToken, + ).concat(httpLink) + : httpLink; + + return GraphQLClient( + cache: GraphQLCache(), + link: graphQLLink, + ); + } + + abstract final String? rootAddress; + abstract final bool hasLogger; + abstract final bool isWithToken; + abstract final String authToken; +} diff --git a/lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql.dart new file mode 100644 index 00000000..763ffcc4 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql.dart @@ -0,0 +1,474 @@ +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 'get_api_tokens.graphql.g.dart'; + +@JsonSerializable(explicitToJson: true) +class Query$GetApiTokensQuery { + Query$GetApiTokensQuery({required this.api, required this.$__typename}); + + @override + factory Query$GetApiTokensQuery.fromJson(Map json) => + _$Query$GetApiTokensQueryFromJson(json); + + final Query$GetApiTokensQuery$api api; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$GetApiTokensQueryToJson(this); + 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$GetApiTokensQuery) || 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$GetApiTokensQuery on Query$GetApiTokensQuery { + CopyWith$Query$GetApiTokensQuery get copyWith => + CopyWith$Query$GetApiTokensQuery(this, (i) => i); +} + +abstract class CopyWith$Query$GetApiTokensQuery { + factory CopyWith$Query$GetApiTokensQuery(Query$GetApiTokensQuery instance, + TRes Function(Query$GetApiTokensQuery) then) = + _CopyWithImpl$Query$GetApiTokensQuery; + + factory CopyWith$Query$GetApiTokensQuery.stub(TRes res) = + _CopyWithStubImpl$Query$GetApiTokensQuery; + + TRes call({Query$GetApiTokensQuery$api? api, String? $__typename}); + CopyWith$Query$GetApiTokensQuery$api get api; +} + +class _CopyWithImpl$Query$GetApiTokensQuery + implements CopyWith$Query$GetApiTokensQuery { + _CopyWithImpl$Query$GetApiTokensQuery(this._instance, this._then); + + final Query$GetApiTokensQuery _instance; + + final TRes Function(Query$GetApiTokensQuery) _then; + + static const _undefined = {}; + + TRes call({Object? api = _undefined, Object? $__typename = _undefined}) => + _then(Query$GetApiTokensQuery( + api: api == _undefined || api == null + ? _instance.api + : (api as Query$GetApiTokensQuery$api), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); + CopyWith$Query$GetApiTokensQuery$api get api { + final local$api = _instance.api; + return CopyWith$Query$GetApiTokensQuery$api(local$api, (e) => call(api: e)); + } +} + +class _CopyWithStubImpl$Query$GetApiTokensQuery + implements CopyWith$Query$GetApiTokensQuery { + _CopyWithStubImpl$Query$GetApiTokensQuery(this._res); + + TRes _res; + + call({Query$GetApiTokensQuery$api? api, String? $__typename}) => _res; + CopyWith$Query$GetApiTokensQuery$api get api => + CopyWith$Query$GetApiTokensQuery$api.stub(_res); +} + +const documentNodeQueryGetApiTokensQuery = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.query, + name: NameNode(value: 'GetApiTokensQuery'), + 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: '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) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), +]); +Query$GetApiTokensQuery _parserFn$Query$GetApiTokensQuery( + Map data) => + Query$GetApiTokensQuery.fromJson(data); + +class Options$Query$GetApiTokensQuery + extends graphql.QueryOptions { + Options$Query$GetApiTokensQuery( + {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: documentNodeQueryGetApiTokensQuery, + parserFn: _parserFn$Query$GetApiTokensQuery); +} + +class WatchOptions$Query$GetApiTokensQuery + extends graphql.WatchQueryOptions { + WatchOptions$Query$GetApiTokensQuery( + {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: documentNodeQueryGetApiTokensQuery, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Query$GetApiTokensQuery); +} + +class FetchMoreOptions$Query$GetApiTokensQuery + extends graphql.FetchMoreOptions { + FetchMoreOptions$Query$GetApiTokensQuery( + {required graphql.UpdateQuery updateQuery}) + : super( + updateQuery: updateQuery, + document: documentNodeQueryGetApiTokensQuery); +} + +extension ClientExtension$Query$GetApiTokensQuery on graphql.GraphQLClient { + Future> query$GetApiTokensQuery( + [Options$Query$GetApiTokensQuery? options]) async => + await this.query(options ?? Options$Query$GetApiTokensQuery()); + graphql.ObservableQuery watchQuery$GetApiTokensQuery( + [WatchOptions$Query$GetApiTokensQuery? options]) => + this.watchQuery(options ?? WatchOptions$Query$GetApiTokensQuery()); + void writeQuery$GetApiTokensQuery( + {required Query$GetApiTokensQuery data, bool broadcast = true}) => + this.writeQuery( + graphql.Request( + operation: graphql.Operation( + document: documentNodeQueryGetApiTokensQuery)), + data: data.toJson(), + broadcast: broadcast); + Query$GetApiTokensQuery? readQuery$GetApiTokensQuery( + {bool optimistic = true}) { + final result = this.readQuery( + graphql.Request( + operation: graphql.Operation( + document: documentNodeQueryGetApiTokensQuery)), + optimistic: optimistic); + return result == null ? null : Query$GetApiTokensQuery.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$GetApiTokensQuery$api { + Query$GetApiTokensQuery$api( + {required this.devices, required this.$__typename}); + + @override + factory Query$GetApiTokensQuery$api.fromJson(Map json) => + _$Query$GetApiTokensQuery$apiFromJson(json); + + final List devices; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$GetApiTokensQuery$apiToJson(this); + int get hashCode { + final l$devices = devices; + final l$$__typename = $__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$GetApiTokensQuery$api) || + runtimeType != other.runtimeType) return false; + final l$devices = devices; + final lOther$devices = other.devices; + 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; + } + + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$GetApiTokensQuery$api + on Query$GetApiTokensQuery$api { + CopyWith$Query$GetApiTokensQuery$api + get copyWith => CopyWith$Query$GetApiTokensQuery$api(this, (i) => i); +} + +abstract class CopyWith$Query$GetApiTokensQuery$api { + factory CopyWith$Query$GetApiTokensQuery$api( + Query$GetApiTokensQuery$api instance, + TRes Function(Query$GetApiTokensQuery$api) then) = + _CopyWithImpl$Query$GetApiTokensQuery$api; + + factory CopyWith$Query$GetApiTokensQuery$api.stub(TRes res) = + _CopyWithStubImpl$Query$GetApiTokensQuery$api; + + TRes call( + {List? devices, + String? $__typename}); + TRes devices( + Iterable Function( + Iterable< + CopyWith$Query$GetApiTokensQuery$api$devices< + Query$GetApiTokensQuery$api$devices>>) + _fn); +} + +class _CopyWithImpl$Query$GetApiTokensQuery$api + implements CopyWith$Query$GetApiTokensQuery$api { + _CopyWithImpl$Query$GetApiTokensQuery$api(this._instance, this._then); + + final Query$GetApiTokensQuery$api _instance; + + final TRes Function(Query$GetApiTokensQuery$api) _then; + + static const _undefined = {}; + + TRes call({Object? devices = _undefined, Object? $__typename = _undefined}) => + _then(Query$GetApiTokensQuery$api( + 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< + CopyWith$Query$GetApiTokensQuery$api$devices< + Query$GetApiTokensQuery$api$devices>>) + _fn) => + call( + devices: _fn(_instance.devices.map((e) => + CopyWith$Query$GetApiTokensQuery$api$devices(e, (i) => i))) + .toList()); +} + +class _CopyWithStubImpl$Query$GetApiTokensQuery$api + implements CopyWith$Query$GetApiTokensQuery$api { + _CopyWithStubImpl$Query$GetApiTokensQuery$api(this._res); + + TRes _res; + + call( + {List? devices, + String? $__typename}) => + _res; + devices(_fn) => _res; +} + +@JsonSerializable(explicitToJson: true) +class Query$GetApiTokensQuery$api$devices { + Query$GetApiTokensQuery$api$devices( + {required this.creationDate, + required this.isCaller, + required this.name, + required this.$__typename}); + + @override + factory Query$GetApiTokensQuery$api$devices.fromJson( + Map json) => + _$Query$GetApiTokensQuery$api$devicesFromJson(json); + + @JsonKey(fromJson: dateTimeFromJson, toJson: dateTimeToJson) + final DateTime creationDate; + + final bool isCaller; + + final String name; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Query$GetApiTokensQuery$api$devicesToJson(this); + 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]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$GetApiTokensQuery$api$devices) || + runtimeType != other.runtimeType) return false; + final l$creationDate = creationDate; + final lOther$creationDate = other.creationDate; + if (l$creationDate != lOther$creationDate) return false; + final l$isCaller = isCaller; + final lOther$isCaller = other.isCaller; + if (l$isCaller != lOther$isCaller) return false; + final l$name = name; + final lOther$name = other.name; + if (l$name != lOther$name) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$GetApiTokensQuery$api$devices + on Query$GetApiTokensQuery$api$devices { + CopyWith$Query$GetApiTokensQuery$api$devices< + Query$GetApiTokensQuery$api$devices> + get copyWith => + CopyWith$Query$GetApiTokensQuery$api$devices(this, (i) => i); +} + +abstract class CopyWith$Query$GetApiTokensQuery$api$devices { + factory CopyWith$Query$GetApiTokensQuery$api$devices( + Query$GetApiTokensQuery$api$devices instance, + TRes Function(Query$GetApiTokensQuery$api$devices) then) = + _CopyWithImpl$Query$GetApiTokensQuery$api$devices; + + factory CopyWith$Query$GetApiTokensQuery$api$devices.stub(TRes res) = + _CopyWithStubImpl$Query$GetApiTokensQuery$api$devices; + + TRes call( + {DateTime? creationDate, + bool? isCaller, + String? name, + String? $__typename}); +} + +class _CopyWithImpl$Query$GetApiTokensQuery$api$devices + implements CopyWith$Query$GetApiTokensQuery$api$devices { + _CopyWithImpl$Query$GetApiTokensQuery$api$devices(this._instance, this._then); + + final Query$GetApiTokensQuery$api$devices _instance; + + final TRes Function(Query$GetApiTokensQuery$api$devices) _then; + + static const _undefined = {}; + + TRes call( + {Object? creationDate = _undefined, + Object? isCaller = _undefined, + Object? name = _undefined, + Object? $__typename = _undefined}) => + _then(Query$GetApiTokensQuery$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))); +} + +class _CopyWithStubImpl$Query$GetApiTokensQuery$api$devices + implements CopyWith$Query$GetApiTokensQuery$api$devices { + _CopyWithStubImpl$Query$GetApiTokensQuery$api$devices(this._res); + + TRes _res; + + call( + {DateTime? creationDate, + bool? isCaller, + String? name, + String? $__typename}) => + _res; +} diff --git a/lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql.g.dart b/lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql.g.dart index 508d8010..bb5e5bae 100644 --- a/lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql.g.dart +++ b/lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql.g.dart @@ -14,6 +14,13 @@ Query$GetApiTokensQuery _$Query$GetApiTokensQueryFromJson( $__typename: json['__typename'] as String, ); +Map _$Query$GetApiTokensQueryToJson( + Query$GetApiTokensQuery instance) => + { + 'api': instance.api.toJson(), + '__typename': instance.$__typename, + }; + Query$GetApiTokensQuery$api _$Query$GetApiTokensQuery$apiFromJson( Map json) => Query$GetApiTokensQuery$api( @@ -24,6 +31,13 @@ Query$GetApiTokensQuery$api _$Query$GetApiTokensQuery$apiFromJson( $__typename: json['__typename'] as String, ); +Map _$Query$GetApiTokensQuery$apiToJson( + Query$GetApiTokensQuery$api instance) => + { + 'devices': instance.devices.map((e) => e.toJson()).toList(), + '__typename': instance.$__typename, + }; + Query$GetApiTokensQuery$api$devices _$Query$GetApiTokensQuery$api$devicesFromJson(Map json) => Query$GetApiTokensQuery$api$devices( @@ -32,3 +46,12 @@ Query$GetApiTokensQuery$api$devices name: json['name'] as String, $__typename: json['__typename'] as String, ); + +Map _$Query$GetApiTokensQuery$api$devicesToJson( + Query$GetApiTokensQuery$api$devices instance) => + { + 'creationDate': dateTimeToJson(instance.creationDate), + 'isCaller': instance.isCaller, + 'name': instance.name, + '__typename': instance.$__typename, + }; diff --git a/lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql.dart new file mode 100644 index 00000000..8d255fe6 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql.dart @@ -0,0 +1,301 @@ +import 'package:gql/ast.dart'; +import 'package:graphql/client.dart' as graphql; +import 'package:json_annotation/json_annotation.dart'; +part 'get_api_version.graphql.g.dart'; + +@JsonSerializable(explicitToJson: true) +class Query$GetApiVersionQuery { + Query$GetApiVersionQuery({required this.api, required this.$__typename}); + + @override + factory Query$GetApiVersionQuery.fromJson(Map json) => + _$Query$GetApiVersionQueryFromJson(json); + + final Query$GetApiVersionQuery$api api; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$GetApiVersionQueryToJson(this); + 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$GetApiVersionQuery) || + 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$GetApiVersionQuery + on Query$GetApiVersionQuery { + CopyWith$Query$GetApiVersionQuery get copyWith => + CopyWith$Query$GetApiVersionQuery(this, (i) => i); +} + +abstract class CopyWith$Query$GetApiVersionQuery { + factory CopyWith$Query$GetApiVersionQuery(Query$GetApiVersionQuery instance, + TRes Function(Query$GetApiVersionQuery) then) = + _CopyWithImpl$Query$GetApiVersionQuery; + + factory CopyWith$Query$GetApiVersionQuery.stub(TRes res) = + _CopyWithStubImpl$Query$GetApiVersionQuery; + + TRes call({Query$GetApiVersionQuery$api? api, String? $__typename}); + CopyWith$Query$GetApiVersionQuery$api get api; +} + +class _CopyWithImpl$Query$GetApiVersionQuery + implements CopyWith$Query$GetApiVersionQuery { + _CopyWithImpl$Query$GetApiVersionQuery(this._instance, this._then); + + final Query$GetApiVersionQuery _instance; + + final TRes Function(Query$GetApiVersionQuery) _then; + + static const _undefined = {}; + + TRes call({Object? api = _undefined, Object? $__typename = _undefined}) => + _then(Query$GetApiVersionQuery( + api: api == _undefined || api == null + ? _instance.api + : (api as Query$GetApiVersionQuery$api), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); + CopyWith$Query$GetApiVersionQuery$api get api { + final local$api = _instance.api; + return CopyWith$Query$GetApiVersionQuery$api( + local$api, (e) => call(api: e)); + } +} + +class _CopyWithStubImpl$Query$GetApiVersionQuery + implements CopyWith$Query$GetApiVersionQuery { + _CopyWithStubImpl$Query$GetApiVersionQuery(this._res); + + TRes _res; + + call({Query$GetApiVersionQuery$api? api, String? $__typename}) => _res; + CopyWith$Query$GetApiVersionQuery$api get api => + CopyWith$Query$GetApiVersionQuery$api.stub(_res); +} + +const documentNodeQueryGetApiVersionQuery = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.query, + name: NameNode(value: 'GetApiVersionQuery'), + 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: null), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), +]); +Query$GetApiVersionQuery _parserFn$Query$GetApiVersionQuery( + Map data) => + Query$GetApiVersionQuery.fromJson(data); + +class Options$Query$GetApiVersionQuery + extends graphql.QueryOptions { + Options$Query$GetApiVersionQuery( + {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: documentNodeQueryGetApiVersionQuery, + parserFn: _parserFn$Query$GetApiVersionQuery); +} + +class WatchOptions$Query$GetApiVersionQuery + extends graphql.WatchQueryOptions { + WatchOptions$Query$GetApiVersionQuery( + {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: documentNodeQueryGetApiVersionQuery, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Query$GetApiVersionQuery); +} + +class FetchMoreOptions$Query$GetApiVersionQuery + extends graphql.FetchMoreOptions { + FetchMoreOptions$Query$GetApiVersionQuery( + {required graphql.UpdateQuery updateQuery}) + : super( + updateQuery: updateQuery, + document: documentNodeQueryGetApiVersionQuery); +} + +extension ClientExtension$Query$GetApiVersionQuery on graphql.GraphQLClient { + Future> + query$GetApiVersionQuery( + [Options$Query$GetApiVersionQuery? options]) async => + await this.query(options ?? Options$Query$GetApiVersionQuery()); + graphql.ObservableQuery + watchQuery$GetApiVersionQuery( + [WatchOptions$Query$GetApiVersionQuery? options]) => + this.watchQuery(options ?? WatchOptions$Query$GetApiVersionQuery()); + void writeQuery$GetApiVersionQuery( + {required Query$GetApiVersionQuery data, bool broadcast = true}) => + this.writeQuery( + graphql.Request( + operation: graphql.Operation( + document: documentNodeQueryGetApiVersionQuery)), + data: data.toJson(), + broadcast: broadcast); + Query$GetApiVersionQuery? readQuery$GetApiVersionQuery( + {bool optimistic = true}) { + final result = this.readQuery( + graphql.Request( + operation: graphql.Operation( + document: documentNodeQueryGetApiVersionQuery)), + optimistic: optimistic); + return result == null ? null : Query$GetApiVersionQuery.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$GetApiVersionQuery$api { + Query$GetApiVersionQuery$api( + {required this.version, required this.$__typename}); + + @override + factory Query$GetApiVersionQuery$api.fromJson(Map json) => + _$Query$GetApiVersionQuery$apiFromJson(json); + + final String version; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$GetApiVersionQuery$apiToJson(this); + int get hashCode { + final l$version = version; + final l$$__typename = $__typename; + return Object.hashAll([l$version, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$GetApiVersionQuery$api) || + runtimeType != other.runtimeType) return false; + final l$version = version; + final lOther$version = other.version; + if (l$version != lOther$version) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$GetApiVersionQuery$api + on Query$GetApiVersionQuery$api { + CopyWith$Query$GetApiVersionQuery$api + get copyWith => CopyWith$Query$GetApiVersionQuery$api(this, (i) => i); +} + +abstract class CopyWith$Query$GetApiVersionQuery$api { + factory CopyWith$Query$GetApiVersionQuery$api( + Query$GetApiVersionQuery$api instance, + TRes Function(Query$GetApiVersionQuery$api) then) = + _CopyWithImpl$Query$GetApiVersionQuery$api; + + factory CopyWith$Query$GetApiVersionQuery$api.stub(TRes res) = + _CopyWithStubImpl$Query$GetApiVersionQuery$api; + + TRes call({String? version, String? $__typename}); +} + +class _CopyWithImpl$Query$GetApiVersionQuery$api + implements CopyWith$Query$GetApiVersionQuery$api { + _CopyWithImpl$Query$GetApiVersionQuery$api(this._instance, this._then); + + final Query$GetApiVersionQuery$api _instance; + + final TRes Function(Query$GetApiVersionQuery$api) _then; + + static const _undefined = {}; + + TRes call({Object? version = _undefined, Object? $__typename = _undefined}) => + _then(Query$GetApiVersionQuery$api( + version: version == _undefined || version == null + ? _instance.version + : (version as String), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); +} + +class _CopyWithStubImpl$Query$GetApiVersionQuery$api + implements CopyWith$Query$GetApiVersionQuery$api { + _CopyWithStubImpl$Query$GetApiVersionQuery$api(this._res); + + TRes _res; + + call({String? version, String? $__typename}) => _res; +} diff --git a/lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql.g.dart b/lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql.g.dart index c0b5a378..0c051786 100644 --- a/lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql.g.dart +++ b/lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql.g.dart @@ -14,9 +14,23 @@ Query$GetApiVersionQuery _$Query$GetApiVersionQueryFromJson( $__typename: json['__typename'] as String, ); +Map _$Query$GetApiVersionQueryToJson( + Query$GetApiVersionQuery instance) => + { + 'api': instance.api.toJson(), + '__typename': instance.$__typename, + }; + Query$GetApiVersionQuery$api _$Query$GetApiVersionQuery$apiFromJson( Map json) => Query$GetApiVersionQuery$api( version: json['version'] as String, $__typename: json['__typename'] as String, ); + +Map _$Query$GetApiVersionQuery$apiToJson( + Query$GetApiVersionQuery$api instance) => + { + 'version': instance.version, + '__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 new file mode 100644 index 00000000..27f902e2 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart @@ -0,0 +1,274 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:selfprivacy/utils/scalars.dart'; +part 'schema.graphql.g.dart'; + +@JsonSerializable(explicitToJson: true) +class Input$RecoveryKeyLimitsInput { + Input$RecoveryKeyLimitsInput({this.expirationDate, this.uses}); + + @override + factory Input$RecoveryKeyLimitsInput.fromJson(Map json) => + _$Input$RecoveryKeyLimitsInputFromJson(json); + + @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]); + } + + @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; + } + + CopyWith$Input$RecoveryKeyLimitsInput + get copyWith => CopyWith$Input$RecoveryKeyLimitsInput(this, (i) => i); +} + +abstract class CopyWith$Input$RecoveryKeyLimitsInput { + factory CopyWith$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}); +} + +class _CopyWithImpl$Input$RecoveryKeyLimitsInput + implements CopyWith$Input$RecoveryKeyLimitsInput { + _CopyWithImpl$Input$RecoveryKeyLimitsInput(this._instance, this._then); + + final Input$RecoveryKeyLimitsInput _instance; + + final TRes Function(Input$RecoveryKeyLimitsInput) _then; + + 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?))); +} + +class _CopyWithStubImpl$Input$RecoveryKeyLimitsInput + implements CopyWith$Input$RecoveryKeyLimitsInput { + _CopyWithStubImpl$Input$RecoveryKeyLimitsInput(this._res); + + TRes _res; + + call({DateTime? expirationDate, int? uses}) => _res; +} + +@JsonSerializable(explicitToJson: true) +class Input$UseNewDeviceKeyInput { + Input$UseNewDeviceKeyInput({required this.key, required this.deviceName}); + + @override + factory Input$UseNewDeviceKeyInput.fromJson(Map json) => + _$Input$UseNewDeviceKeyInputFromJson(json); + + 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]); + } + + @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; + } + + CopyWith$Input$UseNewDeviceKeyInput + get copyWith => CopyWith$Input$UseNewDeviceKeyInput(this, (i) => i); +} + +abstract class CopyWith$Input$UseNewDeviceKeyInput { + factory CopyWith$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}); +} + +class _CopyWithImpl$Input$UseNewDeviceKeyInput + implements CopyWith$Input$UseNewDeviceKeyInput { + _CopyWithImpl$Input$UseNewDeviceKeyInput(this._instance, this._then); + + final Input$UseNewDeviceKeyInput _instance; + + final TRes Function(Input$UseNewDeviceKeyInput) _then; + + 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))); +} + +class _CopyWithStubImpl$Input$UseNewDeviceKeyInput + implements CopyWith$Input$UseNewDeviceKeyInput { + _CopyWithStubImpl$Input$UseNewDeviceKeyInput(this._res); + + TRes _res; + + call({String? key, String? deviceName}) => _res; +} + +@JsonSerializable(explicitToJson: true) +class Input$UseRecoveryKeyInput { + Input$UseRecoveryKeyInput({required this.key, required this.deviceName}); + + @override + factory Input$UseRecoveryKeyInput.fromJson(Map json) => + _$Input$UseRecoveryKeyInputFromJson(json); + + 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]); + } + + @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; + } + + CopyWith$Input$UseRecoveryKeyInput get copyWith => + CopyWith$Input$UseRecoveryKeyInput(this, (i) => i); +} + +abstract class CopyWith$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}); +} + +class _CopyWithImpl$Input$UseRecoveryKeyInput + implements CopyWith$Input$UseRecoveryKeyInput { + _CopyWithImpl$Input$UseRecoveryKeyInput(this._instance, this._then); + + final Input$UseRecoveryKeyInput _instance; + + final TRes Function(Input$UseRecoveryKeyInput) _then; + + 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))); +} + +class _CopyWithStubImpl$Input$UseRecoveryKeyInput + implements CopyWith$Input$UseRecoveryKeyInput { + _CopyWithStubImpl$Input$UseRecoveryKeyInput(this._res); + + TRes _res; + + call({String? key, String? deviceName}) => _res; +} + +enum Enum$DnsProvider { + @JsonValue('CLOUDFLARE') + CLOUDFLARE, + $unknown +} + +enum Enum$ServerProvider { + @JsonValue('HETZNER') + HETZNER, + $unknown +} + +enum Enum$Severity { + @JsonValue('INFO') + INFO, + @JsonValue('WARNING') + WARNING, + @JsonValue('ERROR') + ERROR, + @JsonValue('CRITICAL') + CRITICAL, + @JsonValue('SUCCESS') + SUCCESS, + $unknown +} + +const possibleTypesMap = { + 'MutationReturnInterface': { + 'ApiKeyMutationReturn', + 'DeviceApiTokenMutationReturn', + 'GenericMutationReturn' + } +}; +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 index 84a4c38f..9002a8e1 100644 --- a/lib/logic/api_maps/graphql_maps/schema/schema.graphql.g.dart +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.g.dart @@ -13,6 +13,13 @@ Input$RecoveryKeyLimitsInput _$Input$RecoveryKeyLimitsInputFromJson( uses: json['uses'] as int?, ); +Map _$Input$RecoveryKeyLimitsInputToJson( + Input$RecoveryKeyLimitsInput instance) => + { + 'expirationDate': _nullable$dateTimeToJson(instance.expirationDate), + 'uses': instance.uses, + }; + Input$UseNewDeviceKeyInput _$Input$UseNewDeviceKeyInputFromJson( Map json) => Input$UseNewDeviceKeyInput( @@ -20,9 +27,23 @@ Input$UseNewDeviceKeyInput _$Input$UseNewDeviceKeyInputFromJson( 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, + }; diff --git a/lib/logic/api_maps/graphql_maps/schema/server.dart b/lib/logic/api_maps/graphql_maps/schema/server.dart new file mode 100644 index 00000000..cc0a6c38 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/server.dart @@ -0,0 +1,39 @@ +import 'package:graphql/client.dart'; +import 'package:selfprivacy/config/get_it_config.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/api_map.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/get_api_version.graphql.dart'; +import 'package:selfprivacy/logic/models/hive/server_domain.dart'; + +class ServerApi extends ApiMap { + ServerApi({ + this.hasLogger = false, + this.isWithToken = true, + this.authToken = '', + }) { + final ServerDomain? serverDomain = getIt().serverDomain; + rootAddress = serverDomain?.domainName ?? ''; + } + @override + bool hasLogger; + @override + bool isWithToken; + @override + String authToken; + @override + String? rootAddress; + + Future getApiVersion() async { + QueryResult response; + + final GraphQLClient client = await getClient(); + String? apiVersion; + + try { + response = await client.query$GetApiVersionQuery(); + apiVersion = response.data!['api']['version']; + } catch (e) { + print(e); + } + return apiVersion; + } +} diff --git a/lib/logic/api_maps/rest_maps/server.dart b/lib/logic/api_maps/rest_maps/server.dart index 3cb2ed73..4139d3e2 100644 --- a/lib/logic/api_maps/rest_maps/server.dart +++ b/lib/logic/api_maps/rest_maps/server.dart @@ -49,9 +49,8 @@ class ServerApi extends ApiMap { BaseOptions options = BaseOptions(); if (isWithToken) { - final ServerDomain? cloudFlareDomain = - getIt().serverDomain; - final String domainName = cloudFlareDomain!.domainName; + final ServerDomain? serverDomain = getIt().serverDomain; + final String domainName = serverDomain!.domainName; final String? apiToken = getIt().serverDetails?.apiToken; options = BaseOptions( diff --git a/lib/logic/models/json/api_token.g.dart b/lib/logic/models/json/api_token.g.dart index b6c8b8db..7f7af88c 100644 --- a/lib/logic/models/json/api_token.g.dart +++ b/lib/logic/models/json/api_token.g.dart @@ -11,3 +11,9 @@ ApiToken _$ApiTokenFromJson(Map json) => ApiToken( date: DateTime.parse(json['date'] as String), isCaller: json['is_caller'] as bool, ); + +Map _$ApiTokenToJson(ApiToken instance) => { + 'name': instance.name, + 'date': instance.date.toIso8601String(), + 'is_caller': instance.isCaller, + }; diff --git a/lib/logic/models/json/backup.g.dart b/lib/logic/models/json/backup.g.dart index c784abe1..dea4847d 100644 --- a/lib/logic/models/json/backup.g.dart +++ b/lib/logic/models/json/backup.g.dart @@ -11,12 +11,24 @@ Backup _$BackupFromJson(Map json) => Backup( id: json['short_id'] as String, ); +Map _$BackupToJson(Backup instance) => { + 'time': instance.time.toIso8601String(), + 'short_id': instance.id, + }; + BackupStatus _$BackupStatusFromJson(Map json) => BackupStatus( status: $enumDecode(_$BackupStatusEnumEnumMap, json['status']), progress: (json['progress'] as num).toDouble(), errorMessage: json['error_message'] as String?, ); +Map _$BackupStatusToJson(BackupStatus instance) => + { + 'status': _$BackupStatusEnumEnumMap[instance.status]!, + 'progress': instance.progress, + 'error_message': instance.errorMessage, + }; + const _$BackupStatusEnumEnumMap = { BackupStatusEnum.noKey: 'NO_KEY', BackupStatusEnum.notInitialized: 'NOT_INITIALIZED', diff --git a/lib/logic/models/json/device_token.g.dart b/lib/logic/models/json/device_token.g.dart index efe976c5..406530df 100644 --- a/lib/logic/models/json/device_token.g.dart +++ b/lib/logic/models/json/device_token.g.dart @@ -10,3 +10,9 @@ DeviceToken _$DeviceTokenFromJson(Map json) => DeviceToken( device: json['device'] as String, token: json['token'] as String, ); + +Map _$DeviceTokenToJson(DeviceToken instance) => + { + 'device': instance.device, + 'token': instance.token, + }; diff --git a/lib/logic/models/json/hetzner_server_info.g.dart b/lib/logic/models/json/hetzner_server_info.g.dart index e8c21917..6c178ea4 100644 --- a/lib/logic/models/json/hetzner_server_info.g.dart +++ b/lib/logic/models/json/hetzner_server_info.g.dart @@ -19,6 +19,18 @@ HetznerServerInfo _$HetznerServerInfoFromJson(Map json) => (json['volumes'] as List).map((e) => e as int).toList(), ); +Map _$HetznerServerInfoToJson(HetznerServerInfo instance) => + { + 'id': instance.id, + 'name': instance.name, + 'status': _$ServerStatusEnumMap[instance.status]!, + 'created': instance.created.toIso8601String(), + 'volumes': instance.volumes, + 'server_type': instance.serverType, + 'datacenter': instance.location, + 'public_net': instance.publicNet, + }; + const _$ServerStatusEnumMap = { ServerStatus.running: 'running', ServerStatus.initializing: 'initializing', @@ -37,6 +49,12 @@ HetznerPublicNetInfo _$HetznerPublicNetInfoFromJson( HetznerIp4.fromJson(json['ipv4'] as Map), ); +Map _$HetznerPublicNetInfoToJson( + HetznerPublicNetInfo instance) => + { + 'ipv4': instance.ipv4, + }; + HetznerIp4 _$HetznerIp4FromJson(Map json) => HetznerIp4( json['id'] as int, json['ip'] as String, @@ -44,6 +62,14 @@ HetznerIp4 _$HetznerIp4FromJson(Map json) => HetznerIp4( json['dns_ptr'] as String, ); +Map _$HetznerIp4ToJson(HetznerIp4 instance) => + { + 'blocked': instance.blocked, + 'dns_ptr': instance.reverseDns, + 'id': instance.id, + 'ip': instance.ip, + }; + HetznerServerTypeInfo _$HetznerServerTypeInfoFromJson( Map json) => HetznerServerTypeInfo( @@ -55,12 +81,27 @@ HetznerServerTypeInfo _$HetznerServerTypeInfoFromJson( .toList(), ); +Map _$HetznerServerTypeInfoToJson( + HetznerServerTypeInfo instance) => + { + 'cores': instance.cores, + 'memory': instance.memory, + 'disk': instance.disk, + 'prices': instance.prices, + }; + HetznerPriceInfo _$HetznerPriceInfoFromJson(Map json) => HetznerPriceInfo( HetznerPriceInfo.getPrice(json['price_hourly'] as Map), HetznerPriceInfo.getPrice(json['price_monthly'] as Map), ); +Map _$HetznerPriceInfoToJson(HetznerPriceInfo instance) => + { + 'price_hourly': instance.hourly, + 'price_monthly': instance.monthly, + }; + HetznerLocation _$HetznerLocationFromJson(Map json) => HetznerLocation( json['country'] as String, @@ -68,3 +109,11 @@ HetznerLocation _$HetznerLocationFromJson(Map json) => json['description'] as String, json['network_zone'] as String, ); + +Map _$HetznerLocationToJson(HetznerLocation instance) => + { + 'country': instance.country, + 'city': instance.city, + 'description': instance.description, + 'network_zone': instance.zone, + }; diff --git a/lib/logic/models/json/recovery_token_status.g.dart b/lib/logic/models/json/recovery_token_status.g.dart index cef9abbd..9fb6d6cd 100644 --- a/lib/logic/models/json/recovery_token_status.g.dart +++ b/lib/logic/models/json/recovery_token_status.g.dart @@ -17,3 +17,12 @@ RecoveryKeyStatus _$RecoveryKeyStatusFromJson(Map json) => : DateTime.parse(json['expiration'] as String), usesLeft: json['uses_left'] as int?, ); + +Map _$RecoveryKeyStatusToJson(RecoveryKeyStatus instance) => + { + 'exists': instance.exists, + 'date': instance.date?.toIso8601String(), + 'expiration': instance.expiration?.toIso8601String(), + 'uses_left': instance.usesLeft, + 'valid': instance.valid, + }; diff --git a/lib/ui/pages/more/info/info.dart b/lib/ui/pages/more/info/info.dart index d4c4863b..0860ca80 100644 --- a/lib/ui/pages/more/info/info.dart +++ b/lib/ui/pages/more/info/info.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:selfprivacy/config/brand_theme.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server.dart'; import 'package:selfprivacy/ui/components/brand_divider/brand_divider.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; @@ -23,9 +24,16 @@ class InfoPage extends StatelessWidget { const BrandDivider(), const SizedBox(height: 10), FutureBuilder( - future: _version(), + future: _packageVersion(), builder: (final context, final snapshot) => BrandText.body1( - 'more.about_app_page.text' + 'more.about_app_page.application_version_text' + .tr(args: [snapshot.data.toString()]), + ), + ), + FutureBuilder( + future: _apiVersion(), + builder: (final context, final snapshot) => BrandText.body1( + 'more.about_app_page.api_version_text' .tr(args: [snapshot.data.toString()]), ), ), @@ -34,7 +42,7 @@ class InfoPage extends StatelessWidget { ), ); - Future _version() async { + Future _packageVersion() async { String packageVersion = 'unknown'; try { final PackageInfo packageInfo = await PackageInfo.fromPlatform(); @@ -45,4 +53,15 @@ class InfoPage extends StatelessWidget { return packageVersion; } + + Future _apiVersion() async { + String apiVersion = 'unknown'; + try { + apiVersion = await ServerApi().getApiVersion() ?? apiVersion; + } catch (e) { + print(e); + } + + return apiVersion; + } } diff --git a/pubspec.lock b/pubspec.lock index cb308ae6..e40f6b5c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -29,13 +29,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.3.1" - asn1lib: - dependency: transitive - description: - name: asn1lib - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" async: dependency: transitive description: @@ -84,7 +77,7 @@ packages: name: build_config url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.1.0" build_daemon: dependency: transitive description: @@ -105,7 +98,7 @@ packages: name: build_runner url: "https://pub.dartlang.org" source: hosted - version: "2.1.11" + version: "2.2.0" build_runner_core: dependency: transitive description: @@ -175,14 +168,14 @@ packages: name: connectivity_plus url: "https://pub.dartlang.org" source: hosted - version: "2.3.5" + version: "2.1.0" connectivity_plus_linux: dependency: transitive description: name: connectivity_plus_linux url: "https://pub.dartlang.org" source: hosted - version: "1.3.1" + version: "1.1.0" connectivity_plus_macos: dependency: transitive description: @@ -203,7 +196,7 @@ packages: name: connectivity_plus_web url: "https://pub.dartlang.org" source: hosted - version: "1.2.2" + version: "1.2.3" connectivity_plus_windows: dependency: transitive description: @@ -246,13 +239,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.1" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.4" dart_style: dependency: transitive description: @@ -266,14 +252,14 @@ packages: name: dbus url: "https://pub.dartlang.org" source: hosted - version: "0.7.3" + version: "0.5.4" device_info_plus: dependency: "direct main" description: name: device_info_plus url: "https://pub.dartlang.org" source: hosted - version: "3.2.3" + version: "4.0.1" device_info_plus_linux: dependency: transitive description: @@ -308,7 +294,7 @@ packages: name: device_info_plus_windows url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "3.0.1" dio: dependency: "direct main" description: @@ -322,7 +308,7 @@ packages: name: dynamic_color url: "https://pub.dartlang.org" source: hosted - version: "1.2.2" + version: "1.4.0" easy_localization: dependency: "direct main" description: @@ -371,7 +357,7 @@ packages: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "1.2.1" + version: "2.0.1" file: dependency: transitive description: @@ -587,7 +573,7 @@ packages: name: graphql_codegen url: "https://pub.dartlang.org" source: hosted - version: "0.9.0" + version: "0.10.2" graphql_codegen_config: dependency: transitive description: @@ -622,7 +608,7 @@ packages: name: hive url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.2.3" hive_flutter: dependency: "direct main" description: @@ -636,7 +622,7 @@ packages: name: hive_generator url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.1.3" http: dependency: transitive description: @@ -699,14 +685,14 @@ packages: name: json_annotation url: "https://pub.dartlang.org" source: hosted - version: "4.5.0" + version: "4.6.0" json_serializable: dependency: "direct dev" description: name: json_serializable url: "https://pub.dartlang.org" source: hosted - version: "6.2.0" + version: "6.3.1" lints: dependency: transitive description: @@ -818,7 +804,7 @@ packages: name: nm url: "https://pub.dartlang.org" source: hosted - version: "0.5.0" + version: "0.3.0" node_preamble: dependency: transitive description: @@ -881,7 +867,7 @@ packages: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "2.1.6" + version: "2.1.7" path_provider_macos: dependency: transitive description: @@ -902,7 +888,14 @@ packages: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.6" + version: "2.1.0" + pedantic: + dependency: transitive + description: + name: pedantic + url: "https://pub.dartlang.org" + source: hosted + version: "1.11.1" petitparser: dependency: transitive description: @@ -973,13 +966,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.2.0" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "3.1.0" recase: dependency: transitive description: @@ -993,7 +979,7 @@ packages: name: rxdart url: "https://pub.dartlang.org" source: hosted - version: "0.27.4" + version: "0.27.5" share_plus: dependency: "direct main" description: @@ -1160,13 +1146,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.2" - ssh_key: - dependency: "direct main" - description: - name: ssh_key - url: "https://pub.dartlang.org" - source: hosted - version: "0.7.1" stack_trace: dependency: transitive description: @@ -1251,13 +1230,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.0" - tuple: - dependency: transitive - description: - name: tuple - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" typed_data: dependency: transitive description: @@ -1404,7 +1376,7 @@ packages: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.6.1" + version: "2.7.0" xdg_directories: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index f5367d99..114723f1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -12,10 +12,9 @@ dependencies: basic_utils: ^4.2.0 crypt: ^4.2.1 cubit_form: ^2.0.1 - cupertino_icons: ^1.0.4 - device_info_plus: ^3.2.3 + device_info_plus: ^4.0.1 dio: ^4.0.4 - dynamic_color: ^1.2.2 + dynamic_color: ^1.4.0 easy_localization: ^3.0.0 either_option: ^2.0.1-dev.1 equatable: ^2.0.3 @@ -28,14 +27,14 @@ dependencies: get_it: ^7.2.0 gql: ^0.13.1 graphql: ^5.1.1 - graphql_codegen: ^0.9.0 + graphql_codegen: ^0.10.2 graphql_flutter: ^5.1.0 gtk_theme_fl: ^0.0.1 - hive: ^2.0.5 + hive: ^2.2.3 hive_flutter: ^1.1.0 intl: ^0.17.0 ionicons: ^0.1.2 - json_annotation: ^4.4.0 + json_annotation: ^4.6.0 local_auth: ^2.0.2 modal_bottom_sheet: ^2.0.1 nanoid: ^1.0.0 @@ -44,7 +43,6 @@ dependencies: provider: ^6.0.2 pub_semver: ^2.1.1 share_plus: ^4.0.4 - ssh_key: ^0.7.1 system_theme: ^2.0.0 timezone: ^0.8.0 url_launcher: ^6.0.20 @@ -53,10 +51,10 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - build_runner: ^2.1.1 + build_runner: ^2.2.0 flutter_launcher_icons: ^0.9.2 - hive_generator: ^1.0.0 - json_serializable: ^6.1.4 + hive_generator: ^1.1.3 + json_serializable: ^6.3.1 flutter_lints: ^2.0.1 flutter_icons: diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 070eb3b5..1feb1b08 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -7,6 +7,7 @@ #include "generated_plugin_registrant.h" #include +#include #include #include #include @@ -14,6 +15,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { ConnectivityPlusWindowsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin")); + DynamicColorPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("DynamicColorPluginCApi")); FlutterSecureStorageWindowsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin")); SystemThemePluginRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index a26e37b0..fa5d72de 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -4,6 +4,7 @@ list(APPEND FLUTTER_PLUGIN_LIST connectivity_plus_windows + dynamic_color flutter_secure_storage_windows system_theme url_launcher_windows From c56a0f597680ba9fc83e9f9ad42e95bf3e6a645c Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 25 Jul 2022 19:08:46 +0300 Subject: [PATCH 016/115] Implement getApiTokens for graphql API map --- .../api_maps/graphql_maps/schema/server.dart | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/logic/api_maps/graphql_maps/schema/server.dart b/lib/logic/api_maps/graphql_maps/schema/server.dart index cc0a6c38..1ddf49f7 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server.dart +++ b/lib/logic/api_maps/graphql_maps/schema/server.dart @@ -1,8 +1,10 @@ import 'package:graphql/client.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/api_map.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/get_api_version.graphql.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; +import 'package:selfprivacy/logic/models/json/api_token.dart'; class ServerApi extends ApiMap { ServerApi({ @@ -24,10 +26,9 @@ class ServerApi extends ApiMap { Future getApiVersion() async { QueryResult response; - - final GraphQLClient client = await getClient(); String? apiVersion; + final GraphQLClient client = await getClient(); try { response = await client.query$GetApiVersionQuery(); apiVersion = response.data!['api']['version']; @@ -36,4 +37,21 @@ class ServerApi extends ApiMap { } return apiVersion; } + + Future> getApiTokens() async { + QueryResult response; + List tokens = []; + + try { + final GraphQLClient client = await getClient(); + response = await client.query$GetApiTokensQuery(); + tokens = response.data!['api']['devices'] + .map((final e) => ApiToken.fromJson(e)) + .toList(); + } catch (e) { + print(e); + } + + return tokens; + } } From 5305059a3a20d0ca84bfd33fb406b9f2d14fb2d9 Mon Sep 17 00:00:00 2001 From: def Date: Thu, 28 Jul 2022 13:41:17 +0200 Subject: [PATCH 017/115] update ru clownflare markdown --- assets/images/pics/myprofile.png | Bin 0 -> 21978 bytes assets/images/pics/permissions.png | Bin 0 -> 11506 bytes assets/markdown/how_cloudflare-ru.md | 7 +++++-- 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 assets/images/pics/myprofile.png create mode 100644 assets/images/pics/permissions.png diff --git a/assets/images/pics/myprofile.png b/assets/images/pics/myprofile.png new file mode 100644 index 0000000000000000000000000000000000000000..d1f1f3d0ed5e1782d5f8c97064c49297a5d21667 GIT binary patch literal 21978 zcmce;byQW|+b+BS1*Ann0YySukQPKlq`N~(x*McJ0Rbri0qO2;X;c~sk&qSv>5y*D z&F}r*G0r&Oe`lO?_TYJB=-zwHHRqkzb=@miK~5YOiwp}v5L`(K5hVmcbwCglN=#Jv z8>#-rN%-T2orI<%g5b4X{f836j7N?j_Yp~v=PIsA>(kB}D&wcfw#%ni%WtTz(Tbpu zvbPGeD<~2Xu#bv~jJ*{7p{o6)%=w`e&iD3fMC@v9crsGgL>0);ZyUUNwR+e&Jv)6& zNW<>?&->oJRPv>i&wh=L{Z9{d--}SA_oc^KR;O6AkRNYVCDNHFTsp)#> zCysw*{0h|-71{N_Uc<%3<>s#b{ri=&vNBcxAt50uGSmzA;7#a&S*UzS7a+3eVxBp1 zRAlto`<%b-Y@s_kBO?Rd)Y!seqS{hjOG`^tbws^X*Ui;+eX_PxUo-ick01jBCPKoh zZDwM^WAgpByu7@j;XL{nE|veFOW0`FeDEjtfl}o-9wvu;g)k>)=WpM>b&rtq+919) zH9Ude%!O<$M~mY5otY5K0AYFg0mr3&>tAL1n^Sc}SlP{*+1c4BzD-T%C;MwCY4C5j zdHBMZ>6Bub?uC7~lu=sy`&l18d`L(4PNT_w{#|{2eL%qVa(;t0OsoJ7xOI-E++6wq z;dlXTx9kta&mGuHmu0<^0ETMM~}nJ{f$X=Y3UG&*C%@`B{~gEjEwpD`TJY5 zm!rj6Z3pQu0!y^(qVn(qg!$m>tkGJiBh7y1$Zkwj8$P-%CMH&>R!kTy5+*VQ`cD8x@a=tY_KK{p#AF%dYA?=r=Myo2w=hqtvU};FOh_FcWjazh{+@|RY z5-gA6We^1wm21A-mZObsyJE7kxJZrlB#&{=N0+S`*#xfck&*qmZ-L+5;bP4h{|ogBO;6WFo(}wq`3$<&mSMR39cLrXZt%l&8@W zv}}6K*AQ!K>o-CQhBowaN%z&Rqkj3sZiuA42*hh6xpnInQdU#L%ES~UK^qVd(9_d{ z*sTsTQh)i=9+Lg@^!OOXHzXuvZ|=*NFGIb2e0*GFxX4V44_l-JnCS5EFcC3vFttLj zl#Gnk3e$amZwB1D8h&Tnp>B`5&8NT86_4Sk;@06-+T5$+AHGUi<>OXQo-~*aq!1Gk z5s<3s=;(CcX~aP{{OW(>^kAdGecuAs9el0j;)MC;_k!Ks-6u}V1V~m+&fkRvIP)-a zUMc!dJk|;I_56r{*GW}T5e_02aZh%gjNPCu{O*%K^YhqPSY3(+<6!*$!c=hdUMF1T zqMDj@Sy>Ash3aVNIC+=dSNpnQar7~pmoYm)U`{CaFGQ33Y$Ggm$p5fT;6hC>EJBI9?;b3&z|p)p8L zOGA*4F)_h{%*coIs{d%zCoM+Ic`kUEQT4^bYb!|Es@oZ!F)FCre99Px$!E&ARlhC?H7jW-A&-^-*XB z%dHNkzsOgy*l$8dM-LAVHz@zr(<2ogVGM4Bi-QA)@Ywt8s4tQC?%lg^Mi_V$8l^I4 z=jUU^TDe(SRS=uLf0udotOc&$Rru~I9NZ-e78&Yd$=Q^}3hRlmiY3=DCcwP*`t|El zy_Okp@2CgTFU#nbpG1B9C?cqSjmn=)9*@&3NN{cP<4}j`$Rl%ebLAYFm7(n3wXxE^ z@8AFSC5|a^KZjk3wp{0YbE9qQcdU|{8VMmGHDNG1E}7HvAeBK6D`cVJvxQq~TCv&L z#`gC1(qpKQw!V&iqJfOGvrDrFiRu{+8(Zn}vYEm7$ViOqBDL`BO~`81zT4Y&e~RB` ziH4BKrU+mv9Pe9qoYfH;&M;W(>0OD+K6HXvW~AWGS01CZgBmd z>&6McuV25CMW+khXJBA(-Tf>3>eX)uHe;oF5%|es zd7_X-^Xe8C7oYlEH1>34Wo3a8^%Mqu_&`8ON%=w|@EBX<7KiZe zb8&3CzoA~DJzl1dR_8wVH2^(Om6Vk9598F(!R9pcUA3kDWUWINx%+$3t!3{ODj}qu zY|o*Ue>W&kN=lMT=8yUK@frf23Q=?&uItB1$!#%QX*vMm;YE=Nyi84NEk+9djo5rz zUtj<5;X@pop7-%iK=0zviW5o5NVC@|curk?JxBa^_eDAa%)j5`cTe^$4Mu+bdi>~7 znUuEA&O&#wR_#o)mzIKpf~ID-NhL(Q-|Oov({=Rl!Km|7uv)PBn7BB-I)?`W0s;>o z$}$ku*i5_sZhZrxN=;R@xLk^nkx^e?zf`yBWM@&@+?+8$Sif8Yyl7*rG&M1i{5ZvA zPZ_Ekh03VS0z8VxAEdJJ$hd+q3)^No{8f>%>gosIm=L?iNhCK44a$#N-=O8nB@G1gkj!gWhyIIX;eLkLfd^d~7Ggp949IRi}OrV#83Nk?GY- zTtwv8__+0KvySMZPl^_6(@Q0#uXA=LeF-s9QNlJ5Smrw;C?VH+Ep*+41hr!LfUq0( zOD;t~GJNUQ&VODhPd!Ko2+GWV=D=^GO>e+5m17Ak1gRsJ!JigZKTy3uT7UeAoFcq= z^UKmMxw600Z8TpJx7b_}>f_ykXJC%H*&IWkwM!x*g5N>Z>58O*H8#H9cnRgx$~7=_>Nrjg z4)EA6YC4%uLb{&Z92^r>=FzdSvFYjhajZIUaZ&2XbvO|mT`kePc*w|-ha$l@Upcse z(Y5Ws#y_Tzi(z(C&C1P%vO8KkMuN7kuI}Hzf2!`#VBFiuclQ$TKKq=P7o?rcZuo9* zkO6^>ge;bbb9wXTP40dRx~%N%hcByw8c|$+WQamVRjiw_XSNH+n0=V=>63<*R%b^C zs*spi2ZSyQ56t1O0odKo4Uta*ZWT^(DkoD?E{^c}_Vuf_wszO=Vo2@Nn&Qu{niTF^ zD{DFY{QNvTJPRdI&T46D-aIS`YX1X)w8#5{zKzXhJg2D{+UYPLumSxFN)7e&^NUd}Vs5 zH&(Voy?KttX@+I8#9iQkWM11~zIca2WqSh`8$0^0nz12A{LIV@xVo(!URY#eqBN_e zx%r4|v}6o(GX-95N7>2mFK8}E#wDRLm}$H!lA}w$K{gALV~Xyk-MsH$XP39bn3;-l<$EvW1pBD|=8Td`LDYOdW^_y?U+xDxZhiv*0l0 zM+7c(lzmhJ0@~D(!%v&mG44!EOx%0wu5xcb>e&iCJ$S|NryQyKMKdT5$~9P^5pY1? zg0KmGGE;6SzQQ$h*8ts5-`e_Nrn^HDnXG{EA1L|2(I8(stEs8QTq`dx7ZemU?N9n5 zxF&!7>T2oDyB=#7_rKYOrKH@e(}p|(Z}g)0+(W);v8JV^p|L*Oq9-lQ3^{_14jrK- z?CuC7hccUaI^tu>OmJ%fpXAt)lk=Xl51)%7tSYceErV&VY& zfTR4YY~THWmR3S<$kD}xmxH4qrKqgzLsHQ25yqVwA}y`SmdlGoZLfcSL@zJS3$r4d z>uMmDaeQS;>_bQN^z`uY@iQ7yKYk=4BH}V1qUF#G#Jk(IY31!L7}skZNly%>0Ucc} zB!x=I6CB1^$HDaU^oAPe|8;4}S=D?f;@8%+=I8AoTfpH~R8|I$KtA$`&>xwZNohBT zRHuMIYGP~4_LTDg!r4$|K;g5&7Jg>tLO42qe}95PFjEQv*GG3kgU`A>tls+hH8nPN z8D2+y)6meMzyLkX@X$~KudVLJpipS$mTd;HY=;Y)n7;c+qUPVR4e{Dzduk7ODjrDcU{Z&k&s0VMN4j z9xIKXqop@wk{+}3^Cx)Heua7?MZitz>7D5AsdB@>&||3~h_j}B38G?akhvhEPfkwW zDg^iQhNX&$p*HXi5GXRmBl;70BQzkF-oU|W^trr%^EEUu2s$h-C@f4&OnmbAao71qF4XGJpFfX` zjD!|YT1Mu3cQ+#&Tdo2Fl=0B1L63E{8hg@n0fznhIJ|U986_pc@E?F@VPd@be*$Fv zFYuY{J+;}K?au=G%5iT2K=Z;*;3-0%=_@~;@AFkHzpV*tI>$+PboF=tCJy!E;^MC% zG|Yenr9M{a9|w*wu@fURIoo13Zc8g^ zYXCkRo$>ZlDiT)b(ptz5?eEVAI+JfW9*JsOOyeIuBju}-4~*bFBh&lO7hv%Pj*uCy z`l_zOfr;-c;E-}(UzlmypsXtyN`en_NL}e95g75=AF0&KX zKii{daW;6L6%`pJB$ul0RQx%L>8v*1*|V;&s695|Bi!z&T=8) zt;OThVCZmfTp@!G2!peGEtVgJ9Hl!a{QTiHJBNIcz?99~T`={k?2dy9IP2`v%(G`pTlS!;YeIrpnQEeO*)vvhD z;W9tBeVAJDAn(DI5qFcyvg*uC>&IJmkns-u+A^VZp^SKr2<0l~4`1GC<6(bw3p?IT zJ6)k@(uKWFT2+&sGftZBL!?+lv2I*ZkWu|hi#9PP)#tP%XhI~p63RO9VyCI^M`DBX zsZQrs+AmCLFkH{G)6yR8jx{rz@-Z{~cGmMJIMMBFCIl*W6=2l(by#hw4!sZS#%wSQlT8cTI5cIbFP&_AidF z(?%YRjwz|CeVpY3@N5`$VNmPAy`4dmQEZ!di5GwY`_62xn1l_~uzz~Lx9vBBU8`&L z)GS|uc60QL(`?T_TnXhvBiaXa=Ouz6C))@uFpB~q7%4Ev8RxC(^B;$_H3PQ9dF zAKEAO9>rKNegF5ZUjE*Ua`+MomA?XKrUY%2n8}yL8!mdiTqCOMLt@p^G zKYldQ{}DyQTv2E1MoOkC#KLLzQH`Y|O|FQ0K2+9;Ot38d>0wsZ9D}r(^pycV)|LDt|4zEqCV)>tWGWE2Djh1 z&`GQsJm;;@^<;?b%}(;2?R$v(kt{XBv%CBarYconSv}8kZ#}l&>L=Ge4a3kc%cf%5 zT=}P;!=o~UYhM?%Ij~7{M{02F{_Y&sZq8?|%rC&)W~x)s)eKwjzHrYlq3=YeRtcc^ zx;p&E-Pz}tZS=)Mp=EOM@6of|eMMj5q@{X9otOf$ceXC4xa8U?-!LA|hrD+czIFGn zr@CL=x4mE;)O4fc@!?8*2W;s8Yc0lycHE!XKdZ(}ZFZ94YLYHpYE8z!xR_ilV>D_oE`QVx3#73NGA@fh0qE#Uq`-70B z9e?>6r`UV%h=cXd1K8+k94oMx!+yP=VMWK*#zk6Ro$T_-ofLMEp$Xxs4_Zv@mN!)o zu-V8P89zEd{yO(gdP++=jv;eSZ^Rc}jZeLr`x>&>m{NMjGD(m6mk&*0kvr8W1Tn@|0SC7mt|7iiw0e^8NUQ+Hqd-jjOeG0^;A)QNOighK-gDr%k+q_4CjN zGpq-HuV#5hZbQHPb0uUaW0Xs-Y9_M7LK-|rMW%cEIS6lRb7>+Pwi_4MyIe`#kYp)7C+6Pj#8JPn}WEktC@;uF^h(@n*T$czNoB8h$%Y%e9X@IQbV-pJpZmJD=(J zs6I+B#Y40`BH0L~J0{j7OtpGQH=1M1+nV+@JgkvVQ+kKpr%^4!oPTjfT-J;DF3l=5 zaImoKo;8~Z>m@ghaXwqz?%Vr>f9t)|@Jh05;p`s{xr3X zmO?Vu5lchje#R&Lj16ypzJ9RezF(zKt95eVrX(2_j9Yy>$p8fr$^EE?^?=8ufSaz6 z=)JhL*H}Wa>z<3_cy^~J>#gAQxNNez?1nnBQsFbILT&!|X1dJO7_qKhPlNrPpJ&hS zYPNOJue_j3Ri}z=el-*#HXuhZaM7@f+++XJ1JRigOCmNot zq31PEG`@XuVu4ne%6tcxO3mZtSzKZ)Q}GA-Yl!pgAiB#nGpup{FM*f~s`R)2{Q(1CJ+PaI!u$$4A%% zV^4IBc9`m_(p2sfN%|Yy=YP?@NR23%44*Z*$!nM}>KPelu@Fix-(O?%u#YD|xKuB( zKeQb=O4j8`_1Jq=dCBLfVbTgmE{slo^{bpvmHeQpaRb3CG$^zhU?$YK!>C2Z@KlO{ zXGl%vJ40oq!rE@g$u}2KWeO)saB{_;=MSs78=IRaT345(#9qMpB57ZY6Jb%z! zN4o`Y^^nJjYt)2kh_UG+lx`@GSrO%aOV(e!q?pK^FPa-CrJ={WP6g|MwPp-Ik+ibC z7EdfGeD*2$%cOmFDYpF18q(p%{LdV)Lqiblr+w!xTOVu2Cly__G-zoKr zhhp@~#LmVAULN~yDBYR?G2MKgopMD?n%!ouUS8F2Mh0Tm-*u&BKA+tjH)$|UYzy7F zo4yk5LVq#za=Zg)Yya}cRZDGNu3~n0#?N2$o_j>qs`b7d@tKsp3{$C#hcn{3n_u;T zeu}GmSX=J~f+ZF3Pp>D4Uet+0HC>qzyy4V2ProEzTD_RnTII~ND!HDwyRLBb1FPyh zNj~I9{+J!wa{up3no8yGIARzS6T;EGUWuz6t-bxKlrF9QaNokdwle=cby(C#O;#`K zPYb_-tGCTw}yxd9WMMLWMuk2i2*LaPd2zcA+d?}K{%!XjEzA^wx1U|J?R zqCv(4vCf-=gZD2d{UZ^oQote!_^nt?!{w+S+x!K#XxUeXJp5PZ<@g8Z@>5$Q zul_=bzT#hGN$ALHC3XED_-Gyg=3yx7w0n3bQ>e8gLQN+{lA4RtUbBR~#Tt7h)~cyi zn=%6TGm-@z2b?O4zpPBY7_y$oI~g!b)S~_LdDkm9pw!T1ax?LV9ITV=ethq(gyl!) zbf07jUO(6xTz`GnOSezpXs%+5ZD?|-;kN6#+Hm)3(g4(24z!Zs-|S4VjmnDG9qF38KNorNucy zN+}&Y!-V{*RX@ZZn9$u|O)lkWWHqfu!Tl(x&OxR`-q~N2>G<%qUay8bQ$T^x%Bw7j z`tLnM+ld|*L>2;k0=I6bZ>e)WyLDuZHK4EheG^^wh8U(7DL`ooyDLLtiz#}!u_f1q z^KR&aD`?JXr4XEy&wYIGe@B1uzqGCY8>$a6JbmtMn||nO6QWb`G>9AMSt|eC@g6xR zm4v1(r5A0@nW#lrs66GIW3!UN^6Nv!OpSr?)4^>uUO^1FsoC(3cO&^8(cl%URs{}U zCo?MZdlJ$HctU2nvQ0QBn$FDjUL{J`>Ji87v?RDflc;}au%Ly)A@59_{pY{tUIfIuD77tviiB*82ZRcgPh8` z;F;MuMLk){>WLcM0dB1lFMXPE9BH4m?T^Ib!M=@-ndlG91$Ego@DTTe?3CaA$Y`VY18>m6ACi*_pa;t zX74aDy=n2&7whlkWVQr)0& z2Aaa-uoK%|Lb;dAOfEIUu?dTyxtP6_ac?wd#d(zzPF2tj(ytx z#OC~>xftVu&tz_{YF+rw$ba8Z6Q!O}L2pq-xiopqa3fYvo_K{1nf7vdZ$xhWA*yfp zH;-mXi4fVI50OW!&9ft_@o&hV;+H1NSly`qxAVI7?OXaMKI}jBnjz!%9KY4CJb$7| zmLqB<`MHKQwKuVr9TUmJ!b0qhzP_OLI^}U^K6p3!i9RxTm*SGDsn~&X)77ElaBG{C z{zdBh_9$~^`7o!dIe`o2xrzGa!xgRYnWBe*6+2Q(e5WU`t>bRiaUcIhFL?WPA-mI9 z1?`I9&QsK{uFS`Zqc5sp=Z-5)mkHCJRXj0`i@Sq}lx!`pq)m>iJaF*pd>3;>&C0!L z_;+FMDT+`;@urcj^Pa;w_1;%TzrA0pPGlq5sm@aT7|6Y*i%*eS%S#(#*-Q+~?6G~f z$(-f`gczuYPF>Fuy+6O8r}hfF*L>2-$f6_QjOi!G$!+9QU;V|>$oBg6oD(uZ z3`9KA?d9sH{_^A1i`&closDm!j5*&iF(?q-scP5tqij4;P-rVu=LRIAx=2iC$Z-#)bfWdTgNH`c}v<3aOnDKm!`n74-I~6YB(k(u_q?n>&eit}(r>|e(OCtoq zv~34TXMgHVCtu1(=S#4;R!Bde^U2}-$9xTx3wl~KslA1HL{jpC??a`uKkxt9ZMm$f z=0Nw=v>aGih#QXedxOUeZy~}A?n;R7y^g%lQJY=^$y#1Jw*|qcY~hBbu^%GhKfI*h z=5%r%KD2NYP-3{;|um*T>~G zIRyn#f2uv$5rR{y`JUuUo1OHZdEl`Q3bp(mi8aMlBfJ!Nq*(2!>1KV+mWHHvBXy!z z-3~S^N;0!+Hid4t2yf3hmc&fHysV5o)=uGw)*qHqzE7mnxX;AFlwbC_sD|R?SIy6# zYP0U^u^KFl%%xNCOLP;lv`(G=5*BpqA!h4dg)GD`e|utg#|YY9R77g8+}g>F$uG$W z-BZR`-AFMREvpFE^%nS%?Gf`vZQy3prhvyKU*)UIo*NDF;(3P}+e;~zHC&YTO})ya?ktZKzZ%CG%kf_rhzgq8wFzn-N>$r!B8n>(&2)2g>K6O zFM*mT<1U{#n_DJ*Zen8b;f_4nZF}i4T0|O2~mVtxLFDR&S+E`r@w+O)j zl?l*!(aC@J*T(vk@9f?EGQ%V+y9tyVunlWKOX)Vcepz%7rM?-_36i;KU;+T9Pfbpq z#&OmtHwXY?;aea+dAvMlt*GvZSl;+6TjKN_RTY(mjg92!Xf)*S-@i2C;apr?3wDn| z1_m+>ART}`ZFc=foh)Zt&%dy=bO~g8*g$UlBz36;@An>HRR!*qpMi$S4+9_7H#+(! zaKl;!Qp*j#`taq>2kV;Dc>Aj(marb9E_)XjJ>V8${Vkry4)Yzjyu7s!q+>-yLa8|3<1{Y~LKOpB*t9$hY75N1^IpA{EqOAQU|12&N-@RL$mbMMLiJfgg z?XOUL>&XMqzqQ2z_X9F7dRkh$#}v-a&W?_|Ap0Y5j#dOco!!ORF>tXtSy@1FJbl^( ze7T348whT0u5@!AgMa|Qe%*Sfd^lF=IM&`cHeN0+0iTOA5RUEc?0oO*i+iXw3KB&! za^~}n*0VEDgXiMnKo^VgkE=5)PrpIK2*39f3u$g{hP%C7#dyv`54yg`kB>ll23K)+ zcL$F8_I%6pD+SC;AkAq>Vp(;Vro%E77^Guag2Tf%XPO$y%h?eIMn)801qK`tKe(G4 z8$-%nbjX#7k4j0A%lyIe@F6hJz%Nq3eFO6b1TvbCmDM_I`jMxgef%yc8Q{x3kGAK4 zUjYsS7k~oN1AX=b{?l$6pjWnE4A_Ynuu1iH$Qd+8~ps)>`2gv-+kC##nJHv~M zCy0rOfslPbUGnxVs^1q0dHEK*xvxNfL{RVzmFPTK;dI+uR?LXIfyk!{o`X4chLP7g zuc;aI0(A}&)!QT_9j_j(YAi9WD#bI|OxKIH4F}(%k78FnfUQ~DYPkdr&67xZ;M#$7 z+uPea0rsY>CzI~&80?Smg9i^_(~wt2Mk-Hd@(K&V;G9PaRCVf|P!O_>+0r^t?i}px zO;s3615JkV3g}UIzX}ugqet7Y;bSE_Yd>%yb>9Ppl{kDB9bt`YFzF+se(FXCkstzCTYN4-3U-sc<>dK?K0f$bP?CUnO%Rw@ zgI+isa&5O^5s)|!`v>)tAYHc!i~7gM-M+lN4g`LAMFpsTYHg-b5lc%;Ao`J4k8ZaO z>Hz^|U_gzq=r$gK0ssXC1%yAK7mCyKPFKoDJ|rb+Yu$A2R%5k}OwY>lKZ^UbERwCn zYxT*#@Nb5+!)Bu+#KbY#(s3N|GS{zPcX4s~b1E(@{1tfcte^6rnH?Ri z0lO(FDQSxZ2^H>L{^7Q^wr}73ehvLT)m_z!Z)|J~z$R5wQ90Y`WdlWSR3~*^SHa2{0>|4Pipi_hwXvg4afihhIiELOP!Ch@+aB%R$ zOi59Z49f>cmm90At8H&HG7MtSx*y_R#46187#SPi#J=LvAH72C?dx?Z{d02Y>SVOd zW5?7fXvLjz3zL*2mV{C8KRGEFqH10L#Pv$yIf{7Xk3*JcndZCdYHB>ZyqDW^FVxgV zAt4oh*S{Go0_yC_nwr-xE^(WqAI63d-}UHN;E4?z>>i`Bf`V4q!UU?N|KV@8KNOy zzkSPoff;=J_?mA<2KCAY7+)Le9r48HUd;2Ws}}nDS%zQN$|&dA8iQi?YAWE5;T3HSqIj-7KcU%* z(rX=`WrF$;XVK*}eD~GXR_Sugk)Oa*2eo8@@27y07CfKwsXGw~36IZ(=N~a_Zfjf<>q~LKN<@q+HKCUe;a+?jNrKR0>pmAddNmN6J z1v3LfC>b{v;wmr$N(Yc$NYH|qothA|WFzMXDIJzV#(64C>?ofb8$BWP4i4g@di7d_ zMNe@A4WK+A(;$CUN|gQ%v_%&e7uck%o|hM178a`@k9*J**KV*eRi}I~H38}ms3$m> znR{nvFCkhPlz+M{n=I&6|L)y8koz?^dxPbHQUR1^%9@&2#T950ZqdtuVTaw}Gy&xt zWGDJ7jdfcLvpN(XoUhk4#;1Pw>6 zEfj*uphu62iUQ?3XfmG)2n1Eo65fEyZnn9pww5=sFX!h9L^%);o>{M5wubNz3Qjue=V2odt_48o z3@SJft(1aEkc5DCV}5ZF;whio^s%xFZsB)u(x4}4AaG?O3?@4O_an(Z5vfQb43Z11 z;crzc_($OHO>ulja%dp$1!lTf!36PQ>~l}L4wWnFpQ_;9$Wf9H{mIqPPhRr{eNl(; zTS8o?;gKx(ke?YbCG2KmhZMt*79pQGglj`p5CiY-sd_q_Rhotu))9C?eg6S z>OC_iUZzYp6v=N^L{rB6jkPphJGVYlvho_Iz^FGUPS>~mm zvvCVp^j?sLX}-V>=@E&zwS63WrGqfyLKuF(AydY4bLPr-rqJvtLC5s?@W^>X6!|qb zFECO}US6K(Kl{3khXXhIIrr#T(z+F=sZ8k~CGW|blPVvVQ%l*R`#bv`FFUKq-sQL) zeU@=vdujMXIP&wzZ`}F>rY+V>s@ek(E}SS1B57Huzji|1WjA-GA796Mbf>DX%_!fYQjzV}Ia;9T=)a7?k`9|Jp0?JtGH7MJUs%fn&2NkNN~1A;Qz z7l+k>H>v|vQzgBE0{lNtg*F<V`{9_DsDOHo zeS2ZWFjBp>2kZK%ElLYkw&PM-56=`0wx>V4&3lY}Qlce76RK9fF)S(fe5E7PWvk_+ z?I9!YkFg}4jKrmF8={`etnQ`QI+n+gS_)(pKP#i%3K#a?atGS9c*fx&=hl5ZedIkR zjB(pc6F9RLhUR5$m6r~e8*aV+ zcvE<}K@1H^|Ewtg#!lm3PM*wX`>6PJBXat9YwQb$dDV-Vc#^QXVRt@iJmlSB<&a7K zVBT2CnXN`KQP3#G83rQN!&D;Zih0StkoM!cl&2JQ{4QG+d<`|y^|Cz| z5z17O!L5pwbKZt=gFJt|Ql)#1a&B=^Yl9IXT*X%(Cr+bz+Ll)RHwb68(kuK&1(R=aPood#WZ7Fju ze4B=N$o4U6q()S+S5OZeLjr0L`49c3+8-v9F>K5O-U);9 zqfh+Rlg_y&y9Zr9+M|V_Aif{E9>Z6B>iKc+bIOz}AIIiEK3-b|R`dm*r)D3%II^(51b-kYMPE~?P% zako-M22BgW8}462482B6o@u+JdQ|PSS|bXo8Egqtwink<#nkQrYJv?u6NVK-{fftc z;upjN>o0mnxs0s0xG%mk!R(Qjhzl+^9cbzdF4H>IsV}e#9rTL^P<@9(g$=m*o>C&A zTINwVhE<7DQ<9$SL?}1(3pj0@hQ!2|q=%y;pZPTI>at7mGp9@7AXpz0PIvFI*1%7^ zTYKp(4xW204TAR#LJh^y?(UP_y3&yx{6KsqF`5ZJ?ZuY#j%AsUG)r|ovdJ!Y{_@CS zzVg?A;=dK!8PkM27Ttwu%{qW9Urw?_;vQ> z;gCuC2=bw0C6UmrO}k)`3fq;S?tay+p_P$t*Qmax$?cs&s&*M#Tn~JYzK%%0o%xvW)498Jm0jGxU ziK2oBuzS7G5y11J?tn}t9$Dn1KcDxrS%irs? z=jV^&9P8y{bZB_m3z(G;`&tE2PF7%S@DHeYxi?=ndmclbXEDVM5D_%S{h!z~84KSL zSP(*98f9^fo6aj+oeDe8*D57*QN^#qJf}5*Cf8=_vBCJ**x1xm5@swBR{P*!ndtxb zDOGFLS3^{#*C2P+2x6WqTq&JHLxYUb{nGRE$D!wLDOx_=)gI?AE=fQg>2fzr9`K#nM5Q`6Iv6PQ@Z14vI=Oh7A~$%jg_XW z>k*~TnLW$}O*goxOYVXU``N|Ox1T>9VOfaX@?biYYAhOMzhQnA5T*$zZDBAe_#+qD z28d`q1up^Af=(+qI2h(i@^te;ji9E3;#a_R`#0RIcoyD3VyaY(2~IQt?J6sK1hch( z+d(UiPsU{itAnAYo0!*z%p04UPWRV%T{g8524?0buo{?|dWUl-BQtaU&!0bk|H5Rf zIY$!+iEC?XVWGvv)*#KEpP#p6sjo4Dx5Hp;D9n9A9SI+V5s`f;hIbgOtv8^7CBJh= zHkqFoadL9f*3k(I4W*M!P|?(kPe?c!S%o>ayc3)>JogWp*QRzz@^OTpg=A&XmTOGa z?fR6e!#o~Z>cHjB;%uNVR=`)-x3!g(V%?^MUjPb{3Z~8$Yw_+70O|=y&DXC!sTJnd z=d;mD!y_ZX_l%sKWpWA&dlxTwT}5Z63)9mTy`bIQD})WASKMb8VliHRh5T3P~QxL=#LkOhKy|0GqSLNy89aPAp7#7 zQ;C5{@?j}i$wN&~PfsBsAz@)*Xmdau87u;&F10cM6FVPP3t_zWzpnf3=lk>9eA(z<+%&oy05RVTJcNv+czYx(sBh-kJH?vrFin;0vsvYlT5MYntv6?*Cl5%e~#cNLUU*h@GyU3xI`a zkR!Q7f{QO~7|jZOb2uI~J6sdalLIUh+LBd}iz_Ik<>nqv+P1(To~nF}LHql1!%iC* zGw%$)3(cR3s_HaMPT1I#Kwk&V3>dmLlcA9j%n4lS=|QnxV>>%DHdb3!W;b483;~kqtZV5;U4E0+HJ)ix`cLNXa9=C;x@`85hs26rF>Imu8OpTh1OekPu85vj8 zD7I6duR>N;6&DyTfGAf;MV;N;+wyXIY4zPTki=uaJS&9ep&_M}4S-X;{sU=72)}rd zoRmburb|Id$wre3vGJ+vc3Lp==|({>yPd0F_Dv;cb#3se~Qx(ev-a{;DI z1{19?tN?3`jf{M5Q@TO(7_j~_{cmvjr9Xch0CF~%2UOOiKWQ8gB&rwhuBM4tNYwdi z7wG#J9e@OYTq_<3HfmrD`=g!orIfbcrb%5IHbyMGM|V0M<*7qGm&-VE%2e)` zRuDwR0R&9fcL`Y&rs80FtmayKdprC}Dd>rL79J-#a@^k9QVT9X`A5=J@$RdWw^vg+cN5_JGHBT_31m7zsWM5gWiaV13{pA>hEb z!z370I4%|z8Lv%}2sI31)Rve3J2(iBh*)x{8(HInffJyhBxwop0)N7Rf$r|ihyd$6TLKi(CrBDF*|@HgM$jx_F=hi2bLy( z{raBrH1XRU=C!wwItLQC3#EdoBfFqfg1K3P^3M>D<>MS@9fKo|jREiEeg-qmI2>4LN!=o1x3Ry_wzQ+hF{AC?S+s$WP13p4^}W)y9K}&Kx<0yU=kqZ zz_NND(+Ay8oneZjrzm5p`9LqjH~iGDIlx2yH8V*jamd_E^xem^)Qbv-!v7H^vdS~W z{Q(jDpc%CE!6I#|P&akm5L7j3!@0u&Q{)R!i6PrZ{|w&<{a#)^f~i(O`)7SFlclm@ zkQy8jo{b{SaF%*0?uU+R@aXpC*)D$MvxrVdC#S0rpsznyW&RU}%x>d!Kve^lAgkS1 zd^128#TTel7^E~eGgBESr=(0xN`m?n2eIO5fY1os=E4kAg0~*RIN@g?r{KEqc#<^- z2P1V3US5~}BtEDD9UL9eknvoDp)5%&o3R-0v+3!($lm^ba7Pcr)k9bqh~5PRz|37jLIOGlMlCRnFyF1sItJ8+TrTXNz4qu`M!5OT95qobmu;aM1#0_wOIS0@6F19?nYQ4t6Xc23SU!1*I1Z^Ec< zc{$a)TdTU81Hp80+EcZ(63FJUvr+z8;#@4VIYRJw78Q|kCf+)BcG4hz;vg-YrPtX( z)K*GxbhqC7-{{(2k}!JmM6+z+gP-q0?^#VA(b-A&z-Y;PTwQBxo57!JHXWsH9Px@4}3k`f@@Soru`Kw)WUe1Zo*_?Y)H+04GHq&B)BW zw79skwic~r#x;?rmO7j(Zbb9NdmBrsDw1doeAK?1+!UzqA7IMob6 zP5}a&-9lCYs_1|Js7j9AJUn0yJ2LM^j8ySycYbkHTir{Tk53)oeROnqX=t7M_VN28 zQUnIIG+0V>)!=+2BrsD4Fd%!p1^7};Qb9u_55`JI_23B~uj}Bk5#Sg2SXc>sjyZ4N zeucGpL#VnZg^;fXm zl_e!tE+-le%X0dk;QijB!VC_&_FUwjsTC1F(kw0>1s)}f|Vn&O7x_Y)(SbyK|I1@o@Lb3Z_@DNS|uxvn5yTx#T783*1M23FxkN=%$A;1)%|0qvu*GL)WQ1xwTjg(0(KE{RJV@PUB`6@CMg09=X=3Da*?3|orph)nC36f8rKEXDE7ygf0t~?ydwGY3_ z&=4kMOFDCGHO{dl97%PE(3z2rk#fjUL^8x7JJ~|0In;zAI;QN~Sf|OJtV3#KYzZ?{ zS+Yj9^XvPrb6wx{UDx;L_s{(Cyvw}r^E~hK+`r#_|86zOcz{e9w-RWK2v`F_3C4Q#qd*!aJrgFV=Y|FfR z-Rt~l+Pb=Bnp~6U0Bdf@O8mm9?E@-JFJsd-=lOq?@T1Nm_9Fn$fj;{(5>yPHG`YFv zD#?=*6R?Yhu?o%&2SRiNcox6_9*mB_4dRzuP(lwau4z=a!$29Rs~2%GEEWrje$i+& z5M&oQt?KIPP~r=#`<04X2E)+6U=Y>}2;rIB1^**1IYrjEE+#X~Wdk-aC?$mceX-Rt z>Aij1wu~At^F81mQ}Y|4k5>78Dk)h7FN8(|p*-*`p!`hk6t{>+^zqTAbO0L3aRW1n z4yc1Pq`U= zuU`X8Ts^2CmqExpI?QJ0oyi5RN6)!kQpJYuXH_NS8x+KQW=WHMS>41ZT>7;|EK!(i zyYz(HsBd#&z2~PprBp(h;qvMz$-d*uBnSdT zW;c-Cpl-3J*yHi|zP`SWjt=NmsI(`IJgfP=DaPR>T3DFw!zH-7?q9gmF$pXs58Sul zKEOV;jzjcx3u9zu4G|}SkOUwB^dAuDuyuUiaDWtnFJPE(6}AORO3G^%>&jaGQGOH( z2Eb#W%*2jt3B|&X_v4^+b&H;@3djngRjFH%5fQ-7_)WdFA`&ZLL4LCKd3AkaVgeux z6Z#wCfJ299<>kq)Vd!S3QXqK%{DBfcT0vn3v@ep9&6D2WUZlO9!_3?#EBk@NsRToa z=kDo{{D9#P2@d}2%z^U5Uq9HtE-df%6dPWS(+x?W1F4#!@xDa+Gtu%=?{$=3t;XJj zpZpEpJATo*htiXTw(YW?Mj}p_R7oRkn z3L37ZSJtz2Z@=rIt(Cda$1W{HjM1mPuAzC)XJr=G;`4$Sy1Ir}u-)z?>k)T1B0Ioi zcy7+*uElWCRIpE9Z-Ck+oXut%#4gB9aI=?NoSbJP!z^iWM=gs1e4oBs6F%nl-M&;wklOgx3 zIeHIiSC*EU4~+d-L!RrKwTliRzrKpWh_<>aF_l7n>pu*=BAj=2_vkgxCj_4hwp*@m zYgk^+dDxw-y2yU3)BL4BM{Li&)?!i3gW12}6ZDD~8G(g)rK@cc1Jy&9AH3o1dhx)K zDO;AgX9qUKQ{){A9Fe~1lK{c{6v{+29Dm#^Q_Jrt>%On#1FLKUe*;R5m}2c=DHV&o zc)evm8?xuK(1Smg9iBCg&tAS1Vz+ks=e{fHHR-F_iNU?5(ECYpZs+ZaORCDh&XjkF zpL^Kf&X8bKO}DRG6tdtEE9TZjx@>~AlXqDX0usyR@H=X@KDT9urE6KLuY3JuimOOF zK)qea$FqYd-puS}f~+=B=ps-=RZ=PrN`ua5@qnt1d{a{;Rn~z;v10*B_oS7XUe`1g zqkh{@zIEB%o=c6?l5$ZeNPL>St(sImk(T7Tz80#em}j?dEG16$%vo`xqS3r_C7a_E zm4rA9ed(%XkZ|gz#EbdK_y)hgaIOo9 z^o`#)KFc?C@%PHwYd40UL@!|26yZ0p-mo{o%b=w9YHh;N;K`3 z9+1Yyu9mufDU5hR5}dpAN&aK-khM{4cC-U+?cUAumg7fhIGJM{O9RU6+G4T!&AKy3 zNEI?I>6>N4sf_&8I8J}+9;d!;{NeyCpqKRr!%}2Scf%KJv%EvNTYB!;K`qD)t>K(y~=mS_x@o>mHO5{UZ<*5DVdC~MRTTrL{-; zt;ocXM)>A;HhkgsKeXcNd*+>-DnMaVU44J`ux`k0l;$5+lFFDJkg@a8Xu}F!cII1D z)6+Yvk_<=>{EuX7rNSEs-;+UX*w11CT$8Jn+B>!;h%ACm=NFY^h`dBog?jcufb-2B zqzzbn=a?dsld(j^5T~vVMtQn_>_&_es;aJoO<7ic&n~Ck$8Uq^Mbi@H?*LbU4kD(= z=wIhI$|)nmJBKd{mV()3y<9U6oGslk`S4rta{;(rmI(ak0j~ukq$xHr@kbo)2?uB03V0pIG{8i)~PYxg5O(NZDJOU;l2AQB;U09pkPHm$8^5;?8` zZ)7Y$>G+lkcW@Z7^JF+XIXUsXkw?<8#PEjbrZJ3>HE#F9X?4o=jl8TZEPxT%X$%cF zKKLOrN8sv6;Y=oX&L3hYuvo0JvPsyW;7X2MZL26@+xGt+l>a$ea3Ju6RZ7+=MCQ+!nNpap zJ&NE|MmF1NkE+KglFj(H-S}sAocP|VA0NW^D06;c0lb9%X^t|=ii|V{a|=!ZvVkR= z9XxnYUS1wrv)p@k&7gNSr9GcTcS1g14X|5oZo`;Bk6?T@+}BJ=t~S*IldsvyxNnOJ zAKR{agAYM$zkM=@qlnXP1PRxHIfEc9m>U0&16^TAsF7Bu?TQ>f{0m}kLO4-m=pZ)B;f3ct7N6IoJL^MQrcz7govQnyecxRpA z@prF~x z-nG2-ci_mKHqqlBoh-d-qc7bv(Rh#8O6Qv=QuRh!%%bQx^pTB;6wi_44 z`K3P6*4EzL9<^T?`fS?x>dO8Q>fys?1)iEGyDqTWsLf=Qhj?;KObnXu#*G{7?6?H` z+HN&8$;FGjZI$q0@-L4&`^Uz-zdSp$vpk;8IyyR9WI%Y@OutLZ2x-lwG0d2Gyn`SRuG&!75Lu7bkCJchO6@EtdA{{9xh+^3tH z<@&v?ZNhW00AAFcF4L7PaWI$Sm&v20ztbAYmg2oGCnePgFJ)7Tk4i}3h-}T)F*Y{F z$H%X7U7``T8-oQQc7OU4kTU!jgl+7)&W!ruJl9Fj#>R#_p%-)gGg)`yPb#^)T(vUW znUoM2xv^9>sfuau=pbd39Lv)xDzzR&SD-EjojzY#UQQ?CaD$cA{9t=YA%>e?!gI6U zpFrjf-QHl`@z$?~pju6_^GNfswt^Wn8%x*k_ zS>`>Dq3@re&m|=#FJ8Rh(!)N&h|nn;8>gzXkJotZWTp6eZsGbNBHcER>k2O7;bpdb zXw|qyJ~KV7uBFw|*hq$CK=^w9{PMi9v2k_P;px-4Z{PlobnX6Y-PjKE?=$P+h+`1} zfvARGWXQzCMDxzX;VhMuVa(I3$i$>1HkITt_-{Z!06gmJ>&v!VWIWlGadO%ycbpm< zKfUHU63YBee66jmZD(>9UpM`ROL)?o|Mu-~t*v)BIc-KtETyHTZEbD)&T49E=H%q? z)NH;hDzbm{=*QOLpd~hYMH7lZEq!MN#lgYhi2L;J^dU|?$d*8qR zEGuj7*_m?|ZT%+izt2oeOtig=G4$18j~*Bp*j|}TA>(`UjckTfOiT>-0K+YK4)4px z7cwnk`=L+I_b1`y{r%BRCXXX;M!X_hhpf*lNK-6yb#=|15oZYB56b<^RyFleHn)wj z@!Cv`;q1)J_3PJd$1D3gI=BP{U4AzPkF;qF+S=K%1`Lgiuq$MrFd}>vm2`D=*`I#a z=Ctaq>^sf0a}Q8l;_jS%u%fE#^$Cvm)5Mh8O<^c0YMOyCpW76Q)Z_5WUUXQ z&*o$JB_SbE8qJ|q^7%7Ufb1=DGdVT2$l_{ZJ@5B5&|2(TV%;og1T5ZGRO~H{mhGK% zw1+;=4nY3OP>9Js!9QF7`Z|XQU1vvvaA|a2p%{Gi*%1=#C zCn@pp<_$vQPz41AQ&Urjlfw=Er=72)(h$eH%z}b~%*_4~ZSZ7QR8$ny%>?9QXOftQ zheyC$Edvi}y$W0<#Om?m$4~=ee#h0aw?sYGpFDotO>19WZ;q+@B>m8p01vP7N=*ty zW|_k;BrR=%Qi9NUo!@EbCnphtg3%H2M~8=ee0-PbL{=BFQi_NF93LI{t+%qBeSZH2 znFXhop3g#0hLDgD6ri1jg@cPr68}?WRaMnN?6+^rczE}Pzp7SUCWO|L99aJAO!Dh< z|D)Y_GXbTir-wNBgPEV7f1Lgh|H1`UR@P)um)GVV!BW2=e>F5R2DAI#TH4xfZEe*!PQBEA5+A^XCtbR{T~*a7oRp>M|y7EA)|RlhdAS zznh>XKR-u+7NLW!+1=fR!mc}<;R&_RE-qdl=HTV$r@d?REHDsX?fN!VE?0V;hV#?? z8q@tNGzxC^)Xj!043gfr$q2PMH3v0U1YTx|l2>`H#9jl;@jcq7m-OBpD9~$r2Z@6j zwn56exNIHnZ8S7AoVMt=xH}QDeFOd2FOa5_9&<_1)>l_o3-rp`X4dhEDGrYhRyec@ zQ5f^EH_?d*KVJwZ6BAQwYpaWki+bvMD1lO7baeDe?ZNWy+7z2&>?ilN-(EY*SC9-6 zp3|@qC=?wHjqamIA1b|DbViWu92^RYikB{5zDz=*U+eARK?M_b5%(a74+HPY-!<8v9uTqc&EE!k&g;% z#`X``2`tIUDJvgON2)|cLRU~wR`z{QSgMijC>Us4Wx)iCtXQm!lI(_`zOs|v}ewofua`R5vx1i zw}y(pfB#E+9DlTgGXJOkZE3xZ&4bwZc+aJgQVFl^_E_F@;)Bt(=-lGscUBvN23}!S z8_J{xwxuqjcJ`CC^b8CJC{(`fj^&%RxfjTk<;l8~ckg~rOYc7q4#r8Qz#~jjXJ! z1ng$KhlY2D(u-}6RXADcWevB@cc&8*6JIB40?Lw>mIj-nQKqbB?C!q%hF)xBbQEeZ zhEr#KK+pd1416*m&R~%t;Hp(#c4rTTs+X6Sx_V!-gx56M!_;)DFGtPE$;lF_Asu)G z=q@BED3{T*xw%eL~?tPidB$uJe$e2QkI9vs0v9mJC2y~#tve(Mm8ouc?IrH;5 z``_Q;;UOg?EO%Q;My6&L7QP7%&dJT~(as);rlAcRflsdGAP*iH8KL0P6>wWd1tL>F z3zh0?Zok2{X>^wqG`ptroRXa2t86d){WDZ^kg0FK&qPE-O#1AMW2CY_BW*c|0+Dbd zBO|(2gJXHskODWk(+(H?5PFj`WH6-3}bfw4EL5EX@vb%&;e0I zmfkz6KPZ{f)X~$|A8!o4niFGaTcyH($+Nnd;O3Dp+Qrp%qSD3M(Qyqv@d@8Bu0L<; z_wVKLDz}-o>#2`o-@W^4j`0vTK%>`TGtKzo(9*WVs9J9wPKvI0!S7>Z)ov>jP+VcJ zU-w{L;^krgOifG(nU%+1Y>jU!@XwKX*d`ue1jdgA!Z zUIW{#sj0!STVYB9pO~AwPJfH|`0*A+NYmT~U`KX%Xk}3R+qXtfpSH}PuacA7jaP2{ ztUqTv+C#MjbqZyWl$3O^wJ2=f9xLgyf68xnce88sUC`)vtxuYonxL%DKL7b6^}*4> z&Y<>?W%`{4S7+yG2a)H`pZCq7_eY%nTFydEIH-QjcmdW~5s?jqvWbyQ=Oi~hSfQX35d^s~vp{}`vgaoz78qcjXB17*r zY2>S_sw(XDXo&yx@^W%Yir?<4agMq?p{0d|`&Pf!MW)Ii+@C-Bm7&_416VG0n^KEt z0!sluFYAwogyvu5au z#*{A>hAMJJm*%hk`V<$)*YP&7=b_lE1qfzS4k9EE1UGytMfeqXtgkKMWImH zNV9NKs=Lq3jq-Y2^LhDV#e6&-XLtwC56y<2e^A;3OzNYm<;q0Of?JAih%eQq(M#Dv z`R(m(AVmM*BQxlVr(MY!i@GzE*GDKE&}j0ICY5CI?wJD*+vwH3LtwVpvNAQfyxLlW zmR-ojCKE?JJzBxp03_4nd#t4-YW)CDmCg&Q0Qt2(2ibWw1Nk}+eAIg+)FWgCfV?4J zX>+m$Y~uPAMzOkjdJE|p!WKV1^yg_^MY6NAPxzhqxVi1zQOk7Z1bEAQpJgvFE}ZHp zr_Vk(fQ@>y^w3Z_4tN9u}b2g1c-Y|$|SH#AgFhpW)&q<>dZUhPqX;PhreJiHhIKINJ#oVT7~ys zve6i^T6SjCaM_!Yc2mU1*bMXKsKc^)0KP^#I>L@KW-BsUdcVT9goTE-cXbtkLIBNR zVIkr?|D(cbt~s1>WocVYvdjVvi$DrE#uYMPZcK7nSiXR>i3$vot+&Z*2j<2JsAppXNnZEqoDb=gfo_vmH8bkmBCgo zL$tHP#_%B^!NI|O5wo+i=4NIY1&$ z=c%Mfc2T7^6O|Txo7>>x;>wv+P}k5%lJwElQ*a$QOB2o-7I^7Gx=oz2SfzE)D5%ts z*RQV;1qKBLL9SF)9e`@QPDLeK!sv6&ESyo?{Vi@ynOS`~1RL){-QHDRM`M^HV6yrR z2MDOHt`71kO*#a!WNS^e_uM>hMP*f$A8^IFu9OrYBJlChy8%S8#tknWrs>DGGh0m*F+rH+h@ z+v1x3oSJCKHK8W7O3OZg#Q}ZErN2U zd>st(!2{4jD!DCUVUH?!Myv+R?joj+t-LdOUac`(x4vWHq*yHSJF=!Uu$t{i*eT&j z9>1)R`iM&Gf;%gD@U7do=SS`9GAhK+i1rNFiDKt?>JHx}C;J}mI?f3H?s~OGbmoh8 zBMGU4{V#^I_U|em>Q!}@Wy#(e0T~V^ORM_LC)G&2yWF?5o@HU6E`YhGJ_u4p917RN zJLesAsX!RYiEx47{38B;aHC=;?8giZ3=DL2+Zsu^B)sjaLR=c`7mUv1vny>mJ#w9ZBONKq&3=r3IK7)J1xkfmCgHgIBvOYy2@I=TJ8nGomwOc!wzXsg z?uAtd{Xg_?0NFo9v013mbL#r~dUaoogF{_#GoZP>e?P#x5Kn08i#GeL-IjIr+swLj z2nGK6^I&CB@qV1E2Q-8(p6aM6B_(BIl4ei_joJ>@Wo9-5HsR8et+jPRT%5ySqCXl8>MN0TOxk+_^0phWQ5$4tJTPwl?w>o@$zmP3KyHrwQ;iUhRP? z{#aa$-k9wG6A#`(3(M8jg)Gnmc?04F?8b7ZxlSk$KxXi9E>rUbkg4kH!=m+dbXtEo z0KP~bu0CiG*UBE1Q&hYbELC^79-_Oq`m15Yb-GStzb zCMQoTEBE{miAX#?4(g?O8W>KTbhq<^@C(h3q5!hquKY$RZVQmdqnM{%kgU;Jof)c@ zR#v&;;a$MzK@?k=n`2Fyh>)-1;;5NEe){A9Y85EYb;9#0KHJo#hmbP_m+9OOch}O= zZhqFT_C4}sUXBP>kdsTD=;ZKlcmMeDBb6jM7_E?X5ECmf)o!t{TnzlmEb}ItD=s;C zd48UXkr7nnGz9B?R8&c6DYdx4jmD_v@SeSmxh&-*8glY?iHZ4i%5A-0i77aDL3DyS zP+{Id!+c@5Mv;n=rtpqGjU+}jYA&cs+MFfxEed#+r{{jP#|A)tRA3B`p`DG5qO!6O zKR@QvCs{>BP7V%hE333w)?2qkL`BgeiC@0l$K9_)&%AzgTTxEV7&8n&cJJOE=v2PA zc9E(l>+a$P^72ICExjU^?ofAaCm!MxkY|u};DcmWhGH-qV0Zu$&b7xeN49Df8PHQw zLc&P+6A(AkA@r~|j}JPxK(LVqKN&7IyLj>9)6PVlDpy;m?3PlH>5xh}JM$mX-|Y2k z$3@>HBUIcNVF?ROLBU$@IsE(*5OBU986n#^w-H@b@i#x$V7tg3`U#N&e}SCog*B2fnA6B6$RNH-Js6sW}4wgO-M7lkSFvS=8DC zeX=Y~@P|RNw3uUZtRDX%oWsc zUwaLl<({Z0IJm7d=p6O6NJzT5G{)YUaLpu6gJe-p`P0f?uLjt)r1xVShg`vO8H0K7Os>jA9oXm%?I?}rZ`&d$vZ4i1(< zqZJSU6L21c8YmCpC#xTtSEpo{B~wnI#J9Iyt%_@FC(740#jl1Q#R) z*~sHXRDkgWC$ZPfW6`U2(E3xPX8d}mpFXHeMfTEA60(CliLZf>=%C)U%?QbvT zt?7y0r4PDH-{Zp_-f{r$NmS%1|LAi0>2b>Y!Pm}vA4+!*-SUPWUvXZLU1?P!-*{AFbfR&tmHA4ih_KgVBx z&+h2{Ox5Bl0>9Vuif8h&R43T*-q>z>lJjM~6%gfIGP=OGuq@6z{6r1`sK!Uy* z%~StmQub6Vgf(ZWSo;oeJIlZrCbL3@{C~Z$eQtw<`jW)C^9=^2R?*41u1-!@gQZwl zSg=^Eva+)02ocqNn7jP-*I$6SEuqxuw$#qT7XH9{7J8ac+%cYHAx!6bztz|OH5sn_ z4qNgGWQ9T51IXaE=Qn|BU6{&h@yg|XFMG@6b9qKa6W;S2 z4wP z2Rz(YDg>cbR9FbMEbMOI;>-I*AZnFUBz@*OlfWwL;e5G#A?%c>(N}5Tz6O&38cudW zqQJC_(@UB?T2xGI(aXuRy3E1DV-IASnyRWp){o`R)>caxU_!JgC@6q7(8T=Z<}XBr zkVxh}rM1v3pP%cMWsla?)^?~sN!X=jNQX~Wynp}x<;$12BHz28e*E~+)1zwZ)IENm z6oQhzV)9wr=5*g~P)V>3f<>1&u^=ZdApx|qv_snMoJ42}LwIdS*t$fX&;@sqaE3?@ zZn=36i~VckBuS@KxKaT@b3^&R57`$fn0)r~7~QN(S|U6hBP&J#7%3?gip^+|2|WLbUXJ&&C%6W8CrTYb|04qcI?x90xC*6Iz_^TSVQ<|004jiQC9t{@VRX!pQBXR zz}F0+;36U$)Kb7_2BalkMrp=d-uTb14 z8(jztFdo2X3}&nH@!djz!A*V+UOTi#DLDJkVC^QVbu1JvNx)n^_Vg@(j;fAM1z4(j zWp>b#N$5odxVSnxItoB>0^0)+fcEIrSpYwv(PRyn zSy;IYD>q1`hK2{FjSUUV@bIpljGLPq++=Qc!Vruc|93-{Y%|CN@~c<<{ry2E0S_vy z-kkx?rk14)b9)#;6z1jed#|$EeJ%gtphVrb8W&9tyX$i@!o|nI8#v8Q5z^b+3q#->casxnQ$!y5bOWLCkIW5($YJW_V=6zIA53 zy}kYI+qW>3ymtM%hNh4ScHu>Avz%!vW=c%N}rC)F{!A=oefx_6i1e6FE9Pl>cEkt-r0-ssi3w+{lesz;3 zm|<8Ra5#tvK;!9gg>`SqNpQF-E91$~d+Rd*_&5$f&;oLitV!Y?J$I{q)I7?G5=GdI zwdWotM>|LMetoE12!LD!GTMFhhKq?z>+mo*=w+p)k9o@bx&r@7I(!I{JNsreRiggpFekZcD@1c zl~_zfgvy4plHLp{7}ze)(pOR<(A!ni>}^}=IQ7uZZn@a(I|ND!<{4Bll21=JH84m9 zc#+S5QE>Xhu(S%3COGHO-MtpVQ~S0Rj60jtLlN&ed8ccg)&6EtS6&WNR94OLPVc6E z8n)q%`96aN>;C4=o0{Xj0&C+v^1zmAU|fdL0(2IhX^r$yKh1jE7{&t30hAUruP z7nxv8`f@D9?&*uq2n+~Z7$z&l$>X0r6K!a@%wz1_tXO!;7Obto5g^{T2YNHN<_^3G zhG2^@bOL1vgbG^BKY0__Jz=k25t5REBkT!^r{49v^Yi5k=3J=qRhV=`&tVyvvLcx7fm1wDDIv0b=^v5 zO8`F@BlYz5@)%TupFs^Vq@$}gs(%5+ppmDUB#wK(78k~YSweqsF=RtESE-yI+ zXEK7uZaB7oFI?jwt5B3rR232|}2{LNDXM_L-c<7oKbF&D@E zgY_#Osbh~R8k{+VkM0J>HC0U1XTPMbuI@kjJSknmPwsABBD>_(pR3`S3y!nWE%NB7 zC^(oQdhgzXC5I6n9Nqx>3{XVRZyt*M55|&H1q#HYHi=Y zLnc8!ZPhUSxJnT+^Xu2Il@*oo#YBcm+P+f?qtf35;~FT_k`k(acgeit+3a|w$5!vJ zoI?1|iko)s&r*H^Y5IRS8paxr%CgTjQj)0KIPlsG>6mn}{zhP?B1Q~nAc`)Xm6Q`4~=Z-R=C+s*x2$;EeVGkSUG(9^`yi7&Yiw!vYwGl?KKyrV-Mq+ z@{aNP-(mOX@&^t1<~|WJ)tE<{*DkL$XgJDM>`pKstQo}eKDe&L?N^1V?2Dk)n7#b& zR+LSQT!7;vXCeb2-EyyNie&0ffOEoLXDb@F5{mW)r`NJ*(!`-!_> zg7Q7$hw4U?)>>r@ zCy(bBN87%xk9Jfz?d$2r%IS_=WEvPdsb>0AcC2+MfDtYJeZ2U9D@2-*Nt43-B>Bk| z3XoAWpRRpj@LcarDOCAc0i8j=qt76H|bIj*n2)Kk^R*J;p6?7Q73}i%c_u9ewLdX!Nh}puQ6UOr?>wp|z9H;#WpE?qxaiz>8!1zMDcROAY=2>T=$? za!6!S1&(nvR2n*phgmtP_E}1URkBL_+C90Ufx=f?Zt5K2qz<0eiyg2;1N7`0nkNYw zk4C$q=S=KtGs-((Y!nF-z}I}Ke;IiVSGll?2&#RuG}<-$$7QYXomWVj;q<3|wafyR zgBrpeNMN4L;#I~cZYqb<>E{GHU1vR3NO9`}XYf8$@jpS&5TVKii2q19A%1+HXfim; zYnzX#nV5KZ`S3RC+R@iRM$gV+-FuE(f?n30ketE~P#b>asv+I&xEEt(2cvqQCnsDt ze0w7$mB+$=?{g-M$V|OUFyFzH{pK9ncslN{DWkWsHgV{}kFP($jfc01#~Fz0l7(LO xbNCf4L+lT?Qwb_@?q4eNe+fhX(+6=6{37DkT0+w!-@y&y$w@0q6(WsZ{2L>#jl=)| literal 0 HcmV?d00001 diff --git a/assets/markdown/how_cloudflare-ru.md b/assets/markdown/how_cloudflare-ru.md index 7da91f77..895f2356 100644 --- a/assets/markdown/how_cloudflare-ru.md +++ b/assets/markdown/how_cloudflare-ru.md @@ -1,11 +1,14 @@ ### Как получить Cloudflare API Token 1. Переходим по [ссылке](https://dash.cloudflare.com/) и авторизуемся в ранее созданном аккаунте. https://dash.cloudflare.com/ -В правом углу кликаем на иконку профиля (человечек в кружочке). Для мобильной версии сайта, в верхнем левом углу, нажимаем кнопку **Меню** (три горизонтальных полоски), в выпавшем меню, ищем пункт **My Profile**. +2. В правом верхнем углу кликаем на иконку профиля (для мобильной версии сайта, в верхнем левом углу, нажимаем кнопку **Меню** с тремя горизонтальными полосками). В выпавшем меню, кликаем на пункт **My Profile**. +![My profile](resource:assets/images/pics/myprofile.png) 3. Нам предлагается на выбор, четыре категории настройки: **Preferences**, **Authentication**, **API Tokens**, **Sessions**. Выбираем **API Tokens**. 4. Самым первым пунктом видим кнопку **Create Token**. С полной уверенностью в себе и желанием обрести приватность, нажимаем на неё. 5. Спускаемся в самый низ и видим поле **Create Custom Token** и кнопку **Get Started** с правой стороны. Нажимаем. 6. В поле **Token Name** даём своему токену имя. Можете покреативить и отнестись к этому как к наименованию домашнего зверька :) -7. Далее, у нас **Permissions**. В первом поле выбираем Zone. Во втором поле, по центру, выбираем **DNS**. В последнем поле выбираем **Edit**. +7. Далее, у нас **Permissions**. В первом поле выбираем **Zone**. Во втором поле, по центру, выбираем **DNS**. В последнем поле выбираем **Edit**. +8. Нажимаем на синюю надпись снизу **+ Add more** (сразу же под левым полем которое мы заполняли ранее). Вуаля, у нас появились новые поля. Заполняем по аналогии с предыдущим пунктом, в первом поле выбираем **Zone**, во-втором тоже **Zone**. А уже в третьем нажимаем на **Read**. Давайте сверим с тем что у вас получилось: +![Permissions](resource:assets/images/pics/permissions.png) 8. Далее смотрим на **Zone Resources**. Под этой надписью есть строка с двумя полями. В первом должно быть **Include**, а во втором — **Specific Zone**. Как только Вы выберите **Specific Zone**, справа появится ещё одно поле. В нём выбираем наш домен. 9. Листаем в самый низ и нажимаем на синюю кнопку **Continue to Summary**. 10. Проверяем, всё ли мы правильно выбрали. Должна присутствовать подобная строка: ваш.домен — **DNS:Edit, Zone:Read**. From e7ebfdfac696fc612c113bb182c3745e664778f0 Mon Sep 17 00:00:00 2001 From: def Date: Thu, 28 Jul 2022 23:41:27 +0200 Subject: [PATCH 018/115] fix russian lang --- assets/markdown/how_cloudflare-ru.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/markdown/how_cloudflare-ru.md b/assets/markdown/how_cloudflare-ru.md index 895f2356..d6cc0072 100644 --- a/assets/markdown/how_cloudflare-ru.md +++ b/assets/markdown/how_cloudflare-ru.md @@ -1,13 +1,13 @@ ### Как получить Cloudflare API Token 1. Переходим по [ссылке](https://dash.cloudflare.com/) и авторизуемся в ранее созданном аккаунте. https://dash.cloudflare.com/ -2. В правом верхнем углу кликаем на иконку профиля (для мобильной версии сайта, в верхнем левом углу, нажимаем кнопку **Меню** с тремя горизонтальными полосками). В выпавшем меню, кликаем на пункт **My Profile**. +2. В правом верхнем углу кликаем на иконку профиля (для мобильной версии сайта: в верхнем левом углу нажимаем кнопку **Меню** с тремя горизонтальными полосками). В выпавшем меню кликаем на пункт **My Profile**. ![My profile](resource:assets/images/pics/myprofile.png) 3. Нам предлагается на выбор, четыре категории настройки: **Preferences**, **Authentication**, **API Tokens**, **Sessions**. Выбираем **API Tokens**. 4. Самым первым пунктом видим кнопку **Create Token**. С полной уверенностью в себе и желанием обрести приватность, нажимаем на неё. 5. Спускаемся в самый низ и видим поле **Create Custom Token** и кнопку **Get Started** с правой стороны. Нажимаем. 6. В поле **Token Name** даём своему токену имя. Можете покреативить и отнестись к этому как к наименованию домашнего зверька :) 7. Далее, у нас **Permissions**. В первом поле выбираем **Zone**. Во втором поле, по центру, выбираем **DNS**. В последнем поле выбираем **Edit**. -8. Нажимаем на синюю надпись снизу **+ Add more** (сразу же под левым полем которое мы заполняли ранее). Вуаля, у нас появились новые поля. Заполняем по аналогии с предыдущим пунктом, в первом поле выбираем **Zone**, во-втором тоже **Zone**. А уже в третьем нажимаем на **Read**. Давайте сверим с тем что у вас получилось: +8. Нажимаем на синюю надпись снизу **+ Add more** (сразу же под левым полем которое мы заполняли ранее). Вуаля, у нас появились новые поля. Заполняем по аналогии с предыдущим пунктом, в первом поле выбираем **Zone**, во-втором тоже **Zone**. А уже в третьем нажимаем на **Read**. Давайте сверим с тем, что у вас получилось: ![Permissions](resource:assets/images/pics/permissions.png) 8. Далее смотрим на **Zone Resources**. Под этой надписью есть строка с двумя полями. В первом должно быть **Include**, а во втором — **Specific Zone**. Как только Вы выберите **Specific Zone**, справа появится ещё одно поле. В нём выбираем наш домен. 9. Листаем в самый низ и нажимаем на синюю кнопку **Continue to Summary**. From c747dcd4ae3cffb9dc2ccce434288382d61bc6b1 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 29 Jul 2022 08:38:21 +0300 Subject: [PATCH 019/115] Implement Server Storage card for provider menu Co-authored-by: Inex Code --- analysis_options.yaml | 1 + assets/translations/en.json | 10 + .../schema/get_server_disk_volumes.graphql | 11 + .../get_server_disk_volumes.graphql.dart | 542 ++++++++++++++++++ .../get_server_disk_volumes.graphql.g.dart | 64 +++ .../graphql_maps/schema/schema.graphql | 13 + .../api_maps/graphql_maps/schema/server.dart | 19 + .../server_installation_cubit.dart | 6 + lib/logic/models/json/server_disk_volume.dart | 22 + .../models/json/server_disk_volume.g.dart | 25 + lib/logic/models/state_types.dart | 2 +- .../brand_linear_indicator.dart | 37 ++ .../icon_status_mask/icon_status_mask.dart | 6 + lib/ui/pages/providers/providers.dart | 19 + lib/ui/pages/providers/storage_card.dart | 152 +++++ 15 files changed, 928 insertions(+), 1 deletion(-) create mode 100644 lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql create mode 100644 lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql.dart create mode 100644 lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql.g.dart create mode 100644 lib/logic/models/json/server_disk_volume.dart create mode 100644 lib/logic/models/json/server_disk_volume.g.dart create mode 100644 lib/ui/components/brand_linear_indicator/brand_linear_indicator.dart create mode 100644 lib/ui/pages/providers/storage_card.dart diff --git a/analysis_options.yaml b/analysis_options.yaml index 9d16cb20..aa344a69 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -13,6 +13,7 @@ analyzer: exclude: - lib/generated_plugin_registrant.dart - lib/**.g.dart + - lib/**.graphql.dart linter: # The lint rules applied to this project can be customized in the diff --git a/assets/translations/en.json b/assets/translations/en.json index 4fdb0626..6c48f966 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -163,6 +163,16 @@ "refresh": "Refresh status", "refetchBackups": "Refetch backup list", "refetchingList": "In a few minutes list will be updated" + }, + "storage": { + "card_title": "Server Storage", + "status_ok": "Disk usage is OK", + "status_error": "Low disk space", + "disk_usage": "{} GB used", + "disk_total": "{} GB total · {}", + "gb": "{} GB", + "mb": "{} MB", + "extend_volume_button": "Extend volume" } }, "not_ready_card": { diff --git a/lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql b/lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql new file mode 100644 index 00000000..2a566271 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql @@ -0,0 +1,11 @@ +query GetServerDiskVolumesQuery { + storage { + volumes { + freeSpace + name + root + totalSpace + usedSpace + } + } +} \ No newline at end of file diff --git a/lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql.dart new file mode 100644 index 00000000..007adc55 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql.dart @@ -0,0 +1,542 @@ +import 'package:gql/ast.dart'; +import 'package:graphql/client.dart' as graphql; +import 'package:json_annotation/json_annotation.dart'; +part 'get_server_disk_volumes.graphql.g.dart'; + +@JsonSerializable(explicitToJson: true) +class Query$GetServerDiskVolumesQuery { + Query$GetServerDiskVolumesQuery( + {required this.storage, required this.$__typename}); + + @override + factory Query$GetServerDiskVolumesQuery.fromJson(Map json) => + _$Query$GetServerDiskVolumesQueryFromJson(json); + + final Query$GetServerDiskVolumesQuery$storage storage; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Query$GetServerDiskVolumesQueryToJson(this); + 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$GetServerDiskVolumesQuery) || + 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; + } +} + +extension UtilityExtension$Query$GetServerDiskVolumesQuery + on Query$GetServerDiskVolumesQuery { + CopyWith$Query$GetServerDiskVolumesQuery + get copyWith => CopyWith$Query$GetServerDiskVolumesQuery(this, (i) => i); +} + +abstract class CopyWith$Query$GetServerDiskVolumesQuery { + factory CopyWith$Query$GetServerDiskVolumesQuery( + Query$GetServerDiskVolumesQuery instance, + TRes Function(Query$GetServerDiskVolumesQuery) then) = + _CopyWithImpl$Query$GetServerDiskVolumesQuery; + + factory CopyWith$Query$GetServerDiskVolumesQuery.stub(TRes res) = + _CopyWithStubImpl$Query$GetServerDiskVolumesQuery; + + TRes call( + {Query$GetServerDiskVolumesQuery$storage? storage, String? $__typename}); + CopyWith$Query$GetServerDiskVolumesQuery$storage get storage; +} + +class _CopyWithImpl$Query$GetServerDiskVolumesQuery + implements CopyWith$Query$GetServerDiskVolumesQuery { + _CopyWithImpl$Query$GetServerDiskVolumesQuery(this._instance, this._then); + + final Query$GetServerDiskVolumesQuery _instance; + + final TRes Function(Query$GetServerDiskVolumesQuery) _then; + + static const _undefined = {}; + + TRes call({Object? storage = _undefined, Object? $__typename = _undefined}) => + _then(Query$GetServerDiskVolumesQuery( + storage: storage == _undefined || storage == null + ? _instance.storage + : (storage as Query$GetServerDiskVolumesQuery$storage), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); + CopyWith$Query$GetServerDiskVolumesQuery$storage get storage { + final local$storage = _instance.storage; + return CopyWith$Query$GetServerDiskVolumesQuery$storage( + local$storage, (e) => call(storage: e)); + } +} + +class _CopyWithStubImpl$Query$GetServerDiskVolumesQuery + implements CopyWith$Query$GetServerDiskVolumesQuery { + _CopyWithStubImpl$Query$GetServerDiskVolumesQuery(this._res); + + TRes _res; + + call( + {Query$GetServerDiskVolumesQuery$storage? storage, + String? $__typename}) => + _res; + CopyWith$Query$GetServerDiskVolumesQuery$storage get storage => + CopyWith$Query$GetServerDiskVolumesQuery$storage.stub(_res); +} + +const documentNodeQueryGetServerDiskVolumesQuery = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.query, + name: NameNode(value: 'GetServerDiskVolumesQuery'), + 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: 'freeSpace'), + 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: 'totalSpace'), + 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) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), +]); +Query$GetServerDiskVolumesQuery _parserFn$Query$GetServerDiskVolumesQuery( + Map data) => + Query$GetServerDiskVolumesQuery.fromJson(data); + +class Options$Query$GetServerDiskVolumesQuery + extends graphql.QueryOptions { + Options$Query$GetServerDiskVolumesQuery( + {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: documentNodeQueryGetServerDiskVolumesQuery, + parserFn: _parserFn$Query$GetServerDiskVolumesQuery); +} + +class WatchOptions$Query$GetServerDiskVolumesQuery + extends graphql.WatchQueryOptions { + WatchOptions$Query$GetServerDiskVolumesQuery( + {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: documentNodeQueryGetServerDiskVolumesQuery, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Query$GetServerDiskVolumesQuery); +} + +class FetchMoreOptions$Query$GetServerDiskVolumesQuery + extends graphql.FetchMoreOptions { + FetchMoreOptions$Query$GetServerDiskVolumesQuery( + {required graphql.UpdateQuery updateQuery}) + : super( + updateQuery: updateQuery, + document: documentNodeQueryGetServerDiskVolumesQuery); +} + +extension ClientExtension$Query$GetServerDiskVolumesQuery + on graphql.GraphQLClient { + Future> + query$GetServerDiskVolumesQuery( + [Options$Query$GetServerDiskVolumesQuery? options]) async => + await this + .query(options ?? Options$Query$GetServerDiskVolumesQuery()); + graphql.ObservableQuery + watchQuery$GetServerDiskVolumesQuery( + [WatchOptions$Query$GetServerDiskVolumesQuery? options]) => + this.watchQuery( + options ?? WatchOptions$Query$GetServerDiskVolumesQuery()); + void writeQuery$GetServerDiskVolumesQuery( + {required Query$GetServerDiskVolumesQuery data, + bool broadcast = true}) => + this.writeQuery( + graphql.Request( + operation: graphql.Operation( + document: documentNodeQueryGetServerDiskVolumesQuery)), + data: data.toJson(), + broadcast: broadcast); + Query$GetServerDiskVolumesQuery? readQuery$GetServerDiskVolumesQuery( + {bool optimistic = true}) { + final result = this.readQuery( + graphql.Request( + operation: graphql.Operation( + document: documentNodeQueryGetServerDiskVolumesQuery)), + optimistic: optimistic); + return result == null + ? null + : Query$GetServerDiskVolumesQuery.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$GetServerDiskVolumesQuery$storage { + Query$GetServerDiskVolumesQuery$storage( + {required this.volumes, required this.$__typename}); + + @override + factory Query$GetServerDiskVolumesQuery$storage.fromJson( + Map json) => + _$Query$GetServerDiskVolumesQuery$storageFromJson(json); + + final List volumes; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Query$GetServerDiskVolumesQuery$storageToJson(this); + int get hashCode { + final l$volumes = volumes; + final l$$__typename = $__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 (!(other is Query$GetServerDiskVolumesQuery$storage) || + runtimeType != other.runtimeType) return false; + final l$volumes = volumes; + final lOther$volumes = other.volumes; + 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; + } + + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$GetServerDiskVolumesQuery$storage + on Query$GetServerDiskVolumesQuery$storage { + CopyWith$Query$GetServerDiskVolumesQuery$storage< + Query$GetServerDiskVolumesQuery$storage> + get copyWith => + CopyWith$Query$GetServerDiskVolumesQuery$storage(this, (i) => i); +} + +abstract class CopyWith$Query$GetServerDiskVolumesQuery$storage { + factory CopyWith$Query$GetServerDiskVolumesQuery$storage( + Query$GetServerDiskVolumesQuery$storage instance, + TRes Function(Query$GetServerDiskVolumesQuery$storage) then) = + _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage; + + factory CopyWith$Query$GetServerDiskVolumesQuery$storage.stub(TRes res) = + _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage; + + TRes call( + {List? volumes, + String? $__typename}); + TRes volumes( + Iterable Function( + Iterable< + CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes< + Query$GetServerDiskVolumesQuery$storage$volumes>>) + _fn); +} + +class _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage + implements CopyWith$Query$GetServerDiskVolumesQuery$storage { + _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage( + this._instance, this._then); + + final Query$GetServerDiskVolumesQuery$storage _instance; + + final TRes Function(Query$GetServerDiskVolumesQuery$storage) _then; + + static const _undefined = {}; + + TRes call({Object? volumes = _undefined, Object? $__typename = _undefined}) => + _then(Query$GetServerDiskVolumesQuery$storage( + 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< + CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes< + Query$GetServerDiskVolumesQuery$storage$volumes>>) + _fn) => + call( + volumes: _fn(_instance.volumes.map((e) => + CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes( + e, (i) => i))).toList()); +} + +class _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage + implements CopyWith$Query$GetServerDiskVolumesQuery$storage { + _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage(this._res); + + TRes _res; + + call( + {List? volumes, + String? $__typename}) => + _res; + volumes(_fn) => _res; +} + +@JsonSerializable(explicitToJson: true) +class Query$GetServerDiskVolumesQuery$storage$volumes { + Query$GetServerDiskVolumesQuery$storage$volumes( + {required this.freeSpace, + required this.name, + required this.root, + required this.totalSpace, + required this.usedSpace, + required this.$__typename}); + + @override + factory Query$GetServerDiskVolumesQuery$storage$volumes.fromJson( + Map json) => + _$Query$GetServerDiskVolumesQuery$storage$volumesFromJson(json); + + final String freeSpace; + + final String name; + + final bool root; + + final String totalSpace; + + final String usedSpace; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Query$GetServerDiskVolumesQuery$storage$volumesToJson(this); + int get hashCode { + final l$freeSpace = freeSpace; + final l$name = name; + final l$root = root; + final l$totalSpace = totalSpace; + final l$usedSpace = usedSpace; + final l$$__typename = $__typename; + return Object.hashAll([ + l$freeSpace, + l$name, + l$root, + l$totalSpace, + l$usedSpace, + l$$__typename + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$GetServerDiskVolumesQuery$storage$volumes) || + runtimeType != other.runtimeType) return false; + final l$freeSpace = freeSpace; + final lOther$freeSpace = other.freeSpace; + if (l$freeSpace != lOther$freeSpace) return false; + final l$name = name; + final lOther$name = other.name; + if (l$name != lOther$name) return false; + final l$root = root; + final lOther$root = other.root; + if (l$root != lOther$root) return false; + final l$totalSpace = totalSpace; + final lOther$totalSpace = other.totalSpace; + if (l$totalSpace != lOther$totalSpace) 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; + return true; + } +} + +extension UtilityExtension$Query$GetServerDiskVolumesQuery$storage$volumes + on Query$GetServerDiskVolumesQuery$storage$volumes { + CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes< + Query$GetServerDiskVolumesQuery$storage$volumes> + get copyWith => CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes( + this, (i) => i); +} + +abstract class CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes { + factory CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes( + Query$GetServerDiskVolumesQuery$storage$volumes instance, + TRes Function(Query$GetServerDiskVolumesQuery$storage$volumes) then) = + _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage$volumes; + + factory CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes.stub( + TRes res) = + _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage$volumes; + + TRes call( + {String? freeSpace, + String? name, + bool? root, + String? totalSpace, + String? usedSpace, + String? $__typename}); +} + +class _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage$volumes + implements CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes { + _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage$volumes( + this._instance, this._then); + + final Query$GetServerDiskVolumesQuery$storage$volumes _instance; + + final TRes Function(Query$GetServerDiskVolumesQuery$storage$volumes) _then; + + static const _undefined = {}; + + TRes call( + {Object? freeSpace = _undefined, + Object? name = _undefined, + Object? root = _undefined, + Object? totalSpace = _undefined, + Object? usedSpace = _undefined, + Object? $__typename = _undefined}) => + _then(Query$GetServerDiskVolumesQuery$storage$volumes( + freeSpace: freeSpace == _undefined || freeSpace == null + ? _instance.freeSpace + : (freeSpace as String), + name: name == _undefined || name == null + ? _instance.name + : (name as String), + root: root == _undefined || root == null + ? _instance.root + : (root as bool), + totalSpace: totalSpace == _undefined || totalSpace == null + ? _instance.totalSpace + : (totalSpace 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$GetServerDiskVolumesQuery$storage$volumes + implements CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes { + _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage$volumes(this._res); + + TRes _res; + + call( + {String? freeSpace, + String? name, + bool? root, + String? totalSpace, + String? usedSpace, + String? $__typename}) => + _res; +} diff --git a/lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql.g.dart b/lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql.g.dart new file mode 100644 index 00000000..ecbd5a02 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql.g.dart @@ -0,0 +1,64 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'get_server_disk_volumes.graphql.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Query$GetServerDiskVolumesQuery _$Query$GetServerDiskVolumesQueryFromJson( + Map json) => + Query$GetServerDiskVolumesQuery( + storage: Query$GetServerDiskVolumesQuery$storage.fromJson( + json['storage'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Query$GetServerDiskVolumesQueryToJson( + Query$GetServerDiskVolumesQuery instance) => + { + 'storage': instance.storage.toJson(), + '__typename': instance.$__typename, + }; + +Query$GetServerDiskVolumesQuery$storage + _$Query$GetServerDiskVolumesQuery$storageFromJson( + Map json) => + Query$GetServerDiskVolumesQuery$storage( + volumes: (json['volumes'] as List) + .map((e) => + Query$GetServerDiskVolumesQuery$storage$volumes.fromJson( + e as Map)) + .toList(), + $__typename: json['__typename'] as String, + ); + +Map _$Query$GetServerDiskVolumesQuery$storageToJson( + Query$GetServerDiskVolumesQuery$storage instance) => + { + 'volumes': instance.volumes.map((e) => e.toJson()).toList(), + '__typename': instance.$__typename, + }; + +Query$GetServerDiskVolumesQuery$storage$volumes + _$Query$GetServerDiskVolumesQuery$storage$volumesFromJson( + Map json) => + Query$GetServerDiskVolumesQuery$storage$volumes( + freeSpace: json['freeSpace'] as String, + name: json['name'] as String, + root: json['root'] as bool, + totalSpace: json['totalSpace'] as String, + usedSpace: json['usedSpace'] as String, + $__typename: json['__typename'] as String, + ); + +Map _$Query$GetServerDiskVolumesQuery$storage$volumesToJson( + Query$GetServerDiskVolumesQuery$storage$volumes instance) => + { + 'freeSpace': instance.freeSpace, + 'name': instance.name, + 'root': instance.root, + 'totalSpace': instance.totalSpace, + 'usedSpace': instance.usedSpace, + '__typename': instance.$__typename, + }; diff --git a/lib/logic/api_maps/graphql_maps/schema/schema.graphql b/lib/logic/api_maps/graphql_maps/schema/schema.graphql index c4b3246d..3ad04e3f 100644 --- a/lib/logic/api_maps/graphql_maps/schema/schema.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql @@ -7,6 +7,18 @@ type Alert { timestamp: DateTime } +type Storage { + volumes: [StorageVolume!]! +} + +type StorageVolume { + freeSpace: String! + name: String! + root: Boolean! + totalSpace: String! + usedSpace: String! +} + type Api { version: String! devices: [ApiDevice!]! @@ -82,6 +94,7 @@ interface MutationReturnInterface { type Query { system: System! + storage: Storage! api: Api! } diff --git a/lib/logic/api_maps/graphql_maps/schema/server.dart b/lib/logic/api_maps/graphql_maps/schema/server.dart index 1ddf49f7..ab4fe197 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server.dart +++ b/lib/logic/api_maps/graphql_maps/schema/server.dart @@ -3,8 +3,10 @@ import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/api_map.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/get_api_version.graphql.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/api_token.dart'; +import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; class ServerApi extends ApiMap { ServerApi({ @@ -54,4 +56,21 @@ class ServerApi extends ApiMap { return tokens; } + + Future> getServerDiskVolumes() async { + QueryResult response; + List volumes = []; + + try { + final GraphQLClient client = await getClient(); + response = await client.query$GetServerDiskVolumesQuery(); + volumes = response.data!['storage']['volumes'] + .map((final e) => ServerDiskVolume.fromJson(e)) + .toList(); + } catch (e) { + print(e); + } + + return volumes; + } } diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 6899240f..4ed0d382 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -4,12 +4,14 @@ import 'package:flutter_bloc/flutter_bloc.dart'; 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/schema/server.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/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'; import 'package:selfprivacy/logic/models/hive/user.dart'; +import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; import 'package:selfprivacy/logic/models/server_basic_info.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_repository.dart'; @@ -553,6 +555,10 @@ class ServerInstallationCubit extends Cubit { ); } + Future> getServerDiskVolumes() async => + ServerApi(authToken: 'HARDCODE OUR BEARER HERE FOR NOW') + .getServerDiskVolumes(); + Future setAndValidateCloudflareToken(final String token) async { final ServerInstallationRecovery dataState = state as ServerInstallationRecovery; diff --git a/lib/logic/models/json/server_disk_volume.dart b/lib/logic/models/json/server_disk_volume.dart new file mode 100644 index 00000000..b7d4bfca --- /dev/null +++ b/lib/logic/models/json/server_disk_volume.dart @@ -0,0 +1,22 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'server_disk_volume.g.dart'; + +@JsonSerializable() +class ServerDiskVolume { + factory ServerDiskVolume.fromJson(final Map json) => + _$ServerDiskVolumeFromJson(json); + ServerDiskVolume({ + required this.freeSpace, + required this.name, + required this.root, + required this.totalSpace, + required this.usedSpace, + }); + + final String freeSpace; + final String name; + final bool root; + final String totalSpace; + final String usedSpace; +} diff --git a/lib/logic/models/json/server_disk_volume.g.dart b/lib/logic/models/json/server_disk_volume.g.dart new file mode 100644 index 00000000..95f5788b --- /dev/null +++ b/lib/logic/models/json/server_disk_volume.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'server_disk_volume.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ServerDiskVolume _$ServerDiskVolumeFromJson(Map json) => + ServerDiskVolume( + freeSpace: json['freeSpace'] as String, + name: json['name'] as String, + root: json['root'] as bool, + totalSpace: json['totalSpace'] as String, + usedSpace: json['usedSpace'] as String, + ); + +Map _$ServerDiskVolumeToJson(ServerDiskVolume instance) => + { + 'freeSpace': instance.freeSpace, + 'name': instance.name, + 'root': instance.root, + 'totalSpace': instance.totalSpace, + 'usedSpace': instance.usedSpace, + }; diff --git a/lib/logic/models/state_types.dart b/lib/logic/models/state_types.dart index cd79de6c..3fb110c0 100644 --- a/lib/logic/models/state_types.dart +++ b/lib/logic/models/state_types.dart @@ -1 +1 @@ -enum StateType { uninitialized, stable, warning } +enum StateType { uninitialized, stable, warning, error } diff --git a/lib/ui/components/brand_linear_indicator/brand_linear_indicator.dart b/lib/ui/components/brand_linear_indicator/brand_linear_indicator.dart new file mode 100644 index 00000000..807d3224 --- /dev/null +++ b/lib/ui/components/brand_linear_indicator/brand_linear_indicator.dart @@ -0,0 +1,37 @@ +import 'package:flutter/material.dart'; + +class BrandLinearIndicator extends StatelessWidget { + const BrandLinearIndicator({ + required this.value, + required this.color, + required this.backgroundColor, + required this.height, + final super.key, + }); + + final double value; + final Color color; + final Color backgroundColor; + final double height; + + @override + Widget build(final BuildContext context) => Container( + height: height, + width: double.infinity, + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + color: backgroundColor, + borderRadius: BorderRadius.circular(height), + ), + alignment: Alignment.centerLeft, + child: FractionallySizedBox( + widthFactor: value, + child: Container( + decoration: BoxDecoration( + color: color, + borderRadius: BorderRadius.circular(height), + ), + ), + ), + ); +} diff --git a/lib/ui/components/icon_status_mask/icon_status_mask.dart b/lib/ui/components/icon_status_mask/icon_status_mask.dart index 0c507ede..cda75049 100644 --- a/lib/ui/components/icon_status_mask/icon_status_mask.dart +++ b/lib/ui/components/icon_status_mask/icon_status_mask.dart @@ -28,6 +28,12 @@ class IconStatusMask extends StatelessWidget { case StateType.warning: colors = BrandColors.warningGradientColors; break; + case StateType.error: + colors = [ + Theme.of(context).colorScheme.error, + Theme.of(context).colorScheme.error, + ]; + break; } return ShaderMask( shaderCallback: (final bounds) => LinearGradient( diff --git a/lib/ui/pages/providers/providers.dart b/lib/ui/pages/providers/providers.dart index 97e4aeeb..36903d1f 100644 --- a/lib/ui/pages/providers/providers.dart +++ b/lib/ui/pages/providers/providers.dart @@ -5,6 +5,7 @@ import 'package:selfprivacy/logic/cubit/backups/backups_cubit.dart'; import 'package:selfprivacy/logic/cubit/dns_records/dns_records_cubit.dart'; import 'package:selfprivacy/logic/cubit/providers/providers_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; +import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; import 'package:selfprivacy/logic/models/provider.dart'; import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart'; import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; @@ -15,6 +16,7 @@ import 'package:selfprivacy/ui/components/not_ready_card/not_ready_card.dart'; import 'package:selfprivacy/ui/helpers/modals.dart'; import 'package:selfprivacy/ui/pages/backup_details/backup_details.dart'; import 'package:selfprivacy/ui/pages/dns_details/dns_details.dart'; +import 'package:selfprivacy/ui/pages/providers/storage_card.dart'; import 'package:selfprivacy/ui/pages/server_details/server_details_screen.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; @@ -67,6 +69,23 @@ class _ProvidersPageState extends State { ), ) .toList(); + cards.add( + Padding( + padding: const EdgeInsets.only(bottom: 30), + child: FutureBuilder( + future: + context.read().getServerDiskVolumes(), + builder: ( + final BuildContext context, + final AsyncSnapshot snapshot, + ) => + StorageCard( + volumes: + snapshot.hasData ? snapshot.data as List : [], + ), + ), + ), + ); return Scaffold( appBar: PreferredSize( preferredSize: const Size.fromHeight(52), diff --git a/lib/ui/pages/providers/storage_card.dart b/lib/ui/pages/providers/storage_card.dart new file mode 100644 index 00000000..51c510e4 --- /dev/null +++ b/lib/ui/pages/providers/storage_card.dart @@ -0,0 +1,152 @@ +import 'dart:ffi'; + +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:selfprivacy/logic/cubit/providers/providers_cubit.dart'; +import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; +import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; +import 'package:selfprivacy/ui/components/brand_linear_indicator/brand_linear_indicator.dart'; +import 'package:selfprivacy/ui/components/icon_status_mask/icon_status_mask.dart'; + +class DiskVolume { + int gbUsed = 0; + int gbTotal = 0; + String name = ''; + bool root = false; + + /// from 0.0 to 1.0 + double percentage = 0.0; +} + +class DiskStatus { + bool isDiskOkay = false; + List diskVolumes = []; +} + +class StorageCard extends StatelessWidget { + const StorageCard({required this.volumes, final super.key}); + + final List volumes; + + @override + Widget build( + final BuildContext context, + ) { + final DiskStatus diskStatus = toDiskStatus(volumes); + + final List sections = []; + for (final DiskVolume volume in diskStatus.diskVolumes) { + sections.add( + const SizedBox(height: 16), + ); + sections.add( + Text( + 'providers.storage.disk_usage'.tr(args: [volume.gbUsed.toString()]), + style: Theme.of(context).textTheme.titleMedium, + ), + ); + sections.add( + const SizedBox(height: 4), + ); + sections.add( + BrandLinearIndicator( + value: volume.percentage, + color: volume.root + ? Theme.of(context).colorScheme.primary + : Theme.of(context).colorScheme.secondary, + backgroundColor: Theme.of(context).colorScheme.surfaceVariant, + height: 14.0, + ), + ); + sections.add( + const SizedBox(height: 4), + ); + sections.add( + Text( + 'providers.storage.disk_total'.tr(args: [ + volume.gbTotal.toString(), + volume.name, + ]), + style: Theme.of(context).textTheme.bodySmall, + ), + ); + } + + return GestureDetector( + onTap: null, + child: BrandCards.big( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + const IconStatusMask( + status: StateType.stable, + child: Icon( + Icons.storage_outlined, + size: 30, + color: Colors.white, + ), + ), + IconStatusMask( + status: StateType.stable, + child: Icon( + diskStatus.isDiskOkay + ? Icons.check_circle_outline + : Icons.error_outline, + size: 24, + color: Colors.white, + ), + ), + ], + ), + const SizedBox(height: 16), + Text( + 'providers.storage.card_title'.tr(), + style: Theme.of(context).textTheme.titleLarge, + ), + Text( + diskStatus.isDiskOkay + ? 'providers.storage.status_ok'.tr() + : 'providers.storage.status_error'.tr(), + style: Theme.of(context).textTheme.bodyLarge, + ), + ...sections, + const SizedBox(height: 8), + ], + ), + ), + ); + } + + DiskStatus toDiskStatus(final List status) { + final DiskStatus diskStatus = DiskStatus(); + diskStatus.isDiskOkay = true; + + diskStatus.diskVolumes = status.map(( + final ServerDiskVolume volume, + ) { + final DiskVolume diskVolume = DiskVolume(); + diskVolume.gbUsed = volume.usedSpace == 'None' + ? 0 + : int.parse(volume.usedSpace) ~/ 1000000000; + diskVolume.gbTotal = volume.totalSpace == 'None' + ? 0 + : int.parse(volume.totalSpace) ~/ 1000000000; + diskVolume.name = volume.name; + diskVolume.root = volume.root; + diskVolume.percentage = + volume.usedSpace != 'None' && volume.totalSpace != 'None' + ? 1.0 / int.parse(volume.totalSpace) * int.parse(volume.usedSpace) + : 0.0; + if (diskVolume.percentage >= 0.8 || + diskVolume.gbTotal - diskVolume.gbUsed <= 2) { + diskStatus.isDiskOkay = false; + } + return diskVolume; + }).toList(); + + return diskStatus; + } +} From 96c7d7966a1b6d7a92ad4b5ee354dfe28f3ae547 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 1 Aug 2022 02:10:37 +0300 Subject: [PATCH 020/115] Update cubit for volume management and graphql --- lib/logic/api_maps/graphql_maps/api_map.dart | 7 +- .../graphql_maps/schema/disk_volumes.graphql | 38 + .../schema/disk_volumes.graphql.dart | 1915 +++++++++++++++++ .../schema/disk_volumes.graphql.g.dart | 211 ++ .../schema/get_api_version.graphql | 5 - .../schema/get_api_version.graphql.dart | 301 --- .../schema/get_api_version.graphql.g.dart | 36 - .../schema/get_server_disk_volumes.graphql | 11 - .../get_server_disk_volumes.graphql.dart | 542 ----- .../get_server_disk_volumes.graphql.g.dart | 64 - .../graphql_maps/schema/schema.graphql | 16 +- .../api_maps/graphql_maps/schema/server.dart | 48 +- ..._api_tokens.graphql => server_api.graphql} | 6 + ...s.graphql.dart => server_api.graphql.dart} | 299 ++- ...aphql.g.dart => server_api.graphql.g.dart} | 31 +- .../server_providers/hetzner/hetzner.dart | 6 + .../server_installation_cubit.dart | 4 +- .../server_installation_repository.dart | 4 + lib/logic/cubit/volumes/volumes_cubit.dart | 98 +- lib/logic/models/hive/server_details.dart | 3 + lib/logic/models/hive/server_details.g.dart | 7 +- lib/logic/models/json/server_disk_volume.dart | 6 + .../models/json/server_disk_volume.g.dart | 6 + lib/ui/pages/providers/providers.dart | 6 +- lib/ui/pages/providers/storage_card.dart | 48 +- lib/ui/pages/server_storage/disk_status.dart | 14 + .../pages/server_storage/server_storage.dart | 96 + 27 files changed, 2808 insertions(+), 1020 deletions(-) create mode 100644 lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql create mode 100644 lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart create mode 100644 lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.g.dart delete mode 100644 lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql delete mode 100644 lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql.dart delete mode 100644 lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql.g.dart delete mode 100644 lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql delete mode 100644 lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql.dart delete mode 100644 lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql.g.dart rename lib/logic/api_maps/graphql_maps/schema/{get_api_tokens.graphql => server_api.graphql} (65%) rename lib/logic/api_maps/graphql_maps/schema/{get_api_tokens.graphql.dart => server_api.graphql.dart} (61%) rename lib/logic/api_maps/graphql_maps/schema/{get_api_tokens.graphql.g.dart => server_api.graphql.g.dart} (67%) create mode 100644 lib/ui/pages/server_storage/disk_status.dart create mode 100644 lib/ui/pages/server_storage/server_storage.dart diff --git a/lib/logic/api_maps/graphql_maps/api_map.dart b/lib/logic/api_maps/graphql_maps/api_map.dart index 90d6a349..c9240f00 100644 --- a/lib/logic/api_maps/graphql_maps/api_map.dart +++ b/lib/logic/api_maps/graphql_maps/api_map.dart @@ -1,4 +1,5 @@ import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:selfprivacy/config/get_it_config.dart'; abstract class ApiMap { Future getClient() async { @@ -8,7 +9,9 @@ abstract class ApiMap { final Link graphQLLink = isWithToken ? AuthLink( - getToken: () async => authToken, + getToken: () async => customToken == '' + ? getIt().serverDetails!.apiToken + : customToken, ).concat(httpLink) : httpLink; @@ -21,5 +24,5 @@ abstract class ApiMap { abstract final String? rootAddress; abstract final bool hasLogger; abstract final bool isWithToken; - abstract final String authToken; + abstract final String customToken; } diff --git a/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql new file mode 100644 index 00000000..c85d05d9 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql @@ -0,0 +1,38 @@ +query GetServerDiskVolumesQuery { + storage { + volumes { + freeSpace + model + name + root + serial + totalSpace + type + usedSpace + } + } +} + +mutation MountVolumeMutation($name: String!) { + mountVolume(name: $name) { + code + message + success + } +} + +mutation ResizeVolumeMutation($name: String!) { + resizeVolume(name: $name) { + code + message + success + } +} + +mutation UnmountVolumeMutation($name: String!) { + unmountVolume(name: $name) { + code + message + success + } +} \ No newline at end of file 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 new file mode 100644 index 00000000..527b7168 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart @@ -0,0 +1,1915 @@ +import 'dart:async'; +import 'package:gql/ast.dart'; +import 'package:graphql/client.dart' as graphql; +import 'package:json_annotation/json_annotation.dart'; +part 'disk_volumes.graphql.g.dart'; + +@JsonSerializable(explicitToJson: true) +class Query$GetServerDiskVolumesQuery { + Query$GetServerDiskVolumesQuery( + {required this.storage, required this.$__typename}); + + @override + factory Query$GetServerDiskVolumesQuery.fromJson(Map json) => + _$Query$GetServerDiskVolumesQueryFromJson(json); + + final Query$GetServerDiskVolumesQuery$storage storage; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Query$GetServerDiskVolumesQueryToJson(this); + 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$GetServerDiskVolumesQuery) || + 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; + } +} + +extension UtilityExtension$Query$GetServerDiskVolumesQuery + on Query$GetServerDiskVolumesQuery { + CopyWith$Query$GetServerDiskVolumesQuery + get copyWith => CopyWith$Query$GetServerDiskVolumesQuery(this, (i) => i); +} + +abstract class CopyWith$Query$GetServerDiskVolumesQuery { + factory CopyWith$Query$GetServerDiskVolumesQuery( + Query$GetServerDiskVolumesQuery instance, + TRes Function(Query$GetServerDiskVolumesQuery) then) = + _CopyWithImpl$Query$GetServerDiskVolumesQuery; + + factory CopyWith$Query$GetServerDiskVolumesQuery.stub(TRes res) = + _CopyWithStubImpl$Query$GetServerDiskVolumesQuery; + + TRes call( + {Query$GetServerDiskVolumesQuery$storage? storage, String? $__typename}); + CopyWith$Query$GetServerDiskVolumesQuery$storage get storage; +} + +class _CopyWithImpl$Query$GetServerDiskVolumesQuery + implements CopyWith$Query$GetServerDiskVolumesQuery { + _CopyWithImpl$Query$GetServerDiskVolumesQuery(this._instance, this._then); + + final Query$GetServerDiskVolumesQuery _instance; + + final TRes Function(Query$GetServerDiskVolumesQuery) _then; + + static const _undefined = {}; + + TRes call({Object? storage = _undefined, Object? $__typename = _undefined}) => + _then(Query$GetServerDiskVolumesQuery( + storage: storage == _undefined || storage == null + ? _instance.storage + : (storage as Query$GetServerDiskVolumesQuery$storage), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); + CopyWith$Query$GetServerDiskVolumesQuery$storage get storage { + final local$storage = _instance.storage; + return CopyWith$Query$GetServerDiskVolumesQuery$storage( + local$storage, (e) => call(storage: e)); + } +} + +class _CopyWithStubImpl$Query$GetServerDiskVolumesQuery + implements CopyWith$Query$GetServerDiskVolumesQuery { + _CopyWithStubImpl$Query$GetServerDiskVolumesQuery(this._res); + + TRes _res; + + call( + {Query$GetServerDiskVolumesQuery$storage? storage, + String? $__typename}) => + _res; + CopyWith$Query$GetServerDiskVolumesQuery$storage get storage => + CopyWith$Query$GetServerDiskVolumesQuery$storage.stub(_res); +} + +const documentNodeQueryGetServerDiskVolumesQuery = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.query, + name: NameNode(value: 'GetServerDiskVolumesQuery'), + 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: '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: '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) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), +]); +Query$GetServerDiskVolumesQuery _parserFn$Query$GetServerDiskVolumesQuery( + Map data) => + Query$GetServerDiskVolumesQuery.fromJson(data); + +class Options$Query$GetServerDiskVolumesQuery + extends graphql.QueryOptions { + Options$Query$GetServerDiskVolumesQuery( + {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: documentNodeQueryGetServerDiskVolumesQuery, + parserFn: _parserFn$Query$GetServerDiskVolumesQuery); +} + +class WatchOptions$Query$GetServerDiskVolumesQuery + extends graphql.WatchQueryOptions { + WatchOptions$Query$GetServerDiskVolumesQuery( + {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: documentNodeQueryGetServerDiskVolumesQuery, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Query$GetServerDiskVolumesQuery); +} + +class FetchMoreOptions$Query$GetServerDiskVolumesQuery + extends graphql.FetchMoreOptions { + FetchMoreOptions$Query$GetServerDiskVolumesQuery( + {required graphql.UpdateQuery updateQuery}) + : super( + updateQuery: updateQuery, + document: documentNodeQueryGetServerDiskVolumesQuery); +} + +extension ClientExtension$Query$GetServerDiskVolumesQuery + on graphql.GraphQLClient { + Future> + query$GetServerDiskVolumesQuery( + [Options$Query$GetServerDiskVolumesQuery? options]) async => + await this + .query(options ?? Options$Query$GetServerDiskVolumesQuery()); + graphql.ObservableQuery + watchQuery$GetServerDiskVolumesQuery( + [WatchOptions$Query$GetServerDiskVolumesQuery? options]) => + this.watchQuery( + options ?? WatchOptions$Query$GetServerDiskVolumesQuery()); + void writeQuery$GetServerDiskVolumesQuery( + {required Query$GetServerDiskVolumesQuery data, + bool broadcast = true}) => + this.writeQuery( + graphql.Request( + operation: graphql.Operation( + document: documentNodeQueryGetServerDiskVolumesQuery)), + data: data.toJson(), + broadcast: broadcast); + Query$GetServerDiskVolumesQuery? readQuery$GetServerDiskVolumesQuery( + {bool optimistic = true}) { + final result = this.readQuery( + graphql.Request( + operation: graphql.Operation( + document: documentNodeQueryGetServerDiskVolumesQuery)), + optimistic: optimistic); + return result == null + ? null + : Query$GetServerDiskVolumesQuery.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$GetServerDiskVolumesQuery$storage { + Query$GetServerDiskVolumesQuery$storage( + {required this.volumes, required this.$__typename}); + + @override + factory Query$GetServerDiskVolumesQuery$storage.fromJson( + Map json) => + _$Query$GetServerDiskVolumesQuery$storageFromJson(json); + + final List volumes; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Query$GetServerDiskVolumesQuery$storageToJson(this); + int get hashCode { + final l$volumes = volumes; + final l$$__typename = $__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 (!(other is Query$GetServerDiskVolumesQuery$storage) || + runtimeType != other.runtimeType) return false; + final l$volumes = volumes; + final lOther$volumes = other.volumes; + 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; + } + + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$GetServerDiskVolumesQuery$storage + on Query$GetServerDiskVolumesQuery$storage { + CopyWith$Query$GetServerDiskVolumesQuery$storage< + Query$GetServerDiskVolumesQuery$storage> + get copyWith => + CopyWith$Query$GetServerDiskVolumesQuery$storage(this, (i) => i); +} + +abstract class CopyWith$Query$GetServerDiskVolumesQuery$storage { + factory CopyWith$Query$GetServerDiskVolumesQuery$storage( + Query$GetServerDiskVolumesQuery$storage instance, + TRes Function(Query$GetServerDiskVolumesQuery$storage) then) = + _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage; + + factory CopyWith$Query$GetServerDiskVolumesQuery$storage.stub(TRes res) = + _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage; + + TRes call( + {List? volumes, + String? $__typename}); + TRes volumes( + Iterable Function( + Iterable< + CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes< + Query$GetServerDiskVolumesQuery$storage$volumes>>) + _fn); +} + +class _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage + implements CopyWith$Query$GetServerDiskVolumesQuery$storage { + _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage( + this._instance, this._then); + + final Query$GetServerDiskVolumesQuery$storage _instance; + + final TRes Function(Query$GetServerDiskVolumesQuery$storage) _then; + + static const _undefined = {}; + + TRes call({Object? volumes = _undefined, Object? $__typename = _undefined}) => + _then(Query$GetServerDiskVolumesQuery$storage( + 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< + CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes< + Query$GetServerDiskVolumesQuery$storage$volumes>>) + _fn) => + call( + volumes: _fn(_instance.volumes.map((e) => + CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes( + e, (i) => i))).toList()); +} + +class _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage + implements CopyWith$Query$GetServerDiskVolumesQuery$storage { + _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage(this._res); + + TRes _res; + + call( + {List? volumes, + String? $__typename}) => + _res; + volumes(_fn) => _res; +} + +@JsonSerializable(explicitToJson: true) +class Query$GetServerDiskVolumesQuery$storage$volumes { + Query$GetServerDiskVolumesQuery$storage$volumes( + {required this.freeSpace, + required this.model, + required this.name, + required this.root, + required this.serial, + required this.totalSpace, + required this.type, + required this.usedSpace, + required this.$__typename}); + + @override + factory Query$GetServerDiskVolumesQuery$storage$volumes.fromJson( + Map json) => + _$Query$GetServerDiskVolumesQuery$storage$volumesFromJson(json); + + final String freeSpace; + + final String model; + + final String name; + + final bool root; + + final String serial; + + final String totalSpace; + + final String type; + + final String usedSpace; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Query$GetServerDiskVolumesQuery$storage$volumesToJson(this); + int get hashCode { + final l$freeSpace = freeSpace; + final l$model = model; + final l$name = name; + final l$root = root; + final l$serial = serial; + final l$totalSpace = totalSpace; + final l$type = type; + final l$usedSpace = usedSpace; + final l$$__typename = $__typename; + return Object.hashAll([ + l$freeSpace, + l$model, + l$name, + l$root, + l$serial, + l$totalSpace, + l$type, + l$usedSpace, + l$$__typename + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$GetServerDiskVolumesQuery$storage$volumes) || + runtimeType != other.runtimeType) return false; + final l$freeSpace = freeSpace; + final lOther$freeSpace = other.freeSpace; + if (l$freeSpace != lOther$freeSpace) return false; + final l$model = model; + final lOther$model = other.model; + if (l$model != lOther$model) return false; + final l$name = name; + final lOther$name = other.name; + if (l$name != lOther$name) return false; + final l$root = root; + final lOther$root = other.root; + if (l$root != lOther$root) return false; + final l$serial = serial; + final lOther$serial = other.serial; + if (l$serial != lOther$serial) return false; + final l$totalSpace = totalSpace; + final lOther$totalSpace = other.totalSpace; + if (l$totalSpace != lOther$totalSpace) return false; + final l$type = type; + final lOther$type = other.type; + if (l$type != lOther$type) 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; + return true; + } +} + +extension UtilityExtension$Query$GetServerDiskVolumesQuery$storage$volumes + on Query$GetServerDiskVolumesQuery$storage$volumes { + CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes< + Query$GetServerDiskVolumesQuery$storage$volumes> + get copyWith => CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes( + this, (i) => i); +} + +abstract class CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes { + factory CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes( + Query$GetServerDiskVolumesQuery$storage$volumes instance, + TRes Function(Query$GetServerDiskVolumesQuery$storage$volumes) then) = + _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage$volumes; + + factory CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes.stub( + TRes res) = + _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage$volumes; + + TRes call( + {String? freeSpace, + String? model, + String? name, + bool? root, + String? serial, + String? totalSpace, + String? type, + String? usedSpace, + String? $__typename}); +} + +class _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage$volumes + implements CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes { + _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage$volumes( + this._instance, this._then); + + final Query$GetServerDiskVolumesQuery$storage$volumes _instance; + + final TRes Function(Query$GetServerDiskVolumesQuery$storage$volumes) _then; + + 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? usedSpace = _undefined, + Object? $__typename = _undefined}) => + _then(Query$GetServerDiskVolumesQuery$storage$volumes( + freeSpace: freeSpace == _undefined || freeSpace == null + ? _instance.freeSpace + : (freeSpace as String), + model: model == _undefined || model == null + ? _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 || serial == null + ? _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), + usedSpace: usedSpace == _undefined || usedSpace == null + ? _instance.usedSpace + : (usedSpace as String), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); +} + +class _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage$volumes + implements CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes { + _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage$volumes(this._res); + + TRes _res; + + call( + {String? freeSpace, + String? model, + String? name, + bool? root, + String? serial, + String? totalSpace, + String? type, + String? usedSpace, + String? $__typename}) => + _res; +} + +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$MountVolumeMutation { + Variables$Mutation$MountVolumeMutation({required this.name}); + + @override + factory Variables$Mutation$MountVolumeMutation.fromJson( + Map json) => + _$Variables$Mutation$MountVolumeMutationFromJson(json); + + final String name; + + Map toJson() => + _$Variables$Mutation$MountVolumeMutationToJson(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$MountVolumeMutation) || + 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$MountVolumeMutation< + Variables$Mutation$MountVolumeMutation> + get copyWith => + CopyWith$Variables$Mutation$MountVolumeMutation(this, (i) => i); +} + +abstract class CopyWith$Variables$Mutation$MountVolumeMutation { + factory CopyWith$Variables$Mutation$MountVolumeMutation( + Variables$Mutation$MountVolumeMutation instance, + TRes Function(Variables$Mutation$MountVolumeMutation) then) = + _CopyWithImpl$Variables$Mutation$MountVolumeMutation; + + factory CopyWith$Variables$Mutation$MountVolumeMutation.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$MountVolumeMutation; + + TRes call({String? name}); +} + +class _CopyWithImpl$Variables$Mutation$MountVolumeMutation + implements CopyWith$Variables$Mutation$MountVolumeMutation { + _CopyWithImpl$Variables$Mutation$MountVolumeMutation( + this._instance, this._then); + + final Variables$Mutation$MountVolumeMutation _instance; + + final TRes Function(Variables$Mutation$MountVolumeMutation) _then; + + static const _undefined = {}; + + TRes call({Object? name = _undefined}) => + _then(Variables$Mutation$MountVolumeMutation( + name: name == _undefined || name == null + ? _instance.name + : (name as String))); +} + +class _CopyWithStubImpl$Variables$Mutation$MountVolumeMutation + implements CopyWith$Variables$Mutation$MountVolumeMutation { + _CopyWithStubImpl$Variables$Mutation$MountVolumeMutation(this._res); + + TRes _res; + + call({String? name}) => _res; +} + +@JsonSerializable(explicitToJson: true) +class Mutation$MountVolumeMutation { + Mutation$MountVolumeMutation( + {required this.mountVolume, required this.$__typename}); + + @override + factory Mutation$MountVolumeMutation.fromJson(Map json) => + _$Mutation$MountVolumeMutationFromJson(json); + + final Mutation$MountVolumeMutation$mountVolume mountVolume; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$MountVolumeMutationToJson(this); + int get hashCode { + final l$mountVolume = mountVolume; + final l$$__typename = $__typename; + return Object.hashAll([l$mountVolume, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$MountVolumeMutation) || + runtimeType != other.runtimeType) return false; + final l$mountVolume = mountVolume; + final lOther$mountVolume = other.mountVolume; + if (l$mountVolume != lOther$mountVolume) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$MountVolumeMutation + on Mutation$MountVolumeMutation { + CopyWith$Mutation$MountVolumeMutation + get copyWith => CopyWith$Mutation$MountVolumeMutation(this, (i) => i); +} + +abstract class CopyWith$Mutation$MountVolumeMutation { + factory CopyWith$Mutation$MountVolumeMutation( + Mutation$MountVolumeMutation instance, + TRes Function(Mutation$MountVolumeMutation) then) = + _CopyWithImpl$Mutation$MountVolumeMutation; + + factory CopyWith$Mutation$MountVolumeMutation.stub(TRes res) = + _CopyWithStubImpl$Mutation$MountVolumeMutation; + + TRes call( + {Mutation$MountVolumeMutation$mountVolume? mountVolume, + String? $__typename}); + CopyWith$Mutation$MountVolumeMutation$mountVolume get mountVolume; +} + +class _CopyWithImpl$Mutation$MountVolumeMutation + implements CopyWith$Mutation$MountVolumeMutation { + _CopyWithImpl$Mutation$MountVolumeMutation(this._instance, this._then); + + final Mutation$MountVolumeMutation _instance; + + final TRes Function(Mutation$MountVolumeMutation) _then; + + static const _undefined = {}; + + TRes call( + {Object? mountVolume = _undefined, + Object? $__typename = _undefined}) => + _then(Mutation$MountVolumeMutation( + mountVolume: mountVolume == _undefined || mountVolume == null + ? _instance.mountVolume + : (mountVolume as Mutation$MountVolumeMutation$mountVolume), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); + CopyWith$Mutation$MountVolumeMutation$mountVolume get mountVolume { + final local$mountVolume = _instance.mountVolume; + return CopyWith$Mutation$MountVolumeMutation$mountVolume( + local$mountVolume, (e) => call(mountVolume: e)); + } +} + +class _CopyWithStubImpl$Mutation$MountVolumeMutation + implements CopyWith$Mutation$MountVolumeMutation { + _CopyWithStubImpl$Mutation$MountVolumeMutation(this._res); + + TRes _res; + + call( + {Mutation$MountVolumeMutation$mountVolume? mountVolume, + String? $__typename}) => + _res; + CopyWith$Mutation$MountVolumeMutation$mountVolume get mountVolume => + CopyWith$Mutation$MountVolumeMutation$mountVolume.stub(_res); +} + +const documentNodeMutationMountVolumeMutation = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.mutation, + name: NameNode(value: 'MountVolumeMutation'), + 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: [ + 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) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), +]); +Mutation$MountVolumeMutation _parserFn$Mutation$MountVolumeMutation( + Map data) => + Mutation$MountVolumeMutation.fromJson(data); +typedef OnMutationCompleted$Mutation$MountVolumeMutation = FutureOr + Function(dynamic, Mutation$MountVolumeMutation?); + +class Options$Mutation$MountVolumeMutation + extends graphql.MutationOptions { + Options$Mutation$MountVolumeMutation( + {String? operationName, + required Variables$Mutation$MountVolumeMutation variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$MountVolumeMutation? 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$MountVolumeMutation(data)), + update: update, + onError: onError, + document: documentNodeMutationMountVolumeMutation, + parserFn: _parserFn$Mutation$MountVolumeMutation); + + final OnMutationCompleted$Mutation$MountVolumeMutation? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + onCompletedWithParsed + ]; +} + +class WatchOptions$Mutation$MountVolumeMutation + extends graphql.WatchQueryOptions { + WatchOptions$Mutation$MountVolumeMutation( + {String? operationName, + required Variables$Mutation$MountVolumeMutation 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: documentNodeMutationMountVolumeMutation, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$MountVolumeMutation); +} + +extension ClientExtension$Mutation$MountVolumeMutation + on graphql.GraphQLClient { + Future> + mutate$MountVolumeMutation( + Options$Mutation$MountVolumeMutation options) async => + await this.mutate(options); + graphql.ObservableQuery + watchMutation$MountVolumeMutation( + WatchOptions$Mutation$MountVolumeMutation options) => + this.watchMutation(options); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$MountVolumeMutation$mountVolume { + Mutation$MountVolumeMutation$mountVolume( + {required this.code, + required this.message, + required this.success, + required this.$__typename}); + + @override + factory Mutation$MountVolumeMutation$mountVolume.fromJson( + Map json) => + _$Mutation$MountVolumeMutation$mountVolumeFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$MountVolumeMutation$mountVolumeToJson(this); + 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 Mutation$MountVolumeMutation$mountVolume) || + 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$Mutation$MountVolumeMutation$mountVolume + on Mutation$MountVolumeMutation$mountVolume { + CopyWith$Mutation$MountVolumeMutation$mountVolume< + Mutation$MountVolumeMutation$mountVolume> + get copyWith => + CopyWith$Mutation$MountVolumeMutation$mountVolume(this, (i) => i); +} + +abstract class CopyWith$Mutation$MountVolumeMutation$mountVolume { + factory CopyWith$Mutation$MountVolumeMutation$mountVolume( + Mutation$MountVolumeMutation$mountVolume instance, + TRes Function(Mutation$MountVolumeMutation$mountVolume) then) = + _CopyWithImpl$Mutation$MountVolumeMutation$mountVolume; + + factory CopyWith$Mutation$MountVolumeMutation$mountVolume.stub(TRes res) = + _CopyWithStubImpl$Mutation$MountVolumeMutation$mountVolume; + + TRes call({int? code, String? message, bool? success, String? $__typename}); +} + +class _CopyWithImpl$Mutation$MountVolumeMutation$mountVolume + implements CopyWith$Mutation$MountVolumeMutation$mountVolume { + _CopyWithImpl$Mutation$MountVolumeMutation$mountVolume( + this._instance, this._then); + + final Mutation$MountVolumeMutation$mountVolume _instance; + + final TRes Function(Mutation$MountVolumeMutation$mountVolume) _then; + + static const _undefined = {}; + + TRes call( + {Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined}) => + _then(Mutation$MountVolumeMutation$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))); +} + +class _CopyWithStubImpl$Mutation$MountVolumeMutation$mountVolume + implements CopyWith$Mutation$MountVolumeMutation$mountVolume { + _CopyWithStubImpl$Mutation$MountVolumeMutation$mountVolume(this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; +} + +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$ResizeVolumeMutation { + Variables$Mutation$ResizeVolumeMutation({required this.name}); + + @override + factory Variables$Mutation$ResizeVolumeMutation.fromJson( + Map json) => + _$Variables$Mutation$ResizeVolumeMutationFromJson(json); + + final String name; + + Map toJson() => + _$Variables$Mutation$ResizeVolumeMutationToJson(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$ResizeVolumeMutation) || + 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$ResizeVolumeMutation< + Variables$Mutation$ResizeVolumeMutation> + get copyWith => + CopyWith$Variables$Mutation$ResizeVolumeMutation(this, (i) => i); +} + +abstract class CopyWith$Variables$Mutation$ResizeVolumeMutation { + factory CopyWith$Variables$Mutation$ResizeVolumeMutation( + Variables$Mutation$ResizeVolumeMutation instance, + TRes Function(Variables$Mutation$ResizeVolumeMutation) then) = + _CopyWithImpl$Variables$Mutation$ResizeVolumeMutation; + + factory CopyWith$Variables$Mutation$ResizeVolumeMutation.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$ResizeVolumeMutation; + + TRes call({String? name}); +} + +class _CopyWithImpl$Variables$Mutation$ResizeVolumeMutation + implements CopyWith$Variables$Mutation$ResizeVolumeMutation { + _CopyWithImpl$Variables$Mutation$ResizeVolumeMutation( + this._instance, this._then); + + final Variables$Mutation$ResizeVolumeMutation _instance; + + final TRes Function(Variables$Mutation$ResizeVolumeMutation) _then; + + static const _undefined = {}; + + TRes call({Object? name = _undefined}) => + _then(Variables$Mutation$ResizeVolumeMutation( + name: name == _undefined || name == null + ? _instance.name + : (name as String))); +} + +class _CopyWithStubImpl$Variables$Mutation$ResizeVolumeMutation + implements CopyWith$Variables$Mutation$ResizeVolumeMutation { + _CopyWithStubImpl$Variables$Mutation$ResizeVolumeMutation(this._res); + + TRes _res; + + call({String? name}) => _res; +} + +@JsonSerializable(explicitToJson: true) +class Mutation$ResizeVolumeMutation { + Mutation$ResizeVolumeMutation( + {required this.resizeVolume, required this.$__typename}); + + @override + factory Mutation$ResizeVolumeMutation.fromJson(Map json) => + _$Mutation$ResizeVolumeMutationFromJson(json); + + final Mutation$ResizeVolumeMutation$resizeVolume resizeVolume; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$ResizeVolumeMutationToJson(this); + int get hashCode { + final l$resizeVolume = resizeVolume; + final l$$__typename = $__typename; + return Object.hashAll([l$resizeVolume, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$ResizeVolumeMutation) || + runtimeType != other.runtimeType) return false; + final l$resizeVolume = resizeVolume; + final lOther$resizeVolume = other.resizeVolume; + if (l$resizeVolume != lOther$resizeVolume) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$ResizeVolumeMutation + on Mutation$ResizeVolumeMutation { + CopyWith$Mutation$ResizeVolumeMutation + get copyWith => CopyWith$Mutation$ResizeVolumeMutation(this, (i) => i); +} + +abstract class CopyWith$Mutation$ResizeVolumeMutation { + factory CopyWith$Mutation$ResizeVolumeMutation( + Mutation$ResizeVolumeMutation instance, + TRes Function(Mutation$ResizeVolumeMutation) then) = + _CopyWithImpl$Mutation$ResizeVolumeMutation; + + factory CopyWith$Mutation$ResizeVolumeMutation.stub(TRes res) = + _CopyWithStubImpl$Mutation$ResizeVolumeMutation; + + TRes call( + {Mutation$ResizeVolumeMutation$resizeVolume? resizeVolume, + String? $__typename}); + CopyWith$Mutation$ResizeVolumeMutation$resizeVolume get resizeVolume; +} + +class _CopyWithImpl$Mutation$ResizeVolumeMutation + implements CopyWith$Mutation$ResizeVolumeMutation { + _CopyWithImpl$Mutation$ResizeVolumeMutation(this._instance, this._then); + + final Mutation$ResizeVolumeMutation _instance; + + final TRes Function(Mutation$ResizeVolumeMutation) _then; + + static const _undefined = {}; + + TRes call( + {Object? resizeVolume = _undefined, + Object? $__typename = _undefined}) => + _then(Mutation$ResizeVolumeMutation( + resizeVolume: resizeVolume == _undefined || resizeVolume == null + ? _instance.resizeVolume + : (resizeVolume as Mutation$ResizeVolumeMutation$resizeVolume), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); + CopyWith$Mutation$ResizeVolumeMutation$resizeVolume get resizeVolume { + final local$resizeVolume = _instance.resizeVolume; + return CopyWith$Mutation$ResizeVolumeMutation$resizeVolume( + local$resizeVolume, (e) => call(resizeVolume: e)); + } +} + +class _CopyWithStubImpl$Mutation$ResizeVolumeMutation + implements CopyWith$Mutation$ResizeVolumeMutation { + _CopyWithStubImpl$Mutation$ResizeVolumeMutation(this._res); + + TRes _res; + + call( + {Mutation$ResizeVolumeMutation$resizeVolume? resizeVolume, + String? $__typename}) => + _res; + CopyWith$Mutation$ResizeVolumeMutation$resizeVolume get resizeVolume => + CopyWith$Mutation$ResizeVolumeMutation$resizeVolume.stub(_res); +} + +const documentNodeMutationResizeVolumeMutation = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.mutation, + name: NameNode(value: 'ResizeVolumeMutation'), + 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: [ + 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) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), +]); +Mutation$ResizeVolumeMutation _parserFn$Mutation$ResizeVolumeMutation( + Map data) => + Mutation$ResizeVolumeMutation.fromJson(data); +typedef OnMutationCompleted$Mutation$ResizeVolumeMutation = FutureOr + Function(dynamic, Mutation$ResizeVolumeMutation?); + +class Options$Mutation$ResizeVolumeMutation + extends graphql.MutationOptions { + Options$Mutation$ResizeVolumeMutation( + {String? operationName, + required Variables$Mutation$ResizeVolumeMutation variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$ResizeVolumeMutation? 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$ResizeVolumeMutation(data)), + update: update, + onError: onError, + document: documentNodeMutationResizeVolumeMutation, + parserFn: _parserFn$Mutation$ResizeVolumeMutation); + + final OnMutationCompleted$Mutation$ResizeVolumeMutation? + onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + onCompletedWithParsed + ]; +} + +class WatchOptions$Mutation$ResizeVolumeMutation + extends graphql.WatchQueryOptions { + WatchOptions$Mutation$ResizeVolumeMutation( + {String? operationName, + required Variables$Mutation$ResizeVolumeMutation 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: documentNodeMutationResizeVolumeMutation, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$ResizeVolumeMutation); +} + +extension ClientExtension$Mutation$ResizeVolumeMutation + on graphql.GraphQLClient { + Future> + mutate$ResizeVolumeMutation( + Options$Mutation$ResizeVolumeMutation options) async => + await this.mutate(options); + graphql.ObservableQuery + watchMutation$ResizeVolumeMutation( + WatchOptions$Mutation$ResizeVolumeMutation options) => + this.watchMutation(options); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$ResizeVolumeMutation$resizeVolume { + Mutation$ResizeVolumeMutation$resizeVolume( + {required this.code, + required this.message, + required this.success, + required this.$__typename}); + + @override + factory Mutation$ResizeVolumeMutation$resizeVolume.fromJson( + Map json) => + _$Mutation$ResizeVolumeMutation$resizeVolumeFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$ResizeVolumeMutation$resizeVolumeToJson(this); + 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 Mutation$ResizeVolumeMutation$resizeVolume) || + 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$Mutation$ResizeVolumeMutation$resizeVolume + on Mutation$ResizeVolumeMutation$resizeVolume { + CopyWith$Mutation$ResizeVolumeMutation$resizeVolume< + Mutation$ResizeVolumeMutation$resizeVolume> + get copyWith => + CopyWith$Mutation$ResizeVolumeMutation$resizeVolume(this, (i) => i); +} + +abstract class CopyWith$Mutation$ResizeVolumeMutation$resizeVolume { + factory CopyWith$Mutation$ResizeVolumeMutation$resizeVolume( + Mutation$ResizeVolumeMutation$resizeVolume instance, + TRes Function(Mutation$ResizeVolumeMutation$resizeVolume) then) = + _CopyWithImpl$Mutation$ResizeVolumeMutation$resizeVolume; + + factory CopyWith$Mutation$ResizeVolumeMutation$resizeVolume.stub(TRes res) = + _CopyWithStubImpl$Mutation$ResizeVolumeMutation$resizeVolume; + + TRes call({int? code, String? message, bool? success, String? $__typename}); +} + +class _CopyWithImpl$Mutation$ResizeVolumeMutation$resizeVolume + implements CopyWith$Mutation$ResizeVolumeMutation$resizeVolume { + _CopyWithImpl$Mutation$ResizeVolumeMutation$resizeVolume( + this._instance, this._then); + + final Mutation$ResizeVolumeMutation$resizeVolume _instance; + + final TRes Function(Mutation$ResizeVolumeMutation$resizeVolume) _then; + + static const _undefined = {}; + + TRes call( + {Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined}) => + _then(Mutation$ResizeVolumeMutation$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))); +} + +class _CopyWithStubImpl$Mutation$ResizeVolumeMutation$resizeVolume + implements CopyWith$Mutation$ResizeVolumeMutation$resizeVolume { + _CopyWithStubImpl$Mutation$ResizeVolumeMutation$resizeVolume(this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; +} + +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$UnmountVolumeMutation { + Variables$Mutation$UnmountVolumeMutation({required this.name}); + + @override + factory Variables$Mutation$UnmountVolumeMutation.fromJson( + Map json) => + _$Variables$Mutation$UnmountVolumeMutationFromJson(json); + + final String name; + + Map toJson() => + _$Variables$Mutation$UnmountVolumeMutationToJson(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$UnmountVolumeMutation) || + 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$UnmountVolumeMutation< + Variables$Mutation$UnmountVolumeMutation> + get copyWith => + CopyWith$Variables$Mutation$UnmountVolumeMutation(this, (i) => i); +} + +abstract class CopyWith$Variables$Mutation$UnmountVolumeMutation { + factory CopyWith$Variables$Mutation$UnmountVolumeMutation( + Variables$Mutation$UnmountVolumeMutation instance, + TRes Function(Variables$Mutation$UnmountVolumeMutation) then) = + _CopyWithImpl$Variables$Mutation$UnmountVolumeMutation; + + factory CopyWith$Variables$Mutation$UnmountVolumeMutation.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$UnmountVolumeMutation; + + TRes call({String? name}); +} + +class _CopyWithImpl$Variables$Mutation$UnmountVolumeMutation + implements CopyWith$Variables$Mutation$UnmountVolumeMutation { + _CopyWithImpl$Variables$Mutation$UnmountVolumeMutation( + this._instance, this._then); + + final Variables$Mutation$UnmountVolumeMutation _instance; + + final TRes Function(Variables$Mutation$UnmountVolumeMutation) _then; + + static const _undefined = {}; + + TRes call({Object? name = _undefined}) => + _then(Variables$Mutation$UnmountVolumeMutation( + name: name == _undefined || name == null + ? _instance.name + : (name as String))); +} + +class _CopyWithStubImpl$Variables$Mutation$UnmountVolumeMutation + implements CopyWith$Variables$Mutation$UnmountVolumeMutation { + _CopyWithStubImpl$Variables$Mutation$UnmountVolumeMutation(this._res); + + TRes _res; + + call({String? name}) => _res; +} + +@JsonSerializable(explicitToJson: true) +class Mutation$UnmountVolumeMutation { + Mutation$UnmountVolumeMutation( + {required this.unmountVolume, required this.$__typename}); + + @override + factory Mutation$UnmountVolumeMutation.fromJson(Map json) => + _$Mutation$UnmountVolumeMutationFromJson(json); + + final Mutation$UnmountVolumeMutation$unmountVolume unmountVolume; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$UnmountVolumeMutationToJson(this); + int get hashCode { + final l$unmountVolume = unmountVolume; + final l$$__typename = $__typename; + return Object.hashAll([l$unmountVolume, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$UnmountVolumeMutation) || + runtimeType != other.runtimeType) return false; + final l$unmountVolume = unmountVolume; + final lOther$unmountVolume = other.unmountVolume; + if (l$unmountVolume != lOther$unmountVolume) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$UnmountVolumeMutation + on Mutation$UnmountVolumeMutation { + CopyWith$Mutation$UnmountVolumeMutation + get copyWith => CopyWith$Mutation$UnmountVolumeMutation(this, (i) => i); +} + +abstract class CopyWith$Mutation$UnmountVolumeMutation { + factory CopyWith$Mutation$UnmountVolumeMutation( + Mutation$UnmountVolumeMutation instance, + TRes Function(Mutation$UnmountVolumeMutation) then) = + _CopyWithImpl$Mutation$UnmountVolumeMutation; + + factory CopyWith$Mutation$UnmountVolumeMutation.stub(TRes res) = + _CopyWithStubImpl$Mutation$UnmountVolumeMutation; + + TRes call( + {Mutation$UnmountVolumeMutation$unmountVolume? unmountVolume, + String? $__typename}); + CopyWith$Mutation$UnmountVolumeMutation$unmountVolume get unmountVolume; +} + +class _CopyWithImpl$Mutation$UnmountVolumeMutation + implements CopyWith$Mutation$UnmountVolumeMutation { + _CopyWithImpl$Mutation$UnmountVolumeMutation(this._instance, this._then); + + final Mutation$UnmountVolumeMutation _instance; + + final TRes Function(Mutation$UnmountVolumeMutation) _then; + + static const _undefined = {}; + + TRes call( + {Object? unmountVolume = _undefined, + Object? $__typename = _undefined}) => + _then(Mutation$UnmountVolumeMutation( + unmountVolume: unmountVolume == _undefined || unmountVolume == null + ? _instance.unmountVolume + : (unmountVolume as Mutation$UnmountVolumeMutation$unmountVolume), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); + CopyWith$Mutation$UnmountVolumeMutation$unmountVolume + get unmountVolume { + final local$unmountVolume = _instance.unmountVolume; + return CopyWith$Mutation$UnmountVolumeMutation$unmountVolume( + local$unmountVolume, (e) => call(unmountVolume: e)); + } +} + +class _CopyWithStubImpl$Mutation$UnmountVolumeMutation + implements CopyWith$Mutation$UnmountVolumeMutation { + _CopyWithStubImpl$Mutation$UnmountVolumeMutation(this._res); + + TRes _res; + + call( + {Mutation$UnmountVolumeMutation$unmountVolume? unmountVolume, + String? $__typename}) => + _res; + CopyWith$Mutation$UnmountVolumeMutation$unmountVolume + get unmountVolume => + CopyWith$Mutation$UnmountVolumeMutation$unmountVolume.stub(_res); +} + +const documentNodeMutationUnmountVolumeMutation = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.mutation, + name: NameNode(value: 'UnmountVolumeMutation'), + 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: [ + 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) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), +]); +Mutation$UnmountVolumeMutation _parserFn$Mutation$UnmountVolumeMutation( + Map data) => + Mutation$UnmountVolumeMutation.fromJson(data); +typedef OnMutationCompleted$Mutation$UnmountVolumeMutation = FutureOr + Function(dynamic, Mutation$UnmountVolumeMutation?); + +class Options$Mutation$UnmountVolumeMutation + extends graphql.MutationOptions { + Options$Mutation$UnmountVolumeMutation( + {String? operationName, + required Variables$Mutation$UnmountVolumeMutation variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$UnmountVolumeMutation? 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$UnmountVolumeMutation(data)), + update: update, + onError: onError, + document: documentNodeMutationUnmountVolumeMutation, + parserFn: _parserFn$Mutation$UnmountVolumeMutation); + + final OnMutationCompleted$Mutation$UnmountVolumeMutation? + onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + onCompletedWithParsed + ]; +} + +class WatchOptions$Mutation$UnmountVolumeMutation + extends graphql.WatchQueryOptions { + WatchOptions$Mutation$UnmountVolumeMutation( + {String? operationName, + required Variables$Mutation$UnmountVolumeMutation 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: documentNodeMutationUnmountVolumeMutation, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$UnmountVolumeMutation); +} + +extension ClientExtension$Mutation$UnmountVolumeMutation + on graphql.GraphQLClient { + Future> + mutate$UnmountVolumeMutation( + Options$Mutation$UnmountVolumeMutation options) async => + await this.mutate(options); + graphql.ObservableQuery + watchMutation$UnmountVolumeMutation( + WatchOptions$Mutation$UnmountVolumeMutation options) => + this.watchMutation(options); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$UnmountVolumeMutation$unmountVolume { + Mutation$UnmountVolumeMutation$unmountVolume( + {required this.code, + required this.message, + required this.success, + required this.$__typename}); + + @override + factory Mutation$UnmountVolumeMutation$unmountVolume.fromJson( + Map json) => + _$Mutation$UnmountVolumeMutation$unmountVolumeFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$UnmountVolumeMutation$unmountVolumeToJson(this); + 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 Mutation$UnmountVolumeMutation$unmountVolume) || + 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$Mutation$UnmountVolumeMutation$unmountVolume + on Mutation$UnmountVolumeMutation$unmountVolume { + CopyWith$Mutation$UnmountVolumeMutation$unmountVolume< + Mutation$UnmountVolumeMutation$unmountVolume> + get copyWith => + CopyWith$Mutation$UnmountVolumeMutation$unmountVolume(this, (i) => i); +} + +abstract class CopyWith$Mutation$UnmountVolumeMutation$unmountVolume { + factory CopyWith$Mutation$UnmountVolumeMutation$unmountVolume( + Mutation$UnmountVolumeMutation$unmountVolume instance, + TRes Function(Mutation$UnmountVolumeMutation$unmountVolume) then) = + _CopyWithImpl$Mutation$UnmountVolumeMutation$unmountVolume; + + factory CopyWith$Mutation$UnmountVolumeMutation$unmountVolume.stub(TRes res) = + _CopyWithStubImpl$Mutation$UnmountVolumeMutation$unmountVolume; + + TRes call({int? code, String? message, bool? success, String? $__typename}); +} + +class _CopyWithImpl$Mutation$UnmountVolumeMutation$unmountVolume + implements CopyWith$Mutation$UnmountVolumeMutation$unmountVolume { + _CopyWithImpl$Mutation$UnmountVolumeMutation$unmountVolume( + this._instance, this._then); + + final Mutation$UnmountVolumeMutation$unmountVolume _instance; + + final TRes Function(Mutation$UnmountVolumeMutation$unmountVolume) _then; + + static const _undefined = {}; + + TRes call( + {Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined}) => + _then(Mutation$UnmountVolumeMutation$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))); +} + +class _CopyWithStubImpl$Mutation$UnmountVolumeMutation$unmountVolume + implements CopyWith$Mutation$UnmountVolumeMutation$unmountVolume { + _CopyWithStubImpl$Mutation$UnmountVolumeMutation$unmountVolume(this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; +} 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 new file mode 100644 index 00000000..49a749fe --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.g.dart @@ -0,0 +1,211 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'disk_volumes.graphql.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Query$GetServerDiskVolumesQuery _$Query$GetServerDiskVolumesQueryFromJson( + Map json) => + Query$GetServerDiskVolumesQuery( + storage: Query$GetServerDiskVolumesQuery$storage.fromJson( + json['storage'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Query$GetServerDiskVolumesQueryToJson( + Query$GetServerDiskVolumesQuery instance) => + { + 'storage': instance.storage.toJson(), + '__typename': instance.$__typename, + }; + +Query$GetServerDiskVolumesQuery$storage + _$Query$GetServerDiskVolumesQuery$storageFromJson( + Map json) => + Query$GetServerDiskVolumesQuery$storage( + volumes: (json['volumes'] as List) + .map((e) => + Query$GetServerDiskVolumesQuery$storage$volumes.fromJson( + e as Map)) + .toList(), + $__typename: json['__typename'] as String, + ); + +Map _$Query$GetServerDiskVolumesQuery$storageToJson( + Query$GetServerDiskVolumesQuery$storage instance) => + { + 'volumes': instance.volumes.map((e) => e.toJson()).toList(), + '__typename': instance.$__typename, + }; + +Query$GetServerDiskVolumesQuery$storage$volumes + _$Query$GetServerDiskVolumesQuery$storage$volumesFromJson( + Map json) => + Query$GetServerDiskVolumesQuery$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, + usedSpace: json['usedSpace'] as String, + $__typename: json['__typename'] as String, + ); + +Map _$Query$GetServerDiskVolumesQuery$storage$volumesToJson( + Query$GetServerDiskVolumesQuery$storage$volumes instance) => + { + 'freeSpace': instance.freeSpace, + 'model': instance.model, + 'name': instance.name, + 'root': instance.root, + 'serial': instance.serial, + 'totalSpace': instance.totalSpace, + 'type': instance.type, + 'usedSpace': instance.usedSpace, + '__typename': instance.$__typename, + }; + +Variables$Mutation$MountVolumeMutation + _$Variables$Mutation$MountVolumeMutationFromJson( + Map json) => + Variables$Mutation$MountVolumeMutation( + name: json['name'] as String, + ); + +Map _$Variables$Mutation$MountVolumeMutationToJson( + Variables$Mutation$MountVolumeMutation instance) => + { + 'name': instance.name, + }; + +Mutation$MountVolumeMutation _$Mutation$MountVolumeMutationFromJson( + Map json) => + Mutation$MountVolumeMutation( + mountVolume: Mutation$MountVolumeMutation$mountVolume.fromJson( + json['mountVolume'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$MountVolumeMutationToJson( + Mutation$MountVolumeMutation instance) => + { + 'mountVolume': instance.mountVolume.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$MountVolumeMutation$mountVolume + _$Mutation$MountVolumeMutation$mountVolumeFromJson( + Map json) => + Mutation$MountVolumeMutation$mountVolume( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$MountVolumeMutation$mountVolumeToJson( + Mutation$MountVolumeMutation$mountVolume instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + }; + +Variables$Mutation$ResizeVolumeMutation + _$Variables$Mutation$ResizeVolumeMutationFromJson( + Map json) => + Variables$Mutation$ResizeVolumeMutation( + name: json['name'] as String, + ); + +Map _$Variables$Mutation$ResizeVolumeMutationToJson( + Variables$Mutation$ResizeVolumeMutation instance) => + { + 'name': instance.name, + }; + +Mutation$ResizeVolumeMutation _$Mutation$ResizeVolumeMutationFromJson( + Map json) => + Mutation$ResizeVolumeMutation( + resizeVolume: Mutation$ResizeVolumeMutation$resizeVolume.fromJson( + json['resizeVolume'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$ResizeVolumeMutationToJson( + Mutation$ResizeVolumeMutation instance) => + { + 'resizeVolume': instance.resizeVolume.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$ResizeVolumeMutation$resizeVolume + _$Mutation$ResizeVolumeMutation$resizeVolumeFromJson( + Map json) => + Mutation$ResizeVolumeMutation$resizeVolume( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$ResizeVolumeMutation$resizeVolumeToJson( + Mutation$ResizeVolumeMutation$resizeVolume instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + }; + +Variables$Mutation$UnmountVolumeMutation + _$Variables$Mutation$UnmountVolumeMutationFromJson( + Map json) => + Variables$Mutation$UnmountVolumeMutation( + name: json['name'] as String, + ); + +Map _$Variables$Mutation$UnmountVolumeMutationToJson( + Variables$Mutation$UnmountVolumeMutation instance) => + { + 'name': instance.name, + }; + +Mutation$UnmountVolumeMutation _$Mutation$UnmountVolumeMutationFromJson( + Map json) => + Mutation$UnmountVolumeMutation( + unmountVolume: Mutation$UnmountVolumeMutation$unmountVolume.fromJson( + json['unmountVolume'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$UnmountVolumeMutationToJson( + Mutation$UnmountVolumeMutation instance) => + { + 'unmountVolume': instance.unmountVolume.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$UnmountVolumeMutation$unmountVolume + _$Mutation$UnmountVolumeMutation$unmountVolumeFromJson( + Map json) => + Mutation$UnmountVolumeMutation$unmountVolume( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$UnmountVolumeMutation$unmountVolumeToJson( + Mutation$UnmountVolumeMutation$unmountVolume instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + }; diff --git a/lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql b/lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql deleted file mode 100644 index cbfeb870..00000000 --- a/lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql +++ /dev/null @@ -1,5 +0,0 @@ -query GetApiVersionQuery { - api { - version - } -} \ No newline at end of file diff --git a/lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql.dart deleted file mode 100644 index 8d255fe6..00000000 --- a/lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql.dart +++ /dev/null @@ -1,301 +0,0 @@ -import 'package:gql/ast.dart'; -import 'package:graphql/client.dart' as graphql; -import 'package:json_annotation/json_annotation.dart'; -part 'get_api_version.graphql.g.dart'; - -@JsonSerializable(explicitToJson: true) -class Query$GetApiVersionQuery { - Query$GetApiVersionQuery({required this.api, required this.$__typename}); - - @override - factory Query$GetApiVersionQuery.fromJson(Map json) => - _$Query$GetApiVersionQueryFromJson(json); - - final Query$GetApiVersionQuery$api api; - - @JsonKey(name: '__typename') - final String $__typename; - - Map toJson() => _$Query$GetApiVersionQueryToJson(this); - 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$GetApiVersionQuery) || - 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$GetApiVersionQuery - on Query$GetApiVersionQuery { - CopyWith$Query$GetApiVersionQuery get copyWith => - CopyWith$Query$GetApiVersionQuery(this, (i) => i); -} - -abstract class CopyWith$Query$GetApiVersionQuery { - factory CopyWith$Query$GetApiVersionQuery(Query$GetApiVersionQuery instance, - TRes Function(Query$GetApiVersionQuery) then) = - _CopyWithImpl$Query$GetApiVersionQuery; - - factory CopyWith$Query$GetApiVersionQuery.stub(TRes res) = - _CopyWithStubImpl$Query$GetApiVersionQuery; - - TRes call({Query$GetApiVersionQuery$api? api, String? $__typename}); - CopyWith$Query$GetApiVersionQuery$api get api; -} - -class _CopyWithImpl$Query$GetApiVersionQuery - implements CopyWith$Query$GetApiVersionQuery { - _CopyWithImpl$Query$GetApiVersionQuery(this._instance, this._then); - - final Query$GetApiVersionQuery _instance; - - final TRes Function(Query$GetApiVersionQuery) _then; - - static const _undefined = {}; - - TRes call({Object? api = _undefined, Object? $__typename = _undefined}) => - _then(Query$GetApiVersionQuery( - api: api == _undefined || api == null - ? _instance.api - : (api as Query$GetApiVersionQuery$api), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); - CopyWith$Query$GetApiVersionQuery$api get api { - final local$api = _instance.api; - return CopyWith$Query$GetApiVersionQuery$api( - local$api, (e) => call(api: e)); - } -} - -class _CopyWithStubImpl$Query$GetApiVersionQuery - implements CopyWith$Query$GetApiVersionQuery { - _CopyWithStubImpl$Query$GetApiVersionQuery(this._res); - - TRes _res; - - call({Query$GetApiVersionQuery$api? api, String? $__typename}) => _res; - CopyWith$Query$GetApiVersionQuery$api get api => - CopyWith$Query$GetApiVersionQuery$api.stub(_res); -} - -const documentNodeQueryGetApiVersionQuery = DocumentNode(definitions: [ - OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'GetApiVersionQuery'), - 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: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), -]); -Query$GetApiVersionQuery _parserFn$Query$GetApiVersionQuery( - Map data) => - Query$GetApiVersionQuery.fromJson(data); - -class Options$Query$GetApiVersionQuery - extends graphql.QueryOptions { - Options$Query$GetApiVersionQuery( - {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: documentNodeQueryGetApiVersionQuery, - parserFn: _parserFn$Query$GetApiVersionQuery); -} - -class WatchOptions$Query$GetApiVersionQuery - extends graphql.WatchQueryOptions { - WatchOptions$Query$GetApiVersionQuery( - {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: documentNodeQueryGetApiVersionQuery, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Query$GetApiVersionQuery); -} - -class FetchMoreOptions$Query$GetApiVersionQuery - extends graphql.FetchMoreOptions { - FetchMoreOptions$Query$GetApiVersionQuery( - {required graphql.UpdateQuery updateQuery}) - : super( - updateQuery: updateQuery, - document: documentNodeQueryGetApiVersionQuery); -} - -extension ClientExtension$Query$GetApiVersionQuery on graphql.GraphQLClient { - Future> - query$GetApiVersionQuery( - [Options$Query$GetApiVersionQuery? options]) async => - await this.query(options ?? Options$Query$GetApiVersionQuery()); - graphql.ObservableQuery - watchQuery$GetApiVersionQuery( - [WatchOptions$Query$GetApiVersionQuery? options]) => - this.watchQuery(options ?? WatchOptions$Query$GetApiVersionQuery()); - void writeQuery$GetApiVersionQuery( - {required Query$GetApiVersionQuery data, bool broadcast = true}) => - this.writeQuery( - graphql.Request( - operation: graphql.Operation( - document: documentNodeQueryGetApiVersionQuery)), - data: data.toJson(), - broadcast: broadcast); - Query$GetApiVersionQuery? readQuery$GetApiVersionQuery( - {bool optimistic = true}) { - final result = this.readQuery( - graphql.Request( - operation: graphql.Operation( - document: documentNodeQueryGetApiVersionQuery)), - optimistic: optimistic); - return result == null ? null : Query$GetApiVersionQuery.fromJson(result); - } -} - -@JsonSerializable(explicitToJson: true) -class Query$GetApiVersionQuery$api { - Query$GetApiVersionQuery$api( - {required this.version, required this.$__typename}); - - @override - factory Query$GetApiVersionQuery$api.fromJson(Map json) => - _$Query$GetApiVersionQuery$apiFromJson(json); - - final String version; - - @JsonKey(name: '__typename') - final String $__typename; - - Map toJson() => _$Query$GetApiVersionQuery$apiToJson(this); - int get hashCode { - final l$version = version; - final l$$__typename = $__typename; - return Object.hashAll([l$version, l$$__typename]); - } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Query$GetApiVersionQuery$api) || - runtimeType != other.runtimeType) return false; - final l$version = version; - final lOther$version = other.version; - if (l$version != lOther$version) return false; - final l$$__typename = $__typename; - final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; - return true; - } -} - -extension UtilityExtension$Query$GetApiVersionQuery$api - on Query$GetApiVersionQuery$api { - CopyWith$Query$GetApiVersionQuery$api - get copyWith => CopyWith$Query$GetApiVersionQuery$api(this, (i) => i); -} - -abstract class CopyWith$Query$GetApiVersionQuery$api { - factory CopyWith$Query$GetApiVersionQuery$api( - Query$GetApiVersionQuery$api instance, - TRes Function(Query$GetApiVersionQuery$api) then) = - _CopyWithImpl$Query$GetApiVersionQuery$api; - - factory CopyWith$Query$GetApiVersionQuery$api.stub(TRes res) = - _CopyWithStubImpl$Query$GetApiVersionQuery$api; - - TRes call({String? version, String? $__typename}); -} - -class _CopyWithImpl$Query$GetApiVersionQuery$api - implements CopyWith$Query$GetApiVersionQuery$api { - _CopyWithImpl$Query$GetApiVersionQuery$api(this._instance, this._then); - - final Query$GetApiVersionQuery$api _instance; - - final TRes Function(Query$GetApiVersionQuery$api) _then; - - static const _undefined = {}; - - TRes call({Object? version = _undefined, Object? $__typename = _undefined}) => - _then(Query$GetApiVersionQuery$api( - version: version == _undefined || version == null - ? _instance.version - : (version as String), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); -} - -class _CopyWithStubImpl$Query$GetApiVersionQuery$api - implements CopyWith$Query$GetApiVersionQuery$api { - _CopyWithStubImpl$Query$GetApiVersionQuery$api(this._res); - - TRes _res; - - call({String? version, String? $__typename}) => _res; -} diff --git a/lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql.g.dart b/lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql.g.dart deleted file mode 100644 index 0c051786..00000000 --- a/lib/logic/api_maps/graphql_maps/schema/get_api_version.graphql.g.dart +++ /dev/null @@ -1,36 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'get_api_version.graphql.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -Query$GetApiVersionQuery _$Query$GetApiVersionQueryFromJson( - Map json) => - Query$GetApiVersionQuery( - api: Query$GetApiVersionQuery$api.fromJson( - json['api'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Query$GetApiVersionQueryToJson( - Query$GetApiVersionQuery instance) => - { - 'api': instance.api.toJson(), - '__typename': instance.$__typename, - }; - -Query$GetApiVersionQuery$api _$Query$GetApiVersionQuery$apiFromJson( - Map json) => - Query$GetApiVersionQuery$api( - version: json['version'] as String, - $__typename: json['__typename'] as String, - ); - -Map _$Query$GetApiVersionQuery$apiToJson( - Query$GetApiVersionQuery$api instance) => - { - 'version': instance.version, - '__typename': instance.$__typename, - }; diff --git a/lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql b/lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql deleted file mode 100644 index 2a566271..00000000 --- a/lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql +++ /dev/null @@ -1,11 +0,0 @@ -query GetServerDiskVolumesQuery { - storage { - volumes { - freeSpace - name - root - totalSpace - usedSpace - } - } -} \ No newline at end of file diff --git a/lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql.dart deleted file mode 100644 index 007adc55..00000000 --- a/lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql.dart +++ /dev/null @@ -1,542 +0,0 @@ -import 'package:gql/ast.dart'; -import 'package:graphql/client.dart' as graphql; -import 'package:json_annotation/json_annotation.dart'; -part 'get_server_disk_volumes.graphql.g.dart'; - -@JsonSerializable(explicitToJson: true) -class Query$GetServerDiskVolumesQuery { - Query$GetServerDiskVolumesQuery( - {required this.storage, required this.$__typename}); - - @override - factory Query$GetServerDiskVolumesQuery.fromJson(Map json) => - _$Query$GetServerDiskVolumesQueryFromJson(json); - - final Query$GetServerDiskVolumesQuery$storage storage; - - @JsonKey(name: '__typename') - final String $__typename; - - Map toJson() => - _$Query$GetServerDiskVolumesQueryToJson(this); - 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$GetServerDiskVolumesQuery) || - 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; - } -} - -extension UtilityExtension$Query$GetServerDiskVolumesQuery - on Query$GetServerDiskVolumesQuery { - CopyWith$Query$GetServerDiskVolumesQuery - get copyWith => CopyWith$Query$GetServerDiskVolumesQuery(this, (i) => i); -} - -abstract class CopyWith$Query$GetServerDiskVolumesQuery { - factory CopyWith$Query$GetServerDiskVolumesQuery( - Query$GetServerDiskVolumesQuery instance, - TRes Function(Query$GetServerDiskVolumesQuery) then) = - _CopyWithImpl$Query$GetServerDiskVolumesQuery; - - factory CopyWith$Query$GetServerDiskVolumesQuery.stub(TRes res) = - _CopyWithStubImpl$Query$GetServerDiskVolumesQuery; - - TRes call( - {Query$GetServerDiskVolumesQuery$storage? storage, String? $__typename}); - CopyWith$Query$GetServerDiskVolumesQuery$storage get storage; -} - -class _CopyWithImpl$Query$GetServerDiskVolumesQuery - implements CopyWith$Query$GetServerDiskVolumesQuery { - _CopyWithImpl$Query$GetServerDiskVolumesQuery(this._instance, this._then); - - final Query$GetServerDiskVolumesQuery _instance; - - final TRes Function(Query$GetServerDiskVolumesQuery) _then; - - static const _undefined = {}; - - TRes call({Object? storage = _undefined, Object? $__typename = _undefined}) => - _then(Query$GetServerDiskVolumesQuery( - storage: storage == _undefined || storage == null - ? _instance.storage - : (storage as Query$GetServerDiskVolumesQuery$storage), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); - CopyWith$Query$GetServerDiskVolumesQuery$storage get storage { - final local$storage = _instance.storage; - return CopyWith$Query$GetServerDiskVolumesQuery$storage( - local$storage, (e) => call(storage: e)); - } -} - -class _CopyWithStubImpl$Query$GetServerDiskVolumesQuery - implements CopyWith$Query$GetServerDiskVolumesQuery { - _CopyWithStubImpl$Query$GetServerDiskVolumesQuery(this._res); - - TRes _res; - - call( - {Query$GetServerDiskVolumesQuery$storage? storage, - String? $__typename}) => - _res; - CopyWith$Query$GetServerDiskVolumesQuery$storage get storage => - CopyWith$Query$GetServerDiskVolumesQuery$storage.stub(_res); -} - -const documentNodeQueryGetServerDiskVolumesQuery = DocumentNode(definitions: [ - OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'GetServerDiskVolumesQuery'), - 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: 'freeSpace'), - 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: 'totalSpace'), - 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) - ])), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), -]); -Query$GetServerDiskVolumesQuery _parserFn$Query$GetServerDiskVolumesQuery( - Map data) => - Query$GetServerDiskVolumesQuery.fromJson(data); - -class Options$Query$GetServerDiskVolumesQuery - extends graphql.QueryOptions { - Options$Query$GetServerDiskVolumesQuery( - {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: documentNodeQueryGetServerDiskVolumesQuery, - parserFn: _parserFn$Query$GetServerDiskVolumesQuery); -} - -class WatchOptions$Query$GetServerDiskVolumesQuery - extends graphql.WatchQueryOptions { - WatchOptions$Query$GetServerDiskVolumesQuery( - {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: documentNodeQueryGetServerDiskVolumesQuery, - pollInterval: pollInterval, - eagerlyFetchResults: eagerlyFetchResults, - carryForwardDataOnException: carryForwardDataOnException, - fetchResults: fetchResults, - parserFn: _parserFn$Query$GetServerDiskVolumesQuery); -} - -class FetchMoreOptions$Query$GetServerDiskVolumesQuery - extends graphql.FetchMoreOptions { - FetchMoreOptions$Query$GetServerDiskVolumesQuery( - {required graphql.UpdateQuery updateQuery}) - : super( - updateQuery: updateQuery, - document: documentNodeQueryGetServerDiskVolumesQuery); -} - -extension ClientExtension$Query$GetServerDiskVolumesQuery - on graphql.GraphQLClient { - Future> - query$GetServerDiskVolumesQuery( - [Options$Query$GetServerDiskVolumesQuery? options]) async => - await this - .query(options ?? Options$Query$GetServerDiskVolumesQuery()); - graphql.ObservableQuery - watchQuery$GetServerDiskVolumesQuery( - [WatchOptions$Query$GetServerDiskVolumesQuery? options]) => - this.watchQuery( - options ?? WatchOptions$Query$GetServerDiskVolumesQuery()); - void writeQuery$GetServerDiskVolumesQuery( - {required Query$GetServerDiskVolumesQuery data, - bool broadcast = true}) => - this.writeQuery( - graphql.Request( - operation: graphql.Operation( - document: documentNodeQueryGetServerDiskVolumesQuery)), - data: data.toJson(), - broadcast: broadcast); - Query$GetServerDiskVolumesQuery? readQuery$GetServerDiskVolumesQuery( - {bool optimistic = true}) { - final result = this.readQuery( - graphql.Request( - operation: graphql.Operation( - document: documentNodeQueryGetServerDiskVolumesQuery)), - optimistic: optimistic); - return result == null - ? null - : Query$GetServerDiskVolumesQuery.fromJson(result); - } -} - -@JsonSerializable(explicitToJson: true) -class Query$GetServerDiskVolumesQuery$storage { - Query$GetServerDiskVolumesQuery$storage( - {required this.volumes, required this.$__typename}); - - @override - factory Query$GetServerDiskVolumesQuery$storage.fromJson( - Map json) => - _$Query$GetServerDiskVolumesQuery$storageFromJson(json); - - final List volumes; - - @JsonKey(name: '__typename') - final String $__typename; - - Map toJson() => - _$Query$GetServerDiskVolumesQuery$storageToJson(this); - int get hashCode { - final l$volumes = volumes; - final l$$__typename = $__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 (!(other is Query$GetServerDiskVolumesQuery$storage) || - runtimeType != other.runtimeType) return false; - final l$volumes = volumes; - final lOther$volumes = other.volumes; - 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; - } - - final l$$__typename = $__typename; - final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; - return true; - } -} - -extension UtilityExtension$Query$GetServerDiskVolumesQuery$storage - on Query$GetServerDiskVolumesQuery$storage { - CopyWith$Query$GetServerDiskVolumesQuery$storage< - Query$GetServerDiskVolumesQuery$storage> - get copyWith => - CopyWith$Query$GetServerDiskVolumesQuery$storage(this, (i) => i); -} - -abstract class CopyWith$Query$GetServerDiskVolumesQuery$storage { - factory CopyWith$Query$GetServerDiskVolumesQuery$storage( - Query$GetServerDiskVolumesQuery$storage instance, - TRes Function(Query$GetServerDiskVolumesQuery$storage) then) = - _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage; - - factory CopyWith$Query$GetServerDiskVolumesQuery$storage.stub(TRes res) = - _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage; - - TRes call( - {List? volumes, - String? $__typename}); - TRes volumes( - Iterable Function( - Iterable< - CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes< - Query$GetServerDiskVolumesQuery$storage$volumes>>) - _fn); -} - -class _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage - implements CopyWith$Query$GetServerDiskVolumesQuery$storage { - _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage( - this._instance, this._then); - - final Query$GetServerDiskVolumesQuery$storage _instance; - - final TRes Function(Query$GetServerDiskVolumesQuery$storage) _then; - - static const _undefined = {}; - - TRes call({Object? volumes = _undefined, Object? $__typename = _undefined}) => - _then(Query$GetServerDiskVolumesQuery$storage( - 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< - CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes< - Query$GetServerDiskVolumesQuery$storage$volumes>>) - _fn) => - call( - volumes: _fn(_instance.volumes.map((e) => - CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes( - e, (i) => i))).toList()); -} - -class _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage - implements CopyWith$Query$GetServerDiskVolumesQuery$storage { - _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage(this._res); - - TRes _res; - - call( - {List? volumes, - String? $__typename}) => - _res; - volumes(_fn) => _res; -} - -@JsonSerializable(explicitToJson: true) -class Query$GetServerDiskVolumesQuery$storage$volumes { - Query$GetServerDiskVolumesQuery$storage$volumes( - {required this.freeSpace, - required this.name, - required this.root, - required this.totalSpace, - required this.usedSpace, - required this.$__typename}); - - @override - factory Query$GetServerDiskVolumesQuery$storage$volumes.fromJson( - Map json) => - _$Query$GetServerDiskVolumesQuery$storage$volumesFromJson(json); - - final String freeSpace; - - final String name; - - final bool root; - - final String totalSpace; - - final String usedSpace; - - @JsonKey(name: '__typename') - final String $__typename; - - Map toJson() => - _$Query$GetServerDiskVolumesQuery$storage$volumesToJson(this); - int get hashCode { - final l$freeSpace = freeSpace; - final l$name = name; - final l$root = root; - final l$totalSpace = totalSpace; - final l$usedSpace = usedSpace; - final l$$__typename = $__typename; - return Object.hashAll([ - l$freeSpace, - l$name, - l$root, - l$totalSpace, - l$usedSpace, - l$$__typename - ]); - } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Query$GetServerDiskVolumesQuery$storage$volumes) || - runtimeType != other.runtimeType) return false; - final l$freeSpace = freeSpace; - final lOther$freeSpace = other.freeSpace; - if (l$freeSpace != lOther$freeSpace) return false; - final l$name = name; - final lOther$name = other.name; - if (l$name != lOther$name) return false; - final l$root = root; - final lOther$root = other.root; - if (l$root != lOther$root) return false; - final l$totalSpace = totalSpace; - final lOther$totalSpace = other.totalSpace; - if (l$totalSpace != lOther$totalSpace) 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; - return true; - } -} - -extension UtilityExtension$Query$GetServerDiskVolumesQuery$storage$volumes - on Query$GetServerDiskVolumesQuery$storage$volumes { - CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes< - Query$GetServerDiskVolumesQuery$storage$volumes> - get copyWith => CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes( - this, (i) => i); -} - -abstract class CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes { - factory CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes( - Query$GetServerDiskVolumesQuery$storage$volumes instance, - TRes Function(Query$GetServerDiskVolumesQuery$storage$volumes) then) = - _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage$volumes; - - factory CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes.stub( - TRes res) = - _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage$volumes; - - TRes call( - {String? freeSpace, - String? name, - bool? root, - String? totalSpace, - String? usedSpace, - String? $__typename}); -} - -class _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage$volumes - implements CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes { - _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage$volumes( - this._instance, this._then); - - final Query$GetServerDiskVolumesQuery$storage$volumes _instance; - - final TRes Function(Query$GetServerDiskVolumesQuery$storage$volumes) _then; - - static const _undefined = {}; - - TRes call( - {Object? freeSpace = _undefined, - Object? name = _undefined, - Object? root = _undefined, - Object? totalSpace = _undefined, - Object? usedSpace = _undefined, - Object? $__typename = _undefined}) => - _then(Query$GetServerDiskVolumesQuery$storage$volumes( - freeSpace: freeSpace == _undefined || freeSpace == null - ? _instance.freeSpace - : (freeSpace as String), - name: name == _undefined || name == null - ? _instance.name - : (name as String), - root: root == _undefined || root == null - ? _instance.root - : (root as bool), - totalSpace: totalSpace == _undefined || totalSpace == null - ? _instance.totalSpace - : (totalSpace 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$GetServerDiskVolumesQuery$storage$volumes - implements CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes { - _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage$volumes(this._res); - - TRes _res; - - call( - {String? freeSpace, - String? name, - bool? root, - String? totalSpace, - String? usedSpace, - String? $__typename}) => - _res; -} diff --git a/lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql.g.dart b/lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql.g.dart deleted file mode 100644 index ecbd5a02..00000000 --- a/lib/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql.g.dart +++ /dev/null @@ -1,64 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'get_server_disk_volumes.graphql.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -Query$GetServerDiskVolumesQuery _$Query$GetServerDiskVolumesQueryFromJson( - Map json) => - Query$GetServerDiskVolumesQuery( - storage: Query$GetServerDiskVolumesQuery$storage.fromJson( - json['storage'] as Map), - $__typename: json['__typename'] as String, - ); - -Map _$Query$GetServerDiskVolumesQueryToJson( - Query$GetServerDiskVolumesQuery instance) => - { - 'storage': instance.storage.toJson(), - '__typename': instance.$__typename, - }; - -Query$GetServerDiskVolumesQuery$storage - _$Query$GetServerDiskVolumesQuery$storageFromJson( - Map json) => - Query$GetServerDiskVolumesQuery$storage( - volumes: (json['volumes'] as List) - .map((e) => - Query$GetServerDiskVolumesQuery$storage$volumes.fromJson( - e as Map)) - .toList(), - $__typename: json['__typename'] as String, - ); - -Map _$Query$GetServerDiskVolumesQuery$storageToJson( - Query$GetServerDiskVolumesQuery$storage instance) => - { - 'volumes': instance.volumes.map((e) => e.toJson()).toList(), - '__typename': instance.$__typename, - }; - -Query$GetServerDiskVolumesQuery$storage$volumes - _$Query$GetServerDiskVolumesQuery$storage$volumesFromJson( - Map json) => - Query$GetServerDiskVolumesQuery$storage$volumes( - freeSpace: json['freeSpace'] as String, - name: json['name'] as String, - root: json['root'] as bool, - totalSpace: json['totalSpace'] as String, - usedSpace: json['usedSpace'] as String, - $__typename: json['__typename'] as String, - ); - -Map _$Query$GetServerDiskVolumesQuery$storage$volumesToJson( - Query$GetServerDiskVolumesQuery$storage$volumes instance) => - { - 'freeSpace': instance.freeSpace, - 'name': instance.name, - 'root': instance.root, - 'totalSpace': instance.totalSpace, - 'usedSpace': instance.usedSpace, - '__typename': instance.$__typename, - }; diff --git a/lib/logic/api_maps/graphql_maps/schema/schema.graphql b/lib/logic/api_maps/graphql_maps/schema/schema.graphql index 3ad04e3f..81ab4bc5 100644 --- a/lib/logic/api_maps/graphql_maps/schema/schema.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql @@ -7,18 +7,21 @@ type Alert { timestamp: DateTime } -type Storage { - volumes: [StorageVolume!]! -} - type StorageVolume { freeSpace: String! + model: String! name: String! root: Boolean! + serial: String! totalSpace: String! + type: String! usedSpace: String! } +type Storage { + volumes: [StorageVolume!]! +} + type Api { version: String! devices: [ApiDevice!]! @@ -84,6 +87,9 @@ type Mutation { getNewDeviceApiKey: ApiKeyMutationReturn! invalidateNewDeviceApiKey: GenericMutationReturn! authorizeWithNewDeviceApiKey(input: UseNewDeviceKeyInput!): DeviceApiTokenMutationReturn! + resizeVolume(name: String!): GenericMutationReturn! + unmountVolume(name: String!): GenericMutationReturn! + mountVolume(name: String!): GenericMutationReturn! } interface MutationReturnInterface { @@ -161,4 +167,4 @@ input UseNewDeviceKeyInput { input UseRecoveryKeyInput { key: String! deviceName: String! -} +} \ No newline at end of file diff --git a/lib/logic/api_maps/graphql_maps/schema/server.dart b/lib/logic/api_maps/graphql_maps/schema/server.dart index ab4fe197..4b419a15 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server.dart +++ b/lib/logic/api_maps/graphql_maps/schema/server.dart @@ -1,9 +1,8 @@ import 'package:graphql/client.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/api_map.dart'; -import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql.dart'; -import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/get_api_version.graphql.dart'; -import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_api.graphql.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/api_token.dart'; import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; @@ -12,7 +11,7 @@ class ServerApi extends ApiMap { ServerApi({ this.hasLogger = false, this.isWithToken = true, - this.authToken = '', + this.customToken = '', }) { final ServerDomain? serverDomain = getIt().serverDomain; rootAddress = serverDomain?.domainName ?? ''; @@ -22,7 +21,7 @@ class ServerApi extends ApiMap { @override bool isWithToken; @override - String authToken; + String customToken; @override String? rootAddress; @@ -73,4 +72,43 @@ class ServerApi extends ApiMap { return volumes; } + + Future mountVolume(final String volumeName) async { + try { + final GraphQLClient client = await getClient(); + final variables = + Variables$Mutation$MountVolumeMutation(name: volumeName); + final mountVolumeMutation = + Options$Mutation$MountVolumeMutation(variables: variables); + await client.mutate$MountVolumeMutation(mountVolumeMutation); + } catch (e) { + print(e); + } + } + + Future unmountVolume(final String volumeName) async { + try { + final GraphQLClient client = await getClient(); + final variables = + Variables$Mutation$UnmountVolumeMutation(name: volumeName); + final unmountVolumeMutation = + Options$Mutation$UnmountVolumeMutation(variables: variables); + await client.mutate$UnmountVolumeMutation(unmountVolumeMutation); + } catch (e) { + print(e); + } + } + + Future resizeVolume(final String volumeName) async { + try { + final GraphQLClient client = await getClient(); + final variables = + Variables$Mutation$ResizeVolumeMutation(name: volumeName); + final resizeVolumeMutation = + Options$Mutation$ResizeVolumeMutation(variables: variables); + await client.mutate$ResizeVolumeMutation(resizeVolumeMutation); + } catch (e) { + print(e); + } + } } diff --git a/lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql similarity index 65% rename from lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql rename to lib/logic/api_maps/graphql_maps/schema/server_api.graphql index df9569c0..f88b3346 100644 --- a/lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql @@ -6,4 +6,10 @@ query GetApiTokensQuery { name } } +} + +query GetApiVersionQuery { + api { + version + } } \ No newline at end of file diff --git a/lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart similarity index 61% rename from lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql.dart rename to lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart index 763ffcc4..2394d113 100644 --- a/lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart @@ -2,7 +2,7 @@ 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 'get_api_tokens.graphql.g.dart'; +part 'server_api.graphql.g.dart'; @JsonSerializable(explicitToJson: true) class Query$GetApiTokensQuery { @@ -472,3 +472,300 @@ class _CopyWithStubImpl$Query$GetApiTokensQuery$api$devices String? $__typename}) => _res; } + +@JsonSerializable(explicitToJson: true) +class Query$GetApiVersionQuery { + Query$GetApiVersionQuery({required this.api, required this.$__typename}); + + @override + factory Query$GetApiVersionQuery.fromJson(Map json) => + _$Query$GetApiVersionQueryFromJson(json); + + final Query$GetApiVersionQuery$api api; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$GetApiVersionQueryToJson(this); + 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$GetApiVersionQuery) || + 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$GetApiVersionQuery + on Query$GetApiVersionQuery { + CopyWith$Query$GetApiVersionQuery get copyWith => + CopyWith$Query$GetApiVersionQuery(this, (i) => i); +} + +abstract class CopyWith$Query$GetApiVersionQuery { + factory CopyWith$Query$GetApiVersionQuery(Query$GetApiVersionQuery instance, + TRes Function(Query$GetApiVersionQuery) then) = + _CopyWithImpl$Query$GetApiVersionQuery; + + factory CopyWith$Query$GetApiVersionQuery.stub(TRes res) = + _CopyWithStubImpl$Query$GetApiVersionQuery; + + TRes call({Query$GetApiVersionQuery$api? api, String? $__typename}); + CopyWith$Query$GetApiVersionQuery$api get api; +} + +class _CopyWithImpl$Query$GetApiVersionQuery + implements CopyWith$Query$GetApiVersionQuery { + _CopyWithImpl$Query$GetApiVersionQuery(this._instance, this._then); + + final Query$GetApiVersionQuery _instance; + + final TRes Function(Query$GetApiVersionQuery) _then; + + static const _undefined = {}; + + TRes call({Object? api = _undefined, Object? $__typename = _undefined}) => + _then(Query$GetApiVersionQuery( + api: api == _undefined || api == null + ? _instance.api + : (api as Query$GetApiVersionQuery$api), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); + CopyWith$Query$GetApiVersionQuery$api get api { + final local$api = _instance.api; + return CopyWith$Query$GetApiVersionQuery$api( + local$api, (e) => call(api: e)); + } +} + +class _CopyWithStubImpl$Query$GetApiVersionQuery + implements CopyWith$Query$GetApiVersionQuery { + _CopyWithStubImpl$Query$GetApiVersionQuery(this._res); + + TRes _res; + + call({Query$GetApiVersionQuery$api? api, String? $__typename}) => _res; + CopyWith$Query$GetApiVersionQuery$api get api => + CopyWith$Query$GetApiVersionQuery$api.stub(_res); +} + +const documentNodeQueryGetApiVersionQuery = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.query, + name: NameNode(value: 'GetApiVersionQuery'), + 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: null), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), +]); +Query$GetApiVersionQuery _parserFn$Query$GetApiVersionQuery( + Map data) => + Query$GetApiVersionQuery.fromJson(data); + +class Options$Query$GetApiVersionQuery + extends graphql.QueryOptions { + Options$Query$GetApiVersionQuery( + {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: documentNodeQueryGetApiVersionQuery, + parserFn: _parserFn$Query$GetApiVersionQuery); +} + +class WatchOptions$Query$GetApiVersionQuery + extends graphql.WatchQueryOptions { + WatchOptions$Query$GetApiVersionQuery( + {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: documentNodeQueryGetApiVersionQuery, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Query$GetApiVersionQuery); +} + +class FetchMoreOptions$Query$GetApiVersionQuery + extends graphql.FetchMoreOptions { + FetchMoreOptions$Query$GetApiVersionQuery( + {required graphql.UpdateQuery updateQuery}) + : super( + updateQuery: updateQuery, + document: documentNodeQueryGetApiVersionQuery); +} + +extension ClientExtension$Query$GetApiVersionQuery on graphql.GraphQLClient { + Future> + query$GetApiVersionQuery( + [Options$Query$GetApiVersionQuery? options]) async => + await this.query(options ?? Options$Query$GetApiVersionQuery()); + graphql.ObservableQuery + watchQuery$GetApiVersionQuery( + [WatchOptions$Query$GetApiVersionQuery? options]) => + this.watchQuery(options ?? WatchOptions$Query$GetApiVersionQuery()); + void writeQuery$GetApiVersionQuery( + {required Query$GetApiVersionQuery data, bool broadcast = true}) => + this.writeQuery( + graphql.Request( + operation: graphql.Operation( + document: documentNodeQueryGetApiVersionQuery)), + data: data.toJson(), + broadcast: broadcast); + Query$GetApiVersionQuery? readQuery$GetApiVersionQuery( + {bool optimistic = true}) { + final result = this.readQuery( + graphql.Request( + operation: graphql.Operation( + document: documentNodeQueryGetApiVersionQuery)), + optimistic: optimistic); + return result == null ? null : Query$GetApiVersionQuery.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$GetApiVersionQuery$api { + Query$GetApiVersionQuery$api( + {required this.version, required this.$__typename}); + + @override + factory Query$GetApiVersionQuery$api.fromJson(Map json) => + _$Query$GetApiVersionQuery$apiFromJson(json); + + final String version; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$GetApiVersionQuery$apiToJson(this); + int get hashCode { + final l$version = version; + final l$$__typename = $__typename; + return Object.hashAll([l$version, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$GetApiVersionQuery$api) || + runtimeType != other.runtimeType) return false; + final l$version = version; + final lOther$version = other.version; + if (l$version != lOther$version) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$GetApiVersionQuery$api + on Query$GetApiVersionQuery$api { + CopyWith$Query$GetApiVersionQuery$api + get copyWith => CopyWith$Query$GetApiVersionQuery$api(this, (i) => i); +} + +abstract class CopyWith$Query$GetApiVersionQuery$api { + factory CopyWith$Query$GetApiVersionQuery$api( + Query$GetApiVersionQuery$api instance, + TRes Function(Query$GetApiVersionQuery$api) then) = + _CopyWithImpl$Query$GetApiVersionQuery$api; + + factory CopyWith$Query$GetApiVersionQuery$api.stub(TRes res) = + _CopyWithStubImpl$Query$GetApiVersionQuery$api; + + TRes call({String? version, String? $__typename}); +} + +class _CopyWithImpl$Query$GetApiVersionQuery$api + implements CopyWith$Query$GetApiVersionQuery$api { + _CopyWithImpl$Query$GetApiVersionQuery$api(this._instance, this._then); + + final Query$GetApiVersionQuery$api _instance; + + final TRes Function(Query$GetApiVersionQuery$api) _then; + + static const _undefined = {}; + + TRes call({Object? version = _undefined, Object? $__typename = _undefined}) => + _then(Query$GetApiVersionQuery$api( + version: version == _undefined || version == null + ? _instance.version + : (version as String), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); +} + +class _CopyWithStubImpl$Query$GetApiVersionQuery$api + implements CopyWith$Query$GetApiVersionQuery$api { + _CopyWithStubImpl$Query$GetApiVersionQuery$api(this._res); + + TRes _res; + + call({String? version, String? $__typename}) => _res; +} diff --git a/lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql.g.dart b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.g.dart similarity index 67% rename from lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql.g.dart rename to lib/logic/api_maps/graphql_maps/schema/server_api.graphql.g.dart index bb5e5bae..dcb8ba01 100644 --- a/lib/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql.g.dart +++ b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.g.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'get_api_tokens.graphql.dart'; +part of 'server_api.graphql.dart'; // ************************************************************************** // JsonSerializableGenerator @@ -55,3 +55,32 @@ Map _$Query$GetApiTokensQuery$api$devicesToJson( 'name': instance.name, '__typename': instance.$__typename, }; + +Query$GetApiVersionQuery _$Query$GetApiVersionQueryFromJson( + Map json) => + Query$GetApiVersionQuery( + api: Query$GetApiVersionQuery$api.fromJson( + json['api'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Query$GetApiVersionQueryToJson( + Query$GetApiVersionQuery instance) => + { + 'api': instance.api.toJson(), + '__typename': instance.$__typename, + }; + +Query$GetApiVersionQuery$api _$Query$GetApiVersionQuery$apiFromJson( + Map json) => + Query$GetApiVersionQuery$api( + version: json['version'] as String, + $__typename: json['__typename'] as String, + ); + +Map _$Query$GetApiVersionQuery$apiToJson( + Query$GetApiVersionQuery$api instance) => + { + 'version': instance.version, + '__typename': instance.$__typename, + }; 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 fa75db17..c944efe6 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 @@ -96,11 +96,13 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { final dbSize = dbCreateResponse.data['volume']['size']; final dbServer = dbCreateResponse.data['volume']['server']; final dbName = dbCreateResponse.data['volume']['name']; + final dbDevice = dbCreateResponse.data['volume']['linux_device']; volume = ServerVolume( id: dbId, name: dbName, sizeByte: dbSize, serverId: dbServer, + linuxDevice: dbDevice, ); } catch (e) { print(e); @@ -130,11 +132,13 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { final int dbSize = rawVolume['size']; final dbServer = rawVolume['server']; final String dbName = rawVolume['name']; + final dbDevice = rawVolume['linux_device']; final volume = ServerVolume( id: dbId, name: dbName, sizeByte: dbSize, serverId: dbServer, + linuxDevice: dbDevice, ); volumes.add(volume); } @@ -159,11 +163,13 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { final int dbSize = dbGetResponse.data['volume']['size']; final int dbServer = dbGetResponse.data['volume']['server']; final String dbName = dbGetResponse.data['volume']['name']; + final dbDevice = dbGetResponse.data['volume']['linux_device']; volume = ServerVolume( id: dbId, name: dbName, sizeByte: dbSize, serverId: dbServer, + linuxDevice: dbDevice, ); } catch (e) { print(e); diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 4ed0d382..c17c1ff2 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -541,6 +541,7 @@ class ServerInstallationCubit extends Cubit { name: 'recovered_volume', sizeByte: 0, serverId: server.id, + linuxDevice: '', ), apiToken: dataState.serverDetails!.apiToken, provider: ServerProvider.hetzner, @@ -556,8 +557,7 @@ class ServerInstallationCubit extends Cubit { } Future> getServerDiskVolumes() async => - ServerApi(authToken: 'HARDCODE OUR BEARER HERE FOR NOW') - .getServerDiskVolumes(); + ServerApi().getServerDiskVolumes(); Future setAndValidateCloudflareToken(final String token) async { final ServerInstallationRecovery dataState = diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 1c94a2d0..f09599eb 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -475,6 +475,7 @@ class ServerInstallationRepository { name: '', sizeByte: 0, serverId: 0, + linuxDevice: '', ), provider: ServerProvider.unknown, id: 0, @@ -511,6 +512,7 @@ class ServerInstallationRepository { name: '', sizeByte: 0, serverId: 0, + linuxDevice: '', ), provider: ServerProvider.unknown, id: 0, @@ -547,6 +549,7 @@ class ServerInstallationRepository { name: '', serverId: 0, sizeByte: 0, + linuxDevice: '', ), provider: ServerProvider.unknown, id: 0, @@ -574,6 +577,7 @@ class ServerInstallationRepository { name: '', sizeByte: 0, serverId: 0, + linuxDevice: '', ), provider: ServerProvider.unknown, id: 0, diff --git a/lib/logic/cubit/volumes/volumes_cubit.dart b/lib/logic/cubit/volumes/volumes_cubit.dart index 2645e502..4e494f3a 100644 --- a/lib/logic/cubit/volumes/volumes_cubit.dart +++ b/lib/logic/cubit/volumes/volumes_cubit.dart @@ -1,9 +1,11 @@ import 'package:selfprivacy/config/get_it_config.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_creator.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_factory.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/hive/server_details.dart'; +import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; part 'volumes_state.dart'; @@ -18,18 +20,18 @@ class ApiVolumesCubit ); @override - void load() async { + Future load() async { if (serverInstallationCubit.state is ServerInstallationFinished) { _refetch(); } } - void refresh() async { + Future refresh() async { emit(const ApiVolumesState([], LoadingStatus.refreshing)); _refetch(); } - void _refetch() async { + Future _refetch() async { final List volumes = await providerApi.getVolumeProvider().getVolumes(); if (volumes.isNotEmpty) { @@ -39,31 +41,51 @@ class ApiVolumesCubit } } - void attachVolume(final ServerVolume volume) async { + Future attachVolume(final ServerVolume volume) async { final ServerHostingDetails server = getIt().serverDetails!; await providerApi.getVolumeProvider().attachVolume(volume.id, server.id); refresh(); } - void detachVolume(final ServerVolume volume) async { + Future detachVolume(final ServerVolume volume) async { await providerApi.getVolumeProvider().detachVolume(volume.id); refresh(); } - void resizeVolume(final ServerVolume volume, final int newSizeGb) async { - //if (volume.sizeByte < newSizeGb) { - await providerApi.getVolumeProvider().resizeVolume(volume.id, newSizeGb); + Future resizeVolume( + final ServerDiskVolume volume, + final int newSizeGb, + ) async { + final ServerVolume? providerVolume = await fetchProdiverVolume(volume); + final bool resized = await providerApi.getVolumeProvider().resizeVolume( + providerVolume!.id, + newSizeGb, + ); + + if (!resized) { + return false; + } + + await ServerApi().resizeVolume(volume.name); refresh(); - //} + return true; } - void createVolume() async { - await providerApi.getVolumeProvider().createVolume(); + Future createVolume() async { + final ServerVolume? volume = + await providerApi.getVolumeProvider().createVolume(); + await attachVolume(volume!); + + await Future.delayed(const Duration(seconds: 10)); + + final ServerDiskVolume? diskVolume = await fetchServerDiskVolume(volume); + await ServerApi().mountVolume(diskVolume!.name); refresh(); } - void deleteVolume(final ServerVolume volume) async { - await providerApi.getVolumeProvider().deleteVolume(volume.id); + Future deleteVolume(final ServerDiskVolume volume) async { + final ServerVolume? providerVolume = await fetchProdiverVolume(volume); + await providerApi.getVolumeProvider().deleteVolume(providerVolume!.id); refresh(); } @@ -71,4 +93,54 @@ class ApiVolumesCubit void clear() { emit(const ApiVolumesState.initial()); } + + Future fetchProdiverVolume( + final ServerDiskVolume volume, + ) async { + ServerVolume? fetchedVolume; + final List volumes = + await providerApi.getVolumeProvider().getVolumes(); + + for (final ServerVolume providerVolume in volumes) { + if (providerVolume.linuxDevice == null) { + continue; + } + + final String deviceId = providerVolume.linuxDevice!.split('/').last; + if (deviceId.contains(volume.model!) && + deviceId.contains(volume.serial!)) { + fetchedVolume = providerVolume; + break; + } + } + + return fetchedVolume; + } + + Future fetchServerDiskVolume( + final ServerVolume volume, + ) async { + ServerDiskVolume? fetchedVolume; + if (volume.linuxDevice == null) { + return fetchedVolume; + } + + final List volumes = + await ServerApi().getServerDiskVolumes(); + + for (final ServerDiskVolume serverDiskVolumes in volumes) { + if (serverDiskVolumes.model == null || serverDiskVolumes.serial == null) { + continue; + } + + final String deviceId = volume.linuxDevice!.split('/').last; + if (deviceId.contains(serverDiskVolumes.model!) && + deviceId.contains(serverDiskVolumes.serial!)) { + fetchedVolume = serverDiskVolumes; + break; + } + } + + return fetchedVolume; + } } diff --git a/lib/logic/models/hive/server_details.dart b/lib/logic/models/hive/server_details.dart index 44c8d5b3..3791c664 100644 --- a/lib/logic/models/hive/server_details.dart +++ b/lib/logic/models/hive/server_details.dart @@ -57,6 +57,7 @@ class ServerVolume { required this.name, required this.sizeByte, required this.serverId, + required this.linuxDevice, }); @HiveField(1) @@ -67,6 +68,8 @@ class ServerVolume { int sizeByte; @HiveField(4, defaultValue: null) int? serverId; + @HiveField(5, defaultValue: null) + String? linuxDevice; } @HiveType(typeId: 101) diff --git a/lib/logic/models/hive/server_details.g.dart b/lib/logic/models/hive/server_details.g.dart index d4ea9b01..29716607 100644 --- a/lib/logic/models/hive/server_details.g.dart +++ b/lib/logic/models/hive/server_details.g.dart @@ -75,13 +75,14 @@ class ServerVolumeAdapter extends TypeAdapter { name: fields[2] as String, sizeByte: fields[3] == null ? 10737418240 : fields[3] as int, serverId: fields[4] as int?, + linuxDevice: fields[5] as String?, ); } @override void write(BinaryWriter writer, ServerVolume obj) { writer - ..writeByte(4) + ..writeByte(5) ..writeByte(1) ..write(obj.id) ..writeByte(2) @@ -89,7 +90,9 @@ class ServerVolumeAdapter extends TypeAdapter { ..writeByte(3) ..write(obj.sizeByte) ..writeByte(4) - ..write(obj.serverId); + ..write(obj.serverId) + ..writeByte(5) + ..write(obj.linuxDevice); } @override diff --git a/lib/logic/models/json/server_disk_volume.dart b/lib/logic/models/json/server_disk_volume.dart index b7d4bfca..873b5d97 100644 --- a/lib/logic/models/json/server_disk_volume.dart +++ b/lib/logic/models/json/server_disk_volume.dart @@ -8,15 +8,21 @@ class ServerDiskVolume { _$ServerDiskVolumeFromJson(json); ServerDiskVolume({ required this.freeSpace, + required this.model, required this.name, required this.root, + required this.serial, required this.totalSpace, + required this.type, required this.usedSpace, }); final String freeSpace; + final String? model; final String name; final bool root; + final String? serial; final String totalSpace; + final String type; final String usedSpace; } diff --git a/lib/logic/models/json/server_disk_volume.g.dart b/lib/logic/models/json/server_disk_volume.g.dart index 95f5788b..81a9d86e 100644 --- a/lib/logic/models/json/server_disk_volume.g.dart +++ b/lib/logic/models/json/server_disk_volume.g.dart @@ -9,17 +9,23 @@ part of 'server_disk_volume.dart'; ServerDiskVolume _$ServerDiskVolumeFromJson(Map json) => ServerDiskVolume( 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, usedSpace: json['usedSpace'] as String, ); Map _$ServerDiskVolumeToJson(ServerDiskVolume instance) => { 'freeSpace': instance.freeSpace, + 'model': instance.model, 'name': instance.name, 'root': instance.root, + 'serial': instance.serial, 'totalSpace': instance.totalSpace, + 'type': instance.type, 'usedSpace': instance.usedSpace, }; diff --git a/lib/ui/pages/providers/providers.dart b/lib/ui/pages/providers/providers.dart index 36903d1f..fa231c45 100644 --- a/lib/ui/pages/providers/providers.dart +++ b/lib/ui/pages/providers/providers.dart @@ -122,9 +122,6 @@ class _Card extends StatelessWidget { final ServerInstallationState appConfig = context.watch().state; - final String domainName = - appConfig.isDomainFilled ? appConfig.serverDomain!.domainName : ''; - switch (provider.type) { case ProviderType.server: title = 'providers.server.card_title'.tr(); @@ -140,7 +137,8 @@ class _Card extends StatelessWidget { break; case ProviderType.domain: title = 'providers.domain.screen_title'.tr(); - message = domainName; + message = + appConfig.isDomainFilled ? appConfig.serverDomain!.domainName : ''; stableText = 'providers.domain.status'.tr(); onTap = () => Navigator.of(context).push( diff --git a/lib/ui/pages/providers/storage_card.dart b/lib/ui/pages/providers/storage_card.dart index 51c510e4..74e0770f 100644 --- a/lib/ui/pages/providers/storage_card.dart +++ b/lib/ui/pages/providers/storage_card.dart @@ -1,5 +1,3 @@ -import 'dart:ffi'; - import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:selfprivacy/logic/cubit/providers/providers_cubit.dart'; @@ -7,21 +5,9 @@ import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; import 'package:selfprivacy/ui/components/brand_linear_indicator/brand_linear_indicator.dart'; import 'package:selfprivacy/ui/components/icon_status_mask/icon_status_mask.dart'; - -class DiskVolume { - int gbUsed = 0; - int gbTotal = 0; - String name = ''; - bool root = false; - - /// from 0.0 to 1.0 - double percentage = 0.0; -} - -class DiskStatus { - bool isDiskOkay = false; - List diskVolumes = []; -} +import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; +import 'package:selfprivacy/ui/pages/server_storage/server_storage.dart'; +import 'package:selfprivacy/utils/route_transitions/basic.dart'; class StorageCard extends StatelessWidget { const StorageCard({required this.volumes, final super.key}); @@ -29,9 +15,7 @@ class StorageCard extends StatelessWidget { final List volumes; @override - Widget build( - final BuildContext context, - ) { + Widget build(final BuildContext context) { final DiskStatus diskStatus = toDiskStatus(volumes); final List sections = []; @@ -41,7 +25,11 @@ class StorageCard extends StatelessWidget { ); sections.add( Text( - 'providers.storage.disk_usage'.tr(args: [volume.gbUsed.toString()]), + 'providers.storage.disk_usage'.tr( + args: [ + volume.gbUsed.toString(), + ], + ), style: Theme.of(context).textTheme.titleMedium, ), ); @@ -63,17 +51,25 @@ class StorageCard extends StatelessWidget { ); sections.add( Text( - 'providers.storage.disk_total'.tr(args: [ - volume.gbTotal.toString(), - volume.name, - ]), + 'providers.storage.disk_total'.tr( + args: [ + volume.gbTotal.toString(), + volume.name, + ], + ), style: Theme.of(context).textTheme.bodySmall, ), ); } return GestureDetector( - onTap: null, + onTap: () => Navigator.of(context).push( + materialRoute( + ServerStoragePage( + diskStatus: diskStatus, + ), + ), + ), child: BrandCards.big( child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/ui/pages/server_storage/disk_status.dart b/lib/ui/pages/server_storage/disk_status.dart new file mode 100644 index 00000000..ec2d2872 --- /dev/null +++ b/lib/ui/pages/server_storage/disk_status.dart @@ -0,0 +1,14 @@ +class DiskVolume { + int gbUsed = 0; + int gbTotal = 0; + String name = ''; + bool root = false; + + /// from 0.0 to 1.0 + double percentage = 0.0; +} + +class DiskStatus { + bool isDiskOkay = false; + List diskVolumes = []; +} diff --git a/lib/ui/pages/server_storage/server_storage.dart b/lib/ui/pages/server_storage/server_storage.dart new file mode 100644 index 00000000..82d59c2c --- /dev/null +++ b/lib/ui/pages/server_storage/server_storage.dart @@ -0,0 +1,96 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; +import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; +import 'package:selfprivacy/ui/components/brand_linear_indicator/brand_linear_indicator.dart'; +import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; + +class ServerStoragePage extends StatefulWidget { + const ServerStoragePage({required this.diskStatus, final super.key}); + + final DiskStatus diskStatus; + + @override + State createState() => _ServerStoragePageState(); +} + +class _ServerStoragePageState extends State { + @override + Widget build(final BuildContext context) { + final bool isReady = context.watch().state + is ServerInstallationFinished; + + if (!isReady) { + return BrandHeroScreen( + hasBackButton: true, + heroTitle: 'providers.storage.card_title'.tr(), + children: const [], + ); + } + + final List sections = []; + for (final DiskVolume volume in widget.diskStatus.diskVolumes) { + sections.add( + const SizedBox(height: 16), + ); + sections.add( + Text( + 'providers.storage.disk_usage'.tr( + args: [ + volume.gbUsed.toString(), + ], + ), + style: Theme.of(context).textTheme.titleMedium, + ), + ); + sections.add( + const SizedBox(height: 4), + ); + sections.add( + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + const Icon( + Icons.storage_outlined, + size: 24, + color: Colors.white, + ), + Expanded( + child: BrandLinearIndicator( + value: volume.percentage, + color: volume.root + ? Theme.of(context).colorScheme.primary + : Theme.of(context).colorScheme.secondary, + backgroundColor: Theme.of(context).colorScheme.surfaceVariant, + height: 14.0, + ), + ), + ], + ), + ); + sections.add( + const SizedBox(height: 4), + ); + sections.add( + Text( + 'providers.storage.disk_total'.tr( + args: [ + volume.gbTotal.toString(), + volume.name, + ], + ), + style: Theme.of(context).textTheme.bodySmall, + ), + ); + } + + return BrandHeroScreen( + hasBackButton: true, + heroTitle: 'providers.storage.card_title'.tr(), + children: [ + ...sections, + const SizedBox(height: 8), + ], + ); + } +} From c230037351b9390453dbfabb2f197476b44eb9fd Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 3 Aug 2022 05:25:33 +0300 Subject: [PATCH 021/115] Implement data_migration page and logic --- assets/translations/en.json | 10 +- .../server_providers/hetzner/hetzner.dart | 21 +++ .../server_providers/volume_provider.dart | 1 + lib/logic/cubit/volumes/volumes_cubit.dart | 3 + lib/ui/pages/recovery_key/recovery_key.dart | 3 +- .../pages/server_storage/data_migration.dart | 135 ++++++++++++++++ .../server_storage/extending_volume.dart | 145 ++++++++++++++++++ .../pages/server_storage/server_storage.dart | 115 +++++++++----- 8 files changed, 393 insertions(+), 40 deletions(-) create mode 100644 lib/ui/pages/server_storage/data_migration.dart create mode 100644 lib/ui/pages/server_storage/extending_volume.dart diff --git a/assets/translations/en.json b/assets/translations/en.json index 6c48f966..708da384 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -172,7 +172,15 @@ "disk_total": "{} GB total · {}", "gb": "{} GB", "mb": "{} MB", - "extend_volume_button": "Extend volume" + "extend_volume_button": "Extend volume", + "extending_volume_title": "Extending volume", + "extending_volume_description": "Resizing volume will allow you to store more data on your server without extending the server itself. Volume can only be extended: shrinking is not possible.", + "extending_volume_price_info": "Price includes VAT and is estimated from pricing data provided by Hetzner.", + "size": "Size", + "euro": "Euro", + "data_migration_title": "Data migration", + "data_migration_notice": "During migration all services will be turned off.", + "start_migration_button": "Start migration" } }, "not_ready_card": { 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 c944efe6..098db0f9 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 @@ -74,6 +74,27 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { RegExp getApiTokenValidation() => RegExp(r'\s+|[-!$%^&*()@+|~=`{}\[\]:<>?,.\/]'); + @override + Future getPricePerGb() async { + double? price; + + final Response dbGetResponse; + final Dio client = await getClient(); + try { + dbGetResponse = await client.post('/pricing'); + + final volume = dbGetResponse.data['pricing']['volume']; + final volumePrice = volume['price_per_gb_month']['gross']; + price = volumePrice as double; + } catch (e) { + print(e); + } finally { + client.close(); + } + + return price; + } + @override Future createVolume() async { ServerVolume? volume; 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 63a692dd..bdff72f2 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 @@ -9,4 +9,5 @@ mixin VolumeProviderApi on ApiMap { Future detachVolume(final int volumeId); Future resizeVolume(final int volumeId, final int sizeGb); Future deleteVolume(final int id); + Future getPricePerGb(); } diff --git a/lib/logic/cubit/volumes/volumes_cubit.dart b/lib/logic/cubit/volumes/volumes_cubit.dart index 4e494f3a..c4f74df5 100644 --- a/lib/logic/cubit/volumes/volumes_cubit.dart +++ b/lib/logic/cubit/volumes/volumes_cubit.dart @@ -26,6 +26,9 @@ class ApiVolumesCubit } } + Future getPricePerGb() async => + providerApi.getVolumeProvider().getPricePerGb(); + Future refresh() async { emit(const ApiVolumesState([], LoadingStatus.refreshing)); _refetch(); diff --git a/lib/ui/pages/recovery_key/recovery_key.dart b/lib/ui/pages/recovery_key/recovery_key.dart index 44147f57..ba3069ae 100644 --- a/lib/ui/pages/recovery_key/recovery_key.dart +++ b/lib/ui/pages/recovery_key/recovery_key.dart @@ -294,7 +294,6 @@ class _RecoveryKeyConfigurationState extends State { } _amountController.addListener(_updateErrorStatuses); - _expirationController.addListener(_updateErrorStatuses); return Column( @@ -321,6 +320,7 @@ class _RecoveryKeyConfigurationState extends State { children: [ const SizedBox(height: 8), TextField( + textInputAction: TextInputAction.next, enabled: _isAmountToggled, controller: _amountController, decoration: InputDecoration( @@ -360,6 +360,7 @@ class _RecoveryKeyConfigurationState extends State { children: [ const SizedBox(height: 8), TextField( + textInputAction: TextInputAction.next, enabled: _isExpirationToggled, controller: _expirationController, onTap: () { diff --git a/lib/ui/pages/server_storage/data_migration.dart b/lib/ui/pages/server_storage/data_migration.dart new file mode 100644 index 00000000..8523ce1d --- /dev/null +++ b/lib/ui/pages/server_storage/data_migration.dart @@ -0,0 +1,135 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; +import 'package:selfprivacy/ui/components/brand_button/filled_button.dart'; +import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; +import 'package:selfprivacy/ui/components/brand_linear_indicator/brand_linear_indicator.dart'; +import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; +import 'package:selfprivacy/ui/pages/server_storage/extending_volume.dart'; +import 'package:selfprivacy/utils/route_transitions/basic.dart'; + +class ServerStoragePage extends StatefulWidget { + const ServerStoragePage({required this.diskStatus, final super.key}); + + final DiskStatus diskStatus; + + @override + State createState() => _ServerStoragePageState(); +} + +class _ServerStoragePageState extends State { + List _expandedSections = []; + + @override + Widget build(final BuildContext context) { + final bool isReady = context.watch().state + is ServerInstallationFinished; + + if (!isReady) { + return BrandHeroScreen( + hasBackButton: true, + heroTitle: 'providers.storage.card_title'.tr(), + children: const [], + ); + } + + /// The first section is expanded, the rest are hidden by default. + /// ( true, false, false, etc... ) + _expandedSections = [ + true, + ...List.filled( + widget.diskStatus.diskVolumes.length - 1, + false, + ), + ]; + + int sectionId = 0; + final List sections = []; + for (final DiskVolume volume in widget.diskStatus.diskVolumes) { + sections.add( + const SizedBox(height: 16), + ); + sections.add( + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + const Icon( + Icons.storage_outlined, + size: 24, + color: Colors.white, + ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Text( + 'providers.storage.disk_usage'.tr( + args: [ + volume.gbUsed.toString(), + ], + ), + style: Theme.of(context).textTheme.titleMedium, + ), + Expanded( + child: BrandLinearIndicator( + value: volume.percentage, + color: volume.root + ? Theme.of(context).colorScheme.primary + : Theme.of(context).colorScheme.secondary, + backgroundColor: + Theme.of(context).colorScheme.surfaceVariant, + height: 14.0, + ), + ), + Text( + 'providers.storage.disk_total'.tr( + args: [ + volume.gbTotal.toString(), + volume.name, + ], + ), + style: Theme.of(context).textTheme.bodySmall, + ), + ], + ), + ), + ], + ), + ), + ); + sections.add( + AnimatedCrossFade( + duration: const Duration(milliseconds: 200), + crossFadeState: _expandedSections[sectionId] + ? CrossFadeState.showFirst + : CrossFadeState.showSecond, + firstChild: FilledButton( + title: 'providers.extend_volume_button.title'.tr(), + onPressed: () => Navigator.of(context).push( + materialRoute( + ExtendingVolumePage( + diskVolume: volume, + ), + ), + ), + ), + secondChild: Container(), + ), + ); + + ++sectionId; + } + + return BrandHeroScreen( + hasBackButton: true, + heroTitle: 'providers.storage.card_title'.tr(), + children: [ + ...sections, + const SizedBox(height: 8), + ], + ); + } +} diff --git a/lib/ui/pages/server_storage/extending_volume.dart b/lib/ui/pages/server_storage/extending_volume.dart new file mode 100644 index 00000000..43ad38c2 --- /dev/null +++ b/lib/ui/pages/server_storage/extending_volume.dart @@ -0,0 +1,145 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; +import 'package:selfprivacy/logic/cubit/volumes/volumes_cubit.dart'; +import 'package:selfprivacy/ui/components/brand_button/filled_button.dart'; +import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; +import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; + +class ExtendingVolumePage extends StatefulWidget { + const ExtendingVolumePage({required this.diskVolume, final super.key}); + + final DiskVolume diskVolume; + + @override + State createState() => _ExtendingVolumePageState(); +} + +class _ExtendingVolumePageState extends State { + bool _isSizeError = false; + bool _isPriceError = false; + + double _currentSliderGbValue = 20.0; + double _euroPerGb = 1.0; + + final double maxGb = 500.0; + double minGb = 0.0; + + final TextEditingController _sizeController = TextEditingController(); + late final TextEditingController _priceController; + + void _updateByPrice() { + final double price = double.parse(_priceController.text); + _currentSliderGbValue = price / _euroPerGb; + _sizeController.text = _currentSliderGbValue.round.toString(); + + /// Now we need to convert size back to price to round + /// it properly and display it in text field as well, + /// because size in GB can ONLY(!) be discrete. + _updateBySize(); + } + + void _updateBySize() { + final double size = double.parse(_sizeController.text); + _priceController.text = (size * _euroPerGb).toString(); + _updateErrorStatuses(); + } + + void _updateErrorStatuses() { + final bool error = minGb > _currentSliderGbValue; + _isSizeError = error; + _isPriceError = error; + } + + @override + Widget build(final BuildContext context) => FutureBuilder( + future: context.read().getPricePerGb(), + builder: ( + final BuildContext context, + final AsyncSnapshot snapshot, + ) { + _euroPerGb = snapshot.data as double; + _sizeController.text = _currentSliderGbValue.toString(); + _priceController.text = + (_euroPerGb * double.parse(_sizeController.text)).toString(); + _sizeController.addListener(_updateBySize); + _priceController.addListener(_updateByPrice); + minGb = widget.diskVolume.gbTotal + 1 < maxGb + ? widget.diskVolume.gbTotal + 1 + : maxGb; + + return BrandHeroScreen( + hasBackButton: true, + heroTitle: 'providers.storage.extending_volume_title'.tr(), + heroSubtitle: 'providers.storage.extending_volume_description'.tr(), + children: [ + const SizedBox(height: 16), + Row( + children: [ + TextField( + textInputAction: TextInputAction.next, + enabled: true, + controller: _sizeController, + decoration: InputDecoration( + border: const OutlineInputBorder(), + errorText: _isSizeError ? ' ' : null, + labelText: 'providers.storage.size'.tr(), + ), + keyboardType: TextInputType.number, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly, + ], // Only numbers can be entered + ), + const SizedBox(height: 16), + TextField( + textInputAction: TextInputAction.next, + enabled: true, + controller: _priceController, + decoration: InputDecoration( + border: const OutlineInputBorder(), + errorText: _isPriceError ? ' ' : null, + labelText: 'providers.storage.euro'.tr(), + ), + keyboardType: TextInputType.number, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly, + ], // Only numbers can be entered + ), + ], + ), + const SizedBox(height: 16), + Slider( + min: minGb, + value: widget.diskVolume.gbTotal + 5 < maxGb + ? widget.diskVolume.gbTotal + 5 + : maxGb, + max: maxGb, + divisions: 1, + label: _currentSliderGbValue.round().toString(), + onChanged: (final double value) { + setState(() { + _currentSliderGbValue = value; + _updateErrorStatuses(); + }); + }, + ), + const SizedBox(height: 16), + FilledButton( + title: 'providers.extend_volume_button.title'.tr(), + onPressed: null, + ), + const SizedBox(height: 16), + const Divider( + height: 1.0, + ), + const SizedBox(height: 16), + const Icon(Icons.info_outlined, size: 24), + const SizedBox(height: 16), + Text('providers.storage.extending_volume_price_info'.tr()), + const SizedBox(height: 16), + ], + ); + }, + ); +} diff --git a/lib/ui/pages/server_storage/server_storage.dart b/lib/ui/pages/server_storage/server_storage.dart index 82d59c2c..8523ce1d 100644 --- a/lib/ui/pages/server_storage/server_storage.dart +++ b/lib/ui/pages/server_storage/server_storage.dart @@ -1,9 +1,12 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; +import 'package:selfprivacy/ui/components/brand_button/filled_button.dart'; import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; import 'package:selfprivacy/ui/components/brand_linear_indicator/brand_linear_indicator.dart'; import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; +import 'package:selfprivacy/ui/pages/server_storage/extending_volume.dart'; +import 'package:selfprivacy/utils/route_transitions/basic.dart'; class ServerStoragePage extends StatefulWidget { const ServerStoragePage({required this.diskStatus, final super.key}); @@ -15,6 +18,8 @@ class ServerStoragePage extends StatefulWidget { } class _ServerStoragePageState extends State { + List _expandedSections = []; + @override Widget build(final BuildContext context) { final bool isReady = context.watch().state @@ -28,60 +33,94 @@ class _ServerStoragePageState extends State { ); } + /// The first section is expanded, the rest are hidden by default. + /// ( true, false, false, etc... ) + _expandedSections = [ + true, + ...List.filled( + widget.diskStatus.diskVolumes.length - 1, + false, + ), + ]; + + int sectionId = 0; final List sections = []; for (final DiskVolume volume in widget.diskStatus.diskVolumes) { sections.add( const SizedBox(height: 16), ); sections.add( - Text( - 'providers.storage.disk_usage'.tr( - args: [ - volume.gbUsed.toString(), + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + const Icon( + Icons.storage_outlined, + size: 24, + color: Colors.white, + ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Text( + 'providers.storage.disk_usage'.tr( + args: [ + volume.gbUsed.toString(), + ], + ), + style: Theme.of(context).textTheme.titleMedium, + ), + Expanded( + child: BrandLinearIndicator( + value: volume.percentage, + color: volume.root + ? Theme.of(context).colorScheme.primary + : Theme.of(context).colorScheme.secondary, + backgroundColor: + Theme.of(context).colorScheme.surfaceVariant, + height: 14.0, + ), + ), + Text( + 'providers.storage.disk_total'.tr( + args: [ + volume.gbTotal.toString(), + volume.name, + ], + ), + style: Theme.of(context).textTheme.bodySmall, + ), + ], + ), + ), ], ), - style: Theme.of(context).textTheme.titleMedium, ), ); sections.add( - const SizedBox(height: 4), - ); - sections.add( - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - const Icon( - Icons.storage_outlined, - size: 24, - color: Colors.white, - ), - Expanded( - child: BrandLinearIndicator( - value: volume.percentage, - color: volume.root - ? Theme.of(context).colorScheme.primary - : Theme.of(context).colorScheme.secondary, - backgroundColor: Theme.of(context).colorScheme.surfaceVariant, - height: 14.0, + AnimatedCrossFade( + duration: const Duration(milliseconds: 200), + crossFadeState: _expandedSections[sectionId] + ? CrossFadeState.showFirst + : CrossFadeState.showSecond, + firstChild: FilledButton( + title: 'providers.extend_volume_button.title'.tr(), + onPressed: () => Navigator.of(context).push( + materialRoute( + ExtendingVolumePage( + diskVolume: volume, + ), ), ), - ], - ), - ); - sections.add( - const SizedBox(height: 4), - ); - sections.add( - Text( - 'providers.storage.disk_total'.tr( - args: [ - volume.gbTotal.toString(), - volume.name, - ], ), - style: Theme.of(context).textTheme.bodySmall, + secondChild: Container(), ), ); + + ++sectionId; } return BrandHeroScreen( From 7bbdaf2ebe25cc2763c54a953ef135cd540b6576 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 24 Aug 2022 08:35:49 +0300 Subject: [PATCH 022/115] Last changes on storage pages and job backend logic --- assets/translations/en.json | 13 +- assets/translations/ru.json | 4 +- lib/config/bloc_config.dart | 5 + lib/logic/api_maps/graphql_maps/api_map.dart | 33 +- .../graphql_maps/schema/disk_volumes.graphql | 59 +- .../schema/disk_volumes.graphql.dart | 2221 ++++---- .../schema/disk_volumes.graphql.g.dart | 345 +- .../graphql_maps/schema/schema.graphql | 295 +- .../graphql_maps/schema/schema.graphql.dart | 405 +- .../graphql_maps/schema/schema.graphql.g.dart | 76 + .../api_maps/graphql_maps/schema/server.dart | 153 +- .../graphql_maps/schema/server_api.graphql | 127 +- .../schema/server_api.graphql.dart | 4833 +++++++++++++++-- .../schema/server_api.graphql.g.dart | 727 ++- .../schema/server_settings.graphql | 54 + .../schema/server_settings.graphql.dart | 1707 ++++++ .../schema/server_settings.graphql.g.dart | 300 + .../graphql_maps/schema/services.graphql | 84 + .../graphql_maps/schema/services.graphql.dart | 2771 ++++++++++ .../schema/services.graphql.g.dart | 482 ++ .../graphql_maps/schema/users.graphql | 76 + .../graphql_maps/schema/users.graphql.dart | 2642 +++++++++ .../graphql_maps/schema/users.graphql.g.dart | 471 ++ lib/logic/api_maps/rest_maps/server.dart | 4 +- .../server_providers/hetzner/hetzner.dart | 4 +- lib/logic/cubit/jobs/jobs_cubit.dart | 80 +- lib/logic/cubit/jobs/jobs_state.dart | 26 +- .../server_installation_repository.dart | 37 + lib/logic/cubit/volumes/volumes_cubit.dart | 39 +- lib/logic/models/disk_size.dart | 9 + lib/logic/models/job.dart | 14 +- lib/logic/models/json/backup.g.dart | 2 +- .../models/json/hetzner_server_info.g.dart | 2 +- lib/logic/models/json/server_job.dart | 39 + lib/logic/models/json/server_job.g.dart | 35 + .../brand_button/outlined_button.dart | 34 + .../components/jobs_content/jobs_content.dart | 2 +- .../components/progress_bar/progress_bar.dart | 18 +- lib/ui/pages/providers/providers.dart | 94 +- lib/ui/pages/providers/storage_card.dart | 128 +- .../pages/server_storage/data_migration.dart | 142 +- lib/ui/pages/server_storage/disk_status.dart | 11 +- .../server_storage/extending_volume.dart | 144 +- .../pages/server_storage/server_storage.dart | 147 +- .../server_storage_list_item.dart | 74 + lib/ui/pages/services/service_page.dart | 87 + lib/ui/pages/services/services.dart | 4 +- lib/ui/pages/setup/initializing.dart | 2 +- lib/ui/pages/ssh_keys/new_ssh_key.dart | 2 +- lib/ui/pages/users/new_user.dart | 2 +- 50 files changed, 16907 insertions(+), 2158 deletions(-) create mode 100644 lib/logic/api_maps/graphql_maps/schema/server_settings.graphql create mode 100644 lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart create mode 100644 lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.g.dart create mode 100644 lib/logic/api_maps/graphql_maps/schema/services.graphql create mode 100644 lib/logic/api_maps/graphql_maps/schema/services.graphql.dart create mode 100644 lib/logic/api_maps/graphql_maps/schema/services.graphql.g.dart create mode 100644 lib/logic/api_maps/graphql_maps/schema/users.graphql create mode 100644 lib/logic/api_maps/graphql_maps/schema/users.graphql.dart create mode 100644 lib/logic/api_maps/graphql_maps/schema/users.graphql.g.dart create mode 100644 lib/logic/models/disk_size.dart create mode 100644 lib/logic/models/json/server_job.dart create mode 100644 lib/logic/models/json/server_job.g.dart create mode 100644 lib/ui/components/brand_button/outlined_button.dart create mode 100644 lib/ui/pages/server_storage/server_storage_list_item.dart create mode 100644 lib/ui/pages/services/service_page.dart diff --git a/assets/translations/en.json b/assets/translations/en.json index 53fb30d9..52409913 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -256,6 +256,15 @@ "bottom_sheet": { "1": "Openconnect VPN Server. Engine for secure and scalable VPN infrastructure" } + }, + "page": { + "up_and_running": "Up and running", + "resource_usage": "Resource usage", + "disk_used": "{} of disk space used", + "users": "Users", + "controlled_by": "Controlled by {}", + "apps": "Apps", + "settings": "Settings and maintenance" } }, "users": { @@ -395,8 +404,10 @@ }, "modals": { "_comment": "messages in modals", - "1": "Server with such name, already exist", + "1": "Server with such name, already exist.", + "1_1": "Unexpected error during placement from the provider side.", "2": "Destroy server and create a new one?", + "2_2": "Try again?", "3": "Are you sure?", "4": "Purge all authentication keys?", "5": "Yes, purge all my tokens", diff --git a/assets/translations/ru.json b/assets/translations/ru.json index a93e122a..40bb2a9a 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -375,8 +375,10 @@ }, "modals": { "_comment": "messages in modals", - "1": "Сервер с таким именем уже существует", + "1": "Сервер с таким именем уже существует.", + "1.1": "Непредвиденная ошибка при создании со стороны провайдера.", "2": "Уничтожить сервер и создать новый?", + "2.2": "Попробовать ещё раз?", "3": "Подтвердите", "4": "Сбросить все ключи?", "5": "Да, сбросить", diff --git a/lib/config/bloc_config.dart b/lib/config/bloc_config.dart index 3946d3b9..94508aa4 100644 --- a/lib/config/bloc_config.dart +++ b/lib/config/bloc_config.dart @@ -10,6 +10,7 @@ import 'package:selfprivacy/logic/cubit/jobs/jobs_cubit.dart'; import 'package:selfprivacy/logic/cubit/providers/providers_cubit.dart'; import 'package:selfprivacy/logic/cubit/services/services_cubit.dart'; import 'package:selfprivacy/logic/cubit/users/users_cubit.dart'; +import 'package:selfprivacy/logic/cubit/volumes/volumes_cubit.dart'; class BlocAndProviderConfig extends StatelessWidget { const BlocAndProviderConfig({final super.key, this.child}); @@ -26,6 +27,7 @@ class BlocAndProviderConfig extends StatelessWidget { final dnsRecordsCubit = DnsRecordsCubit(serverInstallationCubit); final recoveryKeyCubit = RecoveryKeyCubit(serverInstallationCubit); final apiDevicesCubit = ApiDevicesCubit(serverInstallationCubit); + final apiVolumesCubit = ApiVolumesCubit(serverInstallationCubit); return MultiProvider( providers: [ BlocProvider( @@ -60,6 +62,9 @@ class BlocAndProviderConfig extends StatelessWidget { BlocProvider( create: (final _) => apiDevicesCubit..load(), ), + BlocProvider( + create: (final _) => apiVolumesCubit..load(), + ), BlocProvider( create: (final _) => JobsCubit(usersCubit: usersCubit, servicesCubit: servicesCubit), diff --git a/lib/logic/api_maps/graphql_maps/api_map.dart b/lib/logic/api_maps/graphql_maps/api_map.dart index c9240f00..c01f1837 100644 --- a/lib/logic/api_maps/graphql_maps/api_map.dart +++ b/lib/logic/api_maps/graphql_maps/api_map.dart @@ -7,11 +7,12 @@ abstract class ApiMap { 'https://api.$rootAddress/graphql', ); + final String token = _getApiToken(); + final Link graphQLLink = isWithToken ? AuthLink( - getToken: () async => customToken == '' - ? getIt().serverDetails!.apiToken - : customToken, + getToken: () async => + customToken == '' ? 'Bearer $token' : customToken, ).concat(httpLink) : httpLink; @@ -21,6 +22,32 @@ abstract class ApiMap { ); } + Future getSubscriptionClient() async { + final String token = _getApiToken(); + + final WebSocketLink webSocketLink = WebSocketLink( + 'ws://api.$rootAddress/graphql', + config: SocketClientConfig( + autoReconnect: true, + headers: token.isEmpty ? null : {'Authorization': 'Bearer $token'}, + ), + ); + + return GraphQLClient( + cache: GraphQLCache(), + link: webSocketLink, + ); + } + + String _getApiToken() { + String token = ''; + final serverDetails = getIt().serverDetails; + if (serverDetails != null) { + token = getIt().serverDetails!.apiToken; + } + return token; + } + abstract final String? rootAddress; abstract final bool hasLogger; abstract final bool isWithToken; diff --git a/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql index c85d05d9..a5947f5e 100644 --- a/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql @@ -1,4 +1,10 @@ -query GetServerDiskVolumesQuery { +fragment basicMutationReturnFields on MutationReturnInterface{ + code + message + success +} + +query GetServerDiskVolumes { storage { volumes { freeSpace @@ -8,31 +14,56 @@ query GetServerDiskVolumesQuery { serial totalSpace type + usages { + title + usedSpace + __typename + ... on ServiceStorageUsage { + service { + id + isMovable + displayName + } + } + } usedSpace } } } -mutation MountVolumeMutation($name: String!) { +mutation MountVolume($name: String!) { mountVolume(name: $name) { - code - message - success + ...basicMutationReturnFields } } -mutation ResizeVolumeMutation($name: String!) { +mutation ResizeVolume($name: String!) { resizeVolume(name: $name) { - code - message - success + ...basicMutationReturnFields } } -mutation UnmountVolumeMutation($name: String!) { +mutation UnmountVolume($name: String!) { unmountVolume(name: $name) { - code - message - success + ...basicMutationReturnFields } -} \ No newline at end of file +} + +mutation MigrateToBinds($input: MigrateToBindsInput!) { + migrateToBinds(input: $input) { + ...basicMutationReturnFields + job { + createdAt + description + error + finishedAt + name + progress + result + status + statusText + uid + updatedAt + } + } +} 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 527b7168..c435da09 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 @@ -2,24 +2,156 @@ 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 'disk_volumes.graphql.g.dart'; @JsonSerializable(explicitToJson: true) -class Query$GetServerDiskVolumesQuery { - Query$GetServerDiskVolumesQuery( - {required this.storage, required this.$__typename}); +class Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields( + {required this.code, + required this.message, + required this.success, + required this.$__typename}); @override - factory Query$GetServerDiskVolumesQuery.fromJson(Map json) => - _$Query$GetServerDiskVolumesQueryFromJson(json); + factory Fragment$basicMutationReturnFields.fromJson( + Map json) => + _$Fragment$basicMutationReturnFieldsFromJson(json); - final Query$GetServerDiskVolumesQuery$storage storage; + final int code; + + final String message; + + final bool success; @JsonKey(name: '__typename') final String $__typename; Map toJson() => - _$Query$GetServerDiskVolumesQueryToJson(this); + _$Fragment$basicMutationReturnFieldsToJson(this); + 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) || + 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 + on Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields copyWith( + {int? code, String? message, bool? success, String? $__typename}) => + Fragment$basicMutationReturnFields( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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) + ])); +const documentNodeFragmentbasicMutationReturnFields = + DocumentNode(definitions: [ + fragmentDefinitionbasicMutationReturnFields, +]); + +extension ClientExtension$Fragment$basicMutationReturnFields + on graphql.GraphQLClient { + 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); + return result == null + ? null + : Fragment$basicMutationReturnFields.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$GetServerDiskVolumes { + Query$GetServerDiskVolumes( + {required this.storage, required this.$__typename}); + + @override + factory Query$GetServerDiskVolumes.fromJson(Map json) => + _$Query$GetServerDiskVolumesFromJson(json); + + final Query$GetServerDiskVolumes$storage storage; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$GetServerDiskVolumesToJson(this); int get hashCode { final l$storage = storage; final l$$__typename = $__typename; @@ -29,7 +161,7 @@ class Query$GetServerDiskVolumesQuery { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Query$GetServerDiskVolumesQuery) || + if (!(other is Query$GetServerDiskVolumes) || runtimeType != other.runtimeType) return false; final l$storage = storage; final lOther$storage = other.storage; @@ -41,69 +173,19 @@ class Query$GetServerDiskVolumesQuery { } } -extension UtilityExtension$Query$GetServerDiskVolumesQuery - on Query$GetServerDiskVolumesQuery { - CopyWith$Query$GetServerDiskVolumesQuery - get copyWith => CopyWith$Query$GetServerDiskVolumesQuery(this, (i) => i); +extension UtilityExtension$Query$GetServerDiskVolumes + on Query$GetServerDiskVolumes { + Query$GetServerDiskVolumes copyWith( + {Query$GetServerDiskVolumes$storage? storage, String? $__typename}) => + Query$GetServerDiskVolumes( + storage: storage == null ? this.storage : storage, + $__typename: $__typename == null ? this.$__typename : $__typename); } -abstract class CopyWith$Query$GetServerDiskVolumesQuery { - factory CopyWith$Query$GetServerDiskVolumesQuery( - Query$GetServerDiskVolumesQuery instance, - TRes Function(Query$GetServerDiskVolumesQuery) then) = - _CopyWithImpl$Query$GetServerDiskVolumesQuery; - - factory CopyWith$Query$GetServerDiskVolumesQuery.stub(TRes res) = - _CopyWithStubImpl$Query$GetServerDiskVolumesQuery; - - TRes call( - {Query$GetServerDiskVolumesQuery$storage? storage, String? $__typename}); - CopyWith$Query$GetServerDiskVolumesQuery$storage get storage; -} - -class _CopyWithImpl$Query$GetServerDiskVolumesQuery - implements CopyWith$Query$GetServerDiskVolumesQuery { - _CopyWithImpl$Query$GetServerDiskVolumesQuery(this._instance, this._then); - - final Query$GetServerDiskVolumesQuery _instance; - - final TRes Function(Query$GetServerDiskVolumesQuery) _then; - - static const _undefined = {}; - - TRes call({Object? storage = _undefined, Object? $__typename = _undefined}) => - _then(Query$GetServerDiskVolumesQuery( - storage: storage == _undefined || storage == null - ? _instance.storage - : (storage as Query$GetServerDiskVolumesQuery$storage), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); - CopyWith$Query$GetServerDiskVolumesQuery$storage get storage { - final local$storage = _instance.storage; - return CopyWith$Query$GetServerDiskVolumesQuery$storage( - local$storage, (e) => call(storage: e)); - } -} - -class _CopyWithStubImpl$Query$GetServerDiskVolumesQuery - implements CopyWith$Query$GetServerDiskVolumesQuery { - _CopyWithStubImpl$Query$GetServerDiskVolumesQuery(this._res); - - TRes _res; - - call( - {Query$GetServerDiskVolumesQuery$storage? storage, - String? $__typename}) => - _res; - CopyWith$Query$GetServerDiskVolumesQuery$storage get storage => - CopyWith$Query$GetServerDiskVolumesQuery$storage.stub(_res); -} - -const documentNodeQueryGetServerDiskVolumesQuery = DocumentNode(definitions: [ +const documentNodeQueryGetServerDiskVolumes = DocumentNode(definitions: [ OperationDefinitionNode( type: OperationType.query, - name: NameNode(value: 'GetServerDiskVolumesQuery'), + name: NameNode(value: 'GetServerDiskVolumes'), variableDefinitions: [], directives: [], selectionSet: SelectionSetNode(selections: [ @@ -161,6 +243,77 @@ const documentNodeQueryGetServerDiskVolumesQuery = DocumentNode(definitions: [ 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: '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, @@ -189,13 +342,13 @@ const documentNodeQueryGetServerDiskVolumesQuery = DocumentNode(definitions: [ selectionSet: null) ])), ]); -Query$GetServerDiskVolumesQuery _parserFn$Query$GetServerDiskVolumesQuery( +Query$GetServerDiskVolumes _parserFn$Query$GetServerDiskVolumes( Map data) => - Query$GetServerDiskVolumesQuery.fromJson(data); + Query$GetServerDiskVolumes.fromJson(data); -class Options$Query$GetServerDiskVolumesQuery - extends graphql.QueryOptions { - Options$Query$GetServerDiskVolumesQuery( +class Options$Query$GetServerDiskVolumes + extends graphql.QueryOptions { + Options$Query$GetServerDiskVolumes( {String? operationName, graphql.FetchPolicy? fetchPolicy, graphql.ErrorPolicy? errorPolicy, @@ -211,13 +364,13 @@ class Options$Query$GetServerDiskVolumesQuery optimisticResult: optimisticResult, pollInterval: pollInterval, context: context, - document: documentNodeQueryGetServerDiskVolumesQuery, - parserFn: _parserFn$Query$GetServerDiskVolumesQuery); + document: documentNodeQueryGetServerDiskVolumes, + parserFn: _parserFn$Query$GetServerDiskVolumes); } -class WatchOptions$Query$GetServerDiskVolumesQuery - extends graphql.WatchQueryOptions { - WatchOptions$Query$GetServerDiskVolumesQuery( +class WatchOptions$Query$GetServerDiskVolumes + extends graphql.WatchQueryOptions { + WatchOptions$Query$GetServerDiskVolumes( {String? operationName, graphql.FetchPolicy? fetchPolicy, graphql.ErrorPolicy? errorPolicy, @@ -235,74 +388,68 @@ class WatchOptions$Query$GetServerDiskVolumesQuery cacheRereadPolicy: cacheRereadPolicy, optimisticResult: optimisticResult, context: context, - document: documentNodeQueryGetServerDiskVolumesQuery, + document: documentNodeQueryGetServerDiskVolumes, pollInterval: pollInterval, eagerlyFetchResults: eagerlyFetchResults, carryForwardDataOnException: carryForwardDataOnException, fetchResults: fetchResults, - parserFn: _parserFn$Query$GetServerDiskVolumesQuery); + parserFn: _parserFn$Query$GetServerDiskVolumes); } -class FetchMoreOptions$Query$GetServerDiskVolumesQuery +class FetchMoreOptions$Query$GetServerDiskVolumes extends graphql.FetchMoreOptions { - FetchMoreOptions$Query$GetServerDiskVolumesQuery( + FetchMoreOptions$Query$GetServerDiskVolumes( {required graphql.UpdateQuery updateQuery}) : super( updateQuery: updateQuery, - document: documentNodeQueryGetServerDiskVolumesQuery); + document: documentNodeQueryGetServerDiskVolumes); } -extension ClientExtension$Query$GetServerDiskVolumesQuery - on graphql.GraphQLClient { - Future> - query$GetServerDiskVolumesQuery( - [Options$Query$GetServerDiskVolumesQuery? options]) async => - await this - .query(options ?? Options$Query$GetServerDiskVolumesQuery()); - graphql.ObservableQuery - watchQuery$GetServerDiskVolumesQuery( - [WatchOptions$Query$GetServerDiskVolumesQuery? options]) => - this.watchQuery( - options ?? WatchOptions$Query$GetServerDiskVolumesQuery()); - void writeQuery$GetServerDiskVolumesQuery( - {required Query$GetServerDiskVolumesQuery data, - bool broadcast = true}) => +extension ClientExtension$Query$GetServerDiskVolumes on graphql.GraphQLClient { + Future> + query$GetServerDiskVolumes( + [Options$Query$GetServerDiskVolumes? options]) async => + await this.query(options ?? Options$Query$GetServerDiskVolumes()); + graphql.ObservableQuery + watchQuery$GetServerDiskVolumes( + [WatchOptions$Query$GetServerDiskVolumes? options]) => + this.watchQuery(options ?? WatchOptions$Query$GetServerDiskVolumes()); + void writeQuery$GetServerDiskVolumes( + {required Query$GetServerDiskVolumes data, bool broadcast = true}) => this.writeQuery( graphql.Request( operation: graphql.Operation( - document: documentNodeQueryGetServerDiskVolumesQuery)), + document: documentNodeQueryGetServerDiskVolumes)), data: data.toJson(), broadcast: broadcast); - Query$GetServerDiskVolumesQuery? readQuery$GetServerDiskVolumesQuery( + Query$GetServerDiskVolumes? readQuery$GetServerDiskVolumes( {bool optimistic = true}) { final result = this.readQuery( graphql.Request( operation: graphql.Operation( - document: documentNodeQueryGetServerDiskVolumesQuery)), + document: documentNodeQueryGetServerDiskVolumes)), optimistic: optimistic); - return result == null - ? null - : Query$GetServerDiskVolumesQuery.fromJson(result); + return result == null ? null : Query$GetServerDiskVolumes.fromJson(result); } } @JsonSerializable(explicitToJson: true) -class Query$GetServerDiskVolumesQuery$storage { - Query$GetServerDiskVolumesQuery$storage( +class Query$GetServerDiskVolumes$storage { + Query$GetServerDiskVolumes$storage( {required this.volumes, required this.$__typename}); @override - factory Query$GetServerDiskVolumesQuery$storage.fromJson( + factory Query$GetServerDiskVolumes$storage.fromJson( Map json) => - _$Query$GetServerDiskVolumesQuery$storageFromJson(json); + _$Query$GetServerDiskVolumes$storageFromJson(json); - final List volumes; + final List volumes; @JsonKey(name: '__typename') final String $__typename; Map toJson() => - _$Query$GetServerDiskVolumesQuery$storageToJson(this); + _$Query$GetServerDiskVolumes$storageToJson(this); int get hashCode { final l$volumes = volumes; final l$$__typename = $__typename; @@ -313,7 +460,7 @@ class Query$GetServerDiskVolumesQuery$storage { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Query$GetServerDiskVolumesQuery$storage) || + if (!(other is Query$GetServerDiskVolumes$storage) || runtimeType != other.runtimeType) return false; final l$volumes = volumes; final lOther$volumes = other.volumes; @@ -331,118 +478,58 @@ class Query$GetServerDiskVolumesQuery$storage { } } -extension UtilityExtension$Query$GetServerDiskVolumesQuery$storage - on Query$GetServerDiskVolumesQuery$storage { - CopyWith$Query$GetServerDiskVolumesQuery$storage< - Query$GetServerDiskVolumesQuery$storage> - get copyWith => - CopyWith$Query$GetServerDiskVolumesQuery$storage(this, (i) => i); -} - -abstract class CopyWith$Query$GetServerDiskVolumesQuery$storage { - factory CopyWith$Query$GetServerDiskVolumesQuery$storage( - Query$GetServerDiskVolumesQuery$storage instance, - TRes Function(Query$GetServerDiskVolumesQuery$storage) then) = - _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage; - - factory CopyWith$Query$GetServerDiskVolumesQuery$storage.stub(TRes res) = - _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage; - - TRes call( - {List? volumes, - String? $__typename}); - TRes volumes( - Iterable Function( - Iterable< - CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes< - Query$GetServerDiskVolumesQuery$storage$volumes>>) - _fn); -} - -class _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage - implements CopyWith$Query$GetServerDiskVolumesQuery$storage { - _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage( - this._instance, this._then); - - final Query$GetServerDiskVolumesQuery$storage _instance; - - final TRes Function(Query$GetServerDiskVolumesQuery$storage) _then; - - static const _undefined = {}; - - TRes call({Object? volumes = _undefined, Object? $__typename = _undefined}) => - _then(Query$GetServerDiskVolumesQuery$storage( - 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< - CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes< - Query$GetServerDiskVolumesQuery$storage$volumes>>) - _fn) => - call( - volumes: _fn(_instance.volumes.map((e) => - CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes( - e, (i) => i))).toList()); -} - -class _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage - implements CopyWith$Query$GetServerDiskVolumesQuery$storage { - _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage(this._res); - - TRes _res; - - call( - {List? volumes, +extension UtilityExtension$Query$GetServerDiskVolumes$storage + on Query$GetServerDiskVolumes$storage { + Query$GetServerDiskVolumes$storage copyWith( + {List? volumes, String? $__typename}) => - _res; - volumes(_fn) => _res; + Query$GetServerDiskVolumes$storage( + volumes: volumes == null ? this.volumes : volumes, + $__typename: $__typename == null ? this.$__typename : $__typename); } @JsonSerializable(explicitToJson: true) -class Query$GetServerDiskVolumesQuery$storage$volumes { - Query$GetServerDiskVolumesQuery$storage$volumes( +class Query$GetServerDiskVolumes$storage$volumes { + Query$GetServerDiskVolumes$storage$volumes( {required this.freeSpace, - required this.model, + this.model, required this.name, required this.root, - required this.serial, + this.serial, required this.totalSpace, required this.type, + required this.usages, required this.usedSpace, required this.$__typename}); @override - factory Query$GetServerDiskVolumesQuery$storage$volumes.fromJson( + factory Query$GetServerDiskVolumes$storage$volumes.fromJson( Map json) => - _$Query$GetServerDiskVolumesQuery$storage$volumesFromJson(json); + _$Query$GetServerDiskVolumes$storage$volumesFromJson(json); final String freeSpace; - final String model; + final String? model; final String name; final bool root; - final String serial; + final String? serial; final String totalSpace; final String type; + final List usages; + final String usedSpace; @JsonKey(name: '__typename') final String $__typename; Map toJson() => - _$Query$GetServerDiskVolumesQuery$storage$volumesToJson(this); + _$Query$GetServerDiskVolumes$storage$volumesToJson(this); int get hashCode { final l$freeSpace = freeSpace; final l$model = model; @@ -451,6 +538,7 @@ class Query$GetServerDiskVolumesQuery$storage$volumes { final l$serial = serial; final l$totalSpace = totalSpace; final l$type = type; + final l$usages = usages; final l$usedSpace = usedSpace; final l$$__typename = $__typename; return Object.hashAll([ @@ -461,6 +549,7 @@ class Query$GetServerDiskVolumesQuery$storage$volumes { l$serial, l$totalSpace, l$type, + Object.hashAll(l$usages.map((v) => v)), l$usedSpace, l$$__typename ]); @@ -469,7 +558,7 @@ class Query$GetServerDiskVolumesQuery$storage$volumes { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Query$GetServerDiskVolumesQuery$storage$volumes) || + if (!(other is Query$GetServerDiskVolumes$storage$volumes) || runtimeType != other.runtimeType) return false; final l$freeSpace = freeSpace; final lOther$freeSpace = other.freeSpace; @@ -492,6 +581,15 @@ class Query$GetServerDiskVolumesQuery$storage$volumes { final l$type = type; final lOther$type = other.type; 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; + 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; + } + final l$usedSpace = usedSpace; final lOther$usedSpace = other.usedSpace; if (l$usedSpace != lOther$usedSpace) return false; @@ -502,119 +600,253 @@ class Query$GetServerDiskVolumesQuery$storage$volumes { } } -extension UtilityExtension$Query$GetServerDiskVolumesQuery$storage$volumes - on Query$GetServerDiskVolumesQuery$storage$volumes { - CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes< - Query$GetServerDiskVolumesQuery$storage$volumes> - get copyWith => CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes( - this, (i) => i); -} - -abstract class CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes { - factory CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes( - Query$GetServerDiskVolumesQuery$storage$volumes instance, - TRes Function(Query$GetServerDiskVolumesQuery$storage$volumes) then) = - _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage$volumes; - - factory CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes.stub( - TRes res) = - _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage$volumes; - - TRes call( - {String? freeSpace, - String? model, - String? name, - bool? root, - String? serial, - String? totalSpace, - String? type, - String? usedSpace, - String? $__typename}); -} - -class _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage$volumes - implements CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes { - _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage$volumes( - this._instance, this._then); - - final Query$GetServerDiskVolumesQuery$storage$volumes _instance; - - final TRes Function(Query$GetServerDiskVolumesQuery$storage$volumes) _then; - - 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? usedSpace = _undefined, - Object? $__typename = _undefined}) => - _then(Query$GetServerDiskVolumesQuery$storage$volumes( - freeSpace: freeSpace == _undefined || freeSpace == null - ? _instance.freeSpace - : (freeSpace as String), - model: model == _undefined || model == null - ? _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 || serial == null - ? _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), - usedSpace: usedSpace == _undefined || usedSpace == null - ? _instance.usedSpace - : (usedSpace as String), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); -} - -class _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage$volumes - implements CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes { - _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage$volumes(this._res); - - TRes _res; - - call( +extension UtilityExtension$Query$GetServerDiskVolumes$storage$volumes + on Query$GetServerDiskVolumes$storage$volumes { + Query$GetServerDiskVolumes$storage$volumes copyWith( {String? freeSpace, - String? model, + String? Function()? model, String? name, bool? root, - String? serial, + String? Function()? serial, String? totalSpace, String? type, + List? usages, String? usedSpace, String? $__typename}) => - _res; + Query$GetServerDiskVolumes$storage$volumes( + freeSpace: freeSpace == null ? this.freeSpace : freeSpace, + model: model == null ? this.model : model(), + name: name == null ? this.name : name, + root: root == null ? this.root : root, + serial: serial == null ? this.serial : serial(), + totalSpace: totalSpace == null ? this.totalSpace : totalSpace, + type: type == null ? this.type : type, + usages: usages == null ? this.usages : usages, + usedSpace: usedSpace == null ? this.usedSpace : usedSpace, + $__typename: $__typename == null ? this.$__typename : $__typename); } @JsonSerializable(explicitToJson: true) -class Variables$Mutation$MountVolumeMutation { - Variables$Mutation$MountVolumeMutation({required this.name}); +class Query$GetServerDiskVolumes$storage$volumes$usages { + Query$GetServerDiskVolumes$storage$volumes$usages( + {required this.title, + required this.usedSpace, + required this.$__typename}); @override - factory Variables$Mutation$MountVolumeMutation.fromJson( + 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 String title; + + final String usedSpace; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Query$GetServerDiskVolumes$storage$volumes$usagesToJson(this); + int get hashCode { + final l$title = title; + final l$usedSpace = usedSpace; + final l$$__typename = $__typename; + return Object.hashAll([l$title, l$usedSpace, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$GetServerDiskVolumes$storage$volumes$usages) || + 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; + return true; + } +} + +extension UtilityExtension$Query$GetServerDiskVolumes$storage$volumes$usages + on Query$GetServerDiskVolumes$storage$volumes$usages { + Query$GetServerDiskVolumes$storage$volumes$usages copyWith( + {String? title, String? usedSpace, String? $__typename}) => + Query$GetServerDiskVolumes$storage$volumes$usages( + title: title == null ? this.title : title, + usedSpace: usedSpace == null ? this.usedSpace : usedSpace, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@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}); + + @override + factory Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage.fromJson( Map json) => - _$Variables$Mutation$MountVolumeMutationFromJson(json); + _$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsageFromJson( + json); + + final String title; + + final String usedSpace; + + @JsonKey(name: '__typename') + final String $__typename; + + final Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service? + service; + + Map toJson() => + _$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsageToJson( + this); + int get hashCode { + 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]); + } + + @override + bool operator ==(Object other) { + 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; + final l$service = service; + final lOther$service = other.service; + if (l$service != lOther$service) return false; + return true; + } +} + +extension UtilityExtension$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage + on Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage { + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage copyWith( + {String? title, + String? usedSpace, + String? $__typename, + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service? + Function()? + service}) => + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage( + title: title == null ? this.title : title, + usedSpace: usedSpace == null ? this.usedSpace : usedSpace, + $__typename: $__typename == null ? this.$__typename : $__typename, + service: service == null ? this.service : service()); +} + +@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}); + + @override + factory Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service.fromJson( + Map json) => + _$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$serviceFromJson( + json); + + final String id; + + final bool isMovable; + + final String displayName; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$serviceToJson( + this); + 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]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other + is Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service) || + runtimeType != other.runtimeType) return false; + final l$id = id; + final lOther$id = other.id; + if (l$id != lOther$id) return false; + final l$isMovable = isMovable; + final lOther$isMovable = other.isMovable; + if (l$isMovable != lOther$isMovable) return false; + final l$displayName = displayName; + final lOther$displayName = other.displayName; + if (l$displayName != lOther$displayName) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service + on Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service { + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service + copyWith( + {String? id, + bool? isMovable, + String? displayName, + String? $__typename}) => + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service( + id: id == null ? this.id : id, + isMovable: isMovable == null ? this.isMovable : isMovable, + displayName: displayName == null ? this.displayName : displayName, + $__typename: + $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$MountVolume { + Variables$Mutation$MountVolume({required this.name}); + + @override + factory Variables$Mutation$MountVolume.fromJson(Map json) => + _$Variables$Mutation$MountVolumeFromJson(json); final String name; - Map toJson() => - _$Variables$Mutation$MountVolumeMutationToJson(this); + Map toJson() => _$Variables$Mutation$MountVolumeToJson(this); int get hashCode { final l$name = name; return Object.hashAll([l$name]); @@ -623,7 +855,7 @@ class Variables$Mutation$MountVolumeMutation { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Variables$Mutation$MountVolumeMutation) || + if (!(other is Variables$Mutation$MountVolume) || runtimeType != other.runtimeType) return false; final l$name = name; final lOther$name = other.name; @@ -631,66 +863,24 @@ class Variables$Mutation$MountVolumeMutation { return true; } - CopyWith$Variables$Mutation$MountVolumeMutation< - Variables$Mutation$MountVolumeMutation> - get copyWith => - CopyWith$Variables$Mutation$MountVolumeMutation(this, (i) => i); -} - -abstract class CopyWith$Variables$Mutation$MountVolumeMutation { - factory CopyWith$Variables$Mutation$MountVolumeMutation( - Variables$Mutation$MountVolumeMutation instance, - TRes Function(Variables$Mutation$MountVolumeMutation) then) = - _CopyWithImpl$Variables$Mutation$MountVolumeMutation; - - factory CopyWith$Variables$Mutation$MountVolumeMutation.stub(TRes res) = - _CopyWithStubImpl$Variables$Mutation$MountVolumeMutation; - - TRes call({String? name}); -} - -class _CopyWithImpl$Variables$Mutation$MountVolumeMutation - implements CopyWith$Variables$Mutation$MountVolumeMutation { - _CopyWithImpl$Variables$Mutation$MountVolumeMutation( - this._instance, this._then); - - final Variables$Mutation$MountVolumeMutation _instance; - - final TRes Function(Variables$Mutation$MountVolumeMutation) _then; - - static const _undefined = {}; - - TRes call({Object? name = _undefined}) => - _then(Variables$Mutation$MountVolumeMutation( - name: name == _undefined || name == null - ? _instance.name - : (name as String))); -} - -class _CopyWithStubImpl$Variables$Mutation$MountVolumeMutation - implements CopyWith$Variables$Mutation$MountVolumeMutation { - _CopyWithStubImpl$Variables$Mutation$MountVolumeMutation(this._res); - - TRes _res; - - call({String? name}) => _res; + Variables$Mutation$MountVolume copyWith({String? name}) => + Variables$Mutation$MountVolume(name: name == null ? this.name : name); } @JsonSerializable(explicitToJson: true) -class Mutation$MountVolumeMutation { - Mutation$MountVolumeMutation( - {required this.mountVolume, required this.$__typename}); +class Mutation$MountVolume { + Mutation$MountVolume({required this.mountVolume, required this.$__typename}); @override - factory Mutation$MountVolumeMutation.fromJson(Map json) => - _$Mutation$MountVolumeMutationFromJson(json); + factory Mutation$MountVolume.fromJson(Map json) => + _$Mutation$MountVolumeFromJson(json); - final Mutation$MountVolumeMutation$mountVolume mountVolume; + final Mutation$MountVolume$mountVolume mountVolume; @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$MountVolumeMutationToJson(this); + Map toJson() => _$Mutation$MountVolumeToJson(this); int get hashCode { final l$mountVolume = mountVolume; final l$$__typename = $__typename; @@ -700,8 +890,8 @@ class Mutation$MountVolumeMutation { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Mutation$MountVolumeMutation) || - runtimeType != other.runtimeType) return false; + 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; @@ -712,72 +902,19 @@ class Mutation$MountVolumeMutation { } } -extension UtilityExtension$Mutation$MountVolumeMutation - on Mutation$MountVolumeMutation { - CopyWith$Mutation$MountVolumeMutation - get copyWith => CopyWith$Mutation$MountVolumeMutation(this, (i) => i); -} - -abstract class CopyWith$Mutation$MountVolumeMutation { - factory CopyWith$Mutation$MountVolumeMutation( - Mutation$MountVolumeMutation instance, - TRes Function(Mutation$MountVolumeMutation) then) = - _CopyWithImpl$Mutation$MountVolumeMutation; - - factory CopyWith$Mutation$MountVolumeMutation.stub(TRes res) = - _CopyWithStubImpl$Mutation$MountVolumeMutation; - - TRes call( - {Mutation$MountVolumeMutation$mountVolume? mountVolume, - String? $__typename}); - CopyWith$Mutation$MountVolumeMutation$mountVolume get mountVolume; -} - -class _CopyWithImpl$Mutation$MountVolumeMutation - implements CopyWith$Mutation$MountVolumeMutation { - _CopyWithImpl$Mutation$MountVolumeMutation(this._instance, this._then); - - final Mutation$MountVolumeMutation _instance; - - final TRes Function(Mutation$MountVolumeMutation) _then; - - static const _undefined = {}; - - TRes call( - {Object? mountVolume = _undefined, - Object? $__typename = _undefined}) => - _then(Mutation$MountVolumeMutation( - mountVolume: mountVolume == _undefined || mountVolume == null - ? _instance.mountVolume - : (mountVolume as Mutation$MountVolumeMutation$mountVolume), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); - CopyWith$Mutation$MountVolumeMutation$mountVolume get mountVolume { - final local$mountVolume = _instance.mountVolume; - return CopyWith$Mutation$MountVolumeMutation$mountVolume( - local$mountVolume, (e) => call(mountVolume: e)); - } -} - -class _CopyWithStubImpl$Mutation$MountVolumeMutation - implements CopyWith$Mutation$MountVolumeMutation { - _CopyWithStubImpl$Mutation$MountVolumeMutation(this._res); - - TRes _res; - - call( - {Mutation$MountVolumeMutation$mountVolume? mountVolume, +extension UtilityExtension$Mutation$MountVolume on Mutation$MountVolume { + Mutation$MountVolume copyWith( + {Mutation$MountVolume$mountVolume? mountVolume, String? $__typename}) => - _res; - CopyWith$Mutation$MountVolumeMutation$mountVolume get mountVolume => - CopyWith$Mutation$MountVolumeMutation$mountVolume.stub(_res); + Mutation$MountVolume( + mountVolume: mountVolume == null ? this.mountVolume : mountVolume, + $__typename: $__typename == null ? this.$__typename : $__typename); } -const documentNodeMutationMountVolumeMutation = DocumentNode(definitions: [ +const documentNodeMutationMountVolume = DocumentNode(definitions: [ OperationDefinitionNode( type: OperationType.mutation, - name: NameNode(value: 'MountVolumeMutation'), + name: NameNode(value: 'MountVolume'), variableDefinitions: [ VariableDefinitionNode( variable: VariableNode(name: NameNode(value: 'name')), @@ -798,24 +935,9 @@ const documentNodeMutationMountVolumeMutation = DocumentNode(definitions: [ ], 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), + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: []), FieldNode( name: NameNode(value: '__typename'), alias: null, @@ -830,25 +952,26 @@ const documentNodeMutationMountVolumeMutation = DocumentNode(definitions: [ directives: [], selectionSet: null) ])), + fragmentDefinitionbasicMutationReturnFields, ]); -Mutation$MountVolumeMutation _parserFn$Mutation$MountVolumeMutation( +Mutation$MountVolume _parserFn$Mutation$MountVolume( Map data) => - Mutation$MountVolumeMutation.fromJson(data); -typedef OnMutationCompleted$Mutation$MountVolumeMutation = FutureOr - Function(dynamic, Mutation$MountVolumeMutation?); + Mutation$MountVolume.fromJson(data); +typedef OnMutationCompleted$Mutation$MountVolume = FutureOr Function( + dynamic, Mutation$MountVolume?); -class Options$Mutation$MountVolumeMutation - extends graphql.MutationOptions { - Options$Mutation$MountVolumeMutation( +class Options$Mutation$MountVolume + extends graphql.MutationOptions { + Options$Mutation$MountVolume( {String? operationName, - required Variables$Mutation$MountVolumeMutation variables, + required Variables$Mutation$MountVolume variables, graphql.FetchPolicy? fetchPolicy, graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, graphql.Context? context, - OnMutationCompleted$Mutation$MountVolumeMutation? onCompleted, - graphql.OnMutationUpdate? update, + OnMutationCompleted$Mutation$MountVolume? onCompleted, + graphql.OnMutationUpdate? update, graphql.OnError? onError}) : onCompletedWithParsed = onCompleted, super( @@ -861,17 +984,14 @@ class Options$Mutation$MountVolumeMutation context: context, onCompleted: onCompleted == null ? null - : (data) => onCompleted( - data, - data == null - ? null - : _parserFn$Mutation$MountVolumeMutation(data)), + : (data) => onCompleted(data, + data == null ? null : _parserFn$Mutation$MountVolume(data)), update: update, onError: onError, - document: documentNodeMutationMountVolumeMutation, - parserFn: _parserFn$Mutation$MountVolumeMutation); + document: documentNodeMutationMountVolume, + parserFn: _parserFn$Mutation$MountVolume); - final OnMutationCompleted$Mutation$MountVolumeMutation? onCompletedWithParsed; + final OnMutationCompleted$Mutation$MountVolume? onCompletedWithParsed; @override List get properties => [ @@ -882,11 +1002,11 @@ class Options$Mutation$MountVolumeMutation ]; } -class WatchOptions$Mutation$MountVolumeMutation - extends graphql.WatchQueryOptions { - WatchOptions$Mutation$MountVolumeMutation( +class WatchOptions$Mutation$MountVolume + extends graphql.WatchQueryOptions { + WatchOptions$Mutation$MountVolume( {String? operationName, - required Variables$Mutation$MountVolumeMutation variables, + required Variables$Mutation$MountVolume variables, graphql.FetchPolicy? fetchPolicy, graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, @@ -904,38 +1024,36 @@ class WatchOptions$Mutation$MountVolumeMutation cacheRereadPolicy: cacheRereadPolicy, optimisticResult: optimisticResult, context: context, - document: documentNodeMutationMountVolumeMutation, + document: documentNodeMutationMountVolume, pollInterval: pollInterval, eagerlyFetchResults: eagerlyFetchResults, carryForwardDataOnException: carryForwardDataOnException, fetchResults: fetchResults, - parserFn: _parserFn$Mutation$MountVolumeMutation); + parserFn: _parserFn$Mutation$MountVolume); } -extension ClientExtension$Mutation$MountVolumeMutation - on graphql.GraphQLClient { - Future> - mutate$MountVolumeMutation( - Options$Mutation$MountVolumeMutation options) async => - await this.mutate(options); - graphql.ObservableQuery - watchMutation$MountVolumeMutation( - WatchOptions$Mutation$MountVolumeMutation options) => - this.watchMutation(options); +extension ClientExtension$Mutation$MountVolume on graphql.GraphQLClient { + Future> mutate$MountVolume( + Options$Mutation$MountVolume options) async => + await this.mutate(options); + graphql.ObservableQuery watchMutation$MountVolume( + WatchOptions$Mutation$MountVolume options) => + this.watchMutation(options); } @JsonSerializable(explicitToJson: true) -class Mutation$MountVolumeMutation$mountVolume { - Mutation$MountVolumeMutation$mountVolume( +class Mutation$MountVolume$mountVolume + implements Fragment$basicMutationReturnFields { + Mutation$MountVolume$mountVolume( {required this.code, required this.message, required this.success, required this.$__typename}); @override - factory Mutation$MountVolumeMutation$mountVolume.fromJson( + factory Mutation$MountVolume$mountVolume.fromJson( Map json) => - _$Mutation$MountVolumeMutation$mountVolumeFromJson(json); + _$Mutation$MountVolume$mountVolumeFromJson(json); final int code; @@ -947,7 +1065,7 @@ class Mutation$MountVolumeMutation$mountVolume { final String $__typename; Map toJson() => - _$Mutation$MountVolumeMutation$mountVolumeToJson(this); + _$Mutation$MountVolume$mountVolumeToJson(this); int get hashCode { final l$code = code; final l$message = message; @@ -959,7 +1077,7 @@ class Mutation$MountVolumeMutation$mountVolume { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Mutation$MountVolumeMutation$mountVolume) || + if (!(other is Mutation$MountVolume$mountVolume) || runtimeType != other.runtimeType) return false; final l$code = code; final lOther$code = other.code; @@ -977,80 +1095,29 @@ class Mutation$MountVolumeMutation$mountVolume { } } -extension UtilityExtension$Mutation$MountVolumeMutation$mountVolume - on Mutation$MountVolumeMutation$mountVolume { - CopyWith$Mutation$MountVolumeMutation$mountVolume< - Mutation$MountVolumeMutation$mountVolume> - get copyWith => - CopyWith$Mutation$MountVolumeMutation$mountVolume(this, (i) => i); -} - -abstract class CopyWith$Mutation$MountVolumeMutation$mountVolume { - factory CopyWith$Mutation$MountVolumeMutation$mountVolume( - Mutation$MountVolumeMutation$mountVolume instance, - TRes Function(Mutation$MountVolumeMutation$mountVolume) then) = - _CopyWithImpl$Mutation$MountVolumeMutation$mountVolume; - - factory CopyWith$Mutation$MountVolumeMutation$mountVolume.stub(TRes res) = - _CopyWithStubImpl$Mutation$MountVolumeMutation$mountVolume; - - TRes call({int? code, String? message, bool? success, String? $__typename}); -} - -class _CopyWithImpl$Mutation$MountVolumeMutation$mountVolume - implements CopyWith$Mutation$MountVolumeMutation$mountVolume { - _CopyWithImpl$Mutation$MountVolumeMutation$mountVolume( - this._instance, this._then); - - final Mutation$MountVolumeMutation$mountVolume _instance; - - final TRes Function(Mutation$MountVolumeMutation$mountVolume) _then; - - static const _undefined = {}; - - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => - _then(Mutation$MountVolumeMutation$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))); -} - -class _CopyWithStubImpl$Mutation$MountVolumeMutation$mountVolume - implements CopyWith$Mutation$MountVolumeMutation$mountVolume { - _CopyWithStubImpl$Mutation$MountVolumeMutation$mountVolume(this._res); - - TRes _res; - - call({int? code, String? message, bool? success, String? $__typename}) => - _res; +extension UtilityExtension$Mutation$MountVolume$mountVolume + on Mutation$MountVolume$mountVolume { + Mutation$MountVolume$mountVolume copyWith( + {int? code, String? message, bool? success, String? $__typename}) => + Mutation$MountVolume$mountVolume( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename); } @JsonSerializable(explicitToJson: true) -class Variables$Mutation$ResizeVolumeMutation { - Variables$Mutation$ResizeVolumeMutation({required this.name}); +class Variables$Mutation$ResizeVolume { + Variables$Mutation$ResizeVolume({required this.name}); @override - factory Variables$Mutation$ResizeVolumeMutation.fromJson( - Map json) => - _$Variables$Mutation$ResizeVolumeMutationFromJson(json); + factory Variables$Mutation$ResizeVolume.fromJson(Map json) => + _$Variables$Mutation$ResizeVolumeFromJson(json); final String name; Map toJson() => - _$Variables$Mutation$ResizeVolumeMutationToJson(this); + _$Variables$Mutation$ResizeVolumeToJson(this); int get hashCode { final l$name = name; return Object.hashAll([l$name]); @@ -1059,7 +1126,7 @@ class Variables$Mutation$ResizeVolumeMutation { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Variables$Mutation$ResizeVolumeMutation) || + if (!(other is Variables$Mutation$ResizeVolume) || runtimeType != other.runtimeType) return false; final l$name = name; final lOther$name = other.name; @@ -1067,66 +1134,25 @@ class Variables$Mutation$ResizeVolumeMutation { return true; } - CopyWith$Variables$Mutation$ResizeVolumeMutation< - Variables$Mutation$ResizeVolumeMutation> - get copyWith => - CopyWith$Variables$Mutation$ResizeVolumeMutation(this, (i) => i); -} - -abstract class CopyWith$Variables$Mutation$ResizeVolumeMutation { - factory CopyWith$Variables$Mutation$ResizeVolumeMutation( - Variables$Mutation$ResizeVolumeMutation instance, - TRes Function(Variables$Mutation$ResizeVolumeMutation) then) = - _CopyWithImpl$Variables$Mutation$ResizeVolumeMutation; - - factory CopyWith$Variables$Mutation$ResizeVolumeMutation.stub(TRes res) = - _CopyWithStubImpl$Variables$Mutation$ResizeVolumeMutation; - - TRes call({String? name}); -} - -class _CopyWithImpl$Variables$Mutation$ResizeVolumeMutation - implements CopyWith$Variables$Mutation$ResizeVolumeMutation { - _CopyWithImpl$Variables$Mutation$ResizeVolumeMutation( - this._instance, this._then); - - final Variables$Mutation$ResizeVolumeMutation _instance; - - final TRes Function(Variables$Mutation$ResizeVolumeMutation) _then; - - static const _undefined = {}; - - TRes call({Object? name = _undefined}) => - _then(Variables$Mutation$ResizeVolumeMutation( - name: name == _undefined || name == null - ? _instance.name - : (name as String))); -} - -class _CopyWithStubImpl$Variables$Mutation$ResizeVolumeMutation - implements CopyWith$Variables$Mutation$ResizeVolumeMutation { - _CopyWithStubImpl$Variables$Mutation$ResizeVolumeMutation(this._res); - - TRes _res; - - call({String? name}) => _res; + Variables$Mutation$ResizeVolume copyWith({String? name}) => + Variables$Mutation$ResizeVolume(name: name == null ? this.name : name); } @JsonSerializable(explicitToJson: true) -class Mutation$ResizeVolumeMutation { - Mutation$ResizeVolumeMutation( +class Mutation$ResizeVolume { + Mutation$ResizeVolume( {required this.resizeVolume, required this.$__typename}); @override - factory Mutation$ResizeVolumeMutation.fromJson(Map json) => - _$Mutation$ResizeVolumeMutationFromJson(json); + factory Mutation$ResizeVolume.fromJson(Map json) => + _$Mutation$ResizeVolumeFromJson(json); - final Mutation$ResizeVolumeMutation$resizeVolume resizeVolume; + final Mutation$ResizeVolume$resizeVolume resizeVolume; @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$ResizeVolumeMutationToJson(this); + Map toJson() => _$Mutation$ResizeVolumeToJson(this); int get hashCode { final l$resizeVolume = resizeVolume; final l$$__typename = $__typename; @@ -1136,8 +1162,8 @@ class Mutation$ResizeVolumeMutation { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Mutation$ResizeVolumeMutation) || - runtimeType != other.runtimeType) return false; + 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; @@ -1148,72 +1174,19 @@ class Mutation$ResizeVolumeMutation { } } -extension UtilityExtension$Mutation$ResizeVolumeMutation - on Mutation$ResizeVolumeMutation { - CopyWith$Mutation$ResizeVolumeMutation - get copyWith => CopyWith$Mutation$ResizeVolumeMutation(this, (i) => i); -} - -abstract class CopyWith$Mutation$ResizeVolumeMutation { - factory CopyWith$Mutation$ResizeVolumeMutation( - Mutation$ResizeVolumeMutation instance, - TRes Function(Mutation$ResizeVolumeMutation) then) = - _CopyWithImpl$Mutation$ResizeVolumeMutation; - - factory CopyWith$Mutation$ResizeVolumeMutation.stub(TRes res) = - _CopyWithStubImpl$Mutation$ResizeVolumeMutation; - - TRes call( - {Mutation$ResizeVolumeMutation$resizeVolume? resizeVolume, - String? $__typename}); - CopyWith$Mutation$ResizeVolumeMutation$resizeVolume get resizeVolume; -} - -class _CopyWithImpl$Mutation$ResizeVolumeMutation - implements CopyWith$Mutation$ResizeVolumeMutation { - _CopyWithImpl$Mutation$ResizeVolumeMutation(this._instance, this._then); - - final Mutation$ResizeVolumeMutation _instance; - - final TRes Function(Mutation$ResizeVolumeMutation) _then; - - static const _undefined = {}; - - TRes call( - {Object? resizeVolume = _undefined, - Object? $__typename = _undefined}) => - _then(Mutation$ResizeVolumeMutation( - resizeVolume: resizeVolume == _undefined || resizeVolume == null - ? _instance.resizeVolume - : (resizeVolume as Mutation$ResizeVolumeMutation$resizeVolume), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); - CopyWith$Mutation$ResizeVolumeMutation$resizeVolume get resizeVolume { - final local$resizeVolume = _instance.resizeVolume; - return CopyWith$Mutation$ResizeVolumeMutation$resizeVolume( - local$resizeVolume, (e) => call(resizeVolume: e)); - } -} - -class _CopyWithStubImpl$Mutation$ResizeVolumeMutation - implements CopyWith$Mutation$ResizeVolumeMutation { - _CopyWithStubImpl$Mutation$ResizeVolumeMutation(this._res); - - TRes _res; - - call( - {Mutation$ResizeVolumeMutation$resizeVolume? resizeVolume, +extension UtilityExtension$Mutation$ResizeVolume on Mutation$ResizeVolume { + Mutation$ResizeVolume copyWith( + {Mutation$ResizeVolume$resizeVolume? resizeVolume, String? $__typename}) => - _res; - CopyWith$Mutation$ResizeVolumeMutation$resizeVolume get resizeVolume => - CopyWith$Mutation$ResizeVolumeMutation$resizeVolume.stub(_res); + Mutation$ResizeVolume( + resizeVolume: resizeVolume == null ? this.resizeVolume : resizeVolume, + $__typename: $__typename == null ? this.$__typename : $__typename); } -const documentNodeMutationResizeVolumeMutation = DocumentNode(definitions: [ +const documentNodeMutationResizeVolume = DocumentNode(definitions: [ OperationDefinitionNode( type: OperationType.mutation, - name: NameNode(value: 'ResizeVolumeMutation'), + name: NameNode(value: 'ResizeVolume'), variableDefinitions: [ VariableDefinitionNode( variable: VariableNode(name: NameNode(value: 'name')), @@ -1234,24 +1207,9 @@ const documentNodeMutationResizeVolumeMutation = DocumentNode(definitions: [ ], 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), + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: []), FieldNode( name: NameNode(value: '__typename'), alias: null, @@ -1266,25 +1224,26 @@ const documentNodeMutationResizeVolumeMutation = DocumentNode(definitions: [ directives: [], selectionSet: null) ])), + fragmentDefinitionbasicMutationReturnFields, ]); -Mutation$ResizeVolumeMutation _parserFn$Mutation$ResizeVolumeMutation( +Mutation$ResizeVolume _parserFn$Mutation$ResizeVolume( Map data) => - Mutation$ResizeVolumeMutation.fromJson(data); -typedef OnMutationCompleted$Mutation$ResizeVolumeMutation = FutureOr - Function(dynamic, Mutation$ResizeVolumeMutation?); + Mutation$ResizeVolume.fromJson(data); +typedef OnMutationCompleted$Mutation$ResizeVolume = FutureOr Function( + dynamic, Mutation$ResizeVolume?); -class Options$Mutation$ResizeVolumeMutation - extends graphql.MutationOptions { - Options$Mutation$ResizeVolumeMutation( +class Options$Mutation$ResizeVolume + extends graphql.MutationOptions { + Options$Mutation$ResizeVolume( {String? operationName, - required Variables$Mutation$ResizeVolumeMutation variables, + required Variables$Mutation$ResizeVolume variables, graphql.FetchPolicy? fetchPolicy, graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, graphql.Context? context, - OnMutationCompleted$Mutation$ResizeVolumeMutation? onCompleted, - graphql.OnMutationUpdate? update, + OnMutationCompleted$Mutation$ResizeVolume? onCompleted, + graphql.OnMutationUpdate? update, graphql.OnError? onError}) : onCompletedWithParsed = onCompleted, super( @@ -1301,14 +1260,13 @@ class Options$Mutation$ResizeVolumeMutation data, data == null ? null - : _parserFn$Mutation$ResizeVolumeMutation(data)), + : _parserFn$Mutation$ResizeVolume(data)), update: update, onError: onError, - document: documentNodeMutationResizeVolumeMutation, - parserFn: _parserFn$Mutation$ResizeVolumeMutation); + document: documentNodeMutationResizeVolume, + parserFn: _parserFn$Mutation$ResizeVolume); - final OnMutationCompleted$Mutation$ResizeVolumeMutation? - onCompletedWithParsed; + final OnMutationCompleted$Mutation$ResizeVolume? onCompletedWithParsed; @override List get properties => [ @@ -1319,11 +1277,11 @@ class Options$Mutation$ResizeVolumeMutation ]; } -class WatchOptions$Mutation$ResizeVolumeMutation - extends graphql.WatchQueryOptions { - WatchOptions$Mutation$ResizeVolumeMutation( +class WatchOptions$Mutation$ResizeVolume + extends graphql.WatchQueryOptions { + WatchOptions$Mutation$ResizeVolume( {String? operationName, - required Variables$Mutation$ResizeVolumeMutation variables, + required Variables$Mutation$ResizeVolume variables, graphql.FetchPolicy? fetchPolicy, graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, @@ -1341,38 +1299,36 @@ class WatchOptions$Mutation$ResizeVolumeMutation cacheRereadPolicy: cacheRereadPolicy, optimisticResult: optimisticResult, context: context, - document: documentNodeMutationResizeVolumeMutation, + document: documentNodeMutationResizeVolume, pollInterval: pollInterval, eagerlyFetchResults: eagerlyFetchResults, carryForwardDataOnException: carryForwardDataOnException, fetchResults: fetchResults, - parserFn: _parserFn$Mutation$ResizeVolumeMutation); + parserFn: _parserFn$Mutation$ResizeVolume); } -extension ClientExtension$Mutation$ResizeVolumeMutation - on graphql.GraphQLClient { - Future> - mutate$ResizeVolumeMutation( - Options$Mutation$ResizeVolumeMutation options) async => - await this.mutate(options); - graphql.ObservableQuery - watchMutation$ResizeVolumeMutation( - WatchOptions$Mutation$ResizeVolumeMutation options) => - this.watchMutation(options); +extension ClientExtension$Mutation$ResizeVolume on graphql.GraphQLClient { + Future> mutate$ResizeVolume( + Options$Mutation$ResizeVolume options) async => + await this.mutate(options); + graphql.ObservableQuery watchMutation$ResizeVolume( + WatchOptions$Mutation$ResizeVolume options) => + this.watchMutation(options); } @JsonSerializable(explicitToJson: true) -class Mutation$ResizeVolumeMutation$resizeVolume { - Mutation$ResizeVolumeMutation$resizeVolume( +class Mutation$ResizeVolume$resizeVolume + implements Fragment$basicMutationReturnFields { + Mutation$ResizeVolume$resizeVolume( {required this.code, required this.message, required this.success, required this.$__typename}); @override - factory Mutation$ResizeVolumeMutation$resizeVolume.fromJson( + factory Mutation$ResizeVolume$resizeVolume.fromJson( Map json) => - _$Mutation$ResizeVolumeMutation$resizeVolumeFromJson(json); + _$Mutation$ResizeVolume$resizeVolumeFromJson(json); final int code; @@ -1384,7 +1340,7 @@ class Mutation$ResizeVolumeMutation$resizeVolume { final String $__typename; Map toJson() => - _$Mutation$ResizeVolumeMutation$resizeVolumeToJson(this); + _$Mutation$ResizeVolume$resizeVolumeToJson(this); int get hashCode { final l$code = code; final l$message = message; @@ -1396,7 +1352,7 @@ class Mutation$ResizeVolumeMutation$resizeVolume { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Mutation$ResizeVolumeMutation$resizeVolume) || + if (!(other is Mutation$ResizeVolume$resizeVolume) || runtimeType != other.runtimeType) return false; final l$code = code; final lOther$code = other.code; @@ -1414,80 +1370,30 @@ class Mutation$ResizeVolumeMutation$resizeVolume { } } -extension UtilityExtension$Mutation$ResizeVolumeMutation$resizeVolume - on Mutation$ResizeVolumeMutation$resizeVolume { - CopyWith$Mutation$ResizeVolumeMutation$resizeVolume< - Mutation$ResizeVolumeMutation$resizeVolume> - get copyWith => - CopyWith$Mutation$ResizeVolumeMutation$resizeVolume(this, (i) => i); -} - -abstract class CopyWith$Mutation$ResizeVolumeMutation$resizeVolume { - factory CopyWith$Mutation$ResizeVolumeMutation$resizeVolume( - Mutation$ResizeVolumeMutation$resizeVolume instance, - TRes Function(Mutation$ResizeVolumeMutation$resizeVolume) then) = - _CopyWithImpl$Mutation$ResizeVolumeMutation$resizeVolume; - - factory CopyWith$Mutation$ResizeVolumeMutation$resizeVolume.stub(TRes res) = - _CopyWithStubImpl$Mutation$ResizeVolumeMutation$resizeVolume; - - TRes call({int? code, String? message, bool? success, String? $__typename}); -} - -class _CopyWithImpl$Mutation$ResizeVolumeMutation$resizeVolume - implements CopyWith$Mutation$ResizeVolumeMutation$resizeVolume { - _CopyWithImpl$Mutation$ResizeVolumeMutation$resizeVolume( - this._instance, this._then); - - final Mutation$ResizeVolumeMutation$resizeVolume _instance; - - final TRes Function(Mutation$ResizeVolumeMutation$resizeVolume) _then; - - static const _undefined = {}; - - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => - _then(Mutation$ResizeVolumeMutation$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))); -} - -class _CopyWithStubImpl$Mutation$ResizeVolumeMutation$resizeVolume - implements CopyWith$Mutation$ResizeVolumeMutation$resizeVolume { - _CopyWithStubImpl$Mutation$ResizeVolumeMutation$resizeVolume(this._res); - - TRes _res; - - call({int? code, String? message, bool? success, String? $__typename}) => - _res; +extension UtilityExtension$Mutation$ResizeVolume$resizeVolume + on Mutation$ResizeVolume$resizeVolume { + Mutation$ResizeVolume$resizeVolume copyWith( + {int? code, String? message, bool? success, String? $__typename}) => + Mutation$ResizeVolume$resizeVolume( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename); } @JsonSerializable(explicitToJson: true) -class Variables$Mutation$UnmountVolumeMutation { - Variables$Mutation$UnmountVolumeMutation({required this.name}); +class Variables$Mutation$UnmountVolume { + Variables$Mutation$UnmountVolume({required this.name}); @override - factory Variables$Mutation$UnmountVolumeMutation.fromJson( + factory Variables$Mutation$UnmountVolume.fromJson( Map json) => - _$Variables$Mutation$UnmountVolumeMutationFromJson(json); + _$Variables$Mutation$UnmountVolumeFromJson(json); final String name; Map toJson() => - _$Variables$Mutation$UnmountVolumeMutationToJson(this); + _$Variables$Mutation$UnmountVolumeToJson(this); int get hashCode { final l$name = name; return Object.hashAll([l$name]); @@ -1496,7 +1402,7 @@ class Variables$Mutation$UnmountVolumeMutation { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Variables$Mutation$UnmountVolumeMutation) || + if (!(other is Variables$Mutation$UnmountVolume) || runtimeType != other.runtimeType) return false; final l$name = name; final lOther$name = other.name; @@ -1504,66 +1410,25 @@ class Variables$Mutation$UnmountVolumeMutation { return true; } - CopyWith$Variables$Mutation$UnmountVolumeMutation< - Variables$Mutation$UnmountVolumeMutation> - get copyWith => - CopyWith$Variables$Mutation$UnmountVolumeMutation(this, (i) => i); -} - -abstract class CopyWith$Variables$Mutation$UnmountVolumeMutation { - factory CopyWith$Variables$Mutation$UnmountVolumeMutation( - Variables$Mutation$UnmountVolumeMutation instance, - TRes Function(Variables$Mutation$UnmountVolumeMutation) then) = - _CopyWithImpl$Variables$Mutation$UnmountVolumeMutation; - - factory CopyWith$Variables$Mutation$UnmountVolumeMutation.stub(TRes res) = - _CopyWithStubImpl$Variables$Mutation$UnmountVolumeMutation; - - TRes call({String? name}); -} - -class _CopyWithImpl$Variables$Mutation$UnmountVolumeMutation - implements CopyWith$Variables$Mutation$UnmountVolumeMutation { - _CopyWithImpl$Variables$Mutation$UnmountVolumeMutation( - this._instance, this._then); - - final Variables$Mutation$UnmountVolumeMutation _instance; - - final TRes Function(Variables$Mutation$UnmountVolumeMutation) _then; - - static const _undefined = {}; - - TRes call({Object? name = _undefined}) => - _then(Variables$Mutation$UnmountVolumeMutation( - name: name == _undefined || name == null - ? _instance.name - : (name as String))); -} - -class _CopyWithStubImpl$Variables$Mutation$UnmountVolumeMutation - implements CopyWith$Variables$Mutation$UnmountVolumeMutation { - _CopyWithStubImpl$Variables$Mutation$UnmountVolumeMutation(this._res); - - TRes _res; - - call({String? name}) => _res; + Variables$Mutation$UnmountVolume copyWith({String? name}) => + Variables$Mutation$UnmountVolume(name: name == null ? this.name : name); } @JsonSerializable(explicitToJson: true) -class Mutation$UnmountVolumeMutation { - Mutation$UnmountVolumeMutation( +class Mutation$UnmountVolume { + Mutation$UnmountVolume( {required this.unmountVolume, required this.$__typename}); @override - factory Mutation$UnmountVolumeMutation.fromJson(Map json) => - _$Mutation$UnmountVolumeMutationFromJson(json); + factory Mutation$UnmountVolume.fromJson(Map json) => + _$Mutation$UnmountVolumeFromJson(json); - final Mutation$UnmountVolumeMutation$unmountVolume unmountVolume; + final Mutation$UnmountVolume$unmountVolume unmountVolume; @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Mutation$UnmountVolumeMutationToJson(this); + Map toJson() => _$Mutation$UnmountVolumeToJson(this); int get hashCode { final l$unmountVolume = unmountVolume; final l$$__typename = $__typename; @@ -1573,8 +1438,8 @@ class Mutation$UnmountVolumeMutation { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Mutation$UnmountVolumeMutation) || - runtimeType != other.runtimeType) return false; + 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; @@ -1585,74 +1450,20 @@ class Mutation$UnmountVolumeMutation { } } -extension UtilityExtension$Mutation$UnmountVolumeMutation - on Mutation$UnmountVolumeMutation { - CopyWith$Mutation$UnmountVolumeMutation - get copyWith => CopyWith$Mutation$UnmountVolumeMutation(this, (i) => i); -} - -abstract class CopyWith$Mutation$UnmountVolumeMutation { - factory CopyWith$Mutation$UnmountVolumeMutation( - Mutation$UnmountVolumeMutation instance, - TRes Function(Mutation$UnmountVolumeMutation) then) = - _CopyWithImpl$Mutation$UnmountVolumeMutation; - - factory CopyWith$Mutation$UnmountVolumeMutation.stub(TRes res) = - _CopyWithStubImpl$Mutation$UnmountVolumeMutation; - - TRes call( - {Mutation$UnmountVolumeMutation$unmountVolume? unmountVolume, - String? $__typename}); - CopyWith$Mutation$UnmountVolumeMutation$unmountVolume get unmountVolume; -} - -class _CopyWithImpl$Mutation$UnmountVolumeMutation - implements CopyWith$Mutation$UnmountVolumeMutation { - _CopyWithImpl$Mutation$UnmountVolumeMutation(this._instance, this._then); - - final Mutation$UnmountVolumeMutation _instance; - - final TRes Function(Mutation$UnmountVolumeMutation) _then; - - static const _undefined = {}; - - TRes call( - {Object? unmountVolume = _undefined, - Object? $__typename = _undefined}) => - _then(Mutation$UnmountVolumeMutation( - unmountVolume: unmountVolume == _undefined || unmountVolume == null - ? _instance.unmountVolume - : (unmountVolume as Mutation$UnmountVolumeMutation$unmountVolume), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); - CopyWith$Mutation$UnmountVolumeMutation$unmountVolume - get unmountVolume { - final local$unmountVolume = _instance.unmountVolume; - return CopyWith$Mutation$UnmountVolumeMutation$unmountVolume( - local$unmountVolume, (e) => call(unmountVolume: e)); - } -} - -class _CopyWithStubImpl$Mutation$UnmountVolumeMutation - implements CopyWith$Mutation$UnmountVolumeMutation { - _CopyWithStubImpl$Mutation$UnmountVolumeMutation(this._res); - - TRes _res; - - call( - {Mutation$UnmountVolumeMutation$unmountVolume? unmountVolume, +extension UtilityExtension$Mutation$UnmountVolume on Mutation$UnmountVolume { + Mutation$UnmountVolume copyWith( + {Mutation$UnmountVolume$unmountVolume? unmountVolume, String? $__typename}) => - _res; - CopyWith$Mutation$UnmountVolumeMutation$unmountVolume - get unmountVolume => - CopyWith$Mutation$UnmountVolumeMutation$unmountVolume.stub(_res); + Mutation$UnmountVolume( + unmountVolume: + unmountVolume == null ? this.unmountVolume : unmountVolume, + $__typename: $__typename == null ? this.$__typename : $__typename); } -const documentNodeMutationUnmountVolumeMutation = DocumentNode(definitions: [ +const documentNodeMutationUnmountVolume = DocumentNode(definitions: [ OperationDefinitionNode( type: OperationType.mutation, - name: NameNode(value: 'UnmountVolumeMutation'), + name: NameNode(value: 'UnmountVolume'), variableDefinitions: [ VariableDefinitionNode( variable: VariableNode(name: NameNode(value: 'name')), @@ -1673,24 +1484,9 @@ const documentNodeMutationUnmountVolumeMutation = DocumentNode(definitions: [ ], 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), + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: []), FieldNode( name: NameNode(value: '__typename'), alias: null, @@ -1705,25 +1501,26 @@ const documentNodeMutationUnmountVolumeMutation = DocumentNode(definitions: [ directives: [], selectionSet: null) ])), + fragmentDefinitionbasicMutationReturnFields, ]); -Mutation$UnmountVolumeMutation _parserFn$Mutation$UnmountVolumeMutation( +Mutation$UnmountVolume _parserFn$Mutation$UnmountVolume( Map data) => - Mutation$UnmountVolumeMutation.fromJson(data); -typedef OnMutationCompleted$Mutation$UnmountVolumeMutation = FutureOr - Function(dynamic, Mutation$UnmountVolumeMutation?); + Mutation$UnmountVolume.fromJson(data); +typedef OnMutationCompleted$Mutation$UnmountVolume = FutureOr Function( + dynamic, Mutation$UnmountVolume?); -class Options$Mutation$UnmountVolumeMutation - extends graphql.MutationOptions { - Options$Mutation$UnmountVolumeMutation( +class Options$Mutation$UnmountVolume + extends graphql.MutationOptions { + Options$Mutation$UnmountVolume( {String? operationName, - required Variables$Mutation$UnmountVolumeMutation variables, + required Variables$Mutation$UnmountVolume variables, graphql.FetchPolicy? fetchPolicy, graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, graphql.Context? context, - OnMutationCompleted$Mutation$UnmountVolumeMutation? onCompleted, - graphql.OnMutationUpdate? update, + OnMutationCompleted$Mutation$UnmountVolume? onCompleted, + graphql.OnMutationUpdate? update, graphql.OnError? onError}) : onCompletedWithParsed = onCompleted, super( @@ -1740,14 +1537,13 @@ class Options$Mutation$UnmountVolumeMutation data, data == null ? null - : _parserFn$Mutation$UnmountVolumeMutation(data)), + : _parserFn$Mutation$UnmountVolume(data)), update: update, onError: onError, - document: documentNodeMutationUnmountVolumeMutation, - parserFn: _parserFn$Mutation$UnmountVolumeMutation); + document: documentNodeMutationUnmountVolume, + parserFn: _parserFn$Mutation$UnmountVolume); - final OnMutationCompleted$Mutation$UnmountVolumeMutation? - onCompletedWithParsed; + final OnMutationCompleted$Mutation$UnmountVolume? onCompletedWithParsed; @override List get properties => [ @@ -1758,11 +1554,11 @@ class Options$Mutation$UnmountVolumeMutation ]; } -class WatchOptions$Mutation$UnmountVolumeMutation - extends graphql.WatchQueryOptions { - WatchOptions$Mutation$UnmountVolumeMutation( +class WatchOptions$Mutation$UnmountVolume + extends graphql.WatchQueryOptions { + WatchOptions$Mutation$UnmountVolume( {String? operationName, - required Variables$Mutation$UnmountVolumeMutation variables, + required Variables$Mutation$UnmountVolume variables, graphql.FetchPolicy? fetchPolicy, graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, @@ -1780,38 +1576,36 @@ class WatchOptions$Mutation$UnmountVolumeMutation cacheRereadPolicy: cacheRereadPolicy, optimisticResult: optimisticResult, context: context, - document: documentNodeMutationUnmountVolumeMutation, + document: documentNodeMutationUnmountVolume, pollInterval: pollInterval, eagerlyFetchResults: eagerlyFetchResults, carryForwardDataOnException: carryForwardDataOnException, fetchResults: fetchResults, - parserFn: _parserFn$Mutation$UnmountVolumeMutation); + parserFn: _parserFn$Mutation$UnmountVolume); } -extension ClientExtension$Mutation$UnmountVolumeMutation - on graphql.GraphQLClient { - Future> - mutate$UnmountVolumeMutation( - Options$Mutation$UnmountVolumeMutation options) async => - await this.mutate(options); - graphql.ObservableQuery - watchMutation$UnmountVolumeMutation( - WatchOptions$Mutation$UnmountVolumeMutation options) => - this.watchMutation(options); +extension ClientExtension$Mutation$UnmountVolume on graphql.GraphQLClient { + Future> mutate$UnmountVolume( + Options$Mutation$UnmountVolume options) async => + await this.mutate(options); + graphql.ObservableQuery watchMutation$UnmountVolume( + WatchOptions$Mutation$UnmountVolume options) => + this.watchMutation(options); } @JsonSerializable(explicitToJson: true) -class Mutation$UnmountVolumeMutation$unmountVolume { - Mutation$UnmountVolumeMutation$unmountVolume( +class Mutation$UnmountVolume$unmountVolume + implements Fragment$basicMutationReturnFields { + Mutation$UnmountVolume$unmountVolume( {required this.code, required this.message, required this.success, required this.$__typename}); @override - factory Mutation$UnmountVolumeMutation$unmountVolume.fromJson( + factory Mutation$UnmountVolume$unmountVolume.fromJson( Map json) => - _$Mutation$UnmountVolumeMutation$unmountVolumeFromJson(json); + _$Mutation$UnmountVolume$unmountVolumeFromJson(json); final int code; @@ -1823,7 +1617,7 @@ class Mutation$UnmountVolumeMutation$unmountVolume { final String $__typename; Map toJson() => - _$Mutation$UnmountVolumeMutation$unmountVolumeToJson(this); + _$Mutation$UnmountVolume$unmountVolumeToJson(this); int get hashCode { final l$code = code; final l$message = message; @@ -1835,7 +1629,7 @@ class Mutation$UnmountVolumeMutation$unmountVolume { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Mutation$UnmountVolumeMutation$unmountVolume) || + if (!(other is Mutation$UnmountVolume$unmountVolume) || runtimeType != other.runtimeType) return false; final l$code = code; final lOther$code = other.code; @@ -1853,63 +1647,544 @@ class Mutation$UnmountVolumeMutation$unmountVolume { } } -extension UtilityExtension$Mutation$UnmountVolumeMutation$unmountVolume - on Mutation$UnmountVolumeMutation$unmountVolume { - CopyWith$Mutation$UnmountVolumeMutation$unmountVolume< - Mutation$UnmountVolumeMutation$unmountVolume> - get copyWith => - CopyWith$Mutation$UnmountVolumeMutation$unmountVolume(this, (i) => i); +extension UtilityExtension$Mutation$UnmountVolume$unmountVolume + on Mutation$UnmountVolume$unmountVolume { + Mutation$UnmountVolume$unmountVolume copyWith( + {int? code, String? message, bool? success, String? $__typename}) => + Mutation$UnmountVolume$unmountVolume( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename); } -abstract class CopyWith$Mutation$UnmountVolumeMutation$unmountVolume { - factory CopyWith$Mutation$UnmountVolumeMutation$unmountVolume( - Mutation$UnmountVolumeMutation$unmountVolume instance, - TRes Function(Mutation$UnmountVolumeMutation$unmountVolume) then) = - _CopyWithImpl$Mutation$UnmountVolumeMutation$unmountVolume; +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$MigrateToBinds { + Variables$Mutation$MigrateToBinds({required this.input}); - factory CopyWith$Mutation$UnmountVolumeMutation$unmountVolume.stub(TRes res) = - _CopyWithStubImpl$Mutation$UnmountVolumeMutation$unmountVolume; + @override + factory Variables$Mutation$MigrateToBinds.fromJson( + Map json) => + _$Variables$Mutation$MigrateToBindsFromJson(json); - TRes call({int? code, String? message, bool? success, String? $__typename}); + 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; + } + + Variables$Mutation$MigrateToBinds copyWith( + {Input$MigrateToBindsInput? input}) => + Variables$Mutation$MigrateToBinds( + input: input == null ? this.input : input); } -class _CopyWithImpl$Mutation$UnmountVolumeMutation$unmountVolume - implements CopyWith$Mutation$UnmountVolumeMutation$unmountVolume { - _CopyWithImpl$Mutation$UnmountVolumeMutation$unmountVolume( - this._instance, this._then); +@JsonSerializable(explicitToJson: true) +class Mutation$MigrateToBinds { + Mutation$MigrateToBinds( + {required this.migrateToBinds, required this.$__typename}); - final Mutation$UnmountVolumeMutation$unmountVolume _instance; + @override + factory Mutation$MigrateToBinds.fromJson(Map json) => + _$Mutation$MigrateToBindsFromJson(json); - final TRes Function(Mutation$UnmountVolumeMutation$unmountVolume) _then; + final Mutation$MigrateToBinds$migrateToBinds migrateToBinds; - static const _undefined = {}; + @JsonKey(name: '__typename') + final String $__typename; - TRes call( - {Object? code = _undefined, - Object? message = _undefined, - Object? success = _undefined, - Object? $__typename = _undefined}) => - _then(Mutation$UnmountVolumeMutation$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))); + Map toJson() => _$Mutation$MigrateToBindsToJson(this); + int get hashCode { + final l$migrateToBinds = migrateToBinds; + final l$$__typename = $__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) + return false; + final l$migrateToBinds = migrateToBinds; + final lOther$migrateToBinds = other.migrateToBinds; + if (l$migrateToBinds != lOther$migrateToBinds) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } } -class _CopyWithStubImpl$Mutation$UnmountVolumeMutation$unmountVolume - implements CopyWith$Mutation$UnmountVolumeMutation$unmountVolume { - _CopyWithStubImpl$Mutation$UnmountVolumeMutation$unmountVolume(this._res); - - TRes _res; - - call({int? code, String? message, bool? success, String? $__typename}) => - _res; +extension UtilityExtension$Mutation$MigrateToBinds on Mutation$MigrateToBinds { + Mutation$MigrateToBinds copyWith( + {Mutation$MigrateToBinds$migrateToBinds? migrateToBinds, + String? $__typename}) => + Mutation$MigrateToBinds( + migrateToBinds: + migrateToBinds == null ? this.migrateToBinds : migrateToBinds, + $__typename: $__typename == null ? this.$__typename : $__typename); } + +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'), + 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: [], + 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) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + 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?); + +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, + 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$MigrateToBinds(data)), + update: update, + onError: onError, + document: documentNodeMutationMigrateToBinds, + parserFn: _parserFn$Mutation$MigrateToBinds); + + final OnMutationCompleted$Mutation$MigrateToBinds? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$MigrateToBinds on graphql.GraphQLClient { + Future> mutate$MigrateToBinds( + Options$Mutation$MigrateToBinds options) async => + await this.mutate(options); + graphql.ObservableQuery watchMutation$MigrateToBinds( + WatchOptions$Mutation$MigrateToBinds options) => + 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}); + + @override + factory Mutation$MigrateToBinds$migrateToBinds.fromJson( + Map json) => + _$Mutation$MigrateToBinds$migrateToBindsFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + final Mutation$MigrateToBinds$migrateToBinds$job? job; + + Map toJson() => + _$Mutation$MigrateToBinds$migrateToBindsToJson(this); + 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]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$MigrateToBinds$migrateToBinds) || + 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; + final l$job = job; + final lOther$job = other.job; + if (l$job != lOther$job) return false; + return true; + } +} + +extension UtilityExtension$Mutation$MigrateToBinds$migrateToBinds + on Mutation$MigrateToBinds$migrateToBinds { + Mutation$MigrateToBinds$migrateToBinds copyWith( + {int? code, + String? message, + bool? success, + String? $__typename, + Mutation$MigrateToBinds$migrateToBinds$job? Function()? job}) => + Mutation$MigrateToBinds$migrateToBinds( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename, + job: job == null ? this.job : job()); +} + +@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}); + + @override + factory Mutation$MigrateToBinds$migrateToBinds$job.fromJson( + Map json) => + _$Mutation$MigrateToBinds$migrateToBinds$jobFromJson(json); + + @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; + + final int? progress; + + final String? result; + + final String status; + + final String? statusText; + + final String uid; + + @JsonKey(fromJson: dateTimeFromJson, toJson: dateTimeToJson) + final DateTime updatedAt; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$MigrateToBinds$migrateToBinds$jobToJson(this); + int get hashCode { + final l$createdAt = createdAt; + final l$description = description; + final l$error = error; + final l$finishedAt = finishedAt; + final l$name = name; + final l$progress = progress; + final l$result = result; + final l$status = status; + final l$statusText = statusText; + final l$uid = uid; + final l$updatedAt = updatedAt; + final l$$__typename = $__typename; + return Object.hashAll([ + l$createdAt, + l$description, + l$error, + l$finishedAt, + l$name, + l$progress, + l$result, + l$status, + l$statusText, + l$uid, + l$updatedAt, + l$$__typename + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$MigrateToBinds$migrateToBinds$job) || + runtimeType != other.runtimeType) return false; + final l$createdAt = createdAt; + final lOther$createdAt = other.createdAt; + if (l$createdAt != lOther$createdAt) return false; + final l$description = description; + final lOther$description = other.description; + if (l$description != lOther$description) return false; + final l$error = error; + final lOther$error = other.error; + if (l$error != lOther$error) return false; + final l$finishedAt = finishedAt; + final lOther$finishedAt = other.finishedAt; + if (l$finishedAt != lOther$finishedAt) return false; + final l$name = name; + final lOther$name = other.name; + if (l$name != lOther$name) return false; + final l$progress = progress; + final lOther$progress = other.progress; + if (l$progress != lOther$progress) return false; + final l$result = result; + final lOther$result = other.result; + if (l$result != lOther$result) return false; + final l$status = status; + final lOther$status = other.status; + if (l$status != lOther$status) return false; + final l$statusText = statusText; + final lOther$statusText = other.statusText; + if (l$statusText != lOther$statusText) return false; + final l$uid = uid; + final lOther$uid = other.uid; + if (l$uid != lOther$uid) return false; + final l$updatedAt = updatedAt; + final lOther$updatedAt = other.updatedAt; + if (l$updatedAt != lOther$updatedAt) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$MigrateToBinds$migrateToBinds$job + on Mutation$MigrateToBinds$migrateToBinds$job { + Mutation$MigrateToBinds$migrateToBinds$job copyWith( + {DateTime? createdAt, + String? description, + String? Function()? error, + DateTime? Function()? finishedAt, + String? name, + int? Function()? progress, + String? Function()? result, + String? status, + String? Function()? statusText, + String? uid, + DateTime? updatedAt, + String? $__typename}) => + Mutation$MigrateToBinds$migrateToBinds$job( + createdAt: createdAt == null ? this.createdAt : createdAt, + description: description == null ? this.description : description, + error: error == null ? this.error : error(), + finishedAt: finishedAt == null ? this.finishedAt : finishedAt(), + name: name == null ? this.name : name, + progress: progress == null ? this.progress : progress(), + result: result == null ? this.result : result(), + status: status == null ? this.status : status, + statusText: statusText == null ? this.statusText : statusText(), + uid: uid == null ? this.uid : uid, + updatedAt: updatedAt == null ? this.updatedAt : updatedAt, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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 index 49a749fe..c1ab4fba 100644 --- 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 @@ -6,57 +6,78 @@ part of 'disk_volumes.graphql.dart'; // JsonSerializableGenerator // ************************************************************************** -Query$GetServerDiskVolumesQuery _$Query$GetServerDiskVolumesQueryFromJson( +Fragment$basicMutationReturnFields _$Fragment$basicMutationReturnFieldsFromJson( Map json) => - Query$GetServerDiskVolumesQuery( - storage: Query$GetServerDiskVolumesQuery$storage.fromJson( + 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$GetServerDiskVolumesQueryToJson( - Query$GetServerDiskVolumesQuery instance) => +Map _$Query$GetServerDiskVolumesToJson( + Query$GetServerDiskVolumes instance) => { 'storage': instance.storage.toJson(), '__typename': instance.$__typename, }; -Query$GetServerDiskVolumesQuery$storage - _$Query$GetServerDiskVolumesQuery$storageFromJson( - Map json) => - Query$GetServerDiskVolumesQuery$storage( - volumes: (json['volumes'] as List) - .map((e) => - Query$GetServerDiskVolumesQuery$storage$volumes.fromJson( - e as Map)) - .toList(), - $__typename: json['__typename'] as String, - ); +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$GetServerDiskVolumesQuery$storageToJson( - Query$GetServerDiskVolumesQuery$storage instance) => +Map _$Query$GetServerDiskVolumes$storageToJson( + Query$GetServerDiskVolumes$storage instance) => { 'volumes': instance.volumes.map((e) => e.toJson()).toList(), '__typename': instance.$__typename, }; -Query$GetServerDiskVolumesQuery$storage$volumes - _$Query$GetServerDiskVolumesQuery$storage$volumesFromJson( +Query$GetServerDiskVolumes$storage$volumes + _$Query$GetServerDiskVolumes$storage$volumesFromJson( Map json) => - Query$GetServerDiskVolumesQuery$storage$volumes( + Query$GetServerDiskVolumes$storage$volumes( freeSpace: json['freeSpace'] as String, - model: json['model'] as String, + model: json['model'] as String?, name: json['name'] as String, root: json['root'] as bool, - serial: json['serial'] as String, + 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$GetServerDiskVolumesQuery$storage$volumesToJson( - Query$GetServerDiskVolumesQuery$storage$volumes instance) => +Map _$Query$GetServerDiskVolumes$storage$volumesToJson( + Query$GetServerDiskVolumes$storage$volumes instance) => { 'freeSpace': instance.freeSpace, 'model': instance.model, @@ -65,50 +86,111 @@ Map _$Query$GetServerDiskVolumesQuery$storage$volumesToJson( 'serial': instance.serial, 'totalSpace': instance.totalSpace, 'type': instance.type, + 'usages': instance.usages.map((e) => e.toJson()).toList(), 'usedSpace': instance.usedSpace, '__typename': instance.$__typename, }; -Variables$Mutation$MountVolumeMutation - _$Variables$Mutation$MountVolumeMutationFromJson( +Query$GetServerDiskVolumes$storage$volumes$usages + _$Query$GetServerDiskVolumes$storage$volumes$usagesFromJson( Map json) => - Variables$Mutation$MountVolumeMutation( - name: json['name'] as String, + Query$GetServerDiskVolumes$storage$volumes$usages( + title: json['title'] as String, + usedSpace: json['usedSpace'] as String, + $__typename: json['__typename'] as String, ); -Map _$Variables$Mutation$MountVolumeMutationToJson( - Variables$Mutation$MountVolumeMutation instance) => +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$MountVolumeMutation _$Mutation$MountVolumeMutationFromJson( +Mutation$MountVolume _$Mutation$MountVolumeFromJson( Map json) => - Mutation$MountVolumeMutation( - mountVolume: Mutation$MountVolumeMutation$mountVolume.fromJson( + Mutation$MountVolume( + mountVolume: Mutation$MountVolume$mountVolume.fromJson( json['mountVolume'] as Map), $__typename: json['__typename'] as String, ); -Map _$Mutation$MountVolumeMutationToJson( - Mutation$MountVolumeMutation instance) => +Map _$Mutation$MountVolumeToJson( + Mutation$MountVolume instance) => { 'mountVolume': instance.mountVolume.toJson(), '__typename': instance.$__typename, }; -Mutation$MountVolumeMutation$mountVolume - _$Mutation$MountVolumeMutation$mountVolumeFromJson( - Map json) => - Mutation$MountVolumeMutation$mountVolume( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); +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$MountVolumeMutation$mountVolumeToJson( - Mutation$MountVolumeMutation$mountVolume instance) => +Map _$Mutation$MountVolume$mountVolumeToJson( + Mutation$MountVolume$mountVolume instance) => { 'code': instance.code, 'message': instance.message, @@ -116,46 +198,44 @@ Map _$Mutation$MountVolumeMutation$mountVolumeToJson( '__typename': instance.$__typename, }; -Variables$Mutation$ResizeVolumeMutation - _$Variables$Mutation$ResizeVolumeMutationFromJson( - Map json) => - Variables$Mutation$ResizeVolumeMutation( - name: json['name'] as String, - ); +Variables$Mutation$ResizeVolume _$Variables$Mutation$ResizeVolumeFromJson( + Map json) => + Variables$Mutation$ResizeVolume( + name: json['name'] as String, + ); -Map _$Variables$Mutation$ResizeVolumeMutationToJson( - Variables$Mutation$ResizeVolumeMutation instance) => +Map _$Variables$Mutation$ResizeVolumeToJson( + Variables$Mutation$ResizeVolume instance) => { 'name': instance.name, }; -Mutation$ResizeVolumeMutation _$Mutation$ResizeVolumeMutationFromJson( +Mutation$ResizeVolume _$Mutation$ResizeVolumeFromJson( Map json) => - Mutation$ResizeVolumeMutation( - resizeVolume: Mutation$ResizeVolumeMutation$resizeVolume.fromJson( + Mutation$ResizeVolume( + resizeVolume: Mutation$ResizeVolume$resizeVolume.fromJson( json['resizeVolume'] as Map), $__typename: json['__typename'] as String, ); -Map _$Mutation$ResizeVolumeMutationToJson( - Mutation$ResizeVolumeMutation instance) => +Map _$Mutation$ResizeVolumeToJson( + Mutation$ResizeVolume instance) => { 'resizeVolume': instance.resizeVolume.toJson(), '__typename': instance.$__typename, }; -Mutation$ResizeVolumeMutation$resizeVolume - _$Mutation$ResizeVolumeMutation$resizeVolumeFromJson( - Map json) => - Mutation$ResizeVolumeMutation$resizeVolume( - code: json['code'] as int, - message: json['message'] as String, - success: json['success'] as bool, - $__typename: json['__typename'] as String, - ); +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$ResizeVolumeMutation$resizeVolumeToJson( - Mutation$ResizeVolumeMutation$resizeVolume instance) => +Map _$Mutation$ResizeVolume$resizeVolumeToJson( + Mutation$ResizeVolume$resizeVolume instance) => { 'code': instance.code, 'message': instance.message, @@ -163,49 +243,134 @@ Map _$Mutation$ResizeVolumeMutation$resizeVolumeToJson( '__typename': instance.$__typename, }; -Variables$Mutation$UnmountVolumeMutation - _$Variables$Mutation$UnmountVolumeMutationFromJson( - Map json) => - Variables$Mutation$UnmountVolumeMutation( - name: json['name'] as String, - ); +Variables$Mutation$UnmountVolume _$Variables$Mutation$UnmountVolumeFromJson( + Map json) => + Variables$Mutation$UnmountVolume( + name: json['name'] as String, + ); -Map _$Variables$Mutation$UnmountVolumeMutationToJson( - Variables$Mutation$UnmountVolumeMutation instance) => +Map _$Variables$Mutation$UnmountVolumeToJson( + Variables$Mutation$UnmountVolume instance) => { 'name': instance.name, }; -Mutation$UnmountVolumeMutation _$Mutation$UnmountVolumeMutationFromJson( +Mutation$UnmountVolume _$Mutation$UnmountVolumeFromJson( Map json) => - Mutation$UnmountVolumeMutation( - unmountVolume: Mutation$UnmountVolumeMutation$unmountVolume.fromJson( + Mutation$UnmountVolume( + unmountVolume: Mutation$UnmountVolume$unmountVolume.fromJson( json['unmountVolume'] as Map), $__typename: json['__typename'] as String, ); -Map _$Mutation$UnmountVolumeMutationToJson( - Mutation$UnmountVolumeMutation instance) => +Map _$Mutation$UnmountVolumeToJson( + Mutation$UnmountVolume instance) => { 'unmountVolume': instance.unmountVolume.toJson(), '__typename': instance.$__typename, }; -Mutation$UnmountVolumeMutation$unmountVolume - _$Mutation$UnmountVolumeMutation$unmountVolumeFromJson( - Map json) => - Mutation$UnmountVolumeMutation$unmountVolume( +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$UnmountVolumeMutation$unmountVolumeToJson( - Mutation$UnmountVolumeMutation$unmountVolume instance) => +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 b/lib/logic/api_maps/graphql_maps/schema/schema.graphql index 81ab4bc5..2f60c969 100644 --- a/lib/logic/api_maps/graphql_maps/schema/schema.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql @@ -1,63 +1,76 @@ -scalar DateTime - type Alert { - severity: Severity! - title: String! message: String! + severity: Severity! timestamp: DateTime -} - -type StorageVolume { - freeSpace: String! - model: String! - name: String! - root: Boolean! - serial: String! - totalSpace: String! - type: String! - usedSpace: String! -} - -type Storage { - volumes: [StorageVolume!]! + title: String! } type Api { - version: String! devices: [ApiDevice!]! recoveryKey: ApiRecoveryKeyStatus! + version: String! } type ApiDevice { - name: String! creationDate: DateTime! isCaller: Boolean! + name: String! +} + +type ApiJob { + createdAt: DateTime! + description: String! + error: String + finishedAt: DateTime + name: String! + progress: Int + result: String + status: String! + statusText: String + uid: String! + updatedAt: DateTime! } type ApiKeyMutationReturn implements MutationReturnInterface { - success: Boolean! - message: String! code: Int! key: String + message: String! + success: Boolean! } type ApiRecoveryKeyStatus { - exists: Boolean! - valid: Boolean! creationDate: DateTime + exists: Boolean! expirationDate: DateTime usesLeft: Int + valid: Boolean! } type AutoUpgradeOptions { - enable: Boolean! allowReboot: Boolean! + enable: Boolean! } -type DeviceApiTokenMutationReturn implements MutationReturnInterface { - success: Boolean! - message: String! +input AutoUpgradeSettingsInput { + enableAutoUpgrade: Boolean = null + allowReboot: Boolean = null +} + +type AutoUpgradeSettingsMutationReturn implements MutationReturnInterface { + allowReboot: Boolean! code: Int! + enableAutoUpgrade: Boolean! + message: String! + success: Boolean! +} + +"""Date with time (isoformat)""" +scalar DateTime + +type DeviceApiTokenMutationReturn implements MutationReturnInterface { + code: Int! + message: String! + success: Boolean! token: String } @@ -66,59 +79,163 @@ enum DnsProvider { } type DnsRecord { - recordType: String! - name: String! content: String! - ttl: Int! + name: String! priority: Int + recordType: String! + ttl: Int! +} + +type GenericJobButationReturn implements MutationReturnInterface { + code: Int! + job: ApiJob + message: String! + success: Boolean! } type GenericMutationReturn implements MutationReturnInterface { - success: Boolean! - message: String! code: Int! + message: String! + success: Boolean! +} + +type Job { + getJob(jobId: String!): ApiJob + getJobs: [ApiJob!]! +} + +input MigrateToBindsInput { + emailBlockDevice: String! + bitwardenBlockDevice: String! + giteaBlockDevice: String! + nextcloudBlockDevice: String! + pleromaBlockDevice: String! +} + +input MoveServiceInput { + serviceId: String! + location: String! } type Mutation { - getNewRecoveryApiKey(limits: RecoveryKeyLimitsInput!): ApiKeyMutationReturn! - useRecoveryApiKey(input: UseRecoveryKeyInput!): DeviceApiTokenMutationReturn! - refreshDeviceApiToken: DeviceApiTokenMutationReturn! - deleteDeviceApiToken(device: String!): GenericMutationReturn! - getNewDeviceApiKey: ApiKeyMutationReturn! - invalidateNewDeviceApiKey: GenericMutationReturn! + addSshKey(sshInput: SshMutationInput!): UserMutationReturn! authorizeWithNewDeviceApiKey(input: UseNewDeviceKeyInput!): DeviceApiTokenMutationReturn! - resizeVolume(name: String!): GenericMutationReturn! - unmountVolume(name: String!): GenericMutationReturn! + changeAutoUpgradeSettings(settings: AutoUpgradeSettingsInput!): AutoUpgradeSettingsMutationReturn! + changeTimezone(timezone: String!): TimezoneMutationReturn! + createUser(user: UserMutationInput!): UserMutationReturn! + deleteDeviceApiToken(device: String!): GenericMutationReturn! + deleteUser(username: String!): GenericMutationReturn! + disableService(serviceId: String!): ServiceMutationReturn! + enableService(serviceId: String!): ServiceMutationReturn! + getNewDeviceApiKey: ApiKeyMutationReturn! + getNewRecoveryApiKey(limits: RecoveryKeyLimitsInput = null): ApiKeyMutationReturn! + invalidateNewDeviceApiKey: GenericMutationReturn! + migrateToBinds(input: MigrateToBindsInput!): GenericJobButationReturn! mountVolume(name: String!): GenericMutationReturn! + moveService(input: MoveServiceInput!): ServiceJobMutationReturn! + pullRepositoryChanges: GenericMutationReturn! + rebootSystem: GenericMutationReturn! + refreshDeviceApiToken: DeviceApiTokenMutationReturn! + removeJob(jobId: String!): GenericMutationReturn! + removeSshKey(sshInput: SshMutationInput!): UserMutationReturn! + resizeVolume(name: String!): GenericMutationReturn! + restartService(serviceId: String!): ServiceMutationReturn! + runSystemRebuild: GenericMutationReturn! + runSystemRollback: GenericMutationReturn! + runSystemUpgrade: GenericMutationReturn! + startService(serviceId: String!): ServiceMutationReturn! + stopService(serviceId: String!): ServiceMutationReturn! + testMutation: GenericMutationReturn! + unmountVolume(name: String!): GenericMutationReturn! + updateUser(user: UserMutationInput!): UserMutationReturn! + useRecoveryApiKey(input: UseRecoveryKeyInput!): DeviceApiTokenMutationReturn! } interface MutationReturnInterface { - success: Boolean! - message: String! code: Int! + message: String! + success: Boolean! } type Query { - system: System! - storage: Storage! api: Api! + jobs: Job! + services: Services! + storage: Storage! + system: System! + users: Users! } input RecoveryKeyLimitsInput { - expirationDate: DateTime - uses: Int + expirationDate: DateTime = null + uses: Int = null } enum ServerProvider { HETZNER } +type Service { + description: String! + displayName: String! + dnsRecords: [DnsRecord!] + id: String! + isEnabled: Boolean! + isMovable: Boolean! + isRequired: Boolean! + status: ServiceStatusEnum! + storageUsage: ServiceStorageUsage! + svgIcon: String! + url: String +} + +type ServiceJobMutationReturn implements MutationReturnInterface { + code: Int! + job: ApiJob + message: String! + service: Service + success: Boolean! +} + +type ServiceMutationReturn implements MutationReturnInterface { + code: Int! + message: String! + service: Service + success: Boolean! +} + +enum ServiceStatusEnum { + ACTIVATING + ACTIVE + DEACTIVATING + FAILED + INACTIVE + OFF + RELOADING +} + +type ServiceStorageUsage implements StorageUsageInterface { + service: Service + title: String! + usedSpace: String! + volume: StorageVolume +} + +type Services { + allServices: [Service!]! +} + enum Severity { - INFO - WARNING - ERROR CRITICAL + ERROR + INFO SUCCESS + WARNING +} + +input SshMutationInput { + username: String! + sshKey: String! } type SshSettings { @@ -127,13 +244,40 @@ type SshSettings { rootSshKeys: [String!]! } +type Storage { + volumes: [StorageVolume!]! +} + +interface StorageUsageInterface { + title: String! + usedSpace: String! + volume: StorageVolume +} + +type StorageVolume { + freeSpace: String! + model: String + name: String! + root: Boolean! + serial: String + totalSpace: String! + type: String! + usages: [StorageUsageInterface!]! + usedSpace: String! +} + +type Subscription { + count(target: Int! = 100): Int! +} + type System { - status: Alert! - domain: SystemDomainInfo! - settings: SystemSettings! + busy: Boolean! + domainInfo: SystemDomainInfo! info: SystemInfo! provider: SystemProviderInfo! - busy: Boolean! + settings: SystemSettings! + status: Alert! + workingDirectory: String! } type SystemDomainInfo { @@ -144,13 +288,14 @@ type SystemDomainInfo { } type SystemInfo { - systemVersion: String! pythonVersion: String! + systemVersion: String! + usingBinds: Boolean! } type SystemProviderInfo { - provider: ServerProvider! id: String! + provider: ServerProvider! } type SystemSettings { @@ -159,6 +304,13 @@ type SystemSettings { timezone: String! } +type TimezoneMutationReturn implements MutationReturnInterface { + code: Int! + message: String! + success: Boolean! + timezone: String +} + input UseNewDeviceKeyInput { key: String! deviceName: String! @@ -167,4 +319,33 @@ input UseNewDeviceKeyInput { input UseRecoveryKeyInput { key: String! deviceName: String! +} + +type User { + sshKeys: [String!]! + userType: UserType! + username: String! +} + +input UserMutationInput { + username: String! + password: String! +} + +type UserMutationReturn implements MutationReturnInterface { + code: Int! + message: String! + success: Boolean! + user: User +} + +enum UserType { + NORMAL + PRIMARY + ROOT +} + +type Users { + allUsers: [User!]! + getUser(username: String!): User } \ No newline at end of file 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 27f902e2..cd86d73a 100644 --- a/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart @@ -2,6 +2,174 @@ 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}); + + @override + factory Input$AutoUpgradeSettingsInput.fromJson(Map json) => + _$Input$AutoUpgradeSettingsInputFromJson(json); + + 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]); + } + + @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; + } + + Input$AutoUpgradeSettingsInput copyWith( + {bool? Function()? enableAutoUpgrade, + bool? Function()? allowReboot}) => + Input$AutoUpgradeSettingsInput( + enableAutoUpgrade: enableAutoUpgrade == null + ? this.enableAutoUpgrade + : enableAutoUpgrade(), + allowReboot: allowReboot == null ? this.allowReboot : allowReboot()); +} + +@JsonSerializable(explicitToJson: true) +class Input$MigrateToBindsInput { + Input$MigrateToBindsInput( + {required this.emailBlockDevice, + required this.bitwardenBlockDevice, + required this.giteaBlockDevice, + required this.nextcloudBlockDevice, + required this.pleromaBlockDevice}); + + @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; + final l$giteaBlockDevice = giteaBlockDevice; + final l$nextcloudBlockDevice = nextcloudBlockDevice; + final l$pleromaBlockDevice = pleromaBlockDevice; + return Object.hashAll([ + l$emailBlockDevice, + l$bitwardenBlockDevice, + l$giteaBlockDevice, + l$nextcloudBlockDevice, + 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; + } + + Input$MigrateToBindsInput copyWith( + {String? emailBlockDevice, + String? bitwardenBlockDevice, + String? giteaBlockDevice, + String? nextcloudBlockDevice, + String? pleromaBlockDevice}) => + Input$MigrateToBindsInput( + emailBlockDevice: emailBlockDevice == null + ? this.emailBlockDevice + : emailBlockDevice, + bitwardenBlockDevice: bitwardenBlockDevice == null + ? this.bitwardenBlockDevice + : bitwardenBlockDevice, + giteaBlockDevice: giteaBlockDevice == null + ? this.giteaBlockDevice + : giteaBlockDevice, + nextcloudBlockDevice: nextcloudBlockDevice == null + ? this.nextcloudBlockDevice + : nextcloudBlockDevice, + pleromaBlockDevice: pleromaBlockDevice == null + ? this.pleromaBlockDevice + : pleromaBlockDevice); +} + +@JsonSerializable(explicitToJson: true) +class Input$MoveServiceInput { + Input$MoveServiceInput({required this.serviceId, required this.location}); + + @override + factory Input$MoveServiceInput.fromJson(Map json) => + _$Input$MoveServiceInputFromJson(json); + + 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]); + } + + @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; + } + + Input$MoveServiceInput copyWith({String? serviceId, String? location}) => + Input$MoveServiceInput( + serviceId: serviceId == null ? this.serviceId : serviceId, + location: location == null ? this.location : location); +} + @JsonSerializable(explicitToJson: true) class Input$RecoveryKeyLimitsInput { Input$RecoveryKeyLimitsInput({this.expirationDate, this.uses}); @@ -37,47 +205,51 @@ class Input$RecoveryKeyLimitsInput { return true; } - CopyWith$Input$RecoveryKeyLimitsInput - get copyWith => CopyWith$Input$RecoveryKeyLimitsInput(this, (i) => i); + Input$RecoveryKeyLimitsInput copyWith( + {DateTime? Function()? expirationDate, int? Function()? uses}) => + Input$RecoveryKeyLimitsInput( + expirationDate: + expirationDate == null ? this.expirationDate : expirationDate(), + uses: uses == null ? this.uses : uses()); } -abstract class CopyWith$Input$RecoveryKeyLimitsInput { - factory CopyWith$Input$RecoveryKeyLimitsInput( - Input$RecoveryKeyLimitsInput instance, - TRes Function(Input$RecoveryKeyLimitsInput) then) = - _CopyWithImpl$Input$RecoveryKeyLimitsInput; +@JsonSerializable(explicitToJson: true) +class Input$SshMutationInput { + Input$SshMutationInput({required this.username, required this.sshKey}); - factory CopyWith$Input$RecoveryKeyLimitsInput.stub(TRes res) = - _CopyWithStubImpl$Input$RecoveryKeyLimitsInput; + @override + factory Input$SshMutationInput.fromJson(Map json) => + _$Input$SshMutationInputFromJson(json); - TRes call({DateTime? expirationDate, int? uses}); -} + final String username; -class _CopyWithImpl$Input$RecoveryKeyLimitsInput - implements CopyWith$Input$RecoveryKeyLimitsInput { - _CopyWithImpl$Input$RecoveryKeyLimitsInput(this._instance, this._then); + final String sshKey; - final Input$RecoveryKeyLimitsInput _instance; + Map toJson() => _$Input$SshMutationInputToJson(this); + int get hashCode { + final l$username = username; + final l$sshKey = sshKey; + return Object.hashAll([l$username, l$sshKey]); + } - final TRes Function(Input$RecoveryKeyLimitsInput) _then; + @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; + } - 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?))); -} - -class _CopyWithStubImpl$Input$RecoveryKeyLimitsInput - implements CopyWith$Input$RecoveryKeyLimitsInput { - _CopyWithStubImpl$Input$RecoveryKeyLimitsInput(this._res); - - TRes _res; - - call({DateTime? expirationDate, int? uses}) => _res; + Input$SshMutationInput copyWith({String? username, String? sshKey}) => + Input$SshMutationInput( + username: username == null ? this.username : username, + sshKey: sshKey == null ? this.sshKey : sshKey); } @JsonSerializable(explicitToJson: true) @@ -113,49 +285,10 @@ class Input$UseNewDeviceKeyInput { return true; } - CopyWith$Input$UseNewDeviceKeyInput - get copyWith => CopyWith$Input$UseNewDeviceKeyInput(this, (i) => i); -} - -abstract class CopyWith$Input$UseNewDeviceKeyInput { - factory CopyWith$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}); -} - -class _CopyWithImpl$Input$UseNewDeviceKeyInput - implements CopyWith$Input$UseNewDeviceKeyInput { - _CopyWithImpl$Input$UseNewDeviceKeyInput(this._instance, this._then); - - final Input$UseNewDeviceKeyInput _instance; - - final TRes Function(Input$UseNewDeviceKeyInput) _then; - - 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))); -} - -class _CopyWithStubImpl$Input$UseNewDeviceKeyInput - implements CopyWith$Input$UseNewDeviceKeyInput { - _CopyWithStubImpl$Input$UseNewDeviceKeyInput(this._res); - - TRes _res; - - call({String? key, String? deviceName}) => _res; + Input$UseNewDeviceKeyInput copyWith({String? key, String? deviceName}) => + Input$UseNewDeviceKeyInput( + key: key == null ? this.key : key, + deviceName: deviceName == null ? this.deviceName : deviceName); } @JsonSerializable(explicitToJson: true) @@ -191,48 +324,49 @@ class Input$UseRecoveryKeyInput { return true; } - CopyWith$Input$UseRecoveryKeyInput get copyWith => - CopyWith$Input$UseRecoveryKeyInput(this, (i) => i); + Input$UseRecoveryKeyInput copyWith({String? key, String? deviceName}) => + Input$UseRecoveryKeyInput( + key: key == null ? this.key : key, + deviceName: deviceName == null ? this.deviceName : deviceName); } -abstract class CopyWith$Input$UseRecoveryKeyInput { - factory CopyWith$Input$UseRecoveryKeyInput(Input$UseRecoveryKeyInput instance, - TRes Function(Input$UseRecoveryKeyInput) then) = - _CopyWithImpl$Input$UseRecoveryKeyInput; +@JsonSerializable(explicitToJson: true) +class Input$UserMutationInput { + Input$UserMutationInput({required this.username, required this.password}); - factory CopyWith$Input$UseRecoveryKeyInput.stub(TRes res) = - _CopyWithStubImpl$Input$UseRecoveryKeyInput; + @override + factory Input$UserMutationInput.fromJson(Map json) => + _$Input$UserMutationInputFromJson(json); - TRes call({String? key, String? deviceName}); -} + final String username; -class _CopyWithImpl$Input$UseRecoveryKeyInput - implements CopyWith$Input$UseRecoveryKeyInput { - _CopyWithImpl$Input$UseRecoveryKeyInput(this._instance, this._then); + final String password; - final Input$UseRecoveryKeyInput _instance; + Map toJson() => _$Input$UserMutationInputToJson(this); + int get hashCode { + final l$username = username; + final l$password = password; + return Object.hashAll([l$username, l$password]); + } - final TRes Function(Input$UseRecoveryKeyInput) _then; + @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; + } - 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))); -} - -class _CopyWithStubImpl$Input$UseRecoveryKeyInput - implements CopyWith$Input$UseRecoveryKeyInput { - _CopyWithStubImpl$Input$UseRecoveryKeyInput(this._res); - - TRes _res; - - call({String? key, String? deviceName}) => _res; + Input$UserMutationInput copyWith({String? username, String? password}) => + Input$UserMutationInput( + username: username == null ? this.username : username, + password: password == null ? this.password : password); } enum Enum$DnsProvider { @@ -247,26 +381,61 @@ enum 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('INFO') - INFO, - @JsonValue('WARNING') - WARNING, - @JsonValue('ERROR') - ERROR, @JsonValue('CRITICAL') CRITICAL, + @JsonValue('ERROR') + ERROR, + @JsonValue('INFO') + INFO, @JsonValue('SUCCESS') SUCCESS, + @JsonValue('WARNING') + WARNING, + $unknown +} + +enum Enum$UserType { + @JsonValue('NORMAL') + NORMAL, + @JsonValue('PRIMARY') + PRIMARY, + @JsonValue('ROOT') + ROOT, $unknown } const possibleTypesMap = { 'MutationReturnInterface': { 'ApiKeyMutationReturn', + 'AutoUpgradeSettingsMutationReturn', 'DeviceApiTokenMutationReturn', - 'GenericMutationReturn' - } + 'GenericJobButationReturn', + 'GenericMutationReturn', + 'ServiceJobMutationReturn', + 'ServiceMutationReturn', + 'TimezoneMutationReturn', + 'UserMutationReturn' + }, + 'StorageUsageInterface': {'ServiceStorageUsage'} }; DateTime? _nullable$dateTimeFromJson(dynamic data) => data == null ? null : dateTimeFromJson(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 index 9002a8e1..d3008d30 100644 --- a/lib/logic/api_maps/graphql_maps/schema/schema.graphql.g.dart +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.g.dart @@ -6,6 +6,54 @@ 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( @@ -20,6 +68,20 @@ Map _$Input$RecoveryKeyLimitsInputToJson( '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( @@ -47,3 +109,17 @@ Map _$Input$UseRecoveryKeyInputToJson( '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, + }; diff --git a/lib/logic/api_maps/graphql_maps/schema/server.dart b/lib/logic/api_maps/graphql_maps/schema/server.dart index 4b419a15..794cff51 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server.dart +++ b/lib/logic/api_maps/graphql_maps/schema/server.dart @@ -3,9 +3,11 @@ import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/api_map.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_api.graphql.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/services.graphql.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/api_token.dart'; import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; +import 'package:selfprivacy/logic/models/json/server_job.dart'; class ServerApi extends ApiMap { ServerApi({ @@ -25,13 +27,35 @@ class ServerApi extends ApiMap { @override String? rootAddress; + Future _commonBoolRequest(final Function graphQLMethod) async { + QueryResult response; + bool result = false; + + try { + response = await graphQLMethod(); + if (response.hasException) { + print(response.exception.toString()); + result = false; + } else { + result = true; + } + } catch (e) { + print(e); + } + + return result; + } + Future getApiVersion() async { QueryResult response; String? apiVersion; - final GraphQLClient client = await getClient(); try { - response = await client.query$GetApiVersionQuery(); + final GraphQLClient client = await getClient(); + response = await client.query$GetApiVersion(); + if (response.hasException) { + print(response.exception.toString()); + } apiVersion = response.data!['api']['version']; } catch (e) { print(e); @@ -45,7 +69,10 @@ class ServerApi extends ApiMap { try { final GraphQLClient client = await getClient(); - response = await client.query$GetApiTokensQuery(); + response = await client.query$GetApiTokens(); + if (response.hasException) { + print(response.exception.toString()); + } tokens = response.data!['api']['devices'] .map((final e) => ApiToken.fromJson(e)) .toList(); @@ -62,7 +89,10 @@ class ServerApi extends ApiMap { try { final GraphQLClient client = await getClient(); - response = await client.query$GetServerDiskVolumesQuery(); + response = await client.query$GetServerDiskVolumes(); + if (response.hasException) { + print(response.exception.toString()); + } volumes = response.data!['storage']['volumes'] .map((final e) => ServerDiskVolume.fromJson(e)) .toList(); @@ -76,11 +106,10 @@ class ServerApi extends ApiMap { Future mountVolume(final String volumeName) async { try { final GraphQLClient client = await getClient(); - final variables = - Variables$Mutation$MountVolumeMutation(name: volumeName); + final variables = Variables$Mutation$MountVolume(name: volumeName); final mountVolumeMutation = - Options$Mutation$MountVolumeMutation(variables: variables); - await client.mutate$MountVolumeMutation(mountVolumeMutation); + Options$Mutation$MountVolume(variables: variables); + await client.mutate$MountVolume(mountVolumeMutation); } catch (e) { print(e); } @@ -89,11 +118,10 @@ class ServerApi extends ApiMap { Future unmountVolume(final String volumeName) async { try { final GraphQLClient client = await getClient(); - final variables = - Variables$Mutation$UnmountVolumeMutation(name: volumeName); + final variables = Variables$Mutation$UnmountVolume(name: volumeName); final unmountVolumeMutation = - Options$Mutation$UnmountVolumeMutation(variables: variables); - await client.mutate$UnmountVolumeMutation(unmountVolumeMutation); + Options$Mutation$UnmountVolume(variables: variables); + await client.mutate$UnmountVolume(unmountVolumeMutation); } catch (e) { print(e); } @@ -102,11 +130,104 @@ class ServerApi extends ApiMap { Future resizeVolume(final String volumeName) async { try { final GraphQLClient client = await getClient(); - final variables = - Variables$Mutation$ResizeVolumeMutation(name: volumeName); + final variables = Variables$Mutation$ResizeVolume(name: volumeName); final resizeVolumeMutation = - Options$Mutation$ResizeVolumeMutation(variables: variables); - await client.mutate$ResizeVolumeMutation(resizeVolumeMutation); + Options$Mutation$ResizeVolume(variables: variables); + await client.mutate$ResizeVolume(resizeVolumeMutation); + } catch (e) { + print(e); + } + } + + Future> getServerJobs() async { + QueryResult response; + List jobs = []; + + try { + final GraphQLClient client = await getClient(); + response = await client.query$GetApiJobs(); + if (response.hasException) { + print(response.exception.toString()); + } + jobs = response.data!['jobs'] + .map((final e) => ServerJob.fromJson(e)) + .toList(); + } catch (e) { + print(e); + } + + return jobs; + } + + Future removeApiJob(final String uid) async { + try { + final GraphQLClient client = await getClient(); + //await client.query$GetApiJobsQuery(); + } catch (e) { + print(e); + } + } + + Future reboot() async { + try { + final GraphQLClient client = await getClient(); + return await _commonBoolRequest( + () async { + await client.mutate$RebootSystem(); + }, + ); + } catch (e) { + return false; + } + } + + Future pullConfigurationUpdate() async { + try { + final GraphQLClient client = await getClient(); + return await _commonBoolRequest( + () async { + await client.mutate$PullRepositoryChanges(); + }, + ); + } catch (e) { + return false; + } + } + + Future upgrade() async { + try { + final GraphQLClient client = await getClient(); + return await _commonBoolRequest( + () async { + await client.mutate$RunSystemUpgrade(); + }, + ); + } catch (e) { + return false; + } + } + + Future switchService(final String uid, final bool needTurnOn) async { + try { + final GraphQLClient client = await getClient(); + if (needTurnOn) { + final variables = Variables$Mutation$EnableService(serviceId: uid); + final mutation = Options$Mutation$EnableService(variables: variables); + await client.mutate$EnableService(mutation); + } else { + final variables = Variables$Mutation$DisableService(serviceId: uid); + final mutation = Options$Mutation$DisableService(variables: variables); + await client.mutate$DisableService(mutation); + } + } catch (e) { + print(e); + } + } + + Future apply() async { + try { + final GraphQLClient client = await getClient(); + await client.mutate$RunSystemRebuild(); } catch (e) { print(e); } 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 f88b3346..96374fad 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql @@ -1,4 +1,70 @@ -query GetApiTokensQuery { +fragment basicMutationReturnFields on MutationReturnInterface{ + code + message + success +} + +query GetApiVersion { + api { + version + } +} + +query GetApiJobs { + jobs { + getJobs { + createdAt + description + error + finishedAt + name + progress + result + status + statusText + uid + updatedAt + } + } +} + +mutation RemoveJob($jobId: String!) { + removeJob(jobId: $jobId) { + ...basicMutationReturnFields + } +} + +mutation RunSystemRebuild { + runSystemRebuild { + ...basicMutationReturnFields + } +} + +mutation RunSystemRollback { + runSystemRollback { + ...basicMutationReturnFields + } +} + +mutation RunSystemUpgrade { + runSystemUpgrade { + ...basicMutationReturnFields + } +} + +mutation PullRepositoryChanges { + pullRepositoryChanges { + ...basicMutationReturnFields + } +} + +mutation RebootSystem { + rebootSystem { + ...basicMutationReturnFields + } +} + +query GetApiTokens { api { devices { creationDate @@ -8,8 +74,61 @@ query GetApiTokensQuery { } } -query GetApiVersionQuery { +query RecoveryKey { api { - version + recoveryKey { + creationDate + exists + expirationDate + usesLeft + valid + } } -} \ No newline at end of file +} + +mutation GetNewRecoveryApiKey($limits: RecoveryKeyLimitsInput) { + getNewRecoveryApiKey(limits: $limits) { + ...basicMutationReturnFields + key + } +} + +mutation UseRecoveryApiKey($input: UseRecoveryKeyInput!) { + useRecoveryApiKey(input: $input) { + ...basicMutationReturnFields + token + } +} + +mutation RefreshDeviceApiToken { + refreshDeviceApiToken { + ...basicMutationReturnFields + token + } +} + +mutation DeleteDeviceApiToken($device: String!) { + deleteDeviceApiToken(device: $device) { + ...basicMutationReturnFields + } +} + +mutation GetNewDeviceApiKey { + getNewDeviceApiKey { + ...basicMutationReturnFields + key + } +} + +mutation InvalidateNewDeviceApiKey { + invalidateNewDeviceApiKey { + ...basicMutationReturnFields + } +} + +mutation AuthorizeWithNewDeviceApiKey($input: UseNewDeviceKeyInput!) { + authorizeWithNewDeviceApiKey(input: $input) { + ...basicMutationReturnFields + token + } +} 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 2394d113..c9d6fe1a 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,23 +1,157 @@ +import 'dart:async'; +import 'disk_volumes.graphql.dart'; 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 'server_api.graphql.g.dart'; @JsonSerializable(explicitToJson: true) -class Query$GetApiTokensQuery { - Query$GetApiTokensQuery({required this.api, required this.$__typename}); +class Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields( + {required this.code, + required this.message, + required this.success, + required this.$__typename}); @override - factory Query$GetApiTokensQuery.fromJson(Map json) => - _$Query$GetApiTokensQueryFromJson(json); + factory Fragment$basicMutationReturnFields.fromJson( + Map json) => + _$Fragment$basicMutationReturnFieldsFromJson(json); - final Query$GetApiTokensQuery$api api; + final int code; + + final String message; + + final bool success; @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$GetApiTokensQueryToJson(this); + Map toJson() => + _$Fragment$basicMutationReturnFieldsToJson(this); + 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) || + 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 + on Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields copyWith( + {int? code, String? message, bool? success, String? $__typename}) => + Fragment$basicMutationReturnFields( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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) + ])); +const documentNodeFragmentbasicMutationReturnFields = + DocumentNode(definitions: [ + fragmentDefinitionbasicMutationReturnFields, +]); + +extension ClientExtension$Fragment$basicMutationReturnFields + on graphql.GraphQLClient { + 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); + return result == null + ? null + : Fragment$basicMutationReturnFields.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$GetApiVersion { + Query$GetApiVersion({required this.api, required this.$__typename}); + + @override + factory Query$GetApiVersion.fromJson(Map json) => + _$Query$GetApiVersionFromJson(json); + + final Query$GetApiVersion$api api; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$GetApiVersionToJson(this); int get hashCode { final l$api = api; final l$$__typename = $__typename; @@ -27,7 +161,7 @@ class Query$GetApiTokensQuery { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Query$GetApiTokensQuery) || runtimeType != other.runtimeType) + if (!(other is Query$GetApiVersion) || runtimeType != other.runtimeType) return false; final l$api = api; final lOther$api = other.api; @@ -39,62 +173,2091 @@ class Query$GetApiTokensQuery { } } -extension UtilityExtension$Query$GetApiTokensQuery on Query$GetApiTokensQuery { - CopyWith$Query$GetApiTokensQuery get copyWith => - CopyWith$Query$GetApiTokensQuery(this, (i) => i); +extension UtilityExtension$Query$GetApiVersion on Query$GetApiVersion { + Query$GetApiVersion copyWith( + {Query$GetApiVersion$api? api, String? $__typename}) => + Query$GetApiVersion( + api: api == null ? this.api : api, + $__typename: $__typename == null ? this.$__typename : $__typename); } -abstract class CopyWith$Query$GetApiTokensQuery { - factory CopyWith$Query$GetApiTokensQuery(Query$GetApiTokensQuery instance, - TRes Function(Query$GetApiTokensQuery) then) = - _CopyWithImpl$Query$GetApiTokensQuery; +const documentNodeQueryGetApiVersion = DocumentNode(definitions: [ + OperationDefinitionNode( + 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: null), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), +]); +Query$GetApiVersion _parserFn$Query$GetApiVersion(Map data) => + Query$GetApiVersion.fromJson(data); - factory CopyWith$Query$GetApiTokensQuery.stub(TRes res) = - _CopyWithStubImpl$Query$GetApiTokensQuery; - - TRes call({Query$GetApiTokensQuery$api? api, String? $__typename}); - CopyWith$Query$GetApiTokensQuery$api get api; +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); } -class _CopyWithImpl$Query$GetApiTokensQuery - implements CopyWith$Query$GetApiTokensQuery { - _CopyWithImpl$Query$GetApiTokensQuery(this._instance, this._then); +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); +} - final Query$GetApiTokensQuery _instance; +class FetchMoreOptions$Query$GetApiVersion extends graphql.FetchMoreOptions { + FetchMoreOptions$Query$GetApiVersion( + {required graphql.UpdateQuery updateQuery}) + : super( + updateQuery: updateQuery, document: documentNodeQueryGetApiVersion); +} - final TRes Function(Query$GetApiTokensQuery) _then; - - static const _undefined = {}; - - TRes call({Object? api = _undefined, Object? $__typename = _undefined}) => - _then(Query$GetApiTokensQuery( - api: api == _undefined || api == null - ? _instance.api - : (api as Query$GetApiTokensQuery$api), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); - CopyWith$Query$GetApiTokensQuery$api get api { - final local$api = _instance.api; - return CopyWith$Query$GetApiTokensQuery$api(local$api, (e) => call(api: e)); +extension ClientExtension$Query$GetApiVersion on graphql.GraphQLClient { + Future> query$GetApiVersion( + [Options$Query$GetApiVersion? options]) async => + await this.query(options ?? Options$Query$GetApiVersion()); + graphql.ObservableQuery watchQuery$GetApiVersion( + [WatchOptions$Query$GetApiVersion? options]) => + this.watchQuery(options ?? WatchOptions$Query$GetApiVersion()); + 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); + return result == null ? null : Query$GetApiVersion.fromJson(result); } } -class _CopyWithStubImpl$Query$GetApiTokensQuery - implements CopyWith$Query$GetApiTokensQuery { - _CopyWithStubImpl$Query$GetApiTokensQuery(this._res); +@JsonSerializable(explicitToJson: true) +class Query$GetApiVersion$api { + Query$GetApiVersion$api({required this.version, required this.$__typename}); - TRes _res; + @override + factory Query$GetApiVersion$api.fromJson(Map json) => + _$Query$GetApiVersion$apiFromJson(json); - call({Query$GetApiTokensQuery$api? api, String? $__typename}) => _res; - CopyWith$Query$GetApiTokensQuery$api get api => - CopyWith$Query$GetApiTokensQuery$api.stub(_res); + final String version; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$GetApiVersion$apiToJson(this); + int get hashCode { + final l$version = version; + final l$$__typename = $__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) + return false; + final l$version = version; + final lOther$version = other.version; + if (l$version != lOther$version) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } } -const documentNodeQueryGetApiTokensQuery = DocumentNode(definitions: [ +extension UtilityExtension$Query$GetApiVersion$api on Query$GetApiVersion$api { + Query$GetApiVersion$api copyWith({String? version, String? $__typename}) => + Query$GetApiVersion$api( + version: version == null ? this.version : version, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Query$GetApiJobs { + Query$GetApiJobs({required this.jobs, required this.$__typename}); + + @override + factory Query$GetApiJobs.fromJson(Map json) => + _$Query$GetApiJobsFromJson(json); + + final Query$GetApiJobs$jobs jobs; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$GetApiJobsToJson(this); + int get hashCode { + final l$jobs = jobs; + final l$$__typename = $__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) + return false; + final l$jobs = jobs; + final lOther$jobs = other.jobs; + if (l$jobs != lOther$jobs) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$GetApiJobs on Query$GetApiJobs { + Query$GetApiJobs copyWith( + {Query$GetApiJobs$jobs? jobs, String? $__typename}) => + Query$GetApiJobs( + jobs: jobs == null ? this.jobs : jobs, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +const documentNodeQueryGetApiJobs = DocumentNode(definitions: [ OperationDefinitionNode( type: OperationType.query, - name: NameNode(value: 'GetApiTokensQuery'), + 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: '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) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + 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); +} + +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); +} + +class FetchMoreOptions$Query$GetApiJobs extends graphql.FetchMoreOptions { + FetchMoreOptions$Query$GetApiJobs({required graphql.UpdateQuery updateQuery}) + : super(updateQuery: updateQuery, document: documentNodeQueryGetApiJobs); +} + +extension ClientExtension$Query$GetApiJobs on graphql.GraphQLClient { + Future> query$GetApiJobs( + [Options$Query$GetApiJobs? options]) async => + await this.query(options ?? Options$Query$GetApiJobs()); + graphql.ObservableQuery watchQuery$GetApiJobs( + [WatchOptions$Query$GetApiJobs? options]) => + this.watchQuery(options ?? WatchOptions$Query$GetApiJobs()); + 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); + return result == null ? null : Query$GetApiJobs.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$GetApiJobs$jobs { + Query$GetApiJobs$jobs({required this.getJobs, required this.$__typename}); + + @override + factory Query$GetApiJobs$jobs.fromJson(Map json) => + _$Query$GetApiJobs$jobsFromJson(json); + + final List getJobs; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$GetApiJobs$jobsToJson(this); + int get hashCode { + final l$getJobs = getJobs; + final l$$__typename = $__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) + return false; + final l$getJobs = getJobs; + final lOther$getJobs = other.getJobs; + 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; + } + + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$GetApiJobs$jobs on Query$GetApiJobs$jobs { + Query$GetApiJobs$jobs copyWith( + {List? getJobs, + String? $__typename}) => + Query$GetApiJobs$jobs( + getJobs: getJobs == null ? this.getJobs : getJobs, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@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}); + + @override + factory Query$GetApiJobs$jobs$getJobs.fromJson(Map json) => + _$Query$GetApiJobs$jobs$getJobsFromJson(json); + + @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; + + final int? progress; + + final String? result; + + final String status; + + final String? statusText; + + final String uid; + + @JsonKey(fromJson: dateTimeFromJson, toJson: dateTimeToJson) + final DateTime updatedAt; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$GetApiJobs$jobs$getJobsToJson(this); + int get hashCode { + final l$createdAt = createdAt; + final l$description = description; + final l$error = error; + final l$finishedAt = finishedAt; + final l$name = name; + final l$progress = progress; + final l$result = result; + final l$status = status; + final l$statusText = statusText; + final l$uid = uid; + final l$updatedAt = updatedAt; + final l$$__typename = $__typename; + return Object.hashAll([ + l$createdAt, + l$description, + l$error, + l$finishedAt, + l$name, + l$progress, + l$result, + l$status, + l$statusText, + l$uid, + l$updatedAt, + l$$__typename + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$GetApiJobs$jobs$getJobs) || + runtimeType != other.runtimeType) return false; + final l$createdAt = createdAt; + final lOther$createdAt = other.createdAt; + if (l$createdAt != lOther$createdAt) return false; + final l$description = description; + final lOther$description = other.description; + if (l$description != lOther$description) return false; + final l$error = error; + final lOther$error = other.error; + if (l$error != lOther$error) return false; + final l$finishedAt = finishedAt; + final lOther$finishedAt = other.finishedAt; + if (l$finishedAt != lOther$finishedAt) return false; + final l$name = name; + final lOther$name = other.name; + if (l$name != lOther$name) return false; + final l$progress = progress; + final lOther$progress = other.progress; + if (l$progress != lOther$progress) return false; + final l$result = result; + final lOther$result = other.result; + if (l$result != lOther$result) return false; + final l$status = status; + final lOther$status = other.status; + if (l$status != lOther$status) return false; + final l$statusText = statusText; + final lOther$statusText = other.statusText; + if (l$statusText != lOther$statusText) return false; + final l$uid = uid; + final lOther$uid = other.uid; + if (l$uid != lOther$uid) return false; + final l$updatedAt = updatedAt; + final lOther$updatedAt = other.updatedAt; + if (l$updatedAt != lOther$updatedAt) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$GetApiJobs$jobs$getJobs + on Query$GetApiJobs$jobs$getJobs { + Query$GetApiJobs$jobs$getJobs copyWith( + {DateTime? createdAt, + String? description, + String? Function()? error, + DateTime? Function()? finishedAt, + String? name, + int? Function()? progress, + String? Function()? result, + String? status, + String? Function()? statusText, + String? uid, + DateTime? updatedAt, + String? $__typename}) => + Query$GetApiJobs$jobs$getJobs( + createdAt: createdAt == null ? this.createdAt : createdAt, + description: description == null ? this.description : description, + error: error == null ? this.error : error(), + finishedAt: finishedAt == null ? this.finishedAt : finishedAt(), + name: name == null ? this.name : name, + progress: progress == null ? this.progress : progress(), + result: result == null ? this.result : result(), + status: status == null ? this.status : status, + statusText: statusText == null ? this.statusText : statusText(), + uid: uid == null ? this.uid : uid, + updatedAt: updatedAt == null ? this.updatedAt : updatedAt, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$RemoveJob { + Variables$Mutation$RemoveJob({required this.jobId}); + + @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; + } + + Variables$Mutation$RemoveJob copyWith({String? jobId}) => + Variables$Mutation$RemoveJob(jobId: jobId == null ? this.jobId : jobId); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$RemoveJob { + Mutation$RemoveJob({required this.removeJob, required this.$__typename}); + + @override + factory Mutation$RemoveJob.fromJson(Map json) => + _$Mutation$RemoveJobFromJson(json); + + final Mutation$RemoveJob$removeJob removeJob; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$RemoveJobToJson(this); + int get hashCode { + final l$removeJob = removeJob; + final l$$__typename = $__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) + return false; + final l$removeJob = removeJob; + final lOther$removeJob = other.removeJob; + if (l$removeJob != lOther$removeJob) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$RemoveJob on Mutation$RemoveJob { + Mutation$RemoveJob copyWith( + {Mutation$RemoveJob$removeJob? removeJob, String? $__typename}) => + Mutation$RemoveJob( + removeJob: removeJob == null ? this.removeJob : removeJob, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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'))) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: []), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + 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?); + +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, + 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); + + final OnMutationCompleted$Mutation$RemoveJob? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$RemoveJob on graphql.GraphQLClient { + Future> mutate$RemoveJob( + Options$Mutation$RemoveJob options) async => + await this.mutate(options); + graphql.ObservableQuery watchMutation$RemoveJob( + WatchOptions$Mutation$RemoveJob options) => + 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}); + + @override + factory Mutation$RemoveJob$removeJob.fromJson(Map json) => + _$Mutation$RemoveJob$removeJobFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$RemoveJob$removeJobToJson(this); + 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 Mutation$RemoveJob$removeJob) || + 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$Mutation$RemoveJob$removeJob + on Mutation$RemoveJob$removeJob { + Mutation$RemoveJob$removeJob copyWith( + {int? code, String? message, bool? success, String? $__typename}) => + Mutation$RemoveJob$removeJob( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$RunSystemRebuild { + Mutation$RunSystemRebuild( + {required this.runSystemRebuild, required this.$__typename}); + + @override + factory Mutation$RunSystemRebuild.fromJson(Map json) => + _$Mutation$RunSystemRebuildFromJson(json); + + final Mutation$RunSystemRebuild$runSystemRebuild runSystemRebuild; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$RunSystemRebuildToJson(this); + int get hashCode { + final l$runSystemRebuild = runSystemRebuild; + final l$$__typename = $__typename; + return Object.hashAll([l$runSystemRebuild, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$RunSystemRebuild) || + runtimeType != other.runtimeType) return false; + final l$runSystemRebuild = runSystemRebuild; + final lOther$runSystemRebuild = other.runSystemRebuild; + if (l$runSystemRebuild != lOther$runSystemRebuild) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$RunSystemRebuild + on Mutation$RunSystemRebuild { + Mutation$RunSystemRebuild copyWith( + {Mutation$RunSystemRebuild$runSystemRebuild? runSystemRebuild, + String? $__typename}) => + Mutation$RunSystemRebuild( + runSystemRebuild: runSystemRebuild == null + ? this.runSystemRebuild + : runSystemRebuild, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: []), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + 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?); + +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, + super( + 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); + + final OnMutationCompleted$Mutation$RunSystemRebuild? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$RunSystemRebuild on graphql.GraphQLClient { + Future> + mutate$RunSystemRebuild( + [Options$Mutation$RunSystemRebuild? options]) async => + await this.mutate(options ?? Options$Mutation$RunSystemRebuild()); + graphql.ObservableQuery< + Mutation$RunSystemRebuild> watchMutation$RunSystemRebuild( + [WatchOptions$Mutation$RunSystemRebuild? options]) => + 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}); + + @override + factory Mutation$RunSystemRebuild$runSystemRebuild.fromJson( + Map json) => + _$Mutation$RunSystemRebuild$runSystemRebuildFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$RunSystemRebuild$runSystemRebuildToJson(this); + 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 Mutation$RunSystemRebuild$runSystemRebuild) || + 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$Mutation$RunSystemRebuild$runSystemRebuild + on Mutation$RunSystemRebuild$runSystemRebuild { + Mutation$RunSystemRebuild$runSystemRebuild copyWith( + {int? code, String? message, bool? success, String? $__typename}) => + Mutation$RunSystemRebuild$runSystemRebuild( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$RunSystemRollback { + Mutation$RunSystemRollback( + {required this.runSystemRollback, required this.$__typename}); + + @override + factory Mutation$RunSystemRollback.fromJson(Map json) => + _$Mutation$RunSystemRollbackFromJson(json); + + final Mutation$RunSystemRollback$runSystemRollback runSystemRollback; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$RunSystemRollbackToJson(this); + int get hashCode { + final l$runSystemRollback = runSystemRollback; + final l$$__typename = $__typename; + return Object.hashAll([l$runSystemRollback, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$RunSystemRollback) || + runtimeType != other.runtimeType) return false; + final l$runSystemRollback = runSystemRollback; + final lOther$runSystemRollback = other.runSystemRollback; + if (l$runSystemRollback != lOther$runSystemRollback) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$RunSystemRollback + on Mutation$RunSystemRollback { + Mutation$RunSystemRollback copyWith( + {Mutation$RunSystemRollback$runSystemRollback? runSystemRollback, + String? $__typename}) => + Mutation$RunSystemRollback( + runSystemRollback: runSystemRollback == null + ? this.runSystemRollback + : runSystemRollback, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: []), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + 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?); + +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, + super( + 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); + + final OnMutationCompleted$Mutation$RunSystemRollback? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$RunSystemRollback on graphql.GraphQLClient { + Future> + mutate$RunSystemRollback( + [Options$Mutation$RunSystemRollback? options]) async => + await this.mutate(options ?? Options$Mutation$RunSystemRollback()); + graphql.ObservableQuery< + Mutation$RunSystemRollback> watchMutation$RunSystemRollback( + [WatchOptions$Mutation$RunSystemRollback? options]) => + 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}); + + @override + factory Mutation$RunSystemRollback$runSystemRollback.fromJson( + Map json) => + _$Mutation$RunSystemRollback$runSystemRollbackFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$RunSystemRollback$runSystemRollbackToJson(this); + 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 Mutation$RunSystemRollback$runSystemRollback) || + 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$Mutation$RunSystemRollback$runSystemRollback + on Mutation$RunSystemRollback$runSystemRollback { + Mutation$RunSystemRollback$runSystemRollback copyWith( + {int? code, String? message, bool? success, String? $__typename}) => + Mutation$RunSystemRollback$runSystemRollback( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$RunSystemUpgrade { + Mutation$RunSystemUpgrade( + {required this.runSystemUpgrade, required this.$__typename}); + + @override + factory Mutation$RunSystemUpgrade.fromJson(Map json) => + _$Mutation$RunSystemUpgradeFromJson(json); + + final Mutation$RunSystemUpgrade$runSystemUpgrade runSystemUpgrade; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$RunSystemUpgradeToJson(this); + int get hashCode { + final l$runSystemUpgrade = runSystemUpgrade; + final l$$__typename = $__typename; + return Object.hashAll([l$runSystemUpgrade, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$RunSystemUpgrade) || + runtimeType != other.runtimeType) return false; + final l$runSystemUpgrade = runSystemUpgrade; + final lOther$runSystemUpgrade = other.runSystemUpgrade; + if (l$runSystemUpgrade != lOther$runSystemUpgrade) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$RunSystemUpgrade + on Mutation$RunSystemUpgrade { + Mutation$RunSystemUpgrade copyWith( + {Mutation$RunSystemUpgrade$runSystemUpgrade? runSystemUpgrade, + String? $__typename}) => + Mutation$RunSystemUpgrade( + runSystemUpgrade: runSystemUpgrade == null + ? this.runSystemUpgrade + : runSystemUpgrade, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: []), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + 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?); + +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, + super( + 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); + + final OnMutationCompleted$Mutation$RunSystemUpgrade? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$RunSystemUpgrade on graphql.GraphQLClient { + Future> + mutate$RunSystemUpgrade( + [Options$Mutation$RunSystemUpgrade? options]) async => + await this.mutate(options ?? Options$Mutation$RunSystemUpgrade()); + graphql.ObservableQuery< + Mutation$RunSystemUpgrade> watchMutation$RunSystemUpgrade( + [WatchOptions$Mutation$RunSystemUpgrade? options]) => + 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}); + + @override + factory Mutation$RunSystemUpgrade$runSystemUpgrade.fromJson( + Map json) => + _$Mutation$RunSystemUpgrade$runSystemUpgradeFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$RunSystemUpgrade$runSystemUpgradeToJson(this); + 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 Mutation$RunSystemUpgrade$runSystemUpgrade) || + 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$Mutation$RunSystemUpgrade$runSystemUpgrade + on Mutation$RunSystemUpgrade$runSystemUpgrade { + Mutation$RunSystemUpgrade$runSystemUpgrade copyWith( + {int? code, String? message, bool? success, String? $__typename}) => + Mutation$RunSystemUpgrade$runSystemUpgrade( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$PullRepositoryChanges { + Mutation$PullRepositoryChanges( + {required this.pullRepositoryChanges, required this.$__typename}); + + @override + factory Mutation$PullRepositoryChanges.fromJson(Map json) => + _$Mutation$PullRepositoryChangesFromJson(json); + + final Mutation$PullRepositoryChanges$pullRepositoryChanges + pullRepositoryChanges; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$PullRepositoryChangesToJson(this); + int get hashCode { + final l$pullRepositoryChanges = pullRepositoryChanges; + final l$$__typename = $__typename; + return Object.hashAll([l$pullRepositoryChanges, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$PullRepositoryChanges) || + runtimeType != other.runtimeType) return false; + final l$pullRepositoryChanges = pullRepositoryChanges; + final lOther$pullRepositoryChanges = other.pullRepositoryChanges; + if (l$pullRepositoryChanges != lOther$pullRepositoryChanges) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$PullRepositoryChanges + on Mutation$PullRepositoryChanges { + Mutation$PullRepositoryChanges copyWith( + {Mutation$PullRepositoryChanges$pullRepositoryChanges? + pullRepositoryChanges, + String? $__typename}) => + Mutation$PullRepositoryChanges( + pullRepositoryChanges: pullRepositoryChanges == null + ? this.pullRepositoryChanges + : pullRepositoryChanges, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: []), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + 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?); + +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, + super( + 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); + + final OnMutationCompleted$Mutation$PullRepositoryChanges? + onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$PullRepositoryChanges + on graphql.GraphQLClient { + Future> + mutate$PullRepositoryChanges( + [Options$Mutation$PullRepositoryChanges? options]) async => + await this + .mutate(options ?? Options$Mutation$PullRepositoryChanges()); + graphql.ObservableQuery + watchMutation$PullRepositoryChanges( + [WatchOptions$Mutation$PullRepositoryChanges? options]) => + this.watchMutation( + 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}); + + @override + factory Mutation$PullRepositoryChanges$pullRepositoryChanges.fromJson( + Map json) => + _$Mutation$PullRepositoryChanges$pullRepositoryChangesFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$PullRepositoryChanges$pullRepositoryChangesToJson(this); + 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 Mutation$PullRepositoryChanges$pullRepositoryChanges) || + 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$Mutation$PullRepositoryChanges$pullRepositoryChanges + on Mutation$PullRepositoryChanges$pullRepositoryChanges { + Mutation$PullRepositoryChanges$pullRepositoryChanges copyWith( + {int? code, String? message, bool? success, String? $__typename}) => + Mutation$PullRepositoryChanges$pullRepositoryChanges( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$RebootSystem { + Mutation$RebootSystem( + {required this.rebootSystem, required this.$__typename}); + + @override + factory Mutation$RebootSystem.fromJson(Map json) => + _$Mutation$RebootSystemFromJson(json); + + final Mutation$RebootSystem$rebootSystem rebootSystem; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$RebootSystemToJson(this); + int get hashCode { + final l$rebootSystem = rebootSystem; + final l$$__typename = $__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) + return false; + final l$rebootSystem = rebootSystem; + final lOther$rebootSystem = other.rebootSystem; + if (l$rebootSystem != lOther$rebootSystem) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$RebootSystem on Mutation$RebootSystem { + Mutation$RebootSystem copyWith( + {Mutation$RebootSystem$rebootSystem? rebootSystem, + String? $__typename}) => + Mutation$RebootSystem( + rebootSystem: rebootSystem == null ? this.rebootSystem : rebootSystem, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: []), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + 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?); + +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, + super( + 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); + + final OnMutationCompleted$Mutation$RebootSystem? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$RebootSystem on graphql.GraphQLClient { + Future> mutate$RebootSystem( + [Options$Mutation$RebootSystem? options]) async => + await this.mutate(options ?? Options$Mutation$RebootSystem()); + graphql.ObservableQuery watchMutation$RebootSystem( + [WatchOptions$Mutation$RebootSystem? options]) => + 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}); + + @override + factory Mutation$RebootSystem$rebootSystem.fromJson( + Map json) => + _$Mutation$RebootSystem$rebootSystemFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$RebootSystem$rebootSystemToJson(this); + 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 Mutation$RebootSystem$rebootSystem) || + 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$Mutation$RebootSystem$rebootSystem + on Mutation$RebootSystem$rebootSystem { + Mutation$RebootSystem$rebootSystem copyWith( + {int? code, String? message, bool? success, String? $__typename}) => + Mutation$RebootSystem$rebootSystem( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Query$GetApiTokens { + Query$GetApiTokens({required this.api, required this.$__typename}); + + @override + factory Query$GetApiTokens.fromJson(Map json) => + _$Query$GetApiTokensFromJson(json); + + final Query$GetApiTokens$api api; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$GetApiTokensToJson(this); + 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$GetApiTokens) || 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$GetApiTokens on Query$GetApiTokens { + Query$GetApiTokens copyWith( + {Query$GetApiTokens$api? api, String? $__typename}) => + Query$GetApiTokens( + api: api == null ? this.api : api, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +const documentNodeQueryGetApiTokens = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.query, + name: NameNode(value: 'GetApiTokens'), variableDefinitions: [], directives: [], selectionSet: SelectionSetNode(selections: [ @@ -150,13 +2313,12 @@ const documentNodeQueryGetApiTokensQuery = DocumentNode(definitions: [ selectionSet: null) ])), ]); -Query$GetApiTokensQuery _parserFn$Query$GetApiTokensQuery( - Map data) => - Query$GetApiTokensQuery.fromJson(data); +Query$GetApiTokens _parserFn$Query$GetApiTokens(Map data) => + Query$GetApiTokens.fromJson(data); -class Options$Query$GetApiTokensQuery - extends graphql.QueryOptions { - Options$Query$GetApiTokensQuery( +class Options$Query$GetApiTokens + extends graphql.QueryOptions { + Options$Query$GetApiTokens( {String? operationName, graphql.FetchPolicy? fetchPolicy, graphql.ErrorPolicy? errorPolicy, @@ -172,13 +2334,13 @@ class Options$Query$GetApiTokensQuery optimisticResult: optimisticResult, pollInterval: pollInterval, context: context, - document: documentNodeQueryGetApiTokensQuery, - parserFn: _parserFn$Query$GetApiTokensQuery); + document: documentNodeQueryGetApiTokens, + parserFn: _parserFn$Query$GetApiTokens); } -class WatchOptions$Query$GetApiTokensQuery - extends graphql.WatchQueryOptions { - WatchOptions$Query$GetApiTokensQuery( +class WatchOptions$Query$GetApiTokens + extends graphql.WatchQueryOptions { + WatchOptions$Query$GetApiTokens( {String? operationName, graphql.FetchPolicy? fetchPolicy, graphql.ErrorPolicy? errorPolicy, @@ -196,64 +2358,60 @@ class WatchOptions$Query$GetApiTokensQuery cacheRereadPolicy: cacheRereadPolicy, optimisticResult: optimisticResult, context: context, - document: documentNodeQueryGetApiTokensQuery, + document: documentNodeQueryGetApiTokens, pollInterval: pollInterval, eagerlyFetchResults: eagerlyFetchResults, carryForwardDataOnException: carryForwardDataOnException, fetchResults: fetchResults, - parserFn: _parserFn$Query$GetApiTokensQuery); + parserFn: _parserFn$Query$GetApiTokens); } -class FetchMoreOptions$Query$GetApiTokensQuery - extends graphql.FetchMoreOptions { - FetchMoreOptions$Query$GetApiTokensQuery( +class FetchMoreOptions$Query$GetApiTokens extends graphql.FetchMoreOptions { + FetchMoreOptions$Query$GetApiTokens( {required graphql.UpdateQuery updateQuery}) : super( - updateQuery: updateQuery, - document: documentNodeQueryGetApiTokensQuery); + updateQuery: updateQuery, document: documentNodeQueryGetApiTokens); } -extension ClientExtension$Query$GetApiTokensQuery on graphql.GraphQLClient { - Future> query$GetApiTokensQuery( - [Options$Query$GetApiTokensQuery? options]) async => - await this.query(options ?? Options$Query$GetApiTokensQuery()); - graphql.ObservableQuery watchQuery$GetApiTokensQuery( - [WatchOptions$Query$GetApiTokensQuery? options]) => - this.watchQuery(options ?? WatchOptions$Query$GetApiTokensQuery()); - void writeQuery$GetApiTokensQuery( - {required Query$GetApiTokensQuery data, bool broadcast = true}) => +extension ClientExtension$Query$GetApiTokens on graphql.GraphQLClient { + Future> query$GetApiTokens( + [Options$Query$GetApiTokens? options]) async => + await this.query(options ?? Options$Query$GetApiTokens()); + graphql.ObservableQuery watchQuery$GetApiTokens( + [WatchOptions$Query$GetApiTokens? options]) => + this.watchQuery(options ?? WatchOptions$Query$GetApiTokens()); + void writeQuery$GetApiTokens( + {required Query$GetApiTokens data, bool broadcast = true}) => this.writeQuery( graphql.Request( - operation: graphql.Operation( - document: documentNodeQueryGetApiTokensQuery)), + operation: + graphql.Operation(document: documentNodeQueryGetApiTokens)), data: data.toJson(), broadcast: broadcast); - Query$GetApiTokensQuery? readQuery$GetApiTokensQuery( - {bool optimistic = true}) { + Query$GetApiTokens? readQuery$GetApiTokens({bool optimistic = true}) { final result = this.readQuery( graphql.Request( - operation: graphql.Operation( - document: documentNodeQueryGetApiTokensQuery)), + operation: + graphql.Operation(document: documentNodeQueryGetApiTokens)), optimistic: optimistic); - return result == null ? null : Query$GetApiTokensQuery.fromJson(result); + return result == null ? null : Query$GetApiTokens.fromJson(result); } } @JsonSerializable(explicitToJson: true) -class Query$GetApiTokensQuery$api { - Query$GetApiTokensQuery$api( - {required this.devices, required this.$__typename}); +class Query$GetApiTokens$api { + Query$GetApiTokens$api({required this.devices, required this.$__typename}); @override - factory Query$GetApiTokensQuery$api.fromJson(Map json) => - _$Query$GetApiTokensQuery$apiFromJson(json); + factory Query$GetApiTokens$api.fromJson(Map json) => + _$Query$GetApiTokens$apiFromJson(json); - final List devices; + final List devices; @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$GetApiTokensQuery$apiToJson(this); + Map toJson() => _$Query$GetApiTokens$apiToJson(this); int get hashCode { final l$devices = devices; final l$$__typename = $__typename; @@ -264,8 +2422,8 @@ class Query$GetApiTokensQuery$api { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Query$GetApiTokensQuery$api) || - runtimeType != other.runtimeType) return false; + 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; @@ -282,87 +2440,26 @@ class Query$GetApiTokensQuery$api { } } -extension UtilityExtension$Query$GetApiTokensQuery$api - on Query$GetApiTokensQuery$api { - CopyWith$Query$GetApiTokensQuery$api - get copyWith => CopyWith$Query$GetApiTokensQuery$api(this, (i) => i); -} - -abstract class CopyWith$Query$GetApiTokensQuery$api { - factory CopyWith$Query$GetApiTokensQuery$api( - Query$GetApiTokensQuery$api instance, - TRes Function(Query$GetApiTokensQuery$api) then) = - _CopyWithImpl$Query$GetApiTokensQuery$api; - - factory CopyWith$Query$GetApiTokensQuery$api.stub(TRes res) = - _CopyWithStubImpl$Query$GetApiTokensQuery$api; - - TRes call( - {List? devices, - String? $__typename}); - TRes devices( - Iterable Function( - Iterable< - CopyWith$Query$GetApiTokensQuery$api$devices< - Query$GetApiTokensQuery$api$devices>>) - _fn); -} - -class _CopyWithImpl$Query$GetApiTokensQuery$api - implements CopyWith$Query$GetApiTokensQuery$api { - _CopyWithImpl$Query$GetApiTokensQuery$api(this._instance, this._then); - - final Query$GetApiTokensQuery$api _instance; - - final TRes Function(Query$GetApiTokensQuery$api) _then; - - static const _undefined = {}; - - TRes call({Object? devices = _undefined, Object? $__typename = _undefined}) => - _then(Query$GetApiTokensQuery$api( - 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< - CopyWith$Query$GetApiTokensQuery$api$devices< - Query$GetApiTokensQuery$api$devices>>) - _fn) => - call( - devices: _fn(_instance.devices.map((e) => - CopyWith$Query$GetApiTokensQuery$api$devices(e, (i) => i))) - .toList()); -} - -class _CopyWithStubImpl$Query$GetApiTokensQuery$api - implements CopyWith$Query$GetApiTokensQuery$api { - _CopyWithStubImpl$Query$GetApiTokensQuery$api(this._res); - - TRes _res; - - call( - {List? devices, +extension UtilityExtension$Query$GetApiTokens$api on Query$GetApiTokens$api { + Query$GetApiTokens$api copyWith( + {List? devices, String? $__typename}) => - _res; - devices(_fn) => _res; + Query$GetApiTokens$api( + devices: devices == null ? this.devices : devices, + $__typename: $__typename == null ? this.$__typename : $__typename); } @JsonSerializable(explicitToJson: true) -class Query$GetApiTokensQuery$api$devices { - Query$GetApiTokensQuery$api$devices( +class Query$GetApiTokens$api$devices { + Query$GetApiTokens$api$devices( {required this.creationDate, required this.isCaller, required this.name, required this.$__typename}); @override - factory Query$GetApiTokensQuery$api$devices.fromJson( - Map json) => - _$Query$GetApiTokensQuery$api$devicesFromJson(json); + factory Query$GetApiTokens$api$devices.fromJson(Map json) => + _$Query$GetApiTokens$api$devicesFromJson(json); @JsonKey(fromJson: dateTimeFromJson, toJson: dateTimeToJson) final DateTime creationDate; @@ -374,8 +2471,7 @@ class Query$GetApiTokensQuery$api$devices { @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Query$GetApiTokensQuery$api$devicesToJson(this); + Map toJson() => _$Query$GetApiTokens$api$devicesToJson(this); int get hashCode { final l$creationDate = creationDate; final l$isCaller = isCaller; @@ -387,7 +2483,7 @@ class Query$GetApiTokensQuery$api$devices { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Query$GetApiTokensQuery$api$devices) || + if (!(other is Query$GetApiTokens$api$devices) || runtimeType != other.runtimeType) return false; final l$creationDate = creationDate; final lOther$creationDate = other.creationDate; @@ -405,88 +2501,34 @@ class Query$GetApiTokensQuery$api$devices { } } -extension UtilityExtension$Query$GetApiTokensQuery$api$devices - on Query$GetApiTokensQuery$api$devices { - CopyWith$Query$GetApiTokensQuery$api$devices< - Query$GetApiTokensQuery$api$devices> - get copyWith => - CopyWith$Query$GetApiTokensQuery$api$devices(this, (i) => i); -} - -abstract class CopyWith$Query$GetApiTokensQuery$api$devices { - factory CopyWith$Query$GetApiTokensQuery$api$devices( - Query$GetApiTokensQuery$api$devices instance, - TRes Function(Query$GetApiTokensQuery$api$devices) then) = - _CopyWithImpl$Query$GetApiTokensQuery$api$devices; - - factory CopyWith$Query$GetApiTokensQuery$api$devices.stub(TRes res) = - _CopyWithStubImpl$Query$GetApiTokensQuery$api$devices; - - TRes call( - {DateTime? creationDate, - bool? isCaller, - String? name, - String? $__typename}); -} - -class _CopyWithImpl$Query$GetApiTokensQuery$api$devices - implements CopyWith$Query$GetApiTokensQuery$api$devices { - _CopyWithImpl$Query$GetApiTokensQuery$api$devices(this._instance, this._then); - - final Query$GetApiTokensQuery$api$devices _instance; - - final TRes Function(Query$GetApiTokensQuery$api$devices) _then; - - static const _undefined = {}; - - TRes call( - {Object? creationDate = _undefined, - Object? isCaller = _undefined, - Object? name = _undefined, - Object? $__typename = _undefined}) => - _then(Query$GetApiTokensQuery$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))); -} - -class _CopyWithStubImpl$Query$GetApiTokensQuery$api$devices - implements CopyWith$Query$GetApiTokensQuery$api$devices { - _CopyWithStubImpl$Query$GetApiTokensQuery$api$devices(this._res); - - TRes _res; - - call( +extension UtilityExtension$Query$GetApiTokens$api$devices + on Query$GetApiTokens$api$devices { + Query$GetApiTokens$api$devices copyWith( {DateTime? creationDate, bool? isCaller, String? name, String? $__typename}) => - _res; + Query$GetApiTokens$api$devices( + creationDate: creationDate == null ? this.creationDate : creationDate, + isCaller: isCaller == null ? this.isCaller : isCaller, + name: name == null ? this.name : name, + $__typename: $__typename == null ? this.$__typename : $__typename); } @JsonSerializable(explicitToJson: true) -class Query$GetApiVersionQuery { - Query$GetApiVersionQuery({required this.api, required this.$__typename}); +class Query$RecoveryKey { + Query$RecoveryKey({required this.api, required this.$__typename}); @override - factory Query$GetApiVersionQuery.fromJson(Map json) => - _$Query$GetApiVersionQueryFromJson(json); + factory Query$RecoveryKey.fromJson(Map json) => + _$Query$RecoveryKeyFromJson(json); - final Query$GetApiVersionQuery$api api; + final Query$RecoveryKey$api api; @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$GetApiVersionQueryToJson(this); + Map toJson() => _$Query$RecoveryKeyToJson(this); int get hashCode { final l$api = api; final l$$__typename = $__typename; @@ -496,8 +2538,8 @@ class Query$GetApiVersionQuery { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Query$GetApiVersionQuery) || - runtimeType != other.runtimeType) return false; + 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; @@ -508,64 +2550,18 @@ class Query$GetApiVersionQuery { } } -extension UtilityExtension$Query$GetApiVersionQuery - on Query$GetApiVersionQuery { - CopyWith$Query$GetApiVersionQuery get copyWith => - CopyWith$Query$GetApiVersionQuery(this, (i) => i); +extension UtilityExtension$Query$RecoveryKey on Query$RecoveryKey { + Query$RecoveryKey copyWith( + {Query$RecoveryKey$api? api, String? $__typename}) => + Query$RecoveryKey( + api: api == null ? this.api : api, + $__typename: $__typename == null ? this.$__typename : $__typename); } -abstract class CopyWith$Query$GetApiVersionQuery { - factory CopyWith$Query$GetApiVersionQuery(Query$GetApiVersionQuery instance, - TRes Function(Query$GetApiVersionQuery) then) = - _CopyWithImpl$Query$GetApiVersionQuery; - - factory CopyWith$Query$GetApiVersionQuery.stub(TRes res) = - _CopyWithStubImpl$Query$GetApiVersionQuery; - - TRes call({Query$GetApiVersionQuery$api? api, String? $__typename}); - CopyWith$Query$GetApiVersionQuery$api get api; -} - -class _CopyWithImpl$Query$GetApiVersionQuery - implements CopyWith$Query$GetApiVersionQuery { - _CopyWithImpl$Query$GetApiVersionQuery(this._instance, this._then); - - final Query$GetApiVersionQuery _instance; - - final TRes Function(Query$GetApiVersionQuery) _then; - - static const _undefined = {}; - - TRes call({Object? api = _undefined, Object? $__typename = _undefined}) => - _then(Query$GetApiVersionQuery( - api: api == _undefined || api == null - ? _instance.api - : (api as Query$GetApiVersionQuery$api), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); - CopyWith$Query$GetApiVersionQuery$api get api { - final local$api = _instance.api; - return CopyWith$Query$GetApiVersionQuery$api( - local$api, (e) => call(api: e)); - } -} - -class _CopyWithStubImpl$Query$GetApiVersionQuery - implements CopyWith$Query$GetApiVersionQuery { - _CopyWithStubImpl$Query$GetApiVersionQuery(this._res); - - TRes _res; - - call({Query$GetApiVersionQuery$api? api, String? $__typename}) => _res; - CopyWith$Query$GetApiVersionQuery$api get api => - CopyWith$Query$GetApiVersionQuery$api.stub(_res); -} - -const documentNodeQueryGetApiVersionQuery = DocumentNode(definitions: [ +const documentNodeQueryRecoveryKey = DocumentNode(definitions: [ OperationDefinitionNode( type: OperationType.query, - name: NameNode(value: 'GetApiVersionQuery'), + name: NameNode(value: 'RecoveryKey'), variableDefinitions: [], directives: [], selectionSet: SelectionSetNode(selections: [ @@ -576,7 +2572,402 @@ const documentNodeQueryGetApiVersionQuery = DocumentNode(definitions: [ directives: [], selectionSet: SelectionSetNode(selections: [ FieldNode( - name: NameNode(value: 'version'), + 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) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + 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); +} + +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); +} + +class FetchMoreOptions$Query$RecoveryKey extends graphql.FetchMoreOptions { + FetchMoreOptions$Query$RecoveryKey({required graphql.UpdateQuery updateQuery}) + : super(updateQuery: updateQuery, document: documentNodeQueryRecoveryKey); +} + +extension ClientExtension$Query$RecoveryKey on graphql.GraphQLClient { + Future> query$RecoveryKey( + [Options$Query$RecoveryKey? options]) async => + await this.query(options ?? Options$Query$RecoveryKey()); + graphql.ObservableQuery watchQuery$RecoveryKey( + [WatchOptions$Query$RecoveryKey? options]) => + this.watchQuery(options ?? WatchOptions$Query$RecoveryKey()); + 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); + return result == null ? null : Query$RecoveryKey.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$RecoveryKey$api { + Query$RecoveryKey$api({required this.recoveryKey, required this.$__typename}); + + @override + factory Query$RecoveryKey$api.fromJson(Map json) => + _$Query$RecoveryKey$apiFromJson(json); + + final Query$RecoveryKey$api$recoveryKey recoveryKey; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$RecoveryKey$apiToJson(this); + int get hashCode { + final l$recoveryKey = recoveryKey; + final l$$__typename = $__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) + return false; + final l$recoveryKey = recoveryKey; + final lOther$recoveryKey = other.recoveryKey; + if (l$recoveryKey != lOther$recoveryKey) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$RecoveryKey$api on Query$RecoveryKey$api { + Query$RecoveryKey$api copyWith( + {Query$RecoveryKey$api$recoveryKey? recoveryKey, + String? $__typename}) => + Query$RecoveryKey$api( + recoveryKey: recoveryKey == null ? this.recoveryKey : recoveryKey, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@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}); + + @override + factory Query$RecoveryKey$api$recoveryKey.fromJson( + Map json) => + _$Query$RecoveryKey$api$recoveryKeyFromJson(json); + + @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); + int get hashCode { + final l$creationDate = creationDate; + final l$exists = exists; + final l$expirationDate = expirationDate; + final l$usesLeft = usesLeft; + final l$valid = valid; + final l$$__typename = $__typename; + return Object.hashAll([ + l$creationDate, + l$exists, + l$expirationDate, + l$usesLeft, + l$valid, + l$$__typename + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$RecoveryKey$api$recoveryKey) || + runtimeType != other.runtimeType) return false; + final l$creationDate = creationDate; + final lOther$creationDate = other.creationDate; + if (l$creationDate != lOther$creationDate) return false; + final l$exists = exists; + final lOther$exists = other.exists; + if (l$exists != lOther$exists) return false; + final l$expirationDate = expirationDate; + final lOther$expirationDate = other.expirationDate; + if (l$expirationDate != lOther$expirationDate) return false; + final l$usesLeft = usesLeft; + final lOther$usesLeft = other.usesLeft; + if (l$usesLeft != lOther$usesLeft) return false; + final l$valid = valid; + final lOther$valid = other.valid; + if (l$valid != lOther$valid) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$RecoveryKey$api$recoveryKey + on Query$RecoveryKey$api$recoveryKey { + Query$RecoveryKey$api$recoveryKey copyWith( + {DateTime? Function()? creationDate, + bool? exists, + DateTime? Function()? expirationDate, + int? Function()? usesLeft, + bool? valid, + String? $__typename}) => + Query$RecoveryKey$api$recoveryKey( + creationDate: + creationDate == null ? this.creationDate : creationDate(), + exists: exists == null ? this.exists : exists, + expirationDate: + expirationDate == null ? this.expirationDate : expirationDate(), + usesLeft: usesLeft == null ? this.usesLeft : usesLeft(), + valid: valid == null ? this.valid : valid, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$GetNewRecoveryApiKey { + Variables$Mutation$GetNewRecoveryApiKey({this.limits}); + + @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]); + } + + @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; + } + + Variables$Mutation$GetNewRecoveryApiKey copyWith( + {Input$RecoveryKeyLimitsInput? Function()? limits}) => + Variables$Mutation$GetNewRecoveryApiKey( + limits: limits == null ? this.limits : limits()); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$GetNewRecoveryApiKey { + Mutation$GetNewRecoveryApiKey( + {required this.getNewRecoveryApiKey, required this.$__typename}); + + @override + factory Mutation$GetNewRecoveryApiKey.fromJson(Map json) => + _$Mutation$GetNewRecoveryApiKeyFromJson(json); + + final Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey getNewRecoveryApiKey; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$GetNewRecoveryApiKeyToJson(this); + int get hashCode { + final l$getNewRecoveryApiKey = getNewRecoveryApiKey; + final l$$__typename = $__typename; + return Object.hashAll([l$getNewRecoveryApiKey, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$GetNewRecoveryApiKey) || + runtimeType != other.runtimeType) return false; + final l$getNewRecoveryApiKey = getNewRecoveryApiKey; + final lOther$getNewRecoveryApiKey = other.getNewRecoveryApiKey; + if (l$getNewRecoveryApiKey != lOther$getNewRecoveryApiKey) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$GetNewRecoveryApiKey + on Mutation$GetNewRecoveryApiKey { + Mutation$GetNewRecoveryApiKey copyWith( + {Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey? + getNewRecoveryApiKey, + String? $__typename}) => + Mutation$GetNewRecoveryApiKey( + getNewRecoveryApiKey: getNewRecoveryApiKey == null + ? this.getNewRecoveryApiKey + : getNewRecoveryApiKey, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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'))) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: []), + FieldNode( + name: NameNode(value: 'key'), alias: null, arguments: [], directives: [], @@ -595,36 +2986,623 @@ const documentNodeQueryGetApiVersionQuery = DocumentNode(definitions: [ directives: [], selectionSet: null) ])), + fragmentDefinitionbasicMutationReturnFields, ]); -Query$GetApiVersionQuery _parserFn$Query$GetApiVersionQuery( +Mutation$GetNewRecoveryApiKey _parserFn$Mutation$GetNewRecoveryApiKey( Map data) => - Query$GetApiVersionQuery.fromJson(data); + Mutation$GetNewRecoveryApiKey.fromJson(data); +typedef OnMutationCompleted$Mutation$GetNewRecoveryApiKey = FutureOr + Function(dynamic, Mutation$GetNewRecoveryApiKey?); -class Options$Query$GetApiVersionQuery - extends graphql.QueryOptions { - Options$Query$GetApiVersionQuery( +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, - Duration? pollInterval, - graphql.Context? context}) - : super( + 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, - pollInterval: pollInterval, context: context, - document: documentNodeQueryGetApiVersionQuery, - parserFn: _parserFn$Query$GetApiVersionQuery); + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( + data, + data == null + ? null + : _parserFn$Mutation$GetNewRecoveryApiKey(data)), + update: update, + onError: onError, + document: documentNodeMutationGetNewRecoveryApiKey, + parserFn: _parserFn$Mutation$GetNewRecoveryApiKey); + + final OnMutationCompleted$Mutation$GetNewRecoveryApiKey? + onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + onCompletedWithParsed + ]; } -class WatchOptions$Query$GetApiVersionQuery - extends graphql.WatchQueryOptions { - WatchOptions$Query$GetApiVersionQuery( +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); +} + +extension ClientExtension$Mutation$GetNewRecoveryApiKey + on graphql.GraphQLClient { + Future> + mutate$GetNewRecoveryApiKey( + [Options$Mutation$GetNewRecoveryApiKey? options]) async => + await this.mutate(options ?? Options$Mutation$GetNewRecoveryApiKey()); + graphql.ObservableQuery + watchMutation$GetNewRecoveryApiKey( + [WatchOptions$Mutation$GetNewRecoveryApiKey? options]) => + this.watchMutation( + 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}); + + @override + factory Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey.fromJson( + Map json) => + _$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKeyFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + final String? key; + + Map toJson() => + _$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKeyToJson(this); + 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]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey) || + 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; + final l$key = key; + final lOther$key = other.key; + if (l$key != lOther$key) return false; + return true; + } +} + +extension UtilityExtension$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey + on Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey { + Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey copyWith( + {int? code, + String? message, + bool? success, + String? $__typename, + String? Function()? key}) => + Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename, + key: key == null ? this.key : key()); +} + +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$UseRecoveryApiKey { + Variables$Mutation$UseRecoveryApiKey({required this.input}); + + @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]); + } + + @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; + } + + Variables$Mutation$UseRecoveryApiKey copyWith( + {Input$UseRecoveryKeyInput? input}) => + Variables$Mutation$UseRecoveryApiKey( + input: input == null ? this.input : input); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$UseRecoveryApiKey { + Mutation$UseRecoveryApiKey( + {required this.useRecoveryApiKey, required this.$__typename}); + + @override + factory Mutation$UseRecoveryApiKey.fromJson(Map json) => + _$Mutation$UseRecoveryApiKeyFromJson(json); + + final Mutation$UseRecoveryApiKey$useRecoveryApiKey useRecoveryApiKey; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$UseRecoveryApiKeyToJson(this); + int get hashCode { + final l$useRecoveryApiKey = useRecoveryApiKey; + final l$$__typename = $__typename; + return Object.hashAll([l$useRecoveryApiKey, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$UseRecoveryApiKey) || + runtimeType != other.runtimeType) return false; + final l$useRecoveryApiKey = useRecoveryApiKey; + final lOther$useRecoveryApiKey = other.useRecoveryApiKey; + if (l$useRecoveryApiKey != lOther$useRecoveryApiKey) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$UseRecoveryApiKey + on Mutation$UseRecoveryApiKey { + Mutation$UseRecoveryApiKey copyWith( + {Mutation$UseRecoveryApiKey$useRecoveryApiKey? useRecoveryApiKey, + String? $__typename}) => + Mutation$UseRecoveryApiKey( + useRecoveryApiKey: useRecoveryApiKey == null + ? this.useRecoveryApiKey + : useRecoveryApiKey, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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'))) + ], + 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( + 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?); + +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, + 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$UseRecoveryApiKey(data)), + update: update, + onError: onError, + document: documentNodeMutationUseRecoveryApiKey, + parserFn: _parserFn$Mutation$UseRecoveryApiKey); + + final OnMutationCompleted$Mutation$UseRecoveryApiKey? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$UseRecoveryApiKey on graphql.GraphQLClient { + Future> + mutate$UseRecoveryApiKey( + Options$Mutation$UseRecoveryApiKey options) async => + await this.mutate(options); + graphql.ObservableQuery + watchMutation$UseRecoveryApiKey( + WatchOptions$Mutation$UseRecoveryApiKey options) => + 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}); + + @override + factory Mutation$UseRecoveryApiKey$useRecoveryApiKey.fromJson( + Map json) => + _$Mutation$UseRecoveryApiKey$useRecoveryApiKeyFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + final String? token; + + Map toJson() => + _$Mutation$UseRecoveryApiKey$useRecoveryApiKeyToJson(this); + 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]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$UseRecoveryApiKey$useRecoveryApiKey) || + 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; + final l$token = token; + final lOther$token = other.token; + if (l$token != lOther$token) return false; + return true; + } +} + +extension UtilityExtension$Mutation$UseRecoveryApiKey$useRecoveryApiKey + on Mutation$UseRecoveryApiKey$useRecoveryApiKey { + Mutation$UseRecoveryApiKey$useRecoveryApiKey copyWith( + {int? code, + String? message, + bool? success, + String? $__typename, + String? Function()? token}) => + Mutation$UseRecoveryApiKey$useRecoveryApiKey( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename, + token: token == null ? this.token : token()); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$RefreshDeviceApiToken { + Mutation$RefreshDeviceApiToken( + {required this.refreshDeviceApiToken, required this.$__typename}); + + @override + factory Mutation$RefreshDeviceApiToken.fromJson(Map json) => + _$Mutation$RefreshDeviceApiTokenFromJson(json); + + final Mutation$RefreshDeviceApiToken$refreshDeviceApiToken + refreshDeviceApiToken; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$RefreshDeviceApiTokenToJson(this); + int get hashCode { + final l$refreshDeviceApiToken = refreshDeviceApiToken; + final l$$__typename = $__typename; + return Object.hashAll([l$refreshDeviceApiToken, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$RefreshDeviceApiToken) || + runtimeType != other.runtimeType) return false; + final l$refreshDeviceApiToken = refreshDeviceApiToken; + final lOther$refreshDeviceApiToken = other.refreshDeviceApiToken; + if (l$refreshDeviceApiToken != lOther$refreshDeviceApiToken) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$RefreshDeviceApiToken + on Mutation$RefreshDeviceApiToken { + Mutation$RefreshDeviceApiToken copyWith( + {Mutation$RefreshDeviceApiToken$refreshDeviceApiToken? + refreshDeviceApiToken, + String? $__typename}) => + Mutation$RefreshDeviceApiToken( + refreshDeviceApiToken: refreshDeviceApiToken == null + ? this.refreshDeviceApiToken + : refreshDeviceApiToken, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +const documentNodeMutationRefreshDeviceApiToken = DocumentNode(definitions: [ + OperationDefinitionNode( + 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: null), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + 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?); + +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, + super( + 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); + + final OnMutationCompleted$Mutation$RefreshDeviceApiToken? + onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + onCompletedWithParsed + ]; +} + +class WatchOptions$Mutation$RefreshDeviceApiToken + extends graphql.WatchQueryOptions { + WatchOptions$Mutation$RefreshDeviceApiToken( {String? operationName, graphql.FetchPolicy? fetchPolicy, graphql.ErrorPolicy? errorPolicy, @@ -642,80 +3620,169 @@ class WatchOptions$Query$GetApiVersionQuery cacheRereadPolicy: cacheRereadPolicy, optimisticResult: optimisticResult, context: context, - document: documentNodeQueryGetApiVersionQuery, + document: documentNodeMutationRefreshDeviceApiToken, pollInterval: pollInterval, eagerlyFetchResults: eagerlyFetchResults, carryForwardDataOnException: carryForwardDataOnException, fetchResults: fetchResults, - parserFn: _parserFn$Query$GetApiVersionQuery); + parserFn: _parserFn$Mutation$RefreshDeviceApiToken); } -class FetchMoreOptions$Query$GetApiVersionQuery - extends graphql.FetchMoreOptions { - FetchMoreOptions$Query$GetApiVersionQuery( - {required graphql.UpdateQuery updateQuery}) - : super( - updateQuery: updateQuery, - document: documentNodeQueryGetApiVersionQuery); -} - -extension ClientExtension$Query$GetApiVersionQuery on graphql.GraphQLClient { - Future> - query$GetApiVersionQuery( - [Options$Query$GetApiVersionQuery? options]) async => - await this.query(options ?? Options$Query$GetApiVersionQuery()); - graphql.ObservableQuery - watchQuery$GetApiVersionQuery( - [WatchOptions$Query$GetApiVersionQuery? options]) => - this.watchQuery(options ?? WatchOptions$Query$GetApiVersionQuery()); - void writeQuery$GetApiVersionQuery( - {required Query$GetApiVersionQuery data, bool broadcast = true}) => - this.writeQuery( - graphql.Request( - operation: graphql.Operation( - document: documentNodeQueryGetApiVersionQuery)), - data: data.toJson(), - broadcast: broadcast); - Query$GetApiVersionQuery? readQuery$GetApiVersionQuery( - {bool optimistic = true}) { - final result = this.readQuery( - graphql.Request( - operation: graphql.Operation( - document: documentNodeQueryGetApiVersionQuery)), - optimistic: optimistic); - return result == null ? null : Query$GetApiVersionQuery.fromJson(result); - } +extension ClientExtension$Mutation$RefreshDeviceApiToken + on graphql.GraphQLClient { + Future> + mutate$RefreshDeviceApiToken( + [Options$Mutation$RefreshDeviceApiToken? options]) async => + await this + .mutate(options ?? Options$Mutation$RefreshDeviceApiToken()); + graphql.ObservableQuery + watchMutation$RefreshDeviceApiToken( + [WatchOptions$Mutation$RefreshDeviceApiToken? options]) => + this.watchMutation( + options ?? WatchOptions$Mutation$RefreshDeviceApiToken()); } @JsonSerializable(explicitToJson: true) -class Query$GetApiVersionQuery$api { - Query$GetApiVersionQuery$api( - {required this.version, required this.$__typename}); +class Mutation$RefreshDeviceApiToken$refreshDeviceApiToken + implements Fragment$basicMutationReturnFields { + Mutation$RefreshDeviceApiToken$refreshDeviceApiToken( + {required this.code, + required this.message, + required this.success, + required this.$__typename, + this.token}); @override - factory Query$GetApiVersionQuery$api.fromJson(Map json) => - _$Query$GetApiVersionQuery$apiFromJson(json); + factory Mutation$RefreshDeviceApiToken$refreshDeviceApiToken.fromJson( + Map json) => + _$Mutation$RefreshDeviceApiToken$refreshDeviceApiTokenFromJson(json); - final String version; + final int code; + + final String message; + + final bool success; @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Query$GetApiVersionQuery$apiToJson(this); + final String? token; + + Map toJson() => + _$Mutation$RefreshDeviceApiToken$refreshDeviceApiTokenToJson(this); int get hashCode { - final l$version = version; + final l$code = code; + final l$message = message; + final l$success = success; final l$$__typename = $__typename; - return Object.hashAll([l$version, l$$__typename]); + final l$token = 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 (!(other is Query$GetApiVersionQuery$api) || + if (!(other is Mutation$RefreshDeviceApiToken$refreshDeviceApiToken) || runtimeType != other.runtimeType) return false; - final l$version = version; - final lOther$version = other.version; - if (l$version != lOther$version) 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; + final l$token = token; + final lOther$token = other.token; + if (l$token != lOther$token) return false; + return true; + } +} + +extension UtilityExtension$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken + on Mutation$RefreshDeviceApiToken$refreshDeviceApiToken { + Mutation$RefreshDeviceApiToken$refreshDeviceApiToken copyWith( + {int? code, + String? message, + bool? success, + String? $__typename, + String? Function()? token}) => + Mutation$RefreshDeviceApiToken$refreshDeviceApiToken( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename, + token: token == null ? this.token : token()); +} + +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$DeleteDeviceApiToken { + Variables$Mutation$DeleteDeviceApiToken({required this.device}); + + @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]); + } + + @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; + } + + Variables$Mutation$DeleteDeviceApiToken copyWith({String? device}) => + Variables$Mutation$DeleteDeviceApiToken( + device: device == null ? this.device : device); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$DeleteDeviceApiToken { + Mutation$DeleteDeviceApiToken( + {required this.deleteDeviceApiToken, required this.$__typename}); + + @override + factory Mutation$DeleteDeviceApiToken.fromJson(Map json) => + _$Mutation$DeleteDeviceApiTokenFromJson(json); + + final Mutation$DeleteDeviceApiToken$deleteDeviceApiToken deleteDeviceApiToken; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$DeleteDeviceApiTokenToJson(this); + int get hashCode { + final l$deleteDeviceApiToken = deleteDeviceApiToken; + final l$$__typename = $__typename; + return Object.hashAll([l$deleteDeviceApiToken, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$DeleteDeviceApiToken) || + runtimeType != other.runtimeType) return false; + final l$deleteDeviceApiToken = deleteDeviceApiToken; + final lOther$deleteDeviceApiToken = other.deleteDeviceApiToken; + if (l$deleteDeviceApiToken != lOther$deleteDeviceApiToken) return false; final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; if (l$$__typename != lOther$$__typename) return false; @@ -723,49 +3790,1035 @@ class Query$GetApiVersionQuery$api { } } -extension UtilityExtension$Query$GetApiVersionQuery$api - on Query$GetApiVersionQuery$api { - CopyWith$Query$GetApiVersionQuery$api - get copyWith => CopyWith$Query$GetApiVersionQuery$api(this, (i) => i); +extension UtilityExtension$Mutation$DeleteDeviceApiToken + on Mutation$DeleteDeviceApiToken { + Mutation$DeleteDeviceApiToken copyWith( + {Mutation$DeleteDeviceApiToken$deleteDeviceApiToken? + deleteDeviceApiToken, + String? $__typename}) => + Mutation$DeleteDeviceApiToken( + deleteDeviceApiToken: deleteDeviceApiToken == null + ? this.deleteDeviceApiToken + : deleteDeviceApiToken, + $__typename: $__typename == null ? this.$__typename : $__typename); } -abstract class CopyWith$Query$GetApiVersionQuery$api { - factory CopyWith$Query$GetApiVersionQuery$api( - Query$GetApiVersionQuery$api instance, - TRes Function(Query$GetApiVersionQuery$api) then) = - _CopyWithImpl$Query$GetApiVersionQuery$api; +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'))) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: []), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + 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?); - factory CopyWith$Query$GetApiVersionQuery$api.stub(TRes res) = - _CopyWithStubImpl$Query$GetApiVersionQuery$api; +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, + 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$DeleteDeviceApiToken(data)), + update: update, + onError: onError, + document: documentNodeMutationDeleteDeviceApiToken, + parserFn: _parserFn$Mutation$DeleteDeviceApiToken); - TRes call({String? version, String? $__typename}); + final OnMutationCompleted$Mutation$DeleteDeviceApiToken? + onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + onCompletedWithParsed + ]; } -class _CopyWithImpl$Query$GetApiVersionQuery$api - implements CopyWith$Query$GetApiVersionQuery$api { - _CopyWithImpl$Query$GetApiVersionQuery$api(this._instance, this._then); - - final Query$GetApiVersionQuery$api _instance; - - final TRes Function(Query$GetApiVersionQuery$api) _then; - - static const _undefined = {}; - - TRes call({Object? version = _undefined, Object? $__typename = _undefined}) => - _then(Query$GetApiVersionQuery$api( - version: version == _undefined || version == null - ? _instance.version - : (version as String), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); +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); } -class _CopyWithStubImpl$Query$GetApiVersionQuery$api - implements CopyWith$Query$GetApiVersionQuery$api { - _CopyWithStubImpl$Query$GetApiVersionQuery$api(this._res); - - TRes _res; - - call({String? version, String? $__typename}) => _res; +extension ClientExtension$Mutation$DeleteDeviceApiToken + on graphql.GraphQLClient { + Future> + mutate$DeleteDeviceApiToken( + Options$Mutation$DeleteDeviceApiToken options) async => + await this.mutate(options); + graphql.ObservableQuery + watchMutation$DeleteDeviceApiToken( + WatchOptions$Mutation$DeleteDeviceApiToken options) => + 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}); + + @override + factory Mutation$DeleteDeviceApiToken$deleteDeviceApiToken.fromJson( + Map json) => + _$Mutation$DeleteDeviceApiToken$deleteDeviceApiTokenFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$DeleteDeviceApiToken$deleteDeviceApiTokenToJson(this); + 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 Mutation$DeleteDeviceApiToken$deleteDeviceApiToken) || + 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$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken + on Mutation$DeleteDeviceApiToken$deleteDeviceApiToken { + Mutation$DeleteDeviceApiToken$deleteDeviceApiToken copyWith( + {int? code, String? message, bool? success, String? $__typename}) => + Mutation$DeleteDeviceApiToken$deleteDeviceApiToken( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$GetNewDeviceApiKey { + Mutation$GetNewDeviceApiKey( + {required this.getNewDeviceApiKey, required this.$__typename}); + + @override + factory Mutation$GetNewDeviceApiKey.fromJson(Map json) => + _$Mutation$GetNewDeviceApiKeyFromJson(json); + + final Mutation$GetNewDeviceApiKey$getNewDeviceApiKey getNewDeviceApiKey; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$GetNewDeviceApiKeyToJson(this); + int get hashCode { + final l$getNewDeviceApiKey = getNewDeviceApiKey; + final l$$__typename = $__typename; + return Object.hashAll([l$getNewDeviceApiKey, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$GetNewDeviceApiKey) || + runtimeType != other.runtimeType) return false; + final l$getNewDeviceApiKey = getNewDeviceApiKey; + final lOther$getNewDeviceApiKey = other.getNewDeviceApiKey; + if (l$getNewDeviceApiKey != lOther$getNewDeviceApiKey) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$GetNewDeviceApiKey + on Mutation$GetNewDeviceApiKey { + Mutation$GetNewDeviceApiKey copyWith( + {Mutation$GetNewDeviceApiKey$getNewDeviceApiKey? getNewDeviceApiKey, + String? $__typename}) => + Mutation$GetNewDeviceApiKey( + getNewDeviceApiKey: getNewDeviceApiKey == null + ? this.getNewDeviceApiKey + : getNewDeviceApiKey, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +const documentNodeMutationGetNewDeviceApiKey = DocumentNode(definitions: [ + OperationDefinitionNode( + 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: null), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + 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?); + +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, + super( + 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); + + final OnMutationCompleted$Mutation$GetNewDeviceApiKey? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$GetNewDeviceApiKey on graphql.GraphQLClient { + Future> + mutate$GetNewDeviceApiKey( + [Options$Mutation$GetNewDeviceApiKey? options]) async => + await this.mutate(options ?? Options$Mutation$GetNewDeviceApiKey()); + graphql.ObservableQuery< + Mutation$GetNewDeviceApiKey> watchMutation$GetNewDeviceApiKey( + [WatchOptions$Mutation$GetNewDeviceApiKey? options]) => + 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}); + + @override + factory Mutation$GetNewDeviceApiKey$getNewDeviceApiKey.fromJson( + Map json) => + _$Mutation$GetNewDeviceApiKey$getNewDeviceApiKeyFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + final String? key; + + Map toJson() => + _$Mutation$GetNewDeviceApiKey$getNewDeviceApiKeyToJson(this); + 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]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$GetNewDeviceApiKey$getNewDeviceApiKey) || + 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; + final l$key = key; + final lOther$key = other.key; + if (l$key != lOther$key) return false; + return true; + } +} + +extension UtilityExtension$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey + on Mutation$GetNewDeviceApiKey$getNewDeviceApiKey { + Mutation$GetNewDeviceApiKey$getNewDeviceApiKey copyWith( + {int? code, + String? message, + bool? success, + String? $__typename, + String? Function()? key}) => + Mutation$GetNewDeviceApiKey$getNewDeviceApiKey( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename, + key: key == null ? this.key : key()); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$InvalidateNewDeviceApiKey { + Mutation$InvalidateNewDeviceApiKey( + {required this.invalidateNewDeviceApiKey, required this.$__typename}); + + @override + factory Mutation$InvalidateNewDeviceApiKey.fromJson( + Map json) => + _$Mutation$InvalidateNewDeviceApiKeyFromJson(json); + + final Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey + invalidateNewDeviceApiKey; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$InvalidateNewDeviceApiKeyToJson(this); + int get hashCode { + final l$invalidateNewDeviceApiKey = invalidateNewDeviceApiKey; + final l$$__typename = $__typename; + return Object.hashAll([l$invalidateNewDeviceApiKey, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$InvalidateNewDeviceApiKey) || + runtimeType != other.runtimeType) return false; + final l$invalidateNewDeviceApiKey = invalidateNewDeviceApiKey; + final lOther$invalidateNewDeviceApiKey = other.invalidateNewDeviceApiKey; + if (l$invalidateNewDeviceApiKey != lOther$invalidateNewDeviceApiKey) + return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$InvalidateNewDeviceApiKey + on Mutation$InvalidateNewDeviceApiKey { + Mutation$InvalidateNewDeviceApiKey copyWith( + {Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey? + invalidateNewDeviceApiKey, + String? $__typename}) => + Mutation$InvalidateNewDeviceApiKey( + invalidateNewDeviceApiKey: invalidateNewDeviceApiKey == null + ? this.invalidateNewDeviceApiKey + : invalidateNewDeviceApiKey, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: []), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + 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?); + +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, + super( + 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); + + final OnMutationCompleted$Mutation$InvalidateNewDeviceApiKey? + onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$InvalidateNewDeviceApiKey + on graphql.GraphQLClient { + Future> + mutate$InvalidateNewDeviceApiKey( + [Options$Mutation$InvalidateNewDeviceApiKey? options]) async => + await this + .mutate(options ?? Options$Mutation$InvalidateNewDeviceApiKey()); + graphql.ObservableQuery + watchMutation$InvalidateNewDeviceApiKey( + [WatchOptions$Mutation$InvalidateNewDeviceApiKey? options]) => + this.watchMutation( + 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}); + + @override + factory Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey.fromJson( + Map json) => + _$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKeyFromJson( + json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKeyToJson( + this); + 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 Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey) || + 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$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey + on Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey { + Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey copyWith( + {int? code, String? message, bool? success, String? $__typename}) => + Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$AuthorizeWithNewDeviceApiKey { + Variables$Mutation$AuthorizeWithNewDeviceApiKey({required this.input}); + + @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]); + } + + @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; + } + + Variables$Mutation$AuthorizeWithNewDeviceApiKey copyWith( + {Input$UseNewDeviceKeyInput? input}) => + Variables$Mutation$AuthorizeWithNewDeviceApiKey( + input: input == null ? this.input : input); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$AuthorizeWithNewDeviceApiKey { + Mutation$AuthorizeWithNewDeviceApiKey( + {required this.authorizeWithNewDeviceApiKey, required this.$__typename}); + + @override + factory Mutation$AuthorizeWithNewDeviceApiKey.fromJson( + Map json) => + _$Mutation$AuthorizeWithNewDeviceApiKeyFromJson(json); + + final Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey + authorizeWithNewDeviceApiKey; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$AuthorizeWithNewDeviceApiKeyToJson(this); + int get hashCode { + final l$authorizeWithNewDeviceApiKey = authorizeWithNewDeviceApiKey; + final l$$__typename = $__typename; + return Object.hashAll([l$authorizeWithNewDeviceApiKey, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$AuthorizeWithNewDeviceApiKey) || + runtimeType != other.runtimeType) return false; + final l$authorizeWithNewDeviceApiKey = authorizeWithNewDeviceApiKey; + final lOther$authorizeWithNewDeviceApiKey = + other.authorizeWithNewDeviceApiKey; + if (l$authorizeWithNewDeviceApiKey != lOther$authorizeWithNewDeviceApiKey) + return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$AuthorizeWithNewDeviceApiKey + on Mutation$AuthorizeWithNewDeviceApiKey { + Mutation$AuthorizeWithNewDeviceApiKey copyWith( + {Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey? + authorizeWithNewDeviceApiKey, + String? $__typename}) => + Mutation$AuthorizeWithNewDeviceApiKey( + authorizeWithNewDeviceApiKey: authorizeWithNewDeviceApiKey == null + ? this.authorizeWithNewDeviceApiKey + : authorizeWithNewDeviceApiKey, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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'))) + ], + 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( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), + fragmentDefinitionbasicMutationReturnFields, +]); +Mutation$AuthorizeWithNewDeviceApiKey + _parserFn$Mutation$AuthorizeWithNewDeviceApiKey( + Map data) => + Mutation$AuthorizeWithNewDeviceApiKey.fromJson(data); +typedef OnMutationCompleted$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, + 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$AuthorizeWithNewDeviceApiKey( + data)), + update: update, + onError: onError, + document: documentNodeMutationAuthorizeWithNewDeviceApiKey, + parserFn: _parserFn$Mutation$AuthorizeWithNewDeviceApiKey); + + final OnMutationCompleted$Mutation$AuthorizeWithNewDeviceApiKey? + onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$AuthorizeWithNewDeviceApiKey + on graphql.GraphQLClient { + Future> + mutate$AuthorizeWithNewDeviceApiKey( + Options$Mutation$AuthorizeWithNewDeviceApiKey options) async => + await this.mutate(options); + graphql.ObservableQuery + watchMutation$AuthorizeWithNewDeviceApiKey( + WatchOptions$Mutation$AuthorizeWithNewDeviceApiKey options) => + 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}); + + @override + factory Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey.fromJson( + Map json) => + _$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKeyFromJson( + json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + final String? token; + + Map toJson() => + _$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKeyToJson( + this); + 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]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other + is Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey) || + 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; + final l$token = token; + final lOther$token = other.token; + if (l$token != lOther$token) return false; + return true; + } +} + +extension UtilityExtension$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey + on Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey { + Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey copyWith( + {int? code, + String? message, + bool? success, + String? $__typename, + String? Function()? token}) => + Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename, + token: token == null ? this.token : token()); +} + +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 index dcb8ba01..525f8d64 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 @@ -6,49 +6,370 @@ part of 'server_api.graphql.dart'; // JsonSerializableGenerator // ************************************************************************** -Query$GetApiTokensQuery _$Query$GetApiTokensQueryFromJson( +Fragment$basicMutationReturnFields _$Fragment$basicMutationReturnFieldsFromJson( Map json) => - Query$GetApiTokensQuery( - api: Query$GetApiTokensQuery$api.fromJson( - json['api'] as Map), + Fragment$basicMutationReturnFields( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, $__typename: json['__typename'] as String, ); -Map _$Query$GetApiTokensQueryToJson( - Query$GetApiTokensQuery instance) => +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$GetApiTokensQuery$api _$Query$GetApiTokensQuery$apiFromJson( +Query$GetApiVersion$api _$Query$GetApiVersion$apiFromJson( Map json) => - Query$GetApiTokensQuery$api( + 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$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$GetApiTokensQuery$api$devices.fromJson( + .map((e) => Query$GetApiTokens$api$devices.fromJson( e as Map)) .toList(), $__typename: json['__typename'] as String, ); -Map _$Query$GetApiTokensQuery$apiToJson( - Query$GetApiTokensQuery$api instance) => +Map _$Query$GetApiTokens$apiToJson( + Query$GetApiTokens$api instance) => { 'devices': instance.devices.map((e) => e.toJson()).toList(), '__typename': instance.$__typename, }; -Query$GetApiTokensQuery$api$devices - _$Query$GetApiTokensQuery$api$devicesFromJson(Map json) => - Query$GetApiTokensQuery$api$devices( - creationDate: dateTimeFromJson(json['creationDate']), - isCaller: json['isCaller'] as bool, - name: json['name'] as String, - $__typename: json['__typename'] as String, - ); +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$GetApiTokensQuery$api$devicesToJson( - Query$GetApiTokensQuery$api$devices instance) => +Map _$Query$GetApiTokens$api$devicesToJson( + Query$GetApiTokens$api$devices instance) => { 'creationDate': dateTimeToJson(instance.creationDate), 'isCaller': instance.isCaller, @@ -56,31 +377,369 @@ Map _$Query$GetApiTokensQuery$api$devicesToJson( '__typename': instance.$__typename, }; -Query$GetApiVersionQuery _$Query$GetApiVersionQueryFromJson( - Map json) => - Query$GetApiVersionQuery( - api: Query$GetApiVersionQuery$api.fromJson( - json['api'] as Map), +Query$RecoveryKey _$Query$RecoveryKeyFromJson(Map json) => + Query$RecoveryKey( + api: Query$RecoveryKey$api.fromJson(json['api'] as Map), $__typename: json['__typename'] as String, ); -Map _$Query$GetApiVersionQueryToJson( - Query$GetApiVersionQuery instance) => +Map _$Query$RecoveryKeyToJson(Query$RecoveryKey instance) => { 'api': instance.api.toJson(), '__typename': instance.$__typename, }; -Query$GetApiVersionQuery$api _$Query$GetApiVersionQuery$apiFromJson( +Query$RecoveryKey$api _$Query$RecoveryKey$apiFromJson( Map json) => - Query$GetApiVersionQuery$api( - version: json['version'] as String, + Query$RecoveryKey$api( + recoveryKey: Query$RecoveryKey$api$recoveryKey.fromJson( + json['recoveryKey'] as Map), $__typename: json['__typename'] as String, ); -Map _$Query$GetApiVersionQuery$apiToJson( - Query$GetApiVersionQuery$api instance) => +Map _$Query$RecoveryKey$apiToJson( + Query$RecoveryKey$api instance) => { - 'version': instance.version, + '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 b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql new file mode 100644 index 00000000..75d36d0a --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql @@ -0,0 +1,54 @@ +fragment basicMutationReturnFields on MutationReturnInterface{ + code + message + success +} + +query SystemSettings { + system { + settings { + autoUpgrade { + allowReboot + enable + } + ssh { + enable + passwordAuthentication + rootSshKeys + } + timezone + } + } +} + +query DomainInfo { + system { + domainInfo { + domain + hostname + provider + requiredDnsRecords { + content + name + priority + recordType + ttl + } + } + } +} + +mutation ChangeTimezone($timezone: String!) { + changeTimezone(timezone: $timezone) { + ...basicMutationReturnFields + timezone + } +} + +mutation ChangeAutoUpgradeSettings($settings: AutoUpgradeSettingsInput!) { + changeAutoUpgradeSettings(settings: $settings) { + ...basicMutationReturnFields + allowReboot + enableAutoUpgrade + } +} 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 new file mode 100644 index 00000000..c37a1a9c --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart @@ -0,0 +1,1707 @@ +import 'dart:async'; +import 'disk_volumes.graphql.dart'; +import 'package:gql/ast.dart'; +import 'package:graphql/client.dart' as graphql; +import 'package:json_annotation/json_annotation.dart'; +import 'schema.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}); + + @override + factory Fragment$basicMutationReturnFields.fromJson( + Map json) => + _$Fragment$basicMutationReturnFieldsFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Fragment$basicMutationReturnFieldsToJson(this); + 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) || + 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 + on Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields copyWith( + {int? code, String? message, bool? success, String? $__typename}) => + Fragment$basicMutationReturnFields( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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) + ])); +const documentNodeFragmentbasicMutationReturnFields = + DocumentNode(definitions: [ + fragmentDefinitionbasicMutationReturnFields, +]); + +extension ClientExtension$Fragment$basicMutationReturnFields + on graphql.GraphQLClient { + 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); + return result == null + ? null + : Fragment$basicMutationReturnFields.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$SystemSettings { + Query$SystemSettings({required this.system, required this.$__typename}); + + @override + factory Query$SystemSettings.fromJson(Map json) => + _$Query$SystemSettingsFromJson(json); + + final Query$SystemSettings$system system; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$SystemSettingsToJson(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$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 { + Query$SystemSettings copyWith( + {Query$SystemSettings$system? system, String? $__typename}) => + Query$SystemSettings( + system: system == null ? this.system : system, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +const documentNodeQuerySystemSettings = DocumentNode(definitions: [ + OperationDefinitionNode( + 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: '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: 'rootSshKeys'), + 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) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), +]); +Query$SystemSettings _parserFn$Query$SystemSettings( + Map data) => + Query$SystemSettings.fromJson(data); + +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); +} + +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); +} + +class FetchMoreOptions$Query$SystemSettings extends graphql.FetchMoreOptions { + FetchMoreOptions$Query$SystemSettings( + {required graphql.UpdateQuery updateQuery}) + : super( + updateQuery: updateQuery, + document: documentNodeQuerySystemSettings); +} + +extension ClientExtension$Query$SystemSettings on graphql.GraphQLClient { + Future> query$SystemSettings( + [Options$Query$SystemSettings? options]) async => + await this.query(options ?? Options$Query$SystemSettings()); + graphql.ObservableQuery watchQuery$SystemSettings( + [WatchOptions$Query$SystemSettings? options]) => + this.watchQuery(options ?? WatchOptions$Query$SystemSettings()); + 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); + return result == null ? null : Query$SystemSettings.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$SystemSettings$system { + Query$SystemSettings$system( + {required this.settings, required this.$__typename}); + + @override + factory Query$SystemSettings$system.fromJson(Map json) => + _$Query$SystemSettings$systemFromJson(json); + + final Query$SystemSettings$system$settings settings; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$SystemSettings$systemToJson(this); + int get hashCode { + final l$settings = settings; + final l$$__typename = $__typename; + return Object.hashAll([l$settings, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$SystemSettings$system) || + runtimeType != other.runtimeType) return false; + final l$settings = settings; + final lOther$settings = other.settings; + if (l$settings != lOther$settings) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$SystemSettings$system + on Query$SystemSettings$system { + Query$SystemSettings$system copyWith( + {Query$SystemSettings$system$settings? settings, + String? $__typename}) => + Query$SystemSettings$system( + settings: settings == null ? this.settings : settings, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Query$SystemSettings$system$settings { + 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); + + final Query$SystemSettings$system$settings$autoUpgrade autoUpgrade; + + final Query$SystemSettings$system$settings$ssh ssh; + + final String timezone; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Query$SystemSettings$system$settingsToJson(this); + 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]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$SystemSettings$system$settings) || + runtimeType != other.runtimeType) return false; + final l$autoUpgrade = autoUpgrade; + final lOther$autoUpgrade = other.autoUpgrade; + if (l$autoUpgrade != lOther$autoUpgrade) return false; + final l$ssh = ssh; + final lOther$ssh = other.ssh; + if (l$ssh != lOther$ssh) return false; + final l$timezone = timezone; + final lOther$timezone = other.timezone; + if (l$timezone != lOther$timezone) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$SystemSettings$system$settings + on Query$SystemSettings$system$settings { + Query$SystemSettings$system$settings copyWith( + {Query$SystemSettings$system$settings$autoUpgrade? autoUpgrade, + Query$SystemSettings$system$settings$ssh? ssh, + String? timezone, + String? $__typename}) => + Query$SystemSettings$system$settings( + autoUpgrade: autoUpgrade == null ? this.autoUpgrade : autoUpgrade, + ssh: ssh == null ? this.ssh : ssh, + timezone: timezone == null ? this.timezone : timezone, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Query$SystemSettings$system$settings$autoUpgrade { + 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); + + final bool allowReboot; + + final bool enable; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Query$SystemSettings$system$settings$autoUpgradeToJson(this); + int get hashCode { + final l$allowReboot = allowReboot; + final l$enable = enable; + final l$$__typename = $__typename; + return Object.hashAll([l$allowReboot, l$enable, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$SystemSettings$system$settings$autoUpgrade) || + runtimeType != other.runtimeType) return false; + final l$allowReboot = allowReboot; + final lOther$allowReboot = other.allowReboot; + if (l$allowReboot != lOther$allowReboot) return false; + final l$enable = enable; + final lOther$enable = other.enable; + if (l$enable != lOther$enable) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$SystemSettings$system$settings$autoUpgrade + on Query$SystemSettings$system$settings$autoUpgrade { + Query$SystemSettings$system$settings$autoUpgrade copyWith( + {bool? allowReboot, bool? enable, String? $__typename}) => + Query$SystemSettings$system$settings$autoUpgrade( + allowReboot: allowReboot == null ? this.allowReboot : allowReboot, + enable: enable == null ? this.enable : enable, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Query$SystemSettings$system$settings$ssh { + Query$SystemSettings$system$settings$ssh( + {required this.enable, + required this.passwordAuthentication, + required this.rootSshKeys, + required this.$__typename}); + + @override + factory Query$SystemSettings$system$settings$ssh.fromJson( + Map json) => + _$Query$SystemSettings$system$settings$sshFromJson(json); + + final bool enable; + + final bool passwordAuthentication; + + final List rootSshKeys; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Query$SystemSettings$system$settings$sshToJson(this); + int get hashCode { + final l$enable = enable; + final l$passwordAuthentication = passwordAuthentication; + final l$rootSshKeys = rootSshKeys; + final l$$__typename = $__typename; + return Object.hashAll([ + l$enable, + l$passwordAuthentication, + Object.hashAll(l$rootSshKeys.map((v) => v)), + l$$__typename + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$SystemSettings$system$settings$ssh) || + runtimeType != other.runtimeType) return false; + final l$enable = enable; + final lOther$enable = other.enable; + if (l$enable != lOther$enable) return false; + final l$passwordAuthentication = passwordAuthentication; + final lOther$passwordAuthentication = other.passwordAuthentication; + if (l$passwordAuthentication != lOther$passwordAuthentication) return false; + final l$rootSshKeys = rootSshKeys; + final lOther$rootSshKeys = other.rootSshKeys; + if (l$rootSshKeys.length != lOther$rootSshKeys.length) return false; + for (int i = 0; i < l$rootSshKeys.length; i++) { + final l$rootSshKeys$entry = l$rootSshKeys[i]; + final lOther$rootSshKeys$entry = lOther$rootSshKeys[i]; + if (l$rootSshKeys$entry != lOther$rootSshKeys$entry) return false; + } + + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$SystemSettings$system$settings$ssh + on Query$SystemSettings$system$settings$ssh { + Query$SystemSettings$system$settings$ssh copyWith( + {bool? enable, + bool? passwordAuthentication, + List? rootSshKeys, + String? $__typename}) => + Query$SystemSettings$system$settings$ssh( + enable: enable == null ? this.enable : enable, + passwordAuthentication: passwordAuthentication == null + ? this.passwordAuthentication + : passwordAuthentication, + rootSshKeys: rootSshKeys == null ? this.rootSshKeys : rootSshKeys, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Query$DomainInfo { + Query$DomainInfo({required this.system, required this.$__typename}); + + @override + factory Query$DomainInfo.fromJson(Map json) => + _$Query$DomainInfoFromJson(json); + + final Query$DomainInfo$system system; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$DomainInfoToJson(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$DomainInfo) || 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$DomainInfo on Query$DomainInfo { + Query$DomainInfo copyWith( + {Query$DomainInfo$system? system, String? $__typename}) => + Query$DomainInfo( + system: system == null ? this.system : system, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +const documentNodeQueryDomainInfo = DocumentNode(definitions: [ + OperationDefinitionNode( + 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: '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: [ + 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) + ])), + 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$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); +} + +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); +} + +class FetchMoreOptions$Query$DomainInfo extends graphql.FetchMoreOptions { + FetchMoreOptions$Query$DomainInfo({required graphql.UpdateQuery updateQuery}) + : super(updateQuery: updateQuery, document: documentNodeQueryDomainInfo); +} + +extension ClientExtension$Query$DomainInfo on graphql.GraphQLClient { + Future> query$DomainInfo( + [Options$Query$DomainInfo? options]) async => + await this.query(options ?? Options$Query$DomainInfo()); + graphql.ObservableQuery watchQuery$DomainInfo( + [WatchOptions$Query$DomainInfo? options]) => + this.watchQuery(options ?? WatchOptions$Query$DomainInfo()); + 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); + return result == null ? null : Query$DomainInfo.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$DomainInfo$system { + Query$DomainInfo$system( + {required this.domainInfo, required this.$__typename}); + + @override + factory Query$DomainInfo$system.fromJson(Map json) => + _$Query$DomainInfo$systemFromJson(json); + + final Query$DomainInfo$system$domainInfo domainInfo; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$DomainInfo$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$DomainInfo$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$DomainInfo$system on Query$DomainInfo$system { + Query$DomainInfo$system copyWith( + {Query$DomainInfo$system$domainInfo? domainInfo, + String? $__typename}) => + Query$DomainInfo$system( + domainInfo: domainInfo == null ? this.domainInfo : domainInfo, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@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}); + + @override + factory Query$DomainInfo$system$domainInfo.fromJson( + Map json) => + _$Query$DomainInfo$system$domainInfoFromJson(json); + + 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); + int get hashCode { + final l$domain = domain; + final l$hostname = hostname; + final l$provider = provider; + final l$requiredDnsRecords = requiredDnsRecords; + final l$$__typename = $__typename; + return Object.hashAll([ + l$domain, + l$hostname, + l$provider, + Object.hashAll(l$requiredDnsRecords.map((v) => v)), + l$$__typename + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$DomainInfo$system$domainInfo) || + runtimeType != other.runtimeType) return false; + final l$domain = domain; + final lOther$domain = other.domain; + if (l$domain != lOther$domain) return false; + final l$hostname = hostname; + final lOther$hostname = other.hostname; + if (l$hostname != lOther$hostname) return false; + final l$provider = provider; + final lOther$provider = other.provider; + if (l$provider != lOther$provider) return false; + final l$requiredDnsRecords = requiredDnsRecords; + final lOther$requiredDnsRecords = other.requiredDnsRecords; + 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) + return false; + } + + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$DomainInfo$system$domainInfo + on Query$DomainInfo$system$domainInfo { + Query$DomainInfo$system$domainInfo copyWith( + {String? domain, + String? hostname, + Enum$DnsProvider? provider, + List? + requiredDnsRecords, + String? $__typename}) => + Query$DomainInfo$system$domainInfo( + domain: domain == null ? this.domain : domain, + hostname: hostname == null ? this.hostname : hostname, + provider: provider == null ? this.provider : provider, + requiredDnsRecords: requiredDnsRecords == null + ? this.requiredDnsRecords + : requiredDnsRecords, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Query$DomainInfo$system$domainInfo$requiredDnsRecords { + Query$DomainInfo$system$domainInfo$requiredDnsRecords( + {required this.content, + required this.name, + this.priority, + required this.recordType, + required this.ttl, + required this.$__typename}); + + @override + factory Query$DomainInfo$system$domainInfo$requiredDnsRecords.fromJson( + Map json) => + _$Query$DomainInfo$system$domainInfo$requiredDnsRecordsFromJson(json); + + final String content; + + final String name; + + final int? priority; + + final String recordType; + + final int ttl; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Query$DomainInfo$system$domainInfo$requiredDnsRecordsToJson(this); + int get hashCode { + final l$content = content; + final l$name = name; + final l$priority = priority; + 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]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$DomainInfo$system$domainInfo$requiredDnsRecords) || + runtimeType != other.runtimeType) return false; + final l$content = content; + final lOther$content = other.content; + if (l$content != lOther$content) return false; + final l$name = name; + final lOther$name = other.name; + if (l$name != lOther$name) return false; + final l$priority = priority; + final lOther$priority = other.priority; + if (l$priority != lOther$priority) return false; + final l$recordType = recordType; + final lOther$recordType = other.recordType; + if (l$recordType != lOther$recordType) return false; + final l$ttl = ttl; + final lOther$ttl = other.ttl; + if (l$ttl != lOther$ttl) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$DomainInfo$system$domainInfo$requiredDnsRecords + on Query$DomainInfo$system$domainInfo$requiredDnsRecords { + Query$DomainInfo$system$domainInfo$requiredDnsRecords copyWith( + {String? content, + String? name, + int? Function()? priority, + String? recordType, + int? ttl, + String? $__typename}) => + Query$DomainInfo$system$domainInfo$requiredDnsRecords( + content: content == null ? this.content : content, + name: name == null ? this.name : name, + priority: priority == null ? this.priority : priority(), + recordType: recordType == null ? this.recordType : recordType, + ttl: ttl == null ? this.ttl : ttl, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$ChangeTimezone { + Variables$Mutation$ChangeTimezone({required this.timezone}); + + @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; + } + + Variables$Mutation$ChangeTimezone copyWith({String? timezone}) => + Variables$Mutation$ChangeTimezone( + timezone: timezone == null ? this.timezone : timezone); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$ChangeTimezone { + Mutation$ChangeTimezone( + {required this.changeTimezone, required this.$__typename}); + + @override + factory Mutation$ChangeTimezone.fromJson(Map json) => + _$Mutation$ChangeTimezoneFromJson(json); + + final Mutation$ChangeTimezone$changeTimezone changeTimezone; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$ChangeTimezoneToJson(this); + int get hashCode { + final l$changeTimezone = changeTimezone; + final l$$__typename = $__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) + return false; + final l$changeTimezone = changeTimezone; + final lOther$changeTimezone = other.changeTimezone; + if (l$changeTimezone != lOther$changeTimezone) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$ChangeTimezone on Mutation$ChangeTimezone { + Mutation$ChangeTimezone copyWith( + {Mutation$ChangeTimezone$changeTimezone? changeTimezone, + String? $__typename}) => + Mutation$ChangeTimezone( + changeTimezone: + changeTimezone == null ? this.changeTimezone : changeTimezone, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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'))) + ], + 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( + 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?); + +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, + 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$ChangeTimezone(data)), + update: update, + onError: onError, + document: documentNodeMutationChangeTimezone, + parserFn: _parserFn$Mutation$ChangeTimezone); + + final OnMutationCompleted$Mutation$ChangeTimezone? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$ChangeTimezone on graphql.GraphQLClient { + Future> mutate$ChangeTimezone( + Options$Mutation$ChangeTimezone options) async => + await this.mutate(options); + graphql.ObservableQuery watchMutation$ChangeTimezone( + WatchOptions$Mutation$ChangeTimezone options) => + 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}); + + @override + factory Mutation$ChangeTimezone$changeTimezone.fromJson( + Map json) => + _$Mutation$ChangeTimezone$changeTimezoneFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + final String? timezone; + + Map toJson() => + _$Mutation$ChangeTimezone$changeTimezoneToJson(this); + 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]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$ChangeTimezone$changeTimezone) || + 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; + final l$timezone = timezone; + final lOther$timezone = other.timezone; + if (l$timezone != lOther$timezone) return false; + return true; + } +} + +extension UtilityExtension$Mutation$ChangeTimezone$changeTimezone + on Mutation$ChangeTimezone$changeTimezone { + Mutation$ChangeTimezone$changeTimezone copyWith( + {int? code, + String? message, + bool? success, + String? $__typename, + String? Function()? timezone}) => + Mutation$ChangeTimezone$changeTimezone( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename, + timezone: timezone == null ? this.timezone : timezone()); +} + +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$ChangeAutoUpgradeSettings { + Variables$Mutation$ChangeAutoUpgradeSettings({required this.settings}); + + @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]); + } + + @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; + } + + Variables$Mutation$ChangeAutoUpgradeSettings copyWith( + {Input$AutoUpgradeSettingsInput? settings}) => + Variables$Mutation$ChangeAutoUpgradeSettings( + settings: settings == null ? this.settings : settings); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$ChangeAutoUpgradeSettings { + Mutation$ChangeAutoUpgradeSettings( + {required this.changeAutoUpgradeSettings, required this.$__typename}); + + @override + factory Mutation$ChangeAutoUpgradeSettings.fromJson( + Map json) => + _$Mutation$ChangeAutoUpgradeSettingsFromJson(json); + + final Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings + changeAutoUpgradeSettings; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$ChangeAutoUpgradeSettingsToJson(this); + int get hashCode { + final l$changeAutoUpgradeSettings = changeAutoUpgradeSettings; + final l$$__typename = $__typename; + return Object.hashAll([l$changeAutoUpgradeSettings, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$ChangeAutoUpgradeSettings) || + runtimeType != other.runtimeType) return false; + final l$changeAutoUpgradeSettings = changeAutoUpgradeSettings; + final lOther$changeAutoUpgradeSettings = other.changeAutoUpgradeSettings; + if (l$changeAutoUpgradeSettings != lOther$changeAutoUpgradeSettings) + return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$ChangeAutoUpgradeSettings + on Mutation$ChangeAutoUpgradeSettings { + Mutation$ChangeAutoUpgradeSettings copyWith( + {Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings? + changeAutoUpgradeSettings, + String? $__typename}) => + Mutation$ChangeAutoUpgradeSettings( + changeAutoUpgradeSettings: changeAutoUpgradeSettings == null + ? this.changeAutoUpgradeSettings + : changeAutoUpgradeSettings, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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'))) + ], + 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( + 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?); + +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, + 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$ChangeAutoUpgradeSettings(data)), + update: update, + onError: onError, + document: documentNodeMutationChangeAutoUpgradeSettings, + parserFn: _parserFn$Mutation$ChangeAutoUpgradeSettings); + + final OnMutationCompleted$Mutation$ChangeAutoUpgradeSettings? + onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$ChangeAutoUpgradeSettings + on graphql.GraphQLClient { + Future> + mutate$ChangeAutoUpgradeSettings( + Options$Mutation$ChangeAutoUpgradeSettings options) async => + await this.mutate(options); + graphql.ObservableQuery + watchMutation$ChangeAutoUpgradeSettings( + WatchOptions$Mutation$ChangeAutoUpgradeSettings options) => + 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}); + + @override + factory Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings.fromJson( + Map json) => + _$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettingsFromJson( + json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + final bool allowReboot; + + final bool enableAutoUpgrade; + + Map toJson() => + _$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettingsToJson( + this); + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + final l$allowReboot = allowReboot; + final l$enableAutoUpgrade = enableAutoUpgrade; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + l$allowReboot, + l$enableAutoUpgrade + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other + is Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings) || + 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; + final l$allowReboot = allowReboot; + final lOther$allowReboot = other.allowReboot; + if (l$allowReboot != lOther$allowReboot) return false; + final l$enableAutoUpgrade = enableAutoUpgrade; + final lOther$enableAutoUpgrade = other.enableAutoUpgrade; + if (l$enableAutoUpgrade != lOther$enableAutoUpgrade) return false; + return true; + } +} + +extension UtilityExtension$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings + on Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings { + Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings copyWith( + {int? code, + String? message, + bool? success, + String? $__typename, + bool? allowReboot, + bool? enableAutoUpgrade}) => + Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename, + allowReboot: allowReboot == null ? this.allowReboot : allowReboot, + enableAutoUpgrade: enableAutoUpgrade == null + ? this.enableAutoUpgrade + : enableAutoUpgrade); +} 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 new file mode 100644 index 00000000..bbca8052 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.g.dart @@ -0,0 +1,300 @@ +// 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, + rootSshKeys: (json['rootSshKeys'] as List) + .map((e) => e as String) + .toList(), + $__typename: json['__typename'] as String, + ); + +Map _$Query$SystemSettings$system$settings$sshToJson( + Query$SystemSettings$system$settings$ssh instance) => + { + 'enable': instance.enable, + 'passwordAuthentication': instance.passwordAuthentication, + 'rootSshKeys': instance.rootSshKeys, + '__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) => + Query$DomainInfo$system$domainInfo$requiredDnsRecords.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.$unknown: r'$unknown', +}; + +Query$DomainInfo$system$domainInfo$requiredDnsRecords + _$Query$DomainInfo$system$domainInfo$requiredDnsRecordsFromJson( + Map json) => + Query$DomainInfo$system$domainInfo$requiredDnsRecords( + 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 + _$Query$DomainInfo$system$domainInfo$requiredDnsRecordsToJson( + Query$DomainInfo$system$domainInfo$requiredDnsRecords instance) => + { + 'content': instance.content, + 'name': instance.name, + 'priority': instance.priority, + 'recordType': instance.recordType, + 'ttl': instance.ttl, + '__typename': instance.$__typename, + }; + +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 b/lib/logic/api_maps/graphql_maps/schema/services.graphql new file mode 100644 index 00000000..ce464426 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/services.graphql @@ -0,0 +1,84 @@ +fragment basicMutationReturnFields on MutationReturnInterface{ + code + message + success +} + +query AllServices { + services { + allServices { + description + displayName + dnsRecords { + content + name + priority + recordType + ttl + } + id + isEnabled + isMovable + isRequired + status + storageUsage { + title + usedSpace + volume { + name + } + } + svgIcon + url + } + } +} + +mutation EnableService($serviceId: String!) { + enableService(serviceId: $serviceId) { + ...basicMutationReturnFields + } +} + +mutation DisableService($serviceId: String!) { + disableService(serviceId: $serviceId) { + ...basicMutationReturnFields + } +} + +mutation StopService($serviceId: String!) { + stopService(serviceId: $serviceId) { + ...basicMutationReturnFields + } +} + +mutation StartService($serviceId: String!) { + startService(serviceId: $serviceId) { + ...basicMutationReturnFields + } +} + +mutation RestartService($serviceId: String!) { + restartService(serviceId: $serviceId) { + ...basicMutationReturnFields + } +} + +mutation MoveService($input: MoveServiceInput!) { + moveService(input: $input) { + ...basicMutationReturnFields + job { + createdAt + description + error + finishedAt + name + progress + result + status + statusText + uid + updatedAt + } + } +} \ No newline at end of file diff --git a/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart new file mode 100644 index 00000000..2a415115 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart @@ -0,0 +1,2771 @@ +import 'dart:async'; +import 'disk_volumes.graphql.dart'; +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}); + + @override + factory Fragment$basicMutationReturnFields.fromJson( + Map json) => + _$Fragment$basicMutationReturnFieldsFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Fragment$basicMutationReturnFieldsToJson(this); + 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) || + 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 + on Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields copyWith( + {int? code, String? message, bool? success, String? $__typename}) => + Fragment$basicMutationReturnFields( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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) + ])); +const documentNodeFragmentbasicMutationReturnFields = + DocumentNode(definitions: [ + fragmentDefinitionbasicMutationReturnFields, +]); + +extension ClientExtension$Fragment$basicMutationReturnFields + on graphql.GraphQLClient { + 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); + return result == null + ? null + : Fragment$basicMutationReturnFields.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$AllServices { + Query$AllServices({required this.services, required this.$__typename}); + + @override + factory Query$AllServices.fromJson(Map json) => + _$Query$AllServicesFromJson(json); + + final Query$AllServices$services services; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$AllServicesToJson(this); + 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 { + Query$AllServices copyWith( + {Query$AllServices$services? services, String? $__typename}) => + Query$AllServices( + services: services == null ? this.services : services, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +const documentNodeQueryAllServices = DocumentNode(definitions: [ + OperationDefinitionNode( + 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: '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: [ + 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) + ])), + 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( + 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$AllServices _parserFn$Query$AllServices(Map data) => + Query$AllServices.fromJson(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); +} + +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); +} + +class FetchMoreOptions$Query$AllServices extends graphql.FetchMoreOptions { + FetchMoreOptions$Query$AllServices({required graphql.UpdateQuery updateQuery}) + : super(updateQuery: updateQuery, document: documentNodeQueryAllServices); +} + +extension ClientExtension$Query$AllServices on graphql.GraphQLClient { + Future> query$AllServices( + [Options$Query$AllServices? options]) async => + await this.query(options ?? Options$Query$AllServices()); + graphql.ObservableQuery watchQuery$AllServices( + [WatchOptions$Query$AllServices? options]) => + this.watchQuery(options ?? WatchOptions$Query$AllServices()); + 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); + return result == null ? null : Query$AllServices.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$AllServices$services { + Query$AllServices$services( + {required this.allServices, required this.$__typename}); + + @override + factory Query$AllServices$services.fromJson(Map json) => + _$Query$AllServices$servicesFromJson(json); + + final List allServices; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$AllServices$servicesToJson(this); + int get hashCode { + final l$allServices = allServices; + final l$$__typename = $__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 (!(other is Query$AllServices$services) || + runtimeType != other.runtimeType) return false; + final l$allServices = allServices; + final lOther$allServices = other.allServices; + 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; + } + + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$AllServices$services + on Query$AllServices$services { + Query$AllServices$services copyWith( + {List? allServices, + String? $__typename}) => + Query$AllServices$services( + allServices: allServices == null ? this.allServices : allServices, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@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}); + + @override + factory Query$AllServices$services$allServices.fromJson( + Map json) => + _$Query$AllServices$services$allServicesFromJson(json); + + final String description; + + final String displayName; + + final List? dnsRecords; + + final String id; + + final bool isEnabled; + + final bool isMovable; + + final bool isRequired; + + @JsonKey(unknownEnumValue: Enum$ServiceStatusEnum.$unknown) + final Enum$ServiceStatusEnum status; + + final Query$AllServices$services$allServices$storageUsage storageUsage; + + final String svgIcon; + + final String? url; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Query$AllServices$services$allServicesToJson(this); + int get hashCode { + final l$description = description; + final l$displayName = displayName; + final l$dnsRecords = dnsRecords; + final l$id = id; + final l$isEnabled = isEnabled; + final l$isMovable = isMovable; + final l$isRequired = isRequired; + final l$status = status; + final l$storageUsage = storageUsage; + final l$svgIcon = svgIcon; + final l$url = url; + final l$$__typename = $__typename; + return Object.hashAll([ + l$description, + l$displayName, + l$dnsRecords == null ? null : Object.hashAll(l$dnsRecords.map((v) => v)), + l$id, + l$isEnabled, + l$isMovable, + l$isRequired, + l$status, + l$storageUsage, + l$svgIcon, + l$url, + l$$__typename + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$AllServices$services$allServices) || + runtimeType != other.runtimeType) return false; + final l$description = description; + final lOther$description = other.description; + if (l$description != lOther$description) return false; + final l$displayName = displayName; + final lOther$displayName = other.displayName; + 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; + 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; + } + } else if (l$dnsRecords != lOther$dnsRecords) { + return false; + } + + final l$id = id; + final lOther$id = other.id; + if (l$id != lOther$id) return false; + final l$isEnabled = isEnabled; + final lOther$isEnabled = other.isEnabled; + if (l$isEnabled != lOther$isEnabled) return false; + final l$isMovable = isMovable; + final lOther$isMovable = other.isMovable; + if (l$isMovable != lOther$isMovable) return false; + final l$isRequired = isRequired; + final lOther$isRequired = other.isRequired; + if (l$isRequired != lOther$isRequired) return false; + final l$status = status; + final lOther$status = other.status; + if (l$status != lOther$status) return false; + final l$storageUsage = storageUsage; + final lOther$storageUsage = other.storageUsage; + if (l$storageUsage != lOther$storageUsage) return false; + final l$svgIcon = svgIcon; + final lOther$svgIcon = other.svgIcon; + if (l$svgIcon != lOther$svgIcon) return false; + final l$url = url; + final lOther$url = other.url; + if (l$url != lOther$url) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$AllServices$services$allServices + on Query$AllServices$services$allServices { + Query$AllServices$services$allServices copyWith( + {String? description, + String? displayName, + List? Function()? + dnsRecords, + String? id, + bool? isEnabled, + bool? isMovable, + bool? isRequired, + Enum$ServiceStatusEnum? status, + Query$AllServices$services$allServices$storageUsage? storageUsage, + String? svgIcon, + String? Function()? url, + String? $__typename}) => + Query$AllServices$services$allServices( + description: description == null ? this.description : description, + displayName: displayName == null ? this.displayName : displayName, + dnsRecords: dnsRecords == null ? this.dnsRecords : dnsRecords(), + id: id == null ? this.id : id, + isEnabled: isEnabled == null ? this.isEnabled : isEnabled, + isMovable: isMovable == null ? this.isMovable : isMovable, + isRequired: isRequired == null ? this.isRequired : isRequired, + status: status == null ? this.status : status, + storageUsage: storageUsage == null ? this.storageUsage : storageUsage, + svgIcon: svgIcon == null ? this.svgIcon : svgIcon, + url: url == null ? this.url : url(), + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Query$AllServices$services$allServices$dnsRecords { + Query$AllServices$services$allServices$dnsRecords( + {required this.content, + required this.name, + this.priority, + required this.recordType, + required this.ttl, + required this.$__typename}); + + @override + factory Query$AllServices$services$allServices$dnsRecords.fromJson( + Map json) => + _$Query$AllServices$services$allServices$dnsRecordsFromJson(json); + + final String content; + + final String name; + + final int? priority; + + final String recordType; + + final int ttl; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Query$AllServices$services$allServices$dnsRecordsToJson(this); + int get hashCode { + final l$content = content; + final l$name = name; + final l$priority = priority; + 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]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$AllServices$services$allServices$dnsRecords) || + runtimeType != other.runtimeType) return false; + final l$content = content; + final lOther$content = other.content; + if (l$content != lOther$content) return false; + final l$name = name; + final lOther$name = other.name; + if (l$name != lOther$name) return false; + final l$priority = priority; + final lOther$priority = other.priority; + if (l$priority != lOther$priority) return false; + final l$recordType = recordType; + final lOther$recordType = other.recordType; + if (l$recordType != lOther$recordType) return false; + final l$ttl = ttl; + final lOther$ttl = other.ttl; + if (l$ttl != lOther$ttl) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$AllServices$services$allServices$dnsRecords + on Query$AllServices$services$allServices$dnsRecords { + Query$AllServices$services$allServices$dnsRecords copyWith( + {String? content, + String? name, + int? Function()? priority, + String? recordType, + int? ttl, + String? $__typename}) => + Query$AllServices$services$allServices$dnsRecords( + content: content == null ? this.content : content, + name: name == null ? this.name : name, + priority: priority == null ? this.priority : priority(), + recordType: recordType == null ? this.recordType : recordType, + ttl: ttl == null ? this.ttl : ttl, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@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}); + + @override + factory Query$AllServices$services$allServices$storageUsage.fromJson( + Map json) => + _$Query$AllServices$services$allServices$storageUsageFromJson(json); + + final String title; + + final String usedSpace; + + final Query$AllServices$services$allServices$storageUsage$volume? volume; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Query$AllServices$services$allServices$storageUsageToJson(this); + 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]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$AllServices$services$allServices$storageUsage) || + 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$volume = volume; + final lOther$volume = other.volume; + if (l$volume != lOther$volume) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$AllServices$services$allServices$storageUsage + on Query$AllServices$services$allServices$storageUsage { + Query$AllServices$services$allServices$storageUsage copyWith( + {String? title, + String? usedSpace, + Query$AllServices$services$allServices$storageUsage$volume? + Function()? + volume, + String? $__typename}) => + Query$AllServices$services$allServices$storageUsage( + title: title == null ? this.title : title, + usedSpace: usedSpace == null ? this.usedSpace : usedSpace, + volume: volume == null ? this.volume : volume(), + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Query$AllServices$services$allServices$storageUsage$volume { + 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); + + final String name; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Query$AllServices$services$allServices$storageUsage$volumeToJson(this); + int get hashCode { + final l$name = name; + final l$$__typename = $__typename; + return Object.hashAll([l$name, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other + is Query$AllServices$services$allServices$storageUsage$volume) || + runtimeType != other.runtimeType) return false; + final l$name = name; + final lOther$name = other.name; + if (l$name != lOther$name) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$AllServices$services$allServices$storageUsage$volume + on Query$AllServices$services$allServices$storageUsage$volume { + Query$AllServices$services$allServices$storageUsage$volume copyWith( + {String? name, String? $__typename}) => + Query$AllServices$services$allServices$storageUsage$volume( + name: name == null ? this.name : name, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$EnableService { + Variables$Mutation$EnableService({required this.serviceId}); + + @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; + } + + Variables$Mutation$EnableService copyWith({String? serviceId}) => + Variables$Mutation$EnableService( + serviceId: serviceId == null ? this.serviceId : serviceId); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$EnableService { + Mutation$EnableService( + {required this.enableService, required this.$__typename}); + + @override + factory Mutation$EnableService.fromJson(Map json) => + _$Mutation$EnableServiceFromJson(json); + + final Mutation$EnableService$enableService enableService; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$EnableServiceToJson(this); + int get hashCode { + final l$enableService = enableService; + final l$$__typename = $__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) + return false; + final l$enableService = enableService; + final lOther$enableService = other.enableService; + if (l$enableService != lOther$enableService) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$EnableService on Mutation$EnableService { + Mutation$EnableService copyWith( + {Mutation$EnableService$enableService? enableService, + String? $__typename}) => + Mutation$EnableService( + enableService: + enableService == null ? this.enableService : enableService, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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'))) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: []), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + 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?); + +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, + 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$EnableService(data)), + update: update, + onError: onError, + document: documentNodeMutationEnableService, + parserFn: _parserFn$Mutation$EnableService); + + final OnMutationCompleted$Mutation$EnableService? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$EnableService on graphql.GraphQLClient { + Future> mutate$EnableService( + Options$Mutation$EnableService options) async => + await this.mutate(options); + graphql.ObservableQuery watchMutation$EnableService( + WatchOptions$Mutation$EnableService options) => + 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}); + + @override + factory Mutation$EnableService$enableService.fromJson( + Map json) => + _$Mutation$EnableService$enableServiceFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$EnableService$enableServiceToJson(this); + 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 Mutation$EnableService$enableService) || + 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$Mutation$EnableService$enableService + on Mutation$EnableService$enableService { + Mutation$EnableService$enableService copyWith( + {int? code, String? message, bool? success, String? $__typename}) => + Mutation$EnableService$enableService( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$DisableService { + Variables$Mutation$DisableService({required this.serviceId}); + + @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; + } + + Variables$Mutation$DisableService copyWith({String? serviceId}) => + Variables$Mutation$DisableService( + serviceId: serviceId == null ? this.serviceId : serviceId); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$DisableService { + Mutation$DisableService( + {required this.disableService, required this.$__typename}); + + @override + factory Mutation$DisableService.fromJson(Map json) => + _$Mutation$DisableServiceFromJson(json); + + final Mutation$DisableService$disableService disableService; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$DisableServiceToJson(this); + int get hashCode { + final l$disableService = disableService; + final l$$__typename = $__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) + return false; + final l$disableService = disableService; + final lOther$disableService = other.disableService; + if (l$disableService != lOther$disableService) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$DisableService on Mutation$DisableService { + Mutation$DisableService copyWith( + {Mutation$DisableService$disableService? disableService, + String? $__typename}) => + Mutation$DisableService( + disableService: + disableService == null ? this.disableService : disableService, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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'))) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: []), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + 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?); + +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, + 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$DisableService(data)), + update: update, + onError: onError, + document: documentNodeMutationDisableService, + parserFn: _parserFn$Mutation$DisableService); + + final OnMutationCompleted$Mutation$DisableService? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$DisableService on graphql.GraphQLClient { + Future> mutate$DisableService( + Options$Mutation$DisableService options) async => + await this.mutate(options); + graphql.ObservableQuery watchMutation$DisableService( + WatchOptions$Mutation$DisableService options) => + 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}); + + @override + factory Mutation$DisableService$disableService.fromJson( + Map json) => + _$Mutation$DisableService$disableServiceFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$DisableService$disableServiceToJson(this); + 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 Mutation$DisableService$disableService) || + 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$Mutation$DisableService$disableService + on Mutation$DisableService$disableService { + Mutation$DisableService$disableService copyWith( + {int? code, String? message, bool? success, String? $__typename}) => + Mutation$DisableService$disableService( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$StopService { + Variables$Mutation$StopService({required this.serviceId}); + + @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; + } + + Variables$Mutation$StopService copyWith({String? serviceId}) => + Variables$Mutation$StopService( + serviceId: serviceId == null ? this.serviceId : serviceId); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$StopService { + Mutation$StopService({required this.stopService, required this.$__typename}); + + @override + factory Mutation$StopService.fromJson(Map json) => + _$Mutation$StopServiceFromJson(json); + + final Mutation$StopService$stopService stopService; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$StopServiceToJson(this); + int get hashCode { + final l$stopService = stopService; + final l$$__typename = $__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) + return false; + final l$stopService = stopService; + final lOther$stopService = other.stopService; + if (l$stopService != lOther$stopService) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$StopService on Mutation$StopService { + Mutation$StopService copyWith( + {Mutation$StopService$stopService? stopService, + String? $__typename}) => + Mutation$StopService( + stopService: stopService == null ? this.stopService : stopService, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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'))) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: []), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + 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?); + +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, + 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); + + final OnMutationCompleted$Mutation$StopService? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$StopService on graphql.GraphQLClient { + Future> mutate$StopService( + Options$Mutation$StopService options) async => + await this.mutate(options); + graphql.ObservableQuery watchMutation$StopService( + WatchOptions$Mutation$StopService options) => + 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}); + + @override + factory Mutation$StopService$stopService.fromJson( + Map json) => + _$Mutation$StopService$stopServiceFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$StopService$stopServiceToJson(this); + 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 Mutation$StopService$stopService) || + 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$Mutation$StopService$stopService + on Mutation$StopService$stopService { + Mutation$StopService$stopService copyWith( + {int? code, String? message, bool? success, String? $__typename}) => + Mutation$StopService$stopService( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$StartService { + Variables$Mutation$StartService({required this.serviceId}); + + @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; + } + + Variables$Mutation$StartService copyWith({String? serviceId}) => + Variables$Mutation$StartService( + serviceId: serviceId == null ? this.serviceId : serviceId); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$StartService { + Mutation$StartService( + {required this.startService, required this.$__typename}); + + @override + factory Mutation$StartService.fromJson(Map json) => + _$Mutation$StartServiceFromJson(json); + + final Mutation$StartService$startService startService; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$StartServiceToJson(this); + int get hashCode { + final l$startService = startService; + final l$$__typename = $__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) + return false; + final l$startService = startService; + final lOther$startService = other.startService; + if (l$startService != lOther$startService) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$StartService on Mutation$StartService { + Mutation$StartService copyWith( + {Mutation$StartService$startService? startService, + String? $__typename}) => + Mutation$StartService( + startService: startService == null ? this.startService : startService, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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'))) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: []), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + 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?); + +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, + 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$StartService(data)), + update: update, + onError: onError, + document: documentNodeMutationStartService, + parserFn: _parserFn$Mutation$StartService); + + final OnMutationCompleted$Mutation$StartService? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$StartService on graphql.GraphQLClient { + Future> mutate$StartService( + Options$Mutation$StartService options) async => + await this.mutate(options); + graphql.ObservableQuery watchMutation$StartService( + WatchOptions$Mutation$StartService options) => + 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}); + + @override + factory Mutation$StartService$startService.fromJson( + Map json) => + _$Mutation$StartService$startServiceFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$StartService$startServiceToJson(this); + 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 Mutation$StartService$startService) || + 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$Mutation$StartService$startService + on Mutation$StartService$startService { + Mutation$StartService$startService copyWith( + {int? code, String? message, bool? success, String? $__typename}) => + Mutation$StartService$startService( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$RestartService { + Variables$Mutation$RestartService({required this.serviceId}); + + @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; + } + + Variables$Mutation$RestartService copyWith({String? serviceId}) => + Variables$Mutation$RestartService( + serviceId: serviceId == null ? this.serviceId : serviceId); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$RestartService { + Mutation$RestartService( + {required this.restartService, required this.$__typename}); + + @override + factory Mutation$RestartService.fromJson(Map json) => + _$Mutation$RestartServiceFromJson(json); + + final Mutation$RestartService$restartService restartService; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$RestartServiceToJson(this); + int get hashCode { + final l$restartService = restartService; + final l$$__typename = $__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) + return false; + final l$restartService = restartService; + final lOther$restartService = other.restartService; + if (l$restartService != lOther$restartService) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$RestartService on Mutation$RestartService { + Mutation$RestartService copyWith( + {Mutation$RestartService$restartService? restartService, + String? $__typename}) => + Mutation$RestartService( + restartService: + restartService == null ? this.restartService : restartService, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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'))) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: []), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + 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?); + +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, + 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$RestartService(data)), + update: update, + onError: onError, + document: documentNodeMutationRestartService, + parserFn: _parserFn$Mutation$RestartService); + + final OnMutationCompleted$Mutation$RestartService? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$RestartService on graphql.GraphQLClient { + Future> mutate$RestartService( + Options$Mutation$RestartService options) async => + await this.mutate(options); + graphql.ObservableQuery watchMutation$RestartService( + WatchOptions$Mutation$RestartService options) => + 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}); + + @override + factory Mutation$RestartService$restartService.fromJson( + Map json) => + _$Mutation$RestartService$restartServiceFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$RestartService$restartServiceToJson(this); + 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 Mutation$RestartService$restartService) || + 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$Mutation$RestartService$restartService + on Mutation$RestartService$restartService { + Mutation$RestartService$restartService copyWith( + {int? code, String? message, bool? success, String? $__typename}) => + Mutation$RestartService$restartService( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$MoveService { + Variables$Mutation$MoveService({required this.input}); + + @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; + } + + Variables$Mutation$MoveService copyWith({Input$MoveServiceInput? input}) => + Variables$Mutation$MoveService(input: input == null ? this.input : input); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$MoveService { + Mutation$MoveService({required this.moveService, required this.$__typename}); + + @override + factory Mutation$MoveService.fromJson(Map json) => + _$Mutation$MoveServiceFromJson(json); + + final Mutation$MoveService$moveService moveService; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$MoveServiceToJson(this); + int get hashCode { + final l$moveService = moveService; + final l$$__typename = $__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) + return false; + final l$moveService = moveService; + final lOther$moveService = other.moveService; + if (l$moveService != lOther$moveService) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$MoveService on Mutation$MoveService { + Mutation$MoveService copyWith( + {Mutation$MoveService$moveService? moveService, + String? $__typename}) => + Mutation$MoveService( + moveService: moveService == null ? this.moveService : moveService, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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'), + 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: [], + 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) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + 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?); + +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, + 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); + + final OnMutationCompleted$Mutation$MoveService? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$MoveService on graphql.GraphQLClient { + Future> mutate$MoveService( + Options$Mutation$MoveService options) async => + await this.mutate(options); + graphql.ObservableQuery watchMutation$MoveService( + WatchOptions$Mutation$MoveService options) => + 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}); + + @override + factory Mutation$MoveService$moveService.fromJson( + Map json) => + _$Mutation$MoveService$moveServiceFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + final Mutation$MoveService$moveService$job? job; + + Map toJson() => + _$Mutation$MoveService$moveServiceToJson(this); + 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]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$MoveService$moveService) || + 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; + final l$job = job; + final lOther$job = other.job; + if (l$job != lOther$job) return false; + return true; + } +} + +extension UtilityExtension$Mutation$MoveService$moveService + on Mutation$MoveService$moveService { + Mutation$MoveService$moveService copyWith( + {int? code, + String? message, + bool? success, + String? $__typename, + Mutation$MoveService$moveService$job? Function()? job}) => + Mutation$MoveService$moveService( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename, + job: job == null ? this.job : job()); +} + +@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}); + + @override + factory Mutation$MoveService$moveService$job.fromJson( + Map json) => + _$Mutation$MoveService$moveService$jobFromJson(json); + + @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; + + final int? progress; + + final String? result; + + final String status; + + final String? statusText; + + final String uid; + + @JsonKey(fromJson: dateTimeFromJson, toJson: dateTimeToJson) + final DateTime updatedAt; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$MoveService$moveService$jobToJson(this); + int get hashCode { + final l$createdAt = createdAt; + final l$description = description; + final l$error = error; + final l$finishedAt = finishedAt; + final l$name = name; + final l$progress = progress; + final l$result = result; + final l$status = status; + final l$statusText = statusText; + final l$uid = uid; + final l$updatedAt = updatedAt; + final l$$__typename = $__typename; + return Object.hashAll([ + l$createdAt, + l$description, + l$error, + l$finishedAt, + l$name, + l$progress, + l$result, + l$status, + l$statusText, + l$uid, + l$updatedAt, + l$$__typename + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$MoveService$moveService$job) || + runtimeType != other.runtimeType) return false; + final l$createdAt = createdAt; + final lOther$createdAt = other.createdAt; + if (l$createdAt != lOther$createdAt) return false; + final l$description = description; + final lOther$description = other.description; + if (l$description != lOther$description) return false; + final l$error = error; + final lOther$error = other.error; + if (l$error != lOther$error) return false; + final l$finishedAt = finishedAt; + final lOther$finishedAt = other.finishedAt; + if (l$finishedAt != lOther$finishedAt) return false; + final l$name = name; + final lOther$name = other.name; + if (l$name != lOther$name) return false; + final l$progress = progress; + final lOther$progress = other.progress; + if (l$progress != lOther$progress) return false; + final l$result = result; + final lOther$result = other.result; + if (l$result != lOther$result) return false; + final l$status = status; + final lOther$status = other.status; + if (l$status != lOther$status) return false; + final l$statusText = statusText; + final lOther$statusText = other.statusText; + if (l$statusText != lOther$statusText) return false; + final l$uid = uid; + final lOther$uid = other.uid; + if (l$uid != lOther$uid) return false; + final l$updatedAt = updatedAt; + final lOther$updatedAt = other.updatedAt; + if (l$updatedAt != lOther$updatedAt) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$MoveService$moveService$job + on Mutation$MoveService$moveService$job { + Mutation$MoveService$moveService$job copyWith( + {DateTime? createdAt, + String? description, + String? Function()? error, + DateTime? Function()? finishedAt, + String? name, + int? Function()? progress, + String? Function()? result, + String? status, + String? Function()? statusText, + String? uid, + DateTime? updatedAt, + String? $__typename}) => + Mutation$MoveService$moveService$job( + createdAt: createdAt == null ? this.createdAt : createdAt, + description: description == null ? this.description : description, + error: error == null ? this.error : error(), + finishedAt: finishedAt == null ? this.finishedAt : finishedAt(), + name: name == null ? this.name : name, + progress: progress == null ? this.progress : progress(), + result: result == null ? this.result : result(), + status: status == null ? this.status : status, + statusText: statusText == null ? this.statusText : statusText(), + uid: uid == null ? this.uid : uid, + updatedAt: updatedAt == null ? this.updatedAt : updatedAt, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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 new file mode 100644 index 00000000..c88900b1 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/services.graphql.g.dart @@ -0,0 +1,482 @@ +// 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) => + Query$AllServices$services$allServices$dnsRecords.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$dnsRecords + _$Query$AllServices$services$allServices$dnsRecordsFromJson( + Map json) => + Query$AllServices$services$allServices$dnsRecords( + 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 _$Query$AllServices$services$allServices$dnsRecordsToJson( + Query$AllServices$services$allServices$dnsRecords instance) => + { + 'content': instance.content, + 'name': instance.name, + 'priority': instance.priority, + 'recordType': instance.recordType, + 'ttl': instance.ttl, + '__typename': instance.$__typename, + }; + +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 b/lib/logic/api_maps/graphql_maps/schema/users.graphql new file mode 100644 index 00000000..cfe01820 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/users.graphql @@ -0,0 +1,76 @@ +fragment basicMutationReturnFields on MutationReturnInterface{ + code + message + success +} + + +mutation CreateUser($user: UserMutationInput!) { + createUser(user: $user) { + ...basicMutationReturnFields + user { + username + userType + sshKeys + } + } +} + +query AllUsers { + users { + allUsers { + userType + username + sshKeys + } + } +} + +mutation AddSshKey($sshInput: SshMutationInput!) { + addSshKey(sshInput: $sshInput) { + ...basicMutationReturnFields + user { + sshKeys + userType + username + } + } +} + +query GetUser($username: String!) { + users { + getUser(username: $username) { + sshKeys + userType + username + } + } +} + +mutation RemoveSshKey($sshInput: SshMutationInput!) { + removeSshKey(sshInput: $sshInput) { + ...basicMutationReturnFields + user { + sshKeys + userType + username + } + } +} + +mutation DeleteUser($username: String!) { + deleteUser(username: $username) { + ...basicMutationReturnFields + } +} + +mutation UpdateUser($user: UserMutationInput!) { + updateUser(user: $user) { + ...basicMutationReturnFields + user { + sshKeys + userType + username + } + } +} \ No newline at end of file diff --git a/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart new file mode 100644 index 00000000..81f3fd8c --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart @@ -0,0 +1,2642 @@ +import 'dart:async'; +import 'disk_volumes.graphql.dart'; +import 'package:gql/ast.dart'; +import 'package:graphql/client.dart' as graphql; +import 'package:json_annotation/json_annotation.dart'; +import 'schema.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}); + + @override + factory Fragment$basicMutationReturnFields.fromJson( + Map json) => + _$Fragment$basicMutationReturnFieldsFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Fragment$basicMutationReturnFieldsToJson(this); + 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) || + 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 + on Fragment$basicMutationReturnFields { + Fragment$basicMutationReturnFields copyWith( + {int? code, String? message, bool? success, String? $__typename}) => + Fragment$basicMutationReturnFields( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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) + ])); +const documentNodeFragmentbasicMutationReturnFields = + DocumentNode(definitions: [ + fragmentDefinitionbasicMutationReturnFields, +]); + +extension ClientExtension$Fragment$basicMutationReturnFields + on graphql.GraphQLClient { + 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); + return result == null + ? null + : Fragment$basicMutationReturnFields.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$CreateUser { + Variables$Mutation$CreateUser({required this.user}); + + @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; + } + + Variables$Mutation$CreateUser copyWith({Input$UserMutationInput? user}) => + Variables$Mutation$CreateUser(user: user == null ? this.user : user); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$CreateUser { + Mutation$CreateUser({required this.createUser, required this.$__typename}); + + @override + factory Mutation$CreateUser.fromJson(Map json) => + _$Mutation$CreateUserFromJson(json); + + final Mutation$CreateUser$createUser createUser; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$CreateUserToJson(this); + int get hashCode { + final l$createUser = createUser; + final l$$__typename = $__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) + return false; + final l$createUser = createUser; + final lOther$createUser = other.createUser; + if (l$createUser != lOther$createUser) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$CreateUser on Mutation$CreateUser { + Mutation$CreateUser copyWith( + {Mutation$CreateUser$createUser? createUser, String? $__typename}) => + Mutation$CreateUser( + createUser: createUser == null ? this.createUser : createUser, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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'), + 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: [], + 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) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), + fragmentDefinitionbasicMutationReturnFields, +]); +Mutation$CreateUser _parserFn$Mutation$CreateUser(Map data) => + Mutation$CreateUser.fromJson(data); +typedef OnMutationCompleted$Mutation$CreateUser = FutureOr Function( + 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, + 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); + + final OnMutationCompleted$Mutation$CreateUser? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$CreateUser on graphql.GraphQLClient { + Future> mutate$CreateUser( + Options$Mutation$CreateUser options) async => + await this.mutate(options); + graphql.ObservableQuery watchMutation$CreateUser( + WatchOptions$Mutation$CreateUser options) => + 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}); + + @override + factory Mutation$CreateUser$createUser.fromJson(Map json) => + _$Mutation$CreateUser$createUserFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + final Mutation$CreateUser$createUser$user? user; + + Map toJson() => _$Mutation$CreateUser$createUserToJson(this); + 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]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$CreateUser$createUser) || + 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; + final l$user = user; + final lOther$user = other.user; + if (l$user != lOther$user) return false; + return true; + } +} + +extension UtilityExtension$Mutation$CreateUser$createUser + on Mutation$CreateUser$createUser { + Mutation$CreateUser$createUser copyWith( + {int? code, + String? message, + bool? success, + String? $__typename, + Mutation$CreateUser$createUser$user? Function()? user}) => + Mutation$CreateUser$createUser( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename, + user: user == null ? this.user : user()); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$CreateUser$createUser$user { + Mutation$CreateUser$createUser$user( + {required this.username, + required this.userType, + required this.sshKeys, + required this.$__typename}); + + @override + factory Mutation$CreateUser$createUser$user.fromJson( + Map json) => + _$Mutation$CreateUser$createUser$userFromJson(json); + + final String username; + + @JsonKey(unknownEnumValue: Enum$UserType.$unknown) + final Enum$UserType userType; + + final List sshKeys; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$CreateUser$createUser$userToJson(this); + int get hashCode { + final l$username = username; + final l$userType = userType; + final l$sshKeys = sshKeys; + final l$$__typename = $__typename; + return Object.hashAll([ + l$username, + l$userType, + Object.hashAll(l$sshKeys.map((v) => v)), + l$$__typename + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$CreateUser$createUser$user) || + runtimeType != other.runtimeType) return false; + final l$username = username; + final lOther$username = other.username; + if (l$username != lOther$username) return false; + final l$userType = userType; + final lOther$userType = other.userType; + 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; + 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; + } + + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$CreateUser$createUser$user + on Mutation$CreateUser$createUser$user { + Mutation$CreateUser$createUser$user copyWith( + {String? username, + Enum$UserType? userType, + List? sshKeys, + String? $__typename}) => + Mutation$CreateUser$createUser$user( + username: username == null ? this.username : username, + userType: userType == null ? this.userType : userType, + sshKeys: sshKeys == null ? this.sshKeys : sshKeys, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Query$AllUsers { + Query$AllUsers({required this.users, required this.$__typename}); + + @override + factory Query$AllUsers.fromJson(Map json) => + _$Query$AllUsersFromJson(json); + + final Query$AllUsers$users users; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$AllUsersToJson(this); + int get hashCode { + final l$users = users; + final l$$__typename = $__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) + return false; + final l$users = users; + final lOther$users = other.users; + if (l$users != lOther$users) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$AllUsers on Query$AllUsers { + Query$AllUsers copyWith({Query$AllUsers$users? users, String? $__typename}) => + Query$AllUsers( + users: users == null ? this.users : users, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +const documentNodeQueryAllUsers = DocumentNode(definitions: [ + OperationDefinitionNode( + 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: [ + FieldNode( + name: NameNode(value: 'userType'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'username'), + 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) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), +]); +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); +} + +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); +} + +class FetchMoreOptions$Query$AllUsers extends graphql.FetchMoreOptions { + FetchMoreOptions$Query$AllUsers({required graphql.UpdateQuery updateQuery}) + : super(updateQuery: updateQuery, document: documentNodeQueryAllUsers); +} + +extension ClientExtension$Query$AllUsers on graphql.GraphQLClient { + Future> query$AllUsers( + [Options$Query$AllUsers? options]) async => + await this.query(options ?? Options$Query$AllUsers()); + graphql.ObservableQuery watchQuery$AllUsers( + [WatchOptions$Query$AllUsers? options]) => + this.watchQuery(options ?? WatchOptions$Query$AllUsers()); + 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); + return result == null ? null : Query$AllUsers.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$AllUsers$users { + Query$AllUsers$users({required this.allUsers, required this.$__typename}); + + @override + factory Query$AllUsers$users.fromJson(Map json) => + _$Query$AllUsers$usersFromJson(json); + + final List allUsers; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$AllUsers$usersToJson(this); + int get hashCode { + final l$allUsers = allUsers; + final l$$__typename = $__typename; + return Object.hashAll( + [Object.hashAll(l$allUsers.map((v) => v)), l$$__typename]); + } + + @override + bool operator ==(Object other) { + 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; + 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; + } + + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$AllUsers$users on Query$AllUsers$users { + Query$AllUsers$users copyWith( + {List? allUsers, + String? $__typename}) => + Query$AllUsers$users( + allUsers: allUsers == null ? this.allUsers : allUsers, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Query$AllUsers$users$allUsers { + Query$AllUsers$users$allUsers( + {required this.userType, + required this.username, + required this.sshKeys, + required this.$__typename}); + + @override + factory Query$AllUsers$users$allUsers.fromJson(Map json) => + _$Query$AllUsers$users$allUsersFromJson(json); + + @JsonKey(unknownEnumValue: Enum$UserType.$unknown) + final Enum$UserType userType; + + final String username; + + final List sshKeys; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$AllUsers$users$allUsersToJson(this); + int get hashCode { + final l$userType = userType; + final l$username = username; + final l$sshKeys = sshKeys; + final l$$__typename = $__typename; + return Object.hashAll([ + l$userType, + l$username, + Object.hashAll(l$sshKeys.map((v) => v)), + l$$__typename + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$AllUsers$users$allUsers) || + runtimeType != other.runtimeType) return false; + final l$userType = userType; + final lOther$userType = other.userType; + if (l$userType != lOther$userType) return false; + final l$username = username; + final lOther$username = other.username; + if (l$username != lOther$username) return false; + final l$sshKeys = sshKeys; + final lOther$sshKeys = other.sshKeys; + 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; + } + + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$AllUsers$users$allUsers + on Query$AllUsers$users$allUsers { + Query$AllUsers$users$allUsers copyWith( + {Enum$UserType? userType, + String? username, + List? sshKeys, + String? $__typename}) => + Query$AllUsers$users$allUsers( + userType: userType == null ? this.userType : userType, + username: username == null ? this.username : username, + sshKeys: sshKeys == null ? this.sshKeys : sshKeys, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$AddSshKey { + Variables$Mutation$AddSshKey({required this.sshInput}); + + @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; + } + + Variables$Mutation$AddSshKey copyWith({Input$SshMutationInput? sshInput}) => + Variables$Mutation$AddSshKey( + sshInput: sshInput == null ? this.sshInput : sshInput); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$AddSshKey { + Mutation$AddSshKey({required this.addSshKey, required this.$__typename}); + + @override + factory Mutation$AddSshKey.fromJson(Map json) => + _$Mutation$AddSshKeyFromJson(json); + + final Mutation$AddSshKey$addSshKey addSshKey; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$AddSshKeyToJson(this); + int get hashCode { + final l$addSshKey = addSshKey; + final l$$__typename = $__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) + return false; + final l$addSshKey = addSshKey; + final lOther$addSshKey = other.addSshKey; + if (l$addSshKey != lOther$addSshKey) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$AddSshKey on Mutation$AddSshKey { + Mutation$AddSshKey copyWith( + {Mutation$AddSshKey$addSshKey? addSshKey, String? $__typename}) => + Mutation$AddSshKey( + addSshKey: addSshKey == null ? this.addSshKey : addSshKey, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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'), + 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: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'sshKeys'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'userType'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'username'), + 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) + ])), + fragmentDefinitionbasicMutationReturnFields, +]); +Mutation$AddSshKey _parserFn$Mutation$AddSshKey(Map data) => + Mutation$AddSshKey.fromJson(data); +typedef OnMutationCompleted$Mutation$AddSshKey = FutureOr Function( + 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, + 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); + + final OnMutationCompleted$Mutation$AddSshKey? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$AddSshKey on graphql.GraphQLClient { + Future> mutate$AddSshKey( + Options$Mutation$AddSshKey options) async => + await this.mutate(options); + graphql.ObservableQuery watchMutation$AddSshKey( + WatchOptions$Mutation$AddSshKey options) => + 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}); + + @override + factory Mutation$AddSshKey$addSshKey.fromJson(Map json) => + _$Mutation$AddSshKey$addSshKeyFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + final Mutation$AddSshKey$addSshKey$user? user; + + Map toJson() => _$Mutation$AddSshKey$addSshKeyToJson(this); + 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]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$AddSshKey$addSshKey) || + 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; + final l$user = user; + final lOther$user = other.user; + if (l$user != lOther$user) return false; + return true; + } +} + +extension UtilityExtension$Mutation$AddSshKey$addSshKey + on Mutation$AddSshKey$addSshKey { + Mutation$AddSshKey$addSshKey copyWith( + {int? code, + String? message, + bool? success, + String? $__typename, + Mutation$AddSshKey$addSshKey$user? Function()? user}) => + Mutation$AddSshKey$addSshKey( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename, + user: user == null ? this.user : user()); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$AddSshKey$addSshKey$user { + Mutation$AddSshKey$addSshKey$user( + {required this.sshKeys, + required this.userType, + required this.username, + required this.$__typename}); + + @override + factory Mutation$AddSshKey$addSshKey$user.fromJson( + Map json) => + _$Mutation$AddSshKey$addSshKey$userFromJson(json); + + final List sshKeys; + + @JsonKey(unknownEnumValue: Enum$UserType.$unknown) + final Enum$UserType userType; + + final String username; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$AddSshKey$addSshKey$userToJson(this); + int get hashCode { + final l$sshKeys = sshKeys; + final l$userType = userType; + final l$username = username; + final l$$__typename = $__typename; + return Object.hashAll([ + Object.hashAll(l$sshKeys.map((v) => v)), + l$userType, + l$username, + l$$__typename + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$AddSshKey$addSshKey$user) || + runtimeType != other.runtimeType) return false; + final l$sshKeys = sshKeys; + final lOther$sshKeys = other.sshKeys; + 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; + } + + final l$userType = userType; + final lOther$userType = other.userType; + if (l$userType != lOther$userType) return false; + final l$username = username; + final lOther$username = other.username; + if (l$username != lOther$username) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$AddSshKey$addSshKey$user + on Mutation$AddSshKey$addSshKey$user { + Mutation$AddSshKey$addSshKey$user copyWith( + {List? sshKeys, + Enum$UserType? userType, + String? username, + String? $__typename}) => + Mutation$AddSshKey$addSshKey$user( + sshKeys: sshKeys == null ? this.sshKeys : sshKeys, + userType: userType == null ? this.userType : userType, + username: username == null ? this.username : username, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Variables$Query$GetUser { + Variables$Query$GetUser({required this.username}); + + @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; + } + + Variables$Query$GetUser copyWith({String? username}) => + Variables$Query$GetUser( + username: username == null ? this.username : username); +} + +@JsonSerializable(explicitToJson: true) +class Query$GetUser { + Query$GetUser({required this.users, required this.$__typename}); + + @override + factory Query$GetUser.fromJson(Map json) => + _$Query$GetUserFromJson(json); + + final Query$GetUser$users users; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$GetUserToJson(this); + int get hashCode { + final l$users = users; + final l$$__typename = $__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) + return false; + final l$users = users; + final lOther$users = other.users; + if (l$users != lOther$users) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$GetUser on Query$GetUser { + Query$GetUser copyWith({Query$GetUser$users? users, String? $__typename}) => + Query$GetUser( + users: users == null ? this.users : users, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'getUser'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'username'), + value: VariableNode(name: NameNode(value: 'username'))) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'sshKeys'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'userType'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'username'), + 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$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); +} + +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); +} + +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); +} + +extension ClientExtension$Query$GetUser on graphql.GraphQLClient { + Future> query$GetUser( + Options$Query$GetUser options) async => + await this.query(options); + 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}) => + 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); + return result == null ? null : Query$GetUser.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$GetUser$users { + Query$GetUser$users({this.getUser, required this.$__typename}); + + @override + factory Query$GetUser$users.fromJson(Map json) => + _$Query$GetUser$usersFromJson(json); + + final Query$GetUser$users$getUser? getUser; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$GetUser$usersToJson(this); + int get hashCode { + final l$getUser = getUser; + final l$$__typename = $__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) + return false; + final l$getUser = getUser; + final lOther$getUser = other.getUser; + if (l$getUser != lOther$getUser) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$GetUser$users on Query$GetUser$users { + Query$GetUser$users copyWith( + {Query$GetUser$users$getUser? Function()? getUser, + String? $__typename}) => + Query$GetUser$users( + getUser: getUser == null ? this.getUser : getUser(), + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Query$GetUser$users$getUser { + Query$GetUser$users$getUser( + {required this.sshKeys, + required this.userType, + required this.username, + required this.$__typename}); + + @override + factory Query$GetUser$users$getUser.fromJson(Map json) => + _$Query$GetUser$users$getUserFromJson(json); + + final List sshKeys; + + @JsonKey(unknownEnumValue: Enum$UserType.$unknown) + final Enum$UserType userType; + + final String username; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$GetUser$users$getUserToJson(this); + int get hashCode { + final l$sshKeys = sshKeys; + final l$userType = userType; + final l$username = username; + final l$$__typename = $__typename; + return Object.hashAll([ + Object.hashAll(l$sshKeys.map((v) => v)), + l$userType, + l$username, + l$$__typename + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$GetUser$users$getUser) || + runtimeType != other.runtimeType) return false; + final l$sshKeys = sshKeys; + final lOther$sshKeys = other.sshKeys; + 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; + } + + final l$userType = userType; + final lOther$userType = other.userType; + if (l$userType != lOther$userType) return false; + final l$username = username; + final lOther$username = other.username; + if (l$username != lOther$username) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$GetUser$users$getUser + on Query$GetUser$users$getUser { + Query$GetUser$users$getUser copyWith( + {List? sshKeys, + Enum$UserType? userType, + String? username, + String? $__typename}) => + Query$GetUser$users$getUser( + sshKeys: sshKeys == null ? this.sshKeys : sshKeys, + userType: userType == null ? this.userType : userType, + username: username == null ? this.username : username, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$RemoveSshKey { + Variables$Mutation$RemoveSshKey({required this.sshInput}); + + @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; + } + + Variables$Mutation$RemoveSshKey copyWith( + {Input$SshMutationInput? sshInput}) => + Variables$Mutation$RemoveSshKey( + sshInput: sshInput == null ? this.sshInput : sshInput); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$RemoveSshKey { + Mutation$RemoveSshKey( + {required this.removeSshKey, required this.$__typename}); + + @override + factory Mutation$RemoveSshKey.fromJson(Map json) => + _$Mutation$RemoveSshKeyFromJson(json); + + final Mutation$RemoveSshKey$removeSshKey removeSshKey; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$RemoveSshKeyToJson(this); + int get hashCode { + final l$removeSshKey = removeSshKey; + final l$$__typename = $__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) + return false; + final l$removeSshKey = removeSshKey; + final lOther$removeSshKey = other.removeSshKey; + if (l$removeSshKey != lOther$removeSshKey) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$RemoveSshKey on Mutation$RemoveSshKey { + Mutation$RemoveSshKey copyWith( + {Mutation$RemoveSshKey$removeSshKey? removeSshKey, + String? $__typename}) => + Mutation$RemoveSshKey( + removeSshKey: removeSshKey == null ? this.removeSshKey : removeSshKey, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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'), + 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: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'sshKeys'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'userType'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'username'), + 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) + ])), + fragmentDefinitionbasicMutationReturnFields, +]); +Mutation$RemoveSshKey _parserFn$Mutation$RemoveSshKey( + Map data) => + Mutation$RemoveSshKey.fromJson(data); +typedef OnMutationCompleted$Mutation$RemoveSshKey = FutureOr Function( + 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, + 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$RemoveSshKey(data)), + update: update, + onError: onError, + document: documentNodeMutationRemoveSshKey, + parserFn: _parserFn$Mutation$RemoveSshKey); + + final OnMutationCompleted$Mutation$RemoveSshKey? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$RemoveSshKey on graphql.GraphQLClient { + Future> mutate$RemoveSshKey( + Options$Mutation$RemoveSshKey options) async => + await this.mutate(options); + graphql.ObservableQuery watchMutation$RemoveSshKey( + WatchOptions$Mutation$RemoveSshKey options) => + 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}); + + @override + factory Mutation$RemoveSshKey$removeSshKey.fromJson( + Map json) => + _$Mutation$RemoveSshKey$removeSshKeyFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + final Mutation$RemoveSshKey$removeSshKey$user? user; + + Map toJson() => + _$Mutation$RemoveSshKey$removeSshKeyToJson(this); + 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]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$RemoveSshKey$removeSshKey) || + 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; + final l$user = user; + final lOther$user = other.user; + if (l$user != lOther$user) return false; + return true; + } +} + +extension UtilityExtension$Mutation$RemoveSshKey$removeSshKey + on Mutation$RemoveSshKey$removeSshKey { + Mutation$RemoveSshKey$removeSshKey copyWith( + {int? code, + String? message, + bool? success, + String? $__typename, + Mutation$RemoveSshKey$removeSshKey$user? Function()? user}) => + Mutation$RemoveSshKey$removeSshKey( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename, + user: user == null ? this.user : user()); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$RemoveSshKey$removeSshKey$user { + Mutation$RemoveSshKey$removeSshKey$user( + {required this.sshKeys, + required this.userType, + required this.username, + required this.$__typename}); + + @override + factory Mutation$RemoveSshKey$removeSshKey$user.fromJson( + Map json) => + _$Mutation$RemoveSshKey$removeSshKey$userFromJson(json); + + final List sshKeys; + + @JsonKey(unknownEnumValue: Enum$UserType.$unknown) + final Enum$UserType userType; + + final String username; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$RemoveSshKey$removeSshKey$userToJson(this); + int get hashCode { + final l$sshKeys = sshKeys; + final l$userType = userType; + final l$username = username; + final l$$__typename = $__typename; + return Object.hashAll([ + Object.hashAll(l$sshKeys.map((v) => v)), + l$userType, + l$username, + l$$__typename + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$RemoveSshKey$removeSshKey$user) || + runtimeType != other.runtimeType) return false; + final l$sshKeys = sshKeys; + final lOther$sshKeys = other.sshKeys; + 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; + } + + final l$userType = userType; + final lOther$userType = other.userType; + if (l$userType != lOther$userType) return false; + final l$username = username; + final lOther$username = other.username; + if (l$username != lOther$username) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$RemoveSshKey$removeSshKey$user + on Mutation$RemoveSshKey$removeSshKey$user { + Mutation$RemoveSshKey$removeSshKey$user copyWith( + {List? sshKeys, + Enum$UserType? userType, + String? username, + String? $__typename}) => + Mutation$RemoveSshKey$removeSshKey$user( + sshKeys: sshKeys == null ? this.sshKeys : sshKeys, + userType: userType == null ? this.userType : userType, + username: username == null ? this.username : username, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$DeleteUser { + Variables$Mutation$DeleteUser({required this.username}); + + @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; + } + + Variables$Mutation$DeleteUser copyWith({String? username}) => + Variables$Mutation$DeleteUser( + username: username == null ? this.username : username); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$DeleteUser { + Mutation$DeleteUser({required this.deleteUser, required this.$__typename}); + + @override + factory Mutation$DeleteUser.fromJson(Map json) => + _$Mutation$DeleteUserFromJson(json); + + final Mutation$DeleteUser$deleteUser deleteUser; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$DeleteUserToJson(this); + int get hashCode { + final l$deleteUser = deleteUser; + final l$$__typename = $__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) + return false; + final l$deleteUser = deleteUser; + final lOther$deleteUser = other.deleteUser; + if (l$deleteUser != lOther$deleteUser) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$DeleteUser on Mutation$DeleteUser { + Mutation$DeleteUser copyWith( + {Mutation$DeleteUser$deleteUser? deleteUser, String? $__typename}) => + Mutation$DeleteUser( + deleteUser: deleteUser == null ? this.deleteUser : deleteUser, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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'))) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: []), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + 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?); + +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, + 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); + + final OnMutationCompleted$Mutation$DeleteUser? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$DeleteUser on graphql.GraphQLClient { + Future> mutate$DeleteUser( + Options$Mutation$DeleteUser options) async => + await this.mutate(options); + graphql.ObservableQuery watchMutation$DeleteUser( + WatchOptions$Mutation$DeleteUser options) => + 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}); + + @override + factory Mutation$DeleteUser$deleteUser.fromJson(Map json) => + _$Mutation$DeleteUser$deleteUserFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$DeleteUser$deleteUserToJson(this); + 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 Mutation$DeleteUser$deleteUser) || + 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$Mutation$DeleteUser$deleteUser + on Mutation$DeleteUser$deleteUser { + Mutation$DeleteUser$deleteUser copyWith( + {int? code, String? message, bool? success, String? $__typename}) => + Mutation$DeleteUser$deleteUser( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$UpdateUser { + Variables$Mutation$UpdateUser({required this.user}); + + @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; + } + + Variables$Mutation$UpdateUser copyWith({Input$UserMutationInput? user}) => + Variables$Mutation$UpdateUser(user: user == null ? this.user : user); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$UpdateUser { + Mutation$UpdateUser({required this.updateUser, required this.$__typename}); + + @override + factory Mutation$UpdateUser.fromJson(Map json) => + _$Mutation$UpdateUserFromJson(json); + + final Mutation$UpdateUser$updateUser updateUser; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$UpdateUserToJson(this); + int get hashCode { + final l$updateUser = updateUser; + final l$$__typename = $__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) + return false; + final l$updateUser = updateUser; + final lOther$updateUser = other.updateUser; + if (l$updateUser != lOther$updateUser) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$UpdateUser on Mutation$UpdateUser { + Mutation$UpdateUser copyWith( + {Mutation$UpdateUser$updateUser? updateUser, String? $__typename}) => + Mutation$UpdateUser( + updateUser: updateUser == null ? this.updateUser : updateUser, + $__typename: $__typename == null ? this.$__typename : $__typename); +} + +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'), + 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: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'sshKeys'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'userType'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'username'), + 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) + ])), + fragmentDefinitionbasicMutationReturnFields, +]); +Mutation$UpdateUser _parserFn$Mutation$UpdateUser(Map data) => + Mutation$UpdateUser.fromJson(data); +typedef OnMutationCompleted$Mutation$UpdateUser = FutureOr Function( + 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, + 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); + + final OnMutationCompleted$Mutation$UpdateUser? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$UpdateUser on graphql.GraphQLClient { + Future> mutate$UpdateUser( + Options$Mutation$UpdateUser options) async => + await this.mutate(options); + graphql.ObservableQuery watchMutation$UpdateUser( + WatchOptions$Mutation$UpdateUser options) => + 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}); + + @override + factory Mutation$UpdateUser$updateUser.fromJson(Map json) => + _$Mutation$UpdateUser$updateUserFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + final Mutation$UpdateUser$updateUser$user? user; + + Map toJson() => _$Mutation$UpdateUser$updateUserToJson(this); + 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]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$UpdateUser$updateUser) || + 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; + final l$user = user; + final lOther$user = other.user; + if (l$user != lOther$user) return false; + return true; + } +} + +extension UtilityExtension$Mutation$UpdateUser$updateUser + on Mutation$UpdateUser$updateUser { + Mutation$UpdateUser$updateUser copyWith( + {int? code, + String? message, + bool? success, + String? $__typename, + Mutation$UpdateUser$updateUser$user? Function()? user}) => + Mutation$UpdateUser$updateUser( + code: code == null ? this.code : code, + message: message == null ? this.message : message, + success: success == null ? this.success : success, + $__typename: $__typename == null ? this.$__typename : $__typename, + user: user == null ? this.user : user()); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$UpdateUser$updateUser$user { + Mutation$UpdateUser$updateUser$user( + {required this.sshKeys, + required this.userType, + required this.username, + required this.$__typename}); + + @override + factory Mutation$UpdateUser$updateUser$user.fromJson( + Map json) => + _$Mutation$UpdateUser$updateUser$userFromJson(json); + + final List sshKeys; + + @JsonKey(unknownEnumValue: Enum$UserType.$unknown) + final Enum$UserType userType; + + final String username; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$UpdateUser$updateUser$userToJson(this); + int get hashCode { + final l$sshKeys = sshKeys; + final l$userType = userType; + final l$username = username; + final l$$__typename = $__typename; + return Object.hashAll([ + Object.hashAll(l$sshKeys.map((v) => v)), + l$userType, + l$username, + l$$__typename + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$UpdateUser$updateUser$user) || + runtimeType != other.runtimeType) return false; + final l$sshKeys = sshKeys; + final lOther$sshKeys = other.sshKeys; + 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; + } + + final l$userType = userType; + final lOther$userType = other.userType; + if (l$userType != lOther$userType) return false; + final l$username = username; + final lOther$username = other.username; + if (l$username != lOther$username) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Mutation$UpdateUser$updateUser$user + on Mutation$UpdateUser$updateUser$user { + Mutation$UpdateUser$updateUser$user copyWith( + {List? sshKeys, + Enum$UserType? userType, + String? username, + String? $__typename}) => + Mutation$UpdateUser$updateUser$user( + sshKeys: sshKeys == null ? this.sshKeys : sshKeys, + userType: userType == null ? this.userType : userType, + username: username == null ? this.username : username, + $__typename: $__typename == null ? this.$__typename : $__typename); +} 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 new file mode 100644 index 00000000..411cbfad --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/users.graphql.g.dart @@ -0,0 +1,471 @@ +// 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, + }; + +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 + : Mutation$CreateUser$createUser$user.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(), + }; + +Mutation$CreateUser$createUser$user + _$Mutation$CreateUser$createUser$userFromJson(Map json) => + Mutation$CreateUser$createUser$user( + 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 _$Mutation$CreateUser$createUser$userToJson( + Mutation$CreateUser$createUser$user 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) => + Query$AllUsers$users$allUsers.fromJson(e as Map)) + .toList(), + $__typename: json['__typename'] as String, + ); + +Map _$Query$AllUsers$usersToJson( + Query$AllUsers$users instance) => + { + 'allUsers': instance.allUsers.map((e) => e.toJson()).toList(), + '__typename': instance.$__typename, + }; + +Query$AllUsers$users$allUsers _$Query$AllUsers$users$allUsersFromJson( + Map json) => + Query$AllUsers$users$allUsers( + userType: $enumDecode(_$Enum$UserTypeEnumMap, json['userType'], + unknownValue: Enum$UserType.$unknown), + username: json['username'] as String, + sshKeys: + (json['sshKeys'] as List).map((e) => e as String).toList(), + $__typename: json['__typename'] as String, + ); + +Map _$Query$AllUsers$users$allUsersToJson( + Query$AllUsers$users$allUsers instance) => + { + 'userType': _$Enum$UserTypeEnumMap[instance.userType], + 'username': instance.username, + 'sshKeys': instance.sshKeys, + '__typename': instance.$__typename, + }; + +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 + : Mutation$AddSshKey$addSshKey$user.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(), + }; + +Mutation$AddSshKey$addSshKey$user _$Mutation$AddSshKey$addSshKey$userFromJson( + Map json) => + Mutation$AddSshKey$addSshKey$user( + sshKeys: + (json['sshKeys'] as List).map((e) => e as String).toList(), + userType: $enumDecode(_$Enum$UserTypeEnumMap, json['userType'], + unknownValue: Enum$UserType.$unknown), + username: json['username'] as String, + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$AddSshKey$addSshKey$userToJson( + Mutation$AddSshKey$addSshKey$user instance) => + { + 'sshKeys': instance.sshKeys, + 'userType': _$Enum$UserTypeEnumMap[instance.userType], + 'username': instance.username, + '__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 + : Query$GetUser$users$getUser.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, + }; + +Query$GetUser$users$getUser _$Query$GetUser$users$getUserFromJson( + Map json) => + Query$GetUser$users$getUser( + sshKeys: + (json['sshKeys'] as List).map((e) => e as String).toList(), + userType: $enumDecode(_$Enum$UserTypeEnumMap, json['userType'], + unknownValue: Enum$UserType.$unknown), + username: json['username'] as String, + $__typename: json['__typename'] as String, + ); + +Map _$Query$GetUser$users$getUserToJson( + Query$GetUser$users$getUser instance) => + { + 'sshKeys': instance.sshKeys, + 'userType': _$Enum$UserTypeEnumMap[instance.userType], + 'username': instance.username, + '__typename': instance.$__typename, + }; + +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 + : Mutation$RemoveSshKey$removeSshKey$user.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(), + }; + +Mutation$RemoveSshKey$removeSshKey$user + _$Mutation$RemoveSshKey$removeSshKey$userFromJson( + Map json) => + Mutation$RemoveSshKey$removeSshKey$user( + sshKeys: (json['sshKeys'] as List) + .map((e) => e as String) + .toList(), + userType: $enumDecode(_$Enum$UserTypeEnumMap, json['userType'], + unknownValue: Enum$UserType.$unknown), + username: json['username'] as String, + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$RemoveSshKey$removeSshKey$userToJson( + Mutation$RemoveSshKey$removeSshKey$user instance) => + { + 'sshKeys': instance.sshKeys, + 'userType': _$Enum$UserTypeEnumMap[instance.userType], + 'username': instance.username, + '__typename': instance.$__typename, + }; + +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 + : Mutation$UpdateUser$updateUser$user.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(), + }; + +Mutation$UpdateUser$updateUser$user + _$Mutation$UpdateUser$updateUser$userFromJson(Map json) => + Mutation$UpdateUser$updateUser$user( + sshKeys: (json['sshKeys'] as List) + .map((e) => e as String) + .toList(), + userType: $enumDecode(_$Enum$UserTypeEnumMap, json['userType'], + unknownValue: Enum$UserType.$unknown), + username: json['username'] as String, + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$UpdateUser$updateUser$userToJson( + Mutation$UpdateUser$updateUser$user instance) => + { + 'sshKeys': instance.sshKeys, + 'userType': _$Enum$UserTypeEnumMap[instance.userType], + 'username': instance.username, + '__typename': instance.$__typename, + }; diff --git a/lib/logic/api_maps/rest_maps/server.dart b/lib/logic/api_maps/rest_maps/server.dart index b16d46d3..17c1cbb2 100644 --- a/lib/logic/api_maps/rest_maps/server.dart +++ b/lib/logic/api_maps/rest_maps/server.dart @@ -105,8 +105,8 @@ class ServerApi extends ApiMap { try { response = await client.get('/services/status'); res = response.statusCode == HttpStatus.ok; - } on DioError catch (e) { - print(e.message); + } catch (e) { + print(e); } finally { close(client); } 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 c28bfa5f..088f82d5 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 @@ -81,11 +81,11 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { final Response dbGetResponse; final Dio client = await getClient(); try { - dbGetResponse = await client.post('/pricing'); + dbGetResponse = await client.get('/pricing'); final volume = dbGetResponse.data['pricing']['volume']; final volumePrice = volume['price_per_gb_month']['gross']; - price = volumePrice as double; + price = double.parse(volumePrice); } catch (e) { print(e); } finally { diff --git a/lib/logic/cubit/jobs/jobs_cubit.dart b/lib/logic/cubit/jobs/jobs_cubit.dart index 8485621f..486770c0 100644 --- a/lib/logic/cubit/jobs/jobs_cubit.dart +++ b/lib/logic/cubit/jobs/jobs_cubit.dart @@ -1,11 +1,14 @@ +import 'dart:async'; + import 'package:easy_localization/easy_localization.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server.dart'; import 'package:selfprivacy/logic/cubit/services/services_cubit.dart'; import 'package:selfprivacy/logic/cubit/users/users_cubit.dart'; import 'package:selfprivacy/logic/models/job.dart'; +import 'package:selfprivacy/logic/models/json/server_job.dart'; export 'package:provider/provider.dart'; @@ -15,20 +18,21 @@ class JobsCubit extends Cubit { JobsCubit({ required this.usersCubit, required this.servicesCubit, - }) : super(JobsStateEmpty()); + }) : super(const JobsStateEmpty([])); final ServerApi api = ServerApi(); final UsersCubit usersCubit; final ServicesCubit servicesCubit; - void addJob(final Job job) { - final List newJobsList = []; + void addJob(final ClientJob job) { + final List newJobsList = []; if (state is JobsStateWithJobs) { - newJobsList.addAll((state as JobsStateWithJobs).jobList); + final JobsStateWithJobs jobsState = state as JobsStateWithJobs; + newJobsList.addAll(jobsState.clientJobList); } newJobsList.add(job); getIt().showSnackBar('jobs.jobAdded'.tr()); - emit(JobsStateWithJobs(newJobsList)); + emit(JobsStateWithJobs(newJobsList, state.serverJobList)); } void removeJob(final String id) { @@ -37,51 +41,51 @@ class JobsCubit extends Cubit { } void createOrRemoveServiceToggleJob(final ToggleJob job) { - final List newJobsList = []; + final List newJobsList = []; if (state is JobsStateWithJobs) { - newJobsList.addAll((state as JobsStateWithJobs).jobList); + newJobsList.addAll((state as JobsStateWithJobs).clientJobList); } final bool needToRemoveJob = newJobsList .any((final el) => el is ServiceToggleJob && el.type == job.type); if (needToRemoveJob) { - final Job removingJob = newJobsList.firstWhere( + final ClientJob removingJob = newJobsList.firstWhere( (final el) => el is ServiceToggleJob && el.type == job.type, ); removeJob(removingJob.id); } else { newJobsList.add(job); getIt().showSnackBar('jobs.jobAdded'.tr()); - emit(JobsStateWithJobs(newJobsList)); + emit(JobsStateWithJobs(newJobsList, state.serverJobList)); } } void createShhJobIfNotExist(final CreateSSHKeyJob job) { - final List newJobsList = []; + final List newJobsList = []; if (state is JobsStateWithJobs) { - newJobsList.addAll((state as JobsStateWithJobs).jobList); + newJobsList.addAll((state as JobsStateWithJobs).clientJobList); } final bool isExistInJobList = newJobsList.any((final el) => el is CreateSSHKeyJob); if (!isExistInJobList) { newJobsList.add(job); getIt().showSnackBar('jobs.jobAdded'.tr()); - emit(JobsStateWithJobs(newJobsList)); + emit(JobsStateWithJobs(newJobsList, state.serverJobList)); } } Future rebootServer() async { - emit(JobsStateLoading()); + emit(JobsStateLoading(state.serverJobList)); final bool isSuccessful = await api.reboot(); if (isSuccessful) { getIt().showSnackBar('jobs.rebootSuccess'.tr()); } else { getIt().showSnackBar('jobs.rebootFailed'.tr()); } - emit(JobsStateEmpty()); + emit(JobsStateEmpty(state.serverJobList)); } Future upgradeServer() async { - emit(JobsStateLoading()); + emit(JobsStateLoading(state.serverJobList)); final bool isPullSuccessful = await api.pullConfigurationUpdate(); final bool isSuccessful = await api.upgrade(); if (isSuccessful) { @@ -93,15 +97,15 @@ class JobsCubit extends Cubit { } else { getIt().showSnackBar('jobs.upgradeFailed'.tr()); } - emit(JobsStateEmpty()); + emit(JobsStateEmpty(state.serverJobList)); } Future applyAll() async { if (state is JobsStateWithJobs) { - final List jobs = (state as JobsStateWithJobs).jobList; - emit(JobsStateLoading()); + final List jobs = (state as JobsStateWithJobs).clientJobList; + emit(JobsStateLoading(state.serverJobList)); bool hasServiceJobs = false; - for (final Job job in jobs) { + for (final ClientJob job in jobs) { if (job is CreateUserJob) { await usersCubit.createUser(job.user); } @@ -122,11 +126,45 @@ class JobsCubit extends Cubit { await api.pullConfigurationUpdate(); await api.apply(); + if (hasServiceJobs) { await servicesCubit.load(); } - emit(JobsStateEmpty()); + emit(JobsStateEmpty(state.serverJobList)); } } + + Future resetRequestsTimer() async { + const duration = Duration(seconds: 1); + Timer.periodic( + duration, + (final timer) async { + if (timer.tick >= 10) { + final List serverJobs = await api.getServerJobs(); + final List newServerJobs = []; + for (final ServerJob job in serverJobs) { + if (job.status == 'FINISHED') { + await api.removeApiJob(job.uid); + } else { + newServerJobs.add(job); + } + } + + if (state is JobsStateWithJobs) { + emit( + JobsStateWithJobs( + (state as JobsStateWithJobs).clientJobList, + newServerJobs, + ), + ); + } else { + emit( + JobsStateEmpty(newServerJobs), + ); + } + } + }, + ); + } } diff --git a/lib/logic/cubit/jobs/jobs_state.dart b/lib/logic/cubit/jobs/jobs_state.dart index dbcf968e..3737cb5d 100644 --- a/lib/logic/cubit/jobs/jobs_state.dart +++ b/lib/logic/cubit/jobs/jobs_state.dart @@ -1,28 +1,34 @@ part of 'jobs_cubit.dart'; abstract class JobsState extends Equatable { + const JobsState(this.serverJobList); + final List serverJobList; @override - List get props => []; + List get props => [serverJobList]; } -class JobsStateLoading extends JobsState {} +class JobsStateLoading extends JobsState { + const JobsStateLoading(super.serverJobList); +} -class JobsStateEmpty extends JobsState {} +class JobsStateEmpty extends JobsState { + const JobsStateEmpty(super.serverJobList); +} class JobsStateWithJobs extends JobsState { - JobsStateWithJobs(this.jobList); - final List jobList; + const JobsStateWithJobs(this.clientJobList, super.serverJobList); + final List clientJobList; JobsState removeById(final String id) { - final List newJobsList = - jobList.where((final element) => element.id != id).toList(); + final List newJobsList = + clientJobList.where((final element) => element.id != id).toList(); if (newJobsList.isEmpty) { - return JobsStateEmpty(); + return JobsStateEmpty(serverJobList); } - return JobsStateWithJobs(newJobsList); + return JobsStateWithJobs(newJobsList, serverJobList); } @override - List get props => jobList; + List get props => [...super.props, clientJobList]; } diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index e19b61ff..cbf9ec61 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -292,6 +292,43 @@ class ServerInstallationRepository { ], ), ); + } else if (e.response!.data['error']['code'] == 'resource_unavailable') { + final NavigationService nav = getIt.get(); + nav.showPopUpDialog( + BrandAlert( + title: 'modals.1_1'.tr(), + contentText: 'modals.2_2'.tr(), + actions: [ + ActionButton( + text: 'modals.7'.tr(), + isRed: true, + onPressed: () async { + ServerHostingDetails? serverDetails; + try { + serverDetails = await api.createServer( + dnsApiToken: cloudFlareKey, + rootUser: rootUser, + domainName: domainName, + ); + } catch (e) { + print(e); + } + + if (serverDetails == null) { + print('Server is not initialized!'); + return; + } + await saveServerDetails(serverDetails); + onSuccess(serverDetails); + }, + ), + ActionButton( + text: 'basis.cancel'.tr(), + onPressed: onCancel, + ), + ], + ), + ); } } } diff --git a/lib/logic/cubit/volumes/volumes_cubit.dart b/lib/logic/cubit/volumes/volumes_cubit.dart index c4f74df5..c6c522a9 100644 --- a/lib/logic/cubit/volumes/volumes_cubit.dart +++ b/lib/logic/cubit/volumes/volumes_cubit.dart @@ -12,12 +12,16 @@ part 'volumes_state.dart'; class ApiVolumesCubit extends ServerInstallationDependendCubit { ApiVolumesCubit(final ServerInstallationCubit serverInstallationCubit) - : super(serverInstallationCubit, const ApiVolumesState.initial()); + : super(serverInstallationCubit, const ApiVolumesState.initial()) { + final serverDetails = getIt().serverDetails; + providerApi = serverDetails == null + ? null + : VolumeApiFactoryCreator.createVolumeProviderApiFactory( + getIt().serverDetails!.provider, + ); + } - final VolumeProviderApiFactory providerApi = - VolumeApiFactoryCreator.createVolumeProviderApiFactory( - getIt().serverDetails!.provider, - ); + VolumeProviderApiFactory? providerApi; @override Future load() async { @@ -26,8 +30,16 @@ class ApiVolumesCubit } } + Future> getVolumes() async { + if (providerApi == null) { + return []; + } + + return providerApi!.getVolumeProvider().getVolumes(); + } + Future getPricePerGb() async => - providerApi.getVolumeProvider().getPricePerGb(); + providerApi!.getVolumeProvider().getPricePerGb(); Future refresh() async { emit(const ApiVolumesState([], LoadingStatus.refreshing)); @@ -35,8 +47,7 @@ class ApiVolumesCubit } Future _refetch() async { - final List volumes = - await providerApi.getVolumeProvider().getVolumes(); + final List volumes = await getVolumes(); if (volumes.isNotEmpty) { emit(ApiVolumesState(volumes, LoadingStatus.success)); } else { @@ -46,12 +57,12 @@ class ApiVolumesCubit Future attachVolume(final ServerVolume volume) async { final ServerHostingDetails server = getIt().serverDetails!; - await providerApi.getVolumeProvider().attachVolume(volume.id, server.id); + await providerApi!.getVolumeProvider().attachVolume(volume.id, server.id); refresh(); } Future detachVolume(final ServerVolume volume) async { - await providerApi.getVolumeProvider().detachVolume(volume.id); + await providerApi!.getVolumeProvider().detachVolume(volume.id); refresh(); } @@ -60,7 +71,7 @@ class ApiVolumesCubit final int newSizeGb, ) async { final ServerVolume? providerVolume = await fetchProdiverVolume(volume); - final bool resized = await providerApi.getVolumeProvider().resizeVolume( + final bool resized = await providerApi!.getVolumeProvider().resizeVolume( providerVolume!.id, newSizeGb, ); @@ -76,7 +87,7 @@ class ApiVolumesCubit Future createVolume() async { final ServerVolume? volume = - await providerApi.getVolumeProvider().createVolume(); + await providerApi!.getVolumeProvider().createVolume(); await attachVolume(volume!); await Future.delayed(const Duration(seconds: 10)); @@ -88,7 +99,7 @@ class ApiVolumesCubit Future deleteVolume(final ServerDiskVolume volume) async { final ServerVolume? providerVolume = await fetchProdiverVolume(volume); - await providerApi.getVolumeProvider().deleteVolume(providerVolume!.id); + await providerApi!.getVolumeProvider().deleteVolume(providerVolume!.id); refresh(); } @@ -102,7 +113,7 @@ class ApiVolumesCubit ) async { ServerVolume? fetchedVolume; final List volumes = - await providerApi.getVolumeProvider().getVolumes(); + await providerApi!.getVolumeProvider().getVolumes(); for (final ServerVolume providerVolume in volumes) { if (providerVolume.linuxDevice == null) { diff --git a/lib/logic/models/disk_size.dart b/lib/logic/models/disk_size.dart new file mode 100644 index 00000000..a8d7a28d --- /dev/null +++ b/lib/logic/models/disk_size.dart @@ -0,0 +1,9 @@ +class DiskSize { + DiskSize({final this.byte = 0}); + + double asKb() => byte / 1000.0; + double asMb() => byte / 1000000.0; + double asGb() => byte / 1000000000.0; + + int byte; +} diff --git a/lib/logic/models/job.dart b/lib/logic/models/job.dart index b04d7d05..9e694597 100644 --- a/lib/logic/models/job.dart +++ b/lib/logic/models/job.dart @@ -7,8 +7,8 @@ import 'package:selfprivacy/utils/password_generator.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; @immutable -class Job extends Equatable { - Job({ +class ClientJob extends Equatable { + ClientJob({ required this.title, final String? id, }) : id = id ?? StringGenerators.simpleId(); @@ -20,7 +20,7 @@ class Job extends Equatable { List get props => [id, title]; } -class CreateUserJob extends Job { +class CreateUserJob extends ClientJob { CreateUserJob({ required this.user, }) : super(title: '${"jobs.createUser".tr()} ${user.login}'); @@ -31,7 +31,7 @@ class CreateUserJob extends Job { List get props => [id, title, user]; } -class DeleteUserJob extends Job { +class DeleteUserJob extends ClientJob { DeleteUserJob({ required this.user, }) : super(title: '${"jobs.deleteUser".tr()} ${user.login}'); @@ -42,7 +42,7 @@ class DeleteUserJob extends Job { List get props => [id, title, user]; } -class ToggleJob extends Job { +class ToggleJob extends ClientJob { ToggleJob({ required this.type, required final super.title, @@ -66,7 +66,7 @@ class ServiceToggleJob extends ToggleJob { final bool needToTurnOn; } -class CreateSSHKeyJob extends Job { +class CreateSSHKeyJob extends ClientJob { CreateSSHKeyJob({ required this.user, required this.publicKey, @@ -79,7 +79,7 @@ class CreateSSHKeyJob extends Job { List get props => [id, title, user, publicKey]; } -class DeleteSSHKeyJob extends Job { +class DeleteSSHKeyJob extends ClientJob { DeleteSSHKeyJob({ required this.user, required this.publicKey, diff --git a/lib/logic/models/json/backup.g.dart b/lib/logic/models/json/backup.g.dart index dea4847d..eff513f0 100644 --- a/lib/logic/models/json/backup.g.dart +++ b/lib/logic/models/json/backup.g.dart @@ -24,7 +24,7 @@ BackupStatus _$BackupStatusFromJson(Map json) => BackupStatus( Map _$BackupStatusToJson(BackupStatus instance) => { - 'status': _$BackupStatusEnumEnumMap[instance.status]!, + 'status': _$BackupStatusEnumEnumMap[instance.status], 'progress': instance.progress, 'error_message': instance.errorMessage, }; diff --git a/lib/logic/models/json/hetzner_server_info.g.dart b/lib/logic/models/json/hetzner_server_info.g.dart index 6c178ea4..7d6ecd29 100644 --- a/lib/logic/models/json/hetzner_server_info.g.dart +++ b/lib/logic/models/json/hetzner_server_info.g.dart @@ -23,7 +23,7 @@ Map _$HetznerServerInfoToJson(HetznerServerInfo instance) => { 'id': instance.id, 'name': instance.name, - 'status': _$ServerStatusEnumMap[instance.status]!, + 'status': _$ServerStatusEnumMap[instance.status], 'created': instance.created.toIso8601String(), 'volumes': instance.volumes, 'server_type': instance.serverType, diff --git a/lib/logic/models/json/server_job.dart b/lib/logic/models/json/server_job.dart new file mode 100644 index 00000000..0a6454c1 --- /dev/null +++ b/lib/logic/models/json/server_job.dart @@ -0,0 +1,39 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'server_job.g.dart'; + +@JsonSerializable() +class ServerJob { + factory ServerJob.fromJson(final Map json) => + _$ServerJobFromJson(json); + ServerJob({ + required this.name, + required this.description, + required this.status, + required this.uid, + required this.updatedAt, + required this.createdAt, + final this.error, + final this.progress, + final this.result, + final this.statusText, + final this.finishedAt, + }); + + final String name; + final String description; + final String status; + final String uid; + @JsonKey(name: 'updated_at') + final String updatedAt; + @JsonKey(name: 'created_at') + final DateTime createdAt; + + final String? error; + final int? progress; + final String? result; + @JsonKey(name: 'status_text') + final String? statusText; + @JsonKey(name: 'finished_at') + final String? finishedAt; +} diff --git a/lib/logic/models/json/server_job.g.dart b/lib/logic/models/json/server_job.g.dart new file mode 100644 index 00000000..2af5358a --- /dev/null +++ b/lib/logic/models/json/server_job.g.dart @@ -0,0 +1,35 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'server_job.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ServerJob _$ServerJobFromJson(Map json) => ServerJob( + name: json['name'] as String, + description: json['description'] as String, + status: json['status'] as String, + uid: json['uid'] as String, + updatedAt: json['updated_at'] as String, + createdAt: DateTime.parse(json['created_at'] as String), + error: json['error'] as String?, + progress: json['progress'] as int?, + result: json['result'] as String?, + statusText: json['status_text'] as String?, + finishedAt: json['finished_at'] as String?, + ); + +Map _$ServerJobToJson(ServerJob instance) => { + 'name': instance.name, + 'description': instance.description, + 'status': instance.status, + 'uid': instance.uid, + 'updated_at': instance.updatedAt, + 'created_at': instance.createdAt.toIso8601String(), + 'error': instance.error, + 'progress': instance.progress, + 'result': instance.result, + 'status_text': instance.statusText, + 'finished_at': instance.finishedAt, + }; diff --git a/lib/ui/components/brand_button/outlined_button.dart b/lib/ui/components/brand_button/outlined_button.dart new file mode 100644 index 00000000..6284943a --- /dev/null +++ b/lib/ui/components/brand_button/outlined_button.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; + +class BrandOutlinedButton extends StatelessWidget { + const BrandOutlinedButton({ + final super.key, + this.onPressed, + this.title, + this.child, + this.disabled = false, + }); + + final VoidCallback? onPressed; + final String? title; + final Widget? child; + final bool disabled; + + @override + Widget build(final BuildContext context) => ConstrainedBox( + constraints: const BoxConstraints( + minHeight: 40, + minWidth: double.infinity, + ), + child: OutlinedButton( + onPressed: onPressed, + child: child ?? + Text( + title ?? '', + style: Theme.of(context).textTheme.button?.copyWith( + color: Theme.of(context).colorScheme.primary, + ), + ), + ), + ); +} diff --git a/lib/ui/components/jobs_content/jobs_content.dart b/lib/ui/components/jobs_content/jobs_content.dart index bd8166de..b4cf3a89 100644 --- a/lib/ui/components/jobs_content/jobs_content.dart +++ b/lib/ui/components/jobs_content/jobs_content.dart @@ -67,7 +67,7 @@ class JobsContent extends StatelessWidget { ]; } else if (state is JobsStateWithJobs) { widgets = [ - ...state.jobList + ...state.clientJobList .map( (final j) => Row( children: [ diff --git a/lib/ui/components/progress_bar/progress_bar.dart b/lib/ui/components/progress_bar/progress_bar.dart index 4de729f7..36c6d029 100644 --- a/lib/ui/components/progress_bar/progress_bar.dart +++ b/lib/ui/components/progress_bar/progress_bar.dart @@ -83,10 +83,14 @@ class _ProgressBarState extends State { height: 5, decoration: BoxDecoration( borderRadius: BorderRadius.circular(5), - gradient: const LinearGradient( + color: Theme.of(context).colorScheme.surfaceVariant, + gradient: LinearGradient( begin: Alignment.topLeft, end: Alignment.bottomRight, - colors: BrandColors.stableGradientColors, + colors: [ + Theme.of(context).colorScheme.primary, + Theme.of(context).colorScheme.secondary + ], ), ), duration: const Duration( @@ -122,15 +126,7 @@ class _ProgressBarState extends State { text: TextSpan( style: progressTextStyleLight, children: [ - if (checked) - const WidgetSpan( - child: Padding( - padding: EdgeInsets.only(bottom: 2, right: 2), - child: Icon(BrandIcons.check, size: 11), - ), - ) - else - TextSpan(text: '${index + 1}.', style: style), + TextSpan(text: '${index + 1}.', style: style), TextSpan(text: step, style: style) ], ), diff --git a/lib/ui/pages/providers/providers.dart b/lib/ui/pages/providers/providers.dart index fa231c45..4e99fab5 100644 --- a/lib/ui/pages/providers/providers.dart +++ b/lib/ui/pages/providers/providers.dart @@ -5,6 +5,9 @@ import 'package:selfprivacy/logic/cubit/backups/backups_cubit.dart'; import 'package:selfprivacy/logic/cubit/dns_records/dns_records_cubit.dart'; import 'package:selfprivacy/logic/cubit/providers/providers_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; +import 'package:selfprivacy/logic/cubit/volumes/volumes_cubit.dart'; +import 'package:selfprivacy/logic/models/disk_size.dart'; +import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; import 'package:selfprivacy/logic/models/provider.dart'; import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart'; @@ -18,6 +21,7 @@ import 'package:selfprivacy/ui/pages/backup_details/backup_details.dart'; import 'package:selfprivacy/ui/pages/dns_details/dns_details.dart'; import 'package:selfprivacy/ui/pages/providers/storage_card.dart'; import 'package:selfprivacy/ui/pages/server_details/server_details_screen.dart'; +import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; GlobalKey navigatorKey = GlobalKey(); @@ -73,15 +77,21 @@ class _ProvidersPageState extends State { Padding( padding: const EdgeInsets.only(bottom: 30), child: FutureBuilder( - future: - context.read().getServerDiskVolumes(), + future: Future.wait([ + context.read().getServerDiskVolumes(), + context.read().getVolumes(), + ]), builder: ( final BuildContext context, - final AsyncSnapshot snapshot, + final AsyncSnapshot> snapshot, ) => StorageCard( - volumes: - snapshot.hasData ? snapshot.data as List : [], + diskStatus: snapshot.hasData + ? toDiskStatus( + snapshot.data![0] as List, + snapshot.data![1] as List, + ) + : DiskStatus(), ), ), ), @@ -105,6 +115,60 @@ class _ProvidersPageState extends State { ), ); } + + DiskStatus toDiskStatus( + final List serverVolumes, + final List providerVolumes, + ) { + final DiskStatus diskStatus = DiskStatus(); + diskStatus.isDiskOkay = true; + + if (providerVolumes.isEmpty || serverVolumes.isEmpty) { + diskStatus.isDiskOkay = false; + } + + diskStatus.diskVolumes = serverVolumes.map(( + final ServerDiskVolume volume, + ) { + final DiskVolume diskVolume = DiskVolume(); + diskVolume.sizeUsed = DiskSize( + byte: volume.usedSpace == 'None' ? 0 : int.parse(volume.usedSpace), + ); + diskVolume.sizeTotal = DiskSize( + byte: volume.totalSpace == 'None' ? 0 : int.parse(volume.totalSpace), + ); + diskVolume.serverDiskVolume = volume; + + for (final ServerVolume providerVolume in providerVolumes) { + if (providerVolume.linuxDevice == null || + volume.model == null || + volume.serial == null) { + continue; + } + + final String deviceId = providerVolume.linuxDevice!.split('/').last; + if (deviceId.contains(volume.model!) && + deviceId.contains(volume.serial!)) { + diskVolume.providerVolume = providerVolume; + break; + } + } + + diskVolume.name = volume.name; + diskVolume.root = volume.root; + diskVolume.percentage = + volume.usedSpace != 'None' && volume.totalSpace != 'None' + ? 1.0 / diskVolume.sizeTotal.byte * diskVolume.sizeUsed.byte + : 0.0; + if (diskVolume.percentage >= 0.8 || + diskVolume.sizeTotal.asGb() - diskVolume.sizeUsed.asGb() <= 2.0) { + diskStatus.isDiskOkay = false; + } + return diskVolume; + }).toList(); + + return diskStatus; + } } class _Card extends StatelessWidget { @@ -137,8 +201,9 @@ class _Card extends StatelessWidget { break; case ProviderType.domain: title = 'providers.domain.screen_title'.tr(); - message = - appConfig.isDomainFilled ? appConfig.serverDomain!.domainName : ''; + message = appConfig.isDomainSelected + ? appConfig.serverDomain!.domainName + : ''; stableText = 'providers.domain.status'.tr(); onTap = () => Navigator.of(context).push( @@ -168,12 +233,17 @@ class _Card extends StatelessWidget { status: provider.state, child: Icon(provider.icon, size: 30, color: Colors.white), ), - const SizedBox(height: 10), - BrandText.h2(title), - const SizedBox(height: 10), + const SizedBox(height: 16), + Text( + title, + style: Theme.of(context).textTheme.titleLarge, + ), if (message != null) ...[ - BrandText.body2(message), - const SizedBox(height: 10), + Text( + message, + style: Theme.of(context).textTheme.titleLarge, + ), + const SizedBox(height: 16), ], if (provider.state == StateType.stable) BrandText.body2(stableText), ], diff --git a/lib/ui/pages/providers/storage_card.dart b/lib/ui/pages/providers/storage_card.dart index 74e0770f..f2facd21 100644 --- a/lib/ui/pages/providers/storage_card.dart +++ b/lib/ui/pages/providers/storage_card.dart @@ -1,67 +1,47 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; +import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; import 'package:selfprivacy/logic/cubit/providers/providers_cubit.dart'; -import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; -import 'package:selfprivacy/ui/components/brand_linear_indicator/brand_linear_indicator.dart'; import 'package:selfprivacy/ui/components/icon_status_mask/icon_status_mask.dart'; import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; import 'package:selfprivacy/ui/pages/server_storage/server_storage.dart'; +import 'package:selfprivacy/ui/pages/server_storage/server_storage_list_item.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; class StorageCard extends StatelessWidget { - const StorageCard({required this.volumes, final super.key}); + const StorageCard({ + required final this.diskStatus, + final super.key, + }); - final List volumes; + final DiskStatus diskStatus; @override Widget build(final BuildContext context) { - final DiskStatus diskStatus = toDiskStatus(volumes); - final List sections = []; for (final DiskVolume volume in diskStatus.diskVolumes) { sections.add( const SizedBox(height: 16), ); sections.add( - Text( - 'providers.storage.disk_usage'.tr( - args: [ - volume.gbUsed.toString(), - ], - ), - style: Theme.of(context).textTheme.titleMedium, - ), - ); - sections.add( - const SizedBox(height: 4), - ); - sections.add( - BrandLinearIndicator( - value: volume.percentage, - color: volume.root - ? Theme.of(context).colorScheme.primary - : Theme.of(context).colorScheme.secondary, - backgroundColor: Theme.of(context).colorScheme.surfaceVariant, - height: 14.0, - ), - ); - sections.add( - const SizedBox(height: 4), - ); - sections.add( - Text( - 'providers.storage.disk_total'.tr( - args: [ - volume.gbTotal.toString(), - volume.name, - ], - ), - style: Theme.of(context).textTheme.bodySmall, + ServerStorageListItem( + volume: volume, + dense: true, + showIcon: false, ), ); } + StateType state = context.watch().state + is ServerInstallationFinished + ? StateType.stable + : StateType.uninitialized; + + if (state == StateType.stable && !diskStatus.isDiskOkay) { + state = StateType.error; + } + return GestureDetector( onTap: () => Navigator.of(context).push( materialRoute( @@ -77,24 +57,25 @@ class StorageCard extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - const IconStatusMask( - status: StateType.stable, - child: Icon( + IconStatusMask( + status: state, + child: const Icon( Icons.storage_outlined, size: 30, color: Colors.white, ), ), - IconStatusMask( - status: StateType.stable, - child: Icon( - diskStatus.isDiskOkay - ? Icons.check_circle_outline - : Icons.error_outline, - size: 24, - color: Colors.white, + if (state != StateType.uninitialized) + IconStatusMask( + status: state, + child: Icon( + diskStatus.isDiskOkay + ? Icons.check_circle_outline + : Icons.error_outline, + size: 24, + color: Colors.white, + ), ), - ), ], ), const SizedBox(height: 16), @@ -102,12 +83,13 @@ class StorageCard extends StatelessWidget { 'providers.storage.card_title'.tr(), style: Theme.of(context).textTheme.titleLarge, ), - Text( - diskStatus.isDiskOkay - ? 'providers.storage.status_ok'.tr() - : 'providers.storage.status_error'.tr(), - style: Theme.of(context).textTheme.bodyLarge, - ), + if (state != StateType.uninitialized) + Text( + diskStatus.isDiskOkay + ? 'providers.storage.status_ok'.tr() + : 'providers.storage.status_error'.tr(), + style: Theme.of(context).textTheme.bodyLarge, + ), ...sections, const SizedBox(height: 8), ], @@ -115,34 +97,4 @@ class StorageCard extends StatelessWidget { ), ); } - - DiskStatus toDiskStatus(final List status) { - final DiskStatus diskStatus = DiskStatus(); - diskStatus.isDiskOkay = true; - - diskStatus.diskVolumes = status.map(( - final ServerDiskVolume volume, - ) { - final DiskVolume diskVolume = DiskVolume(); - diskVolume.gbUsed = volume.usedSpace == 'None' - ? 0 - : int.parse(volume.usedSpace) ~/ 1000000000; - diskVolume.gbTotal = volume.totalSpace == 'None' - ? 0 - : int.parse(volume.totalSpace) ~/ 1000000000; - diskVolume.name = volume.name; - diskVolume.root = volume.root; - diskVolume.percentage = - volume.usedSpace != 'None' && volume.totalSpace != 'None' - ? 1.0 / int.parse(volume.totalSpace) * int.parse(volume.usedSpace) - : 0.0; - if (diskVolume.percentage >= 0.8 || - diskVolume.gbTotal - diskVolume.gbUsed <= 2) { - diskStatus.isDiskOkay = false; - } - return diskVolume; - }).toList(); - - return diskStatus; - } } diff --git a/lib/ui/pages/server_storage/data_migration.dart b/lib/ui/pages/server_storage/data_migration.dart index 8523ce1d..b8fc158f 100644 --- a/lib/ui/pages/server_storage/data_migration.dart +++ b/lib/ui/pages/server_storage/data_migration.dart @@ -1,134 +1,46 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; -import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; -import 'package:selfprivacy/ui/components/brand_button/filled_button.dart'; +import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; -import 'package:selfprivacy/ui/components/brand_linear_indicator/brand_linear_indicator.dart'; import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; -import 'package:selfprivacy/ui/pages/server_storage/extending_volume.dart'; -import 'package:selfprivacy/utils/route_transitions/basic.dart'; +import 'package:selfprivacy/ui/pages/server_storage/server_storage_list_item.dart'; -class ServerStoragePage extends StatefulWidget { - const ServerStoragePage({required this.diskStatus, final super.key}); +class DataMigrationPage extends StatefulWidget { + const DataMigrationPage({ + required this.diskVolumeToResize, + required this.diskStatus, + required this.resizeTarget, + final super.key, + }); + final DiskVolume diskVolumeToResize; final DiskStatus diskStatus; + final DiskSize resizeTarget; @override - State createState() => _ServerStoragePageState(); + State createState() => _DataMigrationPageState(); } -class _ServerStoragePageState extends State { - List _expandedSections = []; - +class _DataMigrationPageState extends State { @override Widget build(final BuildContext context) { - final bool isReady = context.watch().state - is ServerInstallationFinished; - - if (!isReady) { - return BrandHeroScreen( - hasBackButton: true, - heroTitle: 'providers.storage.card_title'.tr(), - children: const [], - ); - } - - /// The first section is expanded, the rest are hidden by default. - /// ( true, false, false, etc... ) - _expandedSections = [ - true, - ...List.filled( - widget.diskStatus.diskVolumes.length - 1, - false, - ), - ]; - - int sectionId = 0; - final List sections = []; - for (final DiskVolume volume in widget.diskStatus.diskVolumes) { - sections.add( - const SizedBox(height: 16), - ); - sections.add( - Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - const Icon( - Icons.storage_outlined, - size: 24, - color: Colors.white, - ), - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Text( - 'providers.storage.disk_usage'.tr( - args: [ - volume.gbUsed.toString(), - ], - ), - style: Theme.of(context).textTheme.titleMedium, - ), - Expanded( - child: BrandLinearIndicator( - value: volume.percentage, - color: volume.root - ? Theme.of(context).colorScheme.primary - : Theme.of(context).colorScheme.secondary, - backgroundColor: - Theme.of(context).colorScheme.surfaceVariant, - height: 14.0, - ), - ), - Text( - 'providers.storage.disk_total'.tr( - args: [ - volume.gbTotal.toString(), - volume.name, - ], - ), - style: Theme.of(context).textTheme.bodySmall, - ), - ], - ), - ), - ], - ), - ), - ); - sections.add( - AnimatedCrossFade( - duration: const Duration(milliseconds: 200), - crossFadeState: _expandedSections[sectionId] - ? CrossFadeState.showFirst - : CrossFadeState.showSecond, - firstChild: FilledButton( - title: 'providers.extend_volume_button.title'.tr(), - onPressed: () => Navigator.of(context).push( - materialRoute( - ExtendingVolumePage( - diskVolume: volume, - ), - ), - ), - ), - secondChild: Container(), - ), - ); - - ++sectionId; - } - + int a = 0; return BrandHeroScreen( hasBackButton: true, - heroTitle: 'providers.storage.card_title'.tr(), + heroTitle: 'providers.storage.data_migration_title'.tr(), children: [ - ...sections, - const SizedBox(height: 8), + ...widget.diskStatus.diskVolumes + .map( + (final volume) => Column( + children: [ + ServerStorageListItem( + volume: volume, + ), + const SizedBox(height: 16), + ], + ), + ) + .toList(), ], ); } diff --git a/lib/ui/pages/server_storage/disk_status.dart b/lib/ui/pages/server_storage/disk_status.dart index ec2d2872..2c00097b 100644 --- a/lib/ui/pages/server_storage/disk_status.dart +++ b/lib/ui/pages/server_storage/disk_status.dart @@ -1,8 +1,15 @@ +import 'package:selfprivacy/logic/models/disk_size.dart'; +import 'package:selfprivacy/logic/models/hive/server_details.dart'; +import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; + class DiskVolume { - int gbUsed = 0; - int gbTotal = 0; + DiskSize sizeUsed = DiskSize(); + DiskSize sizeTotal = DiskSize(); String name = ''; bool root = false; + bool isResizable = true; + ServerDiskVolume? serverDiskVolume; + ServerVolume? providerVolume; /// from 0.0 to 1.0 double percentage = 0.0; diff --git a/lib/ui/pages/server_storage/extending_volume.dart b/lib/ui/pages/server_storage/extending_volume.dart index 43ad38c2..e232bac4 100644 --- a/lib/ui/pages/server_storage/extending_volume.dart +++ b/lib/ui/pages/server_storage/extending_volume.dart @@ -1,55 +1,40 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; import 'package:selfprivacy/logic/cubit/volumes/volumes_cubit.dart'; +import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/ui/components/brand_button/filled_button.dart'; import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; class ExtendingVolumePage extends StatefulWidget { - const ExtendingVolumePage({required this.diskVolume, final super.key}); + const ExtendingVolumePage({ + required this.diskVolumeToResize, + required this.diskStatus, + final super.key, + }); - final DiskVolume diskVolume; + final DiskVolume diskVolumeToResize; + final DiskStatus diskStatus; @override State createState() => _ExtendingVolumePageState(); } class _ExtendingVolumePageState extends State { - bool _isSizeError = false; - bool _isPriceError = false; + bool _isError = false; - double _currentSliderGbValue = 20.0; + double _currentSliderGbValue = -1; double _euroPerGb = 1.0; - final double maxGb = 500.0; - double minGb = 0.0; + final DiskSize maxSize = DiskSize(byte: 500000000000); + DiskSize minSize = DiskSize(); final TextEditingController _sizeController = TextEditingController(); - late final TextEditingController _priceController; - - void _updateByPrice() { - final double price = double.parse(_priceController.text); - _currentSliderGbValue = price / _euroPerGb; - _sizeController.text = _currentSliderGbValue.round.toString(); - - /// Now we need to convert size back to price to round - /// it properly and display it in text field as well, - /// because size in GB can ONLY(!) be discrete. - _updateBySize(); - } - - void _updateBySize() { - final double size = double.parse(_sizeController.text); - _priceController.text = (size * _euroPerGb).toString(); - _updateErrorStatuses(); - } + final TextEditingController _priceController = TextEditingController(); void _updateErrorStatuses() { - final bool error = minGb > _currentSliderGbValue; - _isSizeError = error; - _isPriceError = error; + _isError = minSize.asGb() > _currentSliderGbValue; } @override @@ -59,15 +44,26 @@ class _ExtendingVolumePageState extends State { final BuildContext context, final AsyncSnapshot snapshot, ) { + if (!snapshot.hasData) { + return BrandHeroScreen( + hasBackButton: true, + heroTitle: 'providers.storage.extending_volume_title'.tr(), + heroSubtitle: + 'providers.storage.extending_volume_description'.tr(), + children: const [ + SizedBox(height: 16), + ], + ); + } _euroPerGb = snapshot.data as double; - _sizeController.text = _currentSliderGbValue.toString(); + _sizeController.text = _currentSliderGbValue.truncate().toString(); _priceController.text = - (_euroPerGb * double.parse(_sizeController.text)).toString(); - _sizeController.addListener(_updateBySize); - _priceController.addListener(_updateByPrice); - minGb = widget.diskVolume.gbTotal + 1 < maxGb - ? widget.diskVolume.gbTotal + 1 - : maxGb; + (_euroPerGb * double.parse(_sizeController.text)) + .toStringAsPrecision(2); + minSize = widget.diskVolumeToResize.sizeTotal; + if (_currentSliderGbValue < 0) { + _currentSliderGbValue = minSize.asGb(); + } return BrandHeroScreen( hasBackButton: true, @@ -76,47 +72,48 @@ class _ExtendingVolumePageState extends State { children: [ const SizedBox(height: 16), Row( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - TextField( - textInputAction: TextInputAction.next, - enabled: true, - controller: _sizeController, - decoration: InputDecoration( - border: const OutlineInputBorder(), - errorText: _isSizeError ? ' ' : null, - labelText: 'providers.storage.size'.tr(), + ConstrainedBox( + constraints: const BoxConstraints(maxWidth: 130), + child: TextField( + readOnly: true, + textAlign: TextAlign.start, + textInputAction: TextInputAction.next, + enabled: true, + controller: _sizeController, + decoration: InputDecoration( + border: const OutlineInputBorder(), + errorText: _isError ? ' ' : null, + labelText: 'providers.storage.size'.tr(), + ), ), - keyboardType: TextInputType.number, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, - ], // Only numbers can be entered ), - const SizedBox(height: 16), - TextField( - textInputAction: TextInputAction.next, - enabled: true, - controller: _priceController, - decoration: InputDecoration( - border: const OutlineInputBorder(), - errorText: _isPriceError ? ' ' : null, - labelText: 'providers.storage.euro'.tr(), + const SizedBox(width: 16), + ConstrainedBox( + constraints: const BoxConstraints(maxWidth: 130), + child: TextField( + readOnly: true, + textAlign: TextAlign.start, + textInputAction: TextInputAction.next, + enabled: true, + controller: _priceController, + decoration: InputDecoration( + border: const OutlineInputBorder(), + errorText: _isError ? ' ' : null, + labelText: 'providers.storage.euro'.tr(), + ), ), - keyboardType: TextInputType.number, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, - ], // Only numbers can be entered ), ], ), const SizedBox(height: 16), Slider( - min: minGb, - value: widget.diskVolume.gbTotal + 5 < maxGb - ? widget.diskVolume.gbTotal + 5 - : maxGb, - max: maxGb, - divisions: 1, - label: _currentSliderGbValue.round().toString(), + min: minSize.asGb(), + value: _currentSliderGbValue, + max: maxSize.asGb(), onChanged: (final double value) { setState(() { _currentSliderGbValue = value; @@ -126,15 +123,22 @@ class _ExtendingVolumePageState extends State { ), const SizedBox(height: 16), FilledButton( - title: 'providers.extend_volume_button.title'.tr(), + title: 'providers.storage.extend_volume_button.title'.tr(), onPressed: null, + disabled: _isError, ), const SizedBox(height: 16), const Divider( height: 1.0, ), const SizedBox(height: 16), - const Icon(Icons.info_outlined, size: 24), + const Align( + alignment: Alignment.centerLeft, + child: Icon( + Icons.info_outlined, + size: 24, + ), + ), const SizedBox(height: 16), Text('providers.storage.extending_volume_price_info'.tr()), const SizedBox(height: 16), diff --git a/lib/ui/pages/server_storage/server_storage.dart b/lib/ui/pages/server_storage/server_storage.dart index 8523ce1d..766440be 100644 --- a/lib/ui/pages/server_storage/server_storage.dart +++ b/lib/ui/pages/server_storage/server_storage.dart @@ -1,11 +1,11 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; -import 'package:selfprivacy/ui/components/brand_button/filled_button.dart'; +import 'package:selfprivacy/ui/components/brand_button/outlined_button.dart'; import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; -import 'package:selfprivacy/ui/components/brand_linear_indicator/brand_linear_indicator.dart'; import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; import 'package:selfprivacy/ui/pages/server_storage/extending_volume.dart'; +import 'package:selfprivacy/ui/pages/server_storage/server_storage_list_item.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; class ServerStoragePage extends StatefulWidget { @@ -18,8 +18,6 @@ class ServerStoragePage extends StatefulWidget { } class _ServerStoragePageState extends State { - List _expandedSections = []; - @override Widget build(final BuildContext context) { final bool isReady = context.watch().state @@ -33,103 +31,62 @@ class _ServerStoragePageState extends State { ); } - /// The first section is expanded, the rest are hidden by default. - /// ( true, false, false, etc... ) - _expandedSections = [ - true, - ...List.filled( - widget.diskStatus.diskVolumes.length - 1, - false, - ), - ]; - - int sectionId = 0; - final List sections = []; - for (final DiskVolume volume in widget.diskStatus.diskVolumes) { - sections.add( - const SizedBox(height: 16), - ); - sections.add( - Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - const Icon( - Icons.storage_outlined, - size: 24, - color: Colors.white, - ), - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Text( - 'providers.storage.disk_usage'.tr( - args: [ - volume.gbUsed.toString(), - ], - ), - style: Theme.of(context).textTheme.titleMedium, - ), - Expanded( - child: BrandLinearIndicator( - value: volume.percentage, - color: volume.root - ? Theme.of(context).colorScheme.primary - : Theme.of(context).colorScheme.secondary, - backgroundColor: - Theme.of(context).colorScheme.surfaceVariant, - height: 14.0, - ), - ), - Text( - 'providers.storage.disk_total'.tr( - args: [ - volume.gbTotal.toString(), - volume.name, - ], - ), - style: Theme.of(context).textTheme.bodySmall, - ), - ], - ), - ), - ], - ), - ), - ); - sections.add( - AnimatedCrossFade( - duration: const Duration(milliseconds: 200), - crossFadeState: _expandedSections[sectionId] - ? CrossFadeState.showFirst - : CrossFadeState.showSecond, - firstChild: FilledButton( - title: 'providers.extend_volume_button.title'.tr(), - onPressed: () => Navigator.of(context).push( - materialRoute( - ExtendingVolumePage( - diskVolume: volume, - ), - ), - ), - ), - secondChild: Container(), - ), - ); - - ++sectionId; - } - return BrandHeroScreen( hasBackButton: true, heroTitle: 'providers.storage.card_title'.tr(), children: [ - ...sections, + // ...sections, + ...widget.diskStatus.diskVolumes + .map( + (final volume) => Column( + children: [ + ServerStorageSection( + volume: volume, + diskStatus: widget.diskStatus, + ), + const SizedBox(height: 16), + const Divider(), + const SizedBox(height: 16), + ], + ), + ) + .toList(), const SizedBox(height: 8), ], ); } } + +class ServerStorageSection extends StatelessWidget { + const ServerStorageSection({ + required this.volume, + required this.diskStatus, + final super.key, + }); + + final DiskVolume volume; + final DiskStatus diskStatus; + + @override + Widget build(final BuildContext context) => Column( + children: [ + ServerStorageListItem( + volume: volume, + ), + if (volume.isResizable) ...[ + const SizedBox(height: 16), + BrandOutlinedButton( + title: 'providers.storage.extend_volume_button.title'.tr(), + onPressed: () => Navigator.of(context).push( + materialRoute( + ExtendingVolumePage( + diskVolumeToResize: volume, + diskStatus: diskStatus, + ), + ), + ), + ), + ], + ], + ); +} diff --git a/lib/ui/pages/server_storage/server_storage_list_item.dart b/lib/ui/pages/server_storage/server_storage_list_item.dart new file mode 100644 index 00000000..b6db282d --- /dev/null +++ b/lib/ui/pages/server_storage/server_storage_list_item.dart @@ -0,0 +1,74 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:selfprivacy/ui/components/brand_linear_indicator/brand_linear_indicator.dart'; +import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; + +class ServerStorageListItem extends StatelessWidget { + const ServerStorageListItem({ + required this.volume, + final this.showIcon = true, + final this.dense = false, + final super.key, + }); + + final DiskVolume volume; + final bool showIcon; + final bool dense; + + @override + Widget build(final BuildContext context) { + final TextStyle? titleStyle = dense + ? Theme.of(context).textTheme.titleMedium + : Theme.of(context).textTheme.titleLarge; + + final TextStyle? subtitleStyle = dense + ? Theme.of(context).textTheme.bodySmall + : Theme.of(context).textTheme.bodyMedium; + + return Row( + children: [ + if (showIcon) + const Icon( + Icons.storage_outlined, + size: 24, + color: Colors.white, + ), + if (showIcon) const SizedBox(width: 16), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'providers.storage.disk_usage'.tr( + args: [ + volume.sizeUsed.asGb().toStringAsPrecision(3), + ], + ), + style: titleStyle, + ), + const SizedBox(height: 4), + BrandLinearIndicator( + value: volume.percentage, + color: volume.root + ? Theme.of(context).colorScheme.primary + : Theme.of(context).colorScheme.secondary, + backgroundColor: Theme.of(context).colorScheme.surfaceVariant, + height: 14.0, + ), + const SizedBox(height: 4), + Text( + 'providers.storage.disk_total'.tr( + args: [ + volume.sizeTotal.asGb().toStringAsPrecision(3), + volume.name, + ], + ), + style: subtitleStyle, + ), + ], + ), + ), + ], + ); + } +} diff --git a/lib/ui/pages/services/service_page.dart b/lib/ui/pages/services/service_page.dart new file mode 100644 index 00000000..19a22c2c --- /dev/null +++ b/lib/ui/pages/services/service_page.dart @@ -0,0 +1,87 @@ +import 'package:flutter/material.dart'; +import 'package:selfprivacy/ui/components/brand_button/filled_button.dart'; +import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; +import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; + +class ServicePage extends StatefulWidget { + const ServicePage({final super.key}); + + @override + State createState() => _ServicePageState(); +} + +class _ServicePageState extends State { + @override + Widget build(final BuildContext context) { + int a; + return BrandHeroScreen( + hasBackButton: true, + children: [ + const SizedBox(height: 16), + Container( + alignment: Alignment.center, + child: const Icon( + Icons.question_mark_outlined, + size: 48, + ), + ), + const SizedBox(height: 16), + Text( + 'My Incredible Service', + textAlign: TextAlign.center, + style: Theme.of(context).textTheme.headlineMedium!.copyWith( + color: Theme.of(context).colorScheme.onBackground, + ), + ), + const SizedBox(height: 16), + BrandCards.outlined( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + ConstrainedBox( + constraints: const BoxConstraints(maxWidth: 24), + child: const Icon( + Icons.check_box_outlined, + size: 24, + ), + ), + const SizedBox(width: 16), + ConstrainedBox( + constraints: const BoxConstraints(maxWidth: 130), + child: const Text(''), + ), + ], + ), + ), + const SizedBox(height: 16), + const Divider(), + const SizedBox(height: 16), + ElevatedButton( + onPressed: null, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + ConstrainedBox( + constraints: const BoxConstraints(maxWidth: 24), + child: const Icon( + Icons.language_outlined, + size: 24, + ), + ), + const SizedBox(width: 16), + ConstrainedBox( + constraints: const BoxConstraints(maxWidth: 130), + child: const Text('Your Cool Domain'), + ), + ], + ), + ), + const SizedBox(height: 16), + ], + ); + } +} diff --git a/lib/ui/pages/services/services.dart b/lib/ui/pages/services/services.dart index 0b8ea12d..0a2b7db4 100644 --- a/lib/ui/pages/services/services.dart +++ b/lib/ui/pages/services/services.dart @@ -106,7 +106,7 @@ class _Card extends StatelessWidget { final switchableService = switchableServices.contains(serviceType); final hasSwitchJob = switchableService && jobState is JobsStateWithJobs && - jobState.jobList.any( + jobState.clientJobList.any( (final el) => el is ServiceToggleJob && el.type == serviceType, ); @@ -150,7 +150,7 @@ class _Card extends StatelessWidget { builder: (final context) { late bool isActive; if (hasSwitchJob) { - isActive = (jobState.jobList.firstWhere( + isActive = (jobState.clientJobList.firstWhere( (final el) => el is ServiceToggleJob && el.type == serviceType, ) as ServiceToggleJob) diff --git a/lib/ui/pages/setup/initializing.dart b/lib/ui/pages/setup/initializing.dart index 2cde89ce..ab6e456e 100644 --- a/lib/ui/pages/setup/initializing.dart +++ b/lib/ui/pages/setup/initializing.dart @@ -72,7 +72,7 @@ class InitializingPage extends StatelessWidget { 'Domain', 'User', 'Server', - '✅ Check', + 'Check', ], activeIndex: cubit.state.porgressBar, ), diff --git a/lib/ui/pages/ssh_keys/new_ssh_key.dart b/lib/ui/pages/ssh_keys/new_ssh_key.dart index 247590b7..fc558be2 100644 --- a/lib/ui/pages/ssh_keys/new_ssh_key.dart +++ b/lib/ui/pages/ssh_keys/new_ssh_key.dart @@ -11,7 +11,7 @@ class _NewSshKey extends StatelessWidget { final jobCubit = context.read(); final jobState = jobCubit.state; if (jobState is JobsStateWithJobs) { - final jobs = jobState.jobList; + final jobs = jobState.clientJobList; for (final job in jobs) { if (job is CreateSSHKeyJob && job.user.login == user.login) { user.sshKeys.add(job.publicKey); diff --git a/lib/ui/pages/users/new_user.dart b/lib/ui/pages/users/new_user.dart index 72cb6387..38ec74b7 100644 --- a/lib/ui/pages/users/new_user.dart +++ b/lib/ui/pages/users/new_user.dart @@ -18,7 +18,7 @@ class NewUser extends StatelessWidget { final users = []; users.addAll(context.read().state.users); if (jobState is JobsStateWithJobs) { - final jobs = jobState.jobList; + final jobs = jobState.clientJobList; for (final job in jobs) { if (job is CreateUserJob) { users.add(job.user); From 37d5ee991304c3aa52e554a59c9eebab249da89a Mon Sep 17 00:00:00 2001 From: NaiJi Date: Thu, 25 Aug 2022 02:45:02 +0300 Subject: [PATCH 023/115] Implement ServerJob cubit --- lib/config/bloc_config.dart | 4 +- .../provider_volume_cubit.dart | 108 ++++++++++++ .../provider_volume_state.dart | 24 +++ .../server_installation_cubit.dart | 3 - .../server_volumes/server_volume_cubit.dart | 36 ++++ .../server_volumes/server_volume_state.dart | 24 +++ lib/logic/cubit/volumes/volumes_cubit.dart | 160 ------------------ lib/logic/cubit/volumes/volumes_state.dart | 23 --- lib/ui/pages/providers/providers.dart | 23 +-- .../server_storage/extending_volume.dart | 4 +- ...service_storage_consumption_list_item.dart | 56 ++++++ 11 files changed, 258 insertions(+), 207 deletions(-) create mode 100644 lib/logic/cubit/provider_volumes/provider_volume_cubit.dart create mode 100644 lib/logic/cubit/provider_volumes/provider_volume_state.dart create mode 100644 lib/logic/cubit/server_volumes/server_volume_cubit.dart create mode 100644 lib/logic/cubit/server_volumes/server_volume_state.dart delete mode 100644 lib/logic/cubit/volumes/volumes_cubit.dart delete mode 100644 lib/logic/cubit/volumes/volumes_state.dart create mode 100644 lib/ui/pages/server_storage/service_storage_consumption_list_item.dart diff --git a/lib/config/bloc_config.dart b/lib/config/bloc_config.dart index 94508aa4..29b65450 100644 --- a/lib/config/bloc_config.dart +++ b/lib/config/bloc_config.dart @@ -10,7 +10,7 @@ import 'package:selfprivacy/logic/cubit/jobs/jobs_cubit.dart'; import 'package:selfprivacy/logic/cubit/providers/providers_cubit.dart'; import 'package:selfprivacy/logic/cubit/services/services_cubit.dart'; import 'package:selfprivacy/logic/cubit/users/users_cubit.dart'; -import 'package:selfprivacy/logic/cubit/volumes/volumes_cubit.dart'; +import 'package:selfprivacy/logic/cubit/provider_volumes/provider_volume_cubit.dart'; class BlocAndProviderConfig extends StatelessWidget { const BlocAndProviderConfig({final super.key, this.child}); @@ -27,7 +27,7 @@ class BlocAndProviderConfig extends StatelessWidget { final dnsRecordsCubit = DnsRecordsCubit(serverInstallationCubit); final recoveryKeyCubit = RecoveryKeyCubit(serverInstallationCubit); final apiDevicesCubit = ApiDevicesCubit(serverInstallationCubit); - final apiVolumesCubit = ApiVolumesCubit(serverInstallationCubit); + final apiVolumesCubit = ApiProviderVolumeCubit(serverInstallationCubit); return MultiProvider( providers: [ BlocProvider( diff --git a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart new file mode 100644 index 00000000..12e1a034 --- /dev/null +++ b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart @@ -0,0 +1,108 @@ +import 'package:selfprivacy/config/get_it_config.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_creator.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_factory.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/hive/server_details.dart'; +import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; +import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; + +part 'provider_volume_state.dart'; + +class ApiProviderVolumeCubit + extends ServerInstallationDependendCubit { + ApiProviderVolumeCubit(final ServerInstallationCubit serverInstallationCubit) + : super(serverInstallationCubit, const ApiProviderVolumeState.initial()) { + final serverDetails = getIt().serverDetails; + providerApi = serverDetails == null + ? null + : VolumeApiFactoryCreator.createVolumeProviderApiFactory( + getIt().serverDetails!.provider, + ); + } + + VolumeProviderApiFactory? providerApi; + + @override + Future load() async { + if (serverInstallationCubit.state is ServerInstallationFinished) { + _refetch(); + } + } + + Future getPricePerGb() async => + providerApi!.getVolumeProvider().getPricePerGb(); + + Future refresh() async { + emit(const ApiProviderVolumeState([], LoadingStatus.refreshing)); + _refetch(); + } + + Future _refetch() async { + if (providerApi == null) { + return emit(const ApiProviderVolumeState([], LoadingStatus.error)); + } + + final List volumes = + await providerApi!.getVolumeProvider().getVolumes(); + + if (volumes.isEmpty) { + return emit(const ApiProviderVolumeState([], LoadingStatus.error)); + } + + emit(ApiProviderVolumeState(volumes, LoadingStatus.success)); + } + + Future attachVolume(final ServerVolume volume) async { + final ServerHostingDetails server = getIt().serverDetails!; + await providerApi!.getVolumeProvider().attachVolume(volume.id, server.id); + refresh(); + } + + Future detachVolume(final ServerVolume volume) async { + await providerApi!.getVolumeProvider().detachVolume(volume.id); + refresh(); + } + + Future resizeVolume( + final DiskVolume volume, + final int newSizeGb, + ) async { + final bool resized = await providerApi!.getVolumeProvider().resizeVolume( + volume.providerVolume!.id, + newSizeGb, + ); + + if (!resized) { + return false; + } + + await ServerApi().resizeVolume(volume.name); + refresh(); + return true; + } + + Future createVolume() async { + final ServerVolume? volume = + await providerApi!.getVolumeProvider().createVolume(); + await attachVolume(volume!); + + await Future.delayed(const Duration(seconds: 10)); + + await ServerApi().mountVolume(volume.name); + refresh(); + } + + Future deleteVolume(final DiskVolume volume) async { + await providerApi! + .getVolumeProvider() + .deleteVolume(volume.providerVolume!.id); + refresh(); + } + + @override + void clear() { + emit(const ApiProviderVolumeState.initial()); + } +} diff --git a/lib/logic/cubit/provider_volumes/provider_volume_state.dart b/lib/logic/cubit/provider_volumes/provider_volume_state.dart new file mode 100644 index 00000000..16a3f177 --- /dev/null +++ b/lib/logic/cubit/provider_volumes/provider_volume_state.dart @@ -0,0 +1,24 @@ +part of 'provider_volume_cubit.dart'; + +class ApiProviderVolumeState extends ServerInstallationDependendState { + const ApiProviderVolumeState(this._volumes, this.status); + + const ApiProviderVolumeState.initial() + : this(const [], LoadingStatus.uninitialized); + final List _volumes; + final LoadingStatus status; + + List get volumes => _volumes; + + ApiProviderVolumeState copyWith({ + final List? volumes, + final LoadingStatus? status, + }) => + ApiProviderVolumeState( + volumes ?? _volumes, + status ?? this.status, + ); + + @override + List get props => [_volumes]; +} diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index a1b15e32..571eb8ac 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -554,9 +554,6 @@ class ServerInstallationCubit extends Cubit { ); } - Future> getServerDiskVolumes() async => - ServerApi().getServerDiskVolumes(); - Future setAndValidateCloudflareToken(final String token) async { final ServerInstallationRecovery dataState = state as ServerInstallationRecovery; diff --git a/lib/logic/cubit/server_volumes/server_volume_cubit.dart b/lib/logic/cubit/server_volumes/server_volume_cubit.dart new file mode 100644 index 00000000..fbd49a99 --- /dev/null +++ b/lib/logic/cubit/server_volumes/server_volume_cubit.dart @@ -0,0 +1,36 @@ +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server.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/json/server_disk_volume.dart'; + +part 'server_volume_state.dart'; + +class ApiServerVolumeCubit + extends ServerInstallationDependendCubit { + ApiServerVolumeCubit(final ServerInstallationCubit serverInstallationCubit) + : super(serverInstallationCubit, const ApiServerVolumeState.initial()); + + final ServerApi serverApi = ServerApi(); + + @override + Future load() async { + if (serverInstallationCubit.state is ServerInstallationFinished) { + _refetch(); + } + } + + Future _refetch() async { + final List volumes = + await serverApi.getServerDiskVolumes(); + if (volumes.isNotEmpty) { + emit(ApiServerVolumeState(volumes, LoadingStatus.success)); + } else { + emit(const ApiServerVolumeState([], LoadingStatus.error)); + } + } + + @override + void clear() { + emit(const ApiServerVolumeState.initial()); + } +} diff --git a/lib/logic/cubit/server_volumes/server_volume_state.dart b/lib/logic/cubit/server_volumes/server_volume_state.dart new file mode 100644 index 00000000..3c267710 --- /dev/null +++ b/lib/logic/cubit/server_volumes/server_volume_state.dart @@ -0,0 +1,24 @@ +part of 'server_volume_cubit.dart'; + +class ApiServerVolumeState extends ServerInstallationDependendState { + const ApiServerVolumeState(this._volumes, this.status); + + const ApiServerVolumeState.initial() + : this(const [], LoadingStatus.uninitialized); + final List _volumes; + final LoadingStatus status; + + List get volumes => _volumes; + + ApiServerVolumeState copyWith({ + final List? volumes, + final LoadingStatus? status, + }) => + ApiServerVolumeState( + volumes ?? _volumes, + status ?? this.status, + ); + + @override + List get props => [_volumes]; +} diff --git a/lib/logic/cubit/volumes/volumes_cubit.dart b/lib/logic/cubit/volumes/volumes_cubit.dart deleted file mode 100644 index c6c522a9..00000000 --- a/lib/logic/cubit/volumes/volumes_cubit.dart +++ /dev/null @@ -1,160 +0,0 @@ -import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_creator.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_factory.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/hive/server_details.dart'; -import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; - -part 'volumes_state.dart'; - -class ApiVolumesCubit - extends ServerInstallationDependendCubit { - ApiVolumesCubit(final ServerInstallationCubit serverInstallationCubit) - : super(serverInstallationCubit, const ApiVolumesState.initial()) { - final serverDetails = getIt().serverDetails; - providerApi = serverDetails == null - ? null - : VolumeApiFactoryCreator.createVolumeProviderApiFactory( - getIt().serverDetails!.provider, - ); - } - - VolumeProviderApiFactory? providerApi; - - @override - Future load() async { - if (serverInstallationCubit.state is ServerInstallationFinished) { - _refetch(); - } - } - - Future> getVolumes() async { - if (providerApi == null) { - return []; - } - - return providerApi!.getVolumeProvider().getVolumes(); - } - - Future getPricePerGb() async => - providerApi!.getVolumeProvider().getPricePerGb(); - - Future refresh() async { - emit(const ApiVolumesState([], LoadingStatus.refreshing)); - _refetch(); - } - - Future _refetch() async { - final List volumes = await getVolumes(); - if (volumes.isNotEmpty) { - emit(ApiVolumesState(volumes, LoadingStatus.success)); - } else { - emit(const ApiVolumesState([], LoadingStatus.error)); - } - } - - Future attachVolume(final ServerVolume volume) async { - final ServerHostingDetails server = getIt().serverDetails!; - await providerApi!.getVolumeProvider().attachVolume(volume.id, server.id); - refresh(); - } - - Future detachVolume(final ServerVolume volume) async { - await providerApi!.getVolumeProvider().detachVolume(volume.id); - refresh(); - } - - Future resizeVolume( - final ServerDiskVolume volume, - final int newSizeGb, - ) async { - final ServerVolume? providerVolume = await fetchProdiverVolume(volume); - final bool resized = await providerApi!.getVolumeProvider().resizeVolume( - providerVolume!.id, - newSizeGb, - ); - - if (!resized) { - return false; - } - - await ServerApi().resizeVolume(volume.name); - refresh(); - return true; - } - - Future createVolume() async { - final ServerVolume? volume = - await providerApi!.getVolumeProvider().createVolume(); - await attachVolume(volume!); - - await Future.delayed(const Duration(seconds: 10)); - - final ServerDiskVolume? diskVolume = await fetchServerDiskVolume(volume); - await ServerApi().mountVolume(diskVolume!.name); - refresh(); - } - - Future deleteVolume(final ServerDiskVolume volume) async { - final ServerVolume? providerVolume = await fetchProdiverVolume(volume); - await providerApi!.getVolumeProvider().deleteVolume(providerVolume!.id); - refresh(); - } - - @override - void clear() { - emit(const ApiVolumesState.initial()); - } - - Future fetchProdiverVolume( - final ServerDiskVolume volume, - ) async { - ServerVolume? fetchedVolume; - final List volumes = - await providerApi!.getVolumeProvider().getVolumes(); - - for (final ServerVolume providerVolume in volumes) { - if (providerVolume.linuxDevice == null) { - continue; - } - - final String deviceId = providerVolume.linuxDevice!.split('/').last; - if (deviceId.contains(volume.model!) && - deviceId.contains(volume.serial!)) { - fetchedVolume = providerVolume; - break; - } - } - - return fetchedVolume; - } - - Future fetchServerDiskVolume( - final ServerVolume volume, - ) async { - ServerDiskVolume? fetchedVolume; - if (volume.linuxDevice == null) { - return fetchedVolume; - } - - final List volumes = - await ServerApi().getServerDiskVolumes(); - - for (final ServerDiskVolume serverDiskVolumes in volumes) { - if (serverDiskVolumes.model == null || serverDiskVolumes.serial == null) { - continue; - } - - final String deviceId = volume.linuxDevice!.split('/').last; - if (deviceId.contains(serverDiskVolumes.model!) && - deviceId.contains(serverDiskVolumes.serial!)) { - fetchedVolume = serverDiskVolumes; - break; - } - } - - return fetchedVolume; - } -} diff --git a/lib/logic/cubit/volumes/volumes_state.dart b/lib/logic/cubit/volumes/volumes_state.dart deleted file mode 100644 index cdc14272..00000000 --- a/lib/logic/cubit/volumes/volumes_state.dart +++ /dev/null @@ -1,23 +0,0 @@ -part of 'volumes_cubit.dart'; - -class ApiVolumesState extends ServerInstallationDependendState { - const ApiVolumesState(this._volumes, this.status); - - const ApiVolumesState.initial() : this(const [], LoadingStatus.uninitialized); - final List _volumes; - final LoadingStatus status; - - List get volumes => _volumes; - - ApiVolumesState copyWith({ - final List? volumes, - final LoadingStatus? status, - }) => - ApiVolumesState( - volumes ?? _volumes, - status ?? this.status, - ); - - @override - List get props => [_volumes]; -} diff --git a/lib/ui/pages/providers/providers.dart b/lib/ui/pages/providers/providers.dart index 4e99fab5..2696bf85 100644 --- a/lib/ui/pages/providers/providers.dart +++ b/lib/ui/pages/providers/providers.dart @@ -5,7 +5,8 @@ import 'package:selfprivacy/logic/cubit/backups/backups_cubit.dart'; import 'package:selfprivacy/logic/cubit/dns_records/dns_records_cubit.dart'; import 'package:selfprivacy/logic/cubit/providers/providers_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; -import 'package:selfprivacy/logic/cubit/volumes/volumes_cubit.dart'; +import 'package:selfprivacy/logic/cubit/provider_volumes/provider_volume_cubit.dart'; +import 'package:selfprivacy/logic/cubit/server_volumes/server_volume_cubit.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; @@ -76,22 +77,10 @@ class _ProvidersPageState extends State { cards.add( Padding( padding: const EdgeInsets.only(bottom: 30), - child: FutureBuilder( - future: Future.wait([ - context.read().getServerDiskVolumes(), - context.read().getVolumes(), - ]), - builder: ( - final BuildContext context, - final AsyncSnapshot> snapshot, - ) => - StorageCard( - diskStatus: snapshot.hasData - ? toDiskStatus( - snapshot.data![0] as List, - snapshot.data![1] as List, - ) - : DiskStatus(), + child: StorageCard( + diskStatus: toDiskStatus( + context.read().state.volumes, + context.read().state.volumes, ), ), ), diff --git a/lib/ui/pages/server_storage/extending_volume.dart b/lib/ui/pages/server_storage/extending_volume.dart index e232bac4..651de4d0 100644 --- a/lib/ui/pages/server_storage/extending_volume.dart +++ b/lib/ui/pages/server_storage/extending_volume.dart @@ -1,7 +1,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; -import 'package:selfprivacy/logic/cubit/volumes/volumes_cubit.dart'; +import 'package:selfprivacy/logic/cubit/provider_volumes/provider_volume_cubit.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/ui/components/brand_button/filled_button.dart'; import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; @@ -39,7 +39,7 @@ class _ExtendingVolumePageState extends State { @override Widget build(final BuildContext context) => FutureBuilder( - future: context.read().getPricePerGb(), + future: context.read().getPricePerGb(), builder: ( final BuildContext context, final AsyncSnapshot snapshot, diff --git a/lib/ui/pages/server_storage/service_storage_consumption_list_item.dart b/lib/ui/pages/server_storage/service_storage_consumption_list_item.dart new file mode 100644 index 00000000..9396c1fc --- /dev/null +++ b/lib/ui/pages/server_storage/service_storage_consumption_list_item.dart @@ -0,0 +1,56 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:selfprivacy/ui/components/brand_linear_indicator/brand_linear_indicator.dart'; + +class ServiceStorageConsumptionListItem extends StatelessWidget { + const ServiceStorageConsumptionListItem({ + required this.title, + required this.percentage, + required this.storageConsumptionText, + required this.color, + required this.icon, + final super.key, + }); + + final String title; + final double percentage; + final String storageConsumptionText; + final Color color; + final IconData icon; + @override + Widget build(final BuildContext context) => Row( + children: [ + Icon( + icon, + ), + const SizedBox(width: 16), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + title, + style: Theme.of(context).textTheme.titleMedium, + ), + Text( + storageConsumptionText, + style: Theme.of(context).textTheme.bodyMedium, + ), + ], + ), + const SizedBox(height: 4), + BrandLinearIndicator( + value: percentage, + color: color, + backgroundColor: Theme.of(context).colorScheme.surfaceVariant, + height: 7.0, + ), + ], + ), + ), + ], + ); +} From 6014e385bc8c0f56018a768312afb069bfba6ca6 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 26 Aug 2022 05:34:25 +0300 Subject: [PATCH 024/115] Implement ServerJobCard --- .../provider_volume_cubit.dart | 20 +++++---- .../components/jobs_content/jobs_content.dart | 11 ++++- .../jobs_content/server_job_card.dart | 42 +++++++++++++++++++ 3 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 lib/ui/components/jobs_content/server_job_card.dart diff --git a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart index 12e1a034..be0a0d82 100644 --- a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart +++ b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart @@ -5,7 +5,6 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_pro 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/hive/server_details.dart'; -import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; part 'provider_volume_state.dart'; @@ -54,14 +53,18 @@ class ApiProviderVolumeCubit emit(ApiProviderVolumeState(volumes, LoadingStatus.success)); } - Future attachVolume(final ServerVolume volume) async { + Future attachVolume(final DiskVolume volume) async { final ServerHostingDetails server = getIt().serverDetails!; - await providerApi!.getVolumeProvider().attachVolume(volume.id, server.id); + await providerApi! + .getVolumeProvider() + .attachVolume(volume.providerVolume!.id, server.id); refresh(); } - Future detachVolume(final ServerVolume volume) async { - await providerApi!.getVolumeProvider().detachVolume(volume.id); + Future detachVolume(final DiskVolume volume) async { + await providerApi! + .getVolumeProvider() + .detachVolume(volume.providerVolume!.id); refresh(); } @@ -86,11 +89,14 @@ class ApiProviderVolumeCubit Future createVolume() async { final ServerVolume? volume = await providerApi!.getVolumeProvider().createVolume(); - await attachVolume(volume!); + + final diskVolume = DiskVolume(); + diskVolume.providerVolume = volume; + await attachVolume(diskVolume); await Future.delayed(const Duration(seconds: 10)); - await ServerApi().mountVolume(volume.name); + await ServerApi().mountVolume(volume!.name); refresh(); } diff --git a/lib/ui/components/jobs_content/jobs_content.dart b/lib/ui/components/jobs_content/jobs_content.dart index b4cf3a89..3948f7c4 100644 --- a/lib/ui/components/jobs_content/jobs_content.dart +++ b/lib/ui/components/jobs_content/jobs_content.dart @@ -11,6 +11,7 @@ import 'package:selfprivacy/ui/components/brand_button/brand_button.dart'; import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; import 'package:selfprivacy/ui/components/brand_loader/brand_loader.dart'; import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; +import 'package:selfprivacy/ui/components/jobs_content/server_job_card.dart'; class JobsContent extends StatelessWidget { const JobsContent({final super.key}); @@ -117,7 +118,15 @@ class JobsContent extends StatelessWidget { ), ), const SizedBox(height: 20), - ...widgets + ...widgets, + const SizedBox(height: 8), + const Divider(), + const SizedBox(height: 8), + ...state.serverJobList.map( + (final job) => ServerJobCard( + serverJob: job, + ), + ), ], ); }, diff --git a/lib/ui/components/jobs_content/server_job_card.dart b/lib/ui/components/jobs_content/server_job_card.dart new file mode 100644 index 00000000..6f8c50fa --- /dev/null +++ b/lib/ui/components/jobs_content/server_job_card.dart @@ -0,0 +1,42 @@ +import 'package:flutter/material.dart'; +import 'package:selfprivacy/logic/models/json/server_job.dart'; +import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; +import 'package:selfprivacy/ui/components/brand_linear_indicator/brand_linear_indicator.dart'; + +class ServerJobCard extends StatelessWidget { + const ServerJobCard({ + required final this.serverJob, + final super.key, + }); + + final ServerJob serverJob; + + @override + Widget build(final BuildContext context) => GestureDetector( + child: BrandCards.big( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + serverJob.name, + style: Theme.of(context).textTheme.bodyMedium, + ), + Text( + serverJob.description, + style: Theme.of(context).textTheme.bodySmall, + ), + const SizedBox(height: 8), + BrandLinearIndicator( + value: serverJob.progress == null + ? 0.0 + : serverJob.progress! / 100.0, + color: Theme.of(context).colorScheme.secondary, + backgroundColor: Theme.of(context).colorScheme.surfaceVariant, + height: 7.0, + ), + const SizedBox(height: 8), + ], + ), + ), + ); +} From a698d3e7b2c6d77407d7feaf0af9bbfc216d657e Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 26 Aug 2022 06:41:16 +0300 Subject: [PATCH 025/115] Add padding to About page --- lib/ui/pages/more/about/about.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/ui/pages/more/about/about.dart b/lib/ui/pages/more/about/about.dart index 3d642adc..15a7db13 100644 --- a/lib/ui/pages/more/about/about.dart +++ b/lib/ui/pages/more/about/about.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:selfprivacy/config/brand_theme.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:selfprivacy/ui/components/brand_md/brand_md.dart'; @@ -16,8 +17,13 @@ class AboutPage extends StatelessWidget { hasBackButton: true, ), ), - body: const BrandMarkdown( - fileName: 'about', + body: ListView( + padding: paddingH15V0, + children: const [ + BrandMarkdown( + fileName: 'about', + ), + ], ), ), ); From 952603517658ef275498f00da737f7bd5e181880 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 26 Aug 2022 19:46:30 +0300 Subject: [PATCH 026/115] Fix volume size calculation --- lib/config/bloc_config.dart | 16 +++++++++++++--- lib/logic/models/disk_size.dart | 6 +++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/config/bloc_config.dart b/lib/config/bloc_config.dart index 29b65450..0b4fe048 100644 --- a/lib/config/bloc_config.dart +++ b/lib/config/bloc_config.dart @@ -8,6 +8,7 @@ import 'package:selfprivacy/logic/cubit/backups/backups_cubit.dart'; import 'package:selfprivacy/logic/cubit/dns_records/dns_records_cubit.dart'; import 'package:selfprivacy/logic/cubit/jobs/jobs_cubit.dart'; import 'package:selfprivacy/logic/cubit/providers/providers_cubit.dart'; +import 'package:selfprivacy/logic/cubit/server_volumes/server_volume_cubit.dart'; import 'package:selfprivacy/logic/cubit/services/services_cubit.dart'; import 'package:selfprivacy/logic/cubit/users/users_cubit.dart'; import 'package:selfprivacy/logic/cubit/provider_volumes/provider_volume_cubit.dart'; @@ -28,6 +29,8 @@ class BlocAndProviderConfig extends StatelessWidget { final recoveryKeyCubit = RecoveryKeyCubit(serverInstallationCubit); final apiDevicesCubit = ApiDevicesCubit(serverInstallationCubit); final apiVolumesCubit = ApiProviderVolumeCubit(serverInstallationCubit); + final apiServerVolumesCubit = ApiServerVolumeCubit(serverInstallationCubit); + return MultiProvider( providers: [ BlocProvider( @@ -40,7 +43,9 @@ class BlocAndProviderConfig extends StatelessWidget { create: (final _) => serverInstallationCubit, lazy: false, ), - BlocProvider(create: (final _) => ProvidersCubit()), + BlocProvider( + create: (final _) => ProvidersCubit(), + ), BlocProvider( create: (final _) => usersCubit..load(), lazy: false, @@ -66,8 +71,13 @@ class BlocAndProviderConfig extends StatelessWidget { create: (final _) => apiVolumesCubit..load(), ), BlocProvider( - create: (final _) => - JobsCubit(usersCubit: usersCubit, servicesCubit: servicesCubit), + create: (final _) => apiServerVolumesCubit..load(), + ), + BlocProvider( + create: (final _) => JobsCubit( + usersCubit: usersCubit, + servicesCubit: servicesCubit, + ), ), ], child: child, diff --git a/lib/logic/models/disk_size.dart b/lib/logic/models/disk_size.dart index a8d7a28d..d71b7479 100644 --- a/lib/logic/models/disk_size.dart +++ b/lib/logic/models/disk_size.dart @@ -1,9 +1,9 @@ class DiskSize { DiskSize({final this.byte = 0}); - double asKb() => byte / 1000.0; - double asMb() => byte / 1000000.0; - double asGb() => byte / 1000000000.0; + double asKb() => byte / 1024.0; + double asMb() => byte / 1024.0 / 1024.0; + double asGb() => byte / 1024.0 / 1024.0 / 1024.0; int byte; } From d934a6a9cbcc94492f113965b056a37ffb480332 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 26 Aug 2022 22:28:01 +0300 Subject: [PATCH 027/115] Refactor graphql api, separate by logic --- assets/translations/en.json | 1 + .../api_maps/graphql_maps/schema/server.dart | 235 ------------------ .../graphql_maps/server_api/jobs_api.dart | 34 +++ .../graphql_maps/server_api/server.dart | 88 +++++++ .../server_api/server_actions_api.dart | 70 ++++++ .../graphql_maps/server_api/services_api.dart | 3 + .../graphql_maps/server_api/volume_api.dart | 59 +++++ lib/logic/cubit/jobs/jobs_cubit.dart | 2 +- .../provider_volume_cubit.dart | 2 +- .../server_installation_cubit.dart | 2 +- .../server_volumes/server_volume_cubit.dart | 2 +- lib/logic/models/disk_size.dart | 17 +- lib/logic/models/json/server_job.dart | 4 - lib/ui/pages/more/info/info.dart | 2 +- 14 files changed, 276 insertions(+), 245 deletions(-) delete mode 100644 lib/logic/api_maps/graphql_maps/schema/server.dart create mode 100644 lib/logic/api_maps/graphql_maps/server_api/jobs_api.dart create mode 100644 lib/logic/api_maps/graphql_maps/server_api/server.dart create mode 100644 lib/logic/api_maps/graphql_maps/server_api/server_actions_api.dart create mode 100644 lib/logic/api_maps/graphql_maps/server_api/services_api.dart create mode 100644 lib/logic/api_maps/graphql_maps/server_api/volume_api.dart diff --git a/assets/translations/en.json b/assets/translations/en.json index 52409913..840ffed0 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -172,6 +172,7 @@ "disk_total": "{} GB total · {}", "gb": "{} GB", "mb": "{} MB", + "kb": "{} KB", "extend_volume_button": "Extend volume", "extending_volume_title": "Extending volume", "extending_volume_description": "Resizing volume will allow you to store more data on your server without extending the server itself. Volume can only be extended: shrinking is not possible.", diff --git a/lib/logic/api_maps/graphql_maps/schema/server.dart b/lib/logic/api_maps/graphql_maps/schema/server.dart deleted file mode 100644 index 794cff51..00000000 --- a/lib/logic/api_maps/graphql_maps/schema/server.dart +++ /dev/null @@ -1,235 +0,0 @@ -import 'package:graphql/client.dart'; -import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/graphql_maps/api_map.dart'; -import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_api.graphql.dart'; -import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart'; -import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/services.graphql.dart'; -import 'package:selfprivacy/logic/models/hive/server_domain.dart'; -import 'package:selfprivacy/logic/models/json/api_token.dart'; -import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; -import 'package:selfprivacy/logic/models/json/server_job.dart'; - -class ServerApi extends ApiMap { - ServerApi({ - this.hasLogger = false, - this.isWithToken = true, - this.customToken = '', - }) { - final ServerDomain? serverDomain = getIt().serverDomain; - rootAddress = serverDomain?.domainName ?? ''; - } - @override - bool hasLogger; - @override - bool isWithToken; - @override - String customToken; - @override - String? rootAddress; - - Future _commonBoolRequest(final Function graphQLMethod) async { - QueryResult response; - bool result = false; - - try { - response = await graphQLMethod(); - if (response.hasException) { - print(response.exception.toString()); - result = false; - } else { - result = true; - } - } catch (e) { - print(e); - } - - return result; - } - - Future getApiVersion() async { - QueryResult response; - String? apiVersion; - - try { - final GraphQLClient client = await getClient(); - response = await client.query$GetApiVersion(); - if (response.hasException) { - print(response.exception.toString()); - } - apiVersion = response.data!['api']['version']; - } catch (e) { - print(e); - } - return apiVersion; - } - - Future> getApiTokens() async { - QueryResult response; - List tokens = []; - - try { - final GraphQLClient client = await getClient(); - response = await client.query$GetApiTokens(); - if (response.hasException) { - print(response.exception.toString()); - } - tokens = response.data!['api']['devices'] - .map((final e) => ApiToken.fromJson(e)) - .toList(); - } catch (e) { - print(e); - } - - return tokens; - } - - Future> getServerDiskVolumes() async { - QueryResult response; - List volumes = []; - - try { - final GraphQLClient client = await getClient(); - response = await client.query$GetServerDiskVolumes(); - if (response.hasException) { - print(response.exception.toString()); - } - volumes = response.data!['storage']['volumes'] - .map((final e) => ServerDiskVolume.fromJson(e)) - .toList(); - } catch (e) { - print(e); - } - - return volumes; - } - - Future mountVolume(final String volumeName) async { - try { - final GraphQLClient client = await getClient(); - final variables = Variables$Mutation$MountVolume(name: volumeName); - final mountVolumeMutation = - Options$Mutation$MountVolume(variables: variables); - await client.mutate$MountVolume(mountVolumeMutation); - } catch (e) { - print(e); - } - } - - Future unmountVolume(final String volumeName) async { - try { - final GraphQLClient client = await getClient(); - final variables = Variables$Mutation$UnmountVolume(name: volumeName); - final unmountVolumeMutation = - Options$Mutation$UnmountVolume(variables: variables); - await client.mutate$UnmountVolume(unmountVolumeMutation); - } catch (e) { - print(e); - } - } - - Future resizeVolume(final String volumeName) async { - try { - final GraphQLClient client = await getClient(); - final variables = Variables$Mutation$ResizeVolume(name: volumeName); - final resizeVolumeMutation = - Options$Mutation$ResizeVolume(variables: variables); - await client.mutate$ResizeVolume(resizeVolumeMutation); - } catch (e) { - print(e); - } - } - - Future> getServerJobs() async { - QueryResult response; - List jobs = []; - - try { - final GraphQLClient client = await getClient(); - response = await client.query$GetApiJobs(); - if (response.hasException) { - print(response.exception.toString()); - } - jobs = response.data!['jobs'] - .map((final e) => ServerJob.fromJson(e)) - .toList(); - } catch (e) { - print(e); - } - - return jobs; - } - - Future removeApiJob(final String uid) async { - try { - final GraphQLClient client = await getClient(); - //await client.query$GetApiJobsQuery(); - } catch (e) { - print(e); - } - } - - Future reboot() async { - try { - final GraphQLClient client = await getClient(); - return await _commonBoolRequest( - () async { - await client.mutate$RebootSystem(); - }, - ); - } catch (e) { - return false; - } - } - - Future pullConfigurationUpdate() async { - try { - final GraphQLClient client = await getClient(); - return await _commonBoolRequest( - () async { - await client.mutate$PullRepositoryChanges(); - }, - ); - } catch (e) { - return false; - } - } - - Future upgrade() async { - try { - final GraphQLClient client = await getClient(); - return await _commonBoolRequest( - () async { - await client.mutate$RunSystemUpgrade(); - }, - ); - } catch (e) { - return false; - } - } - - Future switchService(final String uid, final bool needTurnOn) async { - try { - final GraphQLClient client = await getClient(); - if (needTurnOn) { - final variables = Variables$Mutation$EnableService(serviceId: uid); - final mutation = Options$Mutation$EnableService(variables: variables); - await client.mutate$EnableService(mutation); - } else { - final variables = Variables$Mutation$DisableService(serviceId: uid); - final mutation = Options$Mutation$DisableService(variables: variables); - await client.mutate$DisableService(mutation); - } - } catch (e) { - print(e); - } - } - - Future apply() async { - try { - final GraphQLClient client = await getClient(); - await client.mutate$RunSystemRebuild(); - } catch (e) { - print(e); - } - } -} 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 new file mode 100644 index 00000000..f6bf36f8 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/server_api/jobs_api.dart @@ -0,0 +1,34 @@ +part of 'server.dart'; + +mixin JobsApi on ApiMap { + Future> getServerJobs() async { + QueryResult response; + List jobs = []; + + try { + final GraphQLClient client = await getClient(); + response = await client.query$GetApiJobs(); + if (response.hasException) { + print(response.exception.toString()); + } + jobs = response.data!['jobs'] + .map((final e) => ServerJob.fromJson(e)) + .toList(); + } catch (e) { + print(e); + } + + return jobs; + } + + 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); + await client.mutate$RemoveJob(mutation); + } catch (e) { + print(e); + } + } +} diff --git a/lib/logic/api_maps/graphql_maps/server_api/server.dart b/lib/logic/api_maps/graphql_maps/server_api/server.dart new file mode 100644 index 00000000..c7ee23e9 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/server_api/server.dart @@ -0,0 +1,88 @@ +import 'package:graphql/client.dart'; +import 'package:selfprivacy/config/get_it_config.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/api_map.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_api.graphql.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/services.graphql.dart'; +import 'package:selfprivacy/logic/models/hive/server_domain.dart'; +import 'package:selfprivacy/logic/models/json/api_token.dart'; +import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; +import 'package:selfprivacy/logic/models/json/server_job.dart'; + +part 'volume_api.dart'; +part 'jobs_api.dart'; +part 'server_actions_api.dart'; +part 'services_api.dart'; + +class ServerApi extends ApiMap with VolumeApi, JobsApi, ServerActionsApi { + ServerApi({ + this.hasLogger = false, + this.isWithToken = true, + this.customToken = '', + }) { + final ServerDomain? serverDomain = getIt().serverDomain; + rootAddress = serverDomain?.domainName ?? ''; + } + @override + bool hasLogger; + @override + bool isWithToken; + @override + String customToken; + @override + String? rootAddress; + + Future getApiVersion() async { + QueryResult response; + String? apiVersion; + + try { + final GraphQLClient client = await getClient(); + response = await client.query$GetApiVersion(); + if (response.hasException) { + print(response.exception.toString()); + } + apiVersion = response.data!['api']['version']; + } catch (e) { + print(e); + } + return apiVersion; + } + + Future> getApiTokens() async { + QueryResult response; + List tokens = []; + + try { + final GraphQLClient client = await getClient(); + response = await client.query$GetApiTokens(); + if (response.hasException) { + print(response.exception.toString()); + } + tokens = response.data!['api']['devices'] + .map((final e) => ApiToken.fromJson(e)) + .toList(); + } catch (e) { + print(e); + } + + return tokens; + } + + Future switchService(final String uid, final bool needTurnOn) async { + try { + final GraphQLClient client = await getClient(); + if (needTurnOn) { + final variables = Variables$Mutation$EnableService(serviceId: uid); + final mutation = Options$Mutation$EnableService(variables: variables); + await client.mutate$EnableService(mutation); + } else { + final variables = Variables$Mutation$DisableService(serviceId: uid); + final mutation = Options$Mutation$DisableService(variables: variables); + await client.mutate$DisableService(mutation); + } + } catch (e) { + print(e); + } + } +} 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 new file mode 100644 index 00000000..07ca101d --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/server_api/server_actions_api.dart @@ -0,0 +1,70 @@ +part of 'server.dart'; + +mixin ServerActionsApi on ApiMap { + Future _commonBoolRequest(final Function graphQLMethod) async { + QueryResult response; + bool result = false; + + try { + response = await graphQLMethod(); + if (response.hasException) { + print(response.exception.toString()); + result = false; + } else { + result = true; + } + } catch (e) { + print(e); + } + + return result; + } + + Future reboot() async { + try { + final GraphQLClient client = await getClient(); + return await _commonBoolRequest( + () async { + await client.mutate$RebootSystem(); + }, + ); + } catch (e) { + return false; + } + } + + Future pullConfigurationUpdate() async { + try { + final GraphQLClient client = await getClient(); + return await _commonBoolRequest( + () async { + await client.mutate$PullRepositoryChanges(); + }, + ); + } catch (e) { + return false; + } + } + + Future upgrade() async { + try { + final GraphQLClient client = await getClient(); + return await _commonBoolRequest( + () async { + await client.mutate$RunSystemUpgrade(); + }, + ); + } catch (e) { + return false; + } + } + + Future apply() async { + try { + final GraphQLClient client = await getClient(); + await client.mutate$RunSystemRebuild(); + } catch (e) { + print(e); + } + } +} 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 new file mode 100644 index 00000000..acbb8348 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/server_api/services_api.dart @@ -0,0 +1,3 @@ +part of 'server.dart'; + +mixin ServicesApi on ApiMap {} 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 new file mode 100644 index 00000000..ada66d58 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/server_api/volume_api.dart @@ -0,0 +1,59 @@ +part of 'server.dart'; + +mixin VolumeApi on ApiMap { + Future> getServerDiskVolumes() async { + QueryResult response; + List volumes = []; + + try { + final GraphQLClient client = await getClient(); + response = await client.query$GetServerDiskVolumes(); + if (response.hasException) { + print(response.exception.toString()); + } + volumes = response.data!['storage']['volumes'] + .map((final e) => ServerDiskVolume.fromJson(e)) + .toList(); + } catch (e) { + print(e); + } + + return volumes; + } + + Future mountVolume(final String volumeName) async { + try { + final GraphQLClient client = await getClient(); + final variables = Variables$Mutation$MountVolume(name: volumeName); + final mountVolumeMutation = + Options$Mutation$MountVolume(variables: variables); + await client.mutate$MountVolume(mountVolumeMutation); + } catch (e) { + print(e); + } + } + + Future unmountVolume(final String volumeName) async { + try { + final GraphQLClient client = await getClient(); + final variables = Variables$Mutation$UnmountVolume(name: volumeName); + final unmountVolumeMutation = + Options$Mutation$UnmountVolume(variables: variables); + await client.mutate$UnmountVolume(unmountVolumeMutation); + } catch (e) { + print(e); + } + } + + Future resizeVolume(final String volumeName) async { + try { + final GraphQLClient client = await getClient(); + final variables = Variables$Mutation$ResizeVolume(name: volumeName); + final resizeVolumeMutation = + Options$Mutation$ResizeVolume(variables: variables); + await client.mutate$ResizeVolume(resizeVolumeMutation); + } catch (e) { + print(e); + } + } +} diff --git a/lib/logic/cubit/jobs/jobs_cubit.dart b/lib/logic/cubit/jobs/jobs_cubit.dart index 486770c0..baac08dd 100644 --- a/lib/logic/cubit/jobs/jobs_cubit.dart +++ b/lib/logic/cubit/jobs/jobs_cubit.dart @@ -4,7 +4,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server.dart'; import 'package:selfprivacy/logic/cubit/services/services_cubit.dart'; import 'package:selfprivacy/logic/cubit/users/users_cubit.dart'; import 'package:selfprivacy/logic/models/job.dart'; diff --git a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart index be0a0d82..c1cb391a 100644 --- a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart +++ b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart @@ -1,5 +1,5 @@ import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_creator.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_factory.dart'; import 'package:selfprivacy/logic/common_enum/common_enum.dart'; diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 571eb8ac..aee5207f 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -4,7 +4,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; 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/schema/server.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/provider_api_settings.dart'; import 'package:selfprivacy/logic/models/hive/backblaze_credential.dart'; diff --git a/lib/logic/cubit/server_volumes/server_volume_cubit.dart b/lib/logic/cubit/server_volumes/server_volume_cubit.dart index fbd49a99..13015d0b 100644 --- a/lib/logic/cubit/server_volumes/server_volume_cubit.dart +++ b/lib/logic/cubit/server_volumes/server_volume_cubit.dart @@ -1,4 +1,4 @@ -import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server.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/json/server_disk_volume.dart'; diff --git a/lib/logic/models/disk_size.dart b/lib/logic/models/disk_size.dart index d71b7479..ecccb2b8 100644 --- a/lib/logic/models/disk_size.dart +++ b/lib/logic/models/disk_size.dart @@ -1,9 +1,24 @@ +import 'package:easy_localization/easy_localization.dart'; + class DiskSize { DiskSize({final this.byte = 0}); + int byte; + double asKb() => byte / 1024.0; double asMb() => byte / 1024.0 / 1024.0; double asGb() => byte / 1024.0 / 1024.0 / 1024.0; - int byte; + @override + String toString() { + if (byte < 1024) { + return '${byte.toStringAsFixed(0)} ${tr('bytes')}'; + } else if (byte < 1024 * 1024) { + return 'providers.storage.kb'.tr(args: [asKb().toStringAsFixed(1)]); + } else if (byte < 1024 * 1024 * 1024) { + return 'providers.storage.mb'.tr(args: [asMb().toStringAsFixed(1)]); + } else { + return 'providers.storage.gb'.tr(args: [asGb().toStringAsFixed(1)]); + } + } } diff --git a/lib/logic/models/json/server_job.dart b/lib/logic/models/json/server_job.dart index 0a6454c1..a54b7651 100644 --- a/lib/logic/models/json/server_job.dart +++ b/lib/logic/models/json/server_job.dart @@ -24,16 +24,12 @@ class ServerJob { final String description; final String status; final String uid; - @JsonKey(name: 'updated_at') final String updatedAt; - @JsonKey(name: 'created_at') final DateTime createdAt; final String? error; final int? progress; final String? result; - @JsonKey(name: 'status_text') final String? statusText; - @JsonKey(name: 'finished_at') final String? finishedAt; } diff --git a/lib/ui/pages/more/info/info.dart b/lib/ui/pages/more/info/info.dart index 0860ca80..ac0419fc 100644 --- a/lib/ui/pages/more/info/info.dart +++ b/lib/ui/pages/more/info/info.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:selfprivacy/config/brand_theme.dart'; -import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server.dart'; import 'package:selfprivacy/ui/components/brand_divider/brand_divider.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; From c0ce0193608282ff801fdbffcee831d8e0e55e86 Mon Sep 17 00:00:00 2001 From: inexcode Date: Mon, 29 Aug 2022 04:40:35 +0400 Subject: [PATCH 028/115] Add Services type and GraphQL endpoints with parsers. --- .../graphql_maps/server_api/server.dart | 23 +++ .../graphql_maps/server_api/services_api.dart | 158 +++++++++++++++++- lib/logic/models/json/dns_records.dart | 11 ++ lib/logic/models/service.dart | 94 +++++++++++ 4 files changed, 285 insertions(+), 1 deletion(-) create mode 100644 lib/logic/models/service.dart diff --git a/lib/logic/api_maps/graphql_maps/server_api/server.dart b/lib/logic/api_maps/graphql_maps/server_api/server.dart index c7ee23e9..04f1d855 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/server.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/server.dart @@ -1,6 +1,7 @@ import 'package:graphql/client.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/api_map.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'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/services.graphql.dart'; @@ -8,12 +9,34 @@ import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/api_token.dart'; import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; import 'package:selfprivacy/logic/models/json/server_job.dart'; +import 'package:selfprivacy/logic/models/service.dart'; part 'volume_api.dart'; part 'jobs_api.dart'; part 'server_actions_api.dart'; part 'services_api.dart'; +class GenericMutationResult { + GenericMutationResult({ + required this.success, + required this.code, + this.message, + }); + final bool success; + final int code; + final String? message; +} + +class GenericJobMutationReturn extends GenericMutationResult { + GenericJobMutationReturn({ + required final super.success, + required final super.code, + final super.message, + this.job, + }); + final ServerJob? job; +} + class ServerApi extends ApiMap with VolumeApi, JobsApi, ServerActionsApi { 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 acbb8348..62a55e15 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,3 +1,159 @@ part of 'server.dart'; -mixin ServicesApi on ApiMap {} +mixin ServicesApi on ApiMap { + Future> getAllServices() async { + QueryResult response; + List services = []; + try { + final GraphQLClient client = await getClient(); + response = await client.query$AllServices(); + if (response.hasException) { + print(response.exception.toString()); + } + services = response.parsedData?.services.allServices + .map((final service) => Service.fromGraphQL(service)) + .toList() ?? + []; + } catch (e) { + print(e); + } + return services; + } + + Future enableService(final String serviceId) async { + try { + final GraphQLClient client = await getClient(); + final variables = Variables$Mutation$EnableService(serviceId: serviceId); + final mutation = Options$Mutation$EnableService(variables: variables); + final response = await client.mutate$EnableService(mutation); + return GenericMutationResult( + success: response.parsedData?.enableService.success ?? false, + code: response.parsedData?.enableService.code ?? 0, + message: response.parsedData?.enableService.message, + ); + } catch (e) { + print(e); + return GenericMutationResult( + success: false, + code: 0, + message: e.toString(), + ); + } + } + + Future disableService(final String serviceId) async { + try { + final GraphQLClient client = await getClient(); + final variables = Variables$Mutation$DisableService(serviceId: serviceId); + final mutation = Options$Mutation$DisableService(variables: variables); + final response = await client.mutate$DisableService(mutation); + return GenericMutationResult( + success: response.parsedData?.disableService.success ?? false, + code: response.parsedData?.disableService.code ?? 0, + message: response.parsedData?.disableService.message, + ); + } catch (e) { + print(e); + return GenericMutationResult( + success: false, + code: 0, + message: e.toString(), + ); + } + } + + Future stopService(final String serviceId) async { + try { + final GraphQLClient client = await getClient(); + final variables = Variables$Mutation$StopService(serviceId: serviceId); + final mutation = Options$Mutation$StopService(variables: variables); + final response = await client.mutate$StopService(mutation); + return GenericMutationResult( + success: response.parsedData?.stopService.success ?? false, + code: response.parsedData?.stopService.code ?? 0, + message: response.parsedData?.stopService.message, + ); + } catch (e) { + print(e); + return GenericMutationResult( + success: false, + code: 0, + message: e.toString(), + ); + } + } + + 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 GenericMutationResult( + success: response.parsedData?.startService.success ?? false, + code: response.parsedData?.startService.code ?? 0, + message: response.parsedData?.startService.message, + ); + } catch (e) { + print(e); + return GenericMutationResult( + success: false, + code: 0, + message: e.toString(), + ); + } + } + + Future restartService(final String serviceId) async { + try { + final GraphQLClient client = await getClient(); + final variables = Variables$Mutation$RestartService(serviceId: serviceId); + final mutation = Options$Mutation$RestartService(variables: variables); + final response = await client.mutate$RestartService(mutation); + return GenericMutationResult( + success: response.parsedData?.restartService.success ?? false, + code: response.parsedData?.restartService.code ?? 0, + message: response.parsedData?.restartService.message, + ); + } catch (e) { + print(e); + return GenericMutationResult( + success: false, + code: 0, + message: e.toString(), + ); + } + } + + Future moveService( + final String serviceId, + final String destination, + ) async { + try { + final GraphQLClient client = await getClient(); + final variables = Variables$Mutation$MoveService( + input: Input$MoveServiceInput( + serviceId: serviceId, + location: destination, + ), + ); + final mutation = Options$Mutation$MoveService(variables: variables); + final response = await client.mutate$MoveService(mutation); + final jobJson = response.parsedData?.moveService.job?.toJson(); + return GenericJobMutationReturn( + success: response.parsedData?.moveService.success ?? false, + code: response.parsedData?.moveService.code ?? 0, + message: response.parsedData?.moveService.message, + job: jobJson != null ? ServerJob.fromJson(jobJson) : null, + ); + } catch (e) { + print(e); + return GenericJobMutationReturn( + success: false, + code: 0, + message: e.toString(), + job: null, + ); + } + } +} diff --git a/lib/logic/models/json/dns_records.dart b/lib/logic/models/json/dns_records.dart index cd4867c3..1bb385b5 100644 --- a/lib/logic/models/json/dns_records.dart +++ b/lib/logic/models/json/dns_records.dart @@ -1,4 +1,5 @@ import 'package:json_annotation/json_annotation.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/services.graphql.dart'; part 'dns_records.g.dart'; @@ -13,6 +14,16 @@ class DnsRecord { this.proxied = false, }); + DnsRecord.fromGraphQL( + final Query$AllServices$services$allServices$dnsRecords record, + ) : this( + type: record.recordType, + name: record.name, + content: record.content, + ttl: record.ttl, + priority: record.priority ?? 10, + ); + final String type; final String? name; final String? content; diff --git a/lib/logic/models/service.dart b/lib/logic/models/service.dart new file mode 100644 index 00000000..c0f54224 --- /dev/null +++ b/lib/logic/models/service.dart @@ -0,0 +1,94 @@ +import 'dart:convert'; + +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/schema.graphql.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/services.graphql.dart'; +import 'package:selfprivacy/logic/models/disk_size.dart'; +import 'package:selfprivacy/logic/models/json/dns_records.dart'; + +class Service { + Service({ + required this.id, + required this.displayName, + required this.description, + required this.isEnabled, + required this.isRequired, + required this.status, + required this.storageUsage, + required this.svgIcon, + required this.dnsRecords, + this.url, + }); + + Service.fromGraphQL(final Query$AllServices$services$allServices service) + : this( + id: service.id, + displayName: service.displayName, + description: service.description, + isEnabled: service.isEnabled, + isRequired: service.isRequired, + status: ServiceStatus.fromGraphQL(service.status), + storageUsage: ServiceStorageUsage( + used: DiskSize(byte: int.parse(service.storageUsage.usedSpace)), + volume: service.storageUsage.volume?.name, + ), + // Decode the base64 encoded svg icon to text. + svgIcon: utf8.decode(base64.decode(service.svgIcon)), + dnsRecords: service.dnsRecords + ?.map((final record) => DnsRecord.fromGraphQL(record)) + .toList() ?? + [], + url: service.url, + ); + + final String id; + final String displayName; + final String description; + final bool isEnabled; + final bool isRequired; + final ServiceStatus status; + final ServiceStorageUsage storageUsage; + final String svgIcon; + final String? url; + final List dnsRecords; +} + +class ServiceStorageUsage { + ServiceStorageUsage({ + required this.used, + required this.volume, + }); + + final DiskSize used; + final String? volume; +} + +enum ServiceStatus { + activating, + active, + deactivating, + failed, + inactive, + off, + reloading; + + factory ServiceStatus.fromGraphQL(final Enum$ServiceStatusEnum graphQL) { + switch (graphQL) { + case Enum$ServiceStatusEnum.ACTIVATING: + return activating; + case Enum$ServiceStatusEnum.ACTIVE: + return active; + case Enum$ServiceStatusEnum.DEACTIVATING: + return deactivating; + case Enum$ServiceStatusEnum.FAILED: + return failed; + case Enum$ServiceStatusEnum.INACTIVE: + return inactive; + case Enum$ServiceStatusEnum.OFF: + return off; + case Enum$ServiceStatusEnum.RELOADING: + return reloading; + case Enum$ServiceStatusEnum.$unknown: + return inactive; + } + } +} From 440151d0f53ec837cac82547071c4d45a89a365b Mon Sep 17 00:00:00 2001 From: inexcode Date: Mon, 29 Aug 2022 04:40:55 +0400 Subject: [PATCH 029/115] Add SVG library. --- pubspec.lock | 100 ++++++++---------- pubspec.yaml | 1 + .../flutter/generated_plugin_registrant.cc | 3 + windows/flutter/generated_plugins.cmake | 1 + 4 files changed, 48 insertions(+), 57 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index cb308ae6..8eae4c89 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -29,13 +29,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.3.1" - asn1lib: - dependency: transitive - description: - name: asn1lib - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" async: dependency: transitive description: @@ -84,7 +77,7 @@ packages: name: build_config url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.1.0" build_daemon: dependency: transitive description: @@ -105,7 +98,7 @@ packages: name: build_runner url: "https://pub.dartlang.org" source: hosted - version: "2.1.11" + version: "2.2.0" build_runner_core: dependency: transitive description: @@ -175,7 +168,7 @@ packages: name: connectivity_plus url: "https://pub.dartlang.org" source: hosted - version: "2.3.5" + version: "2.1.0" connectivity_plus_linux: dependency: transitive description: @@ -246,13 +239,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.1" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.4" dart_style: dependency: transitive description: @@ -266,49 +252,49 @@ packages: name: dbus url: "https://pub.dartlang.org" source: hosted - version: "0.7.3" + version: "0.7.8" device_info_plus: dependency: "direct main" description: name: device_info_plus url: "https://pub.dartlang.org" source: hosted - version: "3.2.3" + version: "4.1.2" device_info_plus_linux: dependency: transitive description: name: device_info_plus_linux url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "3.0.0" device_info_plus_macos: dependency: transitive description: name: device_info_plus_macos url: "https://pub.dartlang.org" source: hosted - version: "2.2.3" + version: "3.0.0" device_info_plus_platform_interface: dependency: transitive description: name: device_info_plus_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.3.0+1" + version: "3.0.0" device_info_plus_web: dependency: transitive description: name: device_info_plus_web url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "3.0.0" device_info_plus_windows: dependency: transitive description: name: device_info_plus_windows url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "4.0.0" dio: dependency: "direct main" description: @@ -322,7 +308,7 @@ packages: name: dynamic_color url: "https://pub.dartlang.org" source: hosted - version: "1.2.2" + version: "1.4.0" easy_localization: dependency: "direct main" description: @@ -371,7 +357,7 @@ packages: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "1.2.1" + version: "2.0.1" file: dependency: transitive description: @@ -487,6 +473,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.2" + flutter_svg: + dependency: "direct main" + description: + name: flutter_svg + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.4" flutter_test: dependency: "direct dev" description: flutter @@ -587,7 +580,7 @@ packages: name: graphql_codegen url: "https://pub.dartlang.org" source: hosted - version: "0.9.0" + version: "0.10.3" graphql_codegen_config: dependency: transitive description: @@ -622,7 +615,7 @@ packages: name: hive url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.2.3" hive_flutter: dependency: "direct main" description: @@ -636,7 +629,7 @@ packages: name: hive_generator url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.1.3" http: dependency: transitive description: @@ -664,7 +657,7 @@ packages: name: image url: "https://pub.dartlang.org" source: hosted - version: "3.1.3" + version: "3.2.0" intl: dependency: "direct main" description: @@ -699,14 +692,14 @@ packages: name: json_annotation url: "https://pub.dartlang.org" source: hosted - version: "4.5.0" + version: "4.6.0" json_serializable: dependency: "direct dev" description: name: json_serializable url: "https://pub.dartlang.org" source: hosted - version: "6.2.0" + version: "6.3.1" lints: dependency: transitive description: @@ -854,6 +847,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.1" + path_drawing: + dependency: transitive + description: + name: path_drawing + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" + path_parsing: + dependency: transitive + description: + name: path_parsing + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" path_provider: dependency: transitive description: @@ -881,7 +888,7 @@ packages: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "2.1.6" + version: "2.1.7" path_provider_macos: dependency: transitive description: @@ -902,7 +909,7 @@ packages: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.6" + version: "2.1.2" petitparser: dependency: transitive description: @@ -973,13 +980,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.2.0" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "3.1.0" recase: dependency: transitive description: @@ -1160,13 +1160,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.2" - ssh_key: - dependency: "direct main" - description: - name: ssh_key - url: "https://pub.dartlang.org" - source: hosted - version: "0.7.1" stack_trace: dependency: transitive description: @@ -1251,13 +1244,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.0" - tuple: - dependency: transitive - description: - name: tuple - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" typed_data: dependency: transitive description: @@ -1404,7 +1390,7 @@ packages: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.6.1" + version: "2.7.0" xdg_directories: dependency: transitive description: @@ -1418,7 +1404,7 @@ packages: name: xml url: "https://pub.dartlang.org" source: hosted - version: "5.4.1" + version: "6.1.0" yaml: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 114723f1..7ea16fb3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -24,6 +24,7 @@ dependencies: flutter_bloc: ^8.0.1 flutter_markdown: ^0.6.9 flutter_secure_storage: ^5.0.2 + flutter_svg: ^1.1.4 get_it: ^7.2.0 gql: ^0.13.1 graphql: ^5.1.1 diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 070eb3b5..1feb1b08 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -7,6 +7,7 @@ #include "generated_plugin_registrant.h" #include +#include #include #include #include @@ -14,6 +15,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { ConnectivityPlusWindowsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin")); + DynamicColorPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("DynamicColorPluginCApi")); FlutterSecureStorageWindowsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin")); SystemThemePluginRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index a26e37b0..fa5d72de 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -4,6 +4,7 @@ list(APPEND FLUTTER_PLUGIN_LIST connectivity_plus_windows + dynamic_color flutter_secure_storage_windows system_theme url_launcher_windows From b48017508abe4be04967c7cc724ded9e499f9e48 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 29 Aug 2022 19:37:31 +0300 Subject: [PATCH 030/115] Fix ProviderVolume cubit exception --- .../provider_volumes/provider_volume_cubit.dart | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart index c1cb391a..84d8aee1 100644 --- a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart +++ b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart @@ -12,20 +12,19 @@ part 'provider_volume_state.dart'; class ApiProviderVolumeCubit extends ServerInstallationDependendCubit { ApiProviderVolumeCubit(final ServerInstallationCubit serverInstallationCubit) - : super(serverInstallationCubit, const ApiProviderVolumeState.initial()) { - final serverDetails = getIt().serverDetails; - providerApi = serverDetails == null - ? null - : VolumeApiFactoryCreator.createVolumeProviderApiFactory( - getIt().serverDetails!.provider, - ); - } + : super(serverInstallationCubit, const ApiProviderVolumeState.initial()); VolumeProviderApiFactory? providerApi; @override Future load() async { if (serverInstallationCubit.state is ServerInstallationFinished) { + final serverDetails = getIt().serverDetails; + providerApi = serverDetails == null + ? null + : VolumeApiFactoryCreator.createVolumeProviderApiFactory( + getIt().serverDetails!.provider, + ); _refetch(); } } From 62db476575b68cea4f7506a535a109c8fac998db Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 29 Aug 2022 21:18:07 +0300 Subject: [PATCH 031/115] Fix ipv4 bug --- .../schema/disk_volumes.graphql.dart | 1369 +++++++- .../graphql_maps/schema/schema.graphql.dart | 415 ++- .../schema/server_api.graphql.dart | 2816 +++++++++++++++-- .../schema/server_settings.graphql.dart | 1085 ++++++- .../schema/server_settings.graphql.g.dart | 2 +- .../graphql_maps/schema/services.graphql.dart | 1715 +++++++++- .../schema/services.graphql.g.dart | 2 +- .../graphql_maps/schema/users.graphql.dart | 1618 +++++++++- .../graphql_maps/schema/users.graphql.g.dart | 12 +- .../server_providers/hetzner/hetzner.dart | 12 +- .../server_installation_cubit.dart | 2 - lib/logic/models/json/backup.g.dart | 2 +- .../models/json/hetzner_server_info.dart | 2 +- .../models/json/hetzner_server_info.g.dart | 6 +- lib/logic/models/json/server_job.g.dart | 16 +- .../components/progress_bar/progress_bar.dart | 2 - .../pages/server_storage/data_migration.dart | 39 +- ...service_storage_consumption_list_item.dart | 1 - lib/ui/pages/services/service_page.dart | 132 +- 19 files changed, 8261 insertions(+), 987 deletions(-) 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 c435da09..b7d6acac 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 @@ -61,13 +61,62 @@ class Fragment$basicMutationReturnFields { extension UtilityExtension$Fragment$basicMutationReturnFields on Fragment$basicMutationReturnFields { - Fragment$basicMutationReturnFields copyWith( - {int? code, String? message, bool? success, String? $__typename}) => - Fragment$basicMutationReturnFields( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Fragment$basicMutationReturnFields< + Fragment$basicMutationReturnFields> + 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; + + factory CopyWith$Fragment$basicMutationReturnFields.stub(TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields; + + 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); + + final Fragment$basicMutationReturnFields _instance; + + final TRes Function(Fragment$basicMutationReturnFields) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields + implements CopyWith$Fragment$basicMutationReturnFields { + _CopyWithStubImpl$Fragment$basicMutationReturnFields(this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; } const fragmentDefinitionbasicMutationReturnFields = FragmentDefinitionNode( @@ -175,11 +224,58 @@ class Query$GetServerDiskVolumes { extension UtilityExtension$Query$GetServerDiskVolumes on Query$GetServerDiskVolumes { - Query$GetServerDiskVolumes copyWith( - {Query$GetServerDiskVolumes$storage? storage, String? $__typename}) => - Query$GetServerDiskVolumes( - storage: storage == null ? this.storage : storage, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Query$GetServerDiskVolumes + 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; + + factory CopyWith$Query$GetServerDiskVolumes.stub(TRes res) = + _CopyWithStubImpl$Query$GetServerDiskVolumes; + + 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); + + final Query$GetServerDiskVolumes _instance; + + final TRes Function(Query$GetServerDiskVolumes) _then; + + static const _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))); + CopyWith$Query$GetServerDiskVolumes$storage get storage { + final local$storage = _instance.storage; + return CopyWith$Query$GetServerDiskVolumes$storage( + local$storage, (e) => call(storage: e)); + } +} + +class _CopyWithStubImpl$Query$GetServerDiskVolumes + implements CopyWith$Query$GetServerDiskVolumes { + _CopyWithStubImpl$Query$GetServerDiskVolumes(this._res); + + TRes _res; + + call({Query$GetServerDiskVolumes$storage? storage, String? $__typename}) => + _res; + CopyWith$Query$GetServerDiskVolumes$storage get storage => + CopyWith$Query$GetServerDiskVolumes$storage.stub(_res); } const documentNodeQueryGetServerDiskVolumes = DocumentNode(definitions: [ @@ -480,12 +576,73 @@ class Query$GetServerDiskVolumes$storage { extension UtilityExtension$Query$GetServerDiskVolumes$storage on Query$GetServerDiskVolumes$storage { - Query$GetServerDiskVolumes$storage copyWith( + CopyWith$Query$GetServerDiskVolumes$storage< + Query$GetServerDiskVolumes$storage> + 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; + + factory CopyWith$Query$GetServerDiskVolumes$storage.stub(TRes res) = + _CopyWithStubImpl$Query$GetServerDiskVolumes$storage; + + TRes call( + {List? volumes, + String? $__typename}); + TRes volumes( + Iterable Function( + Iterable< + CopyWith$Query$GetServerDiskVolumes$storage$volumes< + Query$GetServerDiskVolumes$storage$volumes>>) + _fn); +} + +class _CopyWithImpl$Query$GetServerDiskVolumes$storage + implements CopyWith$Query$GetServerDiskVolumes$storage { + _CopyWithImpl$Query$GetServerDiskVolumes$storage(this._instance, this._then); + + final Query$GetServerDiskVolumes$storage _instance; + + final TRes Function(Query$GetServerDiskVolumes$storage) _then; + + static const _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))); + TRes volumes( + Iterable Function( + Iterable< + CopyWith$Query$GetServerDiskVolumes$storage$volumes< + Query$GetServerDiskVolumes$storage$volumes>>) + _fn) => + call( + volumes: _fn(_instance.volumes.map((e) => + CopyWith$Query$GetServerDiskVolumes$storage$volumes( + e, (i) => i))).toList()); +} + +class _CopyWithStubImpl$Query$GetServerDiskVolumes$storage + implements CopyWith$Query$GetServerDiskVolumes$storage { + _CopyWithStubImpl$Query$GetServerDiskVolumes$storage(this._res); + + TRes _res; + + call( {List? volumes, String? $__typename}) => - Query$GetServerDiskVolumes$storage( - volumes: volumes == null ? this.volumes : volumes, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + volumes(_fn) => _res; } @JsonSerializable(explicitToJson: true) @@ -602,28 +759,121 @@ class Query$GetServerDiskVolumes$storage$volumes { extension UtilityExtension$Query$GetServerDiskVolumes$storage$volumes on Query$GetServerDiskVolumes$storage$volumes { - Query$GetServerDiskVolumes$storage$volumes copyWith( + CopyWith$Query$GetServerDiskVolumes$storage$volumes< + Query$GetServerDiskVolumes$storage$volumes> + 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; + + 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 usages( + Iterable Function( + Iterable< + CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages< + Query$GetServerDiskVolumes$storage$volumes$usages>>) + _fn); +} + +class _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes + implements CopyWith$Query$GetServerDiskVolumes$storage$volumes { + _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes( + this._instance, this._then); + + final Query$GetServerDiskVolumes$storage$volumes _instance; + + final TRes Function(Query$GetServerDiskVolumes$storage$volumes) _then; + + 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}) => + _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))); + TRes usages( + Iterable Function( + Iterable< + CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages< + Query$GetServerDiskVolumes$storage$volumes$usages>>) + _fn) => + call( + usages: _fn(_instance.usages.map((e) => + CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages( + e, (i) => i))).toList()); +} + +class _CopyWithStubImpl$Query$GetServerDiskVolumes$storage$volumes + implements CopyWith$Query$GetServerDiskVolumes$storage$volumes { + _CopyWithStubImpl$Query$GetServerDiskVolumes$storage$volumes(this._res); + + TRes _res; + + call( {String? freeSpace, - String? Function()? model, + String? model, String? name, bool? root, - String? Function()? serial, + String? serial, String? totalSpace, String? type, List? usages, String? usedSpace, String? $__typename}) => - Query$GetServerDiskVolumes$storage$volumes( - freeSpace: freeSpace == null ? this.freeSpace : freeSpace, - model: model == null ? this.model : model(), - name: name == null ? this.name : name, - root: root == null ? this.root : root, - serial: serial == null ? this.serial : serial(), - totalSpace: totalSpace == null ? this.totalSpace : totalSpace, - type: type == null ? this.type : type, - usages: usages == null ? this.usages : usages, - usedSpace: usedSpace == null ? this.usedSpace : usedSpace, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + usages(_fn) => _res; } @JsonSerializable(explicitToJson: true) @@ -682,12 +932,65 @@ class Query$GetServerDiskVolumes$storage$volumes$usages { extension UtilityExtension$Query$GetServerDiskVolumes$storage$volumes$usages on Query$GetServerDiskVolumes$storage$volumes$usages { - Query$GetServerDiskVolumes$storage$volumes$usages copyWith( - {String? title, String? usedSpace, String? $__typename}) => - Query$GetServerDiskVolumes$storage$volumes$usages( - title: title == null ? this.title : title, - usedSpace: usedSpace == null ? this.usedSpace : usedSpace, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages< + Query$GetServerDiskVolumes$storage$volumes$usages> + get copyWith => + CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages( + 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; + + factory CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages.stub( + TRes res) = + _CopyWithStubImpl$Query$GetServerDiskVolumes$storage$volumes$usages; + + 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); + + final Query$GetServerDiskVolumes$storage$volumes$usages _instance; + + final TRes Function(Query$GetServerDiskVolumes$storage$volumes$usages) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Query$GetServerDiskVolumes$storage$volumes$usages + implements + CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages { + _CopyWithStubImpl$Query$GetServerDiskVolumes$storage$volumes$usages( + this._res); + + TRes _res; + + call({String? title, String? usedSpace, String? $__typename}) => _res; } @JsonSerializable(explicitToJson: true) @@ -750,18 +1053,106 @@ class Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage extension UtilityExtension$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage on Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage { - Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage copyWith( + CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage< + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage> + get copyWith => + CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage( + 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; + + 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}); + CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service< + TRes> get service; +} + +class _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage< + TRes> + implements + CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage< + TRes> { + _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage( + this._instance, this._then); + + final Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage + _instance; + + final TRes Function( + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage) + _then; + + 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?))); + CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service< + TRes> get service { + final local$service = _instance.service; + return local$service == null + ? CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service + .stub(_then(_instance)) + : CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service( + local$service, (e) => call(service: e)); + } +} + +class _CopyWithStubImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage< + TRes> + implements + CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage< + TRes> { + _CopyWithStubImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage( + this._res); + + TRes _res; + + call( {String? title, String? usedSpace, String? $__typename, Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service? - Function()? service}) => - Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage( - title: title == null ? this.title : title, - usedSpace: usedSpace == null ? this.usedSpace : usedSpace, - $__typename: $__typename == null ? this.$__typename : $__typename, - service: service == null ? this.service : service()); + _res; + CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service< + TRes> + get service => + CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service + .stub(_res); } @JsonSerializable(explicitToJson: true) @@ -822,18 +1213,85 @@ class Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$ser extension UtilityExtension$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service on Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service { - Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service - copyWith( - {String? id, - bool? isMovable, - String? displayName, - String? $__typename}) => + CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service< + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service> + get copyWith => + CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service( + 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; + + 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}); +} + +class _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service< + TRes> + implements + CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service< + TRes> { + _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service( + this._instance, this._then); + + final Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service + _instance; + + final TRes Function( + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service) + _then; + + static const _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 == null ? this.id : id, - isMovable: isMovable == null ? this.isMovable : isMovable, - displayName: displayName == null ? this.displayName : displayName, - $__typename: - $__typename == null ? this.$__typename : $__typename); + 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< + TRes> + implements + CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service< + TRes> { + _CopyWithStubImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service( + this._res); + + TRes _res; + + call( + {String? id, + bool? isMovable, + String? displayName, + String? $__typename}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -863,8 +1321,46 @@ class Variables$Mutation$MountVolume { return true; } - Variables$Mutation$MountVolume copyWith({String? name}) => - Variables$Mutation$MountVolume(name: name == null ? this.name : name); + 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; + + factory CopyWith$Variables$Mutation$MountVolume.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$MountVolume; + + TRes call({String? name}); +} + +class _CopyWithImpl$Variables$Mutation$MountVolume + implements CopyWith$Variables$Mutation$MountVolume { + _CopyWithImpl$Variables$Mutation$MountVolume(this._instance, this._then); + + final Variables$Mutation$MountVolume _instance; + + final TRes Function(Variables$Mutation$MountVolume) _then; + + static const _undefined = {}; + + TRes call({Object? name = _undefined}) => + _then(Variables$Mutation$MountVolume( + name: name == _undefined || name == null + ? _instance.name + : (name as String))); +} + +class _CopyWithStubImpl$Variables$Mutation$MountVolume + implements CopyWith$Variables$Mutation$MountVolume { + _CopyWithStubImpl$Variables$Mutation$MountVolume(this._res); + + TRes _res; + + call({String? name}) => _res; } @JsonSerializable(explicitToJson: true) @@ -903,12 +1399,60 @@ class Mutation$MountVolume { } extension UtilityExtension$Mutation$MountVolume on Mutation$MountVolume { - Mutation$MountVolume copyWith( - {Mutation$MountVolume$mountVolume? mountVolume, - String? $__typename}) => - Mutation$MountVolume( - mountVolume: mountVolume == null ? this.mountVolume : mountVolume, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$MountVolume get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Mutation$MountVolume; + + 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); + + final Mutation$MountVolume _instance; + + final TRes Function(Mutation$MountVolume) _then; + + static const _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))); + CopyWith$Mutation$MountVolume$mountVolume get mountVolume { + final local$mountVolume = _instance.mountVolume; + return CopyWith$Mutation$MountVolume$mountVolume( + local$mountVolume, (e) => call(mountVolume: e)); + } +} + +class _CopyWithStubImpl$Mutation$MountVolume + implements CopyWith$Mutation$MountVolume { + _CopyWithStubImpl$Mutation$MountVolume(this._res); + + TRes _res; + + call({Mutation$MountVolume$mountVolume? mountVolume, String? $__typename}) => + _res; + CopyWith$Mutation$MountVolume$mountVolume get mountVolume => + CopyWith$Mutation$MountVolume$mountVolume.stub(_res); } const documentNodeMutationMountVolume = DocumentNode(definitions: [ @@ -1097,13 +1641,60 @@ class Mutation$MountVolume$mountVolume extension UtilityExtension$Mutation$MountVolume$mountVolume on Mutation$MountVolume$mountVolume { - Mutation$MountVolume$mountVolume copyWith( - {int? code, String? message, bool? success, String? $__typename}) => - Mutation$MountVolume$mountVolume( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$MountVolume$mountVolume + 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; + + factory CopyWith$Mutation$MountVolume$mountVolume.stub(TRes res) = + _CopyWithStubImpl$Mutation$MountVolume$mountVolume; + + 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); + + final Mutation$MountVolume$mountVolume _instance; + + final TRes Function(Mutation$MountVolume$mountVolume) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Mutation$MountVolume$mountVolume + implements CopyWith$Mutation$MountVolume$mountVolume { + _CopyWithStubImpl$Mutation$MountVolume$mountVolume(this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -1134,8 +1725,46 @@ class Variables$Mutation$ResizeVolume { return true; } - Variables$Mutation$ResizeVolume copyWith({String? name}) => - Variables$Mutation$ResizeVolume(name: name == null ? this.name : name); + 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; + + factory CopyWith$Variables$Mutation$ResizeVolume.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$ResizeVolume; + + TRes call({String? name}); +} + +class _CopyWithImpl$Variables$Mutation$ResizeVolume + implements CopyWith$Variables$Mutation$ResizeVolume { + _CopyWithImpl$Variables$Mutation$ResizeVolume(this._instance, this._then); + + final Variables$Mutation$ResizeVolume _instance; + + final TRes Function(Variables$Mutation$ResizeVolume) _then; + + static const _undefined = {}; + + TRes call({Object? name = _undefined}) => + _then(Variables$Mutation$ResizeVolume( + name: name == _undefined || name == null + ? _instance.name + : (name as String))); +} + +class _CopyWithStubImpl$Variables$Mutation$ResizeVolume + implements CopyWith$Variables$Mutation$ResizeVolume { + _CopyWithStubImpl$Variables$Mutation$ResizeVolume(this._res); + + TRes _res; + + call({String? name}) => _res; } @JsonSerializable(explicitToJson: true) @@ -1175,12 +1804,62 @@ class Mutation$ResizeVolume { } extension UtilityExtension$Mutation$ResizeVolume on Mutation$ResizeVolume { - Mutation$ResizeVolume copyWith( + CopyWith$Mutation$ResizeVolume get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Mutation$ResizeVolume; + + 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); + + final Mutation$ResizeVolume _instance; + + final TRes Function(Mutation$ResizeVolume) _then; + + static const _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))); + CopyWith$Mutation$ResizeVolume$resizeVolume get resizeVolume { + final local$resizeVolume = _instance.resizeVolume; + return CopyWith$Mutation$ResizeVolume$resizeVolume( + local$resizeVolume, (e) => call(resizeVolume: e)); + } +} + +class _CopyWithStubImpl$Mutation$ResizeVolume + implements CopyWith$Mutation$ResizeVolume { + _CopyWithStubImpl$Mutation$ResizeVolume(this._res); + + TRes _res; + + call( {Mutation$ResizeVolume$resizeVolume? resizeVolume, String? $__typename}) => - Mutation$ResizeVolume( - resizeVolume: resizeVolume == null ? this.resizeVolume : resizeVolume, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Mutation$ResizeVolume$resizeVolume get resizeVolume => + CopyWith$Mutation$ResizeVolume$resizeVolume.stub(_res); } const documentNodeMutationResizeVolume = DocumentNode(definitions: [ @@ -1372,13 +2051,62 @@ class Mutation$ResizeVolume$resizeVolume extension UtilityExtension$Mutation$ResizeVolume$resizeVolume on Mutation$ResizeVolume$resizeVolume { - Mutation$ResizeVolume$resizeVolume copyWith( - {int? code, String? message, bool? success, String? $__typename}) => - Mutation$ResizeVolume$resizeVolume( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$ResizeVolume$resizeVolume< + Mutation$ResizeVolume$resizeVolume> + 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; + + factory CopyWith$Mutation$ResizeVolume$resizeVolume.stub(TRes res) = + _CopyWithStubImpl$Mutation$ResizeVolume$resizeVolume; + + 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); + + final Mutation$ResizeVolume$resizeVolume _instance; + + final TRes Function(Mutation$ResizeVolume$resizeVolume) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Mutation$ResizeVolume$resizeVolume + implements CopyWith$Mutation$ResizeVolume$resizeVolume { + _CopyWithStubImpl$Mutation$ResizeVolume$resizeVolume(this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -1410,8 +2138,46 @@ class Variables$Mutation$UnmountVolume { return true; } - Variables$Mutation$UnmountVolume copyWith({String? name}) => - Variables$Mutation$UnmountVolume(name: name == null ? this.name : name); + 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; + + factory CopyWith$Variables$Mutation$UnmountVolume.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$UnmountVolume; + + TRes call({String? name}); +} + +class _CopyWithImpl$Variables$Mutation$UnmountVolume + implements CopyWith$Variables$Mutation$UnmountVolume { + _CopyWithImpl$Variables$Mutation$UnmountVolume(this._instance, this._then); + + final Variables$Mutation$UnmountVolume _instance; + + final TRes Function(Variables$Mutation$UnmountVolume) _then; + + static const _undefined = {}; + + TRes call({Object? name = _undefined}) => + _then(Variables$Mutation$UnmountVolume( + name: name == _undefined || name == null + ? _instance.name + : (name as String))); +} + +class _CopyWithStubImpl$Variables$Mutation$UnmountVolume + implements CopyWith$Variables$Mutation$UnmountVolume { + _CopyWithStubImpl$Variables$Mutation$UnmountVolume(this._res); + + TRes _res; + + call({String? name}) => _res; } @JsonSerializable(explicitToJson: true) @@ -1451,13 +2217,63 @@ class Mutation$UnmountVolume { } extension UtilityExtension$Mutation$UnmountVolume on Mutation$UnmountVolume { - Mutation$UnmountVolume copyWith( + CopyWith$Mutation$UnmountVolume get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Mutation$UnmountVolume; + + 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); + + final Mutation$UnmountVolume _instance; + + final TRes Function(Mutation$UnmountVolume) _then; + + static const _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))); + CopyWith$Mutation$UnmountVolume$unmountVolume get unmountVolume { + final local$unmountVolume = _instance.unmountVolume; + return CopyWith$Mutation$UnmountVolume$unmountVolume( + local$unmountVolume, (e) => call(unmountVolume: e)); + } +} + +class _CopyWithStubImpl$Mutation$UnmountVolume + implements CopyWith$Mutation$UnmountVolume { + _CopyWithStubImpl$Mutation$UnmountVolume(this._res); + + TRes _res; + + call( {Mutation$UnmountVolume$unmountVolume? unmountVolume, String? $__typename}) => - Mutation$UnmountVolume( - unmountVolume: - unmountVolume == null ? this.unmountVolume : unmountVolume, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Mutation$UnmountVolume$unmountVolume get unmountVolume => + CopyWith$Mutation$UnmountVolume$unmountVolume.stub(_res); } const documentNodeMutationUnmountVolume = DocumentNode(definitions: [ @@ -1649,13 +2465,63 @@ class Mutation$UnmountVolume$unmountVolume extension UtilityExtension$Mutation$UnmountVolume$unmountVolume on Mutation$UnmountVolume$unmountVolume { - Mutation$UnmountVolume$unmountVolume copyWith( - {int? code, String? message, bool? success, String? $__typename}) => - Mutation$UnmountVolume$unmountVolume( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$UnmountVolume$unmountVolume< + Mutation$UnmountVolume$unmountVolume> + 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; + + factory CopyWith$Mutation$UnmountVolume$unmountVolume.stub(TRes res) = + _CopyWithStubImpl$Mutation$UnmountVolume$unmountVolume; + + 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); + + final Mutation$UnmountVolume$unmountVolume _instance; + + final TRes Function(Mutation$UnmountVolume$unmountVolume) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Mutation$UnmountVolume$unmountVolume + implements CopyWith$Mutation$UnmountVolume$unmountVolume { + _CopyWithStubImpl$Mutation$UnmountVolume$unmountVolume(this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -1687,10 +2553,47 @@ class Variables$Mutation$MigrateToBinds { return true; } - Variables$Mutation$MigrateToBinds copyWith( - {Input$MigrateToBindsInput? input}) => - Variables$Mutation$MigrateToBinds( - input: input == null ? this.input : input); + 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; + + factory CopyWith$Variables$Mutation$MigrateToBinds.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$MigrateToBinds; + + TRes call({Input$MigrateToBindsInput? input}); +} + +class _CopyWithImpl$Variables$Mutation$MigrateToBinds + implements CopyWith$Variables$Mutation$MigrateToBinds { + _CopyWithImpl$Variables$Mutation$MigrateToBinds(this._instance, this._then); + + final Variables$Mutation$MigrateToBinds _instance; + + final TRes Function(Variables$Mutation$MigrateToBinds) _then; + + static const _undefined = {}; + + TRes call({Object? input = _undefined}) => + _then(Variables$Mutation$MigrateToBinds( + input: input == _undefined || input == null + ? _instance.input + : (input as Input$MigrateToBindsInput))); +} + +class _CopyWithStubImpl$Variables$Mutation$MigrateToBinds + implements CopyWith$Variables$Mutation$MigrateToBinds { + _CopyWithStubImpl$Variables$Mutation$MigrateToBinds(this._res); + + TRes _res; + + call({Input$MigrateToBindsInput? input}) => _res; } @JsonSerializable(explicitToJson: true) @@ -1730,13 +2633,63 @@ class Mutation$MigrateToBinds { } extension UtilityExtension$Mutation$MigrateToBinds on Mutation$MigrateToBinds { - Mutation$MigrateToBinds copyWith( + CopyWith$Mutation$MigrateToBinds get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Mutation$MigrateToBinds; + + 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); + + final Mutation$MigrateToBinds _instance; + + final TRes Function(Mutation$MigrateToBinds) _then; + + static const _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))); + CopyWith$Mutation$MigrateToBinds$migrateToBinds get migrateToBinds { + final local$migrateToBinds = _instance.migrateToBinds; + return CopyWith$Mutation$MigrateToBinds$migrateToBinds( + local$migrateToBinds, (e) => call(migrateToBinds: e)); + } +} + +class _CopyWithStubImpl$Mutation$MigrateToBinds + implements CopyWith$Mutation$MigrateToBinds { + _CopyWithStubImpl$Mutation$MigrateToBinds(this._res); + + TRes _res; + + call( {Mutation$MigrateToBinds$migrateToBinds? migrateToBinds, String? $__typename}) => - Mutation$MigrateToBinds( - migrateToBinds: - migrateToBinds == null ? this.migrateToBinds : migrateToBinds, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Mutation$MigrateToBinds$migrateToBinds get migrateToBinds => + CopyWith$Mutation$MigrateToBinds$migrateToBinds.stub(_res); } const documentNodeMutationMigrateToBinds = DocumentNode(definitions: [ @@ -2014,18 +2967,88 @@ class Mutation$MigrateToBinds$migrateToBinds extension UtilityExtension$Mutation$MigrateToBinds$migrateToBinds on Mutation$MigrateToBinds$migrateToBinds { - Mutation$MigrateToBinds$migrateToBinds copyWith( + CopyWith$Mutation$MigrateToBinds$migrateToBinds< + Mutation$MigrateToBinds$migrateToBinds> + 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; + + 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}); + 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); + + final Mutation$MigrateToBinds$migrateToBinds _instance; + + final TRes Function(Mutation$MigrateToBinds$migrateToBinds) _then; + + static const _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?))); + CopyWith$Mutation$MigrateToBinds$migrateToBinds$job get job { + final local$job = _instance.job; + return local$job == null + ? CopyWith$Mutation$MigrateToBinds$migrateToBinds$job.stub( + _then(_instance)) + : CopyWith$Mutation$MigrateToBinds$migrateToBinds$job( + local$job, (e) => call(job: e)); + } +} + +class _CopyWithStubImpl$Mutation$MigrateToBinds$migrateToBinds + implements CopyWith$Mutation$MigrateToBinds$migrateToBinds { + _CopyWithStubImpl$Mutation$MigrateToBinds$migrateToBinds(this._res); + + TRes _res; + + call( {int? code, String? message, bool? success, String? $__typename, - Mutation$MigrateToBinds$migrateToBinds$job? Function()? job}) => - Mutation$MigrateToBinds$migrateToBinds( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename, - job: job == null ? this.job : job()); + Mutation$MigrateToBinds$migrateToBinds$job? job}) => + _res; + CopyWith$Mutation$MigrateToBinds$migrateToBinds$job get job => + CopyWith$Mutation$MigrateToBinds$migrateToBinds$job.stub(_res); } @JsonSerializable(explicitToJson: true) @@ -2156,32 +3179,114 @@ class Mutation$MigrateToBinds$migrateToBinds$job { extension UtilityExtension$Mutation$MigrateToBinds$migrateToBinds$job on Mutation$MigrateToBinds$migrateToBinds$job { - Mutation$MigrateToBinds$migrateToBinds$job copyWith( + CopyWith$Mutation$MigrateToBinds$migrateToBinds$job< + Mutation$MigrateToBinds$migrateToBinds$job> + 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; + + 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}); +} + +class _CopyWithImpl$Mutation$MigrateToBinds$migrateToBinds$job + implements CopyWith$Mutation$MigrateToBinds$migrateToBinds$job { + _CopyWithImpl$Mutation$MigrateToBinds$migrateToBinds$job( + this._instance, this._then); + + final Mutation$MigrateToBinds$migrateToBinds$job _instance; + + final TRes Function(Mutation$MigrateToBinds$migrateToBinds$job) _then; + + 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}) => + _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))); +} + +class _CopyWithStubImpl$Mutation$MigrateToBinds$migrateToBinds$job + implements CopyWith$Mutation$MigrateToBinds$migrateToBinds$job { + _CopyWithStubImpl$Mutation$MigrateToBinds$migrateToBinds$job(this._res); + + TRes _res; + + call( {DateTime? createdAt, String? description, - String? Function()? error, - DateTime? Function()? finishedAt, + String? error, + DateTime? finishedAt, String? name, - int? Function()? progress, - String? Function()? result, + int? progress, + String? result, String? status, - String? Function()? statusText, + String? statusText, String? uid, DateTime? updatedAt, String? $__typename}) => - Mutation$MigrateToBinds$migrateToBinds$job( - createdAt: createdAt == null ? this.createdAt : createdAt, - description: description == null ? this.description : description, - error: error == null ? this.error : error(), - finishedAt: finishedAt == null ? this.finishedAt : finishedAt(), - name: name == null ? this.name : name, - progress: progress == null ? this.progress : progress(), - result: result == null ? this.result : result(), - status: status == null ? this.status : status, - statusText: statusText == null ? this.statusText : statusText(), - uid: uid == null ? this.uid : uid, - updatedAt: updatedAt == null ? this.updatedAt : updatedAt, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; } DateTime? _nullable$dateTimeFromJson(dynamic data) => 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 cd86d73a..aa2d2c1e 100644 --- a/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart @@ -35,14 +35,51 @@ class Input$AutoUpgradeSettingsInput { return true; } - Input$AutoUpgradeSettingsInput copyWith( - {bool? Function()? enableAutoUpgrade, - bool? Function()? allowReboot}) => - Input$AutoUpgradeSettingsInput( - enableAutoUpgrade: enableAutoUpgrade == null - ? this.enableAutoUpgrade - : enableAutoUpgrade(), - allowReboot: allowReboot == null ? this.allowReboot : allowReboot()); + CopyWith$Input$AutoUpgradeSettingsInput + get copyWith => CopyWith$Input$AutoUpgradeSettingsInput(this, (i) => i); +} + +abstract class CopyWith$Input$AutoUpgradeSettingsInput { + factory CopyWith$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}); +} + +class _CopyWithImpl$Input$AutoUpgradeSettingsInput + implements CopyWith$Input$AutoUpgradeSettingsInput { + _CopyWithImpl$Input$AutoUpgradeSettingsInput(this._instance, this._then); + + final Input$AutoUpgradeSettingsInput _instance; + + final TRes Function(Input$AutoUpgradeSettingsInput) _then; + + 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?))); +} + +class _CopyWithStubImpl$Input$AutoUpgradeSettingsInput + implements CopyWith$Input$AutoUpgradeSettingsInput { + _CopyWithStubImpl$Input$AutoUpgradeSettingsInput(this._res); + + TRes _res; + + call({bool? enableAutoUpgrade, bool? allowReboot}) => _res; } @JsonSerializable(explicitToJson: true) @@ -107,28 +144,78 @@ class Input$MigrateToBindsInput { return true; } - Input$MigrateToBindsInput copyWith( + 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.stub(TRes res) = + _CopyWithStubImpl$Input$MigrateToBindsInput; + + 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); + + final Input$MigrateToBindsInput _instance; + + final TRes Function(Input$MigrateToBindsInput) _then; + + 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))); +} + +class _CopyWithStubImpl$Input$MigrateToBindsInput + implements CopyWith$Input$MigrateToBindsInput { + _CopyWithStubImpl$Input$MigrateToBindsInput(this._res); + + TRes _res; + + call( {String? emailBlockDevice, String? bitwardenBlockDevice, String? giteaBlockDevice, String? nextcloudBlockDevice, String? pleromaBlockDevice}) => - Input$MigrateToBindsInput( - emailBlockDevice: emailBlockDevice == null - ? this.emailBlockDevice - : emailBlockDevice, - bitwardenBlockDevice: bitwardenBlockDevice == null - ? this.bitwardenBlockDevice - : bitwardenBlockDevice, - giteaBlockDevice: giteaBlockDevice == null - ? this.giteaBlockDevice - : giteaBlockDevice, - nextcloudBlockDevice: nextcloudBlockDevice == null - ? this.nextcloudBlockDevice - : nextcloudBlockDevice, - pleromaBlockDevice: pleromaBlockDevice == null - ? this.pleromaBlockDevice - : pleromaBlockDevice); + _res; } @JsonSerializable(explicitToJson: true) @@ -164,10 +251,48 @@ class Input$MoveServiceInput { return true; } - Input$MoveServiceInput copyWith({String? serviceId, String? location}) => - Input$MoveServiceInput( - serviceId: serviceId == null ? this.serviceId : serviceId, - location: location == null ? this.location : location); + CopyWith$Input$MoveServiceInput get copyWith => + CopyWith$Input$MoveServiceInput(this, (i) => i); +} + +abstract class CopyWith$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}); +} + +class _CopyWithImpl$Input$MoveServiceInput + implements CopyWith$Input$MoveServiceInput { + _CopyWithImpl$Input$MoveServiceInput(this._instance, this._then); + + final Input$MoveServiceInput _instance; + + final TRes Function(Input$MoveServiceInput) _then; + + 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))); +} + +class _CopyWithStubImpl$Input$MoveServiceInput + implements CopyWith$Input$MoveServiceInput { + _CopyWithStubImpl$Input$MoveServiceInput(this._res); + + TRes _res; + + call({String? serviceId, String? location}) => _res; } @JsonSerializable(explicitToJson: true) @@ -205,12 +330,47 @@ class Input$RecoveryKeyLimitsInput { return true; } - Input$RecoveryKeyLimitsInput copyWith( - {DateTime? Function()? expirationDate, int? Function()? uses}) => - Input$RecoveryKeyLimitsInput( - expirationDate: - expirationDate == null ? this.expirationDate : expirationDate(), - uses: uses == null ? this.uses : uses()); + CopyWith$Input$RecoveryKeyLimitsInput + get copyWith => CopyWith$Input$RecoveryKeyLimitsInput(this, (i) => i); +} + +abstract class CopyWith$Input$RecoveryKeyLimitsInput { + factory CopyWith$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}); +} + +class _CopyWithImpl$Input$RecoveryKeyLimitsInput + implements CopyWith$Input$RecoveryKeyLimitsInput { + _CopyWithImpl$Input$RecoveryKeyLimitsInput(this._instance, this._then); + + final Input$RecoveryKeyLimitsInput _instance; + + final TRes Function(Input$RecoveryKeyLimitsInput) _then; + + 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?))); +} + +class _CopyWithStubImpl$Input$RecoveryKeyLimitsInput + implements CopyWith$Input$RecoveryKeyLimitsInput { + _CopyWithStubImpl$Input$RecoveryKeyLimitsInput(this._res); + + TRes _res; + + call({DateTime? expirationDate, int? uses}) => _res; } @JsonSerializable(explicitToJson: true) @@ -246,10 +406,48 @@ class Input$SshMutationInput { return true; } - Input$SshMutationInput copyWith({String? username, String? sshKey}) => - Input$SshMutationInput( - username: username == null ? this.username : username, - sshKey: sshKey == null ? this.sshKey : sshKey); + CopyWith$Input$SshMutationInput get copyWith => + CopyWith$Input$SshMutationInput(this, (i) => i); +} + +abstract class CopyWith$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}); +} + +class _CopyWithImpl$Input$SshMutationInput + implements CopyWith$Input$SshMutationInput { + _CopyWithImpl$Input$SshMutationInput(this._instance, this._then); + + final Input$SshMutationInput _instance; + + final TRes Function(Input$SshMutationInput) _then; + + 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))); +} + +class _CopyWithStubImpl$Input$SshMutationInput + implements CopyWith$Input$SshMutationInput { + _CopyWithStubImpl$Input$SshMutationInput(this._res); + + TRes _res; + + call({String? username, String? sshKey}) => _res; } @JsonSerializable(explicitToJson: true) @@ -285,10 +483,49 @@ class Input$UseNewDeviceKeyInput { return true; } - Input$UseNewDeviceKeyInput copyWith({String? key, String? deviceName}) => - Input$UseNewDeviceKeyInput( - key: key == null ? this.key : key, - deviceName: deviceName == null ? this.deviceName : deviceName); + CopyWith$Input$UseNewDeviceKeyInput + get copyWith => CopyWith$Input$UseNewDeviceKeyInput(this, (i) => i); +} + +abstract class CopyWith$Input$UseNewDeviceKeyInput { + factory CopyWith$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}); +} + +class _CopyWithImpl$Input$UseNewDeviceKeyInput + implements CopyWith$Input$UseNewDeviceKeyInput { + _CopyWithImpl$Input$UseNewDeviceKeyInput(this._instance, this._then); + + final Input$UseNewDeviceKeyInput _instance; + + final TRes Function(Input$UseNewDeviceKeyInput) _then; + + 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))); +} + +class _CopyWithStubImpl$Input$UseNewDeviceKeyInput + implements CopyWith$Input$UseNewDeviceKeyInput { + _CopyWithStubImpl$Input$UseNewDeviceKeyInput(this._res); + + TRes _res; + + call({String? key, String? deviceName}) => _res; } @JsonSerializable(explicitToJson: true) @@ -324,10 +561,48 @@ class Input$UseRecoveryKeyInput { return true; } - Input$UseRecoveryKeyInput copyWith({String? key, String? deviceName}) => - Input$UseRecoveryKeyInput( - key: key == null ? this.key : key, - deviceName: deviceName == null ? this.deviceName : deviceName); + CopyWith$Input$UseRecoveryKeyInput get copyWith => + CopyWith$Input$UseRecoveryKeyInput(this, (i) => i); +} + +abstract class CopyWith$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}); +} + +class _CopyWithImpl$Input$UseRecoveryKeyInput + implements CopyWith$Input$UseRecoveryKeyInput { + _CopyWithImpl$Input$UseRecoveryKeyInput(this._instance, this._then); + + final Input$UseRecoveryKeyInput _instance; + + final TRes Function(Input$UseRecoveryKeyInput) _then; + + 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))); +} + +class _CopyWithStubImpl$Input$UseRecoveryKeyInput + implements CopyWith$Input$UseRecoveryKeyInput { + _CopyWithStubImpl$Input$UseRecoveryKeyInput(this._res); + + TRes _res; + + call({String? key, String? deviceName}) => _res; } @JsonSerializable(explicitToJson: true) @@ -363,10 +638,48 @@ class Input$UserMutationInput { return true; } - Input$UserMutationInput copyWith({String? username, String? password}) => - Input$UserMutationInput( - username: username == null ? this.username : username, - password: password == null ? this.password : password); + CopyWith$Input$UserMutationInput get copyWith => + CopyWith$Input$UserMutationInput(this, (i) => i); +} + +abstract class CopyWith$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}); +} + +class _CopyWithImpl$Input$UserMutationInput + implements CopyWith$Input$UserMutationInput { + _CopyWithImpl$Input$UserMutationInput(this._instance, this._then); + + final Input$UserMutationInput _instance; + + final TRes Function(Input$UserMutationInput) _then; + + 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))); +} + +class _CopyWithStubImpl$Input$UserMutationInput + implements CopyWith$Input$UserMutationInput { + _CopyWithStubImpl$Input$UserMutationInput(this._res); + + TRes _res; + + call({String? username, String? password}) => _res; } enum Enum$DnsProvider { 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 c9d6fe1a..7e99910c 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 @@ -62,13 +62,62 @@ class Fragment$basicMutationReturnFields { extension UtilityExtension$Fragment$basicMutationReturnFields on Fragment$basicMutationReturnFields { - Fragment$basicMutationReturnFields copyWith( - {int? code, String? message, bool? success, String? $__typename}) => - Fragment$basicMutationReturnFields( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Fragment$basicMutationReturnFields< + Fragment$basicMutationReturnFields> + 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; + + factory CopyWith$Fragment$basicMutationReturnFields.stub(TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields; + + 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); + + final Fragment$basicMutationReturnFields _instance; + + final TRes Function(Fragment$basicMutationReturnFields) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields + implements CopyWith$Fragment$basicMutationReturnFields { + _CopyWithStubImpl$Fragment$basicMutationReturnFields(this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; } const fragmentDefinitionbasicMutationReturnFields = FragmentDefinitionNode( @@ -174,11 +223,55 @@ class Query$GetApiVersion { } extension UtilityExtension$Query$GetApiVersion on Query$GetApiVersion { - Query$GetApiVersion copyWith( - {Query$GetApiVersion$api? api, String? $__typename}) => - Query$GetApiVersion( - api: api == null ? this.api : api, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Query$GetApiVersion get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Query$GetApiVersion; + + 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); + + final Query$GetApiVersion _instance; + + final TRes Function(Query$GetApiVersion) _then; + + static const _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))); + CopyWith$Query$GetApiVersion$api get api { + final local$api = _instance.api; + return CopyWith$Query$GetApiVersion$api(local$api, (e) => call(api: e)); + } +} + +class _CopyWithStubImpl$Query$GetApiVersion + implements CopyWith$Query$GetApiVersion { + _CopyWithStubImpl$Query$GetApiVersion(this._res); + + TRes _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: [ @@ -336,10 +429,48 @@ class Query$GetApiVersion$api { } extension UtilityExtension$Query$GetApiVersion$api on Query$GetApiVersion$api { - Query$GetApiVersion$api copyWith({String? version, String? $__typename}) => - Query$GetApiVersion$api( - version: version == null ? this.version : version, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Query$GetApiVersion$api get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Query$GetApiVersion$api; + + TRes call({String? version, String? $__typename}); +} + +class _CopyWithImpl$Query$GetApiVersion$api + implements CopyWith$Query$GetApiVersion$api { + _CopyWithImpl$Query$GetApiVersion$api(this._instance, this._then); + + final Query$GetApiVersion$api _instance; + + final TRes Function(Query$GetApiVersion$api) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Query$GetApiVersion$api + implements CopyWith$Query$GetApiVersion$api { + _CopyWithStubImpl$Query$GetApiVersion$api(this._res); + + TRes _res; + + call({String? version, String? $__typename}) => _res; } @JsonSerializable(explicitToJson: true) @@ -378,11 +509,55 @@ class Query$GetApiJobs { } extension UtilityExtension$Query$GetApiJobs on Query$GetApiJobs { - Query$GetApiJobs copyWith( - {Query$GetApiJobs$jobs? jobs, String? $__typename}) => - Query$GetApiJobs( - jobs: jobs == null ? this.jobs : jobs, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Query$GetApiJobs get copyWith => + 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; + + factory CopyWith$Query$GetApiJobs.stub(TRes res) = + _CopyWithStubImpl$Query$GetApiJobs; + + 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); + + final Query$GetApiJobs _instance; + + final TRes Function(Query$GetApiJobs) _then; + + static const _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))); + CopyWith$Query$GetApiJobs$jobs get jobs { + final local$jobs = _instance.jobs; + return CopyWith$Query$GetApiJobs$jobs(local$jobs, (e) => call(jobs: e)); + } +} + +class _CopyWithStubImpl$Query$GetApiJobs + implements CopyWith$Query$GetApiJobs { + _CopyWithStubImpl$Query$GetApiJobs(this._res); + + TRes _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: [ @@ -617,12 +792,67 @@ class Query$GetApiJobs$jobs { } extension UtilityExtension$Query$GetApiJobs$jobs on Query$GetApiJobs$jobs { - Query$GetApiJobs$jobs copyWith( - {List? getJobs, - String? $__typename}) => - Query$GetApiJobs$jobs( - getJobs: getJobs == null ? this.getJobs : getJobs, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Query$GetApiJobs$jobs get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Query$GetApiJobs$jobs; + + TRes call( + {List? getJobs, String? $__typename}); + TRes getJobs( + Iterable Function( + Iterable< + CopyWith$Query$GetApiJobs$jobs$getJobs< + Query$GetApiJobs$jobs$getJobs>>) + _fn); +} + +class _CopyWithImpl$Query$GetApiJobs$jobs + implements CopyWith$Query$GetApiJobs$jobs { + _CopyWithImpl$Query$GetApiJobs$jobs(this._instance, this._then); + + final Query$GetApiJobs$jobs _instance; + + final TRes Function(Query$GetApiJobs$jobs) _then; + + static const _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))); + TRes getJobs( + Iterable Function( + Iterable< + CopyWith$Query$GetApiJobs$jobs$getJobs< + Query$GetApiJobs$jobs$getJobs>>) + _fn) => + call( + getJobs: _fn(_instance.getJobs.map( + (e) => CopyWith$Query$GetApiJobs$jobs$getJobs(e, (i) => i))) + .toList()); +} + +class _CopyWithStubImpl$Query$GetApiJobs$jobs + implements CopyWith$Query$GetApiJobs$jobs { + _CopyWithStubImpl$Query$GetApiJobs$jobs(this._res); + + TRes _res; + + call({List? getJobs, String? $__typename}) => + _res; + getJobs(_fn) => _res; } @JsonSerializable(explicitToJson: true) @@ -751,32 +981,111 @@ class Query$GetApiJobs$jobs$getJobs { extension UtilityExtension$Query$GetApiJobs$jobs$getJobs on Query$GetApiJobs$jobs$getJobs { - Query$GetApiJobs$jobs$getJobs copyWith( + CopyWith$Query$GetApiJobs$jobs$getJobs + 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; + + 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}); +} + +class _CopyWithImpl$Query$GetApiJobs$jobs$getJobs + implements CopyWith$Query$GetApiJobs$jobs$getJobs { + _CopyWithImpl$Query$GetApiJobs$jobs$getJobs(this._instance, this._then); + + final Query$GetApiJobs$jobs$getJobs _instance; + + final TRes Function(Query$GetApiJobs$jobs$getJobs) _then; + + 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}) => + _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))); +} + +class _CopyWithStubImpl$Query$GetApiJobs$jobs$getJobs + implements CopyWith$Query$GetApiJobs$jobs$getJobs { + _CopyWithStubImpl$Query$GetApiJobs$jobs$getJobs(this._res); + + TRes _res; + + call( {DateTime? createdAt, String? description, - String? Function()? error, - DateTime? Function()? finishedAt, + String? error, + DateTime? finishedAt, String? name, - int? Function()? progress, - String? Function()? result, + int? progress, + String? result, String? status, - String? Function()? statusText, + String? statusText, String? uid, DateTime? updatedAt, String? $__typename}) => - Query$GetApiJobs$jobs$getJobs( - createdAt: createdAt == null ? this.createdAt : createdAt, - description: description == null ? this.description : description, - error: error == null ? this.error : error(), - finishedAt: finishedAt == null ? this.finishedAt : finishedAt(), - name: name == null ? this.name : name, - progress: progress == null ? this.progress : progress(), - result: result == null ? this.result : result(), - status: status == null ? this.status : status, - statusText: statusText == null ? this.statusText : statusText(), - uid: uid == null ? this.uid : uid, - updatedAt: updatedAt == null ? this.updatedAt : updatedAt, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; } @JsonSerializable(explicitToJson: true) @@ -806,8 +1115,45 @@ class Variables$Mutation$RemoveJob { return true; } - Variables$Mutation$RemoveJob copyWith({String? jobId}) => - Variables$Mutation$RemoveJob(jobId: jobId == null ? this.jobId : jobId); + 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; + + factory CopyWith$Variables$Mutation$RemoveJob.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$RemoveJob; + + TRes call({String? jobId}); +} + +class _CopyWithImpl$Variables$Mutation$RemoveJob + implements CopyWith$Variables$Mutation$RemoveJob { + _CopyWithImpl$Variables$Mutation$RemoveJob(this._instance, this._then); + + final Variables$Mutation$RemoveJob _instance; + + final TRes Function(Variables$Mutation$RemoveJob) _then; + + static const _undefined = {}; + + TRes call({Object? jobId = _undefined}) => _then(Variables$Mutation$RemoveJob( + jobId: jobId == _undefined || jobId == null + ? _instance.jobId + : (jobId as String))); +} + +class _CopyWithStubImpl$Variables$Mutation$RemoveJob + implements CopyWith$Variables$Mutation$RemoveJob { + _CopyWithStubImpl$Variables$Mutation$RemoveJob(this._res); + + TRes _res; + + call({String? jobId}) => _res; } @JsonSerializable(explicitToJson: true) @@ -846,11 +1192,57 @@ class Mutation$RemoveJob { } extension UtilityExtension$Mutation$RemoveJob on Mutation$RemoveJob { - Mutation$RemoveJob copyWith( - {Mutation$RemoveJob$removeJob? removeJob, String? $__typename}) => - Mutation$RemoveJob( - removeJob: removeJob == null ? this.removeJob : removeJob, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$RemoveJob get copyWith => + 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; + + factory CopyWith$Mutation$RemoveJob.stub(TRes res) = + _CopyWithStubImpl$Mutation$RemoveJob; + + 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); + + final Mutation$RemoveJob _instance; + + final TRes Function(Mutation$RemoveJob) _then; + + static const _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))); + CopyWith$Mutation$RemoveJob$removeJob get removeJob { + final local$removeJob = _instance.removeJob; + return CopyWith$Mutation$RemoveJob$removeJob( + local$removeJob, (e) => call(removeJob: e)); + } +} + +class _CopyWithStubImpl$Mutation$RemoveJob + implements CopyWith$Mutation$RemoveJob { + _CopyWithStubImpl$Mutation$RemoveJob(this._res); + + TRes _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: [ @@ -1036,13 +1428,60 @@ class Mutation$RemoveJob$removeJob extension UtilityExtension$Mutation$RemoveJob$removeJob on Mutation$RemoveJob$removeJob { - Mutation$RemoveJob$removeJob copyWith( - {int? code, String? message, bool? success, String? $__typename}) => - Mutation$RemoveJob$removeJob( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$RemoveJob$removeJob + 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; + + factory CopyWith$Mutation$RemoveJob$removeJob.stub(TRes res) = + _CopyWithStubImpl$Mutation$RemoveJob$removeJob; + + 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); + + final Mutation$RemoveJob$removeJob _instance; + + final TRes Function(Mutation$RemoveJob$removeJob) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Mutation$RemoveJob$removeJob + implements CopyWith$Mutation$RemoveJob$removeJob { + _CopyWithStubImpl$Mutation$RemoveJob$removeJob(this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -1083,14 +1522,68 @@ class Mutation$RunSystemRebuild { extension UtilityExtension$Mutation$RunSystemRebuild on Mutation$RunSystemRebuild { - Mutation$RunSystemRebuild copyWith( + CopyWith$Mutation$RunSystemRebuild get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Mutation$RunSystemRebuild; + + 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); + + final Mutation$RunSystemRebuild _instance; + + final TRes Function(Mutation$RunSystemRebuild) _then; + + static const _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))); + CopyWith$Mutation$RunSystemRebuild$runSystemRebuild + get runSystemRebuild { + final local$runSystemRebuild = _instance.runSystemRebuild; + return CopyWith$Mutation$RunSystemRebuild$runSystemRebuild( + local$runSystemRebuild, (e) => call(runSystemRebuild: e)); + } +} + +class _CopyWithStubImpl$Mutation$RunSystemRebuild + implements CopyWith$Mutation$RunSystemRebuild { + _CopyWithStubImpl$Mutation$RunSystemRebuild(this._res); + + TRes _res; + + call( {Mutation$RunSystemRebuild$runSystemRebuild? runSystemRebuild, String? $__typename}) => - Mutation$RunSystemRebuild( - runSystemRebuild: runSystemRebuild == null - ? this.runSystemRebuild - : runSystemRebuild, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Mutation$RunSystemRebuild$runSystemRebuild + get runSystemRebuild => + CopyWith$Mutation$RunSystemRebuild$runSystemRebuild.stub(_res); } const documentNodeMutationRunSystemRebuild = DocumentNode(definitions: [ @@ -1269,13 +1762,63 @@ class Mutation$RunSystemRebuild$runSystemRebuild extension UtilityExtension$Mutation$RunSystemRebuild$runSystemRebuild on Mutation$RunSystemRebuild$runSystemRebuild { - Mutation$RunSystemRebuild$runSystemRebuild copyWith( - {int? code, String? message, bool? success, String? $__typename}) => - Mutation$RunSystemRebuild$runSystemRebuild( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$RunSystemRebuild$runSystemRebuild< + Mutation$RunSystemRebuild$runSystemRebuild> + 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; + + factory CopyWith$Mutation$RunSystemRebuild$runSystemRebuild.stub(TRes res) = + _CopyWithStubImpl$Mutation$RunSystemRebuild$runSystemRebuild; + + 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); + + final Mutation$RunSystemRebuild$runSystemRebuild _instance; + + final TRes Function(Mutation$RunSystemRebuild$runSystemRebuild) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Mutation$RunSystemRebuild$runSystemRebuild + implements CopyWith$Mutation$RunSystemRebuild$runSystemRebuild { + _CopyWithStubImpl$Mutation$RunSystemRebuild$runSystemRebuild(this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -1316,14 +1859,69 @@ class Mutation$RunSystemRollback { extension UtilityExtension$Mutation$RunSystemRollback on Mutation$RunSystemRollback { - Mutation$RunSystemRollback copyWith( + CopyWith$Mutation$RunSystemRollback + 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; + + factory CopyWith$Mutation$RunSystemRollback.stub(TRes res) = + _CopyWithStubImpl$Mutation$RunSystemRollback; + + 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); + + final Mutation$RunSystemRollback _instance; + + final TRes Function(Mutation$RunSystemRollback) _then; + + static const _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))); + CopyWith$Mutation$RunSystemRollback$runSystemRollback + get runSystemRollback { + final local$runSystemRollback = _instance.runSystemRollback; + return CopyWith$Mutation$RunSystemRollback$runSystemRollback( + local$runSystemRollback, (e) => call(runSystemRollback: e)); + } +} + +class _CopyWithStubImpl$Mutation$RunSystemRollback + implements CopyWith$Mutation$RunSystemRollback { + _CopyWithStubImpl$Mutation$RunSystemRollback(this._res); + + TRes _res; + + call( {Mutation$RunSystemRollback$runSystemRollback? runSystemRollback, String? $__typename}) => - Mutation$RunSystemRollback( - runSystemRollback: runSystemRollback == null - ? this.runSystemRollback - : runSystemRollback, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Mutation$RunSystemRollback$runSystemRollback + get runSystemRollback => + CopyWith$Mutation$RunSystemRollback$runSystemRollback.stub(_res); } const documentNodeMutationRunSystemRollback = DocumentNode(definitions: [ @@ -1502,13 +2100,63 @@ class Mutation$RunSystemRollback$runSystemRollback extension UtilityExtension$Mutation$RunSystemRollback$runSystemRollback on Mutation$RunSystemRollback$runSystemRollback { - Mutation$RunSystemRollback$runSystemRollback copyWith( - {int? code, String? message, bool? success, String? $__typename}) => - Mutation$RunSystemRollback$runSystemRollback( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$RunSystemRollback$runSystemRollback< + Mutation$RunSystemRollback$runSystemRollback> + 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; + + factory CopyWith$Mutation$RunSystemRollback$runSystemRollback.stub(TRes res) = + _CopyWithStubImpl$Mutation$RunSystemRollback$runSystemRollback; + + 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); + + final Mutation$RunSystemRollback$runSystemRollback _instance; + + final TRes Function(Mutation$RunSystemRollback$runSystemRollback) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Mutation$RunSystemRollback$runSystemRollback + implements CopyWith$Mutation$RunSystemRollback$runSystemRollback { + _CopyWithStubImpl$Mutation$RunSystemRollback$runSystemRollback(this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -1549,14 +2197,68 @@ class Mutation$RunSystemUpgrade { extension UtilityExtension$Mutation$RunSystemUpgrade on Mutation$RunSystemUpgrade { - Mutation$RunSystemUpgrade copyWith( + CopyWith$Mutation$RunSystemUpgrade get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Mutation$RunSystemUpgrade; + + 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); + + final Mutation$RunSystemUpgrade _instance; + + final TRes Function(Mutation$RunSystemUpgrade) _then; + + static const _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))); + CopyWith$Mutation$RunSystemUpgrade$runSystemUpgrade + get runSystemUpgrade { + final local$runSystemUpgrade = _instance.runSystemUpgrade; + return CopyWith$Mutation$RunSystemUpgrade$runSystemUpgrade( + local$runSystemUpgrade, (e) => call(runSystemUpgrade: e)); + } +} + +class _CopyWithStubImpl$Mutation$RunSystemUpgrade + implements CopyWith$Mutation$RunSystemUpgrade { + _CopyWithStubImpl$Mutation$RunSystemUpgrade(this._res); + + TRes _res; + + call( {Mutation$RunSystemUpgrade$runSystemUpgrade? runSystemUpgrade, String? $__typename}) => - Mutation$RunSystemUpgrade( - runSystemUpgrade: runSystemUpgrade == null - ? this.runSystemUpgrade - : runSystemUpgrade, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Mutation$RunSystemUpgrade$runSystemUpgrade + get runSystemUpgrade => + CopyWith$Mutation$RunSystemUpgrade$runSystemUpgrade.stub(_res); } const documentNodeMutationRunSystemUpgrade = DocumentNode(definitions: [ @@ -1735,13 +2437,63 @@ class Mutation$RunSystemUpgrade$runSystemUpgrade extension UtilityExtension$Mutation$RunSystemUpgrade$runSystemUpgrade on Mutation$RunSystemUpgrade$runSystemUpgrade { - Mutation$RunSystemUpgrade$runSystemUpgrade copyWith( - {int? code, String? message, bool? success, String? $__typename}) => - Mutation$RunSystemUpgrade$runSystemUpgrade( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$RunSystemUpgrade$runSystemUpgrade< + Mutation$RunSystemUpgrade$runSystemUpgrade> + 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; + + factory CopyWith$Mutation$RunSystemUpgrade$runSystemUpgrade.stub(TRes res) = + _CopyWithStubImpl$Mutation$RunSystemUpgrade$runSystemUpgrade; + + 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); + + final Mutation$RunSystemUpgrade$runSystemUpgrade _instance; + + final TRes Function(Mutation$RunSystemUpgrade$runSystemUpgrade) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Mutation$RunSystemUpgrade$runSystemUpgrade + implements CopyWith$Mutation$RunSystemUpgrade$runSystemUpgrade { + _CopyWithStubImpl$Mutation$RunSystemUpgrade$runSystemUpgrade(this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -1783,15 +2535,72 @@ class Mutation$PullRepositoryChanges { extension UtilityExtension$Mutation$PullRepositoryChanges on Mutation$PullRepositoryChanges { - Mutation$PullRepositoryChanges copyWith( + CopyWith$Mutation$PullRepositoryChanges + 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; + + factory CopyWith$Mutation$PullRepositoryChanges.stub(TRes res) = + _CopyWithStubImpl$Mutation$PullRepositoryChanges; + + 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); + + final Mutation$PullRepositoryChanges _instance; + + final TRes Function(Mutation$PullRepositoryChanges) _then; + + static const _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))); + CopyWith$Mutation$PullRepositoryChanges$pullRepositoryChanges + get pullRepositoryChanges { + final local$pullRepositoryChanges = _instance.pullRepositoryChanges; + return CopyWith$Mutation$PullRepositoryChanges$pullRepositoryChanges( + local$pullRepositoryChanges, (e) => call(pullRepositoryChanges: e)); + } +} + +class _CopyWithStubImpl$Mutation$PullRepositoryChanges + implements CopyWith$Mutation$PullRepositoryChanges { + _CopyWithStubImpl$Mutation$PullRepositoryChanges(this._res); + + TRes _res; + + call( {Mutation$PullRepositoryChanges$pullRepositoryChanges? pullRepositoryChanges, String? $__typename}) => - Mutation$PullRepositoryChanges( - pullRepositoryChanges: pullRepositoryChanges == null - ? this.pullRepositoryChanges - : pullRepositoryChanges, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Mutation$PullRepositoryChanges$pullRepositoryChanges + get pullRepositoryChanges => + CopyWith$Mutation$PullRepositoryChanges$pullRepositoryChanges.stub( + _res); } const documentNodeMutationPullRepositoryChanges = DocumentNode(definitions: [ @@ -1974,13 +2783,72 @@ class Mutation$PullRepositoryChanges$pullRepositoryChanges extension UtilityExtension$Mutation$PullRepositoryChanges$pullRepositoryChanges on Mutation$PullRepositoryChanges$pullRepositoryChanges { - Mutation$PullRepositoryChanges$pullRepositoryChanges copyWith( - {int? code, String? message, bool? success, String? $__typename}) => - Mutation$PullRepositoryChanges$pullRepositoryChanges( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$PullRepositoryChanges$pullRepositoryChanges< + Mutation$PullRepositoryChanges$pullRepositoryChanges> + get copyWith => + CopyWith$Mutation$PullRepositoryChanges$pullRepositoryChanges( + 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; + + factory CopyWith$Mutation$PullRepositoryChanges$pullRepositoryChanges.stub( + TRes res) = + _CopyWithStubImpl$Mutation$PullRepositoryChanges$pullRepositoryChanges; + + 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); + + final Mutation$PullRepositoryChanges$pullRepositoryChanges _instance; + + final TRes Function(Mutation$PullRepositoryChanges$pullRepositoryChanges) + _then; + + static const _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))); +} + +class _CopyWithStubImpl$Mutation$PullRepositoryChanges$pullRepositoryChanges< + TRes> + implements + CopyWith$Mutation$PullRepositoryChanges$pullRepositoryChanges { + _CopyWithStubImpl$Mutation$PullRepositoryChanges$pullRepositoryChanges( + this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -2020,12 +2888,62 @@ class Mutation$RebootSystem { } extension UtilityExtension$Mutation$RebootSystem on Mutation$RebootSystem { - Mutation$RebootSystem copyWith( + CopyWith$Mutation$RebootSystem get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Mutation$RebootSystem; + + 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); + + final Mutation$RebootSystem _instance; + + final TRes Function(Mutation$RebootSystem) _then; + + static const _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))); + CopyWith$Mutation$RebootSystem$rebootSystem get rebootSystem { + final local$rebootSystem = _instance.rebootSystem; + return CopyWith$Mutation$RebootSystem$rebootSystem( + local$rebootSystem, (e) => call(rebootSystem: e)); + } +} + +class _CopyWithStubImpl$Mutation$RebootSystem + implements CopyWith$Mutation$RebootSystem { + _CopyWithStubImpl$Mutation$RebootSystem(this._res); + + TRes _res; + + call( {Mutation$RebootSystem$rebootSystem? rebootSystem, String? $__typename}) => - Mutation$RebootSystem( - rebootSystem: rebootSystem == null ? this.rebootSystem : rebootSystem, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Mutation$RebootSystem$rebootSystem get rebootSystem => + CopyWith$Mutation$RebootSystem$rebootSystem.stub(_res); } const documentNodeMutationRebootSystem = DocumentNode(definitions: [ @@ -2202,13 +3120,62 @@ class Mutation$RebootSystem$rebootSystem extension UtilityExtension$Mutation$RebootSystem$rebootSystem on Mutation$RebootSystem$rebootSystem { - Mutation$RebootSystem$rebootSystem copyWith( - {int? code, String? message, bool? success, String? $__typename}) => - Mutation$RebootSystem$rebootSystem( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$RebootSystem$rebootSystem< + Mutation$RebootSystem$rebootSystem> + 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; + + factory CopyWith$Mutation$RebootSystem$rebootSystem.stub(TRes res) = + _CopyWithStubImpl$Mutation$RebootSystem$rebootSystem; + + 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); + + final Mutation$RebootSystem$rebootSystem _instance; + + final TRes Function(Mutation$RebootSystem$rebootSystem) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Mutation$RebootSystem$rebootSystem + implements CopyWith$Mutation$RebootSystem$rebootSystem { + _CopyWithStubImpl$Mutation$RebootSystem$rebootSystem(this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -2247,11 +3214,55 @@ class Query$GetApiTokens { } extension UtilityExtension$Query$GetApiTokens on Query$GetApiTokens { - Query$GetApiTokens copyWith( - {Query$GetApiTokens$api? api, String? $__typename}) => - Query$GetApiTokens( - api: api == null ? this.api : api, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Query$GetApiTokens get copyWith => + 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; + + factory CopyWith$Query$GetApiTokens.stub(TRes res) = + _CopyWithStubImpl$Query$GetApiTokens; + + 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); + + final Query$GetApiTokens _instance; + + final TRes Function(Query$GetApiTokens) _then; + + static const _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))); + CopyWith$Query$GetApiTokens$api get api { + final local$api = _instance.api; + return CopyWith$Query$GetApiTokens$api(local$api, (e) => call(api: e)); + } +} + +class _CopyWithStubImpl$Query$GetApiTokens + implements CopyWith$Query$GetApiTokens { + _CopyWithStubImpl$Query$GetApiTokens(this._res); + + TRes _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: [ @@ -2441,12 +3452,67 @@ class Query$GetApiTokens$api { } extension UtilityExtension$Query$GetApiTokens$api on Query$GetApiTokens$api { - Query$GetApiTokens$api copyWith( - {List? devices, - String? $__typename}) => - Query$GetApiTokens$api( - devices: devices == null ? this.devices : devices, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Query$GetApiTokens$api get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Query$GetApiTokens$api; + + TRes call( + {List? devices, String? $__typename}); + TRes devices( + Iterable Function( + Iterable< + CopyWith$Query$GetApiTokens$api$devices< + Query$GetApiTokens$api$devices>>) + _fn); +} + +class _CopyWithImpl$Query$GetApiTokens$api + implements CopyWith$Query$GetApiTokens$api { + _CopyWithImpl$Query$GetApiTokens$api(this._instance, this._then); + + final Query$GetApiTokens$api _instance; + + final TRes Function(Query$GetApiTokens$api) _then; + + static const _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))); + TRes devices( + Iterable Function( + Iterable< + CopyWith$Query$GetApiTokens$api$devices< + Query$GetApiTokens$api$devices>>) + _fn) => + call( + devices: _fn(_instance.devices.map( + (e) => CopyWith$Query$GetApiTokens$api$devices(e, (i) => i))) + .toList()); +} + +class _CopyWithStubImpl$Query$GetApiTokens$api + implements CopyWith$Query$GetApiTokens$api { + _CopyWithStubImpl$Query$GetApiTokens$api(this._res); + + TRes _res; + + call({List? devices, String? $__typename}) => + _res; + devices(_fn) => _res; } @JsonSerializable(explicitToJson: true) @@ -2503,16 +3569,68 @@ class Query$GetApiTokens$api$devices { extension UtilityExtension$Query$GetApiTokens$api$devices on Query$GetApiTokens$api$devices { - Query$GetApiTokens$api$devices copyWith( + CopyWith$Query$GetApiTokens$api$devices + 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; + + factory CopyWith$Query$GetApiTokens$api$devices.stub(TRes res) = + _CopyWithStubImpl$Query$GetApiTokens$api$devices; + + 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); + + final Query$GetApiTokens$api$devices _instance; + + final TRes Function(Query$GetApiTokens$api$devices) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Query$GetApiTokens$api$devices + implements CopyWith$Query$GetApiTokens$api$devices { + _CopyWithStubImpl$Query$GetApiTokens$api$devices(this._res); + + TRes _res; + + call( {DateTime? creationDate, bool? isCaller, String? name, String? $__typename}) => - Query$GetApiTokens$api$devices( - creationDate: creationDate == null ? this.creationDate : creationDate, - isCaller: isCaller == null ? this.isCaller : isCaller, - name: name == null ? this.name : name, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; } @JsonSerializable(explicitToJson: true) @@ -2551,11 +3669,55 @@ class Query$RecoveryKey { } extension UtilityExtension$Query$RecoveryKey on Query$RecoveryKey { - Query$RecoveryKey copyWith( - {Query$RecoveryKey$api? api, String? $__typename}) => - Query$RecoveryKey( - api: api == null ? this.api : api, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Query$RecoveryKey get copyWith => + 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; + + factory CopyWith$Query$RecoveryKey.stub(TRes res) = + _CopyWithStubImpl$Query$RecoveryKey; + + 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); + + final Query$RecoveryKey _instance; + + final TRes Function(Query$RecoveryKey) _then; + + static const _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))); + CopyWith$Query$RecoveryKey$api get api { + final local$api = _instance.api; + return CopyWith$Query$RecoveryKey$api(local$api, (e) => call(api: e)); + } +} + +class _CopyWithStubImpl$Query$RecoveryKey + implements CopyWith$Query$RecoveryKey { + _CopyWithStubImpl$Query$RecoveryKey(this._res); + + TRes _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: [ @@ -2748,12 +3910,60 @@ class Query$RecoveryKey$api { } extension UtilityExtension$Query$RecoveryKey$api on Query$RecoveryKey$api { - Query$RecoveryKey$api copyWith( - {Query$RecoveryKey$api$recoveryKey? recoveryKey, - String? $__typename}) => - Query$RecoveryKey$api( - recoveryKey: recoveryKey == null ? this.recoveryKey : recoveryKey, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Query$RecoveryKey$api get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Query$RecoveryKey$api; + + 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); + + final Query$RecoveryKey$api _instance; + + final TRes Function(Query$RecoveryKey$api) _then; + + static const _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))); + CopyWith$Query$RecoveryKey$api$recoveryKey get recoveryKey { + final local$recoveryKey = _instance.recoveryKey; + return CopyWith$Query$RecoveryKey$api$recoveryKey( + local$recoveryKey, (e) => call(recoveryKey: e)); + } +} + +class _CopyWithStubImpl$Query$RecoveryKey$api + implements CopyWith$Query$RecoveryKey$api { + _CopyWithStubImpl$Query$RecoveryKey$api(this._res); + + TRes _res; + + 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) @@ -2836,22 +4046,80 @@ class Query$RecoveryKey$api$recoveryKey { extension UtilityExtension$Query$RecoveryKey$api$recoveryKey on Query$RecoveryKey$api$recoveryKey { - Query$RecoveryKey$api$recoveryKey copyWith( - {DateTime? Function()? creationDate, + CopyWith$Query$RecoveryKey$api$recoveryKey + 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; + + 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}); +} + +class _CopyWithImpl$Query$RecoveryKey$api$recoveryKey + implements CopyWith$Query$RecoveryKey$api$recoveryKey { + _CopyWithImpl$Query$RecoveryKey$api$recoveryKey(this._instance, this._then); + + final Query$RecoveryKey$api$recoveryKey _instance; + + final TRes Function(Query$RecoveryKey$api$recoveryKey) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Query$RecoveryKey$api$recoveryKey + implements CopyWith$Query$RecoveryKey$api$recoveryKey { + _CopyWithStubImpl$Query$RecoveryKey$api$recoveryKey(this._res); + + TRes _res; + + call( + {DateTime? creationDate, bool? exists, - DateTime? Function()? expirationDate, - int? Function()? usesLeft, + DateTime? expirationDate, + int? usesLeft, bool? valid, String? $__typename}) => - Query$RecoveryKey$api$recoveryKey( - creationDate: - creationDate == null ? this.creationDate : creationDate(), - exists: exists == null ? this.exists : exists, - expirationDate: - expirationDate == null ? this.expirationDate : expirationDate(), - usesLeft: usesLeft == null ? this.usesLeft : usesLeft(), - valid: valid == null ? this.valid : valid, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; } @JsonSerializable(explicitToJson: true) @@ -2883,10 +4151,49 @@ class Variables$Mutation$GetNewRecoveryApiKey { return true; } - Variables$Mutation$GetNewRecoveryApiKey copyWith( - {Input$RecoveryKeyLimitsInput? Function()? limits}) => - Variables$Mutation$GetNewRecoveryApiKey( - limits: limits == null ? this.limits : limits()); + CopyWith$Variables$Mutation$GetNewRecoveryApiKey< + Variables$Mutation$GetNewRecoveryApiKey> + get copyWith => + CopyWith$Variables$Mutation$GetNewRecoveryApiKey(this, (i) => i); +} + +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; + + factory CopyWith$Variables$Mutation$GetNewRecoveryApiKey.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$GetNewRecoveryApiKey; + + TRes call({Input$RecoveryKeyLimitsInput? limits}); +} + +class _CopyWithImpl$Variables$Mutation$GetNewRecoveryApiKey + implements CopyWith$Variables$Mutation$GetNewRecoveryApiKey { + _CopyWithImpl$Variables$Mutation$GetNewRecoveryApiKey( + this._instance, this._then); + + final Variables$Mutation$GetNewRecoveryApiKey _instance; + + final TRes Function(Variables$Mutation$GetNewRecoveryApiKey) _then; + + static const _undefined = {}; + + TRes call({Object? limits = _undefined}) => + _then(Variables$Mutation$GetNewRecoveryApiKey( + limits: limits == _undefined + ? _instance.limits + : (limits as Input$RecoveryKeyLimitsInput?))); +} + +class _CopyWithStubImpl$Variables$Mutation$GetNewRecoveryApiKey + implements CopyWith$Variables$Mutation$GetNewRecoveryApiKey { + _CopyWithStubImpl$Variables$Mutation$GetNewRecoveryApiKey(this._res); + + TRes _res; + + call({Input$RecoveryKeyLimitsInput? limits}) => _res; } @JsonSerializable(explicitToJson: true) @@ -2927,15 +4234,71 @@ class Mutation$GetNewRecoveryApiKey { extension UtilityExtension$Mutation$GetNewRecoveryApiKey on Mutation$GetNewRecoveryApiKey { - Mutation$GetNewRecoveryApiKey copyWith( + CopyWith$Mutation$GetNewRecoveryApiKey + 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; + + factory CopyWith$Mutation$GetNewRecoveryApiKey.stub(TRes res) = + _CopyWithStubImpl$Mutation$GetNewRecoveryApiKey; + + 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); + + final Mutation$GetNewRecoveryApiKey _instance; + + final TRes Function(Mutation$GetNewRecoveryApiKey) _then; + + static const _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))); + CopyWith$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey + get getNewRecoveryApiKey { + final local$getNewRecoveryApiKey = _instance.getNewRecoveryApiKey; + return CopyWith$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey( + local$getNewRecoveryApiKey, (e) => call(getNewRecoveryApiKey: e)); + } +} + +class _CopyWithStubImpl$Mutation$GetNewRecoveryApiKey + implements CopyWith$Mutation$GetNewRecoveryApiKey { + _CopyWithStubImpl$Mutation$GetNewRecoveryApiKey(this._res); + + TRes _res; + + call( {Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey? getNewRecoveryApiKey, String? $__typename}) => - Mutation$GetNewRecoveryApiKey( - getNewRecoveryApiKey: getNewRecoveryApiKey == null - ? this.getNewRecoveryApiKey - : getNewRecoveryApiKey, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey + get getNewRecoveryApiKey => + CopyWith$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey.stub( + _res); } const documentNodeMutationGetNewRecoveryApiKey = DocumentNode(definitions: [ @@ -3146,18 +4509,82 @@ class Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey extension UtilityExtension$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey on Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey { - Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey copyWith( + CopyWith$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey< + Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey> + get copyWith => + CopyWith$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey( + 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; + + factory CopyWith$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey.stub( + TRes res) = + _CopyWithStubImpl$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey; + + 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); + + final Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey _instance; + + final TRes Function(Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey) _then; + + static const _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?))); +} + +class _CopyWithStubImpl$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey + implements + CopyWith$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey { + _CopyWithStubImpl$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey( + this._res); + + TRes _res; + + call( {int? code, String? message, bool? success, String? $__typename, - String? Function()? key}) => - Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename, - key: key == null ? this.key : key()); + String? key}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -3189,10 +4616,49 @@ class Variables$Mutation$UseRecoveryApiKey { return true; } - Variables$Mutation$UseRecoveryApiKey copyWith( - {Input$UseRecoveryKeyInput? input}) => - Variables$Mutation$UseRecoveryApiKey( - input: input == null ? this.input : input); + CopyWith$Variables$Mutation$UseRecoveryApiKey< + Variables$Mutation$UseRecoveryApiKey> + get copyWith => + CopyWith$Variables$Mutation$UseRecoveryApiKey(this, (i) => i); +} + +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; + + factory CopyWith$Variables$Mutation$UseRecoveryApiKey.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$UseRecoveryApiKey; + + TRes call({Input$UseRecoveryKeyInput? input}); +} + +class _CopyWithImpl$Variables$Mutation$UseRecoveryApiKey + implements CopyWith$Variables$Mutation$UseRecoveryApiKey { + _CopyWithImpl$Variables$Mutation$UseRecoveryApiKey( + this._instance, this._then); + + final Variables$Mutation$UseRecoveryApiKey _instance; + + final TRes Function(Variables$Mutation$UseRecoveryApiKey) _then; + + static const _undefined = {}; + + TRes call({Object? input = _undefined}) => + _then(Variables$Mutation$UseRecoveryApiKey( + input: input == _undefined || input == null + ? _instance.input + : (input as Input$UseRecoveryKeyInput))); +} + +class _CopyWithStubImpl$Variables$Mutation$UseRecoveryApiKey + implements CopyWith$Variables$Mutation$UseRecoveryApiKey { + _CopyWithStubImpl$Variables$Mutation$UseRecoveryApiKey(this._res); + + TRes _res; + + call({Input$UseRecoveryKeyInput? input}) => _res; } @JsonSerializable(explicitToJson: true) @@ -3233,14 +4699,69 @@ class Mutation$UseRecoveryApiKey { extension UtilityExtension$Mutation$UseRecoveryApiKey on Mutation$UseRecoveryApiKey { - Mutation$UseRecoveryApiKey copyWith( + CopyWith$Mutation$UseRecoveryApiKey + 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; + + factory CopyWith$Mutation$UseRecoveryApiKey.stub(TRes res) = + _CopyWithStubImpl$Mutation$UseRecoveryApiKey; + + 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); + + final Mutation$UseRecoveryApiKey _instance; + + final TRes Function(Mutation$UseRecoveryApiKey) _then; + + static const _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))); + CopyWith$Mutation$UseRecoveryApiKey$useRecoveryApiKey + get useRecoveryApiKey { + final local$useRecoveryApiKey = _instance.useRecoveryApiKey; + return CopyWith$Mutation$UseRecoveryApiKey$useRecoveryApiKey( + local$useRecoveryApiKey, (e) => call(useRecoveryApiKey: e)); + } +} + +class _CopyWithStubImpl$Mutation$UseRecoveryApiKey + implements CopyWith$Mutation$UseRecoveryApiKey { + _CopyWithStubImpl$Mutation$UseRecoveryApiKey(this._res); + + TRes _res; + + call( {Mutation$UseRecoveryApiKey$useRecoveryApiKey? useRecoveryApiKey, String? $__typename}) => - Mutation$UseRecoveryApiKey( - useRecoveryApiKey: useRecoveryApiKey == null - ? this.useRecoveryApiKey - : useRecoveryApiKey, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Mutation$UseRecoveryApiKey$useRecoveryApiKey + get useRecoveryApiKey => + CopyWith$Mutation$UseRecoveryApiKey$useRecoveryApiKey.stub(_res); } const documentNodeMutationUseRecoveryApiKey = DocumentNode(definitions: [ @@ -3448,18 +4969,75 @@ class Mutation$UseRecoveryApiKey$useRecoveryApiKey extension UtilityExtension$Mutation$UseRecoveryApiKey$useRecoveryApiKey on Mutation$UseRecoveryApiKey$useRecoveryApiKey { - Mutation$UseRecoveryApiKey$useRecoveryApiKey copyWith( + CopyWith$Mutation$UseRecoveryApiKey$useRecoveryApiKey< + Mutation$UseRecoveryApiKey$useRecoveryApiKey> + 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; + + factory CopyWith$Mutation$UseRecoveryApiKey$useRecoveryApiKey.stub(TRes res) = + _CopyWithStubImpl$Mutation$UseRecoveryApiKey$useRecoveryApiKey; + + 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); + + final Mutation$UseRecoveryApiKey$useRecoveryApiKey _instance; + + final TRes Function(Mutation$UseRecoveryApiKey$useRecoveryApiKey) _then; + + static const _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?))); +} + +class _CopyWithStubImpl$Mutation$UseRecoveryApiKey$useRecoveryApiKey + implements CopyWith$Mutation$UseRecoveryApiKey$useRecoveryApiKey { + _CopyWithStubImpl$Mutation$UseRecoveryApiKey$useRecoveryApiKey(this._res); + + TRes _res; + + call( {int? code, String? message, bool? success, String? $__typename, - String? Function()? token}) => - Mutation$UseRecoveryApiKey$useRecoveryApiKey( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename, - token: token == null ? this.token : token()); + String? token}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -3501,15 +5079,72 @@ class Mutation$RefreshDeviceApiToken { extension UtilityExtension$Mutation$RefreshDeviceApiToken on Mutation$RefreshDeviceApiToken { - Mutation$RefreshDeviceApiToken copyWith( + CopyWith$Mutation$RefreshDeviceApiToken + 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; + + factory CopyWith$Mutation$RefreshDeviceApiToken.stub(TRes res) = + _CopyWithStubImpl$Mutation$RefreshDeviceApiToken; + + 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); + + final Mutation$RefreshDeviceApiToken _instance; + + final TRes Function(Mutation$RefreshDeviceApiToken) _then; + + static const _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))); + CopyWith$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken + get refreshDeviceApiToken { + final local$refreshDeviceApiToken = _instance.refreshDeviceApiToken; + return CopyWith$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken( + local$refreshDeviceApiToken, (e) => call(refreshDeviceApiToken: e)); + } +} + +class _CopyWithStubImpl$Mutation$RefreshDeviceApiToken + implements CopyWith$Mutation$RefreshDeviceApiToken { + _CopyWithStubImpl$Mutation$RefreshDeviceApiToken(this._res); + + TRes _res; + + call( {Mutation$RefreshDeviceApiToken$refreshDeviceApiToken? refreshDeviceApiToken, String? $__typename}) => - Mutation$RefreshDeviceApiToken( - refreshDeviceApiToken: refreshDeviceApiToken == null - ? this.refreshDeviceApiToken - : refreshDeviceApiToken, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken + get refreshDeviceApiToken => + CopyWith$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken.stub( + _res); } const documentNodeMutationRefreshDeviceApiToken = DocumentNode(definitions: [ @@ -3706,18 +5341,84 @@ class Mutation$RefreshDeviceApiToken$refreshDeviceApiToken extension UtilityExtension$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken on Mutation$RefreshDeviceApiToken$refreshDeviceApiToken { - Mutation$RefreshDeviceApiToken$refreshDeviceApiToken copyWith( + CopyWith$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken< + Mutation$RefreshDeviceApiToken$refreshDeviceApiToken> + get copyWith => + CopyWith$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken( + 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; + + factory CopyWith$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken.stub( + TRes res) = + _CopyWithStubImpl$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken; + + 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); + + final Mutation$RefreshDeviceApiToken$refreshDeviceApiToken _instance; + + final TRes Function(Mutation$RefreshDeviceApiToken$refreshDeviceApiToken) + _then; + + static const _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?))); +} + +class _CopyWithStubImpl$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken< + TRes> + implements + CopyWith$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken { + _CopyWithStubImpl$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken( + this._res); + + TRes _res; + + call( {int? code, String? message, bool? success, String? $__typename, - String? Function()? token}) => - Mutation$RefreshDeviceApiToken$refreshDeviceApiToken( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename, - token: token == null ? this.token : token()); + String? token}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -3749,9 +5450,49 @@ class Variables$Mutation$DeleteDeviceApiToken { return true; } - Variables$Mutation$DeleteDeviceApiToken copyWith({String? device}) => - Variables$Mutation$DeleteDeviceApiToken( - device: device == null ? this.device : device); + CopyWith$Variables$Mutation$DeleteDeviceApiToken< + Variables$Mutation$DeleteDeviceApiToken> + get copyWith => + CopyWith$Variables$Mutation$DeleteDeviceApiToken(this, (i) => i); +} + +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; + + factory CopyWith$Variables$Mutation$DeleteDeviceApiToken.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$DeleteDeviceApiToken; + + TRes call({String? device}); +} + +class _CopyWithImpl$Variables$Mutation$DeleteDeviceApiToken + implements CopyWith$Variables$Mutation$DeleteDeviceApiToken { + _CopyWithImpl$Variables$Mutation$DeleteDeviceApiToken( + this._instance, this._then); + + final Variables$Mutation$DeleteDeviceApiToken _instance; + + final TRes Function(Variables$Mutation$DeleteDeviceApiToken) _then; + + static const _undefined = {}; + + TRes call({Object? device = _undefined}) => + _then(Variables$Mutation$DeleteDeviceApiToken( + device: device == _undefined || device == null + ? _instance.device + : (device as String))); +} + +class _CopyWithStubImpl$Variables$Mutation$DeleteDeviceApiToken + implements CopyWith$Variables$Mutation$DeleteDeviceApiToken { + _CopyWithStubImpl$Variables$Mutation$DeleteDeviceApiToken(this._res); + + TRes _res; + + call({String? device}) => _res; } @JsonSerializable(explicitToJson: true) @@ -3792,15 +5533,71 @@ class Mutation$DeleteDeviceApiToken { extension UtilityExtension$Mutation$DeleteDeviceApiToken on Mutation$DeleteDeviceApiToken { - Mutation$DeleteDeviceApiToken copyWith( + CopyWith$Mutation$DeleteDeviceApiToken + 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; + + factory CopyWith$Mutation$DeleteDeviceApiToken.stub(TRes res) = + _CopyWithStubImpl$Mutation$DeleteDeviceApiToken; + + 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); + + final Mutation$DeleteDeviceApiToken _instance; + + final TRes Function(Mutation$DeleteDeviceApiToken) _then; + + static const _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))); + CopyWith$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken + get deleteDeviceApiToken { + final local$deleteDeviceApiToken = _instance.deleteDeviceApiToken; + return CopyWith$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken( + local$deleteDeviceApiToken, (e) => call(deleteDeviceApiToken: e)); + } +} + +class _CopyWithStubImpl$Mutation$DeleteDeviceApiToken + implements CopyWith$Mutation$DeleteDeviceApiToken { + _CopyWithStubImpl$Mutation$DeleteDeviceApiToken(this._res); + + TRes _res; + + call( {Mutation$DeleteDeviceApiToken$deleteDeviceApiToken? deleteDeviceApiToken, String? $__typename}) => - Mutation$DeleteDeviceApiToken( - deleteDeviceApiToken: deleteDeviceApiToken == null - ? this.deleteDeviceApiToken - : deleteDeviceApiToken, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken + get deleteDeviceApiToken => + CopyWith$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken.stub( + _res); } const documentNodeMutationDeleteDeviceApiToken = DocumentNode(definitions: [ @@ -3996,13 +5793,70 @@ class Mutation$DeleteDeviceApiToken$deleteDeviceApiToken extension UtilityExtension$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken on Mutation$DeleteDeviceApiToken$deleteDeviceApiToken { - Mutation$DeleteDeviceApiToken$deleteDeviceApiToken copyWith( - {int? code, String? message, bool? success, String? $__typename}) => - Mutation$DeleteDeviceApiToken$deleteDeviceApiToken( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken< + Mutation$DeleteDeviceApiToken$deleteDeviceApiToken> + get copyWith => + CopyWith$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken( + 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; + + factory CopyWith$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken.stub( + TRes res) = + _CopyWithStubImpl$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken; + + 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); + + final Mutation$DeleteDeviceApiToken$deleteDeviceApiToken _instance; + + final TRes Function(Mutation$DeleteDeviceApiToken$deleteDeviceApiToken) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken + implements + CopyWith$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken { + _CopyWithStubImpl$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken( + this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -4043,14 +5897,69 @@ class Mutation$GetNewDeviceApiKey { extension UtilityExtension$Mutation$GetNewDeviceApiKey on Mutation$GetNewDeviceApiKey { - Mutation$GetNewDeviceApiKey copyWith( + CopyWith$Mutation$GetNewDeviceApiKey + 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; + + factory CopyWith$Mutation$GetNewDeviceApiKey.stub(TRes res) = + _CopyWithStubImpl$Mutation$GetNewDeviceApiKey; + + 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); + + final Mutation$GetNewDeviceApiKey _instance; + + final TRes Function(Mutation$GetNewDeviceApiKey) _then; + + static const _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))); + CopyWith$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey + get getNewDeviceApiKey { + final local$getNewDeviceApiKey = _instance.getNewDeviceApiKey; + return CopyWith$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey( + local$getNewDeviceApiKey, (e) => call(getNewDeviceApiKey: e)); + } +} + +class _CopyWithStubImpl$Mutation$GetNewDeviceApiKey + implements CopyWith$Mutation$GetNewDeviceApiKey { + _CopyWithStubImpl$Mutation$GetNewDeviceApiKey(this._res); + + TRes _res; + + call( {Mutation$GetNewDeviceApiKey$getNewDeviceApiKey? getNewDeviceApiKey, String? $__typename}) => - Mutation$GetNewDeviceApiKey( - getNewDeviceApiKey: getNewDeviceApiKey == null - ? this.getNewDeviceApiKey - : getNewDeviceApiKey, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey + get getNewDeviceApiKey => + CopyWith$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey.stub(_res); } const documentNodeMutationGetNewDeviceApiKey = DocumentNode(definitions: [ @@ -4242,18 +6151,76 @@ class Mutation$GetNewDeviceApiKey$getNewDeviceApiKey extension UtilityExtension$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey on Mutation$GetNewDeviceApiKey$getNewDeviceApiKey { - Mutation$GetNewDeviceApiKey$getNewDeviceApiKey copyWith( + CopyWith$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey< + Mutation$GetNewDeviceApiKey$getNewDeviceApiKey> + get copyWith => CopyWith$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey( + 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; + + factory CopyWith$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey.stub( + TRes res) = + _CopyWithStubImpl$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey; + + 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); + + final Mutation$GetNewDeviceApiKey$getNewDeviceApiKey _instance; + + final TRes Function(Mutation$GetNewDeviceApiKey$getNewDeviceApiKey) _then; + + static const _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?))); +} + +class _CopyWithStubImpl$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey + implements CopyWith$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey { + _CopyWithStubImpl$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey(this._res); + + TRes _res; + + call( {int? code, String? message, bool? success, String? $__typename, - String? Function()? key}) => - Mutation$GetNewDeviceApiKey$getNewDeviceApiKey( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename, - key: key == null ? this.key : key()); + String? key}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -4298,15 +6265,75 @@ class Mutation$InvalidateNewDeviceApiKey { extension UtilityExtension$Mutation$InvalidateNewDeviceApiKey on Mutation$InvalidateNewDeviceApiKey { - Mutation$InvalidateNewDeviceApiKey copyWith( + CopyWith$Mutation$InvalidateNewDeviceApiKey< + Mutation$InvalidateNewDeviceApiKey> + 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; + + factory CopyWith$Mutation$InvalidateNewDeviceApiKey.stub(TRes res) = + _CopyWithStubImpl$Mutation$InvalidateNewDeviceApiKey; + + 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); + + final Mutation$InvalidateNewDeviceApiKey _instance; + + final TRes Function(Mutation$InvalidateNewDeviceApiKey) _then; + + static const _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))); + CopyWith$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey + get invalidateNewDeviceApiKey { + final local$invalidateNewDeviceApiKey = _instance.invalidateNewDeviceApiKey; + return CopyWith$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey( + local$invalidateNewDeviceApiKey, + (e) => call(invalidateNewDeviceApiKey: e)); + } +} + +class _CopyWithStubImpl$Mutation$InvalidateNewDeviceApiKey + implements CopyWith$Mutation$InvalidateNewDeviceApiKey { + _CopyWithStubImpl$Mutation$InvalidateNewDeviceApiKey(this._res); + + TRes _res; + + call( {Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey? invalidateNewDeviceApiKey, String? $__typename}) => - Mutation$InvalidateNewDeviceApiKey( - invalidateNewDeviceApiKey: invalidateNewDeviceApiKey == null - ? this.invalidateNewDeviceApiKey - : invalidateNewDeviceApiKey, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey + get invalidateNewDeviceApiKey => + CopyWith$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey + .stub(_res); } const documentNodeMutationInvalidateNewDeviceApiKey = @@ -4493,13 +6520,76 @@ class Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey extension UtilityExtension$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey on Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey { - Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey copyWith( - {int? code, String? message, bool? success, String? $__typename}) => - Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey< + Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey> + get copyWith => + CopyWith$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey( + 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; + + factory CopyWith$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey.stub( + TRes res) = + _CopyWithStubImpl$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey; + + TRes call({int? code, String? message, bool? success, String? $__typename}); +} + +class _CopyWithImpl$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey< + TRes> + implements + CopyWith$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey< + TRes> { + _CopyWithImpl$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey( + this._instance, this._then); + + final Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey _instance; + + final TRes Function( + Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey< + TRes> + implements + CopyWith$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey< + TRes> { + _CopyWithStubImpl$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey( + this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -4531,10 +6621,50 @@ class Variables$Mutation$AuthorizeWithNewDeviceApiKey { return true; } - Variables$Mutation$AuthorizeWithNewDeviceApiKey copyWith( - {Input$UseNewDeviceKeyInput? input}) => - Variables$Mutation$AuthorizeWithNewDeviceApiKey( - input: input == null ? this.input : input); + CopyWith$Variables$Mutation$AuthorizeWithNewDeviceApiKey< + Variables$Mutation$AuthorizeWithNewDeviceApiKey> + get copyWith => CopyWith$Variables$Mutation$AuthorizeWithNewDeviceApiKey( + this, (i) => i); +} + +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; + + factory CopyWith$Variables$Mutation$AuthorizeWithNewDeviceApiKey.stub( + TRes res) = + _CopyWithStubImpl$Variables$Mutation$AuthorizeWithNewDeviceApiKey; + + TRes call({Input$UseNewDeviceKeyInput? input}); +} + +class _CopyWithImpl$Variables$Mutation$AuthorizeWithNewDeviceApiKey + implements CopyWith$Variables$Mutation$AuthorizeWithNewDeviceApiKey { + _CopyWithImpl$Variables$Mutation$AuthorizeWithNewDeviceApiKey( + this._instance, this._then); + + final Variables$Mutation$AuthorizeWithNewDeviceApiKey _instance; + + final TRes Function(Variables$Mutation$AuthorizeWithNewDeviceApiKey) _then; + + static const _undefined = {}; + + TRes call({Object? input = _undefined}) => + _then(Variables$Mutation$AuthorizeWithNewDeviceApiKey( + input: input == _undefined || input == null + ? _instance.input + : (input as Input$UseNewDeviceKeyInput))); +} + +class _CopyWithStubImpl$Variables$Mutation$AuthorizeWithNewDeviceApiKey + implements CopyWith$Variables$Mutation$AuthorizeWithNewDeviceApiKey { + _CopyWithStubImpl$Variables$Mutation$AuthorizeWithNewDeviceApiKey(this._res); + + TRes _res; + + call({Input$UseNewDeviceKeyInput? input}) => _res; } @JsonSerializable(explicitToJson: true) @@ -4580,15 +6710,79 @@ class Mutation$AuthorizeWithNewDeviceApiKey { extension UtilityExtension$Mutation$AuthorizeWithNewDeviceApiKey on Mutation$AuthorizeWithNewDeviceApiKey { - Mutation$AuthorizeWithNewDeviceApiKey copyWith( + CopyWith$Mutation$AuthorizeWithNewDeviceApiKey< + Mutation$AuthorizeWithNewDeviceApiKey> + 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; + + factory CopyWith$Mutation$AuthorizeWithNewDeviceApiKey.stub(TRes res) = + _CopyWithStubImpl$Mutation$AuthorizeWithNewDeviceApiKey; + + TRes call( + {Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey? + authorizeWithNewDeviceApiKey, + String? $__typename}); + CopyWith$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey< + TRes> get authorizeWithNewDeviceApiKey; +} + +class _CopyWithImpl$Mutation$AuthorizeWithNewDeviceApiKey + implements CopyWith$Mutation$AuthorizeWithNewDeviceApiKey { + _CopyWithImpl$Mutation$AuthorizeWithNewDeviceApiKey( + this._instance, this._then); + + final Mutation$AuthorizeWithNewDeviceApiKey _instance; + + final TRes Function(Mutation$AuthorizeWithNewDeviceApiKey) _then; + + static const _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))); + CopyWith$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey< + TRes> get authorizeWithNewDeviceApiKey { + final local$authorizeWithNewDeviceApiKey = + _instance.authorizeWithNewDeviceApiKey; + return CopyWith$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey( + local$authorizeWithNewDeviceApiKey, + (e) => call(authorizeWithNewDeviceApiKey: e)); + } +} + +class _CopyWithStubImpl$Mutation$AuthorizeWithNewDeviceApiKey + implements CopyWith$Mutation$AuthorizeWithNewDeviceApiKey { + _CopyWithStubImpl$Mutation$AuthorizeWithNewDeviceApiKey(this._res); + + TRes _res; + + call( {Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey? authorizeWithNewDeviceApiKey, String? $__typename}) => - Mutation$AuthorizeWithNewDeviceApiKey( - authorizeWithNewDeviceApiKey: authorizeWithNewDeviceApiKey == null - ? this.authorizeWithNewDeviceApiKey - : authorizeWithNewDeviceApiKey, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey< + TRes> + get authorizeWithNewDeviceApiKey => + CopyWith$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey + .stub(_res); } const documentNodeMutationAuthorizeWithNewDeviceApiKey = @@ -4804,18 +6998,90 @@ class Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey extension UtilityExtension$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey on Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey { - Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey copyWith( + CopyWith$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey< + Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey> + get copyWith => + CopyWith$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey( + 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; + + factory CopyWith$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey.stub( + TRes res) = + _CopyWithStubImpl$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey; + + TRes call( + {int? code, + String? message, + bool? success, + String? $__typename, + String? token}); +} + +class _CopyWithImpl$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey< + TRes> + implements + CopyWith$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey< + TRes> { + _CopyWithImpl$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey( + this._instance, this._then); + + final Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey + _instance; + + final TRes Function( + Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey) _then; + + static const _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?))); +} + +class _CopyWithStubImpl$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey< + TRes> + implements + CopyWith$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey< + TRes> { + _CopyWithStubImpl$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey( + this._res); + + TRes _res; + + call( {int? code, String? message, bool? success, String? $__typename, - String? Function()? token}) => - Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename, - token: token == null ? this.token : token()); + String? token}) => + _res; } DateTime? _nullable$dateTimeFromJson(dynamic data) => 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 c37a1a9c..4a920a4d 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 @@ -61,13 +61,62 @@ class Fragment$basicMutationReturnFields { extension UtilityExtension$Fragment$basicMutationReturnFields on Fragment$basicMutationReturnFields { - Fragment$basicMutationReturnFields copyWith( - {int? code, String? message, bool? success, String? $__typename}) => - Fragment$basicMutationReturnFields( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Fragment$basicMutationReturnFields< + Fragment$basicMutationReturnFields> + 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; + + factory CopyWith$Fragment$basicMutationReturnFields.stub(TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields; + + 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); + + final Fragment$basicMutationReturnFields _instance; + + final TRes Function(Fragment$basicMutationReturnFields) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields + implements CopyWith$Fragment$basicMutationReturnFields { + _CopyWithStubImpl$Fragment$basicMutationReturnFields(this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; } const fragmentDefinitionbasicMutationReturnFields = FragmentDefinitionNode( @@ -173,11 +222,56 @@ class Query$SystemSettings { } extension UtilityExtension$Query$SystemSettings on Query$SystemSettings { - Query$SystemSettings copyWith( - {Query$SystemSettings$system? system, String? $__typename}) => - Query$SystemSettings( - system: system == null ? this.system : system, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Query$SystemSettings get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Query$SystemSettings; + + 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); + + final Query$SystemSettings _instance; + + final TRes Function(Query$SystemSettings) _then; + + static const _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))); + CopyWith$Query$SystemSettings$system get system { + final local$system = _instance.system; + return CopyWith$Query$SystemSettings$system( + local$system, (e) => call(system: e)); + } +} + +class _CopyWithStubImpl$Query$SystemSettings + implements CopyWith$Query$SystemSettings { + _CopyWithStubImpl$Query$SystemSettings(this._res); + + TRes _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: [ @@ -408,12 +502,60 @@ class Query$SystemSettings$system { extension UtilityExtension$Query$SystemSettings$system on Query$SystemSettings$system { - Query$SystemSettings$system copyWith( - {Query$SystemSettings$system$settings? settings, - String? $__typename}) => - Query$SystemSettings$system( - settings: settings == null ? this.settings : settings, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Query$SystemSettings$system + 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; + + factory CopyWith$Query$SystemSettings$system.stub(TRes res) = + _CopyWithStubImpl$Query$SystemSettings$system; + + 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); + + final Query$SystemSettings$system _instance; + + final TRes Function(Query$SystemSettings$system) _then; + + static const _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))); + CopyWith$Query$SystemSettings$system$settings get settings { + final local$settings = _instance.settings; + return CopyWith$Query$SystemSettings$system$settings( + local$settings, (e) => call(settings: e)); + } +} + +class _CopyWithStubImpl$Query$SystemSettings$system + implements CopyWith$Query$SystemSettings$system { + _CopyWithStubImpl$Query$SystemSettings$system(this._res); + + TRes _res; + + 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) @@ -471,16 +613,92 @@ class Query$SystemSettings$system$settings { extension UtilityExtension$Query$SystemSettings$system$settings on Query$SystemSettings$system$settings { - Query$SystemSettings$system$settings copyWith( + CopyWith$Query$SystemSettings$system$settings< + Query$SystemSettings$system$settings> + 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; + + 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}); + CopyWith$Query$SystemSettings$system$settings$autoUpgrade + get autoUpgrade; + CopyWith$Query$SystemSettings$system$settings$ssh get ssh; +} + +class _CopyWithImpl$Query$SystemSettings$system$settings + implements CopyWith$Query$SystemSettings$system$settings { + _CopyWithImpl$Query$SystemSettings$system$settings( + this._instance, this._then); + + final Query$SystemSettings$system$settings _instance; + + final TRes Function(Query$SystemSettings$system$settings) _then; + + static const _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))); + CopyWith$Query$SystemSettings$system$settings$autoUpgrade + get autoUpgrade { + final local$autoUpgrade = _instance.autoUpgrade; + return CopyWith$Query$SystemSettings$system$settings$autoUpgrade( + local$autoUpgrade, (e) => call(autoUpgrade: e)); + } + + CopyWith$Query$SystemSettings$system$settings$ssh get ssh { + final local$ssh = _instance.ssh; + return CopyWith$Query$SystemSettings$system$settings$ssh( + local$ssh, (e) => call(ssh: e)); + } +} + +class _CopyWithStubImpl$Query$SystemSettings$system$settings + implements CopyWith$Query$SystemSettings$system$settings { + _CopyWithStubImpl$Query$SystemSettings$system$settings(this._res); + + TRes _res; + + call( {Query$SystemSettings$system$settings$autoUpgrade? autoUpgrade, Query$SystemSettings$system$settings$ssh? ssh, String? timezone, String? $__typename}) => - Query$SystemSettings$system$settings( - autoUpgrade: autoUpgrade == null ? this.autoUpgrade : autoUpgrade, - ssh: ssh == null ? this.ssh : ssh, - timezone: timezone == null ? this.timezone : timezone, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Query$SystemSettings$system$settings$autoUpgrade + get autoUpgrade => + CopyWith$Query$SystemSettings$system$settings$autoUpgrade.stub(_res); + CopyWith$Query$SystemSettings$system$settings$ssh get ssh => + CopyWith$Query$SystemSettings$system$settings$ssh.stub(_res); } @JsonSerializable(explicitToJson: true) @@ -531,12 +749,60 @@ class Query$SystemSettings$system$settings$autoUpgrade { extension UtilityExtension$Query$SystemSettings$system$settings$autoUpgrade on Query$SystemSettings$system$settings$autoUpgrade { - Query$SystemSettings$system$settings$autoUpgrade copyWith( - {bool? allowReboot, bool? enable, String? $__typename}) => - Query$SystemSettings$system$settings$autoUpgrade( - allowReboot: allowReboot == null ? this.allowReboot : allowReboot, - enable: enable == null ? this.enable : enable, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Query$SystemSettings$system$settings$autoUpgrade< + Query$SystemSettings$system$settings$autoUpgrade> + get copyWith => CopyWith$Query$SystemSettings$system$settings$autoUpgrade( + 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; + + factory CopyWith$Query$SystemSettings$system$settings$autoUpgrade.stub( + TRes res) = + _CopyWithStubImpl$Query$SystemSettings$system$settings$autoUpgrade; + + 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); + + final Query$SystemSettings$system$settings$autoUpgrade _instance; + + final TRes Function(Query$SystemSettings$system$settings$autoUpgrade) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Query$SystemSettings$system$settings$autoUpgrade + implements CopyWith$Query$SystemSettings$system$settings$autoUpgrade { + _CopyWithStubImpl$Query$SystemSettings$system$settings$autoUpgrade(this._res); + + TRes _res; + + call({bool? allowReboot, bool? enable, String? $__typename}) => _res; } @JsonSerializable(explicitToJson: true) @@ -605,18 +871,72 @@ class Query$SystemSettings$system$settings$ssh { extension UtilityExtension$Query$SystemSettings$system$settings$ssh on Query$SystemSettings$system$settings$ssh { - Query$SystemSettings$system$settings$ssh copyWith( + CopyWith$Query$SystemSettings$system$settings$ssh< + Query$SystemSettings$system$settings$ssh> + 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; + + factory CopyWith$Query$SystemSettings$system$settings$ssh.stub(TRes res) = + _CopyWithStubImpl$Query$SystemSettings$system$settings$ssh; + + TRes call( + {bool? enable, + bool? passwordAuthentication, + List? rootSshKeys, + 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); + + final Query$SystemSettings$system$settings$ssh _instance; + + final TRes Function(Query$SystemSettings$system$settings$ssh) _then; + + static const _undefined = {}; + + TRes call( + {Object? enable = _undefined, + Object? passwordAuthentication = _undefined, + Object? rootSshKeys = _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), + rootSshKeys: rootSshKeys == _undefined || rootSshKeys == null + ? _instance.rootSshKeys + : (rootSshKeys as List), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); +} + +class _CopyWithStubImpl$Query$SystemSettings$system$settings$ssh + implements CopyWith$Query$SystemSettings$system$settings$ssh { + _CopyWithStubImpl$Query$SystemSettings$system$settings$ssh(this._res); + + TRes _res; + + call( {bool? enable, bool? passwordAuthentication, List? rootSshKeys, String? $__typename}) => - Query$SystemSettings$system$settings$ssh( - enable: enable == null ? this.enable : enable, - passwordAuthentication: passwordAuthentication == null - ? this.passwordAuthentication - : passwordAuthentication, - rootSshKeys: rootSshKeys == null ? this.rootSshKeys : rootSshKeys, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; } @JsonSerializable(explicitToJson: true) @@ -655,11 +975,56 @@ class Query$DomainInfo { } extension UtilityExtension$Query$DomainInfo on Query$DomainInfo { - Query$DomainInfo copyWith( - {Query$DomainInfo$system? system, String? $__typename}) => - Query$DomainInfo( - system: system == null ? this.system : system, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Query$DomainInfo get copyWith => + 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; + + factory CopyWith$Query$DomainInfo.stub(TRes res) = + _CopyWithStubImpl$Query$DomainInfo; + + 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); + + final Query$DomainInfo _instance; + + final TRes Function(Query$DomainInfo) _then; + + static const _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))); + CopyWith$Query$DomainInfo$system get system { + final local$system = _instance.system; + return CopyWith$Query$DomainInfo$system( + local$system, (e) => call(system: e)); + } +} + +class _CopyWithStubImpl$Query$DomainInfo + implements CopyWith$Query$DomainInfo { + _CopyWithStubImpl$Query$DomainInfo(this._res); + + TRes _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: [ @@ -883,12 +1248,60 @@ class Query$DomainInfo$system { } extension UtilityExtension$Query$DomainInfo$system on Query$DomainInfo$system { - Query$DomainInfo$system copyWith( - {Query$DomainInfo$system$domainInfo? domainInfo, - String? $__typename}) => - Query$DomainInfo$system( - domainInfo: domainInfo == null ? this.domainInfo : domainInfo, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Query$DomainInfo$system get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Query$DomainInfo$system; + + 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); + + final Query$DomainInfo$system _instance; + + final TRes Function(Query$DomainInfo$system) _then; + + static const _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))); + CopyWith$Query$DomainInfo$system$domainInfo get domainInfo { + final local$domainInfo = _instance.domainInfo; + return CopyWith$Query$DomainInfo$system$domainInfo( + local$domainInfo, (e) => call(domainInfo: e)); + } +} + +class _CopyWithStubImpl$Query$DomainInfo$system + implements CopyWith$Query$DomainInfo$system { + _CopyWithStubImpl$Query$DomainInfo$system(this._res); + + TRes _res; + + 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) @@ -969,21 +1382,97 @@ class Query$DomainInfo$system$domainInfo { extension UtilityExtension$Query$DomainInfo$system$domainInfo on Query$DomainInfo$system$domainInfo { - Query$DomainInfo$system$domainInfo copyWith( + CopyWith$Query$DomainInfo$system$domainInfo< + Query$DomainInfo$system$domainInfo> + 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; + + 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 requiredDnsRecords( + Iterable Function( + Iterable< + CopyWith$Query$DomainInfo$system$domainInfo$requiredDnsRecords< + Query$DomainInfo$system$domainInfo$requiredDnsRecords>>) + _fn); +} + +class _CopyWithImpl$Query$DomainInfo$system$domainInfo + implements CopyWith$Query$DomainInfo$system$domainInfo { + _CopyWithImpl$Query$DomainInfo$system$domainInfo(this._instance, this._then); + + final Query$DomainInfo$system$domainInfo _instance; + + final TRes Function(Query$DomainInfo$system$domainInfo) _then; + + static const _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< + Query$DomainInfo$system$domainInfo$requiredDnsRecords>), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); + TRes requiredDnsRecords( + Iterable Function( + Iterable< + CopyWith$Query$DomainInfo$system$domainInfo$requiredDnsRecords< + Query$DomainInfo$system$domainInfo$requiredDnsRecords>>) + _fn) => + call( + requiredDnsRecords: _fn(_instance.requiredDnsRecords.map((e) => + CopyWith$Query$DomainInfo$system$domainInfo$requiredDnsRecords( + e, (i) => i))).toList()); +} + +class _CopyWithStubImpl$Query$DomainInfo$system$domainInfo + implements CopyWith$Query$DomainInfo$system$domainInfo { + _CopyWithStubImpl$Query$DomainInfo$system$domainInfo(this._res); + + TRes _res; + + call( {String? domain, String? hostname, Enum$DnsProvider? provider, List? requiredDnsRecords, String? $__typename}) => - Query$DomainInfo$system$domainInfo( - domain: domain == null ? this.domain : domain, - hostname: hostname == null ? this.hostname : hostname, - provider: provider == null ? this.provider : provider, - requiredDnsRecords: requiredDnsRecords == null - ? this.requiredDnsRecords - : requiredDnsRecords, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + requiredDnsRecords(_fn) => _res; } @JsonSerializable(explicitToJson: true) @@ -1056,20 +1545,89 @@ class Query$DomainInfo$system$domainInfo$requiredDnsRecords { extension UtilityExtension$Query$DomainInfo$system$domainInfo$requiredDnsRecords on Query$DomainInfo$system$domainInfo$requiredDnsRecords { - Query$DomainInfo$system$domainInfo$requiredDnsRecords copyWith( + CopyWith$Query$DomainInfo$system$domainInfo$requiredDnsRecords< + Query$DomainInfo$system$domainInfo$requiredDnsRecords> + get copyWith => + CopyWith$Query$DomainInfo$system$domainInfo$requiredDnsRecords( + this, (i) => i); +} + +abstract class CopyWith$Query$DomainInfo$system$domainInfo$requiredDnsRecords< + TRes> { + factory CopyWith$Query$DomainInfo$system$domainInfo$requiredDnsRecords( + Query$DomainInfo$system$domainInfo$requiredDnsRecords instance, + TRes Function(Query$DomainInfo$system$domainInfo$requiredDnsRecords) + then) = + _CopyWithImpl$Query$DomainInfo$system$domainInfo$requiredDnsRecords; + + factory CopyWith$Query$DomainInfo$system$domainInfo$requiredDnsRecords.stub( + TRes res) = + _CopyWithStubImpl$Query$DomainInfo$system$domainInfo$requiredDnsRecords; + + TRes call( + {String? content, + String? name, + int? priority, + String? recordType, + int? ttl, + String? $__typename}); +} + +class _CopyWithImpl$Query$DomainInfo$system$domainInfo$requiredDnsRecords + implements + CopyWith$Query$DomainInfo$system$domainInfo$requiredDnsRecords { + _CopyWithImpl$Query$DomainInfo$system$domainInfo$requiredDnsRecords( + this._instance, this._then); + + final Query$DomainInfo$system$domainInfo$requiredDnsRecords _instance; + + final TRes Function(Query$DomainInfo$system$domainInfo$requiredDnsRecords) + _then; + + static const _undefined = {}; + + TRes call( + {Object? content = _undefined, + Object? name = _undefined, + Object? priority = _undefined, + Object? recordType = _undefined, + Object? ttl = _undefined, + Object? $__typename = _undefined}) => + _then(Query$DomainInfo$system$domainInfo$requiredDnsRecords( + 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$Query$DomainInfo$system$domainInfo$requiredDnsRecords< + TRes> + implements + CopyWith$Query$DomainInfo$system$domainInfo$requiredDnsRecords { + _CopyWithStubImpl$Query$DomainInfo$system$domainInfo$requiredDnsRecords( + this._res); + + TRes _res; + + call( {String? content, String? name, - int? Function()? priority, + int? priority, String? recordType, int? ttl, String? $__typename}) => - Query$DomainInfo$system$domainInfo$requiredDnsRecords( - content: content == null ? this.content : content, - name: name == null ? this.name : name, - priority: priority == null ? this.priority : priority(), - recordType: recordType == null ? this.recordType : recordType, - ttl: ttl == null ? this.ttl : ttl, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; } @JsonSerializable(explicitToJson: true) @@ -1101,9 +1659,47 @@ class Variables$Mutation$ChangeTimezone { return true; } - Variables$Mutation$ChangeTimezone copyWith({String? timezone}) => - Variables$Mutation$ChangeTimezone( - timezone: timezone == null ? this.timezone : timezone); + 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; + + factory CopyWith$Variables$Mutation$ChangeTimezone.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$ChangeTimezone; + + TRes call({String? timezone}); +} + +class _CopyWithImpl$Variables$Mutation$ChangeTimezone + implements CopyWith$Variables$Mutation$ChangeTimezone { + _CopyWithImpl$Variables$Mutation$ChangeTimezone(this._instance, this._then); + + final Variables$Mutation$ChangeTimezone _instance; + + final TRes Function(Variables$Mutation$ChangeTimezone) _then; + + static const _undefined = {}; + + TRes call({Object? timezone = _undefined}) => + _then(Variables$Mutation$ChangeTimezone( + timezone: timezone == _undefined || timezone == null + ? _instance.timezone + : (timezone as String))); +} + +class _CopyWithStubImpl$Variables$Mutation$ChangeTimezone + implements CopyWith$Variables$Mutation$ChangeTimezone { + _CopyWithStubImpl$Variables$Mutation$ChangeTimezone(this._res); + + TRes _res; + + call({String? timezone}) => _res; } @JsonSerializable(explicitToJson: true) @@ -1143,13 +1739,63 @@ class Mutation$ChangeTimezone { } extension UtilityExtension$Mutation$ChangeTimezone on Mutation$ChangeTimezone { - Mutation$ChangeTimezone copyWith( + CopyWith$Mutation$ChangeTimezone get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Mutation$ChangeTimezone; + + 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); + + final Mutation$ChangeTimezone _instance; + + final TRes Function(Mutation$ChangeTimezone) _then; + + static const _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))); + CopyWith$Mutation$ChangeTimezone$changeTimezone get changeTimezone { + final local$changeTimezone = _instance.changeTimezone; + return CopyWith$Mutation$ChangeTimezone$changeTimezone( + local$changeTimezone, (e) => call(changeTimezone: e)); + } +} + +class _CopyWithStubImpl$Mutation$ChangeTimezone + implements CopyWith$Mutation$ChangeTimezone { + _CopyWithStubImpl$Mutation$ChangeTimezone(this._res); + + TRes _res; + + call( {Mutation$ChangeTimezone$changeTimezone? changeTimezone, String? $__typename}) => - Mutation$ChangeTimezone( - changeTimezone: - changeTimezone == null ? this.changeTimezone : changeTimezone, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Mutation$ChangeTimezone$changeTimezone get changeTimezone => + CopyWith$Mutation$ChangeTimezone$changeTimezone.stub(_res); } const documentNodeMutationChangeTimezone = DocumentNode(definitions: [ @@ -1355,18 +2001,77 @@ class Mutation$ChangeTimezone$changeTimezone extension UtilityExtension$Mutation$ChangeTimezone$changeTimezone on Mutation$ChangeTimezone$changeTimezone { - Mutation$ChangeTimezone$changeTimezone copyWith( + CopyWith$Mutation$ChangeTimezone$changeTimezone< + Mutation$ChangeTimezone$changeTimezone> + 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; + + factory CopyWith$Mutation$ChangeTimezone$changeTimezone.stub(TRes res) = + _CopyWithStubImpl$Mutation$ChangeTimezone$changeTimezone; + + 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); + + final Mutation$ChangeTimezone$changeTimezone _instance; + + final TRes Function(Mutation$ChangeTimezone$changeTimezone) _then; + + static const _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?))); +} + +class _CopyWithStubImpl$Mutation$ChangeTimezone$changeTimezone + implements CopyWith$Mutation$ChangeTimezone$changeTimezone { + _CopyWithStubImpl$Mutation$ChangeTimezone$changeTimezone(this._res); + + TRes _res; + + call( {int? code, String? message, bool? success, String? $__typename, - String? Function()? timezone}) => - Mutation$ChangeTimezone$changeTimezone( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename, - timezone: timezone == null ? this.timezone : timezone()); + String? timezone}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -1398,10 +2103,49 @@ class Variables$Mutation$ChangeAutoUpgradeSettings { return true; } - Variables$Mutation$ChangeAutoUpgradeSettings copyWith( - {Input$AutoUpgradeSettingsInput? settings}) => - Variables$Mutation$ChangeAutoUpgradeSettings( - settings: settings == null ? this.settings : settings); + CopyWith$Variables$Mutation$ChangeAutoUpgradeSettings< + Variables$Mutation$ChangeAutoUpgradeSettings> + get copyWith => + CopyWith$Variables$Mutation$ChangeAutoUpgradeSettings(this, (i) => i); +} + +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; + + factory CopyWith$Variables$Mutation$ChangeAutoUpgradeSettings.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$ChangeAutoUpgradeSettings; + + TRes call({Input$AutoUpgradeSettingsInput? settings}); +} + +class _CopyWithImpl$Variables$Mutation$ChangeAutoUpgradeSettings + implements CopyWith$Variables$Mutation$ChangeAutoUpgradeSettings { + _CopyWithImpl$Variables$Mutation$ChangeAutoUpgradeSettings( + this._instance, this._then); + + final Variables$Mutation$ChangeAutoUpgradeSettings _instance; + + final TRes Function(Variables$Mutation$ChangeAutoUpgradeSettings) _then; + + static const _undefined = {}; + + TRes call({Object? settings = _undefined}) => + _then(Variables$Mutation$ChangeAutoUpgradeSettings( + settings: settings == _undefined || settings == null + ? _instance.settings + : (settings as Input$AutoUpgradeSettingsInput))); +} + +class _CopyWithStubImpl$Variables$Mutation$ChangeAutoUpgradeSettings + implements CopyWith$Variables$Mutation$ChangeAutoUpgradeSettings { + _CopyWithStubImpl$Variables$Mutation$ChangeAutoUpgradeSettings(this._res); + + TRes _res; + + call({Input$AutoUpgradeSettingsInput? settings}) => _res; } @JsonSerializable(explicitToJson: true) @@ -1446,15 +2190,75 @@ class Mutation$ChangeAutoUpgradeSettings { extension UtilityExtension$Mutation$ChangeAutoUpgradeSettings on Mutation$ChangeAutoUpgradeSettings { - Mutation$ChangeAutoUpgradeSettings copyWith( + CopyWith$Mutation$ChangeAutoUpgradeSettings< + Mutation$ChangeAutoUpgradeSettings> + 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; + + factory CopyWith$Mutation$ChangeAutoUpgradeSettings.stub(TRes res) = + _CopyWithStubImpl$Mutation$ChangeAutoUpgradeSettings; + + 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); + + final Mutation$ChangeAutoUpgradeSettings _instance; + + final TRes Function(Mutation$ChangeAutoUpgradeSettings) _then; + + static const _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))); + CopyWith$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings + get changeAutoUpgradeSettings { + final local$changeAutoUpgradeSettings = _instance.changeAutoUpgradeSettings; + return CopyWith$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings( + local$changeAutoUpgradeSettings, + (e) => call(changeAutoUpgradeSettings: e)); + } +} + +class _CopyWithStubImpl$Mutation$ChangeAutoUpgradeSettings + implements CopyWith$Mutation$ChangeAutoUpgradeSettings { + _CopyWithStubImpl$Mutation$ChangeAutoUpgradeSettings(this._res); + + TRes _res; + + call( {Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings? changeAutoUpgradeSettings, String? $__typename}) => - Mutation$ChangeAutoUpgradeSettings( - changeAutoUpgradeSettings: changeAutoUpgradeSettings == null - ? this.changeAutoUpgradeSettings - : changeAutoUpgradeSettings, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings + get changeAutoUpgradeSettings => + CopyWith$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings + .stub(_res); } const documentNodeMutationChangeAutoUpgradeSettings = @@ -1688,20 +2492,95 @@ class Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings extension UtilityExtension$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings on Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings { - Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings copyWith( + CopyWith$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings< + Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings> + get copyWith => + CopyWith$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings( + 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; + + 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}); +} + +class _CopyWithImpl$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings< + TRes> + implements + CopyWith$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings< + TRes> { + _CopyWithImpl$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings( + this._instance, this._then); + + final Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings _instance; + + final TRes Function( + Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings< + TRes> + implements + CopyWith$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings< + TRes> { + _CopyWithStubImpl$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings( + this._res); + + TRes _res; + + call( {int? code, String? message, bool? success, String? $__typename, bool? allowReboot, bool? enableAutoUpgrade}) => - Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename, - allowReboot: allowReboot == null ? this.allowReboot : allowReboot, - enableAutoUpgrade: enableAutoUpgrade == null - ? this.enableAutoUpgrade - : 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 index bbca8052..d3e51515 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 @@ -161,7 +161,7 @@ Map _$Query$DomainInfo$system$domainInfoToJson( { 'domain': instance.domain, 'hostname': instance.hostname, - 'provider': _$Enum$DnsProviderEnumMap[instance.provider], + 'provider': _$Enum$DnsProviderEnumMap[instance.provider]!, 'requiredDnsRecords': instance.requiredDnsRecords.map((e) => e.toJson()).toList(), '__typename': instance.$__typename, 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 2a415115..49dbc91f 100644 --- a/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart @@ -62,13 +62,62 @@ class Fragment$basicMutationReturnFields { extension UtilityExtension$Fragment$basicMutationReturnFields on Fragment$basicMutationReturnFields { - Fragment$basicMutationReturnFields copyWith( - {int? code, String? message, bool? success, String? $__typename}) => - Fragment$basicMutationReturnFields( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Fragment$basicMutationReturnFields< + Fragment$basicMutationReturnFields> + 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; + + factory CopyWith$Fragment$basicMutationReturnFields.stub(TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields; + + 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); + + final Fragment$basicMutationReturnFields _instance; + + final TRes Function(Fragment$basicMutationReturnFields) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields + implements CopyWith$Fragment$basicMutationReturnFields { + _CopyWithStubImpl$Fragment$basicMutationReturnFields(this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; } const fragmentDefinitionbasicMutationReturnFields = FragmentDefinitionNode( @@ -174,11 +223,57 @@ class Query$AllServices { } extension UtilityExtension$Query$AllServices on Query$AllServices { - Query$AllServices copyWith( - {Query$AllServices$services? services, String? $__typename}) => - Query$AllServices( - services: services == null ? this.services : services, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Query$AllServices get copyWith => + 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; + + factory CopyWith$Query$AllServices.stub(TRes res) = + _CopyWithStubImpl$Query$AllServices; + + 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); + + final Query$AllServices _instance; + + final TRes Function(Query$AllServices) _then; + + static const _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))); + CopyWith$Query$AllServices$services get services { + final local$services = _instance.services; + return CopyWith$Query$AllServices$services( + local$services, (e) => call(services: e)); + } +} + +class _CopyWithStubImpl$Query$AllServices + implements CopyWith$Query$AllServices { + _CopyWithStubImpl$Query$AllServices(this._res); + + TRes _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: [ @@ -491,12 +586,73 @@ class Query$AllServices$services { extension UtilityExtension$Query$AllServices$services on Query$AllServices$services { - Query$AllServices$services copyWith( + CopyWith$Query$AllServices$services + 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; + + factory CopyWith$Query$AllServices$services.stub(TRes res) = + _CopyWithStubImpl$Query$AllServices$services; + + TRes call( + {List? allServices, + String? $__typename}); + TRes allServices( + Iterable Function( + Iterable< + CopyWith$Query$AllServices$services$allServices< + Query$AllServices$services$allServices>>) + _fn); +} + +class _CopyWithImpl$Query$AllServices$services + implements CopyWith$Query$AllServices$services { + _CopyWithImpl$Query$AllServices$services(this._instance, this._then); + + final Query$AllServices$services _instance; + + final TRes Function(Query$AllServices$services) _then; + + static const _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))); + TRes allServices( + Iterable Function( + Iterable< + CopyWith$Query$AllServices$services$allServices< + Query$AllServices$services$allServices>>) + _fn) => + call( + allServices: _fn(_instance.allServices.map((e) => + CopyWith$Query$AllServices$services$allServices(e, (i) => i))) + .toList()); +} + +class _CopyWithStubImpl$Query$AllServices$services + implements CopyWith$Query$AllServices$services { + _CopyWithStubImpl$Query$AllServices$services(this._res); + + TRes _res; + + call( {List? allServices, String? $__typename}) => - Query$AllServices$services( - allServices: allServices == null ? this.allServices : allServices, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + allServices(_fn) => _res; } @JsonSerializable(explicitToJson: true) @@ -634,11 +790,131 @@ class Query$AllServices$services$allServices { extension UtilityExtension$Query$AllServices$services$allServices on Query$AllServices$services$allServices { - Query$AllServices$services$allServices copyWith( + CopyWith$Query$AllServices$services$allServices< + Query$AllServices$services$allServices> + 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; + + 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 dnsRecords( + Iterable? Function( + Iterable< + CopyWith$Query$AllServices$services$allServices$dnsRecords< + Query$AllServices$services$allServices$dnsRecords>>?) + _fn); + CopyWith$Query$AllServices$services$allServices$storageUsage + get storageUsage; +} + +class _CopyWithImpl$Query$AllServices$services$allServices + implements CopyWith$Query$AllServices$services$allServices { + _CopyWithImpl$Query$AllServices$services$allServices( + this._instance, this._then); + + final Query$AllServices$services$allServices _instance; + + final TRes Function(Query$AllServices$services$allServices) _then; + + 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}) => + _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))); + TRes dnsRecords( + Iterable? Function( + Iterable< + CopyWith$Query$AllServices$services$allServices$dnsRecords< + Query$AllServices$services$allServices$dnsRecords>>?) + _fn) => + call( + dnsRecords: _fn(_instance.dnsRecords?.map((e) => + CopyWith$Query$AllServices$services$allServices$dnsRecords( + e, (i) => i)))?.toList()); + CopyWith$Query$AllServices$services$allServices$storageUsage + get storageUsage { + final local$storageUsage = _instance.storageUsage; + return CopyWith$Query$AllServices$services$allServices$storageUsage( + local$storageUsage, (e) => call(storageUsage: e)); + } +} + +class _CopyWithStubImpl$Query$AllServices$services$allServices + implements CopyWith$Query$AllServices$services$allServices { + _CopyWithStubImpl$Query$AllServices$services$allServices(this._res); + + TRes _res; + + call( {String? description, String? displayName, - List? Function()? - dnsRecords, + List? dnsRecords, String? id, bool? isEnabled, bool? isMovable, @@ -646,21 +922,14 @@ extension UtilityExtension$Query$AllServices$services$allServices Enum$ServiceStatusEnum? status, Query$AllServices$services$allServices$storageUsage? storageUsage, String? svgIcon, - String? Function()? url, + String? url, String? $__typename}) => - Query$AllServices$services$allServices( - description: description == null ? this.description : description, - displayName: displayName == null ? this.displayName : displayName, - dnsRecords: dnsRecords == null ? this.dnsRecords : dnsRecords(), - id: id == null ? this.id : id, - isEnabled: isEnabled == null ? this.isEnabled : isEnabled, - isMovable: isMovable == null ? this.isMovable : isMovable, - isRequired: isRequired == null ? this.isRequired : isRequired, - status: status == null ? this.status : status, - storageUsage: storageUsage == null ? this.storageUsage : storageUsage, - svgIcon: svgIcon == null ? this.svgIcon : svgIcon, - url: url == null ? this.url : url(), - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + dnsRecords(_fn) => _res; + CopyWith$Query$AllServices$services$allServices$storageUsage + get storageUsage => + CopyWith$Query$AllServices$services$allServices$storageUsage.stub( + _res); } @JsonSerializable(explicitToJson: true) @@ -733,20 +1002,87 @@ class Query$AllServices$services$allServices$dnsRecords { extension UtilityExtension$Query$AllServices$services$allServices$dnsRecords on Query$AllServices$services$allServices$dnsRecords { - Query$AllServices$services$allServices$dnsRecords copyWith( + CopyWith$Query$AllServices$services$allServices$dnsRecords< + Query$AllServices$services$allServices$dnsRecords> + get copyWith => + CopyWith$Query$AllServices$services$allServices$dnsRecords( + this, (i) => i); +} + +abstract class CopyWith$Query$AllServices$services$allServices$dnsRecords< + TRes> { + factory CopyWith$Query$AllServices$services$allServices$dnsRecords( + Query$AllServices$services$allServices$dnsRecords instance, + TRes Function(Query$AllServices$services$allServices$dnsRecords) + then) = + _CopyWithImpl$Query$AllServices$services$allServices$dnsRecords; + + factory CopyWith$Query$AllServices$services$allServices$dnsRecords.stub( + TRes res) = + _CopyWithStubImpl$Query$AllServices$services$allServices$dnsRecords; + + TRes call( + {String? content, + String? name, + int? priority, + String? recordType, + int? ttl, + String? $__typename}); +} + +class _CopyWithImpl$Query$AllServices$services$allServices$dnsRecords + implements + CopyWith$Query$AllServices$services$allServices$dnsRecords { + _CopyWithImpl$Query$AllServices$services$allServices$dnsRecords( + this._instance, this._then); + + final Query$AllServices$services$allServices$dnsRecords _instance; + + final TRes Function(Query$AllServices$services$allServices$dnsRecords) _then; + + static const _undefined = {}; + + TRes call( + {Object? content = _undefined, + Object? name = _undefined, + Object? priority = _undefined, + Object? recordType = _undefined, + Object? ttl = _undefined, + Object? $__typename = _undefined}) => + _then(Query$AllServices$services$allServices$dnsRecords( + 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$Query$AllServices$services$allServices$dnsRecords + implements + CopyWith$Query$AllServices$services$allServices$dnsRecords { + _CopyWithStubImpl$Query$AllServices$services$allServices$dnsRecords( + this._res); + + TRes _res; + + call( {String? content, String? name, - int? Function()? priority, + int? priority, String? recordType, int? ttl, String? $__typename}) => - Query$AllServices$services$allServices$dnsRecords( - content: content == null ? this.content : content, - name: name == null ? this.name : name, - priority: priority == null ? this.priority : priority(), - recordType: recordType == null ? this.recordType : recordType, - ttl: ttl == null ? this.ttl : ttl, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; } @JsonSerializable(explicitToJson: true) @@ -804,18 +1140,96 @@ class Query$AllServices$services$allServices$storageUsage { extension UtilityExtension$Query$AllServices$services$allServices$storageUsage on Query$AllServices$services$allServices$storageUsage { - Query$AllServices$services$allServices$storageUsage copyWith( + CopyWith$Query$AllServices$services$allServices$storageUsage< + Query$AllServices$services$allServices$storageUsage> + get copyWith => + CopyWith$Query$AllServices$services$allServices$storageUsage( + 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; + + 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}); + CopyWith$Query$AllServices$services$allServices$storageUsage$volume + get volume; +} + +class _CopyWithImpl$Query$AllServices$services$allServices$storageUsage + implements + CopyWith$Query$AllServices$services$allServices$storageUsage { + _CopyWithImpl$Query$AllServices$services$allServices$storageUsage( + this._instance, this._then); + + final Query$AllServices$services$allServices$storageUsage _instance; + + final TRes Function(Query$AllServices$services$allServices$storageUsage) + _then; + + static const _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))); + CopyWith$Query$AllServices$services$allServices$storageUsage$volume + get volume { + final local$volume = _instance.volume; + return local$volume == null + ? CopyWith$Query$AllServices$services$allServices$storageUsage$volume + .stub(_then(_instance)) + : CopyWith$Query$AllServices$services$allServices$storageUsage$volume( + local$volume, (e) => call(volume: e)); + } +} + +class _CopyWithStubImpl$Query$AllServices$services$allServices$storageUsage< + TRes> + implements + CopyWith$Query$AllServices$services$allServices$storageUsage { + _CopyWithStubImpl$Query$AllServices$services$allServices$storageUsage( + this._res); + + TRes _res; + + call( {String? title, String? usedSpace, - Query$AllServices$services$allServices$storageUsage$volume? - Function()? - volume, + Query$AllServices$services$allServices$storageUsage$volume? volume, String? $__typename}) => - Query$AllServices$services$allServices$storageUsage( - title: title == null ? this.title : title, - usedSpace: usedSpace == null ? this.usedSpace : usedSpace, - volume: volume == null ? this.volume : volume(), - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Query$AllServices$services$allServices$storageUsage$volume + get volume => + CopyWith$Query$AllServices$services$allServices$storageUsage$volume + .stub(_res); } @JsonSerializable(explicitToJson: true) @@ -860,11 +1274,65 @@ class Query$AllServices$services$allServices$storageUsage$volume { extension UtilityExtension$Query$AllServices$services$allServices$storageUsage$volume on Query$AllServices$services$allServices$storageUsage$volume { - Query$AllServices$services$allServices$storageUsage$volume copyWith( - {String? name, String? $__typename}) => - Query$AllServices$services$allServices$storageUsage$volume( - name: name == null ? this.name : name, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Query$AllServices$services$allServices$storageUsage$volume< + Query$AllServices$services$allServices$storageUsage$volume> + get copyWith => + CopyWith$Query$AllServices$services$allServices$storageUsage$volume( + 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; + + factory CopyWith$Query$AllServices$services$allServices$storageUsage$volume.stub( + TRes res) = + _CopyWithStubImpl$Query$AllServices$services$allServices$storageUsage$volume; + + TRes call({String? name, String? $__typename}); +} + +class _CopyWithImpl$Query$AllServices$services$allServices$storageUsage$volume< + TRes> + implements + CopyWith$Query$AllServices$services$allServices$storageUsage$volume< + TRes> { + _CopyWithImpl$Query$AllServices$services$allServices$storageUsage$volume( + this._instance, this._then); + + final Query$AllServices$services$allServices$storageUsage$volume _instance; + + final TRes Function( + Query$AllServices$services$allServices$storageUsage$volume) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Query$AllServices$services$allServices$storageUsage$volume< + TRes> + implements + CopyWith$Query$AllServices$services$allServices$storageUsage$volume< + TRes> { + _CopyWithStubImpl$Query$AllServices$services$allServices$storageUsage$volume( + this._res); + + TRes _res; + + call({String? name, String? $__typename}) => _res; } @JsonSerializable(explicitToJson: true) @@ -896,9 +1364,46 @@ class Variables$Mutation$EnableService { return true; } - Variables$Mutation$EnableService copyWith({String? serviceId}) => - Variables$Mutation$EnableService( - serviceId: serviceId == null ? this.serviceId : serviceId); + 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; + + factory CopyWith$Variables$Mutation$EnableService.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$EnableService; + + TRes call({String? serviceId}); +} + +class _CopyWithImpl$Variables$Mutation$EnableService + implements CopyWith$Variables$Mutation$EnableService { + _CopyWithImpl$Variables$Mutation$EnableService(this._instance, this._then); + + final Variables$Mutation$EnableService _instance; + + final TRes Function(Variables$Mutation$EnableService) _then; + + static const _undefined = {}; + + TRes call({Object? serviceId = _undefined}) => + _then(Variables$Mutation$EnableService( + serviceId: serviceId == _undefined || serviceId == null + ? _instance.serviceId + : (serviceId as String))); +} + +class _CopyWithStubImpl$Variables$Mutation$EnableService + implements CopyWith$Variables$Mutation$EnableService { + _CopyWithStubImpl$Variables$Mutation$EnableService(this._res); + + TRes _res; + + call({String? serviceId}) => _res; } @JsonSerializable(explicitToJson: true) @@ -938,13 +1443,63 @@ class Mutation$EnableService { } extension UtilityExtension$Mutation$EnableService on Mutation$EnableService { - Mutation$EnableService copyWith( + CopyWith$Mutation$EnableService get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Mutation$EnableService; + + 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); + + final Mutation$EnableService _instance; + + final TRes Function(Mutation$EnableService) _then; + + static const _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))); + CopyWith$Mutation$EnableService$enableService get enableService { + final local$enableService = _instance.enableService; + return CopyWith$Mutation$EnableService$enableService( + local$enableService, (e) => call(enableService: e)); + } +} + +class _CopyWithStubImpl$Mutation$EnableService + implements CopyWith$Mutation$EnableService { + _CopyWithStubImpl$Mutation$EnableService(this._res); + + TRes _res; + + call( {Mutation$EnableService$enableService? enableService, String? $__typename}) => - Mutation$EnableService( - enableService: - enableService == null ? this.enableService : enableService, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Mutation$EnableService$enableService get enableService => + CopyWith$Mutation$EnableService$enableService.stub(_res); } const documentNodeMutationEnableService = DocumentNode(definitions: [ @@ -1136,13 +1691,63 @@ class Mutation$EnableService$enableService extension UtilityExtension$Mutation$EnableService$enableService on Mutation$EnableService$enableService { - Mutation$EnableService$enableService copyWith( - {int? code, String? message, bool? success, String? $__typename}) => - Mutation$EnableService$enableService( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$EnableService$enableService< + Mutation$EnableService$enableService> + 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; + + factory CopyWith$Mutation$EnableService$enableService.stub(TRes res) = + _CopyWithStubImpl$Mutation$EnableService$enableService; + + 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); + + final Mutation$EnableService$enableService _instance; + + final TRes Function(Mutation$EnableService$enableService) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Mutation$EnableService$enableService + implements CopyWith$Mutation$EnableService$enableService { + _CopyWithStubImpl$Mutation$EnableService$enableService(this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -1174,9 +1779,47 @@ class Variables$Mutation$DisableService { return true; } - Variables$Mutation$DisableService copyWith({String? serviceId}) => - Variables$Mutation$DisableService( - serviceId: serviceId == null ? this.serviceId : serviceId); + 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; + + factory CopyWith$Variables$Mutation$DisableService.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$DisableService; + + TRes call({String? serviceId}); +} + +class _CopyWithImpl$Variables$Mutation$DisableService + implements CopyWith$Variables$Mutation$DisableService { + _CopyWithImpl$Variables$Mutation$DisableService(this._instance, this._then); + + final Variables$Mutation$DisableService _instance; + + final TRes Function(Variables$Mutation$DisableService) _then; + + static const _undefined = {}; + + TRes call({Object? serviceId = _undefined}) => + _then(Variables$Mutation$DisableService( + serviceId: serviceId == _undefined || serviceId == null + ? _instance.serviceId + : (serviceId as String))); +} + +class _CopyWithStubImpl$Variables$Mutation$DisableService + implements CopyWith$Variables$Mutation$DisableService { + _CopyWithStubImpl$Variables$Mutation$DisableService(this._res); + + TRes _res; + + call({String? serviceId}) => _res; } @JsonSerializable(explicitToJson: true) @@ -1216,13 +1859,63 @@ class Mutation$DisableService { } extension UtilityExtension$Mutation$DisableService on Mutation$DisableService { - Mutation$DisableService copyWith( + CopyWith$Mutation$DisableService get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Mutation$DisableService; + + 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); + + final Mutation$DisableService _instance; + + final TRes Function(Mutation$DisableService) _then; + + static const _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))); + CopyWith$Mutation$DisableService$disableService get disableService { + final local$disableService = _instance.disableService; + return CopyWith$Mutation$DisableService$disableService( + local$disableService, (e) => call(disableService: e)); + } +} + +class _CopyWithStubImpl$Mutation$DisableService + implements CopyWith$Mutation$DisableService { + _CopyWithStubImpl$Mutation$DisableService(this._res); + + TRes _res; + + call( {Mutation$DisableService$disableService? disableService, String? $__typename}) => - Mutation$DisableService( - disableService: - disableService == null ? this.disableService : disableService, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Mutation$DisableService$disableService get disableService => + CopyWith$Mutation$DisableService$disableService.stub(_res); } const documentNodeMutationDisableService = DocumentNode(definitions: [ @@ -1414,13 +2107,63 @@ class Mutation$DisableService$disableService extension UtilityExtension$Mutation$DisableService$disableService on Mutation$DisableService$disableService { - Mutation$DisableService$disableService copyWith( - {int? code, String? message, bool? success, String? $__typename}) => - Mutation$DisableService$disableService( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$DisableService$disableService< + Mutation$DisableService$disableService> + 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; + + factory CopyWith$Mutation$DisableService$disableService.stub(TRes res) = + _CopyWithStubImpl$Mutation$DisableService$disableService; + + 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); + + final Mutation$DisableService$disableService _instance; + + final TRes Function(Mutation$DisableService$disableService) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Mutation$DisableService$disableService + implements CopyWith$Mutation$DisableService$disableService { + _CopyWithStubImpl$Mutation$DisableService$disableService(this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -1450,9 +2193,46 @@ class Variables$Mutation$StopService { return true; } - Variables$Mutation$StopService copyWith({String? serviceId}) => - Variables$Mutation$StopService( - serviceId: serviceId == null ? this.serviceId : serviceId); + 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; + + factory CopyWith$Variables$Mutation$StopService.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$StopService; + + TRes call({String? serviceId}); +} + +class _CopyWithImpl$Variables$Mutation$StopService + implements CopyWith$Variables$Mutation$StopService { + _CopyWithImpl$Variables$Mutation$StopService(this._instance, this._then); + + final Variables$Mutation$StopService _instance; + + final TRes Function(Variables$Mutation$StopService) _then; + + static const _undefined = {}; + + TRes call({Object? serviceId = _undefined}) => + _then(Variables$Mutation$StopService( + serviceId: serviceId == _undefined || serviceId == null + ? _instance.serviceId + : (serviceId as String))); +} + +class _CopyWithStubImpl$Variables$Mutation$StopService + implements CopyWith$Variables$Mutation$StopService { + _CopyWithStubImpl$Variables$Mutation$StopService(this._res); + + TRes _res; + + call({String? serviceId}) => _res; } @JsonSerializable(explicitToJson: true) @@ -1491,12 +2271,60 @@ class Mutation$StopService { } extension UtilityExtension$Mutation$StopService on Mutation$StopService { - Mutation$StopService copyWith( - {Mutation$StopService$stopService? stopService, - String? $__typename}) => - Mutation$StopService( - stopService: stopService == null ? this.stopService : stopService, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$StopService get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Mutation$StopService; + + 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); + + final Mutation$StopService _instance; + + final TRes Function(Mutation$StopService) _then; + + static const _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))); + CopyWith$Mutation$StopService$stopService get stopService { + final local$stopService = _instance.stopService; + return CopyWith$Mutation$StopService$stopService( + local$stopService, (e) => call(stopService: e)); + } +} + +class _CopyWithStubImpl$Mutation$StopService + implements CopyWith$Mutation$StopService { + _CopyWithStubImpl$Mutation$StopService(this._res); + + TRes _res; + + call({Mutation$StopService$stopService? stopService, String? $__typename}) => + _res; + CopyWith$Mutation$StopService$stopService get stopService => + CopyWith$Mutation$StopService$stopService.stub(_res); } const documentNodeMutationStopService = DocumentNode(definitions: [ @@ -1685,13 +2513,60 @@ class Mutation$StopService$stopService extension UtilityExtension$Mutation$StopService$stopService on Mutation$StopService$stopService { - Mutation$StopService$stopService copyWith( - {int? code, String? message, bool? success, String? $__typename}) => - Mutation$StopService$stopService( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$StopService$stopService + 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; + + factory CopyWith$Mutation$StopService$stopService.stub(TRes res) = + _CopyWithStubImpl$Mutation$StopService$stopService; + + 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); + + final Mutation$StopService$stopService _instance; + + final TRes Function(Mutation$StopService$stopService) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Mutation$StopService$stopService + implements CopyWith$Mutation$StopService$stopService { + _CopyWithStubImpl$Mutation$StopService$stopService(this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -1722,9 +2597,46 @@ class Variables$Mutation$StartService { return true; } - Variables$Mutation$StartService copyWith({String? serviceId}) => - Variables$Mutation$StartService( - serviceId: serviceId == null ? this.serviceId : serviceId); + 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; + + factory CopyWith$Variables$Mutation$StartService.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$StartService; + + TRes call({String? serviceId}); +} + +class _CopyWithImpl$Variables$Mutation$StartService + implements CopyWith$Variables$Mutation$StartService { + _CopyWithImpl$Variables$Mutation$StartService(this._instance, this._then); + + final Variables$Mutation$StartService _instance; + + final TRes Function(Variables$Mutation$StartService) _then; + + static const _undefined = {}; + + TRes call({Object? serviceId = _undefined}) => + _then(Variables$Mutation$StartService( + serviceId: serviceId == _undefined || serviceId == null + ? _instance.serviceId + : (serviceId as String))); +} + +class _CopyWithStubImpl$Variables$Mutation$StartService + implements CopyWith$Variables$Mutation$StartService { + _CopyWithStubImpl$Variables$Mutation$StartService(this._res); + + TRes _res; + + call({String? serviceId}) => _res; } @JsonSerializable(explicitToJson: true) @@ -1764,12 +2676,62 @@ class Mutation$StartService { } extension UtilityExtension$Mutation$StartService on Mutation$StartService { - Mutation$StartService copyWith( + CopyWith$Mutation$StartService get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Mutation$StartService; + + 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); + + final Mutation$StartService _instance; + + final TRes Function(Mutation$StartService) _then; + + static const _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))); + CopyWith$Mutation$StartService$startService get startService { + final local$startService = _instance.startService; + return CopyWith$Mutation$StartService$startService( + local$startService, (e) => call(startService: e)); + } +} + +class _CopyWithStubImpl$Mutation$StartService + implements CopyWith$Mutation$StartService { + _CopyWithStubImpl$Mutation$StartService(this._res); + + TRes _res; + + call( {Mutation$StartService$startService? startService, String? $__typename}) => - Mutation$StartService( - startService: startService == null ? this.startService : startService, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Mutation$StartService$startService get startService => + CopyWith$Mutation$StartService$startService.stub(_res); } const documentNodeMutationStartService = DocumentNode(definitions: [ @@ -1961,13 +2923,62 @@ class Mutation$StartService$startService extension UtilityExtension$Mutation$StartService$startService on Mutation$StartService$startService { - Mutation$StartService$startService copyWith( - {int? code, String? message, bool? success, String? $__typename}) => - Mutation$StartService$startService( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$StartService$startService< + Mutation$StartService$startService> + 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; + + factory CopyWith$Mutation$StartService$startService.stub(TRes res) = + _CopyWithStubImpl$Mutation$StartService$startService; + + 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); + + final Mutation$StartService$startService _instance; + + final TRes Function(Mutation$StartService$startService) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Mutation$StartService$startService + implements CopyWith$Mutation$StartService$startService { + _CopyWithStubImpl$Mutation$StartService$startService(this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -1999,9 +3010,47 @@ class Variables$Mutation$RestartService { return true; } - Variables$Mutation$RestartService copyWith({String? serviceId}) => - Variables$Mutation$RestartService( - serviceId: serviceId == null ? this.serviceId : serviceId); + 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; + + factory CopyWith$Variables$Mutation$RestartService.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$RestartService; + + TRes call({String? serviceId}); +} + +class _CopyWithImpl$Variables$Mutation$RestartService + implements CopyWith$Variables$Mutation$RestartService { + _CopyWithImpl$Variables$Mutation$RestartService(this._instance, this._then); + + final Variables$Mutation$RestartService _instance; + + final TRes Function(Variables$Mutation$RestartService) _then; + + static const _undefined = {}; + + TRes call({Object? serviceId = _undefined}) => + _then(Variables$Mutation$RestartService( + serviceId: serviceId == _undefined || serviceId == null + ? _instance.serviceId + : (serviceId as String))); +} + +class _CopyWithStubImpl$Variables$Mutation$RestartService + implements CopyWith$Variables$Mutation$RestartService { + _CopyWithStubImpl$Variables$Mutation$RestartService(this._res); + + TRes _res; + + call({String? serviceId}) => _res; } @JsonSerializable(explicitToJson: true) @@ -2041,13 +3090,63 @@ class Mutation$RestartService { } extension UtilityExtension$Mutation$RestartService on Mutation$RestartService { - Mutation$RestartService copyWith( + CopyWith$Mutation$RestartService get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Mutation$RestartService; + + 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); + + final Mutation$RestartService _instance; + + final TRes Function(Mutation$RestartService) _then; + + static const _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))); + CopyWith$Mutation$RestartService$restartService get restartService { + final local$restartService = _instance.restartService; + return CopyWith$Mutation$RestartService$restartService( + local$restartService, (e) => call(restartService: e)); + } +} + +class _CopyWithStubImpl$Mutation$RestartService + implements CopyWith$Mutation$RestartService { + _CopyWithStubImpl$Mutation$RestartService(this._res); + + TRes _res; + + call( {Mutation$RestartService$restartService? restartService, String? $__typename}) => - Mutation$RestartService( - restartService: - restartService == null ? this.restartService : restartService, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Mutation$RestartService$restartService get restartService => + CopyWith$Mutation$RestartService$restartService.stub(_res); } const documentNodeMutationRestartService = DocumentNode(definitions: [ @@ -2239,13 +3338,63 @@ class Mutation$RestartService$restartService extension UtilityExtension$Mutation$RestartService$restartService on Mutation$RestartService$restartService { - Mutation$RestartService$restartService copyWith( - {int? code, String? message, bool? success, String? $__typename}) => - Mutation$RestartService$restartService( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$RestartService$restartService< + Mutation$RestartService$restartService> + 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; + + factory CopyWith$Mutation$RestartService$restartService.stub(TRes res) = + _CopyWithStubImpl$Mutation$RestartService$restartService; + + 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); + + final Mutation$RestartService$restartService _instance; + + final TRes Function(Mutation$RestartService$restartService) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Mutation$RestartService$restartService + implements CopyWith$Mutation$RestartService$restartService { + _CopyWithStubImpl$Mutation$RestartService$restartService(this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -2275,8 +3424,46 @@ class Variables$Mutation$MoveService { return true; } - Variables$Mutation$MoveService copyWith({Input$MoveServiceInput? input}) => - Variables$Mutation$MoveService(input: input == null ? this.input : input); + 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; + + factory CopyWith$Variables$Mutation$MoveService.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$MoveService; + + TRes call({Input$MoveServiceInput? input}); +} + +class _CopyWithImpl$Variables$Mutation$MoveService + implements CopyWith$Variables$Mutation$MoveService { + _CopyWithImpl$Variables$Mutation$MoveService(this._instance, this._then); + + final Variables$Mutation$MoveService _instance; + + final TRes Function(Variables$Mutation$MoveService) _then; + + static const _undefined = {}; + + TRes call({Object? input = _undefined}) => + _then(Variables$Mutation$MoveService( + input: input == _undefined || input == null + ? _instance.input + : (input as Input$MoveServiceInput))); +} + +class _CopyWithStubImpl$Variables$Mutation$MoveService + implements CopyWith$Variables$Mutation$MoveService { + _CopyWithStubImpl$Variables$Mutation$MoveService(this._res); + + TRes _res; + + call({Input$MoveServiceInput? input}) => _res; } @JsonSerializable(explicitToJson: true) @@ -2315,12 +3502,60 @@ class Mutation$MoveService { } extension UtilityExtension$Mutation$MoveService on Mutation$MoveService { - Mutation$MoveService copyWith( - {Mutation$MoveService$moveService? moveService, - String? $__typename}) => - Mutation$MoveService( - moveService: moveService == null ? this.moveService : moveService, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$MoveService get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Mutation$MoveService; + + 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); + + final Mutation$MoveService _instance; + + final TRes Function(Mutation$MoveService) _then; + + static const _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))); + CopyWith$Mutation$MoveService$moveService get moveService { + final local$moveService = _instance.moveService; + return CopyWith$Mutation$MoveService$moveService( + local$moveService, (e) => call(moveService: e)); + } +} + +class _CopyWithStubImpl$Mutation$MoveService + implements CopyWith$Mutation$MoveService { + _CopyWithStubImpl$Mutation$MoveService(this._res); + + TRes _res; + + call({Mutation$MoveService$moveService? moveService, String? $__typename}) => + _res; + CopyWith$Mutation$MoveService$moveService get moveService => + CopyWith$Mutation$MoveService$moveService.stub(_res); } const documentNodeMutationMoveService = DocumentNode(definitions: [ @@ -2595,18 +3830,84 @@ class Mutation$MoveService$moveService extension UtilityExtension$Mutation$MoveService$moveService on Mutation$MoveService$moveService { - Mutation$MoveService$moveService copyWith( + CopyWith$Mutation$MoveService$moveService + 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; + + 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}); + 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); + + final Mutation$MoveService$moveService _instance; + + final TRes Function(Mutation$MoveService$moveService) _then; + + static const _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?))); + CopyWith$Mutation$MoveService$moveService$job get job { + final local$job = _instance.job; + return local$job == null + ? CopyWith$Mutation$MoveService$moveService$job.stub(_then(_instance)) + : CopyWith$Mutation$MoveService$moveService$job( + local$job, (e) => call(job: e)); + } +} + +class _CopyWithStubImpl$Mutation$MoveService$moveService + implements CopyWith$Mutation$MoveService$moveService { + _CopyWithStubImpl$Mutation$MoveService$moveService(this._res); + + TRes _res; + + call( {int? code, String? message, bool? success, String? $__typename, - Mutation$MoveService$moveService$job? Function()? job}) => - Mutation$MoveService$moveService( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename, - job: job == null ? this.job : job()); + Mutation$MoveService$moveService$job? job}) => + _res; + CopyWith$Mutation$MoveService$moveService$job get job => + CopyWith$Mutation$MoveService$moveService$job.stub(_res); } @JsonSerializable(explicitToJson: true) @@ -2737,32 +4038,114 @@ class Mutation$MoveService$moveService$job { extension UtilityExtension$Mutation$MoveService$moveService$job on Mutation$MoveService$moveService$job { - Mutation$MoveService$moveService$job copyWith( + CopyWith$Mutation$MoveService$moveService$job< + Mutation$MoveService$moveService$job> + 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; + + 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}); +} + +class _CopyWithImpl$Mutation$MoveService$moveService$job + implements CopyWith$Mutation$MoveService$moveService$job { + _CopyWithImpl$Mutation$MoveService$moveService$job( + this._instance, this._then); + + final Mutation$MoveService$moveService$job _instance; + + final TRes Function(Mutation$MoveService$moveService$job) _then; + + 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}) => + _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))); +} + +class _CopyWithStubImpl$Mutation$MoveService$moveService$job + implements CopyWith$Mutation$MoveService$moveService$job { + _CopyWithStubImpl$Mutation$MoveService$moveService$job(this._res); + + TRes _res; + + call( {DateTime? createdAt, String? description, - String? Function()? error, - DateTime? Function()? finishedAt, + String? error, + DateTime? finishedAt, String? name, - int? Function()? progress, - String? Function()? result, + int? progress, + String? result, String? status, - String? Function()? statusText, + String? statusText, String? uid, DateTime? updatedAt, String? $__typename}) => - Mutation$MoveService$moveService$job( - createdAt: createdAt == null ? this.createdAt : createdAt, - description: description == null ? this.description : description, - error: error == null ? this.error : error(), - finishedAt: finishedAt == null ? this.finishedAt : finishedAt(), - name: name == null ? this.name : name, - progress: progress == null ? this.progress : progress(), - result: result == null ? this.result : result(), - status: status == null ? this.status : status, - statusText: statusText == null ? this.statusText : statusText(), - uid: uid == null ? this.uid : uid, - updatedAt: updatedAt == null ? this.updatedAt : updatedAt, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; } DateTime? _nullable$dateTimeFromJson(dynamic 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 index c88900b1..405ab468 100644 --- a/lib/logic/api_maps/graphql_maps/schema/services.graphql.g.dart +++ b/lib/logic/api_maps/graphql_maps/schema/services.graphql.g.dart @@ -89,7 +89,7 @@ Map _$Query$AllServices$services$allServicesToJson( 'isEnabled': instance.isEnabled, 'isMovable': instance.isMovable, 'isRequired': instance.isRequired, - 'status': _$Enum$ServiceStatusEnumEnumMap[instance.status], + 'status': _$Enum$ServiceStatusEnumEnumMap[instance.status]!, 'storageUsage': instance.storageUsage.toJson(), 'svgIcon': instance.svgIcon, 'url': instance.url, 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 81f3fd8c..4fa5cac1 100644 --- a/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart @@ -61,13 +61,62 @@ class Fragment$basicMutationReturnFields { extension UtilityExtension$Fragment$basicMutationReturnFields on Fragment$basicMutationReturnFields { - Fragment$basicMutationReturnFields copyWith( - {int? code, String? message, bool? success, String? $__typename}) => - Fragment$basicMutationReturnFields( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Fragment$basicMutationReturnFields< + Fragment$basicMutationReturnFields> + 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; + + factory CopyWith$Fragment$basicMutationReturnFields.stub(TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields; + + 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); + + final Fragment$basicMutationReturnFields _instance; + + final TRes Function(Fragment$basicMutationReturnFields) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Fragment$basicMutationReturnFields + implements CopyWith$Fragment$basicMutationReturnFields { + _CopyWithStubImpl$Fragment$basicMutationReturnFields(this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; } const fragmentDefinitionbasicMutationReturnFields = FragmentDefinitionNode( @@ -164,8 +213,45 @@ class Variables$Mutation$CreateUser { return true; } - Variables$Mutation$CreateUser copyWith({Input$UserMutationInput? user}) => - Variables$Mutation$CreateUser(user: user == null ? this.user : user); + 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; + + factory CopyWith$Variables$Mutation$CreateUser.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$CreateUser; + + TRes call({Input$UserMutationInput? user}); +} + +class _CopyWithImpl$Variables$Mutation$CreateUser + implements CopyWith$Variables$Mutation$CreateUser { + _CopyWithImpl$Variables$Mutation$CreateUser(this._instance, this._then); + + final Variables$Mutation$CreateUser _instance; + + final TRes Function(Variables$Mutation$CreateUser) _then; + + static const _undefined = {}; + + TRes call({Object? user = _undefined}) => _then(Variables$Mutation$CreateUser( + user: user == _undefined || user == null + ? _instance.user + : (user as Input$UserMutationInput))); +} + +class _CopyWithStubImpl$Variables$Mutation$CreateUser + implements CopyWith$Variables$Mutation$CreateUser { + _CopyWithStubImpl$Variables$Mutation$CreateUser(this._res); + + TRes _res; + + call({Input$UserMutationInput? user}) => _res; } @JsonSerializable(explicitToJson: true) @@ -204,11 +290,59 @@ class Mutation$CreateUser { } extension UtilityExtension$Mutation$CreateUser on Mutation$CreateUser { - Mutation$CreateUser copyWith( - {Mutation$CreateUser$createUser? createUser, String? $__typename}) => - Mutation$CreateUser( - createUser: createUser == null ? this.createUser : createUser, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$CreateUser get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Mutation$CreateUser; + + 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); + + final Mutation$CreateUser _instance; + + final TRes Function(Mutation$CreateUser) _then; + + static const _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))); + CopyWith$Mutation$CreateUser$createUser get createUser { + final local$createUser = _instance.createUser; + return CopyWith$Mutation$CreateUser$createUser( + local$createUser, (e) => call(createUser: e)); + } +} + +class _CopyWithStubImpl$Mutation$CreateUser + implements CopyWith$Mutation$CreateUser { + _CopyWithStubImpl$Mutation$CreateUser(this._res); + + TRes _res; + + call({Mutation$CreateUser$createUser? createUser, String? $__typename}) => + _res; + CopyWith$Mutation$CreateUser$createUser get createUser => + CopyWith$Mutation$CreateUser$createUser.stub(_res); } const documentNodeMutationCreateUser = DocumentNode(definitions: [ @@ -433,18 +567,84 @@ class Mutation$CreateUser$createUser extension UtilityExtension$Mutation$CreateUser$createUser on Mutation$CreateUser$createUser { - Mutation$CreateUser$createUser copyWith( + CopyWith$Mutation$CreateUser$createUser + 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; + + factory CopyWith$Mutation$CreateUser$createUser.stub(TRes res) = + _CopyWithStubImpl$Mutation$CreateUser$createUser; + + TRes call( + {int? code, + String? message, + bool? success, + String? $__typename, + Mutation$CreateUser$createUser$user? user}); + CopyWith$Mutation$CreateUser$createUser$user get user; +} + +class _CopyWithImpl$Mutation$CreateUser$createUser + implements CopyWith$Mutation$CreateUser$createUser { + _CopyWithImpl$Mutation$CreateUser$createUser(this._instance, this._then); + + final Mutation$CreateUser$createUser _instance; + + final TRes Function(Mutation$CreateUser$createUser) _then; + + static const _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 Mutation$CreateUser$createUser$user?))); + CopyWith$Mutation$CreateUser$createUser$user get user { + final local$user = _instance.user; + return local$user == null + ? CopyWith$Mutation$CreateUser$createUser$user.stub(_then(_instance)) + : CopyWith$Mutation$CreateUser$createUser$user( + local$user, (e) => call(user: e)); + } +} + +class _CopyWithStubImpl$Mutation$CreateUser$createUser + implements CopyWith$Mutation$CreateUser$createUser { + _CopyWithStubImpl$Mutation$CreateUser$createUser(this._res); + + TRes _res; + + call( {int? code, String? message, bool? success, String? $__typename, - Mutation$CreateUser$createUser$user? Function()? user}) => - Mutation$CreateUser$createUser( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename, - user: user == null ? this.user : user()); + Mutation$CreateUser$createUser$user? user}) => + _res; + CopyWith$Mutation$CreateUser$createUser$user get user => + CopyWith$Mutation$CreateUser$createUser$user.stub(_res); } @JsonSerializable(explicitToJson: true) @@ -514,16 +714,70 @@ class Mutation$CreateUser$createUser$user { extension UtilityExtension$Mutation$CreateUser$createUser$user on Mutation$CreateUser$createUser$user { - Mutation$CreateUser$createUser$user copyWith( + CopyWith$Mutation$CreateUser$createUser$user< + Mutation$CreateUser$createUser$user> + get copyWith => + CopyWith$Mutation$CreateUser$createUser$user(this, (i) => i); +} + +abstract class CopyWith$Mutation$CreateUser$createUser$user { + factory CopyWith$Mutation$CreateUser$createUser$user( + Mutation$CreateUser$createUser$user instance, + TRes Function(Mutation$CreateUser$createUser$user) then) = + _CopyWithImpl$Mutation$CreateUser$createUser$user; + + factory CopyWith$Mutation$CreateUser$createUser$user.stub(TRes res) = + _CopyWithStubImpl$Mutation$CreateUser$createUser$user; + + TRes call( + {String? username, + Enum$UserType? userType, + List? sshKeys, + String? $__typename}); +} + +class _CopyWithImpl$Mutation$CreateUser$createUser$user + implements CopyWith$Mutation$CreateUser$createUser$user { + _CopyWithImpl$Mutation$CreateUser$createUser$user(this._instance, this._then); + + final Mutation$CreateUser$createUser$user _instance; + + final TRes Function(Mutation$CreateUser$createUser$user) _then; + + static const _undefined = {}; + + TRes call( + {Object? username = _undefined, + Object? userType = _undefined, + Object? sshKeys = _undefined, + Object? $__typename = _undefined}) => + _then(Mutation$CreateUser$createUser$user( + 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$Mutation$CreateUser$createUser$user + implements CopyWith$Mutation$CreateUser$createUser$user { + _CopyWithStubImpl$Mutation$CreateUser$createUser$user(this._res); + + TRes _res; + + call( {String? username, Enum$UserType? userType, List? sshKeys, String? $__typename}) => - Mutation$CreateUser$createUser$user( - username: username == null ? this.username : username, - userType: userType == null ? this.userType : userType, - sshKeys: sshKeys == null ? this.sshKeys : sshKeys, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; } @JsonSerializable(explicitToJson: true) @@ -562,10 +816,55 @@ class Query$AllUsers { } extension UtilityExtension$Query$AllUsers on Query$AllUsers { - Query$AllUsers copyWith({Query$AllUsers$users? users, String? $__typename}) => - Query$AllUsers( - users: users == null ? this.users : users, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Query$AllUsers get copyWith => + 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; + + factory CopyWith$Query$AllUsers.stub(TRes res) = + _CopyWithStubImpl$Query$AllUsers; + + 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); + + final Query$AllUsers _instance; + + final TRes Function(Query$AllUsers) _then; + + static const _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))); + CopyWith$Query$AllUsers$users get users { + final local$users = _instance.users; + return CopyWith$Query$AllUsers$users(local$users, (e) => call(users: e)); + } +} + +class _CopyWithStubImpl$Query$AllUsers + implements CopyWith$Query$AllUsers { + _CopyWithStubImpl$Query$AllUsers(this._res); + + TRes _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: [ @@ -751,12 +1050,68 @@ class Query$AllUsers$users { } extension UtilityExtension$Query$AllUsers$users on Query$AllUsers$users { - Query$AllUsers$users copyWith( - {List? allUsers, - String? $__typename}) => - Query$AllUsers$users( - allUsers: allUsers == null ? this.allUsers : allUsers, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Query$AllUsers$users get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Query$AllUsers$users; + + TRes call( + {List? allUsers, String? $__typename}); + TRes allUsers( + Iterable Function( + Iterable< + CopyWith$Query$AllUsers$users$allUsers< + Query$AllUsers$users$allUsers>>) + _fn); +} + +class _CopyWithImpl$Query$AllUsers$users + implements CopyWith$Query$AllUsers$users { + _CopyWithImpl$Query$AllUsers$users(this._instance, this._then); + + final Query$AllUsers$users _instance; + + final TRes Function(Query$AllUsers$users) _then; + + static const _undefined = {}; + + TRes call( + {Object? allUsers = _undefined, Object? $__typename = _undefined}) => + _then(Query$AllUsers$users( + allUsers: allUsers == _undefined || allUsers == null + ? _instance.allUsers + : (allUsers as List), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); + TRes allUsers( + Iterable Function( + Iterable< + CopyWith$Query$AllUsers$users$allUsers< + Query$AllUsers$users$allUsers>>) + _fn) => + call( + allUsers: _fn(_instance.allUsers.map( + (e) => CopyWith$Query$AllUsers$users$allUsers(e, (i) => i))) + .toList()); +} + +class _CopyWithStubImpl$Query$AllUsers$users + implements CopyWith$Query$AllUsers$users { + _CopyWithStubImpl$Query$AllUsers$users(this._res); + + TRes _res; + + call({List? allUsers, String? $__typename}) => + _res; + allUsers(_fn) => _res; } @JsonSerializable(explicitToJson: true) @@ -824,16 +1179,68 @@ class Query$AllUsers$users$allUsers { extension UtilityExtension$Query$AllUsers$users$allUsers on Query$AllUsers$users$allUsers { - Query$AllUsers$users$allUsers copyWith( + CopyWith$Query$AllUsers$users$allUsers + get copyWith => CopyWith$Query$AllUsers$users$allUsers(this, (i) => i); +} + +abstract class CopyWith$Query$AllUsers$users$allUsers { + factory CopyWith$Query$AllUsers$users$allUsers( + Query$AllUsers$users$allUsers instance, + TRes Function(Query$AllUsers$users$allUsers) then) = + _CopyWithImpl$Query$AllUsers$users$allUsers; + + factory CopyWith$Query$AllUsers$users$allUsers.stub(TRes res) = + _CopyWithStubImpl$Query$AllUsers$users$allUsers; + + TRes call( + {Enum$UserType? userType, + String? username, + List? sshKeys, + String? $__typename}); +} + +class _CopyWithImpl$Query$AllUsers$users$allUsers + implements CopyWith$Query$AllUsers$users$allUsers { + _CopyWithImpl$Query$AllUsers$users$allUsers(this._instance, this._then); + + final Query$AllUsers$users$allUsers _instance; + + final TRes Function(Query$AllUsers$users$allUsers) _then; + + static const _undefined = {}; + + TRes call( + {Object? userType = _undefined, + Object? username = _undefined, + Object? sshKeys = _undefined, + Object? $__typename = _undefined}) => + _then(Query$AllUsers$users$allUsers( + userType: userType == _undefined || userType == null + ? _instance.userType + : (userType as Enum$UserType), + username: username == _undefined || username == null + ? _instance.username + : (username as String), + sshKeys: sshKeys == _undefined || sshKeys == null + ? _instance.sshKeys + : (sshKeys as List), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); +} + +class _CopyWithStubImpl$Query$AllUsers$users$allUsers + implements CopyWith$Query$AllUsers$users$allUsers { + _CopyWithStubImpl$Query$AllUsers$users$allUsers(this._res); + + TRes _res; + + call( {Enum$UserType? userType, String? username, List? sshKeys, String? $__typename}) => - Query$AllUsers$users$allUsers( - userType: userType == null ? this.userType : userType, - username: username == null ? this.username : username, - sshKeys: sshKeys == null ? this.sshKeys : sshKeys, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; } @JsonSerializable(explicitToJson: true) @@ -863,9 +1270,46 @@ class Variables$Mutation$AddSshKey { return true; } - Variables$Mutation$AddSshKey copyWith({Input$SshMutationInput? sshInput}) => - Variables$Mutation$AddSshKey( - sshInput: sshInput == null ? this.sshInput : sshInput); + 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; + + factory CopyWith$Variables$Mutation$AddSshKey.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$AddSshKey; + + TRes call({Input$SshMutationInput? sshInput}); +} + +class _CopyWithImpl$Variables$Mutation$AddSshKey + implements CopyWith$Variables$Mutation$AddSshKey { + _CopyWithImpl$Variables$Mutation$AddSshKey(this._instance, this._then); + + final Variables$Mutation$AddSshKey _instance; + + final TRes Function(Variables$Mutation$AddSshKey) _then; + + static const _undefined = {}; + + TRes call({Object? sshInput = _undefined}) => + _then(Variables$Mutation$AddSshKey( + sshInput: sshInput == _undefined || sshInput == null + ? _instance.sshInput + : (sshInput as Input$SshMutationInput))); +} + +class _CopyWithStubImpl$Variables$Mutation$AddSshKey + implements CopyWith$Variables$Mutation$AddSshKey { + _CopyWithStubImpl$Variables$Mutation$AddSshKey(this._res); + + TRes _res; + + call({Input$SshMutationInput? sshInput}) => _res; } @JsonSerializable(explicitToJson: true) @@ -904,11 +1348,57 @@ class Mutation$AddSshKey { } extension UtilityExtension$Mutation$AddSshKey on Mutation$AddSshKey { - Mutation$AddSshKey copyWith( - {Mutation$AddSshKey$addSshKey? addSshKey, String? $__typename}) => - Mutation$AddSshKey( - addSshKey: addSshKey == null ? this.addSshKey : addSshKey, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$AddSshKey get copyWith => + 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; + + factory CopyWith$Mutation$AddSshKey.stub(TRes res) = + _CopyWithStubImpl$Mutation$AddSshKey; + + 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); + + final Mutation$AddSshKey _instance; + + final TRes Function(Mutation$AddSshKey) _then; + + static const _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))); + CopyWith$Mutation$AddSshKey$addSshKey get addSshKey { + final local$addSshKey = _instance.addSshKey; + return CopyWith$Mutation$AddSshKey$addSshKey( + local$addSshKey, (e) => call(addSshKey: e)); + } +} + +class _CopyWithStubImpl$Mutation$AddSshKey + implements CopyWith$Mutation$AddSshKey { + _CopyWithStubImpl$Mutation$AddSshKey(this._res); + + TRes _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: [ @@ -1133,18 +1623,84 @@ class Mutation$AddSshKey$addSshKey extension UtilityExtension$Mutation$AddSshKey$addSshKey on Mutation$AddSshKey$addSshKey { - Mutation$AddSshKey$addSshKey copyWith( + CopyWith$Mutation$AddSshKey$addSshKey + 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; + + factory CopyWith$Mutation$AddSshKey$addSshKey.stub(TRes res) = + _CopyWithStubImpl$Mutation$AddSshKey$addSshKey; + + TRes call( + {int? code, + String? message, + bool? success, + String? $__typename, + Mutation$AddSshKey$addSshKey$user? user}); + CopyWith$Mutation$AddSshKey$addSshKey$user get user; +} + +class _CopyWithImpl$Mutation$AddSshKey$addSshKey + implements CopyWith$Mutation$AddSshKey$addSshKey { + _CopyWithImpl$Mutation$AddSshKey$addSshKey(this._instance, this._then); + + final Mutation$AddSshKey$addSshKey _instance; + + final TRes Function(Mutation$AddSshKey$addSshKey) _then; + + static const _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 Mutation$AddSshKey$addSshKey$user?))); + CopyWith$Mutation$AddSshKey$addSshKey$user get user { + final local$user = _instance.user; + return local$user == null + ? CopyWith$Mutation$AddSshKey$addSshKey$user.stub(_then(_instance)) + : CopyWith$Mutation$AddSshKey$addSshKey$user( + local$user, (e) => call(user: e)); + } +} + +class _CopyWithStubImpl$Mutation$AddSshKey$addSshKey + implements CopyWith$Mutation$AddSshKey$addSshKey { + _CopyWithStubImpl$Mutation$AddSshKey$addSshKey(this._res); + + TRes _res; + + call( {int? code, String? message, bool? success, String? $__typename, - Mutation$AddSshKey$addSshKey$user? Function()? user}) => - Mutation$AddSshKey$addSshKey( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename, - user: user == null ? this.user : user()); + Mutation$AddSshKey$addSshKey$user? user}) => + _res; + CopyWith$Mutation$AddSshKey$addSshKey$user get user => + CopyWith$Mutation$AddSshKey$addSshKey$user.stub(_res); } @JsonSerializable(explicitToJson: true) @@ -1214,16 +1770,69 @@ class Mutation$AddSshKey$addSshKey$user { extension UtilityExtension$Mutation$AddSshKey$addSshKey$user on Mutation$AddSshKey$addSshKey$user { - Mutation$AddSshKey$addSshKey$user copyWith( + CopyWith$Mutation$AddSshKey$addSshKey$user + get copyWith => + CopyWith$Mutation$AddSshKey$addSshKey$user(this, (i) => i); +} + +abstract class CopyWith$Mutation$AddSshKey$addSshKey$user { + factory CopyWith$Mutation$AddSshKey$addSshKey$user( + Mutation$AddSshKey$addSshKey$user instance, + TRes Function(Mutation$AddSshKey$addSshKey$user) then) = + _CopyWithImpl$Mutation$AddSshKey$addSshKey$user; + + factory CopyWith$Mutation$AddSshKey$addSshKey$user.stub(TRes res) = + _CopyWithStubImpl$Mutation$AddSshKey$addSshKey$user; + + TRes call( + {List? sshKeys, + Enum$UserType? userType, + String? username, + String? $__typename}); +} + +class _CopyWithImpl$Mutation$AddSshKey$addSshKey$user + implements CopyWith$Mutation$AddSshKey$addSshKey$user { + _CopyWithImpl$Mutation$AddSshKey$addSshKey$user(this._instance, this._then); + + final Mutation$AddSshKey$addSshKey$user _instance; + + final TRes Function(Mutation$AddSshKey$addSshKey$user) _then; + + static const _undefined = {}; + + TRes call( + {Object? sshKeys = _undefined, + Object? userType = _undefined, + Object? username = _undefined, + Object? $__typename = _undefined}) => + _then(Mutation$AddSshKey$addSshKey$user( + sshKeys: sshKeys == _undefined || sshKeys == null + ? _instance.sshKeys + : (sshKeys as List), + userType: userType == _undefined || userType == null + ? _instance.userType + : (userType as Enum$UserType), + username: username == _undefined || username == null + ? _instance.username + : (username as String), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); +} + +class _CopyWithStubImpl$Mutation$AddSshKey$addSshKey$user + implements CopyWith$Mutation$AddSshKey$addSshKey$user { + _CopyWithStubImpl$Mutation$AddSshKey$addSshKey$user(this._res); + + TRes _res; + + call( {List? sshKeys, Enum$UserType? userType, String? username, String? $__typename}) => - Mutation$AddSshKey$addSshKey$user( - sshKeys: sshKeys == null ? this.sshKeys : sshKeys, - userType: userType == null ? this.userType : userType, - username: username == null ? this.username : username, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; } @JsonSerializable(explicitToJson: true) @@ -1253,9 +1862,44 @@ class Variables$Query$GetUser { return true; } - Variables$Query$GetUser copyWith({String? username}) => - Variables$Query$GetUser( - username: username == null ? this.username : username); + 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.stub(TRes res) = + _CopyWithStubImpl$Variables$Query$GetUser; + + TRes call({String? username}); +} + +class _CopyWithImpl$Variables$Query$GetUser + implements CopyWith$Variables$Query$GetUser { + _CopyWithImpl$Variables$Query$GetUser(this._instance, this._then); + + final Variables$Query$GetUser _instance; + + final TRes Function(Variables$Query$GetUser) _then; + + static const _undefined = {}; + + TRes call({Object? username = _undefined}) => _then(Variables$Query$GetUser( + username: username == _undefined || username == null + ? _instance.username + : (username as String))); +} + +class _CopyWithStubImpl$Variables$Query$GetUser + implements CopyWith$Variables$Query$GetUser { + _CopyWithStubImpl$Variables$Query$GetUser(this._res); + + TRes _res; + + call({String? username}) => _res; } @JsonSerializable(explicitToJson: true) @@ -1294,10 +1938,55 @@ class Query$GetUser { } extension UtilityExtension$Query$GetUser on Query$GetUser { - Query$GetUser copyWith({Query$GetUser$users? users, String? $__typename}) => - Query$GetUser( - users: users == null ? this.users : users, - $__typename: $__typename == null ? this.$__typename : $__typename); + 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; + + factory CopyWith$Query$GetUser.stub(TRes res) = + _CopyWithStubImpl$Query$GetUser; + + 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); + + final Query$GetUser _instance; + + final TRes Function(Query$GetUser) _then; + + static const _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))); + CopyWith$Query$GetUser$users get users { + final local$users = _instance.users; + return CopyWith$Query$GetUser$users(local$users, (e) => call(users: e)); + } +} + +class _CopyWithStubImpl$Query$GetUser + implements CopyWith$Query$GetUser { + _CopyWithStubImpl$Query$GetUser(this._res); + + TRes _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: [ @@ -1500,12 +2189,58 @@ class Query$GetUser$users { } extension UtilityExtension$Query$GetUser$users on Query$GetUser$users { - Query$GetUser$users copyWith( - {Query$GetUser$users$getUser? Function()? getUser, - String? $__typename}) => - Query$GetUser$users( - getUser: getUser == null ? this.getUser : getUser(), - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Query$GetUser$users get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Query$GetUser$users; + + TRes call({Query$GetUser$users$getUser? getUser, String? $__typename}); + CopyWith$Query$GetUser$users$getUser get getUser; +} + +class _CopyWithImpl$Query$GetUser$users + implements CopyWith$Query$GetUser$users { + _CopyWithImpl$Query$GetUser$users(this._instance, this._then); + + final Query$GetUser$users _instance; + + final TRes Function(Query$GetUser$users) _then; + + static const _undefined = {}; + + TRes call({Object? getUser = _undefined, Object? $__typename = _undefined}) => + _then(Query$GetUser$users( + getUser: getUser == _undefined + ? _instance.getUser + : (getUser as Query$GetUser$users$getUser?), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); + CopyWith$Query$GetUser$users$getUser get getUser { + final local$getUser = _instance.getUser; + return local$getUser == null + ? CopyWith$Query$GetUser$users$getUser.stub(_then(_instance)) + : CopyWith$Query$GetUser$users$getUser( + local$getUser, (e) => call(getUser: e)); + } +} + +class _CopyWithStubImpl$Query$GetUser$users + implements CopyWith$Query$GetUser$users { + _CopyWithStubImpl$Query$GetUser$users(this._res); + + TRes _res; + + call({Query$GetUser$users$getUser? getUser, String? $__typename}) => _res; + CopyWith$Query$GetUser$users$getUser get getUser => + CopyWith$Query$GetUser$users$getUser.stub(_res); } @JsonSerializable(explicitToJson: true) @@ -1573,16 +2308,68 @@ class Query$GetUser$users$getUser { extension UtilityExtension$Query$GetUser$users$getUser on Query$GetUser$users$getUser { - Query$GetUser$users$getUser copyWith( + CopyWith$Query$GetUser$users$getUser + get copyWith => CopyWith$Query$GetUser$users$getUser(this, (i) => i); +} + +abstract class CopyWith$Query$GetUser$users$getUser { + factory CopyWith$Query$GetUser$users$getUser( + Query$GetUser$users$getUser instance, + TRes Function(Query$GetUser$users$getUser) then) = + _CopyWithImpl$Query$GetUser$users$getUser; + + factory CopyWith$Query$GetUser$users$getUser.stub(TRes res) = + _CopyWithStubImpl$Query$GetUser$users$getUser; + + TRes call( + {List? sshKeys, + Enum$UserType? userType, + String? username, + String? $__typename}); +} + +class _CopyWithImpl$Query$GetUser$users$getUser + implements CopyWith$Query$GetUser$users$getUser { + _CopyWithImpl$Query$GetUser$users$getUser(this._instance, this._then); + + final Query$GetUser$users$getUser _instance; + + final TRes Function(Query$GetUser$users$getUser) _then; + + static const _undefined = {}; + + TRes call( + {Object? sshKeys = _undefined, + Object? userType = _undefined, + Object? username = _undefined, + Object? $__typename = _undefined}) => + _then(Query$GetUser$users$getUser( + sshKeys: sshKeys == _undefined || sshKeys == null + ? _instance.sshKeys + : (sshKeys as List), + userType: userType == _undefined || userType == null + ? _instance.userType + : (userType as Enum$UserType), + username: username == _undefined || username == null + ? _instance.username + : (username as String), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); +} + +class _CopyWithStubImpl$Query$GetUser$users$getUser + implements CopyWith$Query$GetUser$users$getUser { + _CopyWithStubImpl$Query$GetUser$users$getUser(this._res); + + TRes _res; + + call( {List? sshKeys, Enum$UserType? userType, String? username, String? $__typename}) => - Query$GetUser$users$getUser( - sshKeys: sshKeys == null ? this.sshKeys : sshKeys, - userType: userType == null ? this.userType : userType, - username: username == null ? this.username : username, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; } @JsonSerializable(explicitToJson: true) @@ -1613,10 +2400,46 @@ class Variables$Mutation$RemoveSshKey { return true; } - Variables$Mutation$RemoveSshKey copyWith( - {Input$SshMutationInput? sshInput}) => - Variables$Mutation$RemoveSshKey( - sshInput: sshInput == null ? this.sshInput : sshInput); + 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; + + factory CopyWith$Variables$Mutation$RemoveSshKey.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$RemoveSshKey; + + TRes call({Input$SshMutationInput? sshInput}); +} + +class _CopyWithImpl$Variables$Mutation$RemoveSshKey + implements CopyWith$Variables$Mutation$RemoveSshKey { + _CopyWithImpl$Variables$Mutation$RemoveSshKey(this._instance, this._then); + + final Variables$Mutation$RemoveSshKey _instance; + + final TRes Function(Variables$Mutation$RemoveSshKey) _then; + + static const _undefined = {}; + + TRes call({Object? sshInput = _undefined}) => + _then(Variables$Mutation$RemoveSshKey( + sshInput: sshInput == _undefined || sshInput == null + ? _instance.sshInput + : (sshInput as Input$SshMutationInput))); +} + +class _CopyWithStubImpl$Variables$Mutation$RemoveSshKey + implements CopyWith$Variables$Mutation$RemoveSshKey { + _CopyWithStubImpl$Variables$Mutation$RemoveSshKey(this._res); + + TRes _res; + + call({Input$SshMutationInput? sshInput}) => _res; } @JsonSerializable(explicitToJson: true) @@ -1656,12 +2479,62 @@ class Mutation$RemoveSshKey { } extension UtilityExtension$Mutation$RemoveSshKey on Mutation$RemoveSshKey { - Mutation$RemoveSshKey copyWith( + CopyWith$Mutation$RemoveSshKey get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Mutation$RemoveSshKey; + + 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); + + final Mutation$RemoveSshKey _instance; + + final TRes Function(Mutation$RemoveSshKey) _then; + + static const _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))); + CopyWith$Mutation$RemoveSshKey$removeSshKey get removeSshKey { + final local$removeSshKey = _instance.removeSshKey; + return CopyWith$Mutation$RemoveSshKey$removeSshKey( + local$removeSshKey, (e) => call(removeSshKey: e)); + } +} + +class _CopyWithStubImpl$Mutation$RemoveSshKey + implements CopyWith$Mutation$RemoveSshKey { + _CopyWithStubImpl$Mutation$RemoveSshKey(this._res); + + TRes _res; + + call( {Mutation$RemoveSshKey$removeSshKey? removeSshKey, String? $__typename}) => - Mutation$RemoveSshKey( - removeSshKey: removeSshKey == null ? this.removeSshKey : removeSshKey, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; + CopyWith$Mutation$RemoveSshKey$removeSshKey get removeSshKey => + CopyWith$Mutation$RemoveSshKey$removeSshKey.stub(_res); } const documentNodeMutationRemoveSshKey = DocumentNode(definitions: [ @@ -1892,18 +2765,87 @@ class Mutation$RemoveSshKey$removeSshKey extension UtilityExtension$Mutation$RemoveSshKey$removeSshKey on Mutation$RemoveSshKey$removeSshKey { - Mutation$RemoveSshKey$removeSshKey copyWith( + CopyWith$Mutation$RemoveSshKey$removeSshKey< + Mutation$RemoveSshKey$removeSshKey> + 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; + + factory CopyWith$Mutation$RemoveSshKey$removeSshKey.stub(TRes res) = + _CopyWithStubImpl$Mutation$RemoveSshKey$removeSshKey; + + TRes call( + {int? code, + String? message, + bool? success, + String? $__typename, + Mutation$RemoveSshKey$removeSshKey$user? user}); + CopyWith$Mutation$RemoveSshKey$removeSshKey$user get user; +} + +class _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey + implements CopyWith$Mutation$RemoveSshKey$removeSshKey { + _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey(this._instance, this._then); + + final Mutation$RemoveSshKey$removeSshKey _instance; + + final TRes Function(Mutation$RemoveSshKey$removeSshKey) _then; + + static const _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 Mutation$RemoveSshKey$removeSshKey$user?))); + CopyWith$Mutation$RemoveSshKey$removeSshKey$user get user { + final local$user = _instance.user; + return local$user == null + ? CopyWith$Mutation$RemoveSshKey$removeSshKey$user.stub( + _then(_instance)) + : CopyWith$Mutation$RemoveSshKey$removeSshKey$user( + local$user, (e) => call(user: e)); + } +} + +class _CopyWithStubImpl$Mutation$RemoveSshKey$removeSshKey + implements CopyWith$Mutation$RemoveSshKey$removeSshKey { + _CopyWithStubImpl$Mutation$RemoveSshKey$removeSshKey(this._res); + + TRes _res; + + call( {int? code, String? message, bool? success, String? $__typename, - Mutation$RemoveSshKey$removeSshKey$user? Function()? user}) => - Mutation$RemoveSshKey$removeSshKey( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename, - user: user == null ? this.user : user()); + Mutation$RemoveSshKey$removeSshKey$user? user}) => + _res; + CopyWith$Mutation$RemoveSshKey$removeSshKey$user get user => + CopyWith$Mutation$RemoveSshKey$removeSshKey$user.stub(_res); } @JsonSerializable(explicitToJson: true) @@ -1973,16 +2915,71 @@ class Mutation$RemoveSshKey$removeSshKey$user { extension UtilityExtension$Mutation$RemoveSshKey$removeSshKey$user on Mutation$RemoveSshKey$removeSshKey$user { - Mutation$RemoveSshKey$removeSshKey$user copyWith( + CopyWith$Mutation$RemoveSshKey$removeSshKey$user< + Mutation$RemoveSshKey$removeSshKey$user> + get copyWith => + CopyWith$Mutation$RemoveSshKey$removeSshKey$user(this, (i) => i); +} + +abstract class CopyWith$Mutation$RemoveSshKey$removeSshKey$user { + factory CopyWith$Mutation$RemoveSshKey$removeSshKey$user( + Mutation$RemoveSshKey$removeSshKey$user instance, + TRes Function(Mutation$RemoveSshKey$removeSshKey$user) then) = + _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey$user; + + factory CopyWith$Mutation$RemoveSshKey$removeSshKey$user.stub(TRes res) = + _CopyWithStubImpl$Mutation$RemoveSshKey$removeSshKey$user; + + TRes call( + {List? sshKeys, + Enum$UserType? userType, + String? username, + String? $__typename}); +} + +class _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey$user + implements CopyWith$Mutation$RemoveSshKey$removeSshKey$user { + _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey$user( + this._instance, this._then); + + final Mutation$RemoveSshKey$removeSshKey$user _instance; + + final TRes Function(Mutation$RemoveSshKey$removeSshKey$user) _then; + + static const _undefined = {}; + + TRes call( + {Object? sshKeys = _undefined, + Object? userType = _undefined, + Object? username = _undefined, + Object? $__typename = _undefined}) => + _then(Mutation$RemoveSshKey$removeSshKey$user( + sshKeys: sshKeys == _undefined || sshKeys == null + ? _instance.sshKeys + : (sshKeys as List), + userType: userType == _undefined || userType == null + ? _instance.userType + : (userType as Enum$UserType), + username: username == _undefined || username == null + ? _instance.username + : (username as String), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); +} + +class _CopyWithStubImpl$Mutation$RemoveSshKey$removeSshKey$user + implements CopyWith$Mutation$RemoveSshKey$removeSshKey$user { + _CopyWithStubImpl$Mutation$RemoveSshKey$removeSshKey$user(this._res); + + TRes _res; + + call( {List? sshKeys, Enum$UserType? userType, String? username, String? $__typename}) => - Mutation$RemoveSshKey$removeSshKey$user( - sshKeys: sshKeys == null ? this.sshKeys : sshKeys, - userType: userType == null ? this.userType : userType, - username: username == null ? this.username : username, - $__typename: $__typename == null ? this.$__typename : $__typename); + _res; } @JsonSerializable(explicitToJson: true) @@ -2012,9 +3009,46 @@ class Variables$Mutation$DeleteUser { return true; } - Variables$Mutation$DeleteUser copyWith({String? username}) => + 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; + + factory CopyWith$Variables$Mutation$DeleteUser.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$DeleteUser; + + TRes call({String? username}); +} + +class _CopyWithImpl$Variables$Mutation$DeleteUser + implements CopyWith$Variables$Mutation$DeleteUser { + _CopyWithImpl$Variables$Mutation$DeleteUser(this._instance, this._then); + + final Variables$Mutation$DeleteUser _instance; + + final TRes Function(Variables$Mutation$DeleteUser) _then; + + static const _undefined = {}; + + TRes call({Object? username = _undefined}) => _then( Variables$Mutation$DeleteUser( - username: username == null ? this.username : username); + username: username == _undefined || username == null + ? _instance.username + : (username as String))); +} + +class _CopyWithStubImpl$Variables$Mutation$DeleteUser + implements CopyWith$Variables$Mutation$DeleteUser { + _CopyWithStubImpl$Variables$Mutation$DeleteUser(this._res); + + TRes _res; + + call({String? username}) => _res; } @JsonSerializable(explicitToJson: true) @@ -2053,11 +3087,59 @@ class Mutation$DeleteUser { } extension UtilityExtension$Mutation$DeleteUser on Mutation$DeleteUser { - Mutation$DeleteUser copyWith( - {Mutation$DeleteUser$deleteUser? deleteUser, String? $__typename}) => - Mutation$DeleteUser( - deleteUser: deleteUser == null ? this.deleteUser : deleteUser, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$DeleteUser get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Mutation$DeleteUser; + + 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); + + final Mutation$DeleteUser _instance; + + final TRes Function(Mutation$DeleteUser) _then; + + static const _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))); + CopyWith$Mutation$DeleteUser$deleteUser get deleteUser { + final local$deleteUser = _instance.deleteUser; + return CopyWith$Mutation$DeleteUser$deleteUser( + local$deleteUser, (e) => call(deleteUser: e)); + } +} + +class _CopyWithStubImpl$Mutation$DeleteUser + implements CopyWith$Mutation$DeleteUser { + _CopyWithStubImpl$Mutation$DeleteUser(this._res); + + TRes _res; + + call({Mutation$DeleteUser$deleteUser? deleteUser, String? $__typename}) => + _res; + CopyWith$Mutation$DeleteUser$deleteUser get deleteUser => + CopyWith$Mutation$DeleteUser$deleteUser.stub(_res); } const documentNodeMutationDeleteUser = DocumentNode(definitions: [ @@ -2243,13 +3325,60 @@ class Mutation$DeleteUser$deleteUser extension UtilityExtension$Mutation$DeleteUser$deleteUser on Mutation$DeleteUser$deleteUser { - Mutation$DeleteUser$deleteUser copyWith( - {int? code, String? message, bool? success, String? $__typename}) => - Mutation$DeleteUser$deleteUser( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$DeleteUser$deleteUser + 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; + + factory CopyWith$Mutation$DeleteUser$deleteUser.stub(TRes res) = + _CopyWithStubImpl$Mutation$DeleteUser$deleteUser; + + 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); + + final Mutation$DeleteUser$deleteUser _instance; + + final TRes Function(Mutation$DeleteUser$deleteUser) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Mutation$DeleteUser$deleteUser + implements CopyWith$Mutation$DeleteUser$deleteUser { + _CopyWithStubImpl$Mutation$DeleteUser$deleteUser(this._res); + + TRes _res; + + call({int? code, String? message, bool? success, String? $__typename}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -2279,8 +3408,45 @@ class Variables$Mutation$UpdateUser { return true; } - Variables$Mutation$UpdateUser copyWith({Input$UserMutationInput? user}) => - Variables$Mutation$UpdateUser(user: user == null ? this.user : user); + 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; + + factory CopyWith$Variables$Mutation$UpdateUser.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$UpdateUser; + + TRes call({Input$UserMutationInput? user}); +} + +class _CopyWithImpl$Variables$Mutation$UpdateUser + implements CopyWith$Variables$Mutation$UpdateUser { + _CopyWithImpl$Variables$Mutation$UpdateUser(this._instance, this._then); + + final Variables$Mutation$UpdateUser _instance; + + final TRes Function(Variables$Mutation$UpdateUser) _then; + + static const _undefined = {}; + + TRes call({Object? user = _undefined}) => _then(Variables$Mutation$UpdateUser( + user: user == _undefined || user == null + ? _instance.user + : (user as Input$UserMutationInput))); +} + +class _CopyWithStubImpl$Variables$Mutation$UpdateUser + implements CopyWith$Variables$Mutation$UpdateUser { + _CopyWithStubImpl$Variables$Mutation$UpdateUser(this._res); + + TRes _res; + + call({Input$UserMutationInput? user}) => _res; } @JsonSerializable(explicitToJson: true) @@ -2319,11 +3485,59 @@ class Mutation$UpdateUser { } extension UtilityExtension$Mutation$UpdateUser on Mutation$UpdateUser { - Mutation$UpdateUser copyWith( - {Mutation$UpdateUser$updateUser? updateUser, String? $__typename}) => - Mutation$UpdateUser( - updateUser: updateUser == null ? this.updateUser : updateUser, - $__typename: $__typename == null ? this.$__typename : $__typename); + CopyWith$Mutation$UpdateUser get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Mutation$UpdateUser; + + 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); + + final Mutation$UpdateUser _instance; + + final TRes Function(Mutation$UpdateUser) _then; + + static const _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))); + CopyWith$Mutation$UpdateUser$updateUser get updateUser { + final local$updateUser = _instance.updateUser; + return CopyWith$Mutation$UpdateUser$updateUser( + local$updateUser, (e) => call(updateUser: e)); + } +} + +class _CopyWithStubImpl$Mutation$UpdateUser + implements CopyWith$Mutation$UpdateUser { + _CopyWithStubImpl$Mutation$UpdateUser(this._res); + + TRes _res; + + call({Mutation$UpdateUser$updateUser? updateUser, String? $__typename}) => + _res; + CopyWith$Mutation$UpdateUser$updateUser get updateUser => + CopyWith$Mutation$UpdateUser$updateUser.stub(_res); } const documentNodeMutationUpdateUser = DocumentNode(definitions: [ @@ -2548,18 +3762,84 @@ class Mutation$UpdateUser$updateUser extension UtilityExtension$Mutation$UpdateUser$updateUser on Mutation$UpdateUser$updateUser { - Mutation$UpdateUser$updateUser copyWith( + CopyWith$Mutation$UpdateUser$updateUser + 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; + + factory CopyWith$Mutation$UpdateUser$updateUser.stub(TRes res) = + _CopyWithStubImpl$Mutation$UpdateUser$updateUser; + + TRes call( + {int? code, + String? message, + bool? success, + String? $__typename, + Mutation$UpdateUser$updateUser$user? user}); + CopyWith$Mutation$UpdateUser$updateUser$user get user; +} + +class _CopyWithImpl$Mutation$UpdateUser$updateUser + implements CopyWith$Mutation$UpdateUser$updateUser { + _CopyWithImpl$Mutation$UpdateUser$updateUser(this._instance, this._then); + + final Mutation$UpdateUser$updateUser _instance; + + final TRes Function(Mutation$UpdateUser$updateUser) _then; + + static const _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 Mutation$UpdateUser$updateUser$user?))); + CopyWith$Mutation$UpdateUser$updateUser$user get user { + final local$user = _instance.user; + return local$user == null + ? CopyWith$Mutation$UpdateUser$updateUser$user.stub(_then(_instance)) + : CopyWith$Mutation$UpdateUser$updateUser$user( + local$user, (e) => call(user: e)); + } +} + +class _CopyWithStubImpl$Mutation$UpdateUser$updateUser + implements CopyWith$Mutation$UpdateUser$updateUser { + _CopyWithStubImpl$Mutation$UpdateUser$updateUser(this._res); + + TRes _res; + + call( {int? code, String? message, bool? success, String? $__typename, - Mutation$UpdateUser$updateUser$user? Function()? user}) => - Mutation$UpdateUser$updateUser( - code: code == null ? this.code : code, - message: message == null ? this.message : message, - success: success == null ? this.success : success, - $__typename: $__typename == null ? this.$__typename : $__typename, - user: user == null ? this.user : user()); + Mutation$UpdateUser$updateUser$user? user}) => + _res; + CopyWith$Mutation$UpdateUser$updateUser$user get user => + CopyWith$Mutation$UpdateUser$updateUser$user.stub(_res); } @JsonSerializable(explicitToJson: true) @@ -2629,14 +3909,68 @@ class Mutation$UpdateUser$updateUser$user { extension UtilityExtension$Mutation$UpdateUser$updateUser$user on Mutation$UpdateUser$updateUser$user { - Mutation$UpdateUser$updateUser$user copyWith( + CopyWith$Mutation$UpdateUser$updateUser$user< + Mutation$UpdateUser$updateUser$user> + get copyWith => + CopyWith$Mutation$UpdateUser$updateUser$user(this, (i) => i); +} + +abstract class CopyWith$Mutation$UpdateUser$updateUser$user { + factory CopyWith$Mutation$UpdateUser$updateUser$user( + Mutation$UpdateUser$updateUser$user instance, + TRes Function(Mutation$UpdateUser$updateUser$user) then) = + _CopyWithImpl$Mutation$UpdateUser$updateUser$user; + + factory CopyWith$Mutation$UpdateUser$updateUser$user.stub(TRes res) = + _CopyWithStubImpl$Mutation$UpdateUser$updateUser$user; + + TRes call( + {List? sshKeys, + Enum$UserType? userType, + String? username, + String? $__typename}); +} + +class _CopyWithImpl$Mutation$UpdateUser$updateUser$user + implements CopyWith$Mutation$UpdateUser$updateUser$user { + _CopyWithImpl$Mutation$UpdateUser$updateUser$user(this._instance, this._then); + + final Mutation$UpdateUser$updateUser$user _instance; + + final TRes Function(Mutation$UpdateUser$updateUser$user) _then; + + static const _undefined = {}; + + TRes call( + {Object? sshKeys = _undefined, + Object? userType = _undefined, + Object? username = _undefined, + Object? $__typename = _undefined}) => + _then(Mutation$UpdateUser$updateUser$user( + sshKeys: sshKeys == _undefined || sshKeys == null + ? _instance.sshKeys + : (sshKeys as List), + userType: userType == _undefined || userType == null + ? _instance.userType + : (userType as Enum$UserType), + username: username == _undefined || username == null + ? _instance.username + : (username as String), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); +} + +class _CopyWithStubImpl$Mutation$UpdateUser$updateUser$user + implements CopyWith$Mutation$UpdateUser$updateUser$user { + _CopyWithStubImpl$Mutation$UpdateUser$updateUser$user(this._res); + + TRes _res; + + call( {List? sshKeys, Enum$UserType? userType, String? username, String? $__typename}) => - Mutation$UpdateUser$updateUser$user( - sshKeys: sshKeys == null ? this.sshKeys : sshKeys, - userType: userType == null ? this.userType : userType, - username: username == null ? this.username : username, - $__typename: $__typename == null ? this.$__typename : $__typename); + _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 index 411cbfad..a7b81c2d 100644 --- a/lib/logic/api_maps/graphql_maps/schema/users.graphql.g.dart +++ b/lib/logic/api_maps/graphql_maps/schema/users.graphql.g.dart @@ -90,7 +90,7 @@ Map _$Mutation$CreateUser$createUser$userToJson( Mutation$CreateUser$createUser$user instance) => { 'username': instance.username, - 'userType': _$Enum$UserTypeEnumMap[instance.userType], + 'userType': _$Enum$UserTypeEnumMap[instance.userType]!, 'sshKeys': instance.sshKeys, '__typename': instance.$__typename, }; @@ -146,7 +146,7 @@ Query$AllUsers$users$allUsers _$Query$AllUsers$users$allUsersFromJson( Map _$Query$AllUsers$users$allUsersToJson( Query$AllUsers$users$allUsers instance) => { - 'userType': _$Enum$UserTypeEnumMap[instance.userType], + 'userType': _$Enum$UserTypeEnumMap[instance.userType]!, 'username': instance.username, 'sshKeys': instance.sshKeys, '__typename': instance.$__typename, @@ -216,7 +216,7 @@ Map _$Mutation$AddSshKey$addSshKey$userToJson( Mutation$AddSshKey$addSshKey$user instance) => { 'sshKeys': instance.sshKeys, - 'userType': _$Enum$UserTypeEnumMap[instance.userType], + 'userType': _$Enum$UserTypeEnumMap[instance.userType]!, 'username': instance.username, '__typename': instance.$__typename, }; @@ -277,7 +277,7 @@ Map _$Query$GetUser$users$getUserToJson( Query$GetUser$users$getUser instance) => { 'sshKeys': instance.sshKeys, - 'userType': _$Enum$UserTypeEnumMap[instance.userType], + 'userType': _$Enum$UserTypeEnumMap[instance.userType]!, 'username': instance.username, '__typename': instance.$__typename, }; @@ -350,7 +350,7 @@ Map _$Mutation$RemoveSshKey$removeSshKey$userToJson( Mutation$RemoveSshKey$removeSshKey$user instance) => { 'sshKeys': instance.sshKeys, - 'userType': _$Enum$UserTypeEnumMap[instance.userType], + 'userType': _$Enum$UserTypeEnumMap[instance.userType]!, 'username': instance.username, '__typename': instance.$__typename, }; @@ -465,7 +465,7 @@ Map _$Mutation$UpdateUser$updateUser$userToJson( Mutation$UpdateUser$updateUser$user instance) => { 'sshKeys': instance.sshKeys, - 'userType': _$Enum$UserTypeEnumMap[instance.userType], + 'userType': _$Enum$UserTypeEnumMap[instance.userType]!, 'username': instance.username, '__typename': instance.$__typename, }; 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 088f82d5..6cf5a971 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 @@ -498,13 +498,16 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { final Dio client = await getClient(); try { final Response response = await client.get('/servers'); - servers = (response.data!['servers'] as List) - .map( + servers = response.data!['servers'] + .map( (final e) => HetznerServerInfo.fromJson(e), ) .toList() - .map( - (final HetznerServerInfo server) => ServerBasicInfo( + .where( + (final server) => server.publicNet.ipv4 != null, + ) + .map( + (final server) => ServerBasicInfo( id: server.id, name: server.name, ip: server.publicNet.ipv4.ip, @@ -520,6 +523,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { close(client); } + print(servers); return servers; } diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index aee5207f..4575fa4b 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -4,14 +4,12 @@ import 'package:flutter_bloc/flutter_bloc.dart'; 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.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/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'; import 'package:selfprivacy/logic/models/hive/user.dart'; -import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; import 'package:selfprivacy/logic/models/server_basic_info.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_repository.dart'; diff --git a/lib/logic/models/json/backup.g.dart b/lib/logic/models/json/backup.g.dart index eff513f0..dea4847d 100644 --- a/lib/logic/models/json/backup.g.dart +++ b/lib/logic/models/json/backup.g.dart @@ -24,7 +24,7 @@ BackupStatus _$BackupStatusFromJson(Map json) => BackupStatus( Map _$BackupStatusToJson(BackupStatus instance) => { - 'status': _$BackupStatusEnumEnumMap[instance.status], + 'status': _$BackupStatusEnumEnumMap[instance.status]!, 'progress': instance.progress, 'error_message': instance.errorMessage, }; diff --git a/lib/logic/models/json/hetzner_server_info.dart b/lib/logic/models/json/hetzner_server_info.dart index ccf036a1..6e28f1cf 100644 --- a/lib/logic/models/json/hetzner_server_info.dart +++ b/lib/logic/models/json/hetzner_server_info.dart @@ -39,7 +39,7 @@ class HetznerServerInfo { @JsonSerializable() class HetznerPublicNetInfo { HetznerPublicNetInfo(this.ipv4); - final HetznerIp4 ipv4; + final HetznerIp4? ipv4; static HetznerPublicNetInfo fromJson(final Map json) => _$HetznerPublicNetInfoFromJson(json); diff --git a/lib/logic/models/json/hetzner_server_info.g.dart b/lib/logic/models/json/hetzner_server_info.g.dart index 7d6ecd29..5201a1c5 100644 --- a/lib/logic/models/json/hetzner_server_info.g.dart +++ b/lib/logic/models/json/hetzner_server_info.g.dart @@ -23,7 +23,7 @@ Map _$HetznerServerInfoToJson(HetznerServerInfo instance) => { 'id': instance.id, 'name': instance.name, - 'status': _$ServerStatusEnumMap[instance.status], + 'status': _$ServerStatusEnumMap[instance.status]!, 'created': instance.created.toIso8601String(), 'volumes': instance.volumes, 'server_type': instance.serverType, @@ -46,7 +46,9 @@ const _$ServerStatusEnumMap = { HetznerPublicNetInfo _$HetznerPublicNetInfoFromJson( Map json) => HetznerPublicNetInfo( - HetznerIp4.fromJson(json['ipv4'] as Map), + json['ipv4'] == null + ? null + : HetznerIp4.fromJson(json['ipv4'] as Map), ); Map _$HetznerPublicNetInfoToJson( diff --git a/lib/logic/models/json/server_job.g.dart b/lib/logic/models/json/server_job.g.dart index 2af5358a..025e1ebc 100644 --- a/lib/logic/models/json/server_job.g.dart +++ b/lib/logic/models/json/server_job.g.dart @@ -11,13 +11,13 @@ ServerJob _$ServerJobFromJson(Map json) => ServerJob( description: json['description'] as String, status: json['status'] as String, uid: json['uid'] as String, - updatedAt: json['updated_at'] as String, - createdAt: DateTime.parse(json['created_at'] as String), + updatedAt: json['updatedAt'] as String, + createdAt: DateTime.parse(json['createdAt'] as String), error: json['error'] as String?, progress: json['progress'] as int?, result: json['result'] as String?, - statusText: json['status_text'] as String?, - finishedAt: json['finished_at'] as String?, + statusText: json['statusText'] as String?, + finishedAt: json['finishedAt'] as String?, ); Map _$ServerJobToJson(ServerJob instance) => { @@ -25,11 +25,11 @@ Map _$ServerJobToJson(ServerJob instance) => { 'description': instance.description, 'status': instance.status, 'uid': instance.uid, - 'updated_at': instance.updatedAt, - 'created_at': instance.createdAt.toIso8601String(), + 'updatedAt': instance.updatedAt, + 'createdAt': instance.createdAt.toIso8601String(), 'error': instance.error, 'progress': instance.progress, 'result': instance.result, - 'status_text': instance.statusText, - 'finished_at': instance.finishedAt, + 'statusText': instance.statusText, + 'finishedAt': instance.finishedAt, }; diff --git a/lib/ui/components/progress_bar/progress_bar.dart b/lib/ui/components/progress_bar/progress_bar.dart index 36c6d029..9b851ce7 100644 --- a/lib/ui/components/progress_bar/progress_bar.dart +++ b/lib/ui/components/progress_bar/progress_bar.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:selfprivacy/config/brand_colors.dart'; import 'package:selfprivacy/config/text_themes.dart'; import 'package:selfprivacy/logic/cubit/app_settings/app_settings_cubit.dart'; -import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart'; import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; class ProgressBar extends StatefulWidget { @@ -114,7 +113,6 @@ class _ProgressBarState extends State { final String? step, }) { final bool isActive = index == widget.activeIndex; - final bool checked = index < widget.activeIndex; style = isActive ? style!.copyWith(fontWeight: FontWeight.w700) : style; return Container( diff --git a/lib/ui/pages/server_storage/data_migration.dart b/lib/ui/pages/server_storage/data_migration.dart index b8fc158f..5085c790 100644 --- a/lib/ui/pages/server_storage/data_migration.dart +++ b/lib/ui/pages/server_storage/data_migration.dart @@ -23,25 +23,22 @@ class DataMigrationPage extends StatefulWidget { class _DataMigrationPageState extends State { @override - Widget build(final BuildContext context) { - int a = 0; - return BrandHeroScreen( - hasBackButton: true, - heroTitle: 'providers.storage.data_migration_title'.tr(), - children: [ - ...widget.diskStatus.diskVolumes - .map( - (final volume) => Column( - children: [ - ServerStorageListItem( - volume: volume, - ), - const SizedBox(height: 16), - ], - ), - ) - .toList(), - ], - ); - } + Widget build(final BuildContext context) => BrandHeroScreen( + hasBackButton: true, + heroTitle: 'providers.storage.data_migration_title'.tr(), + children: [ + ...widget.diskStatus.diskVolumes + .map( + (final volume) => Column( + children: [ + ServerStorageListItem( + volume: volume, + ), + const SizedBox(height: 16), + ], + ), + ) + .toList(), + ], + ); } diff --git a/lib/ui/pages/server_storage/service_storage_consumption_list_item.dart b/lib/ui/pages/server_storage/service_storage_consumption_list_item.dart index 9396c1fc..30216709 100644 --- a/lib/ui/pages/server_storage/service_storage_consumption_list_item.dart +++ b/lib/ui/pages/server_storage/service_storage_consumption_list_item.dart @@ -1,4 +1,3 @@ -import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:selfprivacy/ui/components/brand_linear_indicator/brand_linear_indicator.dart'; diff --git a/lib/ui/pages/services/service_page.dart b/lib/ui/pages/services/service_page.dart index 19a22c2c..afdd9718 100644 --- a/lib/ui/pages/services/service_page.dart +++ b/lib/ui/pages/services/service_page.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:selfprivacy/ui/components/brand_button/filled_button.dart'; import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; @@ -12,76 +11,73 @@ class ServicePage extends StatefulWidget { class _ServicePageState extends State { @override - Widget build(final BuildContext context) { - int a; - return BrandHeroScreen( - hasBackButton: true, - children: [ - const SizedBox(height: 16), - Container( - alignment: Alignment.center, - child: const Icon( - Icons.question_mark_outlined, - size: 48, + Widget build(final BuildContext context) => BrandHeroScreen( + hasBackButton: true, + children: [ + const SizedBox(height: 16), + Container( + alignment: Alignment.center, + child: const Icon( + Icons.question_mark_outlined, + size: 48, + ), ), - ), - const SizedBox(height: 16), - Text( - 'My Incredible Service', - textAlign: TextAlign.center, - style: Theme.of(context).textTheme.headlineMedium!.copyWith( - color: Theme.of(context).colorScheme.onBackground, - ), - ), - const SizedBox(height: 16), - BrandCards.outlined( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 24), - child: const Icon( - Icons.check_box_outlined, - size: 24, + const SizedBox(height: 16), + Text( + 'My Incredible Service', + textAlign: TextAlign.center, + style: Theme.of(context).textTheme.headlineMedium!.copyWith( + color: Theme.of(context).colorScheme.onBackground, ), - ), - const SizedBox(width: 16), - ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 130), - child: const Text(''), - ), - ], ), - ), - const SizedBox(height: 16), - const Divider(), - const SizedBox(height: 16), - ElevatedButton( - onPressed: null, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 24), - child: const Icon( - Icons.language_outlined, - size: 24, + const SizedBox(height: 16), + BrandCards.outlined( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + ConstrainedBox( + constraints: const BoxConstraints(maxWidth: 24), + child: const Icon( + Icons.check_box_outlined, + size: 24, + ), ), - ), - const SizedBox(width: 16), - ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 130), - child: const Text('Your Cool Domain'), - ), - ], + const SizedBox(width: 16), + ConstrainedBox( + constraints: const BoxConstraints(maxWidth: 130), + child: const Text(''), + ), + ], + ), ), - ), - const SizedBox(height: 16), - ], - ); - } + const SizedBox(height: 16), + const Divider(), + const SizedBox(height: 16), + ElevatedButton( + onPressed: null, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + ConstrainedBox( + constraints: const BoxConstraints(maxWidth: 24), + child: const Icon( + Icons.language_outlined, + size: 24, + ), + ), + const SizedBox(width: 16), + ConstrainedBox( + constraints: const BoxConstraints(maxWidth: 130), + child: const Text('Your Cool Domain'), + ), + ], + ), + ), + const SizedBox(height: 16), + ], + ); } From 254604d5849b99ec19b8786cd8710bbcac823b8f Mon Sep 17 00:00:00 2001 From: inexcode Date: Mon, 29 Aug 2022 22:43:42 +0400 Subject: [PATCH 032/115] Fix money display --- lib/ui/pages/server_storage/extending_volume.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ui/pages/server_storage/extending_volume.dart b/lib/ui/pages/server_storage/extending_volume.dart index 651de4d0..72ef9607 100644 --- a/lib/ui/pages/server_storage/extending_volume.dart +++ b/lib/ui/pages/server_storage/extending_volume.dart @@ -59,7 +59,7 @@ class _ExtendingVolumePageState extends State { _sizeController.text = _currentSliderGbValue.truncate().toString(); _priceController.text = (_euroPerGb * double.parse(_sizeController.text)) - .toStringAsPrecision(2); + .toStringAsFixed(2); minSize = widget.diskVolumeToResize.sizeTotal; if (_currentSliderGbValue < 0) { _currentSliderGbValue = minSize.asGb(); From d247f41da4a01c87c519637dc1cced93bb708f20 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 29 Aug 2022 22:54:06 +0300 Subject: [PATCH 033/115] Fix broken installation state check --- lib/ui/pages/setup/initializing.dart | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/lib/ui/pages/setup/initializing.dart b/lib/ui/pages/setup/initializing.dart index ab6e456e..1764b576 100644 --- a/lib/ui/pages/setup/initializing.dart +++ b/lib/ui/pages/setup/initializing.dart @@ -32,18 +32,21 @@ class InitializingPage extends StatelessWidget { if (cubit.state is ServerInstallationRecovery) { return const RecoveryRouting(); } else { - final actualInitializingPage = [ - () => _stepHetzner(cubit), - () => _stepCloudflare(cubit), - () => _stepBackblaze(cubit), - () => _stepDomain(cubit), - () => _stepUser(cubit), - () => _stepServer(cubit), - () => _stepCheck(cubit), - () => _stepCheck(cubit), - () => _stepCheck(cubit), - () => _stepCheck(cubit) - ][cubit.state.progress.index](); + Widget? actualInitializingPage; + if (cubit.state is! ServerInstallationFinished) { + actualInitializingPage = [ + () => _stepHetzner(cubit), + () => _stepCloudflare(cubit), + () => _stepBackblaze(cubit), + () => _stepDomain(cubit), + () => _stepUser(cubit), + () => _stepServer(cubit), + () => _stepCheck(cubit), + () => _stepCheck(cubit), + () => _stepCheck(cubit), + () => _stepCheck(cubit) + ][cubit.state.progress.index](); + } return BlocListener( listener: (final context, final state) { From d168845b98736ad4ab2714e4678066e4a0a06866 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 29 Aug 2022 23:15:48 +0300 Subject: [PATCH 034/115] Fix storage card size view --- assets/translations/en.json | 4 ++-- lib/ui/pages/server_storage/server_storage_list_item.dart | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index 840ffed0..dac1f23c 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -168,8 +168,8 @@ "card_title": "Server Storage", "status_ok": "Disk usage is OK", "status_error": "Low disk space", - "disk_usage": "{} GB used", - "disk_total": "{} GB total · {}", + "disk_usage": "{} used", + "disk_total": "{} total · {}", "gb": "{} GB", "mb": "{} MB", "kb": "{} KB", diff --git a/lib/ui/pages/server_storage/server_storage_list_item.dart b/lib/ui/pages/server_storage/server_storage_list_item.dart index b6db282d..4bb8d323 100644 --- a/lib/ui/pages/server_storage/server_storage_list_item.dart +++ b/lib/ui/pages/server_storage/server_storage_list_item.dart @@ -41,7 +41,7 @@ class ServerStorageListItem extends StatelessWidget { Text( 'providers.storage.disk_usage'.tr( args: [ - volume.sizeUsed.asGb().toStringAsPrecision(3), + volume.sizeUsed.toString(), ], ), style: titleStyle, @@ -59,7 +59,7 @@ class ServerStorageListItem extends StatelessWidget { Text( 'providers.storage.disk_total'.tr( args: [ - volume.sizeTotal.asGb().toStringAsPrecision(3), + volume.sizeTotal.toString(), volume.name, ], ), From 62929a4839d0e8099c5892b6bd985dfb4386070b Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 29 Aug 2022 23:21:59 +0300 Subject: [PATCH 035/115] Fix dkim runtime exception --- lib/logic/api_maps/rest_maps/server.dart | 31 ++++++------------- .../cubit/dns_records/dns_records_cubit.dart | 17 +++++----- .../server_installation_repository.dart | 2 +- 3 files changed, 19 insertions(+), 31 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/server.dart b/lib/logic/api_maps/rest_maps/server.dart index 17c1cbb2..cd8e0a84 100644 --- a/lib/logic/api_maps/rest_maps/server.dart +++ b/lib/logic/api_maps/rest_maps/server.dart @@ -625,38 +625,25 @@ class ServerApi extends ApiMap { } } - Future getDkim() async { + Future getDkim() async { Response response; - + String? dkim; final Dio client = await getClient(); try { response = await client.get('/services/mailserver/dkim'); + final Codec base64toString = utf8.fuse(base64); + dkim = base64toString + .decode(response.data) + .split('(')[1] + .split(')')[0] + .replaceAll('"', ''); } on DioError catch (e) { print(e.message); - throw Exception('No DKIM key found'); } finally { close(client); } - if (response.statusCode == null) { - throw Exception('No DKIM key found'); - } - - if (response.statusCode == HttpStatus.notFound || response.data == null) { - throw Exception('No DKIM key found'); - } - - if (response.statusCode != HttpStatus.ok) { - throw Exception('No DKIM key found'); - } - - final Codec base64toString = utf8.fuse(base64); - - return base64toString - .decode(response.data) - .split('(')[1] - .split(')')[0] - .replaceAll('"', ''); + return dkim; } Future> getRecoveryTokenStatus() async { diff --git a/lib/logic/cubit/dns_records/dns_records_cubit.dart b/lib/logic/cubit/dns_records/dns_records_cubit.dart index e0ab4d42..93ff3db8 100644 --- a/lib/logic/cubit/dns_records/dns_records_cubit.dart +++ b/lib/logic/cubit/dns_records/dns_records_cubit.dart @@ -139,7 +139,7 @@ class DnsRecordsCubit final String? ipAddress, final String? dkimPublicKey, ) { - if (domainName == null || ipAddress == null || dkimPublicKey == null) { + if (domainName == null || ipAddress == null) { return []; } return [ @@ -204,13 +204,14 @@ class DnsRecordsCubit type: 'TXT', category: DnsRecordsCategory.email, ), - DesiredDnsRecord( - name: 'selector._domainkey.$domainName', - content: dkimPublicKey, - description: 'providers.domain.record_description.dkim', - type: 'TXT', - category: DnsRecordsCategory.email, - ), + if (dkimPublicKey != null) + DesiredDnsRecord( + name: 'selector._domainkey.$domainName', + content: dkimPublicKey, + description: 'providers.domain.record_description.dkim', + type: 'TXT', + category: DnsRecordsCategory.email, + ), ]; } } diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index cbf9ec61..c9ca0e96 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -398,7 +398,7 @@ class ServerInstallationRepository { String dkimRecordString = ''; try { - dkimRecordString = await api.getDkim(); + dkimRecordString = (await api.getDkim())!; } catch (e) { print(e); rethrow; From 7d8f8e1d382902ea9a5053a3fa9f3eb618022a8f Mon Sep 17 00:00:00 2001 From: inexcode Date: Tue, 30 Aug 2022 00:35:06 +0400 Subject: [PATCH 036/115] Rewrite services cubit and add basic service screen. --- .../graphql_maps/server_api/server.dart | 3 +- lib/logic/api_maps/rest_maps/server.dart | 20 +- lib/logic/common_enum/common_enum.dart | 92 ++--- lib/logic/cubit/jobs/jobs_cubit.dart | 2 +- lib/logic/cubit/services/services_cubit.dart | 35 +- lib/logic/cubit/services/services_state.dart | 89 ++--- lib/logic/models/job.dart | 4 +- lib/logic/models/service.dart | 20 + .../components/brand_cards/brand_cards.dart | 7 +- lib/ui/pages/services/service_page.dart | 254 +++++++++---- lib/ui/pages/services/services.dart | 353 +++--------------- 11 files changed, 361 insertions(+), 518 deletions(-) diff --git a/lib/logic/api_maps/graphql_maps/server_api/server.dart b/lib/logic/api_maps/graphql_maps/server_api/server.dart index 04f1d855..13ea67a7 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/server.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/server.dart @@ -37,7 +37,8 @@ class GenericJobMutationReturn extends GenericMutationResult { final ServerJob? job; } -class ServerApi extends ApiMap with VolumeApi, JobsApi, ServerActionsApi { +class ServerApi extends ApiMap + with VolumeApi, JobsApi, ServerActionsApi, ServicesApi { ServerApi({ this.hasLogger = false, this.isWithToken = true, diff --git a/lib/logic/api_maps/rest_maps/server.dart b/lib/logic/api_maps/rest_maps/server.dart index cd8e0a84..2563fa50 100644 --- a/lib/logic/api_maps/rest_maps/server.dart +++ b/lib/logic/api_maps/rest_maps/server.dart @@ -409,11 +409,11 @@ class ServerApi extends ApiMap { } return { - ServiceTypes.passwordManager: response.data['bitwarden'] == 0, - ServiceTypes.git: response.data['gitea'] == 0, - ServiceTypes.cloud: response.data['nextcloud'] == 0, - ServiceTypes.vpn: response.data['ocserv'] == 0, - ServiceTypes.socialNetwork: response.data['pleroma'] == 0, + ServiceTypes.bitwarden: response.data['bitwarden'] == 0, + ServiceTypes.gitea: response.data['gitea'] == 0, + ServiceTypes.nextcloud: response.data['nextcloud'] == 0, + ServiceTypes.ocserv: response.data['ocserv'] == 0, + ServiceTypes.pleroma: response.data['pleroma'] == 0, }; } @@ -907,15 +907,15 @@ extension UrlServerExt on ServiceTypes { // return ''; // external service // case ServiceTypes.video: // return ''; // jitsi meet not working - case ServiceTypes.passwordManager: + case ServiceTypes.bitwarden: return 'bitwarden'; - case ServiceTypes.cloud: + case ServiceTypes.nextcloud: return 'nextcloud'; - case ServiceTypes.socialNetwork: + case ServiceTypes.pleroma: return 'pleroma'; - case ServiceTypes.git: + case ServiceTypes.gitea: return 'gitea'; - case ServiceTypes.vpn: + case ServiceTypes.ocserv: return 'ocserv'; default: throw Exception('wrong state'); diff --git a/lib/logic/common_enum/common_enum.dart b/lib/logic/common_enum/common_enum.dart index 3a1a4d80..93334069 100644 --- a/lib/logic/common_enum/common_enum.dart +++ b/lib/logic/common_enum/common_enum.dart @@ -23,94 +23,86 @@ enum InitializingSteps { enum Period { hour, day, month } enum ServiceTypes { - mail, - messenger, - passwordManager, - video, - cloud, - socialNetwork, - git, - vpn, + mailserver, + bitwarden, + jitsi, + nextcloud, + pleroma, + gitea, + ocserv, } extension ServiceTypesExt on ServiceTypes { String get title { switch (this) { - case ServiceTypes.mail: + case ServiceTypes.mailserver: return 'services.mail.title'.tr(); - case ServiceTypes.messenger: - return 'services.messenger.title'.tr(); - case ServiceTypes.passwordManager: + case ServiceTypes.bitwarden: return 'services.password_manager.title'.tr(); - case ServiceTypes.video: + case ServiceTypes.jitsi: return 'services.video.title'.tr(); - case ServiceTypes.cloud: + case ServiceTypes.nextcloud: return 'services.cloud.title'.tr(); - case ServiceTypes.socialNetwork: + case ServiceTypes.pleroma: return 'services.social_network.title'.tr(); - case ServiceTypes.git: + case ServiceTypes.gitea: return 'services.git.title'.tr(); - case ServiceTypes.vpn: + case ServiceTypes.ocserv: return 'services.vpn.title'.tr(); } } String get subtitle { switch (this) { - case ServiceTypes.mail: + case ServiceTypes.mailserver: return 'services.mail.subtitle'.tr(); - case ServiceTypes.messenger: - return 'services.messenger.subtitle'.tr(); - case ServiceTypes.passwordManager: + case ServiceTypes.bitwarden: return 'services.password_manager.subtitle'.tr(); - case ServiceTypes.video: + case ServiceTypes.jitsi: return 'services.video.subtitle'.tr(); - case ServiceTypes.cloud: + case ServiceTypes.nextcloud: return 'services.cloud.subtitle'.tr(); - case ServiceTypes.socialNetwork: + case ServiceTypes.pleroma: return 'services.social_network.subtitle'.tr(); - case ServiceTypes.git: + case ServiceTypes.gitea: return 'services.git.subtitle'.tr(); - case ServiceTypes.vpn: + case ServiceTypes.ocserv: return 'services.vpn.subtitle'.tr(); } } String get loginInfo { switch (this) { - case ServiceTypes.mail: + case ServiceTypes.mailserver: return 'services.mail.login_info'.tr(); - case ServiceTypes.messenger: - return 'services.messenger.login_info'.tr(); - case ServiceTypes.passwordManager: + case ServiceTypes.bitwarden: return 'services.password_manager.login_info'.tr(); - case ServiceTypes.video: + case ServiceTypes.jitsi: return 'services.video.login_info'.tr(); - case ServiceTypes.cloud: + case ServiceTypes.nextcloud: return 'services.cloud.login_info'.tr(); - case ServiceTypes.socialNetwork: + case ServiceTypes.pleroma: return 'services.social_network.login_info'.tr(); - case ServiceTypes.git: + case ServiceTypes.gitea: return 'services.git.login_info'.tr(); - case ServiceTypes.vpn: + case ServiceTypes.ocserv: return ''; } } String get subdomain { switch (this) { - case ServiceTypes.passwordManager: + case ServiceTypes.bitwarden: return 'password'; - case ServiceTypes.video: + case ServiceTypes.jitsi: return 'meet'; - case ServiceTypes.cloud: + case ServiceTypes.nextcloud: return 'cloud'; - case ServiceTypes.socialNetwork: + case ServiceTypes.pleroma: return 'social'; - case ServiceTypes.git: + case ServiceTypes.gitea: return 'git'; - case ServiceTypes.vpn: - case ServiceTypes.messenger: + case ServiceTypes.ocserv: default: return ''; } @@ -118,21 +110,19 @@ extension ServiceTypesExt on ServiceTypes { IconData get icon { switch (this) { - case ServiceTypes.mail: + case ServiceTypes.mailserver: return BrandIcons.envelope; - case ServiceTypes.messenger: - return BrandIcons.messanger; - case ServiceTypes.passwordManager: + case ServiceTypes.bitwarden: return BrandIcons.key; - case ServiceTypes.video: + case ServiceTypes.jitsi: return BrandIcons.webcam; - case ServiceTypes.cloud: + case ServiceTypes.nextcloud: return BrandIcons.upload; - case ServiceTypes.socialNetwork: + case ServiceTypes.pleroma: return BrandIcons.social; - case ServiceTypes.git: + case ServiceTypes.gitea: return BrandIcons.git; - case ServiceTypes.vpn: + case ServiceTypes.ocserv: return Icons.vpn_lock_outlined; } } diff --git a/lib/logic/cubit/jobs/jobs_cubit.dart b/lib/logic/cubit/jobs/jobs_cubit.dart index baac08dd..4457fba5 100644 --- a/lib/logic/cubit/jobs/jobs_cubit.dart +++ b/lib/logic/cubit/jobs/jobs_cubit.dart @@ -114,7 +114,7 @@ class JobsCubit extends Cubit { } if (job is ServiceToggleJob) { hasServiceJobs = true; - await api.switchService(job.type, job.needToTurnOn); + await api.switchService(job.type.name, job.needToTurnOn); } if (job is CreateSSHKeyJob) { await usersCubit.addSshKey(job.user, job.publicKey); diff --git a/lib/logic/cubit/services/services_cubit.dart b/lib/logic/cubit/services/services_cubit.dart index 19160af1..089d9638 100644 --- a/lib/logic/cubit/services/services_cubit.dart +++ b/lib/logic/cubit/services/services_cubit.dart @@ -1,31 +1,48 @@ -import 'package:selfprivacy/logic/api_maps/rest_maps/server.dart'; +import 'dart:async'; + +import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server.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/service.dart'; part 'services_state.dart'; class ServicesCubit extends ServerInstallationDependendCubit { ServicesCubit(final ServerInstallationCubit serverInstallationCubit) - : super(serverInstallationCubit, ServicesState.allOff()); + : super(serverInstallationCubit, const ServicesState.empty()); final ServerApi api = ServerApi(); + Timer? timer; @override Future load() async { if (serverInstallationCubit.state is ServerInstallationFinished) { - final Map statuses = await api.servicesPowerCheck(); + final List services = await api.getAllServices(); emit( ServicesState( - isPasswordManagerEnable: statuses[ServiceTypes.passwordManager]!, - isCloudEnable: statuses[ServiceTypes.cloud]!, - isGitEnable: statuses[ServiceTypes.git]!, - isSocialNetworkEnable: statuses[ServiceTypes.socialNetwork]!, - isVpnEnable: statuses[ServiceTypes.vpn]!, + services: services, ), ); + timer = Timer(const Duration(seconds: 10), () => reload(useTimer: true)); + } + } + + Future reload({final bool useTimer = false}) async { + final List services = await api.getAllServices(); + emit( + ServicesState( + services: services, + ), + ); + if (useTimer) { + timer = Timer(const Duration(seconds: 60), () => reload(useTimer: true)); } } @override void clear() async { - emit(ServicesState.allOff()); + emit(const ServicesState.empty()); + if (timer != null && timer!.isActive) { + timer!.cancel(); + timer = null; + } } } diff --git a/lib/logic/cubit/services/services_state.dart b/lib/logic/cubit/services/services_state.dart index ffe90aee..353786c2 100644 --- a/lib/logic/cubit/services/services_state.dart +++ b/lib/logic/cubit/services/services_state.dart @@ -1,90 +1,43 @@ part of 'services_cubit.dart'; class ServicesState extends ServerInstallationDependendState { - factory ServicesState.allOn() => const ServicesState( - isPasswordManagerEnable: true, - isCloudEnable: true, - isGitEnable: true, - isSocialNetworkEnable: true, - isVpnEnable: true, - ); - - factory ServicesState.allOff() => const ServicesState( - isPasswordManagerEnable: false, - isCloudEnable: false, - isGitEnable: false, - isSocialNetworkEnable: false, - isVpnEnable: false, - ); const ServicesState({ - required this.isPasswordManagerEnable, - required this.isCloudEnable, - required this.isGitEnable, - required this.isSocialNetworkEnable, - required this.isVpnEnable, + required this.services, }); - final bool isPasswordManagerEnable; - final bool isCloudEnable; - final bool isGitEnable; - final bool isSocialNetworkEnable; - final bool isVpnEnable; + const ServicesState.empty() : this(services: const []); - ServicesState enableList( - final List list, - ) => - ServicesState( - isPasswordManagerEnable: list.contains(ServiceTypes.passwordManager) - ? true - : isPasswordManagerEnable, - isCloudEnable: list.contains(ServiceTypes.cloud) ? true : isCloudEnable, - isGitEnable: - list.contains(ServiceTypes.git) ? true : isPasswordManagerEnable, - isSocialNetworkEnable: list.contains(ServiceTypes.socialNetwork) - ? true - : isPasswordManagerEnable, - isVpnEnable: - list.contains(ServiceTypes.vpn) ? true : isPasswordManagerEnable, - ); + final List services; + bool get isPasswordManagerEnable => services.firstWhere((final service) => service.id == 'bitwarden', orElse: () => Service.empty).isEnabled; + bool get isCloudEnable => services.firstWhere((final service) => service.id == 'nextcloud', orElse: () => Service.empty).isEnabled; + bool get isGitEnable => services.firstWhere((final service) => service.id == 'gitea', orElse: () => Service.empty).isEnabled; + bool get isSocialNetworkEnable => services.firstWhere((final service) => service.id == 'pleroma', orElse: () => Service.empty).isEnabled; + bool get isVpnEnable => services.firstWhere((final service) => service.id == 'ocserv', orElse: () => Service.empty).isEnabled; - ServicesState disableList( - final List list, - ) => - ServicesState( - isPasswordManagerEnable: list.contains(ServiceTypes.passwordManager) - ? false - : isPasswordManagerEnable, - isCloudEnable: - list.contains(ServiceTypes.cloud) ? false : isCloudEnable, - isGitEnable: - list.contains(ServiceTypes.git) ? false : isPasswordManagerEnable, - isSocialNetworkEnable: list.contains(ServiceTypes.socialNetwork) - ? false - : isPasswordManagerEnable, - isVpnEnable: - list.contains(ServiceTypes.vpn) ? false : isPasswordManagerEnable, - ); + Service? getServiceById(final String id) { + final service = services.firstWhere((final service) => service.id == id, orElse: () => Service.empty); + if (service.id == 'empty') { + return null; + } + return service; + } @override List get props => [ - isPasswordManagerEnable, - isCloudEnable, - isGitEnable, - isSocialNetworkEnable, - isVpnEnable + services, ]; bool isEnableByType(final ServiceTypes type) { switch (type) { - case ServiceTypes.passwordManager: + case ServiceTypes.bitwarden: return isPasswordManagerEnable; - case ServiceTypes.cloud: + case ServiceTypes.nextcloud: return isCloudEnable; - case ServiceTypes.socialNetwork: + case ServiceTypes.pleroma: return isSocialNetworkEnable; - case ServiceTypes.git: + case ServiceTypes.gitea: return isGitEnable; - case ServiceTypes.vpn: + case ServiceTypes.ocserv: return isVpnEnable; default: throw Exception('wrong state'); diff --git a/lib/logic/models/job.dart b/lib/logic/models/job.dart index 9e694597..6ea31588 100644 --- a/lib/logic/models/job.dart +++ b/lib/logic/models/job.dart @@ -48,7 +48,7 @@ class ToggleJob extends ClientJob { required final super.title, }); - final dynamic type; + final ServiceTypes type; @override List get props => [...super.props, type]; @@ -56,7 +56,7 @@ class ToggleJob extends ClientJob { class ServiceToggleJob extends ToggleJob { ServiceToggleJob({ - required final ServiceTypes super.type, + required final super.type, required this.needToTurnOn, }) : super( title: diff --git a/lib/logic/models/service.dart b/lib/logic/models/service.dart index c0f54224..1085622a 100644 --- a/lib/logic/models/service.dart +++ b/lib/logic/models/service.dart @@ -12,6 +12,7 @@ class Service { required this.description, required this.isEnabled, required this.isRequired, + required this.isMovable, required this.status, required this.storageUsage, required this.svgIcon, @@ -26,6 +27,7 @@ class Service { description: service.description, isEnabled: service.isEnabled, isRequired: service.isRequired, + isMovable: service.isMovable, status: ServiceStatus.fromGraphQL(service.status), storageUsage: ServiceStorageUsage( used: DiskSize(byte: int.parse(service.storageUsage.usedSpace)), @@ -40,11 +42,29 @@ class Service { url: service.url, ); + static Service empty = Service( + id: 'empty', + displayName: '', + description: '', + isEnabled: false, + isRequired: false, + isMovable: false, + status: ServiceStatus.off, + storageUsage: ServiceStorageUsage( + used: DiskSize(byte: 0), + volume: '', + ), + svgIcon: '', + dnsRecords: [], + url: '', + ); + final String id; final String displayName; final String description; final bool isEnabled; final bool isRequired; + final bool isMovable; final ServiceStatus status; final ServiceStorageUsage storageUsage; final String svgIcon; diff --git a/lib/ui/components/brand_cards/brand_cards.dart b/lib/ui/components/brand_cards/brand_cards.dart index d8f48088..f3273e7a 100644 --- a/lib/ui/components/brand_cards/brand_cards.dart +++ b/lib/ui/components/brand_cards/brand_cards.dart @@ -25,9 +25,11 @@ class BrandCards { static Widget filled({ required final Widget child, final bool tertiary = false, + final bool error = false, }) => _FilledCard( tertiary: tertiary, + error: error, child: child, ); } @@ -81,10 +83,12 @@ class _FilledCard extends StatelessWidget { const _FilledCard({ required this.child, required this.tertiary, + required this.error, }); final Widget child; final bool tertiary; + final bool error; @override Widget build(final BuildContext context) => Card( elevation: 0.0, @@ -92,7 +96,8 @@ class _FilledCard extends StatelessWidget { borderRadius: BorderRadius.all(Radius.circular(12)), ), clipBehavior: Clip.antiAlias, - color: tertiary + color: error ? Theme.of(context).colorScheme.errorContainer + : tertiary ? Theme.of(context).colorScheme.tertiaryContainer : Theme.of(context).colorScheme.surfaceVariant, child: child, diff --git a/lib/ui/pages/services/service_page.dart b/lib/ui/pages/services/service_page.dart index afdd9718..75e7c7cf 100644 --- a/lib/ui/pages/services/service_page.dart +++ b/lib/ui/pages/services/service_page.dart @@ -1,9 +1,16 @@ import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; +import 'package:selfprivacy/logic/cubit/services/services_cubit.dart'; +import 'package:selfprivacy/logic/models/service.dart'; import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; +import 'package:url_launcher/url_launcher.dart'; class ServicePage extends StatefulWidget { - const ServicePage({final super.key}); + const ServicePage({required this.serviceId, final super.key}); + + final String serviceId; @override State createState() => _ServicePageState(); @@ -11,73 +18,190 @@ class ServicePage extends StatefulWidget { class _ServicePageState extends State { @override - Widget build(final BuildContext context) => BrandHeroScreen( + Widget build(final BuildContext context) { + final Service? service = + context.watch().state.getServiceById(widget.serviceId); + + if (service == null) { + return const BrandHeroScreen( hasBackButton: true, children: [ - const SizedBox(height: 16), - Container( - alignment: Alignment.center, - child: const Icon( - Icons.question_mark_outlined, - size: 48, - ), + Center( + child: CircularProgressIndicator(), ), - const SizedBox(height: 16), - Text( - 'My Incredible Service', - textAlign: TextAlign.center, - style: Theme.of(context).textTheme.headlineMedium!.copyWith( - color: Theme.of(context).colorScheme.onBackground, - ), - ), - const SizedBox(height: 16), - BrandCards.outlined( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 24), - child: const Icon( - Icons.check_box_outlined, - size: 24, - ), - ), - const SizedBox(width: 16), - ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 130), - child: const Text(''), - ), - ], - ), - ), - const SizedBox(height: 16), - const Divider(), - const SizedBox(height: 16), - ElevatedButton( - onPressed: null, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 24), - child: const Icon( - Icons.language_outlined, - size: 24, - ), - ), - const SizedBox(width: 16), - ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 130), - child: const Text('Your Cool Domain'), - ), - ], - ), - ), - const SizedBox(height: 16), ], ); + } + return BrandHeroScreen( + hasBackButton: true, + children: [ + Container( + alignment: Alignment.center, + child: SvgPicture.string( + service.svgIcon, + width: 48.0, + height: 48.0, + ), + ), + const SizedBox(height: 16), + Text( + service.displayName, + textAlign: TextAlign.center, + style: Theme.of(context).textTheme.headlineMedium!.copyWith( + color: Theme.of(context).colorScheme.onBackground, + ), + ), + const SizedBox(height: 16), + ServiceStatusCard(status: service.status), + const SizedBox(height: 16), + if (service.url != null) + ListTile( + iconColor: Theme.of(context).colorScheme.onBackground, + onTap: () => _launchURL(service.url), + leading: const Icon(Icons.open_in_browser), + title: Text( + 'Open in browser', + style: Theme.of(context).textTheme.titleMedium, + ), + subtitle: Text( + service.url!.replaceAll('https://', ''), + style: Theme.of(context).textTheme.bodyMedium, + ), + ), + const SizedBox(height: 8), + const Divider(), + const SizedBox(height: 8), + ListTile( + iconColor: Theme.of(context).colorScheme.onBackground, + onTap: () => {}, + leading: const Icon(Icons.restart_alt_outlined), + title: Text( + 'Restart service', + style: Theme.of(context).textTheme.titleMedium, + ), + ), + ListTile( + iconColor: Theme.of(context).colorScheme.onBackground, + onTap: () => {}, + leading: const Icon(Icons.power_settings_new), + title: Text( + 'Disable service', + style: Theme.of(context).textTheme.titleMedium, + ), + ), + if (service.isMovable) + ListTile( + iconColor: Theme.of(context).colorScheme.onBackground, + onTap: () => {}, + leading: const Icon(Icons.drive_file_move_outlined), + title: Text( + 'Move to another volume', + style: Theme.of(context).textTheme.titleMedium, + ), + ), + ], + ); + } +} + +class ServiceStatusCard extends StatelessWidget { + const ServiceStatusCard({ + required this.status, + final super.key, + }); + final ServiceStatus status; + + @override + Widget build(final BuildContext context) { + switch (status) { + case ServiceStatus.active: + return BrandCards.filled( + child: const ListTile( + leading: Icon( + Icons.check_circle_outline, + size: 24, + ), + title: Text('Up and running'), + ), + ); + case ServiceStatus.inactive: + return BrandCards.filled( + child: const ListTile( + leading: Icon( + Icons.stop_circle_outlined, + size: 24, + ), + title: Text('Stopped'), + ), + tertiary: true, + ); + case ServiceStatus.failed: + return BrandCards.filled( + child: const ListTile( + leading: Icon( + Icons.error_outline, + size: 24, + ), + title: Text('Failed to start'), + ), + error: true, + ); + case ServiceStatus.off: + return BrandCards.filled( + child: const ListTile( + leading: Icon( + Icons.power_settings_new, + size: 24, + ), + title: Text('Disabled'), + ), + tertiary: true, + ); + case ServiceStatus.activating: + return BrandCards.filled( + child: const ListTile( + leading: Icon( + Icons.restart_alt_outlined, + size: 24, + ), + title: Text('Activating'), + ), + tertiary: true, + ); + case ServiceStatus.deactivating: + return BrandCards.filled( + child: const ListTile( + leading: Icon( + Icons.restart_alt_outlined, + size: 24, + ), + title: Text('Deactivating'), + ), + tertiary: true, + ); + case ServiceStatus.reloading: + return BrandCards.filled( + child: const ListTile( + leading: Icon( + Icons.restart_alt_outlined, + size: 24, + ), + title: Text('Restarting'), + ), + tertiary: true, + ); + } + } +} + +void _launchURL(final url) async { + try { + final Uri uri = Uri.parse(url); + await launchUrl( + uri, + mode: LaunchMode.externalApplication, + ); + } catch (e) { + print(e); + } } diff --git a/lib/ui/pages/services/services.dart b/lib/ui/pages/services/services.dart index 0a2b7db4..ba8465d2 100644 --- a/lib/ui/pages/services/services.dart +++ b/lib/ui/pages/services/services.dart @@ -1,16 +1,13 @@ import 'dart:ui'; import 'package:flutter/material.dart'; -import 'package:selfprivacy/config/brand_colors.dart'; import 'package:selfprivacy/config/brand_theme.dart'; -import 'package:selfprivacy/config/text_themes.dart'; import 'package:selfprivacy/logic/common_enum/common_enum.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/cubit/jobs/jobs_cubit.dart'; import 'package:selfprivacy/logic/cubit/services/services_cubit.dart'; import 'package:selfprivacy/logic/models/job.dart'; import 'package:selfprivacy/logic/models/state_types.dart'; -import 'package:selfprivacy/ui/components/brand_button/brand_button.dart'; import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; import 'package:selfprivacy/ui/components/brand_switch/brand_switch.dart'; @@ -18,17 +15,17 @@ import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; import 'package:selfprivacy/ui/components/icon_status_mask/icon_status_mask.dart'; import 'package:selfprivacy/ui/components/not_ready_card/not_ready_card.dart'; import 'package:easy_localization/easy_localization.dart'; +import 'package:selfprivacy/ui/pages/services/service_page.dart'; +import 'package:selfprivacy/utils/route_transitions/basic.dart'; import 'package:selfprivacy/utils/ui_helpers.dart'; -import 'package:url_launcher/url_launcher_string.dart'; - -import 'package:selfprivacy/ui/pages/root_route.dart'; +import 'package:url_launcher/url_launcher.dart'; const switchableServices = [ - ServiceTypes.passwordManager, - ServiceTypes.cloud, - ServiceTypes.socialNetwork, - ServiceTypes.git, - ServiceTypes.vpn, + ServiceTypes.bitwarden, + ServiceTypes.nextcloud, + ServiceTypes.pleroma, + ServiceTypes.gitea, + ServiceTypes.ocserv, ]; class ServicesPage extends StatefulWidget { @@ -39,18 +36,14 @@ class ServicesPage extends StatefulWidget { } void _launchURL(final url) async { - final canLaunch = await canLaunchUrlString(url); - - if (canLaunch) { - try { - await launchUrlString( - url, - ); - } catch (e) { - print(e); - } - } else { - throw 'Could not launch $url'; + try { + final Uri uri = Uri.parse(url); + await launchUrl( + uri, + mode: LaunchMode.externalApplication, + ); + } catch (e) { + print(e); } } @@ -67,23 +60,28 @@ class _ServicesPageState extends State { title: 'basis.services'.tr(), ), ), - body: ListView( - padding: paddingH15V0, - children: [ - BrandText.body1('services.title'.tr()), - const SizedBox(height: 24), - if (!isReady) ...[const NotReadyCard(), const SizedBox(height: 24)], - ...ServiceTypes.values - .map( - (final t) => Padding( - padding: const EdgeInsets.only( - bottom: 30, + body: RefreshIndicator( + onRefresh: () async { + context.read().reload(); + }, + child: ListView( + padding: paddingH15V0, + children: [ + BrandText.body1('services.title'.tr()), + const SizedBox(height: 24), + if (!isReady) ...[const NotReadyCard(), const SizedBox(height: 24)], + ...ServiceTypes.values + .map( + (final t) => Padding( + padding: const EdgeInsets.only( + bottom: 30, + ), + child: _Card(serviceType: t), ), - child: _Card(serviceType: t), - ), - ) - .toList() - ], + ) + .toList() + ], + ), ), ); } @@ -97,7 +95,6 @@ class _Card extends StatelessWidget { Widget build(final BuildContext context) { final isReady = context.watch().state is ServerInstallationFinished; - final changeTab = context.read().onPress; final serviceState = context.watch().state; final jobsCubit = context.watch(); @@ -118,21 +115,11 @@ class _Card extends StatelessWidget { final domainName = UiHelpers.getDomainName(config); return GestureDetector( - onTap: isSwitchOn - ? () => showDialog( - context: context, - // isScrollControlled: true, - // backgroundColor: Colors.transparent, - builder: (final BuildContext context) => _ServiceDetails( - serviceType: serviceType, - status: - isSwitchOn ? StateType.stable : StateType.uninitialized, - title: serviceType.title, - icon: serviceType.icon, - changeTab: changeTab, - ), - ) - : null, + onTap: () => Navigator.of(context).push( + materialRoute( + ServicePage(serviceId: serviceType.name) + ) + ), child: BrandCards.big( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -202,7 +189,7 @@ class _Card extends StatelessWidget { const SizedBox(height: 10), ], ), - if (serviceType == ServiceTypes.mail) + if (serviceType == ServiceTypes.mailserver) Column( children: [ Text( @@ -246,257 +233,3 @@ class _Card extends StatelessWidget { ); } } - -class _ServiceDetails extends StatelessWidget { - const _ServiceDetails({ - required this.serviceType, - required this.icon, - required this.status, - required this.title, - required this.changeTab, - }); - - final ServiceTypes serviceType; - final IconData icon; - final StateType status; - final String title; - final ValueChanged changeTab; - - @override - Widget build(final BuildContext context) { - late Widget child; - - final config = context.watch().state; - final domainName = UiHelpers.getDomainName(config); - - final linksStyle = body1Style.copyWith( - fontSize: 15, - color: Theme.of(context).brightness == Brightness.dark - ? Colors.white - : BrandColors.black, - fontWeight: FontWeight.bold, - decoration: TextDecoration.underline, - ); - - final textStyle = body1Style.copyWith( - color: Theme.of(context).brightness == Brightness.dark - ? Colors.white - : BrandColors.black, - ); - switch (serviceType) { - case ServiceTypes.mail: - child = RichText( - text: TextSpan( - children: [ - TextSpan( - text: 'services.mail.bottom_sheet.1'.tr(args: [domainName]), - style: textStyle, - ), - const WidgetSpan(child: SizedBox(width: 5)), - WidgetSpan( - child: Padding( - padding: const EdgeInsets.only(bottom: 0.8), - child: GestureDetector( - child: Text( - 'services.mail.bottom_sheet.2'.tr(), - style: linksStyle, - ), - onTap: () { - Navigator.of(context).pop(); - changeTab(2); - }, - ), - ), - ), - ], - ), - ); - break; - case ServiceTypes.messenger: - child = RichText( - text: TextSpan( - children: [ - TextSpan( - text: - 'services.messenger.bottom_sheet.1'.tr(args: [domainName]), - style: textStyle, - ) - ], - ), - ); - break; - case ServiceTypes.passwordManager: - child = RichText( - text: TextSpan( - children: [ - TextSpan( - text: 'services.password_manager.bottom_sheet.1' - .tr(args: [domainName]), - style: textStyle, - ), - const WidgetSpan(child: SizedBox(width: 5)), - WidgetSpan( - child: Padding( - padding: const EdgeInsets.only(bottom: 0.8), - child: GestureDetector( - onTap: () => _launchURL('https://password.$domainName'), - child: Text( - 'password.$domainName', - style: linksStyle, - ), - ), - ), - ), - ], - ), - ); - break; - case ServiceTypes.video: - child = RichText( - text: TextSpan( - children: [ - TextSpan( - text: 'services.video.bottom_sheet.1'.tr(args: [domainName]), - style: textStyle, - ), - const WidgetSpan(child: SizedBox(width: 5)), - WidgetSpan( - child: Padding( - padding: const EdgeInsets.only(bottom: 0.8), - child: GestureDetector( - onTap: () => _launchURL('https://meet.$domainName'), - child: Text( - 'meet.$domainName', - style: linksStyle, - ), - ), - ), - ), - ], - ), - ); - break; - case ServiceTypes.cloud: - child = RichText( - text: TextSpan( - children: [ - TextSpan( - text: 'services.cloud.bottom_sheet.1'.tr(args: [domainName]), - style: textStyle, - ), - const WidgetSpan(child: SizedBox(width: 5)), - WidgetSpan( - child: Padding( - padding: const EdgeInsets.only(bottom: 0.8), - child: GestureDetector( - onTap: () => _launchURL('https://cloud.$domainName'), - child: Text( - 'cloud.$domainName', - style: linksStyle, - ), - ), - ), - ), - ], - ), - ); - break; - case ServiceTypes.socialNetwork: - child = RichText( - text: TextSpan( - children: [ - TextSpan( - text: 'services.social_network.bottom_sheet.1' - .tr(args: [domainName]), - style: textStyle, - ), - const WidgetSpan(child: SizedBox(width: 5)), - WidgetSpan( - child: Padding( - padding: const EdgeInsets.only(bottom: 0.8), - child: GestureDetector( - onTap: () => _launchURL('https://social.$domainName'), - child: Text( - 'social.$domainName', - style: linksStyle, - ), - ), - ), - ), - ], - ), - ); - break; - case ServiceTypes.git: - child = RichText( - text: TextSpan( - children: [ - TextSpan( - text: 'services.git.bottom_sheet.1'.tr(args: [domainName]), - style: textStyle, - ), - const WidgetSpan(child: SizedBox(width: 5)), - WidgetSpan( - child: Padding( - padding: const EdgeInsets.only(bottom: 0.8), - child: GestureDetector( - onTap: () => _launchURL('https://git.$domainName'), - child: Text( - 'git.$domainName', - style: linksStyle, - ), - ), - ), - ), - ], - ), - ); - break; - case ServiceTypes.vpn: - child = Text( - 'services.vpn.bottom_sheet.1'.tr(), - ); - } - - return Dialog( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(20), - ), - child: SingleChildScrollView( - child: SizedBox( - width: 350, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: paddingH15V30, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - IconStatusMask( - status: status, - child: Icon(icon, size: 40, color: Colors.white), - ), - const SizedBox(height: 10), - BrandText.h2(title), - const SizedBox(height: 10), - child, - const SizedBox(height: 40), - Center( - child: Container( - child: BrandButton.rised( - onPressed: () => Navigator.of(context).pop(), - text: 'basis.close'.tr(), - ), - ), - ), - ], - ), - ) - ], - ), - ), - ), - ); - } -} From 503c8d37eafaef74b53a52f1f291124921a7212e Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 30 Aug 2022 06:09:09 +0300 Subject: [PATCH 037/115] Implement server jobs cubit --- lib/config/bloc_config.dart | 7 ++- .../client_jobs_cubit.dart} | 56 ++++------------- .../cubit/client_jobs/client_jobs_state.dart | 26 ++++++++ .../cubit/forms/user/ssh_form_cubit.dart | 2 +- .../cubit/forms/user/user_form_cubit.dart | 2 +- lib/logic/cubit/jobs/jobs_state.dart | 34 ----------- .../cubit/server_jobs/server_jobs_cubit.dart | 61 +++++++++++++++++++ .../cubit/server_jobs/server_jobs_state.dart | 16 +++++ .../components/jobs_content/jobs_content.dart | 13 ++-- .../pre_styled_buttons/flash_fab.dart | 2 +- .../pre_styled_buttons.dart | 2 +- lib/ui/pages/services/services.dart | 9 +-- lib/ui/pages/ssh_keys/ssh_keys.dart | 2 +- lib/ui/pages/users/users.dart | 2 +- 14 files changed, 136 insertions(+), 98 deletions(-) rename lib/logic/cubit/{jobs/jobs_cubit.dart => client_jobs/client_jobs_cubit.dart} (73%) create mode 100644 lib/logic/cubit/client_jobs/client_jobs_state.dart delete mode 100644 lib/logic/cubit/jobs/jobs_state.dart create mode 100644 lib/logic/cubit/server_jobs/server_jobs_cubit.dart create mode 100644 lib/logic/cubit/server_jobs/server_jobs_state.dart diff --git a/lib/config/bloc_config.dart b/lib/config/bloc_config.dart index 0b4fe048..fd00db2b 100644 --- a/lib/config/bloc_config.dart +++ b/lib/config/bloc_config.dart @@ -6,8 +6,9 @@ import 'package:selfprivacy/logic/cubit/server_installation/server_installation_ import 'package:selfprivacy/logic/cubit/app_settings/app_settings_cubit.dart'; import 'package:selfprivacy/logic/cubit/backups/backups_cubit.dart'; import 'package:selfprivacy/logic/cubit/dns_records/dns_records_cubit.dart'; -import 'package:selfprivacy/logic/cubit/jobs/jobs_cubit.dart'; +import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart'; import 'package:selfprivacy/logic/cubit/providers/providers_cubit.dart'; +import 'package:selfprivacy/logic/cubit/server_jobs/server_jobs_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_volumes/server_volume_cubit.dart'; import 'package:selfprivacy/logic/cubit/services/services_cubit.dart'; import 'package:selfprivacy/logic/cubit/users/users_cubit.dart'; @@ -30,6 +31,7 @@ class BlocAndProviderConfig extends StatelessWidget { final apiDevicesCubit = ApiDevicesCubit(serverInstallationCubit); final apiVolumesCubit = ApiProviderVolumeCubit(serverInstallationCubit); final apiServerVolumesCubit = ApiServerVolumeCubit(serverInstallationCubit); + final serverJobsCubit = ServerJobsCubit(serverInstallationCubit); return MultiProvider( providers: [ @@ -73,6 +75,9 @@ class BlocAndProviderConfig extends StatelessWidget { BlocProvider( create: (final _) => apiServerVolumesCubit..load(), ), + BlocProvider( + create: (final _) => serverJobsCubit..load(), + ), BlocProvider( create: (final _) => JobsCubit( usersCubit: usersCubit, diff --git a/lib/logic/cubit/jobs/jobs_cubit.dart b/lib/logic/cubit/client_jobs/client_jobs_cubit.dart similarity index 73% rename from lib/logic/cubit/jobs/jobs_cubit.dart rename to lib/logic/cubit/client_jobs/client_jobs_cubit.dart index 4457fba5..7461a6df 100644 --- a/lib/logic/cubit/jobs/jobs_cubit.dart +++ b/lib/logic/cubit/client_jobs/client_jobs_cubit.dart @@ -8,17 +8,16 @@ import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server.dart'; import 'package:selfprivacy/logic/cubit/services/services_cubit.dart'; import 'package:selfprivacy/logic/cubit/users/users_cubit.dart'; import 'package:selfprivacy/logic/models/job.dart'; -import 'package:selfprivacy/logic/models/json/server_job.dart'; export 'package:provider/provider.dart'; -part 'jobs_state.dart'; +part 'client_jobs_state.dart'; class JobsCubit extends Cubit { JobsCubit({ required this.usersCubit, required this.servicesCubit, - }) : super(const JobsStateEmpty([])); + }) : super(JobsStateEmpty()); final ServerApi api = ServerApi(); final UsersCubit usersCubit; @@ -32,7 +31,7 @@ class JobsCubit extends Cubit { } newJobsList.add(job); getIt().showSnackBar('jobs.jobAdded'.tr()); - emit(JobsStateWithJobs(newJobsList, state.serverJobList)); + emit(JobsStateWithJobs(newJobsList)); } void removeJob(final String id) { @@ -55,7 +54,7 @@ class JobsCubit extends Cubit { } else { newJobsList.add(job); getIt().showSnackBar('jobs.jobAdded'.tr()); - emit(JobsStateWithJobs(newJobsList, state.serverJobList)); + emit(JobsStateWithJobs(newJobsList)); } } @@ -69,23 +68,23 @@ class JobsCubit extends Cubit { if (!isExistInJobList) { newJobsList.add(job); getIt().showSnackBar('jobs.jobAdded'.tr()); - emit(JobsStateWithJobs(newJobsList, state.serverJobList)); + emit(JobsStateWithJobs(newJobsList)); } } Future rebootServer() async { - emit(JobsStateLoading(state.serverJobList)); + emit(JobsStateLoading()); final bool isSuccessful = await api.reboot(); if (isSuccessful) { getIt().showSnackBar('jobs.rebootSuccess'.tr()); } else { getIt().showSnackBar('jobs.rebootFailed'.tr()); } - emit(JobsStateEmpty(state.serverJobList)); + emit(JobsStateEmpty()); } Future upgradeServer() async { - emit(JobsStateLoading(state.serverJobList)); + emit(JobsStateLoading()); final bool isPullSuccessful = await api.pullConfigurationUpdate(); final bool isSuccessful = await api.upgrade(); if (isSuccessful) { @@ -97,13 +96,13 @@ class JobsCubit extends Cubit { } else { getIt().showSnackBar('jobs.upgradeFailed'.tr()); } - emit(JobsStateEmpty(state.serverJobList)); + emit(JobsStateEmpty()); } Future applyAll() async { if (state is JobsStateWithJobs) { final List jobs = (state as JobsStateWithJobs).clientJobList; - emit(JobsStateLoading(state.serverJobList)); + emit(JobsStateLoading()); bool hasServiceJobs = false; for (final ClientJob job in jobs) { if (job is CreateUserJob) { @@ -131,40 +130,7 @@ class JobsCubit extends Cubit { await servicesCubit.load(); } - emit(JobsStateEmpty(state.serverJobList)); + emit(JobsStateEmpty()); } } - - Future resetRequestsTimer() async { - const duration = Duration(seconds: 1); - Timer.periodic( - duration, - (final timer) async { - if (timer.tick >= 10) { - final List serverJobs = await api.getServerJobs(); - final List newServerJobs = []; - for (final ServerJob job in serverJobs) { - if (job.status == 'FINISHED') { - await api.removeApiJob(job.uid); - } else { - newServerJobs.add(job); - } - } - - if (state is JobsStateWithJobs) { - emit( - JobsStateWithJobs( - (state as JobsStateWithJobs).clientJobList, - newServerJobs, - ), - ); - } else { - emit( - JobsStateEmpty(newServerJobs), - ); - } - } - }, - ); - } } diff --git a/lib/logic/cubit/client_jobs/client_jobs_state.dart b/lib/logic/cubit/client_jobs/client_jobs_state.dart new file mode 100644 index 00000000..2bb31856 --- /dev/null +++ b/lib/logic/cubit/client_jobs/client_jobs_state.dart @@ -0,0 +1,26 @@ +part of 'client_jobs_cubit.dart'; + +abstract class JobsState extends Equatable { + @override + List get props => []; +} + +class JobsStateLoading extends JobsState {} + +class JobsStateEmpty extends JobsState {} + +class JobsStateWithJobs extends JobsState { + JobsStateWithJobs(this.clientJobList); + final List clientJobList; + JobsState removeById(final String id) { + final List newJobsList = + clientJobList.where((final element) => element.id != id).toList(); + if (newJobsList.isEmpty) { + return JobsStateEmpty(); + } + return JobsStateWithJobs(newJobsList); + } + + @override + List get props => clientJobList; +} diff --git a/lib/logic/cubit/forms/user/ssh_form_cubit.dart b/lib/logic/cubit/forms/user/ssh_form_cubit.dart index b6493ee7..ba992af0 100644 --- a/lib/logic/cubit/forms/user/ssh_form_cubit.dart +++ b/lib/logic/cubit/forms/user/ssh_form_cubit.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'package:cubit_form/cubit_form.dart'; import 'package:easy_localization/easy_localization.dart'; -import 'package:selfprivacy/logic/cubit/jobs/jobs_cubit.dart'; +import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart'; import 'package:selfprivacy/logic/models/job.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; diff --git a/lib/logic/cubit/forms/user/user_form_cubit.dart b/lib/logic/cubit/forms/user/user_form_cubit.dart index a385befb..92f66f15 100644 --- a/lib/logic/cubit/forms/user/user_form_cubit.dart +++ b/lib/logic/cubit/forms/user/user_form_cubit.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'package:cubit_form/cubit_form.dart'; import 'package:selfprivacy/logic/cubit/forms/factories/field_cubit_factory.dart'; -import 'package:selfprivacy/logic/cubit/jobs/jobs_cubit.dart'; +import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart'; import 'package:selfprivacy/logic/models/job.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; import 'package:selfprivacy/utils/password_generator.dart'; diff --git a/lib/logic/cubit/jobs/jobs_state.dart b/lib/logic/cubit/jobs/jobs_state.dart deleted file mode 100644 index 3737cb5d..00000000 --- a/lib/logic/cubit/jobs/jobs_state.dart +++ /dev/null @@ -1,34 +0,0 @@ -part of 'jobs_cubit.dart'; - -abstract class JobsState extends Equatable { - const JobsState(this.serverJobList); - final List serverJobList; - @override - List get props => [serverJobList]; -} - -class JobsStateLoading extends JobsState { - const JobsStateLoading(super.serverJobList); -} - -class JobsStateEmpty extends JobsState { - const JobsStateEmpty(super.serverJobList); -} - -class JobsStateWithJobs extends JobsState { - const JobsStateWithJobs(this.clientJobList, super.serverJobList); - final List clientJobList; - - JobsState removeById(final String id) { - final List newJobsList = - clientJobList.where((final element) => element.id != id).toList(); - - if (newJobsList.isEmpty) { - return JobsStateEmpty(serverJobList); - } - return JobsStateWithJobs(newJobsList, serverJobList); - } - - @override - List get props => [...super.props, clientJobList]; -} diff --git a/lib/logic/cubit/server_jobs/server_jobs_cubit.dart b/lib/logic/cubit/server_jobs/server_jobs_cubit.dart new file mode 100644 index 00000000..254e6380 --- /dev/null +++ b/lib/logic/cubit/server_jobs/server_jobs_cubit.dart @@ -0,0 +1,61 @@ +import 'dart:async'; + +import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server.dart'; +import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; +import 'package:selfprivacy/logic/models/json/server_job.dart'; + +export 'package:provider/provider.dart'; + +part 'server_jobs_state.dart'; + +class ServerJobsCubit + extends ServerInstallationDependendCubit { + ServerJobsCubit(final ServerInstallationCubit serverInstallationCubit) + : super( + serverInstallationCubit, + const ServerJobsState( + serverJobList: [], + ), + ); + + Timer? timer; + final ServerApi api = ServerApi(); + + @override + void clear() async { + emit( + const ServerJobsState( + serverJobList: [], + ), + ); + if (timer != null && timer!.isActive) { + timer!.cancel(); + timer = null; + } + } + + @override + void load() async { + if (serverInstallationCubit.state is ServerInstallationFinished) { + final List jobs = await api.getServerJobs(); + emit( + ServerJobsState( + serverJobList: jobs, + ), + ); + timer = Timer(const Duration(seconds: 10), () => reload(useTimer: true)); + } + } + + Future reload({final bool useTimer = false}) async { + final List jobs = await api.getServerJobs(); + emit( + ServerJobsState( + serverJobList: jobs, + ), + ); + if (useTimer) { + timer = Timer(const Duration(seconds: 10), () => reload(useTimer: true)); + } + } +} diff --git a/lib/logic/cubit/server_jobs/server_jobs_state.dart b/lib/logic/cubit/server_jobs/server_jobs_state.dart new file mode 100644 index 00000000..82ac4377 --- /dev/null +++ b/lib/logic/cubit/server_jobs/server_jobs_state.dart @@ -0,0 +1,16 @@ +part of 'server_jobs_cubit.dart'; + +class ServerJobsState extends ServerInstallationDependendState { + const ServerJobsState({this.serverJobList = const []}); + final List serverJobList; + + @override + List get props => serverJobList; + + ServerJobsState copyWith({ + final List? serverJobList, + }) => + ServerJobsState( + serverJobList: serverJobList ?? this.serverJobList, + ); +} diff --git a/lib/ui/components/jobs_content/jobs_content.dart b/lib/ui/components/jobs_content/jobs_content.dart index 3948f7c4..f7063230 100644 --- a/lib/ui/components/jobs_content/jobs_content.dart +++ b/lib/ui/components/jobs_content/jobs_content.dart @@ -3,8 +3,9 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:selfprivacy/config/brand_theme.dart'; import 'package:selfprivacy/config/get_it_config.dart'; -import 'package:selfprivacy/logic/cubit/jobs/jobs_cubit.dart'; +import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; +import 'package:selfprivacy/logic/cubit/server_jobs/server_jobs_cubit.dart'; import 'package:selfprivacy/ui/components/action_button/action_button.dart'; import 'package:selfprivacy/ui/components/brand_alert/brand_alert.dart'; import 'package:selfprivacy/ui/components/brand_button/brand_button.dart'; @@ -122,11 +123,11 @@ class JobsContent extends StatelessWidget { const SizedBox(height: 8), const Divider(), const SizedBox(height: 8), - ...state.serverJobList.map( - (final job) => ServerJobCard( - serverJob: job, - ), - ), + ...context.read().state.serverJobList.map( + (final job) => ServerJobCard( + serverJob: job, + ), + ), ], ); }, diff --git a/lib/ui/components/pre_styled_buttons/flash_fab.dart b/lib/ui/components/pre_styled_buttons/flash_fab.dart index 4ae29087..c9fb754f 100644 --- a/lib/ui/components/pre_styled_buttons/flash_fab.dart +++ b/lib/ui/components/pre_styled_buttons/flash_fab.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:ionicons/ionicons.dart'; -import 'package:selfprivacy/logic/cubit/jobs/jobs_cubit.dart'; +import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart'; import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart'; import 'package:selfprivacy/ui/components/jobs_content/jobs_content.dart'; import 'package:selfprivacy/ui/helpers/modals.dart'; diff --git a/lib/ui/components/pre_styled_buttons/pre_styled_buttons.dart b/lib/ui/components/pre_styled_buttons/pre_styled_buttons.dart index ad9105fb..5649236c 100644 --- a/lib/ui/components/pre_styled_buttons/pre_styled_buttons.dart +++ b/lib/ui/components/pre_styled_buttons/pre_styled_buttons.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:ionicons/ionicons.dart'; import 'package:selfprivacy/config/brand_colors.dart'; -import 'package:selfprivacy/logic/cubit/jobs/jobs_cubit.dart'; +import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart'; import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart'; import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; import 'package:easy_localization/easy_localization.dart'; diff --git a/lib/ui/pages/services/services.dart b/lib/ui/pages/services/services.dart index ba8465d2..a469d06b 100644 --- a/lib/ui/pages/services/services.dart +++ b/lib/ui/pages/services/services.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; import 'package:selfprivacy/config/brand_theme.dart'; import 'package:selfprivacy/logic/common_enum/common_enum.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; -import 'package:selfprivacy/logic/cubit/jobs/jobs_cubit.dart'; +import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart'; import 'package:selfprivacy/logic/cubit/services/services_cubit.dart'; import 'package:selfprivacy/logic/models/job.dart'; import 'package:selfprivacy/logic/models/state_types.dart'; @@ -115,11 +115,8 @@ class _Card extends StatelessWidget { final domainName = UiHelpers.getDomainName(config); return GestureDetector( - onTap: () => Navigator.of(context).push( - materialRoute( - ServicePage(serviceId: serviceType.name) - ) - ), + onTap: () => Navigator.of(context) + .push(materialRoute(ServicePage(serviceId: serviceType.name))), child: BrandCards.big( child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/ui/pages/ssh_keys/ssh_keys.dart b/lib/ui/pages/ssh_keys/ssh_keys.dart index 4059ba63..64c1af9c 100644 --- a/lib/ui/pages/ssh_keys/ssh_keys.dart +++ b/lib/ui/pages/ssh_keys/ssh_keys.dart @@ -10,7 +10,7 @@ import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart'; import 'package:selfprivacy/config/brand_colors.dart'; import 'package:selfprivacy/config/brand_theme.dart'; -import 'package:selfprivacy/logic/cubit/jobs/jobs_cubit.dart'; +import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; import 'package:selfprivacy/ui/components/brand_button/brand_button.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; diff --git a/lib/ui/pages/users/users.dart b/lib/ui/pages/users/users.dart index 659453d1..3ccb696a 100644 --- a/lib/ui/pages/users/users.dart +++ b/lib/ui/pages/users/users.dart @@ -8,7 +8,7 @@ import 'package:selfprivacy/config/text_themes.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/user/user_form_cubit.dart'; -import 'package:selfprivacy/logic/cubit/jobs/jobs_cubit.dart'; +import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart'; import 'package:selfprivacy/logic/cubit/users/users_cubit.dart'; import 'package:selfprivacy/logic/models/job.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; From 0602ab7de2ba312c5700c5abe88d44727557f2c2 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 30 Aug 2022 22:17:22 +0300 Subject: [PATCH 038/115] Fetch russian text assets --- assets/translations/en.json | 1 + assets/translations/ru.json | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index dac1f23c..ce1bfb5f 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -307,6 +307,7 @@ "15": "Server created. DNS checks and server boot in progress...", "16": "Until the next check: ", "17": "Check", + "18": "How to obtain Hetzner API Token:'", "19": "1 Go via this link ", "20": "\n", "21": "One more restart to apply your security certificates.", diff --git a/assets/translations/ru.json b/assets/translations/ru.json index 40bb2a9a..1ac780a9 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -163,7 +163,25 @@ "refresh": "Обновить статус", "refetchBackups": "Обновить список копий", "refetchingList": "Через несколько минут список будет обновлён" - + }, + "storage": { + "card_title": "Хранилище", + "status_ok": "Проблем на диске не обнаружено", + "status_error": "Заканчивается место на диске", + "disk_usage": "{} использовано", + "disk_total": "{} всего · {}", + "gb": "{} GB", + "mb": "{} MB", + "kb": "{} KB", + "extend_volume_button": "Расширить хранилище", + "extending_volume_title": "Расширение хранилища", + "extending_volume_description": "Изменение размера хранилища позволит вам держать больше данных на вашем сервере без расширения самого сервера. Объем можно только увеличить: уменьшить нельзя.", + "extending_volume_price_info": "Цена включает НДС и рассчитана на основе данных о ценах, предоставленных Hetzner.", + "size": "Размер", + "euro": "Евро", + "data_migration_title": "Миграция данных", + "data_migration_notice": "На время миграции данных все сервисы будут выключены.", + "start_migration_button": "Начать миграцию" } }, "not_ready_card": { @@ -239,6 +257,15 @@ "bottom_sheet": { "1": "Создать подключиться к VPN-серверу. Движок для безопасной и масштабируемой инфраструктуры VPN" } + }, + "page": { + "up_and_running": "Запущен и работает", + "resource_usage": "Потребление ресурсов", + "disk_used": "{} использовано места на диске", + "users": "Пользователи", + "controlled_by": "Контролируется {}", + "apps": "Приложения", + "settings": "Настройки" } }, "users": { @@ -322,6 +349,10 @@ "domain_not_available_on_token": "Введённый токен не имеет доступа к нужному домену.", "modal_confirmation_title": "Это действительно ваш сервер?", "modal_confirmation_description": "Подключение к неправильному серверу может привести к деструктивным последствиям.", + "modal_confirmation_dns_valid": "Обратный DNS корректен", + "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_backblze": "Подключение к Backblaze", From a693f694ac667c9c0f6f7ebad45c0657c735cad7 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 2 Sep 2022 08:59:46 +0300 Subject: [PATCH 039/115] Add endpoints for migration checking --- .../schema/server_settings.graphql | 8 + .../schema/server_settings.graphql.dart | 410 ++++++++++++++++++ .../schema/server_settings.graphql.g.dart | 44 ++ .../graphql_maps/server_api/server.dart | 19 +- .../server_volumes/server_volume_cubit.dart | 12 +- .../server_volumes/server_volume_state.dart | 18 +- 6 files changed, 502 insertions(+), 9 deletions(-) diff --git a/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql index 75d36d0a..5f175e8a 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql @@ -21,6 +21,14 @@ query SystemSettings { } } +query SystemIsUsingBinds { + system { + info { + usingBinds + } + } +} + query DomainInfo { system { domainInfo { 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 4a920a4d..924f5d00 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 @@ -939,6 +939,416 @@ class _CopyWithStubImpl$Query$SystemSettings$system$settings$ssh _res; } +@JsonSerializable(explicitToJson: true) +class Query$SystemIsUsingBinds { + Query$SystemIsUsingBinds({required this.system, required this.$__typename}); + + @override + factory Query$SystemIsUsingBinds.fromJson(Map json) => + _$Query$SystemIsUsingBindsFromJson(json); + + final Query$SystemIsUsingBinds$system system; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$SystemIsUsingBindsToJson(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$SystemIsUsingBinds) || + 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$SystemIsUsingBinds + on Query$SystemIsUsingBinds { + CopyWith$Query$SystemIsUsingBinds get copyWith => + 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.stub(TRes res) = + _CopyWithStubImpl$Query$SystemIsUsingBinds; + + 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); + + final Query$SystemIsUsingBinds _instance; + + final TRes Function(Query$SystemIsUsingBinds) _then; + + static const _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))); + CopyWith$Query$SystemIsUsingBinds$system get system { + final local$system = _instance.system; + return CopyWith$Query$SystemIsUsingBinds$system( + local$system, (e) => call(system: e)); + } +} + +class _CopyWithStubImpl$Query$SystemIsUsingBinds + implements CopyWith$Query$SystemIsUsingBinds { + _CopyWithStubImpl$Query$SystemIsUsingBinds(this._res); + + TRes _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'), + 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) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), +]); +Query$SystemIsUsingBinds _parserFn$Query$SystemIsUsingBinds( + Map data) => + Query$SystemIsUsingBinds.fromJson(data); + +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); +} + +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); +} + +class FetchMoreOptions$Query$SystemIsUsingBinds + extends graphql.FetchMoreOptions { + FetchMoreOptions$Query$SystemIsUsingBinds( + {required graphql.UpdateQuery updateQuery}) + : super( + updateQuery: updateQuery, + document: documentNodeQuerySystemIsUsingBinds); +} + +extension ClientExtension$Query$SystemIsUsingBinds on graphql.GraphQLClient { + Future> + query$SystemIsUsingBinds( + [Options$Query$SystemIsUsingBinds? options]) async => + await this.query(options ?? Options$Query$SystemIsUsingBinds()); + graphql.ObservableQuery + watchQuery$SystemIsUsingBinds( + [WatchOptions$Query$SystemIsUsingBinds? options]) => + this.watchQuery(options ?? WatchOptions$Query$SystemIsUsingBinds()); + 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); + return result == null ? null : Query$SystemIsUsingBinds.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$SystemIsUsingBinds$system { + Query$SystemIsUsingBinds$system( + {required this.info, required this.$__typename}); + + @override + factory Query$SystemIsUsingBinds$system.fromJson(Map json) => + _$Query$SystemIsUsingBinds$systemFromJson(json); + + final Query$SystemIsUsingBinds$system$info info; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Query$SystemIsUsingBinds$systemToJson(this); + int get hashCode { + final l$info = info; + final l$$__typename = $__typename; + return Object.hashAll([l$info, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$SystemIsUsingBinds$system) || + runtimeType != other.runtimeType) return false; + final l$info = info; + final lOther$info = other.info; + if (l$info != lOther$info) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$SystemIsUsingBinds$system + on Query$SystemIsUsingBinds$system { + CopyWith$Query$SystemIsUsingBinds$system + 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; + + factory CopyWith$Query$SystemIsUsingBinds$system.stub(TRes res) = + _CopyWithStubImpl$Query$SystemIsUsingBinds$system; + + 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); + + final Query$SystemIsUsingBinds$system _instance; + + final TRes Function(Query$SystemIsUsingBinds$system) _then; + + static const _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))); + CopyWith$Query$SystemIsUsingBinds$system$info get info { + final local$info = _instance.info; + return CopyWith$Query$SystemIsUsingBinds$system$info( + local$info, (e) => call(info: e)); + } +} + +class _CopyWithStubImpl$Query$SystemIsUsingBinds$system + implements CopyWith$Query$SystemIsUsingBinds$system { + _CopyWithStubImpl$Query$SystemIsUsingBinds$system(this._res); + + TRes _res; + + 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}); + + @override + factory Query$SystemIsUsingBinds$system$info.fromJson( + Map json) => + _$Query$SystemIsUsingBinds$system$infoFromJson(json); + + final bool usingBinds; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Query$SystemIsUsingBinds$system$infoToJson(this); + int get hashCode { + final l$usingBinds = usingBinds; + final l$$__typename = $__typename; + return Object.hashAll([l$usingBinds, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$SystemIsUsingBinds$system$info) || + runtimeType != other.runtimeType) return false; + final l$usingBinds = usingBinds; + final lOther$usingBinds = other.usingBinds; + if (l$usingBinds != lOther$usingBinds) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +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); +} + +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; + + factory CopyWith$Query$SystemIsUsingBinds$system$info.stub(TRes res) = + _CopyWithStubImpl$Query$SystemIsUsingBinds$system$info; + + 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); + + final Query$SystemIsUsingBinds$system$info _instance; + + final TRes Function(Query$SystemIsUsingBinds$system$info) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Query$SystemIsUsingBinds$system$info + implements CopyWith$Query$SystemIsUsingBinds$system$info { + _CopyWithStubImpl$Query$SystemIsUsingBinds$system$info(this._res); + + TRes _res; + + call({bool? usingBinds, String? $__typename}) => _res; +} + @JsonSerializable(explicitToJson: true) class Query$DomainInfo { Query$DomainInfo({required this.system, required this.$__typename}); 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 d3e51515..d60ae006 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 @@ -113,6 +113,50 @@ Map _$Query$SystemSettings$system$settings$sshToJson( '__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( diff --git a/lib/logic/api_maps/graphql_maps/server_api/server.dart b/lib/logic/api_maps/graphql_maps/server_api/server.dart index 13ea67a7..4fb757e2 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/server.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/server.dart @@ -2,6 +2,7 @@ import 'package:graphql/client.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/api_map.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/schema.graphql.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_api.graphql.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/services.graphql.dart'; @@ -73,6 +74,23 @@ class ServerApi extends ApiMap return apiVersion; } + Future isUsingBinds() async { + QueryResult response; + bool usesBinds = false; + + try { + final GraphQLClient client = await getClient(); + response = await client.query$SystemIsUsingBinds(); + if (response.hasException) { + print(response.exception.toString()); + } + usesBinds = response.data!['system']['info']['usingBinds']; + } catch (e) { + print(e); + } + return usesBinds; + } + Future> getApiTokens() async { QueryResult response; List tokens = []; @@ -89,7 +107,6 @@ class ServerApi extends ApiMap } catch (e) { print(e); } - return tokens; } diff --git a/lib/logic/cubit/server_volumes/server_volume_cubit.dart b/lib/logic/cubit/server_volumes/server_volume_cubit.dart index 13015d0b..53b185c7 100644 --- a/lib/logic/cubit/server_volumes/server_volume_cubit.dart +++ b/lib/logic/cubit/server_volumes/server_volume_cubit.dart @@ -20,13 +20,15 @@ class ApiServerVolumeCubit } Future _refetch() async { - final List volumes = - await serverApi.getServerDiskVolumes(); + final volumes = await serverApi.getServerDiskVolumes(); + final usesBinds = await serverApi.isUsingBinds(); + var status = LoadingStatus.error; + if (volumes.isNotEmpty) { - emit(ApiServerVolumeState(volumes, LoadingStatus.success)); - } else { - emit(const ApiServerVolumeState([], LoadingStatus.error)); + status = LoadingStatus.success; } + + emit(ApiServerVolumeState(volumes, status, usesBinds)); } @override diff --git a/lib/logic/cubit/server_volumes/server_volume_state.dart b/lib/logic/cubit/server_volumes/server_volume_state.dart index 3c267710..12b0b9be 100644 --- a/lib/logic/cubit/server_volumes/server_volume_state.dart +++ b/lib/logic/cubit/server_volumes/server_volume_state.dart @@ -1,11 +1,21 @@ part of 'server_volume_cubit.dart'; class ApiServerVolumeState extends ServerInstallationDependendState { - const ApiServerVolumeState(this._volumes, this.status); + const ApiServerVolumeState( + this._volumes, + this.status, + this.usesBinds, + ); const ApiServerVolumeState.initial() - : this(const [], LoadingStatus.uninitialized); + : this( + const [], + LoadingStatus.uninitialized, + null, + ); + final List _volumes; + final bool? usesBinds; final LoadingStatus status; List get volumes => _volumes; @@ -13,12 +23,14 @@ class ApiServerVolumeState extends ServerInstallationDependendState { ApiServerVolumeState copyWith({ final List? volumes, final LoadingStatus? status, + final bool? usesBinds, }) => ApiServerVolumeState( volumes ?? _volumes, status ?? this.status, + usesBinds ?? this.usesBinds, ); @override - List get props => [_volumes]; + List get props => [_volumes, status, usesBinds]; } From 88a1393a1dc85840c1e97f5803ec5f18f4d71506 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 2 Sep 2022 09:05:35 +0300 Subject: [PATCH 040/115] Move disk status converting to disk status constructor --- .../server_volumes/server_volume_state.dart | 6 +- lib/ui/pages/providers/providers.dart | 59 +------------------ lib/ui/pages/server_storage/disk_status.dart | 56 ++++++++++++++++++ 3 files changed, 58 insertions(+), 63 deletions(-) diff --git a/lib/logic/cubit/server_volumes/server_volume_state.dart b/lib/logic/cubit/server_volumes/server_volume_state.dart index 12b0b9be..3df43855 100644 --- a/lib/logic/cubit/server_volumes/server_volume_state.dart +++ b/lib/logic/cubit/server_volumes/server_volume_state.dart @@ -8,11 +8,7 @@ class ApiServerVolumeState extends ServerInstallationDependendState { ); const ApiServerVolumeState.initial() - : this( - const [], - LoadingStatus.uninitialized, - null, - ); + : this(const [], LoadingStatus.uninitialized, null); final List _volumes; final bool? usesBinds; diff --git a/lib/ui/pages/providers/providers.dart b/lib/ui/pages/providers/providers.dart index 2696bf85..a1e03a19 100644 --- a/lib/ui/pages/providers/providers.dart +++ b/lib/ui/pages/providers/providers.dart @@ -7,9 +7,6 @@ import 'package:selfprivacy/logic/cubit/providers/providers_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/cubit/provider_volumes/provider_volume_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_volumes/server_volume_cubit.dart'; -import 'package:selfprivacy/logic/models/disk_size.dart'; -import 'package:selfprivacy/logic/models/hive/server_details.dart'; -import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; import 'package:selfprivacy/logic/models/provider.dart'; import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart'; import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; @@ -78,7 +75,7 @@ class _ProvidersPageState extends State { Padding( padding: const EdgeInsets.only(bottom: 30), child: StorageCard( - diskStatus: toDiskStatus( + diskStatus: DiskStatus.fromVolumes( context.read().state.volumes, context.read().state.volumes, ), @@ -104,60 +101,6 @@ class _ProvidersPageState extends State { ), ); } - - DiskStatus toDiskStatus( - final List serverVolumes, - final List providerVolumes, - ) { - final DiskStatus diskStatus = DiskStatus(); - diskStatus.isDiskOkay = true; - - if (providerVolumes.isEmpty || serverVolumes.isEmpty) { - diskStatus.isDiskOkay = false; - } - - diskStatus.diskVolumes = serverVolumes.map(( - final ServerDiskVolume volume, - ) { - final DiskVolume diskVolume = DiskVolume(); - diskVolume.sizeUsed = DiskSize( - byte: volume.usedSpace == 'None' ? 0 : int.parse(volume.usedSpace), - ); - diskVolume.sizeTotal = DiskSize( - byte: volume.totalSpace == 'None' ? 0 : int.parse(volume.totalSpace), - ); - diskVolume.serverDiskVolume = volume; - - for (final ServerVolume providerVolume in providerVolumes) { - if (providerVolume.linuxDevice == null || - volume.model == null || - volume.serial == null) { - continue; - } - - final String deviceId = providerVolume.linuxDevice!.split('/').last; - if (deviceId.contains(volume.model!) && - deviceId.contains(volume.serial!)) { - diskVolume.providerVolume = providerVolume; - break; - } - } - - diskVolume.name = volume.name; - diskVolume.root = volume.root; - diskVolume.percentage = - volume.usedSpace != 'None' && volume.totalSpace != 'None' - ? 1.0 / diskVolume.sizeTotal.byte * diskVolume.sizeUsed.byte - : 0.0; - if (diskVolume.percentage >= 0.8 || - diskVolume.sizeTotal.asGb() - diskVolume.sizeUsed.asGb() <= 2.0) { - diskStatus.isDiskOkay = false; - } - return diskVolume; - }).toList(); - - return diskStatus; - } } class _Card extends StatelessWidget { diff --git a/lib/ui/pages/server_storage/disk_status.dart b/lib/ui/pages/server_storage/disk_status.dart index 2c00097b..4c9949e0 100644 --- a/lib/ui/pages/server_storage/disk_status.dart +++ b/lib/ui/pages/server_storage/disk_status.dart @@ -16,6 +16,62 @@ class DiskVolume { } class DiskStatus { + DiskStatus() { + isDiskOkay = false; + diskVolumes = []; + } + + DiskStatus.fromVolumes( + final List serverVolumes, + final List providerVolumes, + ) { + isDiskOkay = true; + + if (providerVolumes.isEmpty || serverVolumes.isEmpty) { + isDiskOkay = false; + } + + diskVolumes = serverVolumes.map(( + final ServerDiskVolume volume, + ) { + final DiskVolume diskVolume = DiskVolume(); + diskVolume.sizeUsed = DiskSize( + byte: volume.usedSpace == 'None' ? 0 : int.parse(volume.usedSpace), + ); + diskVolume.sizeTotal = DiskSize( + byte: volume.totalSpace == 'None' ? 0 : int.parse(volume.totalSpace), + ); + diskVolume.serverDiskVolume = volume; + + for (final ServerVolume providerVolume in providerVolumes) { + if (providerVolume.linuxDevice == null || + volume.model == null || + volume.serial == null) { + continue; + } + + final String deviceId = providerVolume.linuxDevice!.split('/').last; + if (deviceId.contains(volume.model!) && + deviceId.contains(volume.serial!)) { + diskVolume.providerVolume = providerVolume; + break; + } + } + + diskVolume.name = volume.name; + diskVolume.root = volume.root; + diskVolume.percentage = + volume.usedSpace != 'None' && volume.totalSpace != 'None' + ? 1.0 / diskVolume.sizeTotal.byte * diskVolume.sizeUsed.byte + : 0.0; + if (diskVolume.percentage >= 0.8 || + diskVolume.sizeTotal.asGb() - diskVolume.sizeUsed.asGb() <= 2.0) { + isDiskOkay = false; + } + return diskVolume; + }).toList(); + } + bool isDiskOkay = false; List diskVolumes = []; } From 33b8003f07f904687cb095659d85c320353522dd Mon Sep 17 00:00:00 2001 From: Inex Code Date: Sun, 4 Sep 2022 13:45:03 +0300 Subject: [PATCH 041/115] Add user-related GraphQL handlers --- .../graphql_maps/schema/users.graphql | 65 +- .../graphql_maps/schema/users.graphql.dart | 4257 +++++++---------- .../graphql_maps/schema/users.graphql.g.dart | 492 +- .../graphql_maps/server_api/server.dart | 3 + .../graphql_maps/server_api/users_api.dart | 189 + lib/logic/models/hive/user.dart | 11 +- 6 files changed, 2197 insertions(+), 2820 deletions(-) create mode 100644 lib/logic/api_maps/graphql_maps/server_api/users_api.dart diff --git a/lib/logic/api_maps/graphql_maps/schema/users.graphql b/lib/logic/api_maps/graphql_maps/schema/users.graphql index cfe01820..4f16ffc5 100644 --- a/lib/logic/api_maps/graphql_maps/schema/users.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/users.graphql @@ -4,35 +4,16 @@ fragment basicMutationReturnFields on MutationReturnInterface{ success } - -mutation CreateUser($user: UserMutationInput!) { - createUser(user: $user) { - ...basicMutationReturnFields - user { - username - userType - sshKeys - } - } +fragment userFields on User{ + username + userType + sshKeys } query AllUsers { users { allUsers { - userType - username - sshKeys - } - } -} - -mutation AddSshKey($sshInput: SshMutationInput!) { - addSshKey(sshInput: $sshInput) { - ...basicMutationReturnFields - user { - sshKeys - userType - username + ...userFields } } } @@ -40,20 +21,16 @@ mutation AddSshKey($sshInput: SshMutationInput!) { query GetUser($username: String!) { users { getUser(username: $username) { - sshKeys - userType - username + ...userFields } } } -mutation RemoveSshKey($sshInput: SshMutationInput!) { - removeSshKey(sshInput: $sshInput) { +mutation CreateUser($user: UserMutationInput!) { + createUser(user: $user) { ...basicMutationReturnFields user { - sshKeys - userType - username + ...userFields } } } @@ -68,9 +45,25 @@ mutation UpdateUser($user: UserMutationInput!) { updateUser(user: $user) { ...basicMutationReturnFields user { - sshKeys - userType - username + ...userFields } } -} \ No newline at end of file +} + +mutation AddSshKey($sshInput: SshMutationInput!) { + addSshKey(sshInput: $sshInput) { + ...basicMutationReturnFields + user { + ...userFields + } + } +} + +mutation RemoveSshKey($sshInput: SshMutationInput!) { + removeSshKey(sshInput: $sshInput) { + ...basicMutationReturnFields + user { + ...userFields + } + } +} 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 4fa5cac1..328b4a3b 100644 --- a/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart @@ -186,6 +186,898 @@ extension ClientExtension$Fragment$basicMutationReturnFields } } +@JsonSerializable(explicitToJson: true) +class Fragment$userFields { + Fragment$userFields( + {required this.username, + required this.userType, + required this.sshKeys, + required this.$__typename}); + + @override + factory Fragment$userFields.fromJson(Map json) => + _$Fragment$userFieldsFromJson(json); + + 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); + int get hashCode { + final l$username = username; + final l$userType = userType; + final l$sshKeys = sshKeys; + final l$$__typename = $__typename; + return Object.hashAll([ + l$username, + l$userType, + Object.hashAll(l$sshKeys.map((v) => v)), + l$$__typename + ]); + } + + @override + bool operator ==(Object other) { + 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; + final l$userType = userType; + final lOther$userType = other.userType; + 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; + 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; + } + + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + 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); +} + +abstract class CopyWith$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}); +} + +class _CopyWithImpl$Fragment$userFields + implements CopyWith$Fragment$userFields { + _CopyWithImpl$Fragment$userFields(this._instance, this._then); + + final Fragment$userFields _instance; + + final TRes Function(Fragment$userFields) _then; + + static const _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))); +} + +class _CopyWithStubImpl$Fragment$userFields + implements CopyWith$Fragment$userFields { + _CopyWithStubImpl$Fragment$userFields(this._res); + + TRes _res; + + 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) + ])); +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}) => + 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); + return result == null ? null : Fragment$userFields.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$AllUsers { + Query$AllUsers({required this.users, required this.$__typename}); + + @override + factory Query$AllUsers.fromJson(Map json) => + _$Query$AllUsersFromJson(json); + + final Query$AllUsers$users users; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$AllUsersToJson(this); + int get hashCode { + final l$users = users; + final l$$__typename = $__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) + return false; + final l$users = users; + final lOther$users = other.users; + if (l$users != lOther$users) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + 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); +} + +abstract class CopyWith$Query$AllUsers { + factory CopyWith$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}); + CopyWith$Query$AllUsers$users get users; +} + +class _CopyWithImpl$Query$AllUsers + implements CopyWith$Query$AllUsers { + _CopyWithImpl$Query$AllUsers(this._instance, this._then); + + final Query$AllUsers _instance; + + final TRes Function(Query$AllUsers) _then; + + static const _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))); + CopyWith$Query$AllUsers$users get users { + final local$users = _instance.users; + return CopyWith$Query$AllUsers$users(local$users, (e) => call(users: e)); + } +} + +class _CopyWithStubImpl$Query$AllUsers + implements CopyWith$Query$AllUsers { + _CopyWithStubImpl$Query$AllUsers(this._res); + + TRes _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'), + 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: '__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) + ])), + 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); +} + +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); +} + +class FetchMoreOptions$Query$AllUsers extends graphql.FetchMoreOptions { + FetchMoreOptions$Query$AllUsers({required graphql.UpdateQuery updateQuery}) + : super(updateQuery: updateQuery, document: documentNodeQueryAllUsers); +} + +extension ClientExtension$Query$AllUsers on graphql.GraphQLClient { + Future> query$AllUsers( + [Options$Query$AllUsers? options]) async => + await this.query(options ?? Options$Query$AllUsers()); + graphql.ObservableQuery watchQuery$AllUsers( + [WatchOptions$Query$AllUsers? options]) => + this.watchQuery(options ?? WatchOptions$Query$AllUsers()); + 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); + return result == null ? null : Query$AllUsers.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$AllUsers$users { + Query$AllUsers$users({required this.allUsers, required this.$__typename}); + + @override + factory Query$AllUsers$users.fromJson(Map json) => + _$Query$AllUsers$usersFromJson(json); + + final List allUsers; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$AllUsers$usersToJson(this); + int get hashCode { + final l$allUsers = allUsers; + final l$$__typename = $__typename; + return Object.hashAll( + [Object.hashAll(l$allUsers.map((v) => v)), l$$__typename]); + } + + @override + bool operator ==(Object other) { + 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; + 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; + } + + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + 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); +} + +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.stub(TRes res) = + _CopyWithStubImpl$Query$AllUsers$users; + + TRes call({List? allUsers, String? $__typename}); + TRes allUsers( + Iterable Function( + Iterable>) + _fn); +} + +class _CopyWithImpl$Query$AllUsers$users + implements CopyWith$Query$AllUsers$users { + _CopyWithImpl$Query$AllUsers$users(this._instance, this._then); + + final Query$AllUsers$users _instance; + + final TRes Function(Query$AllUsers$users) _then; + + static const _undefined = {}; + + TRes call( + {Object? allUsers = _undefined, Object? $__typename = _undefined}) => + _then(Query$AllUsers$users( + allUsers: allUsers == _undefined || allUsers == null + ? _instance.allUsers + : (allUsers as List), + $__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()); +} + +class _CopyWithStubImpl$Query$AllUsers$users + implements CopyWith$Query$AllUsers$users { + _CopyWithStubImpl$Query$AllUsers$users(this._res); + + TRes _res; + + call({List? allUsers, String? $__typename}) => _res; + allUsers(_fn) => _res; +} + +@JsonSerializable(explicitToJson: true) +class Variables$Query$GetUser { + Variables$Query$GetUser({required this.username}); + + @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.stub(TRes res) = + _CopyWithStubImpl$Variables$Query$GetUser; + + TRes call({String? username}); +} + +class _CopyWithImpl$Variables$Query$GetUser + implements CopyWith$Variables$Query$GetUser { + _CopyWithImpl$Variables$Query$GetUser(this._instance, this._then); + + final Variables$Query$GetUser _instance; + + final TRes Function(Variables$Query$GetUser) _then; + + static const _undefined = {}; + + TRes call({Object? username = _undefined}) => _then(Variables$Query$GetUser( + username: username == _undefined || username == null + ? _instance.username + : (username as String))); +} + +class _CopyWithStubImpl$Variables$Query$GetUser + implements CopyWith$Variables$Query$GetUser { + _CopyWithStubImpl$Variables$Query$GetUser(this._res); + + TRes _res; + + call({String? username}) => _res; +} + +@JsonSerializable(explicitToJson: true) +class Query$GetUser { + Query$GetUser({required this.users, required this.$__typename}); + + @override + factory Query$GetUser.fromJson(Map json) => + _$Query$GetUserFromJson(json); + + final Query$GetUser$users users; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$GetUserToJson(this); + int get hashCode { + final l$users = users; + final l$$__typename = $__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) + return false; + final l$users = users; + final lOther$users = other.users; + if (l$users != lOther$users) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + 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); +} + +abstract class CopyWith$Query$GetUser { + factory CopyWith$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}); + CopyWith$Query$GetUser$users get users; +} + +class _CopyWithImpl$Query$GetUser + implements CopyWith$Query$GetUser { + _CopyWithImpl$Query$GetUser(this._instance, this._then); + + final Query$GetUser _instance; + + final TRes Function(Query$GetUser) _then; + + static const _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))); + CopyWith$Query$GetUser$users get users { + final local$users = _instance.users; + return CopyWith$Query$GetUser$users(local$users, (e) => call(users: e)); + } +} + +class _CopyWithStubImpl$Query$GetUser + implements CopyWith$Query$GetUser { + _CopyWithStubImpl$Query$GetUser(this._res); + + TRes _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'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + 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) + ])), + 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); +} + +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); +} + +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); +} + +extension ClientExtension$Query$GetUser on graphql.GraphQLClient { + Future> query$GetUser( + Options$Query$GetUser options) async => + await this.query(options); + 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}) => + 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); + return result == null ? null : Query$GetUser.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$GetUser$users { + Query$GetUser$users({this.getUser, required this.$__typename}); + + @override + factory Query$GetUser$users.fromJson(Map json) => + _$Query$GetUser$usersFromJson(json); + + final Fragment$userFields? getUser; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$GetUser$usersToJson(this); + int get hashCode { + final l$getUser = getUser; + final l$$__typename = $__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) + return false; + final l$getUser = getUser; + final lOther$getUser = other.getUser; + if (l$getUser != lOther$getUser) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + 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); +} + +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.stub(TRes res) = + _CopyWithStubImpl$Query$GetUser$users; + + 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); + + final Query$GetUser$users _instance; + + final TRes Function(Query$GetUser$users) _then; + + static const _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))); + CopyWith$Fragment$userFields get getUser { + final local$getUser = _instance.getUser; + return local$getUser == null + ? CopyWith$Fragment$userFields.stub(_then(_instance)) + : CopyWith$Fragment$userFields(local$getUser, (e) => call(getUser: e)); + } +} + +class _CopyWithStubImpl$Query$GetUser$users + implements CopyWith$Query$GetUser$users { + _CopyWithStubImpl$Query$GetUser$users(this._res); + + TRes _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}); @@ -378,24 +1270,8 @@ const documentNodeMutationCreateUser = DocumentNode(definitions: [ arguments: [], 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), + FragmentSpreadNode( + name: NameNode(value: 'userFields'), directives: []), FieldNode( name: NameNode(value: '__typename'), alias: null, @@ -418,6 +1294,7 @@ const documentNodeMutationCreateUser = DocumentNode(definitions: [ selectionSet: null) ])), fragmentDefinitionbasicMutationReturnFields, + fragmentDefinitionuserFields, ]); Mutation$CreateUser _parserFn$Mutation$CreateUser(Map data) => Mutation$CreateUser.fromJson(data); @@ -528,7 +1405,7 @@ class Mutation$CreateUser$createUser @JsonKey(name: '__typename') final String $__typename; - final Mutation$CreateUser$createUser$user? user; + final Fragment$userFields? user; Map toJson() => _$Mutation$CreateUser$createUserToJson(this); int get hashCode { @@ -585,8 +1462,8 @@ abstract class CopyWith$Mutation$CreateUser$createUser { String? message, bool? success, String? $__typename, - Mutation$CreateUser$createUser$user? user}); - CopyWith$Mutation$CreateUser$createUser$user get user; + Fragment$userFields? user}); + CopyWith$Fragment$userFields get user; } class _CopyWithImpl$Mutation$CreateUser$createUser @@ -620,13 +1497,12 @@ class _CopyWithImpl$Mutation$CreateUser$createUser : ($__typename as String), user: user == _undefined ? _instance.user - : (user as Mutation$CreateUser$createUser$user?))); - CopyWith$Mutation$CreateUser$createUser$user get user { + : (user as Fragment$userFields?))); + CopyWith$Fragment$userFields get user { final local$user = _instance.user; return local$user == null - ? CopyWith$Mutation$CreateUser$createUser$user.stub(_then(_instance)) - : CopyWith$Mutation$CreateUser$createUser$user( - local$user, (e) => call(user: e)); + ? CopyWith$Fragment$userFields.stub(_then(_instance)) + : CopyWith$Fragment$userFields(local$user, (e) => call(user: e)); } } @@ -641,2345 +1517,10 @@ class _CopyWithStubImpl$Mutation$CreateUser$createUser String? message, bool? success, String? $__typename, - Mutation$CreateUser$createUser$user? user}) => - _res; - CopyWith$Mutation$CreateUser$createUser$user get user => - CopyWith$Mutation$CreateUser$createUser$user.stub(_res); -} - -@JsonSerializable(explicitToJson: true) -class Mutation$CreateUser$createUser$user { - Mutation$CreateUser$createUser$user( - {required this.username, - required this.userType, - required this.sshKeys, - required this.$__typename}); - - @override - factory Mutation$CreateUser$createUser$user.fromJson( - Map json) => - _$Mutation$CreateUser$createUser$userFromJson(json); - - final String username; - - @JsonKey(unknownEnumValue: Enum$UserType.$unknown) - final Enum$UserType userType; - - final List sshKeys; - - @JsonKey(name: '__typename') - final String $__typename; - - Map toJson() => - _$Mutation$CreateUser$createUser$userToJson(this); - int get hashCode { - final l$username = username; - final l$userType = userType; - final l$sshKeys = sshKeys; - final l$$__typename = $__typename; - return Object.hashAll([ - l$username, - l$userType, - Object.hashAll(l$sshKeys.map((v) => v)), - l$$__typename - ]); - } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Mutation$CreateUser$createUser$user) || - runtimeType != other.runtimeType) return false; - final l$username = username; - final lOther$username = other.username; - if (l$username != lOther$username) return false; - final l$userType = userType; - final lOther$userType = other.userType; - 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; - 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; - } - - final l$$__typename = $__typename; - final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; - return true; - } -} - -extension UtilityExtension$Mutation$CreateUser$createUser$user - on Mutation$CreateUser$createUser$user { - CopyWith$Mutation$CreateUser$createUser$user< - Mutation$CreateUser$createUser$user> - get copyWith => - CopyWith$Mutation$CreateUser$createUser$user(this, (i) => i); -} - -abstract class CopyWith$Mutation$CreateUser$createUser$user { - factory CopyWith$Mutation$CreateUser$createUser$user( - Mutation$CreateUser$createUser$user instance, - TRes Function(Mutation$CreateUser$createUser$user) then) = - _CopyWithImpl$Mutation$CreateUser$createUser$user; - - factory CopyWith$Mutation$CreateUser$createUser$user.stub(TRes res) = - _CopyWithStubImpl$Mutation$CreateUser$createUser$user; - - TRes call( - {String? username, - Enum$UserType? userType, - List? sshKeys, - String? $__typename}); -} - -class _CopyWithImpl$Mutation$CreateUser$createUser$user - implements CopyWith$Mutation$CreateUser$createUser$user { - _CopyWithImpl$Mutation$CreateUser$createUser$user(this._instance, this._then); - - final Mutation$CreateUser$createUser$user _instance; - - final TRes Function(Mutation$CreateUser$createUser$user) _then; - - static const _undefined = {}; - - TRes call( - {Object? username = _undefined, - Object? userType = _undefined, - Object? sshKeys = _undefined, - Object? $__typename = _undefined}) => - _then(Mutation$CreateUser$createUser$user( - 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$Mutation$CreateUser$createUser$user - implements CopyWith$Mutation$CreateUser$createUser$user { - _CopyWithStubImpl$Mutation$CreateUser$createUser$user(this._res); - - TRes _res; - - call( - {String? username, - Enum$UserType? userType, - List? sshKeys, - String? $__typename}) => - _res; -} - -@JsonSerializable(explicitToJson: true) -class Query$AllUsers { - Query$AllUsers({required this.users, required this.$__typename}); - - @override - factory Query$AllUsers.fromJson(Map json) => - _$Query$AllUsersFromJson(json); - - final Query$AllUsers$users users; - - @JsonKey(name: '__typename') - final String $__typename; - - Map toJson() => _$Query$AllUsersToJson(this); - int get hashCode { - final l$users = users; - final l$$__typename = $__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) - return false; - final l$users = users; - final lOther$users = other.users; - if (l$users != lOther$users) return false; - final l$$__typename = $__typename; - final lOther$$__typename = other.$__typename; - 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); -} - -abstract class CopyWith$Query$AllUsers { - factory CopyWith$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}); - CopyWith$Query$AllUsers$users get users; -} - -class _CopyWithImpl$Query$AllUsers - implements CopyWith$Query$AllUsers { - _CopyWithImpl$Query$AllUsers(this._instance, this._then); - - final Query$AllUsers _instance; - - final TRes Function(Query$AllUsers) _then; - - static const _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))); - CopyWith$Query$AllUsers$users get users { - final local$users = _instance.users; - return CopyWith$Query$AllUsers$users(local$users, (e) => call(users: e)); - } -} - -class _CopyWithStubImpl$Query$AllUsers - implements CopyWith$Query$AllUsers { - _CopyWithStubImpl$Query$AllUsers(this._res); - - TRes _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'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'allUsers'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'userType'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'username'), - 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) - ])), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), -]); -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); -} - -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); -} - -class FetchMoreOptions$Query$AllUsers extends graphql.FetchMoreOptions { - FetchMoreOptions$Query$AllUsers({required graphql.UpdateQuery updateQuery}) - : super(updateQuery: updateQuery, document: documentNodeQueryAllUsers); -} - -extension ClientExtension$Query$AllUsers on graphql.GraphQLClient { - Future> query$AllUsers( - [Options$Query$AllUsers? options]) async => - await this.query(options ?? Options$Query$AllUsers()); - graphql.ObservableQuery watchQuery$AllUsers( - [WatchOptions$Query$AllUsers? options]) => - this.watchQuery(options ?? WatchOptions$Query$AllUsers()); - 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); - return result == null ? null : Query$AllUsers.fromJson(result); - } -} - -@JsonSerializable(explicitToJson: true) -class Query$AllUsers$users { - Query$AllUsers$users({required this.allUsers, required this.$__typename}); - - @override - factory Query$AllUsers$users.fromJson(Map json) => - _$Query$AllUsers$usersFromJson(json); - - final List allUsers; - - @JsonKey(name: '__typename') - final String $__typename; - - Map toJson() => _$Query$AllUsers$usersToJson(this); - int get hashCode { - final l$allUsers = allUsers; - final l$$__typename = $__typename; - return Object.hashAll( - [Object.hashAll(l$allUsers.map((v) => v)), l$$__typename]); - } - - @override - bool operator ==(Object other) { - 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; - 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; - } - - final l$$__typename = $__typename; - final lOther$$__typename = other.$__typename; - 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); -} - -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.stub(TRes res) = - _CopyWithStubImpl$Query$AllUsers$users; - - TRes call( - {List? allUsers, String? $__typename}); - TRes allUsers( - Iterable Function( - Iterable< - CopyWith$Query$AllUsers$users$allUsers< - Query$AllUsers$users$allUsers>>) - _fn); -} - -class _CopyWithImpl$Query$AllUsers$users - implements CopyWith$Query$AllUsers$users { - _CopyWithImpl$Query$AllUsers$users(this._instance, this._then); - - final Query$AllUsers$users _instance; - - final TRes Function(Query$AllUsers$users) _then; - - static const _undefined = {}; - - TRes call( - {Object? allUsers = _undefined, Object? $__typename = _undefined}) => - _then(Query$AllUsers$users( - allUsers: allUsers == _undefined || allUsers == null - ? _instance.allUsers - : (allUsers as List), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); - TRes allUsers( - Iterable Function( - Iterable< - CopyWith$Query$AllUsers$users$allUsers< - Query$AllUsers$users$allUsers>>) - _fn) => - call( - allUsers: _fn(_instance.allUsers.map( - (e) => CopyWith$Query$AllUsers$users$allUsers(e, (i) => i))) - .toList()); -} - -class _CopyWithStubImpl$Query$AllUsers$users - implements CopyWith$Query$AllUsers$users { - _CopyWithStubImpl$Query$AllUsers$users(this._res); - - TRes _res; - - call({List? allUsers, String? $__typename}) => - _res; - allUsers(_fn) => _res; -} - -@JsonSerializable(explicitToJson: true) -class Query$AllUsers$users$allUsers { - Query$AllUsers$users$allUsers( - {required this.userType, - required this.username, - required this.sshKeys, - required this.$__typename}); - - @override - factory Query$AllUsers$users$allUsers.fromJson(Map json) => - _$Query$AllUsers$users$allUsersFromJson(json); - - @JsonKey(unknownEnumValue: Enum$UserType.$unknown) - final Enum$UserType userType; - - final String username; - - final List sshKeys; - - @JsonKey(name: '__typename') - final String $__typename; - - Map toJson() => _$Query$AllUsers$users$allUsersToJson(this); - int get hashCode { - final l$userType = userType; - final l$username = username; - final l$sshKeys = sshKeys; - final l$$__typename = $__typename; - return Object.hashAll([ - l$userType, - l$username, - Object.hashAll(l$sshKeys.map((v) => v)), - l$$__typename - ]); - } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Query$AllUsers$users$allUsers) || - runtimeType != other.runtimeType) return false; - final l$userType = userType; - final lOther$userType = other.userType; - if (l$userType != lOther$userType) return false; - final l$username = username; - final lOther$username = other.username; - if (l$username != lOther$username) return false; - final l$sshKeys = sshKeys; - final lOther$sshKeys = other.sshKeys; - 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; - } - - final l$$__typename = $__typename; - final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; - return true; - } -} - -extension UtilityExtension$Query$AllUsers$users$allUsers - on Query$AllUsers$users$allUsers { - CopyWith$Query$AllUsers$users$allUsers - get copyWith => CopyWith$Query$AllUsers$users$allUsers(this, (i) => i); -} - -abstract class CopyWith$Query$AllUsers$users$allUsers { - factory CopyWith$Query$AllUsers$users$allUsers( - Query$AllUsers$users$allUsers instance, - TRes Function(Query$AllUsers$users$allUsers) then) = - _CopyWithImpl$Query$AllUsers$users$allUsers; - - factory CopyWith$Query$AllUsers$users$allUsers.stub(TRes res) = - _CopyWithStubImpl$Query$AllUsers$users$allUsers; - - TRes call( - {Enum$UserType? userType, - String? username, - List? sshKeys, - String? $__typename}); -} - -class _CopyWithImpl$Query$AllUsers$users$allUsers - implements CopyWith$Query$AllUsers$users$allUsers { - _CopyWithImpl$Query$AllUsers$users$allUsers(this._instance, this._then); - - final Query$AllUsers$users$allUsers _instance; - - final TRes Function(Query$AllUsers$users$allUsers) _then; - - static const _undefined = {}; - - TRes call( - {Object? userType = _undefined, - Object? username = _undefined, - Object? sshKeys = _undefined, - Object? $__typename = _undefined}) => - _then(Query$AllUsers$users$allUsers( - userType: userType == _undefined || userType == null - ? _instance.userType - : (userType as Enum$UserType), - username: username == _undefined || username == null - ? _instance.username - : (username as String), - sshKeys: sshKeys == _undefined || sshKeys == null - ? _instance.sshKeys - : (sshKeys as List), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); -} - -class _CopyWithStubImpl$Query$AllUsers$users$allUsers - implements CopyWith$Query$AllUsers$users$allUsers { - _CopyWithStubImpl$Query$AllUsers$users$allUsers(this._res); - - TRes _res; - - call( - {Enum$UserType? userType, - String? username, - List? sshKeys, - String? $__typename}) => - _res; -} - -@JsonSerializable(explicitToJson: true) -class Variables$Mutation$AddSshKey { - Variables$Mutation$AddSshKey({required this.sshInput}); - - @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; - - factory CopyWith$Variables$Mutation$AddSshKey.stub(TRes res) = - _CopyWithStubImpl$Variables$Mutation$AddSshKey; - - TRes call({Input$SshMutationInput? sshInput}); -} - -class _CopyWithImpl$Variables$Mutation$AddSshKey - implements CopyWith$Variables$Mutation$AddSshKey { - _CopyWithImpl$Variables$Mutation$AddSshKey(this._instance, this._then); - - final Variables$Mutation$AddSshKey _instance; - - final TRes Function(Variables$Mutation$AddSshKey) _then; - - static const _undefined = {}; - - TRes call({Object? sshInput = _undefined}) => - _then(Variables$Mutation$AddSshKey( - sshInput: sshInput == _undefined || sshInput == null - ? _instance.sshInput - : (sshInput as Input$SshMutationInput))); -} - -class _CopyWithStubImpl$Variables$Mutation$AddSshKey - implements CopyWith$Variables$Mutation$AddSshKey { - _CopyWithStubImpl$Variables$Mutation$AddSshKey(this._res); - - TRes _res; - - call({Input$SshMutationInput? sshInput}) => _res; -} - -@JsonSerializable(explicitToJson: true) -class Mutation$AddSshKey { - Mutation$AddSshKey({required this.addSshKey, required this.$__typename}); - - @override - factory Mutation$AddSshKey.fromJson(Map json) => - _$Mutation$AddSshKeyFromJson(json); - - final Mutation$AddSshKey$addSshKey addSshKey; - - @JsonKey(name: '__typename') - final String $__typename; - - Map toJson() => _$Mutation$AddSshKeyToJson(this); - int get hashCode { - final l$addSshKey = addSshKey; - final l$$__typename = $__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) - return false; - final l$addSshKey = addSshKey; - final lOther$addSshKey = other.addSshKey; - if (l$addSshKey != lOther$addSshKey) return false; - final l$$__typename = $__typename; - final lOther$$__typename = other.$__typename; - 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); -} - -abstract class CopyWith$Mutation$AddSshKey { - factory CopyWith$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}); - CopyWith$Mutation$AddSshKey$addSshKey get addSshKey; -} - -class _CopyWithImpl$Mutation$AddSshKey - implements CopyWith$Mutation$AddSshKey { - _CopyWithImpl$Mutation$AddSshKey(this._instance, this._then); - - final Mutation$AddSshKey _instance; - - final TRes Function(Mutation$AddSshKey) _then; - - static const _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))); - CopyWith$Mutation$AddSshKey$addSshKey get addSshKey { - final local$addSshKey = _instance.addSshKey; - return CopyWith$Mutation$AddSshKey$addSshKey( - local$addSshKey, (e) => call(addSshKey: e)); - } -} - -class _CopyWithStubImpl$Mutation$AddSshKey - implements CopyWith$Mutation$AddSshKey { - _CopyWithStubImpl$Mutation$AddSshKey(this._res); - - TRes _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'), - 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: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'sshKeys'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'userType'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'username'), - 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) - ])), - fragmentDefinitionbasicMutationReturnFields, -]); -Mutation$AddSshKey _parserFn$Mutation$AddSshKey(Map data) => - Mutation$AddSshKey.fromJson(data); -typedef OnMutationCompleted$Mutation$AddSshKey = FutureOr Function( - 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, - 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); - - final OnMutationCompleted$Mutation$AddSshKey? onCompletedWithParsed; - - @override - List get properties => [ - ...super.onCompleted == null - ? super.properties - : super.properties.where((property) => property != onCompleted), - 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); -} - -extension ClientExtension$Mutation$AddSshKey on graphql.GraphQLClient { - Future> mutate$AddSshKey( - Options$Mutation$AddSshKey options) async => - await this.mutate(options); - graphql.ObservableQuery watchMutation$AddSshKey( - WatchOptions$Mutation$AddSshKey options) => - 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}); - - @override - factory Mutation$AddSshKey$addSshKey.fromJson(Map json) => - _$Mutation$AddSshKey$addSshKeyFromJson(json); - - final int code; - - final String message; - - final bool success; - - @JsonKey(name: '__typename') - final String $__typename; - - final Mutation$AddSshKey$addSshKey$user? user; - - Map toJson() => _$Mutation$AddSshKey$addSshKeyToJson(this); - 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]); - } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Mutation$AddSshKey$addSshKey) || - 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; - final l$user = user; - final lOther$user = other.user; - if (l$user != lOther$user) return false; - return true; - } -} - -extension UtilityExtension$Mutation$AddSshKey$addSshKey - on Mutation$AddSshKey$addSshKey { - CopyWith$Mutation$AddSshKey$addSshKey - 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; - - factory CopyWith$Mutation$AddSshKey$addSshKey.stub(TRes res) = - _CopyWithStubImpl$Mutation$AddSshKey$addSshKey; - - TRes call( - {int? code, - String? message, - bool? success, - String? $__typename, - Mutation$AddSshKey$addSshKey$user? user}); - CopyWith$Mutation$AddSshKey$addSshKey$user get user; -} - -class _CopyWithImpl$Mutation$AddSshKey$addSshKey - implements CopyWith$Mutation$AddSshKey$addSshKey { - _CopyWithImpl$Mutation$AddSshKey$addSshKey(this._instance, this._then); - - final Mutation$AddSshKey$addSshKey _instance; - - final TRes Function(Mutation$AddSshKey$addSshKey) _then; - - static const _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 Mutation$AddSshKey$addSshKey$user?))); - CopyWith$Mutation$AddSshKey$addSshKey$user get user { - final local$user = _instance.user; - return local$user == null - ? CopyWith$Mutation$AddSshKey$addSshKey$user.stub(_then(_instance)) - : CopyWith$Mutation$AddSshKey$addSshKey$user( - local$user, (e) => call(user: e)); - } -} - -class _CopyWithStubImpl$Mutation$AddSshKey$addSshKey - implements CopyWith$Mutation$AddSshKey$addSshKey { - _CopyWithStubImpl$Mutation$AddSshKey$addSshKey(this._res); - - TRes _res; - - call( - {int? code, - String? message, - bool? success, - String? $__typename, - Mutation$AddSshKey$addSshKey$user? user}) => - _res; - CopyWith$Mutation$AddSshKey$addSshKey$user get user => - CopyWith$Mutation$AddSshKey$addSshKey$user.stub(_res); -} - -@JsonSerializable(explicitToJson: true) -class Mutation$AddSshKey$addSshKey$user { - Mutation$AddSshKey$addSshKey$user( - {required this.sshKeys, - required this.userType, - required this.username, - required this.$__typename}); - - @override - factory Mutation$AddSshKey$addSshKey$user.fromJson( - Map json) => - _$Mutation$AddSshKey$addSshKey$userFromJson(json); - - final List sshKeys; - - @JsonKey(unknownEnumValue: Enum$UserType.$unknown) - final Enum$UserType userType; - - final String username; - - @JsonKey(name: '__typename') - final String $__typename; - - Map toJson() => - _$Mutation$AddSshKey$addSshKey$userToJson(this); - int get hashCode { - final l$sshKeys = sshKeys; - final l$userType = userType; - final l$username = username; - final l$$__typename = $__typename; - return Object.hashAll([ - Object.hashAll(l$sshKeys.map((v) => v)), - l$userType, - l$username, - l$$__typename - ]); - } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Mutation$AddSshKey$addSshKey$user) || - runtimeType != other.runtimeType) return false; - final l$sshKeys = sshKeys; - final lOther$sshKeys = other.sshKeys; - 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; - } - - final l$userType = userType; - final lOther$userType = other.userType; - if (l$userType != lOther$userType) return false; - final l$username = username; - final lOther$username = other.username; - if (l$username != lOther$username) return false; - final l$$__typename = $__typename; - final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; - return true; - } -} - -extension UtilityExtension$Mutation$AddSshKey$addSshKey$user - on Mutation$AddSshKey$addSshKey$user { - CopyWith$Mutation$AddSshKey$addSshKey$user - get copyWith => - CopyWith$Mutation$AddSshKey$addSshKey$user(this, (i) => i); -} - -abstract class CopyWith$Mutation$AddSshKey$addSshKey$user { - factory CopyWith$Mutation$AddSshKey$addSshKey$user( - Mutation$AddSshKey$addSshKey$user instance, - TRes Function(Mutation$AddSshKey$addSshKey$user) then) = - _CopyWithImpl$Mutation$AddSshKey$addSshKey$user; - - factory CopyWith$Mutation$AddSshKey$addSshKey$user.stub(TRes res) = - _CopyWithStubImpl$Mutation$AddSshKey$addSshKey$user; - - TRes call( - {List? sshKeys, - Enum$UserType? userType, - String? username, - String? $__typename}); -} - -class _CopyWithImpl$Mutation$AddSshKey$addSshKey$user - implements CopyWith$Mutation$AddSshKey$addSshKey$user { - _CopyWithImpl$Mutation$AddSshKey$addSshKey$user(this._instance, this._then); - - final Mutation$AddSshKey$addSshKey$user _instance; - - final TRes Function(Mutation$AddSshKey$addSshKey$user) _then; - - static const _undefined = {}; - - TRes call( - {Object? sshKeys = _undefined, - Object? userType = _undefined, - Object? username = _undefined, - Object? $__typename = _undefined}) => - _then(Mutation$AddSshKey$addSshKey$user( - sshKeys: sshKeys == _undefined || sshKeys == null - ? _instance.sshKeys - : (sshKeys as List), - userType: userType == _undefined || userType == null - ? _instance.userType - : (userType as Enum$UserType), - username: username == _undefined || username == null - ? _instance.username - : (username as String), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); -} - -class _CopyWithStubImpl$Mutation$AddSshKey$addSshKey$user - implements CopyWith$Mutation$AddSshKey$addSshKey$user { - _CopyWithStubImpl$Mutation$AddSshKey$addSshKey$user(this._res); - - TRes _res; - - call( - {List? sshKeys, - Enum$UserType? userType, - String? username, - String? $__typename}) => - _res; -} - -@JsonSerializable(explicitToJson: true) -class Variables$Query$GetUser { - Variables$Query$GetUser({required this.username}); - - @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.stub(TRes res) = - _CopyWithStubImpl$Variables$Query$GetUser; - - TRes call({String? username}); -} - -class _CopyWithImpl$Variables$Query$GetUser - implements CopyWith$Variables$Query$GetUser { - _CopyWithImpl$Variables$Query$GetUser(this._instance, this._then); - - final Variables$Query$GetUser _instance; - - final TRes Function(Variables$Query$GetUser) _then; - - static const _undefined = {}; - - TRes call({Object? username = _undefined}) => _then(Variables$Query$GetUser( - username: username == _undefined || username == null - ? _instance.username - : (username as String))); -} - -class _CopyWithStubImpl$Variables$Query$GetUser - implements CopyWith$Variables$Query$GetUser { - _CopyWithStubImpl$Variables$Query$GetUser(this._res); - - TRes _res; - - call({String? username}) => _res; -} - -@JsonSerializable(explicitToJson: true) -class Query$GetUser { - Query$GetUser({required this.users, required this.$__typename}); - - @override - factory Query$GetUser.fromJson(Map json) => - _$Query$GetUserFromJson(json); - - final Query$GetUser$users users; - - @JsonKey(name: '__typename') - final String $__typename; - - Map toJson() => _$Query$GetUserToJson(this); - int get hashCode { - final l$users = users; - final l$$__typename = $__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) - return false; - final l$users = users; - final lOther$users = other.users; - if (l$users != lOther$users) return false; - final l$$__typename = $__typename; - final lOther$$__typename = other.$__typename; - 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); -} - -abstract class CopyWith$Query$GetUser { - factory CopyWith$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}); - CopyWith$Query$GetUser$users get users; -} - -class _CopyWithImpl$Query$GetUser - implements CopyWith$Query$GetUser { - _CopyWithImpl$Query$GetUser(this._instance, this._then); - - final Query$GetUser _instance; - - final TRes Function(Query$GetUser) _then; - - static const _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))); - CopyWith$Query$GetUser$users get users { - final local$users = _instance.users; - return CopyWith$Query$GetUser$users(local$users, (e) => call(users: e)); - } -} - -class _CopyWithStubImpl$Query$GetUser - implements CopyWith$Query$GetUser { - _CopyWithStubImpl$Query$GetUser(this._res); - - TRes _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'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'getUser'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'username'), - value: VariableNode(name: NameNode(value: 'username'))) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'sshKeys'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'userType'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'username'), - 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$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); -} - -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); -} - -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); -} - -extension ClientExtension$Query$GetUser on graphql.GraphQLClient { - Future> query$GetUser( - Options$Query$GetUser options) async => - await this.query(options); - 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}) => - 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); - return result == null ? null : Query$GetUser.fromJson(result); - } -} - -@JsonSerializable(explicitToJson: true) -class Query$GetUser$users { - Query$GetUser$users({this.getUser, required this.$__typename}); - - @override - factory Query$GetUser$users.fromJson(Map json) => - _$Query$GetUser$usersFromJson(json); - - final Query$GetUser$users$getUser? getUser; - - @JsonKey(name: '__typename') - final String $__typename; - - Map toJson() => _$Query$GetUser$usersToJson(this); - int get hashCode { - final l$getUser = getUser; - final l$$__typename = $__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) - return false; - final l$getUser = getUser; - final lOther$getUser = other.getUser; - if (l$getUser != lOther$getUser) return false; - final l$$__typename = $__typename; - final lOther$$__typename = other.$__typename; - 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); -} - -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.stub(TRes res) = - _CopyWithStubImpl$Query$GetUser$users; - - TRes call({Query$GetUser$users$getUser? getUser, String? $__typename}); - CopyWith$Query$GetUser$users$getUser get getUser; -} - -class _CopyWithImpl$Query$GetUser$users - implements CopyWith$Query$GetUser$users { - _CopyWithImpl$Query$GetUser$users(this._instance, this._then); - - final Query$GetUser$users _instance; - - final TRes Function(Query$GetUser$users) _then; - - static const _undefined = {}; - - TRes call({Object? getUser = _undefined, Object? $__typename = _undefined}) => - _then(Query$GetUser$users( - getUser: getUser == _undefined - ? _instance.getUser - : (getUser as Query$GetUser$users$getUser?), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); - CopyWith$Query$GetUser$users$getUser get getUser { - final local$getUser = _instance.getUser; - return local$getUser == null - ? CopyWith$Query$GetUser$users$getUser.stub(_then(_instance)) - : CopyWith$Query$GetUser$users$getUser( - local$getUser, (e) => call(getUser: e)); - } -} - -class _CopyWithStubImpl$Query$GetUser$users - implements CopyWith$Query$GetUser$users { - _CopyWithStubImpl$Query$GetUser$users(this._res); - - TRes _res; - - call({Query$GetUser$users$getUser? getUser, String? $__typename}) => _res; - CopyWith$Query$GetUser$users$getUser get getUser => - CopyWith$Query$GetUser$users$getUser.stub(_res); -} - -@JsonSerializable(explicitToJson: true) -class Query$GetUser$users$getUser { - Query$GetUser$users$getUser( - {required this.sshKeys, - required this.userType, - required this.username, - required this.$__typename}); - - @override - factory Query$GetUser$users$getUser.fromJson(Map json) => - _$Query$GetUser$users$getUserFromJson(json); - - final List sshKeys; - - @JsonKey(unknownEnumValue: Enum$UserType.$unknown) - final Enum$UserType userType; - - final String username; - - @JsonKey(name: '__typename') - final String $__typename; - - Map toJson() => _$Query$GetUser$users$getUserToJson(this); - int get hashCode { - final l$sshKeys = sshKeys; - final l$userType = userType; - final l$username = username; - final l$$__typename = $__typename; - return Object.hashAll([ - Object.hashAll(l$sshKeys.map((v) => v)), - l$userType, - l$username, - l$$__typename - ]); - } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Query$GetUser$users$getUser) || - runtimeType != other.runtimeType) return false; - final l$sshKeys = sshKeys; - final lOther$sshKeys = other.sshKeys; - 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; - } - - final l$userType = userType; - final lOther$userType = other.userType; - if (l$userType != lOther$userType) return false; - final l$username = username; - final lOther$username = other.username; - if (l$username != lOther$username) return false; - final l$$__typename = $__typename; - final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; - return true; - } -} - -extension UtilityExtension$Query$GetUser$users$getUser - on Query$GetUser$users$getUser { - CopyWith$Query$GetUser$users$getUser - get copyWith => CopyWith$Query$GetUser$users$getUser(this, (i) => i); -} - -abstract class CopyWith$Query$GetUser$users$getUser { - factory CopyWith$Query$GetUser$users$getUser( - Query$GetUser$users$getUser instance, - TRes Function(Query$GetUser$users$getUser) then) = - _CopyWithImpl$Query$GetUser$users$getUser; - - factory CopyWith$Query$GetUser$users$getUser.stub(TRes res) = - _CopyWithStubImpl$Query$GetUser$users$getUser; - - TRes call( - {List? sshKeys, - Enum$UserType? userType, - String? username, - String? $__typename}); -} - -class _CopyWithImpl$Query$GetUser$users$getUser - implements CopyWith$Query$GetUser$users$getUser { - _CopyWithImpl$Query$GetUser$users$getUser(this._instance, this._then); - - final Query$GetUser$users$getUser _instance; - - final TRes Function(Query$GetUser$users$getUser) _then; - - static const _undefined = {}; - - TRes call( - {Object? sshKeys = _undefined, - Object? userType = _undefined, - Object? username = _undefined, - Object? $__typename = _undefined}) => - _then(Query$GetUser$users$getUser( - sshKeys: sshKeys == _undefined || sshKeys == null - ? _instance.sshKeys - : (sshKeys as List), - userType: userType == _undefined || userType == null - ? _instance.userType - : (userType as Enum$UserType), - username: username == _undefined || username == null - ? _instance.username - : (username as String), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); -} - -class _CopyWithStubImpl$Query$GetUser$users$getUser - implements CopyWith$Query$GetUser$users$getUser { - _CopyWithStubImpl$Query$GetUser$users$getUser(this._res); - - TRes _res; - - call( - {List? sshKeys, - Enum$UserType? userType, - String? username, - String? $__typename}) => - _res; -} - -@JsonSerializable(explicitToJson: true) -class Variables$Mutation$RemoveSshKey { - Variables$Mutation$RemoveSshKey({required this.sshInput}); - - @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; - - factory CopyWith$Variables$Mutation$RemoveSshKey.stub(TRes res) = - _CopyWithStubImpl$Variables$Mutation$RemoveSshKey; - - TRes call({Input$SshMutationInput? sshInput}); -} - -class _CopyWithImpl$Variables$Mutation$RemoveSshKey - implements CopyWith$Variables$Mutation$RemoveSshKey { - _CopyWithImpl$Variables$Mutation$RemoveSshKey(this._instance, this._then); - - final Variables$Mutation$RemoveSshKey _instance; - - final TRes Function(Variables$Mutation$RemoveSshKey) _then; - - static const _undefined = {}; - - TRes call({Object? sshInput = _undefined}) => - _then(Variables$Mutation$RemoveSshKey( - sshInput: sshInput == _undefined || sshInput == null - ? _instance.sshInput - : (sshInput as Input$SshMutationInput))); -} - -class _CopyWithStubImpl$Variables$Mutation$RemoveSshKey - implements CopyWith$Variables$Mutation$RemoveSshKey { - _CopyWithStubImpl$Variables$Mutation$RemoveSshKey(this._res); - - TRes _res; - - call({Input$SshMutationInput? sshInput}) => _res; -} - -@JsonSerializable(explicitToJson: true) -class Mutation$RemoveSshKey { - Mutation$RemoveSshKey( - {required this.removeSshKey, required this.$__typename}); - - @override - factory Mutation$RemoveSshKey.fromJson(Map json) => - _$Mutation$RemoveSshKeyFromJson(json); - - final Mutation$RemoveSshKey$removeSshKey removeSshKey; - - @JsonKey(name: '__typename') - final String $__typename; - - Map toJson() => _$Mutation$RemoveSshKeyToJson(this); - int get hashCode { - final l$removeSshKey = removeSshKey; - final l$$__typename = $__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) - return false; - final l$removeSshKey = removeSshKey; - final lOther$removeSshKey = other.removeSshKey; - if (l$removeSshKey != lOther$removeSshKey) return false; - final l$$__typename = $__typename; - final lOther$$__typename = other.$__typename; - 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); -} - -abstract class CopyWith$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}); - CopyWith$Mutation$RemoveSshKey$removeSshKey get removeSshKey; -} - -class _CopyWithImpl$Mutation$RemoveSshKey - implements CopyWith$Mutation$RemoveSshKey { - _CopyWithImpl$Mutation$RemoveSshKey(this._instance, this._then); - - final Mutation$RemoveSshKey _instance; - - final TRes Function(Mutation$RemoveSshKey) _then; - - static const _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))); - CopyWith$Mutation$RemoveSshKey$removeSshKey get removeSshKey { - final local$removeSshKey = _instance.removeSshKey; - return CopyWith$Mutation$RemoveSshKey$removeSshKey( - local$removeSshKey, (e) => call(removeSshKey: e)); - } -} - -class _CopyWithStubImpl$Mutation$RemoveSshKey - implements CopyWith$Mutation$RemoveSshKey { - _CopyWithStubImpl$Mutation$RemoveSshKey(this._res); - - TRes _res; - - call( - {Mutation$RemoveSshKey$removeSshKey? removeSshKey, - String? $__typename}) => - _res; - CopyWith$Mutation$RemoveSshKey$removeSshKey get removeSshKey => - CopyWith$Mutation$RemoveSshKey$removeSshKey.stub(_res); -} - -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'), - 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: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'sshKeys'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'userType'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'username'), - 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) - ])), - fragmentDefinitionbasicMutationReturnFields, -]); -Mutation$RemoveSshKey _parserFn$Mutation$RemoveSshKey( - Map data) => - Mutation$RemoveSshKey.fromJson(data); -typedef OnMutationCompleted$Mutation$RemoveSshKey = FutureOr Function( - 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, - 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$RemoveSshKey(data)), - update: update, - onError: onError, - document: documentNodeMutationRemoveSshKey, - parserFn: _parserFn$Mutation$RemoveSshKey); - - final OnMutationCompleted$Mutation$RemoveSshKey? onCompletedWithParsed; - - @override - List get properties => [ - ...super.onCompleted == null - ? super.properties - : super.properties.where((property) => property != onCompleted), - 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); -} - -extension ClientExtension$Mutation$RemoveSshKey on graphql.GraphQLClient { - Future> mutate$RemoveSshKey( - Options$Mutation$RemoveSshKey options) async => - await this.mutate(options); - graphql.ObservableQuery watchMutation$RemoveSshKey( - WatchOptions$Mutation$RemoveSshKey options) => - 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}); - - @override - factory Mutation$RemoveSshKey$removeSshKey.fromJson( - Map json) => - _$Mutation$RemoveSshKey$removeSshKeyFromJson(json); - - final int code; - - final String message; - - final bool success; - - @JsonKey(name: '__typename') - final String $__typename; - - final Mutation$RemoveSshKey$removeSshKey$user? user; - - Map toJson() => - _$Mutation$RemoveSshKey$removeSshKeyToJson(this); - 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]); - } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Mutation$RemoveSshKey$removeSshKey) || - 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; - final l$user = user; - final lOther$user = other.user; - if (l$user != lOther$user) return false; - return true; - } -} - -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); -} - -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; - - factory CopyWith$Mutation$RemoveSshKey$removeSshKey.stub(TRes res) = - _CopyWithStubImpl$Mutation$RemoveSshKey$removeSshKey; - - TRes call( - {int? code, - String? message, - bool? success, - String? $__typename, - Mutation$RemoveSshKey$removeSshKey$user? user}); - CopyWith$Mutation$RemoveSshKey$removeSshKey$user get user; -} - -class _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey - implements CopyWith$Mutation$RemoveSshKey$removeSshKey { - _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey(this._instance, this._then); - - final Mutation$RemoveSshKey$removeSshKey _instance; - - final TRes Function(Mutation$RemoveSshKey$removeSshKey) _then; - - static const _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 Mutation$RemoveSshKey$removeSshKey$user?))); - CopyWith$Mutation$RemoveSshKey$removeSshKey$user get user { - final local$user = _instance.user; - return local$user == null - ? CopyWith$Mutation$RemoveSshKey$removeSshKey$user.stub( - _then(_instance)) - : CopyWith$Mutation$RemoveSshKey$removeSshKey$user( - local$user, (e) => call(user: e)); - } -} - -class _CopyWithStubImpl$Mutation$RemoveSshKey$removeSshKey - implements CopyWith$Mutation$RemoveSshKey$removeSshKey { - _CopyWithStubImpl$Mutation$RemoveSshKey$removeSshKey(this._res); - - TRes _res; - - call( - {int? code, - String? message, - bool? success, - String? $__typename, - Mutation$RemoveSshKey$removeSshKey$user? user}) => - _res; - CopyWith$Mutation$RemoveSshKey$removeSshKey$user get user => - CopyWith$Mutation$RemoveSshKey$removeSshKey$user.stub(_res); -} - -@JsonSerializable(explicitToJson: true) -class Mutation$RemoveSshKey$removeSshKey$user { - Mutation$RemoveSshKey$removeSshKey$user( - {required this.sshKeys, - required this.userType, - required this.username, - required this.$__typename}); - - @override - factory Mutation$RemoveSshKey$removeSshKey$user.fromJson( - Map json) => - _$Mutation$RemoveSshKey$removeSshKey$userFromJson(json); - - final List sshKeys; - - @JsonKey(unknownEnumValue: Enum$UserType.$unknown) - final Enum$UserType userType; - - final String username; - - @JsonKey(name: '__typename') - final String $__typename; - - Map toJson() => - _$Mutation$RemoveSshKey$removeSshKey$userToJson(this); - int get hashCode { - final l$sshKeys = sshKeys; - final l$userType = userType; - final l$username = username; - final l$$__typename = $__typename; - return Object.hashAll([ - Object.hashAll(l$sshKeys.map((v) => v)), - l$userType, - l$username, - l$$__typename - ]); - } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - if (!(other is Mutation$RemoveSshKey$removeSshKey$user) || - runtimeType != other.runtimeType) return false; - final l$sshKeys = sshKeys; - final lOther$sshKeys = other.sshKeys; - 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; - } - - final l$userType = userType; - final lOther$userType = other.userType; - if (l$userType != lOther$userType) return false; - final l$username = username; - final lOther$username = other.username; - if (l$username != lOther$username) return false; - final l$$__typename = $__typename; - final lOther$$__typename = other.$__typename; - if (l$$__typename != lOther$$__typename) return false; - return true; - } -} - -extension UtilityExtension$Mutation$RemoveSshKey$removeSshKey$user - on Mutation$RemoveSshKey$removeSshKey$user { - CopyWith$Mutation$RemoveSshKey$removeSshKey$user< - Mutation$RemoveSshKey$removeSshKey$user> - get copyWith => - CopyWith$Mutation$RemoveSshKey$removeSshKey$user(this, (i) => i); -} - -abstract class CopyWith$Mutation$RemoveSshKey$removeSshKey$user { - factory CopyWith$Mutation$RemoveSshKey$removeSshKey$user( - Mutation$RemoveSshKey$removeSshKey$user instance, - TRes Function(Mutation$RemoveSshKey$removeSshKey$user) then) = - _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey$user; - - factory CopyWith$Mutation$RemoveSshKey$removeSshKey$user.stub(TRes res) = - _CopyWithStubImpl$Mutation$RemoveSshKey$removeSshKey$user; - - TRes call( - {List? sshKeys, - Enum$UserType? userType, - String? username, - String? $__typename}); -} - -class _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey$user - implements CopyWith$Mutation$RemoveSshKey$removeSshKey$user { - _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey$user( - this._instance, this._then); - - final Mutation$RemoveSshKey$removeSshKey$user _instance; - - final TRes Function(Mutation$RemoveSshKey$removeSshKey$user) _then; - - static const _undefined = {}; - - TRes call( - {Object? sshKeys = _undefined, - Object? userType = _undefined, - Object? username = _undefined, - Object? $__typename = _undefined}) => - _then(Mutation$RemoveSshKey$removeSshKey$user( - sshKeys: sshKeys == _undefined || sshKeys == null - ? _instance.sshKeys - : (sshKeys as List), - userType: userType == _undefined || userType == null - ? _instance.userType - : (userType as Enum$UserType), - username: username == _undefined || username == null - ? _instance.username - : (username as String), - $__typename: $__typename == _undefined || $__typename == null - ? _instance.$__typename - : ($__typename as String))); -} - -class _CopyWithStubImpl$Mutation$RemoveSshKey$removeSshKey$user - implements CopyWith$Mutation$RemoveSshKey$removeSshKey$user { - _CopyWithStubImpl$Mutation$RemoveSshKey$removeSshKey$user(this._res); - - TRes _res; - - call( - {List? sshKeys, - Enum$UserType? userType, - String? username, - String? $__typename}) => + Fragment$userFields? user}) => _res; + CopyWith$Fragment$userFields get user => + CopyWith$Fragment$userFields.stub(_res); } @JsonSerializable(explicitToJson: true) @@ -3573,24 +2114,8 @@ const documentNodeMutationUpdateUser = DocumentNode(definitions: [ arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'sshKeys'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'userType'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'username'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), + FragmentSpreadNode( + name: NameNode(value: 'userFields'), directives: []), FieldNode( name: NameNode(value: '__typename'), alias: null, @@ -3613,6 +2138,7 @@ const documentNodeMutationUpdateUser = DocumentNode(definitions: [ selectionSet: null) ])), fragmentDefinitionbasicMutationReturnFields, + fragmentDefinitionuserFields, ]); Mutation$UpdateUser _parserFn$Mutation$UpdateUser(Map data) => Mutation$UpdateUser.fromJson(data); @@ -3723,7 +2249,7 @@ class Mutation$UpdateUser$updateUser @JsonKey(name: '__typename') final String $__typename; - final Mutation$UpdateUser$updateUser$user? user; + final Fragment$userFields? user; Map toJson() => _$Mutation$UpdateUser$updateUserToJson(this); int get hashCode { @@ -3780,8 +2306,8 @@ abstract class CopyWith$Mutation$UpdateUser$updateUser { String? message, bool? success, String? $__typename, - Mutation$UpdateUser$updateUser$user? user}); - CopyWith$Mutation$UpdateUser$updateUser$user get user; + Fragment$userFields? user}); + CopyWith$Fragment$userFields get user; } class _CopyWithImpl$Mutation$UpdateUser$updateUser @@ -3815,13 +2341,12 @@ class _CopyWithImpl$Mutation$UpdateUser$updateUser : ($__typename as String), user: user == _undefined ? _instance.user - : (user as Mutation$UpdateUser$updateUser$user?))); - CopyWith$Mutation$UpdateUser$updateUser$user get user { + : (user as Fragment$userFields?))); + CopyWith$Fragment$userFields get user { final local$user = _instance.user; return local$user == null - ? CopyWith$Mutation$UpdateUser$updateUser$user.stub(_then(_instance)) - : CopyWith$Mutation$UpdateUser$updateUser$user( - local$user, (e) => call(user: e)); + ? CopyWith$Fragment$userFields.stub(_then(_instance)) + : CopyWith$Fragment$userFields(local$user, (e) => call(user: e)); } } @@ -3836,70 +2361,109 @@ class _CopyWithStubImpl$Mutation$UpdateUser$updateUser String? message, bool? success, String? $__typename, - Mutation$UpdateUser$updateUser$user? user}) => + Fragment$userFields? user}) => _res; - CopyWith$Mutation$UpdateUser$updateUser$user get user => - CopyWith$Mutation$UpdateUser$updateUser$user.stub(_res); + CopyWith$Fragment$userFields get user => + CopyWith$Fragment$userFields.stub(_res); } @JsonSerializable(explicitToJson: true) -class Mutation$UpdateUser$updateUser$user { - Mutation$UpdateUser$updateUser$user( - {required this.sshKeys, - required this.userType, - required this.username, - required this.$__typename}); +class Variables$Mutation$AddSshKey { + Variables$Mutation$AddSshKey({required this.sshInput}); @override - factory Mutation$UpdateUser$updateUser$user.fromJson( - Map json) => - _$Mutation$UpdateUser$updateUser$userFromJson(json); + factory Variables$Mutation$AddSshKey.fromJson(Map json) => + _$Variables$Mutation$AddSshKeyFromJson(json); - final List sshKeys; + final Input$SshMutationInput sshInput; - @JsonKey(unknownEnumValue: Enum$UserType.$unknown) - final Enum$UserType userType; - - final String username; - - @JsonKey(name: '__typename') - final String $__typename; - - Map toJson() => - _$Mutation$UpdateUser$updateUser$userToJson(this); + Map toJson() => _$Variables$Mutation$AddSshKeyToJson(this); int get hashCode { - final l$sshKeys = sshKeys; - final l$userType = userType; - final l$username = username; - final l$$__typename = $__typename; - return Object.hashAll([ - Object.hashAll(l$sshKeys.map((v) => v)), - l$userType, - l$username, - l$$__typename - ]); + final l$sshInput = sshInput; + return Object.hashAll([l$sshInput]); } @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Mutation$UpdateUser$updateUser$user) || + if (!(other is Variables$Mutation$AddSshKey) || runtimeType != other.runtimeType) return false; - final l$sshKeys = sshKeys; - final lOther$sshKeys = other.sshKeys; - 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; - } + final l$sshInput = sshInput; + final lOther$sshInput = other.sshInput; + if (l$sshInput != lOther$sshInput) return false; + return true; + } - final l$userType = userType; - final lOther$userType = other.userType; - if (l$userType != lOther$userType) return false; - final l$username = username; - final lOther$username = other.username; - if (l$username != lOther$username) return false; + 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; + + factory CopyWith$Variables$Mutation$AddSshKey.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$AddSshKey; + + TRes call({Input$SshMutationInput? sshInput}); +} + +class _CopyWithImpl$Variables$Mutation$AddSshKey + implements CopyWith$Variables$Mutation$AddSshKey { + _CopyWithImpl$Variables$Mutation$AddSshKey(this._instance, this._then); + + final Variables$Mutation$AddSshKey _instance; + + final TRes Function(Variables$Mutation$AddSshKey) _then; + + static const _undefined = {}; + + TRes call({Object? sshInput = _undefined}) => + _then(Variables$Mutation$AddSshKey( + sshInput: sshInput == _undefined || sshInput == null + ? _instance.sshInput + : (sshInput as Input$SshMutationInput))); +} + +class _CopyWithStubImpl$Variables$Mutation$AddSshKey + implements CopyWith$Variables$Mutation$AddSshKey { + _CopyWithStubImpl$Variables$Mutation$AddSshKey(this._res); + + TRes _res; + + call({Input$SshMutationInput? sshInput}) => _res; +} + +@JsonSerializable(explicitToJson: true) +class Mutation$AddSshKey { + Mutation$AddSshKey({required this.addSshKey, required this.$__typename}); + + @override + factory Mutation$AddSshKey.fromJson(Map json) => + _$Mutation$AddSshKeyFromJson(json); + + final Mutation$AddSshKey$addSshKey addSshKey; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$AddSshKeyToJson(this); + int get hashCode { + final l$addSshKey = addSshKey; + final l$$__typename = $__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) + return false; + final l$addSshKey = addSshKey; + final lOther$addSshKey = other.addSshKey; + if (l$addSshKey != lOther$addSshKey) return false; final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; if (l$$__typename != lOther$$__typename) return false; @@ -3907,70 +2471,801 @@ class Mutation$UpdateUser$updateUser$user { } } -extension UtilityExtension$Mutation$UpdateUser$updateUser$user - on Mutation$UpdateUser$updateUser$user { - CopyWith$Mutation$UpdateUser$updateUser$user< - Mutation$UpdateUser$updateUser$user> - get copyWith => - CopyWith$Mutation$UpdateUser$updateUser$user(this, (i) => i); +extension UtilityExtension$Mutation$AddSshKey on Mutation$AddSshKey { + CopyWith$Mutation$AddSshKey get copyWith => + CopyWith$Mutation$AddSshKey(this, (i) => i); } -abstract class CopyWith$Mutation$UpdateUser$updateUser$user { - factory CopyWith$Mutation$UpdateUser$updateUser$user( - Mutation$UpdateUser$updateUser$user instance, - TRes Function(Mutation$UpdateUser$updateUser$user) then) = - _CopyWithImpl$Mutation$UpdateUser$updateUser$user; +abstract class CopyWith$Mutation$AddSshKey { + factory CopyWith$Mutation$AddSshKey( + Mutation$AddSshKey instance, TRes Function(Mutation$AddSshKey) then) = + _CopyWithImpl$Mutation$AddSshKey; - factory CopyWith$Mutation$UpdateUser$updateUser$user.stub(TRes res) = - _CopyWithStubImpl$Mutation$UpdateUser$updateUser$user; + factory CopyWith$Mutation$AddSshKey.stub(TRes res) = + _CopyWithStubImpl$Mutation$AddSshKey; - TRes call( - {List? sshKeys, - Enum$UserType? userType, - String? username, - String? $__typename}); + TRes call({Mutation$AddSshKey$addSshKey? addSshKey, String? $__typename}); + CopyWith$Mutation$AddSshKey$addSshKey get addSshKey; } -class _CopyWithImpl$Mutation$UpdateUser$updateUser$user - implements CopyWith$Mutation$UpdateUser$updateUser$user { - _CopyWithImpl$Mutation$UpdateUser$updateUser$user(this._instance, this._then); +class _CopyWithImpl$Mutation$AddSshKey + implements CopyWith$Mutation$AddSshKey { + _CopyWithImpl$Mutation$AddSshKey(this._instance, this._then); - final Mutation$UpdateUser$updateUser$user _instance; + final Mutation$AddSshKey _instance; - final TRes Function(Mutation$UpdateUser$updateUser$user) _then; + final TRes Function(Mutation$AddSshKey) _then; static const _undefined = {}; TRes call( - {Object? sshKeys = _undefined, - Object? userType = _undefined, - Object? username = _undefined, - Object? $__typename = _undefined}) => - _then(Mutation$UpdateUser$updateUser$user( - sshKeys: sshKeys == _undefined || sshKeys == null - ? _instance.sshKeys - : (sshKeys as List), - userType: userType == _undefined || userType == null - ? _instance.userType - : (userType as Enum$UserType), - username: username == _undefined || username == null - ? _instance.username - : (username as String), + {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))); + CopyWith$Mutation$AddSshKey$addSshKey get addSshKey { + final local$addSshKey = _instance.addSshKey; + return CopyWith$Mutation$AddSshKey$addSshKey( + local$addSshKey, (e) => call(addSshKey: e)); + } } -class _CopyWithStubImpl$Mutation$UpdateUser$updateUser$user - implements CopyWith$Mutation$UpdateUser$updateUser$user { - _CopyWithStubImpl$Mutation$UpdateUser$updateUser$user(this._res); +class _CopyWithStubImpl$Mutation$AddSshKey + implements CopyWith$Mutation$AddSshKey { + _CopyWithStubImpl$Mutation$AddSshKey(this._res); + + TRes _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'), + 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: [], + 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) + ])), + fragmentDefinitionbasicMutationReturnFields, + fragmentDefinitionuserFields, +]); +Mutation$AddSshKey _parserFn$Mutation$AddSshKey(Map data) => + Mutation$AddSshKey.fromJson(data); +typedef OnMutationCompleted$Mutation$AddSshKey = FutureOr Function( + 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, + 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); + + final OnMutationCompleted$Mutation$AddSshKey? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$AddSshKey on graphql.GraphQLClient { + Future> mutate$AddSshKey( + Options$Mutation$AddSshKey options) async => + await this.mutate(options); + graphql.ObservableQuery watchMutation$AddSshKey( + WatchOptions$Mutation$AddSshKey options) => + 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}); + + @override + factory Mutation$AddSshKey$addSshKey.fromJson(Map json) => + _$Mutation$AddSshKey$addSshKeyFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + final Fragment$userFields? user; + + Map toJson() => _$Mutation$AddSshKey$addSshKeyToJson(this); + 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]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$AddSshKey$addSshKey) || + 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; + final l$user = user; + final lOther$user = other.user; + if (l$user != lOther$user) return false; + return true; + } +} + +extension UtilityExtension$Mutation$AddSshKey$addSshKey + on Mutation$AddSshKey$addSshKey { + CopyWith$Mutation$AddSshKey$addSshKey + 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; + + 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}); + CopyWith$Fragment$userFields get user; +} + +class _CopyWithImpl$Mutation$AddSshKey$addSshKey + implements CopyWith$Mutation$AddSshKey$addSshKey { + _CopyWithImpl$Mutation$AddSshKey$addSshKey(this._instance, this._then); + + final Mutation$AddSshKey$addSshKey _instance; + + final TRes Function(Mutation$AddSshKey$addSshKey) _then; + + static const _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?))); + CopyWith$Fragment$userFields get user { + final local$user = _instance.user; + return local$user == null + ? CopyWith$Fragment$userFields.stub(_then(_instance)) + : CopyWith$Fragment$userFields(local$user, (e) => call(user: e)); + } +} + +class _CopyWithStubImpl$Mutation$AddSshKey$addSshKey + implements CopyWith$Mutation$AddSshKey$addSshKey { + _CopyWithStubImpl$Mutation$AddSshKey$addSshKey(this._res); TRes _res; call( - {List? sshKeys, - Enum$UserType? userType, - String? username, + {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}); + + @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; + + factory CopyWith$Variables$Mutation$RemoveSshKey.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$RemoveSshKey; + + TRes call({Input$SshMutationInput? sshInput}); +} + +class _CopyWithImpl$Variables$Mutation$RemoveSshKey + implements CopyWith$Variables$Mutation$RemoveSshKey { + _CopyWithImpl$Variables$Mutation$RemoveSshKey(this._instance, this._then); + + final Variables$Mutation$RemoveSshKey _instance; + + final TRes Function(Variables$Mutation$RemoveSshKey) _then; + + static const _undefined = {}; + + TRes call({Object? sshInput = _undefined}) => + _then(Variables$Mutation$RemoveSshKey( + sshInput: sshInput == _undefined || sshInput == null + ? _instance.sshInput + : (sshInput as Input$SshMutationInput))); +} + +class _CopyWithStubImpl$Variables$Mutation$RemoveSshKey + implements CopyWith$Variables$Mutation$RemoveSshKey { + _CopyWithStubImpl$Variables$Mutation$RemoveSshKey(this._res); + + TRes _res; + + call({Input$SshMutationInput? sshInput}) => _res; +} + +@JsonSerializable(explicitToJson: true) +class Mutation$RemoveSshKey { + Mutation$RemoveSshKey( + {required this.removeSshKey, required this.$__typename}); + + @override + factory Mutation$RemoveSshKey.fromJson(Map json) => + _$Mutation$RemoveSshKeyFromJson(json); + + final Mutation$RemoveSshKey$removeSshKey removeSshKey; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$RemoveSshKeyToJson(this); + int get hashCode { + final l$removeSshKey = removeSshKey; + final l$$__typename = $__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) + return false; + final l$removeSshKey = removeSshKey; + final lOther$removeSshKey = other.removeSshKey; + if (l$removeSshKey != lOther$removeSshKey) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + 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); +} + +abstract class CopyWith$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}); + CopyWith$Mutation$RemoveSshKey$removeSshKey get removeSshKey; +} + +class _CopyWithImpl$Mutation$RemoveSshKey + implements CopyWith$Mutation$RemoveSshKey { + _CopyWithImpl$Mutation$RemoveSshKey(this._instance, this._then); + + final Mutation$RemoveSshKey _instance; + + final TRes Function(Mutation$RemoveSshKey) _then; + + static const _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))); + CopyWith$Mutation$RemoveSshKey$removeSshKey get removeSshKey { + final local$removeSshKey = _instance.removeSshKey; + return CopyWith$Mutation$RemoveSshKey$removeSshKey( + local$removeSshKey, (e) => call(removeSshKey: e)); + } +} + +class _CopyWithStubImpl$Mutation$RemoveSshKey + implements CopyWith$Mutation$RemoveSshKey { + _CopyWithStubImpl$Mutation$RemoveSshKey(this._res); + + TRes _res; + + call( + {Mutation$RemoveSshKey$removeSshKey? removeSshKey, String? $__typename}) => _res; + CopyWith$Mutation$RemoveSshKey$removeSshKey get removeSshKey => + CopyWith$Mutation$RemoveSshKey$removeSshKey.stub(_res); +} + +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'), + 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: [], + 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) + ])), + fragmentDefinitionbasicMutationReturnFields, + fragmentDefinitionuserFields, +]); +Mutation$RemoveSshKey _parserFn$Mutation$RemoveSshKey( + Map data) => + Mutation$RemoveSshKey.fromJson(data); +typedef OnMutationCompleted$Mutation$RemoveSshKey = FutureOr Function( + 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, + 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$RemoveSshKey(data)), + update: update, + onError: onError, + document: documentNodeMutationRemoveSshKey, + parserFn: _parserFn$Mutation$RemoveSshKey); + + final OnMutationCompleted$Mutation$RemoveSshKey? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + 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); +} + +extension ClientExtension$Mutation$RemoveSshKey on graphql.GraphQLClient { + Future> mutate$RemoveSshKey( + Options$Mutation$RemoveSshKey options) async => + await this.mutate(options); + graphql.ObservableQuery watchMutation$RemoveSshKey( + WatchOptions$Mutation$RemoveSshKey options) => + 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}); + + @override + factory Mutation$RemoveSshKey$removeSshKey.fromJson( + Map json) => + _$Mutation$RemoveSshKey$removeSshKeyFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + final Fragment$userFields? user; + + Map toJson() => + _$Mutation$RemoveSshKey$removeSshKeyToJson(this); + 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]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Mutation$RemoveSshKey$removeSshKey) || + 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; + final l$user = user; + final lOther$user = other.user; + if (l$user != lOther$user) return false; + return true; + } +} + +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); +} + +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; + + 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}); + CopyWith$Fragment$userFields get user; +} + +class _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey + implements CopyWith$Mutation$RemoveSshKey$removeSshKey { + _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey(this._instance, this._then); + + final Mutation$RemoveSshKey$removeSshKey _instance; + + final TRes Function(Mutation$RemoveSshKey$removeSshKey) _then; + + static const _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?))); + CopyWith$Fragment$userFields get user { + final local$user = _instance.user; + return local$user == null + ? CopyWith$Fragment$userFields.stub(_then(_instance)) + : CopyWith$Fragment$userFields(local$user, (e) => call(user: e)); + } +} + +class _CopyWithStubImpl$Mutation$RemoveSshKey$removeSshKey + implements CopyWith$Mutation$RemoveSshKey$removeSshKey { + _CopyWithStubImpl$Mutation$RemoveSshKey$removeSshKey(this._res); + + TRes _res; + + 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 index a7b81c2d..299005f1 100644 --- a/lib/logic/api_maps/graphql_maps/schema/users.graphql.g.dart +++ b/lib/logic/api_maps/graphql_maps/schema/users.graphql.g.dart @@ -24,6 +24,102 @@ Map _$Fragment$basicMutationReturnFieldsToJson( '__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(), + $__typename: json['__typename'] as String, + ); + +Map _$Query$AllUsers$usersToJson( + Query$AllUsers$users instance) => + { + 'allUsers': instance.allUsers.map((e) => e.toJson()).toList(), + '__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( @@ -60,8 +156,7 @@ Mutation$CreateUser$createUser _$Mutation$CreateUser$createUserFromJson( $__typename: json['__typename'] as String, user: json['user'] == null ? null - : Mutation$CreateUser$createUser$user.fromJson( - json['user'] as Map), + : Fragment$userFields.fromJson(json['user'] as Map), ); Map _$Mutation$CreateUser$createUserToJson( @@ -74,287 +169,6 @@ Map _$Mutation$CreateUser$createUserToJson( 'user': instance.user?.toJson(), }; -Mutation$CreateUser$createUser$user - _$Mutation$CreateUser$createUser$userFromJson(Map json) => - Mutation$CreateUser$createUser$user( - 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 _$Mutation$CreateUser$createUser$userToJson( - Mutation$CreateUser$createUser$user 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) => - Query$AllUsers$users$allUsers.fromJson(e as Map)) - .toList(), - $__typename: json['__typename'] as String, - ); - -Map _$Query$AllUsers$usersToJson( - Query$AllUsers$users instance) => - { - 'allUsers': instance.allUsers.map((e) => e.toJson()).toList(), - '__typename': instance.$__typename, - }; - -Query$AllUsers$users$allUsers _$Query$AllUsers$users$allUsersFromJson( - Map json) => - Query$AllUsers$users$allUsers( - userType: $enumDecode(_$Enum$UserTypeEnumMap, json['userType'], - unknownValue: Enum$UserType.$unknown), - username: json['username'] as String, - sshKeys: - (json['sshKeys'] as List).map((e) => e as String).toList(), - $__typename: json['__typename'] as String, - ); - -Map _$Query$AllUsers$users$allUsersToJson( - Query$AllUsers$users$allUsers instance) => - { - 'userType': _$Enum$UserTypeEnumMap[instance.userType]!, - 'username': instance.username, - 'sshKeys': instance.sshKeys, - '__typename': instance.$__typename, - }; - -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 - : Mutation$AddSshKey$addSshKey$user.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(), - }; - -Mutation$AddSshKey$addSshKey$user _$Mutation$AddSshKey$addSshKey$userFromJson( - Map json) => - Mutation$AddSshKey$addSshKey$user( - sshKeys: - (json['sshKeys'] as List).map((e) => e as String).toList(), - userType: $enumDecode(_$Enum$UserTypeEnumMap, json['userType'], - unknownValue: Enum$UserType.$unknown), - username: json['username'] as String, - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$AddSshKey$addSshKey$userToJson( - Mutation$AddSshKey$addSshKey$user instance) => - { - 'sshKeys': instance.sshKeys, - 'userType': _$Enum$UserTypeEnumMap[instance.userType]!, - 'username': instance.username, - '__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 - : Query$GetUser$users$getUser.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, - }; - -Query$GetUser$users$getUser _$Query$GetUser$users$getUserFromJson( - Map json) => - Query$GetUser$users$getUser( - sshKeys: - (json['sshKeys'] as List).map((e) => e as String).toList(), - userType: $enumDecode(_$Enum$UserTypeEnumMap, json['userType'], - unknownValue: Enum$UserType.$unknown), - username: json['username'] as String, - $__typename: json['__typename'] as String, - ); - -Map _$Query$GetUser$users$getUserToJson( - Query$GetUser$users$getUser instance) => - { - 'sshKeys': instance.sshKeys, - 'userType': _$Enum$UserTypeEnumMap[instance.userType]!, - 'username': instance.username, - '__typename': instance.$__typename, - }; - -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 - : Mutation$RemoveSshKey$removeSshKey$user.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(), - }; - -Mutation$RemoveSshKey$removeSshKey$user - _$Mutation$RemoveSshKey$removeSshKey$userFromJson( - Map json) => - Mutation$RemoveSshKey$removeSshKey$user( - sshKeys: (json['sshKeys'] as List) - .map((e) => e as String) - .toList(), - userType: $enumDecode(_$Enum$UserTypeEnumMap, json['userType'], - unknownValue: Enum$UserType.$unknown), - username: json['username'] as String, - $__typename: json['__typename'] as String, - ); - -Map _$Mutation$RemoveSshKey$removeSshKey$userToJson( - Mutation$RemoveSshKey$removeSshKey$user instance) => - { - 'sshKeys': instance.sshKeys, - 'userType': _$Enum$UserTypeEnumMap[instance.userType]!, - 'username': instance.username, - '__typename': instance.$__typename, - }; - Variables$Mutation$DeleteUser _$Variables$Mutation$DeleteUserFromJson( Map json) => Variables$Mutation$DeleteUser( @@ -435,8 +249,7 @@ Mutation$UpdateUser$updateUser _$Mutation$UpdateUser$updateUserFromJson( $__typename: json['__typename'] as String, user: json['user'] == null ? null - : Mutation$UpdateUser$updateUser$user.fromJson( - json['user'] as Map), + : Fragment$userFields.fromJson(json['user'] as Map), ); Map _$Mutation$UpdateUser$updateUserToJson( @@ -449,23 +262,100 @@ Map _$Mutation$UpdateUser$updateUserToJson( 'user': instance.user?.toJson(), }; -Mutation$UpdateUser$updateUser$user - _$Mutation$UpdateUser$updateUser$userFromJson(Map json) => - Mutation$UpdateUser$updateUser$user( - sshKeys: (json['sshKeys'] as List) - .map((e) => e as String) - .toList(), - userType: $enumDecode(_$Enum$UserTypeEnumMap, json['userType'], - unknownValue: Enum$UserType.$unknown), - username: json['username'] as String, - $__typename: json['__typename'] as String, - ); +Variables$Mutation$AddSshKey _$Variables$Mutation$AddSshKeyFromJson( + Map json) => + Variables$Mutation$AddSshKey( + sshInput: Input$SshMutationInput.fromJson( + json['sshInput'] as Map), + ); -Map _$Mutation$UpdateUser$updateUser$userToJson( - Mutation$UpdateUser$updateUser$user instance) => +Map _$Variables$Mutation$AddSshKeyToJson( + Variables$Mutation$AddSshKey instance) => { - 'sshKeys': instance.sshKeys, - 'userType': _$Enum$UserTypeEnumMap[instance.userType]!, - 'username': instance.username, + '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/graphql_maps/server_api/server.dart b/lib/logic/api_maps/graphql_maps/server_api/server.dart index 4fb757e2..77241653 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/server.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/server.dart @@ -6,7 +6,9 @@ import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_settings.g import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_api.graphql.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/services.graphql.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/users.graphql.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/server_disk_volume.dart'; import 'package:selfprivacy/logic/models/json/server_job.dart'; @@ -16,6 +18,7 @@ part 'volume_api.dart'; part 'jobs_api.dart'; part 'server_actions_api.dart'; part 'services_api.dart'; +part 'users_api.dart'; class GenericMutationResult { GenericMutationResult({ 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 new file mode 100644 index 00000000..5be86a3d --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/server_api/users_api.dart @@ -0,0 +1,189 @@ +part of 'server.dart'; + +class UserMutationResult extends GenericMutationResult { + UserMutationResult({ + required final super.success, + required final super.code, + final super.message, + this.user, + }); + final User? user; +} + +mixin UsersApi on ApiMap { + Future> getAllUsers() async { + QueryResult response; + List users = []; + try { + final GraphQLClient client = await getClient(); + response = await client.query$AllUsers(); + if (response.hasException) { + print(response.exception.toString()); + } + users = response.parsedData?.users.allUsers.map((final user) => User.fromGraphQL(user)).toList() ?? []; + } catch (e) { + print(e); + } + return users; + } + + Future getUser(final String login) async { + QueryResult response; + User? user; + try { + final GraphQLClient client = await getClient(); + final variables = Variables$Query$GetUser(username: login); + response = await client.query$GetUser(Options$Query$GetUser(variables: variables)); + if (response.hasException) { + print(response.exception.toString()); + } + if (response.parsedData?.users.getUser != null) { + user = User( + login: response.parsedData!.users.getUser!.username, + sshKeys: response.parsedData!.users.getUser?.sshKeys ?? const [], + isFoundOnServer: true, + ); + } + } catch (e) { + print(e); + } + return user; + } + + Future createUser( + final String username, + final String password, + ) async { + try { + final GraphQLClient client = await getClient(); + final variables = Variables$Mutation$CreateUser( + user: Input$UserMutationInput(username: username, password: password), + ); + final mutation = Options$Mutation$CreateUser(variables: variables); + final response = await client.mutate$CreateUser(mutation); + return UserMutationResult( + success: response.parsedData?.createUser.success ?? false, + code: response.parsedData?.createUser.code ?? 500, + message: response.parsedData?.createUser.message, + user: response.parsedData?.createUser.user != null ? User.fromGraphQL(response.parsedData!.createUser.user!) : null, + ); + } catch (e) { + print(e); + return UserMutationResult( + success: false, + code: 0, + message: e.toString(), + ); + } + } + + Future deleteUser( + final String username, + ) async { + try { + final GraphQLClient client = await getClient(); + final variables = Variables$Mutation$DeleteUser(username: username); + final mutation = Options$Mutation$DeleteUser(variables: variables); + final response = await client.mutate$DeleteUser(mutation); + return GenericMutationResult( + success: response.parsedData?.deleteUser.success ?? false, + code: response.parsedData?.deleteUser.code ?? 500, + message: response.parsedData?.deleteUser.message, + ); + } catch (e) { + print(e); + return GenericMutationResult( + success: false, + code: 500, + message: e.toString(), + ); + } + } + + Future updateUser( + final String username, + final String password, + ) async { + try { + final GraphQLClient client = await getClient(); + final variables = Variables$Mutation$UpdateUser( + user: Input$UserMutationInput(username: username, password: password), + ); + final mutation = Options$Mutation$UpdateUser(variables: variables); + final response = await client.mutate$UpdateUser(mutation); + return UserMutationResult( + success: response.parsedData?.updateUser.success ?? false, + code: response.parsedData?.updateUser.code ?? 500, + message: response.parsedData?.updateUser.message, + user: response.parsedData?.updateUser.user != null ? User.fromGraphQL(response.parsedData!.updateUser.user!) : null, + ); + } catch (e) { + print(e); + return UserMutationResult( + success: false, + code: 0, + message: e.toString(), + ); + } + } + + Future addSshKey( + final String username, + final String sshKey, + ) async { + try { + final GraphQLClient client = await getClient(); + final variables = Variables$Mutation$AddSshKey( + sshInput: Input$SshMutationInput( + username: username, + sshKey: sshKey, + ), + ); + final mutation = Options$Mutation$AddSshKey(variables: variables); + final response = await client.mutate$AddSshKey(mutation); + return UserMutationResult( + success: response.parsedData?.addSshKey.success ?? false, + code: response.parsedData?.addSshKey.code ?? 500, + message: response.parsedData?.addSshKey.message, + user: response.parsedData?.addSshKey.user != null ? User.fromGraphQL(response.parsedData!.addSshKey.user!) : null, + ); + } catch (e) { + print(e); + return UserMutationResult( + success: false, + code: 0, + message: e.toString(), + ); + } + } + + Future removeSshKey( + final String username, + final String sshKey, + ) async { + try { + final GraphQLClient client = await getClient(); + final variables = Variables$Mutation$RemoveSshKey( + sshInput: Input$SshMutationInput( + username: username, + sshKey: sshKey, + ), + ); + final mutation = Options$Mutation$RemoveSshKey(variables: variables); + final response = await client.mutate$RemoveSshKey(mutation); + return UserMutationResult( + success: response.parsedData?.removeSshKey.success ?? false, + code: response.parsedData?.removeSshKey.code ?? 500, + message: response.parsedData?.removeSshKey.message, + user: response.parsedData?.removeSshKey.user != null ? User.fromGraphQL(response.parsedData!.removeSshKey.user!) : null, + ); + } catch (e) { + print(e); + return UserMutationResult( + success: false, + code: 0, + message: e.toString(), + ); + } + } +} diff --git a/lib/logic/models/hive/user.dart b/lib/logic/models/hive/user.dart index 942ce9fe..f140953d 100644 --- a/lib/logic/models/hive/user.dart +++ b/lib/logic/models/hive/user.dart @@ -2,6 +2,7 @@ import 'dart:ui'; import 'package:equatable/equatable.dart'; import 'package:hive/hive.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/users.graphql.dart'; import 'package:selfprivacy/utils/color_utils.dart'; part 'user.g.dart'; @@ -16,6 +17,13 @@ class User extends Equatable { this.note, }); + User.fromGraphQL(final Fragment$userFields user) + : this( + login: user.username, + sshKeys: user.sshKeys, + isFoundOnServer: true, + ); + @HiveField(0) final String login; @@ -37,6 +45,5 @@ class User extends Equatable { Color get color => stringToColor(login); @override - String toString() => - '$login, ${isFoundOnServer ? 'found' : 'not found'}, ${sshKeys.length} ssh keys, note: $note'; + String toString() => '$login, ${isFoundOnServer ? 'found' : 'not found'}, ${sshKeys.length} ssh keys, note: $note'; } From 894cd9524fa76b816c7df387dc3be60241f3ecc9 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Sun, 4 Sep 2022 14:28:45 +0300 Subject: [PATCH 042/115] Remove android.enableR8 from gradle.properties --- android/gradle.properties | 1 - 1 file changed, 1 deletion(-) diff --git a/android/gradle.properties b/android/gradle.properties index a6738207..94adc3a3 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,4 +1,3 @@ org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true -android.enableR8=true From c1bb617ca79af7cad38b600260f438d3fabc85cd Mon Sep 17 00:00:00 2001 From: Inex Code Date: Sun, 4 Sep 2022 14:29:05 +0300 Subject: [PATCH 043/115] Add user type to the User model --- .../graphql_maps/server_api/users_api.dart | 9 +- lib/logic/api_maps/rest_maps/server.dart | 60 +++------- .../initializing/root_user_form_cubit.dart | 3 +- .../cubit/forms/user/user_form_cubit.dart | 5 +- .../server_installation_repository.dart | 104 ++++++------------ lib/logic/cubit/users/users_cubit.dart | 79 ++++++------- lib/logic/models/hive/README.md | 5 +- lib/logic/models/hive/user.dart | 29 +++++ 8 files changed, 127 insertions(+), 167 deletions(-) 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 5be86a3d..c1b2b801 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 @@ -37,12 +37,9 @@ mixin UsersApi on ApiMap { if (response.hasException) { print(response.exception.toString()); } - if (response.parsedData?.users.getUser != null) { - user = User( - login: response.parsedData!.users.getUser!.username, - sshKeys: response.parsedData!.users.getUser?.sshKeys ?? const [], - isFoundOnServer: true, - ); + final responseUser = response.parsedData?.users.getUser; + if (responseUser != null) { + user = User.fromGraphQL(responseUser); } } catch (e) { print(e); diff --git a/lib/logic/api_maps/rest_maps/server.dart b/lib/logic/api_maps/rest_maps/server.dart index 2563fa50..5c94d990 100644 --- a/lib/logic/api_maps/rest_maps/server.dart +++ b/lib/logic/api_maps/rest_maps/server.dart @@ -4,6 +4,7 @@ import 'dart:io'; import 'package:dio/dio.dart'; import 'package:selfprivacy/config/get_it_config.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; import 'package:selfprivacy/logic/common_enum/common_enum.dart'; import 'package:selfprivacy/logic/models/hive/backblaze_bucket.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; @@ -15,8 +16,6 @@ import 'package:selfprivacy/logic/models/json/device_token.dart'; import 'package:selfprivacy/logic/models/json/recovery_token_status.dart'; import 'package:selfprivacy/logic/models/timezone_settings.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; - class ApiResponse { ApiResponse({ required this.statusCode, @@ -71,9 +70,7 @@ class ServerApi extends ApiMap { baseUrl: 'https://api.$overrideDomain', connectTimeout: 10000, receiveTimeout: 10000, - headers: customToken != null - ? {'Authorization': 'Bearer $customToken'} - : null, + headers: customToken != null ? {'Authorization': 'Bearer $customToken'} : null, ); } @@ -132,6 +129,7 @@ class ServerApi extends ApiMap { statusCode: e.response?.statusCode ?? HttpStatus.internalServerError, data: User( login: user.login, + type: UserType.normal, password: user.password, isFoundOnServer: false, ), @@ -143,8 +141,7 @@ class ServerApi extends ApiMap { bool isFoundOnServer = false; int code = 0; - final bool isUserCreated = (response.statusCode != null) && - (response.statusCode == HttpStatus.created); + final bool isUserCreated = (response.statusCode != null) && (response.statusCode == HttpStatus.created); if (isUserCreated) { isFoundOnServer = true; @@ -158,6 +155,7 @@ class ServerApi extends ApiMap { statusCode: code, data: User( login: user.login, + type: UserType.normal, password: user.password, isFoundOnServer: isFoundOnServer, ), @@ -273,9 +271,7 @@ class ServerApi extends ApiMap { final Dio client = await getClient(); try { response = await client.get('/services/ssh/keys/${user.login}'); - res = (response.data as List) - .map((final e) => e as String) - .toList(); + res = (response.data as List).map((final e) => e as String).toList(); } on DioError catch (e) { print(e.message); return ApiResponse>( @@ -334,9 +330,7 @@ class ServerApi extends ApiMap { return ApiResponse( statusCode: code, data: null, - errorMessage: response.data?.containsKey('error') ?? false - ? response.data['error'] - : null, + errorMessage: response.data?.containsKey('error') ?? false ? response.data['error'] : null, ); } @@ -347,8 +341,7 @@ class ServerApi extends ApiMap { final Dio client = await getClient(); try { response = await client.delete('/users/${user.login}'); - res = response.statusCode == HttpStatus.ok || - response.statusCode == HttpStatus.notFound; + res = response.statusCode == HttpStatus.ok || response.statusCode == HttpStatus.notFound; } on DioError catch (e) { print(e.message); res = false; @@ -359,8 +352,7 @@ class ServerApi extends ApiMap { } @override - String get rootAddress => - throw UnimplementedError('not used in with implementation'); + String get rootAddress => throw UnimplementedError('not used in with implementation'); Future apply() async { bool res = false; @@ -453,8 +445,7 @@ class ServerApi extends ApiMap { final Dio client = await getClient(); try { response = await client.get('/services/restic/backup/list'); - backups = - response.data.map((final e) => Backup.fromJson(e)).toList(); + backups = response.data.map((final e) => Backup.fromJson(e)).toList(); } on DioError catch (e) { print(e.message); } catch (e) { @@ -517,9 +508,7 @@ class ServerApi extends ApiMap { final Dio client = await getClient(); try { response = await client.get('/system/configuration/pull'); - result = (response.statusCode != null) - ? (response.statusCode == HttpStatus.ok) - : false; + result = (response.statusCode != null) ? (response.statusCode == HttpStatus.ok) : false; } on DioError catch (e) { print(e.message); } finally { @@ -535,9 +524,7 @@ class ServerApi extends ApiMap { final Dio client = await getClient(); try { response = await client.get('/system/reboot'); - result = (response.statusCode != null) - ? (response.statusCode == HttpStatus.ok) - : false; + result = (response.statusCode != null) ? (response.statusCode == HttpStatus.ok) : false; } on DioError catch (e) { print(e.message); } finally { @@ -553,9 +540,7 @@ class ServerApi extends ApiMap { final Dio client = await getClient(); try { response = await client.get('/system/configuration/upgrade'); - result = (response.statusCode != null) - ? (response.statusCode == HttpStatus.ok) - : false; + result = (response.statusCode != null) ? (response.statusCode == HttpStatus.ok) : false; } on DioError catch (e) { print(e.message); } finally { @@ -604,8 +589,7 @@ class ServerApi extends ApiMap { Future getServerTimezone() async { // I am not sure how to initialize TimeZoneSettings with default value... final Dio client = await getClient(); - final Response response = - await client.get('/system/configuration/timezone'); + final Response response = await client.get('/system/configuration/timezone'); close(client); return TimeZoneSettings.fromString(response.data); @@ -632,11 +616,7 @@ class ServerApi extends ApiMap { try { response = await client.get('/services/mailserver/dkim'); final Codec base64toString = utf8.fuse(base64); - dkim = base64toString - .decode(response.data) - .split('(')[1] - .split(')')[0] - .replaceAll('"', ''); + dkim = base64toString.decode(response.data).split('(')[1].split(')')[0].replaceAll('"', ''); } on DioError catch (e) { print(e.message); } finally { @@ -667,9 +647,7 @@ class ServerApi extends ApiMap { return ApiResponse( statusCode: code, - data: response.data != null - ? RecoveryKeyStatus.fromJson(response.data) - : null, + data: response.data != null ? RecoveryKeyStatus.fromJson(response.data) : null, ); } @@ -839,11 +817,7 @@ class ServerApi extends ApiMap { return ApiResponse( statusCode: code, - data: (response.data != null) - ? response.data - .map((final e) => ApiToken.fromJson(e)) - .toList() - : [], + data: (response.data != null) ? response.data.map((final e) => ApiToken.fromJson(e)).toList() : [], ); } diff --git a/lib/logic/cubit/forms/setup/initializing/root_user_form_cubit.dart b/lib/logic/cubit/forms/setup/initializing/root_user_form_cubit.dart index b3cf606f..cc4ef6cf 100644 --- a/lib/logic/cubit/forms/setup/initializing/root_user_form_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/root_user_form_cubit.dart @@ -1,8 +1,8 @@ import 'dart:async'; import 'package:cubit_form/cubit_form.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/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; class RootUserFormCubit extends FormCubit { @@ -22,6 +22,7 @@ class RootUserFormCubit extends FormCubit { FutureOr onSubmit() async { final User user = User( login: userName.state.value, + type: UserType.primary, password: password.state.value, ); serverInstallationCubit.setRootUser(user); diff --git a/lib/logic/cubit/forms/user/user_form_cubit.dart b/lib/logic/cubit/forms/user/user_form_cubit.dart index 92f66f15..d745b5f5 100644 --- a/lib/logic/cubit/forms/user/user_form_cubit.dart +++ b/lib/logic/cubit/forms/user/user_form_cubit.dart @@ -1,10 +1,10 @@ import 'dart:async'; import 'package:cubit_form/cubit_form.dart'; -import 'package:selfprivacy/logic/cubit/forms/factories/field_cubit_factory.dart'; import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart'; -import 'package:selfprivacy/logic/models/job.dart'; +import 'package:selfprivacy/logic/cubit/forms/factories/field_cubit_factory.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; +import 'package:selfprivacy/logic/models/job.dart'; import 'package:selfprivacy/utils/password_generator.dart'; class UserFormCubit extends FormCubit { @@ -29,6 +29,7 @@ class UserFormCubit extends FormCubit { FutureOr onSubmit() { final User user = User( login: login.state.value, + type: UserType.normal, password: password.state.value, ); jobsCubit.addJob(CreateUserJob(user: user)); diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index c9ca0e96..91c09714 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -12,10 +12,11 @@ import 'package:selfprivacy/config/hive_config.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_creator.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_factory.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server.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_factory.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server.dart'; import 'package:selfprivacy/logic/common_enum/common_enum.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'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; @@ -26,8 +27,6 @@ import 'package:selfprivacy/logic/models/server_basic_info.dart'; import 'package:selfprivacy/ui/components/action_button/action_button.dart'; import 'package:selfprivacy/ui/components/brand_alert/brand_alert.dart'; -import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; - class IpNotFoundException implements Exception { IpNotFoundException(this.message); final String message; @@ -41,12 +40,10 @@ class ServerAuthorizationException implements Exception { class ServerInstallationRepository { Box box = Hive.box(BNames.serverInstallationBox); Box usersBox = Hive.box(BNames.usersBox); - ServerProviderApiFactory? serverProviderApiFactory = - ApiFactoryCreator.createServerProviderApiFactory( + ServerProviderApiFactory? serverProviderApiFactory = ApiFactoryCreator.createServerProviderApiFactory( ServerProvider.hetzner, // TODO: HARDCODE FOR NOW!!! ); // TODO: Remove when provider selection is implemented. - DnsProviderApiFactory? dnsProviderApiFactory = - ApiFactoryCreator.createDnsProviderApiFactory( + DnsProviderApiFactory? dnsProviderApiFactory = ApiFactoryCreator.createDnsProviderApiFactory( DnsProvider.cloudflare, // TODO: HARDCODE FOR NOW!!! ); @@ -54,15 +51,11 @@ class ServerInstallationRepository { final String? providerApiToken = getIt().hetznerKey; final String? cloudflareToken = getIt().cloudFlareKey; final ServerDomain? serverDomain = getIt().serverDomain; - final BackblazeCredential? backblazeCredential = - getIt().backblazeCredential; - final ServerHostingDetails? serverDetails = - getIt().serverDetails; + final BackblazeCredential? backblazeCredential = getIt().backblazeCredential; + final ServerHostingDetails? serverDetails = getIt().serverDetails; - if (serverDetails != null && - serverDetails.provider != ServerProvider.unknown) { - serverProviderApiFactory = - ApiFactoryCreator.createServerProviderApiFactory( + if (serverDetails != null && serverDetails.provider != ServerProvider.unknown) { + serverProviderApiFactory = ApiFactoryCreator.createServerProviderApiFactory( serverDetails.provider, ); } @@ -82,15 +75,12 @@ class ServerInstallationRepository { serverDetails: serverDetails!, rootUser: box.get(BNames.rootUser), isServerStarted: box.get(BNames.isServerStarted, defaultValue: false), - isServerResetedFirstTime: - box.get(BNames.isServerResetedFirstTime, defaultValue: false), - isServerResetedSecondTime: - box.get(BNames.isServerResetedSecondTime, defaultValue: false), + isServerResetedFirstTime: box.get(BNames.isServerResetedFirstTime, defaultValue: false), + isServerResetedSecondTime: box.get(BNames.isServerResetedSecondTime, defaultValue: false), ); } - if (box.get(BNames.isRecoveringServer, defaultValue: false) && - serverDomain != null) { + if (box.get(BNames.isRecoveringServer, defaultValue: false) && serverDomain != null) { return ServerInstallationRecovery( providerApiToken: providerApiToken, cloudFlareKey: cloudflareToken, @@ -116,10 +106,8 @@ class ServerInstallationRepository { serverDetails: serverDetails, rootUser: box.get(BNames.rootUser), isServerStarted: box.get(BNames.isServerStarted, defaultValue: false), - isServerResetedFirstTime: - box.get(BNames.isServerResetedFirstTime, defaultValue: false), - isServerResetedSecondTime: - box.get(BNames.isServerResetedSecondTime, defaultValue: false), + isServerResetedFirstTime: box.get(BNames.isServerResetedFirstTime, defaultValue: false), + isServerResetedSecondTime: box.get(BNames.isServerResetedSecondTime, defaultValue: false), isLoading: box.get(BNames.isLoading, defaultValue: false), dnsMatches: null, ); @@ -183,13 +171,7 @@ class ServerInstallationRepository { final String? ip4, final Map skippedMatches, ) async { - final List addresses = [ - '$domainName', - 'api.$domainName', - 'cloud.$domainName', - 'meet.$domainName', - 'password.$domainName' - ]; + final List addresses = ['$domainName', 'api.$domainName', 'cloud.$domainName', 'meet.$domainName', 'password.$domainName']; final Map matches = {}; @@ -205,19 +187,15 @@ class ServerInstallationRepository { ); getIt.get().addMessage( Message( - text: - 'DnsLookup: address: $address, $RRecordType, provider: CLOUDFLARE, ip4: $ip4', + 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')}', + text: 'DnsLookup: ${lookupRecordRes == null ? 'empty' : (lookupRecordRes[0].data != ip4 ? 'wrong ip4' : 'right ip4')}', ), ); - if (lookupRecordRes == null || - lookupRecordRes.isEmpty || - lookupRecordRes[0].data != ip4) { + if (lookupRecordRes == null || lookupRecordRes.isEmpty || lookupRecordRes[0].data != ip4) { matches[address] = false; } else { matches[address] = true; @@ -233,8 +211,7 @@ class ServerInstallationRepository { final String cloudFlareKey, final BackblazeCredential backblazeCredential, { required final void Function() onCancel, - required final Future Function(ServerHostingDetails serverDetails) - onSuccess, + required final Future Function(ServerHostingDetails serverDetails) onSuccess, }) async { final ServerProviderApi api = serverProviderApiFactory!.getServerProvider(); try { @@ -338,10 +315,8 @@ class ServerInstallationRepository { final ServerDomain domain, { required final void Function() onCancel, }) async { - final DnsProviderApi dnsProviderApi = - dnsProviderApiFactory!.getDnsProvider(); - final ServerProviderApi serverApi = - serverProviderApiFactory!.getServerProvider(); + final DnsProviderApi dnsProviderApi = dnsProviderApiFactory!.getDnsProvider(); + final ServerProviderApi serverApi = serverProviderApiFactory!.getServerProvider(); await dnsProviderApi.removeSimilarRecords( ip4: serverDetails.ip4, @@ -357,9 +332,7 @@ class ServerInstallationRepository { final NavigationService nav = getIt.get(); nav.showPopUpDialog( BrandAlert( - title: e.response!.data['errors'][0]['code'] == 1038 - ? 'modals.10'.tr() - : 'providers.domain.states.error'.tr(), + title: e.response!.data['errors'][0]['code'] == 1038 ? 'modals.10'.tr() : 'providers.domain.states.error'.tr(), contentText: 'modals.6'.tr(), actions: [ ActionButton( @@ -392,8 +365,7 @@ class ServerInstallationRepository { } Future createDkimRecord(final ServerDomain cloudFlareDomain) async { - final DnsProviderApi dnsProviderApi = - dnsProviderApiFactory!.getDnsProvider(); + final DnsProviderApi dnsProviderApi = dnsProviderApiFactory!.getDnsProvider(); final ServerApi api = ServerApi(); String dkimRecordString = ''; @@ -460,31 +432,25 @@ class ServerInstallationRepository { final DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); if (kIsWeb) { return deviceInfo.webBrowserInfo.then( - (final WebBrowserInfo value) => - '${value.browserName} ${value.platform}', + (final WebBrowserInfo value) => '${value.browserName} ${value.platform}', ); } else { if (Platform.isAndroid) { return deviceInfo.androidInfo.then( - (final AndroidDeviceInfo value) => - '${value.model} ${value.version.release}', + (final AndroidDeviceInfo value) => '${value.model} ${value.version.release}', ); } else if (Platform.isIOS) { return deviceInfo.iosInfo.then( - (final IosDeviceInfo value) => - '${value.utsname.machine} ${value.systemName} ${value.systemVersion}', + (final IosDeviceInfo value) => '${value.utsname.machine} ${value.systemName} ${value.systemVersion}', ); } else if (Platform.isLinux) { - return deviceInfo.linuxInfo - .then((final LinuxDeviceInfo value) => value.prettyName); + return deviceInfo.linuxInfo.then((final LinuxDeviceInfo value) => value.prettyName); } else if (Platform.isMacOS) { return deviceInfo.macOsInfo.then( - (final MacOsDeviceInfo value) => - '${value.hostName} ${value.computerName}', + (final MacOsDeviceInfo value) => '${value.hostName} ${value.computerName}', ); } else if (Platform.isWindows) { - return deviceInfo.windowsInfo - .then((final WindowsDeviceInfo value) => value.computerName); + return deviceInfo.windowsInfo.then((final WindowsDeviceInfo value) => value.computerName); } } return 'Unidentified'; @@ -576,8 +542,7 @@ class ServerInstallationRepository { ); final String serverIp = await getServerIpFromDomain(serverDomain); if (recoveryCapabilities == ServerRecoveryCapabilities.legacy) { - final Map apiResponse = - await serverApi.servicesPowerCheck(); + final Map apiResponse = await serverApi.servicesPowerCheck(); if (apiResponse.isNotEmpty) { return ServerHostingDetails( apiToken: apiToken, @@ -600,8 +565,7 @@ class ServerInstallationRepository { ); } } - final ApiResponse deviceAuthKey = - await serverApi.createDeviceToken(); + final ApiResponse deviceAuthKey = await serverApi.createDeviceToken(); final ApiResponse apiResponse = await serverApi.authorizeDevice( DeviceToken(device: await getDeviceName(), token: deviceAuthKey.data), ); @@ -633,14 +597,14 @@ class ServerInstallationRepository { final ServerApi serverApi = ServerApi(); const User fallbackUser = User( isFoundOnServer: false, + type: UserType.primary, note: "Couldn't find main user on server, API is outdated", login: 'UNKNOWN', sshKeys: [], ); final String? serverApiVersion = await serverApi.getApiVersion(); - final ApiResponse> users = - await serverApi.getUsersList(withMainUser: true); + final ApiResponse> users = await serverApi.getUsersList(withMainUser: true); if (serverApiVersion == null || !users.isSuccess) { return fallbackUser; } @@ -652,6 +616,7 @@ class ServerInstallationRepository { return User( isFoundOnServer: true, login: users.data[0], + type: UserType.primary, ); } on FormatException { return fallbackUser; @@ -739,8 +704,7 @@ class ServerInstallationRepository { Future deleteServer(final ServerDomain serverDomain) async { final ServerProviderApi api = serverProviderApiFactory!.getServerProvider(); - final DnsProviderApi dnsProviderApi = - dnsProviderApiFactory!.getDnsProvider(); + final DnsProviderApi dnsProviderApi = dnsProviderApiFactory!.getDnsProvider(); await api.deleteServer( domainName: serverDomain.domainName, diff --git a/lib/logic/cubit/users/users_cubit.dart b/lib/logic/cubit/users/users_cubit.dart index 3ce0d18e..46e39568 100644 --- a/lib/logic/cubit/users/users_cubit.dart +++ b/lib/logic/cubit/users/users_cubit.dart @@ -1,10 +1,9 @@ import 'package:hive/hive.dart'; import 'package:selfprivacy/config/hive_config.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server.dart'; - export 'package:provider/provider.dart'; part 'users_state.dart'; @@ -15,8 +14,8 @@ class UsersCubit extends ServerInstallationDependendCubit { serverInstallationCubit, const UsersState( [], - User(login: 'root'), - User(login: 'loading...'), + User(login: 'root', type: UserType.root), + User(login: 'loading...', type: UserType.primary), ), ); Box box = Hive.box(BNames.usersBox); @@ -30,30 +29,26 @@ class UsersCubit extends ServerInstallationDependendCubit { final List loadedUsers = box.values.toList(); final primaryUser = serverInstallationBox.get( BNames.rootUser, - defaultValue: const User(login: 'loading...'), + defaultValue: const User(login: 'loading...', type: UserType.primary), ); - final List rootKeys = [ - ...serverInstallationBox.get(BNames.rootKeys, defaultValue: []) - ]; + final List rootKeys = [...serverInstallationBox.get(BNames.rootKeys, defaultValue: [])]; if (loadedUsers.isNotEmpty) { emit( UsersState( loadedUsers, - User(login: 'root', sshKeys: rootKeys), + User(login: 'root', sshKeys: rootKeys, type: UserType.root), primaryUser, ), ); } - final ApiResponse> usersFromServer = - await api.getUsersList(); + final ApiResponse> usersFromServer = await api.getUsersList(); if (usersFromServer.isSuccess) { - final List updatedList = - mergeLocalAndServerUsers(loadedUsers, usersFromServer.data); + final List updatedList = mergeLocalAndServerUsers(loadedUsers, usersFromServer.data); emit( UsersState( updatedList, - User(login: 'root', sshKeys: rootKeys), + User(login: 'root', sshKeys: rootKeys, type: UserType.root), primaryUser, ), ); @@ -64,11 +59,9 @@ class UsersCubit extends ServerInstallationDependendCubit { box.clear(); box.addAll(usersWithSshKeys); - final User rootUserWithSshKeys = - (await loadSshKeys([state.rootUser])).first; + final User rootUserWithSshKeys = (await loadSshKeys([state.rootUser])).first; serverInstallationBox.put(BNames.rootKeys, rootUserWithSshKeys.sshKeys); - final User primaryUserWithSshKeys = - (await loadSshKeys([state.primaryUser])).first; + final User primaryUserWithSshKeys = (await loadSshKeys([state.primaryUser])).first; serverInstallationBox.put(BNames.rootUser, primaryUserWithSshKeys); emit( UsersState( @@ -95,6 +88,7 @@ class UsersCubit extends ServerInstallationDependendCubit { mergedUsers.add( User( login: localUser.login, + type: UserType.normal, isFoundOnServer: true, password: localUser.password, sshKeys: localUser.sshKeys, @@ -105,6 +99,7 @@ class UsersCubit extends ServerInstallationDependendCubit { mergedUsers.add( User( login: localUser.login, + type: UserType.normal, isFoundOnServer: false, password: localUser.password, note: localUser.note, @@ -117,6 +112,7 @@ class UsersCubit extends ServerInstallationDependendCubit { mergedUsers.add( User( login: serverUser, + type: UserType.normal, isFoundOnServer: true, ), ); @@ -129,16 +125,14 @@ class UsersCubit extends ServerInstallationDependendCubit { final List updatedUsers = []; for (final User user in users) { - if (user.isFoundOnServer || - user.login == 'root' || - user.login == state.primaryUser.login) { - final ApiResponse> sshKeys = - await api.getUserSshKeys(user); + if (user.isFoundOnServer || user.login == 'root' || user.login == state.primaryUser.login) { + final ApiResponse> sshKeys = await api.getUserSshKeys(user); print('sshKeys for $user: ${sshKeys.data}'); if (sshKeys.isSuccess) { updatedUsers.add( User( login: user.login, + type: user.type, isFoundOnServer: true, password: user.password, sshKeys: sshKeys.data, @@ -149,6 +143,7 @@ class UsersCubit extends ServerInstallationDependendCubit { updatedUsers.add( User( login: user.login, + type: user.type, isFoundOnServer: true, password: user.password, note: user.note, @@ -159,6 +154,7 @@ class UsersCubit extends ServerInstallationDependendCubit { updatedUsers.add( User( login: user.login, + type: user.type, isFoundOnServer: false, password: user.password, note: user.note, @@ -173,17 +169,14 @@ class UsersCubit extends ServerInstallationDependendCubit { List updatedUsers = List.from(state.users); final ApiResponse> usersFromServer = await api.getUsersList(); if (usersFromServer.isSuccess) { - updatedUsers = - mergeLocalAndServerUsers(updatedUsers, usersFromServer.data); + updatedUsers = mergeLocalAndServerUsers(updatedUsers, usersFromServer.data); } final List usersWithSshKeys = await loadSshKeys(updatedUsers); box.clear(); box.addAll(usersWithSshKeys); - final User rootUserWithSshKeys = - (await loadSshKeys([state.rootUser])).first; + final User rootUserWithSshKeys = (await loadSshKeys([state.rootUser])).first; serverInstallationBox.put(BNames.rootKeys, rootUserWithSshKeys.sshKeys); - final User primaryUserWithSshKeys = - (await loadSshKeys([state.primaryUser])).first; + final User primaryUserWithSshKeys = (await loadSshKeys([state.primaryUser])).first; serverInstallationBox.put(BNames.rootUser, primaryUserWithSshKeys); emit( UsersState( @@ -197,8 +190,7 @@ class UsersCubit extends ServerInstallationDependendCubit { Future createUser(final User user) async { // If user exists on server, do nothing - if (state.users - .any((final User u) => u.login == user.login && u.isFoundOnServer)) { + if (state.users.any((final User u) => u.login == user.login && u.isFoundOnServer)) { return; } // If user is root or primary user, do nothing @@ -240,14 +232,14 @@ class UsersCubit extends ServerInstallationDependendCubit { final ApiResponse result = await api.addRootSshKey(publicKey); if (result.isSuccess) { // Add ssh key to the array of root keys - final List rootKeys = serverInstallationBox - .get(BNames.rootKeys, defaultValue: []) as List; + final List rootKeys = serverInstallationBox.get(BNames.rootKeys, defaultValue: []) as List; rootKeys.add(publicKey); serverInstallationBox.put(BNames.rootKeys, rootKeys); emit( state.copyWith( rootUser: User( login: state.rootUser.login, + type: UserType.root, isFoundOnServer: true, password: state.rootUser.password, sshKeys: rootKeys, @@ -261,11 +253,11 @@ class UsersCubit extends ServerInstallationDependendCubit { if (result.isSuccess) { // If it is primary user, update primary user if (user.login == state.primaryUser.login) { - final List primaryUserKeys = - List.from(state.primaryUser.sshKeys); + final List primaryUserKeys = List.from(state.primaryUser.sshKeys); primaryUserKeys.add(publicKey); final User updatedUser = User( login: state.primaryUser.login, + type: UserType.primary, isFoundOnServer: true, password: state.primaryUser.password, sshKeys: primaryUserKeys, @@ -283,6 +275,7 @@ class UsersCubit extends ServerInstallationDependendCubit { userKeys.add(publicKey); final User updatedUser = User( login: user.login, + type: UserType.normal, isFoundOnServer: true, password: user.password, sshKeys: userKeys, @@ -302,22 +295,21 @@ class UsersCubit extends ServerInstallationDependendCubit { Future deleteSshKey(final User user, final String publicKey) async { // All keys are deleted via api.deleteUserSshKey - final ApiResponse result = - await api.deleteUserSshKey(user, publicKey); + final ApiResponse result = await api.deleteUserSshKey(user, publicKey); if (result.isSuccess) { // If it is root user, delete key from root keys // If it is primary user, update primary user // If it is not primary user, update user if (user.login == 'root') { - final List rootKeys = serverInstallationBox - .get(BNames.rootKeys, defaultValue: []) as List; + final List rootKeys = serverInstallationBox.get(BNames.rootKeys, defaultValue: []) as List; rootKeys.remove(publicKey); serverInstallationBox.put(BNames.rootKeys, rootKeys); emit( state.copyWith( rootUser: User( login: state.rootUser.login, + type: UserType.root, isFoundOnServer: true, password: state.rootUser.password, sshKeys: rootKeys, @@ -328,11 +320,11 @@ class UsersCubit extends ServerInstallationDependendCubit { return; } if (user.login == state.primaryUser.login) { - final List primaryUserKeys = - List.from(state.primaryUser.sshKeys); + final List primaryUserKeys = List.from(state.primaryUser.sshKeys); primaryUserKeys.remove(publicKey); final User updatedUser = User( login: state.primaryUser.login, + type: UserType.primary, isFoundOnServer: true, password: state.primaryUser.password, sshKeys: primaryUserKeys, @@ -350,6 +342,7 @@ class UsersCubit extends ServerInstallationDependendCubit { userKeys.remove(publicKey); final User updatedUser = User( login: user.login, + type: UserType.normal, isFoundOnServer: true, password: user.password, sshKeys: userKeys, @@ -369,8 +362,8 @@ class UsersCubit extends ServerInstallationDependendCubit { emit( const UsersState( [], - User(login: 'root'), - User(login: 'loading...'), + User(login: 'root', type: UserType.root), + User(login: 'loading...', type: UserType.primary), ), ); } diff --git a/lib/logic/models/hive/README.md b/lib/logic/models/hive/README.md index afdd6276..f8f9e14d 100644 --- a/lib/logic/models/hive/README.md +++ b/lib/logic/models/hive/README.md @@ -7,7 +7,8 @@ 5. ServerVolume 6. BackblazeBucket - ## Enums + 100. DnsProvider -101. ServerProvider \ No newline at end of file +101. ServerProvider +102. UserType diff --git a/lib/logic/models/hive/user.dart b/lib/logic/models/hive/user.dart index f140953d..042b2485 100644 --- a/lib/logic/models/hive/user.dart +++ b/lib/logic/models/hive/user.dart @@ -2,6 +2,7 @@ import 'dart:ui'; import 'package:equatable/equatable.dart'; import 'package:hive/hive.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/schema.graphql.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/users.graphql.dart'; import 'package:selfprivacy/utils/color_utils.dart'; @@ -11,6 +12,7 @@ part 'user.g.dart'; class User extends Equatable { const User({ required this.login, + required this.type, this.password, this.sshKeys = const [], this.isFoundOnServer = true, @@ -20,6 +22,7 @@ class User extends Equatable { User.fromGraphQL(final Fragment$userFields user) : this( login: user.username, + type: UserType.fromGraphQL(user.userType), sshKeys: user.sshKeys, isFoundOnServer: true, ); @@ -39,6 +42,9 @@ class User extends Equatable { @HiveField(4) final String? note; + @HiveField(5, defaultValue: UserType.normal) + final UserType type; + @override List get props => [login, password, sshKeys, isFoundOnServer, note]; @@ -47,3 +53,26 @@ class User extends Equatable { @override String toString() => '$login, ${isFoundOnServer ? 'found' : 'not found'}, ${sshKeys.length} ssh keys, note: $note'; } + +@HiveType(typeId: 102) +enum UserType { + @HiveField(0) + root, + @HiveField(1) + primary, + @HiveField(2) + normal; + + factory UserType.fromGraphQL(final Enum$UserType type) { + switch (type) { + case Enum$UserType.ROOT: + return root; + case Enum$UserType.PRIMARY: + return primary; + case Enum$UserType.NORMAL: + return normal; + case Enum$UserType.$unknown: + return normal; + } + } +} From 0879ea8e9731689803c5c0c5a7d536f036e4ed36 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Mon, 5 Sep 2022 07:01:36 +0300 Subject: [PATCH 044/115] Refactor Users cubit to use GraphQL and unified data model --- assets/translations/en.json | 6 +- .../graphql_maps/schema/users.graphql | 3 + .../graphql_maps/schema/users.graphql.dart | 1738 +++++------------ .../graphql_maps/schema/users.graphql.g.dart | 231 +-- .../graphql_maps/server_api/users_api.dart | 4 + lib/logic/cubit/users/users_cubit.dart | 344 +--- lib/logic/cubit/users/users_state.dart | 21 +- lib/logic/models/hive/user.g.dart | 53 +- 8 files changed, 704 insertions(+), 1696 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index ce1bfb5f..5e813da5 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -281,7 +281,11 @@ "delete_confirm_question": "Are you sure?", "reset_password": "Reset password", "account": "Account", - "send_registration_data": "Share login credentials" + "send_registration_data": "Share login credentials", + "could_not_fetch_users": "Couldn't fetch users list", + "could_not_create_user": "Couldn't create user", + "could_not_delete_user": "Couldn't delete user", + "could_not_add_ssh_key": "Couldn't add SSH key" }, "initializing": { "_comment": "initializing page", diff --git a/lib/logic/api_maps/graphql_maps/schema/users.graphql b/lib/logic/api_maps/graphql_maps/schema/users.graphql index 4f16ffc5..78de71ff 100644 --- a/lib/logic/api_maps/graphql_maps/schema/users.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/users.graphql @@ -15,6 +15,9 @@ query AllUsers { allUsers { ...userFields } + rootUser: getUser(username: "root") { + ...userFields + } } } 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 328b4a3b..5d0e5d63 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,19 @@ import 'dart:async'; -import 'disk_volumes.graphql.dart'; + import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; import 'package:json_annotation/json_annotation.dart'; + import 'schema.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); + factory Fragment$basicMutationReturnFields.fromJson(Map json) => _$Fragment$basicMutationReturnFieldsFromJson(json); final int code; @@ -28,8 +24,7 @@ class Fragment$basicMutationReturnFields { @JsonKey(name: '__typename') final String $__typename; - Map toJson() => - _$Fragment$basicMutationReturnFieldsToJson(this); + Map toJson() => _$Fragment$basicMutationReturnFieldsToJson(this); int get hashCode { final l$code = code; final l$message = message; @@ -41,8 +36,7 @@ class Fragment$basicMutationReturnFields { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Fragment$basicMutationReturnFields) || - runtimeType != other.runtimeType) return false; + if (!(other is Fragment$basicMutationReturnFields) || runtimeType != other.runtimeType) return false; final l$code = code; final lOther$code = other.code; if (l$code != lOther$code) return false; @@ -59,28 +53,22 @@ class Fragment$basicMutationReturnFields { } } -extension UtilityExtension$Fragment$basicMutationReturnFields - on Fragment$basicMutationReturnFields { - CopyWith$Fragment$basicMutationReturnFields< - Fragment$basicMutationReturnFields> - get copyWith => - CopyWith$Fragment$basicMutationReturnFields(this, (i) => i); +extension UtilityExtension$Fragment$basicMutationReturnFields on Fragment$basicMutationReturnFields { + CopyWith$Fragment$basicMutationReturnFields 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) = + Fragment$basicMutationReturnFields instance, TRes Function(Fragment$basicMutationReturnFields) then) = _CopyWithImpl$Fragment$basicMutationReturnFields; - factory CopyWith$Fragment$basicMutationReturnFields.stub(TRes res) = - _CopyWithStubImpl$Fragment$basicMutationReturnFields; + factory CopyWith$Fragment$basicMutationReturnFields.stub(TRes res) = _CopyWithStubImpl$Fragment$basicMutationReturnFields; TRes call({int? code, String? message, bool? success, String? $__typename}); } -class _CopyWithImpl$Fragment$basicMutationReturnFields - implements CopyWith$Fragment$basicMutationReturnFields { +class _CopyWithImpl$Fragment$basicMutationReturnFields implements CopyWith$Fragment$basicMutationReturnFields { _CopyWithImpl$Fragment$basicMutationReturnFields(this._instance, this._then); final Fragment$basicMutationReturnFields _instance; @@ -89,114 +77,62 @@ 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 - implements CopyWith$Fragment$basicMutationReturnFields { +class _CopyWithStubImpl$Fragment$basicMutationReturnFields implements CopyWith$Fragment$basicMutationReturnFields { _CopyWithStubImpl$Fragment$basicMutationReturnFields(this._res); TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => - _res; + 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)), + 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) + 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: [ +const documentNodeFragmentbasicMutationReturnFields = DocumentNode(definitions: [ fragmentDefinitionbasicMutationReturnFields, ]); -extension ClientExtension$Fragment$basicMutationReturnFields - on graphql.GraphQLClient { +extension ClientExtension$Fragment$basicMutationReturnFields on graphql.GraphQLClient { void writeFragment$basicMutationReturnFields( - {required Fragment$basicMutationReturnFields data, - required Map idFields, - bool broadcast = true}) => + {required Fragment$basicMutationReturnFields data, required Map idFields, bool broadcast = true}) => this.writeFragment( graphql.FragmentRequest( idFields: idFields, - fragment: const graphql.Fragment( - fragmentName: 'basicMutationReturnFields', - document: documentNodeFragmentbasicMutationReturnFields)), + fragment: const graphql.Fragment(fragmentName: 'basicMutationReturnFields', document: documentNodeFragmentbasicMutationReturnFields)), data: data.toJson(), broadcast: broadcast); - Fragment$basicMutationReturnFields? readFragment$basicMutationReturnFields( - {required Map idFields, bool optimistic = true}) { + + 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)), + fragment: const graphql.Fragment(fragmentName: 'basicMutationReturnFields', document: documentNodeFragmentbasicMutationReturnFields)), optimistic: optimistic); - return result == null - ? null - : Fragment$basicMutationReturnFields.fromJson(result); + 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}); + Fragment$userFields({required this.username, required this.userType, required this.sshKeys, required this.$__typename}); @override - factory Fragment$userFields.fromJson(Map json) => - _$Fragment$userFieldsFromJson(json); + factory Fragment$userFields.fromJson(Map json) => _$Fragment$userFieldsFromJson(json); final String username; @@ -214,19 +150,13 @@ class Fragment$userFields { final l$userType = userType; final l$sshKeys = sshKeys; final l$$__typename = $__typename; - return Object.hashAll([ - l$username, - l$userType, - Object.hashAll(l$sshKeys.map((v) => v)), - l$$__typename - ]); + return Object.hashAll([l$username, l$userType, Object.hashAll(l$sshKeys.map((v) => v)), l$$__typename]); } @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Fragment$userFields) || runtimeType != other.runtimeType) - return false; + 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; @@ -250,27 +180,18 @@ class Fragment$userFields { } extension UtilityExtension$Fragment$userFields on Fragment$userFields { - CopyWith$Fragment$userFields get copyWith => - CopyWith$Fragment$userFields(this, (i) => i); + CopyWith$Fragment$userFields get copyWith => 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; + 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 { +class _CopyWithImpl$Fragment$userFields implements CopyWith$Fragment$userFields { _CopyWithImpl$Fragment$userFields(this._instance, this._then); final Fragment$userFields _instance; @@ -279,96 +200,48 @@ 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 - implements CopyWith$Fragment$userFields { +class _CopyWithStubImpl$Fragment$userFields implements CopyWith$Fragment$userFields { _CopyWithStubImpl$Fragment$userFields(this._res); TRes _res; - call( - {String? username, - Enum$UserType? userType, - List? sshKeys, - String? $__typename}) => - _res; + 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)), + 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) + 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}) => - this.writeFragment( + 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)), + 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}) { + + 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)), + idFields: idFields, fragment: const graphql.Fragment(fragmentName: 'userFields', document: documentNodeFragmentuserFields)), optimistic: optimistic); return result == null ? null : Fragment$userFields.fromJson(result); } @@ -379,8 +252,7 @@ class Query$AllUsers { Query$AllUsers({required this.users, required this.$__typename}); @override - factory Query$AllUsers.fromJson(Map json) => - _$Query$AllUsersFromJson(json); + factory Query$AllUsers.fromJson(Map json) => _$Query$AllUsersFromJson(json); final Query$AllUsers$users users; @@ -397,8 +269,7 @@ class Query$AllUsers { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Query$AllUsers) || runtimeType != other.runtimeType) - return false; + 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; @@ -410,24 +281,19 @@ class Query$AllUsers { } extension UtilityExtension$Query$AllUsers on Query$AllUsers { - CopyWith$Query$AllUsers get copyWith => - CopyWith$Query$AllUsers(this, (i) => i); + CopyWith$Query$AllUsers get copyWith => 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; + factory CopyWith$Query$AllUsers(Query$AllUsers instance, TRes Function(Query$AllUsers) then) = _CopyWithImpl$Query$AllUsers; - factory CopyWith$Query$AllUsers.stub(TRes res) = - _CopyWithStubImpl$Query$AllUsers; + factory CopyWith$Query$AllUsers.stub(TRes res) = _CopyWithStubImpl$Query$AllUsers; TRes call({Query$AllUsers$users? users, String? $__typename}); CopyWith$Query$AllUsers$users get users; } -class _CopyWithImpl$Query$AllUsers - implements CopyWith$Query$AllUsers { +class _CopyWithImpl$Query$AllUsers implements CopyWith$Query$AllUsers { _CopyWithImpl$Query$AllUsers(this._instance, this._then); final Query$AllUsers _instance; @@ -436,29 +302,24 @@ class _CopyWithImpl$Query$AllUsers static const _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))); + 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))); + CopyWith$Query$AllUsers$users get users { final local$users = _instance.users; return CopyWith$Query$AllUsers$users(local$users, (e) => call(users: e)); } } -class _CopyWithStubImpl$Query$AllUsers - implements CopyWith$Query$AllUsers { +class _CopyWithStubImpl$Query$AllUsers implements CopyWith$Query$AllUsers { _CopyWithStubImpl$Query$AllUsers(this._res); TRes _res; call({Query$AllUsers$users? users, String? $__typename}) => _res; - CopyWith$Query$AllUsers$users get users => - CopyWith$Query$AllUsers$users.stub(_res); + + CopyWith$Query$AllUsers$users get users => CopyWith$Query$AllUsers$users.stub(_res); } const documentNodeQueryAllUsers = DocumentNode(definitions: [ @@ -480,33 +341,26 @@ const documentNodeQueryAllUsers = DocumentNode(definitions: [ arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'userFields'), directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) + 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: [], + name: NameNode(value: 'getUser'), + alias: NameNode(value: 'rootUser'), + arguments: [ArgumentNode(name: NameNode(value: 'username'), value: StringValueNode(value: 'root', isBlock: false))], directives: [], - selectionSet: null) + 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) ])), fragmentDefinitionuserFields, ]); -Query$AllUsers _parserFn$Query$AllUsers(Map data) => - Query$AllUsers.fromJson(data); + +Query$AllUsers _parserFn$Query$AllUsers(Map data) => Query$AllUsers.fromJson(data); class Options$Query$AllUsers extends graphql.QueryOptions { Options$Query$AllUsers( @@ -529,8 +383,7 @@ class Options$Query$AllUsers extends graphql.QueryOptions { parserFn: _parserFn$Query$AllUsers); } -class WatchOptions$Query$AllUsers - extends graphql.WatchQueryOptions { +class WatchOptions$Query$AllUsers extends graphql.WatchQueryOptions { WatchOptions$Query$AllUsers( {String? operationName, graphql.FetchPolicy? fetchPolicy, @@ -558,60 +411,52 @@ class WatchOptions$Query$AllUsers } class FetchMoreOptions$Query$AllUsers extends graphql.FetchMoreOptions { - FetchMoreOptions$Query$AllUsers({required graphql.UpdateQuery updateQuery}) - : super(updateQuery: updateQuery, document: documentNodeQueryAllUsers); + FetchMoreOptions$Query$AllUsers({required graphql.UpdateQuery updateQuery}) : super(updateQuery: updateQuery, document: documentNodeQueryAllUsers); } extension ClientExtension$Query$AllUsers on graphql.GraphQLClient { - Future> query$AllUsers( - [Options$Query$AllUsers? options]) async => + Future> query$AllUsers([Options$Query$AllUsers? options]) async => await this.query(options ?? Options$Query$AllUsers()); - graphql.ObservableQuery watchQuery$AllUsers( - [WatchOptions$Query$AllUsers? options]) => + + graphql.ObservableQuery watchQuery$AllUsers([WatchOptions$Query$AllUsers? options]) => this.watchQuery(options ?? WatchOptions$Query$AllUsers()); - void writeQuery$AllUsers( - {required Query$AllUsers data, bool broadcast = true}) => - this.writeQuery( - graphql.Request( - operation: - graphql.Operation(document: documentNodeQueryAllUsers)), - data: data.toJson(), - broadcast: broadcast); + + 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); + 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, 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) => _$Query$AllUsers$usersFromJson(json); final List allUsers; + final Fragment$userFields? rootUser; + @JsonKey(name: '__typename') final String $__typename; Map toJson() => _$Query$AllUsers$usersToJson(this); + 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$$__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) - return false; + 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; @@ -621,6 +466,9 @@ class Query$AllUsers$users { 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; final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; if (l$$__typename != lOther$$__typename) return false; @@ -629,27 +477,22 @@ class Query$AllUsers$users { } 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 get copyWith => 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; + factory CopyWith$Query$AllUsers$users.stub(TRes res) = _CopyWithStubImpl$Query$AllUsers$users; - TRes call({List? allUsers, String? $__typename}); - TRes allUsers( - Iterable Function( - Iterable>) - _fn); + TRes call({List? allUsers, Fragment$userFields? rootUser, String? $__typename}); + + TRes allUsers(Iterable Function(Iterable>) _fn); + + CopyWith$Fragment$userFields get rootUser; } -class _CopyWithImpl$Query$AllUsers$users - implements CopyWith$Query$AllUsers$users { +class _CopyWithImpl$Query$AllUsers$users implements CopyWith$Query$AllUsers$users { _CopyWithImpl$Query$AllUsers$users(this._instance, this._then); final Query$AllUsers$users _instance; @@ -658,32 +501,32 @@ class _CopyWithImpl$Query$AllUsers$users static const _undefined = {}; - TRes call( - {Object? allUsers = _undefined, Object? $__typename = _undefined}) => - _then(Query$AllUsers$users( - allUsers: allUsers == _undefined || allUsers == null - ? _instance.allUsers - : (allUsers as List), - $__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()); + 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))); + + TRes allUsers(Iterable Function(Iterable>) _fn) => + call(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 + ? CopyWith$Fragment$userFields.stub(_then(_instance)) + : CopyWith$Fragment$userFields(local$rootUser, (e) => call(rootUser: e)); + } } -class _CopyWithStubImpl$Query$AllUsers$users - implements CopyWith$Query$AllUsers$users { +class _CopyWithStubImpl$Query$AllUsers$users implements CopyWith$Query$AllUsers$users { _CopyWithStubImpl$Query$AllUsers$users(this._res); TRes _res; - call({List? allUsers, String? $__typename}) => _res; + 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) @@ -691,8 +534,7 @@ class Variables$Query$GetUser { Variables$Query$GetUser({required this.username}); @override - factory Variables$Query$GetUser.fromJson(Map json) => - _$Variables$Query$GetUserFromJson(json); + factory Variables$Query$GetUser.fromJson(Map json) => _$Variables$Query$GetUserFromJson(json); final String username; @@ -705,31 +547,26 @@ class Variables$Query$GetUser { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Variables$Query$GetUser) || runtimeType != other.runtimeType) - return false; + 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); + 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) = + 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; + factory CopyWith$Variables$Query$GetUser.stub(TRes res) = _CopyWithStubImpl$Variables$Query$GetUser; TRes call({String? username}); } -class _CopyWithImpl$Variables$Query$GetUser - implements CopyWith$Variables$Query$GetUser { +class _CopyWithImpl$Variables$Query$GetUser implements CopyWith$Variables$Query$GetUser { _CopyWithImpl$Variables$Query$GetUser(this._instance, this._then); final Variables$Query$GetUser _instance; @@ -738,14 +575,11 @@ 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(username: username == _undefined || username == null ? _instance.username : (username as String))); } -class _CopyWithStubImpl$Variables$Query$GetUser - implements CopyWith$Variables$Query$GetUser { +class _CopyWithStubImpl$Variables$Query$GetUser implements CopyWith$Variables$Query$GetUser { _CopyWithStubImpl$Variables$Query$GetUser(this._res); TRes _res; @@ -758,8 +592,7 @@ class Query$GetUser { Query$GetUser({required this.users, required this.$__typename}); @override - factory Query$GetUser.fromJson(Map json) => - _$Query$GetUserFromJson(json); + factory Query$GetUser.fromJson(Map json) => _$Query$GetUserFromJson(json); final Query$GetUser$users users; @@ -776,8 +609,7 @@ class Query$GetUser { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Query$GetUser) || runtimeType != other.runtimeType) - return false; + 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; @@ -789,24 +621,19 @@ class Query$GetUser { } 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; + factory CopyWith$Query$GetUser(Query$GetUser instance, TRes Function(Query$GetUser) then) = _CopyWithImpl$Query$GetUser; - factory CopyWith$Query$GetUser.stub(TRes res) = - _CopyWithStubImpl$Query$GetUser; + factory CopyWith$Query$GetUser.stub(TRes res) = _CopyWithStubImpl$Query$GetUser; TRes call({Query$GetUser$users? users, String? $__typename}); CopyWith$Query$GetUser$users get users; } -class _CopyWithImpl$Query$GetUser - implements CopyWith$Query$GetUser { +class _CopyWithImpl$Query$GetUser implements CopyWith$Query$GetUser { _CopyWithImpl$Query$GetUser(this._instance, this._then); final Query$GetUser _instance; @@ -815,29 +642,24 @@ class _CopyWithImpl$Query$GetUser static const _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))); + 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))); + CopyWith$Query$GetUser$users get users { final local$users = _instance.users; return CopyWith$Query$GetUser$users(local$users, (e) => call(users: e)); } } -class _CopyWithStubImpl$Query$GetUser - implements CopyWith$Query$GetUser { +class _CopyWithStubImpl$Query$GetUser implements CopyWith$Query$GetUser { _CopyWithStubImpl$Query$GetUser(this._res); TRes _res; call({Query$GetUser$users? users, String? $__typename}) => _res; - CopyWith$Query$GetUser$users get users => - CopyWith$Query$GetUser$users.stub(_res); + + CopyWith$Query$GetUser$users get users => CopyWith$Query$GetUser$users.stub(_res); } const documentNodeQueryGetUser = DocumentNode(definitions: [ @@ -847,8 +669,7 @@ const documentNodeQueryGetUser = DocumentNode(definitions: [ variableDefinitions: [ VariableDefinitionNode( variable: VariableNode(name: NameNode(value: 'username')), - type: - NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), + type: NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), defaultValue: DefaultValueNode(value: null), directives: []) ], @@ -863,40 +684,20 @@ const documentNodeQueryGetUser = DocumentNode(definitions: [ FieldNode( name: NameNode(value: 'getUser'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'username'), - value: VariableNode(name: NameNode(value: 'username'))) - ], + 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) + 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) + FieldNode(name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], selectionSet: null) ])), fragmentDefinitionuserFields, ]); -Query$GetUser _parserFn$Query$GetUser(Map data) => - Query$GetUser.fromJson(data); + +Query$GetUser _parserFn$Query$GetUser(Map data) => Query$GetUser.fromJson(data); class Options$Query$GetUser extends graphql.QueryOptions { Options$Query$GetUser( @@ -921,8 +722,7 @@ class Options$Query$GetUser extends graphql.QueryOptions { parserFn: _parserFn$Query$GetUser); } -class WatchOptions$Query$GetUser - extends graphql.WatchQueryOptions { +class WatchOptions$Query$GetUser extends graphql.WatchQueryOptions { WatchOptions$Query$GetUser( {String? operationName, required Variables$Query$GetUser variables, @@ -952,38 +752,21 @@ class WatchOptions$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 { - Future> query$GetUser( - Options$Query$GetUser options) async => - await this.query(options); - 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}) => - 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()), + Future> query$GetUser(Options$Query$GetUser options) async => await this.query(options); + + 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}) => + 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); return result == null ? null : Query$GetUser.fromJson(result); } @@ -994,8 +777,7 @@ class Query$GetUser$users { 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) => _$Query$GetUser$usersFromJson(json); final Fragment$userFields? getUser; @@ -1012,8 +794,7 @@ class Query$GetUser$users { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Query$GetUser$users) || runtimeType != other.runtimeType) - return false; + 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; @@ -1025,24 +806,19 @@ class Query$GetUser$users { } 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 get copyWith => 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; + factory CopyWith$Query$GetUser$users.stub(TRes res) = _CopyWithStubImpl$Query$GetUser$users; TRes call({Fragment$userFields? getUser, String? $__typename}); CopyWith$Fragment$userFields get getUser; } -class _CopyWithImpl$Query$GetUser$users - implements CopyWith$Query$GetUser$users { +class _CopyWithImpl$Query$GetUser$users implements CopyWith$Query$GetUser$users { _CopyWithImpl$Query$GetUser$users(this._instance, this._then); final Query$GetUser$users _instance; @@ -1051,14 +827,10 @@ class _CopyWithImpl$Query$GetUser$users static const _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))); + 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))); + CopyWith$Fragment$userFields get getUser { final local$getUser = _instance.getUser; return local$getUser == null @@ -1067,15 +839,14 @@ class _CopyWithImpl$Query$GetUser$users } } -class _CopyWithStubImpl$Query$GetUser$users - implements CopyWith$Query$GetUser$users { +class _CopyWithStubImpl$Query$GetUser$users implements CopyWith$Query$GetUser$users { _CopyWithStubImpl$Query$GetUser$users(this._res); TRes _res; call({Fragment$userFields? getUser, String? $__typename}) => _res; - CopyWith$Fragment$userFields get getUser => - CopyWith$Fragment$userFields.stub(_res); + + CopyWith$Fragment$userFields get getUser => CopyWith$Fragment$userFields.stub(_res); } @JsonSerializable(explicitToJson: true) @@ -1083,8 +854,7 @@ class Variables$Mutation$CreateUser { Variables$Mutation$CreateUser({required this.user}); @override - factory Variables$Mutation$CreateUser.fromJson(Map json) => - _$Variables$Mutation$CreateUserFromJson(json); + factory Variables$Mutation$CreateUser.fromJson(Map json) => _$Variables$Mutation$CreateUserFromJson(json); final Input$UserMutationInput user; @@ -1097,32 +867,26 @@ class Variables$Mutation$CreateUser { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Variables$Mutation$CreateUser) || - runtimeType != other.runtimeType) return false; + 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); + 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) = + factory CopyWith$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; + factory CopyWith$Variables$Mutation$CreateUser.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$CreateUser; TRes call({Input$UserMutationInput? user}); } -class _CopyWithImpl$Variables$Mutation$CreateUser - implements CopyWith$Variables$Mutation$CreateUser { +class _CopyWithImpl$Variables$Mutation$CreateUser implements CopyWith$Variables$Mutation$CreateUser { _CopyWithImpl$Variables$Mutation$CreateUser(this._instance, this._then); final Variables$Mutation$CreateUser _instance; @@ -1131,14 +895,11 @@ 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(user: user == _undefined || user == null ? _instance.user : (user as Input$UserMutationInput))); } -class _CopyWithStubImpl$Variables$Mutation$CreateUser - implements CopyWith$Variables$Mutation$CreateUser { +class _CopyWithStubImpl$Variables$Mutation$CreateUser implements CopyWith$Variables$Mutation$CreateUser { _CopyWithStubImpl$Variables$Mutation$CreateUser(this._res); TRes _res; @@ -1151,8 +912,7 @@ class Mutation$CreateUser { Mutation$CreateUser({required this.createUser, required this.$__typename}); @override - factory Mutation$CreateUser.fromJson(Map json) => - _$Mutation$CreateUserFromJson(json); + factory Mutation$CreateUser.fromJson(Map json) => _$Mutation$CreateUserFromJson(json); final Mutation$CreateUser$createUser createUser; @@ -1169,8 +929,7 @@ class Mutation$CreateUser { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Mutation$CreateUser) || runtimeType != other.runtimeType) - return false; + 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; @@ -1182,24 +941,19 @@ class Mutation$CreateUser { } extension UtilityExtension$Mutation$CreateUser on Mutation$CreateUser { - CopyWith$Mutation$CreateUser get copyWith => - CopyWith$Mutation$CreateUser(this, (i) => i); + CopyWith$Mutation$CreateUser get copyWith => 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; + factory CopyWith$Mutation$CreateUser.stub(TRes res) = _CopyWithStubImpl$Mutation$CreateUser; TRes call({Mutation$CreateUser$createUser? createUser, String? $__typename}); CopyWith$Mutation$CreateUser$createUser get createUser; } -class _CopyWithImpl$Mutation$CreateUser - implements CopyWith$Mutation$CreateUser { +class _CopyWithImpl$Mutation$CreateUser implements CopyWith$Mutation$CreateUser { _CopyWithImpl$Mutation$CreateUser(this._instance, this._then); final Mutation$CreateUser _instance; @@ -1208,33 +962,24 @@ class _CopyWithImpl$Mutation$CreateUser static const _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))); + 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))); + CopyWith$Mutation$CreateUser$createUser get createUser { final local$createUser = _instance.createUser; - return CopyWith$Mutation$CreateUser$createUser( - local$createUser, (e) => call(createUser: e)); + return CopyWith$Mutation$CreateUser$createUser(local$createUser, (e) => call(createUser: e)); } } -class _CopyWithStubImpl$Mutation$CreateUser - implements CopyWith$Mutation$CreateUser { +class _CopyWithStubImpl$Mutation$CreateUser implements CopyWith$Mutation$CreateUser { _CopyWithStubImpl$Mutation$CreateUser(this._res); TRes _res; - call({Mutation$CreateUser$createUser? createUser, String? $__typename}) => - _res; - CopyWith$Mutation$CreateUser$createUser get createUser => - CopyWith$Mutation$CreateUser$createUser.stub(_res); + call({Mutation$CreateUser$createUser? createUser, String? $__typename}) => _res; + + CopyWith$Mutation$CreateUser$createUser get createUser => CopyWith$Mutation$CreateUser$createUser.stub(_res); } const documentNodeMutationCreateUser = DocumentNode(definitions: [ @@ -1244,8 +989,7 @@ const documentNodeMutationCreateUser = DocumentNode(definitions: [ variableDefinitions: [ VariableDefinitionNode( variable: VariableNode(name: NameNode(value: 'user')), - type: NamedTypeNode( - name: NameNode(value: 'UserMutationInput'), isNonNull: true), + type: NamedTypeNode(name: NameNode(value: 'UserMutationInput'), isNonNull: true), defaultValue: DefaultValueNode(value: null), directives: []) ], @@ -1254,55 +998,32 @@ const documentNodeMutationCreateUser = DocumentNode(definitions: [ FieldNode( name: NameNode(value: 'createUser'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'user'), - value: VariableNode(name: NameNode(value: 'user'))) - ], + arguments: [ArgumentNode(name: NameNode(value: 'user'), value: VariableNode(name: NameNode(value: 'user')))], directives: [], selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), + FragmentSpreadNode(name: NameNode(value: 'basicMutationReturnFields'), 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) + 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) + 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?); -class Options$Mutation$CreateUser - extends graphql.MutationOptions { +Mutation$CreateUser _parserFn$Mutation$CreateUser(Map data) => Mutation$CreateUser.fromJson(data); + +typedef OnMutationCompleted$Mutation$CreateUser = FutureOr Function(dynamic, Mutation$CreateUser?); + +class Options$Mutation$CreateUser extends graphql.MutationOptions { Options$Mutation$CreateUser( {String? operationName, required Variables$Mutation$CreateUser variables, @@ -1323,10 +1044,7 @@ class Options$Mutation$CreateUser cacheRereadPolicy: cacheRereadPolicy, optimisticResult: optimisticResult, context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted(data, - data == null ? null : _parserFn$Mutation$CreateUser(data)), + onCompleted: onCompleted == null ? null : (data) => onCompleted(data, data == null ? null : _parserFn$Mutation$CreateUser(data)), update: update, onError: onError, document: documentNodeMutationCreateUser, @@ -1335,16 +1053,11 @@ class Options$Mutation$CreateUser final OnMutationCompleted$Mutation$CreateUser? onCompletedWithParsed; @override - List get properties => [ - ...super.onCompleted == null - ? super.properties - : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed - ]; + List get properties => + [...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), onCompletedWithParsed]; } -class WatchOptions$Mutation$CreateUser - extends graphql.WatchQueryOptions { +class WatchOptions$Mutation$CreateUser extends graphql.WatchQueryOptions { WatchOptions$Mutation$CreateUser( {String? operationName, required Variables$Mutation$CreateUser variables, @@ -1374,27 +1087,17 @@ class WatchOptions$Mutation$CreateUser } extension ClientExtension$Mutation$CreateUser on graphql.GraphQLClient { - Future> mutate$CreateUser( - Options$Mutation$CreateUser options) async => - await this.mutate(options); - graphql.ObservableQuery watchMutation$CreateUser( - WatchOptions$Mutation$CreateUser options) => - this.watchMutation(options); + Future> mutate$CreateUser(Options$Mutation$CreateUser options) async => await this.mutate(options); + + graphql.ObservableQuery watchMutation$CreateUser(WatchOptions$Mutation$CreateUser options) => 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}); +class Mutation$CreateUser$createUser implements Fragment$basicMutationReturnFields { + 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) => _$Mutation$CreateUser$createUserFromJson(json); final int code; @@ -1414,15 +1117,13 @@ class Mutation$CreateUser$createUser 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 (!(other is Mutation$CreateUser$createUser) || - runtimeType != other.runtimeType) return false; + if (!(other is Mutation$CreateUser$createUser) || runtimeType != other.runtimeType) return false; final l$code = code; final lOther$code = other.code; if (l$code != lOther$code) return false; @@ -1442,32 +1143,21 @@ 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); +extension UtilityExtension$Mutation$CreateUser$createUser on Mutation$CreateUser$createUser { + CopyWith$Mutation$CreateUser$createUser 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) = + factory CopyWith$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; + 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 { +class _CopyWithImpl$Mutation$CreateUser$createUser implements CopyWith$Mutation$CreateUser$createUser { _CopyWithImpl$Mutation$CreateUser$createUser(this._instance, this._then); final Mutation$CreateUser$createUser _instance; @@ -1483,44 +1173,25 @@ class _CopyWithImpl$Mutation$CreateUser$createUser 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 - ? CopyWith$Fragment$userFields.stub(_then(_instance)) - : CopyWith$Fragment$userFields(local$user, (e) => call(user: e)); + return local$user == null ? CopyWith$Fragment$userFields.stub(_then(_instance)) : CopyWith$Fragment$userFields(local$user, (e) => call(user: e)); } } -class _CopyWithStubImpl$Mutation$CreateUser$createUser - implements CopyWith$Mutation$CreateUser$createUser { +class _CopyWithStubImpl$Mutation$CreateUser$createUser implements CopyWith$Mutation$CreateUser$createUser { _CopyWithStubImpl$Mutation$CreateUser$createUser(this._res); TRes _res; - call( - {int? code, - String? message, - bool? success, - String? $__typename, - Fragment$userFields? user}) => - _res; - CopyWith$Fragment$userFields get user => - CopyWith$Fragment$userFields.stub(_res); + 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) @@ -1528,8 +1199,7 @@ class Variables$Mutation$DeleteUser { Variables$Mutation$DeleteUser({required this.username}); @override - factory Variables$Mutation$DeleteUser.fromJson(Map json) => - _$Variables$Mutation$DeleteUserFromJson(json); + factory Variables$Mutation$DeleteUser.fromJson(Map json) => _$Variables$Mutation$DeleteUserFromJson(json); final String username; @@ -1542,32 +1212,26 @@ class Variables$Mutation$DeleteUser { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Variables$Mutation$DeleteUser) || - runtimeType != other.runtimeType) return false; + 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); + 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) = + factory CopyWith$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; + factory CopyWith$Variables$Mutation$DeleteUser.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$DeleteUser; TRes call({String? username}); } -class _CopyWithImpl$Variables$Mutation$DeleteUser - implements CopyWith$Variables$Mutation$DeleteUser { +class _CopyWithImpl$Variables$Mutation$DeleteUser implements CopyWith$Variables$Mutation$DeleteUser { _CopyWithImpl$Variables$Mutation$DeleteUser(this._instance, this._then); final Variables$Mutation$DeleteUser _instance; @@ -1576,15 +1240,11 @@ 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(username: username == _undefined || username == null ? _instance.username : (username as String))); } -class _CopyWithStubImpl$Variables$Mutation$DeleteUser - implements CopyWith$Variables$Mutation$DeleteUser { +class _CopyWithStubImpl$Variables$Mutation$DeleteUser implements CopyWith$Variables$Mutation$DeleteUser { _CopyWithStubImpl$Variables$Mutation$DeleteUser(this._res); TRes _res; @@ -1597,8 +1257,7 @@ class Mutation$DeleteUser { Mutation$DeleteUser({required this.deleteUser, required this.$__typename}); @override - factory Mutation$DeleteUser.fromJson(Map json) => - _$Mutation$DeleteUserFromJson(json); + factory Mutation$DeleteUser.fromJson(Map json) => _$Mutation$DeleteUserFromJson(json); final Mutation$DeleteUser$deleteUser deleteUser; @@ -1615,8 +1274,7 @@ class Mutation$DeleteUser { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Mutation$DeleteUser) || runtimeType != other.runtimeType) - return false; + 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; @@ -1628,24 +1286,19 @@ class Mutation$DeleteUser { } extension UtilityExtension$Mutation$DeleteUser on Mutation$DeleteUser { - CopyWith$Mutation$DeleteUser get copyWith => - CopyWith$Mutation$DeleteUser(this, (i) => i); + CopyWith$Mutation$DeleteUser get copyWith => 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; + factory CopyWith$Mutation$DeleteUser.stub(TRes res) = _CopyWithStubImpl$Mutation$DeleteUser; TRes call({Mutation$DeleteUser$deleteUser? deleteUser, String? $__typename}); CopyWith$Mutation$DeleteUser$deleteUser get deleteUser; } -class _CopyWithImpl$Mutation$DeleteUser - implements CopyWith$Mutation$DeleteUser { +class _CopyWithImpl$Mutation$DeleteUser implements CopyWith$Mutation$DeleteUser { _CopyWithImpl$Mutation$DeleteUser(this._instance, this._then); final Mutation$DeleteUser _instance; @@ -1654,33 +1307,24 @@ class _CopyWithImpl$Mutation$DeleteUser static const _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))); + 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))); + CopyWith$Mutation$DeleteUser$deleteUser get deleteUser { final local$deleteUser = _instance.deleteUser; - return CopyWith$Mutation$DeleteUser$deleteUser( - local$deleteUser, (e) => call(deleteUser: e)); + return CopyWith$Mutation$DeleteUser$deleteUser(local$deleteUser, (e) => call(deleteUser: e)); } } -class _CopyWithStubImpl$Mutation$DeleteUser - implements CopyWith$Mutation$DeleteUser { +class _CopyWithStubImpl$Mutation$DeleteUser implements CopyWith$Mutation$DeleteUser { _CopyWithStubImpl$Mutation$DeleteUser(this._res); TRes _res; - call({Mutation$DeleteUser$deleteUser? deleteUser, String? $__typename}) => - _res; - CopyWith$Mutation$DeleteUser$deleteUser get deleteUser => - CopyWith$Mutation$DeleteUser$deleteUser.stub(_res); + call({Mutation$DeleteUser$deleteUser? deleteUser, String? $__typename}) => _res; + + CopyWith$Mutation$DeleteUser$deleteUser get deleteUser => CopyWith$Mutation$DeleteUser$deleteUser.stub(_res); } const documentNodeMutationDeleteUser = DocumentNode(definitions: [ @@ -1690,8 +1334,7 @@ const documentNodeMutationDeleteUser = DocumentNode(definitions: [ variableDefinitions: [ VariableDefinitionNode( variable: VariableNode(name: NameNode(value: 'username')), - type: - NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), + type: NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), defaultValue: DefaultValueNode(value: null), directives: []) ], @@ -1700,39 +1343,22 @@ const documentNodeMutationDeleteUser = DocumentNode(definitions: [ FieldNode( name: NameNode(value: 'deleteUser'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'username'), - value: VariableNode(name: NameNode(value: 'username'))) - ], + arguments: [ArgumentNode(name: NameNode(value: 'username'), value: VariableNode(name: NameNode(value: 'username')))], directives: [], selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) + FragmentSpreadNode(name: NameNode(value: 'basicMutationReturnFields'), 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) ])), fragmentDefinitionbasicMutationReturnFields, ]); -Mutation$DeleteUser _parserFn$Mutation$DeleteUser(Map data) => - Mutation$DeleteUser.fromJson(data); -typedef OnMutationCompleted$Mutation$DeleteUser = FutureOr Function( - dynamic, Mutation$DeleteUser?); -class Options$Mutation$DeleteUser - extends graphql.MutationOptions { +Mutation$DeleteUser _parserFn$Mutation$DeleteUser(Map data) => Mutation$DeleteUser.fromJson(data); + +typedef OnMutationCompleted$Mutation$DeleteUser = FutureOr Function(dynamic, Mutation$DeleteUser?); + +class Options$Mutation$DeleteUser extends graphql.MutationOptions { Options$Mutation$DeleteUser( {String? operationName, required Variables$Mutation$DeleteUser variables, @@ -1753,10 +1379,7 @@ class Options$Mutation$DeleteUser cacheRereadPolicy: cacheRereadPolicy, optimisticResult: optimisticResult, context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted(data, - data == null ? null : _parserFn$Mutation$DeleteUser(data)), + onCompleted: onCompleted == null ? null : (data) => onCompleted(data, data == null ? null : _parserFn$Mutation$DeleteUser(data)), update: update, onError: onError, document: documentNodeMutationDeleteUser, @@ -1765,16 +1388,11 @@ class Options$Mutation$DeleteUser final OnMutationCompleted$Mutation$DeleteUser? onCompletedWithParsed; @override - List get properties => [ - ...super.onCompleted == null - ? super.properties - : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed - ]; + List get properties => + [...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), onCompletedWithParsed]; } -class WatchOptions$Mutation$DeleteUser - extends graphql.WatchQueryOptions { +class WatchOptions$Mutation$DeleteUser extends graphql.WatchQueryOptions { WatchOptions$Mutation$DeleteUser( {String? operationName, required Variables$Mutation$DeleteUser variables, @@ -1804,26 +1422,17 @@ class WatchOptions$Mutation$DeleteUser } extension ClientExtension$Mutation$DeleteUser on graphql.GraphQLClient { - Future> mutate$DeleteUser( - Options$Mutation$DeleteUser options) async => - await this.mutate(options); - graphql.ObservableQuery watchMutation$DeleteUser( - WatchOptions$Mutation$DeleteUser options) => - this.watchMutation(options); + Future> mutate$DeleteUser(Options$Mutation$DeleteUser options) async => await this.mutate(options); + + graphql.ObservableQuery watchMutation$DeleteUser(WatchOptions$Mutation$DeleteUser options) => 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}); +class Mutation$DeleteUser$deleteUser implements Fragment$basicMutationReturnFields { + 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) => _$Mutation$DeleteUser$deleteUserFromJson(json); final int code; @@ -1846,8 +1455,7 @@ class Mutation$DeleteUser$deleteUser @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Mutation$DeleteUser$deleteUser) || - runtimeType != other.runtimeType) return false; + if (!(other is Mutation$DeleteUser$deleteUser) || runtimeType != other.runtimeType) return false; final l$code = code; final lOther$code = other.code; if (l$code != lOther$code) return false; @@ -1864,26 +1472,20 @@ 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); +extension UtilityExtension$Mutation$DeleteUser$deleteUser on Mutation$DeleteUser$deleteUser { + CopyWith$Mutation$DeleteUser$deleteUser 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) = + factory CopyWith$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; + factory CopyWith$Mutation$DeleteUser$deleteUser.stub(TRes res) = _CopyWithStubImpl$Mutation$DeleteUser$deleteUser; TRes call({int? code, String? message, bool? success, String? $__typename}); } -class _CopyWithImpl$Mutation$DeleteUser$deleteUser - implements CopyWith$Mutation$DeleteUser$deleteUser { +class _CopyWithImpl$Mutation$DeleteUser$deleteUser implements CopyWith$Mutation$DeleteUser$deleteUser { _CopyWithImpl$Mutation$DeleteUser$deleteUser(this._instance, this._then); final Mutation$DeleteUser$deleteUser _instance; @@ -1892,34 +1494,20 @@ 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 - implements CopyWith$Mutation$DeleteUser$deleteUser { +class _CopyWithStubImpl$Mutation$DeleteUser$deleteUser implements CopyWith$Mutation$DeleteUser$deleteUser { _CopyWithStubImpl$Mutation$DeleteUser$deleteUser(this._res); TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => - _res; + call({int? code, String? message, bool? success, String? $__typename}) => _res; } @JsonSerializable(explicitToJson: true) @@ -1927,8 +1515,7 @@ class Variables$Mutation$UpdateUser { Variables$Mutation$UpdateUser({required this.user}); @override - factory Variables$Mutation$UpdateUser.fromJson(Map json) => - _$Variables$Mutation$UpdateUserFromJson(json); + factory Variables$Mutation$UpdateUser.fromJson(Map json) => _$Variables$Mutation$UpdateUserFromJson(json); final Input$UserMutationInput user; @@ -1941,32 +1528,26 @@ class Variables$Mutation$UpdateUser { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Variables$Mutation$UpdateUser) || - runtimeType != other.runtimeType) return false; + 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); + 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) = + factory CopyWith$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; + factory CopyWith$Variables$Mutation$UpdateUser.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$UpdateUser; TRes call({Input$UserMutationInput? user}); } -class _CopyWithImpl$Variables$Mutation$UpdateUser - implements CopyWith$Variables$Mutation$UpdateUser { +class _CopyWithImpl$Variables$Mutation$UpdateUser implements CopyWith$Variables$Mutation$UpdateUser { _CopyWithImpl$Variables$Mutation$UpdateUser(this._instance, this._then); final Variables$Mutation$UpdateUser _instance; @@ -1975,14 +1556,11 @@ 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(user: user == _undefined || user == null ? _instance.user : (user as Input$UserMutationInput))); } -class _CopyWithStubImpl$Variables$Mutation$UpdateUser - implements CopyWith$Variables$Mutation$UpdateUser { +class _CopyWithStubImpl$Variables$Mutation$UpdateUser implements CopyWith$Variables$Mutation$UpdateUser { _CopyWithStubImpl$Variables$Mutation$UpdateUser(this._res); TRes _res; @@ -1995,8 +1573,7 @@ class Mutation$UpdateUser { Mutation$UpdateUser({required this.updateUser, required this.$__typename}); @override - factory Mutation$UpdateUser.fromJson(Map json) => - _$Mutation$UpdateUserFromJson(json); + factory Mutation$UpdateUser.fromJson(Map json) => _$Mutation$UpdateUserFromJson(json); final Mutation$UpdateUser$updateUser updateUser; @@ -2013,8 +1590,7 @@ class Mutation$UpdateUser { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Mutation$UpdateUser) || runtimeType != other.runtimeType) - return false; + 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; @@ -2026,24 +1602,19 @@ class Mutation$UpdateUser { } extension UtilityExtension$Mutation$UpdateUser on Mutation$UpdateUser { - CopyWith$Mutation$UpdateUser get copyWith => - CopyWith$Mutation$UpdateUser(this, (i) => i); + CopyWith$Mutation$UpdateUser get copyWith => 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; + factory CopyWith$Mutation$UpdateUser.stub(TRes res) = _CopyWithStubImpl$Mutation$UpdateUser; TRes call({Mutation$UpdateUser$updateUser? updateUser, String? $__typename}); CopyWith$Mutation$UpdateUser$updateUser get updateUser; } -class _CopyWithImpl$Mutation$UpdateUser - implements CopyWith$Mutation$UpdateUser { +class _CopyWithImpl$Mutation$UpdateUser implements CopyWith$Mutation$UpdateUser { _CopyWithImpl$Mutation$UpdateUser(this._instance, this._then); final Mutation$UpdateUser _instance; @@ -2052,33 +1623,24 @@ class _CopyWithImpl$Mutation$UpdateUser static const _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))); + 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))); + CopyWith$Mutation$UpdateUser$updateUser get updateUser { final local$updateUser = _instance.updateUser; - return CopyWith$Mutation$UpdateUser$updateUser( - local$updateUser, (e) => call(updateUser: e)); + return CopyWith$Mutation$UpdateUser$updateUser(local$updateUser, (e) => call(updateUser: e)); } } -class _CopyWithStubImpl$Mutation$UpdateUser - implements CopyWith$Mutation$UpdateUser { +class _CopyWithStubImpl$Mutation$UpdateUser implements CopyWith$Mutation$UpdateUser { _CopyWithStubImpl$Mutation$UpdateUser(this._res); TRes _res; - call({Mutation$UpdateUser$updateUser? updateUser, String? $__typename}) => - _res; - CopyWith$Mutation$UpdateUser$updateUser get updateUser => - CopyWith$Mutation$UpdateUser$updateUser.stub(_res); + call({Mutation$UpdateUser$updateUser? updateUser, String? $__typename}) => _res; + + CopyWith$Mutation$UpdateUser$updateUser get updateUser => CopyWith$Mutation$UpdateUser$updateUser.stub(_res); } const documentNodeMutationUpdateUser = DocumentNode(definitions: [ @@ -2088,8 +1650,7 @@ const documentNodeMutationUpdateUser = DocumentNode(definitions: [ variableDefinitions: [ VariableDefinitionNode( variable: VariableNode(name: NameNode(value: 'user')), - type: NamedTypeNode( - name: NameNode(value: 'UserMutationInput'), isNonNull: true), + type: NamedTypeNode(name: NameNode(value: 'UserMutationInput'), isNonNull: true), defaultValue: DefaultValueNode(value: null), directives: []) ], @@ -2098,55 +1659,32 @@ const documentNodeMutationUpdateUser = DocumentNode(definitions: [ FieldNode( name: NameNode(value: 'updateUser'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'user'), - value: VariableNode(name: NameNode(value: 'user'))) - ], + arguments: [ArgumentNode(name: NameNode(value: 'user'), value: VariableNode(name: NameNode(value: 'user')))], directives: [], selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), + FragmentSpreadNode(name: NameNode(value: 'basicMutationReturnFields'), 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) + 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) + 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?); -class Options$Mutation$UpdateUser - extends graphql.MutationOptions { +Mutation$UpdateUser _parserFn$Mutation$UpdateUser(Map data) => Mutation$UpdateUser.fromJson(data); + +typedef OnMutationCompleted$Mutation$UpdateUser = FutureOr Function(dynamic, Mutation$UpdateUser?); + +class Options$Mutation$UpdateUser extends graphql.MutationOptions { Options$Mutation$UpdateUser( {String? operationName, required Variables$Mutation$UpdateUser variables, @@ -2167,10 +1705,7 @@ class Options$Mutation$UpdateUser cacheRereadPolicy: cacheRereadPolicy, optimisticResult: optimisticResult, context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted(data, - data == null ? null : _parserFn$Mutation$UpdateUser(data)), + onCompleted: onCompleted == null ? null : (data) => onCompleted(data, data == null ? null : _parserFn$Mutation$UpdateUser(data)), update: update, onError: onError, document: documentNodeMutationUpdateUser, @@ -2179,16 +1714,11 @@ class Options$Mutation$UpdateUser final OnMutationCompleted$Mutation$UpdateUser? onCompletedWithParsed; @override - List get properties => [ - ...super.onCompleted == null - ? super.properties - : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed - ]; + List get properties => + [...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), onCompletedWithParsed]; } -class WatchOptions$Mutation$UpdateUser - extends graphql.WatchQueryOptions { +class WatchOptions$Mutation$UpdateUser extends graphql.WatchQueryOptions { WatchOptions$Mutation$UpdateUser( {String? operationName, required Variables$Mutation$UpdateUser variables, @@ -2218,27 +1748,17 @@ class WatchOptions$Mutation$UpdateUser } extension ClientExtension$Mutation$UpdateUser on graphql.GraphQLClient { - Future> mutate$UpdateUser( - Options$Mutation$UpdateUser options) async => - await this.mutate(options); - graphql.ObservableQuery watchMutation$UpdateUser( - WatchOptions$Mutation$UpdateUser options) => - this.watchMutation(options); + Future> mutate$UpdateUser(Options$Mutation$UpdateUser options) async => await this.mutate(options); + + graphql.ObservableQuery watchMutation$UpdateUser(WatchOptions$Mutation$UpdateUser options) => 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}); +class Mutation$UpdateUser$updateUser implements Fragment$basicMutationReturnFields { + 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) => _$Mutation$UpdateUser$updateUserFromJson(json); final int code; @@ -2258,15 +1778,13 @@ class Mutation$UpdateUser$updateUser 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 (!(other is Mutation$UpdateUser$updateUser) || - runtimeType != other.runtimeType) return false; + if (!(other is Mutation$UpdateUser$updateUser) || runtimeType != other.runtimeType) return false; final l$code = code; final lOther$code = other.code; if (l$code != lOther$code) return false; @@ -2286,32 +1804,21 @@ 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); +extension UtilityExtension$Mutation$UpdateUser$updateUser on Mutation$UpdateUser$updateUser { + CopyWith$Mutation$UpdateUser$updateUser 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) = + factory CopyWith$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; + 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 { +class _CopyWithImpl$Mutation$UpdateUser$updateUser implements CopyWith$Mutation$UpdateUser$updateUser { _CopyWithImpl$Mutation$UpdateUser$updateUser(this._instance, this._then); final Mutation$UpdateUser$updateUser _instance; @@ -2327,44 +1834,25 @@ class _CopyWithImpl$Mutation$UpdateUser$updateUser 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 - ? CopyWith$Fragment$userFields.stub(_then(_instance)) - : CopyWith$Fragment$userFields(local$user, (e) => call(user: e)); + return local$user == null ? CopyWith$Fragment$userFields.stub(_then(_instance)) : CopyWith$Fragment$userFields(local$user, (e) => call(user: e)); } } -class _CopyWithStubImpl$Mutation$UpdateUser$updateUser - implements CopyWith$Mutation$UpdateUser$updateUser { +class _CopyWithStubImpl$Mutation$UpdateUser$updateUser implements CopyWith$Mutation$UpdateUser$updateUser { _CopyWithStubImpl$Mutation$UpdateUser$updateUser(this._res); TRes _res; - call( - {int? code, - String? message, - bool? success, - String? $__typename, - Fragment$userFields? user}) => - _res; - CopyWith$Fragment$userFields get user => - CopyWith$Fragment$userFields.stub(_res); + 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) @@ -2372,8 +1860,7 @@ class Variables$Mutation$AddSshKey { Variables$Mutation$AddSshKey({required this.sshInput}); @override - factory Variables$Mutation$AddSshKey.fromJson(Map json) => - _$Variables$Mutation$AddSshKeyFromJson(json); + factory Variables$Mutation$AddSshKey.fromJson(Map json) => _$Variables$Mutation$AddSshKeyFromJson(json); final Input$SshMutationInput sshInput; @@ -2386,32 +1873,26 @@ class Variables$Mutation$AddSshKey { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Variables$Mutation$AddSshKey) || - runtimeType != other.runtimeType) return false; + 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); + 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) = + factory CopyWith$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; + factory CopyWith$Variables$Mutation$AddSshKey.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$AddSshKey; TRes call({Input$SshMutationInput? sshInput}); } -class _CopyWithImpl$Variables$Mutation$AddSshKey - implements CopyWith$Variables$Mutation$AddSshKey { +class _CopyWithImpl$Variables$Mutation$AddSshKey implements CopyWith$Variables$Mutation$AddSshKey { _CopyWithImpl$Variables$Mutation$AddSshKey(this._instance, this._then); final Variables$Mutation$AddSshKey _instance; @@ -2420,15 +1901,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))); + TRes call({Object? sshInput = _undefined}) => _then( + Variables$Mutation$AddSshKey(sshInput: sshInput == _undefined || sshInput == null ? _instance.sshInput : (sshInput as Input$SshMutationInput))); } -class _CopyWithStubImpl$Variables$Mutation$AddSshKey - implements CopyWith$Variables$Mutation$AddSshKey { +class _CopyWithStubImpl$Variables$Mutation$AddSshKey implements CopyWith$Variables$Mutation$AddSshKey { _CopyWithStubImpl$Variables$Mutation$AddSshKey(this._res); TRes _res; @@ -2441,8 +1918,7 @@ class Mutation$AddSshKey { Mutation$AddSshKey({required this.addSshKey, required this.$__typename}); @override - factory Mutation$AddSshKey.fromJson(Map json) => - _$Mutation$AddSshKeyFromJson(json); + factory Mutation$AddSshKey.fromJson(Map json) => _$Mutation$AddSshKeyFromJson(json); final Mutation$AddSshKey$addSshKey addSshKey; @@ -2459,8 +1935,7 @@ class Mutation$AddSshKey { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Mutation$AddSshKey) || runtimeType != other.runtimeType) - return false; + 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; @@ -2472,24 +1947,19 @@ class Mutation$AddSshKey { } extension UtilityExtension$Mutation$AddSshKey on Mutation$AddSshKey { - CopyWith$Mutation$AddSshKey get copyWith => - CopyWith$Mutation$AddSshKey(this, (i) => i); + CopyWith$Mutation$AddSshKey get copyWith => 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; + factory CopyWith$Mutation$AddSshKey(Mutation$AddSshKey instance, TRes Function(Mutation$AddSshKey) then) = _CopyWithImpl$Mutation$AddSshKey; - factory CopyWith$Mutation$AddSshKey.stub(TRes res) = - _CopyWithStubImpl$Mutation$AddSshKey; + factory CopyWith$Mutation$AddSshKey.stub(TRes res) = _CopyWithStubImpl$Mutation$AddSshKey; TRes call({Mutation$AddSshKey$addSshKey? addSshKey, String? $__typename}); CopyWith$Mutation$AddSshKey$addSshKey get addSshKey; } -class _CopyWithImpl$Mutation$AddSshKey - implements CopyWith$Mutation$AddSshKey { +class _CopyWithImpl$Mutation$AddSshKey implements CopyWith$Mutation$AddSshKey { _CopyWithImpl$Mutation$AddSshKey(this._instance, this._then); final Mutation$AddSshKey _instance; @@ -2498,31 +1968,24 @@ class _CopyWithImpl$Mutation$AddSshKey static const _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))); + 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))); + CopyWith$Mutation$AddSshKey$addSshKey get addSshKey { final local$addSshKey = _instance.addSshKey; - return CopyWith$Mutation$AddSshKey$addSshKey( - local$addSshKey, (e) => call(addSshKey: e)); + return CopyWith$Mutation$AddSshKey$addSshKey(local$addSshKey, (e) => call(addSshKey: e)); } } -class _CopyWithStubImpl$Mutation$AddSshKey - implements CopyWith$Mutation$AddSshKey { +class _CopyWithStubImpl$Mutation$AddSshKey implements CopyWith$Mutation$AddSshKey { _CopyWithStubImpl$Mutation$AddSshKey(this._res); TRes _res; call({Mutation$AddSshKey$addSshKey? addSshKey, String? $__typename}) => _res; - CopyWith$Mutation$AddSshKey$addSshKey get addSshKey => - CopyWith$Mutation$AddSshKey$addSshKey.stub(_res); + + CopyWith$Mutation$AddSshKey$addSshKey get addSshKey => CopyWith$Mutation$AddSshKey$addSshKey.stub(_res); } const documentNodeMutationAddSshKey = DocumentNode(definitions: [ @@ -2532,8 +1995,7 @@ const documentNodeMutationAddSshKey = DocumentNode(definitions: [ variableDefinitions: [ VariableDefinitionNode( variable: VariableNode(name: NameNode(value: 'sshInput')), - type: NamedTypeNode( - name: NameNode(value: 'SshMutationInput'), isNonNull: true), + type: NamedTypeNode(name: NameNode(value: 'SshMutationInput'), isNonNull: true), defaultValue: DefaultValueNode(value: null), directives: []) ], @@ -2542,55 +2004,32 @@ const documentNodeMutationAddSshKey = DocumentNode(definitions: [ FieldNode( name: NameNode(value: 'addSshKey'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'sshInput'), - value: VariableNode(name: NameNode(value: 'sshInput'))) - ], + arguments: [ArgumentNode(name: NameNode(value: 'sshInput'), value: VariableNode(name: NameNode(value: 'sshInput')))], directives: [], selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), + FragmentSpreadNode(name: NameNode(value: 'basicMutationReturnFields'), 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) + 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) + 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?); -class Options$Mutation$AddSshKey - extends graphql.MutationOptions { +Mutation$AddSshKey _parserFn$Mutation$AddSshKey(Map data) => Mutation$AddSshKey.fromJson(data); + +typedef OnMutationCompleted$Mutation$AddSshKey = FutureOr Function(dynamic, Mutation$AddSshKey?); + +class Options$Mutation$AddSshKey extends graphql.MutationOptions { Options$Mutation$AddSshKey( {String? operationName, required Variables$Mutation$AddSshKey variables, @@ -2611,10 +2050,7 @@ class Options$Mutation$AddSshKey cacheRereadPolicy: cacheRereadPolicy, optimisticResult: optimisticResult, context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted(data, - data == null ? null : _parserFn$Mutation$AddSshKey(data)), + onCompleted: onCompleted == null ? null : (data) => onCompleted(data, data == null ? null : _parserFn$Mutation$AddSshKey(data)), update: update, onError: onError, document: documentNodeMutationAddSshKey, @@ -2623,16 +2059,11 @@ class Options$Mutation$AddSshKey final OnMutationCompleted$Mutation$AddSshKey? onCompletedWithParsed; @override - List get properties => [ - ...super.onCompleted == null - ? super.properties - : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed - ]; + List get properties => + [...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), onCompletedWithParsed]; } -class WatchOptions$Mutation$AddSshKey - extends graphql.WatchQueryOptions { +class WatchOptions$Mutation$AddSshKey extends graphql.WatchQueryOptions { WatchOptions$Mutation$AddSshKey( {String? operationName, required Variables$Mutation$AddSshKey variables, @@ -2662,27 +2093,17 @@ class WatchOptions$Mutation$AddSshKey } extension ClientExtension$Mutation$AddSshKey on graphql.GraphQLClient { - Future> mutate$AddSshKey( - Options$Mutation$AddSshKey options) async => - await this.mutate(options); - graphql.ObservableQuery watchMutation$AddSshKey( - WatchOptions$Mutation$AddSshKey options) => - this.watchMutation(options); + Future> mutate$AddSshKey(Options$Mutation$AddSshKey options) async => await this.mutate(options); + + graphql.ObservableQuery watchMutation$AddSshKey(WatchOptions$Mutation$AddSshKey options) => 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}); +class Mutation$AddSshKey$addSshKey implements Fragment$basicMutationReturnFields { + 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) => _$Mutation$AddSshKey$addSshKeyFromJson(json); final int code; @@ -2702,15 +2123,13 @@ class Mutation$AddSshKey$addSshKey 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 (!(other is Mutation$AddSshKey$addSshKey) || - runtimeType != other.runtimeType) return false; + if (!(other is Mutation$AddSshKey$addSshKey) || runtimeType != other.runtimeType) return false; final l$code = code; final lOther$code = other.code; if (l$code != lOther$code) return false; @@ -2730,32 +2149,21 @@ 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); +extension UtilityExtension$Mutation$AddSshKey$addSshKey on Mutation$AddSshKey$addSshKey { + CopyWith$Mutation$AddSshKey$addSshKey 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) = + factory CopyWith$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; + 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 { +class _CopyWithImpl$Mutation$AddSshKey$addSshKey implements CopyWith$Mutation$AddSshKey$addSshKey { _CopyWithImpl$Mutation$AddSshKey$addSshKey(this._instance, this._then); final Mutation$AddSshKey$addSshKey _instance; @@ -2771,44 +2179,25 @@ class _CopyWithImpl$Mutation$AddSshKey$addSshKey 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 - ? CopyWith$Fragment$userFields.stub(_then(_instance)) - : CopyWith$Fragment$userFields(local$user, (e) => call(user: e)); + return local$user == null ? CopyWith$Fragment$userFields.stub(_then(_instance)) : CopyWith$Fragment$userFields(local$user, (e) => call(user: e)); } } -class _CopyWithStubImpl$Mutation$AddSshKey$addSshKey - implements CopyWith$Mutation$AddSshKey$addSshKey { +class _CopyWithStubImpl$Mutation$AddSshKey$addSshKey implements CopyWith$Mutation$AddSshKey$addSshKey { _CopyWithStubImpl$Mutation$AddSshKey$addSshKey(this._res); TRes _res; - call( - {int? code, - String? message, - bool? success, - String? $__typename, - Fragment$userFields? user}) => - _res; - CopyWith$Fragment$userFields get user => - CopyWith$Fragment$userFields.stub(_res); + 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) @@ -2816,13 +2205,11 @@ class Variables$Mutation$RemoveSshKey { Variables$Mutation$RemoveSshKey({required this.sshInput}); @override - factory Variables$Mutation$RemoveSshKey.fromJson(Map json) => - _$Variables$Mutation$RemoveSshKeyFromJson(json); + factory Variables$Mutation$RemoveSshKey.fromJson(Map json) => _$Variables$Mutation$RemoveSshKeyFromJson(json); final Input$SshMutationInput sshInput; - Map toJson() => - _$Variables$Mutation$RemoveSshKeyToJson(this); + Map toJson() => _$Variables$Mutation$RemoveSshKeyToJson(this); int get hashCode { final l$sshInput = sshInput; return Object.hashAll([l$sshInput]); @@ -2831,32 +2218,26 @@ class Variables$Mutation$RemoveSshKey { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Variables$Mutation$RemoveSshKey) || - runtimeType != other.runtimeType) return false; + 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); + 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) = + factory CopyWith$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; + factory CopyWith$Variables$Mutation$RemoveSshKey.stub(TRes res) = _CopyWithStubImpl$Variables$Mutation$RemoveSshKey; TRes call({Input$SshMutationInput? sshInput}); } -class _CopyWithImpl$Variables$Mutation$RemoveSshKey - implements CopyWith$Variables$Mutation$RemoveSshKey { +class _CopyWithImpl$Variables$Mutation$RemoveSshKey implements CopyWith$Variables$Mutation$RemoveSshKey { _CopyWithImpl$Variables$Mutation$RemoveSshKey(this._instance, this._then); final Variables$Mutation$RemoveSshKey _instance; @@ -2865,15 +2246,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))); + TRes call({Object? sshInput = _undefined}) => _then(Variables$Mutation$RemoveSshKey( + sshInput: sshInput == _undefined || sshInput == null ? _instance.sshInput : (sshInput as Input$SshMutationInput))); } -class _CopyWithStubImpl$Variables$Mutation$RemoveSshKey - implements CopyWith$Variables$Mutation$RemoveSshKey { +class _CopyWithStubImpl$Variables$Mutation$RemoveSshKey implements CopyWith$Variables$Mutation$RemoveSshKey { _CopyWithStubImpl$Variables$Mutation$RemoveSshKey(this._res); TRes _res; @@ -2883,12 +2260,10 @@ class _CopyWithStubImpl$Variables$Mutation$RemoveSshKey @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) => _$Mutation$RemoveSshKeyFromJson(json); final Mutation$RemoveSshKey$removeSshKey removeSshKey; @@ -2905,8 +2280,7 @@ class Mutation$RemoveSshKey { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Mutation$RemoveSshKey) || runtimeType != other.runtimeType) - return false; + 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; @@ -2918,25 +2292,20 @@ class Mutation$RemoveSshKey { } extension UtilityExtension$Mutation$RemoveSshKey on Mutation$RemoveSshKey { - CopyWith$Mutation$RemoveSshKey get copyWith => - CopyWith$Mutation$RemoveSshKey(this, (i) => i); + CopyWith$Mutation$RemoveSshKey get copyWith => CopyWith$Mutation$RemoveSshKey(this, (i) => i); } abstract class CopyWith$Mutation$RemoveSshKey { - factory CopyWith$Mutation$RemoveSshKey(Mutation$RemoveSshKey instance, - TRes Function(Mutation$RemoveSshKey) then) = + 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; + 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 { +class _CopyWithImpl$Mutation$RemoveSshKey implements CopyWith$Mutation$RemoveSshKey { _CopyWithImpl$Mutation$RemoveSshKey(this._instance, this._then); final Mutation$RemoveSshKey _instance; @@ -2945,35 +2314,25 @@ class _CopyWithImpl$Mutation$RemoveSshKey static const _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))); + 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))); + CopyWith$Mutation$RemoveSshKey$removeSshKey get removeSshKey { final local$removeSshKey = _instance.removeSshKey; - return CopyWith$Mutation$RemoveSshKey$removeSshKey( - local$removeSshKey, (e) => call(removeSshKey: e)); + return CopyWith$Mutation$RemoveSshKey$removeSshKey(local$removeSshKey, (e) => call(removeSshKey: e)); } } -class _CopyWithStubImpl$Mutation$RemoveSshKey - implements CopyWith$Mutation$RemoveSshKey { +class _CopyWithStubImpl$Mutation$RemoveSshKey implements CopyWith$Mutation$RemoveSshKey { _CopyWithStubImpl$Mutation$RemoveSshKey(this._res); TRes _res; - call( - {Mutation$RemoveSshKey$removeSshKey? removeSshKey, - String? $__typename}) => - _res; - CopyWith$Mutation$RemoveSshKey$removeSshKey get removeSshKey => - CopyWith$Mutation$RemoveSshKey$removeSshKey.stub(_res); + call({Mutation$RemoveSshKey$removeSshKey? removeSshKey, String? $__typename}) => _res; + + CopyWith$Mutation$RemoveSshKey$removeSshKey get removeSshKey => CopyWith$Mutation$RemoveSshKey$removeSshKey.stub(_res); } const documentNodeMutationRemoveSshKey = DocumentNode(definitions: [ @@ -2983,8 +2342,7 @@ const documentNodeMutationRemoveSshKey = DocumentNode(definitions: [ variableDefinitions: [ VariableDefinitionNode( variable: VariableNode(name: NameNode(value: 'sshInput')), - type: NamedTypeNode( - name: NameNode(value: 'SshMutationInput'), isNonNull: true), + type: NamedTypeNode(name: NameNode(value: 'SshMutationInput'), isNonNull: true), defaultValue: DefaultValueNode(value: null), directives: []) ], @@ -2993,56 +2351,32 @@ const documentNodeMutationRemoveSshKey = DocumentNode(definitions: [ FieldNode( name: NameNode(value: 'removeSshKey'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'sshInput'), - value: VariableNode(name: NameNode(value: 'sshInput'))) - ], + arguments: [ArgumentNode(name: NameNode(value: 'sshInput'), value: VariableNode(name: NameNode(value: 'sshInput')))], directives: [], selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'basicMutationReturnFields'), - directives: []), + FragmentSpreadNode(name: NameNode(value: 'basicMutationReturnFields'), 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) + 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) + FieldNode(name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], selectionSet: null) ])), fragmentDefinitionbasicMutationReturnFields, fragmentDefinitionuserFields, ]); -Mutation$RemoveSshKey _parserFn$Mutation$RemoveSshKey( - Map data) => - Mutation$RemoveSshKey.fromJson(data); -typedef OnMutationCompleted$Mutation$RemoveSshKey = FutureOr Function( - dynamic, Mutation$RemoveSshKey?); -class Options$Mutation$RemoveSshKey - extends graphql.MutationOptions { +Mutation$RemoveSshKey _parserFn$Mutation$RemoveSshKey(Map data) => Mutation$RemoveSshKey.fromJson(data); + +typedef OnMutationCompleted$Mutation$RemoveSshKey = FutureOr Function(dynamic, Mutation$RemoveSshKey?); + +class Options$Mutation$RemoveSshKey extends graphql.MutationOptions { Options$Mutation$RemoveSshKey( {String? operationName, required Variables$Mutation$RemoveSshKey variables, @@ -3063,13 +2397,7 @@ class Options$Mutation$RemoveSshKey cacheRereadPolicy: cacheRereadPolicy, optimisticResult: optimisticResult, context: context, - onCompleted: onCompleted == null - ? null - : (data) => onCompleted( - data, - data == null - ? null - : _parserFn$Mutation$RemoveSshKey(data)), + onCompleted: onCompleted == null ? null : (data) => onCompleted(data, data == null ? null : _parserFn$Mutation$RemoveSshKey(data)), update: update, onError: onError, document: documentNodeMutationRemoveSshKey, @@ -3078,16 +2406,11 @@ class Options$Mutation$RemoveSshKey final OnMutationCompleted$Mutation$RemoveSshKey? onCompletedWithParsed; @override - List get properties => [ - ...super.onCompleted == null - ? super.properties - : super.properties.where((property) => property != onCompleted), - onCompletedWithParsed - ]; + List get properties => + [...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), onCompletedWithParsed]; } -class WatchOptions$Mutation$RemoveSshKey - extends graphql.WatchQueryOptions { +class WatchOptions$Mutation$RemoveSshKey extends graphql.WatchQueryOptions { WatchOptions$Mutation$RemoveSshKey( {String? operationName, required Variables$Mutation$RemoveSshKey variables, @@ -3117,28 +2440,18 @@ class WatchOptions$Mutation$RemoveSshKey } extension ClientExtension$Mutation$RemoveSshKey on graphql.GraphQLClient { - Future> mutate$RemoveSshKey( - Options$Mutation$RemoveSshKey options) async => - await this.mutate(options); - graphql.ObservableQuery watchMutation$RemoveSshKey( - WatchOptions$Mutation$RemoveSshKey options) => + Future> mutate$RemoveSshKey(Options$Mutation$RemoveSshKey options) async => await this.mutate(options); + + graphql.ObservableQuery watchMutation$RemoveSshKey(WatchOptions$Mutation$RemoveSshKey options) => 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}); +class Mutation$RemoveSshKey$removeSshKey implements Fragment$basicMutationReturnFields { + 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); + factory Mutation$RemoveSshKey$removeSshKey.fromJson(Map json) => _$Mutation$RemoveSshKey$removeSshKeyFromJson(json); final int code; @@ -3151,23 +2464,20 @@ class Mutation$RemoveSshKey$removeSshKey final Fragment$userFields? user; - Map toJson() => - _$Mutation$RemoveSshKey$removeSshKeyToJson(this); + Map toJson() => _$Mutation$RemoveSshKey$removeSshKeyToJson(this); 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 (!(other is Mutation$RemoveSshKey$removeSshKey) || - runtimeType != other.runtimeType) return false; + if (!(other is Mutation$RemoveSshKey$removeSshKey) || runtimeType != other.runtimeType) return false; final l$code = code; final lOther$code = other.code; if (l$code != lOther$code) return false; @@ -3187,34 +2497,23 @@ class Mutation$RemoveSshKey$removeSshKey } } -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); +extension UtilityExtension$Mutation$RemoveSshKey$removeSshKey on Mutation$RemoveSshKey$removeSshKey { + CopyWith$Mutation$RemoveSshKey$removeSshKey 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) = + 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; + 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 { +class _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey implements CopyWith$Mutation$RemoveSshKey$removeSshKey { _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey(this._instance, this._then); final Mutation$RemoveSshKey$removeSshKey _instance; @@ -3230,42 +2529,23 @@ class _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey 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 - ? CopyWith$Fragment$userFields.stub(_then(_instance)) - : CopyWith$Fragment$userFields(local$user, (e) => call(user: e)); + return local$user == null ? CopyWith$Fragment$userFields.stub(_then(_instance)) : CopyWith$Fragment$userFields(local$user, (e) => call(user: e)); } } -class _CopyWithStubImpl$Mutation$RemoveSshKey$removeSshKey - implements CopyWith$Mutation$RemoveSshKey$removeSshKey { +class _CopyWithStubImpl$Mutation$RemoveSshKey$removeSshKey implements CopyWith$Mutation$RemoveSshKey$removeSshKey { _CopyWithStubImpl$Mutation$RemoveSshKey$removeSshKey(this._res); TRes _res; - call( - {int? code, - String? message, - bool? success, - String? $__typename, - Fragment$userFields? user}) => - _res; - CopyWith$Fragment$userFields get user => - CopyWith$Fragment$userFields.stub(_res); + 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 index 299005f1..a9dfff53 100644 --- a/lib/logic/api_maps/graphql_maps/schema/users.graphql.g.dart +++ b/lib/logic/api_maps/graphql_maps/schema/users.graphql.g.dart @@ -6,37 +6,28 @@ part of 'users.graphql.dart'; // JsonSerializableGenerator // ************************************************************************** -Fragment$basicMutationReturnFields _$Fragment$basicMutationReturnFieldsFromJson( - Map json) => - Fragment$basicMutationReturnFields( +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) => - { +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( +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(), + 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) => - { +Map _$Fragment$userFieldsToJson(Fragment$userFields instance) => { 'username': instance.username, 'userType': _$Enum$UserTypeEnumMap[instance.userType]!, 'sshKeys': instance.sshKeys, @@ -50,118 +41,83 @@ const _$Enum$UserTypeEnumMap = { Enum$UserType.$unknown: r'$unknown', }; -Query$AllUsers _$Query$AllUsersFromJson(Map json) => - Query$AllUsers( - users: - Query$AllUsers$users.fromJson(json['users'] as Map), +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) => - { +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(), +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) => - { +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( +Variables$Query$GetUser _$Variables$Query$GetUserFromJson(Map json) => Variables$Query$GetUser( username: json['username'] as String, ); -Map _$Variables$Query$GetUserToJson( - Variables$Query$GetUser instance) => - { +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), +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) => - { +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), +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) => - { +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), +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) => - { +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), +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) => - { +Map _$Mutation$CreateUserToJson(Mutation$CreateUser instance) => { 'createUser': instance.createUser.toJson(), '__typename': instance.$__typename, }; -Mutation$CreateUser$createUser _$Mutation$CreateUser$createUserFromJson( - Map json) => - Mutation$CreateUser$createUser( +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), + user: json['user'] == null ? null : Fragment$userFields.fromJson(json['user'] as Map), ); -Map _$Mutation$CreateUser$createUserToJson( - Mutation$CreateUser$createUser instance) => - { +Map _$Mutation$CreateUser$createUserToJson(Mutation$CreateUser$createUser instance) => { 'code': instance.code, 'message': instance.message, 'success': instance.success, @@ -169,92 +125,65 @@ Map _$Mutation$CreateUser$createUserToJson( 'user': instance.user?.toJson(), }; -Variables$Mutation$DeleteUser _$Variables$Mutation$DeleteUserFromJson( - Map json) => - Variables$Mutation$DeleteUser( +Variables$Mutation$DeleteUser _$Variables$Mutation$DeleteUserFromJson(Map json) => Variables$Mutation$DeleteUser( username: json['username'] as String, ); -Map _$Variables$Mutation$DeleteUserToJson( - Variables$Mutation$DeleteUser instance) => - { +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), +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) => - { +Map _$Mutation$DeleteUserToJson(Mutation$DeleteUser instance) => { 'deleteUser': instance.deleteUser.toJson(), '__typename': instance.$__typename, }; -Mutation$DeleteUser$deleteUser _$Mutation$DeleteUser$deleteUserFromJson( - Map json) => - Mutation$DeleteUser$deleteUser( +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) => - { +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), +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) => - { +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), +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) => - { +Map _$Mutation$UpdateUserToJson(Mutation$UpdateUser instance) => { 'updateUser': instance.updateUser.toJson(), '__typename': instance.$__typename, }; -Mutation$UpdateUser$updateUser _$Mutation$UpdateUser$updateUserFromJson( - Map json) => - Mutation$UpdateUser$updateUser( +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), + user: json['user'] == null ? null : Fragment$userFields.fromJson(json['user'] as Map), ); -Map _$Mutation$UpdateUser$updateUserToJson( - Mutation$UpdateUser$updateUser instance) => - { +Map _$Mutation$UpdateUser$updateUserToJson(Mutation$UpdateUser$updateUser instance) => { 'code': instance.code, 'message': instance.message, 'success': instance.success, @@ -262,47 +191,33 @@ Map _$Mutation$UpdateUser$updateUserToJson( 'user': instance.user?.toJson(), }; -Variables$Mutation$AddSshKey _$Variables$Mutation$AddSshKeyFromJson( - Map json) => - Variables$Mutation$AddSshKey( - sshInput: Input$SshMutationInput.fromJson( - json['sshInput'] as Map), +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) => - { +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), +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) => - { +Map _$Mutation$AddSshKeyToJson(Mutation$AddSshKey instance) => { 'addSshKey': instance.addSshKey.toJson(), '__typename': instance.$__typename, }; -Mutation$AddSshKey$addSshKey _$Mutation$AddSshKey$addSshKeyFromJson( - Map json) => - Mutation$AddSshKey$addSshKey( +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), + user: json['user'] == null ? null : Fragment$userFields.fromJson(json['user'] as Map), ); -Map _$Mutation$AddSshKey$addSshKeyToJson( - Mutation$AddSshKey$addSshKey instance) => - { +Map _$Mutation$AddSshKey$addSshKeyToJson(Mutation$AddSshKey$addSshKey instance) => { 'code': instance.code, 'message': instance.message, 'success': instance.success, @@ -310,49 +225,33 @@ Map _$Mutation$AddSshKey$addSshKeyToJson( 'user': instance.user?.toJson(), }; -Variables$Mutation$RemoveSshKey _$Variables$Mutation$RemoveSshKeyFromJson( - Map json) => - Variables$Mutation$RemoveSshKey( - sshInput: Input$SshMutationInput.fromJson( - json['sshInput'] as Map), +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) => - { +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), +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) => - { +Map _$Mutation$RemoveSshKeyToJson(Mutation$RemoveSshKey instance) => { 'removeSshKey': instance.removeSshKey.toJson(), '__typename': instance.$__typename, }; -Mutation$RemoveSshKey$removeSshKey _$Mutation$RemoveSshKey$removeSshKeyFromJson( - Map json) => - Mutation$RemoveSshKey$removeSshKey( +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), + user: json['user'] == null ? null : Fragment$userFields.fromJson(json['user'] as Map), ); -Map _$Mutation$RemoveSshKey$removeSshKeyToJson( - Mutation$RemoveSshKey$removeSshKey instance) => - { +Map _$Mutation$RemoveSshKey$removeSshKeyToJson(Mutation$RemoveSshKey$removeSshKey instance) => { 'code': instance.code, 'message': instance.message, 'success': instance.success, 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 c1b2b801..d224f08f 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 @@ -21,6 +21,10 @@ mixin UsersApi on ApiMap { print(response.exception.toString()); } users = response.parsedData?.users.allUsers.map((final user) => User.fromGraphQL(user)).toList() ?? []; + final rootUser = response.parsedData?.users.rootUser; + if (rootUser != null) { + users.add(User.fromGraphQL(rootUser)); + } } catch (e) { print(e); } diff --git a/lib/logic/cubit/users/users_cubit.dart b/lib/logic/cubit/users/users_cubit.dart index 46e39568..442b2ed8 100644 --- a/lib/logic/cubit/users/users_cubit.dart +++ b/lib/logic/cubit/users/users_cubit.dart @@ -1,6 +1,8 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:hive/hive.dart'; +import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/config/hive_config.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; @@ -14,8 +16,6 @@ class UsersCubit extends ServerInstallationDependendCubit { serverInstallationCubit, const UsersState( [], - User(login: 'root', type: UserType.root), - User(login: 'loading...', type: UserType.primary), ), ); Box box = Hive.box(BNames.usersBox); @@ -25,167 +25,38 @@ class UsersCubit extends ServerInstallationDependendCubit { @override Future load() async { - if (serverInstallationCubit.state is ServerInstallationFinished) { - final List loadedUsers = box.values.toList(); - final primaryUser = serverInstallationBox.get( - BNames.rootUser, - defaultValue: const User(login: 'loading...', type: UserType.primary), - ); - final List rootKeys = [...serverInstallationBox.get(BNames.rootKeys, defaultValue: [])]; - if (loadedUsers.isNotEmpty) { - emit( - UsersState( - loadedUsers, - User(login: 'root', sshKeys: rootKeys, type: UserType.root), - primaryUser, - ), - ); - } - - final ApiResponse> usersFromServer = await api.getUsersList(); - if (usersFromServer.isSuccess) { - final List updatedList = mergeLocalAndServerUsers(loadedUsers, usersFromServer.data); - emit( - UsersState( - updatedList, - User(login: 'root', sshKeys: rootKeys, type: UserType.root), - primaryUser, - ), - ); - } - - final List usersWithSshKeys = await loadSshKeys(state.users); - // Update the users it the box - box.clear(); - box.addAll(usersWithSshKeys); - - final User rootUserWithSshKeys = (await loadSshKeys([state.rootUser])).first; - serverInstallationBox.put(BNames.rootKeys, rootUserWithSshKeys.sshKeys); - final User primaryUserWithSshKeys = (await loadSshKeys([state.primaryUser])).first; - serverInstallationBox.put(BNames.rootUser, primaryUserWithSshKeys); + if (serverInstallationCubit.state is! ServerInstallationFinished) { + return; + } + final List loadedUsers = box.values.toList(); + if (loadedUsers.isNotEmpty) { emit( UsersState( - usersWithSshKeys, - rootUserWithSshKeys, - primaryUserWithSshKeys, - ), - ); - } - } - - List mergeLocalAndServerUsers( - final List localUsers, - final List serverUsers, - ) { - // If local user not exists on server, add it with isFoundOnServer = false - // If server user not exists on local, add it - - final List mergedUsers = []; - final List serverUsersCopy = List.from(serverUsers); - - for (final User localUser in localUsers) { - if (serverUsersCopy.contains(localUser.login)) { - mergedUsers.add( - User( - login: localUser.login, - type: UserType.normal, - isFoundOnServer: true, - password: localUser.password, - sshKeys: localUser.sshKeys, - ), - ); - serverUsersCopy.remove(localUser.login); - } else { - mergedUsers.add( - User( - login: localUser.login, - type: UserType.normal, - isFoundOnServer: false, - password: localUser.password, - note: localUser.note, - ), - ); - } - } - - for (final String serverUser in serverUsersCopy) { - mergedUsers.add( - User( - login: serverUser, - type: UserType.normal, - isFoundOnServer: true, + loadedUsers, ), ); } - return mergedUsers; - } - - Future> loadSshKeys(final List users) async { - final List updatedUsers = []; - - for (final User user in users) { - if (user.isFoundOnServer || user.login == 'root' || user.login == state.primaryUser.login) { - final ApiResponse> sshKeys = await api.getUserSshKeys(user); - print('sshKeys for $user: ${sshKeys.data}'); - if (sshKeys.isSuccess) { - updatedUsers.add( - User( - login: user.login, - type: user.type, - isFoundOnServer: true, - password: user.password, - sshKeys: sshKeys.data, - note: user.note, - ), - ); - } else { - updatedUsers.add( - User( - login: user.login, - type: user.type, - isFoundOnServer: true, - password: user.password, - note: user.note, - ), - ); - } - } else { - updatedUsers.add( - User( - login: user.login, - type: user.type, - isFoundOnServer: false, - password: user.password, - note: user.note, - ), - ); - } - } - return updatedUsers; + refresh(); } Future refresh() async { - List updatedUsers = List.from(state.users); - final ApiResponse> usersFromServer = await api.getUsersList(); - if (usersFromServer.isSuccess) { - updatedUsers = mergeLocalAndServerUsers(updatedUsers, usersFromServer.data); + if (serverInstallationCubit.state is! ServerInstallationFinished) { + return; + } + final List usersFromServer = await api.getAllUsers(); + if (usersFromServer.isNotEmpty) { + emit( + UsersState( + usersFromServer, + ), + ); + // Update the users it the box + box.clear(); + box.addAll(usersFromServer); + } else { + getIt().showSnackBar('users.could_not_fetch_users'.tr()); } - final List usersWithSshKeys = await loadSshKeys(updatedUsers); - box.clear(); - box.addAll(usersWithSshKeys); - final User rootUserWithSshKeys = (await loadSshKeys([state.rootUser])).first; - serverInstallationBox.put(BNames.rootKeys, rootUserWithSshKeys.sshKeys); - final User primaryUserWithSshKeys = (await loadSshKeys([state.primaryUser])).first; - serverInstallationBox.put(BNames.rootUser, primaryUserWithSshKeys); - emit( - UsersState( - usersWithSshKeys, - rootUserWithSshKeys, - primaryUserWithSshKeys, - ), - ); - return; } Future createUser(final User user) async { @@ -193,18 +64,21 @@ class UsersCubit extends ServerInstallationDependendCubit { if (state.users.any((final User u) => u.login == user.login && u.isFoundOnServer)) { return; } - // If user is root or primary user, do nothing - if (user.login == 'root' || user.login == state.primaryUser.login) { + final String? password = user.password; + if (password == null) { + getIt().showSnackBar('users.could_not_create_user'.tr()); return; } // If API returned error, do nothing - final ApiResponse result = await api.createUser(user); - if (!result.isSuccess) { + final UserMutationResult result = await api.createUser(user.login, password); + final User? createdUser = result.user; + if (!result.success || createdUser == null) { + getIt().showSnackBar(result.message ?? 'users.could_not_create_user'.tr()); return; } final List loadedUsers = List.from(state.users); - loadedUsers.add(result.data); + loadedUsers.add(createdUser); await box.clear(); await box.addAll(loadedUsers); emit(state.copyWith(users: loadedUsers)); @@ -212,142 +86,52 @@ class UsersCubit extends ServerInstallationDependendCubit { Future deleteUser(final User user) async { // If user is primary or root, don't delete - if (user.login == state.primaryUser.login || user.login == 'root') { + if (user.type != UserType.normal) { + getIt().showSnackBar('users.could_not_delete_user'.tr()); return; } final List loadedUsers = List.from(state.users); - final bool result = await api.deleteUser(user); - if (result) { + final GenericMutationResult result = await api.deleteUser(user.login); + if (result.success) { loadedUsers.removeWhere((final User u) => u.login == user.login); await box.clear(); await box.addAll(loadedUsers); emit(state.copyWith(users: loadedUsers)); + } else { + getIt().showSnackBar(result.message ?? 'users.could_not_delete_user'.tr()); + } + } + + Future changeUserPassword(final User user, final String newPassword) async { + if (user.type == UserType.root) { + getIt().showSnackBar('users.could_not_change_password'.tr()); + return; + } + final UserMutationResult result = await api.updateUser(user.login, newPassword); + if (!result.success) { + getIt().showSnackBar(result.message ?? 'users.could_not_change_password'.tr()); } } Future addSshKey(final User user, final String publicKey) async { - // If adding root key, use api.addRootSshKey - // Otherwise, use api.addUserSshKey - if (user.login == 'root') { - final ApiResponse result = await api.addRootSshKey(publicKey); - if (result.isSuccess) { - // Add ssh key to the array of root keys - final List rootKeys = serverInstallationBox.get(BNames.rootKeys, defaultValue: []) as List; - rootKeys.add(publicKey); - serverInstallationBox.put(BNames.rootKeys, rootKeys); - emit( - state.copyWith( - rootUser: User( - login: state.rootUser.login, - type: UserType.root, - isFoundOnServer: true, - password: state.rootUser.password, - sshKeys: rootKeys, - note: state.rootUser.note, - ), - ), - ); - } + final UserMutationResult result = await api.addSshKey(user.login, publicKey); + if (result.success) { + final User updatedUser = result.user!; + await box.putAt(box.values.toList().indexOf(user), updatedUser); + emit( + state.copyWith( + users: box.values.toList(), + ), + ); } else { - final ApiResponse result = await api.addUserSshKey(user, publicKey); - if (result.isSuccess) { - // If it is primary user, update primary user - if (user.login == state.primaryUser.login) { - final List primaryUserKeys = List.from(state.primaryUser.sshKeys); - primaryUserKeys.add(publicKey); - final User updatedUser = User( - login: state.primaryUser.login, - type: UserType.primary, - isFoundOnServer: true, - password: state.primaryUser.password, - sshKeys: primaryUserKeys, - note: state.primaryUser.note, - ); - serverInstallationBox.put(BNames.rootUser, updatedUser); - emit( - state.copyWith( - primaryUser: updatedUser, - ), - ); - } else { - // If it is not primary user, update user - final List userKeys = List.from(user.sshKeys); - userKeys.add(publicKey); - final User updatedUser = User( - login: user.login, - type: UserType.normal, - isFoundOnServer: true, - password: user.password, - sshKeys: userKeys, - note: user.note, - ); - await box.putAt(box.values.toList().indexOf(user), updatedUser); - emit( - state.copyWith( - users: box.values.toList(), - ), - ); - } - } + getIt().showSnackBar(result.message ?? 'users.could_not_add_ssh_key'.tr()); } } Future deleteSshKey(final User user, final String publicKey) async { - // All keys are deleted via api.deleteUserSshKey - - final ApiResponse result = await api.deleteUserSshKey(user, publicKey); - if (result.isSuccess) { - // If it is root user, delete key from root keys - // If it is primary user, update primary user - // If it is not primary user, update user - - if (user.login == 'root') { - final List rootKeys = serverInstallationBox.get(BNames.rootKeys, defaultValue: []) as List; - rootKeys.remove(publicKey); - serverInstallationBox.put(BNames.rootKeys, rootKeys); - emit( - state.copyWith( - rootUser: User( - login: state.rootUser.login, - type: UserType.root, - isFoundOnServer: true, - password: state.rootUser.password, - sshKeys: rootKeys, - note: state.rootUser.note, - ), - ), - ); - return; - } - if (user.login == state.primaryUser.login) { - final List primaryUserKeys = List.from(state.primaryUser.sshKeys); - primaryUserKeys.remove(publicKey); - final User updatedUser = User( - login: state.primaryUser.login, - type: UserType.primary, - isFoundOnServer: true, - password: state.primaryUser.password, - sshKeys: primaryUserKeys, - note: state.primaryUser.note, - ); - serverInstallationBox.put(BNames.rootUser, updatedUser); - emit( - state.copyWith( - primaryUser: updatedUser, - ), - ); - return; - } - final List userKeys = List.from(user.sshKeys); - userKeys.remove(publicKey); - final User updatedUser = User( - login: user.login, - type: UserType.normal, - isFoundOnServer: true, - password: user.password, - sshKeys: userKeys, - note: user.note, - ); + final UserMutationResult result = await api.removeSshKey(user.login, publicKey); + if (result.success) { + final User updatedUser = result.user!; await box.putAt(box.values.toList().indexOf(user), updatedUser); emit( state.copyWith( @@ -362,8 +146,6 @@ class UsersCubit extends ServerInstallationDependendCubit { emit( const UsersState( [], - User(login: 'root', type: UserType.root), - User(login: 'loading...', type: UserType.primary), ), ); } diff --git a/lib/logic/cubit/users/users_state.dart b/lib/logic/cubit/users/users_state.dart index fa4ed1cd..41227447 100644 --- a/lib/logic/cubit/users/users_state.dart +++ b/lib/logic/cubit/users/users_state.dart @@ -1,30 +1,27 @@ part of 'users_cubit.dart'; class UsersState extends ServerInstallationDependendState { - const UsersState(this.users, this.rootUser, this.primaryUser); + const UsersState(this.users); final List users; - final User rootUser; - final User primaryUser; + + User get rootUser => users.firstWhere((final user) => user.type == UserType.root); + + User get primaryUser => users.firstWhere((final user) => user.type == UserType.primary); + + List get normalUsers => users.where((final user) => user.type == UserType.normal).toList(); @override - List get props => [users, rootUser, primaryUser]; + List get props => [users]; UsersState copyWith({ final List? users, - final User? rootUser, - final User? primaryUser, }) => UsersState( users ?? this.users, - rootUser ?? this.rootUser, - primaryUser ?? this.primaryUser, ); - bool isLoginRegistered(final String login) => - users.any((final User user) => user.login == login) || - login == rootUser.login || - login == primaryUser.login; + bool isLoginRegistered(final String login) => users.any((final User user) => user.login == login); bool get isEmpty => users.isEmpty; } diff --git a/lib/logic/models/hive/user.g.dart b/lib/logic/models/hive/user.g.dart index a1889dc1..8076f3bb 100644 --- a/lib/logic/models/hive/user.g.dart +++ b/lib/logic/models/hive/user.g.dart @@ -18,6 +18,7 @@ class UserAdapter extends TypeAdapter { }; return User( login: fields[0] as String, + type: fields[5] == null ? UserType.normal : fields[5] as UserType, password: fields[1] as String?, sshKeys: fields[2] == null ? [] : (fields[2] as List).cast(), isFoundOnServer: fields[3] == null ? true : fields[3] as bool, @@ -28,7 +29,7 @@ class UserAdapter extends TypeAdapter { @override void write(BinaryWriter writer, User obj) { writer - ..writeByte(5) + ..writeByte(6) ..writeByte(0) ..write(obj.login) ..writeByte(1) @@ -38,16 +39,54 @@ class UserAdapter extends TypeAdapter { ..writeByte(3) ..write(obj.isFoundOnServer) ..writeByte(4) - ..write(obj.note); + ..write(obj.note) + ..writeByte(5) + ..write(obj.type); } @override int get hashCode => typeId.hashCode; @override - bool operator ==(Object other) => - identical(this, other) || - other is UserAdapter && - runtimeType == other.runtimeType && - typeId == other.typeId; + bool operator ==(Object other) => identical(this, other) || other is UserAdapter && runtimeType == other.runtimeType && typeId == other.typeId; +} + +class UserTypeAdapter extends TypeAdapter { + @override + final int typeId = 102; + + @override + UserType read(BinaryReader reader) { + switch (reader.readByte()) { + case 0: + return UserType.root; + case 1: + return UserType.primary; + case 2: + return UserType.normal; + default: + return UserType.root; + } + } + + @override + void write(BinaryWriter writer, UserType obj) { + switch (obj) { + case UserType.root: + writer.writeByte(0); + break; + case UserType.primary: + writer.writeByte(1); + break; + case UserType.normal: + writer.writeByte(2); + break; + } + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => identical(this, other) || other is UserTypeAdapter && runtimeType == other.runtimeType && typeId == other.typeId; } From 18b737a3274494d2ad2fe78af65b2bba002399a4 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Mon, 5 Sep 2022 07:34:47 +0300 Subject: [PATCH 045/115] Reformatting --- .../graphql_maps/schema/users.graphql.dart | 1698 ++++++++++++----- .../graphql_maps/schema/users.graphql.g.dart | 234 ++- .../graphql_maps/server_api/server.dart | 10 +- .../graphql_maps/server_api/users_api.dart | 26 +- lib/logic/api_maps/rest_maps/server.dart | 55 +- .../server_installation_repository.dart | 97 +- lib/logic/cubit/services/services_state.dart | 28 +- lib/logic/cubit/users/users_cubit.dart | 42 +- lib/logic/cubit/users/users_state.dart | 12 +- lib/logic/models/hive/user.dart | 3 +- lib/logic/models/hive/user.g.dart | 12 +- .../components/brand_cards/brand_cards.dart | 7 +- 12 files changed, 1637 insertions(+), 587 deletions(-) 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 5d0e5d63..7200c167 100644 --- a/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart @@ -10,10 +10,16 @@ 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); + factory Fragment$basicMutationReturnFields.fromJson( + Map json) => + _$Fragment$basicMutationReturnFieldsFromJson(json); final int code; @@ -24,7 +30,8 @@ class Fragment$basicMutationReturnFields { @JsonKey(name: '__typename') final String $__typename; - Map toJson() => _$Fragment$basicMutationReturnFieldsToJson(this); + Map toJson() => + _$Fragment$basicMutationReturnFieldsToJson(this); int get hashCode { final l$code = code; final l$message = message; @@ -36,7 +43,8 @@ class Fragment$basicMutationReturnFields { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Fragment$basicMutationReturnFields) || runtimeType != other.runtimeType) return false; + if (!(other is Fragment$basicMutationReturnFields) || + runtimeType != other.runtimeType) return false; final l$code = code; final lOther$code = other.code; if (l$code != lOther$code) return false; @@ -53,22 +61,28 @@ class Fragment$basicMutationReturnFields { } } -extension UtilityExtension$Fragment$basicMutationReturnFields on Fragment$basicMutationReturnFields { - CopyWith$Fragment$basicMutationReturnFields get copyWith => - CopyWith$Fragment$basicMutationReturnFields(this, (i) => i); +extension UtilityExtension$Fragment$basicMutationReturnFields + on Fragment$basicMutationReturnFields { + CopyWith$Fragment$basicMutationReturnFields< + Fragment$basicMutationReturnFields> + 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) = + Fragment$basicMutationReturnFields instance, + TRes Function(Fragment$basicMutationReturnFields) then) = _CopyWithImpl$Fragment$basicMutationReturnFields; - factory CopyWith$Fragment$basicMutationReturnFields.stub(TRes res) = _CopyWithStubImpl$Fragment$basicMutationReturnFields; + factory CopyWith$Fragment$basicMutationReturnFields.stub(TRes res) = + _CopyWithStubImpl$Fragment$basicMutationReturnFields; TRes call({int? code, String? message, bool? success, String? $__typename}); } -class _CopyWithImpl$Fragment$basicMutationReturnFields implements CopyWith$Fragment$basicMutationReturnFields { +class _CopyWithImpl$Fragment$basicMutationReturnFields + implements CopyWith$Fragment$basicMutationReturnFields { _CopyWithImpl$Fragment$basicMutationReturnFields(this._instance, this._then); final Fragment$basicMutationReturnFields _instance; @@ -77,62 +91,115 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields implements CopyWith 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 implements CopyWith$Fragment$basicMutationReturnFields { +class _CopyWithStubImpl$Fragment$basicMutationReturnFields + implements CopyWith$Fragment$basicMutationReturnFields { _CopyWithStubImpl$Fragment$basicMutationReturnFields(this._res); TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => _res; + 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)), + 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) + 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: [ +const documentNodeFragmentbasicMutationReturnFields = + DocumentNode(definitions: [ fragmentDefinitionbasicMutationReturnFields, ]); -extension ClientExtension$Fragment$basicMutationReturnFields on graphql.GraphQLClient { +extension ClientExtension$Fragment$basicMutationReturnFields + on graphql.GraphQLClient { void writeFragment$basicMutationReturnFields( - {required Fragment$basicMutationReturnFields data, required Map idFields, bool broadcast = true}) => + {required Fragment$basicMutationReturnFields data, + required Map idFields, + bool broadcast = true}) => this.writeFragment( graphql.FragmentRequest( idFields: idFields, - fragment: const graphql.Fragment(fragmentName: 'basicMutationReturnFields', document: documentNodeFragmentbasicMutationReturnFields)), + fragment: const graphql.Fragment( + fragmentName: 'basicMutationReturnFields', + document: documentNodeFragmentbasicMutationReturnFields)), data: data.toJson(), broadcast: broadcast); - Fragment$basicMutationReturnFields? readFragment$basicMutationReturnFields({required Map idFields, bool optimistic = true}) { + 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)), + fragment: const graphql.Fragment( + fragmentName: 'basicMutationReturnFields', + document: documentNodeFragmentbasicMutationReturnFields)), optimistic: optimistic); - return result == null ? null : Fragment$basicMutationReturnFields.fromJson(result); + 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}); + Fragment$userFields( + {required this.username, + required this.userType, + required this.sshKeys, + required this.$__typename}); @override - factory Fragment$userFields.fromJson(Map json) => _$Fragment$userFieldsFromJson(json); + factory Fragment$userFields.fromJson(Map json) => + _$Fragment$userFieldsFromJson(json); final String username; @@ -150,13 +217,19 @@ class Fragment$userFields { final l$userType = userType; final l$sshKeys = sshKeys; final l$$__typename = $__typename; - return Object.hashAll([l$username, l$userType, Object.hashAll(l$sshKeys.map((v) => v)), l$$__typename]); + return Object.hashAll([ + l$username, + l$userType, + Object.hashAll(l$sshKeys.map((v) => v)), + l$$__typename + ]); } @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Fragment$userFields) || runtimeType != other.runtimeType) return false; + 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; @@ -180,18 +253,27 @@ class Fragment$userFields { } extension UtilityExtension$Fragment$userFields on Fragment$userFields { - CopyWith$Fragment$userFields get copyWith => CopyWith$Fragment$userFields(this, (i) => i); + CopyWith$Fragment$userFields get copyWith => + 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; + 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 { +class _CopyWithImpl$Fragment$userFields + implements CopyWith$Fragment$userFields { _CopyWithImpl$Fragment$userFields(this._instance, this._then); final Fragment$userFields _instance; @@ -200,48 +282,97 @@ class _CopyWithImpl$Fragment$userFields implements CopyWith$Fragment$userF 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 implements CopyWith$Fragment$userFields { +class _CopyWithStubImpl$Fragment$userFields + implements CopyWith$Fragment$userFields { _CopyWithStubImpl$Fragment$userFields(this._res); TRes _res; - call({String? username, Enum$UserType? userType, List? sshKeys, String? $__typename}) => _res; + 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)), + 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) + 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}) => this - .writeFragment( + 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)), + 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}) { + 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)), + idFields: idFields, + fragment: const graphql.Fragment( + fragmentName: 'userFields', + document: documentNodeFragmentuserFields)), optimistic: optimistic); return result == null ? null : Fragment$userFields.fromJson(result); } @@ -252,7 +383,8 @@ class Query$AllUsers { Query$AllUsers({required this.users, required this.$__typename}); @override - factory Query$AllUsers.fromJson(Map json) => _$Query$AllUsersFromJson(json); + factory Query$AllUsers.fromJson(Map json) => + _$Query$AllUsersFromJson(json); final Query$AllUsers$users users; @@ -269,7 +401,8 @@ class Query$AllUsers { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Query$AllUsers) || runtimeType != other.runtimeType) return false; + 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; @@ -281,19 +414,24 @@ class Query$AllUsers { } extension UtilityExtension$Query$AllUsers on Query$AllUsers { - CopyWith$Query$AllUsers get copyWith => CopyWith$Query$AllUsers(this, (i) => i); + CopyWith$Query$AllUsers get copyWith => + 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; + factory CopyWith$Query$AllUsers( + Query$AllUsers instance, TRes Function(Query$AllUsers) then) = + _CopyWithImpl$Query$AllUsers; - factory CopyWith$Query$AllUsers.stub(TRes res) = _CopyWithStubImpl$Query$AllUsers; + factory CopyWith$Query$AllUsers.stub(TRes res) = + _CopyWithStubImpl$Query$AllUsers; TRes call({Query$AllUsers$users? users, String? $__typename}); CopyWith$Query$AllUsers$users get users; } -class _CopyWithImpl$Query$AllUsers implements CopyWith$Query$AllUsers { +class _CopyWithImpl$Query$AllUsers + implements CopyWith$Query$AllUsers { _CopyWithImpl$Query$AllUsers(this._instance, this._then); final Query$AllUsers _instance; @@ -302,9 +440,14 @@ class _CopyWithImpl$Query$AllUsers implements CopyWith$Query$AllUsers _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))); + 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))); CopyWith$Query$AllUsers$users get users { final local$users = _instance.users; @@ -312,14 +455,16 @@ class _CopyWithImpl$Query$AllUsers implements CopyWith$Query$AllUsers implements CopyWith$Query$AllUsers { +class _CopyWithStubImpl$Query$AllUsers + implements CopyWith$Query$AllUsers { _CopyWithStubImpl$Query$AllUsers(this._res); TRes _res; call({Query$AllUsers$users? users, String? $__typename}) => _res; - CopyWith$Query$AllUsers$users get users => CopyWith$Query$AllUsers$users.stub(_res); + CopyWith$Query$AllUsers$users get users => + CopyWith$Query$AllUsers$users.stub(_res); } const documentNodeQueryAllUsers = DocumentNode(definitions: [ @@ -341,26 +486,53 @@ const documentNodeQueryAllUsers = DocumentNode(definitions: [ arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode(name: NameNode(value: 'userFields'), directives: []), - FieldNode(name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], selectionSet: null) + FragmentSpreadNode( + name: NameNode(value: 'userFields'), directives: []), + FieldNode( + 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))], + 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) + 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) + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) ])), fragmentDefinitionuserFields, ]); -Query$AllUsers _parserFn$Query$AllUsers(Map data) => Query$AllUsers.fromJson(data); +Query$AllUsers _parserFn$Query$AllUsers(Map data) => + Query$AllUsers.fromJson(data); class Options$Query$AllUsers extends graphql.QueryOptions { Options$Query$AllUsers( @@ -383,7 +555,8 @@ class Options$Query$AllUsers extends graphql.QueryOptions { parserFn: _parserFn$Query$AllUsers); } -class WatchOptions$Query$AllUsers extends graphql.WatchQueryOptions { +class WatchOptions$Query$AllUsers + extends graphql.WatchQueryOptions { WatchOptions$Query$AllUsers( {String? operationName, graphql.FetchPolicy? fetchPolicy, @@ -411,31 +584,45 @@ class WatchOptions$Query$AllUsers extends graphql.WatchQueryOptions> query$AllUsers([Options$Query$AllUsers? options]) async => + Future> query$AllUsers( + [Options$Query$AllUsers? options]) async => await this.query(options ?? Options$Query$AllUsers()); - graphql.ObservableQuery watchQuery$AllUsers([WatchOptions$Query$AllUsers? options]) => + graphql.ObservableQuery watchQuery$AllUsers( + [WatchOptions$Query$AllUsers? options]) => this.watchQuery(options ?? WatchOptions$Query$AllUsers()); - void writeQuery$AllUsers({required Query$AllUsers data, bool broadcast = true}) => - this.writeQuery(graphql.Request(operation: graphql.Operation(document: documentNodeQueryAllUsers)), data: data.toJson(), broadcast: broadcast); + 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); + 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) => + _$Query$AllUsers$usersFromJson(json); final List allUsers; @@ -450,13 +637,15 @@ class Query$AllUsers$users { 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) return false; + 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; @@ -477,22 +666,33 @@ class Query$AllUsers$users { } 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 get copyWith => + 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; + 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>) _fn); + TRes allUsers( + Iterable Function( + Iterable>) + _fn); CopyWith$Fragment$userFields get rootUser; } -class _CopyWithImpl$Query$AllUsers$users implements CopyWith$Query$AllUsers$users { +class _CopyWithImpl$Query$AllUsers$users + implements CopyWith$Query$AllUsers$users { _CopyWithImpl$Query$AllUsers$users(this._instance, this._then); final Query$AllUsers$users _instance; @@ -501,32 +701,54 @@ class _CopyWithImpl$Query$AllUsers$users implements CopyWith$Query$AllUser static const _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))); + 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))); - TRes allUsers(Iterable Function(Iterable>) _fn) => - call(allUsers: _fn(_instance.allUsers.map((e) => CopyWith$Fragment$userFields(e, (i) => i))).toList()); + TRes allUsers( + Iterable Function( + Iterable>) + _fn) => + call( + 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 ? CopyWith$Fragment$userFields.stub(_then(_instance)) - : CopyWith$Fragment$userFields(local$rootUser, (e) => call(rootUser: e)); + : CopyWith$Fragment$userFields( + local$rootUser, (e) => call(rootUser: e)); } } -class _CopyWithStubImpl$Query$AllUsers$users implements CopyWith$Query$AllUsers$users { +class _CopyWithStubImpl$Query$AllUsers$users + implements CopyWith$Query$AllUsers$users { _CopyWithStubImpl$Query$AllUsers$users(this._res); TRes _res; - call({List? allUsers, Fragment$userFields? rootUser, String? $__typename}) => _res; + call( + {List? allUsers, + Fragment$userFields? rootUser, + String? $__typename}) => + _res; allUsers(_fn) => _res; - CopyWith$Fragment$userFields get rootUser => CopyWith$Fragment$userFields.stub(_res); + CopyWith$Fragment$userFields get rootUser => + CopyWith$Fragment$userFields.stub(_res); } @JsonSerializable(explicitToJson: true) @@ -534,7 +756,8 @@ class Variables$Query$GetUser { Variables$Query$GetUser({required this.username}); @override - factory Variables$Query$GetUser.fromJson(Map json) => _$Variables$Query$GetUserFromJson(json); + factory Variables$Query$GetUser.fromJson(Map json) => + _$Variables$Query$GetUserFromJson(json); final String username; @@ -547,26 +770,31 @@ class Variables$Query$GetUser { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Variables$Query$GetUser) || runtimeType != other.runtimeType) return false; + 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); + 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) = + 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; + factory CopyWith$Variables$Query$GetUser.stub(TRes res) = + _CopyWithStubImpl$Variables$Query$GetUser; TRes call({String? username}); } -class _CopyWithImpl$Variables$Query$GetUser implements CopyWith$Variables$Query$GetUser { +class _CopyWithImpl$Variables$Query$GetUser + implements CopyWith$Variables$Query$GetUser { _CopyWithImpl$Variables$Query$GetUser(this._instance, this._then); final Variables$Query$GetUser _instance; @@ -575,11 +803,14 @@ class _CopyWithImpl$Variables$Query$GetUser implements CopyWith$Variables$ 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( + username: username == _undefined || username == null + ? _instance.username + : (username as String))); } -class _CopyWithStubImpl$Variables$Query$GetUser implements CopyWith$Variables$Query$GetUser { +class _CopyWithStubImpl$Variables$Query$GetUser + implements CopyWith$Variables$Query$GetUser { _CopyWithStubImpl$Variables$Query$GetUser(this._res); TRes _res; @@ -592,7 +823,8 @@ class Query$GetUser { Query$GetUser({required this.users, required this.$__typename}); @override - factory Query$GetUser.fromJson(Map json) => _$Query$GetUserFromJson(json); + factory Query$GetUser.fromJson(Map json) => + _$Query$GetUserFromJson(json); final Query$GetUser$users users; @@ -609,7 +841,8 @@ class Query$GetUser { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Query$GetUser) || runtimeType != other.runtimeType) return false; + 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; @@ -621,19 +854,24 @@ class Query$GetUser { } 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; + factory CopyWith$Query$GetUser( + Query$GetUser instance, TRes Function(Query$GetUser) then) = + _CopyWithImpl$Query$GetUser; - factory CopyWith$Query$GetUser.stub(TRes res) = _CopyWithStubImpl$Query$GetUser; + factory CopyWith$Query$GetUser.stub(TRes res) = + _CopyWithStubImpl$Query$GetUser; TRes call({Query$GetUser$users? users, String? $__typename}); CopyWith$Query$GetUser$users get users; } -class _CopyWithImpl$Query$GetUser implements CopyWith$Query$GetUser { +class _CopyWithImpl$Query$GetUser + implements CopyWith$Query$GetUser { _CopyWithImpl$Query$GetUser(this._instance, this._then); final Query$GetUser _instance; @@ -642,9 +880,14 @@ class _CopyWithImpl$Query$GetUser implements CopyWith$Query$GetUser static const _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))); + 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))); CopyWith$Query$GetUser$users get users { final local$users = _instance.users; @@ -652,14 +895,16 @@ class _CopyWithImpl$Query$GetUser implements CopyWith$Query$GetUser } } -class _CopyWithStubImpl$Query$GetUser implements CopyWith$Query$GetUser { +class _CopyWithStubImpl$Query$GetUser + implements CopyWith$Query$GetUser { _CopyWithStubImpl$Query$GetUser(this._res); TRes _res; call({Query$GetUser$users? users, String? $__typename}) => _res; - CopyWith$Query$GetUser$users get users => CopyWith$Query$GetUser$users.stub(_res); + CopyWith$Query$GetUser$users get users => + CopyWith$Query$GetUser$users.stub(_res); } const documentNodeQueryGetUser = DocumentNode(definitions: [ @@ -669,7 +914,8 @@ const documentNodeQueryGetUser = DocumentNode(definitions: [ variableDefinitions: [ VariableDefinitionNode( variable: VariableNode(name: NameNode(value: 'username')), - type: NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), + type: + NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), defaultValue: DefaultValueNode(value: null), directives: []) ], @@ -684,20 +930,41 @@ const documentNodeQueryGetUser = DocumentNode(definitions: [ FieldNode( name: NameNode(value: 'getUser'), alias: null, - arguments: [ArgumentNode(name: NameNode(value: 'username'), value: VariableNode(name: NameNode(value: 'username')))], + 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) + 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) + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) ])), fragmentDefinitionuserFields, ]); -Query$GetUser _parserFn$Query$GetUser(Map data) => Query$GetUser.fromJson(data); +Query$GetUser _parserFn$Query$GetUser(Map data) => + Query$GetUser.fromJson(data); class Options$Query$GetUser extends graphql.QueryOptions { Options$Query$GetUser( @@ -722,7 +989,8 @@ class Options$Query$GetUser extends graphql.QueryOptions { parserFn: _parserFn$Query$GetUser); } -class WatchOptions$Query$GetUser extends graphql.WatchQueryOptions { +class WatchOptions$Query$GetUser + extends graphql.WatchQueryOptions { WatchOptions$Query$GetUser( {String? operationName, required Variables$Query$GetUser variables, @@ -752,21 +1020,41 @@ class WatchOptions$Query$GetUser extends graphql.WatchQueryOptions> query$GetUser(Options$Query$GetUser options) async => await this.query(options); + Future> query$GetUser( + Options$Query$GetUser options) async => + await this.query(options); - graphql.ObservableQuery watchQuery$GetUser(WatchOptions$Query$GetUser options) => this.watchQuery(options); + 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}) => - this.writeQuery(graphql.Request(operation: graphql.Operation(document: documentNodeQueryGetUser), variables: variables.toJson()), - data: data.toJson(), broadcast: broadcast); + 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()), + 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); } @@ -777,7 +1065,8 @@ class Query$GetUser$users { 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) => + _$Query$GetUser$usersFromJson(json); final Fragment$userFields? getUser; @@ -794,7 +1083,8 @@ class Query$GetUser$users { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Query$GetUser$users) || runtimeType != other.runtimeType) return false; + 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; @@ -806,19 +1096,24 @@ class Query$GetUser$users { } 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 get copyWith => + 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; + factory CopyWith$Query$GetUser$users.stub(TRes res) = + _CopyWithStubImpl$Query$GetUser$users; TRes call({Fragment$userFields? getUser, String? $__typename}); CopyWith$Fragment$userFields get getUser; } -class _CopyWithImpl$Query$GetUser$users implements CopyWith$Query$GetUser$users { +class _CopyWithImpl$Query$GetUser$users + implements CopyWith$Query$GetUser$users { _CopyWithImpl$Query$GetUser$users(this._instance, this._then); final Query$GetUser$users _instance; @@ -827,9 +1122,14 @@ class _CopyWithImpl$Query$GetUser$users implements CopyWith$Query$GetUser$ static const _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))); + 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))); CopyWith$Fragment$userFields get getUser { final local$getUser = _instance.getUser; @@ -839,14 +1139,16 @@ class _CopyWithImpl$Query$GetUser$users implements CopyWith$Query$GetUser$ } } -class _CopyWithStubImpl$Query$GetUser$users implements CopyWith$Query$GetUser$users { +class _CopyWithStubImpl$Query$GetUser$users + implements CopyWith$Query$GetUser$users { _CopyWithStubImpl$Query$GetUser$users(this._res); TRes _res; call({Fragment$userFields? getUser, String? $__typename}) => _res; - CopyWith$Fragment$userFields get getUser => CopyWith$Fragment$userFields.stub(_res); + CopyWith$Fragment$userFields get getUser => + CopyWith$Fragment$userFields.stub(_res); } @JsonSerializable(explicitToJson: true) @@ -854,7 +1156,8 @@ class Variables$Mutation$CreateUser { Variables$Mutation$CreateUser({required this.user}); @override - factory Variables$Mutation$CreateUser.fromJson(Map json) => _$Variables$Mutation$CreateUserFromJson(json); + factory Variables$Mutation$CreateUser.fromJson(Map json) => + _$Variables$Mutation$CreateUserFromJson(json); final Input$UserMutationInput user; @@ -867,26 +1170,32 @@ class Variables$Mutation$CreateUser { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Variables$Mutation$CreateUser) || runtimeType != other.runtimeType) return false; + 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); + 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) = + factory CopyWith$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; + factory CopyWith$Variables$Mutation$CreateUser.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$CreateUser; TRes call({Input$UserMutationInput? user}); } -class _CopyWithImpl$Variables$Mutation$CreateUser implements CopyWith$Variables$Mutation$CreateUser { +class _CopyWithImpl$Variables$Mutation$CreateUser + implements CopyWith$Variables$Mutation$CreateUser { _CopyWithImpl$Variables$Mutation$CreateUser(this._instance, this._then); final Variables$Mutation$CreateUser _instance; @@ -895,11 +1204,14 @@ class _CopyWithImpl$Variables$Mutation$CreateUser implements CopyWith$Vari 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( + user: user == _undefined || user == null + ? _instance.user + : (user as Input$UserMutationInput))); } -class _CopyWithStubImpl$Variables$Mutation$CreateUser implements CopyWith$Variables$Mutation$CreateUser { +class _CopyWithStubImpl$Variables$Mutation$CreateUser + implements CopyWith$Variables$Mutation$CreateUser { _CopyWithStubImpl$Variables$Mutation$CreateUser(this._res); TRes _res; @@ -912,7 +1224,8 @@ class Mutation$CreateUser { Mutation$CreateUser({required this.createUser, required this.$__typename}); @override - factory Mutation$CreateUser.fromJson(Map json) => _$Mutation$CreateUserFromJson(json); + factory Mutation$CreateUser.fromJson(Map json) => + _$Mutation$CreateUserFromJson(json); final Mutation$CreateUser$createUser createUser; @@ -929,7 +1242,8 @@ class Mutation$CreateUser { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Mutation$CreateUser) || runtimeType != other.runtimeType) return false; + 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; @@ -941,19 +1255,24 @@ class Mutation$CreateUser { } extension UtilityExtension$Mutation$CreateUser on Mutation$CreateUser { - CopyWith$Mutation$CreateUser get copyWith => CopyWith$Mutation$CreateUser(this, (i) => i); + CopyWith$Mutation$CreateUser get copyWith => + 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; + factory CopyWith$Mutation$CreateUser.stub(TRes res) = + _CopyWithStubImpl$Mutation$CreateUser; TRes call({Mutation$CreateUser$createUser? createUser, String? $__typename}); CopyWith$Mutation$CreateUser$createUser get createUser; } -class _CopyWithImpl$Mutation$CreateUser implements CopyWith$Mutation$CreateUser { +class _CopyWithImpl$Mutation$CreateUser + implements CopyWith$Mutation$CreateUser { _CopyWithImpl$Mutation$CreateUser(this._instance, this._then); final Mutation$CreateUser _instance; @@ -962,24 +1281,35 @@ class _CopyWithImpl$Mutation$CreateUser implements CopyWith$Mutation$Creat static const _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))); + 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))); CopyWith$Mutation$CreateUser$createUser get createUser { final local$createUser = _instance.createUser; - return CopyWith$Mutation$CreateUser$createUser(local$createUser, (e) => call(createUser: e)); + return CopyWith$Mutation$CreateUser$createUser( + local$createUser, (e) => call(createUser: e)); } } -class _CopyWithStubImpl$Mutation$CreateUser implements CopyWith$Mutation$CreateUser { +class _CopyWithStubImpl$Mutation$CreateUser + implements CopyWith$Mutation$CreateUser { _CopyWithStubImpl$Mutation$CreateUser(this._res); TRes _res; - call({Mutation$CreateUser$createUser? createUser, String? $__typename}) => _res; + call({Mutation$CreateUser$createUser? createUser, String? $__typename}) => + _res; - CopyWith$Mutation$CreateUser$createUser get createUser => CopyWith$Mutation$CreateUser$createUser.stub(_res); + CopyWith$Mutation$CreateUser$createUser get createUser => + CopyWith$Mutation$CreateUser$createUser.stub(_res); } const documentNodeMutationCreateUser = DocumentNode(definitions: [ @@ -989,7 +1319,8 @@ const documentNodeMutationCreateUser = DocumentNode(definitions: [ variableDefinitions: [ VariableDefinitionNode( variable: VariableNode(name: NameNode(value: 'user')), - type: NamedTypeNode(name: NameNode(value: 'UserMutationInput'), isNonNull: true), + type: NamedTypeNode( + name: NameNode(value: 'UserMutationInput'), isNonNull: true), defaultValue: DefaultValueNode(value: null), directives: []) ], @@ -998,32 +1329,57 @@ const documentNodeMutationCreateUser = DocumentNode(definitions: [ FieldNode( name: NameNode(value: 'createUser'), alias: null, - arguments: [ArgumentNode(name: NameNode(value: 'user'), value: VariableNode(name: NameNode(value: 'user')))], + arguments: [ + ArgumentNode( + name: NameNode(value: 'user'), + value: VariableNode(name: NameNode(value: 'user'))) + ], directives: [], selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode(name: NameNode(value: 'basicMutationReturnFields'), directives: []), + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + 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) + 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) + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) ])), fragmentDefinitionbasicMutationReturnFields, fragmentDefinitionuserFields, ]); -Mutation$CreateUser _parserFn$Mutation$CreateUser(Map data) => Mutation$CreateUser.fromJson(data); +Mutation$CreateUser _parserFn$Mutation$CreateUser(Map data) => + Mutation$CreateUser.fromJson(data); -typedef OnMutationCompleted$Mutation$CreateUser = FutureOr Function(dynamic, Mutation$CreateUser?); +typedef OnMutationCompleted$Mutation$CreateUser = FutureOr Function( + dynamic, Mutation$CreateUser?); -class Options$Mutation$CreateUser extends graphql.MutationOptions { +class Options$Mutation$CreateUser + extends graphql.MutationOptions { Options$Mutation$CreateUser( {String? operationName, required Variables$Mutation$CreateUser variables, @@ -1044,7 +1400,10 @@ class Options$Mutation$CreateUser extends graphql.MutationOptions onCompleted(data, data == null ? null : _parserFn$Mutation$CreateUser(data)), + onCompleted: onCompleted == null + ? null + : (data) => onCompleted(data, + data == null ? null : _parserFn$Mutation$CreateUser(data)), update: update, onError: onError, document: documentNodeMutationCreateUser, @@ -1053,11 +1412,16 @@ class Options$Mutation$CreateUser extends graphql.MutationOptions get properties => - [...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), onCompletedWithParsed]; + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + onCompletedWithParsed + ]; } -class WatchOptions$Mutation$CreateUser extends graphql.WatchQueryOptions { +class WatchOptions$Mutation$CreateUser + extends graphql.WatchQueryOptions { WatchOptions$Mutation$CreateUser( {String? operationName, required Variables$Mutation$CreateUser variables, @@ -1087,17 +1451,28 @@ class WatchOptions$Mutation$CreateUser extends graphql.WatchQueryOptions> mutate$CreateUser(Options$Mutation$CreateUser options) async => await this.mutate(options); + Future> mutate$CreateUser( + Options$Mutation$CreateUser options) async => + await this.mutate(options); - graphql.ObservableQuery watchMutation$CreateUser(WatchOptions$Mutation$CreateUser options) => this.watchMutation(options); + graphql.ObservableQuery watchMutation$CreateUser( + WatchOptions$Mutation$CreateUser options) => + 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}); +class Mutation$CreateUser$createUser + implements Fragment$basicMutationReturnFields { + 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) => + _$Mutation$CreateUser$createUserFromJson(json); final int code; @@ -1117,13 +1492,15 @@ class Mutation$CreateUser$createUser implements Fragment$basicMutationReturnFiel 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 (!(other is Mutation$CreateUser$createUser) || runtimeType != other.runtimeType) return false; + if (!(other is Mutation$CreateUser$createUser) || + runtimeType != other.runtimeType) return false; final l$code = code; final lOther$code = other.code; if (l$code != lOther$code) return false; @@ -1143,21 +1520,32 @@ class Mutation$CreateUser$createUser implements Fragment$basicMutationReturnFiel } } -extension UtilityExtension$Mutation$CreateUser$createUser on Mutation$CreateUser$createUser { - CopyWith$Mutation$CreateUser$createUser get copyWith => CopyWith$Mutation$CreateUser$createUser(this, (i) => i); +extension UtilityExtension$Mutation$CreateUser$createUser + on Mutation$CreateUser$createUser { + CopyWith$Mutation$CreateUser$createUser + 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) = + factory CopyWith$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; + 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 { +class _CopyWithImpl$Mutation$CreateUser$createUser + implements CopyWith$Mutation$CreateUser$createUser { _CopyWithImpl$Mutation$CreateUser$createUser(this._instance, this._then); final Mutation$CreateUser$createUser _instance; @@ -1173,25 +1561,45 @@ class _CopyWithImpl$Mutation$CreateUser$createUser implements CopyWith$Mut 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 ? CopyWith$Fragment$userFields.stub(_then(_instance)) : CopyWith$Fragment$userFields(local$user, (e) => call(user: e)); + return local$user == null + ? CopyWith$Fragment$userFields.stub(_then(_instance)) + : CopyWith$Fragment$userFields(local$user, (e) => call(user: e)); } } -class _CopyWithStubImpl$Mutation$CreateUser$createUser implements CopyWith$Mutation$CreateUser$createUser { +class _CopyWithStubImpl$Mutation$CreateUser$createUser + implements CopyWith$Mutation$CreateUser$createUser { _CopyWithStubImpl$Mutation$CreateUser$createUser(this._res); TRes _res; - call({int? code, String? message, bool? success, String? $__typename, Fragment$userFields? user}) => _res; + call( + {int? code, + String? message, + bool? success, + String? $__typename, + Fragment$userFields? user}) => + _res; - CopyWith$Fragment$userFields get user => CopyWith$Fragment$userFields.stub(_res); + CopyWith$Fragment$userFields get user => + CopyWith$Fragment$userFields.stub(_res); } @JsonSerializable(explicitToJson: true) @@ -1199,7 +1607,8 @@ class Variables$Mutation$DeleteUser { Variables$Mutation$DeleteUser({required this.username}); @override - factory Variables$Mutation$DeleteUser.fromJson(Map json) => _$Variables$Mutation$DeleteUserFromJson(json); + factory Variables$Mutation$DeleteUser.fromJson(Map json) => + _$Variables$Mutation$DeleteUserFromJson(json); final String username; @@ -1212,26 +1621,32 @@ class Variables$Mutation$DeleteUser { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Variables$Mutation$DeleteUser) || runtimeType != other.runtimeType) return false; + 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); + 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) = + factory CopyWith$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; + factory CopyWith$Variables$Mutation$DeleteUser.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$DeleteUser; TRes call({String? username}); } -class _CopyWithImpl$Variables$Mutation$DeleteUser implements CopyWith$Variables$Mutation$DeleteUser { +class _CopyWithImpl$Variables$Mutation$DeleteUser + implements CopyWith$Variables$Mutation$DeleteUser { _CopyWithImpl$Variables$Mutation$DeleteUser(this._instance, this._then); final Variables$Mutation$DeleteUser _instance; @@ -1240,11 +1655,15 @@ class _CopyWithImpl$Variables$Mutation$DeleteUser implements CopyWith$Vari 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( + username: username == _undefined || username == null + ? _instance.username + : (username as String))); } -class _CopyWithStubImpl$Variables$Mutation$DeleteUser implements CopyWith$Variables$Mutation$DeleteUser { +class _CopyWithStubImpl$Variables$Mutation$DeleteUser + implements CopyWith$Variables$Mutation$DeleteUser { _CopyWithStubImpl$Variables$Mutation$DeleteUser(this._res); TRes _res; @@ -1257,7 +1676,8 @@ class Mutation$DeleteUser { Mutation$DeleteUser({required this.deleteUser, required this.$__typename}); @override - factory Mutation$DeleteUser.fromJson(Map json) => _$Mutation$DeleteUserFromJson(json); + factory Mutation$DeleteUser.fromJson(Map json) => + _$Mutation$DeleteUserFromJson(json); final Mutation$DeleteUser$deleteUser deleteUser; @@ -1274,7 +1694,8 @@ class Mutation$DeleteUser { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Mutation$DeleteUser) || runtimeType != other.runtimeType) return false; + 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; @@ -1286,19 +1707,24 @@ class Mutation$DeleteUser { } extension UtilityExtension$Mutation$DeleteUser on Mutation$DeleteUser { - CopyWith$Mutation$DeleteUser get copyWith => CopyWith$Mutation$DeleteUser(this, (i) => i); + CopyWith$Mutation$DeleteUser get copyWith => + 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; + factory CopyWith$Mutation$DeleteUser.stub(TRes res) = + _CopyWithStubImpl$Mutation$DeleteUser; TRes call({Mutation$DeleteUser$deleteUser? deleteUser, String? $__typename}); CopyWith$Mutation$DeleteUser$deleteUser get deleteUser; } -class _CopyWithImpl$Mutation$DeleteUser implements CopyWith$Mutation$DeleteUser { +class _CopyWithImpl$Mutation$DeleteUser + implements CopyWith$Mutation$DeleteUser { _CopyWithImpl$Mutation$DeleteUser(this._instance, this._then); final Mutation$DeleteUser _instance; @@ -1307,24 +1733,35 @@ class _CopyWithImpl$Mutation$DeleteUser implements CopyWith$Mutation$Delet static const _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))); + 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))); CopyWith$Mutation$DeleteUser$deleteUser get deleteUser { final local$deleteUser = _instance.deleteUser; - return CopyWith$Mutation$DeleteUser$deleteUser(local$deleteUser, (e) => call(deleteUser: e)); + return CopyWith$Mutation$DeleteUser$deleteUser( + local$deleteUser, (e) => call(deleteUser: e)); } } -class _CopyWithStubImpl$Mutation$DeleteUser implements CopyWith$Mutation$DeleteUser { +class _CopyWithStubImpl$Mutation$DeleteUser + implements CopyWith$Mutation$DeleteUser { _CopyWithStubImpl$Mutation$DeleteUser(this._res); TRes _res; - call({Mutation$DeleteUser$deleteUser? deleteUser, String? $__typename}) => _res; + call({Mutation$DeleteUser$deleteUser? deleteUser, String? $__typename}) => + _res; - CopyWith$Mutation$DeleteUser$deleteUser get deleteUser => CopyWith$Mutation$DeleteUser$deleteUser.stub(_res); + CopyWith$Mutation$DeleteUser$deleteUser get deleteUser => + CopyWith$Mutation$DeleteUser$deleteUser.stub(_res); } const documentNodeMutationDeleteUser = DocumentNode(definitions: [ @@ -1334,7 +1771,8 @@ const documentNodeMutationDeleteUser = DocumentNode(definitions: [ variableDefinitions: [ VariableDefinitionNode( variable: VariableNode(name: NameNode(value: 'username')), - type: NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), + type: + NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), defaultValue: DefaultValueNode(value: null), directives: []) ], @@ -1343,22 +1781,41 @@ const documentNodeMutationDeleteUser = DocumentNode(definitions: [ FieldNode( name: NameNode(value: 'deleteUser'), alias: null, - arguments: [ArgumentNode(name: NameNode(value: 'username'), value: VariableNode(name: NameNode(value: 'username')))], + arguments: [ + ArgumentNode( + name: NameNode(value: 'username'), + value: VariableNode(name: NameNode(value: 'username'))) + ], directives: [], selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode(name: NameNode(value: 'basicMutationReturnFields'), directives: []), - FieldNode(name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], selectionSet: null) + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + 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) ])), fragmentDefinitionbasicMutationReturnFields, ]); -Mutation$DeleteUser _parserFn$Mutation$DeleteUser(Map data) => Mutation$DeleteUser.fromJson(data); +Mutation$DeleteUser _parserFn$Mutation$DeleteUser(Map data) => + Mutation$DeleteUser.fromJson(data); -typedef OnMutationCompleted$Mutation$DeleteUser = FutureOr Function(dynamic, Mutation$DeleteUser?); +typedef OnMutationCompleted$Mutation$DeleteUser = FutureOr Function( + dynamic, Mutation$DeleteUser?); -class Options$Mutation$DeleteUser extends graphql.MutationOptions { +class Options$Mutation$DeleteUser + extends graphql.MutationOptions { Options$Mutation$DeleteUser( {String? operationName, required Variables$Mutation$DeleteUser variables, @@ -1379,7 +1836,10 @@ class Options$Mutation$DeleteUser extends graphql.MutationOptions onCompleted(data, data == null ? null : _parserFn$Mutation$DeleteUser(data)), + onCompleted: onCompleted == null + ? null + : (data) => onCompleted(data, + data == null ? null : _parserFn$Mutation$DeleteUser(data)), update: update, onError: onError, document: documentNodeMutationDeleteUser, @@ -1388,11 +1848,16 @@ class Options$Mutation$DeleteUser extends graphql.MutationOptions get properties => - [...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), onCompletedWithParsed]; + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + onCompletedWithParsed + ]; } -class WatchOptions$Mutation$DeleteUser extends graphql.WatchQueryOptions { +class WatchOptions$Mutation$DeleteUser + extends graphql.WatchQueryOptions { WatchOptions$Mutation$DeleteUser( {String? operationName, required Variables$Mutation$DeleteUser variables, @@ -1422,17 +1887,27 @@ class WatchOptions$Mutation$DeleteUser extends graphql.WatchQueryOptions> mutate$DeleteUser(Options$Mutation$DeleteUser options) async => await this.mutate(options); + Future> mutate$DeleteUser( + Options$Mutation$DeleteUser options) async => + await this.mutate(options); - graphql.ObservableQuery watchMutation$DeleteUser(WatchOptions$Mutation$DeleteUser options) => this.watchMutation(options); + graphql.ObservableQuery watchMutation$DeleteUser( + WatchOptions$Mutation$DeleteUser options) => + 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}); +class Mutation$DeleteUser$deleteUser + implements Fragment$basicMutationReturnFields { + 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) => + _$Mutation$DeleteUser$deleteUserFromJson(json); final int code; @@ -1455,7 +1930,8 @@ class Mutation$DeleteUser$deleteUser implements Fragment$basicMutationReturnFiel @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Mutation$DeleteUser$deleteUser) || runtimeType != other.runtimeType) return false; + if (!(other is Mutation$DeleteUser$deleteUser) || + runtimeType != other.runtimeType) return false; final l$code = code; final lOther$code = other.code; if (l$code != lOther$code) return false; @@ -1472,20 +1948,26 @@ class Mutation$DeleteUser$deleteUser implements Fragment$basicMutationReturnFiel } } -extension UtilityExtension$Mutation$DeleteUser$deleteUser on Mutation$DeleteUser$deleteUser { - CopyWith$Mutation$DeleteUser$deleteUser get copyWith => CopyWith$Mutation$DeleteUser$deleteUser(this, (i) => i); +extension UtilityExtension$Mutation$DeleteUser$deleteUser + on Mutation$DeleteUser$deleteUser { + CopyWith$Mutation$DeleteUser$deleteUser + 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) = + factory CopyWith$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; + factory CopyWith$Mutation$DeleteUser$deleteUser.stub(TRes res) = + _CopyWithStubImpl$Mutation$DeleteUser$deleteUser; TRes call({int? code, String? message, bool? success, String? $__typename}); } -class _CopyWithImpl$Mutation$DeleteUser$deleteUser implements CopyWith$Mutation$DeleteUser$deleteUser { +class _CopyWithImpl$Mutation$DeleteUser$deleteUser + implements CopyWith$Mutation$DeleteUser$deleteUser { _CopyWithImpl$Mutation$DeleteUser$deleteUser(this._instance, this._then); final Mutation$DeleteUser$deleteUser _instance; @@ -1494,20 +1976,34 @@ class _CopyWithImpl$Mutation$DeleteUser$deleteUser implements CopyWith$Mut 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 implements CopyWith$Mutation$DeleteUser$deleteUser { +class _CopyWithStubImpl$Mutation$DeleteUser$deleteUser + implements CopyWith$Mutation$DeleteUser$deleteUser { _CopyWithStubImpl$Mutation$DeleteUser$deleteUser(this._res); TRes _res; - call({int? code, String? message, bool? success, String? $__typename}) => _res; + call({int? code, String? message, bool? success, String? $__typename}) => + _res; } @JsonSerializable(explicitToJson: true) @@ -1515,7 +2011,8 @@ class Variables$Mutation$UpdateUser { Variables$Mutation$UpdateUser({required this.user}); @override - factory Variables$Mutation$UpdateUser.fromJson(Map json) => _$Variables$Mutation$UpdateUserFromJson(json); + factory Variables$Mutation$UpdateUser.fromJson(Map json) => + _$Variables$Mutation$UpdateUserFromJson(json); final Input$UserMutationInput user; @@ -1528,26 +2025,32 @@ class Variables$Mutation$UpdateUser { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Variables$Mutation$UpdateUser) || runtimeType != other.runtimeType) return false; + 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); + 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) = + factory CopyWith$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; + factory CopyWith$Variables$Mutation$UpdateUser.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$UpdateUser; TRes call({Input$UserMutationInput? user}); } -class _CopyWithImpl$Variables$Mutation$UpdateUser implements CopyWith$Variables$Mutation$UpdateUser { +class _CopyWithImpl$Variables$Mutation$UpdateUser + implements CopyWith$Variables$Mutation$UpdateUser { _CopyWithImpl$Variables$Mutation$UpdateUser(this._instance, this._then); final Variables$Mutation$UpdateUser _instance; @@ -1556,11 +2059,14 @@ class _CopyWithImpl$Variables$Mutation$UpdateUser implements CopyWith$Vari 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( + user: user == _undefined || user == null + ? _instance.user + : (user as Input$UserMutationInput))); } -class _CopyWithStubImpl$Variables$Mutation$UpdateUser implements CopyWith$Variables$Mutation$UpdateUser { +class _CopyWithStubImpl$Variables$Mutation$UpdateUser + implements CopyWith$Variables$Mutation$UpdateUser { _CopyWithStubImpl$Variables$Mutation$UpdateUser(this._res); TRes _res; @@ -1573,7 +2079,8 @@ class Mutation$UpdateUser { Mutation$UpdateUser({required this.updateUser, required this.$__typename}); @override - factory Mutation$UpdateUser.fromJson(Map json) => _$Mutation$UpdateUserFromJson(json); + factory Mutation$UpdateUser.fromJson(Map json) => + _$Mutation$UpdateUserFromJson(json); final Mutation$UpdateUser$updateUser updateUser; @@ -1590,7 +2097,8 @@ class Mutation$UpdateUser { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Mutation$UpdateUser) || runtimeType != other.runtimeType) return false; + 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; @@ -1602,19 +2110,24 @@ class Mutation$UpdateUser { } extension UtilityExtension$Mutation$UpdateUser on Mutation$UpdateUser { - CopyWith$Mutation$UpdateUser get copyWith => CopyWith$Mutation$UpdateUser(this, (i) => i); + CopyWith$Mutation$UpdateUser get copyWith => + 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; + factory CopyWith$Mutation$UpdateUser.stub(TRes res) = + _CopyWithStubImpl$Mutation$UpdateUser; TRes call({Mutation$UpdateUser$updateUser? updateUser, String? $__typename}); CopyWith$Mutation$UpdateUser$updateUser get updateUser; } -class _CopyWithImpl$Mutation$UpdateUser implements CopyWith$Mutation$UpdateUser { +class _CopyWithImpl$Mutation$UpdateUser + implements CopyWith$Mutation$UpdateUser { _CopyWithImpl$Mutation$UpdateUser(this._instance, this._then); final Mutation$UpdateUser _instance; @@ -1623,24 +2136,35 @@ class _CopyWithImpl$Mutation$UpdateUser implements CopyWith$Mutation$Updat static const _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))); + 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))); CopyWith$Mutation$UpdateUser$updateUser get updateUser { final local$updateUser = _instance.updateUser; - return CopyWith$Mutation$UpdateUser$updateUser(local$updateUser, (e) => call(updateUser: e)); + return CopyWith$Mutation$UpdateUser$updateUser( + local$updateUser, (e) => call(updateUser: e)); } } -class _CopyWithStubImpl$Mutation$UpdateUser implements CopyWith$Mutation$UpdateUser { +class _CopyWithStubImpl$Mutation$UpdateUser + implements CopyWith$Mutation$UpdateUser { _CopyWithStubImpl$Mutation$UpdateUser(this._res); TRes _res; - call({Mutation$UpdateUser$updateUser? updateUser, String? $__typename}) => _res; + call({Mutation$UpdateUser$updateUser? updateUser, String? $__typename}) => + _res; - CopyWith$Mutation$UpdateUser$updateUser get updateUser => CopyWith$Mutation$UpdateUser$updateUser.stub(_res); + CopyWith$Mutation$UpdateUser$updateUser get updateUser => + CopyWith$Mutation$UpdateUser$updateUser.stub(_res); } const documentNodeMutationUpdateUser = DocumentNode(definitions: [ @@ -1650,7 +2174,8 @@ const documentNodeMutationUpdateUser = DocumentNode(definitions: [ variableDefinitions: [ VariableDefinitionNode( variable: VariableNode(name: NameNode(value: 'user')), - type: NamedTypeNode(name: NameNode(value: 'UserMutationInput'), isNonNull: true), + type: NamedTypeNode( + name: NameNode(value: 'UserMutationInput'), isNonNull: true), defaultValue: DefaultValueNode(value: null), directives: []) ], @@ -1659,32 +2184,57 @@ const documentNodeMutationUpdateUser = DocumentNode(definitions: [ FieldNode( name: NameNode(value: 'updateUser'), alias: null, - arguments: [ArgumentNode(name: NameNode(value: 'user'), value: VariableNode(name: NameNode(value: 'user')))], + arguments: [ + ArgumentNode( + name: NameNode(value: 'user'), + value: VariableNode(name: NameNode(value: 'user'))) + ], directives: [], selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode(name: NameNode(value: 'basicMutationReturnFields'), directives: []), + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + 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) + 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) + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) ])), fragmentDefinitionbasicMutationReturnFields, fragmentDefinitionuserFields, ]); -Mutation$UpdateUser _parserFn$Mutation$UpdateUser(Map data) => Mutation$UpdateUser.fromJson(data); +Mutation$UpdateUser _parserFn$Mutation$UpdateUser(Map data) => + Mutation$UpdateUser.fromJson(data); -typedef OnMutationCompleted$Mutation$UpdateUser = FutureOr Function(dynamic, Mutation$UpdateUser?); +typedef OnMutationCompleted$Mutation$UpdateUser = FutureOr Function( + dynamic, Mutation$UpdateUser?); -class Options$Mutation$UpdateUser extends graphql.MutationOptions { +class Options$Mutation$UpdateUser + extends graphql.MutationOptions { Options$Mutation$UpdateUser( {String? operationName, required Variables$Mutation$UpdateUser variables, @@ -1705,7 +2255,10 @@ class Options$Mutation$UpdateUser extends graphql.MutationOptions onCompleted(data, data == null ? null : _parserFn$Mutation$UpdateUser(data)), + onCompleted: onCompleted == null + ? null + : (data) => onCompleted(data, + data == null ? null : _parserFn$Mutation$UpdateUser(data)), update: update, onError: onError, document: documentNodeMutationUpdateUser, @@ -1714,11 +2267,16 @@ class Options$Mutation$UpdateUser extends graphql.MutationOptions get properties => - [...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), onCompletedWithParsed]; + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + onCompletedWithParsed + ]; } -class WatchOptions$Mutation$UpdateUser extends graphql.WatchQueryOptions { +class WatchOptions$Mutation$UpdateUser + extends graphql.WatchQueryOptions { WatchOptions$Mutation$UpdateUser( {String? operationName, required Variables$Mutation$UpdateUser variables, @@ -1748,17 +2306,28 @@ class WatchOptions$Mutation$UpdateUser extends graphql.WatchQueryOptions> mutate$UpdateUser(Options$Mutation$UpdateUser options) async => await this.mutate(options); + Future> mutate$UpdateUser( + Options$Mutation$UpdateUser options) async => + await this.mutate(options); - graphql.ObservableQuery watchMutation$UpdateUser(WatchOptions$Mutation$UpdateUser options) => this.watchMutation(options); + graphql.ObservableQuery watchMutation$UpdateUser( + WatchOptions$Mutation$UpdateUser options) => + 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}); +class Mutation$UpdateUser$updateUser + implements Fragment$basicMutationReturnFields { + 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) => + _$Mutation$UpdateUser$updateUserFromJson(json); final int code; @@ -1778,13 +2347,15 @@ class Mutation$UpdateUser$updateUser implements Fragment$basicMutationReturnFiel 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 (!(other is Mutation$UpdateUser$updateUser) || runtimeType != other.runtimeType) return false; + if (!(other is Mutation$UpdateUser$updateUser) || + runtimeType != other.runtimeType) return false; final l$code = code; final lOther$code = other.code; if (l$code != lOther$code) return false; @@ -1804,21 +2375,32 @@ class Mutation$UpdateUser$updateUser implements Fragment$basicMutationReturnFiel } } -extension UtilityExtension$Mutation$UpdateUser$updateUser on Mutation$UpdateUser$updateUser { - CopyWith$Mutation$UpdateUser$updateUser get copyWith => CopyWith$Mutation$UpdateUser$updateUser(this, (i) => i); +extension UtilityExtension$Mutation$UpdateUser$updateUser + on Mutation$UpdateUser$updateUser { + CopyWith$Mutation$UpdateUser$updateUser + 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) = + factory CopyWith$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; + 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 { +class _CopyWithImpl$Mutation$UpdateUser$updateUser + implements CopyWith$Mutation$UpdateUser$updateUser { _CopyWithImpl$Mutation$UpdateUser$updateUser(this._instance, this._then); final Mutation$UpdateUser$updateUser _instance; @@ -1834,25 +2416,45 @@ class _CopyWithImpl$Mutation$UpdateUser$updateUser implements CopyWith$Mut 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 ? CopyWith$Fragment$userFields.stub(_then(_instance)) : CopyWith$Fragment$userFields(local$user, (e) => call(user: e)); + return local$user == null + ? CopyWith$Fragment$userFields.stub(_then(_instance)) + : CopyWith$Fragment$userFields(local$user, (e) => call(user: e)); } } -class _CopyWithStubImpl$Mutation$UpdateUser$updateUser implements CopyWith$Mutation$UpdateUser$updateUser { +class _CopyWithStubImpl$Mutation$UpdateUser$updateUser + implements CopyWith$Mutation$UpdateUser$updateUser { _CopyWithStubImpl$Mutation$UpdateUser$updateUser(this._res); TRes _res; - call({int? code, String? message, bool? success, String? $__typename, Fragment$userFields? user}) => _res; + call( + {int? code, + String? message, + bool? success, + String? $__typename, + Fragment$userFields? user}) => + _res; - CopyWith$Fragment$userFields get user => CopyWith$Fragment$userFields.stub(_res); + CopyWith$Fragment$userFields get user => + CopyWith$Fragment$userFields.stub(_res); } @JsonSerializable(explicitToJson: true) @@ -1860,7 +2462,8 @@ class Variables$Mutation$AddSshKey { Variables$Mutation$AddSshKey({required this.sshInput}); @override - factory Variables$Mutation$AddSshKey.fromJson(Map json) => _$Variables$Mutation$AddSshKeyFromJson(json); + factory Variables$Mutation$AddSshKey.fromJson(Map json) => + _$Variables$Mutation$AddSshKeyFromJson(json); final Input$SshMutationInput sshInput; @@ -1873,26 +2476,32 @@ class Variables$Mutation$AddSshKey { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Variables$Mutation$AddSshKey) || runtimeType != other.runtimeType) return false; + 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); + 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) = + factory CopyWith$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; + factory CopyWith$Variables$Mutation$AddSshKey.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$AddSshKey; TRes call({Input$SshMutationInput? sshInput}); } -class _CopyWithImpl$Variables$Mutation$AddSshKey implements CopyWith$Variables$Mutation$AddSshKey { +class _CopyWithImpl$Variables$Mutation$AddSshKey + implements CopyWith$Variables$Mutation$AddSshKey { _CopyWithImpl$Variables$Mutation$AddSshKey(this._instance, this._then); final Variables$Mutation$AddSshKey _instance; @@ -1901,11 +2510,15 @@ class _CopyWithImpl$Variables$Mutation$AddSshKey implements CopyWith$Varia static const _undefined = {}; - TRes call({Object? sshInput = _undefined}) => _then( - Variables$Mutation$AddSshKey(sshInput: sshInput == _undefined || sshInput == null ? _instance.sshInput : (sshInput as Input$SshMutationInput))); + TRes call({Object? sshInput = _undefined}) => + _then(Variables$Mutation$AddSshKey( + sshInput: sshInput == _undefined || sshInput == null + ? _instance.sshInput + : (sshInput as Input$SshMutationInput))); } -class _CopyWithStubImpl$Variables$Mutation$AddSshKey implements CopyWith$Variables$Mutation$AddSshKey { +class _CopyWithStubImpl$Variables$Mutation$AddSshKey + implements CopyWith$Variables$Mutation$AddSshKey { _CopyWithStubImpl$Variables$Mutation$AddSshKey(this._res); TRes _res; @@ -1918,7 +2531,8 @@ class Mutation$AddSshKey { Mutation$AddSshKey({required this.addSshKey, required this.$__typename}); @override - factory Mutation$AddSshKey.fromJson(Map json) => _$Mutation$AddSshKeyFromJson(json); + factory Mutation$AddSshKey.fromJson(Map json) => + _$Mutation$AddSshKeyFromJson(json); final Mutation$AddSshKey$addSshKey addSshKey; @@ -1935,7 +2549,8 @@ class Mutation$AddSshKey { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Mutation$AddSshKey) || runtimeType != other.runtimeType) return false; + 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; @@ -1947,19 +2562,24 @@ class Mutation$AddSshKey { } extension UtilityExtension$Mutation$AddSshKey on Mutation$AddSshKey { - CopyWith$Mutation$AddSshKey get copyWith => CopyWith$Mutation$AddSshKey(this, (i) => i); + CopyWith$Mutation$AddSshKey get copyWith => + 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; + factory CopyWith$Mutation$AddSshKey( + Mutation$AddSshKey instance, TRes Function(Mutation$AddSshKey) then) = + _CopyWithImpl$Mutation$AddSshKey; - factory CopyWith$Mutation$AddSshKey.stub(TRes res) = _CopyWithStubImpl$Mutation$AddSshKey; + factory CopyWith$Mutation$AddSshKey.stub(TRes res) = + _CopyWithStubImpl$Mutation$AddSshKey; TRes call({Mutation$AddSshKey$addSshKey? addSshKey, String? $__typename}); CopyWith$Mutation$AddSshKey$addSshKey get addSshKey; } -class _CopyWithImpl$Mutation$AddSshKey implements CopyWith$Mutation$AddSshKey { +class _CopyWithImpl$Mutation$AddSshKey + implements CopyWith$Mutation$AddSshKey { _CopyWithImpl$Mutation$AddSshKey(this._instance, this._then); final Mutation$AddSshKey _instance; @@ -1968,24 +2588,33 @@ class _CopyWithImpl$Mutation$AddSshKey implements CopyWith$Mutation$AddSsh static const _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))); + 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))); CopyWith$Mutation$AddSshKey$addSshKey get addSshKey { final local$addSshKey = _instance.addSshKey; - return CopyWith$Mutation$AddSshKey$addSshKey(local$addSshKey, (e) => call(addSshKey: e)); + return CopyWith$Mutation$AddSshKey$addSshKey( + local$addSshKey, (e) => call(addSshKey: e)); } } -class _CopyWithStubImpl$Mutation$AddSshKey implements CopyWith$Mutation$AddSshKey { +class _CopyWithStubImpl$Mutation$AddSshKey + implements CopyWith$Mutation$AddSshKey { _CopyWithStubImpl$Mutation$AddSshKey(this._res); TRes _res; call({Mutation$AddSshKey$addSshKey? addSshKey, String? $__typename}) => _res; - CopyWith$Mutation$AddSshKey$addSshKey get addSshKey => CopyWith$Mutation$AddSshKey$addSshKey.stub(_res); + CopyWith$Mutation$AddSshKey$addSshKey get addSshKey => + CopyWith$Mutation$AddSshKey$addSshKey.stub(_res); } const documentNodeMutationAddSshKey = DocumentNode(definitions: [ @@ -1995,7 +2624,8 @@ const documentNodeMutationAddSshKey = DocumentNode(definitions: [ variableDefinitions: [ VariableDefinitionNode( variable: VariableNode(name: NameNode(value: 'sshInput')), - type: NamedTypeNode(name: NameNode(value: 'SshMutationInput'), isNonNull: true), + type: NamedTypeNode( + name: NameNode(value: 'SshMutationInput'), isNonNull: true), defaultValue: DefaultValueNode(value: null), directives: []) ], @@ -2004,32 +2634,57 @@ const documentNodeMutationAddSshKey = DocumentNode(definitions: [ FieldNode( name: NameNode(value: 'addSshKey'), alias: null, - arguments: [ArgumentNode(name: NameNode(value: 'sshInput'), value: VariableNode(name: NameNode(value: 'sshInput')))], + arguments: [ + ArgumentNode( + name: NameNode(value: 'sshInput'), + value: VariableNode(name: NameNode(value: 'sshInput'))) + ], directives: [], selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode(name: NameNode(value: 'basicMutationReturnFields'), directives: []), + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + 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) + 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) + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) ])), fragmentDefinitionbasicMutationReturnFields, fragmentDefinitionuserFields, ]); -Mutation$AddSshKey _parserFn$Mutation$AddSshKey(Map data) => Mutation$AddSshKey.fromJson(data); +Mutation$AddSshKey _parserFn$Mutation$AddSshKey(Map data) => + Mutation$AddSshKey.fromJson(data); -typedef OnMutationCompleted$Mutation$AddSshKey = FutureOr Function(dynamic, Mutation$AddSshKey?); +typedef OnMutationCompleted$Mutation$AddSshKey = FutureOr Function( + dynamic, Mutation$AddSshKey?); -class Options$Mutation$AddSshKey extends graphql.MutationOptions { +class Options$Mutation$AddSshKey + extends graphql.MutationOptions { Options$Mutation$AddSshKey( {String? operationName, required Variables$Mutation$AddSshKey variables, @@ -2050,7 +2705,10 @@ class Options$Mutation$AddSshKey extends graphql.MutationOptions onCompleted(data, data == null ? null : _parserFn$Mutation$AddSshKey(data)), + onCompleted: onCompleted == null + ? null + : (data) => onCompleted(data, + data == null ? null : _parserFn$Mutation$AddSshKey(data)), update: update, onError: onError, document: documentNodeMutationAddSshKey, @@ -2059,11 +2717,16 @@ class Options$Mutation$AddSshKey extends graphql.MutationOptions get properties => - [...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), onCompletedWithParsed]; + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + onCompletedWithParsed + ]; } -class WatchOptions$Mutation$AddSshKey extends graphql.WatchQueryOptions { +class WatchOptions$Mutation$AddSshKey + extends graphql.WatchQueryOptions { WatchOptions$Mutation$AddSshKey( {String? operationName, required Variables$Mutation$AddSshKey variables, @@ -2093,17 +2756,28 @@ class WatchOptions$Mutation$AddSshKey extends graphql.WatchQueryOptions> mutate$AddSshKey(Options$Mutation$AddSshKey options) async => await this.mutate(options); + Future> mutate$AddSshKey( + Options$Mutation$AddSshKey options) async => + await this.mutate(options); - graphql.ObservableQuery watchMutation$AddSshKey(WatchOptions$Mutation$AddSshKey options) => this.watchMutation(options); + graphql.ObservableQuery watchMutation$AddSshKey( + WatchOptions$Mutation$AddSshKey options) => + 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}); +class Mutation$AddSshKey$addSshKey + implements Fragment$basicMutationReturnFields { + 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) => + _$Mutation$AddSshKey$addSshKeyFromJson(json); final int code; @@ -2123,13 +2797,15 @@ class Mutation$AddSshKey$addSshKey implements Fragment$basicMutationReturnFields 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 (!(other is Mutation$AddSshKey$addSshKey) || runtimeType != other.runtimeType) return false; + if (!(other is Mutation$AddSshKey$addSshKey) || + runtimeType != other.runtimeType) return false; final l$code = code; final lOther$code = other.code; if (l$code != lOther$code) return false; @@ -2149,21 +2825,32 @@ class Mutation$AddSshKey$addSshKey implements Fragment$basicMutationReturnFields } } -extension UtilityExtension$Mutation$AddSshKey$addSshKey on Mutation$AddSshKey$addSshKey { - CopyWith$Mutation$AddSshKey$addSshKey get copyWith => CopyWith$Mutation$AddSshKey$addSshKey(this, (i) => i); +extension UtilityExtension$Mutation$AddSshKey$addSshKey + on Mutation$AddSshKey$addSshKey { + CopyWith$Mutation$AddSshKey$addSshKey + 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) = + factory CopyWith$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; + 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 { +class _CopyWithImpl$Mutation$AddSshKey$addSshKey + implements CopyWith$Mutation$AddSshKey$addSshKey { _CopyWithImpl$Mutation$AddSshKey$addSshKey(this._instance, this._then); final Mutation$AddSshKey$addSshKey _instance; @@ -2179,25 +2866,45 @@ class _CopyWithImpl$Mutation$AddSshKey$addSshKey implements CopyWith$Mutat 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 ? CopyWith$Fragment$userFields.stub(_then(_instance)) : CopyWith$Fragment$userFields(local$user, (e) => call(user: e)); + return local$user == null + ? CopyWith$Fragment$userFields.stub(_then(_instance)) + : CopyWith$Fragment$userFields(local$user, (e) => call(user: e)); } } -class _CopyWithStubImpl$Mutation$AddSshKey$addSshKey implements CopyWith$Mutation$AddSshKey$addSshKey { +class _CopyWithStubImpl$Mutation$AddSshKey$addSshKey + implements CopyWith$Mutation$AddSshKey$addSshKey { _CopyWithStubImpl$Mutation$AddSshKey$addSshKey(this._res); TRes _res; - call({int? code, String? message, bool? success, String? $__typename, Fragment$userFields? user}) => _res; + call( + {int? code, + String? message, + bool? success, + String? $__typename, + Fragment$userFields? user}) => + _res; - CopyWith$Fragment$userFields get user => CopyWith$Fragment$userFields.stub(_res); + CopyWith$Fragment$userFields get user => + CopyWith$Fragment$userFields.stub(_res); } @JsonSerializable(explicitToJson: true) @@ -2205,11 +2912,13 @@ class Variables$Mutation$RemoveSshKey { Variables$Mutation$RemoveSshKey({required this.sshInput}); @override - factory Variables$Mutation$RemoveSshKey.fromJson(Map json) => _$Variables$Mutation$RemoveSshKeyFromJson(json); + factory Variables$Mutation$RemoveSshKey.fromJson(Map json) => + _$Variables$Mutation$RemoveSshKeyFromJson(json); final Input$SshMutationInput sshInput; - Map toJson() => _$Variables$Mutation$RemoveSshKeyToJson(this); + Map toJson() => + _$Variables$Mutation$RemoveSshKeyToJson(this); int get hashCode { final l$sshInput = sshInput; return Object.hashAll([l$sshInput]); @@ -2218,26 +2927,32 @@ class Variables$Mutation$RemoveSshKey { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Variables$Mutation$RemoveSshKey) || runtimeType != other.runtimeType) return false; + 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); + 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) = + factory CopyWith$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; + factory CopyWith$Variables$Mutation$RemoveSshKey.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$RemoveSshKey; TRes call({Input$SshMutationInput? sshInput}); } -class _CopyWithImpl$Variables$Mutation$RemoveSshKey implements CopyWith$Variables$Mutation$RemoveSshKey { +class _CopyWithImpl$Variables$Mutation$RemoveSshKey + implements CopyWith$Variables$Mutation$RemoveSshKey { _CopyWithImpl$Variables$Mutation$RemoveSshKey(this._instance, this._then); final Variables$Mutation$RemoveSshKey _instance; @@ -2246,11 +2961,15 @@ class _CopyWithImpl$Variables$Mutation$RemoveSshKey implements CopyWith$Va static const _undefined = {}; - TRes call({Object? sshInput = _undefined}) => _then(Variables$Mutation$RemoveSshKey( - sshInput: sshInput == _undefined || sshInput == null ? _instance.sshInput : (sshInput as Input$SshMutationInput))); + TRes call({Object? sshInput = _undefined}) => + _then(Variables$Mutation$RemoveSshKey( + sshInput: sshInput == _undefined || sshInput == null + ? _instance.sshInput + : (sshInput as Input$SshMutationInput))); } -class _CopyWithStubImpl$Variables$Mutation$RemoveSshKey implements CopyWith$Variables$Mutation$RemoveSshKey { +class _CopyWithStubImpl$Variables$Mutation$RemoveSshKey + implements CopyWith$Variables$Mutation$RemoveSshKey { _CopyWithStubImpl$Variables$Mutation$RemoveSshKey(this._res); TRes _res; @@ -2260,10 +2979,12 @@ class _CopyWithStubImpl$Variables$Mutation$RemoveSshKey implements CopyWit @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) => + _$Mutation$RemoveSshKeyFromJson(json); final Mutation$RemoveSshKey$removeSshKey removeSshKey; @@ -2280,7 +3001,8 @@ class Mutation$RemoveSshKey { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (!(other is Mutation$RemoveSshKey) || runtimeType != other.runtimeType) return false; + 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; @@ -2292,20 +3014,25 @@ class Mutation$RemoveSshKey { } extension UtilityExtension$Mutation$RemoveSshKey on Mutation$RemoveSshKey { - CopyWith$Mutation$RemoveSshKey get copyWith => CopyWith$Mutation$RemoveSshKey(this, (i) => i); + CopyWith$Mutation$RemoveSshKey get copyWith => + CopyWith$Mutation$RemoveSshKey(this, (i) => i); } abstract class CopyWith$Mutation$RemoveSshKey { - factory CopyWith$Mutation$RemoveSshKey(Mutation$RemoveSshKey instance, TRes Function(Mutation$RemoveSshKey) then) = + 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; + 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 { +class _CopyWithImpl$Mutation$RemoveSshKey + implements CopyWith$Mutation$RemoveSshKey { _CopyWithImpl$Mutation$RemoveSshKey(this._instance, this._then); final Mutation$RemoveSshKey _instance; @@ -2314,25 +3041,37 @@ class _CopyWithImpl$Mutation$RemoveSshKey implements CopyWith$Mutation$Rem static const _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))); + 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))); CopyWith$Mutation$RemoveSshKey$removeSshKey get removeSshKey { final local$removeSshKey = _instance.removeSshKey; - return CopyWith$Mutation$RemoveSshKey$removeSshKey(local$removeSshKey, (e) => call(removeSshKey: e)); + return CopyWith$Mutation$RemoveSshKey$removeSshKey( + local$removeSshKey, (e) => call(removeSshKey: e)); } } -class _CopyWithStubImpl$Mutation$RemoveSshKey implements CopyWith$Mutation$RemoveSshKey { +class _CopyWithStubImpl$Mutation$RemoveSshKey + implements CopyWith$Mutation$RemoveSshKey { _CopyWithStubImpl$Mutation$RemoveSshKey(this._res); TRes _res; - call({Mutation$RemoveSshKey$removeSshKey? removeSshKey, String? $__typename}) => _res; + call( + {Mutation$RemoveSshKey$removeSshKey? removeSshKey, + String? $__typename}) => + _res; - CopyWith$Mutation$RemoveSshKey$removeSshKey get removeSshKey => CopyWith$Mutation$RemoveSshKey$removeSshKey.stub(_res); + CopyWith$Mutation$RemoveSshKey$removeSshKey get removeSshKey => + CopyWith$Mutation$RemoveSshKey$removeSshKey.stub(_res); } const documentNodeMutationRemoveSshKey = DocumentNode(definitions: [ @@ -2342,7 +3081,8 @@ const documentNodeMutationRemoveSshKey = DocumentNode(definitions: [ variableDefinitions: [ VariableDefinitionNode( variable: VariableNode(name: NameNode(value: 'sshInput')), - type: NamedTypeNode(name: NameNode(value: 'SshMutationInput'), isNonNull: true), + type: NamedTypeNode( + name: NameNode(value: 'SshMutationInput'), isNonNull: true), defaultValue: DefaultValueNode(value: null), directives: []) ], @@ -2351,32 +3091,58 @@ const documentNodeMutationRemoveSshKey = DocumentNode(definitions: [ FieldNode( name: NameNode(value: 'removeSshKey'), alias: null, - arguments: [ArgumentNode(name: NameNode(value: 'sshInput'), value: VariableNode(name: NameNode(value: 'sshInput')))], + arguments: [ + ArgumentNode( + name: NameNode(value: 'sshInput'), + value: VariableNode(name: NameNode(value: 'sshInput'))) + ], directives: [], selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode(name: NameNode(value: 'basicMutationReturnFields'), directives: []), + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + 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) + 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) + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) ])), fragmentDefinitionbasicMutationReturnFields, fragmentDefinitionuserFields, ]); -Mutation$RemoveSshKey _parserFn$Mutation$RemoveSshKey(Map data) => Mutation$RemoveSshKey.fromJson(data); +Mutation$RemoveSshKey _parserFn$Mutation$RemoveSshKey( + Map data) => + Mutation$RemoveSshKey.fromJson(data); -typedef OnMutationCompleted$Mutation$RemoveSshKey = FutureOr Function(dynamic, Mutation$RemoveSshKey?); +typedef OnMutationCompleted$Mutation$RemoveSshKey = FutureOr Function( + dynamic, Mutation$RemoveSshKey?); -class Options$Mutation$RemoveSshKey extends graphql.MutationOptions { +class Options$Mutation$RemoveSshKey + extends graphql.MutationOptions { Options$Mutation$RemoveSshKey( {String? operationName, required Variables$Mutation$RemoveSshKey variables, @@ -2397,7 +3163,13 @@ class Options$Mutation$RemoveSshKey extends graphql.MutationOptions onCompleted(data, data == null ? null : _parserFn$Mutation$RemoveSshKey(data)), + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( + data, + data == null + ? null + : _parserFn$Mutation$RemoveSshKey(data)), update: update, onError: onError, document: documentNodeMutationRemoveSshKey, @@ -2406,11 +3178,16 @@ class Options$Mutation$RemoveSshKey extends graphql.MutationOptions get properties => - [...super.onCompleted == null ? super.properties : super.properties.where((property) => property != onCompleted), onCompletedWithParsed]; + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + onCompletedWithParsed + ]; } -class WatchOptions$Mutation$RemoveSshKey extends graphql.WatchQueryOptions { +class WatchOptions$Mutation$RemoveSshKey + extends graphql.WatchQueryOptions { WatchOptions$Mutation$RemoveSshKey( {String? operationName, required Variables$Mutation$RemoveSshKey variables, @@ -2440,18 +3217,29 @@ class WatchOptions$Mutation$RemoveSshKey extends graphql.WatchQueryOptions> mutate$RemoveSshKey(Options$Mutation$RemoveSshKey options) async => await this.mutate(options); + Future> mutate$RemoveSshKey( + Options$Mutation$RemoveSshKey options) async => + await this.mutate(options); - graphql.ObservableQuery watchMutation$RemoveSshKey(WatchOptions$Mutation$RemoveSshKey options) => + graphql.ObservableQuery watchMutation$RemoveSshKey( + WatchOptions$Mutation$RemoveSshKey options) => 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}); +class Mutation$RemoveSshKey$removeSshKey + implements Fragment$basicMutationReturnFields { + 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); + factory Mutation$RemoveSshKey$removeSshKey.fromJson( + Map json) => + _$Mutation$RemoveSshKey$removeSshKeyFromJson(json); final int code; @@ -2464,20 +3252,23 @@ class Mutation$RemoveSshKey$removeSshKey implements Fragment$basicMutationReturn final Fragment$userFields? user; - Map toJson() => _$Mutation$RemoveSshKey$removeSshKeyToJson(this); + Map toJson() => + _$Mutation$RemoveSshKey$removeSshKeyToJson(this); 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 (!(other is Mutation$RemoveSshKey$removeSshKey) || runtimeType != other.runtimeType) return false; + if (!(other is Mutation$RemoveSshKey$removeSshKey) || + runtimeType != other.runtimeType) return false; final l$code = code; final lOther$code = other.code; if (l$code != lOther$code) return false; @@ -2497,23 +3288,34 @@ class Mutation$RemoveSshKey$removeSshKey implements Fragment$basicMutationReturn } } -extension UtilityExtension$Mutation$RemoveSshKey$removeSshKey on Mutation$RemoveSshKey$removeSshKey { - CopyWith$Mutation$RemoveSshKey$removeSshKey get copyWith => - CopyWith$Mutation$RemoveSshKey$removeSshKey(this, (i) => i); +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); } abstract class CopyWith$Mutation$RemoveSshKey$removeSshKey { factory CopyWith$Mutation$RemoveSshKey$removeSshKey( - Mutation$RemoveSshKey$removeSshKey instance, TRes Function(Mutation$RemoveSshKey$removeSshKey) then) = + 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; + 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 { +class _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey + implements CopyWith$Mutation$RemoveSshKey$removeSshKey { _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey(this._instance, this._then); final Mutation$RemoveSshKey$removeSshKey _instance; @@ -2529,23 +3331,43 @@ class _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey implements CopyWith 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 ? CopyWith$Fragment$userFields.stub(_then(_instance)) : CopyWith$Fragment$userFields(local$user, (e) => call(user: e)); + return local$user == null + ? CopyWith$Fragment$userFields.stub(_then(_instance)) + : CopyWith$Fragment$userFields(local$user, (e) => call(user: e)); } } -class _CopyWithStubImpl$Mutation$RemoveSshKey$removeSshKey implements CopyWith$Mutation$RemoveSshKey$removeSshKey { +class _CopyWithStubImpl$Mutation$RemoveSshKey$removeSshKey + implements CopyWith$Mutation$RemoveSshKey$removeSshKey { _CopyWithStubImpl$Mutation$RemoveSshKey$removeSshKey(this._res); TRes _res; - call({int? code, String? message, bool? success, String? $__typename, Fragment$userFields? user}) => _res; + call( + {int? code, + String? message, + bool? success, + String? $__typename, + Fragment$userFields? user}) => + _res; - CopyWith$Fragment$userFields get user => CopyWith$Fragment$userFields.stub(_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 index a9dfff53..7fb93e4e 100644 --- a/lib/logic/api_maps/graphql_maps/schema/users.graphql.g.dart +++ b/lib/logic/api_maps/graphql_maps/schema/users.graphql.g.dart @@ -6,28 +6,37 @@ part of 'users.graphql.dart'; // JsonSerializableGenerator // ************************************************************************** -Fragment$basicMutationReturnFields _$Fragment$basicMutationReturnFieldsFromJson(Map json) => Fragment$basicMutationReturnFields( +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) => { +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( +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(), + 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) => { +Map _$Fragment$userFieldsToJson( + Fragment$userFields instance) => + { 'username': instance.username, 'userType': _$Enum$UserTypeEnumMap[instance.userType]!, 'sshKeys': instance.sshKeys, @@ -41,83 +50,123 @@ const _$Enum$UserTypeEnumMap = { Enum$UserType.$unknown: r'$unknown', }; -Query$AllUsers _$Query$AllUsersFromJson(Map json) => Query$AllUsers( - users: Query$AllUsers$users.fromJson(json['users'] as Map), +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) => { +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), +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) => { +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( +Variables$Query$GetUser _$Variables$Query$GetUserFromJson( + Map json) => + Variables$Query$GetUser( username: json['username'] as String, ); -Map _$Variables$Query$GetUserToJson(Variables$Query$GetUser instance) => { +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), +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) => { +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), +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) => { +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), +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) => { +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), +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) => { +Map _$Mutation$CreateUserToJson( + Mutation$CreateUser instance) => + { 'createUser': instance.createUser.toJson(), '__typename': instance.$__typename, }; -Mutation$CreateUser$createUser _$Mutation$CreateUser$createUserFromJson(Map json) => Mutation$CreateUser$createUser( +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), + user: json['user'] == null + ? null + : Fragment$userFields.fromJson(json['user'] as Map), ); -Map _$Mutation$CreateUser$createUserToJson(Mutation$CreateUser$createUser instance) => { +Map _$Mutation$CreateUser$createUserToJson( + Mutation$CreateUser$createUser instance) => + { 'code': instance.code, 'message': instance.message, 'success': instance.success, @@ -125,65 +174,92 @@ Map _$Mutation$CreateUser$createUserToJson(Mutation$CreateUser$ 'user': instance.user?.toJson(), }; -Variables$Mutation$DeleteUser _$Variables$Mutation$DeleteUserFromJson(Map json) => Variables$Mutation$DeleteUser( +Variables$Mutation$DeleteUser _$Variables$Mutation$DeleteUserFromJson( + Map json) => + Variables$Mutation$DeleteUser( username: json['username'] as String, ); -Map _$Variables$Mutation$DeleteUserToJson(Variables$Mutation$DeleteUser instance) => { +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), +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) => { +Map _$Mutation$DeleteUserToJson( + Mutation$DeleteUser instance) => + { 'deleteUser': instance.deleteUser.toJson(), '__typename': instance.$__typename, }; -Mutation$DeleteUser$deleteUser _$Mutation$DeleteUser$deleteUserFromJson(Map json) => Mutation$DeleteUser$deleteUser( +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) => { +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), +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) => { +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), +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) => { +Map _$Mutation$UpdateUserToJson( + Mutation$UpdateUser instance) => + { 'updateUser': instance.updateUser.toJson(), '__typename': instance.$__typename, }; -Mutation$UpdateUser$updateUser _$Mutation$UpdateUser$updateUserFromJson(Map json) => Mutation$UpdateUser$updateUser( +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), + user: json['user'] == null + ? null + : Fragment$userFields.fromJson(json['user'] as Map), ); -Map _$Mutation$UpdateUser$updateUserToJson(Mutation$UpdateUser$updateUser instance) => { +Map _$Mutation$UpdateUser$updateUserToJson( + Mutation$UpdateUser$updateUser instance) => + { 'code': instance.code, 'message': instance.message, 'success': instance.success, @@ -191,33 +267,47 @@ Map _$Mutation$UpdateUser$updateUserToJson(Mutation$UpdateUser$ 'user': instance.user?.toJson(), }; -Variables$Mutation$AddSshKey _$Variables$Mutation$AddSshKeyFromJson(Map json) => Variables$Mutation$AddSshKey( - sshInput: Input$SshMutationInput.fromJson(json['sshInput'] as Map), +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) => { +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), +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) => { +Map _$Mutation$AddSshKeyToJson(Mutation$AddSshKey instance) => + { 'addSshKey': instance.addSshKey.toJson(), '__typename': instance.$__typename, }; -Mutation$AddSshKey$addSshKey _$Mutation$AddSshKey$addSshKeyFromJson(Map json) => Mutation$AddSshKey$addSshKey( +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), + user: json['user'] == null + ? null + : Fragment$userFields.fromJson(json['user'] as Map), ); -Map _$Mutation$AddSshKey$addSshKeyToJson(Mutation$AddSshKey$addSshKey instance) => { +Map _$Mutation$AddSshKey$addSshKeyToJson( + Mutation$AddSshKey$addSshKey instance) => + { 'code': instance.code, 'message': instance.message, 'success': instance.success, @@ -225,33 +315,49 @@ Map _$Mutation$AddSshKey$addSshKeyToJson(Mutation$AddSshKey$add 'user': instance.user?.toJson(), }; -Variables$Mutation$RemoveSshKey _$Variables$Mutation$RemoveSshKeyFromJson(Map json) => Variables$Mutation$RemoveSshKey( - sshInput: Input$SshMutationInput.fromJson(json['sshInput'] as Map), +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) => { +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), +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) => { +Map _$Mutation$RemoveSshKeyToJson( + Mutation$RemoveSshKey instance) => + { 'removeSshKey': instance.removeSshKey.toJson(), '__typename': instance.$__typename, }; -Mutation$RemoveSshKey$removeSshKey _$Mutation$RemoveSshKey$removeSshKeyFromJson(Map json) => Mutation$RemoveSshKey$removeSshKey( +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), + user: json['user'] == null + ? null + : Fragment$userFields.fromJson(json['user'] as Map), ); -Map _$Mutation$RemoveSshKey$removeSshKeyToJson(Mutation$RemoveSshKey$removeSshKey instance) => { +Map _$Mutation$RemoveSshKey$removeSshKeyToJson( + Mutation$RemoveSshKey$removeSshKey instance) => + { 'code': instance.code, 'message': instance.message, 'success': instance.success, diff --git a/lib/logic/api_maps/graphql_maps/server_api/server.dart b/lib/logic/api_maps/graphql_maps/server_api/server.dart index 77241653..b8739f04 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/server.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/server.dart @@ -1,10 +1,10 @@ import 'package:graphql/client.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/api_map.dart'; -import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/schema.graphql.dart'; -import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart'; -import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_api.graphql.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'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/services.graphql.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/users.graphql.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; @@ -14,11 +14,11 @@ import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; import 'package:selfprivacy/logic/models/json/server_job.dart'; import 'package:selfprivacy/logic/models/service.dart'; -part 'volume_api.dart'; part 'jobs_api.dart'; part 'server_actions_api.dart'; part 'services_api.dart'; part 'users_api.dart'; +part 'volume_api.dart'; class GenericMutationResult { GenericMutationResult({ @@ -42,7 +42,7 @@ class GenericJobMutationReturn extends GenericMutationResult { } class ServerApi extends ApiMap - with VolumeApi, JobsApi, ServerActionsApi, ServicesApi { + with VolumeApi, JobsApi, ServerActionsApi, ServicesApi, UsersApi { ServerApi({ this.hasLogger = false, this.isWithToken = true, 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 d224f08f..359967b7 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 @@ -7,6 +7,7 @@ class UserMutationResult extends GenericMutationResult { final super.message, this.user, }); + final User? user; } @@ -20,13 +21,17 @@ mixin UsersApi on ApiMap { if (response.hasException) { print(response.exception.toString()); } - users = response.parsedData?.users.allUsers.map((final user) => User.fromGraphQL(user)).toList() ?? []; + users = response.parsedData?.users.allUsers + .map((final user) => User.fromGraphQL(user)) + .toList() ?? + []; final rootUser = response.parsedData?.users.rootUser; if (rootUser != null) { users.add(User.fromGraphQL(rootUser)); } } catch (e) { print(e); + print("Could not"); } return users; } @@ -37,7 +42,8 @@ mixin UsersApi on ApiMap { try { final GraphQLClient client = await getClient(); final variables = Variables$Query$GetUser(username: login); - response = await client.query$GetUser(Options$Query$GetUser(variables: variables)); + response = await client + .query$GetUser(Options$Query$GetUser(variables: variables)); if (response.hasException) { print(response.exception.toString()); } @@ -66,7 +72,9 @@ mixin UsersApi on ApiMap { success: response.parsedData?.createUser.success ?? false, code: response.parsedData?.createUser.code ?? 500, message: response.parsedData?.createUser.message, - user: response.parsedData?.createUser.user != null ? User.fromGraphQL(response.parsedData!.createUser.user!) : null, + user: response.parsedData?.createUser.user != null + ? User.fromGraphQL(response.parsedData!.createUser.user!) + : null, ); } catch (e) { print(e); @@ -116,7 +124,9 @@ mixin UsersApi on ApiMap { success: response.parsedData?.updateUser.success ?? false, code: response.parsedData?.updateUser.code ?? 500, message: response.parsedData?.updateUser.message, - user: response.parsedData?.updateUser.user != null ? User.fromGraphQL(response.parsedData!.updateUser.user!) : null, + user: response.parsedData?.updateUser.user != null + ? User.fromGraphQL(response.parsedData!.updateUser.user!) + : null, ); } catch (e) { print(e); @@ -146,7 +156,9 @@ mixin UsersApi on ApiMap { success: response.parsedData?.addSshKey.success ?? false, code: response.parsedData?.addSshKey.code ?? 500, message: response.parsedData?.addSshKey.message, - user: response.parsedData?.addSshKey.user != null ? User.fromGraphQL(response.parsedData!.addSshKey.user!) : null, + user: response.parsedData?.addSshKey.user != null + ? User.fromGraphQL(response.parsedData!.addSshKey.user!) + : null, ); } catch (e) { print(e); @@ -176,7 +188,9 @@ mixin UsersApi on ApiMap { success: response.parsedData?.removeSshKey.success ?? false, code: response.parsedData?.removeSshKey.code ?? 500, message: response.parsedData?.removeSshKey.message, - user: response.parsedData?.removeSshKey.user != null ? User.fromGraphQL(response.parsedData!.removeSshKey.user!) : null, + user: response.parsedData?.removeSshKey.user != null + ? User.fromGraphQL(response.parsedData!.removeSshKey.user!) + : null, ); } catch (e) { print(e); diff --git a/lib/logic/api_maps/rest_maps/server.dart b/lib/logic/api_maps/rest_maps/server.dart index 5c94d990..edffda09 100644 --- a/lib/logic/api_maps/rest_maps/server.dart +++ b/lib/logic/api_maps/rest_maps/server.dart @@ -70,7 +70,9 @@ class ServerApi extends ApiMap { baseUrl: 'https://api.$overrideDomain', connectTimeout: 10000, receiveTimeout: 10000, - headers: customToken != null ? {'Authorization': 'Bearer $customToken'} : null, + headers: customToken != null + ? {'Authorization': 'Bearer $customToken'} + : null, ); } @@ -141,7 +143,8 @@ class ServerApi extends ApiMap { bool isFoundOnServer = false; int code = 0; - final bool isUserCreated = (response.statusCode != null) && (response.statusCode == HttpStatus.created); + final bool isUserCreated = (response.statusCode != null) && + (response.statusCode == HttpStatus.created); if (isUserCreated) { isFoundOnServer = true; @@ -271,7 +274,9 @@ class ServerApi extends ApiMap { final Dio client = await getClient(); try { response = await client.get('/services/ssh/keys/${user.login}'); - res = (response.data as List).map((final e) => e as String).toList(); + res = (response.data as List) + .map((final e) => e as String) + .toList(); } on DioError catch (e) { print(e.message); return ApiResponse>( @@ -330,7 +335,9 @@ class ServerApi extends ApiMap { return ApiResponse( statusCode: code, data: null, - errorMessage: response.data?.containsKey('error') ?? false ? response.data['error'] : null, + errorMessage: response.data?.containsKey('error') ?? false + ? response.data['error'] + : null, ); } @@ -341,7 +348,8 @@ class ServerApi extends ApiMap { final Dio client = await getClient(); try { response = await client.delete('/users/${user.login}'); - res = response.statusCode == HttpStatus.ok || response.statusCode == HttpStatus.notFound; + res = response.statusCode == HttpStatus.ok || + response.statusCode == HttpStatus.notFound; } on DioError catch (e) { print(e.message); res = false; @@ -352,7 +360,8 @@ class ServerApi extends ApiMap { } @override - String get rootAddress => throw UnimplementedError('not used in with implementation'); + String get rootAddress => + throw UnimplementedError('not used in with implementation'); Future apply() async { bool res = false; @@ -445,7 +454,8 @@ class ServerApi extends ApiMap { final Dio client = await getClient(); try { response = await client.get('/services/restic/backup/list'); - backups = response.data.map((final e) => Backup.fromJson(e)).toList(); + backups = + response.data.map((final e) => Backup.fromJson(e)).toList(); } on DioError catch (e) { print(e.message); } catch (e) { @@ -508,7 +518,9 @@ class ServerApi extends ApiMap { final Dio client = await getClient(); try { response = await client.get('/system/configuration/pull'); - result = (response.statusCode != null) ? (response.statusCode == HttpStatus.ok) : false; + result = (response.statusCode != null) + ? (response.statusCode == HttpStatus.ok) + : false; } on DioError catch (e) { print(e.message); } finally { @@ -524,7 +536,9 @@ class ServerApi extends ApiMap { final Dio client = await getClient(); try { response = await client.get('/system/reboot'); - result = (response.statusCode != null) ? (response.statusCode == HttpStatus.ok) : false; + result = (response.statusCode != null) + ? (response.statusCode == HttpStatus.ok) + : false; } on DioError catch (e) { print(e.message); } finally { @@ -540,7 +554,9 @@ class ServerApi extends ApiMap { final Dio client = await getClient(); try { response = await client.get('/system/configuration/upgrade'); - result = (response.statusCode != null) ? (response.statusCode == HttpStatus.ok) : false; + result = (response.statusCode != null) + ? (response.statusCode == HttpStatus.ok) + : false; } on DioError catch (e) { print(e.message); } finally { @@ -589,7 +605,8 @@ class ServerApi extends ApiMap { Future getServerTimezone() async { // I am not sure how to initialize TimeZoneSettings with default value... final Dio client = await getClient(); - final Response response = await client.get('/system/configuration/timezone'); + final Response response = + await client.get('/system/configuration/timezone'); close(client); return TimeZoneSettings.fromString(response.data); @@ -616,7 +633,11 @@ class ServerApi extends ApiMap { try { response = await client.get('/services/mailserver/dkim'); final Codec base64toString = utf8.fuse(base64); - dkim = base64toString.decode(response.data).split('(')[1].split(')')[0].replaceAll('"', ''); + dkim = base64toString + .decode(response.data) + .split('(')[1] + .split(')')[0] + .replaceAll('"', ''); } on DioError catch (e) { print(e.message); } finally { @@ -647,7 +668,9 @@ class ServerApi extends ApiMap { return ApiResponse( statusCode: code, - data: response.data != null ? RecoveryKeyStatus.fromJson(response.data) : null, + data: response.data != null + ? RecoveryKeyStatus.fromJson(response.data) + : null, ); } @@ -817,7 +840,11 @@ class ServerApi extends ApiMap { return ApiResponse( statusCode: code, - data: (response.data != null) ? response.data.map((final e) => ApiToken.fromJson(e)).toList() : [], + data: (response.data != null) + ? response.data + .map((final e) => ApiToken.fromJson(e)) + .toList() + : [], ); } diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 91c09714..0df91227 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -40,10 +40,12 @@ class ServerAuthorizationException implements Exception { class ServerInstallationRepository { Box box = Hive.box(BNames.serverInstallationBox); Box usersBox = Hive.box(BNames.usersBox); - ServerProviderApiFactory? serverProviderApiFactory = ApiFactoryCreator.createServerProviderApiFactory( + ServerProviderApiFactory? serverProviderApiFactory = + ApiFactoryCreator.createServerProviderApiFactory( ServerProvider.hetzner, // TODO: HARDCODE FOR NOW!!! ); // TODO: Remove when provider selection is implemented. - DnsProviderApiFactory? dnsProviderApiFactory = ApiFactoryCreator.createDnsProviderApiFactory( + DnsProviderApiFactory? dnsProviderApiFactory = + ApiFactoryCreator.createDnsProviderApiFactory( DnsProvider.cloudflare, // TODO: HARDCODE FOR NOW!!! ); @@ -51,11 +53,15 @@ class ServerInstallationRepository { final String? providerApiToken = getIt().hetznerKey; final String? cloudflareToken = getIt().cloudFlareKey; final ServerDomain? serverDomain = getIt().serverDomain; - final BackblazeCredential? backblazeCredential = getIt().backblazeCredential; - final ServerHostingDetails? serverDetails = getIt().serverDetails; + final BackblazeCredential? backblazeCredential = + getIt().backblazeCredential; + final ServerHostingDetails? serverDetails = + getIt().serverDetails; - if (serverDetails != null && serverDetails.provider != ServerProvider.unknown) { - serverProviderApiFactory = ApiFactoryCreator.createServerProviderApiFactory( + if (serverDetails != null && + serverDetails.provider != ServerProvider.unknown) { + serverProviderApiFactory = + ApiFactoryCreator.createServerProviderApiFactory( serverDetails.provider, ); } @@ -75,12 +81,15 @@ class ServerInstallationRepository { serverDetails: serverDetails!, rootUser: box.get(BNames.rootUser), isServerStarted: box.get(BNames.isServerStarted, defaultValue: false), - isServerResetedFirstTime: box.get(BNames.isServerResetedFirstTime, defaultValue: false), - isServerResetedSecondTime: box.get(BNames.isServerResetedSecondTime, defaultValue: false), + isServerResetedFirstTime: + box.get(BNames.isServerResetedFirstTime, defaultValue: false), + isServerResetedSecondTime: + box.get(BNames.isServerResetedSecondTime, defaultValue: false), ); } - if (box.get(BNames.isRecoveringServer, defaultValue: false) && serverDomain != null) { + if (box.get(BNames.isRecoveringServer, defaultValue: false) && + serverDomain != null) { return ServerInstallationRecovery( providerApiToken: providerApiToken, cloudFlareKey: cloudflareToken, @@ -106,8 +115,10 @@ class ServerInstallationRepository { serverDetails: serverDetails, rootUser: box.get(BNames.rootUser), isServerStarted: box.get(BNames.isServerStarted, defaultValue: false), - isServerResetedFirstTime: box.get(BNames.isServerResetedFirstTime, defaultValue: false), - isServerResetedSecondTime: box.get(BNames.isServerResetedSecondTime, defaultValue: false), + isServerResetedFirstTime: + box.get(BNames.isServerResetedFirstTime, defaultValue: false), + isServerResetedSecondTime: + box.get(BNames.isServerResetedSecondTime, defaultValue: false), isLoading: box.get(BNames.isLoading, defaultValue: false), dnsMatches: null, ); @@ -171,7 +182,13 @@ class ServerInstallationRepository { final String? ip4, final Map skippedMatches, ) async { - final List addresses = ['$domainName', 'api.$domainName', 'cloud.$domainName', 'meet.$domainName', 'password.$domainName']; + final List addresses = [ + '$domainName', + 'api.$domainName', + 'cloud.$domainName', + 'meet.$domainName', + 'password.$domainName' + ]; final Map matches = {}; @@ -187,15 +204,19 @@ class ServerInstallationRepository { ); getIt.get().addMessage( Message( - text: 'DnsLookup: address: $address, $RRecordType, provider: CLOUDFLARE, ip4: $ip4', + 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')}', + text: + 'DnsLookup: ${lookupRecordRes == null ? 'empty' : (lookupRecordRes[0].data != ip4 ? 'wrong ip4' : 'right ip4')}', ), ); - if (lookupRecordRes == null || lookupRecordRes.isEmpty || lookupRecordRes[0].data != ip4) { + if (lookupRecordRes == null || + lookupRecordRes.isEmpty || + lookupRecordRes[0].data != ip4) { matches[address] = false; } else { matches[address] = true; @@ -211,7 +232,8 @@ class ServerInstallationRepository { final String cloudFlareKey, final BackblazeCredential backblazeCredential, { required final void Function() onCancel, - required final Future Function(ServerHostingDetails serverDetails) onSuccess, + required final Future Function(ServerHostingDetails serverDetails) + onSuccess, }) async { final ServerProviderApi api = serverProviderApiFactory!.getServerProvider(); try { @@ -315,8 +337,10 @@ class ServerInstallationRepository { final ServerDomain domain, { required final void Function() onCancel, }) async { - final DnsProviderApi dnsProviderApi = dnsProviderApiFactory!.getDnsProvider(); - final ServerProviderApi serverApi = serverProviderApiFactory!.getServerProvider(); + final DnsProviderApi dnsProviderApi = + dnsProviderApiFactory!.getDnsProvider(); + final ServerProviderApi serverApi = + serverProviderApiFactory!.getServerProvider(); await dnsProviderApi.removeSimilarRecords( ip4: serverDetails.ip4, @@ -332,7 +356,9 @@ class ServerInstallationRepository { final NavigationService nav = getIt.get(); nav.showPopUpDialog( BrandAlert( - title: e.response!.data['errors'][0]['code'] == 1038 ? 'modals.10'.tr() : 'providers.domain.states.error'.tr(), + title: e.response!.data['errors'][0]['code'] == 1038 + ? 'modals.10'.tr() + : 'providers.domain.states.error'.tr(), contentText: 'modals.6'.tr(), actions: [ ActionButton( @@ -365,7 +391,8 @@ class ServerInstallationRepository { } Future createDkimRecord(final ServerDomain cloudFlareDomain) async { - final DnsProviderApi dnsProviderApi = dnsProviderApiFactory!.getDnsProvider(); + final DnsProviderApi dnsProviderApi = + dnsProviderApiFactory!.getDnsProvider(); final ServerApi api = ServerApi(); String dkimRecordString = ''; @@ -432,25 +459,31 @@ class ServerInstallationRepository { final DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); if (kIsWeb) { return deviceInfo.webBrowserInfo.then( - (final WebBrowserInfo value) => '${value.browserName} ${value.platform}', + (final WebBrowserInfo value) => + '${value.browserName} ${value.platform}', ); } else { if (Platform.isAndroid) { return deviceInfo.androidInfo.then( - (final AndroidDeviceInfo value) => '${value.model} ${value.version.release}', + (final AndroidDeviceInfo value) => + '${value.model} ${value.version.release}', ); } else if (Platform.isIOS) { return deviceInfo.iosInfo.then( - (final IosDeviceInfo value) => '${value.utsname.machine} ${value.systemName} ${value.systemVersion}', + (final IosDeviceInfo value) => + '${value.utsname.machine} ${value.systemName} ${value.systemVersion}', ); } else if (Platform.isLinux) { - return deviceInfo.linuxInfo.then((final LinuxDeviceInfo value) => value.prettyName); + return deviceInfo.linuxInfo + .then((final LinuxDeviceInfo value) => value.prettyName); } else if (Platform.isMacOS) { return deviceInfo.macOsInfo.then( - (final MacOsDeviceInfo value) => '${value.hostName} ${value.computerName}', + (final MacOsDeviceInfo value) => + '${value.hostName} ${value.computerName}', ); } else if (Platform.isWindows) { - return deviceInfo.windowsInfo.then((final WindowsDeviceInfo value) => value.computerName); + return deviceInfo.windowsInfo + .then((final WindowsDeviceInfo value) => value.computerName); } } return 'Unidentified'; @@ -542,7 +575,8 @@ class ServerInstallationRepository { ); final String serverIp = await getServerIpFromDomain(serverDomain); if (recoveryCapabilities == ServerRecoveryCapabilities.legacy) { - final Map apiResponse = await serverApi.servicesPowerCheck(); + final Map apiResponse = + await serverApi.servicesPowerCheck(); if (apiResponse.isNotEmpty) { return ServerHostingDetails( apiToken: apiToken, @@ -565,7 +599,8 @@ class ServerInstallationRepository { ); } } - final ApiResponse deviceAuthKey = await serverApi.createDeviceToken(); + final ApiResponse deviceAuthKey = + await serverApi.createDeviceToken(); final ApiResponse apiResponse = await serverApi.authorizeDevice( DeviceToken(device: await getDeviceName(), token: deviceAuthKey.data), ); @@ -604,7 +639,8 @@ class ServerInstallationRepository { ); final String? serverApiVersion = await serverApi.getApiVersion(); - final ApiResponse> users = await serverApi.getUsersList(withMainUser: true); + final ApiResponse> users = + await serverApi.getUsersList(withMainUser: true); if (serverApiVersion == null || !users.isSuccess) { return fallbackUser; } @@ -704,7 +740,8 @@ class ServerInstallationRepository { Future deleteServer(final ServerDomain serverDomain) async { final ServerProviderApi api = serverProviderApiFactory!.getServerProvider(); - final DnsProviderApi dnsProviderApi = dnsProviderApiFactory!.getDnsProvider(); + final DnsProviderApi dnsProviderApi = + dnsProviderApiFactory!.getDnsProvider(); await api.deleteServer( domainName: serverDomain.domainName, diff --git a/lib/logic/cubit/services/services_state.dart b/lib/logic/cubit/services/services_state.dart index 353786c2..752347c2 100644 --- a/lib/logic/cubit/services/services_state.dart +++ b/lib/logic/cubit/services/services_state.dart @@ -8,14 +8,30 @@ class ServicesState extends ServerInstallationDependendState { const ServicesState.empty() : this(services: const []); final List services; - bool get isPasswordManagerEnable => services.firstWhere((final service) => service.id == 'bitwarden', orElse: () => Service.empty).isEnabled; - bool get isCloudEnable => services.firstWhere((final service) => service.id == 'nextcloud', orElse: () => Service.empty).isEnabled; - bool get isGitEnable => services.firstWhere((final service) => service.id == 'gitea', orElse: () => Service.empty).isEnabled; - bool get isSocialNetworkEnable => services.firstWhere((final service) => service.id == 'pleroma', orElse: () => Service.empty).isEnabled; - bool get isVpnEnable => services.firstWhere((final service) => service.id == 'ocserv', orElse: () => Service.empty).isEnabled; + bool get isPasswordManagerEnable => services + .firstWhere((final service) => service.id == 'bitwarden', + orElse: () => Service.empty) + .isEnabled; + bool get isCloudEnable => services + .firstWhere((final service) => service.id == 'nextcloud', + orElse: () => Service.empty) + .isEnabled; + bool get isGitEnable => services + .firstWhere((final service) => service.id == 'gitea', + orElse: () => Service.empty) + .isEnabled; + bool get isSocialNetworkEnable => services + .firstWhere((final service) => service.id == 'pleroma', + orElse: () => Service.empty) + .isEnabled; + bool get isVpnEnable => services + .firstWhere((final service) => service.id == 'ocserv', + orElse: () => Service.empty) + .isEnabled; Service? getServiceById(final String id) { - final service = services.firstWhere((final service) => service.id == id, orElse: () => Service.empty); + final service = services.firstWhere((final service) => service.id == id, + orElse: () => Service.empty); if (service.id == 'empty') { return null; } diff --git a/lib/logic/cubit/users/users_cubit.dart b/lib/logic/cubit/users/users_cubit.dart index 442b2ed8..c9f8e804 100644 --- a/lib/logic/cubit/users/users_cubit.dart +++ b/lib/logic/cubit/users/users_cubit.dart @@ -55,25 +55,30 @@ class UsersCubit extends ServerInstallationDependendCubit { box.clear(); box.addAll(usersFromServer); } else { - getIt().showSnackBar('users.could_not_fetch_users'.tr()); + getIt() + .showSnackBar('users.could_not_fetch_users'.tr()); } } Future createUser(final User user) async { // If user exists on server, do nothing - if (state.users.any((final User u) => u.login == user.login && u.isFoundOnServer)) { + if (state.users + .any((final User u) => u.login == user.login && u.isFoundOnServer)) { return; } final String? password = user.password; if (password == null) { - getIt().showSnackBar('users.could_not_create_user'.tr()); + getIt() + .showSnackBar('users.could_not_create_user'.tr()); return; } // If API returned error, do nothing - final UserMutationResult result = await api.createUser(user.login, password); + final UserMutationResult result = + await api.createUser(user.login, password); final User? createdUser = result.user; if (!result.success || createdUser == null) { - getIt().showSnackBar(result.message ?? 'users.could_not_create_user'.tr()); + getIt() + .showSnackBar(result.message ?? 'users.could_not_create_user'.tr()); return; } @@ -87,7 +92,8 @@ class UsersCubit extends ServerInstallationDependendCubit { Future deleteUser(final User user) async { // If user is primary or root, don't delete if (user.type != UserType.normal) { - getIt().showSnackBar('users.could_not_delete_user'.tr()); + getIt() + .showSnackBar('users.could_not_delete_user'.tr()); return; } final List loadedUsers = List.from(state.users); @@ -98,23 +104,29 @@ class UsersCubit extends ServerInstallationDependendCubit { await box.addAll(loadedUsers); emit(state.copyWith(users: loadedUsers)); } else { - getIt().showSnackBar(result.message ?? 'users.could_not_delete_user'.tr()); + getIt() + .showSnackBar(result.message ?? 'users.could_not_delete_user'.tr()); } } - Future changeUserPassword(final User user, final String newPassword) async { + Future changeUserPassword( + final User user, final String newPassword) async { if (user.type == UserType.root) { - getIt().showSnackBar('users.could_not_change_password'.tr()); + getIt() + .showSnackBar('users.could_not_change_password'.tr()); return; } - final UserMutationResult result = await api.updateUser(user.login, newPassword); + final UserMutationResult result = + await api.updateUser(user.login, newPassword); if (!result.success) { - getIt().showSnackBar(result.message ?? 'users.could_not_change_password'.tr()); + getIt().showSnackBar( + result.message ?? 'users.could_not_change_password'.tr()); } } Future addSshKey(final User user, final String publicKey) async { - final UserMutationResult result = await api.addSshKey(user.login, publicKey); + final UserMutationResult result = + await api.addSshKey(user.login, publicKey); if (result.success) { final User updatedUser = result.user!; await box.putAt(box.values.toList().indexOf(user), updatedUser); @@ -124,12 +136,14 @@ class UsersCubit extends ServerInstallationDependendCubit { ), ); } else { - getIt().showSnackBar(result.message ?? 'users.could_not_add_ssh_key'.tr()); + getIt() + .showSnackBar(result.message ?? 'users.could_not_add_ssh_key'.tr()); } } Future deleteSshKey(final User user, final String publicKey) async { - final UserMutationResult result = await api.removeSshKey(user.login, publicKey); + final UserMutationResult result = + await api.removeSshKey(user.login, publicKey); if (result.success) { final User updatedUser = result.user!; await box.putAt(box.values.toList().indexOf(user), updatedUser); diff --git a/lib/logic/cubit/users/users_state.dart b/lib/logic/cubit/users/users_state.dart index 41227447..1065afc0 100644 --- a/lib/logic/cubit/users/users_state.dart +++ b/lib/logic/cubit/users/users_state.dart @@ -5,11 +5,14 @@ class UsersState extends ServerInstallationDependendState { final List users; - User get rootUser => users.firstWhere((final user) => user.type == UserType.root); + User get rootUser => + users.firstWhere((final user) => user.type == UserType.root); - User get primaryUser => users.firstWhere((final user) => user.type == UserType.primary); + User get primaryUser => + users.firstWhere((final user) => user.type == UserType.primary); - List get normalUsers => users.where((final user) => user.type == UserType.normal).toList(); + List get normalUsers => + users.where((final user) => user.type == UserType.normal).toList(); @override List get props => [users]; @@ -21,7 +24,8 @@ class UsersState extends ServerInstallationDependendState { users ?? this.users, ); - bool isLoginRegistered(final String login) => users.any((final User user) => user.login == login); + bool isLoginRegistered(final String login) => + users.any((final User user) => user.login == login); bool get isEmpty => users.isEmpty; } diff --git a/lib/logic/models/hive/user.dart b/lib/logic/models/hive/user.dart index 042b2485..48c121b7 100644 --- a/lib/logic/models/hive/user.dart +++ b/lib/logic/models/hive/user.dart @@ -51,7 +51,8 @@ class User extends Equatable { Color get color => stringToColor(login); @override - String toString() => '$login, ${isFoundOnServer ? 'found' : 'not found'}, ${sshKeys.length} ssh keys, note: $note'; + String toString() => + '$login, ${isFoundOnServer ? 'found' : 'not found'}, ${sshKeys.length} ssh keys, note: $note'; } @HiveType(typeId: 102) diff --git a/lib/logic/models/hive/user.g.dart b/lib/logic/models/hive/user.g.dart index 8076f3bb..8f5b7b20 100644 --- a/lib/logic/models/hive/user.g.dart +++ b/lib/logic/models/hive/user.g.dart @@ -48,7 +48,11 @@ class UserAdapter extends TypeAdapter { int get hashCode => typeId.hashCode; @override - bool operator ==(Object other) => identical(this, other) || other is UserAdapter && runtimeType == other.runtimeType && typeId == other.typeId; + bool operator ==(Object other) => + identical(this, other) || + other is UserAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; } class UserTypeAdapter extends TypeAdapter { @@ -88,5 +92,9 @@ class UserTypeAdapter extends TypeAdapter { int get hashCode => typeId.hashCode; @override - bool operator ==(Object other) => identical(this, other) || other is UserTypeAdapter && runtimeType == other.runtimeType && typeId == other.typeId; + bool operator ==(Object other) => + identical(this, other) || + other is UserTypeAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; } diff --git a/lib/ui/components/brand_cards/brand_cards.dart b/lib/ui/components/brand_cards/brand_cards.dart index f3273e7a..91737885 100644 --- a/lib/ui/components/brand_cards/brand_cards.dart +++ b/lib/ui/components/brand_cards/brand_cards.dart @@ -96,10 +96,11 @@ class _FilledCard extends StatelessWidget { borderRadius: BorderRadius.all(Radius.circular(12)), ), clipBehavior: Clip.antiAlias, - color: error ? Theme.of(context).colorScheme.errorContainer + color: error + ? Theme.of(context).colorScheme.errorContainer : tertiary - ? Theme.of(context).colorScheme.tertiaryContainer - : Theme.of(context).colorScheme.surfaceVariant, + ? Theme.of(context).colorScheme.tertiaryContainer + : Theme.of(context).colorScheme.surfaceVariant, child: child, ); } From 5ee1dec6b5dc0f24f6778001185afb0e6f45acb5 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 5 Sep 2022 08:21:16 +0300 Subject: [PATCH 046/115] Fix Job adapter runtime error --- lib/config/hive_config.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/config/hive_config.dart b/lib/config/hive_config.dart index 03355311..29ab0519 100644 --- a/lib/config/hive_config.dart +++ b/lib/config/hive_config.dart @@ -21,6 +21,7 @@ class HiveConfig { Hive.registerAdapter(DnsProviderAdapter()); Hive.registerAdapter(ServerProviderAdapter()); + Hive.registerAdapter(UserTypeAdapter()); await Hive.openBox(BNames.appSettingsBox); From 5f58022d423aa5cb2223321e5113b052efeb7c05 Mon Sep 17 00:00:00 2001 From: inexcode Date: Mon, 5 Sep 2022 14:51:01 +0400 Subject: [PATCH 047/115] Update user list screen to properly support newer cubit logic --- assets/translations/en.json | 2 + .../graphql_maps/server_api/users_api.dart | 1 - lib/logic/cubit/services/services_state.dart | 36 ++++++++++----- lib/logic/cubit/users/users_cubit.dart | 15 +++++- lib/logic/cubit/users/users_state.dart | 7 ++- lib/ui/pages/users/empty.dart | 32 +++++++++++++ lib/ui/pages/users/users.dart | 46 +++++++++++++++++-- 7 files changed, 118 insertions(+), 21 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index 5e813da5..b68c6b82 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -283,6 +283,8 @@ "account": "Account", "send_registration_data": "Share login credentials", "could_not_fetch_users": "Couldn't fetch users list", + "could_not_fetch_description": "Please check your internet connection and try again", + "refresh_users": "Refresh users list", "could_not_create_user": "Couldn't create user", "could_not_delete_user": "Couldn't delete user", "could_not_add_ssh_key": "Couldn't add SSH key" 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 359967b7..be7d4fb0 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 @@ -31,7 +31,6 @@ mixin UsersApi on ApiMap { } } catch (e) { print(e); - print("Could not"); } return users; } diff --git a/lib/logic/cubit/services/services_state.dart b/lib/logic/cubit/services/services_state.dart index 752347c2..07b82e45 100644 --- a/lib/logic/cubit/services/services_state.dart +++ b/lib/logic/cubit/services/services_state.dart @@ -9,29 +9,41 @@ class ServicesState extends ServerInstallationDependendState { final List services; bool get isPasswordManagerEnable => services - .firstWhere((final service) => service.id == 'bitwarden', - orElse: () => Service.empty) + .firstWhere( + (final service) => service.id == 'bitwarden', + orElse: () => Service.empty, + ) .isEnabled; bool get isCloudEnable => services - .firstWhere((final service) => service.id == 'nextcloud', - orElse: () => Service.empty) + .firstWhere( + (final service) => service.id == 'nextcloud', + orElse: () => Service.empty, + ) .isEnabled; bool get isGitEnable => services - .firstWhere((final service) => service.id == 'gitea', - orElse: () => Service.empty) + .firstWhere( + (final service) => service.id == 'gitea', + orElse: () => Service.empty, + ) .isEnabled; bool get isSocialNetworkEnable => services - .firstWhere((final service) => service.id == 'pleroma', - orElse: () => Service.empty) + .firstWhere( + (final service) => service.id == 'pleroma', + orElse: () => Service.empty, + ) .isEnabled; bool get isVpnEnable => services - .firstWhere((final service) => service.id == 'ocserv', - orElse: () => Service.empty) + .firstWhere( + (final service) => service.id == 'ocserv', + orElse: () => Service.empty, + ) .isEnabled; Service? getServiceById(final String id) { - final service = services.firstWhere((final service) => service.id == id, - orElse: () => Service.empty); + final service = services.firstWhere( + (final service) => service.id == id, + orElse: () => Service.empty, + ); if (service.id == 'empty') { return null; } diff --git a/lib/logic/cubit/users/users_cubit.dart b/lib/logic/cubit/users/users_cubit.dart index c9f8e804..1ff0e9a3 100644 --- a/lib/logic/cubit/users/users_cubit.dart +++ b/lib/logic/cubit/users/users_cubit.dart @@ -16,6 +16,7 @@ class UsersCubit extends ServerInstallationDependendCubit { serverInstallationCubit, const UsersState( [], + false, ), ); Box box = Hive.box(BNames.usersBox); @@ -33,6 +34,7 @@ class UsersCubit extends ServerInstallationDependendCubit { emit( UsersState( loadedUsers, + false, ), ); } @@ -44,11 +46,15 @@ class UsersCubit extends ServerInstallationDependendCubit { if (serverInstallationCubit.state is! ServerInstallationFinished) { return; } + emit(state.copyWith(isLoading: true)); + // sleep for 10 seconds to simulate a slow connection + await Future.delayed(const Duration(seconds: 10)); final List usersFromServer = await api.getAllUsers(); if (usersFromServer.isNotEmpty) { emit( UsersState( usersFromServer, + false, ), ); // Update the users it the box @@ -57,6 +63,7 @@ class UsersCubit extends ServerInstallationDependendCubit { } else { getIt() .showSnackBar('users.could_not_fetch_users'.tr()); + emit(state.copyWith(isLoading: false)); } } @@ -110,7 +117,9 @@ class UsersCubit extends ServerInstallationDependendCubit { } Future changeUserPassword( - final User user, final String newPassword) async { + final User user, + final String newPassword, + ) async { if (user.type == UserType.root) { getIt() .showSnackBar('users.could_not_change_password'.tr()); @@ -120,7 +129,8 @@ class UsersCubit extends ServerInstallationDependendCubit { await api.updateUser(user.login, newPassword); if (!result.success) { getIt().showSnackBar( - result.message ?? 'users.could_not_change_password'.tr()); + result.message ?? 'users.could_not_change_password'.tr(), + ); } } @@ -160,6 +170,7 @@ class UsersCubit extends ServerInstallationDependendCubit { emit( const UsersState( [], + false, ), ); } diff --git a/lib/logic/cubit/users/users_state.dart b/lib/logic/cubit/users/users_state.dart index 1065afc0..dbd931d7 100644 --- a/lib/logic/cubit/users/users_state.dart +++ b/lib/logic/cubit/users/users_state.dart @@ -1,9 +1,10 @@ part of 'users_cubit.dart'; class UsersState extends ServerInstallationDependendState { - const UsersState(this.users); + const UsersState(this.users, this.isLoading); final List users; + final bool isLoading; User get rootUser => users.firstWhere((final user) => user.type == UserType.root); @@ -15,13 +16,15 @@ class UsersState extends ServerInstallationDependendState { users.where((final user) => user.type == UserType.normal).toList(); @override - List get props => [users]; + List get props => [users, isLoading]; UsersState copyWith({ final List? users, + final bool? isLoading, }) => UsersState( users ?? this.users, + isLoading ?? this.isLoading, ); bool isLoginRegistered(final String login) => diff --git a/lib/ui/pages/users/empty.dart b/lib/ui/pages/users/empty.dart index 847003d3..dc2d292b 100644 --- a/lib/ui/pages/users/empty.dart +++ b/lib/ui/pages/users/empty.dart @@ -31,3 +31,35 @@ class _NoUsers extends StatelessWidget { ), ); } + +class _CouldNotLoadUsers extends StatelessWidget { + const _CouldNotLoadUsers({required this.text}); + + final String text; + + @override + Widget build(final BuildContext context) => Padding( + padding: const EdgeInsets.symmetric(horizontal: 20), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Icon(BrandIcons.users, size: 50, color: BrandColors.grey7), + const SizedBox(height: 20), + BrandText.h2( + 'users.could_not_fetch_users'.tr(), + style: const TextStyle( + color: BrandColors.grey7, + ), + ), + const SizedBox(height: 10), + BrandText.medium( + text, + textAlign: TextAlign.center, + style: const TextStyle( + color: BrandColors.grey7, + ), + ), + ], + ), + ); +} diff --git a/lib/ui/pages/users/users.dart b/lib/ui/pages/users/users.dart index 3ccb696a..fb526970 100644 --- a/lib/ui/pages/users/users.dart +++ b/lib/ui/pages/users/users.dart @@ -14,6 +14,7 @@ import 'package:selfprivacy/logic/models/job.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart'; import 'package:selfprivacy/ui/components/brand_button/brand_button.dart'; +import 'package:selfprivacy/ui/components/brand_button/outlined_button.dart'; import 'package:selfprivacy/ui/components/brand_divider/brand_divider.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart'; @@ -46,10 +47,47 @@ class UsersPage extends StatelessWidget { } else { child = BlocBuilder( builder: (final BuildContext context, final UsersState state) { - print('Rebuild users page'); - final primaryUser = state.primaryUser; - final users = [primaryUser, ...state.users]; + final List users = state.users + .where((final user) => user.type != UserType.root) + .toList(); + // final List users = []; + users.sort( + (final User a, final User b) => + a.login.toLowerCase().compareTo(b.login.toLowerCase()), + ); + if (users.isEmpty) { + if (state.isLoading) { + return const Center( + child: CircularProgressIndicator(), + ); + } + return RefreshIndicator( + onRefresh: () async { + context.read().refresh(); + }, + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 15), + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + _CouldNotLoadUsers( + text: 'users.could_not_fetch_description'.tr(), + ), + const SizedBox(height: 18), + BrandOutlinedButton( + onPressed: () { + context.read().refresh(); + }, + title: 'users.refresh_users'.tr(), + ), + ], + ), + ), + ), + ); + } return RefreshIndicator( onRefresh: () async { context.read().refresh(); @@ -59,7 +97,7 @@ class UsersPage extends StatelessWidget { itemBuilder: (final BuildContext context, final int index) => _User( user: users[index], - isRootUser: index == 0, + isRootUser: users[index].type == UserType.primary, ), ), ); From 979e8ee37a22d6bfbc24f36e9c9c401eca3998fa Mon Sep 17 00:00:00 2001 From: inexcode Date: Mon, 5 Sep 2022 16:12:00 +0400 Subject: [PATCH 048/115] New user screen UI --- assets/translations/en.json | 5 +- lib/ui/pages/ssh_keys/new_ssh_key.dart | 4 +- lib/ui/pages/ssh_keys/ssh_keys.dart | 2 +- lib/ui/pages/users/user.dart | 6 +- lib/ui/pages/users/user_details.dart | 343 +++++++++++++------------ lib/ui/pages/users/users.dart | 7 +- 6 files changed, 189 insertions(+), 178 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index b68c6b82..501efaff 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -272,6 +272,7 @@ "_comment": "'Users' tab", "add_new_user": "Add a first user", "new_user": "New user", + "delete_user": "Delete user", "not_ready": "Please connect server, domain and DNS in the Providers tab, to be able to add a first user", "nobody_here": "Nobody here", "login": "Login", @@ -287,7 +288,9 @@ "refresh_users": "Refresh users list", "could_not_create_user": "Couldn't create user", "could_not_delete_user": "Couldn't delete user", - "could_not_add_ssh_key": "Couldn't add SSH key" + "could_not_add_ssh_key": "Couldn't add SSH key", + "email_login": "Email login", + "no_sso_notice": "Only email and SSH accounts are created for this user. Single Sign On for all services is coming soon." }, "initializing": { "_comment": "initializing page", diff --git a/lib/ui/pages/ssh_keys/new_ssh_key.dart b/lib/ui/pages/ssh_keys/new_ssh_key.dart index fc558be2..042707ef 100644 --- a/lib/ui/pages/ssh_keys/new_ssh_key.dart +++ b/lib/ui/pages/ssh_keys/new_ssh_key.dart @@ -1,7 +1,7 @@ part of 'ssh_keys.dart'; -class _NewSshKey extends StatelessWidget { - const _NewSshKey(this.user); +class NewSshKey extends StatelessWidget { + const NewSshKey(this.user, {final super.key}); final User user; @override diff --git a/lib/ui/pages/ssh_keys/ssh_keys.dart b/lib/ui/pages/ssh_keys/ssh_keys.dart index 64c1af9c..4bc48e8a 100644 --- a/lib/ui/pages/ssh_keys/ssh_keys.dart +++ b/lib/ui/pages/ssh_keys/ssh_keys.dart @@ -65,7 +65,7 @@ class _SshKeysPageState extends State { backgroundColor: Colors.transparent, builder: (final BuildContext context) => Padding( padding: MediaQuery.of(context).viewInsets, - child: _NewSshKey(widget.user), + child: NewSshKey(widget.user), ), ); }, diff --git a/lib/ui/pages/users/user.dart b/lib/ui/pages/users/user.dart index 69a2e5dc..1602427d 100644 --- a/lib/ui/pages/users/user.dart +++ b/lib/ui/pages/users/user.dart @@ -11,10 +11,8 @@ class _User extends StatelessWidget { @override Widget build(final BuildContext context) => InkWell( onTap: () { - showBrandBottomSheet( - context: context, - builder: (final BuildContext context) => - _UserDetails(user: user, isRootUser: isRootUser), + Navigator.of(context).push( + materialRoute(_UserDetails(user: user, isRootUser: isRootUser)), ); }, child: Container( diff --git a/lib/ui/pages/users/user_details.dart b/lib/ui/pages/users/user_details.dart index d758c1f4..0bfbce8c 100644 --- a/lib/ui/pages/users/user_details.dart +++ b/lib/ui/pages/users/user_details.dart @@ -15,179 +15,192 @@ class _UserDetails extends StatelessWidget { final String domainName = UiHelpers.getDomainName(config); - return BrandBottomSheet( - isExpended: true, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Container( - height: 200, - decoration: BoxDecoration( - color: user.color, - borderRadius: const BorderRadius.vertical( - top: Radius.circular(20), + return BrandHeroScreen( + hasBackButton: true, + heroTitle: user.login, + children: [ + BrandCards.filled( + child: Column( + children: [ + ListTile( + title: Text('${user.login}@$domainName'), + subtitle: Text('users.email_login'.tr()), + textColor: Theme.of(context).colorScheme.onSurfaceVariant, + leading: const Icon(Icons.alternate_email_outlined), + iconColor: Theme.of(context).colorScheme.onSurfaceVariant, ), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - if (!isRootUser) - Align( - alignment: Alignment.centerRight, - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 4, - horizontal: 2, - ), - child: PopupMenuButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - onSelected: (final PopupMenuItemType result) { - switch (result) { - case PopupMenuItemType.delete: - showDialog( - context: context, - builder: (final BuildContext context) => - AlertDialog( - title: Text('basis.confirmation'.tr()), - content: SingleChildScrollView( - child: ListBody( - children: [ - Text( - 'users.delete_confirm_question'.tr(), - ), - ], - ), - ), - actions: [ - TextButton( - child: Text('basis.cancel'.tr()), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - TextButton( - child: Text( - 'basis.delete'.tr(), - style: const TextStyle( - color: BrandColors.red1, - ), - ), - onPressed: () { - context - .read() - .addJob(DeleteUserJob(user: user)); - Navigator.of(context) - ..pop() - ..pop(); - }, - ), - ], - ), - ); - break; - } - }, - icon: const Icon(Icons.more_vert), - itemBuilder: (final BuildContext context) => [ - PopupMenuItem( - value: PopupMenuItemType.delete, - child: Container( - padding: const EdgeInsets.only(left: 5), - child: Text( - 'basis.delete'.tr(), - style: const TextStyle(color: BrandColors.red1), - ), + ], + ), + ), + const SizedBox(height: 8), + BrandCards.filled( + child: Column( + children: [ + ListTile( + title: Text('ssh.title'.tr()), + textColor: Theme.of(context).colorScheme.onSurfaceVariant, + ), + const Divider(height: 0), + ListTile( + iconColor: Theme.of(context).colorScheme.onSurfaceVariant, + textColor: Theme.of(context).colorScheme.onSurfaceVariant, + title: Text( + 'ssh.create'.tr(), + ), + leading: const Icon(Icons.add_circle_outlined), + onTap: () { + showModalBottomSheet( + context: context, + isScrollControlled: true, + backgroundColor: Colors.transparent, + builder: (final BuildContext context) => Padding( + padding: MediaQuery.of(context).viewInsets, + child: NewSshKey(user), + ), + ); + }, + ), + Column( + children: user.sshKeys.map((final String key) { + final publicKey = + key.split(' ').length > 1 ? key.split(' ')[1] : key; + final keyType = key.split(' ')[0]; + final keyName = key.split(' ').length > 2 + ? key.split(' ')[2] + : 'ssh.no_key_name'.tr(); + return ListTile( + textColor: Theme.of(context).colorScheme.onSurfaceVariant, + title: Text('$keyName ($keyType)'), + // do not overflow text + subtitle: Text( + publicKey, + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + onTap: () { + showDialog( + context: context, + builder: (final BuildContext context) => AlertDialog( + title: Text('ssh.delete'.tr()), + content: SingleChildScrollView( + child: ListBody( + children: [ + Text('ssh.delete_confirm_question'.tr()), + Text('$keyName ($keyType)'), + Text(publicKey), + ], ), ), - ], - ), + actions: [ + TextButton( + child: Text('basis.cancel'.tr()), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + TextButton( + child: Text( + 'basis.delete'.tr(), + style: const TextStyle( + color: BrandColors.red1, + ), + ), + onPressed: () { + context.read().addJob( + DeleteSSHKeyJob( + user: user, + publicKey: key, + ), + ); + Navigator.of(context) + ..pop() + ..pop(); + }, + ), + ], + ), + ); + }, + ); + }).toList(), + ), + ], + ), + ), + const SizedBox(height: 8), + ListTile( + iconColor: Theme.of(context).colorScheme.onBackground, + onTap: () => {}, + leading: const Icon(Icons.lock_reset_outlined), + title: Text( + 'users.reset_password'.tr(), + ), + ), + if (!isRootUser) + ListTile( + iconColor: Theme.of(context).colorScheme.error, + textColor: Theme.of(context).colorScheme.error, + onTap: () => { + showDialog( + context: context, + builder: (final BuildContext context) => AlertDialog( + title: Text('basis.confirmation'.tr()), + content: SingleChildScrollView( + child: ListBody( + children: [ + Text( + 'users.delete_confirm_question'.tr(), + ), + ], ), ), - const Spacer(), - Padding( - padding: const EdgeInsets.symmetric( - vertical: 20, - horizontal: 15, - ), - child: AutoSizeText( - user.login, - style: headline1Style, - softWrap: true, - minFontSize: 9, - maxLines: 3, - overflow: TextOverflow.ellipsis, - ), + actions: [ + TextButton( + child: Text('basis.cancel'.tr()), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + TextButton( + child: Text( + 'basis.delete'.tr(), + style: const TextStyle( + color: BrandColors.red1, + ), + ), + onPressed: () { + context + .read() + .addJob(DeleteUserJob(user: user)); + Navigator.of(context) + ..pop() + ..pop(); + }, + ), + ], ), - ], + ) + }, + leading: const Icon(Icons.person_remove_outlined), + title: Text( + 'users.delete_user'.tr(), ), ), - const SizedBox(height: 20), - Padding( - padding: paddingH15V0.copyWith(bottom: 20), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - BrandText.small('users.account'.tr()), - Container( - height: 40, - alignment: Alignment.centerLeft, - child: BrandText.h4('${user.login}@$domainName'), - ), - if (user.password != null) - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const SizedBox(height: 14), - BrandText.small('basis.password'.tr()), - Container( - height: 40, - alignment: Alignment.centerLeft, - child: BrandText.h4(user.password), - ), - ], - ), - const SizedBox(height: 24), - const BrandDivider(), - const SizedBox(height: 20), - ListTile( - onTap: () { - Navigator.of(context) - .push(materialRoute(SshKeysPage(user: user))); - }, - title: Text('ssh.title'.tr()), - subtitle: user.sshKeys.isNotEmpty - ? Text( - 'ssh.subtitle_with_keys' - .tr(args: [user.sshKeys.length.toString()]), - ) - : Text('ssh.subtitle_without_keys'.tr()), - trailing: const Icon(BrandIcons.key), - ), - const SizedBox(height: 20), - ListTile( - onTap: () { - Share.share( - 'login: ${user.login}, password: ${user.password}', - ); - }, - title: Text( - 'users.send_registration_data'.tr(), - ), - trailing: const Icon(BrandIcons.share), - ), - ], - ), - ) - ], - ), + const Divider(height: 8), + Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Icon(Icons.warning_amber_outlined, size: 24), + const SizedBox(height: 16), + Text( + 'users.no_sso_notice'.tr(), + ), + ], + ), + ), + ], ); } } - -enum PopupMenuItemType { - // reset, - delete, -} diff --git a/lib/ui/pages/users/users.dart b/lib/ui/pages/users/users.dart index fb526970..9c215ef8 100644 --- a/lib/ui/pages/users/users.dart +++ b/lib/ui/pages/users/users.dart @@ -1,10 +1,8 @@ -import 'package:auto_size_text/auto_size_text.dart'; import 'package:cubit_form/cubit_form.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:selfprivacy/config/brand_colors.dart'; import 'package:selfprivacy/config/brand_theme.dart'; -import 'package:selfprivacy/config/text_themes.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/user/user_form_cubit.dart'; @@ -15,15 +13,14 @@ import 'package:selfprivacy/logic/models/hive/user.dart'; import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart'; import 'package:selfprivacy/ui/components/brand_button/brand_button.dart'; import 'package:selfprivacy/ui/components/brand_button/outlined_button.dart'; -import 'package:selfprivacy/ui/components/brand_divider/brand_divider.dart'; +import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.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/ui/components/brand_text/brand_text.dart'; import 'package:selfprivacy/ui/components/not_ready_card/not_ready_card.dart'; -import 'package:selfprivacy/ui/helpers/modals.dart'; import 'package:selfprivacy/ui/pages/ssh_keys/ssh_keys.dart'; import 'package:selfprivacy/utils/ui_helpers.dart'; -import 'package:share_plus/share_plus.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; From 58479256c53bfacacab9a0bc4b886bf7363679d4 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Tue, 6 Sep 2022 12:17:44 +0300 Subject: [PATCH 049/115] Refactor disk_size.dart and disk_status.dart to use getters --- lib/logic/models/disk_size.dart | 12 ++++---- lib/ui/pages/server_storage/disk_status.dart | 28 ++++++------------- .../server_storage/extending_volume.dart | 8 +++--- 3 files changed, 18 insertions(+), 30 deletions(-) diff --git a/lib/logic/models/disk_size.dart b/lib/logic/models/disk_size.dart index ecccb2b8..30d16455 100644 --- a/lib/logic/models/disk_size.dart +++ b/lib/logic/models/disk_size.dart @@ -5,20 +5,20 @@ class DiskSize { int byte; - double asKb() => byte / 1024.0; - double asMb() => byte / 1024.0 / 1024.0; - double asGb() => byte / 1024.0 / 1024.0 / 1024.0; + double get kibibyte => byte / 1024.0; + double get mebibyte => byte / 1024.0 / 1024.0; + double get gibibyte => byte / 1024.0 / 1024.0 / 1024.0; @override String toString() { if (byte < 1024) { return '${byte.toStringAsFixed(0)} ${tr('bytes')}'; } else if (byte < 1024 * 1024) { - return 'providers.storage.kb'.tr(args: [asKb().toStringAsFixed(1)]); + return 'providers.storage.kb'.tr(args: [kibibyte.toStringAsFixed(1)]); } else if (byte < 1024 * 1024 * 1024) { - return 'providers.storage.mb'.tr(args: [asMb().toStringAsFixed(1)]); + return 'providers.storage.mb'.tr(args: [mebibyte.toStringAsFixed(1)]); } else { - return 'providers.storage.gb'.tr(args: [asGb().toStringAsFixed(1)]); + return 'providers.storage.gb'.tr(args: [gibibyte.toStringAsFixed(1)]); } } } diff --git a/lib/ui/pages/server_storage/disk_status.dart b/lib/ui/pages/server_storage/disk_status.dart index 4c9949e0..eae9596a 100644 --- a/lib/ui/pages/server_storage/disk_status.dart +++ b/lib/ui/pages/server_storage/disk_status.dart @@ -12,25 +12,16 @@ class DiskVolume { ServerVolume? providerVolume; /// from 0.0 to 1.0 - double percentage = 0.0; + double get percentage => sizeTotal.byte == 0 ? 0 : sizeUsed.byte / sizeTotal.byte; + bool get isDiskOkay => percentage < 0.8 && sizeTotal.gibibyte - sizeUsed.gibibyte > 2.0; } class DiskStatus { - DiskStatus() { - isDiskOkay = false; - diskVolumes = []; - } DiskStatus.fromVolumes( final List serverVolumes, final List providerVolumes, ) { - isDiskOkay = true; - - if (providerVolumes.isEmpty || serverVolumes.isEmpty) { - isDiskOkay = false; - } - diskVolumes = serverVolumes.map(( final ServerDiskVolume volume, ) { @@ -60,18 +51,15 @@ class DiskStatus { diskVolume.name = volume.name; diskVolume.root = volume.root; - diskVolume.percentage = - volume.usedSpace != 'None' && volume.totalSpace != 'None' - ? 1.0 / diskVolume.sizeTotal.byte * diskVolume.sizeUsed.byte - : 0.0; - if (diskVolume.percentage >= 0.8 || - diskVolume.sizeTotal.asGb() - diskVolume.sizeUsed.asGb() <= 2.0) { - isDiskOkay = false; - } + return diskVolume; }).toList(); } + DiskStatus() { + diskVolumes = []; + } + + bool get isDiskOkay => diskVolumes.every((final volume) => volume.isDiskOkay); - bool isDiskOkay = false; List diskVolumes = []; } diff --git a/lib/ui/pages/server_storage/extending_volume.dart b/lib/ui/pages/server_storage/extending_volume.dart index 72ef9607..7023685d 100644 --- a/lib/ui/pages/server_storage/extending_volume.dart +++ b/lib/ui/pages/server_storage/extending_volume.dart @@ -34,7 +34,7 @@ class _ExtendingVolumePageState extends State { final TextEditingController _priceController = TextEditingController(); void _updateErrorStatuses() { - _isError = minSize.asGb() > _currentSliderGbValue; + _isError = minSize.gibibyte > _currentSliderGbValue; } @override @@ -62,7 +62,7 @@ class _ExtendingVolumePageState extends State { .toStringAsFixed(2); minSize = widget.diskVolumeToResize.sizeTotal; if (_currentSliderGbValue < 0) { - _currentSliderGbValue = minSize.asGb(); + _currentSliderGbValue = minSize.gibibyte; } return BrandHeroScreen( @@ -111,9 +111,9 @@ class _ExtendingVolumePageState extends State { ), const SizedBox(height: 16), Slider( - min: minSize.asGb(), + min: minSize.gibibyte, value: _currentSliderGbValue, - max: maxSize.asGb(), + max: maxSize.gibibyte, onChanged: (final double value) { setState(() { _currentSliderGbValue = value; From 8d2fbb51003f252d6eb0d3389f0dd01666f7b50a Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 6 Sep 2022 13:25:28 +0300 Subject: [PATCH 050/115] Implement service page enabling/disabling and service restart --- assets/translations/en.json | 8 ++- assets/translations/ru.json | 6 +++ lib/logic/cubit/services/services_cubit.dart | 4 ++ lib/ui/pages/services/service_page.dart | 52 +++++++++++++++++--- 4 files changed, 63 insertions(+), 7 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index 501efaff..6a3317a1 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -192,8 +192,14 @@ "in_menu": "Server is not set up yet. Please finish setup using setup wizard for further work." }, "services": { - "_comment": "Вкладка сервисы", + "_comment": "Services", "title": "Your personal, private and independent services.", + "service_page": { + "restart": "Restart service", + "disable": "Disable service", + "enable": "Enable service", + "move": "Move to another volume" + }, "mail": { "title": "E-Mail", "subtitle": "E-Mail for company and family.", diff --git a/assets/translations/ru.json b/assets/translations/ru.json index 1ac780a9..abb9a2d6 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -194,6 +194,12 @@ "services": { "_comment": "Вкладка сервисы", "title": "Ваши личные, приватные и независимые сервисы:", + "service_page": { + "restart": "Перезапустить сервис", + "disable": "Выключить сервис", + "enable": "Включить сервис", + "move": "Переместить на другой диск" + }, "mail": { "title": "Почта", "subtitle": "Электронная почта для семьи или компании.", diff --git a/lib/logic/cubit/services/services_cubit.dart b/lib/logic/cubit/services/services_cubit.dart index 089d9638..c423fd9f 100644 --- a/lib/logic/cubit/services/services_cubit.dart +++ b/lib/logic/cubit/services/services_cubit.dart @@ -37,6 +37,10 @@ class ServicesCubit extends ServerInstallationDependendCubit { } } + Future restart(final String serviceId) async { + await api.restartService(serviceId); + } + @override void clear() async { emit(const ServicesState.empty()); diff --git a/lib/ui/pages/services/service_page.dart b/lib/ui/pages/services/service_page.dart index 75e7c7cf..d3dad443 100644 --- a/lib/ui/pages/services/service_page.dart +++ b/lib/ui/pages/services/service_page.dart @@ -1,7 +1,10 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; -import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; +import 'package:selfprivacy/logic/common_enum/common_enum.dart'; +import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart'; import 'package:selfprivacy/logic/cubit/services/services_cubit.dart'; +import 'package:selfprivacy/logic/models/job.dart'; import 'package:selfprivacy/logic/models/service.dart'; import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; @@ -32,6 +35,10 @@ class _ServicePageState extends State { ], ); } + + final bool serviceDisabled = service.status == ServiceStatus.inactive || + service.status == ServiceStatus.off; + return BrandHeroScreen( hasBackButton: true, children: [ @@ -73,19 +80,30 @@ class _ServicePageState extends State { const SizedBox(height: 8), ListTile( iconColor: Theme.of(context).colorScheme.onBackground, - onTap: () => {}, + onTap: () => { + context.read().restart(service.id), + }, leading: const Icon(Icons.restart_alt_outlined), title: Text( - 'Restart service', + 'services.service_page.restart'.tr(), style: Theme.of(context).textTheme.titleMedium, ), ), ListTile( iconColor: Theme.of(context).colorScheme.onBackground, - onTap: () => {}, + onTap: () => { + context.read().createOrRemoveServiceToggleJob( + ServiceToggleJob( + type: _idToLegacyType(service.id), + needToTurnOn: serviceDisabled, + ), + ), + }, leading: const Icon(Icons.power_settings_new), title: Text( - 'Disable service', + serviceDisabled + ? 'services.service_page.enable'.tr() + : 'services.service_page.disable'.tr(), style: Theme.of(context).textTheme.titleMedium, ), ), @@ -95,13 +113,35 @@ class _ServicePageState extends State { onTap: () => {}, leading: const Icon(Icons.drive_file_move_outlined), title: Text( - 'Move to another volume', + 'services.service_page.move'.tr(), style: Theme.of(context).textTheme.titleMedium, ), ), ], ); } + +// TODO: Get rid as soon as possible + ServiceTypes _idToLegacyType(final String serviceId) { + switch (serviceId) { + case 'mailserver': + return ServiceTypes.mailserver; + case 'jitsi': + return ServiceTypes.jitsi; + case 'bitwarden': + return ServiceTypes.bitwarden; + case 'nextcloud': + return ServiceTypes.nextcloud; + case 'pleroma': + return ServiceTypes.pleroma; + case 'gitea': + return ServiceTypes.gitea; + case 'ocserv': + return ServiceTypes.ocserv; + default: + throw Exception('wrong state'); + } + } } class ServiceStatusCard extends StatelessWidget { From 6f5ffa0f8033061bef8b16acfb88cca9640d371b Mon Sep 17 00:00:00 2001 From: Inex Code Date: Tue, 6 Sep 2022 13:27:18 +0300 Subject: [PATCH 051/115] Make DiskSize a constant constructor and fix slider on Volume resize screen --- .../provider_volume_cubit.dart | 3 +- lib/logic/models/disk_size.dart | 4 +- lib/logic/models/service.dart | 2 +- lib/ui/pages/server_storage/disk_status.dart | 81 ++++++++++++++----- .../server_storage/extending_volume.dart | 16 +++- 5 files changed, 76 insertions(+), 30 deletions(-) diff --git a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart index 84d8aee1..a4df4469 100644 --- a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart +++ b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart @@ -89,8 +89,7 @@ class ApiProviderVolumeCubit final ServerVolume? volume = await providerApi!.getVolumeProvider().createVolume(); - final diskVolume = DiskVolume(); - diskVolume.providerVolume = volume; + final diskVolume = DiskVolume(providerVolume: volume); await attachVolume(diskVolume); await Future.delayed(const Duration(seconds: 10)); diff --git a/lib/logic/models/disk_size.dart b/lib/logic/models/disk_size.dart index 30d16455..60c2d8a1 100644 --- a/lib/logic/models/disk_size.dart +++ b/lib/logic/models/disk_size.dart @@ -1,9 +1,9 @@ import 'package:easy_localization/easy_localization.dart'; class DiskSize { - DiskSize({final this.byte = 0}); + const DiskSize({final this.byte = 0}); - int byte; + final int byte; double get kibibyte => byte / 1024.0; double get mebibyte => byte / 1024.0 / 1024.0; diff --git a/lib/logic/models/service.dart b/lib/logic/models/service.dart index 1085622a..33475588 100644 --- a/lib/logic/models/service.dart +++ b/lib/logic/models/service.dart @@ -51,7 +51,7 @@ class Service { isMovable: false, status: ServiceStatus.off, storageUsage: ServiceStorageUsage( - used: DiskSize(byte: 0), + used: const DiskSize(byte: 0), volume: '', ), svgIcon: '', diff --git a/lib/ui/pages/server_storage/disk_status.dart b/lib/ui/pages/server_storage/disk_status.dart index eae9596a..dbc01c16 100644 --- a/lib/ui/pages/server_storage/disk_status.dart +++ b/lib/ui/pages/server_storage/disk_status.dart @@ -3,21 +3,65 @@ import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; class DiskVolume { - DiskSize sizeUsed = DiskSize(); - DiskSize sizeTotal = DiskSize(); - String name = ''; - bool root = false; - bool isResizable = true; + DiskVolume({ + this.name = '', + this.sizeTotal = const DiskSize(byte: 0), + this.sizeUsed = const DiskSize(byte: 0), + this.root = false, + this.isResizable = false, + this.serverDiskVolume, + this.providerVolume, + }); + + DiskVolume.fromServerDiscVolume( + final ServerDiskVolume volume, + final ServerVolume? providerVolume, + ) : this( + name: volume.name, + sizeTotal: DiskSize( + byte: + volume.totalSpace == 'None' ? 0 : int.parse(volume.totalSpace), + ), + sizeUsed: DiskSize( + byte: volume.usedSpace == 'None' ? 0 : int.parse(volume.usedSpace), + ), + root: volume.root, + isResizable: providerVolume != null, + serverDiskVolume: volume, + providerVolume: providerVolume, + ); + + /// Get the display name of the volume + /// + /// If it is sda1 and root the name is "System disk" + /// If there is a mapping to providerVolume, the name is "Expandable volume" + /// Otherwise the name is the name of the volume + String get displayName { + if (root) { + return 'System disk'; + } else if (providerVolume != null) { + return 'Expandable volume'; + } else { + return name; + } + } + + DiskSize sizeUsed; + DiskSize sizeTotal; + String name; + bool root; + bool isResizable; ServerDiskVolume? serverDiskVolume; ServerVolume? providerVolume; /// from 0.0 to 1.0 - double get percentage => sizeTotal.byte == 0 ? 0 : sizeUsed.byte / sizeTotal.byte; - bool get isDiskOkay => percentage < 0.8 && sizeTotal.gibibyte - sizeUsed.gibibyte > 2.0; + double get percentage => + sizeTotal.byte == 0 ? 0 : sizeUsed.byte / sizeTotal.byte; + bool get isDiskOkay => + percentage < 0.8 && sizeTotal.gibibyte - sizeUsed.gibibyte > 2.0; } class DiskStatus { - DiskStatus.fromVolumes( final List serverVolumes, final List providerVolumes, @@ -25,32 +69,25 @@ class DiskStatus { diskVolumes = serverVolumes.map(( final ServerDiskVolume volume, ) { - final DiskVolume diskVolume = DiskVolume(); - diskVolume.sizeUsed = DiskSize( - byte: volume.usedSpace == 'None' ? 0 : int.parse(volume.usedSpace), - ); - diskVolume.sizeTotal = DiskSize( - byte: volume.totalSpace == 'None' ? 0 : int.parse(volume.totalSpace), - ); - diskVolume.serverDiskVolume = volume; + ServerVolume? providerVolume; - for (final ServerVolume providerVolume in providerVolumes) { - if (providerVolume.linuxDevice == null || + for (final ServerVolume iterableProviderVolume in providerVolumes) { + if (iterableProviderVolume.linuxDevice == null || volume.model == null || volume.serial == null) { continue; } - final String deviceId = providerVolume.linuxDevice!.split('/').last; + final String deviceId = iterableProviderVolume.linuxDevice!.split('/').last; if (deviceId.contains(volume.model!) && deviceId.contains(volume.serial!)) { - diskVolume.providerVolume = providerVolume; + providerVolume = iterableProviderVolume; break; } } - diskVolume.name = volume.name; - diskVolume.root = volume.root; + final DiskVolume diskVolume = DiskVolume.fromServerDiscVolume(volume, providerVolume); + return diskVolume; }).toList(); diff --git a/lib/ui/pages/server_storage/extending_volume.dart b/lib/ui/pages/server_storage/extending_volume.dart index 7023685d..e6ceb11e 100644 --- a/lib/ui/pages/server_storage/extending_volume.dart +++ b/lib/ui/pages/server_storage/extending_volume.dart @@ -22,13 +22,20 @@ class ExtendingVolumePage extends StatefulWidget { } class _ExtendingVolumePageState extends State { + @override + void initState() { + minSize = widget.diskVolumeToResize.sizeTotal; + _currentSliderGbValue = minSize.gibibyte; + super.initState(); + } + bool _isError = false; - double _currentSliderGbValue = -1; + late double _currentSliderGbValue; double _euroPerGb = 1.0; - final DiskSize maxSize = DiskSize(byte: 500000000000); - DiskSize minSize = DiskSize(); + final DiskSize maxSize = const DiskSize(byte: 500000000000); + late DiskSize minSize; final TextEditingController _sizeController = TextEditingController(); final TextEditingController _priceController = TextEditingController(); @@ -52,6 +59,9 @@ class _ExtendingVolumePageState extends State { 'providers.storage.extending_volume_description'.tr(), children: const [ SizedBox(height: 16), + Center( + child: CircularProgressIndicator(), + ), ], ); } From 5f13be9339a7efef83e06f2cce6312e242b3b68c Mon Sep 17 00:00:00 2001 From: Inex Code Date: Tue, 6 Sep 2022 14:03:21 +0300 Subject: [PATCH 052/115] Fix Hetzner size storage --- .../server_providers/hetzner/hetzner.dart | 2 +- lib/logic/models/disk_size.dart | 14 ++++++++++++++ lib/ui/pages/server_storage/disk_status.dart | 7 ++++--- lib/ui/pages/server_storage/extending_volume.dart | 5 +++-- 4 files changed, 22 insertions(+), 6 deletions(-) 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 6cf5a971..04ded55f 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 @@ -150,7 +150,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { final List rawVolumes = dbGetResponse.data['volumes']; for (final rawVolume in rawVolumes) { final int dbId = rawVolume['id']; - final int dbSize = rawVolume['size']; + final int dbSize = rawVolume['size'] * 1024 * 1024 * 1024; final dbServer = rawVolume['server']; final String dbName = rawVolume['name']; final dbDevice = rawVolume['linux_device']; diff --git a/lib/logic/models/disk_size.dart b/lib/logic/models/disk_size.dart index 60c2d8a1..9fe18b7d 100644 --- a/lib/logic/models/disk_size.dart +++ b/lib/logic/models/disk_size.dart @@ -3,12 +3,26 @@ import 'package:easy_localization/easy_localization.dart'; class DiskSize { const DiskSize({final this.byte = 0}); + DiskSize.fromKibibyte(final double kibibyte) + : this(byte: (kibibyte * 1024).round()); + DiskSize.fromMebibyte(final double mebibyte) + : this(byte: (mebibyte * 1024 * 1024).round()); + DiskSize.fromGibibyte(final double gibibyte) + : this(byte: (gibibyte * 1024 * 1024 * 1024).round()); + final int byte; double get kibibyte => byte / 1024.0; double get mebibyte => byte / 1024.0 / 1024.0; double get gibibyte => byte / 1024.0 / 1024.0 / 1024.0; + DiskSize operator +(final DiskSize other) => + DiskSize(byte: byte + other.byte); + DiskSize operator -(final DiskSize other) => + DiskSize(byte: byte - other.byte); + DiskSize operator *(final double other) => + DiskSize(byte: (byte * other).round()); + @override String toString() { if (byte < 1024) { diff --git a/lib/ui/pages/server_storage/disk_status.dart b/lib/ui/pages/server_storage/disk_status.dart index dbc01c16..1803f609 100644 --- a/lib/ui/pages/server_storage/disk_status.dart +++ b/lib/ui/pages/server_storage/disk_status.dart @@ -78,7 +78,8 @@ class DiskStatus { continue; } - final String deviceId = iterableProviderVolume.linuxDevice!.split('/').last; + final String deviceId = + iterableProviderVolume.linuxDevice!.split('/').last; if (deviceId.contains(volume.model!) && deviceId.contains(volume.serial!)) { providerVolume = iterableProviderVolume; @@ -86,8 +87,8 @@ class DiskStatus { } } - final DiskVolume diskVolume = DiskVolume.fromServerDiscVolume(volume, providerVolume); - + final DiskVolume diskVolume = + DiskVolume.fromServerDiscVolume(volume, providerVolume); return diskVolume; }).toList(); diff --git a/lib/ui/pages/server_storage/extending_volume.dart b/lib/ui/pages/server_storage/extending_volume.dart index e6ceb11e..0c748190 100644 --- a/lib/ui/pages/server_storage/extending_volume.dart +++ b/lib/ui/pages/server_storage/extending_volume.dart @@ -24,7 +24,7 @@ class ExtendingVolumePage extends StatefulWidget { class _ExtendingVolumePageState extends State { @override void initState() { - minSize = widget.diskVolumeToResize.sizeTotal; + minSize = widget.diskVolumeToResize.sizeTotal + DiskSize.fromGibibyte(2); _currentSliderGbValue = minSize.gibibyte; super.initState(); } @@ -70,7 +70,8 @@ class _ExtendingVolumePageState extends State { _priceController.text = (_euroPerGb * double.parse(_sizeController.text)) .toStringAsFixed(2); - minSize = widget.diskVolumeToResize.sizeTotal; + minSize = + widget.diskVolumeToResize.sizeTotal + DiskSize.fromGibibyte(2); if (_currentSliderGbValue < 0) { _currentSliderGbValue = minSize.gibibyte; } From 580da306e153243c4847d2b38861c38c9ee197a6 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 6 Sep 2022 15:33:12 +0300 Subject: [PATCH 053/115] Fix extending volume button error --- lib/ui/pages/server_storage/extending_volume.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ui/pages/server_storage/extending_volume.dart b/lib/ui/pages/server_storage/extending_volume.dart index 0c748190..02b1dba7 100644 --- a/lib/ui/pages/server_storage/extending_volume.dart +++ b/lib/ui/pages/server_storage/extending_volume.dart @@ -135,7 +135,7 @@ class _ExtendingVolumePageState extends State { const SizedBox(height: 16), FilledButton( title: 'providers.storage.extend_volume_button.title'.tr(), - onPressed: null, + onPressed: _isError ? null : () => {}, disabled: _isError, ), const SizedBox(height: 16), From 3eda30d924a03ad42742ab9fe2b5bdf93fcc9858 Mon Sep 17 00:00:00 2001 From: inexcode Date: Thu, 8 Sep 2022 10:53:25 +0300 Subject: [PATCH 054/115] Refresh DNS screen design --- lib/ui/pages/dns_details/dns_details.dart | 237 ++++++++++------------ 1 file changed, 112 insertions(+), 125 deletions(-) diff --git a/lib/ui/pages/dns_details/dns_details.dart b/lib/ui/pages/dns_details/dns_details.dart index 44d6db0d..c59d26b6 100644 --- a/lib/ui/pages/dns_details/dns_details.dart +++ b/lib/ui/pages/dns_details/dns_details.dart @@ -22,46 +22,59 @@ class _DnsDetailsPageState extends State { String description = ''; String subtitle = ''; Icon icon = const Icon( - Icons.check, - color: Colors.green, + Icons.check_circle_outline, + size: 24.0, ); + bool isError = false; switch (dnsState) { case DnsRecordsStatus.uninitialized: description = 'providers.domain.states.uninitialized'.tr(); icon = const Icon( Icons.refresh, + size: 24.0, ); + isError = false; break; case DnsRecordsStatus.refreshing: description = 'providers.domain.states.refreshing'.tr(); icon = const Icon( Icons.refresh, + size: 24.0, ); + isError = false; break; case DnsRecordsStatus.good: description = 'providers.domain.states.ok'.tr(); icon = const Icon( - Icons.check, - color: Colors.green, + Icons.check_circle_outline, + size: 24.0, ); + isError = false; break; case DnsRecordsStatus.error: description = 'providers.domain.states.error'.tr(); subtitle = 'providers.domain.states.error_subtitle'.tr(); icon = const Icon( - Icons.error, - color: Colors.red, + Icons.error_outline, + size: 24.0, ); + isError = true; break; } - return ListTile( - onTap: dnsState == DnsRecordsStatus.error ? () => fixCallback() : null, - title: Text( - description, - style: Theme.of(context).textTheme.headline6, + return BrandCards.filled( + child: ListTile( + onTap: dnsState == DnsRecordsStatus.error ? () => fixCallback() : null, + leading: icon, + title: Text(description), + subtitle: subtitle != '' ? Text(subtitle) : null, + textColor: isError + ? Theme.of(context).colorScheme.error + : Theme.of(context).colorScheme.onSurfaceVariant, + iconColor: isError + ? Theme.of(context).colorScheme.error + : Theme.of(context).colorScheme.onSurfaceVariant, ), - subtitle: subtitle != '' ? Text(subtitle) : null, - leading: icon, + error: isError, ); } @@ -94,132 +107,106 @@ class _DnsDetailsPageState extends State { ); } + final Color goodColor = Theme.of(context).colorScheme.onBackground; + final Color errorColor = Theme.of(context).colorScheme.error; + final Color neutralColor = Theme.of(context).colorScheme.onBackground; + return BrandHeroScreen( hasBackButton: true, heroSubtitle: domain, heroIcon: BrandIcons.globe, heroTitle: 'providers.domain.screen_title'.tr(), children: [ - BrandCards.outlined( - child: Column( - children: [ - _getStateCard(dnsCubit.dnsState, () { - context.read().fix(); - }), - ], - ), - ), - + _getStateCard(dnsCubit.dnsState, () { + context.read().fix(); + }), const SizedBox(height: 16.0), - // Outlined card with a list of A records and their - // status. - BrandCards.outlined( - child: Column( - children: [ - ListTile( - title: Text( - 'providers.domain.cards.services.title'.tr(), - style: Theme.of(context).textTheme.headline6, + ListTile( + title: Text( + 'providers.domain.cards.services.title'.tr(), + style: Theme.of(context).textTheme.headlineSmall!.copyWith( + color: Theme.of(context).colorScheme.secondary, ), - subtitle: Text( - 'providers.domain.cards.services.subtitle'.tr(), - style: Theme.of(context).textTheme.caption, - ), - ), - ...dnsCubit.dnsRecords - .where( - (final dnsRecord) => - dnsRecord.category == DnsRecordsCategory.services, - ) - .map( - (final dnsRecord) => Column( - children: [ - const Divider( - height: 1.0, - ), - ListTile( - leading: Icon( - dnsRecord.isSatisfied - ? Icons.check - : dnsCubit.dnsState == - DnsRecordsStatus.refreshing - ? Icons.refresh - : Icons.error, - color: dnsRecord.isSatisfied - ? Colors.green - : dnsCubit.dnsState == - DnsRecordsStatus.refreshing - ? Colors.grey - : Colors.red, - ), - title: Text( - dnsRecord.description.tr(), - style: Theme.of(context).textTheme.labelLarge, - ), - subtitle: Text( - dnsRecord.name, - style: Theme.of(context).textTheme.caption, - ), - ), - ], - ), - ) - .toList(), - ], + ), + subtitle: Text( + 'providers.domain.cards.services.subtitle'.tr(), + style: Theme.of(context).textTheme.labelMedium, ), ), + ...dnsCubit.dnsRecords + .where( + (final dnsRecord) => + dnsRecord.category == DnsRecordsCategory.services, + ) + .map( + (final dnsRecord) => Column( + children: [ + ListTile( + leading: Icon( + dnsRecord.isSatisfied + ? Icons.check_circle_outline + : dnsCubit.dnsState == DnsRecordsStatus.refreshing + ? Icons.refresh + : Icons.error_outline, + color: dnsRecord.isSatisfied + ? goodColor + : dnsCubit.dnsState == DnsRecordsStatus.refreshing + ? neutralColor + : errorColor, + ), + title: Text( + dnsRecord.description.tr(), + ), + subtitle: Text( + dnsRecord.name, + ), + ), + ], + ), + ) + .toList(), const SizedBox(height: 16.0), - BrandCards.outlined( - child: Column( - children: [ - ListTile( - title: Text( - 'providers.domain.cards.email.title'.tr(), - style: Theme.of(context).textTheme.headline6, + ListTile( + title: Text( + 'providers.domain.cards.email.title'.tr(), + style: Theme.of(context).textTheme.headlineSmall!.copyWith( + color: Theme.of(context).colorScheme.secondary, ), - subtitle: Text( - 'providers.domain.cards.email.subtitle'.tr(), - style: Theme.of(context).textTheme.caption, - ), - ), - ...dnsCubit.dnsRecords - .where( - (final dnsRecord) => - dnsRecord.category == DnsRecordsCategory.email, - ) - .map( - (final dnsRecord) => Column( - children: [ - const Divider( - height: 1.0, - ), - ListTile( - leading: Icon( - dnsRecord.isSatisfied - ? Icons.check - : dnsCubit.dnsState == - DnsRecordsStatus.refreshing - ? Icons.refresh - : Icons.error, - color: dnsRecord.isSatisfied - ? Colors.green - : dnsCubit.dnsState == - DnsRecordsStatus.refreshing - ? Colors.grey - : Colors.red, - ), - title: Text( - dnsRecord.description.tr(), - style: Theme.of(context).textTheme.labelLarge, - ), - ), - ], - ), - ) - .toList(), - ], + ), + subtitle: Text( + 'providers.domain.cards.email.subtitle'.tr(), + style: Theme.of(context).textTheme.labelMedium, ), ), + ...dnsCubit.dnsRecords + .where( + (final dnsRecord) => + dnsRecord.category == DnsRecordsCategory.email, + ) + .map( + (final dnsRecord) => Column( + children: [ + ListTile( + leading: Icon( + dnsRecord.isSatisfied + ? Icons.check_circle_outline + : dnsCubit.dnsState == DnsRecordsStatus.refreshing + ? Icons.refresh + : Icons.error_outline, + color: dnsRecord.isSatisfied + ? goodColor + : dnsCubit.dnsState == DnsRecordsStatus.refreshing + ? neutralColor + : errorColor, + ), + title: Text( + dnsRecord.description.tr(), + ), + ), + ], + ), + ) + .toList(), ], ); } From 981b9865cd0e79adcb44e521551db52f513777ec Mon Sep 17 00:00:00 2001 From: inexcode Date: Thu, 8 Sep 2022 18:13:18 +0300 Subject: [PATCH 055/115] Fix users not changing SSH keys and remove SSH keys screen --- lib/logic/cubit/users/users_cubit.dart | 14 +- lib/ui/pages/more/more.dart | 7 +- lib/ui/pages/ssh_keys/new_ssh_key.dart | 76 ---- lib/ui/pages/ssh_keys/ssh_keys.dart | 144 -------- lib/ui/pages/users/user.dart | 2 +- lib/ui/pages/users/user_details.dart | 465 ++++++++++++++++--------- lib/ui/pages/users/users.dart | 2 +- 7 files changed, 315 insertions(+), 395 deletions(-) delete mode 100644 lib/ui/pages/ssh_keys/new_ssh_key.dart delete mode 100644 lib/ui/pages/ssh_keys/ssh_keys.dart diff --git a/lib/logic/cubit/users/users_cubit.dart b/lib/logic/cubit/users/users_cubit.dart index 1ff0e9a3..87abcffd 100644 --- a/lib/logic/cubit/users/users_cubit.dart +++ b/lib/logic/cubit/users/users_cubit.dart @@ -47,8 +47,6 @@ class UsersCubit extends ServerInstallationDependendCubit { return; } emit(state.copyWith(isLoading: true)); - // sleep for 10 seconds to simulate a slow connection - await Future.delayed(const Duration(seconds: 10)); final List usersFromServer = await api.getAllUsers(); if (usersFromServer.isNotEmpty) { emit( @@ -58,8 +56,8 @@ class UsersCubit extends ServerInstallationDependendCubit { ), ); // Update the users it the box - box.clear(); - box.addAll(usersFromServer); + await box.clear(); + await box.addAll(usersFromServer); } else { getIt() .showSnackBar('users.could_not_fetch_users'.tr()); @@ -139,7 +137,9 @@ class UsersCubit extends ServerInstallationDependendCubit { await api.addSshKey(user.login, publicKey); if (result.success) { final User updatedUser = result.user!; - await box.putAt(box.values.toList().indexOf(user), updatedUser); + final int index = + state.users.indexWhere((final User u) => u.login == user.login); + await box.putAt(index, updatedUser); emit( state.copyWith( users: box.values.toList(), @@ -156,7 +156,9 @@ class UsersCubit extends ServerInstallationDependendCubit { await api.removeSshKey(user.login, publicKey); if (result.success) { final User updatedUser = result.user!; - await box.putAt(box.values.toList().indexOf(user), updatedUser); + final int index = + state.users.indexWhere((final User u) => u.login == user.login); + await box.putAt(index, updatedUser); emit( state.copyWith( users: box.values.toList(), diff --git a/lib/ui/pages/more/more.dart b/lib/ui/pages/more/more.dart index 5a02da3c..fce3f640 100644 --- a/lib/ui/pages/more/more.dart +++ b/lib/ui/pages/more/more.dart @@ -11,10 +11,9 @@ import 'package:selfprivacy/ui/pages/recovery_key/recovery_key.dart'; import 'package:selfprivacy/ui/pages/setup/initializing.dart'; import 'package:selfprivacy/ui/pages/onboarding/onboarding.dart'; import 'package:selfprivacy/ui/pages/root_route.dart'; -import 'package:selfprivacy/ui/pages/ssh_keys/ssh_keys.dart'; +import 'package:selfprivacy/ui/pages/users/users.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; -import 'package:selfprivacy/logic/cubit/users/users_cubit.dart'; import 'package:selfprivacy/ui/pages/more/about/about.dart'; import 'package:selfprivacy/ui/pages/more/app_settings/app_setting.dart'; import 'package:selfprivacy/ui/pages/more/console/console.dart'; @@ -53,8 +52,8 @@ class MorePage extends StatelessWidget { _MoreMenuItem( title: 'more.create_ssh_key'.tr(), iconData: Ionicons.key_outline, - goTo: SshKeysPage( - user: context.read().state.rootUser, + goTo: const UserDetails( + login: 'root', ), ), if (isReady) diff --git a/lib/ui/pages/ssh_keys/new_ssh_key.dart b/lib/ui/pages/ssh_keys/new_ssh_key.dart deleted file mode 100644 index 042707ef..00000000 --- a/lib/ui/pages/ssh_keys/new_ssh_key.dart +++ /dev/null @@ -1,76 +0,0 @@ -part of 'ssh_keys.dart'; - -class NewSshKey extends StatelessWidget { - const NewSshKey(this.user, {final super.key}); - final User user; - - @override - Widget build(final BuildContext context) => BrandBottomSheet( - child: BlocProvider( - create: (final context) { - final jobCubit = context.read(); - final jobState = jobCubit.state; - if (jobState is JobsStateWithJobs) { - final jobs = jobState.clientJobList; - for (final job in jobs) { - if (job is CreateSSHKeyJob && job.user.login == user.login) { - user.sshKeys.add(job.publicKey); - } - } - } - return SshFormCubit( - jobsCubit: jobCubit, - user: user, - ); - }, - child: Builder( - builder: (final context) { - final formCubitState = context.watch().state; - - return BlocListener( - listener: (final context, final state) { - if (state.isSubmitted) { - Navigator.pop(context); - } - }, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - BrandHeader( - title: user.login, - ), - const SizedBox(width: 14), - Padding( - padding: paddingH15V0, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - IntrinsicHeight( - child: CubitFormTextField( - formFieldCubit: context.read().key, - decoration: InputDecoration( - labelText: 'ssh.input_label'.tr(), - ), - ), - ), - const SizedBox(height: 30), - BrandButton.rised( - onPressed: formCubitState.isSubmitting - ? null - : () => - context.read().trySubmit(), - text: 'ssh.create'.tr(), - ), - const SizedBox(height: 30), - ], - ), - ), - ], - ), - ); - }, - ), - ), - ); -} diff --git a/lib/ui/pages/ssh_keys/ssh_keys.dart b/lib/ui/pages/ssh_keys/ssh_keys.dart deleted file mode 100644 index 4bc48e8a..00000000 --- a/lib/ui/pages/ssh_keys/ssh_keys.dart +++ /dev/null @@ -1,144 +0,0 @@ -import 'package:cubit_form/cubit_form.dart'; -import 'package:easy_localization/easy_localization.dart'; -import 'package:flutter/material.dart'; -import 'package:selfprivacy/logic/cubit/forms/user/ssh_form_cubit.dart'; -import 'package:selfprivacy/logic/models/job.dart'; -import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart'; -import 'package:selfprivacy/ui/components/brand_cards/brand_cards.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/config/brand_colors.dart'; -import 'package:selfprivacy/config/brand_theme.dart'; -import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart'; -import 'package:selfprivacy/logic/models/hive/user.dart'; -import 'package:selfprivacy/ui/components/brand_button/brand_button.dart'; -import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; - -part 'new_ssh_key.dart'; - -// Get user object as a parameter -class SshKeysPage extends StatefulWidget { - const SshKeysPage({required this.user, final super.key}); - final User user; - - @override - State createState() => _SshKeysPageState(); -} - -class _SshKeysPageState extends State { - @override - Widget build(final BuildContext context) => BrandHeroScreen( - heroTitle: 'ssh.title'.tr(), - heroSubtitle: widget.user.login, - heroIcon: BrandIcons.key, - children: [ - if (widget.user.login == 'root') - Column( - children: [ - // Show alert card if user is root - BrandCards.outlined( - child: ListTile( - leading: Icon( - Icons.warning_rounded, - color: Theme.of(context).colorScheme.error, - ), - title: Text('ssh.root.title'.tr()), - subtitle: Text('ssh.root.subtitle'.tr()), - ), - ) - ], - ), - BrandCards.outlined( - child: Column( - children: [ - ListTile( - title: Text( - 'ssh.create'.tr(), - style: Theme.of(context).textTheme.headline6, - ), - leading: const Icon(Icons.add_circle_outline_rounded), - onTap: () { - showModalBottomSheet( - context: context, - isScrollControlled: true, - backgroundColor: Colors.transparent, - builder: (final BuildContext context) => Padding( - padding: MediaQuery.of(context).viewInsets, - child: NewSshKey(widget.user), - ), - ); - }, - ), - const Divider(height: 0), - // show a list of ListTiles with ssh keys - // Clicking on one should delete it - Column( - children: widget.user.sshKeys.map((final String key) { - final publicKey = - key.split(' ').length > 1 ? key.split(' ')[1] : key; - final keyType = key.split(' ')[0]; - final keyName = key.split(' ').length > 2 - ? key.split(' ')[2] - : 'ssh.no_key_name'.tr(); - return ListTile( - title: Text('$keyName ($keyType)'), - // do not overflow text - subtitle: Text( - publicKey, - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - onTap: () { - showDialog( - context: context, - builder: (final BuildContext context) => AlertDialog( - title: Text('ssh.delete'.tr()), - content: SingleChildScrollView( - child: ListBody( - children: [ - Text('ssh.delete_confirm_question'.tr()), - Text('$keyName ($keyType)'), - Text(publicKey), - ], - ), - ), - actions: [ - TextButton( - child: Text('basis.cancel'.tr()), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - TextButton( - child: Text( - 'basis.delete'.tr(), - style: const TextStyle( - color: BrandColors.red1, - ), - ), - onPressed: () { - context.read().addJob( - DeleteSSHKeyJob( - user: widget.user, - publicKey: key, - ), - ); - Navigator.of(context) - ..pop() - ..pop(); - }, - ), - ], - ), - ); - }, - ); - }).toList(), - ) - ], - ), - ), - ], - ); -} diff --git a/lib/ui/pages/users/user.dart b/lib/ui/pages/users/user.dart index 1602427d..1d781811 100644 --- a/lib/ui/pages/users/user.dart +++ b/lib/ui/pages/users/user.dart @@ -12,7 +12,7 @@ class _User extends StatelessWidget { Widget build(final BuildContext context) => InkWell( onTap: () { Navigator.of(context).push( - materialRoute(_UserDetails(user: user, isRootUser: isRootUser)), + materialRoute(UserDetails(login: user.login)), ); }, child: Container( diff --git a/lib/ui/pages/users/user_details.dart b/lib/ui/pages/users/user_details.dart index 0bfbce8c..dfa08dc6 100644 --- a/lib/ui/pages/users/user_details.dart +++ b/lib/ui/pages/users/user_details.dart @@ -1,13 +1,12 @@ part of 'users.dart'; -class _UserDetails extends StatelessWidget { - const _UserDetails({ - required this.user, - required this.isRootUser, +class UserDetails extends StatelessWidget { + const UserDetails({ + required this.login, + final super.key, }); - final User user; - final bool isRootUser; + final String login; @override Widget build(final BuildContext context) { final ServerInstallationState config = @@ -15,118 +14,46 @@ class _UserDetails extends StatelessWidget { final String domainName = UiHelpers.getDomainName(config); + final User user = context.watch().state.users.firstWhere( + (final User user) => user.login == login, + orElse: () => const User( + type: UserType.normal, + login: 'error', + ), + ); + + if (user.type == UserType.root) { + return BrandHeroScreen( + hasBackButton: true, + heroTitle: user.login, + heroSubtitle: 'ssh.root.title'.tr(), + children: [ + _SshKeysCard(user: user), + const SizedBox(height: 8), + Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Icon(Icons.warning_amber_outlined, size: 24), + const SizedBox(height: 16), + Text( + 'ssh.root.subtitle'.tr(), + ), + ], + ), + ), + ], + ); + } + return BrandHeroScreen( hasBackButton: true, heroTitle: user.login, children: [ - BrandCards.filled( - child: Column( - children: [ - ListTile( - title: Text('${user.login}@$domainName'), - subtitle: Text('users.email_login'.tr()), - textColor: Theme.of(context).colorScheme.onSurfaceVariant, - leading: const Icon(Icons.alternate_email_outlined), - iconColor: Theme.of(context).colorScheme.onSurfaceVariant, - ), - ], - ), - ), + _UserLogins(user: user, domainName: domainName), const SizedBox(height: 8), - BrandCards.filled( - child: Column( - children: [ - ListTile( - title: Text('ssh.title'.tr()), - textColor: Theme.of(context).colorScheme.onSurfaceVariant, - ), - const Divider(height: 0), - ListTile( - iconColor: Theme.of(context).colorScheme.onSurfaceVariant, - textColor: Theme.of(context).colorScheme.onSurfaceVariant, - title: Text( - 'ssh.create'.tr(), - ), - leading: const Icon(Icons.add_circle_outlined), - onTap: () { - showModalBottomSheet( - context: context, - isScrollControlled: true, - backgroundColor: Colors.transparent, - builder: (final BuildContext context) => Padding( - padding: MediaQuery.of(context).viewInsets, - child: NewSshKey(user), - ), - ); - }, - ), - Column( - children: user.sshKeys.map((final String key) { - final publicKey = - key.split(' ').length > 1 ? key.split(' ')[1] : key; - final keyType = key.split(' ')[0]; - final keyName = key.split(' ').length > 2 - ? key.split(' ')[2] - : 'ssh.no_key_name'.tr(); - return ListTile( - textColor: Theme.of(context).colorScheme.onSurfaceVariant, - title: Text('$keyName ($keyType)'), - // do not overflow text - subtitle: Text( - publicKey, - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - onTap: () { - showDialog( - context: context, - builder: (final BuildContext context) => AlertDialog( - title: Text('ssh.delete'.tr()), - content: SingleChildScrollView( - child: ListBody( - children: [ - Text('ssh.delete_confirm_question'.tr()), - Text('$keyName ($keyType)'), - Text(publicKey), - ], - ), - ), - actions: [ - TextButton( - child: Text('basis.cancel'.tr()), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - TextButton( - child: Text( - 'basis.delete'.tr(), - style: const TextStyle( - color: BrandColors.red1, - ), - ), - onPressed: () { - context.read().addJob( - DeleteSSHKeyJob( - user: user, - publicKey: key, - ), - ); - Navigator.of(context) - ..pop() - ..pop(); - }, - ), - ], - ), - ); - }, - ); - }).toList(), - ), - ], - ), - ), + _SshKeysCard(user: user), const SizedBox(height: 8), ListTile( iconColor: Theme.of(context).colorScheme.onBackground, @@ -136,56 +63,7 @@ class _UserDetails extends StatelessWidget { 'users.reset_password'.tr(), ), ), - if (!isRootUser) - ListTile( - iconColor: Theme.of(context).colorScheme.error, - textColor: Theme.of(context).colorScheme.error, - onTap: () => { - showDialog( - context: context, - builder: (final BuildContext context) => AlertDialog( - title: Text('basis.confirmation'.tr()), - content: SingleChildScrollView( - child: ListBody( - children: [ - Text( - 'users.delete_confirm_question'.tr(), - ), - ], - ), - ), - actions: [ - TextButton( - child: Text('basis.cancel'.tr()), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - TextButton( - child: Text( - 'basis.delete'.tr(), - style: const TextStyle( - color: BrandColors.red1, - ), - ), - onPressed: () { - context - .read() - .addJob(DeleteUserJob(user: user)); - Navigator.of(context) - ..pop() - ..pop(); - }, - ), - ], - ), - ) - }, - leading: const Icon(Icons.person_remove_outlined), - title: Text( - 'users.delete_user'.tr(), - ), - ), + if (user.type == UserType.normal) _DeleteUserTile(user: user), const Divider(height: 8), Padding( padding: const EdgeInsets.all(16.0), @@ -204,3 +82,264 @@ class _UserDetails extends StatelessWidget { ); } } + +class _DeleteUserTile extends StatelessWidget { + const _DeleteUserTile({ + required this.user, + }); + + final User user; + + @override + Widget build(final BuildContext context) => ListTile( + iconColor: Theme.of(context).colorScheme.error, + textColor: Theme.of(context).colorScheme.error, + onTap: () => { + showDialog( + context: context, + builder: (final BuildContext context) => AlertDialog( + title: Text('basis.confirmation'.tr()), + content: SingleChildScrollView( + child: ListBody( + children: [ + Text( + 'users.delete_confirm_question'.tr(), + ), + ], + ), + ), + actions: [ + TextButton( + child: Text('basis.cancel'.tr()), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + TextButton( + child: Text( + 'basis.delete'.tr(), + style: TextStyle( + color: Theme.of(context).colorScheme.error, + ), + ), + onPressed: () { + context.read().addJob(DeleteUserJob(user: user)); + Navigator.of(context) + ..pop() + ..pop(); + }, + ), + ], + ), + ) + }, + leading: const Icon(Icons.person_remove_outlined), + title: Text( + 'users.delete_user'.tr(), + ), + ); +} + +class _UserLogins extends StatelessWidget { + const _UserLogins({ + required this.user, + required this.domainName, + }); + + final User user; + final String domainName; + + @override + Widget build(final BuildContext context) => BrandCards.filled( + child: Column( + children: [ + ListTile( + title: Text('${user.login}@$domainName'), + subtitle: Text('users.email_login'.tr()), + textColor: Theme.of(context).colorScheme.onSurfaceVariant, + leading: const Icon(Icons.alternate_email_outlined), + iconColor: Theme.of(context).colorScheme.onSurfaceVariant, + ), + ], + ), + ); +} + +class _SshKeysCard extends StatelessWidget { + const _SshKeysCard({ + required this.user, + }); + + final User user; + + @override + Widget build(final BuildContext context) => BrandCards.filled( + child: Column( + children: [ + ListTile( + title: Text('ssh.title'.tr()), + textColor: Theme.of(context).colorScheme.onSurfaceVariant, + ), + const Divider(height: 0), + ListTile( + iconColor: Theme.of(context).colorScheme.onSurfaceVariant, + textColor: Theme.of(context).colorScheme.onSurfaceVariant, + title: Text( + 'ssh.create'.tr(), + ), + leading: const Icon(Icons.add_circle_outlined), + onTap: () { + showModalBottomSheet( + context: context, + isScrollControlled: true, + backgroundColor: Colors.transparent, + builder: (final BuildContext context) => Padding( + padding: MediaQuery.of(context).viewInsets, + child: NewSshKey(user), + ), + ); + }, + ), + Column( + children: user.sshKeys.map((final String key) { + final publicKey = + key.split(' ').length > 1 ? key.split(' ')[1] : key; + final keyType = key.split(' ')[0]; + final keyName = key.split(' ').length > 2 + ? key.split(' ')[2] + : 'ssh.no_key_name'.tr(); + return ListTile( + textColor: Theme.of(context).colorScheme.onSurfaceVariant, + title: Text('$keyName ($keyType)'), + // do not overflow text + subtitle: Text( + publicKey, + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + onTap: () { + showDialog( + context: context, + builder: (final BuildContext context) => AlertDialog( + title: Text('ssh.delete'.tr()), + content: SingleChildScrollView( + child: ListBody( + children: [ + Text('ssh.delete_confirm_question'.tr()), + Text('$keyName ($keyType)'), + Text(publicKey), + ], + ), + ), + actions: [ + TextButton( + child: Text('basis.cancel'.tr()), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + TextButton( + child: Text( + 'basis.delete'.tr(), + style: TextStyle( + color: Theme.of(context).colorScheme.error, + ), + ), + onPressed: () { + context.read().addJob( + DeleteSSHKeyJob( + user: user, + publicKey: key, + ), + ); + Navigator.of(context) + ..pop() + ..pop(); + }, + ), + ], + ), + ); + }, + ); + }).toList(), + ), + ], + ), + ); +} + +class NewSshKey extends StatelessWidget { + const NewSshKey(this.user, {final super.key}); + final User user; + + @override + Widget build(final BuildContext context) => BrandBottomSheet( + child: BlocProvider( + create: (final context) { + final jobCubit = context.read(); + final jobState = jobCubit.state; + if (jobState is JobsStateWithJobs) { + final jobs = jobState.clientJobList; + for (final job in jobs) { + if (job is CreateSSHKeyJob && job.user.login == user.login) { + user.sshKeys.add(job.publicKey); + } + } + } + return SshFormCubit( + jobsCubit: jobCubit, + user: user, + ); + }, + child: Builder( + builder: (final context) { + final formCubitState = context.watch().state; + + return BlocListener( + listener: (final context, final state) { + if (state.isSubmitted) { + Navigator.pop(context); + } + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + BrandHeader( + title: user.login, + ), + const SizedBox(width: 14), + Padding( + padding: paddingH15V0, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + IntrinsicHeight( + child: CubitFormTextField( + formFieldCubit: context.read().key, + decoration: InputDecoration( + labelText: 'ssh.input_label'.tr(), + ), + ), + ), + const SizedBox(height: 30), + BrandButton.rised( + onPressed: formCubitState.isSubmitting + ? null + : () => + context.read().trySubmit(), + text: 'ssh.create'.tr(), + ), + const SizedBox(height: 30), + ], + ), + ), + ], + ), + ); + }, + ), + ), + ); +} diff --git a/lib/ui/pages/users/users.dart b/lib/ui/pages/users/users.dart index 9c215ef8..bf76ba89 100644 --- a/lib/ui/pages/users/users.dart +++ b/lib/ui/pages/users/users.dart @@ -3,6 +3,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:selfprivacy/config/brand_colors.dart'; import 'package:selfprivacy/config/brand_theme.dart'; +import 'package:selfprivacy/logic/cubit/forms/user/ssh_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/user/user_form_cubit.dart'; @@ -19,7 +20,6 @@ import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.da import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart'; import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; import 'package:selfprivacy/ui/components/not_ready_card/not_ready_card.dart'; -import 'package:selfprivacy/ui/pages/ssh_keys/ssh_keys.dart'; import 'package:selfprivacy/utils/ui_helpers.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; From 2826892400d2841c8085976440a5ebddee321334 Mon Sep 17 00:00:00 2001 From: inexcode Date: Thu, 8 Sep 2022 18:14:05 +0300 Subject: [PATCH 056/115] Add a new filled card style and fix red texts --- .../action_button/action_button.dart | 5 +++-- lib/ui/components/brand_cards/brand_cards.dart | 18 ++++++++++++++---- .../pages/backup_details/backup_details.dart | 5 ++--- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/lib/ui/components/action_button/action_button.dart b/lib/ui/components/action_button/action_button.dart index 3a518496..6572794b 100644 --- a/lib/ui/components/action_button/action_button.dart +++ b/lib/ui/components/action_button/action_button.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:selfprivacy/config/brand_colors.dart'; class ActionButton extends StatelessWidget { const ActionButton({ @@ -20,7 +19,9 @@ class ActionButton extends StatelessWidget { return TextButton( child: Text( text!, - style: isRed ? const TextStyle(color: BrandColors.red1) : null, + style: isRed + ? TextStyle(color: Theme.of(context).colorScheme.error) + : null, ), onPressed: () { navigator.pop(); diff --git a/lib/ui/components/brand_cards/brand_cards.dart b/lib/ui/components/brand_cards/brand_cards.dart index 91737885..c9196000 100644 --- a/lib/ui/components/brand_cards/brand_cards.dart +++ b/lib/ui/components/brand_cards/brand_cards.dart @@ -25,11 +25,15 @@ class BrandCards { static Widget filled({ required final Widget child, final bool tertiary = false, + final bool secondary = false, final bool error = false, + final bool clipped = true, }) => _FilledCard( tertiary: tertiary, + secondary: secondary, error: error, + clipped: clipped, child: child, ); } @@ -82,25 +86,31 @@ class _OutlinedCard extends StatelessWidget { class _FilledCard extends StatelessWidget { const _FilledCard({ required this.child, + required this.secondary, required this.tertiary, required this.error, + required this.clipped, }); final Widget child; final bool tertiary; final bool error; + final bool clipped; + final bool secondary; @override Widget build(final BuildContext context) => Card( elevation: 0.0, shape: const RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(12)), ), - clipBehavior: Clip.antiAlias, + clipBehavior: clipped ? Clip.antiAlias : Clip.none, color: error ? Theme.of(context).colorScheme.errorContainer - : tertiary - ? Theme.of(context).colorScheme.tertiaryContainer - : Theme.of(context).colorScheme.surfaceVariant, + : secondary + ? Theme.of(context).colorScheme.secondaryContainer + : tertiary + ? Theme.of(context).colorScheme.tertiaryContainer + : Theme.of(context).colorScheme.surfaceVariant, child: child, ); } diff --git a/lib/ui/pages/backup_details/backup_details.dart b/lib/ui/pages/backup_details/backup_details.dart index 55a8dd12..c4a62284 100644 --- a/lib/ui/pages/backup_details/backup_details.dart +++ b/lib/ui/pages/backup_details/backup_details.dart @@ -1,6 +1,5 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; -import 'package:selfprivacy/config/brand_colors.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/cubit/backups/backups_cubit.dart'; @@ -110,9 +109,9 @@ class _BackupDetailsState extends State ), if (backupStatus == BackupStatusEnum.error) ListTile( - leading: const Icon( + leading: Icon( Icons.error_outline, - color: BrandColors.red1, + color: Theme.of(context).colorScheme.error, ), title: Text( 'providers.backup.error_pending'.tr(), From da63ce45c880399f163a2bfb712f203e93c79373 Mon Sep 17 00:00:00 2001 From: inexcode Date: Thu, 8 Sep 2022 18:39:49 +0300 Subject: [PATCH 057/115] Simplify root SSH keys page --- lib/ui/pages/users/user_details.dart | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/lib/ui/pages/users/user_details.dart b/lib/ui/pages/users/user_details.dart index dfa08dc6..4b1049c1 100644 --- a/lib/ui/pages/users/user_details.dart +++ b/lib/ui/pages/users/user_details.dart @@ -25,24 +25,10 @@ class UserDetails extends StatelessWidget { if (user.type == UserType.root) { return BrandHeroScreen( hasBackButton: true, - heroTitle: user.login, - heroSubtitle: 'ssh.root.title'.tr(), + heroTitle: 'ssh.root.title'.tr(), + heroSubtitle: 'ssh.root.subtitle'.tr(), children: [ _SshKeysCard(user: user), - const SizedBox(height: 8), - Padding( - padding: const EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Icon(Icons.warning_amber_outlined, size: 24), - const SizedBox(height: 16), - Text( - 'ssh.root.subtitle'.tr(), - ), - ], - ), - ), ], ); } From 06fbcff9a941812f8e29c92b2d09dbc96a601e41 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Thu, 8 Sep 2022 22:58:45 +0300 Subject: [PATCH 058/115] Fix graphql type errors --- .../graphql_maps/schema/users.graphql.dart | 56 +------------------ .../graphql_maps/server_api/jobs_api.dart | 13 +++-- .../dns_providers/cloudflare/cloudflare.dart | 37 ++++++------ lib/logic/models/json/server_job.dart | 19 ++++++- lib/logic/models/json/server_job.g.dart | 10 ++-- 5 files changed, 52 insertions(+), 83 deletions(-) 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 7200c167..a132155a 100644 --- a/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart @@ -1,11 +1,9 @@ import 'dart:async'; - +import 'disk_volumes.graphql.dart'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; import 'package:json_annotation/json_annotation.dart'; - import 'schema.graphql.dart'; - part 'users.graphql.g.dart'; @JsonSerializable(explicitToJson: true) @@ -173,7 +171,6 @@ extension ClientExtension$Fragment$basicMutationReturnFields document: documentNodeFragmentbasicMutationReturnFields)), data: data.toJson(), broadcast: broadcast); - Fragment$basicMutationReturnFields? readFragment$basicMutationReturnFields( {required Map idFields, bool optimistic = true}) { final result = this.readFragment( @@ -364,7 +361,6 @@ extension ClientExtension$Fragment$userFields on graphql.GraphQLClient { document: documentNodeFragmentuserFields)), data: data.toJson(), broadcast: broadcast); - Fragment$userFields? readFragment$userFields( {required Map idFields, bool optimistic = true}) { final result = this.readFragment( @@ -448,7 +444,6 @@ class _CopyWithImpl$Query$AllUsers $__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)); @@ -462,7 +457,6 @@ class _CopyWithStubImpl$Query$AllUsers TRes _res; call({Query$AllUsers$users? users, String? $__typename}) => _res; - CopyWith$Query$AllUsers$users get users => CopyWith$Query$AllUsers$users.stub(_res); } @@ -530,7 +524,6 @@ const documentNodeQueryAllUsers = DocumentNode(definitions: [ ])), fragmentDefinitionuserFields, ]); - Query$AllUsers _parserFn$Query$AllUsers(Map data) => Query$AllUsers.fromJson(data); @@ -592,11 +585,9 @@ extension ClientExtension$Query$AllUsers on graphql.GraphQLClient { Future> query$AllUsers( [Options$Query$AllUsers? options]) async => await this.query(options ?? Options$Query$AllUsers()); - graphql.ObservableQuery watchQuery$AllUsers( [WatchOptions$Query$AllUsers? options]) => this.watchQuery(options ?? WatchOptions$Query$AllUsers()); - void writeQuery$AllUsers( {required Query$AllUsers data, bool broadcast = true}) => this.writeQuery( @@ -605,7 +596,6 @@ extension ClientExtension$Query$AllUsers on graphql.GraphQLClient { graphql.Operation(document: documentNodeQueryAllUsers)), data: data.toJson(), broadcast: broadcast); - Query$AllUsers? readQuery$AllUsers({bool optimistic = true}) { final result = this.readQuery( graphql.Request( @@ -632,7 +622,6 @@ class Query$AllUsers$users { final String $__typename; Map toJson() => _$Query$AllUsers$usersToJson(this); - int get hashCode { final l$allUsers = allUsers; final l$rootUser = rootUser; @@ -682,12 +671,10 @@ abstract class CopyWith$Query$AllUsers$users { {List? allUsers, Fragment$userFields? rootUser, String? $__typename}); - TRes allUsers( Iterable Function( Iterable>) _fn); - CopyWith$Fragment$userFields get rootUser; } @@ -715,7 +702,6 @@ class _CopyWithImpl$Query$AllUsers$users $__typename: $__typename == _undefined || $__typename == null ? _instance.$__typename : ($__typename as String))); - TRes allUsers( Iterable Function( Iterable>) @@ -723,7 +709,6 @@ class _CopyWithImpl$Query$AllUsers$users call( 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 @@ -744,9 +729,7 @@ class _CopyWithStubImpl$Query$AllUsers$users Fragment$userFields? rootUser, String? $__typename}) => _res; - allUsers(_fn) => _res; - CopyWith$Fragment$userFields get rootUser => CopyWith$Fragment$userFields.stub(_res); } @@ -888,7 +871,6 @@ class _CopyWithImpl$Query$GetUser $__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)); @@ -902,7 +884,6 @@ class _CopyWithStubImpl$Query$GetUser TRes _res; call({Query$GetUser$users? users, String? $__typename}) => _res; - CopyWith$Query$GetUser$users get users => CopyWith$Query$GetUser$users.stub(_res); } @@ -962,7 +943,6 @@ const documentNodeQueryGetUser = DocumentNode(definitions: [ ])), fragmentDefinitionuserFields, ]); - Query$GetUser _parserFn$Query$GetUser(Map data) => Query$GetUser.fromJson(data); @@ -1033,11 +1013,9 @@ extension ClientExtension$Query$GetUser on graphql.GraphQLClient { Future> query$GetUser( Options$Query$GetUser options) async => await this.query(options); - graphql.ObservableQuery watchQuery$GetUser( WatchOptions$Query$GetUser options) => this.watchQuery(options); - void writeQuery$GetUser( {required Query$GetUser data, required Variables$Query$GetUser variables, @@ -1048,7 +1026,6 @@ extension ClientExtension$Query$GetUser on graphql.GraphQLClient { variables: variables.toJson()), data: data.toJson(), broadcast: broadcast); - Query$GetUser? readQuery$GetUser( {required Variables$Query$GetUser variables, bool optimistic = true}) { final result = this.readQuery( @@ -1130,7 +1107,6 @@ class _CopyWithImpl$Query$GetUser$users $__typename: $__typename == _undefined || $__typename == null ? _instance.$__typename : ($__typename as String))); - CopyWith$Fragment$userFields get getUser { final local$getUser = _instance.getUser; return local$getUser == null @@ -1146,7 +1122,6 @@ class _CopyWithStubImpl$Query$GetUser$users TRes _res; call({Fragment$userFields? getUser, String? $__typename}) => _res; - CopyWith$Fragment$userFields get getUser => CopyWith$Fragment$userFields.stub(_res); } @@ -1291,7 +1266,6 @@ class _CopyWithImpl$Mutation$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( @@ -1307,7 +1281,6 @@ class _CopyWithStubImpl$Mutation$CreateUser call({Mutation$CreateUser$createUser? createUser, String? $__typename}) => _res; - CopyWith$Mutation$CreateUser$createUser get createUser => CopyWith$Mutation$CreateUser$createUser.stub(_res); } @@ -1371,10 +1344,8 @@ const documentNodeMutationCreateUser = DocumentNode(definitions: [ fragmentDefinitionbasicMutationReturnFields, fragmentDefinitionuserFields, ]); - Mutation$CreateUser _parserFn$Mutation$CreateUser(Map data) => Mutation$CreateUser.fromJson(data); - typedef OnMutationCompleted$Mutation$CreateUser = FutureOr Function( dynamic, Mutation$CreateUser?); @@ -1454,7 +1425,6 @@ extension ClientExtension$Mutation$CreateUser on graphql.GraphQLClient { Future> mutate$CreateUser( Options$Mutation$CreateUser options) async => await this.mutate(options); - graphql.ObservableQuery watchMutation$CreateUser( WatchOptions$Mutation$CreateUser options) => this.watchMutation(options); @@ -1597,7 +1567,6 @@ class _CopyWithStubImpl$Mutation$CreateUser$createUser String? $__typename, Fragment$userFields? user}) => _res; - CopyWith$Fragment$userFields get user => CopyWith$Fragment$userFields.stub(_res); } @@ -1743,7 +1712,6 @@ class _CopyWithImpl$Mutation$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( @@ -1759,7 +1727,6 @@ class _CopyWithStubImpl$Mutation$DeleteUser call({Mutation$DeleteUser$deleteUser? deleteUser, String? $__typename}) => _res; - CopyWith$Mutation$DeleteUser$deleteUser get deleteUser => CopyWith$Mutation$DeleteUser$deleteUser.stub(_res); } @@ -1807,10 +1774,8 @@ const documentNodeMutationDeleteUser = DocumentNode(definitions: [ ])), fragmentDefinitionbasicMutationReturnFields, ]); - Mutation$DeleteUser _parserFn$Mutation$DeleteUser(Map data) => Mutation$DeleteUser.fromJson(data); - typedef OnMutationCompleted$Mutation$DeleteUser = FutureOr Function( dynamic, Mutation$DeleteUser?); @@ -1890,7 +1855,6 @@ extension ClientExtension$Mutation$DeleteUser on graphql.GraphQLClient { Future> mutate$DeleteUser( Options$Mutation$DeleteUser options) async => await this.mutate(options); - graphql.ObservableQuery watchMutation$DeleteUser( WatchOptions$Mutation$DeleteUser options) => this.watchMutation(options); @@ -2146,7 +2110,6 @@ class _CopyWithImpl$Mutation$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( @@ -2162,7 +2125,6 @@ class _CopyWithStubImpl$Mutation$UpdateUser call({Mutation$UpdateUser$updateUser? updateUser, String? $__typename}) => _res; - CopyWith$Mutation$UpdateUser$updateUser get updateUser => CopyWith$Mutation$UpdateUser$updateUser.stub(_res); } @@ -2226,10 +2188,8 @@ const documentNodeMutationUpdateUser = DocumentNode(definitions: [ fragmentDefinitionbasicMutationReturnFields, fragmentDefinitionuserFields, ]); - Mutation$UpdateUser _parserFn$Mutation$UpdateUser(Map data) => Mutation$UpdateUser.fromJson(data); - typedef OnMutationCompleted$Mutation$UpdateUser = FutureOr Function( dynamic, Mutation$UpdateUser?); @@ -2309,7 +2269,6 @@ extension ClientExtension$Mutation$UpdateUser on graphql.GraphQLClient { Future> mutate$UpdateUser( Options$Mutation$UpdateUser options) async => await this.mutate(options); - graphql.ObservableQuery watchMutation$UpdateUser( WatchOptions$Mutation$UpdateUser options) => this.watchMutation(options); @@ -2452,7 +2411,6 @@ class _CopyWithStubImpl$Mutation$UpdateUser$updateUser String? $__typename, Fragment$userFields? user}) => _res; - CopyWith$Fragment$userFields get user => CopyWith$Fragment$userFields.stub(_res); } @@ -2597,7 +2555,6 @@ class _CopyWithImpl$Mutation$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( @@ -2612,7 +2569,6 @@ class _CopyWithStubImpl$Mutation$AddSshKey TRes _res; call({Mutation$AddSshKey$addSshKey? addSshKey, String? $__typename}) => _res; - CopyWith$Mutation$AddSshKey$addSshKey get addSshKey => CopyWith$Mutation$AddSshKey$addSshKey.stub(_res); } @@ -2676,10 +2632,8 @@ const documentNodeMutationAddSshKey = DocumentNode(definitions: [ fragmentDefinitionbasicMutationReturnFields, fragmentDefinitionuserFields, ]); - Mutation$AddSshKey _parserFn$Mutation$AddSshKey(Map data) => Mutation$AddSshKey.fromJson(data); - typedef OnMutationCompleted$Mutation$AddSshKey = FutureOr Function( dynamic, Mutation$AddSshKey?); @@ -2759,7 +2713,6 @@ extension ClientExtension$Mutation$AddSshKey on graphql.GraphQLClient { Future> mutate$AddSshKey( Options$Mutation$AddSshKey options) async => await this.mutate(options); - graphql.ObservableQuery watchMutation$AddSshKey( WatchOptions$Mutation$AddSshKey options) => this.watchMutation(options); @@ -2902,7 +2855,6 @@ class _CopyWithStubImpl$Mutation$AddSshKey$addSshKey String? $__typename, Fragment$userFields? user}) => _res; - CopyWith$Fragment$userFields get user => CopyWith$Fragment$userFields.stub(_res); } @@ -3051,7 +3003,6 @@ class _CopyWithImpl$Mutation$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( @@ -3069,7 +3020,6 @@ class _CopyWithStubImpl$Mutation$RemoveSshKey {Mutation$RemoveSshKey$removeSshKey? removeSshKey, String? $__typename}) => _res; - CopyWith$Mutation$RemoveSshKey$removeSshKey get removeSshKey => CopyWith$Mutation$RemoveSshKey$removeSshKey.stub(_res); } @@ -3133,11 +3083,9 @@ const documentNodeMutationRemoveSshKey = DocumentNode(definitions: [ fragmentDefinitionbasicMutationReturnFields, fragmentDefinitionuserFields, ]); - Mutation$RemoveSshKey _parserFn$Mutation$RemoveSshKey( Map data) => Mutation$RemoveSshKey.fromJson(data); - typedef OnMutationCompleted$Mutation$RemoveSshKey = FutureOr Function( dynamic, Mutation$RemoveSshKey?); @@ -3220,7 +3168,6 @@ extension ClientExtension$Mutation$RemoveSshKey on graphql.GraphQLClient { Future> mutate$RemoveSshKey( Options$Mutation$RemoveSshKey options) async => await this.mutate(options); - graphql.ObservableQuery watchMutation$RemoveSshKey( WatchOptions$Mutation$RemoveSshKey options) => this.watchMutation(options); @@ -3367,7 +3314,6 @@ class _CopyWithStubImpl$Mutation$RemoveSshKey$removeSshKey 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/server_api/jobs_api.dart b/lib/logic/api_maps/graphql_maps/server_api/jobs_api.dart index f6bf36f8..28f362a9 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 @@ -2,8 +2,8 @@ part of 'server.dart'; mixin JobsApi on ApiMap { Future> getServerJobs() async { - QueryResult response; - List jobs = []; + QueryResult response; + List jobsList = []; try { final GraphQLClient client = await getClient(); @@ -11,14 +11,15 @@ mixin JobsApi on ApiMap { if (response.hasException) { print(response.exception.toString()); } - jobs = response.data!['jobs'] - .map((final e) => ServerJob.fromJson(e)) - .toList(); + jobsList = jobsList = response.parsedData?.jobs.getJobs + .map((final job) => ServerJob.fromGraphQL(job)) + .toList() ?? + []; } catch (e) { print(e); } - return jobs; + return jobsList; } Future removeApiJob(final String uid) async { 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 46dc72ac..e0fb469a 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 @@ -126,32 +126,37 @@ class CloudflareApi extends DnsProviderApi { 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(); - final Response response = await client.get(url); + try { + response = await client.get(url); + final List records = response.data['result'] ?? []; - final List records = response.data['result'] ?? []; - final List allRecords = []; - - 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'], - ), - ); + 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); } - close(client); return allRecords; } diff --git a/lib/logic/models/json/server_job.dart b/lib/logic/models/json/server_job.dart index a54b7651..94b9e432 100644 --- a/lib/logic/models/json/server_job.dart +++ b/lib/logic/models/json/server_job.dart @@ -1,4 +1,5 @@ import 'package:json_annotation/json_annotation.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_api.graphql.dart'; part 'server_job.g.dart'; @@ -20,16 +21,30 @@ class ServerJob { final this.finishedAt, }); + ServerJob.fromGraphQL(final Query$GetApiJobs$jobs$getJobs serverJob) + : this( + createdAt: serverJob.createdAt, + description: serverJob.description, + error: serverJob.error, + finishedAt: serverJob.finishedAt, + name: serverJob.name, + progress: serverJob.progress, + result: serverJob.result, + status: serverJob.status, + statusText: serverJob.statusText, + uid: serverJob.uid, + updatedAt: serverJob.updatedAt, + ); final String name; final String description; final String status; final String uid; - final String updatedAt; + final DateTime updatedAt; final DateTime createdAt; final String? error; final int? progress; final String? result; final String? statusText; - final String? finishedAt; + final DateTime? finishedAt; } diff --git a/lib/logic/models/json/server_job.g.dart b/lib/logic/models/json/server_job.g.dart index 025e1ebc..b74590b6 100644 --- a/lib/logic/models/json/server_job.g.dart +++ b/lib/logic/models/json/server_job.g.dart @@ -11,13 +11,15 @@ ServerJob _$ServerJobFromJson(Map json) => ServerJob( description: json['description'] as String, status: json['status'] as String, uid: json['uid'] as String, - updatedAt: json['updatedAt'] as String, + updatedAt: DateTime.parse(json['updatedAt'] as String), createdAt: DateTime.parse(json['createdAt'] as String), error: json['error'] as String?, progress: json['progress'] as int?, result: json['result'] as String?, statusText: json['statusText'] as String?, - finishedAt: json['finishedAt'] as String?, + finishedAt: json['finishedAt'] == null + ? null + : DateTime.parse(json['finishedAt'] as String), ); Map _$ServerJobToJson(ServerJob instance) => { @@ -25,11 +27,11 @@ Map _$ServerJobToJson(ServerJob instance) => { 'description': instance.description, 'status': instance.status, 'uid': instance.uid, - 'updatedAt': instance.updatedAt, + 'updatedAt': instance.updatedAt.toIso8601String(), 'createdAt': instance.createdAt.toIso8601String(), 'error': instance.error, 'progress': instance.progress, 'result': instance.result, 'statusText': instance.statusText, - 'finishedAt': instance.finishedAt, + 'finishedAt': instance.finishedAt?.toIso8601String(), }; From e4bb35d5d817c2a8c895f566b42a8b970fc0a338 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 9 Sep 2022 12:14:37 +0300 Subject: [PATCH 059/115] Catch cloudflare exceptions --- .../dns_providers/cloudflare/cloudflare.dart | 96 +++++++++++-------- .../rest_maps/dns_providers/dns_provider.dart | 2 +- .../initializing/domain_setup_cubit.dart | 18 ++-- .../server_installation_repository.dart | 8 +- 4 files changed, 69 insertions(+), 55 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 e0fb469a..3088de67 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 @@ -76,22 +76,23 @@ class CloudflareApi extends DnsProviderApi { } @override - Future getZoneId(final String domain) async { - validateStatus = (final status) => - status == HttpStatus.ok || status == HttpStatus.forbidden; + Future getZoneId(final String domain) async { + String? zoneId; + final Dio client = await getClient(); - final Response response = await client.get( - '/zones', - queryParameters: {'name': domain}, - ); - - close(client); - - if (response.data['result'].isEmpty) { - throw DomainNotFoundException('No domains found'); - } else { - return response.data['result'][0]['id']; + try { + final Response response = await client.get( + '/zones', + queryParameters: {'name': domain}, + ); + zoneId = response.data['result'][0]['id']; + } catch (e) { + print(e); + } finally { + close(client); } + + return zoneId; } @override @@ -105,21 +106,25 @@ class CloudflareApi extends DnsProviderApi { final String url = '/zones/$domainZoneId/dns_records'; final Dio client = await getClient(); - final Response response = await client.get(url); + try { + final Response response = await client.get(url); - final List records = response.data['result'] ?? []; - final List allDeleteFutures = []; + 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"]}'), - ); + 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); + } finally { + close(client); } - - await Future.wait(allDeleteFutures); - close(client); } @override @@ -252,27 +257,38 @@ class CloudflareApi extends DnsProviderApi { ); final Dio client = await getClient(); - await client.post( - url, - data: dkimRecord.toJson(), - ); - - client.close(); + try { + await client.post( + url, + data: dkimRecord.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); + } - final Response response = await client.get( - url, - queryParameters: {'per_page': 50}, - ); - - close(client); - return response.data['result'] - .map((final el) => el['name'] as String) - .toList(); + return domains; } } 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 5c2a9369..6680975e 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 @@ -23,7 +23,7 @@ abstract class DnsProviderApi extends ApiMap { final String dkimRecordString, final ServerDomain domain, ); - Future getZoneId(final String domain); + Future getZoneId(final String domain); Future> domainList(); Future isApiTokenValid(final String token); 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 4a14b862..a1c458fb 100644 --- a/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart @@ -31,19 +31,21 @@ class DomainSetupCubit extends Cubit { emit(Loading(LoadingTypes.saving)); - final String zoneId = await serverInstallationCubit + final String? zoneId = await serverInstallationCubit .repository.dnsProviderApiFactory! .getDnsProvider() .getZoneId(domainName); - final ServerDomain domain = ServerDomain( - domainName: domainName, - zoneId: zoneId, - provider: DnsProvider.cloudflare, - ); + if (zoneId != null) { + final ServerDomain domain = ServerDomain( + domainName: domainName, + zoneId: zoneId, + provider: DnsProvider.cloudflare, + ); - serverInstallationCubit.setDomain(domain); - emit(DomainSet()); + serverInstallationCubit.setDomain(domain); + emit(DomainSet()); + } } } diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 0df91227..76089229 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -169,12 +169,8 @@ class ServerInstallationRepository { ), ); - try { - final String domainId = await dnsProviderApi.getZoneId(domain); - return domainId; - } on DomainNotFoundException { - return null; - } + final String? domainId = await dnsProviderApi.getZoneId(domain); + return domainId; } Future> isDnsAddressesMatch( From ae8827975adf4850c27582ad471fe8058fe7a574 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 9 Sep 2022 17:55:04 +0300 Subject: [PATCH 060/115] Fix server_storage_list_item.dart colors and text --- lib/ui/components/brand_divider/brand_divider.dart | 3 +-- lib/ui/pages/server_storage/server_storage_list_item.dart | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/ui/components/brand_divider/brand_divider.dart b/lib/ui/components/brand_divider/brand_divider.dart index 03e44653..646989a1 100644 --- a/lib/ui/components/brand_divider/brand_divider.dart +++ b/lib/ui/components/brand_divider/brand_divider.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:selfprivacy/config/brand_colors.dart'; class BrandDivider extends StatelessWidget { const BrandDivider({final super.key}); @@ -8,6 +7,6 @@ class BrandDivider extends StatelessWidget { Widget build(final BuildContext context) => Container( width: double.infinity, height: 1, - color: BrandColors.dividerColor, + color: Theme.of(context).colorScheme.onSurface.withAlpha(30), ); } diff --git a/lib/ui/pages/server_storage/server_storage_list_item.dart b/lib/ui/pages/server_storage/server_storage_list_item.dart index 4bb8d323..3aad19b2 100644 --- a/lib/ui/pages/server_storage/server_storage_list_item.dart +++ b/lib/ui/pages/server_storage/server_storage_list_item.dart @@ -28,10 +28,10 @@ class ServerStorageListItem extends StatelessWidget { return Row( children: [ if (showIcon) - const Icon( + Icon( Icons.storage_outlined, size: 24, - color: Colors.white, + color: Theme.of(context).colorScheme.onBackground, ), if (showIcon) const SizedBox(width: 16), Expanded( @@ -60,7 +60,7 @@ class ServerStorageListItem extends StatelessWidget { 'providers.storage.disk_total'.tr( args: [ volume.sizeTotal.toString(), - volume.name, + volume.displayName, ], ), style: subtitleStyle, From 11885b7ac7c08ed5b13c1fd700e8e55785a59da7 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 9 Sep 2022 17:57:34 +0300 Subject: [PATCH 061/115] Fix app connecting to 'https://api./' after access recovery We no longer hold server domain in ServerAPI class. Instead, we get a domain from the app config every time. --- lib/logic/api_maps/graphql_maps/server_api/server.dart | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/logic/api_maps/graphql_maps/server_api/server.dart b/lib/logic/api_maps/graphql_maps/server_api/server.dart index b8739f04..56b92371 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/server.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/server.dart @@ -7,7 +7,6 @@ import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_api.graphq import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/services.graphql.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/users.graphql.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/server_disk_volume.dart'; @@ -47,10 +46,8 @@ class ServerApi extends ApiMap this.hasLogger = false, this.isWithToken = true, this.customToken = '', - }) { - final ServerDomain? serverDomain = getIt().serverDomain; - rootAddress = serverDomain?.domainName ?? ''; - } + }); + @override bool hasLogger; @override @@ -58,7 +55,7 @@ class ServerApi extends ApiMap @override String customToken; @override - String? rootAddress; + String? get rootAddress => getIt().serverDomain?.domainName; Future getApiVersion() async { QueryResult response; From ef7d906504a42a301b3f48bc4345a378712ed3b6 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 9 Sep 2022 17:58:01 +0300 Subject: [PATCH 062/115] Catch Hetzner metrics trying to emit when closed and disable logging. --- lib/logic/cubit/hetzner_metrics/hetzner_metrics_cubit.dart | 6 +++++- .../cubit/hetzner_metrics/hetzner_metrics_repository.dart | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/logic/cubit/hetzner_metrics/hetzner_metrics_cubit.dart b/lib/logic/cubit/hetzner_metrics/hetzner_metrics_cubit.dart index aaae36c5..cb398dcd 100644 --- a/lib/logic/cubit/hetzner_metrics/hetzner_metrics_cubit.dart +++ b/lib/logic/cubit/hetzner_metrics/hetzner_metrics_cubit.dart @@ -45,6 +45,10 @@ class HetznerMetricsCubit extends Cubit { () => load(newState.period), ); - emit(newState); + try { + emit(newState); + } on StateError { + print('Tried to emit Hetzner metrics when cubit is closed'); + } } } diff --git a/lib/logic/cubit/hetzner_metrics/hetzner_metrics_repository.dart b/lib/logic/cubit/hetzner_metrics/hetzner_metrics_repository.dart index 0fb780ae..dc0805c7 100644 --- a/lib/logic/cubit/hetzner_metrics/hetzner_metrics_repository.dart +++ b/lib/logic/cubit/hetzner_metrics/hetzner_metrics_repository.dart @@ -21,7 +21,7 @@ class HetznerMetricsRepository { break; } - final HetznerApi api = HetznerApi(hasLogger: true); + final HetznerApi api = HetznerApi(hasLogger: false); final List> results = await Future.wait([ api.getMetrics(start, end, 'cpu'), From b3ba7d959f10fcd0b0fd17be5aa7e3e75e40e159 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Mon, 12 Sep 2022 14:41:22 +0300 Subject: [PATCH 063/115] Rename to org.selfprivacy.app and add flavors. --- android/app/build.gradle | 21 +++++++++++++++++-- android/app/src/debug/AndroidManifest.xml | 2 +- android/app/src/main/AndroidManifest.xml | 2 +- .../selfprivacy/app}/MainActivity.kt | 2 +- android/app/src/profile/AndroidManifest.xml | 2 +- android/build.gradle | 13 ++++++++++++ linux/CMakeLists.txt | 2 +- 7 files changed, 37 insertions(+), 7 deletions(-) rename android/app/src/main/kotlin/{pro/kherel/selfprivacy => org/selfprivacy/app}/MainActivity.kt (75%) diff --git a/android/app/build.gradle b/android/app/build.gradle index 0963724e..3811c5e7 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -26,7 +26,9 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion flutter.compileSdkVersion + namespace 'org.selfprivacy.app' + + compileSdkVersion flutter.compileSdkVersion ndkVersion flutter.ndkVersion sourceSets { @@ -48,7 +50,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "pro.kherel.selfprivacy" + applicationId "org.selfprivacy.app" minSdkVersion 21 targetSdkVersion 31 versionCode flutterVersionCode.toInteger() @@ -62,6 +64,21 @@ android { signingConfig signingConfigs.debug } } + + flavorDimensions "default" + productFlavors { + fdroid { + applicationId "pro.kherel.selfprivacy" + } + production { + applicationIdSuffix "" + } + nightly { + applicationIdSuffix ".nightly" + versionCode project.getVersionCode() + versionName "nightly-" + project.getVersionCode() + } + } } flutter { diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index 27e1af1d..dddeb01f 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="org.selfprivacy.app"> diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 33c2ba9a..50f47475 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="org.selfprivacy.app"> diff --git a/android/build.gradle b/android/build.gradle index 31e95773..d78205d8 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,18 @@ buildscript { ext.kotlin_version = '1.6.10' + ext.getVersionCode = { -> + try { + def stdout = new ByteArrayOutputStream() + exec { + commandLine 'git', 'rev-list', '--first-parent', '--count', 'origin/master' + standardOutput = stdout + } + return Integer.parseInt(stdout.toString().trim()) + } + catch (ignored) { + return -1 + } + } repositories { google() jcenter() diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index cc332a28..94dd8d0b 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -7,7 +7,7 @@ project(runner LANGUAGES CXX) set(BINARY_NAME "selfprivacy") # The unique GTK application identifier for this application. See: # https://wiki.gnome.org/HowDoI/ChooseApplicationID -set(APPLICATION_ID "pro.kherel.selfprivacy") +set(APPLICATION_ID "org.selfprivacy.app") # Explicitly opt in to modern CMake behaviors to avoid warnings with recent # versions of CMake. From c5eed6ace958aa78428d234950f9d50d478e922b Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 12 Sep 2022 20:38:22 +0300 Subject: [PATCH 064/115] Improve server settings page --- assets/translations/en.json | 7 +++++ assets/translations/ru.json | 7 +++++ .../graphql_maps/server_api/server.dart | 22 ++++++++++++++ lib/logic/api_maps/rest_maps/server.dart | 17 +++++++---- .../server_detailed_info_repository.dart | 17 +++++------ lib/logic/models/timezone_settings.dart | 11 ++++--- .../pages/server_details/server_settings.dart | 29 +++++++------------ 7 files changed, 73 insertions(+), 37 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index 6a3317a1..61d60767 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -101,6 +101,13 @@ "month": "Month", "day": "Day", "hour": "Hour" + }, + "settings": { + "allow_autoupgrade": "Allow auto-upgrade", + "allow_autoupgrade_hint": "Allow automatic packages upgrades on server", + "reboot_after_upgrade": "Reboot after upgrade", + "reboot_after_upgrade_hint": "Reboot without prompt after applying changes on server", + "server_timezone": "Server timezone" } }, "domain": { diff --git a/assets/translations/ru.json b/assets/translations/ru.json index abb9a2d6..9040ed80 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -101,6 +101,13 @@ "month": "Месяц", "day": "День", "hour": "Час" + }, + "settings": { + "allow_autoupgrade": "Разрешить авто-обноления", + "allow_autoupgrade_hint": "Разрешить автоматичесую установку обновлений на сервер", + "reboot_after_upgrade": "Перезагружать после обновлений", + "reboot_after_upgrade_hint": "Автоматически перезагружать сервер после применения обновлений", + "server_timezone": "Часовой пояс сервера" } }, "domain": { diff --git a/lib/logic/api_maps/graphql_maps/server_api/server.dart b/lib/logic/api_maps/graphql_maps/server_api/server.dart index 56b92371..3cb39d89 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/server.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/server.dart @@ -126,4 +126,26 @@ class ServerApi extends ApiMap print(e); } } + + Future setAutoUpgradeSettings( + final bool allowReboot, + final bool enableAutoUpgrade, + ) async { + try { + final GraphQLClient client = await getClient(); + final input = Input$AutoUpgradeSettingsInput( + allowReboot: allowReboot, + enableAutoUpgrade: enableAutoUpgrade, + ); + final variables = Variables$Mutation$ChangeAutoUpgradeSettings( + settings: input, + ); + final mutation = Options$Mutation$ChangeAutoUpgradeSettings( + variables: variables, + ); + await client.mutate$ChangeAutoUpgradeSettings(mutation); + } catch (e) { + print(e); + } + } } diff --git a/lib/logic/api_maps/rest_maps/server.dart b/lib/logic/api_maps/rest_maps/server.dart index edffda09..3660d499 100644 --- a/lib/logic/api_maps/rest_maps/server.dart +++ b/lib/logic/api_maps/rest_maps/server.dart @@ -603,13 +603,20 @@ class ServerApi extends ApiMap { } Future getServerTimezone() async { - // I am not sure how to initialize TimeZoneSettings with default value... + TimeZoneSettings settings = TimeZoneSettings(); final Dio client = await getClient(); - final Response response = - await client.get('/system/configuration/timezone'); - close(client); + try { + final Response response = await client.get( + '/system/configuration/timezone', + ); + settings = TimeZoneSettings.fromString(response.data); + } catch (e) { + print(e); + } finally { + close(client); + } - return TimeZoneSettings.fromString(response.data); + return settings; } Future updateServerTimezone(final TimeZoneSettings settings) async { 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 e5858d2d..4cbe3e87 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 @@ -5,17 +5,14 @@ import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart'; import 'package:selfprivacy/logic/models/timezone_settings.dart'; class ServerDetailsRepository { - HetznerApi hetznerAPi = HetznerApi(); - ServerApi selfprivacyServer = ServerApi(); + HetznerApi hetzner = HetznerApi(); + ServerApi server = ServerApi(); - Future load() async { - print('load'); - return ServerDetailsRepositoryDto( - autoUpgradeSettings: await selfprivacyServer.getAutoUpgradeSettings(), - hetznerServerInfo: await hetznerAPi.getInfo(), - serverTimezone: await selfprivacyServer.getServerTimezone(), - ); - } + Future load() async => ServerDetailsRepositoryDto( + autoUpgradeSettings: await server.getAutoUpgradeSettings(), + hetznerServerInfo: await hetzner.getInfo(), + serverTimezone: await server.getServerTimezone(), + ); } class ServerDetailsRepositoryDto { diff --git a/lib/logic/models/timezone_settings.dart b/lib/logic/models/timezone_settings.dart index 22c84b44..4b4334af 100644 --- a/lib/logic/models/timezone_settings.dart +++ b/lib/logic/models/timezone_settings.dart @@ -3,13 +3,16 @@ import 'package:timezone/timezone.dart'; class TimeZoneSettings { factory TimeZoneSettings.fromString(final String string) { final Location location = timeZoneDatabase.locations[string]!; - return TimeZoneSettings(location); + return TimeZoneSettings(timezone: location); } - TimeZoneSettings(this.timezone); - final Location timezone; + TimeZoneSettings({this.timezone}); + final Location? timezone; Map toJson() => { - 'timezone': timezone.name, + 'timezone': timezone?.name ?? 'Unknown', }; + + @override + String toString() => timezone?.name ?? 'Unknown'; } diff --git a/lib/ui/pages/server_details/server_settings.dart b/lib/ui/pages/server_details/server_settings.dart index 18d425e6..418014c2 100644 --- a/lib/ui/pages/server_details/server_settings.dart +++ b/lib/ui/pages/server_details/server_settings.dart @@ -11,7 +11,7 @@ class _ServerSettings extends StatelessWidget { Widget build(final BuildContext context) { final serverDetailsState = context.watch().state; if (serverDetailsState is ServerDetailsNotReady) { - return const Text('not ready'); + return Text('basis.loading'.tr()); } else if (serverDetailsState is! Loaded) { return BrandLoader.horizontal(); } @@ -38,19 +38,17 @@ class _ServerSettings extends StatelessWidget { SwitcherBlock( onChange: (final _) {}, isActive: serverDetailsState.autoUpgradeSettings.enable, - child: const _TextColumn( - title: 'Allow Auto-upgrade', - value: 'Wether to allow automatic packages upgrades', - hasWarning: false, + child: _TextColumn( + title: 'providers.server.settings.allow_autoupgrade'.tr(), + value: 'providers.server.settings.allow_autoupgrade_hint'.tr(), ), ), SwitcherBlock( onChange: (final _) {}, isActive: serverDetailsState.autoUpgradeSettings.allowReboot, - child: const _TextColumn( - title: 'Reboot after upgrade', - value: 'Reboot without prompt after applying updates', - hasWarning: false, + child: _TextColumn( + title: 'providers.server.settings.reboot_after_upgrade'.tr(), + value: 'providers.server.settings.reboot_after_upgrade_hint'.tr(), ), ), _Button( @@ -58,9 +56,8 @@ class _ServerSettings extends StatelessWidget { Navigator.of(context).push(materialRoute(const SelectTimezone())); }, child: _TextColumn( - title: 'Server Timezone', - value: serverDetailsState.serverTimezone.timezone.name, - hasWarning: false, + title: 'providers.server.settings.server_timezone'.tr(), + value: serverDetailsState.serverTimezone.toString(), ), ), ], @@ -108,16 +105,12 @@ class _TextColumn extends StatelessWidget { children: [ BrandText.body1( title, - style: TextStyle(color: hasWarning ? BrandColors.warning : null), + style: Theme.of(context).textTheme.bodyLarge, ), const SizedBox(height: 5), BrandText.body1( value, - style: TextStyle( - fontSize: 13, - height: 1.53, - color: hasWarning ? BrandColors.warning : BrandColors.gray1, - ), + style: Theme.of(context).textTheme.bodyMedium, ), ], ); From 7e10c1324ca268502ce330f310ad659a54ffa6cd Mon Sep 17 00:00:00 2001 From: Inex Code Date: Wed, 14 Sep 2022 16:37:29 +0300 Subject: [PATCH 065/115] Remove BrandDivider and use vanilla instead. --- lib/ui/components/one_page/one_page.dart | 48 ------------------- .../pages/more/app_settings/app_setting.dart | 32 ++++--------- lib/ui/pages/more/console/console.dart | 4 +- lib/ui/pages/more/info/info.dart | 2 - .../server_details/server_details_screen.dart | 2 - .../pages/server_details/server_settings.dart | 10 ++-- 6 files changed, 12 insertions(+), 86 deletions(-) delete mode 100644 lib/ui/components/one_page/one_page.dart diff --git a/lib/ui/components/one_page/one_page.dart b/lib/ui/components/one_page/one_page.dart deleted file mode 100644 index d16dd5f3..00000000 --- a/lib/ui/components/one_page/one_page.dart +++ /dev/null @@ -1,48 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:selfprivacy/ui/components/brand_divider/brand_divider.dart'; -import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; -import 'package:easy_localization/easy_localization.dart'; -import 'package:selfprivacy/ui/components/pre_styled_buttons/pre_styled_buttons.dart'; - -class OnePage extends StatelessWidget { - const OnePage({ - required this.title, - required this.child, - final super.key, - }); - - final String title; - final Widget child; - - @override - Widget build(final BuildContext context) => Scaffold( - appBar: PreferredSize( - preferredSize: const Size.fromHeight(52), - child: Column( - children: [ - Container( - height: 51, - alignment: Alignment.center, - padding: const EdgeInsets.symmetric(horizontal: 15), - child: BrandText.h4('basis.details'.tr()), - ), - const BrandDivider(), - ], - ), - ), - body: child, - bottomNavigationBar: SafeArea( - child: Container( - decoration: BoxDecoration(boxShadow: kElevationToShadow[3]), - height: kBottomNavigationBarHeight, - child: Container( - color: Theme.of(context).scaffoldBackgroundColor, - alignment: Alignment.center, - child: PreStyledButtons.close( - onPress: () => Navigator.of(context).pop(), - ), - ), - ), - ), - ); -} diff --git a/lib/ui/pages/more/app_settings/app_setting.dart b/lib/ui/pages/more/app_settings/app_setting.dart index 862815c1..8c2cf506 100644 --- a/lib/ui/pages/more/app_settings/app_setting.dart +++ b/lib/ui/pages/more/app_settings/app_setting.dart @@ -5,7 +5,6 @@ import 'package:selfprivacy/logic/cubit/app_settings/app_settings_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/ui/components/action_button/action_button.dart'; import 'package:selfprivacy/ui/components/brand_alert/brand_alert.dart'; -import 'package:selfprivacy/ui/components/brand_divider/brand_divider.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; import 'package:selfprivacy/ui/components/brand_switch/brand_switch.dart'; import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; @@ -38,15 +37,9 @@ class _AppSettingsPageState extends State { body: ListView( padding: paddingH15V0, children: [ - const BrandDivider(), + const Divider(height: 1), Container( - padding: const EdgeInsets.only(top: 20, bottom: 5), - decoration: const BoxDecoration( - border: Border( - bottom: - BorderSide(width: 1, color: BrandColors.dividerColor), - ), - ), + padding: const EdgeInsets.symmetric(vertical: 16), child: Row( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -68,14 +61,9 @@ class _AppSettingsPageState extends State { ], ), ), + const Divider(height: 0), Container( - padding: const EdgeInsets.only(top: 20, bottom: 5), - decoration: const BoxDecoration( - border: Border( - bottom: - BorderSide(width: 1, color: BrandColors.dividerColor), - ), - ), + padding: const EdgeInsets.symmetric(vertical: 16), child: Row( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -127,7 +115,8 @@ class _AppSettingsPageState extends State { ], ), ), - deleteServer(context) + const Divider(height: 0), + _DeleteServer(context) ], ), ), @@ -135,16 +124,11 @@ class _AppSettingsPageState extends State { ); } - Widget deleteServer(final BuildContext context) { + Widget _DeleteServer(final BuildContext context) { final bool isDisabled = context.watch().state.serverDetails == null; return Container( - padding: const EdgeInsets.only(top: 20, bottom: 5), - decoration: const BoxDecoration( - border: Border( - bottom: BorderSide(width: 1, color: BrandColors.dividerColor), - ), - ), + padding: const EdgeInsets.symmetric(vertical: 16), child: Row( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, diff --git a/lib/ui/pages/more/console/console.dart b/lib/ui/pages/more/console/console.dart index 76703444..e3951013 100644 --- a/lib/ui/pages/more/console/console.dart +++ b/lib/ui/pages/more/console/console.dart @@ -4,7 +4,6 @@ import 'package:flutter/material.dart'; import 'package:selfprivacy/config/brand_colors.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/models/message.dart'; -import 'package:selfprivacy/ui/components/brand_divider/brand_divider.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; class Console extends StatefulWidget { @@ -37,8 +36,7 @@ class _ConsoleState extends State { preferredSize: const Size.fromHeight(53), child: Column( children: const [ - BrandHeader(title: 'Console', hasBackButton: true), - BrandDivider(), + BrandHeader(title: 'Console', hasBackButton: true) ], ), ), diff --git a/lib/ui/pages/more/info/info.dart b/lib/ui/pages/more/info/info.dart index ac0419fc..8d2526d6 100644 --- a/lib/ui/pages/more/info/info.dart +++ b/lib/ui/pages/more/info/info.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:selfprivacy/config/brand_theme.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server.dart'; -import 'package:selfprivacy/ui/components/brand_divider/brand_divider.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; import 'package:package_info/package_info.dart'; @@ -21,7 +20,6 @@ class InfoPage extends StatelessWidget { body: ListView( padding: paddingH15V0, children: [ - const BrandDivider(), const SizedBox(height: 10), FutureBuilder( future: _packageVersion(), diff --git a/lib/ui/pages/server_details/server_details_screen.dart b/lib/ui/pages/server_details/server_details_screen.dart index 1f442220..38edcc63 100644 --- a/lib/ui/pages/server_details/server_details_screen.dart +++ b/lib/ui/pages/server_details/server_details_screen.dart @@ -8,7 +8,6 @@ import 'package:selfprivacy/logic/cubit/hetzner_metrics/hetzner_metrics_cubit.da import 'package:selfprivacy/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/models/state_types.dart'; -import 'package:selfprivacy/ui/components/brand_divider/brand_divider.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart'; import 'package:selfprivacy/ui/components/brand_loader/brand_loader.dart'; @@ -78,7 +77,6 @@ class _ServerDetailsScreenState extends State padding: const EdgeInsets.symmetric(horizontal: 15), child: BrandText.h4('basis.details'.tr()), ), - const BrandDivider(), ], ), ), diff --git a/lib/ui/pages/server_details/server_settings.dart b/lib/ui/pages/server_details/server_settings.dart index 418014c2..a5c98ff3 100644 --- a/lib/ui/pages/server_details/server_settings.dart +++ b/lib/ui/pages/server_details/server_settings.dart @@ -34,7 +34,6 @@ class _ServerSettings extends StatelessWidget { ], ), ), - const BrandDivider(), SwitcherBlock( onChange: (final _) {}, isActive: serverDetailsState.autoUpgradeSettings.enable, @@ -43,6 +42,7 @@ class _ServerSettings extends StatelessWidget { value: 'providers.server.settings.allow_autoupgrade_hint'.tr(), ), ), + const Divider(height: 0), SwitcherBlock( onChange: (final _) {}, isActive: serverDetailsState.autoUpgradeSettings.allowReboot, @@ -51,6 +51,7 @@ class _ServerSettings extends StatelessWidget { value: 'providers.server.settings.reboot_after_upgrade_hint'.tr(), ), ), + const Divider(height: 0), _Button( onTap: () { Navigator.of(context).push(materialRoute(const SelectTimezone())); @@ -78,12 +79,7 @@ class _Button extends StatelessWidget { Widget build(final BuildContext context) => InkWell( onTap: onTap, child: Container( - padding: const EdgeInsets.only(top: 20, bottom: 5), - decoration: const BoxDecoration( - border: Border( - bottom: BorderSide(width: 1, color: BrandColors.dividerColor), - ), - ), + padding: const EdgeInsets.symmetric(vertical: 16), child: child, ), ); From 31624a3412587fb4254bdeb1530c3369f5bf09c4 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Wed, 14 Sep 2022 16:37:29 +0300 Subject: [PATCH 066/115] Remove BrandDivider and use vanilla instead. --- lib/ui/components/brand_divider/brand_divider.dart | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 lib/ui/components/brand_divider/brand_divider.dart diff --git a/lib/ui/components/brand_divider/brand_divider.dart b/lib/ui/components/brand_divider/brand_divider.dart deleted file mode 100644 index 646989a1..00000000 --- a/lib/ui/components/brand_divider/brand_divider.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:flutter/material.dart'; - -class BrandDivider extends StatelessWidget { - const BrandDivider({final super.key}); - - @override - Widget build(final BuildContext context) => Container( - width: double.infinity, - height: 1, - color: Theme.of(context).colorScheme.onSurface.withAlpha(30), - ); -} From 1a17f73df464ea95c9bb818bcce0018621c7da28 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Wed, 14 Sep 2022 18:14:55 +0300 Subject: [PATCH 067/115] Delete unused UI components. --- .../brand_modal_sheet/brand_modal_sheet.dart | 63 -------------- .../components/brand_radio/brand_radio.dart | 2 + .../brand_radio_tile/brand_radio_tile.dart | 2 + .../brand_span_button/brand_span_button.dart | 35 -------- lib/ui/components/brand_text/brand_text.dart | 2 + .../dots_indicator/dots_indicator.dart | 33 ------- .../components/pre_styled_buttons/close.dart | 19 ---- .../components/pre_styled_buttons/flash.dart | 87 ------------------- .../pre_styled_buttons/flash_fab.dart | 1 + .../pre_styled_buttons.dart | 22 ----- lib/utils/extensions/elevation_extension.dart | 32 ------- lib/utils/route_transitions/slide_bottom.dart | 49 ----------- lib/utils/route_transitions/slide_right.dart | 48 ---------- 13 files changed, 7 insertions(+), 388 deletions(-) delete mode 100644 lib/ui/components/brand_modal_sheet/brand_modal_sheet.dart delete mode 100644 lib/ui/components/brand_span_button/brand_span_button.dart delete mode 100644 lib/ui/components/dots_indicator/dots_indicator.dart delete mode 100644 lib/ui/components/pre_styled_buttons/close.dart delete mode 100644 lib/ui/components/pre_styled_buttons/flash.dart delete mode 100644 lib/ui/components/pre_styled_buttons/pre_styled_buttons.dart delete mode 100644 lib/utils/extensions/elevation_extension.dart delete mode 100644 lib/utils/route_transitions/slide_bottom.dart delete mode 100644 lib/utils/route_transitions/slide_right.dart diff --git a/lib/ui/components/brand_modal_sheet/brand_modal_sheet.dart b/lib/ui/components/brand_modal_sheet/brand_modal_sheet.dart deleted file mode 100644 index 6435f7bc..00000000 --- a/lib/ui/components/brand_modal_sheet/brand_modal_sheet.dart +++ /dev/null @@ -1,63 +0,0 @@ -// import 'package:flutter/material.dart'; - -// var navigatorKey = GlobalKey(); - -// class BrandModalSheet extends StatelessWidget { -// const BrandModalSheet({ -// Key? key, -// this.child, -// }) : super(key: key); - -// final Widget? child; -// @override -// Widget build(BuildContext context) { -// return DraggableScrollableSheet( -// minChildSize: 1, -// initialChildSize: 1, -// maxChildSize: 1, -// builder: (context, scrollController) { -// return SingleChildScrollView( -// controller: scrollController, -// physics: ClampingScrollPhysics(), -// child: Container( -// child: Column( -// children: [ -// GestureDetector( -// onTap: () => Navigator.of(context).pop(), -// behavior: HitTestBehavior.opaque, -// child: Container( -// width: double.infinity, -// child: Center( -// child: Padding( -// padding: EdgeInsets.only(top: 132, bottom: 6), -// child: Container( -// height: 4, -// width: 30, -// decoration: BoxDecoration( -// borderRadius: BorderRadius.circular(2), -// color: Color(0xFFE3E3E3).withOpacity(0.65), -// ), -// ), -// ), -// ), -// ), -// ), -// Container( -// constraints: BoxConstraints( -// minHeight: MediaQuery.of(context).size.height - 132, -// maxHeight: MediaQuery.of(context).size.height - 132, -// ), -// decoration: BoxDecoration( -// borderRadius: -// BorderRadius.vertical(top: Radius.circular(20)), -// color: Theme.of(context).scaffoldBackgroundColor, -// ), -// width: double.infinity, -// child: child), -// ], -// ), -// ), -// ); -// }); -// } -// } diff --git a/lib/ui/components/brand_radio/brand_radio.dart b/lib/ui/components/brand_radio/brand_radio.dart index 60f41fb5..2dc8fc00 100644 --- a/lib/ui/components/brand_radio/brand_radio.dart +++ b/lib/ui/components/brand_radio/brand_radio.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:selfprivacy/config/brand_colors.dart'; +// TODO: Delete this file. + class BrandRadio extends StatelessWidget { const BrandRadio({ required this.isChecked, diff --git a/lib/ui/components/brand_radio_tile/brand_radio_tile.dart b/lib/ui/components/brand_radio_tile/brand_radio_tile.dart index 5b18247d..3226c97b 100644 --- a/lib/ui/components/brand_radio_tile/brand_radio_tile.dart +++ b/lib/ui/components/brand_radio_tile/brand_radio_tile.dart @@ -2,6 +2,8 @@ import 'package:flutter/material.dart'; import 'package:selfprivacy/ui/components/brand_radio/brand_radio.dart'; import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; +// TODO: Delete this file + class BrandRadioTile extends StatelessWidget { const BrandRadioTile({ required this.isChecked, diff --git a/lib/ui/components/brand_span_button/brand_span_button.dart b/lib/ui/components/brand_span_button/brand_span_button.dart deleted file mode 100644 index de19730e..00000000 --- a/lib/ui/components/brand_span_button/brand_span_button.dart +++ /dev/null @@ -1,35 +0,0 @@ -import 'package:flutter/gestures.dart'; -import 'package:flutter/material.dart'; -import 'package:selfprivacy/config/brand_colors.dart'; -import 'package:url_launcher/url_launcher.dart'; - -class BrandSpanButton extends TextSpan { - BrandSpanButton({ - required final String text, - required final VoidCallback onTap, - final TextStyle? style, - }) : super( - recognizer: TapGestureRecognizer()..onTap = onTap, - text: text, - style: (style ?? const TextStyle()).copyWith(color: BrandColors.blue), - ); - - BrandSpanButton.link({ - required final String text, - final String? urlString, - final TextStyle? style, - }) : super( - recognizer: TapGestureRecognizer() - ..onTap = () => _launchURL(urlString ?? text), - text: text, - style: (style ?? const TextStyle()).copyWith(color: BrandColors.blue), - ); - - static Future _launchURL(final String link) async { - if (await canLaunchUrl(Uri.parse(link))) { - await launchUrl(Uri.parse(link)); - } else { - throw 'Could not launch $link'; - } - } -} diff --git a/lib/ui/components/brand_text/brand_text.dart b/lib/ui/components/brand_text/brand_text.dart index 544ffcec..00e9d736 100644 --- a/lib/ui/components/brand_text/brand_text.dart +++ b/lib/ui/components/brand_text/brand_text.dart @@ -2,6 +2,8 @@ import 'package:flutter/material.dart'; import 'package:selfprivacy/config/text_themes.dart'; export 'package:selfprivacy/utils/extensions/text_extensions.dart'; +// TODO: Delete this file + enum TextType { h1, // right now only at onboarding and opened providers h2, // cards titles diff --git a/lib/ui/components/dots_indicator/dots_indicator.dart b/lib/ui/components/dots_indicator/dots_indicator.dart deleted file mode 100644 index fff647b7..00000000 --- a/lib/ui/components/dots_indicator/dots_indicator.dart +++ /dev/null @@ -1,33 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:selfprivacy/config/brand_colors.dart'; - -class DotsIndicator extends StatelessWidget { - const DotsIndicator({ - required this.activeIndex, - required this.count, - final super.key, - }); - - final int activeIndex; - final int count; - - @override - Widget build(final BuildContext context) { - final List dots = List.generate( - count, - (final index) => Container( - margin: const EdgeInsets.symmetric(horizontal: 5, vertical: 10), - height: 10, - width: 10, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: index == activeIndex ? BrandColors.blue : BrandColors.gray2, - ), - ), - ); - return Row( - mainAxisAlignment: MainAxisAlignment.center, - children: dots, - ); - } -} diff --git a/lib/ui/components/pre_styled_buttons/close.dart b/lib/ui/components/pre_styled_buttons/close.dart deleted file mode 100644 index 48a1bddb..00000000 --- a/lib/ui/components/pre_styled_buttons/close.dart +++ /dev/null @@ -1,19 +0,0 @@ -part of 'pre_styled_buttons.dart'; - -class _CloseButton extends StatelessWidget { - const _CloseButton({required this.onPress}); - - final VoidCallback onPress; - - @override - Widget build(final BuildContext context) => OutlinedButton( - onPressed: () => Navigator.of(context).pop(), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - BrandText.h4('basis.close'.tr()), - const Icon(Icons.close), - ], - ), - ); -} diff --git a/lib/ui/components/pre_styled_buttons/flash.dart b/lib/ui/components/pre_styled_buttons/flash.dart deleted file mode 100644 index 3e780fd7..00000000 --- a/lib/ui/components/pre_styled_buttons/flash.dart +++ /dev/null @@ -1,87 +0,0 @@ -part of 'pre_styled_buttons.dart'; - -class _BrandFlashButton extends StatefulWidget { - @override - _BrandFlashButtonState createState() => _BrandFlashButtonState(); -} - -class _BrandFlashButtonState extends State<_BrandFlashButton> - with SingleTickerProviderStateMixin { - late AnimationController _animationController; - late Animation _colorTween; - - @override - void initState() { - _animationController = AnimationController( - vsync: this, - duration: const Duration(milliseconds: 800), - ); - _colorTween = ColorTween( - begin: BrandColors.black, - end: BrandColors.primary, - ).animate(_animationController); - - super.initState(); - WidgetsBinding.instance.addPostFrameCallback(_afterLayout); - } - - void _afterLayout(final _) { - if (Theme.of(context).brightness == Brightness.dark) { - setState(() { - _colorTween = ColorTween( - begin: BrandColors.white, - end: BrandColors.primary, - ).animate(_animationController); - }); - } - } - - @override - void dispose() { - _animationController.dispose(); - super.dispose(); - } - - bool wasPrevStateIsEmpty = true; - - @override - Widget build(final BuildContext context) => - BlocListener( - listener: (final context, final state) { - if (wasPrevStateIsEmpty && state is! JobsStateEmpty) { - wasPrevStateIsEmpty = false; - _animationController.forward(); - } else if (!wasPrevStateIsEmpty && state is JobsStateEmpty) { - wasPrevStateIsEmpty = true; - - _animationController.reverse(); - } - }, - child: IconButton( - onPressed: () { - showBrandBottomSheet( - context: context, - builder: (final context) => const BrandBottomSheet( - isExpended: true, - child: JobsContent(), - ), - ); - }, - icon: AnimatedBuilder( - animation: _colorTween, - builder: (final context, final child) { - final double v = _animationController.value; - final IconData icon = - v > 0.5 ? Ionicons.flash : Ionicons.flash_outline; - return Transform.scale( - scale: 1 + (v < 0.5 ? v : 1 - v) * 2, - child: Icon( - icon, - color: _colorTween.value, - ), - ); - }, - ), - ), - ); -} diff --git a/lib/ui/components/pre_styled_buttons/flash_fab.dart b/lib/ui/components/pre_styled_buttons/flash_fab.dart index c9fb754f..b97f3bd6 100644 --- a/lib/ui/components/pre_styled_buttons/flash_fab.dart +++ b/lib/ui/components/pre_styled_buttons/flash_fab.dart @@ -55,6 +55,7 @@ class _BrandFabState extends State }, child: FloatingActionButton( onPressed: () { + // TODO: Make a hero animation to the screen showBrandBottomSheet( context: context, builder: (final BuildContext context) => const BrandBottomSheet( diff --git a/lib/ui/components/pre_styled_buttons/pre_styled_buttons.dart b/lib/ui/components/pre_styled_buttons/pre_styled_buttons.dart deleted file mode 100644 index 5649236c..00000000 --- a/lib/ui/components/pre_styled_buttons/pre_styled_buttons.dart +++ /dev/null @@ -1,22 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:ionicons/ionicons.dart'; -import 'package:selfprivacy/config/brand_colors.dart'; -import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart'; -import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart'; -import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; -import 'package:easy_localization/easy_localization.dart'; -import 'package:selfprivacy/ui/components/jobs_content/jobs_content.dart'; -import 'package:selfprivacy/ui/helpers/modals.dart'; - -part 'close.dart'; -part 'flash.dart'; - -class PreStyledButtons { - static Widget close({ - required final VoidCallback onPress, - }) => - _CloseButton(onPress: onPress); - - static Widget flash() => _BrandFlashButton(); -} diff --git a/lib/utils/extensions/elevation_extension.dart b/lib/utils/extensions/elevation_extension.dart deleted file mode 100644 index 9c6bbc14..00000000 --- a/lib/utils/extensions/elevation_extension.dart +++ /dev/null @@ -1,32 +0,0 @@ -library elevation_extension; - -import 'package:flutter/material.dart'; -import 'package:flutter/cupertino.dart'; - -extension ElevationExtension on BoxDecoration { - BoxDecoration copyWith({ - final Color? color, - final DecorationImage? image, - final BoxBorder? border, - final BorderRadiusGeometry? borderRadius, - final List? boxShadow, - final Gradient? gradient, - final BlendMode? backgroundBlendMode, - final BoxShape? shape, - }) => - BoxDecoration( - color: color ?? this.color, - image: image ?? this.image, - border: border ?? this.border, - borderRadius: borderRadius ?? this.borderRadius, - boxShadow: this.boxShadow != null || boxShadow != null - ? [ - ...this.boxShadow ?? [], - ...boxShadow ?? [] - ] - : null, - gradient: gradient ?? this.gradient, - backgroundBlendMode: backgroundBlendMode ?? this.backgroundBlendMode, - shape: shape ?? this.shape, - ); -} diff --git a/lib/utils/route_transitions/slide_bottom.dart b/lib/utils/route_transitions/slide_bottom.dart deleted file mode 100644 index e187b4d7..00000000 --- a/lib/utils/route_transitions/slide_bottom.dart +++ /dev/null @@ -1,49 +0,0 @@ -import 'package:flutter/material.dart'; - -Function pageBuilder = (final Widget widget) => ( - final BuildContext context, - final Animation animation, - final Animation secondaryAnimation, - ) => - widget; - -Function transitionsBuilder = ( - final BuildContext context, - final Animation animation, - final Animation secondaryAnimation, - final Widget child, -) => - SlideTransition( - position: Tween( - begin: const Offset(0, 1), - end: Offset.zero, - ).animate(animation), - child: Container( - decoration: animation.isCompleted - ? null - : const BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.black, - ), - ), - ), - child: child, - ), - ); - -class SlideBottomRoute extends PageRouteBuilder { - SlideBottomRoute(this.widget) - : super( - transitionDuration: const Duration(milliseconds: 150), - pageBuilder: pageBuilder(widget), - transitionsBuilder: transitionsBuilder as Widget Function( - BuildContext, - Animation, - Animation, - Widget, - ), - ); - - final Widget widget; -} diff --git a/lib/utils/route_transitions/slide_right.dart b/lib/utils/route_transitions/slide_right.dart deleted file mode 100644 index eae4414d..00000000 --- a/lib/utils/route_transitions/slide_right.dart +++ /dev/null @@ -1,48 +0,0 @@ -import 'package:flutter/material.dart'; - -Function pageBuilder = (final Widget widget) => ( - final BuildContext context, - final Animation animation, - final Animation secondaryAnimation, - ) => - widget; - -Function transitionsBuilder = ( - final BuildContext context, - final Animation animation, - final Animation secondaryAnimation, - final Widget child, -) => - SlideTransition( - position: Tween( - begin: const Offset(-1, 0), - end: Offset.zero, - ).animate(animation), - child: Container( - decoration: animation.isCompleted - ? null - : const BoxDecoration( - border: Border( - right: BorderSide( - color: Colors.black, - ), - ), - ), - child: child, - ), - ); - -class SlideRightRoute extends PageRouteBuilder { - SlideRightRoute(this.widget) - : super( - pageBuilder: pageBuilder(widget), - transitionsBuilder: transitionsBuilder as Widget Function( - BuildContext, - Animation, - Animation, - Widget, - ), - ); - - final Widget widget; -} From 34837d8e29524c1c0b835ac3423528e1a6b67fd3 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Wed, 14 Sep 2022 19:45:50 +0300 Subject: [PATCH 068/115] Introducing InfoBox widget, small UI fixes --- lib/ui/components/info_box/info_box.dart | 31 +++++++++++++++++++ .../components/switch_block/switch_bloc.dart | 9 ++---- lib/ui/pages/devices/devices.dart | 16 ++-------- .../recovery_key/recovery_key_receiving.dart | 10 ++---- lib/ui/pages/services/service_page.dart | 1 + lib/ui/pages/users/user_details.dart | 12 ++----- lib/ui/pages/users/users.dart | 1 + 7 files changed, 43 insertions(+), 37 deletions(-) create mode 100644 lib/ui/components/info_box/info_box.dart diff --git a/lib/ui/components/info_box/info_box.dart b/lib/ui/components/info_box/info_box.dart new file mode 100644 index 00000000..5a4129c2 --- /dev/null +++ b/lib/ui/components/info_box/info_box.dart @@ -0,0 +1,31 @@ +import 'package:flutter/material.dart'; + +class InfoBox extends StatelessWidget { + const InfoBox({ + required this.text, + this.isWarning = false, + final super.key, + }); + + final String text; + final bool isWarning; + + @override + Widget build(final BuildContext context) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Icon( + isWarning ? Icons.warning_amber_outlined : Icons.info_outline, + size: 24, + color: Theme.of(context).colorScheme.onBackground, + ), + const SizedBox(height: 16), + Text( + text, + style: Theme.of(context).textTheme.bodyMedium!.copyWith( + color: Theme.of(context).colorScheme.onBackground, + ), + ), + ], + ); +} diff --git a/lib/ui/components/switch_block/switch_bloc.dart b/lib/ui/components/switch_block/switch_bloc.dart index ae593f1e..cce3b742 100644 --- a/lib/ui/components/switch_block/switch_bloc.dart +++ b/lib/ui/components/switch_block/switch_bloc.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:selfprivacy/config/brand_colors.dart'; +// TODO: Delete this file. + class SwitcherBlock extends StatelessWidget { const SwitcherBlock({ required this.child, @@ -15,12 +17,7 @@ class SwitcherBlock extends StatelessWidget { @override Widget build(final BuildContext context) => Container( - padding: const EdgeInsets.only(top: 20, bottom: 5), - decoration: const BoxDecoration( - border: Border( - bottom: BorderSide(width: 1, color: BrandColors.dividerColor), - ), - ), + padding: const EdgeInsets.symmetric(vertical: 16), child: Row( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, diff --git a/lib/ui/pages/devices/devices.dart b/lib/ui/pages/devices/devices.dart index ad48096e..e89535ab 100644 --- a/lib/ui/pages/devices/devices.dart +++ b/lib/ui/pages/devices/devices.dart @@ -6,6 +6,7 @@ import 'package:selfprivacy/logic/cubit/devices/devices_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/models/json/api_token.dart'; import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; +import 'package:selfprivacy/ui/components/info_box/info_box.dart'; import 'package:selfprivacy/ui/pages/devices/new_device.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; @@ -51,20 +52,7 @@ class _DevicesScreenState extends State { const SizedBox(height: 16), const Divider(height: 1), const SizedBox(height: 16), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Icon( - Icons.info_outline, - color: Theme.of(context).colorScheme.onBackground, - ), - const SizedBox(height: 16), - Text( - 'devices.main_screen.tip'.tr(), - style: Theme.of(context).textTheme.bodyMedium, - ), - ], - ), + InfoBox(text: 'devices.main_screen.tip'.tr(),), ], const SizedBox(height: 24), ], diff --git a/lib/ui/pages/recovery_key/recovery_key_receiving.dart b/lib/ui/pages/recovery_key/recovery_key_receiving.dart index 7ae6adaf..521cf723 100644 --- a/lib/ui/pages/recovery_key/recovery_key_receiving.dart +++ b/lib/ui/pages/recovery_key/recovery_key_receiving.dart @@ -2,6 +2,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:selfprivacy/ui/components/brand_button/filled_button.dart'; import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; +import 'package:selfprivacy/ui/components/info_box/info_box.dart'; class RecoveryKeyReceiving extends StatelessWidget { const RecoveryKeyReceiving({required this.recoveryKey, final super.key}); @@ -28,14 +29,7 @@ class RecoveryKeyReceiving extends StatelessWidget { const SizedBox(height: 16), const Divider(), const SizedBox(height: 16), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Icon(Icons.info_outlined, size: 24), - const SizedBox(height: 16), - Text('recovery_key.key_receiving_info'.tr()), - ], - ), + InfoBox(text: 'recovery_key.key_receiving_info'.tr(),), const SizedBox(height: 16), FilledButton( title: 'recovery_key.key_receiving_done'.tr(), diff --git a/lib/ui/pages/services/service_page.dart b/lib/ui/pages/services/service_page.dart index d3dad443..7dfa5a18 100644 --- a/lib/ui/pages/services/service_page.dart +++ b/lib/ui/pages/services/service_page.dart @@ -48,6 +48,7 @@ class _ServicePageState extends State { service.svgIcon, width: 48.0, height: 48.0, + color: Theme.of(context).colorScheme.onBackground, ), ), const SizedBox(height: 16), diff --git a/lib/ui/pages/users/user_details.dart b/lib/ui/pages/users/user_details.dart index 4b1049c1..f6efb0df 100644 --- a/lib/ui/pages/users/user_details.dart +++ b/lib/ui/pages/users/user_details.dart @@ -53,15 +53,9 @@ class UserDetails extends StatelessWidget { const Divider(height: 8), Padding( padding: const EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Icon(Icons.warning_amber_outlined, size: 24), - const SizedBox(height: 16), - Text( - 'users.no_sso_notice'.tr(), - ), - ], + child: InfoBox( + text: 'users.no_sso_notice'.tr(), + isWarning: true, ), ), ], diff --git a/lib/ui/pages/users/users.dart b/lib/ui/pages/users/users.dart index bf76ba89..886be330 100644 --- a/lib/ui/pages/users/users.dart +++ b/lib/ui/pages/users/users.dart @@ -19,6 +19,7 @@ import 'package:selfprivacy/ui/components/brand_header/brand_header.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/ui/components/brand_text/brand_text.dart'; +import 'package:selfprivacy/ui/components/info_box/info_box.dart'; import 'package:selfprivacy/ui/components/not_ready_card/not_ready_card.dart'; import 'package:selfprivacy/utils/ui_helpers.dart'; From 12d4cd23ec83fb0f9c825e489cfddc4e0171c625 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Wed, 14 Sep 2022 19:46:38 +0300 Subject: [PATCH 069/115] Binds migration screen --- lib/ui/pages/more/more.dart | 34 ++++ .../pages/server_storage/data_migration.dart | 153 +++++++++++++++--- lib/ui/pages/server_storage/disk_status.dart | 18 +++ .../service_migration_list_item.dart | 90 +++++++++++ 4 files changed, 275 insertions(+), 20 deletions(-) create mode 100644 lib/ui/pages/server_storage/service_migration_list_item.dart diff --git a/lib/ui/pages/more/more.dart b/lib/ui/pages/more/more.dart index fce3f640..3a3b1f5e 100644 --- a/lib/ui/pages/more/more.dart +++ b/lib/ui/pages/more/more.dart @@ -2,12 +2,17 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:ionicons/ionicons.dart'; import 'package:selfprivacy/config/brand_theme.dart'; +import 'package:selfprivacy/logic/cubit/provider_volumes/provider_volume_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; +import 'package:selfprivacy/logic/cubit/server_volumes/server_volume_cubit.dart'; +import 'package:selfprivacy/logic/cubit/services/services_cubit.dart'; import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart'; import 'package:selfprivacy/ui/pages/devices/devices.dart'; import 'package:selfprivacy/ui/pages/recovery_key/recovery_key.dart'; +import 'package:selfprivacy/ui/pages/server_storage/data_migration.dart'; +import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; import 'package:selfprivacy/ui/pages/setup/initializing.dart'; import 'package:selfprivacy/ui/pages/onboarding/onboarding.dart'; import 'package:selfprivacy/ui/pages/root_route.dart'; @@ -27,6 +32,9 @@ class MorePage extends StatelessWidget { final bool isReady = context.watch().state is ServerInstallationFinished; + final bool? usesBinds = + context.watch().state.usesBinds; + return Scaffold( appBar: PreferredSize( preferredSize: const Size.fromHeight(52), @@ -40,6 +48,32 @@ class MorePage extends StatelessWidget { padding: paddingH15V0, child: Column( children: [ + if (isReady && usesBinds != null && !usesBinds) + _MoreMenuItem( + title: 'providers.storage.start_migration_button'.tr(), + iconData: Icons.drive_file_move_outline, + goTo: DataMigrationPage( + diskStatus: DiskStatus.fromVolumes( + context.read().state.volumes, + context.read().state.volumes, + ), + services: context + .read() + .state + .services + .where( + (final service) => + service.id == 'bitwarden' || + service.id == 'gitea' || + service.id == 'pleroma' || + service.id == 'mailserver' || + service.id == 'nextcloud', + ) + .toList(), + ), + subtitle: 'not_ready_card.in_menu'.tr(), + accent: true, + ), if (!isReady) _MoreMenuItem( title: 'more.configuration_wizard'.tr(), diff --git a/lib/ui/pages/server_storage/data_migration.dart b/lib/ui/pages/server_storage/data_migration.dart index 5085c790..05948840 100644 --- a/lib/ui/pages/server_storage/data_migration.dart +++ b/lib/ui/pages/server_storage/data_migration.dart @@ -1,44 +1,157 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; -import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; +import 'package:selfprivacy/logic/models/service.dart'; +import 'package:selfprivacy/ui/components/brand_button/filled_button.dart'; +import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; +import 'package:selfprivacy/ui/components/info_box/info_box.dart'; import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; import 'package:selfprivacy/ui/pages/server_storage/server_storage_list_item.dart'; +import 'package:selfprivacy/ui/pages/server_storage/service_migration_list_item.dart'; class DataMigrationPage extends StatefulWidget { const DataMigrationPage({ - required this.diskVolumeToResize, + required this.services, required this.diskStatus, - required this.resizeTarget, final super.key, }); - final DiskVolume diskVolumeToResize; final DiskStatus diskStatus; - final DiskSize resizeTarget; + final List services; @override State createState() => _DataMigrationPageState(); } class _DataMigrationPageState extends State { + /// Service id to target migration disk name + final Map serviceToDisk = {}; + + static const headerHeight = 52.0; + static const headerVerticalPadding = 8.0; + static const listItemHeight = 62.0; + @override - Widget build(final BuildContext context) => BrandHeroScreen( - hasBackButton: true, - heroTitle: 'providers.storage.data_migration_title'.tr(), - children: [ - ...widget.diskStatus.diskVolumes - .map( - (final volume) => Column( + void initState() { + super.initState(); + + for (final Service service in widget.services) { + if (service.storageUsage.volume != null) { + serviceToDisk[service.id] = service.storageUsage.volume!; + } + } + } + + void onChange(final String volumeName, final String serviceId) { + setState(() { + serviceToDisk[serviceId] = volumeName; + }); + } + + /// Check the services and if a service is moved (in a serviceToDisk entry) + /// subtract the used storage from the old volume and add it to the new volume. + /// The old volume is the volume the service is currently on, shown in services list. + DiskVolume recalculatedDiskUsages(final DiskVolume volume, final List services) { + DiskSize used = volume.sizeUsed; + + for (final Service service in services) { + if (service.storageUsage.volume != null) { + if (service.storageUsage.volume == volume.name) { + if (serviceToDisk[service.id] != null && serviceToDisk[service.id] != volume.name) { + used -= service.storageUsage.used; + } + } else { + if (serviceToDisk[service.id] != null && serviceToDisk[service.id] == volume.name) { + used += service.storageUsage.used; + } + } + } + } + + return volume.copyWith(sizeUsed: used); + } + + @override + Widget build(final BuildContext context) { + final Size appBarHeight = Size.fromHeight( + headerHeight + + headerVerticalPadding * 2 + + listItemHeight * widget.diskStatus.diskVolumes.length + + headerVerticalPadding * widget.diskStatus.diskVolumes.length, + ); + return SafeArea( + child: Scaffold( + appBar: PreferredSize( + preferredSize: appBarHeight, + child: Column( + children: [ + BrandHeader( + title: 'providers.storage.data_migration_title'.tr(), + hasBackButton: true, + ), + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: headerVerticalPadding, + ), + child: Column( children: [ - ServerStorageListItem( - volume: volume, - ), - const SizedBox(height: 16), + ...widget.diskStatus.diskVolumes + .map( + (final volume) => Column( + children: [ + ServerStorageListItem( + volume: recalculatedDiskUsages(volume, widget.services), + dense: true, + ), + const SizedBox(height: headerVerticalPadding), + ], + ), + ) + .toList(), ], ), - ) - .toList(), - ], - ); + ), + const Divider(height: 0), + ], + ), + ), + body: ListView( + padding: const EdgeInsets.all(16.0), + children: [ + if (widget.services.isEmpty) const Center(child: CircularProgressIndicator()), + ...widget.services + .map( + (final service) => Column( + children: [ + const SizedBox(height: 8), + ServiceMigrationListItem( + service: service, + diskStatus: widget.diskStatus, + selectedVolume: serviceToDisk[service.id]!, + onChange: onChange, + ), + const SizedBox(height: 4), + const Divider(), + ], + ), + ) + .toList(), + Padding( + padding: const EdgeInsets.all(8.0), + child: InfoBox(text: 'providers.storage.data_migration_notice'.tr(), isWarning: true,), + ), + const SizedBox(height: 16), + FilledButton( + title: 'providers.storage.start_migration_button'.tr(), + onPressed: () { + // TODO: Implement migration + }, + ), + const SizedBox(height: 32), + ], + ), + ), + ); + } } diff --git a/lib/ui/pages/server_storage/disk_status.dart b/lib/ui/pages/server_storage/disk_status.dart index 1803f609..a4f921e9 100644 --- a/lib/ui/pages/server_storage/disk_status.dart +++ b/lib/ui/pages/server_storage/disk_status.dart @@ -59,6 +59,24 @@ class DiskVolume { sizeTotal.byte == 0 ? 0 : sizeUsed.byte / sizeTotal.byte; bool get isDiskOkay => percentage < 0.8 && sizeTotal.gibibyte - sizeUsed.gibibyte > 2.0; + + DiskVolume copyWith({ + final DiskSize? sizeUsed, + final DiskSize? sizeTotal, + final String? name, + final bool? root, + final bool? isResizable, + final ServerDiskVolume? serverDiskVolume, + final ServerVolume? providerVolume, + }) => DiskVolume( + sizeUsed: sizeUsed ?? this.sizeUsed, + sizeTotal: sizeTotal ?? this.sizeTotal, + name: name ?? this.name, + root: root ?? this.root, + isResizable: isResizable ?? this.isResizable, + serverDiskVolume: serverDiskVolume ?? this.serverDiskVolume, + providerVolume: providerVolume ?? this.providerVolume, + ); } class DiskStatus { diff --git a/lib/ui/pages/server_storage/service_migration_list_item.dart b/lib/ui/pages/server_storage/service_migration_list_item.dart new file mode 100644 index 00000000..ac6fc5bf --- /dev/null +++ b/lib/ui/pages/server_storage/service_migration_list_item.dart @@ -0,0 +1,90 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:selfprivacy/logic/models/service.dart'; +import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; + +class ServiceMigrationListItem extends StatelessWidget { + const ServiceMigrationListItem({ + required this.service, + required this.diskStatus, + required this.selectedVolume, + required this.onChange, + final super.key, + }); + + final Service service; + final DiskStatus diskStatus; + final String selectedVolume; + final Function onChange; + + @override + Widget build(final BuildContext context) => Column( + children: [ + _headerRow(context), + const SizedBox(height: 16), + ..._radioRows(context), + ], + ); + + Widget _headerRow(final BuildContext context) => SizedBox( + height: 24, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Row( + children: [ + Container( + alignment: Alignment.topLeft, + child: SvgPicture.string( + service.svgIcon, + width: 24.0, + height: 24.0, + color: Theme.of(context).colorScheme.onBackground, + ), + ), + const SizedBox(width: 16), + Container( + alignment: Alignment.topLeft, + child: Text( + service.displayName, + style: Theme.of(context).textTheme.titleMedium, + ), + ), + const SizedBox(width: 16), + Expanded( + child: Container( + alignment: Alignment.centerRight, + child: Text( + service.storageUsage.used.toString(), + style: Theme.of(context).textTheme.bodyMedium, + ), + ), + ), + ], + ), + ), + ); + + List _radioRows(final BuildContext context) { + final List volumeRows = []; + + for (final DiskVolume volume in diskStatus.diskVolumes) { + volumeRows.add( + RadioListTile( + title: Text( + volume.displayName, + ), + contentPadding: EdgeInsets.zero, + activeColor: Theme.of(context).colorScheme.secondary, + dense: true, + value: volume.name, + groupValue: selectedVolume, + onChanged: (final value) { + onChange(value, service.id); + }, + ), + ); + } + + return volumeRows; + } +} From dc72b6d1b2e46935161a6d255be1fa2420f7d4f8 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Thu, 15 Sep 2022 02:31:25 +0300 Subject: [PATCH 070/115] Implement server settings page functionality --- assets/translations/en.json | 3 +- assets/translations/ru.json | 3 +- lib/config/bloc_config.dart | 1 + .../schema/server_settings.graphql | 1 - .../schema/server_settings.graphql.dart | 42 +----------- .../schema/server_settings.graphql.g.dart | 4 -- .../graphql_maps/server_api/server.dart | 53 +++++++++++++-- lib/logic/api_maps/rest_maps/server.dart | 38 ----------- .../server_detailed_info_cubit.dart | 2 +- .../server_detailed_info_repository.dart | 33 ++++++++-- lib/logic/models/auto_upgrade_settings.dart | 18 +++++ .../models/json/auto_upgrade_settings.dart | 22 ------- .../models/json/auto_upgrade_settings.g.dart | 20 ------ lib/logic/models/ssh_settings.dart | 17 +++++ lib/logic/models/system_settings.dart | 26 ++++++++ .../server_details/server_details_screen.dart | 1 + .../pages/server_details/server_settings.dart | 65 +++++++++++++++---- .../server_details/time_zone/time_zone.dart | 56 ++++++++++------ 18 files changed, 234 insertions(+), 171 deletions(-) create mode 100644 lib/logic/models/auto_upgrade_settings.dart delete mode 100644 lib/logic/models/json/auto_upgrade_settings.dart delete mode 100644 lib/logic/models/json/auto_upgrade_settings.g.dart create mode 100644 lib/logic/models/ssh_settings.dart create mode 100644 lib/logic/models/system_settings.dart diff --git a/assets/translations/en.json b/assets/translations/en.json index 61d60767..a51f0da9 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -107,7 +107,8 @@ "allow_autoupgrade_hint": "Allow automatic packages upgrades on server", "reboot_after_upgrade": "Reboot after upgrade", "reboot_after_upgrade_hint": "Reboot without prompt after applying changes on server", - "server_timezone": "Server timezone" + "server_timezone": "Server timezone", + "select_timezone": "Select timezone" } }, "domain": { diff --git a/assets/translations/ru.json b/assets/translations/ru.json index 9040ed80..906e9471 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -107,7 +107,8 @@ "allow_autoupgrade_hint": "Разрешить автоматичесую установку обновлений на сервер", "reboot_after_upgrade": "Перезагружать после обновлений", "reboot_after_upgrade_hint": "Автоматически перезагружать сервер после применения обновлений", - "server_timezone": "Часовой пояс сервера" + "server_timezone": "Часовой пояс сервера", + "select_timezone": "Выберите часовой пояс" } }, "domain": { diff --git a/lib/config/bloc_config.dart b/lib/config/bloc_config.dart index fd00db2b..fb24a02b 100644 --- a/lib/config/bloc_config.dart +++ b/lib/config/bloc_config.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:selfprivacy/logic/cubit/devices/devices_cubit.dart'; import 'package:selfprivacy/logic/cubit/recovery_key/recovery_key_cubit.dart'; +import 'package:selfprivacy/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/cubit/app_settings/app_settings_cubit.dart'; import 'package:selfprivacy/logic/cubit/backups/backups_cubit.dart'; diff --git a/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql index 5f175e8a..d8a1d62d 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql @@ -14,7 +14,6 @@ query SystemSettings { ssh { enable passwordAuthentication - rootSshKeys } timezone } 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 924f5d00..538b58cf 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 @@ -336,12 +336,6 @@ const documentNodeQuerySystemSettings = DocumentNode(definitions: [ arguments: [], directives: [], selectionSet: null), - FieldNode( - name: NameNode(value: 'rootSshKeys'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), FieldNode( name: NameNode(value: '__typename'), alias: null, @@ -810,7 +804,6 @@ class Query$SystemSettings$system$settings$ssh { Query$SystemSettings$system$settings$ssh( {required this.enable, required this.passwordAuthentication, - required this.rootSshKeys, required this.$__typename}); @override @@ -822,8 +815,6 @@ class Query$SystemSettings$system$settings$ssh { final bool passwordAuthentication; - final List rootSshKeys; - @JsonKey(name: '__typename') final String $__typename; @@ -832,14 +823,8 @@ class Query$SystemSettings$system$settings$ssh { int get hashCode { final l$enable = enable; final l$passwordAuthentication = passwordAuthentication; - final l$rootSshKeys = rootSshKeys; final l$$__typename = $__typename; - return Object.hashAll([ - l$enable, - l$passwordAuthentication, - Object.hashAll(l$rootSshKeys.map((v) => v)), - l$$__typename - ]); + return Object.hashAll([l$enable, l$passwordAuthentication, l$$__typename]); } @override @@ -853,15 +838,6 @@ class Query$SystemSettings$system$settings$ssh { final l$passwordAuthentication = passwordAuthentication; final lOther$passwordAuthentication = other.passwordAuthentication; if (l$passwordAuthentication != lOther$passwordAuthentication) return false; - final l$rootSshKeys = rootSshKeys; - final lOther$rootSshKeys = other.rootSshKeys; - if (l$rootSshKeys.length != lOther$rootSshKeys.length) return false; - for (int i = 0; i < l$rootSshKeys.length; i++) { - final l$rootSshKeys$entry = l$rootSshKeys[i]; - final lOther$rootSshKeys$entry = lOther$rootSshKeys[i]; - if (l$rootSshKeys$entry != lOther$rootSshKeys$entry) return false; - } - final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; if (l$$__typename != lOther$$__typename) return false; @@ -886,11 +862,7 @@ abstract class CopyWith$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, - List? rootSshKeys, - String? $__typename}); + TRes call({bool? enable, bool? passwordAuthentication, String? $__typename}); } class _CopyWithImpl$Query$SystemSettings$system$settings$ssh @@ -907,7 +879,6 @@ class _CopyWithImpl$Query$SystemSettings$system$settings$ssh TRes call( {Object? enable = _undefined, Object? passwordAuthentication = _undefined, - Object? rootSshKeys = _undefined, Object? $__typename = _undefined}) => _then(Query$SystemSettings$system$settings$ssh( enable: enable == _undefined || enable == null @@ -917,9 +888,6 @@ class _CopyWithImpl$Query$SystemSettings$system$settings$ssh passwordAuthentication == null ? _instance.passwordAuthentication : (passwordAuthentication as bool), - rootSshKeys: rootSshKeys == _undefined || rootSshKeys == null - ? _instance.rootSshKeys - : (rootSshKeys as List), $__typename: $__typename == _undefined || $__typename == null ? _instance.$__typename : ($__typename as String))); @@ -931,11 +899,7 @@ class _CopyWithStubImpl$Query$SystemSettings$system$settings$ssh TRes _res; - call( - {bool? enable, - bool? passwordAuthentication, - List? rootSshKeys, - String? $__typename}) => + call({bool? enable, bool? passwordAuthentication, String? $__typename}) => _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 index d60ae006..fc66954b 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 @@ -98,9 +98,6 @@ Query$SystemSettings$system$settings$ssh Query$SystemSettings$system$settings$ssh( enable: json['enable'] as bool, passwordAuthentication: json['passwordAuthentication'] as bool, - rootSshKeys: (json['rootSshKeys'] as List) - .map((e) => e as String) - .toList(), $__typename: json['__typename'] as String, ); @@ -109,7 +106,6 @@ Map _$Query$SystemSettings$system$settings$sshToJson( { 'enable': instance.enable, 'passwordAuthentication': instance.passwordAuthentication, - 'rootSshKeys': instance.rootSshKeys, '__typename': instance.$__typename, }; diff --git a/lib/logic/api_maps/graphql_maps/server_api/server.dart b/lib/logic/api_maps/graphql_maps/server_api/server.dart index 3cb39d89..0e20fb02 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/server.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/server.dart @@ -7,11 +7,14 @@ import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_api.graphq import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/services.graphql.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/users.graphql.dart'; +import 'package:selfprivacy/logic/models/auto_upgrade_settings.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; import 'package:selfprivacy/logic/models/json/api_token.dart'; import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; import 'package:selfprivacy/logic/models/json/server_job.dart'; import 'package:selfprivacy/logic/models/service.dart'; +import 'package:selfprivacy/logic/models/ssh_settings.dart'; +import 'package:selfprivacy/logic/models/system_settings.dart'; part 'jobs_api.dart'; part 'server_actions_api.dart'; @@ -128,14 +131,13 @@ class ServerApi extends ApiMap } Future setAutoUpgradeSettings( - final bool allowReboot, - final bool enableAutoUpgrade, + final AutoUpgradeSettings settings, ) async { try { final GraphQLClient client = await getClient(); final input = Input$AutoUpgradeSettingsInput( - allowReboot: allowReboot, - enableAutoUpgrade: enableAutoUpgrade, + allowReboot: settings.allowReboot, + enableAutoUpgrade: settings.enable, ); final variables = Variables$Mutation$ChangeAutoUpgradeSettings( settings: input, @@ -148,4 +150,47 @@ class ServerApi extends ApiMap print(e); } } + + Future setTimezone(final String timezone) async { + try { + final GraphQLClient client = await getClient(); + final variables = Variables$Mutation$ChangeTimezone( + timezone: timezone, + ); + final mutation = Options$Mutation$ChangeTimezone( + variables: variables, + ); + await client.mutate$ChangeTimezone(mutation); + } catch (e) { + print(e); + } + } + + Future getSystemSettings() async { + QueryResult response; + SystemSettings settings = SystemSettings( + autoUpgradeSettings: AutoUpgradeSettings( + allowReboot: false, + enable: false, + ), + sshSettings: SshSettings( + enable: false, + passwordAuthentication: false, + ), + timezone: 'Unknown', + ); + + try { + final GraphQLClient client = await getClient(); + response = await client.query$SystemSettings(); + if (response.hasException) { + print(response.exception.toString()); + } + settings = SystemSettings.fromGraphQL(response.parsedData!.system); + } catch (e) { + print(e); + } + + return settings; + } } diff --git a/lib/logic/api_maps/rest_maps/server.dart b/lib/logic/api_maps/rest_maps/server.dart index 3660d499..f7e78eba 100644 --- a/lib/logic/api_maps/rest_maps/server.dart +++ b/lib/logic/api_maps/rest_maps/server.dart @@ -10,7 +10,6 @@ import 'package:selfprivacy/logic/models/hive/backblaze_bucket.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/auto_upgrade_settings.dart'; import 'package:selfprivacy/logic/models/json/backup.dart'; import 'package:selfprivacy/logic/models/json/device_token.dart'; import 'package:selfprivacy/logic/models/json/recovery_token_status.dart'; @@ -565,43 +564,6 @@ class ServerApi extends ApiMap { return result; } - Future getAutoUpgradeSettings() async { - Response response; - AutoUpgradeSettings settings = const AutoUpgradeSettings( - enable: false, - allowReboot: false, - ); - - final Dio client = await getClient(); - try { - response = await client.get('/system/configuration/autoUpgrade'); - if (response.data != null) { - settings = AutoUpgradeSettings.fromJson(response.data); - } - } on DioError catch (e) { - print(e.message); - } finally { - close(client); - } - return settings; - } - - Future updateAutoUpgradeSettings( - final AutoUpgradeSettings settings, - ) async { - final Dio client = await getClient(); - try { - await client.put( - '/system/configuration/autoUpgrade', - data: settings.toJson(), - ); - } on DioError catch (e) { - print(e.message); - } finally { - close(client); - } - } - Future getServerTimezone() async { TimeZoneSettings settings = TimeZoneSettings(); final Dio client = await getClient(); diff --git a/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart b/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart index 613069b0..2290c0a5 100644 --- a/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart +++ b/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart @@ -2,7 +2,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/cubit/server_detailed_info/server_detailed_info_repository.dart'; -import 'package:selfprivacy/logic/models/json/auto_upgrade_settings.dart'; +import 'package:selfprivacy/logic/models/auto_upgrade_settings.dart'; import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart'; import 'package:selfprivacy/logic/models/timezone_settings.dart'; 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 4cbe3e87..dada896b 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,6 +1,6 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/server.dart'; -import 'package:selfprivacy/logic/models/json/auto_upgrade_settings.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server.dart'; +import 'package:selfprivacy/logic/models/auto_upgrade_settings.dart'; import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart'; import 'package:selfprivacy/logic/models/timezone_settings.dart'; @@ -8,11 +8,30 @@ class ServerDetailsRepository { HetznerApi hetzner = HetznerApi(); ServerApi server = ServerApi(); - Future load() async => ServerDetailsRepositoryDto( - autoUpgradeSettings: await server.getAutoUpgradeSettings(), - hetznerServerInfo: await hetzner.getInfo(), - serverTimezone: await server.getServerTimezone(), - ); + Future load() async { + final settings = await server.getSystemSettings(); + return ServerDetailsRepositoryDto( + autoUpgradeSettings: settings.autoUpgradeSettings, + hetznerServerInfo: await hetzner.getInfo(), + serverTimezone: TimeZoneSettings.fromString( + settings.timezone, + ), + ); + } + + Future setAutoUpgradeSettings( + final AutoUpgradeSettings settings, + ) async { + await server.setAutoUpgradeSettings(settings); + } + + Future setTimezone( + final String timezone, + ) async { + if (timezone.isNotEmpty) { + await server.setTimezone(timezone); + } + } } class ServerDetailsRepositoryDto { diff --git a/lib/logic/models/auto_upgrade_settings.dart b/lib/logic/models/auto_upgrade_settings.dart new file mode 100644 index 00000000..19130422 --- /dev/null +++ b/lib/logic/models/auto_upgrade_settings.dart @@ -0,0 +1,18 @@ +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart'; + +class AutoUpgradeSettings { + AutoUpgradeSettings({ + required this.enable, + required this.allowReboot, + }); + + AutoUpgradeSettings.fromGraphQL( + final Query$SystemSettings$system$settings$autoUpgrade autoUpgrade, + ) : this( + enable: autoUpgrade.enable, + allowReboot: autoUpgrade.allowReboot, + ); + + final bool enable; + final bool allowReboot; +} diff --git a/lib/logic/models/json/auto_upgrade_settings.dart b/lib/logic/models/json/auto_upgrade_settings.dart deleted file mode 100644 index 421f9b88..00000000 --- a/lib/logic/models/json/auto_upgrade_settings.dart +++ /dev/null @@ -1,22 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:json_annotation/json_annotation.dart'; - -part 'auto_upgrade_settings.g.dart'; - -@JsonSerializable(createToJson: true) -class AutoUpgradeSettings extends Equatable { - factory AutoUpgradeSettings.fromJson(final Map json) => - _$AutoUpgradeSettingsFromJson(json); - - const AutoUpgradeSettings({ - required this.enable, - required this.allowReboot, - }); - final bool enable; - final bool allowReboot; - - @override - List get props => [enable, allowReboot]; - - Map toJson() => _$AutoUpgradeSettingsToJson(this); -} diff --git a/lib/logic/models/json/auto_upgrade_settings.g.dart b/lib/logic/models/json/auto_upgrade_settings.g.dart deleted file mode 100644 index e6accc2f..00000000 --- a/lib/logic/models/json/auto_upgrade_settings.g.dart +++ /dev/null @@ -1,20 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'auto_upgrade_settings.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -AutoUpgradeSettings _$AutoUpgradeSettingsFromJson(Map json) => - AutoUpgradeSettings( - enable: json['enable'] as bool, - allowReboot: json['allowReboot'] as bool, - ); - -Map _$AutoUpgradeSettingsToJson( - AutoUpgradeSettings instance) => - { - 'enable': instance.enable, - 'allowReboot': instance.allowReboot, - }; diff --git a/lib/logic/models/ssh_settings.dart b/lib/logic/models/ssh_settings.dart new file mode 100644 index 00000000..008b07ee --- /dev/null +++ b/lib/logic/models/ssh_settings.dart @@ -0,0 +1,17 @@ +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart'; + +class SshSettings { + SshSettings({ + required this.enable, + required this.passwordAuthentication, + }); + + SshSettings.fromGraphQL(final Query$SystemSettings$system$settings$ssh ssh) + : this( + enable: ssh.enable, + passwordAuthentication: ssh.passwordAuthentication, + ); + + final bool enable; + final bool passwordAuthentication; +} diff --git a/lib/logic/models/system_settings.dart b/lib/logic/models/system_settings.dart new file mode 100644 index 00000000..88ef5c7a --- /dev/null +++ b/lib/logic/models/system_settings.dart @@ -0,0 +1,26 @@ +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart'; +import 'package:selfprivacy/logic/models/auto_upgrade_settings.dart'; +import 'package:selfprivacy/logic/models/ssh_settings.dart'; + +class SystemSettings { + SystemSettings({ + required this.sshSettings, + required this.autoUpgradeSettings, + required this.timezone, + }); + + SystemSettings.fromGraphQL(final Query$SystemSettings$system system) + : this( + sshSettings: SshSettings.fromGraphQL( + system.settings.ssh, + ), + autoUpgradeSettings: AutoUpgradeSettings.fromGraphQL( + system.settings.autoUpgrade, + ), + timezone: system.settings.timezone, + ); + + final SshSettings sshSettings; + final AutoUpgradeSettings autoUpgradeSettings; + final String timezone; +} diff --git a/lib/ui/pages/server_details/server_details_screen.dart b/lib/ui/pages/server_details/server_details_screen.dart index 38edcc63..00043692 100644 --- a/lib/ui/pages/server_details/server_details_screen.dart +++ b/lib/ui/pages/server_details/server_details_screen.dart @@ -7,6 +7,7 @@ import 'package:selfprivacy/logic/common_enum/common_enum.dart'; import 'package:selfprivacy/logic/cubit/hetzner_metrics/hetzner_metrics_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; +import 'package:selfprivacy/logic/models/auto_upgrade_settings.dart'; import 'package:selfprivacy/logic/models/state_types.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart'; diff --git a/lib/ui/pages/server_details/server_settings.dart b/lib/ui/pages/server_details/server_settings.dart index a5c98ff3..bf0325a8 100644 --- a/lib/ui/pages/server_details/server_settings.dart +++ b/lib/ui/pages/server_details/server_settings.dart @@ -1,12 +1,18 @@ part of 'server_details_screen.dart'; -class _ServerSettings extends StatelessWidget { - const _ServerSettings({ - required this.tabController, - }); +class _ServerSettings extends StatefulWidget { + const _ServerSettings({required this.tabController}); final TabController tabController; + @override + State<_ServerSettings> createState() => _ServerSettingsState(); +} + +class _ServerSettingsState extends State<_ServerSettings> { + bool? allowAutoUpgrade; + bool? rebootAfterUpgrade; + @override Widget build(final BuildContext context) { final serverDetailsState = context.watch().state; @@ -15,6 +21,11 @@ class _ServerSettings extends StatelessWidget { } else if (serverDetailsState is! Loaded) { return BrandLoader.horizontal(); } + if (allowAutoUpgrade == null || rebootAfterUpgrade == null) { + allowAutoUpgrade = serverDetailsState.autoUpgradeSettings.enable; + rebootAfterUpgrade = serverDetailsState.autoUpgradeSettings.allowReboot; + } + return ListView( padding: paddingH15V0, children: [ @@ -27,7 +38,7 @@ class _ServerSettings extends StatelessWidget { children: [ IconButton( icon: const Icon(BrandIcons.arrowLeft), - onPressed: () => tabController.animateTo(0), + onPressed: () => widget.tabController.animateTo(0), ), const SizedBox(width: 10), BrandText.h4('basis.settings'.tr()), @@ -35,8 +46,21 @@ class _ServerSettings extends StatelessWidget { ), ), SwitcherBlock( - onChange: (final _) {}, - isActive: serverDetailsState.autoUpgradeSettings.enable, + onChange: (final switched) { + context + .read() + .repository + .setAutoUpgradeSettings( + AutoUpgradeSettings( + enable: switched, + allowReboot: rebootAfterUpgrade ?? false, + ), + ); + setState(() { + allowAutoUpgrade = switched; + }); + }, + isActive: allowAutoUpgrade ?? false, child: _TextColumn( title: 'providers.server.settings.allow_autoupgrade'.tr(), value: 'providers.server.settings.allow_autoupgrade_hint'.tr(), @@ -44,8 +68,23 @@ class _ServerSettings extends StatelessWidget { ), const Divider(height: 0), SwitcherBlock( - onChange: (final _) {}, - isActive: serverDetailsState.autoUpgradeSettings.allowReboot, + onChange: (final switched) { + context + .read() + .repository + .setAutoUpgradeSettings( + AutoUpgradeSettings( + enable: allowAutoUpgrade ?? false, + allowReboot: switched, + ), + ); + setState( + () { + rebootAfterUpgrade = switched; + }, + ); + }, + isActive: rebootAfterUpgrade ?? false, child: _TextColumn( title: 'providers.server.settings.reboot_after_upgrade'.tr(), value: 'providers.server.settings.reboot_after_upgrade_hint'.tr(), @@ -54,7 +93,11 @@ class _ServerSettings extends StatelessWidget { const Divider(height: 0), _Button( onTap: () { - Navigator.of(context).push(materialRoute(const SelectTimezone())); + Navigator.of(context).push( + materialRoute( + const SelectTimezone(), + ), + ); }, child: _TextColumn( title: 'providers.server.settings.server_timezone'.tr(), @@ -89,12 +132,10 @@ class _TextColumn extends StatelessWidget { const _TextColumn({ required this.title, required this.value, - this.hasWarning = false, }); final String title; final String value; - final bool hasWarning; @override Widget build(final BuildContext context) => Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/ui/pages/server_details/time_zone/time_zone.dart b/lib/ui/pages/server_details/time_zone/time_zone.dart index 33799c35..fa652a58 100644 --- a/lib/ui/pages/server_details/time_zone/time_zone.dart +++ b/lib/ui/pages/server_details/time_zone/time_zone.dart @@ -47,10 +47,10 @@ class _SelectTimezoneState extends State { @override Widget build(final BuildContext context) => Scaffold( - appBar: const PreferredSize( - preferredSize: Size.fromHeight(52), + appBar: PreferredSize( + preferredSize: const Size.fromHeight(52), child: BrandHeader( - title: 'select timezone', + title: 'providers.server.settings.select_timezone'.tr(), hasBackButton: true, ), ), @@ -76,7 +76,7 @@ class _SelectTimezoneState extends State { return MapEntry( key, Container( - height: 60, + height: 75, padding: const EdgeInsets.symmetric(horizontal: 20), decoration: const BoxDecoration( border: Border( @@ -85,24 +85,38 @@ class _SelectTimezoneState extends State { ), ), ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - BrandText.body1( - timezoneName, - style: const TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold, - ), + child: InkWell( + onTap: () { + context + .read() + .repository + .setTimezone( + timezoneName, + ); + Navigator.of(context).pop(); + }, + child: Container( + padding: const EdgeInsets.symmetric(vertical: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + BrandText.body1( + timezoneName, + style: const TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + ), + ), + BrandText.small( + 'GMT ${duration.toDayHourMinuteFormat()} ${area.isNotEmpty ? '($area)' : ''}', + style: const TextStyle( + fontSize: 13, + ), + ), + ], ), - BrandText.small( - 'GMT ${duration.toDayHourMinuteFormat()} ${area.isNotEmpty ? '($area)' : ''}', - style: const TextStyle( - fontSize: 13, - ), - ), - ], + ), ), ), ); From 8039283f3725d5e87466a5b69a9846e460b80cf1 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Thu, 15 Sep 2022 16:05:23 +0300 Subject: [PATCH 071/115] Wrap get metrics endpoint with try-catch --- .../server_providers/hetzner/hetzner.dart | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) 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 04ded55f..8340676d 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 @@ -466,19 +466,27 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { ) async { final ServerHostingDetails? hetznerServer = getIt().serverDetails; - final Dio client = await getClient(); - final Map queryParameters = { - 'start': start.toUtc().toIso8601String(), - 'end': end.toUtc().toIso8601String(), - 'type': type - }; - final Response res = await client.get( - '/servers/${hetznerServer!.id}/metrics', - queryParameters: queryParameters, - ); - close(client); - return res.data; + Map metrics = {}; + final Dio client = await getClient(); + try { + final Map queryParameters = { + 'start': start.toUtc().toIso8601String(), + 'end': end.toUtc().toIso8601String(), + 'type': type + }; + final Response res = await client.get( + '/servers/${hetznerServer!.id}/metrics', + queryParameters: queryParameters, + ); + metrics = res.data; + } catch (e) { + print(e); + } finally { + close(client); + } + + return metrics; } Future getInfo() async { From 03c38f637f419bed0e53eb852421e93692ca049c Mon Sep 17 00:00:00 2001 From: inexcode Date: Thu, 15 Sep 2022 18:40:02 +0300 Subject: [PATCH 072/115] Initial charts rework --- .../server_details/charts/bottom_title.dart | 29 +++ .../server_details/{ => charts}/chart.dart | 24 ++- .../server_details/charts/cpu_chart.dart | 175 ++++++++++++++++++ .../{ => charts}/network_charts.dart | 30 +-- lib/ui/pages/server_details/cpu_chart.dart | 135 -------------- .../server_details/server_details_screen.dart | 7 +- 6 files changed, 234 insertions(+), 166 deletions(-) create mode 100644 lib/ui/pages/server_details/charts/bottom_title.dart rename lib/ui/pages/server_details/{ => charts}/chart.dart (86%) create mode 100644 lib/ui/pages/server_details/charts/cpu_chart.dart rename lib/ui/pages/server_details/{ => charts}/network_charts.dart (89%) delete mode 100644 lib/ui/pages/server_details/cpu_chart.dart diff --git a/lib/ui/pages/server_details/charts/bottom_title.dart b/lib/ui/pages/server_details/charts/bottom_title.dart new file mode 100644 index 00000000..3db976ad --- /dev/null +++ b/lib/ui/pages/server_details/charts/bottom_title.dart @@ -0,0 +1,29 @@ +import 'package:selfprivacy/logic/common_enum/common_enum.dart'; +import 'package:selfprivacy/logic/models/hetzner_metrics.dart'; +import 'package:intl/intl.dart'; + +String bottomTitle( + final int value, + final List data, + final Period period, +) { + final hhmm = DateFormat('HH:mm'); + final day = DateFormat('MMMd'); + String res; + + if (value <= 0) { + return ''; + } + + final time = data[value].time; + switch (period) { + case Period.hour: + case Period.day: + res = hhmm.format(time); + break; + case Period.month: + res = day.format(time); + } + + return res; +} diff --git a/lib/ui/pages/server_details/chart.dart b/lib/ui/pages/server_details/charts/chart.dart similarity index 86% rename from lib/ui/pages/server_details/chart.dart rename to lib/ui/pages/server_details/charts/chart.dart index f7972e9c..d5affc08 100644 --- a/lib/ui/pages/server_details/chart.dart +++ b/lib/ui/pages/server_details/charts/chart.dart @@ -1,4 +1,4 @@ -part of 'server_details_screen.dart'; +part of '../server_details_screen.dart'; class _Chart extends StatelessWidget { @override @@ -17,9 +17,25 @@ class _Chart extends StatelessWidget { ]; } else if (state is HetznerMetricsLoaded) { charts = [ - const Legend(color: Colors.red, text: 'CPU %'), - const SizedBox(height: 20), - getCpuChart(state), + BrandCards.filled( + clipped: false, + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'CPU Usage', + style: Theme.of(context).textTheme.titleMedium?.copyWith( + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + ), + const SizedBox(height: 16), + getCpuChart(state), + ], + ), + ), + ), Row( mainAxisAlignment: MainAxisAlignment.end, children: [ diff --git a/lib/ui/pages/server_details/charts/cpu_chart.dart b/lib/ui/pages/server_details/charts/cpu_chart.dart new file mode 100644 index 00000000..14e30dcc --- /dev/null +++ b/lib/ui/pages/server_details/charts/cpu_chart.dart @@ -0,0 +1,175 @@ +import 'package:flutter/material.dart'; +import 'package:fl_chart/fl_chart.dart'; +import 'package:selfprivacy/logic/common_enum/common_enum.dart'; +import 'package:selfprivacy/logic/models/hetzner_metrics.dart'; +import 'package:intl/intl.dart'; +import 'package:selfprivacy/ui/pages/server_details/charts/bottom_title.dart'; + +class CpuChart extends StatelessWidget { + const CpuChart({ + required this.data, + required this.period, + required this.start, + final super.key, + }); + + final List data; + final Period period; + final DateTime start; + + List getSpots() { + var i = 0; + final List res = []; + + for (final d in data) { + res.add(FlSpot(i.toDouble(), d.value)); + i++; + } + + return res; + } + + @override + Widget build(final BuildContext context) => LineChart( + LineChartData( + lineTouchData: LineTouchData( + enabled: true, + touchTooltipData: LineTouchTooltipData( + tooltipBgColor: Theme.of(context).colorScheme.surface, + tooltipPadding: const EdgeInsets.all(8), + getTooltipItems: (final List touchedBarSpots) { + final List res = []; + + for (final spot in touchedBarSpots) { + final value = spot.y; + final date = data[spot.x.toInt()].time; + + res.add( + LineTooltipItem( + '${value.toStringAsFixed(2)}% at ${DateFormat('HH:mm dd.MM.yyyy').format(date)}', + TextStyle( + color: Theme.of(context).colorScheme.onSurface, + fontWeight: FontWeight.bold, + ), + ), + ); + } + + return res; + }, + ), + ), + lineBarsData: [ + LineChartBarData( + spots: getSpots(), + isCurved: false, + barWidth: 2, + color: Theme.of(context).colorScheme.primary, + dotData: FlDotData( + show: false, + ), + belowBarData: BarAreaData( + show: true, + gradient: LinearGradient( + colors: [ + Theme.of(context).colorScheme.primary.withOpacity(0.5), + Theme.of(context).colorScheme.primary.withOpacity(0.0), + ], + begin: Alignment.bottomCenter, + end: Alignment.topCenter, + ), + ), + ), + ], + minY: 0, + maxY: 100, + minX: data.length - 200, + titlesData: FlTitlesData( + topTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)), + bottomTitles: AxisTitles( + sideTitles: SideTitles( + interval: 40, + reservedSize: 30, + getTitlesWidget: (final value, final titleMeta) => Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + bottomTitle( + value.toInt(), + data, + period, + ), + style: Theme.of(context).textTheme.labelSmall?.copyWith( + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + ), + ), + showTitles: true, + ), + ), + leftTitles: AxisTitles( + sideTitles: SideTitles( + showTitles: false, + ), + ), + rightTitles: AxisTitles( + sideTitles: SideTitles( + showTitles: false, + ), + ), + ), + gridData: FlGridData( + show: true, + drawVerticalLine: true, + horizontalInterval: 25, + verticalInterval: 40, + getDrawingHorizontalLine: (final value) => FlLine( + color: Theme.of(context).colorScheme.outline.withOpacity(0.3), + strokeWidth: 1, + ), + getDrawingVerticalLine: (final value) => FlLine( + color: Theme.of(context).colorScheme.outline.withOpacity(0.3), + strokeWidth: 1, + ), + ), + borderData: FlBorderData( + show: true, + border: Border( + bottom: BorderSide( + color: Theme.of(context).colorScheme.outline.withOpacity(0.3), + width: 1, + ), + left: BorderSide( + color: Theme.of(context).colorScheme.outline.withOpacity(0.3), + width: 1, + ), + right: BorderSide( + color: Theme.of(context).colorScheme.outline.withOpacity(0.3), + width: 1, + ), + top: BorderSide( + color: Theme.of(context).colorScheme.outline.withOpacity(0.3), + width: 1, + ), + ), + ), + ), + ); + + bool checkToShowTitle( + final double minValue, + final double maxValue, + final SideTitles sideTitles, + final double appliedInterval, + final double value, + ) { + if (value < 0) { + return false; + } else if (value == 0) { + return true; + } + + final localValue = value - minValue; + final v = localValue / 20; + return v - v.floor() == 0; + } +} diff --git a/lib/ui/pages/server_details/network_charts.dart b/lib/ui/pages/server_details/charts/network_charts.dart similarity index 89% rename from lib/ui/pages/server_details/network_charts.dart rename to lib/ui/pages/server_details/charts/network_charts.dart index d1375ae6..75d866a1 100644 --- a/lib/ui/pages/server_details/network_charts.dart +++ b/lib/ui/pages/server_details/charts/network_charts.dart @@ -6,7 +6,7 @@ import 'package:selfprivacy/config/brand_colors.dart'; import 'package:selfprivacy/config/text_themes.dart'; import 'package:selfprivacy/logic/common_enum/common_enum.dart'; import 'package:selfprivacy/logic/models/hetzner_metrics.dart'; -import 'package:intl/intl.dart'; +import 'package:selfprivacy/ui/pages/server_details/charts/bottom_title.dart'; class NetworkChart extends StatelessWidget { const NetworkChart({ @@ -77,7 +77,11 @@ class NetworkChart extends StatelessWidget { child: RotatedBox( quarterTurns: 1, child: Text( - bottomTitle(value.toInt()), + bottomTitle( + value.toInt(), + listData[0], + period, + ), style: const TextStyle( fontSize: 10, color: Colors.purple, @@ -135,26 +139,4 @@ class NetworkChart extends StatelessWidget { final finalValue = diff / 20; return finalValue - finalValue.floor() == 0; } - - String bottomTitle(final int value) { - final hhmm = DateFormat('HH:mm'); - final day = DateFormat('MMMd'); - String res; - - if (value <= 0) { - return ''; - } - - final time = listData[0][value].time; - switch (period) { - case Period.hour: - case Period.day: - res = hhmm.format(time); - break; - case Period.month: - res = day.format(time); - } - - return res; - } } diff --git a/lib/ui/pages/server_details/cpu_chart.dart b/lib/ui/pages/server_details/cpu_chart.dart deleted file mode 100644 index 11f1eaef..00000000 --- a/lib/ui/pages/server_details/cpu_chart.dart +++ /dev/null @@ -1,135 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:fl_chart/fl_chart.dart'; -import 'package:selfprivacy/config/brand_colors.dart'; -import 'package:selfprivacy/config/text_themes.dart'; -import 'package:selfprivacy/logic/common_enum/common_enum.dart'; -import 'package:selfprivacy/logic/models/hetzner_metrics.dart'; -import 'package:intl/intl.dart'; - -class CpuChart extends StatelessWidget { - const CpuChart({ - required this.data, - required this.period, - required this.start, - final super.key, - }); - - final List data; - final Period period; - final DateTime start; - - List getSpots() { - var i = 0; - final List res = []; - - for (final d in data) { - res.add(FlSpot(i.toDouble(), d.value)); - i++; - } - - return res; - } - - @override - Widget build(final BuildContext context) => LineChart( - LineChartData( - lineTouchData: LineTouchData(enabled: false), - lineBarsData: [ - LineChartBarData( - spots: getSpots(), - isCurved: true, - barWidth: 1, - color: Colors.red, - dotData: FlDotData( - show: false, - ), - ), - ], - minY: 0, - maxY: 100, - minX: data.length - 200, - titlesData: FlTitlesData( - topTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)), - bottomTitles: AxisTitles( - sideTitles: SideTitles( - interval: 20, - reservedSize: 50, - getTitlesWidget: (final value, final titleMeta) => Padding( - padding: const EdgeInsets.all(8.0), - child: RotatedBox( - quarterTurns: 1, - child: Text( - bottomTitle(value.toInt()), - style: const TextStyle( - fontSize: 10, - color: Colors.purple, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - showTitles: true, - ), - ), - leftTitles: AxisTitles( - sideTitles: SideTitles( - getTitlesWidget: (final value, final titleMeta) => Padding( - padding: const EdgeInsets.only(right: 15), - child: Text( - value.toInt().toString(), - style: progressTextStyleLight.copyWith( - color: Theme.of(context).brightness == Brightness.dark - ? BrandColors.gray4 - : null, - ), - ), - ), - interval: 25, - showTitles: false, - ), - ), - ), - gridData: FlGridData(show: true), - ), - ); - - bool checkToShowTitle( - final double minValue, - final double maxValue, - final SideTitles sideTitles, - final double appliedInterval, - final double value, - ) { - if (value < 0) { - return false; - } else if (value == 0) { - return true; - } - - final localValue = value - minValue; - final v = localValue / 20; - return v - v.floor() == 0; - } - - String bottomTitle(final int value) { - final hhmm = DateFormat('HH:mm'); - final day = DateFormat('MMMd'); - String res; - - if (value <= 0) { - return ''; - } - - final time = data[value].time; - switch (period) { - case Period.hour: - case Period.day: - res = hhmm.format(time); - break; - case Period.month: - res = day.format(time); - } - - return res; - } -} diff --git a/lib/ui/pages/server_details/server_details_screen.dart b/lib/ui/pages/server_details/server_details_screen.dart index 00043692..5c60b322 100644 --- a/lib/ui/pages/server_details/server_details_screen.dart +++ b/lib/ui/pages/server_details/server_details_screen.dart @@ -9,6 +9,7 @@ import 'package:selfprivacy/logic/cubit/server_detailed_info/server_detailed_inf import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/models/auto_upgrade_settings.dart'; import 'package:selfprivacy/logic/models/state_types.dart'; +import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart'; import 'package:selfprivacy/ui/components/brand_loader/brand_loader.dart'; @@ -22,10 +23,10 @@ import 'package:selfprivacy/utils/named_font_weight.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; import 'package:timezone/timezone.dart'; -import 'package:selfprivacy/ui/pages/server_details/cpu_chart.dart'; -import 'package:selfprivacy/ui/pages/server_details/network_charts.dart'; +import 'package:selfprivacy/ui/pages/server_details/charts/cpu_chart.dart'; +import 'package:selfprivacy/ui/pages/server_details/charts/network_charts.dart'; -part 'chart.dart'; +part 'charts/chart.dart'; part 'header.dart'; part 'server_settings.dart'; part 'text_details.dart'; From bb0da1ac14a449cfc6dd91640356725848725d02 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Thu, 15 Sep 2022 19:55:28 +0300 Subject: [PATCH 073/115] Start the changelog for 0.7.0 --- fastlane/metadata/android/en-US/changelogs/0.7.0.txt | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 fastlane/metadata/android/en-US/changelogs/0.7.0.txt diff --git a/fastlane/metadata/android/en-US/changelogs/0.7.0.txt b/fastlane/metadata/android/en-US/changelogs/0.7.0.txt new file mode 100644 index 00000000..60316c0b --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/0.7.0.txt @@ -0,0 +1,9 @@ +- Server storage management +- New screen for service management +- New users management screen +- User passwords can be changed +- Server auto upgrade settings can be changed now +- Server timezone can be changed +- Fixed bugs related to users list synchronization +- UI fixes +- Minor bug fixes From 0c31e7697cb6beb879e777570e61a108e51d896e Mon Sep 17 00:00:00 2001 From: Inex Code Date: Thu, 15 Sep 2022 19:57:26 +0300 Subject: [PATCH 074/115] Refactor cards, move server details screen from modal to screen, move storage card to server screen. --- lib/config/bloc_config.dart | 1 - .../components/brand_cards/brand_cards.dart | 69 --------------- .../components/brand_cards/filled_card.dart | 34 ++++++++ .../components/brand_cards/outlined_card.dart | 22 +++++ .../pages/backup_details/backup_details.dart | 8 +- lib/ui/pages/dns_details/dns_details.dart | 8 +- .../pages/more/app_settings/app_setting.dart | 4 +- lib/ui/pages/more/more.dart | 4 +- lib/ui/pages/providers/providers.dart | 11 +-- lib/ui/pages/providers/storage_card.dart | 85 +++++++++--------- lib/ui/pages/recovery_key/recovery_key.dart | 4 +- lib/ui/pages/server_details/charts/chart.dart | 83 ++++++------------ lib/ui/pages/server_details/header.dart | 58 ------------- .../server_details/server_details_screen.dart | 87 +++++++------------ .../pages/server_details/server_settings.dart | 23 +---- lib/ui/pages/services/service_page.dart | 42 ++++----- .../recovering/recovery_confirm_server.dart | 4 +- .../recovering/recovery_method_select.dart | 12 +-- lib/ui/pages/users/user_details.dart | 4 +- lib/ui/pages/users/users.dart | 2 +- 20 files changed, 208 insertions(+), 357 deletions(-) create mode 100644 lib/ui/components/brand_cards/filled_card.dart create mode 100644 lib/ui/components/brand_cards/outlined_card.dart delete mode 100644 lib/ui/pages/server_details/header.dart diff --git a/lib/config/bloc_config.dart b/lib/config/bloc_config.dart index fb24a02b..fd00db2b 100644 --- a/lib/config/bloc_config.dart +++ b/lib/config/bloc_config.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:selfprivacy/logic/cubit/devices/devices_cubit.dart'; import 'package:selfprivacy/logic/cubit/recovery_key/recovery_key_cubit.dart'; -import 'package:selfprivacy/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/cubit/app_settings/app_settings_cubit.dart'; import 'package:selfprivacy/logic/cubit/backups/backups_cubit.dart'; diff --git a/lib/ui/components/brand_cards/brand_cards.dart b/lib/ui/components/brand_cards/brand_cards.dart index c9196000..67e7f725 100644 --- a/lib/ui/components/brand_cards/brand_cards.dart +++ b/lib/ui/components/brand_cards/brand_cards.dart @@ -19,23 +19,6 @@ class BrandCards { borderRadius: BorderRadius.circular(10), child: child, ); - static Widget outlined({required final Widget child}) => _OutlinedCard( - child: child, - ); - static Widget filled({ - required final Widget child, - final bool tertiary = false, - final bool secondary = false, - final bool error = false, - final bool clipped = true, - }) => - _FilledCard( - tertiary: tertiary, - secondary: secondary, - error: error, - clipped: clipped, - child: child, - ); } class _BrandCard extends StatelessWidget { @@ -63,58 +46,6 @@ class _BrandCard extends StatelessWidget { ); } -class _OutlinedCard extends StatelessWidget { - const _OutlinedCard({ - required this.child, - }); - - final Widget child; - @override - Widget build(final BuildContext context) => Card( - elevation: 0.0, - shape: RoundedRectangleBorder( - borderRadius: const BorderRadius.all(Radius.circular(12)), - side: BorderSide( - color: Theme.of(context).colorScheme.outline, - ), - ), - clipBehavior: Clip.antiAlias, - child: child, - ); -} - -class _FilledCard extends StatelessWidget { - const _FilledCard({ - required this.child, - required this.secondary, - required this.tertiary, - required this.error, - required this.clipped, - }); - - final Widget child; - final bool tertiary; - final bool error; - final bool clipped; - final bool secondary; - @override - Widget build(final BuildContext context) => Card( - elevation: 0.0, - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(12)), - ), - clipBehavior: clipped ? Clip.antiAlias : Clip.none, - color: error - ? Theme.of(context).colorScheme.errorContainer - : secondary - ? Theme.of(context).colorScheme.secondaryContainer - : tertiary - ? Theme.of(context).colorScheme.tertiaryContainer - : Theme.of(context).colorScheme.surfaceVariant, - child: child, - ); -} - final List bigShadow = [ BoxShadow( offset: const Offset(0, 4), diff --git a/lib/ui/components/brand_cards/filled_card.dart b/lib/ui/components/brand_cards/filled_card.dart new file mode 100644 index 00000000..3a706c8c --- /dev/null +++ b/lib/ui/components/brand_cards/filled_card.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; + +class FilledCard extends StatelessWidget { + const FilledCard({ + required this.child, + this.secondary = false, + this.tertiary = false, + this.error = false, + this.clipped = true, + final super.key, + }); + + final Widget child; + final bool tertiary; + final bool error; + final bool clipped; + final bool secondary; + @override + Widget build(final BuildContext context) => Card( + elevation: 0.0, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(12)), + ), + clipBehavior: clipped ? Clip.antiAlias : Clip.none, + color: error + ? Theme.of(context).colorScheme.errorContainer + : secondary + ? Theme.of(context).colorScheme.secondaryContainer + : tertiary + ? Theme.of(context).colorScheme.tertiaryContainer + : Theme.of(context).colorScheme.surfaceVariant, + child: child, + ); +} diff --git a/lib/ui/components/brand_cards/outlined_card.dart b/lib/ui/components/brand_cards/outlined_card.dart new file mode 100644 index 00000000..9da63902 --- /dev/null +++ b/lib/ui/components/brand_cards/outlined_card.dart @@ -0,0 +1,22 @@ +import 'package:flutter/material.dart'; + +class OutlinedCard extends StatelessWidget { + const OutlinedCard({ + required this.child, + final super.key, + }); + + final Widget child; + @override + Widget build(final BuildContext context) => Card( + elevation: 0.0, + shape: RoundedRectangleBorder( + borderRadius: const BorderRadius.all(Radius.circular(12)), + side: BorderSide( + color: Theme.of(context).colorScheme.outline, + ), + ), + clipBehavior: Clip.antiAlias, + child: child, + ); +} diff --git a/lib/ui/pages/backup_details/backup_details.dart b/lib/ui/pages/backup_details/backup_details.dart index c4a62284..aad55208 100644 --- a/lib/ui/pages/backup_details/backup_details.dart +++ b/lib/ui/pages/backup_details/backup_details.dart @@ -8,11 +8,11 @@ import 'package:selfprivacy/logic/models/state_types.dart'; import 'package:selfprivacy/ui/components/action_button/action_button.dart'; import 'package:selfprivacy/ui/components/brand_alert/brand_alert.dart'; import 'package:selfprivacy/ui/components/brand_button/brand_button.dart'; +import 'package:selfprivacy/ui/components/brand_cards/outlined_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/ui/components/brand_text/brand_text.dart'; -import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; GlobalKey navigatorKey = GlobalKey(); @@ -63,7 +63,7 @@ class _BackupDetailsState extends State BrandText.body1('providers.backup.waitingForRebuild'.tr()), if (backupStatus != BackupStatusEnum.initializing && backupStatus != BackupStatusEnum.noKey) - BrandCards.outlined( + OutlinedCard( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -127,7 +127,7 @@ class _BackupDetailsState extends State // When clicked, starts the restore action if (backupStatus != BackupStatusEnum.initializing && backupStatus != BackupStatusEnum.noKey) - BrandCards.outlined( + OutlinedCard( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -195,7 +195,7 @@ class _BackupDetailsState extends State ), ), const SizedBox(height: 16), - BrandCards.outlined( + OutlinedCard( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/ui/pages/dns_details/dns_details.dart b/lib/ui/pages/dns_details/dns_details.dart index c59d26b6..91c7d007 100644 --- a/lib/ui/pages/dns_details/dns_details.dart +++ b/lib/ui/pages/dns_details/dns_details.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import 'package:selfprivacy/config/get_it_config.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/brand_cards.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'; @@ -61,7 +61,8 @@ class _DnsDetailsPageState extends State { isError = true; break; } - return BrandCards.filled( + return FilledCard( + error: isError, child: ListTile( onTap: dnsState == DnsRecordsStatus.error ? () => fixCallback() : null, leading: icon, @@ -74,7 +75,6 @@ class _DnsDetailsPageState extends State { ? Theme.of(context).colorScheme.error : Theme.of(context).colorScheme.onSurfaceVariant, ), - error: isError, ); } @@ -95,7 +95,7 @@ class _DnsDetailsPageState extends State { heroIcon: BrandIcons.globe, heroTitle: 'providers.domain.screen_title'.tr(), children: [ - BrandCards.outlined( + FilledCard( child: ListTile( title: Text( 'not_ready_card.in_menu'.tr(), diff --git a/lib/ui/pages/more/app_settings/app_setting.dart b/lib/ui/pages/more/app_settings/app_setting.dart index 8c2cf506..47e2e1a8 100644 --- a/lib/ui/pages/more/app_settings/app_setting.dart +++ b/lib/ui/pages/more/app_settings/app_setting.dart @@ -116,7 +116,7 @@ class _AppSettingsPageState extends State { ), ), const Divider(height: 0), - _DeleteServer(context) + _deleteServer(context) ], ), ), @@ -124,7 +124,7 @@ class _AppSettingsPageState extends State { ); } - Widget _DeleteServer(final BuildContext context) { + Widget _deleteServer(final BuildContext context) { final bool isDisabled = context.watch().state.serverDetails == null; return Container( diff --git a/lib/ui/pages/more/more.dart b/lib/ui/pages/more/more.dart index 3a3b1f5e..e2b78423 100644 --- a/lib/ui/pages/more/more.dart +++ b/lib/ui/pages/more/more.dart @@ -6,7 +6,7 @@ import 'package:selfprivacy/logic/cubit/provider_volumes/provider_volume_cubit.d import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_volumes/server_volume_cubit.dart'; import 'package:selfprivacy/logic/cubit/services/services_cubit.dart'; -import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; +import 'package:selfprivacy/ui/components/brand_cards/filled_card.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart'; import 'package:selfprivacy/ui/pages/devices/devices.dart'; @@ -157,7 +157,7 @@ class _MoreMenuItem extends StatelessWidget { final Color color = accent ? Theme.of(context).colorScheme.onTertiaryContainer : Theme.of(context).colorScheme.onSurface; - return BrandCards.filled( + return FilledCard( tertiary: accent, child: ListTile( contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), diff --git a/lib/ui/pages/providers/providers.dart b/lib/ui/pages/providers/providers.dart index a1e03a19..bd150de3 100644 --- a/lib/ui/pages/providers/providers.dart +++ b/lib/ui/pages/providers/providers.dart @@ -8,13 +8,11 @@ import 'package:selfprivacy/logic/cubit/server_installation/server_installation_ import 'package:selfprivacy/logic/cubit/provider_volumes/provider_volume_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_volumes/server_volume_cubit.dart'; import 'package:selfprivacy/logic/models/provider.dart'; -import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart'; import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; import 'package:selfprivacy/ui/components/icon_status_mask/icon_status_mask.dart'; import 'package:selfprivacy/ui/components/not_ready_card/not_ready_card.dart'; -import 'package:selfprivacy/ui/helpers/modals.dart'; import 'package:selfprivacy/ui/pages/backup_details/backup_details.dart'; import 'package:selfprivacy/ui/pages/dns_details/dns_details.dart'; import 'package:selfprivacy/ui/pages/providers/storage_card.dart'; @@ -122,14 +120,7 @@ class _Card extends StatelessWidget { case ProviderType.server: title = 'providers.server.card_title'.tr(); stableText = 'providers.server.status'.tr(); - onTap = () => showBrandBottomSheet( - context: context, - builder: (final BuildContext context) => const BrandBottomSheet( - isExpended: true, - child: ServerDetailsScreen(), - ), - ); - + onTap = () => Navigator.of(context).push(materialRoute(const ServerDetailsScreen())); break; case ProviderType.domain: title = 'providers.domain.screen_title'.tr(); diff --git a/lib/ui/pages/providers/storage_card.dart b/lib/ui/pages/providers/storage_card.dart index f2facd21..69e245c6 100644 --- a/lib/ui/pages/providers/storage_card.dart +++ b/lib/ui/pages/providers/storage_card.dart @@ -2,7 +2,6 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; import 'package:selfprivacy/logic/cubit/providers/providers_cubit.dart'; -import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; import 'package:selfprivacy/ui/components/icon_status_mask/icon_status_mask.dart'; import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; import 'package:selfprivacy/ui/pages/server_storage/server_storage.dart'; @@ -42,7 +41,9 @@ class StorageCard extends StatelessWidget { state = StateType.error; } - return GestureDetector( + return Card( + child: InkResponse( + highlightShape: BoxShape.rectangle, onTap: () => Navigator.of(context).push( materialRoute( ServerStoragePage( @@ -50,49 +51,49 @@ class StorageCard extends StatelessWidget { ), ), ), - child: BrandCards.big( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - IconStatusMask( - status: state, - child: const Icon( - Icons.storage_outlined, - size: 30, - color: Colors.white, + + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'providers.storage.card_title'.tr(), + style: Theme.of(context).textTheme.titleLarge, + ), + if (state != StateType.uninitialized) + Text( + diskStatus.isDiskOkay + ? 'providers.storage.status_ok'.tr() + : 'providers.storage.status_error'.tr(), + style: Theme.of(context).textTheme.bodyLarge, + ), + ], ), - ), - if (state != StateType.uninitialized) - IconStatusMask( - status: state, - child: Icon( - diskStatus.isDiskOkay - ? Icons.check_circle_outline - : Icons.error_outline, - size: 24, - color: Colors.white, + if (state != StateType.uninitialized) + IconStatusMask( + status: state, + child: Icon( + diskStatus.isDiskOkay + ? Icons.check_circle_outline + : Icons.error_outline, + size: 24, + color: Colors.white, + ), ), - ), - ], - ), - const SizedBox(height: 16), - Text( - 'providers.storage.card_title'.tr(), - style: Theme.of(context).textTheme.titleLarge, - ), - if (state != StateType.uninitialized) - Text( - diskStatus.isDiskOkay - ? 'providers.storage.status_ok'.tr() - : 'providers.storage.status_error'.tr(), - style: Theme.of(context).textTheme.bodyLarge, + ], ), - ...sections, - const SizedBox(height: 8), - ], + ...sections, + const SizedBox(height: 8), + ], + ), ), ), ); diff --git a/lib/ui/pages/recovery_key/recovery_key.dart b/lib/ui/pages/recovery_key/recovery_key.dart index ba3069ae..2254879d 100644 --- a/lib/ui/pages/recovery_key/recovery_key.dart +++ b/lib/ui/pages/recovery_key/recovery_key.dart @@ -8,7 +8,7 @@ import 'package:selfprivacy/logic/cubit/recovery_key/recovery_key_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/ui/components/brand_button/brand_button.dart'; import 'package:selfprivacy/ui/components/brand_button/filled_button.dart'; -import 'package:selfprivacy/ui/components/brand_cards/brand_cards.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/pages/recovery_key/recovery_key_receiving.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; @@ -112,7 +112,7 @@ class RecoveryKeyStatusCard extends StatelessWidget { final bool isValid; @override - Widget build(final BuildContext context) => BrandCards.filled( + Widget build(final BuildContext context) => FilledCard( child: ListTile( title: isValid ? Text( diff --git a/lib/ui/pages/server_details/charts/chart.dart b/lib/ui/pages/server_details/charts/chart.dart index d5affc08..4b23f90f 100644 --- a/lib/ui/pages/server_details/charts/chart.dart +++ b/lib/ui/pages/server_details/charts/chart.dart @@ -17,7 +17,7 @@ class _Chart extends StatelessWidget { ]; } else if (state is HetznerMetricsLoaded) { charts = [ - BrandCards.filled( + FilledCard( clipped: false, child: Padding( padding: const EdgeInsets.all(16.0), @@ -36,18 +36,6 @@ class _Chart extends StatelessWidget { ), ), ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - BrandText.small('Public Network interface packets per sec'), - const SizedBox(width: 10), - const Legend(color: Colors.red, text: 'IN'), - const SizedBox(width: 5), - const Legend(color: Colors.green, text: 'OUT'), - ], - ), - const SizedBox(height: 20), - getPpsChart(state), const SizedBox(height: 1), Row( mainAxisAlignment: MainAxisAlignment.end, @@ -66,36 +54,33 @@ class _Chart extends StatelessWidget { throw 'wrong state'; } - return Container( - padding: const EdgeInsets.symmetric(horizontal: 5), - child: Column( - children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - BrandRadioTile( - isChecked: period == Period.month, - text: 'providers.server.chart.month'.tr(), - onPress: () => cubit.changePeriod(Period.month), - ), - BrandRadioTile( - isChecked: period == Period.day, - text: 'providers.server.chart.day'.tr(), - onPress: () => cubit.changePeriod(Period.day), - ), - BrandRadioTile( - isChecked: period == Period.hour, - text: 'providers.server.chart.hour'.tr(), - onPress: () => cubit.changePeriod(Period.hour), - ), - ], - ), + return Column( + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + BrandRadioTile( + isChecked: period == Period.month, + text: 'providers.server.chart.month'.tr(), + onPress: () => cubit.changePeriod(Period.month), + ), + BrandRadioTile( + isChecked: period == Period.day, + text: 'providers.server.chart.day'.tr(), + onPress: () => cubit.changePeriod(Period.day), + ), + BrandRadioTile( + isChecked: period == Period.hour, + text: 'providers.server.chart.hour'.tr(), + onPress: () => cubit.changePeriod(Period.hour), + ), + ], ), - ...charts, - ], - ), + ), + ...charts, + ], ); } @@ -112,20 +97,6 @@ class _Chart extends StatelessWidget { ); } - Widget getPpsChart(final HetznerMetricsLoaded state) { - final ppsIn = state.ppsIn; - final ppsOut = state.ppsOut; - - return SizedBox( - height: 200, - child: NetworkChart( - listData: [ppsIn, ppsOut], - period: state.period, - start: state.start, - ), - ); - } - Widget getBandwidthChart(final HetznerMetricsLoaded state) { final ppsIn = state.bandwidthIn; final ppsOut = state.bandwidthOut; diff --git a/lib/ui/pages/server_details/header.dart b/lib/ui/pages/server_details/header.dart deleted file mode 100644 index a10bc1cf..00000000 --- a/lib/ui/pages/server_details/header.dart +++ /dev/null @@ -1,58 +0,0 @@ -part of 'server_details_screen.dart'; - -class _Header extends StatelessWidget { - const _Header({ - required this.providerState, - required this.tabController, - }); - - final StateType providerState; - final TabController tabController; - - @override - Widget build(final BuildContext context) => Row( - children: [ - IconStatusMask( - status: providerState, - child: const Icon( - BrandIcons.server, - size: 40, - color: Colors.white, - ), - ), - const SizedBox(width: 10), - BrandText.h2('providers.server.card_title'.tr()), - const Spacer(), - Padding( - padding: const EdgeInsets.symmetric( - vertical: 4, - horizontal: 2, - ), - child: PopupMenuButton<_PopupMenuItemType>( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - onSelected: (final _PopupMenuItemType result) { - switch (result) { - case _PopupMenuItemType.setting: - tabController.animateTo(1); - break; - } - }, - icon: const Icon(Icons.more_vert), - itemBuilder: (final BuildContext context) => [ - PopupMenuItem<_PopupMenuItemType>( - value: _PopupMenuItemType.setting, - child: Container( - padding: const EdgeInsets.only(left: 5), - child: Text('basis.settings'.tr()), - ), - ), - ], - ), - ), - ], - ); -} - -enum _PopupMenuItemType { setting } diff --git a/lib/ui/pages/server_details/server_details_screen.dart b/lib/ui/pages/server_details/server_details_screen.dart index 5c60b322..ffd48e7e 100644 --- a/lib/ui/pages/server_details/server_details_screen.dart +++ b/lib/ui/pages/server_details/server_details_screen.dart @@ -2,22 +2,24 @@ import 'package:cubit_form/cubit_form.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:selfprivacy/config/brand_colors.dart'; -import 'package:selfprivacy/config/brand_theme.dart'; import 'package:selfprivacy/logic/common_enum/common_enum.dart'; import 'package:selfprivacy/logic/cubit/hetzner_metrics/hetzner_metrics_cubit.dart'; +import 'package:selfprivacy/logic/cubit/provider_volumes/provider_volume_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; +import 'package:selfprivacy/logic/cubit/server_volumes/server_volume_cubit.dart'; import 'package:selfprivacy/logic/models/auto_upgrade_settings.dart'; -import 'package:selfprivacy/logic/models/state_types.dart'; -import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; +import 'package:selfprivacy/ui/components/brand_cards/filled_card.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.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/ui/components/brand_loader/brand_loader.dart'; import 'package:selfprivacy/ui/components/brand_radio_tile/brand_radio_tile.dart'; import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; -import 'package:selfprivacy/ui/components/icon_status_mask/icon_status_mask.dart'; import 'package:selfprivacy/ui/components/switch_block/switch_bloc.dart'; +import 'package:selfprivacy/ui/pages/providers/storage_card.dart'; import 'package:selfprivacy/ui/pages/server_details/time_zone/lang.dart'; +import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; import 'package:selfprivacy/utils/extensions/duration.dart'; import 'package:selfprivacy/utils/named_font_weight.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; @@ -27,7 +29,6 @@ import 'package:selfprivacy/ui/pages/server_details/charts/cpu_chart.dart'; import 'package:selfprivacy/ui/pages/server_details/charts/network_charts.dart'; part 'charts/chart.dart'; -part 'header.dart'; part 'server_settings.dart'; part 'text_details.dart'; part 'time_zone/time_zone.dart'; @@ -64,59 +65,37 @@ class _ServerDetailsScreenState extends State Widget build(final BuildContext context) { final bool isReady = context.watch().state is ServerInstallationFinished; - final providerState = isReady ? StateType.stable : StateType.uninitialized; + + if (!isReady) { + return BrandHeroScreen( + heroIcon: BrandIcons.server, + heroTitle: 'providers.server.card_title'.tr(), + heroSubtitle: 'not_ready_card.in_menu'.tr(), + children: const [], + ); + } return BlocProvider( create: (final context) => ServerDetailsCubit()..check(), - child: Scaffold( - appBar: PreferredSize( - preferredSize: const Size.fromHeight(52), - child: Column( - children: [ - Container( - height: 51, - alignment: Alignment.center, - padding: const EdgeInsets.symmetric(horizontal: 15), - child: BrandText.h4('basis.details'.tr()), - ), - ], - ), - ), - body: TabBarView( - physics: const NeverScrollableScrollPhysics(), - controller: tabController, - children: [ - SingleChildScrollView( - physics: const ClampingScrollPhysics(), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: paddingH15V0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _Header( - providerState: providerState, - tabController: tabController, - ), - BrandText.body1('providers.server.bottom_sheet.1'.tr()), - ], - ), - ), - const SizedBox(height: 10), - BlocProvider( - create: (final context) => HetznerMetricsCubit()..restart(), - child: _Chart(), - ), - const SizedBox(height: 20), - _TextDetails(), - ], - ), + child: BrandHeroScreen( + heroIcon: BrandIcons.server, + heroTitle: 'providers.server.card_title'.tr(), + heroSubtitle: 'providers.server.bottom_sheet.1'.tr(), + children: [ + StorageCard( + diskStatus: DiskStatus.fromVolumes( + context.read().state.volumes, + context.read().state.volumes, ), - _ServerSettings(tabController: tabController), - ], - ), + ), + BlocProvider( + create: (final context) => HetznerMetricsCubit()..restart(), + child: _Chart(), + ), + const SizedBox(height: 20), + _TextDetails(), + const _ServerSettings(), + ], ), ); } diff --git a/lib/ui/pages/server_details/server_settings.dart b/lib/ui/pages/server_details/server_settings.dart index bf0325a8..62269496 100644 --- a/lib/ui/pages/server_details/server_settings.dart +++ b/lib/ui/pages/server_details/server_settings.dart @@ -1,9 +1,7 @@ part of 'server_details_screen.dart'; class _ServerSettings extends StatefulWidget { - const _ServerSettings({required this.tabController}); - - final TabController tabController; + const _ServerSettings(); @override State<_ServerSettings> createState() => _ServerSettingsState(); @@ -26,25 +24,8 @@ class _ServerSettingsState extends State<_ServerSettings> { rebootAfterUpgrade = serverDetailsState.autoUpgradeSettings.allowReboot; } - return ListView( - padding: paddingH15V0, + return Column( children: [ - const SizedBox(height: 10), - Container( - height: 52, - alignment: Alignment.centerLeft, - padding: const EdgeInsets.only(left: 1), - child: Row( - children: [ - IconButton( - icon: const Icon(BrandIcons.arrowLeft), - onPressed: () => widget.tabController.animateTo(0), - ), - const SizedBox(width: 10), - BrandText.h4('basis.settings'.tr()), - ], - ), - ), SwitcherBlock( onChange: (final switched) { context diff --git a/lib/ui/pages/services/service_page.dart b/lib/ui/pages/services/service_page.dart index 7dfa5a18..2bdf8f72 100644 --- a/lib/ui/pages/services/service_page.dart +++ b/lib/ui/pages/services/service_page.dart @@ -6,7 +6,7 @@ import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart'; import 'package:selfprivacy/logic/cubit/services/services_cubit.dart'; import 'package:selfprivacy/logic/models/job.dart'; import 'package:selfprivacy/logic/models/service.dart'; -import 'package:selfprivacy/ui/components/brand_cards/brand_cards.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:url_launcher/url_launcher.dart'; @@ -156,8 +156,8 @@ class ServiceStatusCard extends StatelessWidget { Widget build(final BuildContext context) { switch (status) { case ServiceStatus.active: - return BrandCards.filled( - child: const ListTile( + return const FilledCard( + child: ListTile( leading: Icon( Icons.check_circle_outline, size: 24, @@ -166,70 +166,70 @@ class ServiceStatusCard extends StatelessWidget { ), ); case ServiceStatus.inactive: - return BrandCards.filled( - child: const ListTile( + return const FilledCard( + tertiary: true, + child: ListTile( leading: Icon( Icons.stop_circle_outlined, size: 24, ), title: Text('Stopped'), ), - tertiary: true, ); case ServiceStatus.failed: - return BrandCards.filled( - child: const ListTile( + return const FilledCard( + error: true, + child: ListTile( leading: Icon( Icons.error_outline, size: 24, ), title: Text('Failed to start'), ), - error: true, ); case ServiceStatus.off: - return BrandCards.filled( - child: const ListTile( + return const FilledCard( + tertiary: true, + child: ListTile( leading: Icon( Icons.power_settings_new, size: 24, ), title: Text('Disabled'), ), - tertiary: true, ); case ServiceStatus.activating: - return BrandCards.filled( - child: const ListTile( + return const FilledCard( + tertiary: true, + child: ListTile( leading: Icon( Icons.restart_alt_outlined, size: 24, ), title: Text('Activating'), ), - tertiary: true, ); case ServiceStatus.deactivating: - return BrandCards.filled( - child: const ListTile( + return const FilledCard( + tertiary: true, + child: ListTile( leading: Icon( Icons.restart_alt_outlined, size: 24, ), title: Text('Deactivating'), ), - tertiary: true, ); case ServiceStatus.reloading: - return BrandCards.filled( - child: const ListTile( + return const FilledCard( + tertiary: true, + child: ListTile( leading: Icon( Icons.restart_alt_outlined, size: 24, ), title: Text('Restarting'), ), - tertiary: true, ); } } diff --git a/lib/ui/pages/setup/recovering/recovery_confirm_server.dart b/lib/ui/pages/setup/recovering/recovery_confirm_server.dart index 063bd890..d8510650 100644 --- a/lib/ui/pages/setup/recovering/recovery_confirm_server.dart +++ b/lib/ui/pages/setup/recovering/recovery_confirm_server.dart @@ -4,7 +4,7 @@ import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_depe import 'package:selfprivacy/logic/models/server_basic_info.dart'; import 'package:selfprivacy/ui/components/brand_button/filled_button.dart'; import 'package:selfprivacy/ui/components/brand_button/brand_button.dart'; -import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; +import 'package:selfprivacy/ui/components/brand_cards/filled_card.dart'; import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; class RecoveryConfirmServer extends StatefulWidget { @@ -135,7 +135,7 @@ class _RecoveryConfirmServerState extends State { required final ServerBasicInfoWithValidators server, final VoidCallback? onTap, }) => - BrandCards.filled( + FilledCard( child: ListTile( contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16), diff --git a/lib/ui/pages/setup/recovering/recovery_method_select.dart b/lib/ui/pages/setup/recovering/recovery_method_select.dart index fe622acb..d34b896d 100644 --- a/lib/ui/pages/setup/recovering/recovery_method_select.dart +++ b/lib/ui/pages/setup/recovering/recovery_method_select.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/ui/components/brand_button/brand_button.dart'; -import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; +import 'package:selfprivacy/ui/components/brand_cards/outlined_card.dart'; import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; import 'package:selfprivacy/ui/pages/setup/recovering/recover_by_old_token.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; @@ -20,7 +20,7 @@ class RecoveryMethodSelect extends StatelessWidget { onBackButtonPressed: context.read().revertRecoveryStep, children: [ - BrandCards.outlined( + OutlinedCard( child: ListTile( title: Text( 'recovering.method_select_other_device'.tr(), @@ -33,7 +33,7 @@ class RecoveryMethodSelect extends StatelessWidget { ), ), const SizedBox(height: 16), - BrandCards.outlined( + OutlinedCard( child: ListTile( title: Text( 'recovering.method_select_recovery_key'.tr(), @@ -75,7 +75,7 @@ class RecoveryFallbackMethodSelect extends StatelessWidget { hasBackButton: true, hasFlashButton: false, children: [ - BrandCards.outlined( + OutlinedCard( child: ListTile( title: Text( 'recovering.fallback_select_token_copy'.tr(), @@ -92,7 +92,7 @@ class RecoveryFallbackMethodSelect extends StatelessWidget { ), ), const SizedBox(height: 16), - BrandCards.outlined( + OutlinedCard( child: ListTile( title: Text( 'recovering.fallback_select_root_ssh'.tr(), @@ -109,7 +109,7 @@ class RecoveryFallbackMethodSelect extends StatelessWidget { ), ), const SizedBox(height: 16), - BrandCards.outlined( + OutlinedCard( child: ListTile( title: Text( 'recovering.fallback_select_provider_console'.tr(), diff --git a/lib/ui/pages/users/user_details.dart b/lib/ui/pages/users/user_details.dart index f6efb0df..2ec6baee 100644 --- a/lib/ui/pages/users/user_details.dart +++ b/lib/ui/pages/users/user_details.dart @@ -130,7 +130,7 @@ class _UserLogins extends StatelessWidget { final String domainName; @override - Widget build(final BuildContext context) => BrandCards.filled( + Widget build(final BuildContext context) => FilledCard( child: Column( children: [ ListTile( @@ -153,7 +153,7 @@ class _SshKeysCard extends StatelessWidget { final User user; @override - Widget build(final BuildContext context) => BrandCards.filled( + Widget build(final BuildContext context) => FilledCard( child: Column( children: [ ListTile( diff --git a/lib/ui/pages/users/users.dart b/lib/ui/pages/users/users.dart index 886be330..6b8709fd 100644 --- a/lib/ui/pages/users/users.dart +++ b/lib/ui/pages/users/users.dart @@ -14,7 +14,7 @@ import 'package:selfprivacy/logic/models/hive/user.dart'; import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart'; import 'package:selfprivacy/ui/components/brand_button/brand_button.dart'; import 'package:selfprivacy/ui/components/brand_button/outlined_button.dart'; -import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; +import 'package:selfprivacy/ui/components/brand_cards/filled_card.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart'; From 6619e42cfa11eca89090704a3bc6a6e57055b687 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 16 Sep 2022 00:08:14 +0300 Subject: [PATCH 075/115] New providers page cards --- lib/ui/pages/providers/providers.dart | 222 ++++++++++-------- .../server_details/server_details_screen.dart | 2 +- .../storage_card.dart | 11 +- 3 files changed, 124 insertions(+), 111 deletions(-) rename lib/ui/pages/{providers => server_storage}/storage_card.dart (95%) diff --git a/lib/ui/pages/providers/providers.dart b/lib/ui/pages/providers/providers.dart index bd150de3..6aa06287 100644 --- a/lib/ui/pages/providers/providers.dart +++ b/lib/ui/pages/providers/providers.dart @@ -3,19 +3,18 @@ import 'package:flutter/material.dart'; import 'package:selfprivacy/config/brand_theme.dart'; import 'package:selfprivacy/logic/cubit/backups/backups_cubit.dart'; import 'package:selfprivacy/logic/cubit/dns_records/dns_records_cubit.dart'; +import 'package:selfprivacy/logic/cubit/provider_volumes/provider_volume_cubit.dart'; import 'package:selfprivacy/logic/cubit/providers/providers_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; -import 'package:selfprivacy/logic/cubit/provider_volumes/provider_volume_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_volumes/server_volume_cubit.dart'; -import 'package:selfprivacy/logic/models/provider.dart'; -import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; +import 'package:selfprivacy/logic/models/hive/server_details.dart'; +import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; -import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; +import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart'; import 'package:selfprivacy/ui/components/icon_status_mask/icon_status_mask.dart'; import 'package:selfprivacy/ui/components/not_ready_card/not_ready_card.dart'; import 'package:selfprivacy/ui/pages/backup_details/backup_details.dart'; import 'package:selfprivacy/ui/pages/dns_details/dns_details.dart'; -import 'package:selfprivacy/ui/pages/providers/storage_card.dart'; import 'package:selfprivacy/ui/pages/server_details/server_details_screen.dart'; import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; @@ -39,6 +38,25 @@ class _ProvidersPageState extends State { final DnsRecordsStatus dnsStatus = context.watch().state.dnsState; + final List serverVolumes = + context.watch().state.volumes; + final List providerVolumes = + context.watch().state.volumes; + final diskStatus = DiskStatus.fromVolumes(serverVolumes, providerVolumes); + + final ServerInstallationState appConfig = + context.watch().state; + + StateType getServerStatus() { + if (!isReady) { + return StateType.uninitialized; + } + if (!diskStatus.isDiskOkay) { + return StateType.warning; + } + return StateType.stable; + } + StateType getDnsStatus() { if (dnsStatus == DnsRecordsStatus.uninitialized || dnsStatus == DnsRecordsStatus.refreshing) { @@ -50,36 +68,6 @@ class _ProvidersPageState extends State { return StateType.stable; } - final List cards = ProviderType.values - .map( - (final ProviderType type) => Padding( - padding: const EdgeInsets.only(bottom: 30), - child: _Card( - provider: ProviderModel( - state: isReady - ? (type == ProviderType.backup && !isBackupInitialized - ? StateType.uninitialized - : (type == ProviderType.domain) - ? getDnsStatus() - : StateType.stable) - : StateType.uninitialized, - type: type, - ), - ), - ), - ) - .toList(); - cards.add( - Padding( - padding: const EdgeInsets.only(bottom: 30), - child: StorageCard( - diskStatus: DiskStatus.fromVolumes( - context.read().state.volumes, - context.read().state.volumes, - ), - ), - ), - ); return Scaffold( appBar: PreferredSize( preferredSize: const Size.fromHeight(52), @@ -94,7 +82,45 @@ class _ProvidersPageState extends State { const NotReadyCard(), const SizedBox(height: 24), ], - ...cards, + _Card( + state: getServerStatus(), + icon: BrandIcons.server, + title: 'providers.server.card_title'.tr(), + subtitle: diskStatus.isDiskOkay + ? 'providers.storage.status_ok'.tr() + : 'providers.storage.status_error'.tr(), + onTap: () => Navigator.of(context) + .push(materialRoute(const ServerDetailsScreen())), + ), + const SizedBox(height: 16), + _Card( + state: getDnsStatus(), + icon: BrandIcons.globe, + title: 'providers.domain.screen_title'.tr(), + subtitle: appConfig.isDomainSelected + ? appConfig.serverDomain!.domainName + : '', + onTap: () => Navigator.of(context).push( + materialRoute( + const DnsDetailsPage(), + ), + ), + ), + const SizedBox(height: 16), + // TODO: When backups are fixed, show this card + if (isBackupInitialized) + _Card( + state: isBackupInitialized + ? StateType.stable + : StateType.uninitialized, + icon: BrandIcons.save, + title: 'providers.backup.card_title'.tr(), + subtitle: isBackupInitialized + ? 'providers.backup.card_subtitle'.tr() + : '', + onTap: () => Navigator.of(context) + .push(materialRoute(const BackupDetails())), + ), ], ), ); @@ -102,76 +128,64 @@ class _ProvidersPageState extends State { } class _Card extends StatelessWidget { - const _Card({required this.provider}); + const _Card({ + required final this.state, + required final this.icon, + required final this.title, + required final this.subtitle, + final this.onTap, + }); + + final Function()? onTap; + final StateType state; + final IconData icon; + final String title; + final String subtitle; - final ProviderModel provider; @override - Widget build(final BuildContext context) { - late String title; - String? message; - late String stableText; - late VoidCallback onTap; - final bool isReady = context.watch().state - is ServerInstallationFinished; - final ServerInstallationState appConfig = - context.watch().state; - - switch (provider.type) { - case ProviderType.server: - title = 'providers.server.card_title'.tr(); - stableText = 'providers.server.status'.tr(); - onTap = () => Navigator.of(context).push(materialRoute(const ServerDetailsScreen())); - break; - case ProviderType.domain: - title = 'providers.domain.screen_title'.tr(); - message = appConfig.isDomainSelected - ? appConfig.serverDomain!.domainName - : ''; - stableText = 'providers.domain.status'.tr(); - - onTap = () => Navigator.of(context).push( - materialRoute( - const DnsDetailsPage(), - ), - ); - break; - case ProviderType.backup: - title = 'providers.backup.card_title'.tr(); - stableText = 'providers.backup.status'.tr(); - - onTap = () => Navigator.of(context).push( - materialRoute( - const BackupDetails(), - ), - ); - break; - } - return GestureDetector( - onTap: isReady ? onTap : null, - child: BrandCards.big( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - IconStatusMask( - status: provider.state, - child: Icon(provider.icon, size: 30, color: Colors.white), + Widget build(final BuildContext context) => Card( + child: InkResponse( + highlightShape: BoxShape.rectangle, + onTap: onTap, + child: Padding( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + IconStatusMask( + status: state, + child: Icon(icon, size: 30, color: Colors.white), + ), + if (state != StateType.uninitialized) + IconStatusMask( + status: state, + child: Icon( + state == StateType.stable + ? Icons.check_circle_outline + : state == StateType.warning + ? Icons.warning_amber_outlined + : Icons.error_outline, + color: Colors.white, + ), + ), + ], + ), + const SizedBox(height: 8), + Text( + title, + style: Theme.of(context).textTheme.titleLarge, + ), + if (state != StateType.uninitialized) + Text( + subtitle, + style: Theme.of(context).textTheme.bodyLarge, + ), + ], ), - const SizedBox(height: 16), - Text( - title, - style: Theme.of(context).textTheme.titleLarge, - ), - if (message != null) ...[ - Text( - message, - style: Theme.of(context).textTheme.titleLarge, - ), - const SizedBox(height: 16), - ], - if (provider.state == StateType.stable) BrandText.body2(stableText), - ], + ), ), - ), - ); - } + ); } diff --git a/lib/ui/pages/server_details/server_details_screen.dart b/lib/ui/pages/server_details/server_details_screen.dart index ffd48e7e..ac7b13bb 100644 --- a/lib/ui/pages/server_details/server_details_screen.dart +++ b/lib/ui/pages/server_details/server_details_screen.dart @@ -17,7 +17,7 @@ import 'package:selfprivacy/ui/components/brand_loader/brand_loader.dart'; import 'package:selfprivacy/ui/components/brand_radio_tile/brand_radio_tile.dart'; import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; import 'package:selfprivacy/ui/components/switch_block/switch_bloc.dart'; -import 'package:selfprivacy/ui/pages/providers/storage_card.dart'; +import 'package:selfprivacy/ui/pages/server_storage/storage_card.dart'; import 'package:selfprivacy/ui/pages/server_details/time_zone/lang.dart'; import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; import 'package:selfprivacy/utils/extensions/duration.dart'; diff --git a/lib/ui/pages/providers/storage_card.dart b/lib/ui/pages/server_storage/storage_card.dart similarity index 95% rename from lib/ui/pages/providers/storage_card.dart rename to lib/ui/pages/server_storage/storage_card.dart index 69e245c6..c7c2e4ab 100644 --- a/lib/ui/pages/providers/storage_card.dart +++ b/lib/ui/pages/server_storage/storage_card.dart @@ -44,14 +44,13 @@ class StorageCard extends StatelessWidget { return Card( child: InkResponse( highlightShape: BoxShape.rectangle, - onTap: () => Navigator.of(context).push( - materialRoute( - ServerStoragePage( - diskStatus: diskStatus, + onTap: () => Navigator.of(context).push( + materialRoute( + ServerStoragePage( + diskStatus: diskStatus, + ), ), ), - ), - child: Padding( padding: const EdgeInsets.all(16.0), child: Column( From 71a18695e450c730e93ad292c31ccb555559f4ec Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 16 Sep 2022 00:08:32 +0300 Subject: [PATCH 076/115] Formatting fixes --- .../components/brand_cards/filled_card.dart | 28 ++++++++-------- .../components/brand_cards/outlined_card.dart | 20 ++++++------ lib/ui/components/info_box/info_box.dart | 32 +++++++++---------- .../pages/backup_details/backup_details.dart | 1 - lib/ui/pages/devices/devices.dart | 4 ++- .../recovery_key/recovery_key_receiving.dart | 4 ++- .../pages/server_storage/data_migration.dart | 20 ++++++++---- lib/ui/pages/server_storage/disk_status.dart | 19 +++++------ 8 files changed, 70 insertions(+), 58 deletions(-) diff --git a/lib/ui/components/brand_cards/filled_card.dart b/lib/ui/components/brand_cards/filled_card.dart index 3a706c8c..02d46604 100644 --- a/lib/ui/components/brand_cards/filled_card.dart +++ b/lib/ui/components/brand_cards/filled_card.dart @@ -17,18 +17,18 @@ class FilledCard extends StatelessWidget { final bool secondary; @override Widget build(final BuildContext context) => Card( - elevation: 0.0, - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(12)), - ), - clipBehavior: clipped ? Clip.antiAlias : Clip.none, - color: error - ? Theme.of(context).colorScheme.errorContainer - : secondary - ? Theme.of(context).colorScheme.secondaryContainer - : tertiary - ? Theme.of(context).colorScheme.tertiaryContainer - : Theme.of(context).colorScheme.surfaceVariant, - child: child, - ); + elevation: 0.0, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(12)), + ), + clipBehavior: clipped ? Clip.antiAlias : Clip.none, + color: error + ? Theme.of(context).colorScheme.errorContainer + : secondary + ? Theme.of(context).colorScheme.secondaryContainer + : tertiary + ? Theme.of(context).colorScheme.tertiaryContainer + : Theme.of(context).colorScheme.surfaceVariant, + child: child, + ); } diff --git a/lib/ui/components/brand_cards/outlined_card.dart b/lib/ui/components/brand_cards/outlined_card.dart index 9da63902..dc959dc2 100644 --- a/lib/ui/components/brand_cards/outlined_card.dart +++ b/lib/ui/components/brand_cards/outlined_card.dart @@ -9,14 +9,14 @@ class OutlinedCard extends StatelessWidget { final Widget child; @override Widget build(final BuildContext context) => Card( - elevation: 0.0, - shape: RoundedRectangleBorder( - borderRadius: const BorderRadius.all(Radius.circular(12)), - side: BorderSide( - color: Theme.of(context).colorScheme.outline, - ), - ), - clipBehavior: Clip.antiAlias, - child: child, - ); + elevation: 0.0, + shape: RoundedRectangleBorder( + borderRadius: const BorderRadius.all(Radius.circular(12)), + side: BorderSide( + color: Theme.of(context).colorScheme.outline, + ), + ), + clipBehavior: Clip.antiAlias, + child: child, + ); } diff --git a/lib/ui/components/info_box/info_box.dart b/lib/ui/components/info_box/info_box.dart index 5a4129c2..816053e3 100644 --- a/lib/ui/components/info_box/info_box.dart +++ b/lib/ui/components/info_box/info_box.dart @@ -12,20 +12,20 @@ class InfoBox extends StatelessWidget { @override Widget build(final BuildContext context) => Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Icon( - isWarning ? Icons.warning_amber_outlined : Icons.info_outline, - size: 24, - color: Theme.of(context).colorScheme.onBackground, - ), - const SizedBox(height: 16), - Text( - text, - style: Theme.of(context).textTheme.bodyMedium!.copyWith( - color: Theme.of(context).colorScheme.onBackground, - ), - ), - ], - ); + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Icon( + isWarning ? Icons.warning_amber_outlined : Icons.info_outline, + size: 24, + color: Theme.of(context).colorScheme.onBackground, + ), + const SizedBox(height: 16), + Text( + text, + style: Theme.of(context).textTheme.bodyMedium!.copyWith( + color: Theme.of(context).colorScheme.onBackground, + ), + ), + ], + ); } diff --git a/lib/ui/pages/backup_details/backup_details.dart b/lib/ui/pages/backup_details/backup_details.dart index aad55208..b3635d3f 100644 --- a/lib/ui/pages/backup_details/backup_details.dart +++ b/lib/ui/pages/backup_details/backup_details.dart @@ -13,7 +13,6 @@ import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.da import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart'; import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; - GlobalKey navigatorKey = GlobalKey(); class BackupDetails extends StatefulWidget { diff --git a/lib/ui/pages/devices/devices.dart b/lib/ui/pages/devices/devices.dart index e89535ab..bc608339 100644 --- a/lib/ui/pages/devices/devices.dart +++ b/lib/ui/pages/devices/devices.dart @@ -52,7 +52,9 @@ class _DevicesScreenState extends State { const SizedBox(height: 16), const Divider(height: 1), const SizedBox(height: 16), - InfoBox(text: 'devices.main_screen.tip'.tr(),), + InfoBox( + text: 'devices.main_screen.tip'.tr(), + ), ], const SizedBox(height: 24), ], diff --git a/lib/ui/pages/recovery_key/recovery_key_receiving.dart b/lib/ui/pages/recovery_key/recovery_key_receiving.dart index 521cf723..60169e5a 100644 --- a/lib/ui/pages/recovery_key/recovery_key_receiving.dart +++ b/lib/ui/pages/recovery_key/recovery_key_receiving.dart @@ -29,7 +29,9 @@ class RecoveryKeyReceiving extends StatelessWidget { const SizedBox(height: 16), const Divider(), const SizedBox(height: 16), - InfoBox(text: 'recovery_key.key_receiving_info'.tr(),), + InfoBox( + text: 'recovery_key.key_receiving_info'.tr(), + ), const SizedBox(height: 16), FilledButton( title: 'recovery_key.key_receiving_done'.tr(), diff --git a/lib/ui/pages/server_storage/data_migration.dart b/lib/ui/pages/server_storage/data_migration.dart index 05948840..6a3756a9 100644 --- a/lib/ui/pages/server_storage/data_migration.dart +++ b/lib/ui/pages/server_storage/data_migration.dart @@ -51,17 +51,20 @@ class _DataMigrationPageState extends State { /// Check the services and if a service is moved (in a serviceToDisk entry) /// subtract the used storage from the old volume and add it to the new volume. /// The old volume is the volume the service is currently on, shown in services list. - DiskVolume recalculatedDiskUsages(final DiskVolume volume, final List services) { + DiskVolume recalculatedDiskUsages( + final DiskVolume volume, final List services) { DiskSize used = volume.sizeUsed; for (final Service service in services) { if (service.storageUsage.volume != null) { if (service.storageUsage.volume == volume.name) { - if (serviceToDisk[service.id] != null && serviceToDisk[service.id] != volume.name) { + if (serviceToDisk[service.id] != null && + serviceToDisk[service.id] != volume.name) { used -= service.storageUsage.used; } } else { - if (serviceToDisk[service.id] != null && serviceToDisk[service.id] == volume.name) { + if (serviceToDisk[service.id] != null && + serviceToDisk[service.id] == volume.name) { used += service.storageUsage.used; } } @@ -101,7 +104,8 @@ class _DataMigrationPageState extends State { (final volume) => Column( children: [ ServerStorageListItem( - volume: recalculatedDiskUsages(volume, widget.services), + volume: recalculatedDiskUsages( + volume, widget.services), dense: true, ), const SizedBox(height: headerVerticalPadding), @@ -119,7 +123,8 @@ class _DataMigrationPageState extends State { body: ListView( padding: const EdgeInsets.all(16.0), children: [ - if (widget.services.isEmpty) const Center(child: CircularProgressIndicator()), + if (widget.services.isEmpty) + const Center(child: CircularProgressIndicator()), ...widget.services .map( (final service) => Column( @@ -139,7 +144,10 @@ class _DataMigrationPageState extends State { .toList(), Padding( padding: const EdgeInsets.all(8.0), - child: InfoBox(text: 'providers.storage.data_migration_notice'.tr(), isWarning: true,), + child: InfoBox( + text: 'providers.storage.data_migration_notice'.tr(), + isWarning: true, + ), ), const SizedBox(height: 16), FilledButton( diff --git a/lib/ui/pages/server_storage/disk_status.dart b/lib/ui/pages/server_storage/disk_status.dart index a4f921e9..2a37ad77 100644 --- a/lib/ui/pages/server_storage/disk_status.dart +++ b/lib/ui/pages/server_storage/disk_status.dart @@ -68,15 +68,16 @@ class DiskVolume { final bool? isResizable, final ServerDiskVolume? serverDiskVolume, final ServerVolume? providerVolume, - }) => DiskVolume( - sizeUsed: sizeUsed ?? this.sizeUsed, - sizeTotal: sizeTotal ?? this.sizeTotal, - name: name ?? this.name, - root: root ?? this.root, - isResizable: isResizable ?? this.isResizable, - serverDiskVolume: serverDiskVolume ?? this.serverDiskVolume, - providerVolume: providerVolume ?? this.providerVolume, - ); + }) => + DiskVolume( + sizeUsed: sizeUsed ?? this.sizeUsed, + sizeTotal: sizeTotal ?? this.sizeTotal, + name: name ?? this.name, + root: root ?? this.root, + isResizable: isResizable ?? this.isResizable, + serverDiskVolume: serverDiskVolume ?? this.serverDiskVolume, + providerVolume: providerVolume ?? this.providerVolume, + ); } class DiskStatus { From 469fbde6c49b2632355780b08017bcd211430cc6 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 16 Sep 2022 00:59:37 +0300 Subject: [PATCH 077/115] Replace brand_radio_tile.dart with segmented_buttons.dart --- .../brand_button/segmented_buttons.dart | 52 +++++++++++++++++++ .../brand_radio_tile/brand_radio_tile.dart | 37 ------------- lib/ui/pages/server_details/charts/chart.dart | 46 ++++++++-------- .../server_details/server_details_screen.dart | 2 +- .../pages/server_storage/data_migration.dart | 8 ++- 5 files changed, 83 insertions(+), 62 deletions(-) create mode 100644 lib/ui/components/brand_button/segmented_buttons.dart delete mode 100644 lib/ui/components/brand_radio_tile/brand_radio_tile.dart diff --git a/lib/ui/components/brand_button/segmented_buttons.dart b/lib/ui/components/brand_button/segmented_buttons.dart new file mode 100644 index 00000000..444aa906 --- /dev/null +++ b/lib/ui/components/brand_button/segmented_buttons.dart @@ -0,0 +1,52 @@ +import 'package:flutter/material.dart'; + +class SegmentedButtons extends StatelessWidget { + const SegmentedButtons({ + required this.isSelected, + required this.onPressed, + required this.titles, + final super.key, + }); + + final List isSelected; + final Function(int)? onPressed; + final List titles; + + @override + Widget build(final BuildContext context) => LayoutBuilder( + builder: (final context, final constraints) => ToggleButtons( + constraints: BoxConstraints( + minWidth: (constraints.maxWidth - 8) / 3, + minHeight: 40, + ), + borderRadius: BorderRadius.circular(48), + borderColor: Theme.of(context).colorScheme.outline, + selectedBorderColor: Theme.of(context).colorScheme.outline, + fillColor: Theme.of(context).colorScheme.secondaryContainer, + selectedColor: Theme.of(context).colorScheme.onSecondaryContainer, + color: Theme.of(context).colorScheme.onSurface, + isSelected: isSelected, + onPressed: onPressed, + children: titles.asMap().entries.map((final entry) { + final index = entry.key; + final title = entry.value; + return Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + if (isSelected[index]) + Icon( + Icons.check, + size: 18, + color: Theme.of(context).colorScheme.onSecondaryContainer, + ), + if (isSelected[index]) const SizedBox(width: 8), + Text( + title, + style: Theme.of(context).textTheme.labelLarge, + ), + ], + ); + }).toList(), + ), + ); +} diff --git a/lib/ui/components/brand_radio_tile/brand_radio_tile.dart b/lib/ui/components/brand_radio_tile/brand_radio_tile.dart deleted file mode 100644 index 3226c97b..00000000 --- a/lib/ui/components/brand_radio_tile/brand_radio_tile.dart +++ /dev/null @@ -1,37 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:selfprivacy/ui/components/brand_radio/brand_radio.dart'; -import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; - -// TODO: Delete this file - -class BrandRadioTile extends StatelessWidget { - const BrandRadioTile({ - required this.isChecked, - required this.text, - required this.onPress, - final super.key, - }); - - final bool isChecked; - - final String text; - final VoidCallback onPress; - - @override - Widget build(final BuildContext context) => GestureDetector( - onTap: onPress, - behavior: HitTestBehavior.translucent, - child: Padding( - padding: const EdgeInsets.all(2), - child: Row( - children: [ - BrandRadio( - isChecked: isChecked, - ), - const SizedBox(width: 9), - BrandText.h5(text) - ], - ), - ), - ); -} diff --git a/lib/ui/pages/server_details/charts/chart.dart b/lib/ui/pages/server_details/charts/chart.dart index 4b23f90f..0ff2dd40 100644 --- a/lib/ui/pages/server_details/charts/chart.dart +++ b/lib/ui/pages/server_details/charts/chart.dart @@ -56,28 +56,30 @@ class _Chart extends StatelessWidget { return Column( children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - BrandRadioTile( - isChecked: period == Period.month, - text: 'providers.server.chart.month'.tr(), - onPress: () => cubit.changePeriod(Period.month), - ), - BrandRadioTile( - isChecked: period == Period.day, - text: 'providers.server.chart.day'.tr(), - onPress: () => cubit.changePeriod(Period.day), - ), - BrandRadioTile( - isChecked: period == Period.hour, - text: 'providers.server.chart.hour'.tr(), - onPress: () => cubit.changePeriod(Period.hour), - ), - ], - ), + SegmentedButtons( + isSelected: [ + period == Period.month, + period == Period.day, + period == Period.hour, + ], + onPressed: (final index) { + switch (index) { + case 0: + cubit.changePeriod(Period.month); + break; + case 1: + cubit.changePeriod(Period.day); + break; + case 2: + cubit.changePeriod(Period.hour); + break; + } + }, + titles: [ + 'providers.server.chart.month'.tr(), + 'providers.server.chart.day'.tr(), + 'providers.server.chart.hour'.tr() + ], ), ...charts, ], diff --git a/lib/ui/pages/server_details/server_details_screen.dart b/lib/ui/pages/server_details/server_details_screen.dart index ac7b13bb..0457c80f 100644 --- a/lib/ui/pages/server_details/server_details_screen.dart +++ b/lib/ui/pages/server_details/server_details_screen.dart @@ -9,12 +9,12 @@ import 'package:selfprivacy/logic/cubit/server_detailed_info/server_detailed_inf import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_volumes/server_volume_cubit.dart'; import 'package:selfprivacy/logic/models/auto_upgrade_settings.dart'; +import 'package:selfprivacy/ui/components/brand_button/segmented_buttons.dart'; import 'package:selfprivacy/ui/components/brand_cards/filled_card.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.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/ui/components/brand_loader/brand_loader.dart'; -import 'package:selfprivacy/ui/components/brand_radio_tile/brand_radio_tile.dart'; import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; import 'package:selfprivacy/ui/components/switch_block/switch_bloc.dart'; import 'package:selfprivacy/ui/pages/server_storage/storage_card.dart'; diff --git a/lib/ui/pages/server_storage/data_migration.dart b/lib/ui/pages/server_storage/data_migration.dart index 6a3756a9..67eca453 100644 --- a/lib/ui/pages/server_storage/data_migration.dart +++ b/lib/ui/pages/server_storage/data_migration.dart @@ -52,7 +52,9 @@ class _DataMigrationPageState extends State { /// subtract the used storage from the old volume and add it to the new volume. /// The old volume is the volume the service is currently on, shown in services list. DiskVolume recalculatedDiskUsages( - final DiskVolume volume, final List services) { + final DiskVolume volume, + final List services, + ) { DiskSize used = volume.sizeUsed; for (final Service service in services) { @@ -105,7 +107,9 @@ class _DataMigrationPageState extends State { children: [ ServerStorageListItem( volume: recalculatedDiskUsages( - volume, widget.services), + volume, + widget.services, + ), dense: true, ), const SizedBox(height: headerVerticalPadding), From 6e9bde827aa924cef983db7773bdbeca0979c3f9 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 16 Sep 2022 01:01:41 +0300 Subject: [PATCH 078/115] Fix clipping on Cards with InkResponse --- lib/ui/pages/providers/providers.dart | 1 + lib/ui/pages/server_storage/storage_card.dart | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/ui/pages/providers/providers.dart b/lib/ui/pages/providers/providers.dart index 6aa06287..6cc1495d 100644 --- a/lib/ui/pages/providers/providers.dart +++ b/lib/ui/pages/providers/providers.dart @@ -144,6 +144,7 @@ class _Card extends StatelessWidget { @override Widget build(final BuildContext context) => Card( + clipBehavior: Clip.antiAlias, child: InkResponse( highlightShape: BoxShape.rectangle, onTap: onTap, diff --git a/lib/ui/pages/server_storage/storage_card.dart b/lib/ui/pages/server_storage/storage_card.dart index c7c2e4ab..210eec48 100644 --- a/lib/ui/pages/server_storage/storage_card.dart +++ b/lib/ui/pages/server_storage/storage_card.dart @@ -42,6 +42,7 @@ class StorageCard extends StatelessWidget { } return Card( + clipBehavior: Clip.antiAlias, child: InkResponse( highlightShape: BoxShape.rectangle, onTap: () => Navigator.of(context).push( From 3079b4bcc5f7565c277a23bc55e6f65e6364c9c7 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 16 Sep 2022 01:28:10 +0300 Subject: [PATCH 079/115] Add animations to segmented_buttons.dart --- .../brand_button/segmented_buttons.dart | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/lib/ui/components/brand_button/segmented_buttons.dart b/lib/ui/components/brand_button/segmented_buttons.dart index 444aa906..8ddccb5b 100644 --- a/lib/ui/components/brand_button/segmented_buttons.dart +++ b/lib/ui/components/brand_button/segmented_buttons.dart @@ -30,19 +30,34 @@ class SegmentedButtons extends StatelessWidget { children: titles.asMap().entries.map((final entry) { final index = entry.key; final title = entry.value; - return Row( - crossAxisAlignment: CrossAxisAlignment.center, + return Stack( + alignment: Alignment.centerLeft, children: [ - if (isSelected[index]) - Icon( - Icons.check, - size: 18, - color: Theme.of(context).colorScheme.onSecondaryContainer, + AnimatedOpacity( + duration: const Duration(milliseconds: 200), + opacity: isSelected[index] ? 1 : 0, + child: AnimatedScale( + duration: const Duration(milliseconds: 200), + curve: Curves.easeInOut, + alignment: Alignment.centerLeft, + scale: isSelected[index] ? 1 : 0, + child: Icon( + Icons.check, + size: 18, + color: Theme.of(context).colorScheme.onSecondaryContainer, + ), + ), + ), + AnimatedPadding( + padding: isSelected[index] + ? const EdgeInsets.only(left: 24) + : EdgeInsets.zero, + duration: const Duration(milliseconds: 200), + curve: Curves.easeInOut, + child: Text( + title, + style: Theme.of(context).textTheme.labelLarge, ), - if (isSelected[index]) const SizedBox(width: 8), - Text( - title, - style: Theme.of(context).textTheme.labelLarge, ), ], ); From 36cbc8e89bfd9cc080980bb14fd81efc901ef122 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 16 Sep 2022 10:50:05 +0300 Subject: [PATCH 080/115] Catch StateError on server_detailed_info_cubit.dart --- .../server_detailed_info_cubit.dart | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart b/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart index 2290c0a5..5f75497b 100644 --- a/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart +++ b/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart @@ -15,19 +15,23 @@ class ServerDetailsCubit extends Cubit { void check() async { final bool isReadyToCheck = getIt().serverDetails != null; - if (isReadyToCheck) { - emit(ServerDetailsLoading()); - final ServerDetailsRepositoryDto data = await repository.load(); - emit( - Loaded( - serverInfo: data.hetznerServerInfo, - autoUpgradeSettings: data.autoUpgradeSettings, - serverTimezone: data.serverTimezone, - checkTime: DateTime.now(), - ), - ); - } else { - emit(ServerDetailsNotReady()); + try { + if (isReadyToCheck) { + emit(ServerDetailsLoading()); + final ServerDetailsRepositoryDto data = await repository.load(); + emit( + Loaded( + serverInfo: data.hetznerServerInfo, + autoUpgradeSettings: data.autoUpgradeSettings, + serverTimezone: data.serverTimezone, + checkTime: DateTime.now(), + ), + ); + } else { + emit(ServerDetailsNotReady()); + } + } on StateError { + print('Tried to emit server info state when cubit is closed'); } } } From a7248a9b3046b94fc71815b1678118fc8d391d7f Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 16 Sep 2022 10:50:21 +0300 Subject: [PATCH 081/115] Remove unnecessary logging --- .../server_installation_cubit.dart | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 4575fa4b..9cb68359 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -608,24 +608,6 @@ class ServerInstallationCubit extends Cubit { @override void onChange(final Change change) { super.onChange(change); - print('================================'); - print('ServerInstallationState changed!'); - print('Current type: ${change.nextState.runtimeType}'); - print('Hetzner key: ${change.nextState.providerApiToken}'); - print('Cloudflare key: ${change.nextState.cloudFlareKey}'); - print('Domain: ${change.nextState.serverDomain}'); - print('BackblazeCredential: ${change.nextState.backblazeCredential}'); - if (change.nextState is ServerInstallationRecovery) { - print( - 'Recovery Step: ${(change.nextState as ServerInstallationRecovery).currentStep}', - ); - print( - 'Recovery Capabilities: ${(change.nextState as ServerInstallationRecovery).recoveryCapabilities}', - ); - } - if (change.nextState is TimerState) { - print('Timer: ${(change.nextState as TimerState).duration}'); - } } void clearAppConfig() { From e3d7f2b3d7b14dceb3242c4a0982e73198e83876 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 16 Sep 2022 11:06:27 +0300 Subject: [PATCH 082/115] Fix ServerDetailsCubit exception --- lib/config/bloc_config.dart | 4 +++ .../server_detailed_info_cubit.dart | 34 ++++++++++++++++--- .../server_detailed_info_state.dart | 2 +- .../server_details/server_details_screen.dart | 2 +- 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/lib/config/bloc_config.dart b/lib/config/bloc_config.dart index fd00db2b..1e9d5c12 100644 --- a/lib/config/bloc_config.dart +++ b/lib/config/bloc_config.dart @@ -32,6 +32,7 @@ class BlocAndProviderConfig extends StatelessWidget { final apiVolumesCubit = ApiProviderVolumeCubit(serverInstallationCubit); final apiServerVolumesCubit = ApiServerVolumeCubit(serverInstallationCubit); final serverJobsCubit = ServerJobsCubit(serverInstallationCubit); + final serverDetailsCubit = ServerDetailsCubit(serverInstallationCubit); return MultiProvider( providers: [ @@ -78,6 +79,9 @@ class BlocAndProviderConfig extends StatelessWidget { BlocProvider( create: (final _) => serverJobsCubit..load(), ), + BlocProvider( + create: (final _) => serverDetailsCubit..load(), + ), BlocProvider( create: (final _) => JobsCubit( usersCubit: usersCubit, diff --git a/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart b/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart index 5f75497b..537524c7 100644 --- a/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart +++ b/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart @@ -1,6 +1,5 @@ -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:equatable/equatable.dart'; import 'package:selfprivacy/config/get_it_config.dart'; +import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_detailed_info/server_detailed_info_repository.dart'; import 'package:selfprivacy/logic/models/auto_upgrade_settings.dart'; import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart'; @@ -8,8 +7,10 @@ import 'package:selfprivacy/logic/models/timezone_settings.dart'; part 'server_detailed_info_state.dart'; -class ServerDetailsCubit extends Cubit { - ServerDetailsCubit() : super(ServerDetailsInitial()); +class ServerDetailsCubit + extends ServerInstallationDependendCubit { + ServerDetailsCubit(final ServerInstallationCubit serverInstallationCubit) + : super(serverInstallationCubit, ServerDetailsInitial()); ServerDetailsRepository repository = ServerDetailsRepository(); @@ -34,4 +35,29 @@ class ServerDetailsCubit extends Cubit { print('Tried to emit server info state when cubit is closed'); } } + + Future setTimezone( + final String timezone, + ) async { + final ServerDetailsRepositoryDto data = await repository.load(); + await repository.setTimezone(timezone); + emit( + Loaded( + serverInfo: data.hetznerServerInfo, + autoUpgradeSettings: data.autoUpgradeSettings, + serverTimezone: TimeZoneSettings.fromString(timezone), + checkTime: DateTime.now(), + ), + ); + } + + @override + void clear() { + emit(ServerDetailsNotReady()); + } + + @override + void load() async { + check(); + } } diff --git a/lib/logic/cubit/server_detailed_info/server_detailed_info_state.dart b/lib/logic/cubit/server_detailed_info/server_detailed_info_state.dart index ef226c1e..ea5f4864 100644 --- a/lib/logic/cubit/server_detailed_info/server_detailed_info_state.dart +++ b/lib/logic/cubit/server_detailed_info/server_detailed_info_state.dart @@ -1,6 +1,6 @@ part of 'server_detailed_info_cubit.dart'; -abstract class ServerDetailsState extends Equatable { +abstract class ServerDetailsState extends ServerInstallationDependendState { const ServerDetailsState(); @override diff --git a/lib/ui/pages/server_details/server_details_screen.dart b/lib/ui/pages/server_details/server_details_screen.dart index 0457c80f..16f87be8 100644 --- a/lib/ui/pages/server_details/server_details_screen.dart +++ b/lib/ui/pages/server_details/server_details_screen.dart @@ -76,7 +76,7 @@ class _ServerDetailsScreenState extends State } return BlocProvider( - create: (final context) => ServerDetailsCubit()..check(), + create: (final context) => context.read()..check(), child: BrandHeroScreen( heroIcon: BrandIcons.server, heroTitle: 'providers.server.card_title'.tr(), From d75c2837ca060905a60d23b6f0bd99f537647154 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 16 Sep 2022 11:07:37 +0300 Subject: [PATCH 083/115] Catch error on metrics loading from Hetzner --- lib/logic/common_enum/common_enum.dart | 17 ++++++++++++++++- .../hetzner_metrics/hetzner_metrics_cubit.dart | 16 ++++++++++------ .../hetzner_metrics_repository.dart | 9 +++++++++ 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/lib/logic/common_enum/common_enum.dart b/lib/logic/common_enum/common_enum.dart index 93334069..77c2fa82 100644 --- a/lib/logic/common_enum/common_enum.dart +++ b/lib/logic/common_enum/common_enum.dart @@ -20,7 +20,22 @@ enum InitializingSteps { checkSystemDnsAndDkimSet, } -enum Period { hour, day, month } +enum Period { + hour, + day, + month; + + int get stepPeriodInSeconds { + switch (this) { + case Period.hour: + return 18; + case Period.day: + return 432; + case Period.month: + return 6480; + } + } +} enum ServiceTypes { mailserver, diff --git a/lib/logic/cubit/hetzner_metrics/hetzner_metrics_cubit.dart b/lib/logic/cubit/hetzner_metrics/hetzner_metrics_cubit.dart index cb398dcd..1cfdc23a 100644 --- a/lib/logic/cubit/hetzner_metrics/hetzner_metrics_cubit.dart +++ b/lib/logic/cubit/hetzner_metrics/hetzner_metrics_cubit.dart @@ -39,16 +39,20 @@ class HetznerMetricsCubit extends Cubit { } void load(final Period period) async { - final HetznerMetricsLoaded newState = await repository.getMetrics(period); - timer = Timer( - Duration(seconds: newState.stepInSeconds.toInt()), - () => load(newState.period), - ); - try { + final HetznerMetricsLoaded newState = await repository.getMetrics(period); + timer = Timer( + Duration(seconds: newState.stepInSeconds.toInt()), + () => load(newState.period), + ); emit(newState); } on StateError { print('Tried to emit Hetzner metrics when cubit is closed'); + } on MetricsLoadException { + timer = Timer( + Duration(seconds: state.period.stepPeriodInSeconds), + () => load(state.period), + ); } } } diff --git a/lib/logic/cubit/hetzner_metrics/hetzner_metrics_repository.dart b/lib/logic/cubit/hetzner_metrics/hetzner_metrics_repository.dart index dc0805c7..134c955e 100644 --- a/lib/logic/cubit/hetzner_metrics/hetzner_metrics_repository.dart +++ b/lib/logic/cubit/hetzner_metrics/hetzner_metrics_repository.dart @@ -4,6 +4,11 @@ import 'package:selfprivacy/logic/models/hetzner_metrics.dart'; import 'package:selfprivacy/logic/cubit/hetzner_metrics/hetzner_metrics_cubit.dart'; +class MetricsLoadException implements Exception { + MetricsLoadException(this.message); + final String message; +} + class HetznerMetricsRepository { Future getMetrics(final Period period) async { final DateTime end = DateTime.now(); @@ -31,6 +36,10 @@ class HetznerMetricsRepository { final cpuMetricsData = results[0]['metrics']; final networkMetricsData = results[1]['metrics']; + if (cpuMetricsData == null || networkMetricsData == null) { + throw MetricsLoadException('Metrics data is null'); + } + return HetznerMetricsLoaded( period: period, start: start, From 4a4fa35de3cec2370ec5e1f855152201630bc52d Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 16 Sep 2022 11:11:03 +0300 Subject: [PATCH 084/115] Remove setTimezone from ServerDetailedInfo cubit --- lib/config/bloc_config.dart | 1 + .../server_detailed_info_cubit.dart | 15 --------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/lib/config/bloc_config.dart b/lib/config/bloc_config.dart index 1e9d5c12..a6cf7202 100644 --- a/lib/config/bloc_config.dart +++ b/lib/config/bloc_config.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:selfprivacy/logic/cubit/devices/devices_cubit.dart'; import 'package:selfprivacy/logic/cubit/recovery_key/recovery_key_cubit.dart'; +import 'package:selfprivacy/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/cubit/app_settings/app_settings_cubit.dart'; import 'package:selfprivacy/logic/cubit/backups/backups_cubit.dart'; diff --git a/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart b/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart index 537524c7..a3af96e8 100644 --- a/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart +++ b/lib/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart @@ -36,21 +36,6 @@ class ServerDetailsCubit } } - Future setTimezone( - final String timezone, - ) async { - final ServerDetailsRepositoryDto data = await repository.load(); - await repository.setTimezone(timezone); - emit( - Loaded( - serverInfo: data.hetznerServerInfo, - autoUpgradeSettings: data.autoUpgradeSettings, - serverTimezone: TimeZoneSettings.fromString(timezone), - checkTime: DateTime.now(), - ), - ); - } - @override void clear() { emit(ServerDetailsNotReady()); From 11e58981b5339c88cbbb395bd3cccdd58fa4443a Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 16 Sep 2022 12:08:31 +0300 Subject: [PATCH 085/115] Implement migration process page --- assets/translations/en.json | 4 +- assets/translations/ru.json | 4 +- .../graphql_maps/server_api/volume_api.dart | 19 ++++++ .../migration_process_page.dart | 67 +++++++++++++++++++ 4 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 lib/ui/pages/server_storage/migration_process_page.dart diff --git a/assets/translations/en.json b/assets/translations/en.json index a51f0da9..d83fcd17 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -189,7 +189,9 @@ "euro": "Euro", "data_migration_title": "Data migration", "data_migration_notice": "During migration all services will be turned off.", - "start_migration_button": "Start migration" + "start_migration_button": "Start migration", + "migration_process": "Migrating...", + "migration_done": "Finish" } }, "not_ready_card": { diff --git a/assets/translations/ru.json b/assets/translations/ru.json index 906e9471..aa755a7c 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -189,7 +189,9 @@ "euro": "Евро", "data_migration_title": "Миграция данных", "data_migration_notice": "На время миграции данных все сервисы будут выключены.", - "start_migration_button": "Начать миграцию" + "start_migration_button": "Начать миграцию", + "migration_process": "Мигрируем...", + "migration_done": "Завершить" } }, "not_ready_card": { 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 ada66d58..06d6e5bc 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 @@ -56,4 +56,23 @@ mixin VolumeApi on ApiMap { print(e); } } + + Future migrateToBinds(final Map serviceToDisk) async { + try { + final GraphQLClient client = await getClient(); + final input = Input$MigrateToBindsInput( + bitwardenBlockDevice: serviceToDisk['bitwarden']!, + emailBlockDevice: serviceToDisk['mailserver']!, + giteaBlockDevice: serviceToDisk['gitea']!, + nextcloudBlockDevice: serviceToDisk['nextcloud']!, + pleromaBlockDevice: serviceToDisk['pleroma']!, + ); + final variables = Variables$Mutation$MigrateToBinds(input: input); + final migrateMutation = + Options$Mutation$MigrateToBinds(variables: variables); + await client.mutate$MigrateToBinds(migrateMutation); + } catch (e) { + print(e); + } + } } diff --git a/lib/ui/pages/server_storage/migration_process_page.dart b/lib/ui/pages/server_storage/migration_process_page.dart new file mode 100644 index 00000000..12dd8fea --- /dev/null +++ b/lib/ui/pages/server_storage/migration_process_page.dart @@ -0,0 +1,67 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:selfprivacy/logic/cubit/server_jobs/server_jobs_cubit.dart'; +import 'package:selfprivacy/logic/models/json/server_job.dart'; +import 'package:selfprivacy/ui/components/brand_button/filled_button.dart'; +import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; +import 'package:selfprivacy/ui/components/brand_linear_indicator/brand_linear_indicator.dart'; +import 'package:selfprivacy/ui/pages/root_route.dart'; +import 'package:selfprivacy/utils/route_transitions/basic.dart'; + +class MigrationProcessPage extends StatefulWidget { + const MigrationProcessPage({ + required this.jobUid, + final super.key, + }); + + final String jobUid; + + @override + State createState() => _MigrationProcessPageState(); +} + +class _MigrationProcessPageState extends State { + @override + void initState() { + super.initState(); + } + + @override + Widget build(final BuildContext context) { + final serverJobsState = context.watch().state; + final ServerJob job = serverJobsState.serverJobList.firstWhere( + (final ServerJob job) => job.uid == widget.jobUid, + ); + final double value = job.progress == null ? 0.0 : job.progress! / 100; + return BrandHeroScreen( + hasBackButton: false, + heroTitle: 'providers.storage.migration_process'.tr(), + heroSubtitle: job.statusText, + children: [ + BrandLinearIndicator( + value: value, + color: Theme.of(context).colorScheme.primary, + backgroundColor: Theme.of(context).colorScheme.surfaceVariant, + height: 14.0, + ), + const SizedBox(height: 16), + if (job.finishedAt != null) + Text( + job.result!, + style: Theme.of(context).textTheme.titleMedium, + ), + if (job.finishedAt != null) const SizedBox(height: 16), + if (job.finishedAt != null) + FilledButton( + title: 'providers.storage.migration_done'.tr(), + onPressed: () { + Navigator.of(context).pushAndRemoveUntil( + materialRoute(const RootPage()), + (final predicate) => false, + ); + }, + ) + ], + ); + } +} From 5ca58a0cd32ef8ad2db0637e8f5946f0a7acbd86 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 16 Sep 2022 12:44:15 +0300 Subject: [PATCH 086/115] Refactor network chart --- assets/translations/en.json | 6 +- assets/translations/ru.json | 6 +- lib/config/bloc_observer.dart | 13 +- lib/ui/pages/server_details/charts/chart.dart | 57 ++-- .../server_details/charts/network_charts.dart | 245 ++++++++++++------ 5 files changed, 218 insertions(+), 109 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index d83fcd17..253d39e1 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -100,7 +100,11 @@ "chart": { "month": "Month", "day": "Day", - "hour": "Hour" + "hour": "Hour", + "cpu_title": "CPU Usage", + "network_title": "Network Usage", + "in": "In", + "out": "Out" }, "settings": { "allow_autoupgrade": "Allow auto-upgrade", diff --git a/assets/translations/ru.json b/assets/translations/ru.json index aa755a7c..df68f75f 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -100,7 +100,11 @@ "chart": { "month": "Месяц", "day": "День", - "hour": "Час" + "hour": "Час", + "cpu_title": "Использование процессора", + "network_title": "Использование сети", + "in": "Получено", + "out": "Отправлено" }, "settings": { "allow_autoupgrade": "Разрешить авто-обноления", diff --git a/lib/config/bloc_observer.dart b/lib/config/bloc_observer.dart index e68923c9..3f2f26d8 100644 --- a/lib/config/bloc_observer.dart +++ b/lib/config/bloc_observer.dart @@ -1,7 +1,4 @@ -import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:selfprivacy/ui/components/error/error.dart'; -import 'package:selfprivacy/utils/route_transitions/basic.dart'; import 'package:selfprivacy/config/get_it_config.dart'; @@ -14,15 +11,9 @@ class SimpleBlocObserver extends BlocObserver { final Object error, final StackTrace stackTrace, ) { - final NavigatorState navigator = getIt.get().navigator!; - navigator.push( - materialRoute( - BrandError( - error: error, - stackTrace: stackTrace, - ), - ), + getIt().showSnackBar( + 'Bloc error: ${error.toString()}', ); super.onError(bloc, error, stackTrace); } diff --git a/lib/ui/pages/server_details/charts/chart.dart b/lib/ui/pages/server_details/charts/chart.dart index 0ff2dd40..12528767 100644 --- a/lib/ui/pages/server_details/charts/chart.dart +++ b/lib/ui/pages/server_details/charts/chart.dart @@ -25,7 +25,7 @@ class _Chart extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - 'CPU Usage', + 'providers.server.chart.cpu_title'.tr(), style: Theme.of(context).textTheme.titleMedium?.copyWith( color: Theme.of(context).colorScheme.onSurfaceVariant, ), @@ -36,19 +36,40 @@ class _Chart extends StatelessWidget { ), ), ), - const SizedBox(height: 1), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - BrandText.small('Public Network interface bytes per sec'), - const SizedBox(width: 10), - const Legend(color: Colors.red, text: 'IN'), - const SizedBox(width: 5), - const Legend(color: Colors.green, text: 'OUT'), - ], + const SizedBox(height: 8), + FilledCard( + clipped: false, + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + 'providers.server.chart.network_title'.tr(), + style: Theme.of(context).textTheme.titleMedium?.copyWith( + color: + Theme.of(context).colorScheme.onSurfaceVariant, + ), + ), + const Spacer(), + Legend( + color: Theme.of(context).colorScheme.primary, + text: 'providers.server.chart.in'.tr()), + const SizedBox(width: 5), + Legend( + color: Theme.of(context).colorScheme.tertiary, + text: 'providers.server.chart.out'.tr()), + ], + ), + const SizedBox(height: 20), + getBandwidthChart(state), + ], + ), + ), ), - const SizedBox(height: 20), - getBandwidthChart(state), ]; } else { throw 'wrong state'; @@ -81,6 +102,7 @@ class _Chart extends StatelessWidget { 'providers.server.chart.hour'.tr() ], ), + const SizedBox(height: 8), ...charts, ], ); @@ -129,7 +151,10 @@ class Legend extends StatelessWidget { children: [ _ColoredBox(color: color), const SizedBox(width: 5), - BrandText.small(text), + Text( + text, + style: Theme.of(context).textTheme.labelSmall, + ), ], ); } @@ -146,9 +171,11 @@ class _ColoredBox extends StatelessWidget { width: 10, height: 10, decoration: BoxDecoration( - color: color.withOpacity(0.3), + borderRadius: BorderRadius.circular(5), + color: color.withOpacity(0.4), border: Border.all( color: color, + width: 1.5, ), ), ); diff --git a/lib/ui/pages/server_details/charts/network_charts.dart b/lib/ui/pages/server_details/charts/network_charts.dart index 75d866a1..7487fd32 100644 --- a/lib/ui/pages/server_details/charts/network_charts.dart +++ b/lib/ui/pages/server_details/charts/network_charts.dart @@ -1,10 +1,10 @@ import 'dart:math'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:fl_chart/fl_chart.dart'; -import 'package:selfprivacy/config/brand_colors.dart'; -import 'package:selfprivacy/config/text_themes.dart'; import 'package:selfprivacy/logic/common_enum/common_enum.dart'; +import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/logic/models/hetzner_metrics.dart'; import 'package:selfprivacy/ui/pages/server_details/charts/bottom_title.dart'; @@ -33,91 +33,174 @@ class NetworkChart extends StatelessWidget { } @override - Widget build(final BuildContext context) => SizedBox( - height: 150, - width: MediaQuery.of(context).size.width, - child: LineChart( - LineChartData( - lineTouchData: LineTouchData(enabled: false), - lineBarsData: [ - LineChartBarData( - spots: getSpots(listData[0]), - isCurved: true, - barWidth: 1, - color: Colors.red, - dotData: FlDotData( - show: false, - ), - ), - LineChartBarData( - spots: getSpots(listData[1]), - isCurved: true, - barWidth: 1, - color: Colors.green, - dotData: FlDotData( - show: false, - ), - ), - ], - minY: 0, - maxY: [ - ...listData[0].map((final e) => e.value), - ...listData[1].map((final e) => e.value) - ].reduce(max) * - 1.2, - minX: listData[0].length - 200, - titlesData: FlTitlesData( - topTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)), - bottomTitles: AxisTitles( - sideTitles: SideTitles( - interval: 20, - reservedSize: 50, - getTitlesWidget: (final value, final titleMeta) => Padding( - padding: const EdgeInsets.all(8.0), - child: RotatedBox( - quarterTurns: 1, - child: Text( - bottomTitle( - value.toInt(), - listData[0], - period, - ), - style: const TextStyle( - fontSize: 10, - color: Colors.purple, - fontWeight: FontWeight.bold, - ), + Widget build(final BuildContext context) => LineChart( + LineChartData( + lineTouchData: LineTouchData( + enabled: true, + touchTooltipData: LineTouchTooltipData( + tooltipBgColor: Theme.of(context).colorScheme.surface, + tooltipPadding: const EdgeInsets.all(8), + getTooltipItems: (final List touchedBarSpots) { + final List res = []; + + bool timeShown = false; + + for (final spot in touchedBarSpots) { + final value = spot.y; + final date = listData[0][spot.x.toInt()].time; + + res.add( + LineTooltipItem( + '${timeShown ? '' : DateFormat('HH:mm dd.MM.yyyy').format(date)} ${spot.barIndex == 0 ? 'providers.server.chart.in'.tr() : 'providers.server.chart.out'.tr()} ${DiskSize(byte: value.toInt()).toString()}', + TextStyle( + color: Theme.of(context).colorScheme.onSurface, + fontWeight: FontWeight.bold, ), ), - ), - showTitles: true, - ), + ); + + timeShown = true; + } + + return res; + }, + ), + ), + lineBarsData: [ + // IN + LineChartBarData( + spots: getSpots(listData[0]), + isCurved: false, + barWidth: 2, + color: Theme.of(context).colorScheme.primary, + dotData: FlDotData( + show: false, ), - leftTitles: AxisTitles( - sideTitles: SideTitles( - reservedSize: 50, - getTitlesWidget: (final value, final titleMeta) => Padding( - padding: const EdgeInsets.only(right: 5), - child: Text( - value.toInt().toString(), - style: progressTextStyleLight.copyWith( - color: Theme.of(context).brightness == Brightness.dark - ? BrandColors.gray4 - : null, - ), - ), - ), - interval: [ - ...listData[0].map((final e) => e.value), - ...listData[1].map((final e) => e.value) - ].reduce(max) * - 2 / - 10, - showTitles: false, + belowBarData: BarAreaData( + show: true, + gradient: LinearGradient( + colors: [ + Theme.of(context).colorScheme.primary.withOpacity(0.5), + Theme.of(context).colorScheme.primary.withOpacity(0.0), + ], + begin: Alignment.bottomCenter, + end: Alignment.topCenter, ), ), ), - gridData: FlGridData(show: true), + // OUT + LineChartBarData( + spots: getSpots(listData[1]), + isCurved: false, + barWidth: 2, + color: Theme.of(context).colorScheme.tertiary, + dotData: FlDotData( + show: false, + ), + belowBarData: BarAreaData( + show: true, + gradient: LinearGradient( + colors: [ + Theme.of(context).colorScheme.tertiary.withOpacity(0.5), + Theme.of(context).colorScheme.tertiary.withOpacity(0.0), + ], + begin: Alignment.bottomCenter, + end: Alignment.topCenter, + ), + ), + ), + ], + minY: 0, + maxY: [ + ...listData[0].map((final e) => e.value), + ...listData[1].map((final e) => e.value) + ].reduce(max) * + 1.2, + minX: listData[0].length - 200, + titlesData: FlTitlesData( + topTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)), + bottomTitles: AxisTitles( + sideTitles: SideTitles( + interval: 40, + reservedSize: 30, + getTitlesWidget: (final value, final titleMeta) => Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + bottomTitle( + value.toInt(), + listData[0], + period, + ), + style: Theme.of(context).textTheme.labelSmall?.copyWith( + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + ), + ), + showTitles: true, + ), + ), + leftTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)), + rightTitles: AxisTitles( + sideTitles: SideTitles( + reservedSize: 50, + getTitlesWidget: (final value, final titleMeta) => Padding( + padding: const EdgeInsets.only(left: 5), + child: Text( + DiskSize(byte: value.toInt()).toString(), + style: Theme.of(context).textTheme.labelSmall?.copyWith( + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + ), + ), + interval: [ + ...listData[0].map((final e) => e.value), + ...listData[1].map((final e) => e.value) + ].reduce(max) * + 2 / + 6.5, + showTitles: true, + ), + ), + ), + gridData: FlGridData( + show: true, + drawVerticalLine: true, + verticalInterval: 40, + horizontalInterval: [ + ...listData[0].map((final e) => e.value), + ...listData[1].map((final e) => e.value) + ].reduce(max) * + 2 / + 6.5, + getDrawingHorizontalLine: (final value) => FlLine( + color: Theme.of(context).colorScheme.outline.withOpacity(0.3), + strokeWidth: 1, + ), + getDrawingVerticalLine: (final value) => FlLine( + color: Theme.of(context).colorScheme.outline.withOpacity(0.3), + strokeWidth: 1, + ), + ), + borderData: FlBorderData( + show: true, + border: Border( + bottom: BorderSide( + color: Theme.of(context).colorScheme.outline.withOpacity(0.3), + width: 1, + ), + left: BorderSide( + color: Theme.of(context).colorScheme.outline.withOpacity(0.3), + width: 1, + ), + right: BorderSide( + color: Theme.of(context).colorScheme.outline.withOpacity(0.3), + width: 1, + ), + top: BorderSide( + color: Theme.of(context).colorScheme.outline.withOpacity(0.3), + width: 1, + ), + ), ), ), ); From c8581e65aa70de9751f000312877095fe06e41de Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 16 Sep 2022 12:54:18 +0300 Subject: [PATCH 087/115] Add adaptive density --- lib/theming/factory/app_theme_factory.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/theming/factory/app_theme_factory.dart b/lib/theming/factory/app_theme_factory.dart index 48f4b086..c44be7a3 100644 --- a/lib/theming/factory/app_theme_factory.dart +++ b/lib/theming/factory/app_theme_factory.dart @@ -60,6 +60,7 @@ abstract class AppThemeFactory { final Typography appTypography = Typography.material2021(); final ThemeData materialThemeData = ThemeData( + visualDensity: VisualDensity.adaptivePlatformDensity, colorScheme: colorScheme, brightness: colorScheme.brightness, typography: appTypography, From 41efde80b2f7f9cae63d2f606ac87ef651a0e41c Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 16 Sep 2022 13:07:26 +0300 Subject: [PATCH 088/115] Make SegmentedButtons responsive to visual density --- lib/ui/components/brand_button/segmented_buttons.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ui/components/brand_button/segmented_buttons.dart b/lib/ui/components/brand_button/segmented_buttons.dart index 8ddccb5b..e3ce50cd 100644 --- a/lib/ui/components/brand_button/segmented_buttons.dart +++ b/lib/ui/components/brand_button/segmented_buttons.dart @@ -17,7 +17,7 @@ class SegmentedButtons extends StatelessWidget { builder: (final context, final constraints) => ToggleButtons( constraints: BoxConstraints( minWidth: (constraints.maxWidth - 8) / 3, - minHeight: 40, + minHeight: 40 + Theme.of(context).visualDensity.vertical * 4, ), borderRadius: BorderRadius.circular(48), borderColor: Theme.of(context).colorScheme.outline, From 61d049118fb5eb27b80d302dba535fc43ca8d094 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 16 Sep 2022 13:36:26 +0300 Subject: [PATCH 089/115] Add animation for graph loading --- assets/translations/en.json | 1 + lib/config/bloc_observer.dart | 1 - lib/ui/pages/server_details/charts/chart.dart | 54 +++++++++++++------ .../server_details/server_details_screen.dart | 8 ++- 4 files changed, 47 insertions(+), 17 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index 253d39e1..c4d319dc 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -106,6 +106,7 @@ "in": "In", "out": "Out" }, + "resource_usage": "Resource usage", "settings": { "allow_autoupgrade": "Allow auto-upgrade", "allow_autoupgrade_hint": "Allow automatic packages upgrades on server", diff --git a/lib/config/bloc_observer.dart b/lib/config/bloc_observer.dart index 3f2f26d8..d8bf846a 100644 --- a/lib/config/bloc_observer.dart +++ b/lib/config/bloc_observer.dart @@ -11,7 +11,6 @@ class SimpleBlocObserver extends BlocObserver { final Object error, final StackTrace stackTrace, ) { - getIt().showSnackBar( 'Bloc error: ${error.toString()}', ); diff --git a/lib/ui/pages/server_details/charts/chart.dart b/lib/ui/pages/server_details/charts/chart.dart index 12528767..60dfc092 100644 --- a/lib/ui/pages/server_details/charts/chart.dart +++ b/lib/ui/pages/server_details/charts/chart.dart @@ -7,15 +7,7 @@ class _Chart extends StatelessWidget { final Period period = cubit.state.period; final HetznerMetricsState state = cubit.state; List charts; - if (state is HetznerMetricsLoading) { - charts = [ - Container( - height: 200, - alignment: Alignment.center, - child: Text('basis.loading'.tr()), - ) - ]; - } else if (state is HetznerMetricsLoaded) { + if (state is HetznerMetricsLoaded || state is HetznerMetricsLoading) { charts = [ FilledCard( clipped: false, @@ -31,7 +23,17 @@ class _Chart extends StatelessWidget { ), ), const SizedBox(height: 16), - getCpuChart(state), + Stack( + alignment: Alignment.center, + children: [ + if (state is HetznerMetricsLoaded) getCpuChart(state), + AnimatedOpacity( + duration: const Duration(milliseconds: 200), + opacity: state is HetznerMetricsLoading ? 1 : 0, + child: const _GraphLoadingCardContent(), + ), + ], + ), ], ), ), @@ -56,16 +58,28 @@ class _Chart extends StatelessWidget { ), const Spacer(), Legend( - color: Theme.of(context).colorScheme.primary, - text: 'providers.server.chart.in'.tr()), + color: Theme.of(context).colorScheme.primary, + text: 'providers.server.chart.in'.tr(), + ), const SizedBox(width: 5), Legend( - color: Theme.of(context).colorScheme.tertiary, - text: 'providers.server.chart.out'.tr()), + color: Theme.of(context).colorScheme.tertiary, + text: 'providers.server.chart.out'.tr(), + ), ], ), const SizedBox(height: 20), - getBandwidthChart(state), + Stack( + alignment: Alignment.center, + children: [ + if (state is HetznerMetricsLoaded) getBandwidthChart(state), + AnimatedOpacity( + duration: const Duration(milliseconds: 200), + opacity: state is HetznerMetricsLoading ? 1 : 0, + child: const _GraphLoadingCardContent(), + ), + ], + ), ], ), ), @@ -136,6 +150,16 @@ class _Chart extends StatelessWidget { } } +class _GraphLoadingCardContent extends StatelessWidget { + const _GraphLoadingCardContent(); + + @override + Widget build(final BuildContext context) => const SizedBox( + height: 200, + child: Center(child: CircularProgressIndicator()), + ); +} + class Legend extends StatelessWidget { const Legend({ required this.color, diff --git a/lib/ui/pages/server_details/server_details_screen.dart b/lib/ui/pages/server_details/server_details_screen.dart index 16f87be8..5b839ef1 100644 --- a/lib/ui/pages/server_details/server_details_screen.dart +++ b/lib/ui/pages/server_details/server_details_screen.dart @@ -88,11 +88,17 @@ class _ServerDetailsScreenState extends State context.read().state.volumes, ), ), + const Divider(height: 32), + Text( + 'providers.server.resource_usage'.tr(), + style: Theme.of(context).textTheme.titleLarge, + ), + const SizedBox(height: 8), BlocProvider( create: (final context) => HetznerMetricsCubit()..restart(), child: _Chart(), ), - const SizedBox(height: 20), + const Divider(height: 32), _TextDetails(), const _ServerSettings(), ], From 641e329725df8579462401b5bca7568f758b7ea6 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 16 Sep 2022 14:28:17 +0300 Subject: [PATCH 090/115] Move DiskStatus to the server volume cubit --- lib/config/bloc_config.dart | 2 +- .../provider_volume_cubit.dart | 2 +- .../server_volumes/server_volume_cubit.dart | 47 +++++++++++++++++-- .../server_volumes/server_volume_state.dart | 13 +++-- .../models}/disk_status.dart | 0 lib/ui/pages/more/more.dart | 7 +-- lib/ui/pages/providers/providers.dart | 10 +--- .../server_details/server_details_screen.dart | 7 +-- .../pages/server_storage/data_migration.dart | 2 +- .../server_storage/extending_volume.dart | 2 +- .../pages/server_storage/server_storage.dart | 2 +- .../server_storage_list_item.dart | 2 +- .../service_migration_list_item.dart | 2 +- lib/ui/pages/server_storage/storage_card.dart | 2 +- lib/ui/pages/services/service_page.dart | 4 ++ 15 files changed, 68 insertions(+), 36 deletions(-) rename lib/{ui/pages/server_storage => logic/models}/disk_status.dart (100%) diff --git a/lib/config/bloc_config.dart b/lib/config/bloc_config.dart index a6cf7202..b80dada7 100644 --- a/lib/config/bloc_config.dart +++ b/lib/config/bloc_config.dart @@ -31,7 +31,7 @@ class BlocAndProviderConfig extends StatelessWidget { final recoveryKeyCubit = RecoveryKeyCubit(serverInstallationCubit); final apiDevicesCubit = ApiDevicesCubit(serverInstallationCubit); final apiVolumesCubit = ApiProviderVolumeCubit(serverInstallationCubit); - final apiServerVolumesCubit = ApiServerVolumeCubit(serverInstallationCubit); + final apiServerVolumesCubit = ApiServerVolumeCubit(serverInstallationCubit, apiVolumesCubit); final serverJobsCubit = ServerJobsCubit(serverInstallationCubit); final serverDetailsCubit = ServerDetailsCubit(serverInstallationCubit); diff --git a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart index a4df4469..d64a32c8 100644 --- a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart +++ b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart @@ -5,7 +5,7 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_pro 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/hive/server_details.dart'; -import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; +import 'package:selfprivacy/logic/models/disk_status.dart'; part 'provider_volume_state.dart'; diff --git a/lib/logic/cubit/server_volumes/server_volume_cubit.dart b/lib/logic/cubit/server_volumes/server_volume_cubit.dart index 53b185c7..f13a4b07 100644 --- a/lib/logic/cubit/server_volumes/server_volume_cubit.dart +++ b/lib/logic/cubit/server_volumes/server_volume_cubit.dart @@ -1,14 +1,22 @@ +import 'dart:async'; + import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server.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/cubit/provider_volumes/provider_volume_cubit.dart'; +import 'package:selfprivacy/logic/models/disk_status.dart'; import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; part 'server_volume_state.dart'; class ApiServerVolumeCubit extends ServerInstallationDependendCubit { - ApiServerVolumeCubit(final ServerInstallationCubit serverInstallationCubit) - : super(serverInstallationCubit, const ApiServerVolumeState.initial()); + ApiServerVolumeCubit( + final ServerInstallationCubit serverInstallationCubit, this.providerVolumeCubit, + ) : super(serverInstallationCubit, ApiServerVolumeState.initial()) { + _providerVolumeSubscription = + providerVolumeCubit.stream.listen(checkProviderVolumes); + } final ServerApi serverApi = ServerApi(); @@ -19,6 +27,21 @@ class ApiServerVolumeCubit } } + late StreamSubscription _providerVolumeSubscription; + final ApiProviderVolumeCubit providerVolumeCubit; + + void checkProviderVolumes(final ApiProviderVolumeState state) { + emit( + ApiServerVolumeState( + this.state._volumes, + this.state.status, + this.state.usesBinds, + DiskStatus.fromVolumes(this.state._volumes, state.volumes), + ), + ); + return; + } + Future _refetch() async { final volumes = await serverApi.getServerDiskVolumes(); final usesBinds = await serverApi.isUsingBinds(); @@ -28,11 +51,27 @@ class ApiServerVolumeCubit status = LoadingStatus.success; } - emit(ApiServerVolumeState(volumes, status, usesBinds)); + emit( + ApiServerVolumeState( + volumes, + status, + usesBinds, + DiskStatus.fromVolumes( + volumes, + providerVolumeCubit.state.volumes, + ), + ), + ); } @override void clear() { - emit(const ApiServerVolumeState.initial()); + emit(ApiServerVolumeState.initial()); + } + + @override + Future close() { + _providerVolumeSubscription.cancel(); + return super.close(); } } diff --git a/lib/logic/cubit/server_volumes/server_volume_state.dart b/lib/logic/cubit/server_volumes/server_volume_state.dart index 3df43855..1764d7fc 100644 --- a/lib/logic/cubit/server_volumes/server_volume_state.dart +++ b/lib/logic/cubit/server_volumes/server_volume_state.dart @@ -5,26 +5,33 @@ class ApiServerVolumeState extends ServerInstallationDependendState { this._volumes, this.status, this.usesBinds, + this._diskStatus, ); - const ApiServerVolumeState.initial() - : this(const [], LoadingStatus.uninitialized, null); + ApiServerVolumeState.initial() + : this(const [], LoadingStatus.uninitialized, null, DiskStatus()); final List _volumes; + final DiskStatus _diskStatus; final bool? usesBinds; final LoadingStatus status; - List get volumes => _volumes; + List get volumes => _diskStatus.diskVolumes; + DiskStatus get diskStatus => _diskStatus; + + DiskVolume getVolume(final String volumeName) => volumes.firstWhere((final volume) => volume.name == volumeName, orElse: () => DiskVolume()); ApiServerVolumeState copyWith({ final List? volumes, final LoadingStatus? status, final bool? usesBinds, + final DiskStatus? diskStatus, }) => ApiServerVolumeState( volumes ?? _volumes, status ?? this.status, usesBinds ?? this.usesBinds, + diskStatus ?? _diskStatus, ); @override diff --git a/lib/ui/pages/server_storage/disk_status.dart b/lib/logic/models/disk_status.dart similarity index 100% rename from lib/ui/pages/server_storage/disk_status.dart rename to lib/logic/models/disk_status.dart diff --git a/lib/ui/pages/more/more.dart b/lib/ui/pages/more/more.dart index e2b78423..593abc28 100644 --- a/lib/ui/pages/more/more.dart +++ b/lib/ui/pages/more/more.dart @@ -2,7 +2,6 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:ionicons/ionicons.dart'; import 'package:selfprivacy/config/brand_theme.dart'; -import 'package:selfprivacy/logic/cubit/provider_volumes/provider_volume_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_volumes/server_volume_cubit.dart'; import 'package:selfprivacy/logic/cubit/services/services_cubit.dart'; @@ -12,7 +11,6 @@ import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart'; import 'package:selfprivacy/ui/pages/devices/devices.dart'; import 'package:selfprivacy/ui/pages/recovery_key/recovery_key.dart'; import 'package:selfprivacy/ui/pages/server_storage/data_migration.dart'; -import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; import 'package:selfprivacy/ui/pages/setup/initializing.dart'; import 'package:selfprivacy/ui/pages/onboarding/onboarding.dart'; import 'package:selfprivacy/ui/pages/root_route.dart'; @@ -53,10 +51,7 @@ class MorePage extends StatelessWidget { title: 'providers.storage.start_migration_button'.tr(), iconData: Icons.drive_file_move_outline, goTo: DataMigrationPage( - diskStatus: DiskStatus.fromVolumes( - context.read().state.volumes, - context.read().state.volumes, - ), + diskStatus: context.watch().state.diskStatus, services: context .read() .state diff --git a/lib/ui/pages/providers/providers.dart b/lib/ui/pages/providers/providers.dart index 6cc1495d..8b06751b 100644 --- a/lib/ui/pages/providers/providers.dart +++ b/lib/ui/pages/providers/providers.dart @@ -3,12 +3,9 @@ import 'package:flutter/material.dart'; import 'package:selfprivacy/config/brand_theme.dart'; import 'package:selfprivacy/logic/cubit/backups/backups_cubit.dart'; import 'package:selfprivacy/logic/cubit/dns_records/dns_records_cubit.dart'; -import 'package:selfprivacy/logic/cubit/provider_volumes/provider_volume_cubit.dart'; import 'package:selfprivacy/logic/cubit/providers/providers_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_volumes/server_volume_cubit.dart'; -import 'package:selfprivacy/logic/models/hive/server_details.dart'; -import 'package:selfprivacy/logic/models/json/server_disk_volume.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart'; import 'package:selfprivacy/ui/components/icon_status_mask/icon_status_mask.dart'; @@ -16,7 +13,6 @@ import 'package:selfprivacy/ui/components/not_ready_card/not_ready_card.dart'; import 'package:selfprivacy/ui/pages/backup_details/backup_details.dart'; import 'package:selfprivacy/ui/pages/dns_details/dns_details.dart'; import 'package:selfprivacy/ui/pages/server_details/server_details_screen.dart'; -import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; GlobalKey navigatorKey = GlobalKey(); @@ -38,11 +34,7 @@ class _ProvidersPageState extends State { final DnsRecordsStatus dnsStatus = context.watch().state.dnsState; - final List serverVolumes = - context.watch().state.volumes; - final List providerVolumes = - context.watch().state.volumes; - final diskStatus = DiskStatus.fromVolumes(serverVolumes, providerVolumes); + final diskStatus = context.watch().state.diskStatus; final ServerInstallationState appConfig = context.watch().state; diff --git a/lib/ui/pages/server_details/server_details_screen.dart b/lib/ui/pages/server_details/server_details_screen.dart index 5b839ef1..9d25e8ba 100644 --- a/lib/ui/pages/server_details/server_details_screen.dart +++ b/lib/ui/pages/server_details/server_details_screen.dart @@ -4,7 +4,6 @@ import 'package:flutter/material.dart'; import 'package:selfprivacy/config/brand_colors.dart'; import 'package:selfprivacy/logic/common_enum/common_enum.dart'; import 'package:selfprivacy/logic/cubit/hetzner_metrics/hetzner_metrics_cubit.dart'; -import 'package:selfprivacy/logic/cubit/provider_volumes/provider_volume_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_volumes/server_volume_cubit.dart'; @@ -19,7 +18,6 @@ import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; import 'package:selfprivacy/ui/components/switch_block/switch_bloc.dart'; import 'package:selfprivacy/ui/pages/server_storage/storage_card.dart'; import 'package:selfprivacy/ui/pages/server_details/time_zone/lang.dart'; -import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; import 'package:selfprivacy/utils/extensions/duration.dart'; import 'package:selfprivacy/utils/named_font_weight.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; @@ -83,10 +81,7 @@ class _ServerDetailsScreenState extends State heroSubtitle: 'providers.server.bottom_sheet.1'.tr(), children: [ StorageCard( - diskStatus: DiskStatus.fromVolumes( - context.read().state.volumes, - context.read().state.volumes, - ), + diskStatus: context.watch().state.diskStatus, ), const Divider(height: 32), Text( diff --git a/lib/ui/pages/server_storage/data_migration.dart b/lib/ui/pages/server_storage/data_migration.dart index 67eca453..cf43bd9c 100644 --- a/lib/ui/pages/server_storage/data_migration.dart +++ b/lib/ui/pages/server_storage/data_migration.dart @@ -5,7 +5,7 @@ import 'package:selfprivacy/logic/models/service.dart'; import 'package:selfprivacy/ui/components/brand_button/filled_button.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; import 'package:selfprivacy/ui/components/info_box/info_box.dart'; -import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; +import 'package:selfprivacy/logic/models/disk_status.dart'; import 'package:selfprivacy/ui/pages/server_storage/server_storage_list_item.dart'; import 'package:selfprivacy/ui/pages/server_storage/service_migration_list_item.dart'; diff --git a/lib/ui/pages/server_storage/extending_volume.dart b/lib/ui/pages/server_storage/extending_volume.dart index 02b1dba7..c0c48b2e 100644 --- a/lib/ui/pages/server_storage/extending_volume.dart +++ b/lib/ui/pages/server_storage/extending_volume.dart @@ -5,7 +5,7 @@ import 'package:selfprivacy/logic/cubit/provider_volumes/provider_volume_cubit.d import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/ui/components/brand_button/filled_button.dart'; import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; -import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; +import 'package:selfprivacy/logic/models/disk_status.dart'; class ExtendingVolumePage extends StatefulWidget { const ExtendingVolumePage({ diff --git a/lib/ui/pages/server_storage/server_storage.dart b/lib/ui/pages/server_storage/server_storage.dart index 766440be..94a0532e 100644 --- a/lib/ui/pages/server_storage/server_storage.dart +++ b/lib/ui/pages/server_storage/server_storage.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/ui/components/brand_button/outlined_button.dart'; import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; -import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; +import 'package:selfprivacy/logic/models/disk_status.dart'; import 'package:selfprivacy/ui/pages/server_storage/extending_volume.dart'; import 'package:selfprivacy/ui/pages/server_storage/server_storage_list_item.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; diff --git a/lib/ui/pages/server_storage/server_storage_list_item.dart b/lib/ui/pages/server_storage/server_storage_list_item.dart index 3aad19b2..371769a8 100644 --- a/lib/ui/pages/server_storage/server_storage_list_item.dart +++ b/lib/ui/pages/server_storage/server_storage_list_item.dart @@ -1,7 +1,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:selfprivacy/ui/components/brand_linear_indicator/brand_linear_indicator.dart'; -import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; +import 'package:selfprivacy/logic/models/disk_status.dart'; class ServerStorageListItem extends StatelessWidget { const ServerStorageListItem({ diff --git a/lib/ui/pages/server_storage/service_migration_list_item.dart b/lib/ui/pages/server_storage/service_migration_list_item.dart index ac6fc5bf..f6b59663 100644 --- a/lib/ui/pages/server_storage/service_migration_list_item.dart +++ b/lib/ui/pages/server_storage/service_migration_list_item.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:selfprivacy/logic/models/service.dart'; -import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; +import 'package:selfprivacy/logic/models/disk_status.dart'; class ServiceMigrationListItem extends StatelessWidget { const ServiceMigrationListItem({ diff --git a/lib/ui/pages/server_storage/storage_card.dart b/lib/ui/pages/server_storage/storage_card.dart index 210eec48..7bad8958 100644 --- a/lib/ui/pages/server_storage/storage_card.dart +++ b/lib/ui/pages/server_storage/storage_card.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; import 'package:selfprivacy/logic/cubit/providers/providers_cubit.dart'; import 'package:selfprivacy/ui/components/icon_status_mask/icon_status_mask.dart'; -import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart'; +import 'package:selfprivacy/logic/models/disk_status.dart'; import 'package:selfprivacy/ui/pages/server_storage/server_storage.dart'; import 'package:selfprivacy/ui/pages/server_storage/server_storage_list_item.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; diff --git a/lib/ui/pages/services/service_page.dart b/lib/ui/pages/services/service_page.dart index 2bdf8f72..dd5f8e86 100644 --- a/lib/ui/pages/services/service_page.dart +++ b/lib/ui/pages/services/service_page.dart @@ -117,6 +117,10 @@ class _ServicePageState extends State { 'services.service_page.move'.tr(), style: Theme.of(context).textTheme.titleMedium, ), + // subtitle: Text( + // 'Uses ${service.storageUsage.used} on ${context.read().state.totalStorage}', + // style: Theme.of(context).textTheme.bodyMedium, + // ), ), ], ); From 6f6df3076788bc4403d3b077f41f2e280c9d54d1 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 16 Sep 2022 15:00:15 +0300 Subject: [PATCH 091/115] Animate BrandLinearIndicator --- .../brand_linear_indicator.dart | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/lib/ui/components/brand_linear_indicator/brand_linear_indicator.dart b/lib/ui/components/brand_linear_indicator/brand_linear_indicator.dart index 807d3224..16ffb40a 100644 --- a/lib/ui/components/brand_linear_indicator/brand_linear_indicator.dart +++ b/lib/ui/components/brand_linear_indicator/brand_linear_indicator.dart @@ -15,21 +15,29 @@ class BrandLinearIndicator extends StatelessWidget { final double height; @override - Widget build(final BuildContext context) => Container( - height: height, - width: double.infinity, - clipBehavior: Clip.antiAlias, - decoration: BoxDecoration( - color: backgroundColor, - borderRadius: BorderRadius.circular(height), - ), - alignment: Alignment.centerLeft, - child: FractionallySizedBox( - widthFactor: value, - child: Container( - decoration: BoxDecoration( - color: color, - borderRadius: BorderRadius.circular(height), + Widget build(final BuildContext context) => LayoutBuilder( + builder: (final context, final constraints) => Container( + height: height, + width: constraints.maxWidth, + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + color: backgroundColor, + borderRadius: BorderRadius.circular(height), + ), + alignment: Alignment.centerLeft, + child: AnimatedSlide( + duration: const Duration(milliseconds: 400), + curve: Curves.easeInOut, + offset: Offset( + -(1 - value), + 0, + ), + child: Container( + width: constraints.maxWidth, + decoration: BoxDecoration( + color: color, + borderRadius: BorderRadius.circular(height), + ), ), ), ), From ae0295d9598121f76d64dc216e5838b7e9de20dd Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 16 Sep 2022 16:36:51 +0300 Subject: [PATCH 092/115] Add storage usage to service screen, formatting --- assets/translations/en.json | 4 +++- assets/translations/ru.json | 4 +++- lib/config/bloc_config.dart | 3 ++- .../server_volumes/server_volume_cubit.dart | 3 ++- .../server_volumes/server_volume_state.dart | 6 ++++-- lib/ui/pages/more/more.dart | 5 ++++- lib/ui/pages/services/service_page.dart | 20 ++++++++++++++----- 7 files changed, 33 insertions(+), 12 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index c4d319dc..f3ec3523 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -210,10 +210,12 @@ "_comment": "Services", "title": "Your personal, private and independent services.", "service_page": { + "open_in_browser": "Open in browser", "restart": "Restart service", "disable": "Disable service", "enable": "Enable service", - "move": "Move to another volume" + "move": "Move to another volume", + "uses": "Uses {usage} on {volume}" }, "mail": { "title": "E-Mail", diff --git a/assets/translations/ru.json b/assets/translations/ru.json index df68f75f..5072c88b 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -209,10 +209,12 @@ "_comment": "Вкладка сервисы", "title": "Ваши личные, приватные и независимые сервисы:", "service_page": { + "open_in_browser": "Открыть в браузере", "restart": "Перезапустить сервис", "disable": "Выключить сервис", "enable": "Включить сервис", - "move": "Переместить на другой диск" + "move": "Переместить на другой диск", + "uses": "Использует {usage} на {volume}" }, "mail": { "title": "Почта", diff --git a/lib/config/bloc_config.dart b/lib/config/bloc_config.dart index b80dada7..b88b21d7 100644 --- a/lib/config/bloc_config.dart +++ b/lib/config/bloc_config.dart @@ -31,7 +31,8 @@ class BlocAndProviderConfig extends StatelessWidget { final recoveryKeyCubit = RecoveryKeyCubit(serverInstallationCubit); final apiDevicesCubit = ApiDevicesCubit(serverInstallationCubit); final apiVolumesCubit = ApiProviderVolumeCubit(serverInstallationCubit); - final apiServerVolumesCubit = ApiServerVolumeCubit(serverInstallationCubit, apiVolumesCubit); + final apiServerVolumesCubit = + ApiServerVolumeCubit(serverInstallationCubit, apiVolumesCubit); final serverJobsCubit = ServerJobsCubit(serverInstallationCubit); final serverDetailsCubit = ServerDetailsCubit(serverInstallationCubit); diff --git a/lib/logic/cubit/server_volumes/server_volume_cubit.dart b/lib/logic/cubit/server_volumes/server_volume_cubit.dart index f13a4b07..ca6dbb6e 100644 --- a/lib/logic/cubit/server_volumes/server_volume_cubit.dart +++ b/lib/logic/cubit/server_volumes/server_volume_cubit.dart @@ -12,7 +12,8 @@ part 'server_volume_state.dart'; class ApiServerVolumeCubit extends ServerInstallationDependendCubit { ApiServerVolumeCubit( - final ServerInstallationCubit serverInstallationCubit, this.providerVolumeCubit, + final ServerInstallationCubit serverInstallationCubit, + this.providerVolumeCubit, ) : super(serverInstallationCubit, ApiServerVolumeState.initial()) { _providerVolumeSubscription = providerVolumeCubit.stream.listen(checkProviderVolumes); diff --git a/lib/logic/cubit/server_volumes/server_volume_state.dart b/lib/logic/cubit/server_volumes/server_volume_state.dart index 1764d7fc..b2b1fce0 100644 --- a/lib/logic/cubit/server_volumes/server_volume_state.dart +++ b/lib/logic/cubit/server_volumes/server_volume_state.dart @@ -5,7 +5,7 @@ class ApiServerVolumeState extends ServerInstallationDependendState { this._volumes, this.status, this.usesBinds, - this._diskStatus, + this._diskStatus, ); ApiServerVolumeState.initial() @@ -19,7 +19,9 @@ class ApiServerVolumeState extends ServerInstallationDependendState { List get volumes => _diskStatus.diskVolumes; DiskStatus get diskStatus => _diskStatus; - DiskVolume getVolume(final String volumeName) => volumes.firstWhere((final volume) => volume.name == volumeName, orElse: () => DiskVolume()); + DiskVolume getVolume(final String volumeName) => + volumes.firstWhere((final volume) => volume.name == volumeName, + orElse: () => DiskVolume()); ApiServerVolumeState copyWith({ final List? volumes, diff --git a/lib/ui/pages/more/more.dart b/lib/ui/pages/more/more.dart index 593abc28..0d1f9802 100644 --- a/lib/ui/pages/more/more.dart +++ b/lib/ui/pages/more/more.dart @@ -51,7 +51,10 @@ class MorePage extends StatelessWidget { title: 'providers.storage.start_migration_button'.tr(), iconData: Icons.drive_file_move_outline, goTo: DataMigrationPage( - diskStatus: context.watch().state.diskStatus, + diskStatus: context + .watch() + .state + .diskStatus, services: context .read() .state diff --git a/lib/ui/pages/services/service_page.dart b/lib/ui/pages/services/service_page.dart index dd5f8e86..82dde3dc 100644 --- a/lib/ui/pages/services/service_page.dart +++ b/lib/ui/pages/services/service_page.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:selfprivacy/logic/common_enum/common_enum.dart'; import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart'; +import 'package:selfprivacy/logic/cubit/server_volumes/server_volume_cubit.dart'; import 'package:selfprivacy/logic/cubit/services/services_cubit.dart'; import 'package:selfprivacy/logic/models/job.dart'; import 'package:selfprivacy/logic/models/service.dart'; @@ -68,7 +69,7 @@ class _ServicePageState extends State { onTap: () => _launchURL(service.url), leading: const Icon(Icons.open_in_browser), title: Text( - 'Open in browser', + 'services.service_page.open_in_browser'.tr(), style: Theme.of(context).textTheme.titleMedium, ), subtitle: Text( @@ -117,10 +118,19 @@ class _ServicePageState extends State { 'services.service_page.move'.tr(), style: Theme.of(context).textTheme.titleMedium, ), - // subtitle: Text( - // 'Uses ${service.storageUsage.used} on ${context.read().state.totalStorage}', - // style: Theme.of(context).textTheme.bodyMedium, - // ), + subtitle: Text( + 'services.service_page.uses'.tr( + namedArgs: { + 'usage': service.storageUsage.used.toString(), + 'volume': context + .read() + .state + .getVolume(service.storageUsage.volume ?? '') + .displayName + }, + ), + style: Theme.of(context).textTheme.bodyMedium, + ), ), ], ); From c84d16d8b7e1cc3d0ac2fe179a92aea1dbe095f6 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 16 Sep 2022 16:49:53 +0300 Subject: [PATCH 093/115] Move files related to storage --- .../cubit/server_volumes/server_volume_state.dart | 7 ++++--- .../server_storage_list_item.dart | 0 .../service_migration_list_item.dart | 0 .../service_storage_consumption_list_item.dart | 0 lib/ui/pages/more/more.dart | 4 ++-- .../data_to_binds_migration.dart} | 13 +++++++------ .../migration_process_page.dart | 2 +- lib/ui/pages/server_storage/server_storage.dart | 2 +- lib/ui/pages/server_storage/storage_card.dart | 2 +- 9 files changed, 16 insertions(+), 14 deletions(-) rename lib/ui/{pages/server_storage => components/storage_list_items}/server_storage_list_item.dart (100%) rename lib/ui/{pages/server_storage => components/storage_list_items}/service_migration_list_item.dart (100%) rename lib/ui/{pages/server_storage => components/storage_list_items}/service_storage_consumption_list_item.dart (100%) rename lib/ui/pages/server_storage/{data_migration.dart => binds_migration/data_to_binds_migration.dart} (92%) rename lib/ui/pages/server_storage/{ => binds_migration}/migration_process_page.dart (98%) diff --git a/lib/logic/cubit/server_volumes/server_volume_state.dart b/lib/logic/cubit/server_volumes/server_volume_state.dart index b2b1fce0..d68daa58 100644 --- a/lib/logic/cubit/server_volumes/server_volume_state.dart +++ b/lib/logic/cubit/server_volumes/server_volume_state.dart @@ -19,9 +19,10 @@ class ApiServerVolumeState extends ServerInstallationDependendState { List get volumes => _diskStatus.diskVolumes; DiskStatus get diskStatus => _diskStatus; - DiskVolume getVolume(final String volumeName) => - volumes.firstWhere((final volume) => volume.name == volumeName, - orElse: () => DiskVolume()); + DiskVolume getVolume(final String volumeName) => volumes.firstWhere( + (final volume) => volume.name == volumeName, + orElse: () => DiskVolume(), + ); ApiServerVolumeState copyWith({ final List? volumes, diff --git a/lib/ui/pages/server_storage/server_storage_list_item.dart b/lib/ui/components/storage_list_items/server_storage_list_item.dart similarity index 100% rename from lib/ui/pages/server_storage/server_storage_list_item.dart rename to lib/ui/components/storage_list_items/server_storage_list_item.dart diff --git a/lib/ui/pages/server_storage/service_migration_list_item.dart b/lib/ui/components/storage_list_items/service_migration_list_item.dart similarity index 100% rename from lib/ui/pages/server_storage/service_migration_list_item.dart rename to lib/ui/components/storage_list_items/service_migration_list_item.dart diff --git a/lib/ui/pages/server_storage/service_storage_consumption_list_item.dart b/lib/ui/components/storage_list_items/service_storage_consumption_list_item.dart similarity index 100% rename from lib/ui/pages/server_storage/service_storage_consumption_list_item.dart rename to lib/ui/components/storage_list_items/service_storage_consumption_list_item.dart diff --git a/lib/ui/pages/more/more.dart b/lib/ui/pages/more/more.dart index 0d1f9802..eeedd4d8 100644 --- a/lib/ui/pages/more/more.dart +++ b/lib/ui/pages/more/more.dart @@ -10,7 +10,7 @@ import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart'; import 'package:selfprivacy/ui/pages/devices/devices.dart'; import 'package:selfprivacy/ui/pages/recovery_key/recovery_key.dart'; -import 'package:selfprivacy/ui/pages/server_storage/data_migration.dart'; +import 'package:selfprivacy/ui/pages/server_storage/binds_migration/data_to_binds_migration.dart'; import 'package:selfprivacy/ui/pages/setup/initializing.dart'; import 'package:selfprivacy/ui/pages/onboarding/onboarding.dart'; import 'package:selfprivacy/ui/pages/root_route.dart'; @@ -50,7 +50,7 @@ class MorePage extends StatelessWidget { _MoreMenuItem( title: 'providers.storage.start_migration_button'.tr(), iconData: Icons.drive_file_move_outline, - goTo: DataMigrationPage( + goTo: DataToBindsMigrationPage( diskStatus: context .watch() .state diff --git a/lib/ui/pages/server_storage/data_migration.dart b/lib/ui/pages/server_storage/binds_migration/data_to_binds_migration.dart similarity index 92% rename from lib/ui/pages/server_storage/data_migration.dart rename to lib/ui/pages/server_storage/binds_migration/data_to_binds_migration.dart index cf43bd9c..7c21e102 100644 --- a/lib/ui/pages/server_storage/data_migration.dart +++ b/lib/ui/pages/server_storage/binds_migration/data_to_binds_migration.dart @@ -6,11 +6,11 @@ import 'package:selfprivacy/ui/components/brand_button/filled_button.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; import 'package:selfprivacy/ui/components/info_box/info_box.dart'; import 'package:selfprivacy/logic/models/disk_status.dart'; -import 'package:selfprivacy/ui/pages/server_storage/server_storage_list_item.dart'; -import 'package:selfprivacy/ui/pages/server_storage/service_migration_list_item.dart'; +import 'package:selfprivacy/ui/components/storage_list_items/server_storage_list_item.dart'; +import 'package:selfprivacy/ui/components/storage_list_items/service_migration_list_item.dart'; -class DataMigrationPage extends StatefulWidget { - const DataMigrationPage({ +class DataToBindsMigrationPage extends StatefulWidget { + const DataToBindsMigrationPage({ required this.services, required this.diskStatus, final super.key, @@ -20,10 +20,11 @@ class DataMigrationPage extends StatefulWidget { final List services; @override - State createState() => _DataMigrationPageState(); + State createState() => + _DataToBindsMigrationPageState(); } -class _DataMigrationPageState extends State { +class _DataToBindsMigrationPageState extends State { /// Service id to target migration disk name final Map serviceToDisk = {}; diff --git a/lib/ui/pages/server_storage/migration_process_page.dart b/lib/ui/pages/server_storage/binds_migration/migration_process_page.dart similarity index 98% rename from lib/ui/pages/server_storage/migration_process_page.dart rename to lib/ui/pages/server_storage/binds_migration/migration_process_page.dart index 12dd8fea..b1d20411 100644 --- a/lib/ui/pages/server_storage/migration_process_page.dart +++ b/lib/ui/pages/server_storage/binds_migration/migration_process_page.dart @@ -42,7 +42,7 @@ class _MigrationProcessPageState extends State { value: value, color: Theme.of(context).colorScheme.primary, backgroundColor: Theme.of(context).colorScheme.surfaceVariant, - height: 14.0, + height: 4.0, ), const SizedBox(height: 16), if (job.finishedAt != null) diff --git a/lib/ui/pages/server_storage/server_storage.dart b/lib/ui/pages/server_storage/server_storage.dart index 94a0532e..f29e9694 100644 --- a/lib/ui/pages/server_storage/server_storage.dart +++ b/lib/ui/pages/server_storage/server_storage.dart @@ -5,7 +5,7 @@ import 'package:selfprivacy/ui/components/brand_button/outlined_button.dart'; import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; import 'package:selfprivacy/logic/models/disk_status.dart'; import 'package:selfprivacy/ui/pages/server_storage/extending_volume.dart'; -import 'package:selfprivacy/ui/pages/server_storage/server_storage_list_item.dart'; +import 'package:selfprivacy/ui/components/storage_list_items/server_storage_list_item.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; class ServerStoragePage extends StatefulWidget { diff --git a/lib/ui/pages/server_storage/storage_card.dart b/lib/ui/pages/server_storage/storage_card.dart index 7bad8958..33b742a2 100644 --- a/lib/ui/pages/server_storage/storage_card.dart +++ b/lib/ui/pages/server_storage/storage_card.dart @@ -5,7 +5,7 @@ import 'package:selfprivacy/logic/cubit/providers/providers_cubit.dart'; import 'package:selfprivacy/ui/components/icon_status_mask/icon_status_mask.dart'; import 'package:selfprivacy/logic/models/disk_status.dart'; import 'package:selfprivacy/ui/pages/server_storage/server_storage.dart'; -import 'package:selfprivacy/ui/pages/server_storage/server_storage_list_item.dart'; +import 'package:selfprivacy/ui/components/storage_list_items/server_storage_list_item.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; class StorageCard extends StatelessWidget { From 3d34f0bb55e28569533f316e4b9923c7b19b70bb Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 16 Sep 2022 17:14:29 +0300 Subject: [PATCH 094/115] Fix screens when no server initialized --- lib/ui/pages/dns_details/dns_details.dart | 12 ++---------- lib/ui/pages/services/services.dart | 6 ++++-- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/ui/pages/dns_details/dns_details.dart b/lib/ui/pages/dns_details/dns_details.dart index 91c7d007..5a3d0dfd 100644 --- a/lib/ui/pages/dns_details/dns_details.dart +++ b/lib/ui/pages/dns_details/dns_details.dart @@ -94,16 +94,8 @@ class _DnsDetailsPageState extends State { headerTitle: '', heroIcon: BrandIcons.globe, heroTitle: 'providers.domain.screen_title'.tr(), - children: [ - FilledCard( - child: ListTile( - title: Text( - 'not_ready_card.in_menu'.tr(), - style: Theme.of(context).textTheme.headline6, - ), - ), - ), - ], + heroSubtitle: 'not_ready_card.in_menu'.tr(), + children: const [], ); } diff --git a/lib/ui/pages/services/services.dart b/lib/ui/pages/services/services.dart index a469d06b..d638866a 100644 --- a/lib/ui/pages/services/services.dart +++ b/lib/ui/pages/services/services.dart @@ -115,8 +115,10 @@ class _Card extends StatelessWidget { final domainName = UiHelpers.getDomainName(config); return GestureDetector( - onTap: () => Navigator.of(context) - .push(materialRoute(ServicePage(serviceId: serviceType.name))), + onTap: isReady + ? () => Navigator.of(context) + .push(materialRoute(ServicePage(serviceId: serviceType.name))) + : null, child: BrandCards.big( child: Column( crossAxisAlignment: CrossAxisAlignment.start, From 5ca4ee27e3c3228fcdcd6df53c794fef9f55c416 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Sun, 18 Sep 2022 16:24:17 +0300 Subject: [PATCH 095/115] Introduce ListTileOnSurfaceVariant and refactor TextDetails on server details screen. --- assets/translations/en.json | 13 ++ assets/translations/ru.json | 16 ++ .../list_tile_on_surface_variant.dart | 44 +++++ .../server_details/server_details_screen.dart | 2 + lib/ui/pages/server_details/text_details.dart | 154 ++++++------------ lib/ui/pages/users/user_details.dart | 37 ++--- lib/ui/pages/users/users.dart | 1 + lib/utils/extensions/string_extensions.dart | 4 + 8 files changed, 139 insertions(+), 132 deletions(-) create mode 100644 lib/ui/components/list_tiles/list_tile_on_surface_variant.dart create mode 100644 lib/utils/extensions/string_extensions.dart diff --git a/assets/translations/en.json b/assets/translations/en.json index f3ec3523..485d4076 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -114,6 +114,19 @@ "reboot_after_upgrade_hint": "Reboot without prompt after applying changes on server", "server_timezone": "Server timezone", "select_timezone": "Select timezone" + }, + "info": { + "server_id": "Server ID", + "status": "Status", + "cpu": "CPU", + "ram": "Memory", + "disk": "Disk local", + "monthly_cost": "Monthly cost", + "location": "Location", + "core_count": { + "one": "{} core", + "other": "{} cores" + } } }, "domain": { diff --git a/assets/translations/ru.json b/assets/translations/ru.json index 5072c88b..a6b4bc59 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -113,6 +113,22 @@ "reboot_after_upgrade_hint": "Автоматически перезагружать сервер после применения обновлений", "server_timezone": "Часовой пояс сервера", "select_timezone": "Выберите часовой пояс" + }, + "info": { + "server_id": "ID сервера", + "status": "Статус", + "cpu": "Процессор", + "ram": "Операивная память", + "disk": "Диск", + "monthly_cost": "Ежемесячная стоимость", + "location": "Размещение", + "core_count": { + "one": "{} ядро", + "two": "{} ядра", + "few": "{} ядра", + "many": "{} ядер", + "other": "{} ядер" + } } }, "domain": { diff --git a/lib/ui/components/list_tiles/list_tile_on_surface_variant.dart b/lib/ui/components/list_tiles/list_tile_on_surface_variant.dart new file mode 100644 index 00000000..c31315bd --- /dev/null +++ b/lib/ui/components/list_tiles/list_tile_on_surface_variant.dart @@ -0,0 +1,44 @@ +import 'package:flutter/material.dart'; + +class ListTileOnSurfaceVariant extends StatelessWidget { + const ListTileOnSurfaceVariant({ + required this.title, + this.subtitle, + this.leadingIcon, + this.onTap, + this.disableSubtitleOverflow = false, + final super.key, + }); + + final String title; + final String? subtitle; + final IconData? leadingIcon; + final Function()? onTap; + final bool disableSubtitleOverflow; + + Widget? getSubtitle() { + if (subtitle == null) { + return null; + } + if (disableSubtitleOverflow) { + return Text( + subtitle!, + maxLines: 1, + overflow: TextOverflow.ellipsis, + ); + } + return Text( + subtitle!, + ); + } + + @override + Widget build(final BuildContext context) => ListTile( + title: Text(title), + subtitle: getSubtitle(), + onTap: onTap, + textColor: Theme.of(context).colorScheme.onSurfaceVariant, + leading: leadingIcon != null ? Icon(leadingIcon) : null, + iconColor: Theme.of(context).colorScheme.onSurfaceVariant, + ); +} diff --git a/lib/ui/pages/server_details/server_details_screen.dart b/lib/ui/pages/server_details/server_details_screen.dart index 9d25e8ba..4d5d5ebd 100644 --- a/lib/ui/pages/server_details/server_details_screen.dart +++ b/lib/ui/pages/server_details/server_details_screen.dart @@ -15,10 +15,12 @@ import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.da import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart'; import 'package:selfprivacy/ui/components/brand_loader/brand_loader.dart'; import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; +import 'package:selfprivacy/ui/components/list_tiles/list_tile_on_surface_variant.dart'; import 'package:selfprivacy/ui/components/switch_block/switch_bloc.dart'; import 'package:selfprivacy/ui/pages/server_storage/storage_card.dart'; import 'package:selfprivacy/ui/pages/server_details/time_zone/lang.dart'; import 'package:selfprivacy/utils/extensions/duration.dart'; +import 'package:selfprivacy/utils/extensions/string_extensions.dart'; import 'package:selfprivacy/utils/named_font_weight.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; import 'package:timezone/timezone.dart'; diff --git a/lib/ui/pages/server_details/text_details.dart b/lib/ui/pages/server_details/text_details.dart index 2285d305..f512e917 100644 --- a/lib/ui/pages/server_details/text_details.dart +++ b/lib/ui/pages/server_details/text_details.dart @@ -11,115 +11,53 @@ class _TextDetails extends StatelessWidget { return _TempMessage(message: 'basis.no_data'.tr()); } else if (details is Loaded) { final data = details.serverInfo; - final checkTime = details.checkTime; - return Column( - children: [ - Center(child: BrandText.h3('providers.server.bottom_sheet.2'.tr())), - const SizedBox(height: 10), - Table( - columnWidths: const { - 0: FractionColumnWidth(.5), - 1: FractionColumnWidth(.5), - }, - defaultVerticalAlignment: TableCellVerticalAlignment.middle, - children: [ - TableRow( - children: [ - getRowTitle('Last check:'), - getRowValue(formatter.format(checkTime)), - ], + return FilledCard( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(16.0), + child: Text( + 'providers.server.bottom_sheet.2'.tr(), + style: Theme.of(context).textTheme.titleMedium?.copyWith( + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), - TableRow( - children: [ - getRowTitle('Server Id:'), - getRowValue(data.id.toString()), - ], - ), - TableRow( - children: [ - getRowTitle('Status:'), - getRowValue( - data.status.toString().split('.')[1].toUpperCase(), - isBold: true, - ), - ], - ), - TableRow( - children: [ - getRowTitle('CPU:'), - getRowValue( - data.serverType.cores.toString(), - ), - ], - ), - TableRow( - children: [ - getRowTitle('Memory:'), - getRowValue( - '${data.serverType.memory.toString()} GB', - ), - ], - ), - TableRow( - children: [ - getRowTitle('Disk Local:'), - getRowValue( - '${data.serverType.disk.toString()} GB', - ), - ], - ), - TableRow( - children: [ - getRowTitle('Price monthly:'), - getRowValue( - data.serverType.prices[1].monthly.toString(), - ), - ], - ), - TableRow( - children: [ - getRowTitle('Price hourly:'), - getRowValue( - data.serverType.prices[1].hourly.toString(), - ), - ], - ), - ], - ), - const SizedBox(height: 30), - Center(child: BrandText.h3('providers.server.bottom_sheet.3'.tr())), - const SizedBox(height: 10), - Table( - columnWidths: const { - 0: FractionColumnWidth(.5), - 1: FractionColumnWidth(.5), - }, - defaultVerticalAlignment: TableCellVerticalAlignment.middle, - children: [ - TableRow( - children: [ - getRowTitle('Country:'), - getRowValue( - data.location.country, - ), - ], - ), - TableRow( - children: [ - getRowTitle('City:'), - getRowValue(data.location.city), - ], - ), - TableRow( - children: [ - getRowTitle('Description:'), - getRowValue(data.location.description), - ], - ), - ], - ), - const SizedBox(height: 20), - ], + ), + ListTileOnSurfaceVariant( + leadingIcon: Icons.numbers_outlined, + title: data.id.toString(), + subtitle: 'providers.server.info.server_id'.tr(), + ), + ListTileOnSurfaceVariant( + leadingIcon: Icons.mode_standby_outlined, + title: data.status.toString().split('.')[1].capitalize(), + subtitle: 'providers.server.info.status'.tr(), + ), + ListTileOnSurfaceVariant( + leadingIcon: Icons.memory_outlined, + title: 'providers.server.info.core_count' + .plural(data.serverType.cores), + subtitle: 'providers.server.info.cpu'.tr(), + ), + ListTileOnSurfaceVariant( + leadingIcon: Icons.memory_outlined, + title: '${data.serverType.memory.toString()} GB', + subtitle: 'providers.server.info.ram'.tr(), + ), + ListTileOnSurfaceVariant( + leadingIcon: Icons.euro_outlined, + title: data.serverType.prices[1].monthly.toStringAsFixed(2), + subtitle: 'providers.server.info.monthly_cost'.tr(), + ), + // Server location + ListTileOnSurfaceVariant( + leadingIcon: Icons.location_on_outlined, + title: '${data.location.city}, ${data.location.country}', + subtitle: 'providers.server.info.location'.tr(), + ), + ], + ), ); } else { throw Exception('wrong state'); diff --git a/lib/ui/pages/users/user_details.dart b/lib/ui/pages/users/user_details.dart index 2ec6baee..24f2457f 100644 --- a/lib/ui/pages/users/user_details.dart +++ b/lib/ui/pages/users/user_details.dart @@ -133,12 +133,10 @@ class _UserLogins extends StatelessWidget { Widget build(final BuildContext context) => FilledCard( child: Column( children: [ - ListTile( - title: Text('${user.login}@$domainName'), - subtitle: Text('users.email_login'.tr()), - textColor: Theme.of(context).colorScheme.onSurfaceVariant, - leading: const Icon(Icons.alternate_email_outlined), - iconColor: Theme.of(context).colorScheme.onSurfaceVariant, + ListTileOnSurfaceVariant( + title: '${user.login}@$domainName', + subtitle: 'users.email_login'.tr(), + leadingIcon: Icons.alternate_email_outlined, ), ], ), @@ -156,18 +154,13 @@ class _SshKeysCard extends StatelessWidget { Widget build(final BuildContext context) => FilledCard( child: Column( children: [ - ListTile( - title: Text('ssh.title'.tr()), - textColor: Theme.of(context).colorScheme.onSurfaceVariant, + ListTileOnSurfaceVariant( + title: 'ssh.title'.tr(), ), const Divider(height: 0), - ListTile( - iconColor: Theme.of(context).colorScheme.onSurfaceVariant, - textColor: Theme.of(context).colorScheme.onSurfaceVariant, - title: Text( - 'ssh.create'.tr(), - ), - leading: const Icon(Icons.add_circle_outlined), + ListTileOnSurfaceVariant( + title: 'ssh.create'.tr(), + leadingIcon: Icons.add_circle_outline, onTap: () { showModalBottomSheet( context: context, @@ -188,15 +181,11 @@ class _SshKeysCard extends StatelessWidget { final keyName = key.split(' ').length > 2 ? key.split(' ')[2] : 'ssh.no_key_name'.tr(); - return ListTile( - textColor: Theme.of(context).colorScheme.onSurfaceVariant, - title: Text('$keyName ($keyType)'), + return ListTileOnSurfaceVariant( + title: '$keyName ($keyType)', + disableSubtitleOverflow: true, // do not overflow text - subtitle: Text( - publicKey, - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), + subtitle: publicKey, onTap: () { showDialog( context: context, diff --git a/lib/ui/pages/users/users.dart b/lib/ui/pages/users/users.dart index 6b8709fd..7e255935 100644 --- a/lib/ui/pages/users/users.dart +++ b/lib/ui/pages/users/users.dart @@ -20,6 +20,7 @@ import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.da import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart'; import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; import 'package:selfprivacy/ui/components/info_box/info_box.dart'; +import 'package:selfprivacy/ui/components/list_tiles/list_tile_on_surface_variant.dart'; import 'package:selfprivacy/ui/components/not_ready_card/not_ready_card.dart'; import 'package:selfprivacy/utils/ui_helpers.dart'; diff --git a/lib/utils/extensions/string_extensions.dart b/lib/utils/extensions/string_extensions.dart new file mode 100644 index 00000000..91cb543b --- /dev/null +++ b/lib/utils/extensions/string_extensions.dart @@ -0,0 +1,4 @@ +extension StringExtension on String { + String capitalize() => + '${this[0].toUpperCase()}${substring(1).toLowerCase()}'; +} From 39358a827fc1cc6813b5713e64f9dabbbed39b66 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Sun, 18 Sep 2022 17:05:41 +0300 Subject: [PATCH 096/115] Implement migrate to binds logic --- .../graphql_maps/server_api/volume_api.dart | 14 ++++- .../cubit/server_jobs/server_jobs_cubit.dart | 31 ++++++++--- .../cubit/server_jobs/server_jobs_state.dart | 10 +++- .../data_to_binds_migration.dart | 8 ++- .../migration_process_page.dart | 52 ++++++++++++------- 5 files changed, 85 insertions(+), 30 deletions(-) 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 06d6e5bc..e0c68cc4 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,7 +57,10 @@ mixin VolumeApi on ApiMap { } } - Future migrateToBinds(final Map serviceToDisk) async { + Future migrateToBinds( + final Map serviceToDisk, + ) async { + String? jobUid; try { final GraphQLClient client = await getClient(); final input = Input$MigrateToBindsInput( @@ -70,9 +73,16 @@ mixin VolumeApi on ApiMap { final variables = Variables$Mutation$MigrateToBinds(input: input); final migrateMutation = Options$Mutation$MigrateToBinds(variables: variables); - await client.mutate$MigrateToBinds(migrateMutation); + final QueryResult result = + await client.mutate$MigrateToBinds( + migrateMutation, + ); + + jobUid = result.parsedData!.migrateToBinds.job!.uid; } catch (e) { print(e); } + + return jobUid; } } diff --git a/lib/logic/cubit/server_jobs/server_jobs_cubit.dart b/lib/logic/cubit/server_jobs/server_jobs_cubit.dart index 254e6380..74ce932d 100644 --- a/lib/logic/cubit/server_jobs/server_jobs_cubit.dart +++ b/lib/logic/cubit/server_jobs/server_jobs_cubit.dart @@ -13,9 +13,7 @@ class ServerJobsCubit ServerJobsCubit(final ServerInstallationCubit serverInstallationCubit) : super( serverInstallationCubit, - const ServerJobsState( - serverJobList: [], - ), + const ServerJobsState(), ); Timer? timer; @@ -24,9 +22,7 @@ class ServerJobsCubit @override void clear() async { emit( - const ServerJobsState( - serverJobList: [], - ), + const ServerJobsState(), ); if (timer != null && timer!.isActive) { timer!.cancel(); @@ -47,6 +43,29 @@ class ServerJobsCubit } } + Future migrateToBinds(final Map serviceToDisk) async { + final String? jobUid = await api.migrateToBinds(serviceToDisk); + emit( + ServerJobsState( + migrationJobUid: jobUid, + ), + ); + } + + ServerJob? getServerJobByUid(final String uid) { + ServerJob? job; + + try { + job = state.serverJobList.firstWhere( + (final ServerJob job) => job.uid == uid, + ); + } catch (e) { + print(e); + } + + return job; + } + Future reload({final bool useTimer = false}) async { final List jobs = await api.getServerJobs(); emit( diff --git a/lib/logic/cubit/server_jobs/server_jobs_state.dart b/lib/logic/cubit/server_jobs/server_jobs_state.dart index 82ac4377..bf7d0adb 100644 --- a/lib/logic/cubit/server_jobs/server_jobs_state.dart +++ b/lib/logic/cubit/server_jobs/server_jobs_state.dart @@ -1,16 +1,22 @@ part of 'server_jobs_cubit.dart'; class ServerJobsState extends ServerInstallationDependendState { - const ServerJobsState({this.serverJobList = const []}); + const ServerJobsState({ + this.serverJobList = const [], + this.migrationJobUid, + }); final List serverJobList; + final String? migrationJobUid; @override - List get props => serverJobList; + List get props => [migrationJobUid, ...serverJobList]; ServerJobsState copyWith({ final List? serverJobList, + final String? migrationJobUid, }) => ServerJobsState( serverJobList: serverJobList ?? this.serverJobList, + migrationJobUid: migrationJobUid ?? this.migrationJobUid, ); } diff --git a/lib/ui/pages/server_storage/binds_migration/data_to_binds_migration.dart b/lib/ui/pages/server_storage/binds_migration/data_to_binds_migration.dart index 7c21e102..a88b70cb 100644 --- a/lib/ui/pages/server_storage/binds_migration/data_to_binds_migration.dart +++ b/lib/ui/pages/server_storage/binds_migration/data_to_binds_migration.dart @@ -1,5 +1,6 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; +import 'package:selfprivacy/logic/cubit/server_jobs/server_jobs_cubit.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/logic/models/service.dart'; import 'package:selfprivacy/ui/components/brand_button/filled_button.dart'; @@ -8,6 +9,8 @@ import 'package:selfprivacy/ui/components/info_box/info_box.dart'; import 'package:selfprivacy/logic/models/disk_status.dart'; import 'package:selfprivacy/ui/components/storage_list_items/server_storage_list_item.dart'; import 'package:selfprivacy/ui/components/storage_list_items/service_migration_list_item.dart'; +import 'package:selfprivacy/ui/pages/server_storage/binds_migration/migration_process_page.dart'; +import 'package:selfprivacy/utils/route_transitions/basic.dart'; class DataToBindsMigrationPage extends StatefulWidget { const DataToBindsMigrationPage({ @@ -158,7 +161,10 @@ class _DataToBindsMigrationPageState extends State { FilledButton( title: 'providers.storage.start_migration_button'.tr(), onPressed: () { - // TODO: Implement migration + context.read().migrateToBinds(serviceToDisk); + Navigator.of(context).push( + materialRoute(const MigrationProcessPage()), + ); }, ), const SizedBox(height: 32), diff --git a/lib/ui/pages/server_storage/binds_migration/migration_process_page.dart b/lib/ui/pages/server_storage/binds_migration/migration_process_page.dart index b1d20411..a63748c6 100644 --- a/lib/ui/pages/server_storage/binds_migration/migration_process_page.dart +++ b/lib/ui/pages/server_storage/binds_migration/migration_process_page.dart @@ -10,12 +10,9 @@ import 'package:selfprivacy/utils/route_transitions/basic.dart'; class MigrationProcessPage extends StatefulWidget { const MigrationProcessPage({ - required this.jobUid, final super.key, }); - final String jobUid; - @override State createState() => _MigrationProcessPageState(); } @@ -28,22 +25,25 @@ class _MigrationProcessPageState extends State { @override Widget build(final BuildContext context) { + ServerJob? job; + String? subtitle = ''; + double value = 0.0; + List children = []; + final serverJobsState = context.watch().state; - final ServerJob job = serverJobsState.serverJobList.firstWhere( - (final ServerJob job) => job.uid == widget.jobUid, - ); - final double value = job.progress == null ? 0.0 : job.progress! / 100; - return BrandHeroScreen( - hasBackButton: false, - heroTitle: 'providers.storage.migration_process'.tr(), - heroSubtitle: job.statusText, - children: [ - BrandLinearIndicator( - value: value, - color: Theme.of(context).colorScheme.primary, - backgroundColor: Theme.of(context).colorScheme.surfaceVariant, - height: 4.0, - ), + if (serverJobsState.migrationJobUid != null) { + job = context.read().getServerJobByUid( + serverJobsState.migrationJobUid!, + ); + } + + if (job == null) { + subtitle = 'basis.loading'.tr(); + } else { + value = job.progress == null ? 0.0 : job.progress! / 100; + subtitle = job.statusText; + children = [ + ...children, const SizedBox(height: 16), if (job.finishedAt != null) Text( @@ -60,7 +60,21 @@ class _MigrationProcessPageState extends State { (final predicate) => false, ); }, - ) + ), + ]; + } + return BrandHeroScreen( + hasBackButton: false, + heroTitle: 'providers.storage.migration_process'.tr(), + heroSubtitle: subtitle, + children: [ + BrandLinearIndicator( + value: value, + color: Theme.of(context).colorScheme.primary, + backgroundColor: Theme.of(context).colorScheme.surfaceVariant, + height: 4.0, + ), + ...children, ], ); } From cb660eb2bb1e08c8864c36a33a19711d3322735e Mon Sep 17 00:00:00 2001 From: Inex Code Date: Sun, 18 Sep 2022 17:17:13 +0300 Subject: [PATCH 097/115] Refactor server_settings.dart to use vanilla ListTiles --- .../server_details/server_details_screen.dart | 6 +- .../pages/server_details/server_settings.dart | 90 +++++-------------- 2 files changed, 25 insertions(+), 71 deletions(-) diff --git a/lib/ui/pages/server_details/server_details_screen.dart b/lib/ui/pages/server_details/server_details_screen.dart index 4d5d5ebd..367d8de8 100644 --- a/lib/ui/pages/server_details/server_details_screen.dart +++ b/lib/ui/pages/server_details/server_details_screen.dart @@ -16,7 +16,6 @@ import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart'; import 'package:selfprivacy/ui/components/brand_loader/brand_loader.dart'; import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; import 'package:selfprivacy/ui/components/list_tiles/list_tile_on_surface_variant.dart'; -import 'package:selfprivacy/ui/components/switch_block/switch_bloc.dart'; import 'package:selfprivacy/ui/pages/server_storage/storage_card.dart'; import 'package:selfprivacy/ui/pages/server_details/time_zone/lang.dart'; import 'package:selfprivacy/utils/extensions/duration.dart'; @@ -85,6 +84,8 @@ class _ServerDetailsScreenState extends State StorageCard( diskStatus: context.watch().state.diskStatus, ), + const SizedBox(height: 16), + const _ServerSettings(), const Divider(height: 32), Text( 'providers.server.resource_usage'.tr(), @@ -95,9 +96,8 @@ class _ServerDetailsScreenState extends State create: (final context) => HetznerMetricsCubit()..restart(), child: _Chart(), ), - const Divider(height: 32), + const SizedBox(height: 8), _TextDetails(), - const _ServerSettings(), ], ), ); diff --git a/lib/ui/pages/server_details/server_settings.dart b/lib/ui/pages/server_details/server_settings.dart index 62269496..9a35e74a 100644 --- a/lib/ui/pages/server_details/server_settings.dart +++ b/lib/ui/pages/server_details/server_settings.dart @@ -26,8 +26,9 @@ class _ServerSettingsState extends State<_ServerSettings> { return Column( children: [ - SwitcherBlock( - onChange: (final switched) { + SwitchListTile( + value: allowAutoUpgrade ?? false, + onChanged: (final switched) { context .read() .repository @@ -41,15 +42,15 @@ class _ServerSettingsState extends State<_ServerSettings> { allowAutoUpgrade = switched; }); }, - isActive: allowAutoUpgrade ?? false, - child: _TextColumn( - title: 'providers.server.settings.allow_autoupgrade'.tr(), - value: 'providers.server.settings.allow_autoupgrade_hint'.tr(), + title: Text('providers.server.settings.allow_autoupgrade'.tr()), + subtitle: Text( + 'providers.server.settings.allow_autoupgrade_hint'.tr(), ), + activeColor: Theme.of(context).colorScheme.primary, ), - const Divider(height: 0), - SwitcherBlock( - onChange: (final switched) { + SwitchListTile( + value: rebootAfterUpgrade ?? false, + onChanged: (final switched) { context .read() .repository @@ -59,20 +60,21 @@ class _ServerSettingsState extends State<_ServerSettings> { allowReboot: switched, ), ); - setState( - () { - rebootAfterUpgrade = switched; - }, - ); + setState(() { + rebootAfterUpgrade = switched; + }); }, - isActive: rebootAfterUpgrade ?? false, - child: _TextColumn( - title: 'providers.server.settings.reboot_after_upgrade'.tr(), - value: 'providers.server.settings.reboot_after_upgrade_hint'.tr(), + title: Text('providers.server.settings.reboot_after_upgrade'.tr()), + subtitle: Text( + 'providers.server.settings.reboot_after_upgrade_hint'.tr(), ), + activeColor: Theme.of(context).colorScheme.primary, ), - const Divider(height: 0), - _Button( + ListTile( + title: Text('providers.server.settings.server_timezone'.tr()), + subtitle: Text( + serverDetailsState.serverTimezone.toString(), + ), onTap: () { Navigator.of(context).push( materialRoute( @@ -80,56 +82,8 @@ class _ServerSettingsState extends State<_ServerSettings> { ), ); }, - child: _TextColumn( - title: 'providers.server.settings.server_timezone'.tr(), - value: serverDetailsState.serverTimezone.toString(), - ), ), ], ); } } - -class _Button extends StatelessWidget { - const _Button({ - required this.onTap, - required this.child, - }); - - final Widget child; - final VoidCallback onTap; - - @override - Widget build(final BuildContext context) => InkWell( - onTap: onTap, - child: Container( - padding: const EdgeInsets.symmetric(vertical: 16), - child: child, - ), - ); -} - -class _TextColumn extends StatelessWidget { - const _TextColumn({ - required this.title, - required this.value, - }); - - final String title; - final String value; - @override - Widget build(final BuildContext context) => Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - BrandText.body1( - title, - style: Theme.of(context).textTheme.bodyLarge, - ), - const SizedBox(height: 5), - BrandText.body1( - value, - style: Theme.of(context).textTheme.bodyMedium, - ), - ], - ); -} From 159f86196507d3ee59294e5fbe747c1c1bcf545e Mon Sep 17 00:00:00 2001 From: NaiJi Date: Sun, 18 Sep 2022 17:29:00 +0300 Subject: [PATCH 098/115] Implement initialization migration to binds error handling --- .../graphql_maps/server_api/volume_api.dart | 31 ++++++++++++++++--- .../cubit/server_jobs/server_jobs_cubit.dart | 10 ++++-- 2 files changed, 34 insertions(+), 7 deletions(-) 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 e0c68cc4..4865a565 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,5 +1,15 @@ part of 'server.dart'; +class MigrateToBindsMutationReturn extends GenericMutationResult { + MigrateToBindsMutationReturn({ + required final super.success, + required final super.code, + final super.message, + this.jobUid, + }); + final String? jobUid; +} + mixin VolumeApi on ApiMap { Future> getServerDiskVolumes() async { QueryResult response; @@ -57,10 +67,11 @@ mixin VolumeApi on ApiMap { } } - Future migrateToBinds( + Future migrateToBinds( final Map serviceToDisk, ) async { - String? jobUid; + MigrateToBindsMutationReturn? mutation; + try { final GraphQLClient client = await getClient(); final input = Input$MigrateToBindsInput( @@ -77,12 +88,22 @@ mixin VolumeApi on ApiMap { await client.mutate$MigrateToBinds( migrateMutation, ); - - jobUid = result.parsedData!.migrateToBinds.job!.uid; + mutation = mutation = MigrateToBindsMutationReturn( + success: result.parsedData!.migrateToBinds.success, + code: result.parsedData!.migrateToBinds.code, + message: result.parsedData!.migrateToBinds.message, + jobUid: result.parsedData!.migrateToBinds.job?.uid, + ); } catch (e) { print(e); + mutation = MigrateToBindsMutationReturn( + success: false, + code: 0, + message: e.toString(), + jobUid: null, + ); } - return jobUid; + return mutation; } } diff --git a/lib/logic/cubit/server_jobs/server_jobs_cubit.dart b/lib/logic/cubit/server_jobs/server_jobs_cubit.dart index 74ce932d..46f04e5b 100644 --- a/lib/logic/cubit/server_jobs/server_jobs_cubit.dart +++ b/lib/logic/cubit/server_jobs/server_jobs_cubit.dart @@ -1,5 +1,6 @@ import 'dart:async'; +import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; import 'package:selfprivacy/logic/models/json/server_job.dart'; @@ -44,10 +45,15 @@ class ServerJobsCubit } Future migrateToBinds(final Map serviceToDisk) async { - final String? jobUid = await api.migrateToBinds(serviceToDisk); + final result = await api.migrateToBinds(serviceToDisk); + if (!result.success || result.jobUid == null) { + getIt().showSnackBar(result.message!); + return; + } + emit( ServerJobsState( - migrationJobUid: jobUid, + migrationJobUid: result.jobUid, ), ); } From 8017c5ab4c8ab85ab19be8b55e5ff9bc37f8f2f4 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Sun, 18 Sep 2022 19:06:17 +0300 Subject: [PATCH 099/115] Show services in Server Storage screen --- .../server_storage_list_item.dart | 106 +++++++++++++----- .../service_migration_list_item.dart | 62 +++++----- .../pages/server_storage/server_storage.dart | 57 ++++++++++ 3 files changed, 171 insertions(+), 54 deletions(-) diff --git a/lib/ui/components/storage_list_items/server_storage_list_item.dart b/lib/ui/components/storage_list_items/server_storage_list_item.dart index 371769a8..1cc07572 100644 --- a/lib/ui/components/storage_list_items/server_storage_list_item.dart +++ b/lib/ui/components/storage_list_items/server_storage_list_item.dart @@ -15,6 +15,55 @@ class ServerStorageListItem extends StatelessWidget { final bool showIcon; final bool dense; + @override + Widget build(final BuildContext context) => ConsumptionListItem( + title: 'providers.storage.disk_usage'.tr( + args: [ + volume.sizeUsed.toString(), + ], + ), + subtitle: 'providers.storage.disk_total'.tr( + args: [ + volume.sizeTotal.toString(), + volume.displayName, + ], + ), + dense: dense, + color: volume.root + ? Theme.of(context).colorScheme.primary + : Theme.of(context).colorScheme.secondary, + backgroundColor: Theme.of(context).colorScheme.surfaceVariant, + percentage: volume.percentage, + icon: Icon( + Icons.storage_outlined, + size: 24, + color: Theme.of(context).colorScheme.onBackground, + ), + ); +} + +class ConsumptionListItem extends StatelessWidget { + const ConsumptionListItem({ + required this.title, + required this.color, + required this.backgroundColor, + required this.percentage, + this.subtitle, + this.rightSideText, + this.icon, + this.dense = false, + final super.key, + }); + + final String title; + final String? subtitle; + final String? rightSideText; + final Color color; + final Color backgroundColor; + final double percentage; + final Widget? icon; + final bool dense; + @override Widget build(final BuildContext context) { final TextStyle? titleStyle = dense @@ -26,45 +75,46 @@ class ServerStorageListItem extends StatelessWidget { : Theme.of(context).textTheme.bodyMedium; return Row( + crossAxisAlignment: CrossAxisAlignment.center, children: [ - if (showIcon) - Icon( - Icons.storage_outlined, - size: 24, - color: Theme.of(context).colorScheme.onBackground, - ), - if (showIcon) const SizedBox(width: 16), + if (icon != null) icon!, + if (icon != null) const SizedBox(width: 16), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - 'providers.storage.disk_usage'.tr( - args: [ - volume.sizeUsed.toString(), - ], - ), - style: titleStyle, + Row( + mainAxisAlignment: rightSideText != null + ? MainAxisAlignment.spaceBetween + : MainAxisAlignment.start, + children: [ + Text( + title, + style: titleStyle, + textAlign: TextAlign.start, + ), + if (rightSideText != null) + Text( + rightSideText!, + style: Theme.of(context).textTheme.bodyMedium, + textAlign: TextAlign.end, + ), + ], ), const SizedBox(height: 4), BrandLinearIndicator( - value: volume.percentage, - color: volume.root - ? Theme.of(context).colorScheme.primary - : Theme.of(context).colorScheme.secondary, - backgroundColor: Theme.of(context).colorScheme.surfaceVariant, - height: 14.0, + value: percentage, + color: color, + backgroundColor: backgroundColor, + height: dense ? 8.0 : 14.0, ), const SizedBox(height: 4), - Text( - 'providers.storage.disk_total'.tr( - args: [ - volume.sizeTotal.toString(), - volume.displayName, - ], + if (subtitle != null) + Text( + subtitle!, + style: subtitleStyle, + textAlign: TextAlign.start, ), - style: subtitleStyle, - ), ], ), ), diff --git a/lib/ui/components/storage_list_items/service_migration_list_item.dart b/lib/ui/components/storage_list_items/service_migration_list_item.dart index f6b59663..847d2cf6 100644 --- a/lib/ui/components/storage_list_items/service_migration_list_item.dart +++ b/lib/ui/components/storage_list_items/service_migration_list_item.dart @@ -20,13 +20,47 @@ class ServiceMigrationListItem extends StatelessWidget { @override Widget build(final BuildContext context) => Column( children: [ - _headerRow(context), + ServiceConsumptionTitle(service: service), const SizedBox(height: 16), ..._radioRows(context), ], ); - Widget _headerRow(final BuildContext context) => SizedBox( + List _radioRows(final BuildContext context) { + final List volumeRows = []; + + for (final DiskVolume volume in diskStatus.diskVolumes) { + volumeRows.add( + RadioListTile( + title: Text( + volume.displayName, + ), + contentPadding: EdgeInsets.zero, + activeColor: Theme.of(context).colorScheme.secondary, + dense: true, + value: volume.name, + groupValue: selectedVolume, + onChanged: (final value) { + onChange(value, service.id); + }, + ), + ); + } + + return volumeRows; + } +} + +class ServiceConsumptionTitle extends StatelessWidget { + const ServiceConsumptionTitle({ + required this.service, + final super.key, + }); + + final Service service; + + @override + Widget build(final BuildContext context) => SizedBox( height: 24, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 8), @@ -63,28 +97,4 @@ class ServiceMigrationListItem extends StatelessWidget { ), ), ); - - List _radioRows(final BuildContext context) { - final List volumeRows = []; - - for (final DiskVolume volume in diskStatus.diskVolumes) { - volumeRows.add( - RadioListTile( - title: Text( - volume.displayName, - ), - contentPadding: EdgeInsets.zero, - activeColor: Theme.of(context).colorScheme.secondary, - dense: true, - value: volume.name, - groupValue: selectedVolume, - onChanged: (final value) { - onChange(value, service.id); - }, - ), - ); - } - - return volumeRows; - } } diff --git a/lib/ui/pages/server_storage/server_storage.dart b/lib/ui/pages/server_storage/server_storage.dart index f29e9694..9a83789a 100644 --- a/lib/ui/pages/server_storage/server_storage.dart +++ b/lib/ui/pages/server_storage/server_storage.dart @@ -1,6 +1,9 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; +import 'package:selfprivacy/logic/cubit/services/services_cubit.dart'; +import 'package:selfprivacy/logic/models/service.dart'; import 'package:selfprivacy/ui/components/brand_button/outlined_button.dart'; import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; import 'package:selfprivacy/logic/models/disk_status.dart'; @@ -23,6 +26,9 @@ class _ServerStoragePageState extends State { final bool isReady = context.watch().state is ServerInstallationFinished; + final List services = + context.watch().state.services; + if (!isReady) { return BrandHeroScreen( hasBackButton: true, @@ -39,10 +45,17 @@ class _ServerStoragePageState extends State { ...widget.diskStatus.diskVolumes .map( (final volume) => Column( + mainAxisSize: MainAxisSize.min, children: [ ServerStorageSection( volume: volume, diskStatus: widget.diskStatus, + services: services + .where( + (final service) => + service.storageUsage.volume == volume.name, + ) + .toList(), ), const SizedBox(height: 16), const Divider(), @@ -61,18 +74,30 @@ class ServerStorageSection extends StatelessWidget { const ServerStorageSection({ required this.volume, required this.diskStatus, + required this.services, final super.key, }); final DiskVolume volume; final DiskStatus diskStatus; + final List services; @override Widget build(final BuildContext context) => Column( + mainAxisSize: MainAxisSize.min, children: [ ServerStorageListItem( volume: volume, ), + const SizedBox(height: 16), + ...services + .map( + (final service) => ServerConsumptionListTile( + service: service, + volume: volume, + ), + ) + .toList(), if (volume.isResizable) ...[ const SizedBox(height: 16), BrandOutlinedButton( @@ -90,3 +115,35 @@ class ServerStorageSection extends StatelessWidget { ], ); } + +class ServerConsumptionListTile extends StatelessWidget { + const ServerConsumptionListTile({ + required this.service, + required this.volume, + final super.key, + }); + + final Service service; + final DiskVolume volume; + + @override + Widget build(final BuildContext context) => Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: ConsumptionListItem( + title: service.displayName, + icon: SvgPicture.string( + service.svgIcon, + width: 24.0, + height: 24.0, + color: Theme.of(context).colorScheme.onBackground, + ), + rightSideText: service.storageUsage.used.toString(), + percentage: service.storageUsage.used.byte / volume.sizeTotal.byte, + color: volume.root + ? Theme.of(context).colorScheme.primary + : Theme.of(context).colorScheme.secondary, + backgroundColor: Theme.of(context).colorScheme.surfaceVariant, + dense: true, + ), + ); +} From d9b82b1250357deb792ccba32aec6f7a6c88ab62 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Sun, 18 Sep 2022 19:26:55 +0300 Subject: [PATCH 100/115] Implement volume extending button --- assets/translations/en.json | 1 + assets/translations/ru.json | 1 + .../cubit/provider_volumes/provider_volume_cubit.dart | 4 ++++ lib/ui/pages/server_storage/extending_volume.dart | 9 ++++++++- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index 485d4076..8abf8d39 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -203,6 +203,7 @@ "extending_volume_title": "Extending volume", "extending_volume_description": "Resizing volume will allow you to store more data on your server without extending the server itself. Volume can only be extended: shrinking is not possible.", "extending_volume_price_info": "Price includes VAT and is estimated from pricing data provided by Hetzner.", + "extending_volume_error": "Couldn't initialize volume extending.", "size": "Size", "euro": "Euro", "data_migration_title": "Data migration", diff --git a/assets/translations/ru.json b/assets/translations/ru.json index a6b4bc59..a8d3f0d5 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -205,6 +205,7 @@ "extending_volume_title": "Расширение хранилища", "extending_volume_description": "Изменение размера хранилища позволит вам держать больше данных на вашем сервере без расширения самого сервера. Объем можно только увеличить: уменьшить нельзя.", "extending_volume_price_info": "Цена включает НДС и рассчитана на основе данных о ценах, предоставленных Hetzner.", + "extending_volume_error": "Не удалось начать расширение хранилища.", "size": "Размер", "euro": "Евро", "data_migration_title": "Миграция данных", diff --git a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart index d64a32c8..88f798ca 100644 --- a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart +++ b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart @@ -1,3 +1,4 @@ +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.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_creator.dart'; @@ -77,6 +78,9 @@ class ApiProviderVolumeCubit ); if (!resized) { + getIt().showSnackBar( + 'providers.storage.extending_volume_error'.tr(), + ); return false; } diff --git a/lib/ui/pages/server_storage/extending_volume.dart b/lib/ui/pages/server_storage/extending_volume.dart index c0c48b2e..52de1239 100644 --- a/lib/ui/pages/server_storage/extending_volume.dart +++ b/lib/ui/pages/server_storage/extending_volume.dart @@ -135,7 +135,14 @@ class _ExtendingVolumePageState extends State { const SizedBox(height: 16), FilledButton( title: 'providers.storage.extend_volume_button.title'.tr(), - onPressed: _isError ? null : () => {}, + onPressed: _isError + ? null + : () => { + context.read().resizeVolume( + widget.diskVolumeToResize, + _currentSliderGbValue.round(), + ), + }, disabled: _isError, ), const SizedBox(height: 16), From 89c907b109fbbcbb5a3de6514a1bc1bf7873efd7 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Sun, 18 Sep 2022 19:29:06 +0300 Subject: [PATCH 101/115] Make job status an enum --- lib/logic/models/json/server_job.dart | 30 +++++++++++++++++++++++-- lib/logic/models/json/server_job.g.dart | 11 +++++++-- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/lib/logic/models/json/server_job.dart b/lib/logic/models/json/server_job.dart index 94b9e432..156ebc25 100644 --- a/lib/logic/models/json/server_job.dart +++ b/lib/logic/models/json/server_job.dart @@ -30,14 +30,14 @@ class ServerJob { name: serverJob.name, progress: serverJob.progress, result: serverJob.result, - status: serverJob.status, + status: JobStatusEnum.fromString(serverJob.status), statusText: serverJob.statusText, uid: serverJob.uid, updatedAt: serverJob.updatedAt, ); final String name; final String description; - final String status; + final JobStatusEnum status; final String uid; final DateTime updatedAt; final DateTime createdAt; @@ -48,3 +48,29 @@ class ServerJob { final String? statusText; final DateTime? finishedAt; } + +enum JobStatusEnum { + @JsonValue('CREATED') + created, + @JsonValue('RUNNING') + running, + @JsonValue('FINISHED') + finished, + @JsonValue('ERROR') + error; + + factory JobStatusEnum.fromString(final String status) { + switch (status) { + case 'CREATED': + return created; + case 'RUNNING': + return running; + case 'FINISHED': + return finished; + case 'ERROR': + return error; + default: + throw Exception('Unknown status: $status'); + } + } +} diff --git a/lib/logic/models/json/server_job.g.dart b/lib/logic/models/json/server_job.g.dart index b74590b6..54719f80 100644 --- a/lib/logic/models/json/server_job.g.dart +++ b/lib/logic/models/json/server_job.g.dart @@ -9,7 +9,7 @@ part of 'server_job.dart'; ServerJob _$ServerJobFromJson(Map json) => ServerJob( name: json['name'] as String, description: json['description'] as String, - status: json['status'] as String, + status: $enumDecode(_$JobStatusEnumEnumMap, json['status']), uid: json['uid'] as String, updatedAt: DateTime.parse(json['updatedAt'] as String), createdAt: DateTime.parse(json['createdAt'] as String), @@ -25,7 +25,7 @@ ServerJob _$ServerJobFromJson(Map json) => ServerJob( Map _$ServerJobToJson(ServerJob instance) => { 'name': instance.name, 'description': instance.description, - 'status': instance.status, + 'status': _$JobStatusEnumEnumMap[instance.status]!, 'uid': instance.uid, 'updatedAt': instance.updatedAt.toIso8601String(), 'createdAt': instance.createdAt.toIso8601String(), @@ -35,3 +35,10 @@ Map _$ServerJobToJson(ServerJob instance) => { 'statusText': instance.statusText, 'finishedAt': instance.finishedAt?.toIso8601String(), }; + +const _$JobStatusEnumEnumMap = { + JobStatusEnum.created: 'CREATED', + JobStatusEnum.running: 'RUNNING', + JobStatusEnum.finished: 'FINISHED', + JobStatusEnum.error: 'ERROR', +}; From 35a617065e9be17bc91c705798e3ba6f1d997d09 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Sun, 18 Sep 2022 19:31:22 +0300 Subject: [PATCH 102/115] Implement root page pushing after extending volume button --- .../pages/server_storage/extending_volume.dart | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/ui/pages/server_storage/extending_volume.dart b/lib/ui/pages/server_storage/extending_volume.dart index 52de1239..38aed993 100644 --- a/lib/ui/pages/server_storage/extending_volume.dart +++ b/lib/ui/pages/server_storage/extending_volume.dart @@ -6,6 +6,8 @@ import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/ui/components/brand_button/filled_button.dart'; import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; import 'package:selfprivacy/logic/models/disk_status.dart'; +import 'package:selfprivacy/ui/pages/root_route.dart'; +import 'package:selfprivacy/utils/route_transitions/basic.dart'; class ExtendingVolumePage extends StatefulWidget { const ExtendingVolumePage({ @@ -137,12 +139,16 @@ class _ExtendingVolumePageState extends State { title: 'providers.storage.extend_volume_button.title'.tr(), onPressed: _isError ? null - : () => { - context.read().resizeVolume( - widget.diskVolumeToResize, - _currentSliderGbValue.round(), - ), - }, + : () { + context.read().resizeVolume( + widget.diskVolumeToResize, + _currentSliderGbValue.round(), + ); + Navigator.of(context).pushAndRemoveUntil( + materialRoute(const RootPage()), + (final predicate) => false, + ); + }, disabled: _isError, ), const SizedBox(height: 16), From 34d635c2c598bc8881069ee135399d93ea1d9161 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Sun, 18 Sep 2022 19:35:16 +0300 Subject: [PATCH 103/115] Add delay between provider and server storage resizing calls --- lib/logic/cubit/provider_volumes/provider_volume_cubit.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart index 88f798ca..65c313b1 100644 --- a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart +++ b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart @@ -84,6 +84,8 @@ class ApiProviderVolumeCubit return false; } + await Future.delayed(const Duration(seconds: 10)); + await ServerApi().resizeVolume(volume.name); refresh(); return true; From 1817031be8bd0fe3f8157ad19bf93b313d0dbf6c Mon Sep 17 00:00:00 2001 From: Inex Code Date: Sun, 18 Sep 2022 20:56:37 +0300 Subject: [PATCH 104/115] Animate color of BrandLinearIndicator --- .../brand_linear_indicator/brand_linear_indicator.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ui/components/brand_linear_indicator/brand_linear_indicator.dart b/lib/ui/components/brand_linear_indicator/brand_linear_indicator.dart index 16ffb40a..50104aa0 100644 --- a/lib/ui/components/brand_linear_indicator/brand_linear_indicator.dart +++ b/lib/ui/components/brand_linear_indicator/brand_linear_indicator.dart @@ -32,7 +32,9 @@ class BrandLinearIndicator extends StatelessWidget { -(1 - value), 0, ), - child: Container( + child: AnimatedContainer( + duration: const Duration(milliseconds: 400), + curve: Curves.easeInOut, width: constraints.maxWidth, decoration: BoxDecoration( color: color, From 19aab4b57f4294e58bac38c04061c2b084727540 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Sun, 18 Sep 2022 20:56:55 +0300 Subject: [PATCH 105/115] Redesign the ServerJobCard --- .../jobs_content/server_job_card.dart | 75 ++++++++++++++++--- 1 file changed, 63 insertions(+), 12 deletions(-) diff --git a/lib/ui/components/jobs_content/server_job_card.dart b/lib/ui/components/jobs_content/server_job_card.dart index 6f8c50fa..1dadb687 100644 --- a/lib/ui/components/jobs_content/server_job_card.dart +++ b/lib/ui/components/jobs_content/server_job_card.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:selfprivacy/logic/models/json/server_job.dart'; -import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; import 'package:selfprivacy/ui/components/brand_linear_indicator/brand_linear_indicator.dart'; class ServerJobCard extends StatelessWidget { @@ -12,31 +11,83 @@ class ServerJobCard extends StatelessWidget { final ServerJob serverJob; @override - Widget build(final BuildContext context) => GestureDetector( - child: BrandCards.big( + Widget build(final BuildContext context) { + Color color; + IconData icon; + + switch (serverJob.status) { + case JobStatusEnum.created: + color = Theme.of(context).colorScheme.secondary; + icon = Icons.query_builder_outlined; + break; + case JobStatusEnum.running: + color = Theme.of(context).colorScheme.tertiary; + icon = Icons.pending_outlined; + break; + case JobStatusEnum.finished: + color = Theme.of(context).colorScheme.primary; + icon = Icons.check_circle_outline; + break; + case JobStatusEnum.error: + color = Theme.of(context).colorScheme.error; + icon = Icons.error_outline; + break; + } + + final String? statusString = + serverJob.error ?? serverJob.result ?? serverJob.statusText; + + return GestureDetector( + child: Card( + child: Padding( + padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - serverJob.name, - style: Theme.of(context).textTheme.bodyMedium, - ), - Text( - serverJob.description, - style: Theme.of(context).textTheme.bodySmall, + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + serverJob.name, + style: Theme.of(context).textTheme.bodyMedium, + ), + Text( + serverJob.description, + style: Theme.of(context).textTheme.bodySmall, + ), + ], + ), + const Spacer(), + Icon( + icon, + color: color, + ), + ], ), const SizedBox(height: 8), BrandLinearIndicator( value: serverJob.progress == null ? 0.0 : serverJob.progress! / 100.0, - color: Theme.of(context).colorScheme.secondary, + color: color, backgroundColor: Theme.of(context).colorScheme.surfaceVariant, height: 7.0, ), const SizedBox(height: 8), + if (statusString != null) + Text( + statusString, + style: Theme.of(context).textTheme.labelSmall?.copyWith( + color: Theme.of(context).colorScheme.onSurface, + ), + ), ], ), ), - ); + ), + ); + } } From e330878e6daf09edc60cf1179f1880e7a3c78820 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Sun, 18 Sep 2022 23:12:09 +0300 Subject: [PATCH 106/115] Allow removing completed and failed server jobs --- assets/translations/ru.json | 3 +- .../graphql_maps/server_api/jobs_api.dart | 14 +- .../cubit/server_jobs/server_jobs_cubit.dart | 46 +++- .../cubit/server_jobs/server_jobs_state.dart | 18 +- lib/logic/models/json/server_job.dart | 1 + .../components/jobs_content/jobs_content.dart | 228 ++++++++++-------- 6 files changed, 194 insertions(+), 116 deletions(-) diff --git a/assets/translations/ru.json b/assets/translations/ru.json index a8d3f0d5..6ceb70a4 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -482,7 +482,8 @@ "upgradeServer": "Обновить сервер", "rebootServer": "Перезагрузить сервер", "create_ssh_key": "Создать SSH ключ для {}", - "delete_ssh_key": "Удалить SSH ключ для {}" + "delete_ssh_key": "Удалить SSH ключ для {}", + "server_jobs": "Задачи на сервере" }, "validations": { "required": "Обязательное поле.", 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 28f362a9..8d731e3e 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,14 +22,24 @@ 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); - await client.mutate$RemoveJob(mutation); + final response = await client.mutate$RemoveJob(mutation); + return GenericMutationResult( + success: response.parsedData?.removeJob.success ?? false, + code: response.parsedData?.removeJob.code ?? 0, + message: response.parsedData?.removeJob.message, + ); } catch (e) { print(e); + return GenericMutationResult( + success: false, + code: 0, + message: e.toString(), + ); } } } diff --git a/lib/logic/cubit/server_jobs/server_jobs_cubit.dart b/lib/logic/cubit/server_jobs/server_jobs_cubit.dart index 46f04e5b..43b2b2d5 100644 --- a/lib/logic/cubit/server_jobs/server_jobs_cubit.dart +++ b/lib/logic/cubit/server_jobs/server_jobs_cubit.dart @@ -14,7 +14,7 @@ class ServerJobsCubit ServerJobsCubit(final ServerInstallationCubit serverInstallationCubit) : super( serverInstallationCubit, - const ServerJobsState(), + ServerJobsState(), ); Timer? timer; @@ -23,7 +23,7 @@ class ServerJobsCubit @override void clear() async { emit( - const ServerJobsState(), + ServerJobsState(), ); if (timer != null && timer!.isActive) { timer!.cancel(); @@ -40,7 +40,7 @@ class ServerJobsCubit serverJobList: jobs, ), ); - timer = Timer(const Duration(seconds: 10), () => reload(useTimer: true)); + timer = Timer(const Duration(seconds: 5), () => reload(useTimer: true)); } } @@ -72,6 +72,44 @@ class ServerJobsCubit return job; } + /// Get the job object and change its isHidden to true. + /// Emit the new state. + /// Call the api to remove the job. + /// If the api call fails, change the isHidden to false and emit the new state. + /// If the api call succeeds, remove the job from the list and emit the new state. + Future removeServerJob(final String uid) async { + final ServerJob? job = getServerJobByUid(uid); + if (job == null) { + return; + } + + job.isHidden = true; + emit( + ServerJobsState( + serverJobList: state.serverJobList, + ), + ); + + final result = await api.removeApiJob(uid); + if (!result.success) { + job.isHidden = false; + emit( + ServerJobsState( + serverJobList: state.serverJobList, + ), + ); + getIt().showSnackBar(result.message!); + return; + } + + state.serverJobList.remove(job); + emit( + ServerJobsState( + serverJobList: state.serverJobList, + ), + ); + } + Future reload({final bool useTimer = false}) async { final List jobs = await api.getServerJobs(); emit( @@ -80,7 +118,7 @@ class ServerJobsCubit ), ); if (useTimer) { - timer = Timer(const Duration(seconds: 10), () => reload(useTimer: true)); + timer = Timer(const Duration(seconds: 5), () => reload(useTimer: true)); } } } diff --git a/lib/logic/cubit/server_jobs/server_jobs_state.dart b/lib/logic/cubit/server_jobs/server_jobs_state.dart index bf7d0adb..25d8deab 100644 --- a/lib/logic/cubit/server_jobs/server_jobs_state.dart +++ b/lib/logic/cubit/server_jobs/server_jobs_state.dart @@ -1,22 +1,28 @@ part of 'server_jobs_cubit.dart'; class ServerJobsState extends ServerInstallationDependendState { - const ServerJobsState({ - this.serverJobList = const [], + ServerJobsState({ + final serverJobList = const [], this.migrationJobUid, - }); - final List serverJobList; + }) { + _serverJobList = serverJobList; + } + + late final List _serverJobList; final String? migrationJobUid; + List get serverJobList => + _serverJobList.where((final ServerJob job) => !job.isHidden).toList(); + @override - List get props => [migrationJobUid, ...serverJobList]; + List get props => [migrationJobUid, ..._serverJobList]; ServerJobsState copyWith({ final List? serverJobList, final String? migrationJobUid, }) => ServerJobsState( - serverJobList: serverJobList ?? this.serverJobList, + serverJobList: serverJobList ?? _serverJobList, migrationJobUid: migrationJobUid ?? this.migrationJobUid, ); } diff --git a/lib/logic/models/json/server_job.dart b/lib/logic/models/json/server_job.dart index 156ebc25..67bbfca4 100644 --- a/lib/logic/models/json/server_job.dart +++ b/lib/logic/models/json/server_job.dart @@ -47,6 +47,7 @@ class ServerJob { final String? result; final String? statusText; final DateTime? finishedAt; + bool isHidden = false; } enum JobStatusEnum { diff --git a/lib/ui/components/jobs_content/jobs_content.dart b/lib/ui/components/jobs_content/jobs_content.dart index f7063230..58fffd74 100644 --- a/lib/ui/components/jobs_content/jobs_content.dart +++ b/lib/ui/components/jobs_content/jobs_content.dart @@ -6,6 +6,7 @@ import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_jobs/server_jobs_cubit.dart'; +import 'package:selfprivacy/logic/models/json/server_job.dart'; import 'package:selfprivacy/ui/components/action_button/action_button.dart'; import 'package:selfprivacy/ui/components/brand_alert/brand_alert.dart'; import 'package:selfprivacy/ui/components/brand_button/brand_button.dart'; @@ -18,118 +19,139 @@ class JobsContent extends StatelessWidget { const JobsContent({final super.key}); @override - Widget build(final BuildContext context) => BlocBuilder( - builder: (final context, final state) { - late List widgets; - final ServerInstallationState installationState = - context.read().state; - if (state is JobsStateEmpty) { - widgets = [ - const SizedBox(height: 80), - Center(child: BrandText.body1('jobs.empty'.tr())), - ]; + Widget build(final BuildContext context) { + final List serverJobs = + context.watch().state.serverJobList; - if (installationState is ServerInstallationFinished) { - widgets = [ - ...widgets, - const SizedBox(height: 80), - BrandButton.rised( - onPressed: () => context.read().upgradeServer(), - text: 'jobs.upgradeServer'.tr(), - ), - const SizedBox(height: 10), - BrandButton.text( - onPressed: () { - final NavigationService nav = getIt(); - nav.showPopUpDialog( - BrandAlert( - title: 'jobs.rebootServer'.tr(), - contentText: 'modals.3'.tr(), - actions: [ - ActionButton( - text: 'basis.cancel'.tr(), - ), - ActionButton( - onPressed: () => - {context.read().rebootServer()}, - text: 'modals.9'.tr(), - ) - ], - ), - ); - }, - title: 'jobs.rebootServer'.tr(), - ), - ]; - } - } else if (state is JobsStateLoading) { + return BlocBuilder( + builder: (final context, final state) { + late List widgets; + final ServerInstallationState installationState = + context.read().state; + if (state is JobsStateEmpty) { + widgets = [ + const SizedBox(height: 80), + Center(child: BrandText.body1('jobs.empty'.tr())), + ]; + + if (installationState is ServerInstallationFinished) { widgets = [ + ...widgets, const SizedBox(height: 80), - BrandLoader.horizontal(), - ]; - } else if (state is JobsStateWithJobs) { - widgets = [ - ...state.clientJobList - .map( - (final j) => Row( - children: [ - Expanded( - child: BrandCards.small( - child: Text(j.title), - ), + BrandButton.rised( + onPressed: () => context.read().upgradeServer(), + text: 'jobs.upgradeServer'.tr(), + ), + const SizedBox(height: 10), + BrandButton.text( + onPressed: () { + final NavigationService nav = getIt(); + nav.showPopUpDialog( + BrandAlert( + title: 'jobs.rebootServer'.tr(), + contentText: 'modals.3'.tr(), + actions: [ + ActionButton( + text: 'basis.cancel'.tr(), ), - const SizedBox(width: 10), - ElevatedButton( - style: ElevatedButton.styleFrom( - primary: - Theme.of(context).colorScheme.errorContainer, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - ), - ), + ActionButton( onPressed: () => - context.read().removeJob(j.id), - child: Text( - 'basis.remove'.tr(), - style: TextStyle( - color: Theme.of(context) - .colorScheme - .onErrorContainer, - ), - ), - ), + {context.read().rebootServer()}, + text: 'modals.9'.tr(), + ) ], ), - ) - .toList(), - const SizedBox(height: 20), - BrandButton.rised( - onPressed: () => context.read().applyAll(), - text: 'jobs.start'.tr(), + ); + }, + title: 'jobs.rebootServer'.tr(), ), ]; } - return ListView( - padding: paddingH15V0, - children: [ - const SizedBox(height: 15), - Center( - child: BrandText.h2( - 'jobs.title'.tr(), - ), - ), - const SizedBox(height: 20), - ...widgets, - const SizedBox(height: 8), - const Divider(), - const SizedBox(height: 8), - ...context.read().state.serverJobList.map( - (final job) => ServerJobCard( - serverJob: job, - ), + } else if (state is JobsStateLoading) { + widgets = [ + const SizedBox(height: 80), + BrandLoader.horizontal(), + ]; + } else if (state is JobsStateWithJobs) { + widgets = [ + ...state.clientJobList + .map( + (final j) => Row( + children: [ + Expanded( + child: BrandCards.small( + child: Text(j.title), + ), + ), + const SizedBox(width: 10), + ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).colorScheme.errorContainer, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + ), + onPressed: () => + context.read().removeJob(j.id), + child: Text( + 'basis.remove'.tr(), + style: TextStyle( + color: + Theme.of(context).colorScheme.onErrorContainer, + ), + ), + ), + ], ), - ], - ); - }, - ); + ) + .toList(), + const SizedBox(height: 20), + BrandButton.rised( + onPressed: () => context.read().applyAll(), + text: 'jobs.start'.tr(), + ), + ]; + } + return ListView( + padding: paddingH15V0, + children: [ + const SizedBox(height: 15), + Center( + child: BrandText.h2( + 'jobs.title'.tr(), + ), + ), + const SizedBox(height: 20), + ...widgets, + const SizedBox(height: 8), + const Divider(height: 0), + const SizedBox(height: 8), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + 'jobs.server_jobs'.tr(), + style: Theme.of(context).textTheme.titleMedium, + ), + ), + ...serverJobs.map( + (final job) => Dismissible( + key: ValueKey(job.uid), + direction: job.status == JobStatusEnum.finished || + job.status == JobStatusEnum.error + ? DismissDirection.horizontal + : DismissDirection.none, + child: ServerJobCard( + serverJob: job, + ), + onDismissed: (final direction) { + context.read().removeServerJob(job.uid); + }, + ), + ), + const SizedBox(height: 24), + ], + ); + }, + ); + } } From a0b365f496ec99aa1464c98e05af38e2e922a241 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Sun, 18 Sep 2022 23:12:25 +0300 Subject: [PATCH 107/115] Add missing translation string --- assets/translations/en.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index 8abf8d39..9fb5d729 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -489,7 +489,8 @@ "upgradeServer": "Upgrade server", "rebootServer": "Reboot server", "create_ssh_key": "Create SSH key for {}", - "delete_ssh_key": "Delete SSH key for {}" + "delete_ssh_key": "Delete SSH key for {}", + "server_jobs": "Jobs on the server" }, "validations": { "required": "Required.", From 900e07f364b9407b4e2e9a133441f9c39f778215 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Sun, 18 Sep 2022 23:25:26 +0300 Subject: [PATCH 108/115] Implement user password reset --- assets/translations/ru.json | 3 +- .../cubit/client_jobs/client_jobs_cubit.dart | 3 + .../cubit/forms/user/user_form_cubit.dart | 53 ++++++++---- lib/logic/models/job.dart | 11 +++ lib/ui/pages/users/reset_password.dart | 84 +++++++++++++++++++ lib/ui/pages/users/user_details.dart | 12 ++- lib/ui/pages/users/users.dart | 1 + 7 files changed, 150 insertions(+), 17 deletions(-) create mode 100644 lib/ui/pages/users/reset_password.dart diff --git a/assets/translations/ru.json b/assets/translations/ru.json index 6ceb70a4..4c92f22c 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -483,7 +483,8 @@ "rebootServer": "Перезагрузить сервер", "create_ssh_key": "Создать SSH ключ для {}", "delete_ssh_key": "Удалить SSH ключ для {}", - "server_jobs": "Задачи на сервере" + "server_jobs": "Задачи на сервере", + "resetUserPassword": "Сбросить пароль пользователя" }, "validations": { "required": "Обязательное поле.", diff --git a/lib/logic/cubit/client_jobs/client_jobs_cubit.dart b/lib/logic/cubit/client_jobs/client_jobs_cubit.dart index 7461a6df..49b856ff 100644 --- a/lib/logic/cubit/client_jobs/client_jobs_cubit.dart +++ b/lib/logic/cubit/client_jobs/client_jobs_cubit.dart @@ -121,6 +121,9 @@ class JobsCubit extends Cubit { if (job is DeleteSSHKeyJob) { await usersCubit.deleteSshKey(job.user, job.publicKey); } + if (job is ResetUserPasswordJob) { + await usersCubit.changeUserPassword(job.user, job.user.password!); + } } await api.pullConfigurationUpdate(); diff --git a/lib/logic/cubit/forms/user/user_form_cubit.dart b/lib/logic/cubit/forms/user/user_form_cubit.dart index d745b5f5..c60fef9e 100644 --- a/lib/logic/cubit/forms/user/user_form_cubit.dart +++ b/lib/logic/cubit/forms/user/user_form_cubit.dart @@ -11,28 +11,50 @@ class UserFormCubit extends FormCubit { UserFormCubit({ required this.jobsCubit, required final FieldCubitFactory fieldFactory, - final User? user, + final this.initialUser, }) { - final bool isEdit = user != null; + if (initialUser == null) { + login = fieldFactory.createUserLoginField(); + login.setValue(''); + password = fieldFactory.createUserPasswordField(); + password.setValue( + StringGenerators.userPassword(), + ); - login = fieldFactory.createUserLoginField(); - login.setValue(isEdit ? user.login : ''); - password = fieldFactory.createUserPasswordField(); - password.setValue( - isEdit ? (user.password ?? '') : StringGenerators.userPassword(), - ); + super.addFields([login, password]); + } else { + login = fieldFactory.createRequiredStringField(); + login.setValue(initialUser!.login); + password = fieldFactory.createUserPasswordField(); + password.setValue( + initialUser?.password ?? '', + ); - super.addFields([login, password]); + super.addFields([login, password]); + } } @override FutureOr onSubmit() { - final User user = User( - login: login.state.value, - type: UserType.normal, - password: password.state.value, - ); - jobsCubit.addJob(CreateUserJob(user: user)); + print('onSubmit'); + print('initialUser: $initialUser'); + print('login: ${login.state.value}'); + print('password: ${password.state.value}'); + if (initialUser == null) { + final User user = User( + login: login.state.value, + type: UserType.normal, + password: password.state.value, + ); + jobsCubit.addJob(CreateUserJob(user: user)); + } else { + final User user = User( + login: initialUser?.login ?? login.state.value, + type: initialUser?.type ?? UserType.normal, + password: password.state.value, + ); + jobsCubit.addJob(ResetUserPasswordJob(user: user)); + } } late FieldCubit login; @@ -43,4 +65,5 @@ class UserFormCubit extends FormCubit { } final JobsCubit jobsCubit; + final User? initialUser; } diff --git a/lib/logic/models/job.dart b/lib/logic/models/job.dart index 6ea31588..2d62a305 100644 --- a/lib/logic/models/job.dart +++ b/lib/logic/models/job.dart @@ -31,6 +31,17 @@ class CreateUserJob extends ClientJob { List get props => [id, title, user]; } +class ResetUserPasswordJob extends ClientJob { + ResetUserPasswordJob({ + required this.user, + }) : super(title: '${"jobs.resetUserPassword".tr()} ${user.login}'); + + final User user; + + @override + List get props => [id, title, user]; +} + class DeleteUserJob extends ClientJob { DeleteUserJob({ required this.user, diff --git a/lib/ui/pages/users/reset_password.dart b/lib/ui/pages/users/reset_password.dart new file mode 100644 index 00000000..841a9353 --- /dev/null +++ b/lib/ui/pages/users/reset_password.dart @@ -0,0 +1,84 @@ +part of 'users.dart'; + +class ResetPassword extends StatelessWidget { + const ResetPassword({ + required this.user, + final super.key, + }); + + final User user; + + @override + Widget build(final BuildContext context) => BrandBottomSheet( + child: BlocProvider( + create: (final BuildContext context) => UserFormCubit( + jobsCubit: context.read(), + fieldFactory: FieldCubitFactory(context), + initialUser: user, + ), + child: Builder( + builder: (final BuildContext context) { + final FormCubitState formCubitState = + context.watch().state; + + return BlocListener( + listener: + (final BuildContext context, final FormCubitState state) { + if (state.isSubmitted) { + Navigator.pop(context); + } + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + BrandHeader( + title: 'users.reset_password'.tr(), + ), + const SizedBox(width: 14), + Padding( + padding: paddingH15V0, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + CubitFormTextField( + formFieldCubit: + context.read().password, + decoration: InputDecoration( + alignLabelWithHint: false, + labelText: 'basis.password'.tr(), + suffixIcon: Padding( + padding: const EdgeInsets.only(right: 8), + child: IconButton( + icon: Icon( + BrandIcons.refresh, + color: + Theme.of(context).colorScheme.secondary, + ), + onPressed: context + .read() + .genNewPassword, + ), + ), + ), + ), + const SizedBox(height: 30), + BrandButton.rised( + onPressed: formCubitState.isSubmitting + ? null + : () => + context.read().trySubmit(), + text: 'basis.apply'.tr(), + ), + const SizedBox(height: 30), + ], + ), + ), + ], + ), + ); + }, + ), + ), + ); +} diff --git a/lib/ui/pages/users/user_details.dart b/lib/ui/pages/users/user_details.dart index 24f2457f..86a9e3d7 100644 --- a/lib/ui/pages/users/user_details.dart +++ b/lib/ui/pages/users/user_details.dart @@ -43,7 +43,17 @@ class UserDetails extends StatelessWidget { const SizedBox(height: 8), ListTile( iconColor: Theme.of(context).colorScheme.onBackground, - onTap: () => {}, + onTap: () => { + showModalBottomSheet( + context: context, + isScrollControlled: true, + backgroundColor: Colors.transparent, + builder: (final BuildContext context) => Padding( + padding: MediaQuery.of(context).viewInsets, + child: ResetPassword(user: user), + ), + ), + }, leading: const Icon(Icons.lock_reset_outlined), title: Text( 'users.reset_password'.tr(), diff --git a/lib/ui/pages/users/users.dart b/lib/ui/pages/users/users.dart index 7e255935..40443a9c 100644 --- a/lib/ui/pages/users/users.dart +++ b/lib/ui/pages/users/users.dart @@ -31,6 +31,7 @@ part 'new_user.dart'; part 'user.dart'; part 'user_details.dart'; part 'add_user_fab.dart'; +part 'reset_password.dart'; class UsersPage extends StatelessWidget { const UsersPage({final super.key}); From 2a4c691f1e8cfb892451b313424d291b8f168cc0 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Mon, 19 Sep 2022 01:11:26 +0300 Subject: [PATCH 109/115] Pre-release testing bug fixes --- assets/translations/en.json | 5 +-- assets/translations/ru.json | 2 +- .../provider_volume_cubit.dart | 33 ++++++++++++++++--- .../provider_volume_state.dart | 7 ++-- .../server_volumes/server_volume_cubit.dart | 4 +-- .../jobs_content/server_job_card.dart | 28 ++++++++-------- .../data_to_binds_migration.dart | 18 ++++++++-- .../server_storage/extending_volume.dart | 11 +++++-- 8 files changed, 77 insertions(+), 31 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index 9fb5d729..3c849eff 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -202,7 +202,7 @@ "extend_volume_button": "Extend volume", "extending_volume_title": "Extending volume", "extending_volume_description": "Resizing volume will allow you to store more data on your server without extending the server itself. Volume can only be extended: shrinking is not possible.", - "extending_volume_price_info": "Price includes VAT and is estimated from pricing data provided by Hetzner.", + "extending_volume_price_info": "Price includes VAT and is estimated from pricing data provided by Hetzner. Server will be rebooted after resizing.", "extending_volume_error": "Couldn't initialize volume extending.", "size": "Size", "euro": "Euro", @@ -490,7 +490,8 @@ "rebootServer": "Reboot server", "create_ssh_key": "Create SSH key for {}", "delete_ssh_key": "Delete SSH key for {}", - "server_jobs": "Jobs on the server" + "server_jobs": "Jobs on the server", + "resetUserPassword": "Reset password of user" }, "validations": { "required": "Required.", diff --git a/assets/translations/ru.json b/assets/translations/ru.json index 4c92f22c..ce2d6231 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -204,7 +204,7 @@ "extend_volume_button": "Расширить хранилище", "extending_volume_title": "Расширение хранилища", "extending_volume_description": "Изменение размера хранилища позволит вам держать больше данных на вашем сервере без расширения самого сервера. Объем можно только увеличить: уменьшить нельзя.", - "extending_volume_price_info": "Цена включает НДС и рассчитана на основе данных о ценах, предоставленных Hetzner.", + "extending_volume_price_info": "Цена включает НДС и рассчитана на основе данных о ценах, предоставленных Hetzner. Сервер будет перезагружен во время процесса.", "extending_volume_error": "Не удалось начать расширение хранилища.", "size": "Размер", "euro": "Евро", diff --git a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart index 65c313b1..6a1c7d16 100644 --- a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart +++ b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart @@ -17,6 +17,8 @@ class ApiProviderVolumeCubit VolumeProviderApiFactory? providerApi; + final ServerApi serverApi = ServerApi(); + @override Future load() async { if (serverInstallationCubit.state is ServerInstallationFinished) { @@ -34,23 +36,23 @@ class ApiProviderVolumeCubit providerApi!.getVolumeProvider().getPricePerGb(); Future refresh() async { - emit(const ApiProviderVolumeState([], LoadingStatus.refreshing)); + emit(const ApiProviderVolumeState([], LoadingStatus.refreshing, false)); _refetch(); } Future _refetch() async { if (providerApi == null) { - return emit(const ApiProviderVolumeState([], LoadingStatus.error)); + return emit(const ApiProviderVolumeState([], LoadingStatus.error, false)); } final List volumes = await providerApi!.getVolumeProvider().getVolumes(); if (volumes.isEmpty) { - return emit(const ApiProviderVolumeState([], LoadingStatus.error)); + return emit(const ApiProviderVolumeState([], LoadingStatus.error, false)); } - emit(ApiProviderVolumeState(volumes, LoadingStatus.success)); + emit(ApiProviderVolumeState(volumes, LoadingStatus.success, false)); } Future attachVolume(final DiskVolume volume) async { @@ -71,7 +73,12 @@ class ApiProviderVolumeCubit Future resizeVolume( final DiskVolume volume, final int newSizeGb, + final Function() callback, ) async { + getIt().showSnackBar( + 'Starting resize', + ); + emit(state.copyWith(isResizing: true)); final bool resized = await providerApi!.getVolumeProvider().resizeVolume( volume.providerVolume!.id, newSizeGb, @@ -81,13 +88,29 @@ class ApiProviderVolumeCubit getIt().showSnackBar( 'providers.storage.extending_volume_error'.tr(), ); + emit(state.copyWith(isResizing: false)); return false; } + getIt().showSnackBar( + 'Hetzner resized, waiting 10 seconds', + ); await Future.delayed(const Duration(seconds: 10)); await ServerApi().resizeVolume(volume.name); - refresh(); + getIt().showSnackBar( + 'Server api resized, waiting 20 seconds', + ); + + await Future.delayed(const Duration(seconds: 20)); + getIt().showSnackBar( + 'Restarting server', + ); + + await refresh(); + emit(state.copyWith(isResizing: false)); + await callback(); + await serverApi.reboot(); return true; } diff --git a/lib/logic/cubit/provider_volumes/provider_volume_state.dart b/lib/logic/cubit/provider_volumes/provider_volume_state.dart index 16a3f177..406eaaad 100644 --- a/lib/logic/cubit/provider_volumes/provider_volume_state.dart +++ b/lib/logic/cubit/provider_volumes/provider_volume_state.dart @@ -1,22 +1,25 @@ part of 'provider_volume_cubit.dart'; class ApiProviderVolumeState extends ServerInstallationDependendState { - const ApiProviderVolumeState(this._volumes, this.status); + const ApiProviderVolumeState(this._volumes, this.status, this.isResizing); const ApiProviderVolumeState.initial() - : this(const [], LoadingStatus.uninitialized); + : this(const [], LoadingStatus.uninitialized, false); final List _volumes; final LoadingStatus status; + final bool isResizing; List get volumes => _volumes; ApiProviderVolumeState copyWith({ final List? volumes, final LoadingStatus? status, + final bool? isResizing, }) => ApiProviderVolumeState( volumes ?? _volumes, status ?? this.status, + isResizing ?? this.isResizing, ); @override diff --git a/lib/logic/cubit/server_volumes/server_volume_cubit.dart b/lib/logic/cubit/server_volumes/server_volume_cubit.dart index ca6dbb6e..e48a809e 100644 --- a/lib/logic/cubit/server_volumes/server_volume_cubit.dart +++ b/lib/logic/cubit/server_volumes/server_volume_cubit.dart @@ -24,7 +24,7 @@ class ApiServerVolumeCubit @override Future load() async { if (serverInstallationCubit.state is ServerInstallationFinished) { - _refetch(); + reload(); } } @@ -43,7 +43,7 @@ class ApiServerVolumeCubit return; } - Future _refetch() async { + Future reload() async { final volumes = await serverApi.getServerDiskVolumes(); final usesBinds = await serverApi.isUsingBinds(); var status = LoadingStatus.error; diff --git a/lib/ui/components/jobs_content/server_job_card.dart b/lib/ui/components/jobs_content/server_job_card.dart index 1dadb687..46e21166 100644 --- a/lib/ui/components/jobs_content/server_job_card.dart +++ b/lib/ui/components/jobs_content/server_job_card.dart @@ -46,21 +46,23 @@ class ServerJobCard extends StatelessWidget { children: [ Row( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - serverJob.name, - style: Theme.of(context).textTheme.bodyMedium, - ), - Text( - serverJob.description, - style: Theme.of(context).textTheme.bodySmall, - ), - ], + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + serverJob.name, + style: Theme.of(context).textTheme.bodyMedium, + ), + Text( + serverJob.description, + style: Theme.of(context).textTheme.bodySmall, + ), + ], + ), ), - const Spacer(), Icon( icon, color: color, diff --git a/lib/ui/pages/server_storage/binds_migration/data_to_binds_migration.dart b/lib/ui/pages/server_storage/binds_migration/data_to_binds_migration.dart index a88b70cb..c984dd5b 100644 --- a/lib/ui/pages/server_storage/binds_migration/data_to_binds_migration.dart +++ b/lib/ui/pages/server_storage/binds_migration/data_to_binds_migration.dart @@ -3,13 +3,16 @@ import 'package:flutter/material.dart'; import 'package:selfprivacy/logic/cubit/server_jobs/server_jobs_cubit.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/logic/models/service.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_header/brand_header.dart'; import 'package:selfprivacy/ui/components/info_box/info_box.dart'; import 'package:selfprivacy/logic/models/disk_status.dart'; +import 'package:selfprivacy/ui/components/jobs_content/jobs_content.dart'; import 'package:selfprivacy/ui/components/storage_list_items/server_storage_list_item.dart'; import 'package:selfprivacy/ui/components/storage_list_items/service_migration_list_item.dart'; -import 'package:selfprivacy/ui/pages/server_storage/binds_migration/migration_process_page.dart'; +import 'package:selfprivacy/ui/helpers/modals.dart'; +import 'package:selfprivacy/ui/pages/root_route.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; class DataToBindsMigrationPage extends StatefulWidget { @@ -162,8 +165,17 @@ class _DataToBindsMigrationPageState extends State { title: 'providers.storage.start_migration_button'.tr(), onPressed: () { context.read().migrateToBinds(serviceToDisk); - Navigator.of(context).push( - materialRoute(const MigrationProcessPage()), + Navigator.of(context).pushAndRemoveUntil( + materialRoute(const RootPage()), + (final predicate) => false, + ); + showBrandBottomSheet( + context: context, + builder: (final BuildContext context) => + const BrandBottomSheet( + isExpended: true, + child: JobsContent(), + ), ); }, ), diff --git a/lib/ui/pages/server_storage/extending_volume.dart b/lib/ui/pages/server_storage/extending_volume.dart index 38aed993..1c8980e2 100644 --- a/lib/ui/pages/server_storage/extending_volume.dart +++ b/lib/ui/pages/server_storage/extending_volume.dart @@ -2,6 +2,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; import 'package:selfprivacy/logic/cubit/provider_volumes/provider_volume_cubit.dart'; +import 'package:selfprivacy/logic/cubit/server_volumes/server_volume_cubit.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/ui/components/brand_button/filled_button.dart'; import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; @@ -26,7 +27,7 @@ class ExtendingVolumePage extends StatefulWidget { class _ExtendingVolumePageState extends State { @override void initState() { - minSize = widget.diskVolumeToResize.sizeTotal + DiskSize.fromGibibyte(2); + minSize = widget.diskVolumeToResize.sizeTotal + DiskSize.fromGibibyte(3); _currentSliderGbValue = minSize.gibibyte; super.initState(); } @@ -73,11 +74,14 @@ class _ExtendingVolumePageState extends State { (_euroPerGb * double.parse(_sizeController.text)) .toStringAsFixed(2); minSize = - widget.diskVolumeToResize.sizeTotal + DiskSize.fromGibibyte(2); + widget.diskVolumeToResize.sizeTotal + DiskSize.fromGibibyte(3); if (_currentSliderGbValue < 0) { _currentSliderGbValue = minSize.gibibyte; } + final isAlreadyResizing = + context.watch().state.isResizing; + return BrandHeroScreen( hasBackButton: true, heroTitle: 'providers.storage.extending_volume_title'.tr(), @@ -143,13 +147,14 @@ class _ExtendingVolumePageState extends State { context.read().resizeVolume( widget.diskVolumeToResize, _currentSliderGbValue.round(), + context.read().reload, ); Navigator.of(context).pushAndRemoveUntil( materialRoute(const RootPage()), (final predicate) => false, ); }, - disabled: _isError, + disabled: _isError || isAlreadyResizing, ), const SizedBox(height: 16), const Divider( From fe95f5e5d3e1cd8c01f5b48ea69085aa94438a7b Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 19 Sep 2022 02:13:25 +0300 Subject: [PATCH 110/115] Add props into provider job state --- lib/logic/cubit/provider_volumes/provider_volume_state.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/logic/cubit/provider_volumes/provider_volume_state.dart b/lib/logic/cubit/provider_volumes/provider_volume_state.dart index 406eaaad..3858ef14 100644 --- a/lib/logic/cubit/provider_volumes/provider_volume_state.dart +++ b/lib/logic/cubit/provider_volumes/provider_volume_state.dart @@ -23,5 +23,5 @@ class ApiProviderVolumeState extends ServerInstallationDependendState { ); @override - List get props => [_volumes]; + List get props => [_volumes, status, isResizing]; } From d6d7a0dcb611c244c6141b7aa5837d659c18372b Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 19 Sep 2022 02:42:21 +0300 Subject: [PATCH 111/115] Implement rebuild server job for settings page --- .../server_api/server_actions_api.dart | 14 ++++------- .../cubit/client_jobs/client_jobs_cubit.dart | 4 ++++ lib/logic/models/job.dart | 7 ++++++ .../server_details/server_details_screen.dart | 2 ++ .../pages/server_details/server_settings.dart | 23 +++++++++++++++++++ 5 files changed, 40 insertions(+), 10 deletions(-) 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 07ca101d..780f1d37 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 @@ -24,9 +24,7 @@ mixin ServerActionsApi on ApiMap { try { final GraphQLClient client = await getClient(); return await _commonBoolRequest( - () async { - await client.mutate$RebootSystem(); - }, + () async => client.mutate$RebootSystem(), ); } catch (e) { return false; @@ -37,9 +35,7 @@ mixin ServerActionsApi on ApiMap { try { final GraphQLClient client = await getClient(); return await _commonBoolRequest( - () async { - await client.mutate$PullRepositoryChanges(); - }, + () async => client.mutate$PullRepositoryChanges(), ); } catch (e) { return false; @@ -49,10 +45,8 @@ mixin ServerActionsApi on ApiMap { Future upgrade() async { try { final GraphQLClient client = await getClient(); - return await _commonBoolRequest( - () async { - await client.mutate$RunSystemUpgrade(); - }, + return _commonBoolRequest( + () async => client.mutate$RunSystemUpgrade(), ); } catch (e) { return false; diff --git a/lib/logic/cubit/client_jobs/client_jobs_cubit.dart b/lib/logic/cubit/client_jobs/client_jobs_cubit.dart index 49b856ff..4fa610cd 100644 --- a/lib/logic/cubit/client_jobs/client_jobs_cubit.dart +++ b/lib/logic/cubit/client_jobs/client_jobs_cubit.dart @@ -105,6 +105,7 @@ class JobsCubit extends Cubit { emit(JobsStateLoading()); bool hasServiceJobs = false; for (final ClientJob job in jobs) { + // TODO: Rewrite to polymorphism if (job is CreateUserJob) { await usersCubit.createUser(job.user); } @@ -124,6 +125,9 @@ class JobsCubit extends Cubit { if (job is ResetUserPasswordJob) { await usersCubit.changeUserPassword(job.user, job.user.password!); } + if (job is RebuildServerJob) { + await upgradeServer(); + } } await api.pullConfigurationUpdate(); diff --git a/lib/logic/models/job.dart b/lib/logic/models/job.dart index 2d62a305..1dc1bd91 100644 --- a/lib/logic/models/job.dart +++ b/lib/logic/models/job.dart @@ -20,6 +20,13 @@ class ClientJob extends Equatable { List get props => [id, title]; } +class RebuildServerJob extends ClientJob { + RebuildServerJob({ + required final super.title, + final super.id, + }); +} + class CreateUserJob extends ClientJob { CreateUserJob({ required this.user, diff --git a/lib/ui/pages/server_details/server_details_screen.dart b/lib/ui/pages/server_details/server_details_screen.dart index 367d8de8..24675dad 100644 --- a/lib/ui/pages/server_details/server_details_screen.dart +++ b/lib/ui/pages/server_details/server_details_screen.dart @@ -3,11 +3,13 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:selfprivacy/config/brand_colors.dart'; import 'package:selfprivacy/logic/common_enum/common_enum.dart'; +import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart'; import 'package:selfprivacy/logic/cubit/hetzner_metrics/hetzner_metrics_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_volumes/server_volume_cubit.dart'; import 'package:selfprivacy/logic/models/auto_upgrade_settings.dart'; +import 'package:selfprivacy/logic/models/job.dart'; import 'package:selfprivacy/ui/components/brand_button/segmented_buttons.dart'; import 'package:selfprivacy/ui/components/brand_cards/filled_card.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; diff --git a/lib/ui/pages/server_details/server_settings.dart b/lib/ui/pages/server_details/server_settings.dart index 9a35e74a..38c7133b 100644 --- a/lib/ui/pages/server_details/server_settings.dart +++ b/lib/ui/pages/server_details/server_settings.dart @@ -10,6 +10,7 @@ class _ServerSettings extends StatefulWidget { class _ServerSettingsState extends State<_ServerSettings> { bool? allowAutoUpgrade; bool? rebootAfterUpgrade; + bool? didSomethingChange; @override Widget build(final BuildContext context) { @@ -24,11 +25,18 @@ class _ServerSettingsState extends State<_ServerSettings> { rebootAfterUpgrade = serverDetailsState.autoUpgradeSettings.allowReboot; } + didSomethingChange ??= false; + return Column( children: [ SwitchListTile( value: allowAutoUpgrade ?? false, onChanged: (final switched) { + if (didSomethingChange == false) { + context.read().addJob( + RebuildServerJob(title: 'jobs.upgradeServer'.tr()), + ); + } context .read() .repository @@ -40,6 +48,7 @@ class _ServerSettingsState extends State<_ServerSettings> { ); setState(() { allowAutoUpgrade = switched; + didSomethingChange = true; }); }, title: Text('providers.server.settings.allow_autoupgrade'.tr()), @@ -51,6 +60,11 @@ class _ServerSettingsState extends State<_ServerSettings> { SwitchListTile( value: rebootAfterUpgrade ?? false, onChanged: (final switched) { + if (didSomethingChange == false) { + context.read().addJob( + RebuildServerJob(title: 'jobs.upgradeServer'.tr()), + ); + } context .read() .repository @@ -62,6 +76,7 @@ class _ServerSettingsState extends State<_ServerSettings> { ); setState(() { rebootAfterUpgrade = switched; + didSomethingChange = true; }); }, title: Text('providers.server.settings.reboot_after_upgrade'.tr()), @@ -76,6 +91,14 @@ class _ServerSettingsState extends State<_ServerSettings> { serverDetailsState.serverTimezone.toString(), ), onTap: () { + if (didSomethingChange == false) { + context.read().addJob( + RebuildServerJob(title: 'jobs.upgradeServer'.tr()), + ); + } + setState(() { + didSomethingChange = true; + }); Navigator.of(context).push( materialRoute( const SelectTimezone(), From 10891881ae3c8bb605635f3112455edf94365ef3 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Mon, 19 Sep 2022 03:21:08 +0300 Subject: [PATCH 112/115] Service migrations --- .../cubit/server_jobs/server_jobs_state.dart | 7 +++-- lib/logic/cubit/services/services_cubit.dart | 22 ++++++++++++++- lib/logic/cubit/services/services_state.dart | 19 ++++++++++++- .../components/jobs_content/jobs_content.dart | 13 ++++----- lib/ui/pages/more/more.dart | 5 ++-- ...migration.dart => services_migration.dart} | 27 ++++++++++++++----- lib/ui/pages/services/service_page.dart | 20 +++++++++++++- 7 files changed, 94 insertions(+), 19 deletions(-) rename lib/ui/pages/server_storage/binds_migration/{data_to_binds_migration.dart => services_migration.dart} (87%) diff --git a/lib/logic/cubit/server_jobs/server_jobs_state.dart b/lib/logic/cubit/server_jobs/server_jobs_state.dart index 25d8deab..cf9cb8e0 100644 --- a/lib/logic/cubit/server_jobs/server_jobs_state.dart +++ b/lib/logic/cubit/server_jobs/server_jobs_state.dart @@ -11,8 +11,11 @@ class ServerJobsState extends ServerInstallationDependendState { late final List _serverJobList; final String? migrationJobUid; - List get serverJobList => - _serverJobList.where((final ServerJob job) => !job.isHidden).toList(); + List get serverJobList { + final List list = _serverJobList; + list.sort((final a, final b) => b.createdAt.compareTo(a.createdAt)); + return list; + } @override List get props => [migrationJobUid, ..._serverJobList]; diff --git a/lib/logic/cubit/services/services_cubit.dart b/lib/logic/cubit/services/services_cubit.dart index c423fd9f..4bb575a6 100644 --- a/lib/logic/cubit/services/services_cubit.dart +++ b/lib/logic/cubit/services/services_cubit.dart @@ -19,6 +19,7 @@ class ServicesCubit extends ServerInstallationDependendCubit { emit( ServicesState( services: services, + lockedServices: const [], ), ); timer = Timer(const Duration(seconds: 10), () => reload(useTimer: true)); @@ -28,7 +29,7 @@ class ServicesCubit extends ServerInstallationDependendCubit { Future reload({final bool useTimer = false}) async { final List services = await api.getAllServices(); emit( - ServicesState( + state.copyWith( services: services, ), ); @@ -38,7 +39,26 @@ class ServicesCubit extends ServerInstallationDependendCubit { } Future restart(final String serviceId) async { + emit(state.copyWith(lockedServices: [...state.lockedServices, serviceId])); await api.restartService(serviceId); + await Future.delayed(const Duration(seconds: 2)); + reload(); + await Future.delayed(const Duration(seconds: 10)); + emit( + state.copyWith( + lockedServices: state.lockedServices + .where((final element) => element != serviceId) + .toList(), + ), + ); + reload(); + } + + Future moveService( + final String serviceId, + final String destination, + ) async { + await api.moveService(serviceId, destination); } @override diff --git a/lib/logic/cubit/services/services_state.dart b/lib/logic/cubit/services/services_state.dart index 07b82e45..d5aa95eb 100644 --- a/lib/logic/cubit/services/services_state.dart +++ b/lib/logic/cubit/services/services_state.dart @@ -3,11 +3,18 @@ part of 'services_cubit.dart'; class ServicesState extends ServerInstallationDependendState { const ServicesState({ required this.services, + required this.lockedServices, }); - const ServicesState.empty() : this(services: const []); + const ServicesState.empty() + : this(services: const [], lockedServices: const []); final List services; + final List lockedServices; + + bool isServiceLocked(final String serviceId) => + lockedServices.contains(serviceId); + bool get isPasswordManagerEnable => services .firstWhere( (final service) => service.id == 'bitwarden', @@ -53,6 +60,7 @@ class ServicesState extends ServerInstallationDependendState { @override List get props => [ services, + lockedServices, ]; bool isEnableByType(final ServiceTypes type) { @@ -71,4 +79,13 @@ class ServicesState extends ServerInstallationDependendState { throw Exception('wrong state'); } } + + ServicesState copyWith({ + final List? services, + final List? lockedServices, + }) => + ServicesState( + services: services ?? this.services, + lockedServices: lockedServices ?? this.lockedServices, + ); } diff --git a/lib/ui/components/jobs_content/jobs_content.dart b/lib/ui/components/jobs_content/jobs_content.dart index 58fffd74..d43a194c 100644 --- a/lib/ui/components/jobs_content/jobs_content.dart +++ b/lib/ui/components/jobs_content/jobs_content.dart @@ -126,13 +126,14 @@ class JobsContent extends StatelessWidget { const SizedBox(height: 8), const Divider(height: 0), const SizedBox(height: 8), - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - 'jobs.server_jobs'.tr(), - style: Theme.of(context).textTheme.titleMedium, + if (serverJobs.isNotEmpty) + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + 'jobs.server_jobs'.tr(), + style: Theme.of(context).textTheme.titleMedium, + ), ), - ), ...serverJobs.map( (final job) => Dismissible( key: ValueKey(job.uid), diff --git a/lib/ui/pages/more/more.dart b/lib/ui/pages/more/more.dart index eeedd4d8..2dcdd40d 100644 --- a/lib/ui/pages/more/more.dart +++ b/lib/ui/pages/more/more.dart @@ -10,7 +10,7 @@ import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart'; import 'package:selfprivacy/ui/pages/devices/devices.dart'; import 'package:selfprivacy/ui/pages/recovery_key/recovery_key.dart'; -import 'package:selfprivacy/ui/pages/server_storage/binds_migration/data_to_binds_migration.dart'; +import 'package:selfprivacy/ui/pages/server_storage/binds_migration/services_migration.dart'; import 'package:selfprivacy/ui/pages/setup/initializing.dart'; import 'package:selfprivacy/ui/pages/onboarding/onboarding.dart'; import 'package:selfprivacy/ui/pages/root_route.dart'; @@ -50,7 +50,7 @@ class MorePage extends StatelessWidget { _MoreMenuItem( title: 'providers.storage.start_migration_button'.tr(), iconData: Icons.drive_file_move_outline, - goTo: DataToBindsMigrationPage( + goTo: ServicesMigrationPage( diskStatus: context .watch() .state @@ -68,6 +68,7 @@ class MorePage extends StatelessWidget { service.id == 'nextcloud', ) .toList(), + isMigration: true, ), subtitle: 'not_ready_card.in_menu'.tr(), accent: true, diff --git a/lib/ui/pages/server_storage/binds_migration/data_to_binds_migration.dart b/lib/ui/pages/server_storage/binds_migration/services_migration.dart similarity index 87% rename from lib/ui/pages/server_storage/binds_migration/data_to_binds_migration.dart rename to lib/ui/pages/server_storage/binds_migration/services_migration.dart index c984dd5b..9783a479 100644 --- a/lib/ui/pages/server_storage/binds_migration/data_to_binds_migration.dart +++ b/lib/ui/pages/server_storage/binds_migration/services_migration.dart @@ -1,6 +1,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:selfprivacy/logic/cubit/server_jobs/server_jobs_cubit.dart'; +import 'package:selfprivacy/logic/cubit/services/services_cubit.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/logic/models/service.dart'; import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart'; @@ -15,22 +16,23 @@ import 'package:selfprivacy/ui/helpers/modals.dart'; import 'package:selfprivacy/ui/pages/root_route.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; -class DataToBindsMigrationPage extends StatefulWidget { - const DataToBindsMigrationPage({ +class ServicesMigrationPage extends StatefulWidget { + const ServicesMigrationPage({ required this.services, required this.diskStatus, + required this.isMigration, final super.key, }); final DiskStatus diskStatus; final List services; + final bool isMigration; @override - State createState() => - _DataToBindsMigrationPageState(); + State createState() => _ServicesMigrationPageState(); } -class _DataToBindsMigrationPageState extends State { +class _ServicesMigrationPageState extends State { /// Service id to target migration disk name final Map serviceToDisk = {}; @@ -164,7 +166,20 @@ class _DataToBindsMigrationPageState extends State { FilledButton( title: 'providers.storage.start_migration_button'.tr(), onPressed: () { - context.read().migrateToBinds(serviceToDisk); + if (widget.isMigration) { + context.read().migrateToBinds( + serviceToDisk, + ); + } else { + for (final service in widget.services) { + if (serviceToDisk[service.id] != null) { + context.read().moveService( + service.id, + serviceToDisk[service.id]!, + ); + } + } + } Navigator.of(context).pushAndRemoveUntil( materialRoute(const RootPage()), (final predicate) => false, diff --git a/lib/ui/pages/services/service_page.dart b/lib/ui/pages/services/service_page.dart index 82dde3dc..417f1bf2 100644 --- a/lib/ui/pages/services/service_page.dart +++ b/lib/ui/pages/services/service_page.dart @@ -9,6 +9,8 @@ import 'package:selfprivacy/logic/models/job.dart'; import 'package:selfprivacy/logic/models/service.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/pages/server_storage/binds_migration/services_migration.dart'; +import 'package:selfprivacy/utils/route_transitions/basic.dart'; import 'package:url_launcher/url_launcher.dart'; class ServicePage extends StatefulWidget { @@ -40,6 +42,9 @@ class _ServicePageState extends State { final bool serviceDisabled = service.status == ServiceStatus.inactive || service.status == ServiceStatus.off; + final bool serviceLocked = + context.watch().state.isServiceLocked(service.id); + return BrandHeroScreen( hasBackButton: true, children: [ @@ -90,6 +95,7 @@ class _ServicePageState extends State { 'services.service_page.restart'.tr(), style: Theme.of(context).textTheme.titleMedium, ), + enabled: !serviceDisabled && !serviceLocked, ), ListTile( iconColor: Theme.of(context).colorScheme.onBackground, @@ -108,11 +114,22 @@ class _ServicePageState extends State { : 'services.service_page.disable'.tr(), style: Theme.of(context).textTheme.titleMedium, ), + enabled: !serviceLocked, ), if (service.isMovable) ListTile( iconColor: Theme.of(context).colorScheme.onBackground, - onTap: () => {}, + // Open page ServicesMigrationPage + onTap: () => Navigator.of(context).push( + materialRoute( + ServicesMigrationPage( + services: [service], + diskStatus: + context.read().state.diskStatus, + isMigration: false, + ), + ), + ), leading: const Icon(Icons.drive_file_move_outlined), title: Text( 'services.service_page.move'.tr(), @@ -131,6 +148,7 @@ class _ServicePageState extends State { ), style: Theme.of(context).textTheme.bodyMedium, ), + enabled: !serviceDisabled && !serviceLocked, ), ], ); From 0425ea8ab8511ba45a1b7272e9d6bc53c8b11b35 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Mon, 19 Sep 2022 03:42:00 +0300 Subject: [PATCH 113/115] Add a button to remove all removable server jobs --- .../cubit/server_jobs/server_jobs_cubit.dart | 43 ++++++++----------- .../cubit/server_jobs/server_jobs_state.dart | 8 +++- .../components/jobs_content/jobs_content.dart | 23 ++++++++-- 3 files changed, 45 insertions(+), 29 deletions(-) diff --git a/lib/logic/cubit/server_jobs/server_jobs_cubit.dart b/lib/logic/cubit/server_jobs/server_jobs_cubit.dart index 43b2b2d5..1e808956 100644 --- a/lib/logic/cubit/server_jobs/server_jobs_cubit.dart +++ b/lib/logic/cubit/server_jobs/server_jobs_cubit.dart @@ -72,42 +72,35 @@ class ServerJobsCubit return job; } - /// Get the job object and change its isHidden to true. - /// Emit the new state. - /// Call the api to remove the job. - /// If the api call fails, change the isHidden to false and emit the new state. - /// If the api call succeeds, remove the job from the list and emit the new state. Future removeServerJob(final String uid) async { - final ServerJob? job = getServerJobByUid(uid); - if (job == null) { - return; - } - - job.isHidden = true; - emit( - ServerJobsState( - serverJobList: state.serverJobList, - ), - ); - final result = await api.removeApiJob(uid); if (!result.success) { - job.isHidden = false; - emit( - ServerJobsState( - serverJobList: state.serverJobList, - ), - ); getIt().showSnackBar(result.message!); return; } - state.serverJobList.remove(job); emit( ServerJobsState( - serverJobList: state.serverJobList, + serverJobList: [ + for (final ServerJob job in state.serverJobList) + if (job.uid != uid) job + ], ), ); + print('removed job $uid'); + } + + Future removeAllFinishedJobs() async { + final List finishedJobs = state.serverJobList + .where( + (final ServerJob job) => + job.status == JobStatusEnum.finished || + job.status == JobStatusEnum.error, + ) + .toList(); + for (final ServerJob job in finishedJobs) { + await removeServerJob(job.uid); + } } Future reload({final bool useTimer = false}) async { diff --git a/lib/logic/cubit/server_jobs/server_jobs_state.dart b/lib/logic/cubit/server_jobs/server_jobs_state.dart index cf9cb8e0..2acc487c 100644 --- a/lib/logic/cubit/server_jobs/server_jobs_state.dart +++ b/lib/logic/cubit/server_jobs/server_jobs_state.dart @@ -17,8 +17,14 @@ class ServerJobsState extends ServerInstallationDependendState { return list; } + bool get hasRemovableJobs => serverJobList.any( + (final job) => + job.status == JobStatusEnum.finished || + job.status == JobStatusEnum.error, + ); + @override - List get props => [migrationJobUid, ..._serverJobList]; + List get props => [migrationJobUid, _serverJobList]; ServerJobsState copyWith({ final List? serverJobList, diff --git a/lib/ui/components/jobs_content/jobs_content.dart b/lib/ui/components/jobs_content/jobs_content.dart index d43a194c..877770dc 100644 --- a/lib/ui/components/jobs_content/jobs_content.dart +++ b/lib/ui/components/jobs_content/jobs_content.dart @@ -23,6 +23,9 @@ class JobsContent extends StatelessWidget { final List serverJobs = context.watch().state.serverJobList; + final bool hasRemovableJobs = + context.watch().state.hasRemovableJobs; + return BlocBuilder( builder: (final context, final state) { late List widgets; @@ -129,9 +132,23 @@ class JobsContent extends StatelessWidget { if (serverJobs.isNotEmpty) Padding( padding: const EdgeInsets.all(8.0), - child: Text( - 'jobs.server_jobs'.tr(), - style: Theme.of(context).textTheme.titleMedium, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + 'jobs.server_jobs'.tr(), + style: Theme.of(context).textTheme.titleMedium, + ), + IconButton( + onPressed: hasRemovableJobs + ? () => context + .read() + .removeAllFinishedJobs() + : null, + icon: const Icon(Icons.clear_all), + color: Theme.of(context).colorScheme.onBackground, + ), + ], ), ), ...serverJobs.map( From bb6d615d37554fae474903ab1fad71d0e50a93ea Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 19 Sep 2022 03:48:59 +0300 Subject: [PATCH 114/115] Fix 'start migration button' subtitle --- lib/ui/pages/more/more.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ui/pages/more/more.dart b/lib/ui/pages/more/more.dart index 2dcdd40d..bc0468b0 100644 --- a/lib/ui/pages/more/more.dart +++ b/lib/ui/pages/more/more.dart @@ -70,7 +70,7 @@ class MorePage extends StatelessWidget { .toList(), isMigration: true, ), - subtitle: 'not_ready_card.in_menu'.tr(), + subtitle: 'providers.storage.data_migration_notice'.tr(), accent: true, ), if (!isReady) From 8d24e7f8a63897dd81314c4c5c4dbb8b2d35bdf3 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Mon, 19 Sep 2022 04:35:49 +0300 Subject: [PATCH 115/115] Bump version --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 7ea16fb3..372bd4a2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: selfprivacy description: selfprivacy.org publish_to: 'none' -version: 0.6.1+15 +version: 0.7.0+16 environment: sdk: '>=2.17.0 <3.0.0'