initial commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import 'remote_node.dart';
|
||||
import 'service.dart';
|
||||
|
||||
part 'aggregated_node_status.freezed.dart';
|
||||
part 'aggregated_node_status.g.dart';
|
||||
|
||||
/// Mirrors the anonymous `nodeServices` struct returned by
|
||||
/// `GET /nodes/aggregated`: `{node, services?, error?}`. `error` is the
|
||||
/// *local* API reporting that fetching *this remote* failed (e.g.
|
||||
/// unreachable) — a per-entry condition, distinct from the outer call
|
||||
/// itself failing. Render `error` inline per-card; never conflate it with
|
||||
/// an [ApiException] on the aggregated fetch as a whole.
|
||||
@freezed
|
||||
sealed class AggregatedNodeStatus with _$AggregatedNodeStatus {
|
||||
const factory AggregatedNodeStatus({
|
||||
required RemoteNode node,
|
||||
@Default(<Service>[]) List<Service> services,
|
||||
String? error,
|
||||
}) = _AggregatedNodeStatus;
|
||||
|
||||
factory AggregatedNodeStatus.fromJson(Map<String, dynamic> json) =>
|
||||
_$AggregatedNodeStatusFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,301 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'aggregated_node_status.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$AggregatedNodeStatus {
|
||||
|
||||
RemoteNode get node; List<Service> get services; String? get error;
|
||||
/// Create a copy of AggregatedNodeStatus
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$AggregatedNodeStatusCopyWith<AggregatedNodeStatus> get copyWith => _$AggregatedNodeStatusCopyWithImpl<AggregatedNodeStatus>(this as AggregatedNodeStatus, _$identity);
|
||||
|
||||
/// Serializes this AggregatedNodeStatus to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is AggregatedNodeStatus&&(identical(other.node, node) || other.node == node)&&const DeepCollectionEquality().equals(other.services, services)&&(identical(other.error, error) || other.error == error));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,node,const DeepCollectionEquality().hash(services),error);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AggregatedNodeStatus(node: $node, services: $services, error: $error)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $AggregatedNodeStatusCopyWith<$Res> {
|
||||
factory $AggregatedNodeStatusCopyWith(AggregatedNodeStatus value, $Res Function(AggregatedNodeStatus) _then) = _$AggregatedNodeStatusCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
RemoteNode node, List<Service> services, String? error
|
||||
});
|
||||
|
||||
|
||||
$RemoteNodeCopyWith<$Res> get node;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$AggregatedNodeStatusCopyWithImpl<$Res>
|
||||
implements $AggregatedNodeStatusCopyWith<$Res> {
|
||||
_$AggregatedNodeStatusCopyWithImpl(this._self, this._then);
|
||||
|
||||
final AggregatedNodeStatus _self;
|
||||
final $Res Function(AggregatedNodeStatus) _then;
|
||||
|
||||
/// Create a copy of AggregatedNodeStatus
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? node = null,Object? services = null,Object? error = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
node: null == node ? _self.node : node // ignore: cast_nullable_to_non_nullable
|
||||
as RemoteNode,services: null == services ? _self.services : services // ignore: cast_nullable_to_non_nullable
|
||||
as List<Service>,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
/// Create a copy of AggregatedNodeStatus
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$RemoteNodeCopyWith<$Res> get node {
|
||||
|
||||
return $RemoteNodeCopyWith<$Res>(_self.node, (value) {
|
||||
return _then(_self.copyWith(node: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [AggregatedNodeStatus].
|
||||
extension AggregatedNodeStatusPatterns on AggregatedNodeStatus {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _AggregatedNodeStatus value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _AggregatedNodeStatus() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _AggregatedNodeStatus value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _AggregatedNodeStatus():
|
||||
return $default(_that);}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _AggregatedNodeStatus value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _AggregatedNodeStatus() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( RemoteNode node, List<Service> services, String? error)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _AggregatedNodeStatus() when $default != null:
|
||||
return $default(_that.node,_that.services,_that.error);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( RemoteNode node, List<Service> services, String? error) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _AggregatedNodeStatus():
|
||||
return $default(_that.node,_that.services,_that.error);}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( RemoteNode node, List<Service> services, String? error)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _AggregatedNodeStatus() when $default != null:
|
||||
return $default(_that.node,_that.services,_that.error);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _AggregatedNodeStatus implements AggregatedNodeStatus {
|
||||
const _AggregatedNodeStatus({required this.node, final List<Service> services = const <Service>[], this.error}): _services = services;
|
||||
factory _AggregatedNodeStatus.fromJson(Map<String, dynamic> json) => _$AggregatedNodeStatusFromJson(json);
|
||||
|
||||
@override final RemoteNode node;
|
||||
final List<Service> _services;
|
||||
@override@JsonKey() List<Service> get services {
|
||||
if (_services is EqualUnmodifiableListView) return _services;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_services);
|
||||
}
|
||||
|
||||
@override final String? error;
|
||||
|
||||
/// Create a copy of AggregatedNodeStatus
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$AggregatedNodeStatusCopyWith<_AggregatedNodeStatus> get copyWith => __$AggregatedNodeStatusCopyWithImpl<_AggregatedNodeStatus>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$AggregatedNodeStatusToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AggregatedNodeStatus&&(identical(other.node, node) || other.node == node)&&const DeepCollectionEquality().equals(other._services, _services)&&(identical(other.error, error) || other.error == error));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,node,const DeepCollectionEquality().hash(_services),error);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AggregatedNodeStatus(node: $node, services: $services, error: $error)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$AggregatedNodeStatusCopyWith<$Res> implements $AggregatedNodeStatusCopyWith<$Res> {
|
||||
factory _$AggregatedNodeStatusCopyWith(_AggregatedNodeStatus value, $Res Function(_AggregatedNodeStatus) _then) = __$AggregatedNodeStatusCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
RemoteNode node, List<Service> services, String? error
|
||||
});
|
||||
|
||||
|
||||
@override $RemoteNodeCopyWith<$Res> get node;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$AggregatedNodeStatusCopyWithImpl<$Res>
|
||||
implements _$AggregatedNodeStatusCopyWith<$Res> {
|
||||
__$AggregatedNodeStatusCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _AggregatedNodeStatus _self;
|
||||
final $Res Function(_AggregatedNodeStatus) _then;
|
||||
|
||||
/// Create a copy of AggregatedNodeStatus
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? node = null,Object? services = null,Object? error = freezed,}) {
|
||||
return _then(_AggregatedNodeStatus(
|
||||
node: null == node ? _self.node : node // ignore: cast_nullable_to_non_nullable
|
||||
as RemoteNode,services: null == services ? _self._services : services // ignore: cast_nullable_to_non_nullable
|
||||
as List<Service>,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of AggregatedNodeStatus
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$RemoteNodeCopyWith<$Res> get node {
|
||||
|
||||
return $RemoteNodeCopyWith<$Res>(_self.node, (value) {
|
||||
return _then(_self.copyWith(node: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,27 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'aggregated_node_status.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_AggregatedNodeStatus _$AggregatedNodeStatusFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _AggregatedNodeStatus(
|
||||
node: RemoteNode.fromJson(json['node'] as Map<String, dynamic>),
|
||||
services:
|
||||
(json['services'] as List<dynamic>?)
|
||||
?.map((e) => Service.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
const <Service>[],
|
||||
error: json['error'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$AggregatedNodeStatusToJson(
|
||||
_AggregatedNodeStatus instance,
|
||||
) => <String, dynamic>{
|
||||
'node': instance.node.toJson(),
|
||||
'services': instance.services.map((e) => e.toJson()).toList(),
|
||||
'error': instance.error,
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import 'backup_execution.dart';
|
||||
import 'backup_target.dart';
|
||||
|
||||
part 'backup_config.freezed.dart';
|
||||
part 'backup_config.g.dart';
|
||||
|
||||
/// Mirrors `models.BackupConfig`. Used both at node level (`GET /node/backup`)
|
||||
/// and per-service (`Service.backup`). `nextRun`/`lastRun` here are
|
||||
/// aggregates (earliest/latest) across `targets` — each target now tracks
|
||||
/// its own `schedule`/`lastRun`/`nextRun` too. There's no `frequency` field
|
||||
/// on the Go side anymore; scheduling moved to a per-target cron `schedule`.
|
||||
@freezed
|
||||
sealed class BackupConfig with _$BackupConfig {
|
||||
const factory BackupConfig({
|
||||
@JsonKey(name: 'source_path') String? sourcePath,
|
||||
@Default(<BackupTarget>[]) List<BackupTarget> targets,
|
||||
@JsonKey(name: 'next_run') DateTime? nextRun,
|
||||
@JsonKey(name: 'last_run') DateTime? lastRun,
|
||||
@Default(<BackupExecution>[]) List<BackupExecution> history,
|
||||
}) = _BackupConfig;
|
||||
|
||||
factory BackupConfig.fromJson(Map<String, dynamic> json) => _$BackupConfigFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,295 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'backup_config.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$BackupConfig {
|
||||
|
||||
@JsonKey(name: 'source_path') String? get sourcePath; List<BackupTarget> get targets;@JsonKey(name: 'next_run') DateTime? get nextRun;@JsonKey(name: 'last_run') DateTime? get lastRun; List<BackupExecution> get history;
|
||||
/// Create a copy of BackupConfig
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$BackupConfigCopyWith<BackupConfig> get copyWith => _$BackupConfigCopyWithImpl<BackupConfig>(this as BackupConfig, _$identity);
|
||||
|
||||
/// Serializes this BackupConfig to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is BackupConfig&&(identical(other.sourcePath, sourcePath) || other.sourcePath == sourcePath)&&const DeepCollectionEquality().equals(other.targets, targets)&&(identical(other.nextRun, nextRun) || other.nextRun == nextRun)&&(identical(other.lastRun, lastRun) || other.lastRun == lastRun)&&const DeepCollectionEquality().equals(other.history, history));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,sourcePath,const DeepCollectionEquality().hash(targets),nextRun,lastRun,const DeepCollectionEquality().hash(history));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BackupConfig(sourcePath: $sourcePath, targets: $targets, nextRun: $nextRun, lastRun: $lastRun, history: $history)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $BackupConfigCopyWith<$Res> {
|
||||
factory $BackupConfigCopyWith(BackupConfig value, $Res Function(BackupConfig) _then) = _$BackupConfigCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'source_path') String? sourcePath, List<BackupTarget> targets,@JsonKey(name: 'next_run') DateTime? nextRun,@JsonKey(name: 'last_run') DateTime? lastRun, List<BackupExecution> history
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$BackupConfigCopyWithImpl<$Res>
|
||||
implements $BackupConfigCopyWith<$Res> {
|
||||
_$BackupConfigCopyWithImpl(this._self, this._then);
|
||||
|
||||
final BackupConfig _self;
|
||||
final $Res Function(BackupConfig) _then;
|
||||
|
||||
/// Create a copy of BackupConfig
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? sourcePath = freezed,Object? targets = null,Object? nextRun = freezed,Object? lastRun = freezed,Object? history = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
sourcePath: freezed == sourcePath ? _self.sourcePath : sourcePath // ignore: cast_nullable_to_non_nullable
|
||||
as String?,targets: null == targets ? _self.targets : targets // ignore: cast_nullable_to_non_nullable
|
||||
as List<BackupTarget>,nextRun: freezed == nextRun ? _self.nextRun : nextRun // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,lastRun: freezed == lastRun ? _self.lastRun : lastRun // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,history: null == history ? _self.history : history // ignore: cast_nullable_to_non_nullable
|
||||
as List<BackupExecution>,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [BackupConfig].
|
||||
extension BackupConfigPatterns on BackupConfig {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _BackupConfig value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _BackupConfig() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _BackupConfig value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _BackupConfig():
|
||||
return $default(_that);}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _BackupConfig value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _BackupConfig() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function(@JsonKey(name: 'source_path') String? sourcePath, List<BackupTarget> targets, @JsonKey(name: 'next_run') DateTime? nextRun, @JsonKey(name: 'last_run') DateTime? lastRun, List<BackupExecution> history)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _BackupConfig() when $default != null:
|
||||
return $default(_that.sourcePath,_that.targets,_that.nextRun,_that.lastRun,_that.history);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function(@JsonKey(name: 'source_path') String? sourcePath, List<BackupTarget> targets, @JsonKey(name: 'next_run') DateTime? nextRun, @JsonKey(name: 'last_run') DateTime? lastRun, List<BackupExecution> history) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _BackupConfig():
|
||||
return $default(_that.sourcePath,_that.targets,_that.nextRun,_that.lastRun,_that.history);}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function(@JsonKey(name: 'source_path') String? sourcePath, List<BackupTarget> targets, @JsonKey(name: 'next_run') DateTime? nextRun, @JsonKey(name: 'last_run') DateTime? lastRun, List<BackupExecution> history)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _BackupConfig() when $default != null:
|
||||
return $default(_that.sourcePath,_that.targets,_that.nextRun,_that.lastRun,_that.history);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _BackupConfig implements BackupConfig {
|
||||
const _BackupConfig({@JsonKey(name: 'source_path') this.sourcePath, final List<BackupTarget> targets = const <BackupTarget>[], @JsonKey(name: 'next_run') this.nextRun, @JsonKey(name: 'last_run') this.lastRun, final List<BackupExecution> history = const <BackupExecution>[]}): _targets = targets,_history = history;
|
||||
factory _BackupConfig.fromJson(Map<String, dynamic> json) => _$BackupConfigFromJson(json);
|
||||
|
||||
@override@JsonKey(name: 'source_path') final String? sourcePath;
|
||||
final List<BackupTarget> _targets;
|
||||
@override@JsonKey() List<BackupTarget> get targets {
|
||||
if (_targets is EqualUnmodifiableListView) return _targets;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_targets);
|
||||
}
|
||||
|
||||
@override@JsonKey(name: 'next_run') final DateTime? nextRun;
|
||||
@override@JsonKey(name: 'last_run') final DateTime? lastRun;
|
||||
final List<BackupExecution> _history;
|
||||
@override@JsonKey() List<BackupExecution> get history {
|
||||
if (_history is EqualUnmodifiableListView) return _history;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_history);
|
||||
}
|
||||
|
||||
|
||||
/// Create a copy of BackupConfig
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$BackupConfigCopyWith<_BackupConfig> get copyWith => __$BackupConfigCopyWithImpl<_BackupConfig>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$BackupConfigToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _BackupConfig&&(identical(other.sourcePath, sourcePath) || other.sourcePath == sourcePath)&&const DeepCollectionEquality().equals(other._targets, _targets)&&(identical(other.nextRun, nextRun) || other.nextRun == nextRun)&&(identical(other.lastRun, lastRun) || other.lastRun == lastRun)&&const DeepCollectionEquality().equals(other._history, _history));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,sourcePath,const DeepCollectionEquality().hash(_targets),nextRun,lastRun,const DeepCollectionEquality().hash(_history));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BackupConfig(sourcePath: $sourcePath, targets: $targets, nextRun: $nextRun, lastRun: $lastRun, history: $history)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$BackupConfigCopyWith<$Res> implements $BackupConfigCopyWith<$Res> {
|
||||
factory _$BackupConfigCopyWith(_BackupConfig value, $Res Function(_BackupConfig) _then) = __$BackupConfigCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'source_path') String? sourcePath, List<BackupTarget> targets,@JsonKey(name: 'next_run') DateTime? nextRun,@JsonKey(name: 'last_run') DateTime? lastRun, List<BackupExecution> history
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$BackupConfigCopyWithImpl<$Res>
|
||||
implements _$BackupConfigCopyWith<$Res> {
|
||||
__$BackupConfigCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _BackupConfig _self;
|
||||
final $Res Function(_BackupConfig) _then;
|
||||
|
||||
/// Create a copy of BackupConfig
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? sourcePath = freezed,Object? targets = null,Object? nextRun = freezed,Object? lastRun = freezed,Object? history = null,}) {
|
||||
return _then(_BackupConfig(
|
||||
sourcePath: freezed == sourcePath ? _self.sourcePath : sourcePath // ignore: cast_nullable_to_non_nullable
|
||||
as String?,targets: null == targets ? _self._targets : targets // ignore: cast_nullable_to_non_nullable
|
||||
as List<BackupTarget>,nextRun: freezed == nextRun ? _self.nextRun : nextRun // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,lastRun: freezed == lastRun ? _self.lastRun : lastRun // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,history: null == history ? _self._history : history // ignore: cast_nullable_to_non_nullable
|
||||
as List<BackupExecution>,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,37 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'backup_config.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_BackupConfig _$BackupConfigFromJson(Map<String, dynamic> json) =>
|
||||
_BackupConfig(
|
||||
sourcePath: json['source_path'] as String?,
|
||||
targets:
|
||||
(json['targets'] as List<dynamic>?)
|
||||
?.map((e) => BackupTarget.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
const <BackupTarget>[],
|
||||
nextRun: json['next_run'] == null
|
||||
? null
|
||||
: DateTime.parse(json['next_run'] as String),
|
||||
lastRun: json['last_run'] == null
|
||||
? null
|
||||
: DateTime.parse(json['last_run'] as String),
|
||||
history:
|
||||
(json['history'] as List<dynamic>?)
|
||||
?.map((e) => BackupExecution.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
const <BackupExecution>[],
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$BackupConfigToJson(_BackupConfig instance) =>
|
||||
<String, dynamic>{
|
||||
'source_path': instance.sourcePath,
|
||||
'targets': instance.targets.map((e) => e.toJson()).toList(),
|
||||
'next_run': instance.nextRun?.toIso8601String(),
|
||||
'last_run': instance.lastRun?.toIso8601String(),
|
||||
'history': instance.history.map((e) => e.toJson()).toList(),
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'backup_execution.freezed.dart';
|
||||
part 'backup_execution.g.dart';
|
||||
|
||||
/// Mirrors `models.BackupExecution`.
|
||||
@freezed
|
||||
sealed class BackupExecution with _$BackupExecution {
|
||||
const factory BackupExecution({
|
||||
required String id,
|
||||
required DateTime timestamp,
|
||||
required bool success,
|
||||
@JsonKey(name: 'duration_seconds') required int durationSeconds,
|
||||
@Default('') String message,
|
||||
@JsonKey(name: 'target_id') String? targetId,
|
||||
}) = _BackupExecution;
|
||||
|
||||
factory BackupExecution.fromJson(Map<String, dynamic> json) => _$BackupExecutionFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,286 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'backup_execution.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$BackupExecution {
|
||||
|
||||
String get id; DateTime get timestamp; bool get success;@JsonKey(name: 'duration_seconds') int get durationSeconds; String get message;@JsonKey(name: 'target_id') String? get targetId;
|
||||
/// Create a copy of BackupExecution
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$BackupExecutionCopyWith<BackupExecution> get copyWith => _$BackupExecutionCopyWithImpl<BackupExecution>(this as BackupExecution, _$identity);
|
||||
|
||||
/// Serializes this BackupExecution to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is BackupExecution&&(identical(other.id, id) || other.id == id)&&(identical(other.timestamp, timestamp) || other.timestamp == timestamp)&&(identical(other.success, success) || other.success == success)&&(identical(other.durationSeconds, durationSeconds) || other.durationSeconds == durationSeconds)&&(identical(other.message, message) || other.message == message)&&(identical(other.targetId, targetId) || other.targetId == targetId));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,timestamp,success,durationSeconds,message,targetId);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BackupExecution(id: $id, timestamp: $timestamp, success: $success, durationSeconds: $durationSeconds, message: $message, targetId: $targetId)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $BackupExecutionCopyWith<$Res> {
|
||||
factory $BackupExecutionCopyWith(BackupExecution value, $Res Function(BackupExecution) _then) = _$BackupExecutionCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String id, DateTime timestamp, bool success,@JsonKey(name: 'duration_seconds') int durationSeconds, String message,@JsonKey(name: 'target_id') String? targetId
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$BackupExecutionCopyWithImpl<$Res>
|
||||
implements $BackupExecutionCopyWith<$Res> {
|
||||
_$BackupExecutionCopyWithImpl(this._self, this._then);
|
||||
|
||||
final BackupExecution _self;
|
||||
final $Res Function(BackupExecution) _then;
|
||||
|
||||
/// Create a copy of BackupExecution
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? timestamp = null,Object? success = null,Object? durationSeconds = null,Object? message = null,Object? targetId = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,timestamp: null == timestamp ? _self.timestamp : timestamp // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,success: null == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
|
||||
as bool,durationSeconds: null == durationSeconds ? _self.durationSeconds : durationSeconds // ignore: cast_nullable_to_non_nullable
|
||||
as int,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||
as String,targetId: freezed == targetId ? _self.targetId : targetId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [BackupExecution].
|
||||
extension BackupExecutionPatterns on BackupExecution {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _BackupExecution value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _BackupExecution() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _BackupExecution value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _BackupExecution():
|
||||
return $default(_that);}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _BackupExecution value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _BackupExecution() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, DateTime timestamp, bool success, @JsonKey(name: 'duration_seconds') int durationSeconds, String message, @JsonKey(name: 'target_id') String? targetId)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _BackupExecution() when $default != null:
|
||||
return $default(_that.id,_that.timestamp,_that.success,_that.durationSeconds,_that.message,_that.targetId);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, DateTime timestamp, bool success, @JsonKey(name: 'duration_seconds') int durationSeconds, String message, @JsonKey(name: 'target_id') String? targetId) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _BackupExecution():
|
||||
return $default(_that.id,_that.timestamp,_that.success,_that.durationSeconds,_that.message,_that.targetId);}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, DateTime timestamp, bool success, @JsonKey(name: 'duration_seconds') int durationSeconds, String message, @JsonKey(name: 'target_id') String? targetId)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _BackupExecution() when $default != null:
|
||||
return $default(_that.id,_that.timestamp,_that.success,_that.durationSeconds,_that.message,_that.targetId);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _BackupExecution implements BackupExecution {
|
||||
const _BackupExecution({required this.id, required this.timestamp, required this.success, @JsonKey(name: 'duration_seconds') required this.durationSeconds, this.message = '', @JsonKey(name: 'target_id') this.targetId});
|
||||
factory _BackupExecution.fromJson(Map<String, dynamic> json) => _$BackupExecutionFromJson(json);
|
||||
|
||||
@override final String id;
|
||||
@override final DateTime timestamp;
|
||||
@override final bool success;
|
||||
@override@JsonKey(name: 'duration_seconds') final int durationSeconds;
|
||||
@override@JsonKey() final String message;
|
||||
@override@JsonKey(name: 'target_id') final String? targetId;
|
||||
|
||||
/// Create a copy of BackupExecution
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$BackupExecutionCopyWith<_BackupExecution> get copyWith => __$BackupExecutionCopyWithImpl<_BackupExecution>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$BackupExecutionToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _BackupExecution&&(identical(other.id, id) || other.id == id)&&(identical(other.timestamp, timestamp) || other.timestamp == timestamp)&&(identical(other.success, success) || other.success == success)&&(identical(other.durationSeconds, durationSeconds) || other.durationSeconds == durationSeconds)&&(identical(other.message, message) || other.message == message)&&(identical(other.targetId, targetId) || other.targetId == targetId));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,timestamp,success,durationSeconds,message,targetId);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BackupExecution(id: $id, timestamp: $timestamp, success: $success, durationSeconds: $durationSeconds, message: $message, targetId: $targetId)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$BackupExecutionCopyWith<$Res> implements $BackupExecutionCopyWith<$Res> {
|
||||
factory _$BackupExecutionCopyWith(_BackupExecution value, $Res Function(_BackupExecution) _then) = __$BackupExecutionCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String id, DateTime timestamp, bool success,@JsonKey(name: 'duration_seconds') int durationSeconds, String message,@JsonKey(name: 'target_id') String? targetId
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$BackupExecutionCopyWithImpl<$Res>
|
||||
implements _$BackupExecutionCopyWith<$Res> {
|
||||
__$BackupExecutionCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _BackupExecution _self;
|
||||
final $Res Function(_BackupExecution) _then;
|
||||
|
||||
/// Create a copy of BackupExecution
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? timestamp = null,Object? success = null,Object? durationSeconds = null,Object? message = null,Object? targetId = freezed,}) {
|
||||
return _then(_BackupExecution(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,timestamp: null == timestamp ? _self.timestamp : timestamp // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,success: null == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
|
||||
as bool,durationSeconds: null == durationSeconds ? _self.durationSeconds : durationSeconds // ignore: cast_nullable_to_non_nullable
|
||||
as int,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||
as String,targetId: freezed == targetId ? _self.targetId : targetId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,27 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'backup_execution.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_BackupExecution _$BackupExecutionFromJson(Map<String, dynamic> json) =>
|
||||
_BackupExecution(
|
||||
id: json['id'] as String,
|
||||
timestamp: DateTime.parse(json['timestamp'] as String),
|
||||
success: json['success'] as bool,
|
||||
durationSeconds: (json['duration_seconds'] as num).toInt(),
|
||||
message: json['message'] as String? ?? '',
|
||||
targetId: json['target_id'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$BackupExecutionToJson(_BackupExecution instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'timestamp': instance.timestamp.toIso8601String(),
|
||||
'success': instance.success,
|
||||
'duration_seconds': instance.durationSeconds,
|
||||
'message': instance.message,
|
||||
'target_id': instance.targetId,
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
/// Mirrors `models.BackupMethod` in `nodemaster/models/types.go`.
|
||||
enum BackupMethod {
|
||||
@JsonValue('rsync')
|
||||
rsync,
|
||||
@JsonValue('restic')
|
||||
restic,
|
||||
@JsonValue('external')
|
||||
external,
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import 'backup_method.dart';
|
||||
|
||||
part 'backup_target.freezed.dart';
|
||||
part 'backup_target.g.dart';
|
||||
|
||||
/// Mirrors `models.BackupTarget`. `schedule` is a standard 5-field cron
|
||||
/// expression; empty means manual-only (no automatic scheduling).
|
||||
@freezed
|
||||
sealed class BackupTarget with _$BackupTarget {
|
||||
const factory BackupTarget({
|
||||
@Default('') String id,
|
||||
required String name,
|
||||
required BackupMethod method,
|
||||
required String remote,
|
||||
@Default(<String, String>{}) Map<String, String> params,
|
||||
String? schedule,
|
||||
@JsonKey(name: 'last_run') DateTime? lastRun,
|
||||
@JsonKey(name: 'next_run') DateTime? nextRun,
|
||||
}) = _BackupTarget;
|
||||
|
||||
factory BackupTarget.fromJson(Map<String, dynamic> json) => _$BackupTargetFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,298 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'backup_target.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$BackupTarget {
|
||||
|
||||
String get id; String get name; BackupMethod get method; String get remote; Map<String, String> get params; String? get schedule;@JsonKey(name: 'last_run') DateTime? get lastRun;@JsonKey(name: 'next_run') DateTime? get nextRun;
|
||||
/// Create a copy of BackupTarget
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$BackupTargetCopyWith<BackupTarget> get copyWith => _$BackupTargetCopyWithImpl<BackupTarget>(this as BackupTarget, _$identity);
|
||||
|
||||
/// Serializes this BackupTarget to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is BackupTarget&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.method, method) || other.method == method)&&(identical(other.remote, remote) || other.remote == remote)&&const DeepCollectionEquality().equals(other.params, params)&&(identical(other.schedule, schedule) || other.schedule == schedule)&&(identical(other.lastRun, lastRun) || other.lastRun == lastRun)&&(identical(other.nextRun, nextRun) || other.nextRun == nextRun));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,name,method,remote,const DeepCollectionEquality().hash(params),schedule,lastRun,nextRun);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BackupTarget(id: $id, name: $name, method: $method, remote: $remote, params: $params, schedule: $schedule, lastRun: $lastRun, nextRun: $nextRun)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $BackupTargetCopyWith<$Res> {
|
||||
factory $BackupTargetCopyWith(BackupTarget value, $Res Function(BackupTarget) _then) = _$BackupTargetCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String id, String name, BackupMethod method, String remote, Map<String, String> params, String? schedule,@JsonKey(name: 'last_run') DateTime? lastRun,@JsonKey(name: 'next_run') DateTime? nextRun
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$BackupTargetCopyWithImpl<$Res>
|
||||
implements $BackupTargetCopyWith<$Res> {
|
||||
_$BackupTargetCopyWithImpl(this._self, this._then);
|
||||
|
||||
final BackupTarget _self;
|
||||
final $Res Function(BackupTarget) _then;
|
||||
|
||||
/// Create a copy of BackupTarget
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? name = null,Object? method = null,Object? remote = null,Object? params = null,Object? schedule = freezed,Object? lastRun = freezed,Object? nextRun = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String,method: null == method ? _self.method : method // ignore: cast_nullable_to_non_nullable
|
||||
as BackupMethod,remote: null == remote ? _self.remote : remote // ignore: cast_nullable_to_non_nullable
|
||||
as String,params: null == params ? _self.params : params // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, String>,schedule: freezed == schedule ? _self.schedule : schedule // ignore: cast_nullable_to_non_nullable
|
||||
as String?,lastRun: freezed == lastRun ? _self.lastRun : lastRun // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,nextRun: freezed == nextRun ? _self.nextRun : nextRun // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [BackupTarget].
|
||||
extension BackupTargetPatterns on BackupTarget {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _BackupTarget value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _BackupTarget() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _BackupTarget value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _BackupTarget():
|
||||
return $default(_that);}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _BackupTarget value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _BackupTarget() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String name, BackupMethod method, String remote, Map<String, String> params, String? schedule, @JsonKey(name: 'last_run') DateTime? lastRun, @JsonKey(name: 'next_run') DateTime? nextRun)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _BackupTarget() when $default != null:
|
||||
return $default(_that.id,_that.name,_that.method,_that.remote,_that.params,_that.schedule,_that.lastRun,_that.nextRun);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String name, BackupMethod method, String remote, Map<String, String> params, String? schedule, @JsonKey(name: 'last_run') DateTime? lastRun, @JsonKey(name: 'next_run') DateTime? nextRun) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _BackupTarget():
|
||||
return $default(_that.id,_that.name,_that.method,_that.remote,_that.params,_that.schedule,_that.lastRun,_that.nextRun);}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String name, BackupMethod method, String remote, Map<String, String> params, String? schedule, @JsonKey(name: 'last_run') DateTime? lastRun, @JsonKey(name: 'next_run') DateTime? nextRun)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _BackupTarget() when $default != null:
|
||||
return $default(_that.id,_that.name,_that.method,_that.remote,_that.params,_that.schedule,_that.lastRun,_that.nextRun);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _BackupTarget implements BackupTarget {
|
||||
const _BackupTarget({this.id = '', required this.name, required this.method, required this.remote, final Map<String, String> params = const <String, String>{}, this.schedule, @JsonKey(name: 'last_run') this.lastRun, @JsonKey(name: 'next_run') this.nextRun}): _params = params;
|
||||
factory _BackupTarget.fromJson(Map<String, dynamic> json) => _$BackupTargetFromJson(json);
|
||||
|
||||
@override@JsonKey() final String id;
|
||||
@override final String name;
|
||||
@override final BackupMethod method;
|
||||
@override final String remote;
|
||||
final Map<String, String> _params;
|
||||
@override@JsonKey() Map<String, String> get params {
|
||||
if (_params is EqualUnmodifiableMapView) return _params;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(_params);
|
||||
}
|
||||
|
||||
@override final String? schedule;
|
||||
@override@JsonKey(name: 'last_run') final DateTime? lastRun;
|
||||
@override@JsonKey(name: 'next_run') final DateTime? nextRun;
|
||||
|
||||
/// Create a copy of BackupTarget
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$BackupTargetCopyWith<_BackupTarget> get copyWith => __$BackupTargetCopyWithImpl<_BackupTarget>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$BackupTargetToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _BackupTarget&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.method, method) || other.method == method)&&(identical(other.remote, remote) || other.remote == remote)&&const DeepCollectionEquality().equals(other._params, _params)&&(identical(other.schedule, schedule) || other.schedule == schedule)&&(identical(other.lastRun, lastRun) || other.lastRun == lastRun)&&(identical(other.nextRun, nextRun) || other.nextRun == nextRun));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,name,method,remote,const DeepCollectionEquality().hash(_params),schedule,lastRun,nextRun);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BackupTarget(id: $id, name: $name, method: $method, remote: $remote, params: $params, schedule: $schedule, lastRun: $lastRun, nextRun: $nextRun)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$BackupTargetCopyWith<$Res> implements $BackupTargetCopyWith<$Res> {
|
||||
factory _$BackupTargetCopyWith(_BackupTarget value, $Res Function(_BackupTarget) _then) = __$BackupTargetCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String id, String name, BackupMethod method, String remote, Map<String, String> params, String? schedule,@JsonKey(name: 'last_run') DateTime? lastRun,@JsonKey(name: 'next_run') DateTime? nextRun
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$BackupTargetCopyWithImpl<$Res>
|
||||
implements _$BackupTargetCopyWith<$Res> {
|
||||
__$BackupTargetCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _BackupTarget _self;
|
||||
final $Res Function(_BackupTarget) _then;
|
||||
|
||||
/// Create a copy of BackupTarget
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? name = null,Object? method = null,Object? remote = null,Object? params = null,Object? schedule = freezed,Object? lastRun = freezed,Object? nextRun = freezed,}) {
|
||||
return _then(_BackupTarget(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String,method: null == method ? _self.method : method // ignore: cast_nullable_to_non_nullable
|
||||
as BackupMethod,remote: null == remote ? _self.remote : remote // ignore: cast_nullable_to_non_nullable
|
||||
as String,params: null == params ? _self._params : params // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, String>,schedule: freezed == schedule ? _self.schedule : schedule // ignore: cast_nullable_to_non_nullable
|
||||
as String?,lastRun: freezed == lastRun ? _self.lastRun : lastRun // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,nextRun: freezed == nextRun ? _self.nextRun : nextRun // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,45 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'backup_target.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_BackupTarget _$BackupTargetFromJson(Map<String, dynamic> json) =>
|
||||
_BackupTarget(
|
||||
id: json['id'] as String? ?? '',
|
||||
name: json['name'] as String,
|
||||
method: $enumDecode(_$BackupMethodEnumMap, json['method']),
|
||||
remote: json['remote'] as String,
|
||||
params:
|
||||
(json['params'] as Map<String, dynamic>?)?.map(
|
||||
(k, e) => MapEntry(k, e as String),
|
||||
) ??
|
||||
const <String, String>{},
|
||||
schedule: json['schedule'] as String?,
|
||||
lastRun: json['last_run'] == null
|
||||
? null
|
||||
: DateTime.parse(json['last_run'] as String),
|
||||
nextRun: json['next_run'] == null
|
||||
? null
|
||||
: DateTime.parse(json['next_run'] as String),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$BackupTargetToJson(_BackupTarget instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
'method': _$BackupMethodEnumMap[instance.method]!,
|
||||
'remote': instance.remote,
|
||||
'params': instance.params,
|
||||
'schedule': instance.schedule,
|
||||
'last_run': instance.lastRun?.toIso8601String(),
|
||||
'next_run': instance.nextRun?.toIso8601String(),
|
||||
};
|
||||
|
||||
const _$BackupMethodEnumMap = {
|
||||
BackupMethod.rsync: 'rsync',
|
||||
BackupMethod.restic: 'restic',
|
||||
BackupMethod.external: 'external',
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
export 'aggregated_node_status.dart';
|
||||
export 'backup_config.dart';
|
||||
export 'backup_execution.dart';
|
||||
export 'backup_method.dart';
|
||||
export 'backup_target.dart';
|
||||
export 'node_info.dart';
|
||||
export 'remote_node.dart';
|
||||
export 'run_state.dart';
|
||||
export 'scan_result.dart';
|
||||
export 'service.dart';
|
||||
export 'service_scan_info.dart';
|
||||
export 'update_record.dart';
|
||||
@@ -0,0 +1,30 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import 'backup_config.dart';
|
||||
import 'update_record.dart';
|
||||
|
||||
part 'node_info.freezed.dart';
|
||||
part 'node_info.g.dart';
|
||||
|
||||
/// Mirrors `models.NodeInfo` — the local/current host's identity + backup
|
||||
/// config + update log, as served by `GET /node/`.
|
||||
///
|
||||
/// `resticPassword` is write-only: the API never echoes the real password
|
||||
/// back (`GET /node/` sends `restic_password_set` instead, see
|
||||
/// `controllers/node.go`), so this stays `null` unless the user is actively
|
||||
/// setting/changing it in the identity form, and is omitted from the PUT
|
||||
/// body entirely when `null` so an untouched form never clobbers the
|
||||
/// existing password (mirrors the Go side's "empty string = don't change").
|
||||
@freezed
|
||||
sealed class NodeInfo with _$NodeInfo {
|
||||
const factory NodeInfo({
|
||||
required String hostname,
|
||||
String? description,
|
||||
@JsonKey(name: 'update_history') @Default(<UpdateRecord>[]) List<UpdateRecord> updateHistory,
|
||||
required BackupConfig backup,
|
||||
@JsonKey(name: 'restic_password_set') @Default(false) bool resticPasswordSet,
|
||||
@JsonKey(name: 'restic_password', includeIfNull: false) String? resticPassword,
|
||||
}) = _NodeInfo;
|
||||
|
||||
factory NodeInfo.fromJson(Map<String, dynamic> json) => _$NodeInfoFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,310 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'node_info.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$NodeInfo {
|
||||
|
||||
String get hostname; String? get description;@JsonKey(name: 'update_history') List<UpdateRecord> get updateHistory; BackupConfig get backup;@JsonKey(name: 'restic_password_set') bool get resticPasswordSet;@JsonKey(name: 'restic_password', includeIfNull: false) String? get resticPassword;
|
||||
/// Create a copy of NodeInfo
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$NodeInfoCopyWith<NodeInfo> get copyWith => _$NodeInfoCopyWithImpl<NodeInfo>(this as NodeInfo, _$identity);
|
||||
|
||||
/// Serializes this NodeInfo to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is NodeInfo&&(identical(other.hostname, hostname) || other.hostname == hostname)&&(identical(other.description, description) || other.description == description)&&const DeepCollectionEquality().equals(other.updateHistory, updateHistory)&&(identical(other.backup, backup) || other.backup == backup)&&(identical(other.resticPasswordSet, resticPasswordSet) || other.resticPasswordSet == resticPasswordSet)&&(identical(other.resticPassword, resticPassword) || other.resticPassword == resticPassword));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,hostname,description,const DeepCollectionEquality().hash(updateHistory),backup,resticPasswordSet,resticPassword);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'NodeInfo(hostname: $hostname, description: $description, updateHistory: $updateHistory, backup: $backup, resticPasswordSet: $resticPasswordSet, resticPassword: $resticPassword)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $NodeInfoCopyWith<$Res> {
|
||||
factory $NodeInfoCopyWith(NodeInfo value, $Res Function(NodeInfo) _then) = _$NodeInfoCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String hostname, String? description,@JsonKey(name: 'update_history') List<UpdateRecord> updateHistory, BackupConfig backup,@JsonKey(name: 'restic_password_set') bool resticPasswordSet,@JsonKey(name: 'restic_password', includeIfNull: false) String? resticPassword
|
||||
});
|
||||
|
||||
|
||||
$BackupConfigCopyWith<$Res> get backup;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$NodeInfoCopyWithImpl<$Res>
|
||||
implements $NodeInfoCopyWith<$Res> {
|
||||
_$NodeInfoCopyWithImpl(this._self, this._then);
|
||||
|
||||
final NodeInfo _self;
|
||||
final $Res Function(NodeInfo) _then;
|
||||
|
||||
/// Create a copy of NodeInfo
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? hostname = null,Object? description = freezed,Object? updateHistory = null,Object? backup = null,Object? resticPasswordSet = null,Object? resticPassword = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
hostname: null == hostname ? _self.hostname : hostname // ignore: cast_nullable_to_non_nullable
|
||||
as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||
as String?,updateHistory: null == updateHistory ? _self.updateHistory : updateHistory // ignore: cast_nullable_to_non_nullable
|
||||
as List<UpdateRecord>,backup: null == backup ? _self.backup : backup // ignore: cast_nullable_to_non_nullable
|
||||
as BackupConfig,resticPasswordSet: null == resticPasswordSet ? _self.resticPasswordSet : resticPasswordSet // ignore: cast_nullable_to_non_nullable
|
||||
as bool,resticPassword: freezed == resticPassword ? _self.resticPassword : resticPassword // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
/// Create a copy of NodeInfo
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$BackupConfigCopyWith<$Res> get backup {
|
||||
|
||||
return $BackupConfigCopyWith<$Res>(_self.backup, (value) {
|
||||
return _then(_self.copyWith(backup: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [NodeInfo].
|
||||
extension NodeInfoPatterns on NodeInfo {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _NodeInfo value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _NodeInfo() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _NodeInfo value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _NodeInfo():
|
||||
return $default(_that);}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _NodeInfo value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _NodeInfo() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String hostname, String? description, @JsonKey(name: 'update_history') List<UpdateRecord> updateHistory, BackupConfig backup, @JsonKey(name: 'restic_password_set') bool resticPasswordSet, @JsonKey(name: 'restic_password', includeIfNull: false) String? resticPassword)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _NodeInfo() when $default != null:
|
||||
return $default(_that.hostname,_that.description,_that.updateHistory,_that.backup,_that.resticPasswordSet,_that.resticPassword);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String hostname, String? description, @JsonKey(name: 'update_history') List<UpdateRecord> updateHistory, BackupConfig backup, @JsonKey(name: 'restic_password_set') bool resticPasswordSet, @JsonKey(name: 'restic_password', includeIfNull: false) String? resticPassword) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _NodeInfo():
|
||||
return $default(_that.hostname,_that.description,_that.updateHistory,_that.backup,_that.resticPasswordSet,_that.resticPassword);}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String hostname, String? description, @JsonKey(name: 'update_history') List<UpdateRecord> updateHistory, BackupConfig backup, @JsonKey(name: 'restic_password_set') bool resticPasswordSet, @JsonKey(name: 'restic_password', includeIfNull: false) String? resticPassword)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _NodeInfo() when $default != null:
|
||||
return $default(_that.hostname,_that.description,_that.updateHistory,_that.backup,_that.resticPasswordSet,_that.resticPassword);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _NodeInfo implements NodeInfo {
|
||||
const _NodeInfo({required this.hostname, this.description, @JsonKey(name: 'update_history') final List<UpdateRecord> updateHistory = const <UpdateRecord>[], required this.backup, @JsonKey(name: 'restic_password_set') this.resticPasswordSet = false, @JsonKey(name: 'restic_password', includeIfNull: false) this.resticPassword}): _updateHistory = updateHistory;
|
||||
factory _NodeInfo.fromJson(Map<String, dynamic> json) => _$NodeInfoFromJson(json);
|
||||
|
||||
@override final String hostname;
|
||||
@override final String? description;
|
||||
final List<UpdateRecord> _updateHistory;
|
||||
@override@JsonKey(name: 'update_history') List<UpdateRecord> get updateHistory {
|
||||
if (_updateHistory is EqualUnmodifiableListView) return _updateHistory;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_updateHistory);
|
||||
}
|
||||
|
||||
@override final BackupConfig backup;
|
||||
@override@JsonKey(name: 'restic_password_set') final bool resticPasswordSet;
|
||||
@override@JsonKey(name: 'restic_password', includeIfNull: false) final String? resticPassword;
|
||||
|
||||
/// Create a copy of NodeInfo
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$NodeInfoCopyWith<_NodeInfo> get copyWith => __$NodeInfoCopyWithImpl<_NodeInfo>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$NodeInfoToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _NodeInfo&&(identical(other.hostname, hostname) || other.hostname == hostname)&&(identical(other.description, description) || other.description == description)&&const DeepCollectionEquality().equals(other._updateHistory, _updateHistory)&&(identical(other.backup, backup) || other.backup == backup)&&(identical(other.resticPasswordSet, resticPasswordSet) || other.resticPasswordSet == resticPasswordSet)&&(identical(other.resticPassword, resticPassword) || other.resticPassword == resticPassword));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,hostname,description,const DeepCollectionEquality().hash(_updateHistory),backup,resticPasswordSet,resticPassword);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'NodeInfo(hostname: $hostname, description: $description, updateHistory: $updateHistory, backup: $backup, resticPasswordSet: $resticPasswordSet, resticPassword: $resticPassword)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$NodeInfoCopyWith<$Res> implements $NodeInfoCopyWith<$Res> {
|
||||
factory _$NodeInfoCopyWith(_NodeInfo value, $Res Function(_NodeInfo) _then) = __$NodeInfoCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String hostname, String? description,@JsonKey(name: 'update_history') List<UpdateRecord> updateHistory, BackupConfig backup,@JsonKey(name: 'restic_password_set') bool resticPasswordSet,@JsonKey(name: 'restic_password', includeIfNull: false) String? resticPassword
|
||||
});
|
||||
|
||||
|
||||
@override $BackupConfigCopyWith<$Res> get backup;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$NodeInfoCopyWithImpl<$Res>
|
||||
implements _$NodeInfoCopyWith<$Res> {
|
||||
__$NodeInfoCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _NodeInfo _self;
|
||||
final $Res Function(_NodeInfo) _then;
|
||||
|
||||
/// Create a copy of NodeInfo
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? hostname = null,Object? description = freezed,Object? updateHistory = null,Object? backup = null,Object? resticPasswordSet = null,Object? resticPassword = freezed,}) {
|
||||
return _then(_NodeInfo(
|
||||
hostname: null == hostname ? _self.hostname : hostname // ignore: cast_nullable_to_non_nullable
|
||||
as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||
as String?,updateHistory: null == updateHistory ? _self._updateHistory : updateHistory // ignore: cast_nullable_to_non_nullable
|
||||
as List<UpdateRecord>,backup: null == backup ? _self.backup : backup // ignore: cast_nullable_to_non_nullable
|
||||
as BackupConfig,resticPasswordSet: null == resticPasswordSet ? _self.resticPasswordSet : resticPasswordSet // ignore: cast_nullable_to_non_nullable
|
||||
as bool,resticPassword: freezed == resticPassword ? _self.resticPassword : resticPassword // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of NodeInfo
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$BackupConfigCopyWith<$Res> get backup {
|
||||
|
||||
return $BackupConfigCopyWith<$Res>(_self.backup, (value) {
|
||||
return _then(_self.copyWith(backup: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,29 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'node_info.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_NodeInfo _$NodeInfoFromJson(Map<String, dynamic> json) => _NodeInfo(
|
||||
hostname: json['hostname'] as String,
|
||||
description: json['description'] as String?,
|
||||
updateHistory:
|
||||
(json['update_history'] as List<dynamic>?)
|
||||
?.map((e) => UpdateRecord.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
const <UpdateRecord>[],
|
||||
backup: BackupConfig.fromJson(json['backup'] as Map<String, dynamic>),
|
||||
resticPasswordSet: json['restic_password_set'] as bool? ?? false,
|
||||
resticPassword: json['restic_password'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$NodeInfoToJson(_NodeInfo instance) => <String, dynamic>{
|
||||
'hostname': instance.hostname,
|
||||
'description': instance.description,
|
||||
'update_history': instance.updateHistory.map((e) => e.toJson()).toList(),
|
||||
'backup': instance.backup.toJson(),
|
||||
'restic_password_set': instance.resticPasswordSet,
|
||||
'restic_password': ?instance.resticPassword,
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'remote_node.freezed.dart';
|
||||
part 'remote_node.g.dart';
|
||||
|
||||
/// Mirrors `models.RemoteNode` — an entry in this node's registry of
|
||||
/// sibling NodeMaster hosts (`/nodes/*`).
|
||||
@freezed
|
||||
sealed class RemoteNode with _$RemoteNode {
|
||||
const factory RemoteNode({
|
||||
@Default('') String id,
|
||||
required String name,
|
||||
required String url,
|
||||
@Default('') String status,
|
||||
String? description,
|
||||
@Default(<String>[]) List<String> tags,
|
||||
@JsonKey(name: 'last_seen') DateTime? lastSeen,
|
||||
}) = _RemoteNode;
|
||||
|
||||
factory RemoteNode.fromJson(Map<String, dynamic> json) => _$RemoteNodeFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,295 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'remote_node.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$RemoteNode {
|
||||
|
||||
String get id; String get name; String get url; String get status; String? get description; List<String> get tags;@JsonKey(name: 'last_seen') DateTime? get lastSeen;
|
||||
/// Create a copy of RemoteNode
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$RemoteNodeCopyWith<RemoteNode> get copyWith => _$RemoteNodeCopyWithImpl<RemoteNode>(this as RemoteNode, _$identity);
|
||||
|
||||
/// Serializes this RemoteNode to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is RemoteNode&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.url, url) || other.url == url)&&(identical(other.status, status) || other.status == status)&&(identical(other.description, description) || other.description == description)&&const DeepCollectionEquality().equals(other.tags, tags)&&(identical(other.lastSeen, lastSeen) || other.lastSeen == lastSeen));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,name,url,status,description,const DeepCollectionEquality().hash(tags),lastSeen);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'RemoteNode(id: $id, name: $name, url: $url, status: $status, description: $description, tags: $tags, lastSeen: $lastSeen)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $RemoteNodeCopyWith<$Res> {
|
||||
factory $RemoteNodeCopyWith(RemoteNode value, $Res Function(RemoteNode) _then) = _$RemoteNodeCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String id, String name, String url, String status, String? description, List<String> tags,@JsonKey(name: 'last_seen') DateTime? lastSeen
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$RemoteNodeCopyWithImpl<$Res>
|
||||
implements $RemoteNodeCopyWith<$Res> {
|
||||
_$RemoteNodeCopyWithImpl(this._self, this._then);
|
||||
|
||||
final RemoteNode _self;
|
||||
final $Res Function(RemoteNode) _then;
|
||||
|
||||
/// Create a copy of RemoteNode
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? name = null,Object? url = null,Object? status = null,Object? description = freezed,Object? tags = null,Object? lastSeen = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String,url: null == url ? _self.url : url // ignore: cast_nullable_to_non_nullable
|
||||
as String,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||
as String?,tags: null == tags ? _self.tags : tags // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,lastSeen: freezed == lastSeen ? _self.lastSeen : lastSeen // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [RemoteNode].
|
||||
extension RemoteNodePatterns on RemoteNode {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _RemoteNode value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _RemoteNode() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _RemoteNode value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _RemoteNode():
|
||||
return $default(_that);}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _RemoteNode value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _RemoteNode() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String name, String url, String status, String? description, List<String> tags, @JsonKey(name: 'last_seen') DateTime? lastSeen)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _RemoteNode() when $default != null:
|
||||
return $default(_that.id,_that.name,_that.url,_that.status,_that.description,_that.tags,_that.lastSeen);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String name, String url, String status, String? description, List<String> tags, @JsonKey(name: 'last_seen') DateTime? lastSeen) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _RemoteNode():
|
||||
return $default(_that.id,_that.name,_that.url,_that.status,_that.description,_that.tags,_that.lastSeen);}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String name, String url, String status, String? description, List<String> tags, @JsonKey(name: 'last_seen') DateTime? lastSeen)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _RemoteNode() when $default != null:
|
||||
return $default(_that.id,_that.name,_that.url,_that.status,_that.description,_that.tags,_that.lastSeen);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _RemoteNode implements RemoteNode {
|
||||
const _RemoteNode({this.id = '', required this.name, required this.url, this.status = '', this.description, final List<String> tags = const <String>[], @JsonKey(name: 'last_seen') this.lastSeen}): _tags = tags;
|
||||
factory _RemoteNode.fromJson(Map<String, dynamic> json) => _$RemoteNodeFromJson(json);
|
||||
|
||||
@override@JsonKey() final String id;
|
||||
@override final String name;
|
||||
@override final String url;
|
||||
@override@JsonKey() final String status;
|
||||
@override final String? description;
|
||||
final List<String> _tags;
|
||||
@override@JsonKey() List<String> get tags {
|
||||
if (_tags is EqualUnmodifiableListView) return _tags;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_tags);
|
||||
}
|
||||
|
||||
@override@JsonKey(name: 'last_seen') final DateTime? lastSeen;
|
||||
|
||||
/// Create a copy of RemoteNode
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$RemoteNodeCopyWith<_RemoteNode> get copyWith => __$RemoteNodeCopyWithImpl<_RemoteNode>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$RemoteNodeToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _RemoteNode&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.url, url) || other.url == url)&&(identical(other.status, status) || other.status == status)&&(identical(other.description, description) || other.description == description)&&const DeepCollectionEquality().equals(other._tags, _tags)&&(identical(other.lastSeen, lastSeen) || other.lastSeen == lastSeen));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,name,url,status,description,const DeepCollectionEquality().hash(_tags),lastSeen);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'RemoteNode(id: $id, name: $name, url: $url, status: $status, description: $description, tags: $tags, lastSeen: $lastSeen)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$RemoteNodeCopyWith<$Res> implements $RemoteNodeCopyWith<$Res> {
|
||||
factory _$RemoteNodeCopyWith(_RemoteNode value, $Res Function(_RemoteNode) _then) = __$RemoteNodeCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String id, String name, String url, String status, String? description, List<String> tags,@JsonKey(name: 'last_seen') DateTime? lastSeen
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$RemoteNodeCopyWithImpl<$Res>
|
||||
implements _$RemoteNodeCopyWith<$Res> {
|
||||
__$RemoteNodeCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _RemoteNode _self;
|
||||
final $Res Function(_RemoteNode) _then;
|
||||
|
||||
/// Create a copy of RemoteNode
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? name = null,Object? url = null,Object? status = null,Object? description = freezed,Object? tags = null,Object? lastSeen = freezed,}) {
|
||||
return _then(_RemoteNode(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String,url: null == url ? _self.url : url // ignore: cast_nullable_to_non_nullable
|
||||
as String,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||
as String?,tags: null == tags ? _self._tags : tags // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,lastSeen: freezed == lastSeen ? _self.lastSeen : lastSeen // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,32 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'remote_node.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_RemoteNode _$RemoteNodeFromJson(Map<String, dynamic> json) => _RemoteNode(
|
||||
id: json['id'] as String? ?? '',
|
||||
name: json['name'] as String,
|
||||
url: json['url'] as String,
|
||||
status: json['status'] as String? ?? '',
|
||||
description: json['description'] as String?,
|
||||
tags:
|
||||
(json['tags'] as List<dynamic>?)?.map((e) => e as String).toList() ??
|
||||
const <String>[],
|
||||
lastSeen: json['last_seen'] == null
|
||||
? null
|
||||
: DateTime.parse(json['last_seen'] as String),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$RemoteNodeToJson(_RemoteNode instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
'url': instance.url,
|
||||
'status': instance.status,
|
||||
'description': instance.description,
|
||||
'tags': instance.tags,
|
||||
'last_seen': instance.lastSeen?.toIso8601String(),
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import 'backup_method.dart';
|
||||
|
||||
part 'run_state.freezed.dart';
|
||||
part 'run_state.g.dart';
|
||||
|
||||
/// Mirrors `models.RunState` — the live (in-memory, non-persisted) progress
|
||||
/// of a single backup target's current or most recent run. Polled from
|
||||
/// `GET /.../backup/targets/:tid/progress` while a run is in flight.
|
||||
@freezed
|
||||
sealed class RunState with _$RunState {
|
||||
const factory RunState({
|
||||
@Default(false) bool running,
|
||||
@JsonKey(name: 'target_id') @Default('') String targetId,
|
||||
BackupMethod? method,
|
||||
@Default(0) double percent,
|
||||
String? eta,
|
||||
String? message,
|
||||
@JsonKey(name: 'started_at') DateTime? startedAt,
|
||||
}) = _RunState;
|
||||
|
||||
factory RunState.fromJson(Map<String, dynamic> json) => _$RunStateFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,289 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'run_state.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$RunState {
|
||||
|
||||
bool get running;@JsonKey(name: 'target_id') String get targetId; BackupMethod? get method; double get percent; String? get eta; String? get message;@JsonKey(name: 'started_at') DateTime? get startedAt;
|
||||
/// Create a copy of RunState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$RunStateCopyWith<RunState> get copyWith => _$RunStateCopyWithImpl<RunState>(this as RunState, _$identity);
|
||||
|
||||
/// Serializes this RunState to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is RunState&&(identical(other.running, running) || other.running == running)&&(identical(other.targetId, targetId) || other.targetId == targetId)&&(identical(other.method, method) || other.method == method)&&(identical(other.percent, percent) || other.percent == percent)&&(identical(other.eta, eta) || other.eta == eta)&&(identical(other.message, message) || other.message == message)&&(identical(other.startedAt, startedAt) || other.startedAt == startedAt));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,running,targetId,method,percent,eta,message,startedAt);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'RunState(running: $running, targetId: $targetId, method: $method, percent: $percent, eta: $eta, message: $message, startedAt: $startedAt)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $RunStateCopyWith<$Res> {
|
||||
factory $RunStateCopyWith(RunState value, $Res Function(RunState) _then) = _$RunStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
bool running,@JsonKey(name: 'target_id') String targetId, BackupMethod? method, double percent, String? eta, String? message,@JsonKey(name: 'started_at') DateTime? startedAt
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$RunStateCopyWithImpl<$Res>
|
||||
implements $RunStateCopyWith<$Res> {
|
||||
_$RunStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final RunState _self;
|
||||
final $Res Function(RunState) _then;
|
||||
|
||||
/// Create a copy of RunState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? running = null,Object? targetId = null,Object? method = freezed,Object? percent = null,Object? eta = freezed,Object? message = freezed,Object? startedAt = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
running: null == running ? _self.running : running // ignore: cast_nullable_to_non_nullable
|
||||
as bool,targetId: null == targetId ? _self.targetId : targetId // ignore: cast_nullable_to_non_nullable
|
||||
as String,method: freezed == method ? _self.method : method // ignore: cast_nullable_to_non_nullable
|
||||
as BackupMethod?,percent: null == percent ? _self.percent : percent // ignore: cast_nullable_to_non_nullable
|
||||
as double,eta: freezed == eta ? _self.eta : eta // ignore: cast_nullable_to_non_nullable
|
||||
as String?,message: freezed == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||
as String?,startedAt: freezed == startedAt ? _self.startedAt : startedAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [RunState].
|
||||
extension RunStatePatterns on RunState {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _RunState value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _RunState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _RunState value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _RunState():
|
||||
return $default(_that);}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _RunState value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _RunState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool running, @JsonKey(name: 'target_id') String targetId, BackupMethod? method, double percent, String? eta, String? message, @JsonKey(name: 'started_at') DateTime? startedAt)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _RunState() when $default != null:
|
||||
return $default(_that.running,_that.targetId,_that.method,_that.percent,_that.eta,_that.message,_that.startedAt);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool running, @JsonKey(name: 'target_id') String targetId, BackupMethod? method, double percent, String? eta, String? message, @JsonKey(name: 'started_at') DateTime? startedAt) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _RunState():
|
||||
return $default(_that.running,_that.targetId,_that.method,_that.percent,_that.eta,_that.message,_that.startedAt);}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool running, @JsonKey(name: 'target_id') String targetId, BackupMethod? method, double percent, String? eta, String? message, @JsonKey(name: 'started_at') DateTime? startedAt)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _RunState() when $default != null:
|
||||
return $default(_that.running,_that.targetId,_that.method,_that.percent,_that.eta,_that.message,_that.startedAt);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _RunState implements RunState {
|
||||
const _RunState({this.running = false, @JsonKey(name: 'target_id') this.targetId = '', this.method, this.percent = 0, this.eta, this.message, @JsonKey(name: 'started_at') this.startedAt});
|
||||
factory _RunState.fromJson(Map<String, dynamic> json) => _$RunStateFromJson(json);
|
||||
|
||||
@override@JsonKey() final bool running;
|
||||
@override@JsonKey(name: 'target_id') final String targetId;
|
||||
@override final BackupMethod? method;
|
||||
@override@JsonKey() final double percent;
|
||||
@override final String? eta;
|
||||
@override final String? message;
|
||||
@override@JsonKey(name: 'started_at') final DateTime? startedAt;
|
||||
|
||||
/// Create a copy of RunState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$RunStateCopyWith<_RunState> get copyWith => __$RunStateCopyWithImpl<_RunState>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$RunStateToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _RunState&&(identical(other.running, running) || other.running == running)&&(identical(other.targetId, targetId) || other.targetId == targetId)&&(identical(other.method, method) || other.method == method)&&(identical(other.percent, percent) || other.percent == percent)&&(identical(other.eta, eta) || other.eta == eta)&&(identical(other.message, message) || other.message == message)&&(identical(other.startedAt, startedAt) || other.startedAt == startedAt));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,running,targetId,method,percent,eta,message,startedAt);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'RunState(running: $running, targetId: $targetId, method: $method, percent: $percent, eta: $eta, message: $message, startedAt: $startedAt)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$RunStateCopyWith<$Res> implements $RunStateCopyWith<$Res> {
|
||||
factory _$RunStateCopyWith(_RunState value, $Res Function(_RunState) _then) = __$RunStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
bool running,@JsonKey(name: 'target_id') String targetId, BackupMethod? method, double percent, String? eta, String? message,@JsonKey(name: 'started_at') DateTime? startedAt
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$RunStateCopyWithImpl<$Res>
|
||||
implements _$RunStateCopyWith<$Res> {
|
||||
__$RunStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _RunState _self;
|
||||
final $Res Function(_RunState) _then;
|
||||
|
||||
/// Create a copy of RunState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? running = null,Object? targetId = null,Object? method = freezed,Object? percent = null,Object? eta = freezed,Object? message = freezed,Object? startedAt = freezed,}) {
|
||||
return _then(_RunState(
|
||||
running: null == running ? _self.running : running // ignore: cast_nullable_to_non_nullable
|
||||
as bool,targetId: null == targetId ? _self.targetId : targetId // ignore: cast_nullable_to_non_nullable
|
||||
as String,method: freezed == method ? _self.method : method // ignore: cast_nullable_to_non_nullable
|
||||
as BackupMethod?,percent: null == percent ? _self.percent : percent // ignore: cast_nullable_to_non_nullable
|
||||
as double,eta: freezed == eta ? _self.eta : eta // ignore: cast_nullable_to_non_nullable
|
||||
as String?,message: freezed == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||
as String?,startedAt: freezed == startedAt ? _self.startedAt : startedAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,35 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'run_state.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_RunState _$RunStateFromJson(Map<String, dynamic> json) => _RunState(
|
||||
running: json['running'] as bool? ?? false,
|
||||
targetId: json['target_id'] as String? ?? '',
|
||||
method: $enumDecodeNullable(_$BackupMethodEnumMap, json['method']),
|
||||
percent: (json['percent'] as num?)?.toDouble() ?? 0,
|
||||
eta: json['eta'] as String?,
|
||||
message: json['message'] as String?,
|
||||
startedAt: json['started_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['started_at'] as String),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$RunStateToJson(_RunState instance) => <String, dynamic>{
|
||||
'running': instance.running,
|
||||
'target_id': instance.targetId,
|
||||
'method': _$BackupMethodEnumMap[instance.method],
|
||||
'percent': instance.percent,
|
||||
'eta': instance.eta,
|
||||
'message': instance.message,
|
||||
'started_at': instance.startedAt?.toIso8601String(),
|
||||
};
|
||||
|
||||
const _$BackupMethodEnumMap = {
|
||||
BackupMethod.rsync: 'rsync',
|
||||
BackupMethod.restic: 'restic',
|
||||
BackupMethod.external: 'external',
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import 'service_scan_info.dart';
|
||||
|
||||
part 'scan_result.freezed.dart';
|
||||
part 'scan_result.g.dart';
|
||||
|
||||
/// Mirrors `models.ScanResult`, returned by `POST /node/scan`.
|
||||
@freezed
|
||||
sealed class ScanResult with _$ScanResult {
|
||||
const factory ScanResult({
|
||||
@JsonKey(name: 'scanned_paths') @Default(<String>[]) List<String> scannedPaths,
|
||||
@Default(0) int found,
|
||||
@Default(<ServiceScanInfo>[]) List<ServiceScanInfo> created,
|
||||
@Default(<ServiceScanInfo>[]) List<ServiceScanInfo> updated,
|
||||
@Default(<String>[]) List<String> errors,
|
||||
}) = _ScanResult;
|
||||
|
||||
factory ScanResult.fromJson(Map<String, dynamic> json) => _$ScanResultFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,307 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'scan_result.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ScanResult {
|
||||
|
||||
@JsonKey(name: 'scanned_paths') List<String> get scannedPaths; int get found; List<ServiceScanInfo> get created; List<ServiceScanInfo> get updated; List<String> get errors;
|
||||
/// Create a copy of ScanResult
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$ScanResultCopyWith<ScanResult> get copyWith => _$ScanResultCopyWithImpl<ScanResult>(this as ScanResult, _$identity);
|
||||
|
||||
/// Serializes this ScanResult to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ScanResult&&const DeepCollectionEquality().equals(other.scannedPaths, scannedPaths)&&(identical(other.found, found) || other.found == found)&&const DeepCollectionEquality().equals(other.created, created)&&const DeepCollectionEquality().equals(other.updated, updated)&&const DeepCollectionEquality().equals(other.errors, errors));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(scannedPaths),found,const DeepCollectionEquality().hash(created),const DeepCollectionEquality().hash(updated),const DeepCollectionEquality().hash(errors));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ScanResult(scannedPaths: $scannedPaths, found: $found, created: $created, updated: $updated, errors: $errors)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $ScanResultCopyWith<$Res> {
|
||||
factory $ScanResultCopyWith(ScanResult value, $Res Function(ScanResult) _then) = _$ScanResultCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'scanned_paths') List<String> scannedPaths, int found, List<ServiceScanInfo> created, List<ServiceScanInfo> updated, List<String> errors
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$ScanResultCopyWithImpl<$Res>
|
||||
implements $ScanResultCopyWith<$Res> {
|
||||
_$ScanResultCopyWithImpl(this._self, this._then);
|
||||
|
||||
final ScanResult _self;
|
||||
final $Res Function(ScanResult) _then;
|
||||
|
||||
/// Create a copy of ScanResult
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? scannedPaths = null,Object? found = null,Object? created = null,Object? updated = null,Object? errors = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
scannedPaths: null == scannedPaths ? _self.scannedPaths : scannedPaths // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,found: null == found ? _self.found : found // ignore: cast_nullable_to_non_nullable
|
||||
as int,created: null == created ? _self.created : created // ignore: cast_nullable_to_non_nullable
|
||||
as List<ServiceScanInfo>,updated: null == updated ? _self.updated : updated // ignore: cast_nullable_to_non_nullable
|
||||
as List<ServiceScanInfo>,errors: null == errors ? _self.errors : errors // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [ScanResult].
|
||||
extension ScanResultPatterns on ScanResult {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _ScanResult value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ScanResult() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _ScanResult value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ScanResult():
|
||||
return $default(_that);}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _ScanResult value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ScanResult() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function(@JsonKey(name: 'scanned_paths') List<String> scannedPaths, int found, List<ServiceScanInfo> created, List<ServiceScanInfo> updated, List<String> errors)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ScanResult() when $default != null:
|
||||
return $default(_that.scannedPaths,_that.found,_that.created,_that.updated,_that.errors);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function(@JsonKey(name: 'scanned_paths') List<String> scannedPaths, int found, List<ServiceScanInfo> created, List<ServiceScanInfo> updated, List<String> errors) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ScanResult():
|
||||
return $default(_that.scannedPaths,_that.found,_that.created,_that.updated,_that.errors);}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function(@JsonKey(name: 'scanned_paths') List<String> scannedPaths, int found, List<ServiceScanInfo> created, List<ServiceScanInfo> updated, List<String> errors)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ScanResult() when $default != null:
|
||||
return $default(_that.scannedPaths,_that.found,_that.created,_that.updated,_that.errors);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _ScanResult implements ScanResult {
|
||||
const _ScanResult({@JsonKey(name: 'scanned_paths') final List<String> scannedPaths = const <String>[], this.found = 0, final List<ServiceScanInfo> created = const <ServiceScanInfo>[], final List<ServiceScanInfo> updated = const <ServiceScanInfo>[], final List<String> errors = const <String>[]}): _scannedPaths = scannedPaths,_created = created,_updated = updated,_errors = errors;
|
||||
factory _ScanResult.fromJson(Map<String, dynamic> json) => _$ScanResultFromJson(json);
|
||||
|
||||
final List<String> _scannedPaths;
|
||||
@override@JsonKey(name: 'scanned_paths') List<String> get scannedPaths {
|
||||
if (_scannedPaths is EqualUnmodifiableListView) return _scannedPaths;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_scannedPaths);
|
||||
}
|
||||
|
||||
@override@JsonKey() final int found;
|
||||
final List<ServiceScanInfo> _created;
|
||||
@override@JsonKey() List<ServiceScanInfo> get created {
|
||||
if (_created is EqualUnmodifiableListView) return _created;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_created);
|
||||
}
|
||||
|
||||
final List<ServiceScanInfo> _updated;
|
||||
@override@JsonKey() List<ServiceScanInfo> get updated {
|
||||
if (_updated is EqualUnmodifiableListView) return _updated;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_updated);
|
||||
}
|
||||
|
||||
final List<String> _errors;
|
||||
@override@JsonKey() List<String> get errors {
|
||||
if (_errors is EqualUnmodifiableListView) return _errors;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_errors);
|
||||
}
|
||||
|
||||
|
||||
/// Create a copy of ScanResult
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$ScanResultCopyWith<_ScanResult> get copyWith => __$ScanResultCopyWithImpl<_ScanResult>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$ScanResultToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ScanResult&&const DeepCollectionEquality().equals(other._scannedPaths, _scannedPaths)&&(identical(other.found, found) || other.found == found)&&const DeepCollectionEquality().equals(other._created, _created)&&const DeepCollectionEquality().equals(other._updated, _updated)&&const DeepCollectionEquality().equals(other._errors, _errors));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_scannedPaths),found,const DeepCollectionEquality().hash(_created),const DeepCollectionEquality().hash(_updated),const DeepCollectionEquality().hash(_errors));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ScanResult(scannedPaths: $scannedPaths, found: $found, created: $created, updated: $updated, errors: $errors)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$ScanResultCopyWith<$Res> implements $ScanResultCopyWith<$Res> {
|
||||
factory _$ScanResultCopyWith(_ScanResult value, $Res Function(_ScanResult) _then) = __$ScanResultCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'scanned_paths') List<String> scannedPaths, int found, List<ServiceScanInfo> created, List<ServiceScanInfo> updated, List<String> errors
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$ScanResultCopyWithImpl<$Res>
|
||||
implements _$ScanResultCopyWith<$Res> {
|
||||
__$ScanResultCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _ScanResult _self;
|
||||
final $Res Function(_ScanResult) _then;
|
||||
|
||||
/// Create a copy of ScanResult
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? scannedPaths = null,Object? found = null,Object? created = null,Object? updated = null,Object? errors = null,}) {
|
||||
return _then(_ScanResult(
|
||||
scannedPaths: null == scannedPaths ? _self._scannedPaths : scannedPaths // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,found: null == found ? _self.found : found // ignore: cast_nullable_to_non_nullable
|
||||
as int,created: null == created ? _self._created : created // ignore: cast_nullable_to_non_nullable
|
||||
as List<ServiceScanInfo>,updated: null == updated ? _self._updated : updated // ignore: cast_nullable_to_non_nullable
|
||||
as List<ServiceScanInfo>,errors: null == errors ? _self._errors : errors // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,38 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'scan_result.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_ScanResult _$ScanResultFromJson(Map<String, dynamic> json) => _ScanResult(
|
||||
scannedPaths:
|
||||
(json['scanned_paths'] as List<dynamic>?)
|
||||
?.map((e) => e as String)
|
||||
.toList() ??
|
||||
const <String>[],
|
||||
found: (json['found'] as num?)?.toInt() ?? 0,
|
||||
created:
|
||||
(json['created'] as List<dynamic>?)
|
||||
?.map((e) => ServiceScanInfo.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
const <ServiceScanInfo>[],
|
||||
updated:
|
||||
(json['updated'] as List<dynamic>?)
|
||||
?.map((e) => ServiceScanInfo.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
const <ServiceScanInfo>[],
|
||||
errors:
|
||||
(json['errors'] as List<dynamic>?)?.map((e) => e as String).toList() ??
|
||||
const <String>[],
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ScanResultToJson(_ScanResult instance) =>
|
||||
<String, dynamic>{
|
||||
'scanned_paths': instance.scannedPaths,
|
||||
'found': instance.found,
|
||||
'created': instance.created.map((e) => e.toJson()).toList(),
|
||||
'updated': instance.updated.map((e) => e.toJson()).toList(),
|
||||
'errors': instance.errors,
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import 'backup_config.dart';
|
||||
|
||||
part 'service.freezed.dart';
|
||||
part 'service.g.dart';
|
||||
|
||||
/// Mirrors `models.Service` — a compose-based service on this host.
|
||||
/// `status` is one of "up" / "down" / "unknown" (untyped string on the Go
|
||||
/// side); kept as a raw string here too and mapped to [Severity] at the
|
||||
/// widget boundary rather than modeled as a closed enum, since the server
|
||||
/// can emit values this client doesn't yet know about.
|
||||
@freezed
|
||||
sealed class Service with _$Service {
|
||||
const factory Service({
|
||||
@Default('') String id,
|
||||
required String name,
|
||||
@JsonKey(name: 'compose_file') required String composeFile,
|
||||
@JsonKey(name: 'compose_type') String? composeType,
|
||||
@JsonKey(name: 'backup_folder') String? backupFolder,
|
||||
@Default('unknown') String status,
|
||||
@JsonKey(name: 'stop_on_backup') @Default(false) bool stopOnBackup,
|
||||
@JsonKey(name: 'external_backup_stop_minutes') @Default(0) int externalBackupStopMinutes,
|
||||
@JsonKey(name: 'external_backup_start_minutes') @Default(0) int externalBackupStartMinutes,
|
||||
BackupConfig? backup,
|
||||
}) = _Service;
|
||||
|
||||
factory Service.fromJson(Map<String, dynamic> json) => _$ServiceFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,322 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'service.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$Service {
|
||||
|
||||
String get id; String get name;@JsonKey(name: 'compose_file') String get composeFile;@JsonKey(name: 'compose_type') String? get composeType;@JsonKey(name: 'backup_folder') String? get backupFolder; String get status;@JsonKey(name: 'stop_on_backup') bool get stopOnBackup;@JsonKey(name: 'external_backup_stop_minutes') int get externalBackupStopMinutes;@JsonKey(name: 'external_backup_start_minutes') int get externalBackupStartMinutes; BackupConfig? get backup;
|
||||
/// Create a copy of Service
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$ServiceCopyWith<Service> get copyWith => _$ServiceCopyWithImpl<Service>(this as Service, _$identity);
|
||||
|
||||
/// Serializes this Service to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is Service&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.composeFile, composeFile) || other.composeFile == composeFile)&&(identical(other.composeType, composeType) || other.composeType == composeType)&&(identical(other.backupFolder, backupFolder) || other.backupFolder == backupFolder)&&(identical(other.status, status) || other.status == status)&&(identical(other.stopOnBackup, stopOnBackup) || other.stopOnBackup == stopOnBackup)&&(identical(other.externalBackupStopMinutes, externalBackupStopMinutes) || other.externalBackupStopMinutes == externalBackupStopMinutes)&&(identical(other.externalBackupStartMinutes, externalBackupStartMinutes) || other.externalBackupStartMinutes == externalBackupStartMinutes)&&(identical(other.backup, backup) || other.backup == backup));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,name,composeFile,composeType,backupFolder,status,stopOnBackup,externalBackupStopMinutes,externalBackupStartMinutes,backup);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Service(id: $id, name: $name, composeFile: $composeFile, composeType: $composeType, backupFolder: $backupFolder, status: $status, stopOnBackup: $stopOnBackup, externalBackupStopMinutes: $externalBackupStopMinutes, externalBackupStartMinutes: $externalBackupStartMinutes, backup: $backup)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $ServiceCopyWith<$Res> {
|
||||
factory $ServiceCopyWith(Service value, $Res Function(Service) _then) = _$ServiceCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String id, String name,@JsonKey(name: 'compose_file') String composeFile,@JsonKey(name: 'compose_type') String? composeType,@JsonKey(name: 'backup_folder') String? backupFolder, String status,@JsonKey(name: 'stop_on_backup') bool stopOnBackup,@JsonKey(name: 'external_backup_stop_minutes') int externalBackupStopMinutes,@JsonKey(name: 'external_backup_start_minutes') int externalBackupStartMinutes, BackupConfig? backup
|
||||
});
|
||||
|
||||
|
||||
$BackupConfigCopyWith<$Res>? get backup;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$ServiceCopyWithImpl<$Res>
|
||||
implements $ServiceCopyWith<$Res> {
|
||||
_$ServiceCopyWithImpl(this._self, this._then);
|
||||
|
||||
final Service _self;
|
||||
final $Res Function(Service) _then;
|
||||
|
||||
/// Create a copy of Service
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? name = null,Object? composeFile = null,Object? composeType = freezed,Object? backupFolder = freezed,Object? status = null,Object? stopOnBackup = null,Object? externalBackupStopMinutes = null,Object? externalBackupStartMinutes = null,Object? backup = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String,composeFile: null == composeFile ? _self.composeFile : composeFile // ignore: cast_nullable_to_non_nullable
|
||||
as String,composeType: freezed == composeType ? _self.composeType : composeType // ignore: cast_nullable_to_non_nullable
|
||||
as String?,backupFolder: freezed == backupFolder ? _self.backupFolder : backupFolder // ignore: cast_nullable_to_non_nullable
|
||||
as String?,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as String,stopOnBackup: null == stopOnBackup ? _self.stopOnBackup : stopOnBackup // ignore: cast_nullable_to_non_nullable
|
||||
as bool,externalBackupStopMinutes: null == externalBackupStopMinutes ? _self.externalBackupStopMinutes : externalBackupStopMinutes // ignore: cast_nullable_to_non_nullable
|
||||
as int,externalBackupStartMinutes: null == externalBackupStartMinutes ? _self.externalBackupStartMinutes : externalBackupStartMinutes // ignore: cast_nullable_to_non_nullable
|
||||
as int,backup: freezed == backup ? _self.backup : backup // ignore: cast_nullable_to_non_nullable
|
||||
as BackupConfig?,
|
||||
));
|
||||
}
|
||||
/// Create a copy of Service
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$BackupConfigCopyWith<$Res>? get backup {
|
||||
if (_self.backup == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $BackupConfigCopyWith<$Res>(_self.backup!, (value) {
|
||||
return _then(_self.copyWith(backup: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [Service].
|
||||
extension ServicePatterns on Service {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _Service value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Service() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _Service value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Service():
|
||||
return $default(_that);}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _Service value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Service() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String name, @JsonKey(name: 'compose_file') String composeFile, @JsonKey(name: 'compose_type') String? composeType, @JsonKey(name: 'backup_folder') String? backupFolder, String status, @JsonKey(name: 'stop_on_backup') bool stopOnBackup, @JsonKey(name: 'external_backup_stop_minutes') int externalBackupStopMinutes, @JsonKey(name: 'external_backup_start_minutes') int externalBackupStartMinutes, BackupConfig? backup)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Service() when $default != null:
|
||||
return $default(_that.id,_that.name,_that.composeFile,_that.composeType,_that.backupFolder,_that.status,_that.stopOnBackup,_that.externalBackupStopMinutes,_that.externalBackupStartMinutes,_that.backup);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String name, @JsonKey(name: 'compose_file') String composeFile, @JsonKey(name: 'compose_type') String? composeType, @JsonKey(name: 'backup_folder') String? backupFolder, String status, @JsonKey(name: 'stop_on_backup') bool stopOnBackup, @JsonKey(name: 'external_backup_stop_minutes') int externalBackupStopMinutes, @JsonKey(name: 'external_backup_start_minutes') int externalBackupStartMinutes, BackupConfig? backup) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Service():
|
||||
return $default(_that.id,_that.name,_that.composeFile,_that.composeType,_that.backupFolder,_that.status,_that.stopOnBackup,_that.externalBackupStopMinutes,_that.externalBackupStartMinutes,_that.backup);}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String name, @JsonKey(name: 'compose_file') String composeFile, @JsonKey(name: 'compose_type') String? composeType, @JsonKey(name: 'backup_folder') String? backupFolder, String status, @JsonKey(name: 'stop_on_backup') bool stopOnBackup, @JsonKey(name: 'external_backup_stop_minutes') int externalBackupStopMinutes, @JsonKey(name: 'external_backup_start_minutes') int externalBackupStartMinutes, BackupConfig? backup)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Service() when $default != null:
|
||||
return $default(_that.id,_that.name,_that.composeFile,_that.composeType,_that.backupFolder,_that.status,_that.stopOnBackup,_that.externalBackupStopMinutes,_that.externalBackupStartMinutes,_that.backup);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _Service implements Service {
|
||||
const _Service({this.id = '', required this.name, @JsonKey(name: 'compose_file') required this.composeFile, @JsonKey(name: 'compose_type') this.composeType, @JsonKey(name: 'backup_folder') this.backupFolder, this.status = 'unknown', @JsonKey(name: 'stop_on_backup') this.stopOnBackup = false, @JsonKey(name: 'external_backup_stop_minutes') this.externalBackupStopMinutes = 0, @JsonKey(name: 'external_backup_start_minutes') this.externalBackupStartMinutes = 0, this.backup});
|
||||
factory _Service.fromJson(Map<String, dynamic> json) => _$ServiceFromJson(json);
|
||||
|
||||
@override@JsonKey() final String id;
|
||||
@override final String name;
|
||||
@override@JsonKey(name: 'compose_file') final String composeFile;
|
||||
@override@JsonKey(name: 'compose_type') final String? composeType;
|
||||
@override@JsonKey(name: 'backup_folder') final String? backupFolder;
|
||||
@override@JsonKey() final String status;
|
||||
@override@JsonKey(name: 'stop_on_backup') final bool stopOnBackup;
|
||||
@override@JsonKey(name: 'external_backup_stop_minutes') final int externalBackupStopMinutes;
|
||||
@override@JsonKey(name: 'external_backup_start_minutes') final int externalBackupStartMinutes;
|
||||
@override final BackupConfig? backup;
|
||||
|
||||
/// Create a copy of Service
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$ServiceCopyWith<_Service> get copyWith => __$ServiceCopyWithImpl<_Service>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$ServiceToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Service&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.composeFile, composeFile) || other.composeFile == composeFile)&&(identical(other.composeType, composeType) || other.composeType == composeType)&&(identical(other.backupFolder, backupFolder) || other.backupFolder == backupFolder)&&(identical(other.status, status) || other.status == status)&&(identical(other.stopOnBackup, stopOnBackup) || other.stopOnBackup == stopOnBackup)&&(identical(other.externalBackupStopMinutes, externalBackupStopMinutes) || other.externalBackupStopMinutes == externalBackupStopMinutes)&&(identical(other.externalBackupStartMinutes, externalBackupStartMinutes) || other.externalBackupStartMinutes == externalBackupStartMinutes)&&(identical(other.backup, backup) || other.backup == backup));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,name,composeFile,composeType,backupFolder,status,stopOnBackup,externalBackupStopMinutes,externalBackupStartMinutes,backup);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Service(id: $id, name: $name, composeFile: $composeFile, composeType: $composeType, backupFolder: $backupFolder, status: $status, stopOnBackup: $stopOnBackup, externalBackupStopMinutes: $externalBackupStopMinutes, externalBackupStartMinutes: $externalBackupStartMinutes, backup: $backup)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$ServiceCopyWith<$Res> implements $ServiceCopyWith<$Res> {
|
||||
factory _$ServiceCopyWith(_Service value, $Res Function(_Service) _then) = __$ServiceCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String id, String name,@JsonKey(name: 'compose_file') String composeFile,@JsonKey(name: 'compose_type') String? composeType,@JsonKey(name: 'backup_folder') String? backupFolder, String status,@JsonKey(name: 'stop_on_backup') bool stopOnBackup,@JsonKey(name: 'external_backup_stop_minutes') int externalBackupStopMinutes,@JsonKey(name: 'external_backup_start_minutes') int externalBackupStartMinutes, BackupConfig? backup
|
||||
});
|
||||
|
||||
|
||||
@override $BackupConfigCopyWith<$Res>? get backup;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$ServiceCopyWithImpl<$Res>
|
||||
implements _$ServiceCopyWith<$Res> {
|
||||
__$ServiceCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _Service _self;
|
||||
final $Res Function(_Service) _then;
|
||||
|
||||
/// Create a copy of Service
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? name = null,Object? composeFile = null,Object? composeType = freezed,Object? backupFolder = freezed,Object? status = null,Object? stopOnBackup = null,Object? externalBackupStopMinutes = null,Object? externalBackupStartMinutes = null,Object? backup = freezed,}) {
|
||||
return _then(_Service(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String,composeFile: null == composeFile ? _self.composeFile : composeFile // ignore: cast_nullable_to_non_nullable
|
||||
as String,composeType: freezed == composeType ? _self.composeType : composeType // ignore: cast_nullable_to_non_nullable
|
||||
as String?,backupFolder: freezed == backupFolder ? _self.backupFolder : backupFolder // ignore: cast_nullable_to_non_nullable
|
||||
as String?,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as String,stopOnBackup: null == stopOnBackup ? _self.stopOnBackup : stopOnBackup // ignore: cast_nullable_to_non_nullable
|
||||
as bool,externalBackupStopMinutes: null == externalBackupStopMinutes ? _self.externalBackupStopMinutes : externalBackupStopMinutes // ignore: cast_nullable_to_non_nullable
|
||||
as int,externalBackupStartMinutes: null == externalBackupStartMinutes ? _self.externalBackupStartMinutes : externalBackupStartMinutes // ignore: cast_nullable_to_non_nullable
|
||||
as int,backup: freezed == backup ? _self.backup : backup // ignore: cast_nullable_to_non_nullable
|
||||
as BackupConfig?,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of Service
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$BackupConfigCopyWith<$Res>? get backup {
|
||||
if (_self.backup == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $BackupConfigCopyWith<$Res>(_self.backup!, (value) {
|
||||
return _then(_self.copyWith(backup: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,37 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'service.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_Service _$ServiceFromJson(Map<String, dynamic> json) => _Service(
|
||||
id: json['id'] as String? ?? '',
|
||||
name: json['name'] as String,
|
||||
composeFile: json['compose_file'] as String,
|
||||
composeType: json['compose_type'] as String?,
|
||||
backupFolder: json['backup_folder'] as String?,
|
||||
status: json['status'] as String? ?? 'unknown',
|
||||
stopOnBackup: json['stop_on_backup'] as bool? ?? false,
|
||||
externalBackupStopMinutes:
|
||||
(json['external_backup_stop_minutes'] as num?)?.toInt() ?? 0,
|
||||
externalBackupStartMinutes:
|
||||
(json['external_backup_start_minutes'] as num?)?.toInt() ?? 0,
|
||||
backup: json['backup'] == null
|
||||
? null
|
||||
: BackupConfig.fromJson(json['backup'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ServiceToJson(_Service instance) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
'compose_file': instance.composeFile,
|
||||
'compose_type': instance.composeType,
|
||||
'backup_folder': instance.backupFolder,
|
||||
'status': instance.status,
|
||||
'stop_on_backup': instance.stopOnBackup,
|
||||
'external_backup_stop_minutes': instance.externalBackupStopMinutes,
|
||||
'external_backup_start_minutes': instance.externalBackupStartMinutes,
|
||||
'backup': instance.backup?.toJson(),
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'service_scan_info.freezed.dart';
|
||||
part 'service_scan_info.g.dart';
|
||||
|
||||
/// Mirrors `models.ServiceScanInfo` — one entry in a [ScanResult]'s
|
||||
/// `created`/`updated` lists.
|
||||
@freezed
|
||||
sealed class ServiceScanInfo with _$ServiceScanInfo {
|
||||
const factory ServiceScanInfo({
|
||||
required String name,
|
||||
@JsonKey(name: 'compose_file') required String composeFile,
|
||||
@JsonKey(name: 'backup_folder') String? backupFolder,
|
||||
@Default('unknown') String status,
|
||||
}) = _ServiceScanInfo;
|
||||
|
||||
factory ServiceScanInfo.fromJson(Map<String, dynamic> json) => _$ServiceScanInfoFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,280 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'service_scan_info.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ServiceScanInfo {
|
||||
|
||||
String get name;@JsonKey(name: 'compose_file') String get composeFile;@JsonKey(name: 'backup_folder') String? get backupFolder; String get status;
|
||||
/// Create a copy of ServiceScanInfo
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$ServiceScanInfoCopyWith<ServiceScanInfo> get copyWith => _$ServiceScanInfoCopyWithImpl<ServiceScanInfo>(this as ServiceScanInfo, _$identity);
|
||||
|
||||
/// Serializes this ServiceScanInfo to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ServiceScanInfo&&(identical(other.name, name) || other.name == name)&&(identical(other.composeFile, composeFile) || other.composeFile == composeFile)&&(identical(other.backupFolder, backupFolder) || other.backupFolder == backupFolder)&&(identical(other.status, status) || other.status == status));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,name,composeFile,backupFolder,status);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ServiceScanInfo(name: $name, composeFile: $composeFile, backupFolder: $backupFolder, status: $status)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $ServiceScanInfoCopyWith<$Res> {
|
||||
factory $ServiceScanInfoCopyWith(ServiceScanInfo value, $Res Function(ServiceScanInfo) _then) = _$ServiceScanInfoCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String name,@JsonKey(name: 'compose_file') String composeFile,@JsonKey(name: 'backup_folder') String? backupFolder, String status
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$ServiceScanInfoCopyWithImpl<$Res>
|
||||
implements $ServiceScanInfoCopyWith<$Res> {
|
||||
_$ServiceScanInfoCopyWithImpl(this._self, this._then);
|
||||
|
||||
final ServiceScanInfo _self;
|
||||
final $Res Function(ServiceScanInfo) _then;
|
||||
|
||||
/// Create a copy of ServiceScanInfo
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? name = null,Object? composeFile = null,Object? backupFolder = freezed,Object? status = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String,composeFile: null == composeFile ? _self.composeFile : composeFile // ignore: cast_nullable_to_non_nullable
|
||||
as String,backupFolder: freezed == backupFolder ? _self.backupFolder : backupFolder // ignore: cast_nullable_to_non_nullable
|
||||
as String?,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [ServiceScanInfo].
|
||||
extension ServiceScanInfoPatterns on ServiceScanInfo {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _ServiceScanInfo value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ServiceScanInfo() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _ServiceScanInfo value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ServiceScanInfo():
|
||||
return $default(_that);}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _ServiceScanInfo value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ServiceScanInfo() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String name, @JsonKey(name: 'compose_file') String composeFile, @JsonKey(name: 'backup_folder') String? backupFolder, String status)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ServiceScanInfo() when $default != null:
|
||||
return $default(_that.name,_that.composeFile,_that.backupFolder,_that.status);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String name, @JsonKey(name: 'compose_file') String composeFile, @JsonKey(name: 'backup_folder') String? backupFolder, String status) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ServiceScanInfo():
|
||||
return $default(_that.name,_that.composeFile,_that.backupFolder,_that.status);}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String name, @JsonKey(name: 'compose_file') String composeFile, @JsonKey(name: 'backup_folder') String? backupFolder, String status)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ServiceScanInfo() when $default != null:
|
||||
return $default(_that.name,_that.composeFile,_that.backupFolder,_that.status);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _ServiceScanInfo implements ServiceScanInfo {
|
||||
const _ServiceScanInfo({required this.name, @JsonKey(name: 'compose_file') required this.composeFile, @JsonKey(name: 'backup_folder') this.backupFolder, this.status = 'unknown'});
|
||||
factory _ServiceScanInfo.fromJson(Map<String, dynamic> json) => _$ServiceScanInfoFromJson(json);
|
||||
|
||||
@override final String name;
|
||||
@override@JsonKey(name: 'compose_file') final String composeFile;
|
||||
@override@JsonKey(name: 'backup_folder') final String? backupFolder;
|
||||
@override@JsonKey() final String status;
|
||||
|
||||
/// Create a copy of ServiceScanInfo
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$ServiceScanInfoCopyWith<_ServiceScanInfo> get copyWith => __$ServiceScanInfoCopyWithImpl<_ServiceScanInfo>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$ServiceScanInfoToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ServiceScanInfo&&(identical(other.name, name) || other.name == name)&&(identical(other.composeFile, composeFile) || other.composeFile == composeFile)&&(identical(other.backupFolder, backupFolder) || other.backupFolder == backupFolder)&&(identical(other.status, status) || other.status == status));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,name,composeFile,backupFolder,status);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ServiceScanInfo(name: $name, composeFile: $composeFile, backupFolder: $backupFolder, status: $status)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$ServiceScanInfoCopyWith<$Res> implements $ServiceScanInfoCopyWith<$Res> {
|
||||
factory _$ServiceScanInfoCopyWith(_ServiceScanInfo value, $Res Function(_ServiceScanInfo) _then) = __$ServiceScanInfoCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String name,@JsonKey(name: 'compose_file') String composeFile,@JsonKey(name: 'backup_folder') String? backupFolder, String status
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$ServiceScanInfoCopyWithImpl<$Res>
|
||||
implements _$ServiceScanInfoCopyWith<$Res> {
|
||||
__$ServiceScanInfoCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _ServiceScanInfo _self;
|
||||
final $Res Function(_ServiceScanInfo) _then;
|
||||
|
||||
/// Create a copy of ServiceScanInfo
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? name = null,Object? composeFile = null,Object? backupFolder = freezed,Object? status = null,}) {
|
||||
return _then(_ServiceScanInfo(
|
||||
name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String,composeFile: null == composeFile ? _self.composeFile : composeFile // ignore: cast_nullable_to_non_nullable
|
||||
as String,backupFolder: freezed == backupFolder ? _self.backupFolder : backupFolder // ignore: cast_nullable_to_non_nullable
|
||||
as String?,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,23 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'service_scan_info.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_ServiceScanInfo _$ServiceScanInfoFromJson(Map<String, dynamic> json) =>
|
||||
_ServiceScanInfo(
|
||||
name: json['name'] as String,
|
||||
composeFile: json['compose_file'] as String,
|
||||
backupFolder: json['backup_folder'] as String?,
|
||||
status: json['status'] as String? ?? 'unknown',
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ServiceScanInfoToJson(_ServiceScanInfo instance) =>
|
||||
<String, dynamic>{
|
||||
'name': instance.name,
|
||||
'compose_file': instance.composeFile,
|
||||
'backup_folder': instance.backupFolder,
|
||||
'status': instance.status,
|
||||
};
|
||||
@@ -0,0 +1,16 @@
|
||||
import '../theme/status_colors.dart';
|
||||
|
||||
/// Maps the API's untyped status strings to a [Severity] for [StatusPill]
|
||||
/// rendering. Centralized here (not per-screen) since `Service.status` is
|
||||
/// rendered on both the Services table and Fleet's aggregated card grid.
|
||||
Severity severityForServiceStatus(String status) => switch (status) {
|
||||
'up' => Severity.good,
|
||||
'down' => Severity.critical,
|
||||
_ => Severity.warning, // "unknown" or anything this client doesn't recognize yet
|
||||
};
|
||||
|
||||
/// Maps a backup/update execution's `success` flag to a [Severity].
|
||||
Severity severityForSuccess(bool success) => success ? Severity.good : Severity.critical;
|
||||
|
||||
/// Maps a [RemoteNode.status]/reachability signal to a [Severity].
|
||||
Severity severityForNodeReachable(bool reachable) => reachable ? Severity.good : Severity.critical;
|
||||
@@ -0,0 +1,18 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'update_record.freezed.dart';
|
||||
part 'update_record.g.dart';
|
||||
|
||||
/// Mirrors `models.UpdateRecord` — an OS package update log entry.
|
||||
@freezed
|
||||
sealed class UpdateRecord with _$UpdateRecord {
|
||||
const factory UpdateRecord({
|
||||
@Default('') String id,
|
||||
required DateTime timestamp,
|
||||
required bool success,
|
||||
@Default(<String>[]) List<String> packages,
|
||||
@Default('') String message,
|
||||
}) = _UpdateRecord;
|
||||
|
||||
factory UpdateRecord.fromJson(Map<String, dynamic> json) => _$UpdateRecordFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,289 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'update_record.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$UpdateRecord {
|
||||
|
||||
String get id; DateTime get timestamp; bool get success; List<String> get packages; String get message;
|
||||
/// Create a copy of UpdateRecord
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$UpdateRecordCopyWith<UpdateRecord> get copyWith => _$UpdateRecordCopyWithImpl<UpdateRecord>(this as UpdateRecord, _$identity);
|
||||
|
||||
/// Serializes this UpdateRecord to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is UpdateRecord&&(identical(other.id, id) || other.id == id)&&(identical(other.timestamp, timestamp) || other.timestamp == timestamp)&&(identical(other.success, success) || other.success == success)&&const DeepCollectionEquality().equals(other.packages, packages)&&(identical(other.message, message) || other.message == message));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,timestamp,success,const DeepCollectionEquality().hash(packages),message);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UpdateRecord(id: $id, timestamp: $timestamp, success: $success, packages: $packages, message: $message)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $UpdateRecordCopyWith<$Res> {
|
||||
factory $UpdateRecordCopyWith(UpdateRecord value, $Res Function(UpdateRecord) _then) = _$UpdateRecordCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String id, DateTime timestamp, bool success, List<String> packages, String message
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$UpdateRecordCopyWithImpl<$Res>
|
||||
implements $UpdateRecordCopyWith<$Res> {
|
||||
_$UpdateRecordCopyWithImpl(this._self, this._then);
|
||||
|
||||
final UpdateRecord _self;
|
||||
final $Res Function(UpdateRecord) _then;
|
||||
|
||||
/// Create a copy of UpdateRecord
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? timestamp = null,Object? success = null,Object? packages = null,Object? message = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,timestamp: null == timestamp ? _self.timestamp : timestamp // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,success: null == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
|
||||
as bool,packages: null == packages ? _self.packages : packages // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [UpdateRecord].
|
||||
extension UpdateRecordPatterns on UpdateRecord {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _UpdateRecord value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateRecord() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _UpdateRecord value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateRecord():
|
||||
return $default(_that);}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _UpdateRecord value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateRecord() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, DateTime timestamp, bool success, List<String> packages, String message)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateRecord() when $default != null:
|
||||
return $default(_that.id,_that.timestamp,_that.success,_that.packages,_that.message);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, DateTime timestamp, bool success, List<String> packages, String message) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateRecord():
|
||||
return $default(_that.id,_that.timestamp,_that.success,_that.packages,_that.message);}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, DateTime timestamp, bool success, List<String> packages, String message)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateRecord() when $default != null:
|
||||
return $default(_that.id,_that.timestamp,_that.success,_that.packages,_that.message);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _UpdateRecord implements UpdateRecord {
|
||||
const _UpdateRecord({this.id = '', required this.timestamp, required this.success, final List<String> packages = const <String>[], this.message = ''}): _packages = packages;
|
||||
factory _UpdateRecord.fromJson(Map<String, dynamic> json) => _$UpdateRecordFromJson(json);
|
||||
|
||||
@override@JsonKey() final String id;
|
||||
@override final DateTime timestamp;
|
||||
@override final bool success;
|
||||
final List<String> _packages;
|
||||
@override@JsonKey() List<String> get packages {
|
||||
if (_packages is EqualUnmodifiableListView) return _packages;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_packages);
|
||||
}
|
||||
|
||||
@override@JsonKey() final String message;
|
||||
|
||||
/// Create a copy of UpdateRecord
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$UpdateRecordCopyWith<_UpdateRecord> get copyWith => __$UpdateRecordCopyWithImpl<_UpdateRecord>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$UpdateRecordToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _UpdateRecord&&(identical(other.id, id) || other.id == id)&&(identical(other.timestamp, timestamp) || other.timestamp == timestamp)&&(identical(other.success, success) || other.success == success)&&const DeepCollectionEquality().equals(other._packages, _packages)&&(identical(other.message, message) || other.message == message));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,timestamp,success,const DeepCollectionEquality().hash(_packages),message);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UpdateRecord(id: $id, timestamp: $timestamp, success: $success, packages: $packages, message: $message)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$UpdateRecordCopyWith<$Res> implements $UpdateRecordCopyWith<$Res> {
|
||||
factory _$UpdateRecordCopyWith(_UpdateRecord value, $Res Function(_UpdateRecord) _then) = __$UpdateRecordCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String id, DateTime timestamp, bool success, List<String> packages, String message
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$UpdateRecordCopyWithImpl<$Res>
|
||||
implements _$UpdateRecordCopyWith<$Res> {
|
||||
__$UpdateRecordCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _UpdateRecord _self;
|
||||
final $Res Function(_UpdateRecord) _then;
|
||||
|
||||
/// Create a copy of UpdateRecord
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? timestamp = null,Object? success = null,Object? packages = null,Object? message = null,}) {
|
||||
return _then(_UpdateRecord(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,timestamp: null == timestamp ? _self.timestamp : timestamp // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,success: null == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
|
||||
as bool,packages: null == packages ? _self._packages : packages // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,29 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'update_record.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_UpdateRecord _$UpdateRecordFromJson(Map<String, dynamic> json) =>
|
||||
_UpdateRecord(
|
||||
id: json['id'] as String? ?? '',
|
||||
timestamp: DateTime.parse(json['timestamp'] as String),
|
||||
success: json['success'] as bool,
|
||||
packages:
|
||||
(json['packages'] as List<dynamic>?)
|
||||
?.map((e) => e as String)
|
||||
.toList() ??
|
||||
const <String>[],
|
||||
message: json['message'] as String? ?? '',
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$UpdateRecordToJson(_UpdateRecord instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'timestamp': instance.timestamp.toIso8601String(),
|
||||
'success': instance.success,
|
||||
'packages': instance.packages,
|
||||
'message': instance.message,
|
||||
};
|
||||
Reference in New Issue
Block a user