Documentation
¶
Overview ¶
Package gitlab is the library behind the lab command line: the HTTP client, request shaping, and the typed data models for the GitLab REST API v4 (gitlab.com/api/v4).
The public API requires no key for public projects and users. The Client sets a polite User-Agent, paces requests to 1100ms apart (60 req/min limit), and retries transient failures (429 and 5xx) with a capped backoff.
Index ¶
- Constants
- type Client
- func (c *Client) Commits(ctx context.Context, path string, limit int) ([]Commit, error)
- func (c *Client) Groups(ctx context.Context, name string, limit int) ([]Group, error)
- func (c *Client) Project(ctx context.Context, path string) (*Project, error)
- func (c *Client) Search(ctx context.Context, query string, limit int) ([]Project, error)
- func (c *Client) User(ctx context.Context, username string) (*User, error)
- type Commit
- type Config
- type Domain
- type Group
- type Project
- type User
Constants ¶
const Host = "gitlab.com"
Host is the GitLab API host.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to the GitLab API over HTTP.
func (*Client) Project ¶
Project returns detail for one project by path (e.g. "gitlab-org/gitlab") or numeric id.
type Commit ¶
type Commit struct {
ID string `json:"id"`
ShortID string `json:"short_id"`
Title string `json:"title"`
AuthorName string `json:"author_name"`
AuthorEmail string `json:"author_email,omitempty"`
CreatedAt string `json:"created_at"`
Message string `json:"message,omitempty"`
WebURL string `json:"web_url,omitempty"`
}
Commit is one repository commit.
type Config ¶
type Config struct {
BaseURL string
UserAgent string
Rate time.Duration
Timeout time.Duration
Retries int
}
Config holds all tunable parameters for the Client.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns sensible defaults for the GitLab API.
type Domain ¶
type Domain struct{}
Domain is the GitLab driver.
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme, the hostnames a pasted link is matched against, and the identity reused for the binary's help and version.
type Group ¶
type Group struct {
ID int `json:"id"`
Name string `json:"name"`
Path string `json:"full_path"`
Description string `json:"description,omitempty"`
Visibility string `json:"visibility"`
Stars int `json:"star_count,omitempty"`
WebURL string `json:"web_url"`
}
Group is one GitLab group or organization.
type Project ¶
type Project struct {
ID int `json:"id"`
Path string `json:"path_with_namespace"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Stars int `json:"star_count"`
Forks int `json:"forks_count"`
Visibility string `json:"visibility"`
URL string `json:"web_url"`
LastActivity string `json:"last_activity_at,omitempty"`
OpenIssues int `json:"open_issues_count,omitempty"`
DefaultBranch string `json:"default_branch,omitempty"`
}
Project is one GitLab project.
type User ¶
type User struct {
ID int `json:"id"`
Username string `json:"username"`
Name string `json:"name"`
State string `json:"state,omitempty"`
AvatarURL string `json:"avatar_url,omitempty"`
WebURL string `json:"web_url"`
Bio string `json:"bio,omitempty"`
Location string `json:"location,omitempty"`
}
User is one GitLab user.