agentHeartbeat method
The fake's heartbeat of agentId (09 4.8): changes the reported values that are given
and stamps last_heartbeat_at.
A null reportedBillingMode leaves the reported mode as it is; clearReported removes it
(an adapter that follows the configured mode per run, 10 8).
Implementation
void agentHeartbeat(
String agentId, {
String? reportedBillingMode,
List<String>? billingModesSupported,
String? keyType,
String? state,
bool clearReported = false,
}) {
final a = agentOf(agentId)!;
if (clearReported) a.reportedBillingMode = null;
if (reportedBillingMode != null) {
a.reportedBillingMode = reportedBillingMode;
}
if (billingModesSupported != null) {
a.billingModesSupported = List.of(billingModesSupported);
}
if (keyType != null) a.keyType = keyType;
if (state != null) a.state = state;
a.mismatchAtHeartbeat =
a.reportedBillingMode != null && a.reportedBillingMode != a.billingMode;
a.lastHeartbeatAt = stamp();
}