From b3b7c83461006c012acdb2573ee64a068a522d26 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Thu, 29 Jun 2023 15:38:46 -0300 Subject: [PATCH] chore: Implement fragments for ServerJob type on backup requests --- .../graphql_maps/schema/backups.graphql | 14 + .../graphql_maps/schema/backups.graphql.dart | 802 ++++++++++++++- .../graphql_maps/schema/disk_volumes.graphql | 12 +- .../schema/disk_volumes.graphql.dart | 426 +------- .../graphql_maps/schema/server_api.graphql | 28 +- .../schema/server_api.graphql.dart | 934 ++++++++++-------- .../schema/server_settings.graphql.dart | 2 +- .../graphql_maps/schema/services.graphql | 12 +- .../graphql_maps/schema/services.graphql.dart | 452 +-------- .../graphql_maps/schema/users.graphql.dart | 2 +- .../graphql_maps/server_api/backups_api.dart | 47 +- lib/logic/models/json/server_job.dart | 2 +- .../providers/dns_providers/dns_provider.dart | 9 + 13 files changed, 1445 insertions(+), 1297 deletions(-) diff --git a/lib/logic/api_maps/graphql_maps/schema/backups.graphql b/lib/logic/api_maps/graphql_maps/schema/backups.graphql index c0341b19..fae80432 100644 --- a/lib/logic/api_maps/graphql_maps/schema/backups.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/backups.graphql @@ -50,6 +50,9 @@ mutation StartBackup($serviceId: String!) { backup { startBackup(serviceId: $serviceId) { ...basicMutationReturnFields + job { + ...basicApiJobsFields + } } } } @@ -77,3 +80,14 @@ mutation InitializeRepository($repository: InitializeRepositoryInput!) { } } } + +mutation RestoreBackup($snapshotId: String!) { + backup { + restoreBackup(snapshotId: $snapshotId) { + ...basicMutationReturnFields + job { + ...basicApiJobsFields + } + } + } +} \ No newline at end of file diff --git a/lib/logic/api_maps/graphql_maps/schema/backups.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/backups.graphql.dart index 2ed668b1..52bf45eb 100644 --- a/lib/logic/api_maps/graphql_maps/schema/backups.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/backups.graphql.dart @@ -1,9 +1,10 @@ import 'dart:async'; -import 'disk_volumes.graphql.dart'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; import 'package:selfprivacy/utils/scalars.dart'; import 'schema.graphql.dart'; +import 'server_api.graphql.dart'; +import 'services.graphql.dart'; class Fragment$genericBackupConfigReturn { Fragment$genericBackupConfigReturn({ @@ -3003,6 +3004,25 @@ const documentNodeMutationStartBackup = DocumentNode(definitions: [ name: NameNode(value: 'basicMutationReturnFields'), directives: [], ), + FieldNode( + name: NameNode(value: 'job'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicApiJobsFields'), + directives: [], + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), FieldNode( name: NameNode(value: '__typename'), alias: null, @@ -3031,6 +3051,7 @@ const documentNodeMutationStartBackup = DocumentNode(definitions: [ ]), ), fragmentDefinitionbasicMutationReturnFields, + fragmentDefinitionbasicApiJobsFields, ]); Mutation$StartBackup _parserFn$Mutation$StartBackup( Map data) => @@ -3268,6 +3289,7 @@ class Mutation$StartBackup$backup$startBackup required this.message, required this.success, this.$__typename = 'GenericJobMutationReturn', + this.job, }); factory Mutation$StartBackup$backup$startBackup.fromJson( @@ -3276,11 +3298,16 @@ class Mutation$StartBackup$backup$startBackup final l$message = json['message']; final l$success = json['success']; final l$$__typename = json['__typename']; + final l$job = json['job']; return Mutation$StartBackup$backup$startBackup( code: (l$code as int), message: (l$message as String), success: (l$success as bool), $__typename: (l$$__typename as String), + job: l$job == null + ? null + : Fragment$basicApiJobsFields.fromJson( + (l$job as Map)), ); } @@ -3292,6 +3319,8 @@ class Mutation$StartBackup$backup$startBackup final String $__typename; + final Fragment$basicApiJobsFields? job; + Map toJson() { final _resultData = {}; final l$code = code; @@ -3302,6 +3331,8 @@ class Mutation$StartBackup$backup$startBackup _resultData['success'] = l$success; final l$$__typename = $__typename; _resultData['__typename'] = l$$__typename; + final l$job = job; + _resultData['job'] = l$job?.toJson(); return _resultData; } @@ -3311,11 +3342,13 @@ class Mutation$StartBackup$backup$startBackup 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, ]); } @@ -3348,6 +3381,11 @@ class Mutation$StartBackup$backup$startBackup 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; } } @@ -3376,7 +3414,9 @@ abstract class CopyWith$Mutation$StartBackup$backup$startBackup { String? message, bool? success, String? $__typename, + Fragment$basicApiJobsFields? job, }); + CopyWith$Fragment$basicApiJobsFields get job; } class _CopyWithImpl$Mutation$StartBackup$backup$startBackup @@ -3397,6 +3437,7 @@ class _CopyWithImpl$Mutation$StartBackup$backup$startBackup Object? message = _undefined, Object? success = _undefined, Object? $__typename = _undefined, + Object? job = _undefined, }) => _then(Mutation$StartBackup$backup$startBackup( code: @@ -3410,7 +3451,16 @@ class _CopyWithImpl$Mutation$StartBackup$backup$startBackup $__typename: $__typename == _undefined || $__typename == null ? _instance.$__typename : ($__typename as String), + job: job == _undefined + ? _instance.job + : (job as Fragment$basicApiJobsFields?), )); + CopyWith$Fragment$basicApiJobsFields get job { + final local$job = _instance.job; + return local$job == null + ? CopyWith$Fragment$basicApiJobsFields.stub(_then(_instance)) + : CopyWith$Fragment$basicApiJobsFields(local$job, (e) => call(job: e)); + } } class _CopyWithStubImpl$Mutation$StartBackup$backup$startBackup @@ -3424,8 +3474,11 @@ class _CopyWithStubImpl$Mutation$StartBackup$backup$startBackup String? message, bool? success, String? $__typename, + Fragment$basicApiJobsFields? job, }) => _res; + CopyWith$Fragment$basicApiJobsFields get job => + CopyWith$Fragment$basicApiJobsFields.stub(_res); } class Variables$Mutation$SetAutobackupPeriod { @@ -4928,3 +4981,750 @@ class _CopyWithStubImpl$Mutation$InitializeRepository$backup CopyWith$Fragment$genericBackupConfigReturn get initializeRepository => CopyWith$Fragment$genericBackupConfigReturn.stub(_res); } + +class Variables$Mutation$RestoreBackup { + factory Variables$Mutation$RestoreBackup({required String snapshotId}) => + Variables$Mutation$RestoreBackup._({ + r'snapshotId': snapshotId, + }); + + Variables$Mutation$RestoreBackup._(this._$data); + + factory Variables$Mutation$RestoreBackup.fromJson(Map data) { + final result$data = {}; + final l$snapshotId = data['snapshotId']; + result$data['snapshotId'] = (l$snapshotId as String); + return Variables$Mutation$RestoreBackup._(result$data); + } + + Map _$data; + + String get snapshotId => (_$data['snapshotId'] as String); + Map toJson() { + final result$data = {}; + final l$snapshotId = snapshotId; + result$data['snapshotId'] = l$snapshotId; + return result$data; + } + + CopyWith$Variables$Mutation$RestoreBackup + get copyWith => CopyWith$Variables$Mutation$RestoreBackup( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$RestoreBackup) || + runtimeType != other.runtimeType) { + return false; + } + final l$snapshotId = snapshotId; + final lOther$snapshotId = other.snapshotId; + if (l$snapshotId != lOther$snapshotId) { + return false; + } + return true; + } + + @override + int get hashCode { + final l$snapshotId = snapshotId; + return Object.hashAll([l$snapshotId]); + } +} + +abstract class CopyWith$Variables$Mutation$RestoreBackup { + factory CopyWith$Variables$Mutation$RestoreBackup( + Variables$Mutation$RestoreBackup instance, + TRes Function(Variables$Mutation$RestoreBackup) then, + ) = _CopyWithImpl$Variables$Mutation$RestoreBackup; + + factory CopyWith$Variables$Mutation$RestoreBackup.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$RestoreBackup; + + TRes call({String? snapshotId}); +} + +class _CopyWithImpl$Variables$Mutation$RestoreBackup + implements CopyWith$Variables$Mutation$RestoreBackup { + _CopyWithImpl$Variables$Mutation$RestoreBackup( + this._instance, + this._then, + ); + + final Variables$Mutation$RestoreBackup _instance; + + final TRes Function(Variables$Mutation$RestoreBackup) _then; + + static const _undefined = {}; + + TRes call({Object? snapshotId = _undefined}) => + _then(Variables$Mutation$RestoreBackup._({ + ..._instance._$data, + if (snapshotId != _undefined && snapshotId != null) + 'snapshotId': (snapshotId as String), + })); +} + +class _CopyWithStubImpl$Variables$Mutation$RestoreBackup + implements CopyWith$Variables$Mutation$RestoreBackup { + _CopyWithStubImpl$Variables$Mutation$RestoreBackup(this._res); + + TRes _res; + + call({String? snapshotId}) => _res; +} + +class Mutation$RestoreBackup { + Mutation$RestoreBackup({ + required this.backup, + this.$__typename = 'Mutation', + }); + + factory Mutation$RestoreBackup.fromJson(Map json) { + final l$backup = json['backup']; + final l$$__typename = json['__typename']; + return Mutation$RestoreBackup( + backup: Mutation$RestoreBackup$backup.fromJson( + (l$backup as Map)), + $__typename: (l$$__typename as String), + ); + } + + final Mutation$RestoreBackup$backup backup; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$backup = backup; + _resultData['backup'] = l$backup.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$backup = backup; + final l$$__typename = $__typename; + return Object.hashAll([ + l$backup, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Mutation$RestoreBackup) || + runtimeType != other.runtimeType) { + return false; + } + final l$backup = backup; + final lOther$backup = other.backup; + if (l$backup != lOther$backup) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Mutation$RestoreBackup on Mutation$RestoreBackup { + CopyWith$Mutation$RestoreBackup get copyWith => + CopyWith$Mutation$RestoreBackup( + this, + (i) => i, + ); +} + +abstract class CopyWith$Mutation$RestoreBackup { + factory CopyWith$Mutation$RestoreBackup( + Mutation$RestoreBackup instance, + TRes Function(Mutation$RestoreBackup) then, + ) = _CopyWithImpl$Mutation$RestoreBackup; + + factory CopyWith$Mutation$RestoreBackup.stub(TRes res) = + _CopyWithStubImpl$Mutation$RestoreBackup; + + TRes call({ + Mutation$RestoreBackup$backup? backup, + String? $__typename, + }); + CopyWith$Mutation$RestoreBackup$backup get backup; +} + +class _CopyWithImpl$Mutation$RestoreBackup + implements CopyWith$Mutation$RestoreBackup { + _CopyWithImpl$Mutation$RestoreBackup( + this._instance, + this._then, + ); + + final Mutation$RestoreBackup _instance; + + final TRes Function(Mutation$RestoreBackup) _then; + + static const _undefined = {}; + + TRes call({ + Object? backup = _undefined, + Object? $__typename = _undefined, + }) => + _then(Mutation$RestoreBackup( + backup: backup == _undefined || backup == null + ? _instance.backup + : (backup as Mutation$RestoreBackup$backup), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); + CopyWith$Mutation$RestoreBackup$backup get backup { + final local$backup = _instance.backup; + return CopyWith$Mutation$RestoreBackup$backup( + local$backup, (e) => call(backup: e)); + } +} + +class _CopyWithStubImpl$Mutation$RestoreBackup + implements CopyWith$Mutation$RestoreBackup { + _CopyWithStubImpl$Mutation$RestoreBackup(this._res); + + TRes _res; + + call({ + Mutation$RestoreBackup$backup? backup, + String? $__typename, + }) => + _res; + CopyWith$Mutation$RestoreBackup$backup get backup => + CopyWith$Mutation$RestoreBackup$backup.stub(_res); +} + +const documentNodeMutationRestoreBackup = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.mutation, + name: NameNode(value: 'RestoreBackup'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'snapshotId')), + type: NamedTypeNode( + name: NameNode(value: 'String'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'backup'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'restoreBackup'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'snapshotId'), + value: VariableNode(name: NameNode(value: 'snapshotId')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicMutationReturnFields'), + directives: [], + ), + FieldNode( + name: NameNode(value: 'job'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'basicApiJobsFields'), + directives: [], + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + fragmentDefinitionbasicMutationReturnFields, + fragmentDefinitionbasicApiJobsFields, +]); +Mutation$RestoreBackup _parserFn$Mutation$RestoreBackup( + Map data) => + Mutation$RestoreBackup.fromJson(data); +typedef OnMutationCompleted$Mutation$RestoreBackup = FutureOr Function( + Map?, + Mutation$RestoreBackup?, +); + +class Options$Mutation$RestoreBackup + extends graphql.MutationOptions { + Options$Mutation$RestoreBackup({ + String? operationName, + required Variables$Mutation$RestoreBackup variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Mutation$RestoreBackup? typedOptimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$RestoreBackup? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, + super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( + data, + data == null + ? null + : _parserFn$Mutation$RestoreBackup(data), + ), + update: update, + onError: onError, + document: documentNodeMutationRestoreBackup, + parserFn: _parserFn$Mutation$RestoreBackup, + ); + + final OnMutationCompleted$Mutation$RestoreBackup? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + onCompletedWithParsed, + ]; +} + +class WatchOptions$Mutation$RestoreBackup + extends graphql.WatchQueryOptions { + WatchOptions$Mutation$RestoreBackup({ + String? operationName, + required Variables$Mutation$RestoreBackup variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Mutation$RestoreBackup? typedOptimisticResult, + 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 ?? typedOptimisticResult?.toJson(), + context: context, + document: documentNodeMutationRestoreBackup, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$RestoreBackup, + ); +} + +extension ClientExtension$Mutation$RestoreBackup on graphql.GraphQLClient { + Future> mutate$RestoreBackup( + Options$Mutation$RestoreBackup options) async => + await this.mutate(options); + graphql.ObservableQuery watchMutation$RestoreBackup( + WatchOptions$Mutation$RestoreBackup options) => + this.watchMutation(options); +} + +class Mutation$RestoreBackup$backup { + Mutation$RestoreBackup$backup({ + required this.restoreBackup, + this.$__typename = 'BackupMutations', + }); + + factory Mutation$RestoreBackup$backup.fromJson(Map json) { + final l$restoreBackup = json['restoreBackup']; + final l$$__typename = json['__typename']; + return Mutation$RestoreBackup$backup( + restoreBackup: Mutation$RestoreBackup$backup$restoreBackup.fromJson( + (l$restoreBackup as Map)), + $__typename: (l$$__typename as String), + ); + } + + final Mutation$RestoreBackup$backup$restoreBackup restoreBackup; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$restoreBackup = restoreBackup; + _resultData['restoreBackup'] = l$restoreBackup.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$restoreBackup = restoreBackup; + final l$$__typename = $__typename; + return Object.hashAll([ + l$restoreBackup, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Mutation$RestoreBackup$backup) || + runtimeType != other.runtimeType) { + return false; + } + final l$restoreBackup = restoreBackup; + final lOther$restoreBackup = other.restoreBackup; + if (l$restoreBackup != lOther$restoreBackup) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Mutation$RestoreBackup$backup + on Mutation$RestoreBackup$backup { + CopyWith$Mutation$RestoreBackup$backup + get copyWith => CopyWith$Mutation$RestoreBackup$backup( + this, + (i) => i, + ); +} + +abstract class CopyWith$Mutation$RestoreBackup$backup { + factory CopyWith$Mutation$RestoreBackup$backup( + Mutation$RestoreBackup$backup instance, + TRes Function(Mutation$RestoreBackup$backup) then, + ) = _CopyWithImpl$Mutation$RestoreBackup$backup; + + factory CopyWith$Mutation$RestoreBackup$backup.stub(TRes res) = + _CopyWithStubImpl$Mutation$RestoreBackup$backup; + + TRes call({ + Mutation$RestoreBackup$backup$restoreBackup? restoreBackup, + String? $__typename, + }); + CopyWith$Mutation$RestoreBackup$backup$restoreBackup get restoreBackup; +} + +class _CopyWithImpl$Mutation$RestoreBackup$backup + implements CopyWith$Mutation$RestoreBackup$backup { + _CopyWithImpl$Mutation$RestoreBackup$backup( + this._instance, + this._then, + ); + + final Mutation$RestoreBackup$backup _instance; + + final TRes Function(Mutation$RestoreBackup$backup) _then; + + static const _undefined = {}; + + TRes call({ + Object? restoreBackup = _undefined, + Object? $__typename = _undefined, + }) => + _then(Mutation$RestoreBackup$backup( + restoreBackup: restoreBackup == _undefined || restoreBackup == null + ? _instance.restoreBackup + : (restoreBackup as Mutation$RestoreBackup$backup$restoreBackup), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); + CopyWith$Mutation$RestoreBackup$backup$restoreBackup get restoreBackup { + final local$restoreBackup = _instance.restoreBackup; + return CopyWith$Mutation$RestoreBackup$backup$restoreBackup( + local$restoreBackup, (e) => call(restoreBackup: e)); + } +} + +class _CopyWithStubImpl$Mutation$RestoreBackup$backup + implements CopyWith$Mutation$RestoreBackup$backup { + _CopyWithStubImpl$Mutation$RestoreBackup$backup(this._res); + + TRes _res; + + call({ + Mutation$RestoreBackup$backup$restoreBackup? restoreBackup, + String? $__typename, + }) => + _res; + CopyWith$Mutation$RestoreBackup$backup$restoreBackup + get restoreBackup => + CopyWith$Mutation$RestoreBackup$backup$restoreBackup.stub(_res); +} + +class Mutation$RestoreBackup$backup$restoreBackup + implements Fragment$basicMutationReturnFields$$GenericJobMutationReturn { + Mutation$RestoreBackup$backup$restoreBackup({ + required this.code, + required this.message, + required this.success, + this.$__typename = 'GenericJobMutationReturn', + this.job, + }); + + factory Mutation$RestoreBackup$backup$restoreBackup.fromJson( + Map json) { + final l$code = json['code']; + final l$message = json['message']; + final l$success = json['success']; + final l$$__typename = json['__typename']; + final l$job = json['job']; + return Mutation$RestoreBackup$backup$restoreBackup( + code: (l$code as int), + message: (l$message as String), + success: (l$success as bool), + $__typename: (l$$__typename as String), + job: l$job == null + ? null + : Fragment$basicApiJobsFields.fromJson( + (l$job as Map)), + ); + } + + final int code; + + final String message; + + final bool success; + + final String $__typename; + + final Fragment$basicApiJobsFields? job; + + Map toJson() { + final _resultData = {}; + final l$code = code; + _resultData['code'] = l$code; + final l$message = message; + _resultData['message'] = l$message; + final l$success = success; + _resultData['success'] = l$success; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + final l$job = job; + _resultData['job'] = l$job?.toJson(); + return _resultData; + } + + @override + int get hashCode { + final l$code = code; + final l$message = message; + final l$success = success; + final l$$__typename = $__typename; + final l$job = job; + return Object.hashAll([ + l$code, + l$message, + l$success, + l$$__typename, + l$job, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Mutation$RestoreBackup$backup$restoreBackup) || + 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$RestoreBackup$backup$restoreBackup + on Mutation$RestoreBackup$backup$restoreBackup { + CopyWith$Mutation$RestoreBackup$backup$restoreBackup< + Mutation$RestoreBackup$backup$restoreBackup> + get copyWith => CopyWith$Mutation$RestoreBackup$backup$restoreBackup( + this, + (i) => i, + ); +} + +abstract class CopyWith$Mutation$RestoreBackup$backup$restoreBackup { + factory CopyWith$Mutation$RestoreBackup$backup$restoreBackup( + Mutation$RestoreBackup$backup$restoreBackup instance, + TRes Function(Mutation$RestoreBackup$backup$restoreBackup) then, + ) = _CopyWithImpl$Mutation$RestoreBackup$backup$restoreBackup; + + factory CopyWith$Mutation$RestoreBackup$backup$restoreBackup.stub(TRes res) = + _CopyWithStubImpl$Mutation$RestoreBackup$backup$restoreBackup; + + TRes call({ + int? code, + String? message, + bool? success, + String? $__typename, + Fragment$basicApiJobsFields? job, + }); + CopyWith$Fragment$basicApiJobsFields get job; +} + +class _CopyWithImpl$Mutation$RestoreBackup$backup$restoreBackup + implements CopyWith$Mutation$RestoreBackup$backup$restoreBackup { + _CopyWithImpl$Mutation$RestoreBackup$backup$restoreBackup( + this._instance, + this._then, + ); + + final Mutation$RestoreBackup$backup$restoreBackup _instance; + + final TRes Function(Mutation$RestoreBackup$backup$restoreBackup) _then; + + static const _undefined = {}; + + TRes call({ + Object? code = _undefined, + Object? message = _undefined, + Object? success = _undefined, + Object? $__typename = _undefined, + Object? job = _undefined, + }) => + _then(Mutation$RestoreBackup$backup$restoreBackup( + 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 Fragment$basicApiJobsFields?), + )); + CopyWith$Fragment$basicApiJobsFields get job { + final local$job = _instance.job; + return local$job == null + ? CopyWith$Fragment$basicApiJobsFields.stub(_then(_instance)) + : CopyWith$Fragment$basicApiJobsFields(local$job, (e) => call(job: e)); + } +} + +class _CopyWithStubImpl$Mutation$RestoreBackup$backup$restoreBackup + implements CopyWith$Mutation$RestoreBackup$backup$restoreBackup { + _CopyWithStubImpl$Mutation$RestoreBackup$backup$restoreBackup(this._res); + + TRes _res; + + call({ + int? code, + String? message, + bool? success, + String? $__typename, + Fragment$basicApiJobsFields? job, + }) => + _res; + CopyWith$Fragment$basicApiJobsFields get job => + CopyWith$Fragment$basicApiJobsFields.stub(_res); +} diff --git a/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql index a5947f5e..e1d562d2 100644 --- a/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql @@ -53,17 +53,7 @@ mutation MigrateToBinds($input: MigrateToBindsInput!) { migrateToBinds(input: $input) { ...basicMutationReturnFields job { - createdAt - description - error - finishedAt - name - progress - result - status - statusText - uid - updatedAt + ...basicApiJobsFields } } } diff --git a/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart index c900dcc7..2d7939a5 100644 --- a/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart @@ -1,8 +1,9 @@ import 'dart:async'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; -import 'package:selfprivacy/utils/scalars.dart'; import 'schema.graphql.dart'; +import 'server_api.graphql.dart'; +import 'services.graphql.dart'; class Fragment$basicMutationReturnFields { Fragment$basicMutationReturnFields({ @@ -5679,82 +5680,9 @@ const documentNodeMutationMigrateToBinds = DocumentNode(definitions: [ arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'createdAt'), - alias: null, - arguments: [], + FragmentSpreadNode( + name: NameNode(value: 'basicApiJobsFields'), 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'), @@ -5784,6 +5712,7 @@ const documentNodeMutationMigrateToBinds = DocumentNode(definitions: [ ]), ), fragmentDefinitionbasicMutationReturnFields, + fragmentDefinitionbasicApiJobsFields, ]); Mutation$MigrateToBinds _parserFn$Mutation$MigrateToBinds( Map data) => @@ -5906,7 +5835,7 @@ class Mutation$MigrateToBinds$migrateToBinds $__typename: (l$$__typename as String), job: l$job == null ? null - : Mutation$MigrateToBinds$migrateToBinds$job.fromJson( + : Fragment$basicApiJobsFields.fromJson( (l$job as Map)), ); } @@ -5919,7 +5848,7 @@ class Mutation$MigrateToBinds$migrateToBinds final String $__typename; - final Mutation$MigrateToBinds$migrateToBinds$job? job; + final Fragment$basicApiJobsFields? job; Map toJson() { final _resultData = {}; @@ -6014,9 +5943,9 @@ abstract class CopyWith$Mutation$MigrateToBinds$migrateToBinds { String? message, bool? success, String? $__typename, - Mutation$MigrateToBinds$migrateToBinds$job? job, + Fragment$basicApiJobsFields? job, }); - CopyWith$Mutation$MigrateToBinds$migrateToBinds$job get job; + CopyWith$Fragment$basicApiJobsFields get job; } class _CopyWithImpl$Mutation$MigrateToBinds$migrateToBinds @@ -6053,15 +5982,13 @@ class _CopyWithImpl$Mutation$MigrateToBinds$migrateToBinds : ($__typename as String), job: job == _undefined ? _instance.job - : (job as Mutation$MigrateToBinds$migrateToBinds$job?), + : (job as Fragment$basicApiJobsFields?), )); - CopyWith$Mutation$MigrateToBinds$migrateToBinds$job get job { + CopyWith$Fragment$basicApiJobsFields 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)); + ? CopyWith$Fragment$basicApiJobsFields.stub(_then(_instance)) + : CopyWith$Fragment$basicApiJobsFields(local$job, (e) => call(job: e)); } } @@ -6076,330 +6003,9 @@ class _CopyWithStubImpl$Mutation$MigrateToBinds$migrateToBinds 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); -} - -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, - this.$__typename = 'ApiJob', - }); - - factory Mutation$MigrateToBinds$migrateToBinds$job.fromJson( - Map json) { - final l$createdAt = json['createdAt']; - final l$description = json['description']; - final l$error = json['error']; - final l$finishedAt = json['finishedAt']; - final l$name = json['name']; - final l$progress = json['progress']; - final l$result = json['result']; - final l$status = json['status']; - final l$statusText = json['statusText']; - final l$uid = json['uid']; - final l$updatedAt = json['updatedAt']; - final l$$__typename = json['__typename']; - return Mutation$MigrateToBinds$migrateToBinds$job( - createdAt: dateTimeFromJson(l$createdAt), - description: (l$description as String), - error: (l$error as String?), - finishedAt: l$finishedAt == null ? null : dateTimeFromJson(l$finishedAt), - name: (l$name as String), - progress: (l$progress as int?), - result: (l$result as String?), - status: (l$status as String), - statusText: (l$statusText as String?), - uid: (l$uid as String), - updatedAt: dateTimeFromJson(l$updatedAt), - $__typename: (l$$__typename as String), - ); - } - - final DateTime createdAt; - - final String description; - - final String? error; - - final DateTime? finishedAt; - - final String name; - - final int? progress; - - final String? result; - - final String status; - - final String? statusText; - - final String uid; - - final DateTime updatedAt; - - final String $__typename; - - Map toJson() { - final _resultData = {}; - final l$createdAt = createdAt; - _resultData['createdAt'] = dateTimeToJson(l$createdAt); - final l$description = description; - _resultData['description'] = l$description; - final l$error = error; - _resultData['error'] = l$error; - final l$finishedAt = finishedAt; - _resultData['finishedAt'] = - l$finishedAt == null ? null : dateTimeToJson(l$finishedAt); - final l$name = name; - _resultData['name'] = l$name; - final l$progress = progress; - _resultData['progress'] = l$progress; - final l$result = result; - _resultData['result'] = l$result; - final l$status = status; - _resultData['status'] = l$status; - final l$statusText = statusText; - _resultData['statusText'] = l$statusText; - final l$uid = uid; - _resultData['uid'] = l$uid; - final l$updatedAt = updatedAt; - _resultData['updatedAt'] = dateTimeToJson(l$updatedAt); - final l$$__typename = $__typename; - _resultData['__typename'] = l$$__typename; - return _resultData; - } - - @override - int get hashCode { - final l$createdAt = createdAt; - final l$description = description; - 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, + Fragment$basicApiJobsFields? job, }) => _res; + CopyWith$Fragment$basicApiJobsFields get job => + CopyWith$Fragment$basicApiJobsFields.stub(_res); } diff --git a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql index 9797e81f..631454db 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql @@ -4,6 +4,21 @@ fragment basicMutationReturnFields on MutationReturnInterface{ success } +fragment basicApiJobsFields on ApiJob{ + createdAt + description + error + finishedAt + name + progress + result + status + statusText + uid + typeId + updatedAt +} + query GetApiVersion { api { version @@ -13,18 +28,7 @@ query GetApiVersion { query GetApiJobs { jobs { getJobs { - createdAt - description - error - finishedAt - name - progress - result - status - statusText - uid - typeId - updatedAt + ...basicApiJobsFields } } } diff --git a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart index 7c09fbb7..75b1f344 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart @@ -1,9 +1,9 @@ import 'dart:async'; -import 'disk_volumes.graphql.dart'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; import 'package:selfprivacy/utils/scalars.dart'; import 'schema.graphql.dart'; +import 'services.graphql.dart'; class Fragment$basicMutationReturnFields { Fragment$basicMutationReturnFields({ @@ -2283,6 +2283,486 @@ class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$UserMutationReturn< _res; } +class Fragment$basicApiJobsFields { + Fragment$basicApiJobsFields({ + 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.typeId, + required this.updatedAt, + this.$__typename = 'ApiJob', + }); + + factory Fragment$basicApiJobsFields.fromJson(Map json) { + final l$createdAt = json['createdAt']; + final l$description = json['description']; + final l$error = json['error']; + final l$finishedAt = json['finishedAt']; + final l$name = json['name']; + final l$progress = json['progress']; + final l$result = json['result']; + final l$status = json['status']; + final l$statusText = json['statusText']; + final l$uid = json['uid']; + final l$typeId = json['typeId']; + final l$updatedAt = json['updatedAt']; + final l$$__typename = json['__typename']; + return Fragment$basicApiJobsFields( + createdAt: dateTimeFromJson(l$createdAt), + description: (l$description as String), + error: (l$error as String?), + finishedAt: l$finishedAt == null ? null : dateTimeFromJson(l$finishedAt), + name: (l$name as String), + progress: (l$progress as int?), + result: (l$result as String?), + status: (l$status as String), + statusText: (l$statusText as String?), + uid: (l$uid as String), + typeId: (l$typeId as String), + updatedAt: dateTimeFromJson(l$updatedAt), + $__typename: (l$$__typename as String), + ); + } + + final DateTime createdAt; + + final String description; + + final String? error; + + final DateTime? finishedAt; + + final String name; + + final int? progress; + + final String? result; + + final String status; + + final String? statusText; + + final String uid; + + final String typeId; + + final DateTime updatedAt; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$createdAt = createdAt; + _resultData['createdAt'] = dateTimeToJson(l$createdAt); + final l$description = description; + _resultData['description'] = l$description; + final l$error = error; + _resultData['error'] = l$error; + final l$finishedAt = finishedAt; + _resultData['finishedAt'] = + l$finishedAt == null ? null : dateTimeToJson(l$finishedAt); + final l$name = name; + _resultData['name'] = l$name; + final l$progress = progress; + _resultData['progress'] = l$progress; + final l$result = result; + _resultData['result'] = l$result; + final l$status = status; + _resultData['status'] = l$status; + final l$statusText = statusText; + _resultData['statusText'] = l$statusText; + final l$uid = uid; + _resultData['uid'] = l$uid; + final l$typeId = typeId; + _resultData['typeId'] = l$typeId; + final l$updatedAt = updatedAt; + _resultData['updatedAt'] = dateTimeToJson(l$updatedAt); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$createdAt = createdAt; + final l$description = description; + 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$typeId = typeId; + 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$typeId, + l$updatedAt, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Fragment$basicApiJobsFields) || + 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$typeId = typeId; + final lOther$typeId = other.typeId; + if (l$typeId != lOther$typeId) { + 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$Fragment$basicApiJobsFields + on Fragment$basicApiJobsFields { + CopyWith$Fragment$basicApiJobsFields + get copyWith => CopyWith$Fragment$basicApiJobsFields( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$basicApiJobsFields { + factory CopyWith$Fragment$basicApiJobsFields( + Fragment$basicApiJobsFields instance, + TRes Function(Fragment$basicApiJobsFields) then, + ) = _CopyWithImpl$Fragment$basicApiJobsFields; + + factory CopyWith$Fragment$basicApiJobsFields.stub(TRes res) = + _CopyWithStubImpl$Fragment$basicApiJobsFields; + + TRes call({ + DateTime? createdAt, + String? description, + String? error, + DateTime? finishedAt, + String? name, + int? progress, + String? result, + String? status, + String? statusText, + String? uid, + String? typeId, + DateTime? updatedAt, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$basicApiJobsFields + implements CopyWith$Fragment$basicApiJobsFields { + _CopyWithImpl$Fragment$basicApiJobsFields( + this._instance, + this._then, + ); + + final Fragment$basicApiJobsFields _instance; + + final TRes Function(Fragment$basicApiJobsFields) _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? typeId = _undefined, + Object? updatedAt = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$basicApiJobsFields( + 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), + typeId: typeId == _undefined || typeId == null + ? _instance.typeId + : (typeId as String), + updatedAt: updatedAt == _undefined || updatedAt == null + ? _instance.updatedAt + : (updatedAt as DateTime), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$basicApiJobsFields + implements CopyWith$Fragment$basicApiJobsFields { + _CopyWithStubImpl$Fragment$basicApiJobsFields(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, + String? typeId, + DateTime? updatedAt, + String? $__typename, + }) => + _res; +} + +const fragmentDefinitionbasicApiJobsFields = FragmentDefinitionNode( + name: NameNode(value: 'basicApiJobsFields'), + typeCondition: TypeConditionNode( + on: NamedTypeNode( + name: NameNode(value: 'ApiJob'), + isNonNull: false, + )), + 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: 'typeId'), + 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, + ), + ]), +); +const documentNodeFragmentbasicApiJobsFields = DocumentNode(definitions: [ + fragmentDefinitionbasicApiJobsFields, +]); + +extension ClientExtension$Fragment$basicApiJobsFields on graphql.GraphQLClient { + void writeFragment$basicApiJobsFields({ + required Fragment$basicApiJobsFields data, + required Map idFields, + bool broadcast = true, + }) => + this.writeFragment( + graphql.FragmentRequest( + idFields: idFields, + fragment: const graphql.Fragment( + fragmentName: 'basicApiJobsFields', + document: documentNodeFragmentbasicApiJobsFields, + ), + ), + data: data.toJson(), + broadcast: broadcast, + ); + Fragment$basicApiJobsFields? readFragment$basicApiJobsFields({ + required Map idFields, + bool optimistic = true, + }) { + final result = this.readFragment( + graphql.FragmentRequest( + idFields: idFields, + fragment: const graphql.Fragment( + fragmentName: 'basicApiJobsFields', + document: documentNodeFragmentbasicApiJobsFields, + ), + ), + optimistic: optimistic, + ); + return result == null ? null : Fragment$basicApiJobsFields.fromJson(result); + } +} + class Query$GetApiVersion { Query$GetApiVersion({ required this.api, @@ -2844,89 +3324,9 @@ const documentNodeQueryGetApiJobs = DocumentNode(definitions: [ arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'createdAt'), - alias: null, - arguments: [], + FragmentSpreadNode( + name: NameNode(value: 'basicApiJobsFields'), 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: 'typeId'), - alias: null, - arguments: [], - directives: [], - selectionSet: null, - ), - FieldNode( - name: NameNode(value: 'updatedAt'), - alias: null, - arguments: [], - directives: [], - selectionSet: null, ), FieldNode( name: NameNode(value: '__typename'), @@ -2955,6 +3355,7 @@ const documentNodeQueryGetApiJobs = DocumentNode(definitions: [ ), ]), ), + fragmentDefinitionbasicApiJobsFields, ]); Query$GetApiJobs _parserFn$Query$GetApiJobs(Map data) => Query$GetApiJobs.fromJson(data); @@ -3083,14 +3484,14 @@ class Query$GetApiJobs$jobs { final l$$__typename = json['__typename']; return Query$GetApiJobs$jobs( getJobs: (l$getJobs as List) - .map((e) => Query$GetApiJobs$jobs$getJobs.fromJson( - (e as Map))) + .map((e) => + Fragment$basicApiJobsFields.fromJson((e as Map))) .toList(), $__typename: (l$$__typename as String), ); } - final List getJobs; + final List getJobs; final String $__typename; @@ -3160,14 +3561,14 @@ abstract class CopyWith$Query$GetApiJobs$jobs { _CopyWithStubImpl$Query$GetApiJobs$jobs; TRes call({ - List? getJobs, + List? getJobs, String? $__typename, }); TRes getJobs( - Iterable Function( + Iterable Function( Iterable< - CopyWith$Query$GetApiJobs$jobs$getJobs< - Query$GetApiJobs$jobs$getJobs>>) + CopyWith$Fragment$basicApiJobsFields< + Fragment$basicApiJobsFields>>) _fn); } @@ -3191,20 +3592,20 @@ class _CopyWithImpl$Query$GetApiJobs$jobs _then(Query$GetApiJobs$jobs( getJobs: getJobs == _undefined || getJobs == null ? _instance.getJobs - : (getJobs as List), + : (getJobs as List), $__typename: $__typename == _undefined || $__typename == null ? _instance.$__typename : ($__typename as String), )); TRes getJobs( - Iterable Function( + Iterable Function( Iterable< - CopyWith$Query$GetApiJobs$jobs$getJobs< - Query$GetApiJobs$jobs$getJobs>>) + CopyWith$Fragment$basicApiJobsFields< + Fragment$basicApiJobsFields>>) _fn) => call( - getJobs: _fn(_instance.getJobs - .map((e) => CopyWith$Query$GetApiJobs$jobs$getJobs( + getJobs: _fn( + _instance.getJobs.map((e) => CopyWith$Fragment$basicApiJobsFields( e, (i) => i, ))).toList()); @@ -3217,352 +3618,13 @@ class _CopyWithStubImpl$Query$GetApiJobs$jobs TRes _res; call({ - List? getJobs, + List? getJobs, String? $__typename, }) => _res; getJobs(_fn) => _res; } -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.typeId, - required this.updatedAt, - this.$__typename = 'ApiJob', - }); - - factory Query$GetApiJobs$jobs$getJobs.fromJson(Map json) { - final l$createdAt = json['createdAt']; - final l$description = json['description']; - final l$error = json['error']; - final l$finishedAt = json['finishedAt']; - final l$name = json['name']; - final l$progress = json['progress']; - final l$result = json['result']; - final l$status = json['status']; - final l$statusText = json['statusText']; - final l$uid = json['uid']; - final l$typeId = json['typeId']; - final l$updatedAt = json['updatedAt']; - final l$$__typename = json['__typename']; - return Query$GetApiJobs$jobs$getJobs( - createdAt: dateTimeFromJson(l$createdAt), - description: (l$description as String), - error: (l$error as String?), - finishedAt: l$finishedAt == null ? null : dateTimeFromJson(l$finishedAt), - name: (l$name as String), - progress: (l$progress as int?), - result: (l$result as String?), - status: (l$status as String), - statusText: (l$statusText as String?), - uid: (l$uid as String), - typeId: (l$typeId as String), - updatedAt: dateTimeFromJson(l$updatedAt), - $__typename: (l$$__typename as String), - ); - } - - final DateTime createdAt; - - final String description; - - final String? error; - - final DateTime? finishedAt; - - final String name; - - final int? progress; - - final String? result; - - final String status; - - final String? statusText; - - final String uid; - - final String typeId; - - final DateTime updatedAt; - - final String $__typename; - - Map toJson() { - final _resultData = {}; - final l$createdAt = createdAt; - _resultData['createdAt'] = dateTimeToJson(l$createdAt); - final l$description = description; - _resultData['description'] = l$description; - final l$error = error; - _resultData['error'] = l$error; - final l$finishedAt = finishedAt; - _resultData['finishedAt'] = - l$finishedAt == null ? null : dateTimeToJson(l$finishedAt); - final l$name = name; - _resultData['name'] = l$name; - final l$progress = progress; - _resultData['progress'] = l$progress; - final l$result = result; - _resultData['result'] = l$result; - final l$status = status; - _resultData['status'] = l$status; - final l$statusText = statusText; - _resultData['statusText'] = l$statusText; - final l$uid = uid; - _resultData['uid'] = l$uid; - final l$typeId = typeId; - _resultData['typeId'] = l$typeId; - final l$updatedAt = updatedAt; - _resultData['updatedAt'] = dateTimeToJson(l$updatedAt); - final l$$__typename = $__typename; - _resultData['__typename'] = l$$__typename; - return _resultData; - } - - @override - int get hashCode { - final l$createdAt = createdAt; - final l$description = description; - 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$typeId = typeId; - 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$typeId, - 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$typeId = typeId; - final lOther$typeId = other.typeId; - if (l$typeId != lOther$typeId) { - 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, - String? typeId, - 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? typeId = _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), - typeId: typeId == _undefined || typeId == null - ? _instance.typeId - : (typeId 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, - String? typeId, - DateTime? updatedAt, - String? $__typename, - }) => - _res; -} - class Variables$Mutation$RemoveJob { factory Variables$Mutation$RemoveJob({required String jobId}) => Variables$Mutation$RemoveJob._({ diff --git a/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart index ae8aabcb..abbba037 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart @@ -1,8 +1,8 @@ import 'dart:async'; -import 'disk_volumes.graphql.dart'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; import 'schema.graphql.dart'; +import 'services.graphql.dart'; class Fragment$basicMutationReturnFields { Fragment$basicMutationReturnFields({ diff --git a/lib/logic/api_maps/graphql_maps/schema/services.graphql b/lib/logic/api_maps/graphql_maps/schema/services.graphql index c27b568c..104d22b8 100644 --- a/lib/logic/api_maps/graphql_maps/schema/services.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/services.graphql @@ -65,17 +65,7 @@ mutation MoveService($input: MoveServiceInput!) { moveService(input: $input) { ...basicMutationReturnFields job { - createdAt - description - error - finishedAt - name - progress - result - status - statusText - uid - updatedAt + ...basicApiJobsFields } } } diff --git a/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart index 2fbf6c3d..e2cd4056 100644 --- a/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart @@ -1,9 +1,8 @@ import 'dart:async'; -import 'disk_volumes.graphql.dart'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; -import 'package:selfprivacy/utils/scalars.dart'; import 'schema.graphql.dart'; +import 'server_api.graphql.dart'; import 'server_settings.graphql.dart'; class Fragment$basicMutationReturnFields { @@ -2496,6 +2495,13 @@ const documentNodeQueryAllServices = DocumentNode(definitions: [ directives: [], selectionSet: null, ), + FieldNode( + name: NameNode(value: 'canBeBackedUp'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), FieldNode( name: NameNode(value: 'status'), alias: null, @@ -2877,6 +2883,7 @@ class Query$AllServices$services$allServices { required this.isEnabled, required this.isMovable, required this.isRequired, + required this.canBeBackedUp, required this.status, required this.storageUsage, required this.svgIcon, @@ -2893,6 +2900,7 @@ class Query$AllServices$services$allServices { final l$isEnabled = json['isEnabled']; final l$isMovable = json['isMovable']; final l$isRequired = json['isRequired']; + final l$canBeBackedUp = json['canBeBackedUp']; final l$status = json['status']; final l$storageUsage = json['storageUsage']; final l$svgIcon = json['svgIcon']; @@ -2909,6 +2917,7 @@ class Query$AllServices$services$allServices { isEnabled: (l$isEnabled as bool), isMovable: (l$isMovable as bool), isRequired: (l$isRequired as bool), + canBeBackedUp: (l$canBeBackedUp as bool), status: fromJson$Enum$ServiceStatusEnum((l$status as String)), storageUsage: Query$AllServices$services$allServices$storageUsage.fromJson( @@ -2933,6 +2942,8 @@ class Query$AllServices$services$allServices { final bool isRequired; + final bool canBeBackedUp; + final Enum$ServiceStatusEnum status; final Query$AllServices$services$allServices$storageUsage storageUsage; @@ -2959,6 +2970,8 @@ class Query$AllServices$services$allServices { _resultData['isMovable'] = l$isMovable; final l$isRequired = isRequired; _resultData['isRequired'] = l$isRequired; + final l$canBeBackedUp = canBeBackedUp; + _resultData['canBeBackedUp'] = l$canBeBackedUp; final l$status = status; _resultData['status'] = toJson$Enum$ServiceStatusEnum(l$status); final l$storageUsage = storageUsage; @@ -2981,6 +2994,7 @@ class Query$AllServices$services$allServices { final l$isEnabled = isEnabled; final l$isMovable = isMovable; final l$isRequired = isRequired; + final l$canBeBackedUp = canBeBackedUp; final l$status = status; final l$storageUsage = storageUsage; final l$svgIcon = svgIcon; @@ -2994,6 +3008,7 @@ class Query$AllServices$services$allServices { l$isEnabled, l$isMovable, l$isRequired, + l$canBeBackedUp, l$status, l$storageUsage, l$svgIcon, @@ -3057,6 +3072,11 @@ class Query$AllServices$services$allServices { if (l$isRequired != lOther$isRequired) { return false; } + final l$canBeBackedUp = canBeBackedUp; + final lOther$canBeBackedUp = other.canBeBackedUp; + if (l$canBeBackedUp != lOther$canBeBackedUp) { + return false; + } final l$status = status; final lOther$status = other.status; if (l$status != lOther$status) { @@ -3113,6 +3133,7 @@ abstract class CopyWith$Query$AllServices$services$allServices { bool? isEnabled, bool? isMovable, bool? isRequired, + bool? canBeBackedUp, Enum$ServiceStatusEnum? status, Query$AllServices$services$allServices$storageUsage? storageUsage, String? svgIcon, @@ -3150,6 +3171,7 @@ class _CopyWithImpl$Query$AllServices$services$allServices Object? isEnabled = _undefined, Object? isMovable = _undefined, Object? isRequired = _undefined, + Object? canBeBackedUp = _undefined, Object? status = _undefined, Object? storageUsage = _undefined, Object? svgIcon = _undefined, @@ -3176,6 +3198,9 @@ class _CopyWithImpl$Query$AllServices$services$allServices isRequired: isRequired == _undefined || isRequired == null ? _instance.isRequired : (isRequired as bool), + canBeBackedUp: canBeBackedUp == _undefined || canBeBackedUp == null + ? _instance.canBeBackedUp + : (canBeBackedUp as bool), status: status == _undefined || status == null ? _instance.status : (status as Enum$ServiceStatusEnum), @@ -3225,6 +3250,7 @@ class _CopyWithStubImpl$Query$AllServices$services$allServices bool? isEnabled, bool? isMovable, bool? isRequired, + bool? canBeBackedUp, Enum$ServiceStatusEnum? status, Query$AllServices$services$allServices$storageUsage? storageUsage, String? svgIcon, @@ -6561,82 +6587,9 @@ const documentNodeMutationMoveService = DocumentNode(definitions: [ arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'createdAt'), - alias: null, - arguments: [], + FragmentSpreadNode( + name: NameNode(value: 'basicApiJobsFields'), 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'), @@ -6666,6 +6619,7 @@ const documentNodeMutationMoveService = DocumentNode(definitions: [ ]), ), fragmentDefinitionbasicMutationReturnFields, + fragmentDefinitionbasicApiJobsFields, ]); Mutation$MoveService _parserFn$Mutation$MoveService( Map data) => @@ -6785,7 +6739,7 @@ class Mutation$MoveService$moveService $__typename: (l$$__typename as String), job: l$job == null ? null - : Mutation$MoveService$moveService$job.fromJson( + : Fragment$basicApiJobsFields.fromJson( (l$job as Map)), ); } @@ -6798,7 +6752,7 @@ class Mutation$MoveService$moveService final String $__typename; - final Mutation$MoveService$moveService$job? job; + final Fragment$basicApiJobsFields? job; Map toJson() { final _resultData = {}; @@ -6892,9 +6846,9 @@ abstract class CopyWith$Mutation$MoveService$moveService { String? message, bool? success, String? $__typename, - Mutation$MoveService$moveService$job? job, + Fragment$basicApiJobsFields? job, }); - CopyWith$Mutation$MoveService$moveService$job get job; + CopyWith$Fragment$basicApiJobsFields get job; } class _CopyWithImpl$Mutation$MoveService$moveService @@ -6931,14 +6885,13 @@ class _CopyWithImpl$Mutation$MoveService$moveService : ($__typename as String), job: job == _undefined ? _instance.job - : (job as Mutation$MoveService$moveService$job?), + : (job as Fragment$basicApiJobsFields?), )); - CopyWith$Mutation$MoveService$moveService$job get job { + CopyWith$Fragment$basicApiJobsFields 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)); + ? CopyWith$Fragment$basicApiJobsFields.stub(_then(_instance)) + : CopyWith$Fragment$basicApiJobsFields(local$job, (e) => call(job: e)); } } @@ -6953,330 +6906,9 @@ class _CopyWithStubImpl$Mutation$MoveService$moveService 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); -} - -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, - this.$__typename = 'ApiJob', - }); - - factory Mutation$MoveService$moveService$job.fromJson( - Map json) { - final l$createdAt = json['createdAt']; - final l$description = json['description']; - final l$error = json['error']; - final l$finishedAt = json['finishedAt']; - final l$name = json['name']; - final l$progress = json['progress']; - final l$result = json['result']; - final l$status = json['status']; - final l$statusText = json['statusText']; - final l$uid = json['uid']; - final l$updatedAt = json['updatedAt']; - final l$$__typename = json['__typename']; - return Mutation$MoveService$moveService$job( - createdAt: dateTimeFromJson(l$createdAt), - description: (l$description as String), - error: (l$error as String?), - finishedAt: l$finishedAt == null ? null : dateTimeFromJson(l$finishedAt), - name: (l$name as String), - progress: (l$progress as int?), - result: (l$result as String?), - status: (l$status as String), - statusText: (l$statusText as String?), - uid: (l$uid as String), - updatedAt: dateTimeFromJson(l$updatedAt), - $__typename: (l$$__typename as String), - ); - } - - final DateTime createdAt; - - final String description; - - final String? error; - - final DateTime? finishedAt; - - final String name; - - final int? progress; - - final String? result; - - final String status; - - final String? statusText; - - final String uid; - - final DateTime updatedAt; - - final String $__typename; - - Map toJson() { - final _resultData = {}; - final l$createdAt = createdAt; - _resultData['createdAt'] = dateTimeToJson(l$createdAt); - final l$description = description; - _resultData['description'] = l$description; - final l$error = error; - _resultData['error'] = l$error; - final l$finishedAt = finishedAt; - _resultData['finishedAt'] = - l$finishedAt == null ? null : dateTimeToJson(l$finishedAt); - final l$name = name; - _resultData['name'] = l$name; - final l$progress = progress; - _resultData['progress'] = l$progress; - final l$result = result; - _resultData['result'] = l$result; - final l$status = status; - _resultData['status'] = l$status; - final l$statusText = statusText; - _resultData['statusText'] = l$statusText; - final l$uid = uid; - _resultData['uid'] = l$uid; - final l$updatedAt = updatedAt; - _resultData['updatedAt'] = dateTimeToJson(l$updatedAt); - final l$$__typename = $__typename; - _resultData['__typename'] = l$$__typename; - return _resultData; - } - - @override - int get hashCode { - final l$createdAt = createdAt; - final l$description = description; - 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, + Fragment$basicApiJobsFields? job, }) => _res; + CopyWith$Fragment$basicApiJobsFields get job => + CopyWith$Fragment$basicApiJobsFields.stub(_res); } diff --git a/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart index d17316df..4df77d6f 100644 --- a/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart @@ -1,8 +1,8 @@ import 'dart:async'; -import 'disk_volumes.graphql.dart'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; import 'schema.graphql.dart'; +import 'services.graphql.dart'; class Fragment$basicMutationReturnFields { Fragment$basicMutationReturnFields({ diff --git a/lib/logic/api_maps/graphql_maps/server_api/backups_api.dart b/lib/logic/api_maps/graphql_maps/server_api/backups_api.dart index 18fea675..b652db03 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/backups_api.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/backups_api.dart @@ -72,9 +72,9 @@ mixin BackupsApi on GraphQLApiMap { ); } - Future startBackup(final String serviceId) async { + Future> startBackup(final String serviceId) async { QueryResult response; - GenericResult? result; + GenericResult? result; try { final GraphQLClient client = await getClient(); @@ -92,7 +92,9 @@ mixin BackupsApi on GraphQLApiMap { } result = GenericResult( success: true, - data: null, + data: ServerJob.fromGraphQL( + response.parsedData!.backup.startBackup.job!, + ), ); } catch (e) { print(e); @@ -204,4 +206,43 @@ mixin BackupsApi on GraphQLApiMap { return result; } + + Future> restoreBackup( + final String snapshotId, + ) async { + QueryResult response; + GenericResult? result; + + try { + final GraphQLClient client = await getClient(); + final variables = + Variables$Mutation$RestoreBackup(snapshotId: snapshotId); + final options = Options$Mutation$RestoreBackup(variables: variables); + response = await client.mutate$RestoreBackup(options); + if (response.hasException) { + final message = response.exception.toString(); + print(message); + result = GenericResult( + success: false, + data: null, + message: message, + ); + } + result = GenericResult( + success: true, + data: ServerJob.fromGraphQL( + response.parsedData!.backup.restoreBackup.job!, + ), + ); + } catch (e) { + print(e); + result = GenericResult( + success: false, + data: null, + message: e.toString(), + ); + } + + return result; + } } diff --git a/lib/logic/models/json/server_job.dart b/lib/logic/models/json/server_job.dart index 6b125c5f..44fb2561 100644 --- a/lib/logic/models/json/server_job.dart +++ b/lib/logic/models/json/server_job.dart @@ -22,7 +22,7 @@ class ServerJob { this.finishedAt, }); - ServerJob.fromGraphQL(final Query$GetApiJobs$jobs$getJobs serverJob) + ServerJob.fromGraphQL(final Fragment$basicApiJobsFields serverJob) : this( createdAt: serverJob.createdAt, description: serverJob.description, diff --git a/lib/logic/providers/dns_providers/dns_provider.dart b/lib/logic/providers/dns_providers/dns_provider.dart index 60976f68..e27c4b00 100644 --- a/lib/logic/providers/dns_providers/dns_provider.dart +++ b/lib/logic/providers/dns_providers/dns_provider.dart @@ -5,7 +5,16 @@ import 'package:selfprivacy/logic/models/json/dns_records.dart'; export 'package:selfprivacy/logic/api_maps/generic_result.dart'; abstract class DnsProvider { + /// Returns an assigned enum value, respectively to which + /// provider implements [DnsProvider] interface. DnsProviderType get type; + + /// Tries to access an account linked to the provided token. + /// + /// To generate a token for your account follow instructions of your + /// DNS provider respectfully. + /// + /// If success, saves it for future usage. Future> tryInitApiByToken(final String token); Future> getZoneId(final String domain); Future> removeDomainRecords({