Documentation
¶
Overview ¶
Package hf implements backend.Repo over the Hugging Face Hub HTTP API with a hand-rolled net/http client, the same shape as the ghapi backend: bearer auth, conditional requests (ETag), Link-header pagination, and rate-limit errors. Commit detail, Blame, and Archive return backend.ErrUnsupported because the Hub API has no endpoint for them; the server degrades those views per the capability model.
Index ¶
- 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 Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
Repo is a backend.Repo bound to one Hub repository on one API host.
func New ¶
New returns a Repo talking to huggingface.co. kind is "model", "dataset", or "space"; anything else panics, because the CLI validates kinds before construction. An empty token means anonymous access.
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.