Documentation ¶
Overview ¶
Package github implements a client SDK for the Github API.
Index ¶
- Constants
- type Client
- func (c *Client) Commit(ctx context.Context, repository, sha string) (*Commit, error)
- func (c *Client) OIDCToken(ctx context.Context, cfg OIDCVars) (token string, err error)
- func (c *Client) PullReviews(ctx context.Context, repository string, nr int) (Reviews, error)
- func (c *Client) PullsForCommit(ctx context.Context, repository, commit string) (pulls Pulls, err error)
- type Commit
- type GitMetadata
- type Label
- type OIDCVars
- type Pull
- type Pulls
- type RefInfo
- type Review
- type Reviews
- type User
Constants ¶
View Source
const ( // ErrNotFound indicates the resource does not exists. ErrNotFound errors.Kind = "resource not found (HTTP Status: 404)" // ErrUnprocessableEntity indicates the entity cannot be processed for any reason. ErrUnprocessableEntity errors.Kind = "entity cannot be processed (HTTP Status: 422)" )
View Source
const ( // Domain is the default GitHub domain. Domain = "github.com" // APIDomain is the default GitHub API domain. APIDomain = "api." + Domain // APIBaseURL is the default base url for the GitHub API. APIBaseURL = "https://" + APIDomain )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // BaseURL is the base URL used to construct the final URL of endpoints. // If not set, then api.github.com is used. BaseURL string // HTTPClient sets the HTTP client used and then allows for advanced // connection reuse schemes. If not set, a new http.Client is used. HTTPClient *http.Client // Token is the Github token (usually provided by the GH_TOKEN environment // variable. Token string }
Client is a Github HTTP client wrapper.
func (*Client) Commit ¶ added in v0.4.1
Commit retrieves information about an specific commit in the GitHub API.
func (*Client) PullReviews ¶ added in v0.4.4
PullReviews returns the list of reviews of the given pull request number.
type Commit ¶ added in v0.4.1
type Commit struct { SHA string `json:"sha"` Commit struct { Author GitMetadata Committer GitMetadata Message string } `json:"commit"` Author User Committer User Verification struct { Verified bool `json:"verified"` Reason string `json:"reason"` } `json:"verification"` }
Commit holds information of a specific commit.
type GitMetadata ¶ added in v0.4.1
type GitMetadata struct { Name string `json:"name"` Email string `json:"email"` Date *time.Time `json:"date,omitempty"` }
GitMetadata holds the commit metadata exported by Github.
type Label ¶ added in v0.4.4
type Label struct { Name string `json:"name"` Color string `json:"color"` Description string `json:"description,omitempty"` }
Label of the issue or pull request.
type Pull ¶
type Pull struct { URL string `json:"url"` HTMLURL string `json:"html_url"` Number int `json:"number"` Title string `json:"title"` Body string `json:"body"` State string `json:"state"` User User `json:"user"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` ClosedAt *time.Time `json:"closed_at,omitempty"` MergedAt *time.Time `json:"merged_at,omitempty"` MergeCommitSHA string `json:"merge_commit_sha,omitempty"` Head RefInfo `json:"head"` Base RefInfo `json:"base"` Labels []Label `json:"labels"` }
Pull represents a pull request object.
type RefInfo ¶ added in v0.4.1
type RefInfo struct { Label string `json:"label"` Ref string `json:"ref"` SHA string `json:"sha"` User User `json:"user"` }
RefInfo contains metadata for the git ref (HEAD, branch, etc)
type Review ¶ added in v0.4.4
type Review struct { User User `json:"user"` Body string `json:"body,omitempty"` State string `json:"state,omitempty"` SubmittedAt time.Time `json:"submitted_at,omitempty"` AuthorAssociation string `json:"author_association,omitempty"` CommitID string `json:"commit_id,omitempty"` }
Review represents the review information.
Click to show internal directories.
Click to hide internal directories.