Documentation ¶
Overview ¶
Package git provides easy API access to Sourcehut Git repositories.
Index ¶
Constants ¶
const BaseURL = "https://git.sr.ht/api/"
BaseURL is the default public Sourcehut API URL. It is exported for convenience.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client handles communication with the Sourcehut API.
API docs: https://man.sr.ht/git.sr.ht/api.md
func (*Client) GetUser ¶
GetUser returns information about the provided username, or the currently authenticated user if the username is empty.
type Commit ¶
type Commit struct { ID string `json:"id"` ShortID string `json:"short_id"` Author Author `json:"author"` Committer Author `json:"committer"` Timestamp time.Time `json:"timestamp"` Message string `json:"message"` Tree string `json:"tree"` Signature *struct { Signature string `json:"signature"` Data string `json:"data"` } `json:"signature"` Parents []string `json"Parents"` }
Commit is a single commit in a repo.
type Option ¶
Option is used to configure an API client.
func Base ¶
Base returns an option that configures the public Sourcehut API URL.
If base does not have a trailing slash, one is added automatically. If unspecified, BaseURL is used.
func SrhtClient ¶
func SrhtClient(client sourcehut.Client) Option
SrhtClient returns an option that configures the client to use the provided sourcehut.Client for API requests. If unspecified, the default sourcehut.Client (with no options of its own) is used.
type Repo ¶
type Repo struct { ID int64 `json:"id"` Created time.Time `json:"created"` Subject string `json:"subject"` Name string `json:"name"` Description string `json:"description"` Visibility RepoVisibility `json:"visibility"` }
Repo represents a repository.
type RepoIter ¶
type RepoIter struct {
*sourcehut.Iter
}
RepoIter is used for iterating over a collection of repos.
type RepoVisibility ¶
type RepoVisibility string
RepoVisibility is the visibility level of a repo.
const ( VisibilityPublic RepoVisibility = "public" VisibilityUnlisted RepoVisibility = "unlisted" VisibilityPrivate RepoVisibility = "private" )
Supported visibility levels.