{"modulePath":"github.com/project-init/gommon","version":"v0.17.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package githubclient\n\n## Constants\n\n```go\nconst (\n\t// MaxRetries is how many times a retryable response is sent again.\n\tMaxRetries = 5\n\t// DefaultTimeout is how long one attempt waits for GitHub to answer.\n\t// The wait between attempts is outside this deadline.\n\tDefaultTimeout = 30 * time.Second\n)\n```\n\n## Variables\n\n```go\nvar ErrAuthTimedOut = errors.New(\"github auth timed out\")\n```\nErrAuthTimedOut is returned when \\`gh auth token\\` does not finish within ghAuthTimeout.\n\n```go\nvar ErrAuthUnavailable = errors.New(\"github auth unavailable\")\n```\nErrAuthUnavailable is returned when neither GITHUB\\_TOKEN nor gh CLI auth is available.\n\n## Functions\n\n```go\nfunc New(token string, baseURL string) (*gh.Client, error)\n```\nNew returns a GitHub API client. An empty token sends requests without a bearer token. An empty baseURL uses [https://api.github.com/](https://api.github.com/) and [https://uploads.github.com/](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. While a request waits out a Retry-After, every other request through the client waits with it. Otherwise a spent primary limit, marked by X-RateLimit-Remaining 0, or a 5xx holds only its own request, and a secondary rate limit or a 429 holds every request. A client timeout returns an error that wraps errors.ErrTimeout and does not include the request URL.\n\n```go\nfunc ResolveToken() (string, error)\n```\n\n","path":"github.com/project-init/gommon/pkg/githubclient","name":"githubclient","synopsis":"","isRedistributable":true}
