Skip to main content

snapshot_from_payload_lenient

Function snapshot_from_payload_lenient 

Source
pub fn snapshot_from_payload_lenient(payload: OauthUsage) -> UsageSnapshot
Expand description

Map a windowed payload to a snapshot with every window treated as independently optional, never requiring five_hour. This is the base-url and token path’s mapper: an alternate-endpoint proxy emits each window on its own ({}, {five_hour}, {seven_day}, {five_hour, seven_day}), and a missing five_hour is a valid steady state - the cold start before the first upstream request, and the post-5h-reset window where the proxy drops the key entirely - not a malformed response. {} maps to all-None (n/a bars); an out-of-contract error-shaped 200 lands here as n/a too rather than erroring. Infallible - there is no window this can reject.