api

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 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 Client

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

func NewClient

func NewClient(creds *auth.Credentials) *Client

func (*Client) FetchUsage

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

type UsageResponse

type UsageResponse struct {
	SessionPercent    float64
	WeeklyPercent     float64
	SessionResetAt    string
	WeeklyResetAt     string
	WeeklySonnetPct   *float64
	WeeklySonnetReset string
	WeeklyOpusPct     *float64
	WeeklyOpusReset   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