Versions in this module Expand all Collapse all v0 v0.4.0 Oct 22, 2026 Changes in this version + const DashboardTimeout + const DefaultBaseURL + const DefaultPollInterval + const MinPollInterval + const RefreshMinSpacing + const RefreshTimeout + var ErrTimeout = errors.New("redline did not respond in time") + var ErrUnauthorized = errors.New("redline rejected the API token") + var ErrUnreachable = errors.New("redline unreachable") + func DiscoverToken(tokenFile string) (token string, path string, err error) + type Client struct + BaseURL string + HTTPClient *http.Client + Token string + func NewClient(baseURL, token string, allowRemote bool) (*Client, error) + func (c *Client) Dashboard(ctx context.Context) ([]byte, error) + func (c *Client) Refresh(ctx context.Context, providerID string) error + type Poller struct + Client *Client + Interval time.Duration + KeepStaleFor time.Duration + Logger *log.Logger + Now func() time.Time + OnChange func(Usage) + func (p *Poller) Current() Usage + func (p *Poller) Poll(ctx context.Context) Usage + func (p *Poller) Refresh(ctx context.Context) (RefreshResult, error) + func (p *Poller) Start(ctx context.Context) <-chan struct{} + type Provider struct + Error string + ID string + Label string + ObservedAt time.Time + Primary *Window + Provider string + Source string + State ProviderState + Windows []Window + type ProviderState string + const ProviderError + const ProviderOK + const ProviderStale + type RefreshResult struct + RetryAfter time.Duration + Throttled bool + Usage Usage + type State string + const StateDisabled + const StateLoading + const StateOK + const StateUnavailable + type Usage struct + Message string + Providers []Provider + State State + UpdatedAt time.Time + func Disabled() Usage + func MapDashboard(raw []byte, now time.Time) (Usage, error) + type Window struct + Key string + Label string + PeriodSeconds int64 + Remaining float64 + ResetInferred bool + ResetsAt time.Time + Scope string