Documentation
¶
Index ¶
- type Client
- type Credentials
- type Label
- type OctoClient
- func (o *OctoClient) GetAuthenticatedUser() (User, error)
- func (o *OctoClient) GetPull(repo string, pr int) (Pull, error)
- func (o *OctoClient) ListPulls(repo string, page int, state string) ([]Pull, error)
- func (o *OctoClient) ListReviews(repo string, pr int, page int) ([]Review, error)
- func (o *OctoClient) SearchPulls(repo string, page int, q *QueryBuilder) (SearchResponse, error)
- type Pull
- type QueryBuilder
- func (q *QueryBuilder) Build() string
- func (q *QueryBuilder) IsDraft() *QueryBuilder
- func (q *QueryBuilder) IsMerged() *QueryBuilder
- func (q *QueryBuilder) IsMergedAfter(t time.Time) *QueryBuilder
- func (q *QueryBuilder) WithAuthor(authorLogin string) *QueryBuilder
- func (q *QueryBuilder) WithRepo(repo string) *QueryBuilder
- func (q *QueryBuilder) WithState(state string) *QueryBuilder
- type Repo
- type Review
- type SearchResponse
- type SearchResult
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
GetAuthenticatedUser() (User, error)
ListPulls(repo string, page int, state string) ([]Pull, error)
SearchPulls(repo string, page int, q *QueryBuilder) (SearchResponse, error)
GetPull(repo string, pr int) (Pull, error)
ListReviews(repo string, pr int, page int) ([]Review, error)
}
Client wraps the GitHub API
func NewOctoClient ¶
func NewOctoClient(cred Credentials) Client
NewOctoClient returns a new OctoClient
type Credentials ¶
Credentials are Basic Authentication credentials for GitHub See https://docs.github.com/en/rest/overview/other-authentication-methods
func (Credentials) EncodeToBasic ¶
func (c Credentials) EncodeToBasic() string
EncodeToBasic encodes the credentials as an RFC-2617 Basic Authorization header
type OctoClient ¶
type OctoClient struct {
BaseEndpoint string
// contains filtered or unexported fields
}
OctoClient is a GitHub REST API Client
func (*OctoClient) GetAuthenticatedUser ¶
func (o *OctoClient) GetAuthenticatedUser() (User, error)
GetAuthenticatedUser returns the current user
func (*OctoClient) GetPull ¶
func (o *OctoClient) GetPull(repo string, pr int) (Pull, error)
GetPull retrieves details about a pull request
func (*OctoClient) ListReviews ¶
ListReviews returns the list of reviews for a pull request
func (*OctoClient) SearchPulls ¶
func (o *OctoClient) SearchPulls(repo string, page int, q *QueryBuilder) (SearchResponse, error)
SearchPulls searches for pull requests
type Pull ¶
type Pull struct {
Number int `json:"number"`
Title string `json:"title"`
User User `json:"user"`
Labels []Label `json:"labels"`
IsMerged bool `json:"merged"`
CreatedAt time.Time `json:"created_at"`
MergedAt time.Time `json:"merged_at"`
ClosedAt time.Time `json:"closed_at"`
MergeCommit string `json:"merge_commit_sha"`
Reviewers []User `json:"requested_reviewers"`
}
Pull is a GitHub Pull Request
type QueryBuilder ¶
type QueryBuilder struct {
// contains filtered or unexported fields
}
QueryBuilder creates a search query with keywords and qualifiers See https://docs.github.com/en/github/searching-for-information-on-github/searching-issues-and-pull-requests
func (*QueryBuilder) Build ¶
func (q *QueryBuilder) Build() string
Build returns the query as a string
func (*QueryBuilder) IsDraft ¶
func (q *QueryBuilder) IsDraft() *QueryBuilder
IsDraft adds a draft pull request qualifier
func (*QueryBuilder) IsMerged ¶
func (q *QueryBuilder) IsMerged() *QueryBuilder
IsMerged adds a merged pull request qualifier
func (*QueryBuilder) IsMergedAfter ¶
func (q *QueryBuilder) IsMergedAfter(t time.Time) *QueryBuilder
IsMergedAfter filters pull requests that were merged after a given date
func (*QueryBuilder) WithAuthor ¶
func (q *QueryBuilder) WithAuthor(authorLogin string) *QueryBuilder
WithAuthor filters issues and pull requests by the author's login username
func (*QueryBuilder) WithRepo ¶
func (q *QueryBuilder) WithRepo(repo string) *QueryBuilder
WithRepo filters issues and pull requests by repository
func (*QueryBuilder) WithState ¶
func (q *QueryBuilder) WithState(state string) *QueryBuilder
WithState filters issues and pull requests by state
type Repo ¶
type Repo string
Repo is the unique name of a GitHub repository
func (*Repo) UnmarshalJSON ¶
UnmarshalJSON parses a repo name from a url
type Review ¶
type Review struct {
ID int `json:"id"`
User User `json:"user"`
State string `json:"state"`
Commit string `json:"commit_id"`
SubmittedAt time.Time `json:"submitted_at"`
}
Review is a Pull Request review
type SearchResponse ¶
type SearchResponse struct {
Total int `json:"total_count"`
IsIncomplete bool `json:"incomplete_results"`
Items []SearchResult `json:"items"`
}
SearchResponse are the results of an issue or pull request search