githubclient

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 15 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// MaxRetries is how many times a retryable response is sent again.
	MaxRetries = 5
	// DefaultTimeout is how long one attempt waits for GitHub to answer.
	// The wait between attempts is outside this deadline.
	DefaultTimeout = 30 * time.Second
)

Variables

View Source
var ErrAuthTimedOut = errors.New("github auth timed out")

ErrAuthTimedOut is returned when `gh auth token` does not finish within ghAuthTimeout.

View Source
var ErrAuthUnavailable = errors.New("github auth unavailable")

ErrAuthUnavailable is returned when neither GITHUB_TOKEN nor gh CLI auth is available.

Functions

func New

func New(token string, baseURL string) (*gh.Client, error)

New returns a GitHub API client. An empty token sends requests without a bearer token. An empty baseURL uses https://api.github.com/ and https://uploads.github.com/. Any other absolute http or https baseURL keeps uploads on that same host, under /api/uploads/. Each attempt waits DefaultTimeout. A 429 or 5xx is retried up to MaxRetries times, as is a primary or secondary rate limit. Retry-After is the wait when GitHub sends a positive number of seconds. A primary limit waits until X-RateLimit-Reset, a Unix timestamp. Either of those waits is capped at one hour. A client timeout returns an error that wraps errors.ErrTimeout and does not include the request URL.

func ResolveToken

func ResolveToken() (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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