api

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseResetDuration added in v0.4.0

func ParseResetDuration(s string) time.Duration

ParseResetDuration parses an RFC3339 timestamp and returns the duration until that time.

Types

type AuthError added in v0.7.0

type AuthError struct {
	StatusCode int
	Message    string
}

AuthError indicates an authentication failure that persists after credential reload.

func (*AuthError) Error added in v0.7.0

func (e *AuthError) Error() string

type Client

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

func NewClient

func NewClient(provider *auth.Provider) *Client

func (*Client) FetchUsage

func (c *Client) FetchUsage(ctx context.Context) (*UsageResponse, error)

type RateLimitError added in v0.8.4

type RateLimitError struct {
	RetryAfter time.Duration
}

RateLimitError indicates a 429 response with an optional Retry-After duration.

func (*RateLimitError) Error added in v0.8.4

func (e *RateLimitError) Error() string

type UsageResponse

type UsageResponse struct {
	SessionPercent    float64
	WeeklyPercent     float64
	SessionResetAt    string
	WeeklyResetAt     string
	WeeklySonnetPct   *float64
	WeeklySonnetReset string
	WeeklyOpusPct     *float64
	WeeklyOpusReset   string
	WeeklyDesignPct   *float64
	WeeklyDesignReset string
	ExtraUsageEnabled bool
	ExtraUsageLimit   *float64
	ExtraUsageUsed    *float64
	Raw               json.RawMessage
}

UsageResponse represents the parsed OAuth usage data.

func (*UsageResponse) SessionResetDuration

func (u *UsageResponse) SessionResetDuration() time.Duration

SessionResetDuration parses the session reset time and returns duration until reset.

func (*UsageResponse) WeeklyResetDuration

func (u *UsageResponse) WeeklyResetDuration() time.Duration

WeeklyResetDuration parses the weekly reset time and returns duration until reset.

Jump to

Keyboard shortcuts

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