Documentation
¶
Overview ¶
Package ghapi implements backend.Repo over the GitHub REST API v3 with a hand-rolled net/http client. It owns auth headers, conditional requests (ETag), Link-header pagination, and rate-limit errors. LastCommit and Blame return backend.ErrUnsupported: REST has no affordable shape for either (GraphQL does, later milestone).
Index ¶
- type RateLimitError
- type Repo
- func (r *Repo) Archive(ctx context.Context, rev, format, prefix string, w io.Writer) error
- func (r *Repo) Blame(ctx context.Context, rev, pth string) ([]backend.BlameHunk, error)
- func (r *Repo) Blob(ctx context.Context, rev, pth string) (backend.Blob, error)
- func (r *Repo) Commit(ctx context.Context, sha string) (backend.CommitDetail, error)
- func (r *Repo) Commits(ctx context.Context, rev, pth string, n, skip int) ([]backend.Commit, bool, error)
- func (r *Repo) Files(ctx context.Context, rev string) ([]string, error)
- func (r *Repo) Info(ctx context.Context) (backend.Info, error)
- func (r *Repo) LastCommit(ctx context.Context, rev, pth string) (backend.Commit, error)
- func (r *Repo) Refs(ctx context.Context) (backend.Refs, error)
- func (r *Repo) Resolve(ctx context.Context, ref string) (string, error)
- func (r *Repo) Tree(ctx context.Context, rev, pth string) ([]backend.TreeEntry, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RateLimitError ¶
type RateLimitError = backend.RateLimitError
RateLimitError is the shared backend type; the alias keeps the natural name available to ghapi callers.
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
Repo is a backend.Repo bound to one owner/repo on one API host.
func New ¶
New returns a Repo talking to api.github.com. An empty token means anonymous access (60 requests/hour instead of 5000).
func NewWithBaseURL ¶
NewWithBaseURL is New with the API host and HTTP client injectable, which tests use to point at a mock server. A nil client means http.DefaultClient.