Help us shape the future of Go! Take the 2026 Go Developer Survey

usage

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnavailable = errors.New("usage unavailable")

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache bounds quota history to 64 account keys and coalesces concurrent reads. Keys are caller-owned account identities or credential digests, never raw credentials.

func (*Cache) Clear

func (c *Cache) Clear()

func (*Cache) Fetch

func (c *Cache) Fetch(ctx context.Context, key string, fetch func(context.Context) (Snapshot, error)) (Snapshot, error)

func (*Cache) Peek

func (c *Cache) Peek(key string) (Snapshot, bool)

type Client

type Client struct {
	Cache                   *Cache
	HTTPClient              *http.Client
	CodexURL, OpenCodeGoURL string
}

Client reads provider-reported quota only. URLs are injectable for tests and private deployments; credentials never follow redirects.

func (Client) Fetch

func (c Client) Fetch(ctx context.Context, provider string, credential auth.ModelAuth) (Snapshot, error)

type Snapshot

type Snapshot struct {
	Plan      string
	Windows   []Window
	CheckedAt time.Time
}

func (Snapshot) Summary

func (u Snapshot) Summary() string

type Window

type Window struct {
	Name      string
	Remaining float64
	ResetsAt  time.Time
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL