Documentation
¶
Index ¶
- type Author
- type Base
- type Branch
- type BranchCommit
- type Build
- type Comment
- type CommentsHREF
- type Commit
- type CommitAuthor
- type CommitCommentPayload
- type CommitCommitter
- type Commiter
- type CommitsHREF
- type Config
- type CreatePayload
- type Creator
- type DeletePayload
- type Deployment
- type DeploymentPayload
- type DeploymentStatus
- type DeploymentStatusPayload
- type Error
- type Event
- type EventSubtype
- type ForkPayload
- type Forkee
- type GollumPayload
- type HTML
- type Head
- type HeadCommit
- type Issue
- type IssueCommentPayload
- type IssueHREF
- type IssuesPayload
- type Label
- type Links
- type LinksPullRequest
- type Member
- type MemberPayload
- type MembershipPayload
- type Organization
- type Owner
- type Page
- type PageBuildPayload
- type PublicPayload
- type PullRequest
- type PullRequestComment
- type PullRequestHREF
- type PullRequestPayload
- type PullRequestReviewCommentPayload
- type PushPayload
- type Pusher
- type PusherPush
- type Release
- type ReleasePayload
- type Repository
- type RepositoryPayload
- type ReviewCommentHREF
- type ReviewCommentsHREF
- type Self
- type Sender
- type StatusCommit
- type StatusCommitAuthor
- type StatusCommitCommiter
- type StatusCommitInner
- type StatusPayload
- type StatusesHREF
- type Team
- type TeamAddPayload
- type Tree
- type User
- type WatchPayload
- type Webhook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Branch ¶
type Branch struct {
Name string `json:"name"`
Commit BranchCommit `json:"commit"`
}
Branch contains GitHub's branch information
type BranchCommit ¶
BranchCommit contains GitHub's branch commit information
type Build ¶
type Build struct {
URL string `json:"url"`
Status string `json:"status"`
Error Error `json:"error"`
Pusher Pusher `json:"pusher"`
Commit string `json:"commit"`
Duration int `json:"duration"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Build contains GitHub's build information
type Comment ¶
type Comment struct {
URL string `json:"url"`
HTMLURL string `json:"html_url"`
ID int `json:"id"`
User User `json:"user"`
Position int `json:"position"`
Line int `json:"line"`
Path string `json:"path"`
CommitID string `json:"commit_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Body string `json:"body"`
}
Comment contains GitHub's comment information
type CommentsHREF ¶
type CommentsHREF struct {
HREF string `json:"href"`
}
CommentsHREF contains GitHub's comments href information
type Commit ¶
type Commit struct {
ID string `json:"id"`
Distinct bool `json:"distinct"`
Message string `json:"message"`
Timestamp time.Time `json:"timestamp"`
URL string `json:"url"`
Author CommitAuthor `json:"author"`
Committer CommitCommitter `json:"committer"`
Added []string `json:"added"`
Removed []string `json:"removed"`
Modified []string `json:"modified"`
}
Commit contains GitHub's commit information
type CommitAuthor ¶
type CommitAuthor struct {
Name string `json:"name"`
Email string `json:"email"`
Username string `json:"username"`
}
CommitAuthor contains GitHub's commit author information
type CommitCommentPayload ¶
type CommitCommentPayload struct {
Action string `json:"action"`
RefType string `json:"ref_type"`
Comment Comment `json:"comment"`
Repository Repository `json:"repository"`
Sender Sender `json:"sender"`
}
CommitCommentPayload contains the information for GitHub's commit_comment hook event
type CommitCommitter ¶
type CommitCommitter struct {
CommitAuthor
}
CommitCommitter contains GitHub's commit commiter information
type CommitsHREF ¶
type CommitsHREF struct {
HREF string `json:"href"`
}
CommitsHREF contains GitHub's commits href information
type Config ¶
type Config struct {
Secret string
}
Config defines the configuration to create a new GitHub Webhook instance
type CreatePayload ¶
type CreatePayload struct {
Ref string `json:"ref"`
RefType string `json:"ref_type"`
MasterBranch string `json:"master_branch"`
Description string `json:"description"`
PusherType string `json:"pusher_type"`
Repository Repository `json:"repository"`
Sender Sender `json:"sender"`
}
CreatePayload contains the information for GitHub's create hook event
type DeletePayload ¶
type DeletePayload struct {
Ref string `json:"ref"`
RefType string `json:"ref_type"`
PusherType string `json:"pusher_type"`
Repository Repository `json:"repository"`
Sender Sender `json:"sender"`
}
DeletePayload contains the information for GitHub's delete hook event
type Deployment ¶
type Deployment struct {
URL string `json:"url"`
ID int `json:"id"`
SHA string `json:"sha"`
Ref string `json:"ref"`
Task string `json:"task"`
//paylod
Environment string `json:"environment"`
Description string `json:"description"`
Creator Creator `json:"creator"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
StatusesURL string `json:"statuses_url"`
RepositoryURL string `json:"repository_url"`
}
Deployment contains GitHub's deployment information
type DeploymentPayload ¶
type DeploymentPayload struct {
Deployment Deployment `json:"deployment"`
Repository Repository `json:"repository"`
Sender Sender `json:"sender"`
}
DeploymentPayload contains the information for GitHub's deployment hook
type DeploymentStatus ¶
type DeploymentStatus struct {
URL string `json:"url"`
ID int `json:"id"`
State string `json:"state"`
Creator Creator `json:"creator"`
Description string `json:"description"`
TargetURL string `json:"target_url"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeploymentURL string `json:"deployment_url"`
RepositoryURL string `json:"repository_url"`
}
DeploymentStatus contains GitHub's deployment_status information
type DeploymentStatusPayload ¶
type DeploymentStatusPayload struct {
Deployment Deployment `json:"deployment"`
DeploymentStatus DeploymentStatus `json:"deployment_status"`
Repository Repository `json:"repository"`
Sender Sender `json:"sender"`
}
DeploymentStatusPayload contains the information for GitHub's deployment_status hook event
type Error ¶
type Error struct {
Message string `json:"message"`
}
Error contains GitHub's error information
type Event ¶
type Event string
Event defines a GitHub hook event type
const ( CommitCommentEvent Event = "commit_comment" CreateEvent Event = "create" DeleteEvent Event = "delete" DeploymentEvent Event = "deployment" DeploymentStatusEvent Event = "deployment_status" ForkEvent Event = "fork" GollumEvent Event = "gollum" IssueCommentEvent Event = "issue_comment" IssuesEvent Event = "issues" MemberEvent Event = "member" MembershipEvent Event = "membership" PageBuildEvent Event = "page_build" PublicEvent Event = "public" PullRequestReviewCommentEvent Event = "pull_request_review_comment" PullRequestEvent Event = "pull_request" PushEvent Event = "push" RepositoryEvent Event = "repository" ReleaseEvent Event = "release" StatusEvent Event = "status" TeamAddEvent Event = "team_add" WatchEvent Event = "watch" )
GitHub hook types
type EventSubtype ¶
type EventSubtype string
EventSubtype defines a GitHub Hook Event subtype
const ( NoSubtype EventSubtype = "" BranchSubtype EventSubtype = "branch" TagSubtype EventSubtype = "tag" PullSubtype EventSubtype = "pull" IssueSubtype EventSubtype = "issues" )
GitHub hook event subtypes
type ForkPayload ¶
type ForkPayload struct {
Forkee Forkee `json:"forkee"`
Repository Repository `json:"repository"`
Sender Sender `json:"sender"`
}
ForkPayload contains the information for GitHub's fork hook event
type Forkee ¶
type Forkee struct {
Repository
Public bool `json:"public"`
}
Forkee contains GitHub's forkee information
type GollumPayload ¶
type GollumPayload struct {
Pages []Page `json:"pages"`
Repository Repository `json:"repository"`
Sender Sender `json:"sender"`
}
GollumPayload contains the information for GitHub's gollum hook event
type Head ¶
type Head struct {
Label string `json:"label"`
Ref string `json:"ref"`
SHA string `json:"sha"`
User User `json:"user"`
Repo Repository `json:"repo"`
}
Head contains GitHub's head information
type HeadCommit ¶
type HeadCommit struct {
Commit
}
HeadCommit contains GitHub's head_commit information
type Issue ¶
type Issue struct {
URL string `json:"url"`
LabelsURL string `json:"labels_url"`
CommentsURL string `json:"comments_url"`
EventsURL string `json:"events_url"`
HTMLURL string `json:"html_url"`
ID int `json:"id"`
Number int `json:"number"`
Title string `json:"title"`
User User `json:"user"`
Labels []Label `json:"labels"`
State string `json:"state"`
Locked bool `json:"locked"`
Assignee string `json:"assignee"`
Milestone string `json:"milestone"`
Comments int `json:"comments"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ClosedAt time.Time `json:"closed_at"`
Body string `json:"body"`
}
Issue contains GitHub's issue information
type IssueCommentPayload ¶
type IssueCommentPayload struct {
IssuesPayload
Comment Comment `json:"comment"`
}
IssueCommentPayload contains the information for GitHub's issue_comment hook event
type IssueHREF ¶
type IssueHREF struct {
HREF string `json:"href"`
}
IssueHREF contains GitHub's issue href information
type IssuesPayload ¶
type IssuesPayload struct {
Action string `json:"action"`
Issue Issue `json:"issue"`
Repository Repository `json:"repository"`
Sender Sender `json:"sender"`
}
IssuesPayload contains the information for GitHub's issues hook event
type Links ¶
type Links struct {
Self Self `json:"self"`
HTML HTML `json:"html"`
PullRequest PullRequestHREF `json:"pull_request"`
}
Links contains GitHub's link information
type LinksPullRequest ¶
type LinksPullRequest struct {
Self Self `json:"self"`
HTML HTML `json:"html"`
Issue IssueHREF `json:"issue"`
Comments CommentsHREF `json:"comments"`
ReviewComments ReviewCommentsHREF `json:"review_comments"`
ReviewComment ReviewCommentHREF `json:"review_comment"`
Commits CommitsHREF `json:"commits"`
Statuses StatusesHREF `json:"statuses"`
}
LinksPullRequest contains GitHub's pull request link information
type MemberPayload ¶
type MemberPayload struct {
Action string `json:"action"`
Member Member `json:"member"`
Repository Repository `json:"repository"`
Sender Sender `json:"sender"`
}
MemberPayload contains the information for GitHub's member hook event
type MembershipPayload ¶
type MembershipPayload struct {
Action string `json:"action"`
Scope string `json:"scope"`
Member Member `json:"member"`
Sender Sender `json:"sender"`
Team Team `json:"team"`
Organization Organization `json:"organization"`
}
MembershipPayload contains the information for GitHub's membership hook event
type Organization ¶
type Organization struct {
Login string `json:"login"`
ID int `json:"id"`
URL string `json:"url"`
ReposURL string `json:"repos_url"`
EventsURL string `json:"events_url"`
MembersURL string `json:"members_url"`
PublicMembersURL string `json:"public_members_url"`
AvatarURL string `json:"avatar_url"`
}
Organization contains GitHub's organization information
type Page ¶
type Page struct {
PageName string `json:"page_name"`
Title string `json:"title"`
Summary string `json:"summary"`
Action string `json:"action"`
SHA string `json:"sha"`
HTMLURL string `json:"html_url"`
}
Page contains GitHub's page information
type PageBuildPayload ¶
type PageBuildPayload struct {
ID int `json:"id"`
Build Build `json:"build"`
Repository Repository `json:"repository"`
Sender Sender `json:"sender"`
}
PageBuildPayload contains the information for GitHub's page_build hook event
type PublicPayload ¶
type PublicPayload struct {
Repository Repository `json:"repository"`
Sender Sender `json:"sender"`
}
PublicPayload contains the information for GitHub's public hook event
type PullRequest ¶
type PullRequest struct {
URL string `json:"url"`
ID int `json:"id"`
HTMLURL string `json:"html_url"`
DiffURL string `json:"diff_url"`
PatchURL string `json:"patch_url"`
IssueURL string `json:"issue_url"`
Number int `json:"number"`
State string `json:"state"`
Locked bool `json:"locked"`
Title string `json:"title"`
User User `json:"user"`
Body string `json:"body"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ClosedAt time.Time `json:"closed_at"`
MergedAt time.Time `json:"merged_at"`
MergeCommitSHA string `json:"merge_commit_sha"`
Assignee string `json:"assignee"`
Milestone string `json:"milestone"`
CommitsURL string `json:"commits_url"`
ReviewCommentsURL string `json:"review_comments_url"`
ReviewCommentURL string `json:"review_comment_url"`
CommentsURL string `json:"comments_url"`
StatusesURL string `json:"statuses_url"`
Head Head `json:"head"`
Base Base `json:"base"`
Links LinksPullRequest `json:"_links"`
Merged bool `json:"merged"`
Mergable bool `json:"mergeable"`
MergableState string `json:"mergeable_state"`
MergedBy string `json:"merged_by"`
Comments int `json:"comments"`
ReviewComments int `json:"review_comments"`
Commits int `json:"commits"`
Additions int `json:"additions"`
Deletions int `json:"deletions"`
ChangedFiles int `json:"changed_files"`
}
PullRequest contains GitHub's pull_request information
type PullRequestComment ¶
type PullRequestComment struct {
URL string `json:"url"`
ID int `json:"id"`
DiffHunk string `json:"diff_hunk"`
Path string `json:"path"`
Position int `json:"position"`
OriginalPosition int `json:"original_position"`
CommitID string `json:"commit_id"`
OriginalCommitID string `json:"original_commit_id"`
User User `json:"user"`
Body string `json:"body"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
HTMLURL string `json:"html_url"`
PullRequestURL string `json:"pull_request_url"`
Links Links `json:"links"`
}
PullRequestComment contains GitHub's pull request comment information
type PullRequestHREF ¶
type PullRequestHREF struct {
HREF string `json:"href"`
}
PullRequestHREF contains GitHub's pull_request href information
type PullRequestPayload ¶
type PullRequestPayload struct {
Action string `json:"action"`
Number int `json:"number"`
PullRequest PullRequest `json:"pull_request"`
Repository Repository `json:"repository"`
Sender Sender `json:"sender"`
}
PullRequestPayload contains the information for GitHub's pull_request hook event
type PullRequestReviewCommentPayload ¶
type PullRequestReviewCommentPayload struct {
Action string `json:"action"`
Comment PullRequestComment `json:"comment"`
Repository Repository `json:"repository"`
Sender Sender `json:"sender"`
}
PullRequestReviewCommentPayload contains the information for GitHub's pull_request_review_comment hook event
type PushPayload ¶
type PushPayload struct {
Ref string `json:"ref"`
Before string `json:"before"`
After string `json:"after"`
Created bool `json:"created"`
Deleted bool `json:"deleted"`
Forced bool `json:"forced"`
BaseRef string `json:"base_ref"`
Compare string `json:"compare"`
Commits []Commit `json:"commits"`
HeadCommit HeadCommit `json:"head_commit"`
Repository Repository `json:"repository"`
Pusher PusherPush `json:"pusher"`
Sender Sender `json:"sender"`
}
PushPayload contains the information for GitHub's push hook event
type PusherPush ¶
PusherPush contains GitHub's push pusher information
type Release ¶
type Release struct {
URL string `json:"url"`
AssetsURL string `json:"assets_url"`
UploadURL string `json:"upload_url"`
HTMLURL string `json:"html_url"`
ID int `json:"id"`
TagName string `json:"tag_name"`
TargetCommitish string `json:"target_commitish"`
Name string `json:"name"`
Draft bool `json:"draft"`
Author Author `json:"author"`
Prelelease bool `json:"prerelease"`
CreatedAt time.Time `json:"created_at"`
PublishedAt time.Time `json:"published_at"`
Assets []string `json:"assets"`
TarballURL string `json:"tarball_url"`
ZipballURL string `json:"zipball_url"`
Body string `json:"body"`
}
Release contains GitHub's release information
type ReleasePayload ¶
type ReleasePayload struct {
Action string `json:"action"`
Release Release `json:"release"`
Repository Repository `json:"repository"`
Sender Sender `json:"sender"`
}
ReleasePayload contains the information for GitHub's release hook event
type Repository ¶
type Repository struct {
ID int `json:"id"`
Name string `json:"name"`
FullName string `json:"full_name"`
Owner Owner `json:"owner"`
Private bool `json:"private"`
HTMLURL string `json:"html_url"`
Description string `json:"description"`
Fork bool `json:"fork"`
URL string `json:"url"`
ForksURL string `json:"forks_url"`
KeysURL string `json:"keys_url"`
CollaboratorsURL string `json:"collaborators_url"`
TeamsURL string `json:"teams_url"`
HooksURL string `json:"hooks_url"`
IssueEventsURL string `json:"issue_events_url"`
EventsURL string `json:"events_url"`
AssigneesURL string `json:"assignees_url"`
BranchesURL string `json:"branches_url"`
TagsURL string `json:"tags_url"`
BlobsURL string `json:"blobs_url"`
GitTagsURL string `json:"git_tags_url"`
GitRefsURL string `json:"git_refs_url"`
TreesURL string `json:"trees_url"`
StatusesURL string `json:"statuses_url"`
LanguagesURL string `json:"languages_url"`
StargazersURL string `json:"stargazers_url"`
ContributorsURL string `json:"contributors_url"`
SubscribersURL string `json:"subscribers_url"`
SubscriptionURL string `json:"subscription_url"`
CommitsURL string `json:"commits_url"`
GitCommitsURL string `json:"git_commits_url"`
CommentsURL string `json:"comments_url"`
IssueCommentURL string `json:"issue_comment_url"`
ContentsURL string `json:"contents_url"`
CompareURL string `json:"compare_url"`
MergesURL string `json:"merges_url"`
ArchiveURL string `json:"archive_url"`
DownloadsURL string `json:"downloads_url"`
IssuesURL string `json:"issues_url"`
PullsURL string `json:"pulls_url"`
MilestonesURL string `json:"milestones_url"`
NotificationsURL string `json:"notifications_url"`
LabelsURL string `json:"labels_url"`
ReleasesURL string `json:"releases_url"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
PushedAt time.Time `json:"pushed_at"`
GitURL string `json:"git_url"`
SSHURL string `json:"ssh_url"`
CloneURL string `json:"clone_url"`
SVNURL string `json:"svn_url"`
Homepage string `json:"homepage"`
Size int `json:"size"`
StargazersCount int `json:"stargazers_count"`
WatchersCount int `json:"watchers_count"`
Language string `json:"language"`
HasIssues bool `json:"has_issues"`
HasDownloads bool `json:"has_downloads"`
HasWiki bool `json:"has_wiki"`
HasPages bool `json:"has_pages"`
ForksCount int `json:"forks_count"`
MirrorURL string `json:"mirror_url"`
OpenIssuesCount int `json:"open_issues_count"`
Forks int `json:"forks"`
OpenIssues int `json:"open_issues"`
Watchers int `json:"watchers"`
DefaultBranch string `json:"default_branch"`
}
Repository contais all of the GitHub repository information
type RepositoryPayload ¶
type RepositoryPayload struct {
Action string `json:"action"`
Repository Repository `json:"repository"`
Organization Organization `json:"organization"`
Sender Sender `json:"sender"`
}
RepositoryPayload contains the information for GitHub's repository hook event
type ReviewCommentHREF ¶
type ReviewCommentHREF struct {
HREF string `json:"href"`
}
ReviewCommentHREF contains GitHub's review comment href information
type ReviewCommentsHREF ¶
type ReviewCommentsHREF struct {
HREF string `json:"href"`
}
ReviewCommentsHREF contains GitHub's review comments href information
type StatusCommit ¶
type StatusCommit struct {
SHA string `json:"sha"`
Commit StatusCommitInner `json:"commit"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
CommentsURL string `json:"comments_url"`
Author Author `json:"author"`
Committer Commiter `json:"committer"`
Parents []string `json:"parents"`
}
StatusCommit contains GitHub's status commit information
type StatusCommitAuthor ¶
type StatusCommitAuthor struct {
Name string `json:"name"`
Email string `json:"email"`
Date time.Time `json:"date"`
}
StatusCommitAuthor contains GitHub's status commit author information
type StatusCommitCommiter ¶
type StatusCommitCommiter struct {
Name string `json:"name"`
Email string `json:"email"`
Date time.Time `json:"date"`
}
StatusCommitCommiter contains GitHub's status commit committer information
type StatusCommitInner ¶
type StatusCommitInner struct {
Author StatusCommitAuthor `json:"author"`
Commiter StatusCommitCommiter `jsons:"committer"`
Message string `json:"message"`
Tree Tree `json:"tree"`
URL string `json:"url"`
CommentCount int `json:"comment_count"`
}
StatusCommitInner contains GitHub's inner status commit information
type StatusPayload ¶
type StatusPayload struct {
ID int `json:"id"`
SHA string `json:"sha"`
Name string `json:"name"`
TragetURL string `json:"target_url"`
Context string `json:"context"`
Desctiption string `json:"description"`
State string `json:"state"`
Commit StatusCommit `json:"commit"`
Branches []Branch `json:"branches"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Repository Repository `json:"repository"`
Sender Sender `json:"sender"`
}
StatusPayload contains the information for GitHub's status hook event
type StatusesHREF ¶
type StatusesHREF struct {
HREF string `json:"href"`
}
StatusesHREF contains GitHub's statuses href information
type Team ¶
type Team struct {
Name string `json:"name"`
ID int `json:"id"`
Slug string `json:"slug"`
Permission string `json:"permission"`
URL string `json:"url"`
MembersURL string `json:"members_url"`
RepositoriesURL string `json:"repositories_url"`
}
Team contains GitHub's team information
type TeamAddPayload ¶
type TeamAddPayload struct {
Team Team `json:"team"`
Repository Repository `json:"repository"`
Organization Organization `json:"organization"`
Sender Sender `json:"sender"`
}
TeamAddPayload contains the information for GitHub's team_add hook event
type User ¶
type User struct {
Login string `json:"login"`
ID int `json:"id"`
AvatarURL string `json:"avatar_url"`
GravatarID string `json:"gravatar_id"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
FollowersURL string `json:"followers_url"`
FollowingURL string `json:"following_url"`
GistsURL string `json:"gists_url"`
StarredURL string `json:"starred_url"`
SubscriptionsURL string `json:"subscriptions_url"`
OrganizationsURL string `json:"organizations_url"`
ReposURL string `json:"repos_url"`
EventsURL string `json:"events_url"`
ReceivedEventsURL string `json:"received_events_url"`
Type string `json:"type"`
SiteAdmin bool `json:"site_admin"`
}
User contains GitHub's user information
type WatchPayload ¶
type WatchPayload struct {
Action string `json:"action"`
Repository Repository `json:"repository"`
Sender Sender `json:"sender"`
}
WatchPayload contains the information for GitHub's watch hook event
type Webhook ¶
type Webhook struct {
// contains filtered or unexported fields
}
Webhook instance contains all methods needed to process events
func (Webhook) ParsePayload ¶
func (hook Webhook) ParsePayload(w http.ResponseWriter, r *http.Request)
ParsePayload parses and verifies the payload and fires off the mapped function, if it exists.
func (Webhook) Provider ¶
func (hook Webhook) Provider() webhooks.Provider
Provider returns the current hooks provider ID
func (Webhook) RegisterEvents ¶
RegisterEvents registers the function to call when the specified event(s) are encountered