Documentation
¶
Overview ¶
Package github implements a client for GitHub that includes the minimum set of functions required by Hermit.
Index ¶
- func AuthenticatedURLRewriter(token string, matcher RepoMatcher) func(uri string) (string, error)
- func TokenAuthenticatedTransport(transport http.RoundTripper, token string) http.RoundTripper
- type Asset
- type Client
- func (a *Client) Download(asset Asset) (resp *http.Response, err error)
- func (a *Client) ETag(asset Asset) (etag string, err error)
- func (a *Client) LatestRelease(repo string) (*Release, error)
- func (a *Client) ProjectForURL(sourceURL string) string
- func (a *Client) Release(repo, tag string) (*Release, error)
- func (a *Client) Releases(repo string, limit int) (releases []*Release, err error)
- func (a *Client) Repo(repo string) (*Repo, error)
- type Release
- type Repo
- type RepoMatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthenticatedURLRewriter ¶ added in v0.44.4
func AuthenticatedURLRewriter(token string, matcher RepoMatcher) func(uri string) (string, error)
AuthenticatedURLRewriter rewrites GitHub URLs to include an auth token if they match the provided pattern
func TokenAuthenticatedTransport ¶
func TokenAuthenticatedTransport(transport http.RoundTripper, token string) http.RoundTripper
TokenAuthenticatedTransport returns a HTTP transport that will inject a GitHub authentication token into any requests to github.com.
Conceptually similar to https://github.com/google/go-github/blob/d23570d44313ca73dbcaadec71fc43eca4d29f8b/github/github.go#L841-L875
Types ¶
type Asset ¶
Asset is a minimal type for assets in the GitHub releases meta information retrieved via the GitHub API.
See https://docs.github.com/en/rest/reference/repos#list-releases
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for GitHub.
func (*Client) Download ¶ added in v0.3.3
Download creates a download request for retrieving a release asset from GitHub.
func (*Client) ETag ¶ added in v0.10.0
ETag issues a HEAD request for an Asset and returns its ETag.
func (*Client) LatestRelease ¶
LatestRelease details for a GitHub repository.
func (*Client) ProjectForURL ¶
ProjectForURL returns the <repo>/<project> for the given URL if it is a GitHub project.
type Release ¶
Release is a minimal type for GitHub releases meta information retrieved via the GitHub API.
See https://docs.github.com/en/rest/reference/repos#list-releases
type RepoMatcher ¶ added in v0.44.4
RepoMatcher is used to determine which repositories will use authenticated requests.
func GlobRepoMatcher ¶ added in v0.44.4
func GlobRepoMatcher(patterns []string) (RepoMatcher, error)
GlobRepoMatcher accepts a list of glob patterns and returns a RepoMatcher that will match 'owner/repo' pairs against the globs.
It returns an error if any of the patterns are invalid.