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/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/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 diff --git a/assets/images/pics/myprofile.png b/assets/images/pics/myprofile.png new file mode 100644 index 00000000..d1f1f3d0 Binary files /dev/null and b/assets/images/pics/myprofile.png differ diff --git a/assets/images/pics/permissions.png b/assets/images/pics/permissions.png new file mode 100644 index 00000000..4b9dd3f7 Binary files /dev/null and b/assets/images/pics/permissions.png differ diff --git a/assets/markdown/how_cloudflare-ru.md b/assets/markdown/how_cloudflare-ru.md index 7da91f77..d6cc0072 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**. diff --git a/assets/translations/en.json b/assets/translations/en.json index 46cee9b8..3c849eff 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", @@ -99,7 +100,33 @@ "chart": { "month": "Month", "day": "Day", - "hour": "Hour" + "hour": "Hour", + "cpu_title": "CPU Usage", + "network_title": "Network Usage", + "in": "In", + "out": "Out" + }, + "resource_usage": "Resource usage", + "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", + "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": { @@ -162,6 +189,28 @@ "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": "{} used", + "disk_total": "{} 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.", + "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", + "data_migration_title": "Data migration", + "data_migration_notice": "During migration all services will be turned off.", + "start_migration_button": "Start migration", + "migration_process": "Migrating...", + "migration_done": "Finish" } }, "not_ready_card": { @@ -172,8 +221,16 @@ "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": { + "open_in_browser": "Open in browser", + "restart": "Restart service", + "disable": "Disable service", + "enable": "Enable service", + "move": "Move to another volume", + "uses": "Uses {usage} on {volume}" + }, "mail": { "title": "E-Mail", "subtitle": "E-Mail for company and family.", @@ -237,12 +294,22 @@ "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": { "_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", @@ -252,13 +319,24 @@ "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_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", + "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", "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", @@ -275,13 +353,14 @@ "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.", "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", @@ -373,8 +452,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", @@ -408,7 +489,9 @@ "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", + "resetUserPassword": "Reset password of user" }, "validations": { "required": "Required.", diff --git a/assets/translations/ru.json b/assets/translations/ru.json index 68665e26..ce2d6231 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": "Настройки приложения", @@ -99,7 +100,35 @@ "chart": { "month": "Месяц", "day": "День", - "hour": "Час" + "hour": "Час", + "cpu_title": "Использование процессора", + "network_title": "Использование сети", + "in": "Получено", + "out": "Отправлено" + }, + "settings": { + "allow_autoupgrade": "Разрешить авто-обноления", + "allow_autoupgrade_hint": "Разрешить автоматичесую установку обновлений на сервер", + "reboot_after_upgrade": "Перезагружать после обновлений", + "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": { @@ -162,7 +191,28 @@ "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. Сервер будет перезагружен во время процесса.", + "extending_volume_error": "Не удалось начать расширение хранилища.", + "size": "Размер", + "euro": "Евро", + "data_migration_title": "Миграция данных", + "data_migration_notice": "На время миграции данных все сервисы будут выключены.", + "start_migration_button": "Начать миграцию", + "migration_process": "Мигрируем...", + "migration_done": "Завершить" } }, "not_ready_card": { @@ -175,6 +225,14 @@ "services": { "_comment": "Вкладка сервисы", "title": "Ваши личные, приватные и независимые сервисы:", + "service_page": { + "open_in_browser": "Открыть в браузере", + "restart": "Перезапустить сервис", + "disable": "Выключить сервис", + "enable": "Включить сервис", + "move": "Переместить на другой диск", + "uses": "Использует {usage} на {volume}" + }, "mail": { "title": "Почта", "subtitle": "Электронная почта для семьи или компании.", @@ -238,6 +296,15 @@ "bottom_sheet": { "1": "Создать подключиться к VPN-серверу. Движок для безопасной и масштабируемой инфраструктуры VPN" } + }, + "page": { + "up_and_running": "Запущен и работает", + "resource_usage": "Потребление ресурсов", + "disk_used": "{} использовано места на диске", + "users": "Пользователи", + "controlled_by": "Контролируется {}", + "apps": "Приложения", + "settings": "Настройки" } }, "users": { @@ -260,6 +327,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", @@ -318,6 +388,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", @@ -371,8 +445,10 @@ }, "modals": { "_comment": "messages in modals", - "1": "Сервер с таким именем уже существует", + "1": "Сервер с таким именем уже существует.", + "1.1": "Непредвиденная ошибка при создании со стороны провайдера.", "2": "Уничтожить сервер и создать новый?", + "2.2": "Попробовать ещё раз?", "3": "Подтвердите", "4": "Сбросить все ключи?", "5": "Да, сбросить", @@ -406,7 +482,9 @@ "upgradeServer": "Обновить сервер", "rebootServer": "Перезагрузить сервер", "create_ssh_key": "Создать SSH ключ для {}", - "delete_ssh_key": "Удалить SSH ключ для {}" + "delete_ssh_key": "Удалить SSH ключ для {}", + "server_jobs": "Задачи на сервере", + "resetUserPassword": "Сбросить пароль пользователя" }, "validations": { "required": "Обязательное поле.", diff --git a/build.yaml b/build.yaml index 709b623e..993e8dd4 100644 --- a/build.yaml +++ b/build.yaml @@ -1,7 +1,17 @@ targets: $default: builders: + graphql_codegen: + options: + scalars: + DateTime: + type: DateTime + fromJsonFunctionName: dateTimeFromJson + toJsonFunctionName: dateTimeToJson + import: package:selfprivacy/utils/scalars.dart + clients: + - graphql json_serializable: options: create_factory: true - create_to_json: false \ No newline at end of file + create_to_json: true 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 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 diff --git a/lib/config/bloc_config.dart b/lib/config/bloc_config.dart index 3946d3b9..b88b21d7 100644 --- a/lib/config/bloc_config.dart +++ b/lib/config/bloc_config.dart @@ -2,14 +2,18 @@ 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'; 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'; +import 'package:selfprivacy/logic/cubit/provider_volumes/provider_volume_cubit.dart'; class BlocAndProviderConfig extends StatelessWidget { const BlocAndProviderConfig({final super.key, this.child}); @@ -26,6 +30,12 @@ class BlocAndProviderConfig extends StatelessWidget { final dnsRecordsCubit = DnsRecordsCubit(serverInstallationCubit); final recoveryKeyCubit = RecoveryKeyCubit(serverInstallationCubit); final apiDevicesCubit = ApiDevicesCubit(serverInstallationCubit); + final apiVolumesCubit = ApiProviderVolumeCubit(serverInstallationCubit); + final apiServerVolumesCubit = + ApiServerVolumeCubit(serverInstallationCubit, apiVolumesCubit); + final serverJobsCubit = ServerJobsCubit(serverInstallationCubit); + final serverDetailsCubit = ServerDetailsCubit(serverInstallationCubit); + return MultiProvider( providers: [ BlocProvider( @@ -38,7 +48,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, @@ -61,8 +73,22 @@ class BlocAndProviderConfig extends StatelessWidget { create: (final _) => apiDevicesCubit..load(), ), BlocProvider( - create: (final _) => - JobsCubit(usersCubit: usersCubit, servicesCubit: servicesCubit), + create: (final _) => apiVolumesCubit..load(), + ), + BlocProvider( + create: (final _) => apiServerVolumesCubit..load(), + ), + BlocProvider( + create: (final _) => serverJobsCubit..load(), + ), + BlocProvider( + create: (final _) => serverDetailsCubit..load(), + ), + BlocProvider( + create: (final _) => JobsCubit( + usersCubit: usersCubit, + servicesCubit: servicesCubit, + ), ), ], child: child, diff --git a/lib/config/bloc_observer.dart b/lib/config/bloc_observer.dart index e68923c9..d8bf846a 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,8 @@ 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/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); 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..c01f1837 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/api_map.dart @@ -0,0 +1,55 @@ +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:selfprivacy/config/get_it_config.dart'; + +abstract class ApiMap { + Future getClient() async { + final httpLink = HttpLink( + 'https://api.$rootAddress/graphql', + ); + + final String token = _getApiToken(); + + final Link graphQLLink = isWithToken + ? AuthLink( + getToken: () async => + customToken == '' ? 'Bearer $token' : customToken, + ).concat(httpLink) + : httpLink; + + return GraphQLClient( + cache: GraphQLCache(), + link: graphQLLink, + ); + } + + 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; + 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..a5947f5e --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql @@ -0,0 +1,69 @@ +fragment basicMutationReturnFields on MutationReturnInterface{ + code + message + success +} + +query GetServerDiskVolumes { + storage { + volumes { + freeSpace + model + name + root + serial + totalSpace + type + usages { + title + usedSpace + __typename + ... on ServiceStorageUsage { + service { + id + isMovable + displayName + } + } + } + usedSpace + } + } +} + +mutation MountVolume($name: String!) { + mountVolume(name: $name) { + ...basicMutationReturnFields + } +} + +mutation ResizeVolume($name: String!) { + resizeVolume(name: $name) { + ...basicMutationReturnFields + } +} + +mutation UnmountVolume($name: String!) { + unmountVolume(name: $name) { + ...basicMutationReturnFields + } +} + +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 new file mode 100644 index 00000000..b7d6acac --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart @@ -0,0 +1,3295 @@ +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 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 { + 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( + 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; + return Object.hashAll([l$storage, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$GetServerDiskVolumes) || + runtimeType != other.runtimeType) return false; + final l$storage = storage; + final lOther$storage = other.storage; + if (l$storage != lOther$storage) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$GetServerDiskVolumes + on Query$GetServerDiskVolumes { + 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: [ + OperationDefinitionNode( + type: OperationType.query, + name: NameNode(value: 'GetServerDiskVolumes'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'storage'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'volumes'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'freeSpace'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'model'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'name'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'root'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'serial'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'totalSpace'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'type'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'usages'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'title'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'usedSpace'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + InlineFragmentNode( + typeCondition: TypeConditionNode( + on: NamedTypeNode( + name: NameNode( + value: 'ServiceStorageUsage'), + isNonNull: false)), + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'service'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'id'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'isMovable'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'displayName'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])) + ])), + FieldNode( + name: NameNode(value: 'usedSpace'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: '__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$GetServerDiskVolumes _parserFn$Query$GetServerDiskVolumes( + Map data) => + Query$GetServerDiskVolumes.fromJson(data); + +class Options$Query$GetServerDiskVolumes + extends graphql.QueryOptions { + Options$Query$GetServerDiskVolumes( + {String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Duration? pollInterval, + graphql.Context? context}) + : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + pollInterval: pollInterval, + context: context, + document: documentNodeQueryGetServerDiskVolumes, + parserFn: _parserFn$Query$GetServerDiskVolumes); +} + +class WatchOptions$Query$GetServerDiskVolumes + extends graphql.WatchQueryOptions { + WatchOptions$Query$GetServerDiskVolumes( + {String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false}) + : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeQueryGetServerDiskVolumes, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Query$GetServerDiskVolumes); +} + +class FetchMoreOptions$Query$GetServerDiskVolumes + extends graphql.FetchMoreOptions { + FetchMoreOptions$Query$GetServerDiskVolumes( + {required graphql.UpdateQuery updateQuery}) + : super( + updateQuery: updateQuery, + document: documentNodeQueryGetServerDiskVolumes); +} + +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: documentNodeQueryGetServerDiskVolumes)), + data: data.toJson(), + broadcast: broadcast); + Query$GetServerDiskVolumes? readQuery$GetServerDiskVolumes( + {bool optimistic = true}) { + final result = this.readQuery( + graphql.Request( + operation: graphql.Operation( + document: documentNodeQueryGetServerDiskVolumes)), + optimistic: optimistic); + return result == null ? null : Query$GetServerDiskVolumes.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$GetServerDiskVolumes$storage { + Query$GetServerDiskVolumes$storage( + {required this.volumes, required this.$__typename}); + + @override + factory Query$GetServerDiskVolumes$storage.fromJson( + Map json) => + _$Query$GetServerDiskVolumes$storageFromJson(json); + + final List volumes; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Query$GetServerDiskVolumes$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$GetServerDiskVolumes$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$GetServerDiskVolumes$storage + on Query$GetServerDiskVolumes$storage { + 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}) => + _res; + volumes(_fn) => _res; +} + +@JsonSerializable(explicitToJson: true) +class Query$GetServerDiskVolumes$storage$volumes { + Query$GetServerDiskVolumes$storage$volumes( + {required this.freeSpace, + this.model, + required this.name, + required this.root, + this.serial, + required this.totalSpace, + required this.type, + required this.usages, + required this.usedSpace, + required this.$__typename}); + + @override + factory Query$GetServerDiskVolumes$storage$volumes.fromJson( + Map json) => + _$Query$GetServerDiskVolumes$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 List usages; + + final String usedSpace; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Query$GetServerDiskVolumes$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$usages = usages; + 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, + Object.hashAll(l$usages.map((v) => v)), + l$usedSpace, + l$$__typename + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$GetServerDiskVolumes$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$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; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$GetServerDiskVolumes$storage$volumes + on Query$GetServerDiskVolumes$storage$volumes { + CopyWith$Query$GetServerDiskVolumes$storage$volumes< + Query$GetServerDiskVolumes$storage$volumes> + get copyWith => + CopyWith$Query$GetServerDiskVolumes$storage$volumes(this, (i) => i); +} + +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? model, + String? name, + bool? root, + String? serial, + String? totalSpace, + String? type, + List? usages, + String? usedSpace, + String? $__typename}) => + _res; + usages(_fn) => _res; +} + +@JsonSerializable(explicitToJson: true) +class Query$GetServerDiskVolumes$storage$volumes$usages { + Query$GetServerDiskVolumes$storage$volumes$usages( + {required this.title, + required this.usedSpace, + required this.$__typename}); + + @override + factory Query$GetServerDiskVolumes$storage$volumes$usages.fromJson( + Map json) { + switch (json["__typename"] as String) { + case "ServiceStorageUsage": + return Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage + .fromJson(json); + default: + return _$Query$GetServerDiskVolumes$storage$volumes$usagesFromJson( + json); + } + } + + final 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 { + 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) +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) => + _$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 { + 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? + 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) +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 { + 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 == _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) +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$MountVolumeToJson(this); + int get hashCode { + final l$name = name; + return Object.hashAll([l$name]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Variables$Mutation$MountVolume) || + runtimeType != other.runtimeType) return false; + final l$name = name; + final lOther$name = other.name; + if (l$name != lOther$name) return false; + return true; + } + + CopyWith$Variables$Mutation$MountVolume + get copyWith => CopyWith$Variables$Mutation$MountVolume(this, (i) => i); +} + +abstract class CopyWith$Variables$Mutation$MountVolume { + factory CopyWith$Variables$Mutation$MountVolume( + Variables$Mutation$MountVolume instance, + TRes Function(Variables$Mutation$MountVolume) then) = + _CopyWithImpl$Variables$Mutation$MountVolume; + + 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) +class Mutation$MountVolume { + Mutation$MountVolume({required this.mountVolume, required this.$__typename}); + + @override + factory Mutation$MountVolume.fromJson(Map json) => + _$Mutation$MountVolumeFromJson(json); + + final Mutation$MountVolume$mountVolume mountVolume; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$MountVolumeToJson(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$MountVolume) || 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$MountVolume on Mutation$MountVolume { + 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: [ + OperationDefinitionNode( + type: OperationType.mutation, + name: NameNode(value: 'MountVolume'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'name')), + type: + NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), + defaultValue: DefaultValueNode(value: null), + directives: []) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'mountVolume'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'name'), + value: VariableNode(name: NameNode(value: 'name'))) + ], + 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$MountVolume _parserFn$Mutation$MountVolume( + Map data) => + Mutation$MountVolume.fromJson(data); +typedef OnMutationCompleted$Mutation$MountVolume = FutureOr Function( + dynamic, Mutation$MountVolume?); + +class Options$Mutation$MountVolume + extends graphql.MutationOptions { + Options$Mutation$MountVolume( + {String? operationName, + required Variables$Mutation$MountVolume variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$MountVolume? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError}) + : onCompletedWithParsed = onCompleted, + super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted(data, + data == null ? null : _parserFn$Mutation$MountVolume(data)), + update: update, + onError: onError, + document: documentNodeMutationMountVolume, + parserFn: _parserFn$Mutation$MountVolume); + + final OnMutationCompleted$Mutation$MountVolume? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + onCompletedWithParsed + ]; +} + +class WatchOptions$Mutation$MountVolume + extends graphql.WatchQueryOptions { + WatchOptions$Mutation$MountVolume( + {String? operationName, + required Variables$Mutation$MountVolume variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false}) + : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationMountVolume, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$MountVolume); +} + +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$MountVolume$mountVolume + implements Fragment$basicMutationReturnFields { + Mutation$MountVolume$mountVolume( + {required this.code, + required this.message, + required this.success, + required this.$__typename}); + + @override + factory Mutation$MountVolume$mountVolume.fromJson( + Map json) => + _$Mutation$MountVolume$mountVolumeFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$MountVolume$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$MountVolume$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$MountVolume$mountVolume + on Mutation$MountVolume$mountVolume { + 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) +class Variables$Mutation$ResizeVolume { + Variables$Mutation$ResizeVolume({required this.name}); + + @override + factory Variables$Mutation$ResizeVolume.fromJson(Map json) => + _$Variables$Mutation$ResizeVolumeFromJson(json); + + final String name; + + Map toJson() => + _$Variables$Mutation$ResizeVolumeToJson(this); + int get hashCode { + final l$name = name; + return Object.hashAll([l$name]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Variables$Mutation$ResizeVolume) || + runtimeType != other.runtimeType) return false; + final l$name = name; + final lOther$name = other.name; + if (l$name != lOther$name) return false; + return true; + } + + CopyWith$Variables$Mutation$ResizeVolume + get copyWith => CopyWith$Variables$Mutation$ResizeVolume(this, (i) => i); +} + +abstract class CopyWith$Variables$Mutation$ResizeVolume { + factory CopyWith$Variables$Mutation$ResizeVolume( + Variables$Mutation$ResizeVolume instance, + TRes Function(Variables$Mutation$ResizeVolume) then) = + _CopyWithImpl$Variables$Mutation$ResizeVolume; + + 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) +class Mutation$ResizeVolume { + Mutation$ResizeVolume( + {required this.resizeVolume, required this.$__typename}); + + @override + factory Mutation$ResizeVolume.fromJson(Map json) => + _$Mutation$ResizeVolumeFromJson(json); + + final Mutation$ResizeVolume$resizeVolume resizeVolume; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$ResizeVolumeToJson(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$ResizeVolume) || 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$ResizeVolume on Mutation$ResizeVolume { + 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}) => + _res; + CopyWith$Mutation$ResizeVolume$resizeVolume get resizeVolume => + CopyWith$Mutation$ResizeVolume$resizeVolume.stub(_res); +} + +const documentNodeMutationResizeVolume = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.mutation, + name: NameNode(value: 'ResizeVolume'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'name')), + type: + NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), + defaultValue: DefaultValueNode(value: null), + directives: []) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'resizeVolume'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'name'), + value: VariableNode(name: NameNode(value: 'name'))) + ], + 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$ResizeVolume _parserFn$Mutation$ResizeVolume( + Map data) => + Mutation$ResizeVolume.fromJson(data); +typedef OnMutationCompleted$Mutation$ResizeVolume = FutureOr Function( + dynamic, Mutation$ResizeVolume?); + +class Options$Mutation$ResizeVolume + extends graphql.MutationOptions { + Options$Mutation$ResizeVolume( + {String? operationName, + required Variables$Mutation$ResizeVolume variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$ResizeVolume? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError}) + : onCompletedWithParsed = onCompleted, + 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$ResizeVolume(data)), + update: update, + onError: onError, + document: documentNodeMutationResizeVolume, + parserFn: _parserFn$Mutation$ResizeVolume); + + final OnMutationCompleted$Mutation$ResizeVolume? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + onCompletedWithParsed + ]; +} + +class WatchOptions$Mutation$ResizeVolume + extends graphql.WatchQueryOptions { + WatchOptions$Mutation$ResizeVolume( + {String? operationName, + required Variables$Mutation$ResizeVolume variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false}) + : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationResizeVolume, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$ResizeVolume); +} + +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$ResizeVolume$resizeVolume + implements Fragment$basicMutationReturnFields { + Mutation$ResizeVolume$resizeVolume( + {required this.code, + required this.message, + required this.success, + required this.$__typename}); + + @override + factory Mutation$ResizeVolume$resizeVolume.fromJson( + Map json) => + _$Mutation$ResizeVolume$resizeVolumeFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$ResizeVolume$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$ResizeVolume$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$ResizeVolume$resizeVolume + on Mutation$ResizeVolume$resizeVolume { + 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) +class Variables$Mutation$UnmountVolume { + Variables$Mutation$UnmountVolume({required this.name}); + + @override + factory Variables$Mutation$UnmountVolume.fromJson( + Map json) => + _$Variables$Mutation$UnmountVolumeFromJson(json); + + final String name; + + Map toJson() => + _$Variables$Mutation$UnmountVolumeToJson(this); + int get hashCode { + final l$name = name; + return Object.hashAll([l$name]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Variables$Mutation$UnmountVolume) || + runtimeType != other.runtimeType) return false; + final l$name = name; + final lOther$name = other.name; + if (l$name != lOther$name) return false; + return true; + } + + CopyWith$Variables$Mutation$UnmountVolume + get copyWith => CopyWith$Variables$Mutation$UnmountVolume(this, (i) => i); +} + +abstract class CopyWith$Variables$Mutation$UnmountVolume { + factory CopyWith$Variables$Mutation$UnmountVolume( + Variables$Mutation$UnmountVolume instance, + TRes Function(Variables$Mutation$UnmountVolume) then) = + _CopyWithImpl$Variables$Mutation$UnmountVolume; + + 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) +class Mutation$UnmountVolume { + Mutation$UnmountVolume( + {required this.unmountVolume, required this.$__typename}); + + @override + factory Mutation$UnmountVolume.fromJson(Map json) => + _$Mutation$UnmountVolumeFromJson(json); + + final Mutation$UnmountVolume$unmountVolume unmountVolume; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Mutation$UnmountVolumeToJson(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$UnmountVolume) || 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$UnmountVolume on Mutation$UnmountVolume { + 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}) => + _res; + CopyWith$Mutation$UnmountVolume$unmountVolume get unmountVolume => + CopyWith$Mutation$UnmountVolume$unmountVolume.stub(_res); +} + +const documentNodeMutationUnmountVolume = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.mutation, + name: NameNode(value: 'UnmountVolume'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'name')), + type: + NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), + defaultValue: DefaultValueNode(value: null), + directives: []) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'unmountVolume'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'name'), + value: VariableNode(name: NameNode(value: 'name'))) + ], + 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$UnmountVolume _parserFn$Mutation$UnmountVolume( + Map data) => + Mutation$UnmountVolume.fromJson(data); +typedef OnMutationCompleted$Mutation$UnmountVolume = FutureOr Function( + dynamic, Mutation$UnmountVolume?); + +class Options$Mutation$UnmountVolume + extends graphql.MutationOptions { + Options$Mutation$UnmountVolume( + {String? operationName, + required Variables$Mutation$UnmountVolume variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$UnmountVolume? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError}) + : onCompletedWithParsed = onCompleted, + 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$UnmountVolume(data)), + update: update, + onError: onError, + document: documentNodeMutationUnmountVolume, + parserFn: _parserFn$Mutation$UnmountVolume); + + final OnMutationCompleted$Mutation$UnmountVolume? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + onCompletedWithParsed + ]; +} + +class WatchOptions$Mutation$UnmountVolume + extends graphql.WatchQueryOptions { + WatchOptions$Mutation$UnmountVolume( + {String? operationName, + required Variables$Mutation$UnmountVolume variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false}) + : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationUnmountVolume, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$UnmountVolume); +} + +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$UnmountVolume$unmountVolume + implements Fragment$basicMutationReturnFields { + Mutation$UnmountVolume$unmountVolume( + {required this.code, + required this.message, + required this.success, + required this.$__typename}); + + @override + factory Mutation$UnmountVolume$unmountVolume.fromJson( + Map json) => + _$Mutation$UnmountVolume$unmountVolumeFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => + _$Mutation$UnmountVolume$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$UnmountVolume$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$UnmountVolume$unmountVolume + on Mutation$UnmountVolume$unmountVolume { + 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) +class Variables$Mutation$MigrateToBinds { + Variables$Mutation$MigrateToBinds({required this.input}); + + @override + factory Variables$Mutation$MigrateToBinds.fromJson( + Map json) => + _$Variables$Mutation$MigrateToBindsFromJson(json); + + final Input$MigrateToBindsInput input; + + Map toJson() => + _$Variables$Mutation$MigrateToBindsToJson(this); + int get hashCode { + final l$input = input; + return Object.hashAll([l$input]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Variables$Mutation$MigrateToBinds) || + runtimeType != other.runtimeType) return false; + final l$input = input; + final lOther$input = other.input; + if (l$input != lOther$input) return false; + return true; + } + + CopyWith$Variables$Mutation$MigrateToBinds + get copyWith => + CopyWith$Variables$Mutation$MigrateToBinds(this, (i) => i); +} + +abstract class CopyWith$Variables$Mutation$MigrateToBinds { + factory CopyWith$Variables$Mutation$MigrateToBinds( + Variables$Mutation$MigrateToBinds instance, + TRes Function(Variables$Mutation$MigrateToBinds) then) = + _CopyWithImpl$Variables$Mutation$MigrateToBinds; + + 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) +class Mutation$MigrateToBinds { + Mutation$MigrateToBinds( + {required this.migrateToBinds, required this.$__typename}); + + @override + factory Mutation$MigrateToBinds.fromJson(Map json) => + _$Mutation$MigrateToBindsFromJson(json); + + final Mutation$MigrateToBinds$migrateToBinds migrateToBinds; + + @JsonKey(name: '__typename') + final String $__typename; + + 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; + } +} + +extension UtilityExtension$Mutation$MigrateToBinds on Mutation$MigrateToBinds { + 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}) => + _res; + CopyWith$Mutation$MigrateToBinds$migrateToBinds get migrateToBinds => + CopyWith$Mutation$MigrateToBinds$migrateToBinds.stub(_res); +} + +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 { + 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? job}) => + _res; + CopyWith$Mutation$MigrateToBinds$migrateToBinds$job get job => + CopyWith$Mutation$MigrateToBinds$migrateToBinds$job.stub(_res); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$MigrateToBinds$migrateToBinds$job { + Mutation$MigrateToBinds$migrateToBinds$job( + {required this.createdAt, + required this.description, + this.error, + this.finishedAt, + required this.name, + this.progress, + this.result, + required this.status, + this.statusText, + required this.uid, + required this.updatedAt, + required this.$__typename}); + + @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 { + 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? error, + DateTime? finishedAt, + String? name, + int? progress, + String? result, + String? status, + String? statusText, + String? uid, + DateTime? updatedAt, + String? $__typename}) => + _res; +} + +DateTime? _nullable$dateTimeFromJson(dynamic data) => + data == null ? null : dateTimeFromJson(data); +dynamic _nullable$dateTimeToJson(DateTime? data) => + data == null ? null : dateTimeToJson(data); diff --git a/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.g.dart b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.g.dart new file mode 100644 index 00000000..c1ab4fba --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.g.dart @@ -0,0 +1,376 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'disk_volumes.graphql.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Fragment$basicMutationReturnFields _$Fragment$basicMutationReturnFieldsFromJson( + Map json) => + Fragment$basicMutationReturnFields( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + ); + +Map _$Fragment$basicMutationReturnFieldsToJson( + Fragment$basicMutationReturnFields instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + }; + +Query$GetServerDiskVolumes _$Query$GetServerDiskVolumesFromJson( + Map json) => + Query$GetServerDiskVolumes( + storage: Query$GetServerDiskVolumes$storage.fromJson( + json['storage'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Query$GetServerDiskVolumesToJson( + Query$GetServerDiskVolumes instance) => + { + 'storage': instance.storage.toJson(), + '__typename': instance.$__typename, + }; + +Query$GetServerDiskVolumes$storage _$Query$GetServerDiskVolumes$storageFromJson( + Map json) => + Query$GetServerDiskVolumes$storage( + volumes: (json['volumes'] as List) + .map((e) => Query$GetServerDiskVolumes$storage$volumes.fromJson( + e as Map)) + .toList(), + $__typename: json['__typename'] as String, + ); + +Map _$Query$GetServerDiskVolumes$storageToJson( + Query$GetServerDiskVolumes$storage instance) => + { + 'volumes': instance.volumes.map((e) => e.toJson()).toList(), + '__typename': instance.$__typename, + }; + +Query$GetServerDiskVolumes$storage$volumes + _$Query$GetServerDiskVolumes$storage$volumesFromJson( + Map json) => + Query$GetServerDiskVolumes$storage$volumes( + freeSpace: json['freeSpace'] as String, + model: json['model'] as String?, + name: json['name'] as String, + root: json['root'] as bool, + serial: json['serial'] as String?, + totalSpace: json['totalSpace'] as String, + type: json['type'] as String, + usages: (json['usages'] as List) + .map((e) => + Query$GetServerDiskVolumes$storage$volumes$usages.fromJson( + e as Map)) + .toList(), + usedSpace: json['usedSpace'] as String, + $__typename: json['__typename'] as String, + ); + +Map _$Query$GetServerDiskVolumes$storage$volumesToJson( + Query$GetServerDiskVolumes$storage$volumes instance) => + { + 'freeSpace': instance.freeSpace, + 'model': instance.model, + 'name': instance.name, + 'root': instance.root, + 'serial': instance.serial, + 'totalSpace': instance.totalSpace, + 'type': instance.type, + 'usages': instance.usages.map((e) => e.toJson()).toList(), + 'usedSpace': instance.usedSpace, + '__typename': instance.$__typename, + }; + +Query$GetServerDiskVolumes$storage$volumes$usages + _$Query$GetServerDiskVolumes$storage$volumes$usagesFromJson( + Map json) => + Query$GetServerDiskVolumes$storage$volumes$usages( + title: json['title'] as String, + usedSpace: json['usedSpace'] as String, + $__typename: json['__typename'] as String, + ); + +Map _$Query$GetServerDiskVolumes$storage$volumes$usagesToJson( + Query$GetServerDiskVolumes$storage$volumes$usages instance) => + { + 'title': instance.title, + 'usedSpace': instance.usedSpace, + '__typename': instance.$__typename, + }; + +Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage + _$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsageFromJson( + Map json) => + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage( + title: json['title'] as String, + usedSpace: json['usedSpace'] as String, + $__typename: json['__typename'] as String, + service: json['service'] == null + ? null + : Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service + .fromJson(json['service'] as Map), + ); + +Map + _$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsageToJson( + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage + instance) => + { + 'title': instance.title, + 'usedSpace': instance.usedSpace, + '__typename': instance.$__typename, + 'service': instance.service?.toJson(), + }; + +Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service + _$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$serviceFromJson( + Map json) => + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service( + id: json['id'] as String, + isMovable: json['isMovable'] as bool, + displayName: json['displayName'] as String, + $__typename: json['__typename'] as String, + ); + +Map + _$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$serviceToJson( + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service + instance) => + { + 'id': instance.id, + 'isMovable': instance.isMovable, + 'displayName': instance.displayName, + '__typename': instance.$__typename, + }; + +Variables$Mutation$MountVolume _$Variables$Mutation$MountVolumeFromJson( + Map json) => + Variables$Mutation$MountVolume( + name: json['name'] as String, + ); + +Map _$Variables$Mutation$MountVolumeToJson( + Variables$Mutation$MountVolume instance) => + { + 'name': instance.name, + }; + +Mutation$MountVolume _$Mutation$MountVolumeFromJson( + Map json) => + Mutation$MountVolume( + mountVolume: Mutation$MountVolume$mountVolume.fromJson( + json['mountVolume'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$MountVolumeToJson( + Mutation$MountVolume instance) => + { + 'mountVolume': instance.mountVolume.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$MountVolume$mountVolume _$Mutation$MountVolume$mountVolumeFromJson( + Map json) => + Mutation$MountVolume$mountVolume( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$MountVolume$mountVolumeToJson( + Mutation$MountVolume$mountVolume instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + }; + +Variables$Mutation$ResizeVolume _$Variables$Mutation$ResizeVolumeFromJson( + Map json) => + Variables$Mutation$ResizeVolume( + name: json['name'] as String, + ); + +Map _$Variables$Mutation$ResizeVolumeToJson( + Variables$Mutation$ResizeVolume instance) => + { + 'name': instance.name, + }; + +Mutation$ResizeVolume _$Mutation$ResizeVolumeFromJson( + Map json) => + Mutation$ResizeVolume( + resizeVolume: Mutation$ResizeVolume$resizeVolume.fromJson( + json['resizeVolume'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$ResizeVolumeToJson( + Mutation$ResizeVolume instance) => + { + 'resizeVolume': instance.resizeVolume.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$ResizeVolume$resizeVolume _$Mutation$ResizeVolume$resizeVolumeFromJson( + Map json) => + Mutation$ResizeVolume$resizeVolume( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$ResizeVolume$resizeVolumeToJson( + Mutation$ResizeVolume$resizeVolume instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + }; + +Variables$Mutation$UnmountVolume _$Variables$Mutation$UnmountVolumeFromJson( + Map json) => + Variables$Mutation$UnmountVolume( + name: json['name'] as String, + ); + +Map _$Variables$Mutation$UnmountVolumeToJson( + Variables$Mutation$UnmountVolume instance) => + { + 'name': instance.name, + }; + +Mutation$UnmountVolume _$Mutation$UnmountVolumeFromJson( + Map json) => + Mutation$UnmountVolume( + unmountVolume: Mutation$UnmountVolume$unmountVolume.fromJson( + json['unmountVolume'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$UnmountVolumeToJson( + Mutation$UnmountVolume instance) => + { + 'unmountVolume': instance.unmountVolume.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$UnmountVolume$unmountVolume + _$Mutation$UnmountVolume$unmountVolumeFromJson(Map json) => + Mutation$UnmountVolume$unmountVolume( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$UnmountVolume$unmountVolumeToJson( + Mutation$UnmountVolume$unmountVolume instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + }; + +Variables$Mutation$MigrateToBinds _$Variables$Mutation$MigrateToBindsFromJson( + Map json) => + Variables$Mutation$MigrateToBinds( + input: Input$MigrateToBindsInput.fromJson( + json['input'] as Map), + ); + +Map _$Variables$Mutation$MigrateToBindsToJson( + Variables$Mutation$MigrateToBinds instance) => + { + 'input': instance.input.toJson(), + }; + +Mutation$MigrateToBinds _$Mutation$MigrateToBindsFromJson( + Map json) => + Mutation$MigrateToBinds( + migrateToBinds: Mutation$MigrateToBinds$migrateToBinds.fromJson( + json['migrateToBinds'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$MigrateToBindsToJson( + Mutation$MigrateToBinds instance) => + { + 'migrateToBinds': instance.migrateToBinds.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$MigrateToBinds$migrateToBinds + _$Mutation$MigrateToBinds$migrateToBindsFromJson( + Map json) => + Mutation$MigrateToBinds$migrateToBinds( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + job: json['job'] == null + ? null + : Mutation$MigrateToBinds$migrateToBinds$job.fromJson( + json['job'] as Map), + ); + +Map _$Mutation$MigrateToBinds$migrateToBindsToJson( + Mutation$MigrateToBinds$migrateToBinds instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + 'job': instance.job?.toJson(), + }; + +Mutation$MigrateToBinds$migrateToBinds$job + _$Mutation$MigrateToBinds$migrateToBinds$jobFromJson( + Map json) => + Mutation$MigrateToBinds$migrateToBinds$job( + createdAt: dateTimeFromJson(json['createdAt']), + description: json['description'] as String, + error: json['error'] as String?, + finishedAt: _nullable$dateTimeFromJson(json['finishedAt']), + name: json['name'] as String, + progress: json['progress'] as int?, + result: json['result'] as String?, + status: json['status'] as String, + statusText: json['statusText'] as String?, + uid: json['uid'] as String, + updatedAt: dateTimeFromJson(json['updatedAt']), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$MigrateToBinds$migrateToBinds$jobToJson( + Mutation$MigrateToBinds$migrateToBinds$job instance) => + { + 'createdAt': dateTimeToJson(instance.createdAt), + 'description': instance.description, + 'error': instance.error, + 'finishedAt': _nullable$dateTimeToJson(instance.finishedAt), + 'name': instance.name, + 'progress': instance.progress, + 'result': instance.result, + 'status': instance.status, + 'statusText': instance.statusText, + 'uid': instance.uid, + 'updatedAt': dateTimeToJson(instance.updatedAt), + '__typename': instance.$__typename, + }; diff --git a/lib/logic/api_maps/graphql_maps/schema/schema.graphql b/lib/logic/api_maps/graphql_maps/schema/schema.graphql new file mode 100644 index 00000000..2f60c969 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql @@ -0,0 +1,351 @@ +type Alert { + message: String! + severity: Severity! + timestamp: DateTime + title: String! +} + +type Api { + devices: [ApiDevice!]! + recoveryKey: ApiRecoveryKeyStatus! + version: String! +} + +type ApiDevice { + 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 { + code: Int! + key: String + message: String! + success: Boolean! +} + +type ApiRecoveryKeyStatus { + creationDate: DateTime + exists: Boolean! + expirationDate: DateTime + usesLeft: Int + valid: Boolean! +} + +type AutoUpgradeOptions { + allowReboot: Boolean! + enable: Boolean! +} + +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 +} + +enum DnsProvider { + CLOUDFLARE +} + +type DnsRecord { + content: String! + name: String! + priority: Int + recordType: String! + ttl: Int! +} + +type GenericJobButationReturn implements MutationReturnInterface { + code: Int! + job: ApiJob + message: String! + success: Boolean! +} + +type GenericMutationReturn implements MutationReturnInterface { + 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 { + addSshKey(sshInput: SshMutationInput!): UserMutationReturn! + authorizeWithNewDeviceApiKey(input: UseNewDeviceKeyInput!): DeviceApiTokenMutationReturn! + 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 { + code: Int! + message: String! + success: Boolean! +} + +type Query { + api: Api! + jobs: Job! + services: Services! + storage: Storage! + system: System! + users: Users! +} + +input RecoveryKeyLimitsInput { + 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 { + CRITICAL + ERROR + INFO + SUCCESS + WARNING +} + +input SshMutationInput { + username: String! + sshKey: String! +} + +type SshSettings { + enable: Boolean! + passwordAuthentication: Boolean! + 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 { + busy: Boolean! + domainInfo: SystemDomainInfo! + info: SystemInfo! + provider: SystemProviderInfo! + settings: SystemSettings! + status: Alert! + workingDirectory: String! +} + +type SystemDomainInfo { + domain: String! + hostname: String! + provider: DnsProvider! + requiredDnsRecords: [DnsRecord!]! +} + +type SystemInfo { + pythonVersion: String! + systemVersion: String! + usingBinds: Boolean! +} + +type SystemProviderInfo { + id: String! + provider: ServerProvider! +} + +type SystemSettings { + autoUpgrade: AutoUpgradeOptions! + ssh: SshSettings! + timezone: String! +} + +type TimezoneMutationReturn implements MutationReturnInterface { + code: Int! + message: String! + success: Boolean! + timezone: String +} + +input UseNewDeviceKeyInput { + key: String! + deviceName: String! +} + +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 new file mode 100644 index 00000000..aa2d2c1e --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart @@ -0,0 +1,756 @@ +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; + } + + 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) +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; + } + + 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}) => + _res; +} + +@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; + } + + 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) +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$SshMutationInput { + Input$SshMutationInput({required this.username, required this.sshKey}); + + @override + factory Input$SshMutationInput.fromJson(Map json) => + _$Input$SshMutationInputFromJson(json); + + final String username; + + final String sshKey; + + Map toJson() => _$Input$SshMutationInputToJson(this); + int get hashCode { + final l$username = username; + final l$sshKey = sshKey; + return Object.hashAll([l$username, l$sshKey]); + } + + @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; + } + + 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) +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; +} + +@JsonSerializable(explicitToJson: true) +class Input$UserMutationInput { + Input$UserMutationInput({required this.username, required this.password}); + + @override + factory Input$UserMutationInput.fromJson(Map json) => + _$Input$UserMutationInputFromJson(json); + + final String username; + + final String password; + + Map toJson() => _$Input$UserMutationInputToJson(this); + int get hashCode { + final l$username = username; + final l$password = password; + return Object.hashAll([l$username, l$password]); + } + + @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; + } + + 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 { + @JsonValue('CLOUDFLARE') + CLOUDFLARE, + $unknown +} + +enum Enum$ServerProvider { + @JsonValue('HETZNER') + HETZNER, + $unknown +} + +enum Enum$ServiceStatusEnum { + @JsonValue('ACTIVATING') + ACTIVATING, + @JsonValue('ACTIVE') + ACTIVE, + @JsonValue('DEACTIVATING') + DEACTIVATING, + @JsonValue('FAILED') + FAILED, + @JsonValue('INACTIVE') + INACTIVE, + @JsonValue('OFF') + OFF, + @JsonValue('RELOADING') + RELOADING, + $unknown +} + +enum Enum$Severity { + @JsonValue('CRITICAL') + CRITICAL, + @JsonValue('ERROR') + ERROR, + @JsonValue('INFO') + INFO, + @JsonValue('SUCCESS') + SUCCESS, + @JsonValue('WARNING') + WARNING, + $unknown +} + +enum Enum$UserType { + @JsonValue('NORMAL') + NORMAL, + @JsonValue('PRIMARY') + PRIMARY, + @JsonValue('ROOT') + ROOT, + $unknown +} + +const possibleTypesMap = { + 'MutationReturnInterface': { + 'ApiKeyMutationReturn', + 'AutoUpgradeSettingsMutationReturn', + 'DeviceApiTokenMutationReturn', + 'GenericJobButationReturn', + 'GenericMutationReturn', + 'ServiceJobMutationReturn', + 'ServiceMutationReturn', + 'TimezoneMutationReturn', + 'UserMutationReturn' + }, + 'StorageUsageInterface': {'ServiceStorageUsage'} +}; +DateTime? _nullable$dateTimeFromJson(dynamic data) => + data == null ? null : dateTimeFromJson(data); +dynamic _nullable$dateTimeToJson(DateTime? data) => + data == null ? null : dateTimeToJson(data); diff --git a/lib/logic/api_maps/graphql_maps/schema/schema.graphql.g.dart b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.g.dart new file mode 100644 index 00000000..d3008d30 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.g.dart @@ -0,0 +1,125 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'schema.graphql.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Input$AutoUpgradeSettingsInput _$Input$AutoUpgradeSettingsInputFromJson( + Map json) => + Input$AutoUpgradeSettingsInput( + enableAutoUpgrade: json['enableAutoUpgrade'] as bool?, + allowReboot: json['allowReboot'] as bool?, + ); + +Map _$Input$AutoUpgradeSettingsInputToJson( + Input$AutoUpgradeSettingsInput instance) => + { + 'enableAutoUpgrade': instance.enableAutoUpgrade, + 'allowReboot': instance.allowReboot, + }; + +Input$MigrateToBindsInput _$Input$MigrateToBindsInputFromJson( + Map json) => + Input$MigrateToBindsInput( + emailBlockDevice: json['emailBlockDevice'] as String, + bitwardenBlockDevice: json['bitwardenBlockDevice'] as String, + giteaBlockDevice: json['giteaBlockDevice'] as String, + nextcloudBlockDevice: json['nextcloudBlockDevice'] as String, + pleromaBlockDevice: json['pleromaBlockDevice'] as String, + ); + +Map _$Input$MigrateToBindsInputToJson( + Input$MigrateToBindsInput instance) => + { + 'emailBlockDevice': instance.emailBlockDevice, + 'bitwardenBlockDevice': instance.bitwardenBlockDevice, + 'giteaBlockDevice': instance.giteaBlockDevice, + 'nextcloudBlockDevice': instance.nextcloudBlockDevice, + 'pleromaBlockDevice': instance.pleromaBlockDevice, + }; + +Input$MoveServiceInput _$Input$MoveServiceInputFromJson( + Map json) => + Input$MoveServiceInput( + serviceId: json['serviceId'] as String, + location: json['location'] as String, + ); + +Map _$Input$MoveServiceInputToJson( + Input$MoveServiceInput instance) => + { + 'serviceId': instance.serviceId, + 'location': instance.location, + }; + +Input$RecoveryKeyLimitsInput _$Input$RecoveryKeyLimitsInputFromJson( + Map json) => + Input$RecoveryKeyLimitsInput( + expirationDate: _nullable$dateTimeFromJson(json['expirationDate']), + uses: json['uses'] as int?, + ); + +Map _$Input$RecoveryKeyLimitsInputToJson( + Input$RecoveryKeyLimitsInput instance) => + { + 'expirationDate': _nullable$dateTimeToJson(instance.expirationDate), + 'uses': instance.uses, + }; + +Input$SshMutationInput _$Input$SshMutationInputFromJson( + Map json) => + Input$SshMutationInput( + username: json['username'] as String, + sshKey: json['sshKey'] as String, + ); + +Map _$Input$SshMutationInputToJson( + Input$SshMutationInput instance) => + { + 'username': instance.username, + 'sshKey': instance.sshKey, + }; + +Input$UseNewDeviceKeyInput _$Input$UseNewDeviceKeyInputFromJson( + Map json) => + Input$UseNewDeviceKeyInput( + key: json['key'] as String, + deviceName: json['deviceName'] as String, + ); + +Map _$Input$UseNewDeviceKeyInputToJson( + Input$UseNewDeviceKeyInput instance) => + { + 'key': instance.key, + 'deviceName': instance.deviceName, + }; + +Input$UseRecoveryKeyInput _$Input$UseRecoveryKeyInputFromJson( + Map json) => + Input$UseRecoveryKeyInput( + key: json['key'] as String, + deviceName: json['deviceName'] as String, + ); + +Map _$Input$UseRecoveryKeyInputToJson( + Input$UseRecoveryKeyInput instance) => + { + 'key': instance.key, + 'deviceName': instance.deviceName, + }; + +Input$UserMutationInput _$Input$UserMutationInputFromJson( + Map json) => + Input$UserMutationInput( + username: json['username'] as String, + password: json['password'] as String, + ); + +Map _$Input$UserMutationInputToJson( + Input$UserMutationInput instance) => + { + 'username': instance.username, + 'password': instance.password, + }; diff --git a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql new file mode 100644 index 00000000..96374fad --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql @@ -0,0 +1,134 @@ +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 + isCaller + name + } + } +} + +query RecoveryKey { + api { + recoveryKey { + creationDate + exists + expirationDate + usesLeft + valid + } + } +} + +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 new file mode 100644 index 00000000..7e99910c --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart @@ -0,0 +1,7090 @@ +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 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 { + 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( + 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; + return Object.hashAll([l$api, l$$__typename]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Query$GetApiVersion) || runtimeType != other.runtimeType) + return false; + final l$api = api; + final lOther$api = other.api; + if (l$api != lOther$api) return false; + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) return false; + return true; + } +} + +extension UtilityExtension$Query$GetApiVersion on Query$GetApiVersion { + CopyWith$Query$GetApiVersion get copyWith => + CopyWith$Query$GetApiVersion(this, (i) => i); +} + +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: [ + 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); + +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 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); +} + +class FetchMoreOptions$Query$GetApiVersion extends graphql.FetchMoreOptions { + FetchMoreOptions$Query$GetApiVersion( + {required graphql.UpdateQuery updateQuery}) + : super( + updateQuery: updateQuery, document: documentNodeQueryGetApiVersion); +} + +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); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$GetApiVersion$api { + Query$GetApiVersion$api({required this.version, required this.$__typename}); + + @override + factory Query$GetApiVersion$api.fromJson(Map json) => + _$Query$GetApiVersion$apiFromJson(json); + + 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; + } +} + +extension UtilityExtension$Query$GetApiVersion$api on Query$GetApiVersion$api { + 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) +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 { + 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: [ + OperationDefinitionNode( + type: OperationType.query, + name: NameNode(value: 'GetApiJobs'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'jobs'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'getJobs'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: '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 { + 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) +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 { + 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? error, + DateTime? finishedAt, + String? name, + int? progress, + String? result, + String? status, + String? statusText, + String? uid, + DateTime? updatedAt, + String? $__typename}) => + _res; +} + +@JsonSerializable(explicitToJson: true) +class Variables$Mutation$RemoveJob { + Variables$Mutation$RemoveJob({required this.jobId}); + + @override + factory Variables$Mutation$RemoveJob.fromJson(Map json) => + _$Variables$Mutation$RemoveJobFromJson(json); + + final String jobId; + + Map toJson() => _$Variables$Mutation$RemoveJobToJson(this); + int get hashCode { + final l$jobId = jobId; + return Object.hashAll([l$jobId]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Variables$Mutation$RemoveJob) || + runtimeType != other.runtimeType) return false; + final l$jobId = jobId; + final lOther$jobId = other.jobId; + if (l$jobId != lOther$jobId) return false; + return true; + } + + CopyWith$Variables$Mutation$RemoveJob + get copyWith => CopyWith$Variables$Mutation$RemoveJob(this, (i) => i); +} + +abstract class CopyWith$Variables$Mutation$RemoveJob { + factory CopyWith$Variables$Mutation$RemoveJob( + Variables$Mutation$RemoveJob instance, + TRes Function(Variables$Mutation$RemoveJob) then) = + _CopyWithImpl$Variables$Mutation$RemoveJob; + + 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) +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 { + 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: [ + 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 { + 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) +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 { + 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}) => + _res; + CopyWith$Mutation$RunSystemRebuild$runSystemRebuild + get runSystemRebuild => + CopyWith$Mutation$RunSystemRebuild$runSystemRebuild.stub(_res); +} + +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 { + 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) +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 { + 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}) => + _res; + CopyWith$Mutation$RunSystemRollback$runSystemRollback + get runSystemRollback => + CopyWith$Mutation$RunSystemRollback$runSystemRollback.stub(_res); +} + +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 { + 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) +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 { + 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}) => + _res; + CopyWith$Mutation$RunSystemUpgrade$runSystemUpgrade + get runSystemUpgrade => + CopyWith$Mutation$RunSystemUpgrade$runSystemUpgrade.stub(_res); +} + +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 { + 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) +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 { + 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}) => + _res; + CopyWith$Mutation$PullRepositoryChanges$pullRepositoryChanges + get pullRepositoryChanges => + CopyWith$Mutation$PullRepositoryChanges$pullRepositoryChanges.stub( + _res); +} + +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 { + 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) +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 { + 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}) => + _res; + CopyWith$Mutation$RebootSystem$rebootSystem get rebootSystem => + CopyWith$Mutation$RebootSystem$rebootSystem.stub(_res); +} + +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 { + 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) +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 { + 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: [ + OperationDefinitionNode( + type: OperationType.query, + name: NameNode(value: 'GetApiTokens'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'api'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'devices'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: '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$GetApiTokens _parserFn$Query$GetApiTokens(Map data) => + Query$GetApiTokens.fromJson(data); + +class Options$Query$GetApiTokens + extends graphql.QueryOptions { + Options$Query$GetApiTokens( + {String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Duration? pollInterval, + graphql.Context? context}) + : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + pollInterval: pollInterval, + context: context, + document: documentNodeQueryGetApiTokens, + parserFn: _parserFn$Query$GetApiTokens); +} + +class WatchOptions$Query$GetApiTokens + extends graphql.WatchQueryOptions { + WatchOptions$Query$GetApiTokens( + {String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false}) + : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeQueryGetApiTokens, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Query$GetApiTokens); +} + +class FetchMoreOptions$Query$GetApiTokens extends graphql.FetchMoreOptions { + FetchMoreOptions$Query$GetApiTokens( + {required graphql.UpdateQuery updateQuery}) + : super( + updateQuery: updateQuery, document: documentNodeQueryGetApiTokens); +} + +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: documentNodeQueryGetApiTokens)), + data: data.toJson(), + broadcast: broadcast); + Query$GetApiTokens? readQuery$GetApiTokens({bool optimistic = true}) { + final result = this.readQuery( + graphql.Request( + operation: + graphql.Operation(document: documentNodeQueryGetApiTokens)), + optimistic: optimistic); + return result == null ? null : Query$GetApiTokens.fromJson(result); + } +} + +@JsonSerializable(explicitToJson: true) +class Query$GetApiTokens$api { + Query$GetApiTokens$api({required this.devices, required this.$__typename}); + + @override + factory Query$GetApiTokens$api.fromJson(Map json) => + _$Query$GetApiTokens$apiFromJson(json); + + final List devices; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$GetApiTokens$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$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; + 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$GetApiTokens$api on Query$GetApiTokens$api { + 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) +class Query$GetApiTokens$api$devices { + Query$GetApiTokens$api$devices( + {required this.creationDate, + required this.isCaller, + required this.name, + required this.$__typename}); + + @override + factory Query$GetApiTokens$api$devices.fromJson(Map json) => + _$Query$GetApiTokens$api$devicesFromJson(json); + + @JsonKey(fromJson: dateTimeFromJson, toJson: dateTimeToJson) + final DateTime creationDate; + + final bool isCaller; + + final String name; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$GetApiTokens$api$devicesToJson(this); + 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$GetApiTokens$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$GetApiTokens$api$devices + on Query$GetApiTokens$api$devices { + 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}) => + _res; +} + +@JsonSerializable(explicitToJson: true) +class Query$RecoveryKey { + Query$RecoveryKey({required this.api, required this.$__typename}); + + @override + factory Query$RecoveryKey.fromJson(Map json) => + _$Query$RecoveryKeyFromJson(json); + + final Query$RecoveryKey$api api; + + @JsonKey(name: '__typename') + final String $__typename; + + Map toJson() => _$Query$RecoveryKeyToJson(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$RecoveryKey) || 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$RecoveryKey on Query$RecoveryKey { + 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: [ + OperationDefinitionNode( + type: OperationType.query, + name: NameNode(value: 'RecoveryKey'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'api'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'recoveryKey'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: '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 { + 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) +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 { + 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? expirationDate, + int? usesLeft, + bool? valid, + String? $__typename}) => + _res; +} + +@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; + } + + 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) +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 { + 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}) => + _res; + CopyWith$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey + get getNewRecoveryApiKey => + CopyWith$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey.stub( + _res); +} + +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: [], + 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$GetNewRecoveryApiKey _parserFn$Mutation$GetNewRecoveryApiKey( + Map data) => + Mutation$GetNewRecoveryApiKey.fromJson(data); +typedef OnMutationCompleted$Mutation$GetNewRecoveryApiKey = FutureOr + Function(dynamic, Mutation$GetNewRecoveryApiKey?); + +class Options$Mutation$GetNewRecoveryApiKey + extends graphql.MutationOptions { + Options$Mutation$GetNewRecoveryApiKey( + {String? operationName, + Variables$Mutation$GetNewRecoveryApiKey? variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$GetNewRecoveryApiKey? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError}) + : onCompletedWithParsed = onCompleted, + 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$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$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 { + 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? key}) => + _res; +} + +@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; + } + + 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) +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 { + 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}) => + _res; + CopyWith$Mutation$UseRecoveryApiKey$useRecoveryApiKey + get useRecoveryApiKey => + CopyWith$Mutation$UseRecoveryApiKey$useRecoveryApiKey.stub(_res); +} + +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 { + 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? token}) => + _res; +} + +@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 { + 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}) => + _res; + CopyWith$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken + get refreshDeviceApiToken => + CopyWith$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken.stub( + _res); +} + +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, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false}) + : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationRefreshDeviceApiToken, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$RefreshDeviceApiToken); +} + +extension ClientExtension$Mutation$RefreshDeviceApiToken + 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 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 Mutation$RefreshDeviceApiToken$refreshDeviceApiToken.fromJson( + Map json) => + _$Mutation$RefreshDeviceApiToken$refreshDeviceApiTokenFromJson(json); + + final int code; + + final String message; + + final bool success; + + @JsonKey(name: '__typename') + final String $__typename; + + final String? token; + + Map toJson() => + _$Mutation$RefreshDeviceApiToken$refreshDeviceApiTokenToJson(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$RefreshDeviceApiToken$refreshDeviceApiToken) || + 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$RefreshDeviceApiToken$refreshDeviceApiToken + on Mutation$RefreshDeviceApiToken$refreshDeviceApiToken { + 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? token}) => + _res; +} + +@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; + } + + 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) +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; + return true; + } +} + +extension UtilityExtension$Mutation$DeleteDeviceApiToken + on Mutation$DeleteDeviceApiToken { + 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}) => + _res; + CopyWith$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken + get deleteDeviceApiToken => + CopyWith$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken.stub( + _res); +} + +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?); + +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); + + final OnMutationCompleted$Mutation$DeleteDeviceApiToken? + onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + onCompletedWithParsed + ]; +} + +class WatchOptions$Mutation$DeleteDeviceApiToken + extends graphql.WatchQueryOptions { + WatchOptions$Mutation$DeleteDeviceApiToken( + {String? operationName, + required Variables$Mutation$DeleteDeviceApiToken variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false}) + : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeMutationDeleteDeviceApiToken, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$DeleteDeviceApiToken); +} + +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 { + 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) +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 { + 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}) => + _res; + CopyWith$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey + get getNewDeviceApiKey => + CopyWith$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey.stub(_res); +} + +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 { + 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? key}) => + _res; +} + +@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 { + 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}) => + _res; + CopyWith$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey + get invalidateNewDeviceApiKey => + CopyWith$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey + .stub(_res); +} + +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 { + 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) +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; + } + + 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) +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 { + 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}) => + _res; + CopyWith$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey< + TRes> + get authorizeWithNewDeviceApiKey => + CopyWith$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey + .stub(_res); +} + +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 { + 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? token}) => + _res; +} + +DateTime? _nullable$dateTimeFromJson(dynamic data) => + data == null ? null : dateTimeFromJson(data); +dynamic _nullable$dateTimeToJson(DateTime? data) => + data == null ? null : dateTimeToJson(data); diff --git a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.g.dart b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.g.dart new file mode 100644 index 00000000..525f8d64 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.g.dart @@ -0,0 +1,745 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'server_api.graphql.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Fragment$basicMutationReturnFields _$Fragment$basicMutationReturnFieldsFromJson( + Map json) => + Fragment$basicMutationReturnFields( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + ); + +Map _$Fragment$basicMutationReturnFieldsToJson( + Fragment$basicMutationReturnFields instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + }; + +Query$GetApiVersion _$Query$GetApiVersionFromJson(Map json) => + Query$GetApiVersion( + api: + Query$GetApiVersion$api.fromJson(json['api'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Query$GetApiVersionToJson( + Query$GetApiVersion instance) => + { + 'api': instance.api.toJson(), + '__typename': instance.$__typename, + }; + +Query$GetApiVersion$api _$Query$GetApiVersion$apiFromJson( + Map json) => + Query$GetApiVersion$api( + version: json['version'] as String, + $__typename: json['__typename'] as String, + ); + +Map _$Query$GetApiVersion$apiToJson( + Query$GetApiVersion$api instance) => + { + 'version': instance.version, + '__typename': instance.$__typename, + }; + +Query$GetApiJobs _$Query$GetApiJobsFromJson(Map json) => + Query$GetApiJobs( + jobs: + Query$GetApiJobs$jobs.fromJson(json['jobs'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Query$GetApiJobsToJson(Query$GetApiJobs instance) => + { + 'jobs': instance.jobs.toJson(), + '__typename': instance.$__typename, + }; + +Query$GetApiJobs$jobs _$Query$GetApiJobs$jobsFromJson( + Map json) => + Query$GetApiJobs$jobs( + getJobs: (json['getJobs'] as List) + .map((e) => + Query$GetApiJobs$jobs$getJobs.fromJson(e as Map)) + .toList(), + $__typename: json['__typename'] as String, + ); + +Map _$Query$GetApiJobs$jobsToJson( + Query$GetApiJobs$jobs instance) => + { + 'getJobs': instance.getJobs.map((e) => e.toJson()).toList(), + '__typename': instance.$__typename, + }; + +Query$GetApiJobs$jobs$getJobs _$Query$GetApiJobs$jobs$getJobsFromJson( + Map json) => + Query$GetApiJobs$jobs$getJobs( + createdAt: dateTimeFromJson(json['createdAt']), + description: json['description'] as String, + error: json['error'] as String?, + finishedAt: _nullable$dateTimeFromJson(json['finishedAt']), + name: json['name'] as String, + progress: json['progress'] as int?, + result: json['result'] as String?, + status: json['status'] as String, + statusText: json['statusText'] as String?, + uid: json['uid'] as String, + updatedAt: dateTimeFromJson(json['updatedAt']), + $__typename: json['__typename'] as String, + ); + +Map _$Query$GetApiJobs$jobs$getJobsToJson( + Query$GetApiJobs$jobs$getJobs instance) => + { + 'createdAt': dateTimeToJson(instance.createdAt), + 'description': instance.description, + 'error': instance.error, + 'finishedAt': _nullable$dateTimeToJson(instance.finishedAt), + 'name': instance.name, + 'progress': instance.progress, + 'result': instance.result, + 'status': instance.status, + 'statusText': instance.statusText, + 'uid': instance.uid, + 'updatedAt': dateTimeToJson(instance.updatedAt), + '__typename': instance.$__typename, + }; + +Variables$Mutation$RemoveJob _$Variables$Mutation$RemoveJobFromJson( + Map json) => + Variables$Mutation$RemoveJob( + jobId: json['jobId'] as String, + ); + +Map _$Variables$Mutation$RemoveJobToJson( + Variables$Mutation$RemoveJob instance) => + { + 'jobId': instance.jobId, + }; + +Mutation$RemoveJob _$Mutation$RemoveJobFromJson(Map json) => + Mutation$RemoveJob( + removeJob: Mutation$RemoveJob$removeJob.fromJson( + json['removeJob'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$RemoveJobToJson(Mutation$RemoveJob instance) => + { + 'removeJob': instance.removeJob.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$RemoveJob$removeJob _$Mutation$RemoveJob$removeJobFromJson( + Map json) => + Mutation$RemoveJob$removeJob( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$RemoveJob$removeJobToJson( + Mutation$RemoveJob$removeJob instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + }; + +Mutation$RunSystemRebuild _$Mutation$RunSystemRebuildFromJson( + Map json) => + Mutation$RunSystemRebuild( + runSystemRebuild: Mutation$RunSystemRebuild$runSystemRebuild.fromJson( + json['runSystemRebuild'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$RunSystemRebuildToJson( + Mutation$RunSystemRebuild instance) => + { + 'runSystemRebuild': instance.runSystemRebuild.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$RunSystemRebuild$runSystemRebuild + _$Mutation$RunSystemRebuild$runSystemRebuildFromJson( + Map json) => + Mutation$RunSystemRebuild$runSystemRebuild( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$RunSystemRebuild$runSystemRebuildToJson( + Mutation$RunSystemRebuild$runSystemRebuild instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + }; + +Mutation$RunSystemRollback _$Mutation$RunSystemRollbackFromJson( + Map json) => + Mutation$RunSystemRollback( + runSystemRollback: Mutation$RunSystemRollback$runSystemRollback.fromJson( + json['runSystemRollback'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$RunSystemRollbackToJson( + Mutation$RunSystemRollback instance) => + { + 'runSystemRollback': instance.runSystemRollback.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$RunSystemRollback$runSystemRollback + _$Mutation$RunSystemRollback$runSystemRollbackFromJson( + Map json) => + Mutation$RunSystemRollback$runSystemRollback( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$RunSystemRollback$runSystemRollbackToJson( + Mutation$RunSystemRollback$runSystemRollback instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + }; + +Mutation$RunSystemUpgrade _$Mutation$RunSystemUpgradeFromJson( + Map json) => + Mutation$RunSystemUpgrade( + runSystemUpgrade: Mutation$RunSystemUpgrade$runSystemUpgrade.fromJson( + json['runSystemUpgrade'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$RunSystemUpgradeToJson( + Mutation$RunSystemUpgrade instance) => + { + 'runSystemUpgrade': instance.runSystemUpgrade.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$RunSystemUpgrade$runSystemUpgrade + _$Mutation$RunSystemUpgrade$runSystemUpgradeFromJson( + Map json) => + Mutation$RunSystemUpgrade$runSystemUpgrade( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$RunSystemUpgrade$runSystemUpgradeToJson( + Mutation$RunSystemUpgrade$runSystemUpgrade instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + }; + +Mutation$PullRepositoryChanges _$Mutation$PullRepositoryChangesFromJson( + Map json) => + Mutation$PullRepositoryChanges( + pullRepositoryChanges: + Mutation$PullRepositoryChanges$pullRepositoryChanges.fromJson( + json['pullRepositoryChanges'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$PullRepositoryChangesToJson( + Mutation$PullRepositoryChanges instance) => + { + 'pullRepositoryChanges': instance.pullRepositoryChanges.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$PullRepositoryChanges$pullRepositoryChanges + _$Mutation$PullRepositoryChanges$pullRepositoryChangesFromJson( + Map json) => + Mutation$PullRepositoryChanges$pullRepositoryChanges( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + ); + +Map + _$Mutation$PullRepositoryChanges$pullRepositoryChangesToJson( + Mutation$PullRepositoryChanges$pullRepositoryChanges instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + }; + +Mutation$RebootSystem _$Mutation$RebootSystemFromJson( + Map json) => + Mutation$RebootSystem( + rebootSystem: Mutation$RebootSystem$rebootSystem.fromJson( + json['rebootSystem'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$RebootSystemToJson( + Mutation$RebootSystem instance) => + { + 'rebootSystem': instance.rebootSystem.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$RebootSystem$rebootSystem _$Mutation$RebootSystem$rebootSystemFromJson( + Map json) => + Mutation$RebootSystem$rebootSystem( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$RebootSystem$rebootSystemToJson( + Mutation$RebootSystem$rebootSystem instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + }; + +Query$GetApiTokens _$Query$GetApiTokensFromJson(Map json) => + Query$GetApiTokens( + api: Query$GetApiTokens$api.fromJson(json['api'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Query$GetApiTokensToJson(Query$GetApiTokens instance) => + { + 'api': instance.api.toJson(), + '__typename': instance.$__typename, + }; + +Query$GetApiTokens$api _$Query$GetApiTokens$apiFromJson( + Map json) => + Query$GetApiTokens$api( + devices: (json['devices'] as List) + .map((e) => Query$GetApiTokens$api$devices.fromJson( + e as Map)) + .toList(), + $__typename: json['__typename'] as String, + ); + +Map _$Query$GetApiTokens$apiToJson( + Query$GetApiTokens$api instance) => + { + 'devices': instance.devices.map((e) => e.toJson()).toList(), + '__typename': instance.$__typename, + }; + +Query$GetApiTokens$api$devices _$Query$GetApiTokens$api$devicesFromJson( + Map json) => + Query$GetApiTokens$api$devices( + creationDate: dateTimeFromJson(json['creationDate']), + isCaller: json['isCaller'] as bool, + name: json['name'] as String, + $__typename: json['__typename'] as String, + ); + +Map _$Query$GetApiTokens$api$devicesToJson( + Query$GetApiTokens$api$devices instance) => + { + 'creationDate': dateTimeToJson(instance.creationDate), + 'isCaller': instance.isCaller, + 'name': instance.name, + '__typename': instance.$__typename, + }; + +Query$RecoveryKey _$Query$RecoveryKeyFromJson(Map json) => + Query$RecoveryKey( + api: Query$RecoveryKey$api.fromJson(json['api'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Query$RecoveryKeyToJson(Query$RecoveryKey instance) => + { + 'api': instance.api.toJson(), + '__typename': instance.$__typename, + }; + +Query$RecoveryKey$api _$Query$RecoveryKey$apiFromJson( + Map json) => + Query$RecoveryKey$api( + recoveryKey: Query$RecoveryKey$api$recoveryKey.fromJson( + json['recoveryKey'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Query$RecoveryKey$apiToJson( + Query$RecoveryKey$api instance) => + { + 'recoveryKey': instance.recoveryKey.toJson(), + '__typename': instance.$__typename, + }; + +Query$RecoveryKey$api$recoveryKey _$Query$RecoveryKey$api$recoveryKeyFromJson( + Map json) => + Query$RecoveryKey$api$recoveryKey( + creationDate: _nullable$dateTimeFromJson(json['creationDate']), + exists: json['exists'] as bool, + expirationDate: _nullable$dateTimeFromJson(json['expirationDate']), + usesLeft: json['usesLeft'] as int?, + valid: json['valid'] as bool, + $__typename: json['__typename'] as String, + ); + +Map _$Query$RecoveryKey$api$recoveryKeyToJson( + Query$RecoveryKey$api$recoveryKey instance) => + { + 'creationDate': _nullable$dateTimeToJson(instance.creationDate), + 'exists': instance.exists, + 'expirationDate': _nullable$dateTimeToJson(instance.expirationDate), + 'usesLeft': instance.usesLeft, + 'valid': instance.valid, + '__typename': instance.$__typename, + }; + +Variables$Mutation$GetNewRecoveryApiKey + _$Variables$Mutation$GetNewRecoveryApiKeyFromJson( + Map json) => + Variables$Mutation$GetNewRecoveryApiKey( + limits: json['limits'] == null + ? null + : Input$RecoveryKeyLimitsInput.fromJson( + json['limits'] as Map), + ); + +Map _$Variables$Mutation$GetNewRecoveryApiKeyToJson( + Variables$Mutation$GetNewRecoveryApiKey instance) => + { + 'limits': instance.limits?.toJson(), + }; + +Mutation$GetNewRecoveryApiKey _$Mutation$GetNewRecoveryApiKeyFromJson( + Map json) => + Mutation$GetNewRecoveryApiKey( + getNewRecoveryApiKey: + Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey.fromJson( + json['getNewRecoveryApiKey'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$GetNewRecoveryApiKeyToJson( + Mutation$GetNewRecoveryApiKey instance) => + { + 'getNewRecoveryApiKey': instance.getNewRecoveryApiKey.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey + _$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKeyFromJson( + Map json) => + Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + key: json['key'] as String?, + ); + +Map _$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKeyToJson( + Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + 'key': instance.key, + }; + +Variables$Mutation$UseRecoveryApiKey + _$Variables$Mutation$UseRecoveryApiKeyFromJson(Map json) => + Variables$Mutation$UseRecoveryApiKey( + input: Input$UseRecoveryKeyInput.fromJson( + json['input'] as Map), + ); + +Map _$Variables$Mutation$UseRecoveryApiKeyToJson( + Variables$Mutation$UseRecoveryApiKey instance) => + { + 'input': instance.input.toJson(), + }; + +Mutation$UseRecoveryApiKey _$Mutation$UseRecoveryApiKeyFromJson( + Map json) => + Mutation$UseRecoveryApiKey( + useRecoveryApiKey: Mutation$UseRecoveryApiKey$useRecoveryApiKey.fromJson( + json['useRecoveryApiKey'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$UseRecoveryApiKeyToJson( + Mutation$UseRecoveryApiKey instance) => + { + 'useRecoveryApiKey': instance.useRecoveryApiKey.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$UseRecoveryApiKey$useRecoveryApiKey + _$Mutation$UseRecoveryApiKey$useRecoveryApiKeyFromJson( + Map json) => + Mutation$UseRecoveryApiKey$useRecoveryApiKey( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + token: json['token'] as String?, + ); + +Map _$Mutation$UseRecoveryApiKey$useRecoveryApiKeyToJson( + Mutation$UseRecoveryApiKey$useRecoveryApiKey instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + 'token': instance.token, + }; + +Mutation$RefreshDeviceApiToken _$Mutation$RefreshDeviceApiTokenFromJson( + Map json) => + Mutation$RefreshDeviceApiToken( + refreshDeviceApiToken: + Mutation$RefreshDeviceApiToken$refreshDeviceApiToken.fromJson( + json['refreshDeviceApiToken'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$RefreshDeviceApiTokenToJson( + Mutation$RefreshDeviceApiToken instance) => + { + 'refreshDeviceApiToken': instance.refreshDeviceApiToken.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$RefreshDeviceApiToken$refreshDeviceApiToken + _$Mutation$RefreshDeviceApiToken$refreshDeviceApiTokenFromJson( + Map json) => + Mutation$RefreshDeviceApiToken$refreshDeviceApiToken( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + token: json['token'] as String?, + ); + +Map + _$Mutation$RefreshDeviceApiToken$refreshDeviceApiTokenToJson( + Mutation$RefreshDeviceApiToken$refreshDeviceApiToken instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + 'token': instance.token, + }; + +Variables$Mutation$DeleteDeviceApiToken + _$Variables$Mutation$DeleteDeviceApiTokenFromJson( + Map json) => + Variables$Mutation$DeleteDeviceApiToken( + device: json['device'] as String, + ); + +Map _$Variables$Mutation$DeleteDeviceApiTokenToJson( + Variables$Mutation$DeleteDeviceApiToken instance) => + { + 'device': instance.device, + }; + +Mutation$DeleteDeviceApiToken _$Mutation$DeleteDeviceApiTokenFromJson( + Map json) => + Mutation$DeleteDeviceApiToken( + deleteDeviceApiToken: + Mutation$DeleteDeviceApiToken$deleteDeviceApiToken.fromJson( + json['deleteDeviceApiToken'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$DeleteDeviceApiTokenToJson( + Mutation$DeleteDeviceApiToken instance) => + { + 'deleteDeviceApiToken': instance.deleteDeviceApiToken.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$DeleteDeviceApiToken$deleteDeviceApiToken + _$Mutation$DeleteDeviceApiToken$deleteDeviceApiTokenFromJson( + Map json) => + Mutation$DeleteDeviceApiToken$deleteDeviceApiToken( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$DeleteDeviceApiToken$deleteDeviceApiTokenToJson( + Mutation$DeleteDeviceApiToken$deleteDeviceApiToken instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + }; + +Mutation$GetNewDeviceApiKey _$Mutation$GetNewDeviceApiKeyFromJson( + Map json) => + Mutation$GetNewDeviceApiKey( + getNewDeviceApiKey: + Mutation$GetNewDeviceApiKey$getNewDeviceApiKey.fromJson( + json['getNewDeviceApiKey'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$GetNewDeviceApiKeyToJson( + Mutation$GetNewDeviceApiKey instance) => + { + 'getNewDeviceApiKey': instance.getNewDeviceApiKey.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$GetNewDeviceApiKey$getNewDeviceApiKey + _$Mutation$GetNewDeviceApiKey$getNewDeviceApiKeyFromJson( + Map json) => + Mutation$GetNewDeviceApiKey$getNewDeviceApiKey( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + key: json['key'] as String?, + ); + +Map _$Mutation$GetNewDeviceApiKey$getNewDeviceApiKeyToJson( + Mutation$GetNewDeviceApiKey$getNewDeviceApiKey instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + 'key': instance.key, + }; + +Mutation$InvalidateNewDeviceApiKey _$Mutation$InvalidateNewDeviceApiKeyFromJson( + Map json) => + Mutation$InvalidateNewDeviceApiKey( + invalidateNewDeviceApiKey: + Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey.fromJson( + json['invalidateNewDeviceApiKey'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$InvalidateNewDeviceApiKeyToJson( + Mutation$InvalidateNewDeviceApiKey instance) => + { + 'invalidateNewDeviceApiKey': instance.invalidateNewDeviceApiKey.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey + _$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKeyFromJson( + Map json) => + Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + ); + +Map + _$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKeyToJson( + Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey + instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + }; + +Variables$Mutation$AuthorizeWithNewDeviceApiKey + _$Variables$Mutation$AuthorizeWithNewDeviceApiKeyFromJson( + Map json) => + Variables$Mutation$AuthorizeWithNewDeviceApiKey( + input: Input$UseNewDeviceKeyInput.fromJson( + json['input'] as Map), + ); + +Map _$Variables$Mutation$AuthorizeWithNewDeviceApiKeyToJson( + Variables$Mutation$AuthorizeWithNewDeviceApiKey instance) => + { + 'input': instance.input.toJson(), + }; + +Mutation$AuthorizeWithNewDeviceApiKey + _$Mutation$AuthorizeWithNewDeviceApiKeyFromJson( + Map json) => + Mutation$AuthorizeWithNewDeviceApiKey( + authorizeWithNewDeviceApiKey: + Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey + .fromJson(json['authorizeWithNewDeviceApiKey'] + as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$AuthorizeWithNewDeviceApiKeyToJson( + Mutation$AuthorizeWithNewDeviceApiKey instance) => + { + 'authorizeWithNewDeviceApiKey': + instance.authorizeWithNewDeviceApiKey.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey + _$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKeyFromJson( + Map json) => + Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + token: json['token'] as String?, + ); + +Map + _$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKeyToJson( + Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey + instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + 'token': instance.token, + }; diff --git a/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql new file mode 100644 index 00000000..d8a1d62d --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql @@ -0,0 +1,61 @@ +fragment basicMutationReturnFields on MutationReturnInterface{ + code + message + success +} + +query SystemSettings { + system { + settings { + autoUpgrade { + allowReboot + enable + } + ssh { + enable + passwordAuthentication + } + timezone + } + } +} + +query SystemIsUsingBinds { + system { + info { + usingBinds + } + } +} + +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..538b58cf --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart @@ -0,0 +1,2960 @@ +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 { + 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( + 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 { + 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: [ + 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: '__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 { + 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) +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 { + 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}) => + _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) +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 { + 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) +class Query$SystemSettings$system$settings$ssh { + Query$SystemSettings$system$settings$ssh( + {required this.enable, + required this.passwordAuthentication, + required this.$__typename}); + + @override + factory Query$SystemSettings$system$settings$ssh.fromJson( + Map json) => + _$Query$SystemSettings$system$settings$sshFromJson(json); + + final bool enable; + + final bool passwordAuthentication; + + @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$$__typename = $__typename; + return Object.hashAll([l$enable, l$passwordAuthentication, 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$$__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 { + 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, 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? $__typename = _undefined}) => + _then(Query$SystemSettings$system$settings$ssh( + enable: enable == _undefined || enable == null + ? _instance.enable + : (enable as bool), + passwordAuthentication: passwordAuthentication == _undefined || + passwordAuthentication == null + ? _instance.passwordAuthentication + : (passwordAuthentication as bool), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String))); +} + +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, String? $__typename}) => + _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}); + + @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 { + 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: [ + 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 { + 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) +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 { + 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}) => + _res; + requiredDnsRecords(_fn) => _res; +} + +@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 { + 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? priority, + String? recordType, + int? ttl, + String? $__typename}) => + _res; +} + +@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; + } + + 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) +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 { + 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}) => + _res; + CopyWith$Mutation$ChangeTimezone$changeTimezone get changeTimezone => + CopyWith$Mutation$ChangeTimezone$changeTimezone.stub(_res); +} + +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 { + 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? timezone}) => + _res; +} + +@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; + } + + 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) +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 { + 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}) => + _res; + CopyWith$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings + get changeAutoUpgradeSettings => + CopyWith$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings + .stub(_res); +} + +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 { + 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}) => + _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 new file mode 100644 index 00000000..fc66954b --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.g.dart @@ -0,0 +1,340 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'server_settings.graphql.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Fragment$basicMutationReturnFields _$Fragment$basicMutationReturnFieldsFromJson( + Map json) => + Fragment$basicMutationReturnFields( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + ); + +Map _$Fragment$basicMutationReturnFieldsToJson( + Fragment$basicMutationReturnFields instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + }; + +Query$SystemSettings _$Query$SystemSettingsFromJson( + Map json) => + Query$SystemSettings( + system: Query$SystemSettings$system.fromJson( + json['system'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Query$SystemSettingsToJson( + Query$SystemSettings instance) => + { + 'system': instance.system.toJson(), + '__typename': instance.$__typename, + }; + +Query$SystemSettings$system _$Query$SystemSettings$systemFromJson( + Map json) => + Query$SystemSettings$system( + settings: Query$SystemSettings$system$settings.fromJson( + json['settings'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Query$SystemSettings$systemToJson( + Query$SystemSettings$system instance) => + { + 'settings': instance.settings.toJson(), + '__typename': instance.$__typename, + }; + +Query$SystemSettings$system$settings + _$Query$SystemSettings$system$settingsFromJson(Map json) => + Query$SystemSettings$system$settings( + autoUpgrade: + Query$SystemSettings$system$settings$autoUpgrade.fromJson( + json['autoUpgrade'] as Map), + ssh: Query$SystemSettings$system$settings$ssh.fromJson( + json['ssh'] as Map), + timezone: json['timezone'] as String, + $__typename: json['__typename'] as String, + ); + +Map _$Query$SystemSettings$system$settingsToJson( + Query$SystemSettings$system$settings instance) => + { + 'autoUpgrade': instance.autoUpgrade.toJson(), + 'ssh': instance.ssh.toJson(), + 'timezone': instance.timezone, + '__typename': instance.$__typename, + }; + +Query$SystemSettings$system$settings$autoUpgrade + _$Query$SystemSettings$system$settings$autoUpgradeFromJson( + Map json) => + Query$SystemSettings$system$settings$autoUpgrade( + allowReboot: json['allowReboot'] as bool, + enable: json['enable'] as bool, + $__typename: json['__typename'] as String, + ); + +Map _$Query$SystemSettings$system$settings$autoUpgradeToJson( + Query$SystemSettings$system$settings$autoUpgrade instance) => + { + 'allowReboot': instance.allowReboot, + 'enable': instance.enable, + '__typename': instance.$__typename, + }; + +Query$SystemSettings$system$settings$ssh + _$Query$SystemSettings$system$settings$sshFromJson( + Map json) => + Query$SystemSettings$system$settings$ssh( + enable: json['enable'] as bool, + passwordAuthentication: json['passwordAuthentication'] as bool, + $__typename: json['__typename'] as String, + ); + +Map _$Query$SystemSettings$system$settings$sshToJson( + Query$SystemSettings$system$settings$ssh instance) => + { + 'enable': instance.enable, + 'passwordAuthentication': instance.passwordAuthentication, + '__typename': instance.$__typename, + }; + +Query$SystemIsUsingBinds _$Query$SystemIsUsingBindsFromJson( + Map json) => + Query$SystemIsUsingBinds( + system: Query$SystemIsUsingBinds$system.fromJson( + json['system'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Query$SystemIsUsingBindsToJson( + Query$SystemIsUsingBinds instance) => + { + 'system': instance.system.toJson(), + '__typename': instance.$__typename, + }; + +Query$SystemIsUsingBinds$system _$Query$SystemIsUsingBinds$systemFromJson( + Map json) => + Query$SystemIsUsingBinds$system( + info: Query$SystemIsUsingBinds$system$info.fromJson( + json['info'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Query$SystemIsUsingBinds$systemToJson( + Query$SystemIsUsingBinds$system instance) => + { + 'info': instance.info.toJson(), + '__typename': instance.$__typename, + }; + +Query$SystemIsUsingBinds$system$info + _$Query$SystemIsUsingBinds$system$infoFromJson(Map json) => + Query$SystemIsUsingBinds$system$info( + usingBinds: json['usingBinds'] as bool, + $__typename: json['__typename'] as String, + ); + +Map _$Query$SystemIsUsingBinds$system$infoToJson( + Query$SystemIsUsingBinds$system$info instance) => + { + 'usingBinds': instance.usingBinds, + '__typename': instance.$__typename, + }; + +Query$DomainInfo _$Query$DomainInfoFromJson(Map json) => + Query$DomainInfo( + system: Query$DomainInfo$system.fromJson( + json['system'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Query$DomainInfoToJson(Query$DomainInfo instance) => + { + 'system': instance.system.toJson(), + '__typename': instance.$__typename, + }; + +Query$DomainInfo$system _$Query$DomainInfo$systemFromJson( + Map json) => + Query$DomainInfo$system( + domainInfo: Query$DomainInfo$system$domainInfo.fromJson( + json['domainInfo'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Query$DomainInfo$systemToJson( + Query$DomainInfo$system instance) => + { + 'domainInfo': instance.domainInfo.toJson(), + '__typename': instance.$__typename, + }; + +Query$DomainInfo$system$domainInfo _$Query$DomainInfo$system$domainInfoFromJson( + Map json) => + Query$DomainInfo$system$domainInfo( + domain: json['domain'] as String, + hostname: json['hostname'] as String, + provider: $enumDecode(_$Enum$DnsProviderEnumMap, json['provider'], + unknownValue: Enum$DnsProvider.$unknown), + requiredDnsRecords: (json['requiredDnsRecords'] as List) + .map((e) => + 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..49dbc91f --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart @@ -0,0 +1,4154 @@ +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 { + 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( + 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 { + 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: [ + 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 { + 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}) => + _res; + allServices(_fn) => _res; +} + +@JsonSerializable(explicitToJson: true) +class Query$AllServices$services$allServices { + Query$AllServices$services$allServices( + {required this.description, + required this.displayName, + this.dnsRecords, + required this.id, + required this.isEnabled, + required this.isMovable, + required this.isRequired, + required this.status, + required this.storageUsage, + required this.svgIcon, + this.url, + required this.$__typename}); + + @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 { + 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? dnsRecords, + String? id, + bool? isEnabled, + bool? isMovable, + bool? isRequired, + Enum$ServiceStatusEnum? status, + Query$AllServices$services$allServices$storageUsage? storageUsage, + String? svgIcon, + String? url, + String? $__typename}) => + _res; + dnsRecords(_fn) => _res; + CopyWith$Query$AllServices$services$allServices$storageUsage + get storageUsage => + CopyWith$Query$AllServices$services$allServices$storageUsage.stub( + _res); +} + +@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 { + 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? priority, + String? recordType, + int? ttl, + String? $__typename}) => + _res; +} + +@JsonSerializable(explicitToJson: true) +class Query$AllServices$services$allServices$storageUsage { + Query$AllServices$services$allServices$storageUsage( + {required this.title, + required this.usedSpace, + this.volume, + required this.$__typename}); + + @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 { + 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? volume, + String? $__typename}) => + _res; + CopyWith$Query$AllServices$services$allServices$storageUsage$volume + get volume => + CopyWith$Query$AllServices$services$allServices$storageUsage$volume + .stub(_res); +} + +@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 { + 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) +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; + } + + 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) +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 { + 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}) => + _res; + CopyWith$Mutation$EnableService$enableService get enableService => + CopyWith$Mutation$EnableService$enableService.stub(_res); +} + +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 { + 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) +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; + } + + 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) +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 { + 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}) => + _res; + CopyWith$Mutation$DisableService$disableService get disableService => + CopyWith$Mutation$DisableService$disableService.stub(_res); +} + +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 { + 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) +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; + } + + 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) +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 { + 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: [ + 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 { + 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) +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; + } + + 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) +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 { + 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}) => + _res; + CopyWith$Mutation$StartService$startService get startService => + CopyWith$Mutation$StartService$startService.stub(_res); +} + +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 { + 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) +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; + } + + 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) +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 { + 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}) => + _res; + CopyWith$Mutation$RestartService$restartService get restartService => + CopyWith$Mutation$RestartService$restartService.stub(_res); +} + +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 { + 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) +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; + } + + 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) +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 { + 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: [ + 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 { + 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? job}) => + _res; + CopyWith$Mutation$MoveService$moveService$job get job => + CopyWith$Mutation$MoveService$moveService$job.stub(_res); +} + +@JsonSerializable(explicitToJson: true) +class Mutation$MoveService$moveService$job { + Mutation$MoveService$moveService$job( + {required this.createdAt, + required this.description, + this.error, + this.finishedAt, + required this.name, + this.progress, + this.result, + required this.status, + this.statusText, + required this.uid, + required this.updatedAt, + required this.$__typename}); + + @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 { + 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? error, + DateTime? finishedAt, + String? name, + int? progress, + String? result, + String? status, + String? statusText, + String? uid, + DateTime? updatedAt, + String? $__typename}) => + _res; +} + +DateTime? _nullable$dateTimeFromJson(dynamic data) => + data == null ? null : dateTimeFromJson(data); +dynamic _nullable$dateTimeToJson(DateTime? data) => + data == null ? null : dateTimeToJson(data); diff --git a/lib/logic/api_maps/graphql_maps/schema/services.graphql.g.dart b/lib/logic/api_maps/graphql_maps/schema/services.graphql.g.dart new file mode 100644 index 00000000..405ab468 --- /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..78de71ff --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/users.graphql @@ -0,0 +1,72 @@ +fragment basicMutationReturnFields on MutationReturnInterface{ + code + message + success +} + +fragment userFields on User{ + username + userType + sshKeys +} + +query AllUsers { + users { + allUsers { + ...userFields + } + rootUser: getUser(username: "root") { + ...userFields + } + } +} + +query GetUser($username: String!) { + users { + getUser(username: $username) { + ...userFields + } + } +} + +mutation CreateUser($user: UserMutationInput!) { + createUser(user: $user) { + ...basicMutationReturnFields + user { + ...userFields + } + } +} + +mutation DeleteUser($username: String!) { + deleteUser(username: $username) { + ...basicMutationReturnFields + } +} + +mutation UpdateUser($user: UserMutationInput!) { + updateUser(user: $user) { + ...basicMutationReturnFields + user { + ...userFields + } + } +} + +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 new file mode 100644 index 00000000..a132155a --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart @@ -0,0 +1,3319 @@ +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 { + 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( + 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 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: 'getUser'), + alias: NameNode(value: 'rootUser'), + arguments: [ + ArgumentNode( + name: NameNode(value: 'username'), + value: StringValueNode(value: 'root', isBlock: false)) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'userFields'), directives: []), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), + 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, this.rootUser, required this.$__typename}); + + @override + 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$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; + 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$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; + 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, + 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 { + _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? 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 { + _CopyWithStubImpl$Query$AllUsers$users(this._res); + + TRes _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) +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}); + + @override + factory Variables$Mutation$CreateUser.fromJson(Map json) => + _$Variables$Mutation$CreateUserFromJson(json); + + final Input$UserMutationInput user; + + Map toJson() => _$Variables$Mutation$CreateUserToJson(this); + int get hashCode { + final l$user = user; + return Object.hashAll([l$user]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (!(other is Variables$Mutation$CreateUser) || + runtimeType != other.runtimeType) return false; + final l$user = user; + final lOther$user = other.user; + if (l$user != lOther$user) return false; + return true; + } + + CopyWith$Variables$Mutation$CreateUser + get copyWith => CopyWith$Variables$Mutation$CreateUser(this, (i) => i); +} + +abstract class CopyWith$Variables$Mutation$CreateUser { + factory CopyWith$Variables$Mutation$CreateUser( + Variables$Mutation$CreateUser instance, + TRes Function(Variables$Mutation$CreateUser) then) = + _CopyWithImpl$Variables$Mutation$CreateUser; + + 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) +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 { + 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: [ + 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: [ + 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$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 Fragment$userFields? 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 { + 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, + Fragment$userFields? user}); + CopyWith$Fragment$userFields get user; +} + +class _CopyWithImpl$Mutation$CreateUser$createUser + implements CopyWith$Mutation$CreateUser$createUser { + _CopyWithImpl$Mutation$CreateUser$createUser(this._instance, this._then); + + 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 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$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); +} + +@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; + } + + 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 == _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) +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 { + 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: [ + 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 { + 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) +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; + } + + 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) +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 { + 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: [ + 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: [ + 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$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 Fragment$userFields? 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 { + 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, + Fragment$userFields? user}); + CopyWith$Fragment$userFields get user; +} + +class _CopyWithImpl$Mutation$UpdateUser$updateUser + implements CopyWith$Mutation$UpdateUser$updateUser { + _CopyWithImpl$Mutation$UpdateUser$updateUser(this._instance, this._then); + + 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 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$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); +} + +@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: [ + 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( + {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 new file mode 100644 index 00000000..7fb93e4e --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/schema/users.graphql.g.dart @@ -0,0 +1,366 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'users.graphql.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Fragment$basicMutationReturnFields _$Fragment$basicMutationReturnFieldsFromJson( + Map json) => + Fragment$basicMutationReturnFields( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + ); + +Map _$Fragment$basicMutationReturnFieldsToJson( + Fragment$basicMutationReturnFields instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + }; + +Fragment$userFields _$Fragment$userFieldsFromJson(Map json) => + Fragment$userFields( + username: json['username'] as String, + userType: $enumDecode(_$Enum$UserTypeEnumMap, json['userType'], + unknownValue: Enum$UserType.$unknown), + sshKeys: + (json['sshKeys'] as List).map((e) => e as String).toList(), + $__typename: json['__typename'] as String, + ); + +Map _$Fragment$userFieldsToJson( + Fragment$userFields instance) => + { + 'username': instance.username, + 'userType': _$Enum$UserTypeEnumMap[instance.userType]!, + 'sshKeys': instance.sshKeys, + '__typename': instance.$__typename, + }; + +const _$Enum$UserTypeEnumMap = { + Enum$UserType.NORMAL: 'NORMAL', + Enum$UserType.PRIMARY: 'PRIMARY', + Enum$UserType.ROOT: 'ROOT', + Enum$UserType.$unknown: r'$unknown', +}; + +Query$AllUsers _$Query$AllUsersFromJson(Map json) => + Query$AllUsers( + users: + Query$AllUsers$users.fromJson(json['users'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Query$AllUsersToJson(Query$AllUsers instance) => + { + 'users': instance.users.toJson(), + '__typename': instance.$__typename, + }; + +Query$AllUsers$users _$Query$AllUsers$usersFromJson( + Map json) => + Query$AllUsers$users( + allUsers: (json['allUsers'] as List) + .map((e) => Fragment$userFields.fromJson(e as Map)) + .toList(), + rootUser: json['rootUser'] == null + ? null + : Fragment$userFields.fromJson( + json['rootUser'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Query$AllUsers$usersToJson( + Query$AllUsers$users instance) => + { + 'allUsers': instance.allUsers.map((e) => e.toJson()).toList(), + 'rootUser': instance.rootUser?.toJson(), + '__typename': instance.$__typename, + }; + +Variables$Query$GetUser _$Variables$Query$GetUserFromJson( + Map json) => + Variables$Query$GetUser( + username: json['username'] as String, + ); + +Map _$Variables$Query$GetUserToJson( + Variables$Query$GetUser instance) => + { + 'username': instance.username, + }; + +Query$GetUser _$Query$GetUserFromJson(Map json) => + Query$GetUser( + users: + Query$GetUser$users.fromJson(json['users'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Query$GetUserToJson(Query$GetUser instance) => + { + 'users': instance.users.toJson(), + '__typename': instance.$__typename, + }; + +Query$GetUser$users _$Query$GetUser$usersFromJson(Map json) => + Query$GetUser$users( + getUser: json['getUser'] == null + ? null + : Fragment$userFields.fromJson( + json['getUser'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Query$GetUser$usersToJson( + Query$GetUser$users instance) => + { + 'getUser': instance.getUser?.toJson(), + '__typename': instance.$__typename, + }; + +Variables$Mutation$CreateUser _$Variables$Mutation$CreateUserFromJson( + Map json) => + Variables$Mutation$CreateUser( + user: Input$UserMutationInput.fromJson( + json['user'] as Map), + ); + +Map _$Variables$Mutation$CreateUserToJson( + Variables$Mutation$CreateUser instance) => + { + 'user': instance.user.toJson(), + }; + +Mutation$CreateUser _$Mutation$CreateUserFromJson(Map json) => + Mutation$CreateUser( + createUser: Mutation$CreateUser$createUser.fromJson( + json['createUser'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$CreateUserToJson( + Mutation$CreateUser instance) => + { + 'createUser': instance.createUser.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$CreateUser$createUser _$Mutation$CreateUser$createUserFromJson( + Map json) => + Mutation$CreateUser$createUser( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + user: json['user'] == null + ? null + : Fragment$userFields.fromJson(json['user'] as Map), + ); + +Map _$Mutation$CreateUser$createUserToJson( + Mutation$CreateUser$createUser instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + 'user': instance.user?.toJson(), + }; + +Variables$Mutation$DeleteUser _$Variables$Mutation$DeleteUserFromJson( + Map json) => + Variables$Mutation$DeleteUser( + username: json['username'] as String, + ); + +Map _$Variables$Mutation$DeleteUserToJson( + Variables$Mutation$DeleteUser instance) => + { + 'username': instance.username, + }; + +Mutation$DeleteUser _$Mutation$DeleteUserFromJson(Map json) => + Mutation$DeleteUser( + deleteUser: Mutation$DeleteUser$deleteUser.fromJson( + json['deleteUser'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$DeleteUserToJson( + Mutation$DeleteUser instance) => + { + 'deleteUser': instance.deleteUser.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$DeleteUser$deleteUser _$Mutation$DeleteUser$deleteUserFromJson( + Map json) => + Mutation$DeleteUser$deleteUser( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$DeleteUser$deleteUserToJson( + Mutation$DeleteUser$deleteUser instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + }; + +Variables$Mutation$UpdateUser _$Variables$Mutation$UpdateUserFromJson( + Map json) => + Variables$Mutation$UpdateUser( + user: Input$UserMutationInput.fromJson( + json['user'] as Map), + ); + +Map _$Variables$Mutation$UpdateUserToJson( + Variables$Mutation$UpdateUser instance) => + { + 'user': instance.user.toJson(), + }; + +Mutation$UpdateUser _$Mutation$UpdateUserFromJson(Map json) => + Mutation$UpdateUser( + updateUser: Mutation$UpdateUser$updateUser.fromJson( + json['updateUser'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$UpdateUserToJson( + Mutation$UpdateUser instance) => + { + 'updateUser': instance.updateUser.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$UpdateUser$updateUser _$Mutation$UpdateUser$updateUserFromJson( + Map json) => + Mutation$UpdateUser$updateUser( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + user: json['user'] == null + ? null + : Fragment$userFields.fromJson(json['user'] as Map), + ); + +Map _$Mutation$UpdateUser$updateUserToJson( + Mutation$UpdateUser$updateUser instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + 'user': instance.user?.toJson(), + }; + +Variables$Mutation$AddSshKey _$Variables$Mutation$AddSshKeyFromJson( + Map json) => + Variables$Mutation$AddSshKey( + sshInput: Input$SshMutationInput.fromJson( + json['sshInput'] as Map), + ); + +Map _$Variables$Mutation$AddSshKeyToJson( + Variables$Mutation$AddSshKey instance) => + { + 'sshInput': instance.sshInput.toJson(), + }; + +Mutation$AddSshKey _$Mutation$AddSshKeyFromJson(Map json) => + Mutation$AddSshKey( + addSshKey: Mutation$AddSshKey$addSshKey.fromJson( + json['addSshKey'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$AddSshKeyToJson(Mutation$AddSshKey instance) => + { + 'addSshKey': instance.addSshKey.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$AddSshKey$addSshKey _$Mutation$AddSshKey$addSshKeyFromJson( + Map json) => + Mutation$AddSshKey$addSshKey( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + user: json['user'] == null + ? null + : Fragment$userFields.fromJson(json['user'] as Map), + ); + +Map _$Mutation$AddSshKey$addSshKeyToJson( + Mutation$AddSshKey$addSshKey instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + 'user': instance.user?.toJson(), + }; + +Variables$Mutation$RemoveSshKey _$Variables$Mutation$RemoveSshKeyFromJson( + Map json) => + Variables$Mutation$RemoveSshKey( + sshInput: Input$SshMutationInput.fromJson( + json['sshInput'] as Map), + ); + +Map _$Variables$Mutation$RemoveSshKeyToJson( + Variables$Mutation$RemoveSshKey instance) => + { + 'sshInput': instance.sshInput.toJson(), + }; + +Mutation$RemoveSshKey _$Mutation$RemoveSshKeyFromJson( + Map json) => + Mutation$RemoveSshKey( + removeSshKey: Mutation$RemoveSshKey$removeSshKey.fromJson( + json['removeSshKey'] as Map), + $__typename: json['__typename'] as String, + ); + +Map _$Mutation$RemoveSshKeyToJson( + Mutation$RemoveSshKey instance) => + { + 'removeSshKey': instance.removeSshKey.toJson(), + '__typename': instance.$__typename, + }; + +Mutation$RemoveSshKey$removeSshKey _$Mutation$RemoveSshKey$removeSshKeyFromJson( + Map json) => + Mutation$RemoveSshKey$removeSshKey( + code: json['code'] as int, + message: json['message'] as String, + success: json['success'] as bool, + $__typename: json['__typename'] as String, + user: json['user'] == null + ? null + : Fragment$userFields.fromJson(json['user'] as Map), + ); + +Map _$Mutation$RemoveSshKey$removeSshKeyToJson( + Mutation$RemoveSshKey$removeSshKey instance) => + { + 'code': instance.code, + 'message': instance.message, + 'success': instance.success, + '__typename': instance.$__typename, + 'user': instance.user?.toJson(), + }; diff --git a/lib/logic/api_maps/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..8d731e3e --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/server_api/jobs_api.dart @@ -0,0 +1,45 @@ +part of 'server.dart'; + +mixin JobsApi on ApiMap { + Future> getServerJobs() async { + QueryResult response; + List jobsList = []; + + try { + final GraphQLClient client = await getClient(); + response = await client.query$GetApiJobs(); + if (response.hasException) { + print(response.exception.toString()); + } + jobsList = jobsList = response.parsedData?.jobs.getJobs + .map((final job) => ServerJob.fromGraphQL(job)) + .toList() ?? + []; + } catch (e) { + print(e); + } + + return jobsList; + } + + Future removeApiJob(final String uid) async { + try { + final GraphQLClient client = await getClient(); + final variables = Variables$Mutation$RemoveJob(jobId: uid); + final mutation = Options$Mutation$RemoveJob(variables: variables); + final response = await client.mutate$RemoveJob(mutation); + return 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/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..0e20fb02 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/server_api/server.dart @@ -0,0 +1,196 @@ +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/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/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'; +part 'services_api.dart'; +part 'users_api.dart'; +part 'volume_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, ServicesApi, UsersApi { + ServerApi({ + this.hasLogger = false, + this.isWithToken = true, + this.customToken = '', + }); + + @override + bool hasLogger; + @override + bool isWithToken; + @override + String customToken; + @override + String? get rootAddress => getIt().serverDomain?.domainName; + + 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 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 = []; + + 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); + } + } + + Future setAutoUpgradeSettings( + final AutoUpgradeSettings settings, + ) async { + try { + final GraphQLClient client = await getClient(); + final input = Input$AutoUpgradeSettingsInput( + allowReboot: settings.allowReboot, + enableAutoUpgrade: settings.enable, + ); + final variables = Variables$Mutation$ChangeAutoUpgradeSettings( + settings: input, + ); + final mutation = Options$Mutation$ChangeAutoUpgradeSettings( + variables: variables, + ); + await client.mutate$ChangeAutoUpgradeSettings(mutation); + } catch (e) { + 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/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..780f1d37 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/server_api/server_actions_api.dart @@ -0,0 +1,64 @@ +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 => client.mutate$RebootSystem(), + ); + } catch (e) { + return false; + } + } + + Future pullConfigurationUpdate() async { + try { + final GraphQLClient client = await getClient(); + return await _commonBoolRequest( + () async => client.mutate$PullRepositoryChanges(), + ); + } catch (e) { + return false; + } + } + + Future upgrade() async { + try { + final GraphQLClient client = await getClient(); + return _commonBoolRequest( + () async => 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..62a55e15 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/server_api/services_api.dart @@ -0,0 +1,159 @@ +part of 'server.dart'; + +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/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..be7d4fb0 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/server_api/users_api.dart @@ -0,0 +1,203 @@ +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() ?? + []; + final rootUser = response.parsedData?.users.rootUser; + if (rootUser != null) { + users.add(User.fromGraphQL(rootUser)); + } + } 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()); + } + final responseUser = response.parsedData?.users.getUser; + if (responseUser != null) { + user = User.fromGraphQL(responseUser); + } + } 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/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..4865a565 --- /dev/null +++ b/lib/logic/api_maps/graphql_maps/server_api/volume_api.dart @@ -0,0 +1,109 @@ +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; + 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 migrateToBinds( + final Map serviceToDisk, + ) async { + MigrateToBindsMutationReturn? mutation; + + 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); + final QueryResult result = + await client.mutate$MigrateToBinds( + migrateMutation, + ); + 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 mutation; + } +} diff --git a/lib/logic/api_maps/hetzner.dart b/lib/logic/api_maps/hetzner.dart deleted file mode 100644 index 4de4f36f..00000000 --- a/lib/logic/api_maps/hetzner.dart +++ /dev/null @@ -1,277 +0,0 @@ -import 'dart:convert'; -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/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; - - @override - BaseOptions get options { - final BaseOptions options = BaseOptions(baseUrl: rootAddress); - if (isWithToken) { - final String? token = getIt().hetznerKey; - assert(token != null); - options.headers = {'Authorization': 'Bearer $token'}; - } - - if (validateStatus != null) { - options.validateStatus = validateStatus!; - } - - return options; - } - - @override - String rootAddress = 'https://api.hetzner.cloud/v1'; - - Future isValid(final String token) async { - validateStatus = (final int? status) => - status == HttpStatus.ok || status == HttpStatus.unauthorized; - 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}'); - } - } - - Future createVolume() async { - 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'], - ); - } - - Future createServer({ - required final String cloudFlareKey, - required final User rootUser, - required final String domainName, - required final ServerVolume dataBase, - }) async { - final Dio client = await getClient(); - - final String dbPassword = StringGenerators.dbPassword(); - final int dbId = dataBase.id; - - final String apiToken = StringGenerators.apiToken(); - - final String hostname = getHostnameFromDomain(domainName); - - final String base64Password = - base64.encode(utf8.encode(rootUser.password ?? 'PASS')); - - print('hostname: $hostname'); - - /// add ssh key when you need it: e.g. "ssh_keys":["kherel"] - /// 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"; - print(userdataString); - - final Map data = { - 'name': hostname, - 'server_type': 'cx11', - 'start_after_create': false, - 'image': 'ubuntu-20.04', - 'volumes': [dbId], - 'networks': [], - 'user_data': userdataString, - 'labels': {}, - 'automount': true, - 'location': 'fsn1' - }; - print('Decoded data: $data'); - - ServerHostingDetails? serverDetails; - - try { - final Response serverCreateResponse = await client.post( - '/servers', - data: data, - ); - print(serverCreateResponse.data); - serverDetails = ServerHostingDetails( - id: serverCreateResponse.data['server']['id'], - ip4: serverCreateResponse.data['server']['public_net']['ipv4']['ip'], - createTime: DateTime.now(), - volume: dataBase, - apiToken: apiToken, - provider: ServerProvider.hetzner, - ); - } on DioError catch (e) { - print(e); - rethrow; - } catch (e) { - print(e); - } finally { - client.close(); - } - - return serverDetails; - } - - static String getHostnameFromDomain(final String domain) { - // Replace all non-alphanumeric characters with an underscore - String hostname = - domain.split('.')[0].replaceAll(RegExp(r'[^a-zA-Z0-9]'), '-'); - if (hostname.endsWith('-')) { - hostname = hostname.substring(0, hostname.length - 1); - } - if (hostname.startsWith('-')) { - hostname = hostname.substring(1); - } - if (hostname.isEmpty) { - hostname = 'selfprivacy-server'; - } - - return hostname; - } - - Future deleteSelfprivacyServerAndAllVolumes({ - required final String domainName, - }) async { - final Dio client = await getClient(); - - final String hostname = getHostnameFromDomain(domainName); - - final Response serversReponse = await client.get('/servers'); - final List servers = serversReponse.data['servers']; - final Map server = servers.firstWhere((final el) => el['name'] == hostname); - final List volumes = server['volumes']; - final List laterFutures = []; - - for (final volumeId in volumes) { - await client.post('/volumes/$volumeId/actions/detach'); - } - await Future.delayed(const Duration(seconds: 10)); - - for (final volumeId in volumes) { - laterFutures.add(client.delete('/volumes/$volumeId')); - } - laterFutures.add(client.delete('/servers/${server['id']}')); - - await Future.wait(laterFutures); - close(client); - } - - Future reset() async { - final ServerHostingDetails server = getIt().serverDetails!; - - final Dio client = await getClient(); - await client.post('/servers/${server.id}/actions/reset'); - close(client); - - return server.copyWith(startTime: DateTime.now()); - } - - Future powerOn() async { - final ServerHostingDetails server = getIt().serverDetails!; - - final Dio client = await getClient(); - await client.post('/servers/${server.id}/actions/poweron'); - close(client); - - return server.copyWith(startTime: DateTime.now()); - } - - Future> getMetrics( - final DateTime start, - final DateTime end, - final String type, - ) 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; - } - - 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']); - } - - 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)) - .toList(); - } - - Future createReverseDns({ - required final String ip4, - required final String domainName, - }) async { - final ServerHostingDetails? hetznerServer = - getIt().serverDetails; - - final Dio client = await getClient(); - try { - await client.post( - '/servers/${hetznerServer!.id}/actions/change_dns_ptr', - data: { - 'ip': ip4, - 'dns_ptr': domainName, - }, - ); - } catch (e) { - print(e); - } finally { - close(client); - } - } -} 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..18b4ea33 --- /dev/null +++ b/lib/logic/api_maps/rest_maps/api_factory_creator.dart @@ -0,0 +1,48 @@ +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 ServerProviderApiFactory createServerProviderApiFactory( + final ServerProvider provider, + ) { + switch (provider) { + case ServerProvider.hetzner: + return HetznerApiFactory(); + case ServerProvider.unknown: + throw UnknownApiProviderException('Unknown server provider'); + } + } + + static DnsProviderApiFactory createDnsProviderApiFactory( + final DnsProvider provider, + ) { + switch (provider) { + case DnsProvider.cloudflare: + return CloudflareApiFactory(); + case DnsProvider.unknown: + throw UnknownApiProviderException('Unknown DNS provider'); + } + } +} + +class VolumeApiFactoryCreator { + static VolumeProviderApiFactory createVolumeProviderApiFactory( + final ServerProvider provider, + ) { + switch (provider) { + case ServerProvider.hetzner: + return HetznerApiFactory(); + case ServerProvider.unknown: + throw UnknownApiProviderException('Unknown volume provider'); + } + } +} 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/dns_providers/cloudflare/cloudflare.dart similarity index 54% rename from lib/logic/api_maps/cloudflare.dart rename to lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart index 9141d5fe..3088de67 100644 --- a/lib/logic/api_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/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,110 +45,133 @@ 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; } - Future getZoneId(final String domain) async { - validateStatus = (final status) => - status == HttpStatus.ok || status == HttpStatus.forbidden; + @override + 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 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'; 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 Future> getDnsRecords({ - required final ServerDomain cloudFlareDomain, + required final ServerDomain domain, }) async { - final String domainName = cloudFlareDomain.domainName; - final String domainZoneId = cloudFlareDomain.zoneId; + 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; } + @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 +241,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( @@ -234,26 +257,38 @@ class CloudflareApi extends ApiMap { ); 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/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..6680975e --- /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/server.dart b/lib/logic/api_maps/rest_maps/server.dart similarity index 89% rename from lib/logic/api_maps/server.dart rename to lib/logic/api_maps/rest_maps/server.dart index 67a0739c..f7e78eba 100644 --- a/lib/logic/api_maps/server.dart +++ b/lib/logic/api_maps/rest_maps/server.dart @@ -4,19 +4,17 @@ 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'; 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'; import 'package:selfprivacy/logic/models/timezone_settings.dart'; -import 'package:selfprivacy/logic/api_maps/api_map.dart'; - class ApiResponse { ApiResponse({ required this.statusCode, @@ -46,16 +44,20 @@ class ServerApi extends ApiMap { @override BaseOptions get options { - BaseOptions options = BaseOptions(); + BaseOptions options = BaseOptions( + connectTimeout: 10000, + receiveTimeout: 10000, + ); 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( baseUrl: 'https://api.$domainName', + connectTimeout: 10000, + receiveTimeout: 10000, headers: { 'Authorization': 'Bearer $apiToken', }, @@ -65,6 +67,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, @@ -99,8 +103,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); } @@ -126,6 +130,7 @@ class ServerApi extends ApiMap { statusCode: e.response?.statusCode ?? HttpStatus.internalServerError, data: User( login: user.login, + type: UserType.normal, password: user.password, isFoundOnServer: false, ), @@ -152,6 +157,7 @@ class ServerApi extends ApiMap { statusCode: code, data: User( login: user.login, + type: UserType.normal, password: user.password, isFoundOnServer: isFoundOnServer, ), @@ -403,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, }; } @@ -558,51 +564,21 @@ 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 { - // 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 { @@ -621,36 +597,23 @@ class ServerApi extends ApiMap { 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); - return null; } finally { close(client); } - if (response.statusCode == null) { - return null; - } - - if (response.statusCode == HttpStatus.notFound || response.data == null) { - throw Exception('No DKIM key found'); - } - - if (response.statusCode != HttpStatus.ok) { - return ''; - } - - final Codec base64toString = utf8.fuse(base64); - - return base64toString - .decode(response.data) - .split('(')[1] - .split(')')[0] - .replaceAll('"', ''); + return dkim; } Future> getRecoveryTokenStatus() async { @@ -914,15 +877,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/api_maps/rest_maps/server_providers/hetzner/hetzner.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart new file mode 100644 index 00000000..8340676d --- /dev/null +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart @@ -0,0 +1,558 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:dio/dio.dart'; +import 'package:selfprivacy/config/get_it_config.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/volume_provider.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; +import 'package:selfprivacy/logic/models/hive/server_domain.dart'; +import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart'; +import 'package:selfprivacy/logic/models/hive/server_details.dart'; +import 'package:selfprivacy/logic/models/hive/user.dart'; +import 'package:selfprivacy/logic/models/server_basic_info.dart'; +import 'package:selfprivacy/utils/password_generator.dart'; + +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 { + final BaseOptions options = BaseOptions(baseUrl: rootAddress); + if (isWithToken) { + final String? token = getIt().hetznerKey; + assert(token != null); + options.headers = {'Authorization': 'Bearer $token'}; + } + + if (validateStatus != null) { + options.validateStatus = validateStatus!; + } + + return options; + } + + @override + String rootAddress = 'https://api.hetzner.cloud/v1'; + + @override + Future isApiTokenValid(final String token) async { + bool isValid = false; + Response? response; + final Dio client = await getClient(); + 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 getPricePerGb() async { + double? price; + + final Response dbGetResponse; + final Dio client = await getClient(); + try { + dbGetResponse = await client.get('/pricing'); + + final volume = dbGetResponse.data['pricing']['volume']; + final volumePrice = volume['price_per_gb_month']['gross']; + price = double.parse(volumePrice); + } catch (e) { + print(e); + } finally { + client.close(); + } + + return price; + } + + @override + Future createVolume() async { + ServerVolume? volume; + + final Response dbCreateResponse; + final Dio client = await getClient(); + 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 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); + } finally { + client.close(); + } + + return volume; + } + + @override + 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 int dbSize = rawVolume['size'] * 1024 * 1024 * 1024; + 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); + } + } catch (e) { + print(e); + } finally { + client.close(); + } + + return volumes; + } + + @override + 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 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); + } finally { + client.close(); + } + + return volume; + } + + @override + Future deleteVolume(final int id) async { + final Dio client = await getClient(); + try { + await client.delete('/volumes/$id'); + } catch (e) { + print(e); + } finally { + client.close(); + } + } + + @override + 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; + } + + @override + 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; + } + + @override + 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; + } + + @override + Future createServer({ + 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 createServerWithVolume( + dnsApiToken: dnsApiToken, + rootUser: rootUser, + domainName: domainName, + dataBase: newVolume, + ); + + return details; + } + + Future createServerWithVolume({ + required final String dnsApiToken, + required final User rootUser, + required final String domainName, + required final ServerVolume dataBase, + }) async { + final Dio client = await getClient(); + + final String dbPassword = StringGenerators.dbPassword(); + final int dbId = dataBase.id; + + final String apiToken = StringGenerators.apiToken(); + + final String hostname = getHostnameFromDomain(domainName); + + final String base64Password = + base64.encode(utf8.encode(rootUser.password ?? 'PASS')); + + print('hostname: $hostname'); + + /// add ssh key when you need it: e.g. "ssh_keys":["kherel"] + /// 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=$dnsApiToken DB_PASSWORD=$dbPassword API_TOKEN=$apiToken HOSTNAME=$hostname bash 2>&1 | tee /tmp/infect.log"; + print(userdataString); + + final Map data = { + 'name': hostname, + 'server_type': 'cx11', + 'start_after_create': false, + 'image': 'ubuntu-20.04', + 'volumes': [dbId], + 'networks': [], + 'user_data': userdataString, + 'labels': {}, + 'automount': true, + 'location': 'fsn1' + }; + print('Decoded data: $data'); + + ServerHostingDetails? serverDetails; + DioError? hetznerError; + bool success = false; + + try { + final Response serverCreateResponse = await client.post( + '/servers', + data: data, + ); + print(serverCreateResponse.data); + serverDetails = ServerHostingDetails( + id: serverCreateResponse.data['server']['id'], + ip4: serverCreateResponse.data['server']['public_net']['ipv4']['ip'], + createTime: DateTime.now(), + volume: dataBase, + apiToken: apiToken, + provider: ServerProvider.hetzner, + ); + success = true; + } on DioError catch (e) { + print(e); + hetznerError = e; + } catch (e) { + print(e); + } finally { + client.close(); + } + + if (!success) { + await Future.delayed(const Duration(seconds: 10)); + await deleteVolume(dbId); + } + + if (hetznerError != null) { + throw hetznerError; + } + + return serverDetails; + } + + static String getHostnameFromDomain(final String domain) { + // Replace all non-alphanumeric characters with an underscore + String hostname = + domain.split('.')[0].replaceAll(RegExp(r'[^a-zA-Z0-9]'), '-'); + if (hostname.endsWith('-')) { + hostname = hostname.substring(0, hostname.length - 1); + } + if (hostname.startsWith('-')) { + hostname = hostname.substring(1); + } + if (hostname.isEmpty) { + hostname = 'selfprivacy-server'; + } + + return hostname; + } + + @override + Future deleteServer({ + required final String domainName, + }) async { + final Dio client = await getClient(); + + final String hostname = getHostnameFromDomain(domainName); + + final Response serversReponse = await client.get('/servers'); + final List servers = serversReponse.data['servers']; + final Map server = servers.firstWhere((final el) => el['name'] == hostname); + final List volumes = server['volumes']; + final List laterFutures = []; + + for (final volumeId in volumes) { + await client.post('/volumes/$volumeId/actions/detach'); + } + await Future.delayed(const Duration(seconds: 10)); + + for (final volumeId in volumes) { + laterFutures.add(client.delete('/volumes/$volumeId')); + } + laterFutures.add(client.delete('/servers/${server['id']}')); + + await Future.wait(laterFutures); + close(client); + } + + @override + Future restart() async { + final ServerHostingDetails server = getIt().serverDetails!; + + final Dio client = await getClient(); + 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(); + try { + await client.post('/servers/${server.id}/actions/poweron'); + } catch (e) { + print(e); + } finally { + close(client); + } + + return server.copyWith(startTime: DateTime.now()); + } + + Future> getMetrics( + final DateTime start, + final DateTime end, + final String type, + ) async { + final ServerHostingDetails? hetznerServer = + getIt().serverDetails; + + 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 { + 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']); + } + + @override + Future> getServers() async { + List servers = []; + + final Dio client = await getClient(); + try { + final Response response = await client.get('/servers'); + servers = response.data!['servers'] + .map( + (final e) => HetznerServerInfo.fromJson(e), + ) + .toList() + .where( + (final server) => server.publicNet.ipv4 != null, + ) + .map( + (final server) => ServerBasicInfo( + id: server.id, + name: server.name, + ip: server.publicNet.ipv4.ip, + reverseDns: server.publicNet.ipv4.reverseDns, + created: server.created, + volumeId: server.volumes.isNotEmpty ? server.volumes[0] : 0, + ), + ) + .toList(); + } catch (e) { + print(e); + } finally { + close(client); + } + + print(servers); + return servers; + } + + @override + Future createReverseDns({ + required final ServerHostingDetails serverDetails, + required final ServerDomain domain, + }) async { + final Dio client = await getClient(); + try { + await client.post( + '/servers/${serverDetails.id}/actions/change_dns_ptr', + data: { + 'ip': serverDetails.ip4, + 'dns_ptr': domain.domainName, + }, + ); + } catch (e) { + print(e); + } finally { + close(client); + } + } +} 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/server_providers/server_provider.dart b/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart new file mode 100644 index 00000000..010ebd75 --- /dev/null +++ b/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart @@ -0,0 +1,26 @@ +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/server_basic_info.dart'; + +abstract class ServerProviderApi extends ApiMap { + 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/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/server_providers/volume_provider.dart b/lib/logic/api_maps/rest_maps/server_providers/volume_provider.dart new file mode 100644 index 00000000..bdff72f2 --- /dev/null +++ b/lib/logic/api_maps/rest_maps/server_providers/volume_provider.dart @@ -0,0 +1,13 @@ +import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; +import 'package:selfprivacy/logic/models/hive/server_details.dart'; + +mixin VolumeProviderApi on ApiMap { + 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); + Future getPricePerGb(); +} diff --git a/lib/logic/common_enum/common_enum.dart b/lib/logic/common_enum/common_enum.dart index 3a1a4d80..77c2fa82 100644 --- a/lib/logic/common_enum/common_enum.dart +++ b/lib/logic/common_enum/common_enum.dart @@ -20,97 +20,104 @@ 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 { - 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 +125,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/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/jobs/jobs_cubit.dart b/lib/logic/cubit/client_jobs/client_jobs_cubit.dart similarity index 77% rename from lib/logic/cubit/jobs/jobs_cubit.dart rename to lib/logic/cubit/client_jobs/client_jobs_cubit.dart index 6de64677..4fa610cd 100644 --- a/lib/logic/cubit/jobs/jobs_cubit.dart +++ b/lib/logic/cubit/client_jobs/client_jobs_cubit.dart @@ -1,15 +1,17 @@ +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/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'; export 'package:provider/provider.dart'; -part 'jobs_state.dart'; +part 'client_jobs_state.dart'; class JobsCubit extends Cubit { JobsCubit({ @@ -21,10 +23,11 @@ class JobsCubit extends Cubit { 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()); @@ -37,14 +40,14 @@ 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); @@ -56,9 +59,9 @@ class JobsCubit extends Cubit { } 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); @@ -98,10 +101,11 @@ class JobsCubit extends Cubit { Future applyAll() async { if (state is JobsStateWithJobs) { - final List jobs = (state as JobsStateWithJobs).jobList; + final List jobs = (state as JobsStateWithJobs).clientJobList; emit(JobsStateLoading()); bool hasServiceJobs = false; - for (final Job job in jobs) { + for (final ClientJob job in jobs) { + // TODO: Rewrite to polymorphism if (job is CreateUserJob) { await usersCubit.createUser(job.user); } @@ -110,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); @@ -118,10 +122,17 @@ 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!); + } + if (job is RebuildServerJob) { + await upgradeServer(); + } } await api.pullConfigurationUpdate(); await api.apply(); + if (hasServiceJobs) { await servicesCubit.load(); } diff --git a/lib/logic/cubit/jobs/jobs_state.dart b/lib/logic/cubit/client_jobs/client_jobs_state.dart similarity index 59% rename from lib/logic/cubit/jobs/jobs_state.dart rename to lib/logic/cubit/client_jobs/client_jobs_state.dart index dbcf968e..2bb31856 100644 --- a/lib/logic/cubit/jobs/jobs_state.dart +++ b/lib/logic/cubit/client_jobs/client_jobs_state.dart @@ -1,4 +1,4 @@ -part of 'jobs_cubit.dart'; +part of 'client_jobs_cubit.dart'; abstract class JobsState extends Equatable { @override @@ -10,13 +10,11 @@ class JobsStateLoading extends JobsState {} class JobsStateEmpty extends JobsState {} class JobsStateWithJobs extends JobsState { - JobsStateWithJobs(this.jobList); - final List jobList; - + JobsStateWithJobs(this.clientJobList); + 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(); } @@ -24,5 +22,5 @@ class JobsStateWithJobs extends JobsState { } @override - List get props => jobList; + List get props => clientJobList; } diff --git a/lib/logic/cubit/devices/devices_cubit.dart b/lib/logic/cubit/devices/devices_cubit.dart index f0380635..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'; @@ -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/dns_records/dns_records_cubit.dart b/lib/logic/cubit/dns_records/dns_records_cubit.dart index 0590b065..93ff3db8 100644 --- a/lib/logic/cubit/dns_records/dns_records_cubit.dart +++ b/lib/logic/cubit/dns_records/dns_records_cubit.dart @@ -1,10 +1,12 @@ 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/cloudflare.dart'; -import 'package:selfprivacy/logic/api_maps/server.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(); } @@ -130,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 [ @@ -195,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/forms/setup/initializing/backblaze_form_cubit.dart b/lib/logic/cubit/forms/setup/initializing/backblaze_form_cubit.dart index 4769286d..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'; @@ -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/dns_provider_form_cubit.dart similarity index 72% 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 01d26835..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/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,24 +29,25 @@ 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; } 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/domain_cloudflare.dart b/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart similarity index 69% rename from lib/logic/cubit/forms/setup/initializing/domain_cloudflare.dart rename to lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart index 89b50a62..a1c458fb 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/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,20 +28,24 @@ 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, - 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/forms/setup/initializing/hetzner_form_cubit.dart b/lib/logic/cubit/forms/setup/initializing/provider_form_cubit.dart similarity index 72% rename from lib/logic/cubit/forms/setup/initializing/hetzner_form_cubit.dart rename to lib/logic/cubit/forms/setup/initializing/provider_form_cubit.dart index b8f47e10..9f3b5d58 100644 --- a/lib/logic/cubit/forms/setup/initializing/hetzner_form_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/provider_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.getServerProviderApiTokenValidation(); apiKey = FieldCubit( initalValue: '', validations: [ @@ -30,24 +30,25 @@ 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 + .isServerProviderApiTokenValid(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/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/setup/recovering/recovery_domain_form_cubit.dart b/lib/logic/cubit/forms/setup/recovering/recovery_domain_form_cubit.dart index 664b87b8..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'; @@ -18,8 +18,9 @@ class RecoveryDomainFormCubit extends FormCubit { @override FutureOr onSubmit() async { - initializingCubit - .submitDomainForAccessRecovery(serverDomainField.state.value); + initializingCubit.submitDomainForAccessRecovery( + serverDomainField.state.value.toLowerCase(), + ); } @override diff --git a/lib/logic/cubit/forms/user/ssh_form_cubit.dart b/lib/logic/cubit/forms/user/ssh_form_cubit.dart index ba38a642..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'; @@ -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/forms/user/user_form_cubit.dart b/lib/logic/cubit/forms/user/user_form_cubit.dart index a385befb..c60fef9e 100644 --- a/lib/logic/cubit/forms/user/user_form_cubit.dart +++ b/lib/logic/cubit/forms/user/user_form_cubit.dart @@ -1,37 +1,60 @@ import 'dart:async'; import 'package:cubit_form/cubit_form.dart'; +import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.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/models/job.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 { 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, - 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; @@ -42,4 +65,5 @@ class UserFormCubit extends FormCubit { } final JobsCubit jobsCubit; + final User? initialUser; } diff --git a/lib/logic/cubit/hetzner_metrics/hetzner_metrics_cubit.dart b/lib/logic/cubit/hetzner_metrics/hetzner_metrics_cubit.dart index aaae36c5..1cfdc23a 100644 --- a/lib/logic/cubit/hetzner_metrics/hetzner_metrics_cubit.dart +++ b/lib/logic/cubit/hetzner_metrics/hetzner_metrics_cubit.dart @@ -39,12 +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), - ); - - emit(newState); + 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 de7f3d43..134c955e 100644 --- a/lib/logic/cubit/hetzner_metrics/hetzner_metrics_repository.dart +++ b/lib/logic/cubit/hetzner_metrics/hetzner_metrics_repository.dart @@ -1,9 +1,14 @@ -import 'package:selfprivacy/logic/api_maps/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'; 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(); @@ -21,7 +26,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'), @@ -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, 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..6a1c7d16 --- /dev/null +++ b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart @@ -0,0 +1,141 @@ +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'; +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/disk_status.dart'; + +part 'provider_volume_state.dart'; + +class ApiProviderVolumeCubit + extends ServerInstallationDependendCubit { + ApiProviderVolumeCubit(final ServerInstallationCubit serverInstallationCubit) + : super(serverInstallationCubit, const ApiProviderVolumeState.initial()); + + VolumeProviderApiFactory? providerApi; + + final ServerApi serverApi = ServerApi(); + + @override + Future load() async { + if (serverInstallationCubit.state is ServerInstallationFinished) { + final serverDetails = getIt().serverDetails; + providerApi = serverDetails == null + ? null + : VolumeApiFactoryCreator.createVolumeProviderApiFactory( + getIt().serverDetails!.provider, + ); + _refetch(); + } + } + + Future getPricePerGb() async => + providerApi!.getVolumeProvider().getPricePerGb(); + + Future refresh() async { + emit(const ApiProviderVolumeState([], LoadingStatus.refreshing, false)); + _refetch(); + } + + Future _refetch() async { + if (providerApi == null) { + return emit(const ApiProviderVolumeState([], LoadingStatus.error, false)); + } + + final List volumes = + await providerApi!.getVolumeProvider().getVolumes(); + + if (volumes.isEmpty) { + return emit(const ApiProviderVolumeState([], LoadingStatus.error, false)); + } + + emit(ApiProviderVolumeState(volumes, LoadingStatus.success, false)); + } + + Future attachVolume(final DiskVolume volume) async { + final ServerHostingDetails server = getIt().serverDetails!; + await providerApi! + .getVolumeProvider() + .attachVolume(volume.providerVolume!.id, server.id); + refresh(); + } + + Future detachVolume(final DiskVolume volume) async { + await providerApi! + .getVolumeProvider() + .detachVolume(volume.providerVolume!.id); + refresh(); + } + + 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, + ); + + if (!resized) { + 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); + 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; + } + + Future createVolume() async { + final ServerVolume? volume = + await providerApi!.getVolumeProvider().createVolume(); + + final diskVolume = DiskVolume(providerVolume: volume); + await attachVolume(diskVolume); + + 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..3858ef14 --- /dev/null +++ b/lib/logic/cubit/provider_volumes/provider_volume_state.dart @@ -0,0 +1,27 @@ +part of 'provider_volume_cubit.dart'; + +class ApiProviderVolumeState extends ServerInstallationDependendState { + const ApiProviderVolumeState(this._volumes, this.status, this.isResizing); + + const ApiProviderVolumeState.initial() + : 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 + List get props => [_volumes, status, isResizing]; +} 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..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 @@ -1,33 +1,48 @@ -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/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'; 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(); 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'); } } + + @override + void clear() { + emit(ServerDetailsNotReady()); + } + + @override + void load() async { + check(); + } } 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..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,21 +1,37 @@ -import 'package:selfprivacy/logic/api_maps/hetzner.dart'; -import 'package:selfprivacy/logic/api_maps/server.dart'; -import 'package:selfprivacy/logic/models/json/auto_upgrade_settings.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.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'; class ServerDetailsRepository { - HetznerApi hetznerAPi = HetznerApi(); - ServerApi selfprivacyServer = ServerApi(); + HetznerApi hetzner = HetznerApi(); + ServerApi server = ServerApi(); Future load() async { - print('load'); + final settings = await server.getSystemSettings(); return ServerDetailsRepositoryDto( - autoUpgradeSettings: await selfprivacyServer.getAutoUpgradeSettings(), - hetznerServerInfo: await hetznerAPi.getInfo(), - serverTimezone: await selfprivacyServer.getServerTimezone(), + 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/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/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index ef83104d..9cb68359 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -4,6 +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/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'; @@ -49,13 +51,40 @@ class ServerInstallationCubit extends Cubit { } } + RegExp getServerProviderApiTokenValidation() => + repository.serverProviderApiFactory! + .getServerProvider() + .getApiTokenValidation(); + + RegExp getDnsProviderApiTokenValidation() => repository.dnsProviderApiFactory! + .getDnsProvider() + .getApiTokenValidation(); + + Future isServerProviderApiTokenValid( + final String providerToken, + ) async => + repository.serverProviderApiFactory! + .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 { await repository.saveHetznerKey(hetznerKey); if (state is ServerInstallationRecovery) { emit( (state as ServerInstallationRecovery).copyWith( - hetznerKey: hetznerKey, + providerApiToken: hetznerKey, currentStep: RecoveryStep.serverSelection, ), ); @@ -63,7 +92,9 @@ class ServerInstallationCubit extends Cubit { } emit( - (state as ServerInstallationNotFinished).copyWith(hetznerKey: hetznerKey), + (state as ServerInstallationNotFinished).copyWith( + providerApiToken: hetznerKey, + ), ); } @@ -117,7 +148,7 @@ class ServerInstallationCubit extends Cubit { Future onSuccess(final ServerHostingDetails serverDetails) async { await repository.createDnsRecords( - serverDetails.ip4, + serverDetails, state.serverDomain!, onCancel: onCancel, ); @@ -167,6 +198,7 @@ class ServerInstallationCubit extends Cubit { final ServerHostingDetails server = await repository.startServer( dataState.serverDetails!, ); + await repository.saveServerDetails(server); await repository.saveIsServerStarted(true); @@ -292,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, @@ -417,11 +461,11 @@ class ServerInstallationCubit extends Cubit { ), ); break; - case RecoveryStep.serverSelection: - repository.deleteHetznerKey(); + case RecoveryStep.cloudflareToken: + repository.deleteServerDetails(); emit( dataState.copyWith( - currentStep: RecoveryStep.hetznerToken, + currentStep: RecoveryStep.serverSelection, ), ); break; @@ -464,7 +508,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( @@ -491,6 +535,9 @@ class ServerInstallationCubit extends Cubit { volume: ServerVolume( id: server.volumeId, name: 'recovered_volume', + sizeByte: 0, + serverId: server.id, + linuxDevice: '', ), apiToken: dataState.serverDetails!.apiToken, provider: ServerProvider.hetzner, @@ -561,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.hetznerKey}'); - 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() { @@ -597,7 +626,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 5d4db8fe..76089229 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -9,23 +9,24 @@ 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/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/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'; 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/message.dart'; 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; @@ -39,9 +40,17 @@ class ServerAuthorizationException implements Exception { class ServerInstallationRepository { Box box = Hive.box(BNames.serverInstallationBox); Box usersBox = Hive.box(BNames.usersBox); + 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? hetznerToken = getIt().hetznerKey; + final String? providerApiToken = getIt().hetznerKey; final String? cloudflareToken = getIt().cloudFlareKey; final ServerDomain? serverDomain = getIt().serverDomain; final BackblazeCredential? backblazeCredential = @@ -49,9 +58,23 @@ class ServerInstallationRepository { final ServerHostingDetails? serverDetails = getIt().serverDetails; + if (serverDetails != null && + serverDetails.provider != ServerProvider.unknown) { + serverProviderApiFactory = + ApiFactoryCreator.createServerProviderApiFactory( + serverDetails.provider, + ); + } + + if (serverDomain != null && serverDomain.provider != DnsProvider.unknown) { + dnsProviderApiFactory = ApiFactoryCreator.createDnsProviderApiFactory( + serverDomain.provider, + ); + } + if (box.get(BNames.hasFinalChecked, defaultValue: false)) { return ServerInstallationFinished( - hetznerKey: hetznerToken!, + providerApiToken: providerApiToken!, cloudFlareKey: cloudflareToken!, serverDomain: serverDomain!, backblazeCredential: backblazeCredential!, @@ -68,14 +91,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 +108,7 @@ class ServerInstallationRepository { } return ServerInstallationNotFinished( - hetznerKey: hetznerToken, + providerApiToken: providerApiToken, cloudFlareKey: cloudflareToken, serverDomain: serverDomain, backblazeCredential: backblazeCredential, @@ -130,24 +153,24 @@ class ServerInstallationRepository { Future startServer( final ServerHostingDetails hetznerServer, ) async { - final HetznerApi hetznerApi = HetznerApi(); - final ServerHostingDetails serverDetails = await hetznerApi.powerOn(); + ServerHostingDetails serverDetails; + + 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); - return domainId; - } on DomainNotFoundException { - return null; - } + final String? domainId = await dnsProviderApi.getZoneId(domain); + return domainId; } Future> isDnsAddressesMatch( @@ -208,18 +231,14 @@ class ServerInstallationRepository { required final Future Function(ServerHostingDetails serverDetails) onSuccess, }) async { - final HetznerApi hetznerApi = HetznerApi(); - late ServerVolume dataBase; - + final ServerProviderApi api = serverProviderApiFactory!.getServerProvider(); try { - dataBase = await hetznerApi.createVolume(); - - 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) { print('Server is not initialized!'); return; @@ -238,17 +257,58 @@ class ServerInstallationRepository { text: 'basis.delete'.tr(), isRed: true, onPressed: () async { - await hetznerApi.deleteSelfprivacyServerAndAllVolumes( + await api.deleteServer( domainName: domainName, ); - final ServerHostingDetails? serverDetails = - await hetznerApi.createServer( - cloudFlareKey: cloudFlareKey, - rootUser: rootUser, - domainName: domainName, - dataBase: dataBase, - ); + 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, + ), + ], + ), + ); + } 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; @@ -268,25 +328,27 @@ class ServerInstallationRepository { } } - Future createDnsRecords( - final String ip4, - final ServerDomain cloudFlareDomain, { + Future createDnsRecords( + final ServerHostingDetails serverDetails, + final ServerDomain domain, { required final void Function() onCancel, }) async { - final CloudflareApi cloudflareApi = CloudflareApi(); + final DnsProviderApi dnsProviderApi = + dnsProviderApiFactory!.getDnsProvider(); + final ServerProviderApi serverApi = + serverProviderApiFactory!.getServerProvider(); - await cloudflareApi.removeSimilarRecords( - ip4: ip4, - cloudFlareDomain: cloudFlareDomain, + await dnsProviderApi.removeSimilarRecords( + ip4: serverDetails.ip4, + domain: domain, ); try { - await cloudflareApi.createMultipleDnsRecords( - ip4: ip4, - cloudFlareDomain: cloudFlareDomain, + await dnsProviderApi.createMultipleDnsRecords( + ip4: serverDetails.ip4, + domain: domain, ); } on DioError catch (e) { - final HetznerApi hetznerApi = HetznerApi(); final NavigationService nav = getIt.get(); nav.showPopUpDialog( BrandAlert( @@ -299,8 +361,8 @@ class ServerInstallationRepository { text: 'basis.delete'.tr(), isRed: true, onPressed: () async { - await hetznerApi.deleteSelfprivacyServerAndAllVolumes( - domainName: cloudFlareDomain.domainName, + await serverApi.deleteServer( + domainName: domain.domainName, ); onCancel(); @@ -313,42 +375,46 @@ class ServerInstallationRepository { ], ), ); + return false; } - await HetznerApi().createReverseDns( - ip4: ip4, - domainName: cloudFlareDomain.domainName, + await serverApi.createReverseDns( + serverDetails: serverDetails, + domain: domain, ); + + return true; } 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(); + String dkimRecordString = ''; + try { + dkimRecordString = (await api.getDkim())!; + } catch (e) { + print(e); + rethrow; + } - await cloudflareApi.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 { - final HetznerApi hetznerApi = HetznerApi(); - return hetznerApi.reset(); + final ServerProviderApi api = serverProviderApiFactory!.getServerProvider(); + return api.restart(); } Future powerOn() async { - final HetznerApi hetznerApi = HetznerApi(); - return hetznerApi.powerOn(); + final ServerProviderApi api = serverProviderApiFactory!.getServerProvider(); + return api.powerOn(); } Future getRecoveryCapabilities( @@ -439,6 +505,9 @@ class ServerInstallationRepository { volume: ServerVolume( id: 0, name: '', + sizeByte: 0, + serverId: 0, + linuxDevice: '', ), provider: ServerProvider.unknown, id: 0, @@ -473,6 +542,9 @@ class ServerInstallationRepository { volume: ServerVolume( id: 0, name: '', + sizeByte: 0, + serverId: 0, + linuxDevice: '', ), provider: ServerProvider.unknown, id: 0, @@ -507,6 +579,9 @@ class ServerInstallationRepository { volume: ServerVolume( id: 0, name: '', + serverId: 0, + sizeByte: 0, + linuxDevice: '', ), provider: ServerProvider.unknown, id: 0, @@ -532,6 +607,9 @@ class ServerInstallationRepository { volume: ServerVolume( id: 0, name: '', + sizeByte: 0, + serverId: 0, + linuxDevice: '', ), provider: ServerProvider.unknown, id: 0, @@ -550,6 +628,7 @@ 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: [], @@ -569,27 +648,16 @@ class ServerInstallationRepository { return User( isFoundOnServer: true, login: users.data[0], + type: UserType.primary, ); } on FormatException { return fallbackUser; } } - Future> getServersOnHetznerAccount() async { - final HetznerApi hetznerApi = HetznerApi(); - final List servers = await hetznerApi.getServers(); - return servers - .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(); + Future> getServersOnProviderAccount() async { + final ServerProviderApi api = serverProviderApiFactory!.getServerProvider(); + return api.getServers(); } Future saveServerDetails( @@ -598,6 +666,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); @@ -614,10 +687,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); } @@ -652,10 +735,11 @@ class ServerInstallationRepository { } Future deleteServer(final ServerDomain serverDomain) async { - final HetznerApi hetznerApi = HetznerApi(); - final CloudflareApi cloudFlare = CloudflareApi(); + final ServerProviderApi api = serverProviderApiFactory!.getServerProvider(); + final DnsProviderApi dnsProviderApi = + dnsProviderApiFactory!.getDnsProvider(); - await hetznerApi.deleteSelfprivacyServerAndAllVolumes( + await api.deleteServer( domainName: serverDomain.domainName, ); @@ -666,7 +750,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/server_installation/server_installation_state.dart b/lib/logic/cubit/server_installation/server_installation_state.dart index b3128e71..bb04c07d 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,11 +35,11 @@ abstract class ServerInstallationState extends Equatable { final bool isServerResetedFirstTime; final bool isServerResetedSecondTime; - bool get isHetznerFilled => hetznerKey != 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 = [ - isHetznerFilled, - isCloudFlareFilled, - isBackblazeFilled, - isDomainFilled, - isUserFilled, + isServerProviderFilled, + isDnsProviderFilled, + isBackupsProviderFilled, + isDomainSelected, + isPrimaryUserFilled, isServerCreated, isServerStarted, isServerResetedFirstTime, @@ -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/server_jobs/server_jobs_cubit.dart b/lib/logic/cubit/server_jobs/server_jobs_cubit.dart new file mode 100644 index 00000000..1e808956 --- /dev/null +++ b/lib/logic/cubit/server_jobs/server_jobs_cubit.dart @@ -0,0 +1,117 @@ +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'; + +export 'package:provider/provider.dart'; + +part 'server_jobs_state.dart'; + +class ServerJobsCubit + extends ServerInstallationDependendCubit { + ServerJobsCubit(final ServerInstallationCubit serverInstallationCubit) + : super( + serverInstallationCubit, + ServerJobsState(), + ); + + Timer? timer; + final ServerApi api = ServerApi(); + + @override + void clear() async { + emit( + ServerJobsState(), + ); + 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: 5), () => reload(useTimer: true)); + } + } + + Future migrateToBinds(final Map serviceToDisk) async { + final result = await api.migrateToBinds(serviceToDisk); + if (!result.success || result.jobUid == null) { + getIt().showSnackBar(result.message!); + return; + } + + emit( + ServerJobsState( + migrationJobUid: result.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 removeServerJob(final String uid) async { + final result = await api.removeApiJob(uid); + if (!result.success) { + getIt().showSnackBar(result.message!); + return; + } + + emit( + ServerJobsState( + 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 { + final List jobs = await api.getServerJobs(); + emit( + ServerJobsState( + serverJobList: jobs, + ), + ); + if (useTimer) { + 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 new file mode 100644 index 00000000..2acc487c --- /dev/null +++ b/lib/logic/cubit/server_jobs/server_jobs_state.dart @@ -0,0 +1,37 @@ +part of 'server_jobs_cubit.dart'; + +class ServerJobsState extends ServerInstallationDependendState { + ServerJobsState({ + final serverJobList = const [], + this.migrationJobUid, + }) { + _serverJobList = serverJobList; + } + + late final List _serverJobList; + final String? migrationJobUid; + + List get serverJobList { + final List list = _serverJobList; + list.sort((final a, final b) => b.createdAt.compareTo(a.createdAt)); + return list; + } + + bool get hasRemovableJobs => serverJobList.any( + (final job) => + job.status == JobStatusEnum.finished || + job.status == JobStatusEnum.error, + ); + + @override + List get props => [migrationJobUid, _serverJobList]; + + ServerJobsState copyWith({ + final List? serverJobList, + final String? migrationJobUid, + }) => + ServerJobsState( + serverJobList: serverJobList ?? _serverJobList, + migrationJobUid: migrationJobUid ?? this.migrationJobUid, + ); +} 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..e48a809e --- /dev/null +++ b/lib/logic/cubit/server_volumes/server_volume_cubit.dart @@ -0,0 +1,78 @@ +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, + this.providerVolumeCubit, + ) : super(serverInstallationCubit, ApiServerVolumeState.initial()) { + _providerVolumeSubscription = + providerVolumeCubit.stream.listen(checkProviderVolumes); + } + + final ServerApi serverApi = ServerApi(); + + @override + Future load() async { + if (serverInstallationCubit.state is ServerInstallationFinished) { + reload(); + } + } + + 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 reload() async { + final volumes = await serverApi.getServerDiskVolumes(); + final usesBinds = await serverApi.isUsingBinds(); + var status = LoadingStatus.error; + + if (volumes.isNotEmpty) { + status = LoadingStatus.success; + } + + emit( + ApiServerVolumeState( + volumes, + status, + usesBinds, + DiskStatus.fromVolumes( + volumes, + providerVolumeCubit.state.volumes, + ), + ), + ); + } + + @override + void clear() { + 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 new file mode 100644 index 00000000..d68daa58 --- /dev/null +++ b/lib/logic/cubit/server_volumes/server_volume_state.dart @@ -0,0 +1,42 @@ +part of 'server_volume_cubit.dart'; + +class ApiServerVolumeState extends ServerInstallationDependendState { + const ApiServerVolumeState( + this._volumes, + this.status, + this.usesBinds, + this._diskStatus, + ); + + ApiServerVolumeState.initial() + : this(const [], LoadingStatus.uninitialized, null, DiskStatus()); + + final List _volumes; + final DiskStatus _diskStatus; + final bool? usesBinds; + final LoadingStatus status; + + 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 + List get props => [_volumes, status, usesBinds]; +} diff --git a/lib/logic/cubit/services/services_cubit.dart b/lib/logic/cubit/services/services_cubit.dart index f83a2a9a..4bb575a6 100644 --- a/lib/logic/cubit/services/services_cubit.dart +++ b/lib/logic/cubit/services/services_cubit.dart @@ -1,31 +1,72 @@ -import 'package:selfprivacy/logic/api_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, + lockedServices: const [], ), ); + timer = Timer(const Duration(seconds: 10), () => reload(useTimer: true)); } } + Future reload({final bool useTimer = false}) async { + final List services = await api.getAllServices(); + emit( + state.copyWith( + services: services, + ), + ); + if (useTimer) { + timer = Timer(const Duration(seconds: 60), () => reload(useTimer: true)); + } + } + + 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 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..d5aa95eb 100644 --- a/lib/logic/cubit/services/services_state.dart +++ b/lib/logic/cubit/services/services_state.dart @@ -1,93 +1,91 @@ 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, + required this.lockedServices, }); - final bool isPasswordManagerEnable; - final bool isCloudEnable; - final bool isGitEnable; - final bool isSocialNetworkEnable; - final bool isVpnEnable; + const ServicesState.empty() + : this(services: const [], lockedServices: 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; + final List lockedServices; - 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, - ); + bool isServiceLocked(final String serviceId) => + lockedServices.contains(serviceId); + + 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, + ); + if (service.id == 'empty') { + return null; + } + return service; + } @override List get props => [ - isPasswordManagerEnable, - isCloudEnable, - isGitEnable, - isSocialNetworkEnable, - isVpnEnable + services, + lockedServices, ]; 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'); } } + + ServicesState copyWith({ + final List? services, + final List? lockedServices, + }) => + ServicesState( + services: services ?? this.services, + lockedServices: lockedServices ?? this.lockedServices, + ); } diff --git a/lib/logic/cubit/users/users_cubit.dart b/lib/logic/cubit/users/users_cubit.dart index 9b86c109..87abcffd 100644 --- a/lib/logic/cubit/users/users_cubit.dart +++ b/lib/logic/cubit/users/users_cubit.dart @@ -1,10 +1,11 @@ +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/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'; -import 'package:selfprivacy/logic/api_maps/server.dart'; - export 'package:provider/provider.dart'; part 'users_state.dart'; @@ -15,8 +16,7 @@ class UsersCubit extends ServerInstallationDependendCubit { serverInstallationCubit, const UsersState( [], - User(login: 'root'), - User(login: 'loading...'), + false, ), ); Box box = Hive.box(BNames.usersBox); @@ -26,173 +26,43 @@ 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...'), - ); - final List rootKeys = [ - ...serverInstallationBox.get(BNames.rootKeys, defaultValue: []) - ]; - if (loadedUsers.isNotEmpty) { - emit( - UsersState( - loadedUsers, - User(login: 'root', sshKeys: rootKeys), - 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), - 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, - isFoundOnServer: true, - password: localUser.password, - sshKeys: localUser.sshKeys, - ), - ); - serverUsersCopy.remove(localUser.login); - } else { - mergedUsers.add( - User( - login: localUser.login, - isFoundOnServer: false, - password: localUser.password, - note: localUser.note, - ), - ); - } - } - - for (final String serverUser in serverUsersCopy) { - mergedUsers.add( - User( - login: serverUser, - isFoundOnServer: true, + loadedUsers, + false, ), ); } - 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, - isFoundOnServer: true, - password: user.password, - sshKeys: sshKeys.data, - note: user.note, - ), - ); - } else { - updatedUsers.add( - User( - login: user.login, - isFoundOnServer: true, - password: user.password, - note: user.note, - ), - ); - } - } else { - updatedUsers.add( - User( - login: user.login, - 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; + } + emit(state.copyWith(isLoading: true)); + final List usersFromServer = await api.getAllUsers(); + if (usersFromServer.isNotEmpty) { + emit( + UsersState( + usersFromServer, + false, + ), + ); + // Update the users it the box + await box.clear(); + await box.addAll(usersFromServer); + } else { + getIt() + .showSnackBar('users.could_not_fetch_users'.tr()); + emit(state.copyWith(isLoading: false)); } - 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 { @@ -201,18 +71,24 @@ class UsersCubit extends ServerInstallationDependendCubit { .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)); @@ -220,142 +96,69 @@ 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, - 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!; + 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(), + ), + ); } 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, - 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, - 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, - 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, - 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, - isFoundOnServer: true, - password: user.password, - sshKeys: userKeys, - note: user.note, - ); - await box.putAt(box.values.toList().indexOf(user), updatedUser); + final UserMutationResult result = + await api.removeSshKey(user.login, publicKey); + if (result.success) { + final User updatedUser = result.user!; + 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(), @@ -369,8 +172,7 @@ class UsersCubit extends ServerInstallationDependendCubit { emit( const UsersState( [], - User(login: 'root'), - User(login: 'loading...'), + false, ), ); } diff --git a/lib/logic/cubit/users/users_state.dart b/lib/logic/cubit/users/users_state.dart index fa4ed1cd..dbd931d7 100644 --- a/lib/logic/cubit/users/users_state.dart +++ b/lib/logic/cubit/users/users_state.dart @@ -1,30 +1,34 @@ part of 'users_cubit.dart'; class UsersState extends ServerInstallationDependendState { - const UsersState(this.users, this.rootUser, this.primaryUser); + const UsersState(this.users, this.isLoading); final List users; - final User rootUser; - final User primaryUser; + final bool isLoading; + + 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, isLoading]; UsersState copyWith({ final List? users, - final User? rootUser, - final User? primaryUser, + final bool? isLoading, }) => UsersState( users ?? this.users, - rootUser ?? this.rootUser, - primaryUser ?? this.primaryUser, + isLoading ?? this.isLoading, ); bool isLoginRegistered(final String login) => - users.any((final User user) => user.login == login) || - login == rootUser.login || - login == primaryUser.login; + users.any((final User user) => user.login == login); bool get isEmpty => users.isEmpty; } 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/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/disk_size.dart b/lib/logic/models/disk_size.dart new file mode 100644 index 00000000..9fe18b7d --- /dev/null +++ b/lib/logic/models/disk_size.dart @@ -0,0 +1,38 @@ +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) { + return '${byte.toStringAsFixed(0)} ${tr('bytes')}'; + } else if (byte < 1024 * 1024) { + return 'providers.storage.kb'.tr(args: [kibibyte.toStringAsFixed(1)]); + } else if (byte < 1024 * 1024 * 1024) { + return 'providers.storage.mb'.tr(args: [mebibyte.toStringAsFixed(1)]); + } else { + return 'providers.storage.gb'.tr(args: [gibibyte.toStringAsFixed(1)]); + } + } +} diff --git a/lib/logic/models/disk_status.dart b/lib/logic/models/disk_status.dart new file mode 100644 index 00000000..2a37ad77 --- /dev/null +++ b/lib/logic/models/disk_status.dart @@ -0,0 +1,122 @@ +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 { + 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; + + 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 { + DiskStatus.fromVolumes( + final List serverVolumes, + final List providerVolumes, + ) { + diskVolumes = serverVolumes.map(( + final ServerDiskVolume volume, + ) { + ServerVolume? providerVolume; + + for (final ServerVolume iterableProviderVolume in providerVolumes) { + if (iterableProviderVolume.linuxDevice == null || + volume.model == null || + volume.serial == null) { + continue; + } + + final String deviceId = + iterableProviderVolume.linuxDevice!.split('/').last; + if (deviceId.contains(volume.model!) && + deviceId.contains(volume.serial!)) { + providerVolume = iterableProviderVolume; + break; + } + } + + final DiskVolume diskVolume = + DiskVolume.fromServerDiscVolume(volume, providerVolume); + + return diskVolume; + }).toList(); + } + DiskStatus() { + diskVolumes = []; + } + + bool get isDiskOkay => diskVolumes.every((final volume) => volume.isDiskOkay); + + List diskVolumes = []; +} 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/server_details.dart b/lib/logic/models/hive/server_details.dart index 5188e62e..3791c664 100644 --- a/lib/logic/models/hive/server_details.dart +++ b/lib/logic/models/hive/server_details.dart @@ -55,12 +55,21 @@ class ServerVolume { ServerVolume({ required this.id, required this.name, + required this.sizeByte, + required this.serverId, + required this.linuxDevice, }); @HiveField(1) int id; @HiveField(2) String name; + @HiveField(3, defaultValue: 10737418240) // 10 Gb + 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 f10628e7..29716607 100644 --- a/lib/logic/models/hive/server_details.g.dart +++ b/lib/logic/models/hive/server_details.g.dart @@ -73,17 +73,26 @@ 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?, + linuxDevice: fields[5] as String?, ); } @override void write(BinaryWriter writer, ServerVolume obj) { writer - ..writeByte(2) + ..writeByte(5) ..writeByte(1) ..write(obj.id) ..writeByte(2) - ..write(obj.name); + ..write(obj.name) + ..writeByte(3) + ..write(obj.sizeByte) + ..writeByte(4) + ..write(obj.serverId) + ..writeByte(5) + ..write(obj.linuxDevice); } @override diff --git a/lib/logic/models/hive/user.dart b/lib/logic/models/hive/user.dart index 942ce9fe..48c121b7 100644 --- a/lib/logic/models/hive/user.dart +++ b/lib/logic/models/hive/user.dart @@ -2,6 +2,8 @@ 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'; part 'user.g.dart'; @@ -10,12 +12,21 @@ part 'user.g.dart'; class User extends Equatable { const User({ required this.login, + required this.type, this.password, this.sshKeys = const [], this.isFoundOnServer = true, this.note, }); + User.fromGraphQL(final Fragment$userFields user) + : this( + login: user.username, + type: UserType.fromGraphQL(user.userType), + sshKeys: user.sshKeys, + isFoundOnServer: true, + ); + @HiveField(0) final String login; @@ -31,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]; @@ -40,3 +54,26 @@ class User extends Equatable { 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; + } + } +} diff --git a/lib/logic/models/hive/user.g.dart b/lib/logic/models/hive/user.g.dart index d9b28d65..8f5b7b20 100644 --- a/lib/logic/models/hive/user.g.dart +++ b/lib/logic/models/hive/user.g.dart @@ -11,13 +11,14 @@ 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( 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, @@ -26,9 +27,9 @@ class UserAdapter extends TypeAdapter { } @override - void write(final BinaryWriter writer, final User obj) { + void write(BinaryWriter writer, User obj) { writer - ..writeByte(5) + ..writeByte(6) ..writeByte(0) ..write(obj.login) ..writeByte(1) @@ -38,16 +39,62 @@ 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 ==(final Object other) => + 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; +} diff --git a/lib/logic/models/job.dart b/lib/logic/models/job.dart index b04d7d05..1dc1bd91 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,14 @@ class Job extends Equatable { List get props => [id, title]; } -class CreateUserJob extends Job { +class RebuildServerJob extends ClientJob { + RebuildServerJob({ + required final super.title, + final super.id, + }); +} + +class CreateUserJob extends ClientJob { CreateUserJob({ required this.user, }) : super(title: '${"jobs.createUser".tr()} ${user.login}'); @@ -31,7 +38,18 @@ class CreateUserJob extends Job { List get props => [id, title, user]; } -class DeleteUserJob extends Job { +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, }) : super(title: '${"jobs.deleteUser".tr()} ${user.login}'); @@ -42,13 +60,13 @@ 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, }); - final dynamic type; + final ServiceTypes type; @override List get props => [...super.props, type]; @@ -56,7 +74,7 @@ class ToggleJob extends Job { class ServiceToggleJob extends ToggleJob { ServiceToggleJob({ - required final ServiceTypes super.type, + required final super.type, required this.needToTurnOn, }) : super( title: @@ -66,7 +84,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 +97,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/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/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/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/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/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 e8c21917..5201a1c5 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', @@ -34,9 +46,17 @@ 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( + HetznerPublicNetInfo instance) => + { + 'ipv4': instance.ipv4, + }; + HetznerIp4 _$HetznerIp4FromJson(Map json) => HetznerIp4( json['id'] as int, json['ip'] as String, @@ -44,6 +64,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 +83,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 +111,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/logic/models/json/server_disk_volume.dart b/lib/logic/models/json/server_disk_volume.dart new file mode 100644 index 00000000..873b5d97 --- /dev/null +++ b/lib/logic/models/json/server_disk_volume.dart @@ -0,0 +1,28 @@ +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.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 new file mode 100644 index 00000000..81a9d86e --- /dev/null +++ b/lib/logic/models/json/server_disk_volume.g.dart @@ -0,0 +1,31 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'server_disk_volume.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +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/logic/models/json/server_job.dart b/lib/logic/models/json/server_job.dart new file mode 100644 index 00000000..67bbfca4 --- /dev/null +++ b/lib/logic/models/json/server_job.dart @@ -0,0 +1,77 @@ +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'; + +@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, + }); + + 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: JobStatusEnum.fromString(serverJob.status), + statusText: serverJob.statusText, + uid: serverJob.uid, + updatedAt: serverJob.updatedAt, + ); + final String name; + final String description; + final JobStatusEnum status; + final String uid; + final DateTime updatedAt; + final DateTime createdAt; + + final String? error; + final int? progress; + final String? result; + final String? statusText; + final DateTime? finishedAt; + bool isHidden = false; +} + +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 new file mode 100644 index 00000000..54719f80 --- /dev/null +++ b/lib/logic/models/json/server_job.g.dart @@ -0,0 +1,44 @@ +// 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: $enumDecode(_$JobStatusEnumEnumMap, json['status']), + uid: json['uid'] 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'] == null + ? null + : DateTime.parse(json['finishedAt'] as String), + ); + +Map _$ServerJobToJson(ServerJob instance) => { + 'name': instance.name, + 'description': instance.description, + 'status': _$JobStatusEnumEnumMap[instance.status]!, + 'uid': instance.uid, + 'updatedAt': instance.updatedAt.toIso8601String(), + 'createdAt': instance.createdAt.toIso8601String(), + 'error': instance.error, + 'progress': instance.progress, + 'result': instance.result, + 'statusText': instance.statusText, + 'finishedAt': instance.finishedAt?.toIso8601String(), + }; + +const _$JobStatusEnumEnumMap = { + JobStatusEnum.created: 'CREATED', + JobStatusEnum.running: 'RUNNING', + JobStatusEnum.finished: 'FINISHED', + JobStatusEnum.error: 'ERROR', +}; diff --git a/lib/logic/models/service.dart b/lib/logic/models/service.dart new file mode 100644 index 00000000..33475588 --- /dev/null +++ b/lib/logic/models/service.dart @@ -0,0 +1,114 @@ +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.isMovable, + 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, + isMovable: service.isMovable, + 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, + ); + + static Service empty = Service( + id: 'empty', + displayName: '', + description: '', + isEnabled: false, + isRequired: false, + isMovable: false, + status: ServiceStatus.off, + storageUsage: ServiceStorageUsage( + used: const 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; + 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; + } + } +} 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/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/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/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/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, 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_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/brand_button/segmented_buttons.dart b/lib/ui/components/brand_button/segmented_buttons.dart new file mode 100644 index 00000000..e3ce50cd --- /dev/null +++ b/lib/ui/components/brand_button/segmented_buttons.dart @@ -0,0 +1,67 @@ +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 + Theme.of(context).visualDensity.vertical * 4, + ), + 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 Stack( + alignment: Alignment.centerLeft, + children: [ + 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, + ), + ), + ], + ); + }).toList(), + ), + ); +} diff --git a/lib/ui/components/brand_cards/brand_cards.dart b/lib/ui/components/brand_cards/brand_cards.dart index d8f48088..67e7f725 100644 --- a/lib/ui/components/brand_cards/brand_cards.dart +++ b/lib/ui/components/brand_cards/brand_cards.dart @@ -19,17 +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, - }) => - _FilledCard( - tertiary: tertiary, - child: child, - ); } class _BrandCard extends StatelessWidget { @@ -57,48 +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.tertiary, - }); - - final Widget child; - final bool tertiary; - @override - Widget build(final BuildContext context) => Card( - elevation: 0.0, - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(12)), - ), - clipBehavior: Clip.antiAlias, - color: 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..02d46604 --- /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..dc959dc2 --- /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/components/brand_divider/brand_divider.dart b/lib/ui/components/brand_divider/brand_divider.dart deleted file mode 100644 index 03e44653..00000000 --- a/lib/ui/components/brand_divider/brand_divider.dart +++ /dev/null @@ -1,13 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:selfprivacy/config/brand_colors.dart'; - -class BrandDivider extends StatelessWidget { - const BrandDivider({final super.key}); - - @override - Widget build(final BuildContext context) => Container( - width: double.infinity, - height: 1, - color: BrandColors.dividerColor, - ); -} 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..50104aa0 --- /dev/null +++ b/lib/ui/components/brand_linear_indicator/brand_linear_indicator.dart @@ -0,0 +1,47 @@ +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) => 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: AnimatedContainer( + duration: const Duration(milliseconds: 400), + curve: Curves.easeInOut, + width: constraints.maxWidth, + decoration: BoxDecoration( + color: color, + borderRadius: BorderRadius.circular(height), + ), + ), + ), + ), + ); +} 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 deleted file mode 100644 index 5b18247d..00000000 --- a/lib/ui/components/brand_radio_tile/brand_radio_tile.dart +++ /dev/null @@ -1,35 +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'; - -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/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/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/components/info_box/info_box.dart b/lib/ui/components/info_box/info_box.dart new file mode 100644 index 00000000..816053e3 --- /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/jobs_content/jobs_content.dart b/lib/ui/components/jobs_content/jobs_content.dart index bd8166de..877770dc 100644 --- a/lib/ui/components/jobs_content/jobs_content.dart +++ b/lib/ui/components/jobs_content/jobs_content.dart @@ -3,123 +3,173 @@ 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/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'; 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}); @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) { + final bool hasRemovableJobs = + context.watch().state.hasRemovableJobs; + + 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.jobList - .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(), + } 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), + if (serverJobs.isNotEmpty) + Padding( + padding: const EdgeInsets.all(8.0), + 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, + ), + ], ), ), - const SizedBox(height: 20), - ...widgets - ], - ); - }, - ); + ...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), + ], + ); + }, + ); + } } 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..46e21166 --- /dev/null +++ b/lib/ui/components/jobs_content/server_job_card.dart @@ -0,0 +1,95 @@ +import 'package:flutter/material.dart'; +import 'package:selfprivacy/logic/models/json/server_job.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) { + 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: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + 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, + ), + ], + ), + ), + Icon( + icon, + color: color, + ), + ], + ), + const SizedBox(height: 8), + BrandLinearIndicator( + value: serverJob.progress == null + ? 0.0 + : serverJob.progress! / 100.0, + 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, + ), + ), + ], + ), + ), + ), + ); + } +} 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/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/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 4ae29087..b97f3bd6 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'; @@ -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 ad9105fb..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/jobs/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/ui/components/progress_bar/progress_bar.dart b/lib/ui/components/progress_bar/progress_bar.dart index 4de729f7..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 { @@ -83,10 +82,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( @@ -110,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( @@ -122,15 +124,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/components/storage_list_items/server_storage_list_item.dart b/lib/ui/components/storage_list_items/server_storage_list_item.dart new file mode 100644 index 00000000..1cc07572 --- /dev/null +++ b/lib/ui/components/storage_list_items/server_storage_list_item.dart @@ -0,0 +1,124 @@ +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/logic/models/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) => 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 + ? 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( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + if (icon != null) icon!, + if (icon != null) const SizedBox(width: 16), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + 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: percentage, + color: color, + backgroundColor: backgroundColor, + height: dense ? 8.0 : 14.0, + ), + const SizedBox(height: 4), + if (subtitle != null) + Text( + subtitle!, + style: subtitleStyle, + textAlign: TextAlign.start, + ), + ], + ), + ), + ], + ); + } +} 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 new file mode 100644 index 00000000..847d2cf6 --- /dev/null +++ b/lib/ui/components/storage_list_items/service_migration_list_item.dart @@ -0,0 +1,100 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:selfprivacy/logic/models/service.dart'; +import 'package:selfprivacy/logic/models/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: [ + ServiceConsumptionTitle(service: service), + const SizedBox(height: 16), + ..._radioRows(context), + ], + ); + + 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), + 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, + ), + ), + ), + ], + ), + ), + ); +} diff --git a/lib/ui/components/storage_list_items/service_storage_consumption_list_item.dart b/lib/ui/components/storage_list_items/service_storage_consumption_list_item.dart new file mode 100644 index 00000000..30216709 --- /dev/null +++ b/lib/ui/components/storage_list_items/service_storage_consumption_list_item.dart @@ -0,0 +1,55 @@ +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, + ), + ], + ), + ), + ], + ); +} 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/backup_details/backup_details.dart b/lib/ui/pages/backup_details/backup_details.dart index 55a8dd12..b3635d3f 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'; @@ -9,12 +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(); class BackupDetails extends StatefulWidget { @@ -64,7 +62,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: [ @@ -110,9 +108,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(), @@ -128,7 +126,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: [ @@ -196,7 +194,7 @@ class _BackupDetailsState extends State ), ), const SizedBox(height: 16), - BrandCards.outlined( + OutlinedCard( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/ui/pages/devices/devices.dart b/lib/ui/pages/devices/devices.dart index ad48096e..bc608339 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,19 +52,8 @@ 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/dns_details/dns_details.dart b/lib/ui/pages/dns_details/dns_details.dart index 44d6db0d..5a3d0dfd 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'; @@ -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 FilledCard( + error: isError, + 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, ); } @@ -81,145 +94,111 @@ class _DnsDetailsPageState extends State { headerTitle: '', heroIcon: BrandIcons.globe, heroTitle: 'providers.domain.screen_title'.tr(), - children: [ - BrandCards.outlined( - 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 [], ); } + 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(), ], ); } 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', + ), + ], ), ), ); diff --git a/lib/ui/pages/more/app_settings/app_setting.dart b/lib/ui/pages/more/app_settings/app_setting.dart index 862815c1..47e2e1a8 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 d4c4863b..8d2526d6 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/ui/components/brand_divider/brand_divider.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server.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'; @@ -20,12 +20,18 @@ class InfoPage extends StatelessWidget { body: ListView( padding: paddingH15V0, children: [ - 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 +40,7 @@ class InfoPage extends StatelessWidget { ), ); - Future _version() async { + Future _packageVersion() async { String packageVersion = 'unknown'; try { final PackageInfo packageInfo = await PackageInfo.fromPlatform(); @@ -45,4 +51,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/lib/ui/pages/more/more.dart b/lib/ui/pages/more/more.dart index 5a02da3c..bc0468b0 100644 --- a/lib/ui/pages/more/more.dart +++ b/lib/ui/pages/more/more.dart @@ -3,18 +3,20 @@ import 'package:flutter/material.dart'; import 'package:ionicons/ionicons.dart'; import 'package:selfprivacy/config/brand_theme.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; -import 'package:selfprivacy/ui/components/brand_cards/brand_cards.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/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'; import 'package:selfprivacy/ui/pages/recovery_key/recovery_key.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'; -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'; @@ -28,6 +30,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), @@ -41,6 +46,33 @@ 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: ServicesMigrationPage( + diskStatus: context + .watch() + .state + .diskStatus, + services: context + .read() + .state + .services + .where( + (final service) => + service.id == 'bitwarden' || + service.id == 'gitea' || + service.id == 'pleroma' || + service.id == 'mailserver' || + service.id == 'nextcloud', + ) + .toList(), + isMigration: true, + ), + subtitle: 'providers.storage.data_migration_notice'.tr(), + accent: true, + ), if (!isReady) _MoreMenuItem( title: 'more.configuration_wizard'.tr(), @@ -53,8 +85,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) @@ -124,7 +156,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 97e4aeeb..8b06751b 100644 --- a/lib/ui/pages/providers/providers.dart +++ b/lib/ui/pages/providers/providers.dart @@ -5,14 +5,11 @@ 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/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/logic/cubit/server_volumes/server_volume_cubit.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/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/server_details/server_details_screen.dart'; @@ -37,6 +34,21 @@ class _ProvidersPageState extends State { final DnsRecordsStatus dnsStatus = context.watch().state.dnsState; + final diskStatus = context.watch().state.diskStatus; + + 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) { @@ -48,25 +60,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(); return Scaffold( appBar: PreferredSize( preferredSize: const Size.fromHeight(52), @@ -81,7 +74,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())), + ), ], ), ); @@ -89,79 +120,65 @@ 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; - - final String domainName = - appConfig.isDomainFilled ? appConfig.serverDomain!.domainName : ''; - - switch (provider.type) { - 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(), - ), - ); - - break; - case ProviderType.domain: - title = 'providers.domain.screen_title'.tr(); - message = 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( + clipBehavior: Clip.antiAlias, + 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: 10), - BrandText.h2(title), - const SizedBox(height: 10), - if (message != null) ...[ - BrandText.body2(message), - const SizedBox(height: 10), - ], - if (provider.state == StateType.stable) BrandText.body2(stableText), - ], + ), ), - ), - ); - } + ); } diff --git a/lib/ui/pages/recovery_key/recovery_key.dart b/lib/ui/pages/recovery_key/recovery_key.dart index 44147f57..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( @@ -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/recovery_key/recovery_key_receiving.dart b/lib/ui/pages/recovery_key/recovery_key_receiving.dart index 7ae6adaf..60169e5a 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,13 +29,8 @@ 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( diff --git a/lib/ui/pages/server_details/chart.dart b/lib/ui/pages/server_details/chart.dart deleted file mode 100644 index f7972e9c..00000000 --- a/lib/ui/pages/server_details/chart.dart +++ /dev/null @@ -1,166 +0,0 @@ -part of 'server_details_screen.dart'; - -class _Chart extends StatelessWidget { - @override - Widget build(final BuildContext context) { - final HetznerMetricsCubit cubit = context.watch(); - 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) { - charts = [ - const Legend(color: Colors.red, text: 'CPU %'), - const SizedBox(height: 20), - getCpuChart(state), - 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, - 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: 20), - getBandwidthChart(state), - ]; - } else { - 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), - ), - ], - ), - ), - ...charts, - ], - ), - ); - } - - Widget getCpuChart(final HetznerMetricsLoaded state) { - final data = state.cpu; - - return SizedBox( - height: 200, - child: CpuChart( - data: data, - period: state.period, - start: state.start, - ), - ); - } - - 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; - - return SizedBox( - height: 200, - child: NetworkChart( - listData: [ppsIn, ppsOut], - period: state.period, - start: state.start, - ), - ); - } -} - -class Legend extends StatelessWidget { - const Legend({ - required this.color, - required this.text, - final super.key, - }); - - final String text; - final Color color; - @override - Widget build(final BuildContext context) => Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - _ColoredBox(color: color), - const SizedBox(width: 5), - BrandText.small(text), - ], - ); -} - -class _ColoredBox extends StatelessWidget { - const _ColoredBox({ - required this.color, - }); - - final Color color; - - @override - Widget build(final BuildContext context) => Container( - width: 10, - height: 10, - decoration: BoxDecoration( - color: color.withOpacity(0.3), - border: Border.all( - color: color, - ), - ), - ); -} 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/charts/chart.dart b/lib/ui/pages/server_details/charts/chart.dart new file mode 100644 index 00000000..60dfc092 --- /dev/null +++ b/lib/ui/pages/server_details/charts/chart.dart @@ -0,0 +1,206 @@ +part of '../server_details_screen.dart'; + +class _Chart extends StatelessWidget { + @override + Widget build(final BuildContext context) { + final HetznerMetricsCubit cubit = context.watch(); + final Period period = cubit.state.period; + final HetznerMetricsState state = cubit.state; + List charts; + if (state is HetznerMetricsLoaded || state is HetznerMetricsLoading) { + charts = [ + FilledCard( + clipped: false, + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'providers.server.chart.cpu_title'.tr(), + style: Theme.of(context).textTheme.titleMedium?.copyWith( + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + ), + const SizedBox(height: 16), + 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(), + ), + ], + ), + ], + ), + ), + ), + 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), + 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(), + ), + ], + ), + ], + ), + ), + ), + ]; + } else { + throw 'wrong state'; + } + + return Column( + children: [ + 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() + ], + ), + const SizedBox(height: 8), + ...charts, + ], + ); + } + + Widget getCpuChart(final HetznerMetricsLoaded state) { + final data = state.cpu; + + return SizedBox( + height: 200, + child: CpuChart( + data: data, + period: state.period, + start: state.start, + ), + ); + } + + Widget getBandwidthChart(final HetznerMetricsLoaded state) { + final ppsIn = state.bandwidthIn; + final ppsOut = state.bandwidthOut; + + return SizedBox( + height: 200, + child: NetworkChart( + listData: [ppsIn, ppsOut], + period: state.period, + start: state.start, + ), + ); + } +} + +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, + required this.text, + final super.key, + }); + + final String text; + final Color color; + @override + Widget build(final BuildContext context) => Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + _ColoredBox(color: color), + const SizedBox(width: 5), + Text( + text, + style: Theme.of(context).textTheme.labelSmall, + ), + ], + ); +} + +class _ColoredBox extends StatelessWidget { + const _ColoredBox({ + required this.color, + }); + + final Color color; + + @override + Widget build(final BuildContext context) => Container( + width: 10, + height: 10, + decoration: BoxDecoration( + 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/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/charts/network_charts.dart b/lib/ui/pages/server_details/charts/network_charts.dart new file mode 100644 index 00000000..7487fd32 --- /dev/null +++ b/lib/ui/pages/server_details/charts/network_charts.dart @@ -0,0 +1,225 @@ +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/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'; + +class NetworkChart extends StatelessWidget { + const NetworkChart({ + required this.listData, + required this.period, + required this.start, + final super.key, + }); + + final List> listData; + final Period period; + final DateTime start; + + List getSpots(final data) { + 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 = []; + + 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, + ), + ), + ); + + 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, + ), + 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, + ), + ), + ), + // 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, + ), + ), + ), + ), + ); + + 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 diff = value - minValue; + final finalValue = diff / 20; + return finalValue - finalValue.floor() == 0; + } +} 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/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/network_charts.dart b/lib/ui/pages/server_details/network_charts.dart deleted file mode 100644 index d1375ae6..00000000 --- a/lib/ui/pages/server_details/network_charts.dart +++ /dev/null @@ -1,160 +0,0 @@ -import 'dart:math'; - -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 NetworkChart extends StatelessWidget { - const NetworkChart({ - required this.listData, - required this.period, - required this.start, - final super.key, - }); - - final List> listData; - final Period period; - final DateTime start; - - List getSpots(final data) { - 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) => 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()), - style: const TextStyle( - fontSize: 10, - color: Colors.purple, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - showTitles: true, - ), - ), - 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, - ), - ), - ), - 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 diff = value - minValue; - 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/server_details_screen.dart b/lib/ui/pages/server_details/server_details_screen.dart index 1f442220..24675dad 100644 --- a/lib/ui/pages/server_details/server_details_screen.dart +++ b/lib/ui/pages/server_details/server_details_screen.dart @@ -2,31 +2,34 @@ 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/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/models/state_types.dart'; -import 'package:selfprivacy/ui/components/brand_divider/brand_divider.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'; +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/components/list_tiles/list_tile_on_surface_variant.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'; -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 'header.dart'; +part 'charts/chart.dart'; part 'server_settings.dart'; part 'text_details.dart'; part 'time_zone/time_zone.dart'; @@ -63,60 +66,41 @@ 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()), - ), - const BrandDivider(), - ], + create: (final context) => context.read()..check(), + child: BrandHeroScreen( + heroIcon: BrandIcons.server, + heroTitle: 'providers.server.card_title'.tr(), + heroSubtitle: 'providers.server.bottom_sheet.1'.tr(), + children: [ + StorageCard( + diskStatus: context.watch().state.diskStatus, ), - ), - 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(), - ], - ), - ), - _ServerSettings(tabController: tabController), - ], - ), + const SizedBox(height: 16), + const _ServerSettings(), + 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: 8), + _TextDetails(), + ], ), ); } diff --git a/lib/ui/pages/server_details/server_settings.dart b/lib/ui/pages/server_details/server_settings.dart index 18d425e6..38c7133b 100644 --- a/lib/ui/pages/server_details/server_settings.dart +++ b/lib/ui/pages/server_details/server_settings.dart @@ -1,124 +1,112 @@ part of 'server_details_screen.dart'; -class _ServerSettings extends StatelessWidget { - const _ServerSettings({ - required this.tabController, - }); +class _ServerSettings extends StatefulWidget { + const _ServerSettings(); - final TabController tabController; + @override + State<_ServerSettings> createState() => _ServerSettingsState(); +} + +class _ServerSettingsState extends State<_ServerSettings> { + bool? allowAutoUpgrade; + bool? rebootAfterUpgrade; + bool? didSomethingChange; @override 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(); } - return ListView( - padding: paddingH15V0, + if (allowAutoUpgrade == null || rebootAfterUpgrade == null) { + allowAutoUpgrade = serverDetailsState.autoUpgradeSettings.enable; + rebootAfterUpgrade = serverDetailsState.autoUpgradeSettings.allowReboot; + } + + didSomethingChange ??= false; + + 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: () => tabController.animateTo(0), - ), - const SizedBox(width: 10), - BrandText.h4('basis.settings'.tr()), - ], - ), - ), - const BrandDivider(), - SwitcherBlock( - onChange: (final _) {}, - isActive: serverDetailsState.autoUpgradeSettings.enable, - child: const _TextColumn( - title: 'Allow Auto-upgrade', - value: 'Wether to allow automatic packages upgrades', - hasWarning: false, - ), - ), - SwitcherBlock( - onChange: (final _) {}, - isActive: serverDetailsState.autoUpgradeSettings.allowReboot, - child: const _TextColumn( - title: 'Reboot after upgrade', - value: 'Reboot without prompt after applying updates', - hasWarning: false, - ), - ), - _Button( - onTap: () { - Navigator.of(context).push(materialRoute(const SelectTimezone())); + SwitchListTile( + value: allowAutoUpgrade ?? false, + onChanged: (final switched) { + if (didSomethingChange == false) { + context.read().addJob( + RebuildServerJob(title: 'jobs.upgradeServer'.tr()), + ); + } + context + .read() + .repository + .setAutoUpgradeSettings( + AutoUpgradeSettings( + enable: switched, + allowReboot: rebootAfterUpgrade ?? false, + ), + ); + setState(() { + allowAutoUpgrade = switched; + didSomethingChange = true; + }); }, - child: _TextColumn( - title: 'Server Timezone', - value: serverDetailsState.serverTimezone.timezone.name, - hasWarning: false, + title: Text('providers.server.settings.allow_autoupgrade'.tr()), + subtitle: Text( + 'providers.server.settings.allow_autoupgrade_hint'.tr(), ), + activeColor: Theme.of(context).colorScheme.primary, + ), + SwitchListTile( + value: rebootAfterUpgrade ?? false, + onChanged: (final switched) { + if (didSomethingChange == false) { + context.read().addJob( + RebuildServerJob(title: 'jobs.upgradeServer'.tr()), + ); + } + context + .read() + .repository + .setAutoUpgradeSettings( + AutoUpgradeSettings( + enable: allowAutoUpgrade ?? false, + allowReboot: switched, + ), + ); + setState(() { + rebootAfterUpgrade = switched; + didSomethingChange = true; + }); + }, + 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, + ), + ListTile( + title: Text('providers.server.settings.server_timezone'.tr()), + subtitle: Text( + 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(), + ), + ); + }, ), ], ); } } - -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.only(top: 20, bottom: 5), - decoration: const BoxDecoration( - border: Border( - bottom: BorderSide(width: 1, color: BrandColors.dividerColor), - ), - ), - child: child, - ), - ); -} - -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, - children: [ - BrandText.body1( - title, - style: TextStyle(color: hasWarning ? BrandColors.warning : null), - ), - const SizedBox(height: 5), - BrandText.body1( - value, - style: TextStyle( - fontSize: 13, - height: 1.53, - color: hasWarning ? BrandColors.warning : BrandColors.gray1, - ), - ), - ], - ); -} 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/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, - ), - ), - ], + ), ), ), ); 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 new file mode 100644 index 00000000..a63748c6 --- /dev/null +++ b/lib/ui/pages/server_storage/binds_migration/migration_process_page.dart @@ -0,0 +1,81 @@ +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({ + final super.key, + }); + + @override + State createState() => _MigrationProcessPageState(); +} + +class _MigrationProcessPageState extends State { + @override + void initState() { + super.initState(); + } + + @override + Widget build(final BuildContext context) { + ServerJob? job; + String? subtitle = ''; + double value = 0.0; + List children = []; + + final serverJobsState = context.watch().state; + 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( + 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, + ); + }, + ), + ]; + } + 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, + ], + ); + } +} diff --git a/lib/ui/pages/server_storage/binds_migration/services_migration.dart b/lib/ui/pages/server_storage/binds_migration/services_migration.dart new file mode 100644 index 00000000..9783a479 --- /dev/null +++ b/lib/ui/pages/server_storage/binds_migration/services_migration.dart @@ -0,0 +1,203 @@ +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'; +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/helpers/modals.dart'; +import 'package:selfprivacy/ui/pages/root_route.dart'; +import 'package:selfprivacy/utils/route_transitions/basic.dart'; + +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() => _ServicesMigrationPageState(); +} + +class _ServicesMigrationPageState 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 + 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: [ + ...widget.diskStatus.diskVolumes + .map( + (final volume) => Column( + children: [ + ServerStorageListItem( + volume: recalculatedDiskUsages( + volume, + widget.services, + ), + dense: true, + ), + const SizedBox(height: headerVerticalPadding), + ], + ), + ) + .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: () { + 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, + ); + showBrandBottomSheet( + context: context, + builder: (final BuildContext context) => + const BrandBottomSheet( + isExpended: true, + child: JobsContent(), + ), + ); + }, + ), + const SizedBox(height: 32), + ], + ), + ), + ); + } +} 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..1c8980e2 --- /dev/null +++ b/lib/ui/pages/server_storage/extending_volume.dart @@ -0,0 +1,178 @@ +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'; +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({ + required this.diskVolumeToResize, + required this.diskStatus, + final super.key, + }); + + final DiskVolume diskVolumeToResize; + final DiskStatus diskStatus; + + @override + State createState() => _ExtendingVolumePageState(); +} + +class _ExtendingVolumePageState extends State { + @override + void initState() { + minSize = widget.diskVolumeToResize.sizeTotal + DiskSize.fromGibibyte(3); + _currentSliderGbValue = minSize.gibibyte; + super.initState(); + } + + bool _isError = false; + + late double _currentSliderGbValue; + double _euroPerGb = 1.0; + + final DiskSize maxSize = const DiskSize(byte: 500000000000); + late DiskSize minSize; + + final TextEditingController _sizeController = TextEditingController(); + final TextEditingController _priceController = TextEditingController(); + + void _updateErrorStatuses() { + _isError = minSize.gibibyte > _currentSliderGbValue; + } + + @override + Widget build(final BuildContext context) => FutureBuilder( + future: context.read().getPricePerGb(), + builder: ( + 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), + Center( + child: CircularProgressIndicator(), + ), + ], + ); + } + _euroPerGb = snapshot.data as double; + _sizeController.text = _currentSliderGbValue.truncate().toString(); + _priceController.text = + (_euroPerGb * double.parse(_sizeController.text)) + .toStringAsFixed(2); + minSize = + 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(), + heroSubtitle: 'providers.storage.extending_volume_description'.tr(), + children: [ + const SizedBox(height: 16), + Row( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + 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(), + ), + ), + ), + 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(), + ), + ), + ), + ], + ), + const SizedBox(height: 16), + Slider( + min: minSize.gibibyte, + value: _currentSliderGbValue, + max: maxSize.gibibyte, + onChanged: (final double value) { + setState(() { + _currentSliderGbValue = value; + _updateErrorStatuses(); + }); + }, + ), + const SizedBox(height: 16), + FilledButton( + title: 'providers.storage.extend_volume_button.title'.tr(), + onPressed: _isError + ? null + : () { + context.read().resizeVolume( + widget.diskVolumeToResize, + _currentSliderGbValue.round(), + context.read().reload, + ); + Navigator.of(context).pushAndRemoveUntil( + materialRoute(const RootPage()), + (final predicate) => false, + ); + }, + disabled: _isError || isAlreadyResizing, + ), + const SizedBox(height: 16), + const Divider( + height: 1.0, + ), + const SizedBox(height: 16), + 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 new file mode 100644 index 00000000..9a83789a --- /dev/null +++ b/lib/ui/pages/server_storage/server_storage.dart @@ -0,0 +1,149 @@ +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'; +import 'package:selfprivacy/ui/pages/server_storage/extending_volume.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 { + 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; + + final List services = + context.watch().state.services; + + if (!isReady) { + return BrandHeroScreen( + hasBackButton: true, + heroTitle: 'providers.storage.card_title'.tr(), + children: const [], + ); + } + + return BrandHeroScreen( + hasBackButton: true, + heroTitle: 'providers.storage.card_title'.tr(), + children: [ + // ...sections, + ...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(), + const SizedBox(height: 16), + ], + ), + ) + .toList(), + const SizedBox(height: 8), + ], + ); + } +} + +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( + title: 'providers.storage.extend_volume_button.title'.tr(), + onPressed: () => Navigator.of(context).push( + materialRoute( + ExtendingVolumePage( + diskVolumeToResize: volume, + diskStatus: diskStatus, + ), + ), + ), + ), + ], + ], + ); +} + +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, + ), + ); +} diff --git a/lib/ui/pages/server_storage/storage_card.dart b/lib/ui/pages/server_storage/storage_card.dart new file mode 100644 index 00000000..33b742a2 --- /dev/null +++ b/lib/ui/pages/server_storage/storage_card.dart @@ -0,0 +1,101 @@ +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/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/components/storage_list_items/server_storage_list_item.dart'; +import 'package:selfprivacy/utils/route_transitions/basic.dart'; + +class StorageCard extends StatelessWidget { + const StorageCard({ + required final this.diskStatus, + final super.key, + }); + + final DiskStatus diskStatus; + + @override + Widget build(final BuildContext context) { + final List sections = []; + for (final DiskVolume volume in diskStatus.diskVolumes) { + sections.add( + const SizedBox(height: 16), + ); + sections.add( + 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 Card( + clipBehavior: Clip.antiAlias, + child: InkResponse( + highlightShape: BoxShape.rectangle, + onTap: () => Navigator.of(context).push( + materialRoute( + ServerStoragePage( + diskStatus: diskStatus, + ), + ), + ), + 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, + ), + ), + ], + ), + ...sections, + const SizedBox(height: 8), + ], + ), + ), + ), + ); + } +} diff --git a/lib/ui/pages/services/service_page.dart b/lib/ui/pages/services/service_page.dart new file mode 100644 index 00000000..417f1bf2 --- /dev/null +++ b/lib/ui/pages/services/service_page.dart @@ -0,0 +1,280 @@ +import 'package:easy_localization/easy_localization.dart'; +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'; +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 { + const ServicePage({required this.serviceId, final super.key}); + + final String serviceId; + + @override + State createState() => _ServicePageState(); +} + +class _ServicePageState extends State { + @override + Widget build(final BuildContext context) { + final Service? service = + context.watch().state.getServiceById(widget.serviceId); + + if (service == null) { + return const BrandHeroScreen( + hasBackButton: true, + children: [ + Center( + child: CircularProgressIndicator(), + ), + ], + ); + } + + 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: [ + Container( + alignment: Alignment.center, + child: SvgPicture.string( + service.svgIcon, + width: 48.0, + height: 48.0, + color: Theme.of(context).colorScheme.onBackground, + ), + ), + 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( + 'services.service_page.open_in_browser'.tr(), + 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: () => { + context.read().restart(service.id), + }, + leading: const Icon(Icons.restart_alt_outlined), + title: Text( + 'services.service_page.restart'.tr(), + style: Theme.of(context).textTheme.titleMedium, + ), + enabled: !serviceDisabled && !serviceLocked, + ), + ListTile( + iconColor: Theme.of(context).colorScheme.onBackground, + onTap: () => { + context.read().createOrRemoveServiceToggleJob( + ServiceToggleJob( + type: _idToLegacyType(service.id), + needToTurnOn: serviceDisabled, + ), + ), + }, + leading: const Icon(Icons.power_settings_new), + title: Text( + serviceDisabled + ? 'services.service_page.enable'.tr() + : 'services.service_page.disable'.tr(), + style: Theme.of(context).textTheme.titleMedium, + ), + enabled: !serviceLocked, + ), + if (service.isMovable) + ListTile( + iconColor: Theme.of(context).colorScheme.onBackground, + // 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(), + style: Theme.of(context).textTheme.titleMedium, + ), + 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, + ), + enabled: !serviceDisabled && !serviceLocked, + ), + ], + ); + } + +// 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 { + const ServiceStatusCard({ + required this.status, + final super.key, + }); + final ServiceStatus status; + + @override + Widget build(final BuildContext context) { + switch (status) { + case ServiceStatus.active: + return const FilledCard( + child: ListTile( + leading: Icon( + Icons.check_circle_outline, + size: 24, + ), + title: Text('Up and running'), + ), + ); + case ServiceStatus.inactive: + return const FilledCard( + tertiary: true, + child: ListTile( + leading: Icon( + Icons.stop_circle_outlined, + size: 24, + ), + title: Text('Stopped'), + ), + ); + case ServiceStatus.failed: + return const FilledCard( + error: true, + child: ListTile( + leading: Icon( + Icons.error_outline, + size: 24, + ), + title: Text('Failed to start'), + ), + ); + case ServiceStatus.off: + return const FilledCard( + tertiary: true, + child: ListTile( + leading: Icon( + Icons.power_settings_new, + size: 24, + ), + title: Text('Disabled'), + ), + ); + case ServiceStatus.activating: + return const FilledCard( + tertiary: true, + child: ListTile( + leading: Icon( + Icons.restart_alt_outlined, + size: 24, + ), + title: Text('Activating'), + ), + ); + case ServiceStatus.deactivating: + return const FilledCard( + tertiary: true, + child: ListTile( + leading: Icon( + Icons.restart_alt_outlined, + size: 24, + ), + title: Text('Deactivating'), + ), + ); + case ServiceStatus.reloading: + return const FilledCard( + tertiary: true, + child: ListTile( + leading: Icon( + Icons.restart_alt_outlined, + size: 24, + ), + title: Text('Restarting'), + ), + ); + } + } +} + +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 0b8ea12d..d638866a 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/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'; -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(); @@ -106,7 +103,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, ); @@ -118,20 +115,9 @@ 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, - ), - ) + onTap: isReady + ? () => Navigator.of(context) + .push(materialRoute(ServicePage(serviceId: serviceType.name))) : null, child: BrandCards.big( child: Column( @@ -150,7 +136,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) @@ -202,7 +188,7 @@ class _Card extends StatelessWidget { const SizedBox(height: 10), ], ), - if (serviceType == ServiceTypes.mail) + if (serviceType == ServiceTypes.mailserver) Column( children: [ Text( @@ -246,257 +232,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(), - ), - ), - ), - ], - ), - ) - ], - ), - ), - ), - ); - } -} diff --git a/lib/ui/pages/setup/initializing.dart b/lib/ui/pages/setup/initializing.dart index 9c92f161..1764b576 100644 --- a/lib/ui/pages/setup/initializing.dart +++ b/lib/ui/pages/setup/initializing.dart @@ -5,9 +5,9 @@ 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/hetzner_form_cubit.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'; import 'package:selfprivacy/ui/components/brand_button/brand_button.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) { @@ -30,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), - () => Center(child: Text('initializing.finish'.tr())) - ][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) { @@ -58,7 +63,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, ) @@ -70,7 +75,7 @@ class InitializingPage extends StatelessWidget { 'Domain', 'User', 'Server', - '✅ Check', + 'Check', ], activeIndex: cubit.state.porgressBar, ), @@ -135,10 +140,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 +159,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 +170,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), @@ -191,10 +198,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, @@ -209,7 +216,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( @@ -220,7 +227,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_backblaze.dart b/lib/ui/pages/setup/recovering/recovery_confirm_backblaze.dart index 2b558727..cbd40ff0 100644 --- a/lib/ui/pages/setup/recovering/recovery_confirm_backblaze.dart +++ b/lib/ui/pages/setup/recovering/recovery_confirm_backblaze.dart @@ -28,6 +28,9 @@ class RecoveryConfirmBackblaze extends StatelessWidget { heroTitle: 'recovering.confirm_backblaze'.tr(), heroSubtitle: 'recovering.confirm_backblaze_description'.tr(), hasBackButton: true, + onBackButtonPressed: () { + Navigator.of(context).popUntil((final route) => route.isFirst); + }, 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..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(), @@ -31,9 +31,11 @@ class RecoveryConfirmCloudflare extends StatelessWidget { ), hasBackButton: true, hasFlashButton: false, + onBackButtonPressed: + context.read().revertRecoveryStep, children: [ CubitFormTextField( - formFieldCubit: context.read().apiKey, + formFieldCubit: context.read().apiKey, decoration: InputDecoration( border: const OutlineInputBorder(), labelText: 'initializing.5'.tr(), @@ -43,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), diff --git a/lib/ui/pages/setup/recovering/recovery_confirm_server.dart b/lib/ui/pages/setup/recovering/recovery_confirm_server.dart index 110425ef..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 { @@ -39,6 +39,9 @@ class _RecoveryConfirmServerState extends State { ? 'recovering.choose_server_description'.tr() : 'recovering.confirm_server_description'.tr(), hasBackButton: true, + onBackButtonPressed: () { + Navigator.of(context).popUntil((final route) => route.isFirst); + }, hasFlashButton: false, children: [ FutureBuilder>( @@ -132,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_hentzner_connected.dart b/lib/ui/pages/setup/recovering/recovery_hentzner_connected.dart index e1812b32..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'; @@ -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(), @@ -32,9 +32,12 @@ class RecoveryHetznerConnected extends StatelessWidget { ), hasBackButton: true, hasFlashButton: false, + onBackButtonPressed: () { + Navigator.of(context).popUntil((final route) => route.isFirst); + }, children: [ CubitFormTextField( - formFieldCubit: context.read().apiKey, + formFieldCubit: context.read().apiKey, decoration: InputDecoration( border: const OutlineInputBorder(), labelText: 'recovering.hetzner_connected_placeholder'.tr(), @@ -45,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/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/ssh_keys/new_ssh_key.dart b/lib/ui/pages/ssh_keys/new_ssh_key.dart deleted file mode 100644 index 247590b7..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 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.jobList; - 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 4059ba63..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/jobs/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/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/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); 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.dart b/lib/ui/pages/users/user.dart index 69a2e5dc..1d781811 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(login: user.login)), ); }, child: Container( diff --git a/lib/ui/pages/users/user_details.dart b/lib/ui/pages/users/user_details.dart index d758c1f4..86a9e3d7 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,179 +14,311 @@ class _UserDetails extends StatelessWidget { final String domainName = UiHelpers.getDomainName(config); - return BrandBottomSheet( - isExpended: true, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, + 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: 'ssh.root.title'.tr(), + heroSubtitle: 'ssh.root.subtitle'.tr(), children: [ - Container( - height: 200, - decoration: BoxDecoration( - color: user.color, - borderRadius: const BorderRadius.vertical( - top: Radius.circular(20), + _SshKeysCard(user: user), + ], + ); + } + + return BrandHeroScreen( + hasBackButton: true, + heroTitle: user.login, + children: [ + _UserLogins(user: user, domainName: domainName), + const SizedBox(height: 8), + _SshKeysCard(user: user), + const SizedBox(height: 8), + ListTile( + iconColor: Theme.of(context).colorScheme.onBackground, + onTap: () => { + showModalBottomSheet( + context: context, + isScrollControlled: true, + backgroundColor: Colors.transparent, + builder: (final BuildContext context) => Padding( + padding: MediaQuery.of(context).viewInsets, + child: ResetPassword(user: user), ), ), - 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 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, - ), - ), - ], - ), + }, + leading: const Icon(Icons.lock_reset_outlined), + title: Text( + 'users.reset_password'.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), - ), - ], - ), - ) - ], - ), + ), + if (user.type == UserType.normal) _DeleteUserTile(user: user), + const Divider(height: 8), + Padding( + padding: const EdgeInsets.all(16.0), + child: InfoBox( + text: 'users.no_sso_notice'.tr(), + isWarning: true, + ), + ), + ], ); } } -enum PopupMenuItemType { - // reset, - delete, +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) => FilledCard( + child: Column( + children: [ + ListTileOnSurfaceVariant( + title: '${user.login}@$domainName', + subtitle: 'users.email_login'.tr(), + leadingIcon: Icons.alternate_email_outlined, + ), + ], + ), + ); +} + +class _SshKeysCard extends StatelessWidget { + const _SshKeysCard({ + required this.user, + }); + + final User user; + + @override + Widget build(final BuildContext context) => FilledCard( + child: Column( + children: [ + ListTileOnSurfaceVariant( + title: 'ssh.title'.tr(), + ), + const Divider(height: 0), + ListTileOnSurfaceVariant( + title: 'ssh.create'.tr(), + leadingIcon: Icons.add_circle_outline, + 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 ListTileOnSurfaceVariant( + title: '$keyName ($keyType)', + disableSubtitleOverflow: true, + // do not overflow text + subtitle: publicKey, + 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 659453d1..40443a9c 100644 --- a/lib/ui/pages/users/users.dart +++ b/lib/ui/pages/users/users.dart @@ -1,28 +1,28 @@ -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/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'; -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'; 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_divider/brand_divider.dart'; +import 'package:selfprivacy/ui/components/brand_button/outlined_button.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_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/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'; @@ -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}); @@ -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, ), ), ); 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/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()}'; +} 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; -} diff --git a/lib/utils/scalars.dart b/lib/utils/scalars.dart new file mode 100644 index 00000000..278fb80a --- /dev/null +++ b/lib/utils/scalars.dart @@ -0,0 +1,9 @@ +// ignore_for_file: prefer_final_parameters, prefer_expression_function_bodies + +String dateTimeToJson(DateTime data) { + return data.toIso8601String(); +} + +DateTime dateTimeFromJson(dynamic data) { + return DateTime.parse(data as String); +} 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'; } 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. diff --git a/pubspec.lock b/pubspec.lock index e3faf1b6..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: @@ -169,6 +162,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.1.0" + 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: @@ -204,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: @@ -218,48 +246,55 @@ 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.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: @@ -273,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: @@ -322,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: @@ -356,6 +391,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: @@ -431,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 @@ -462,6 +511,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.10.3" + 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: @@ -482,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: @@ -496,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: @@ -524,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: @@ -559,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: @@ -672,6 +805,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 +819,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: @@ -700,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: @@ -727,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: @@ -748,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: @@ -819,13 +980,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.2.0" - quiver: + recase: dependency: transitive description: - name: quiver + name: recase url: "https://pub.dartlang.org" source: hosted - version: "3.1.0" + 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: @@ -992,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: @@ -1083,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: @@ -1153,6 +1307,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: @@ -1229,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: @@ -1243,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 71a5f2f9..372bd4a2 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.7.0+16 environment: sdk: '>=2.17.0 <3.0.0' @@ -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 @@ -25,13 +24,18 @@ 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 + 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 @@ -40,7 +44,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 @@ -49,10 +52,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 37b7695e..1feb1b08 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,11 +6,17 @@ #include "generated_plugin_registrant.h" +#include +#include #include #include #include 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 a1aaa278..fa5d72de 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,6 +3,8 @@ # list(APPEND FLUTTER_PLUGIN_LIST + connectivity_plus_windows + dynamic_color flutter_secure_storage_windows system_theme url_launcher_windows