26 lines
960 B
Dart
26 lines
960 B
Dart
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);
|
||
|
|
}
|