Documentation ¶
Overview ¶
Package github provides low-level tools to retrieve information from the Github API
Index ¶
- type API
- type APIv3
- func (a APIv3) ClosedPullRequests(limit int) ([]PullRequest, error)
- func (a APIv3) Comments(number int) ([]Comment, error)
- func (a APIv3) DiffSize(number int) (int, error)
- func (a APIv3) Get(url string, target interface{}) error
- func (a APIv3) Repository() (*Repository, error)
- func (a APIv3) ReviewRequests(number int) ([]User, error)
- type Comment
- type PullRequest
- type Repository
- type ReviewRequestsResponse
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface { Get(url string, target interface{}) error Repository() (*Repository, error) ClosedPullRequests(limit int) ([]PullRequest, error) DiffSize(number int) (int, error) Comments(number int) ([]Comment, error) ReviewRequests(number int) ([]User, error) }
API is an interface for a collection of methods to retrieve information from Github API
type APIv3 ¶
type APIv3 struct { HTTPClient client.HTTPClient RepoName string }
APIv3 is an implementation of API which works with Github REST API (v3)
func (APIv3) ClosedPullRequests ¶
func (a APIv3) ClosedPullRequests(limit int) ([]PullRequest, error)
ClosedPullRequests fetches a list of closed Pull Requests with a `limit`
func (APIv3) DiffSize ¶
DiffSize fetches the size of the diff of the particular Pull Request given `number`
func (APIv3) Get ¶
Get makes an HTTP request, checks the response, reads the body and unmarshals it to the `target`
func (APIv3) Repository ¶
func (a APIv3) Repository() (*Repository, error)
Repository fetches the remote repository data
type PullRequest ¶
type PullRequest struct { Number int `json:"number"` Body string `json:"body"` CreatedAt time.Time `json:"created_at"` MergedAt time.Time `json:"merged_at,omitempty"` User User `json:"user"` State string `json:"state"` Assignees []User `json:"assignees"` DiffURL string `json:"diff_url"` DiffSize *int ReviewRequests *[]User Comments *[]Comment }
PullRequest is a representation of the Pull Request the Github API returns
func (*PullRequest) FillDetails ¶
func (p *PullRequest) FillDetails(a API) error
FillDetails makes additional requests to fill details about the Pull Request (such as diff size)
func (PullRequest) IsMerged ¶
func (p PullRequest) IsMerged() bool
IsMerged tells if PullRequest was really merged, not just closed
type Repository ¶
type Repository struct {
FullName string `json:"full_name"`
}
Repository is a representation of a Github repository which is accessible via API
type ReviewRequestsResponse ¶
type ReviewRequestsResponse struct {
Users []User `json:"users"`
}
ReviewRequestsResponse is a representation of the /requested_reviewers API response
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package client contains an implementation of a HTTP client aware of all the Github rules like rate limiting or authenticating
|
Package client contains an implementation of a HTTP client aware of all the Github rules like rate limiting or authenticating |
Package page provides an utility to fetch paginated resources
|
Package page provides an utility to fetch paginated resources |
Package util is a high-level API for Github
|
Package util is a high-level API for Github |