Documentation
¶
Index ¶
- Constants
- func PayloadSignature(payload []byte, key []byte) string
- func ValidatePayload(payload []byte, sig string, key []byte) bool
- type Client
- func (c *Client) AddLabel(org, repo string, number int, label string) error
- func (c *Client) CloseIssue(org, repo string, number int) error
- func (c *Client) CreateComment(org, repo string, number int, comment string) error
- func (c *Client) CreateCommentReaction(org, repo string, ID int, reaction string) error
- func (c *Client) CreateStatus(org, repo, ref string, s Status) error
- func (c *Client) DeleteComment(org, repo string, ID int) error
- func (c *Client) FindIssues(query string) ([]Issue, error)
- func (c *Client) GetPullRequest(org, repo string, number int) (*PullRequest, error)
- func (c *Client) GetPullRequestChanges(pr PullRequest) ([]PullRequestChange, error)
- func (c *Client) GetRef(org, repo, ref string) (string, error)
- func (c *Client) IsMember(org, user string) (bool, error)
- func (c *Client) ListIssueComments(org, repo string, number int) ([]IssueComment, error)
- func (c *Client) RemoveLabel(org, repo string, number int, label string) error
- type Commit
- type Issue
- type IssueComment
- type IssueCommentEvent
- type IssuesSearchResult
- type Label
- type Logger
- type PullRequest
- type PullRequestBranch
- type PullRequestChange
- type PullRequestEvent
- type PushEvent
- type Reaction
- type Repo
- type Status
- type StatusEvent
- type User
Constants ¶
const ( StatusPending = "pending" StatusSuccess = "success" StatusError = "error" StatusFailure = "failure" )
These are possible State entries for a Status.
const ( ReactionThumbsUp = "+1" ReactionThumbsDown = "-1" ReactionLaugh = "laugh" ReactionConfused = "confused" ReactionHeart = "heart" ReactionHooray = "hooray" )
Possible contents for reactions.
Variables ¶
This section is empty.
Functions ¶
func PayloadSignature ¶
PayloadSignature returns the signature that matches the payload.
Types ¶
type Client ¶
type Client struct {
// If Logger is non-nil, log all method calls with it.
Logger Logger
// contains filtered or unexported fields
}
func NewDryRunClient ¶
NewDryRunClient creates a new client that will not perform mutating actions such as setting statuses or commenting, but it will still query GitHub and use up API tokens.
func NewFakeClient ¶
func NewFakeClient() *Client
NewFakeClient creates a new client that will not perform any actions at all.
func (*Client) CreateComment ¶
CreateComment creates a comment on the issue.
func (*Client) CreateCommentReaction ¶
func (*Client) CreateStatus ¶
CreateStatus creates or updates the status of a commit.
func (*Client) DeleteComment ¶
DeleteComment deletes the comment.
func (*Client) FindIssues ¶
FindIssues uses the github search API to find issues which match a particular query. TODO(foxish): we should accept map[string][]string and use net/url properly.
func (*Client) GetPullRequest ¶
func (c *Client) GetPullRequest(org, repo string, number int) (*PullRequest, error)
GetPullRequest gets a pull request.
func (*Client) GetPullRequestChanges ¶
func (c *Client) GetPullRequestChanges(pr PullRequest) ([]PullRequestChange, error)
GetPullRequestChanges gets a list of files modified in a pull request.
func (*Client) ListIssueComments ¶
func (c *Client) ListIssueComments(org, repo string, number int) ([]IssueComment, error)
ListIssueComments returns all comments on an issue. This may use more than one API token.
type Issue ¶
type Issue struct {
User User `json:"user"`
Number int `json:"number"`
Title string `json:"title"`
State string `json:"state"`
HTMLURL string `json:"html_url"`
Labels []Label `json:"labels"`
Assignees []User `json:"assignees"`
// This will be non-nil if it is a pull request.
PullRequest *struct{} `json:"pull_request,omitempty"`
}
func (Issue) IsAssignee ¶
func (Issue) IsPullRequest ¶
type IssueComment ¶
type IssueCommentEvent ¶
type IssueCommentEvent struct {
Action string `json:"action"`
Issue Issue `json:"issue"`
Comment IssueComment `json:"comment"`
Repo Repo `json:"repository"`
}
type IssuesSearchResult ¶
type IssuesSearchResult struct {
Total int `json:"total_count,omitempty"`
Issues []Issue `json:"items,omitempty"`
}
IssuesSearchResult represents the result of an issues search.
type PullRequest ¶
type PullRequest struct {
Number int `json:"number"`
HTMLURL string `json:"html_url"`
User User `json:"user"`
Base PullRequestBranch `json:"base"`
Head PullRequestBranch `json:"head"`
}
PullRequest contains information about a PullRequest.
type PullRequestBranch ¶
type PullRequestBranch struct {
Ref string `json:"ref"`
SHA string `json:"sha"`
Repo Repo `json:"repo"`
}
PullRequestBranch contains information about a particular branch in a PR.
type PullRequestChange ¶
type PullRequestChange struct {
SHA string `json:"sha"`
Filename string `json:"filename"`
Status string `json:"added"`
Additions int `json:"additions"`
Deletions int `json:"deletions"`
Changes int `json:"changes"`
Patch string `json:"patch"`
}
PullRequestChange contains information about what a PR changed.
type PullRequestEvent ¶
type PullRequestEvent struct {
Action string `json:"action"`
Number int `json:"number"`
PullRequest PullRequest `json:"pull_request"`
Label Label `json:"label"`
}
PullRequestEvent is what GitHub sends us when a PR is changed.
type PushEvent ¶
type Repo ¶
type Repo struct {
Owner User `json:"owner"`
Name string `json:"name"`
FullName string `json:"full_name"`
HTMLURL string `json:"html_url"`
}
Repo contains general repository information.
type Status ¶
type Status struct {
State string `json:"state"`
TargetURL string `json:"target_url,omitempty"`
Description string `json:"description,omitempty"`
Context string `json:"context,omitempty"`
}
Status is used to set a commit status line.
type StatusEvent ¶
type StatusEvent struct {
SHA string `json:"sha,omitempty"`
State string `json:"state,omitempty"`
Description string `json:"description,omitempty"`
TargetURL string `json:"target_url,omitempty"`
ID int `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Context string `json:"context,omitempty"`
Sender User `json:"sender,omitempty"`
Repo Repo `json:"repository,omitempty"`
}