diff --git a/lib/logic/api_maps/graphql_maps/schema/schema.graphql b/lib/logic/api_maps/graphql_maps/schema/schema.graphql index bd86f454..21968b8b 100644 --- a/lib/logic/api_maps/graphql_maps/schema/schema.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql @@ -288,6 +288,7 @@ type SSHSettingsMutationReturn implements MutationReturnInterface { enum ServerProvider { HETZNER DIGITALOCEAN + OTHER } type Service { @@ -408,7 +409,8 @@ type StorageVolume { } type Subscription { - count(target: Int! = 100): Int! + jobUpdates: [ApiJob!]! + count: Int! } type System { diff --git a/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart index d9304efb..039a87a7 100644 --- a/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart @@ -1625,7 +1625,18 @@ class _CopyWithStubImpl$Input$UserMutationInput _res; } -enum Enum$BackupProvider { BACKBLAZE, NONE, MEMORY, FILE, $unknown } +enum Enum$BackupProvider { + BACKBLAZE, + NONE, + MEMORY, + FILE, + $unknown; + + factory Enum$BackupProvider.fromJson(String value) => + fromJson$Enum$BackupProvider(value); + + String toJson() => toJson$Enum$BackupProvider(this); +} String toJson$Enum$BackupProvider(Enum$BackupProvider e) { switch (e) { @@ -1657,7 +1668,17 @@ Enum$BackupProvider fromJson$Enum$BackupProvider(String value) { } } -enum Enum$BackupReason { EXPLICIT, AUTO, PRE_RESTORE, $unknown } +enum Enum$BackupReason { + EXPLICIT, + AUTO, + PRE_RESTORE, + $unknown; + + factory Enum$BackupReason.fromJson(String value) => + fromJson$Enum$BackupReason(value); + + String toJson() => toJson$Enum$BackupReason(this); +} String toJson$Enum$BackupReason(Enum$BackupReason e) { switch (e) { @@ -1685,7 +1706,17 @@ Enum$BackupReason fromJson$Enum$BackupReason(String value) { } } -enum Enum$DnsProvider { CLOUDFLARE, DIGITALOCEAN, DESEC, $unknown } +enum Enum$DnsProvider { + CLOUDFLARE, + DIGITALOCEAN, + DESEC, + $unknown; + + factory Enum$DnsProvider.fromJson(String value) => + fromJson$Enum$DnsProvider(value); + + String toJson() => toJson$Enum$DnsProvider(this); +} String toJson$Enum$DnsProvider(Enum$DnsProvider e) { switch (e) { @@ -1713,7 +1744,16 @@ Enum$DnsProvider fromJson$Enum$DnsProvider(String value) { } } -enum Enum$RestoreStrategy { INPLACE, DOWNLOAD_VERIFY_OVERWRITE, $unknown } +enum Enum$RestoreStrategy { + INPLACE, + DOWNLOAD_VERIFY_OVERWRITE, + $unknown; + + factory Enum$RestoreStrategy.fromJson(String value) => + fromJson$Enum$RestoreStrategy(value); + + String toJson() => toJson$Enum$RestoreStrategy(this); +} String toJson$Enum$RestoreStrategy(Enum$RestoreStrategy e) { switch (e) { @@ -1737,7 +1777,17 @@ Enum$RestoreStrategy fromJson$Enum$RestoreStrategy(String value) { } } -enum Enum$ServerProvider { HETZNER, DIGITALOCEAN, $unknown } +enum Enum$ServerProvider { + HETZNER, + DIGITALOCEAN, + OTHER, + $unknown; + + factory Enum$ServerProvider.fromJson(String value) => + fromJson$Enum$ServerProvider(value); + + String toJson() => toJson$Enum$ServerProvider(this); +} String toJson$Enum$ServerProvider(Enum$ServerProvider e) { switch (e) { @@ -1745,6 +1795,8 @@ String toJson$Enum$ServerProvider(Enum$ServerProvider e) { return r'HETZNER'; case Enum$ServerProvider.DIGITALOCEAN: return r'DIGITALOCEAN'; + case Enum$ServerProvider.OTHER: + return r'OTHER'; case Enum$ServerProvider.$unknown: return r'$unknown'; } @@ -1756,6 +1808,8 @@ Enum$ServerProvider fromJson$Enum$ServerProvider(String value) { return Enum$ServerProvider.HETZNER; case r'DIGITALOCEAN': return Enum$ServerProvider.DIGITALOCEAN; + case r'OTHER': + return Enum$ServerProvider.OTHER; default: return Enum$ServerProvider.$unknown; } @@ -1769,7 +1823,12 @@ enum Enum$ServiceStatusEnum { ACTIVATING, DEACTIVATING, OFF, - $unknown + $unknown; + + factory Enum$ServiceStatusEnum.fromJson(String value) => + fromJson$Enum$ServiceStatusEnum(value); + + String toJson() => toJson$Enum$ServiceStatusEnum(this); } String toJson$Enum$ServiceStatusEnum(Enum$ServiceStatusEnum e) { @@ -1814,7 +1873,18 @@ Enum$ServiceStatusEnum fromJson$Enum$ServiceStatusEnum(String value) { } } -enum Enum$Severity { INFO, WARNING, ERROR, CRITICAL, SUCCESS, $unknown } +enum Enum$Severity { + INFO, + WARNING, + ERROR, + CRITICAL, + SUCCESS, + $unknown; + + factory Enum$Severity.fromJson(String value) => fromJson$Enum$Severity(value); + + String toJson() => toJson$Enum$Severity(this); +} String toJson$Enum$Severity(Enum$Severity e) { switch (e) { @@ -1850,7 +1920,16 @@ Enum$Severity fromJson$Enum$Severity(String value) { } } -enum Enum$UserType { NORMAL, PRIMARY, ROOT, $unknown } +enum Enum$UserType { + NORMAL, + PRIMARY, + ROOT, + $unknown; + + factory Enum$UserType.fromJson(String value) => fromJson$Enum$UserType(value); + + String toJson() => toJson$Enum$UserType(this); +} String toJson$Enum$UserType(Enum$UserType e) { switch (e) { @@ -1887,7 +1966,12 @@ enum Enum$__TypeKind { INPUT_OBJECT, LIST, NON_NULL, - $unknown + $unknown; + + factory Enum$__TypeKind.fromJson(String value) => + fromJson$Enum$__TypeKind(value); + + String toJson() => toJson$Enum$__TypeKind(this); } String toJson$Enum$__TypeKind(Enum$__TypeKind e) { @@ -1956,7 +2040,12 @@ enum Enum$__DirectiveLocation { ENUM_VALUE, INPUT_OBJECT, INPUT_FIELD_DEFINITION, - $unknown + $unknown; + + factory Enum$__DirectiveLocation.fromJson(String value) => + fromJson$Enum$__DirectiveLocation(value); + + String toJson() => toJson$Enum$__DirectiveLocation(this); } String toJson$Enum$__DirectiveLocation(Enum$__DirectiveLocation e) { diff --git a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql index ae1a4edb..7baaeea3 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql @@ -33,6 +33,12 @@ query GetApiJobs { } } +subscription JobUpdates { + jobUpdates { + ...basicApiJobsFields + } +} + mutation RemoveJob($jobId: String!) { jobs { removeJob(jobId: $jobId) { 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 36f60bac..1fdbd689 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 @@ -3831,6 +3831,273 @@ class _CopyWithStubImpl$Query$GetApiJobs$jobs getJobs(_fn) => _res; } +class Subscription$JobUpdates { + Subscription$JobUpdates({ + required this.jobUpdates, + this.$__typename = 'Subscription', + }); + + factory Subscription$JobUpdates.fromJson(Map json) { + final l$jobUpdates = json['jobUpdates']; + final l$$__typename = json['__typename']; + return Subscription$JobUpdates( + jobUpdates: (l$jobUpdates as List) + .map((e) => + Fragment$basicApiJobsFields.fromJson((e as Map))) + .toList(), + $__typename: (l$$__typename as String), + ); + } + + final List jobUpdates; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$jobUpdates = jobUpdates; + _resultData['jobUpdates'] = l$jobUpdates.map((e) => e.toJson()).toList(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$jobUpdates = jobUpdates; + final l$$__typename = $__typename; + return Object.hashAll([ + Object.hashAll(l$jobUpdates.map((v) => v)), + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Subscription$JobUpdates) || + runtimeType != other.runtimeType) { + return false; + } + final l$jobUpdates = jobUpdates; + final lOther$jobUpdates = other.jobUpdates; + if (l$jobUpdates.length != lOther$jobUpdates.length) { + return false; + } + for (int i = 0; i < l$jobUpdates.length; i++) { + final l$jobUpdates$entry = l$jobUpdates[i]; + final lOther$jobUpdates$entry = lOther$jobUpdates[i]; + if (l$jobUpdates$entry != lOther$jobUpdates$entry) { + return false; + } + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Subscription$JobUpdates on Subscription$JobUpdates { + CopyWith$Subscription$JobUpdates get copyWith => + CopyWith$Subscription$JobUpdates( + this, + (i) => i, + ); +} + +abstract class CopyWith$Subscription$JobUpdates { + factory CopyWith$Subscription$JobUpdates( + Subscription$JobUpdates instance, + TRes Function(Subscription$JobUpdates) then, + ) = _CopyWithImpl$Subscription$JobUpdates; + + factory CopyWith$Subscription$JobUpdates.stub(TRes res) = + _CopyWithStubImpl$Subscription$JobUpdates; + + TRes call({ + List? jobUpdates, + String? $__typename, + }); + TRes jobUpdates( + Iterable Function( + Iterable< + CopyWith$Fragment$basicApiJobsFields< + Fragment$basicApiJobsFields>>) + _fn); +} + +class _CopyWithImpl$Subscription$JobUpdates + implements CopyWith$Subscription$JobUpdates { + _CopyWithImpl$Subscription$JobUpdates( + this._instance, + this._then, + ); + + final Subscription$JobUpdates _instance; + + final TRes Function(Subscription$JobUpdates) _then; + + static const _undefined = {}; + + TRes call({ + Object? jobUpdates = _undefined, + Object? $__typename = _undefined, + }) => + _then(Subscription$JobUpdates( + jobUpdates: jobUpdates == _undefined || jobUpdates == null + ? _instance.jobUpdates + : (jobUpdates as List), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); + + TRes jobUpdates( + Iterable Function( + Iterable< + CopyWith$Fragment$basicApiJobsFields< + Fragment$basicApiJobsFields>>) + _fn) => + call( + jobUpdates: _fn(_instance.jobUpdates + .map((e) => CopyWith$Fragment$basicApiJobsFields( + e, + (i) => i, + ))).toList()); +} + +class _CopyWithStubImpl$Subscription$JobUpdates + implements CopyWith$Subscription$JobUpdates { + _CopyWithStubImpl$Subscription$JobUpdates(this._res); + + TRes _res; + + call({ + List? jobUpdates, + String? $__typename, + }) => + _res; + + jobUpdates(_fn) => _res; +} + +const documentNodeSubscriptionJobUpdates = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.subscription, + name: NameNode(value: 'JobUpdates'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'jobUpdates'), + 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, + ), + ]), + ), + fragmentDefinitionbasicApiJobsFields, +]); +Subscription$JobUpdates _parserFn$Subscription$JobUpdates( + Map data) => + Subscription$JobUpdates.fromJson(data); + +class Options$Subscription$JobUpdates + extends graphql.SubscriptionOptions { + Options$Subscription$JobUpdates({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Subscription$JobUpdates? typedOptimisticResult, + graphql.Context? context, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), + context: context, + document: documentNodeSubscriptionJobUpdates, + parserFn: _parserFn$Subscription$JobUpdates, + ); +} + +class WatchOptions$Subscription$JobUpdates + extends graphql.WatchQueryOptions { + WatchOptions$Subscription$JobUpdates({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Subscription$JobUpdates? typedOptimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), + context: context, + document: documentNodeSubscriptionJobUpdates, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Subscription$JobUpdates, + ); +} + +class FetchMoreOptions$Subscription$JobUpdates + extends graphql.FetchMoreOptions { + FetchMoreOptions$Subscription$JobUpdates( + {required graphql.UpdateQuery updateQuery}) + : super( + updateQuery: updateQuery, + document: documentNodeSubscriptionJobUpdates, + ); +} + +extension ClientExtension$Subscription$JobUpdates on graphql.GraphQLClient { + Stream> subscribe$JobUpdates( + [Options$Subscription$JobUpdates? options]) => + this.subscribe(options ?? Options$Subscription$JobUpdates()); + graphql.ObservableQuery watchSubscription$JobUpdates( + [WatchOptions$Subscription$JobUpdates? options]) => + this.watchQuery(options ?? WatchOptions$Subscription$JobUpdates()); +} + class Variables$Mutation$RemoveJob { factory Variables$Mutation$RemoveJob({required String jobId}) => Variables$Mutation$RemoveJob._({