pub enum AccountBudget {
Unknown {
spend_billed: bool,
},
Subscription {
five_hour_util: Option<f64>,
seven_day_util: Option<f64>,
resets_at: Option<SystemTime>,
},
Api {
daily: f64,
weekly: f64,
monthly: f64,
},
}Expand description
What an account has left, in the terms its backend bills in.
A view over a UsageSnapshot, deliberately not part of it: the
snapshot is persisted and this is not, so the stored type stays a
struct and serde keeps decoding every cached row.
Variants§
Unknown
No usable snapshot: none has landed yet, or the cached one was
written under a different provider and no longer describes
this account.
spend_billed carries the account’s billing model anyway, so
unknown figures are named in the account’s own terms rather
than as windows an API account has none of.
Subscription
Plan windows, as percentages of an allowance that resets. Each
column is None when the snapshot carried no window for it -
the lenient mapper documents three states where that happens,
and the strict one requires only the five-hour window, so a
present snapshot is not a promise of a present figure.
Fields
seven_day_util: Option<f64>Binding 7-day utilization: max across the three 7-day
windows, or None when all three are absent.
resets_at: Option<SystemTime>When the account unlocks - Some only while it is at its
cap, so a capped account’s row can show a reset ETA.
Api
Per-key spend in USD over the three periods the backend pre-computes. No allowance, so no percentage and no reset; account-wide balance has a different scope and is not carried here, so a row cannot imply both figures are per-key.