webhook

package
v0.0.0-...-1b6f9b2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2015 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Overview

Package webhook implements middleware for GitHub Webhooks. User provides webhook service object that handles events delivered by GitHub. Webhook handler verifies payload signature delivered along with the event, unmarshals it to corresponding event struct and dispatches control to user service.

The types of events are configured up front during webhook creation. Only "application/json" content type is supported for incoming events.

Event types

        Name       |            Type
-------------------+-----------------------------
 commit_comment    | *webhook.CommitCommentEvent
-------------------+-----------------------------
 create            | *webhook.CreateEvent
-------------------+-----------------------------
 delete            | *webhook.DeleteEvent
-------------------+-----------------------------
 deployment        | *webhook.DeploymentEvent
-------------------+-----------------------------
 deployment_status | *webhook.DeploymentStatusEvent
-------------------+-----------------------------
 download          | *webhook.DownloadEvent
-------------------+-----------------------------
 follow            | *webhook.FollowEvent
-------------------+-----------------------------
 fork_apply        | *webhook.ForkApplyEvent
-------------------+-----------------------------
 fork              | *webhook.ForkEvent
-------------------+-----------------------------
 gist              | *webhook.GistEvent
-------------------+-----------------------------
 gollum            | *webhook.GollumEvent
-------------------+-----------------------------
 issue_comment     | *webhook.IssueCommentEvent
-------------------+-----------------------------
 issues            | *webhook.IssuesEvent
-------------------+-----------------------------
 member            | *webhook.MemberEvent
-------------------+-----------------------------
 membership        | *webhook.MembershipEvent
-------------------+-----------------------------
 page_build        | *webhook.PageBuildEvent
-------------------+-----------------------------
 ping              | *webhook.PingEvent
-------------------+-----------------------------
 public            | *webhook.PublicEvent
-------------------+-----------------------------
 pull_request      | *webhook.PullRequestEvent
-------------------+-----------------------------
 push              | *webhook.PushEvent
-------------------+-----------------------------
 release           | *webhook.ReleaseEvent
-------------------+-----------------------------
 repository        | *webhook.RepositoryEvent
-------------------+-----------------------------
 status            | *webhook.StatusEvent
-------------------+-----------------------------
 team_add          | *webhook.TeamAddEvent
-------------------+-----------------------------
 watch             | *webhook.WatchEvent
-------------------+---------+----------------------------------------
 pull_request_review_comment | *webhook.PullRequestReviewCommentEvent
-----------------------------+----------------------------------------

Handler service

Webhook dispatches incoming events to user-provided handler service. Each method that takes *Event struct as a single argument is mapped for handling corresponding event type according to the above table. In order to handle all the events with single method, webhook handler looks up for the method with the following definition:

func (T) MethodName(eventName string, eventPayload interface{})

If a handler service has defined both: methods for handling particular events and method hadling all events, the former has the priority - if there exists no method for handling particular event type, the blanket handler will be used.

Example

The following handler service logs each incoming event.

package main

import (
	"log"
	"net/http"

	"github.com/rjeczalik/gh/webhook"
)

type LoggerService struct{}

func (LoggerService) Ping(event *webhook.PingEvent) {
	log.Printf("supported events: %v", event.Hook.Events)
}

func (LoggerService) Push(event *webhook.PushEvent) {
	log.Printf("%s has pushed to %s", event.Pusher.Email, event.Repository.Name)
}

func (LoggerService) All(name string, event interface{}) {
	log.Println("event", event)
}

func main() {
   log.Fatal(http.ListenAndServe(":8080", webhook.New("secret", LoggerService{}))
}

The "ping" and "push" event are handle accordingly by the Ping and Push methods, all the rest are handled with the All one.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assets

type Assets struct {
	BrowserDownloadURL string   `json:"browser_download_url"`
	ContentType        string   `json:"content_type"`
	CreatedAt          Time     `json:"created_at"`
	DownloadCount      int      `json:"download_count"`
	ID                 int      `json:"id"`
	Label              string   `json:"label"`
	Name               string   `json:"name"`
	Size               int      `json:"size"`
	State              string   `json:"state"`
	URL                string   `json:"url"`
	UpdatedAt          Time     `json:"updated_at"`
	Uploader           Uploader `json:"uploader"`
}

Assets was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Assignee

type Assignee struct {
	AvatarURL         string `json:"avatar_url"`
	EventsURL         string `json:"events_url"`
	FollowersURL      string `json:"followers_url"`
	FollowingURL      string `json:"following_url"`
	GistsURL          string `json:"gists_url"`
	GravatarID        string `json:"gravatar_id"`
	HTMLURL           string `json:"html_url"`
	ID                int    `json:"id"`
	Login             string `json:"login"`
	OrganizationsURL  string `json:"organizations_url"`
	ReceivedEventsURL string `json:"received_events_url"`
	ReposURL          string `json:"repos_url"`
	SiteAdmin         bool   `json:"site_admin"`
	StarredURL        string `json:"starred_url"`
	SubscriptionsURL  string `json:"subscriptions_url"`
	Type              string `json:"type"`
	URL               string `json:"url"`
}

Assignee was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Author

type Author struct {
	AvatarURL         string `json:"avatar_url"`
	Email             string `json:"email"`
	EventsURL         string `json:"events_url"`
	FollowersURL      string `json:"followers_url"`
	FollowingURL      string `json:"following_url"`
	GistsURL          string `json:"gists_url"`
	GravatarID        string `json:"gravatar_id"`
	HTMLURL           string `json:"html_url"`
	ID                int    `json:"id"`
	Login             string `json:"login"`
	Name              string `json:"name"`
	OrganizationsURL  string `json:"organizations_url"`
	ReceivedEventsURL string `json:"received_events_url"`
	ReposURL          string `json:"repos_url"`
	SiteAdmin         bool   `json:"site_admin"`
	StarredURL        string `json:"starred_url"`
	SubscriptionsURL  string `json:"subscriptions_url"`
	Type              string `json:"type"`
	URL               string `json:"url"`
	Username          string `json:"username"`
}

Author was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Base

type Base struct {
	Label string `json:"label"`
	Ref   string `json:"ref"`
	Repo  Repo   `json:"repo"`
	SHA   string `json:"sha"`
	User  User   `json:"user"`
}

Base was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Branches

type Branches struct {
	Commit Commit `json:"commit"`
	Name   string `json:"name"`
}

Branches was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Build

type Build struct {
	Commit    string `json:"commit"`
	CreatedAt Time   `json:"created_at"`
	Duration  int    `json:"duration"`
	Error     Error  `json:"error"`
	Pusher    Pusher `json:"pusher"`
	Status    string `json:"status"`
	URL       string `json:"url"`
	UpdatedAt Time   `json:"updated_at"`
}

Build was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type ChangeStatus

type ChangeStatus struct {
	Additions int `json:"additions"`
	Deletions int `json:"deletions"`
	Total     int `json:"total"`
}

ChangeStatus was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Comment

type Comment struct {
	Body             string `json:"body"`
	CommitID         string `json:"commit_id"`
	CreatedAt        Time   `json:"created_at"`
	DiffHunk         string `json:"diff_hunk"`
	HTMLURL          string `json:"html_url"`
	ID               int    `json:"id"`
	IssueURL         string `json:"issue_url"`
	Line             int    `json:"line"`
	OriginalCommitID string `json:"original_commit_id"`
	OriginalPosition int    `json:"original_position"`
	Path             string `json:"path"`
	Position         int    `json:"position"`
	PullRequestURL   string `json:"pull_request_url"`
	URL              string `json:"url"`
	UpdatedAt        Time   `json:"updated_at"`
	User             User   `json:"user"`
}

Comment was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Commit

type Commit struct {
	Author      Author    `json:"author"`
	CommentsURL string    `json:"comments_url"`
	Committer   Committer `json:"committer"`
	HTMLURL     string    `json:"html_url"`
	Parents     []Parents `json:"parents"`
	SHA         string    `json:"sha"`
	URL         string    `json:"url"`
}

Commit was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type CommitCommentEvent

type CommitCommentEvent struct {
	Action     string     `json:"action"`
	Comment    Comment    `json:"comment"`
	Repository Repository `json:"repository"`
	Sender     Sender     `json:"sender"`
}

CommitCommentEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Commits

type Commits struct {
	Added     []string  `json:"added"`
	Author    Author    `json:"author"`
	Committer Committer `json:"committer"`
	Distinct  bool      `json:"distinct"`
	ID        string    `json:"id"`
	Message   string    `json:"message"`
	Modified  []string  `json:"modified"`
	Removed   []string  `json:"removed"`
	Timestamp Time      `json:"timestamp"`
	URL       string    `json:"url"`
}

Commits was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Committer

type Committer struct {
	AvatarURL         string `json:"avatar_url"`
	Email             string `json:"email"`
	EventsURL         string `json:"events_url"`
	FollowersURL      string `json:"followers_url"`
	FollowingURL      string `json:"following_url"`
	GistsURL          string `json:"gists_url"`
	GravatarID        string `json:"gravatar_id"`
	HTMLURL           string `json:"html_url"`
	ID                int    `json:"id"`
	Login             string `json:"login"`
	Name              string `json:"name"`
	OrganizationsURL  string `json:"organizations_url"`
	ReceivedEventsURL string `json:"received_events_url"`
	ReposURL          string `json:"repos_url"`
	SiteAdmin         bool   `json:"site_admin"`
	StarredURL        string `json:"starred_url"`
	SubscriptionsURL  string `json:"subscriptions_url"`
	Type              string `json:"type"`
	URL               string `json:"url"`
	Username          string `json:"username"`
}

Committer was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Config

type Config struct {
	ContentType string `json:"content_type"`
	URL         string `json:"url"`
}

Config was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type CreateEvent

type CreateEvent struct {
	Description  string     `json:"description"`
	MasterBranch string     `json:"master_branch"`
	PusherType   string     `json:"pusher_type"`
	Ref          string     `json:"ref"`
	RefType      string     `json:"ref_type"`
	Repository   Repository `json:"repository"`
	Sender       Sender     `json:"sender"`
}

CreateEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Creator

type Creator struct {
	AvatarURL         string `json:"avatar_url"`
	EventsURL         string `json:"events_url"`
	FollowersURL      string `json:"followers_url"`
	FollowingURL      string `json:"following_url"`
	GistsURL          string `json:"gists_url"`
	GravatarID        string `json:"gravatar_id"`
	HTMLURL           string `json:"html_url"`
	ID                int    `json:"id"`
	Login             string `json:"login"`
	OrganizationsURL  string `json:"organizations_url"`
	ReceivedEventsURL string `json:"received_events_url"`
	ReposURL          string `json:"repos_url"`
	SiteAdmin         bool   `json:"site_admin"`
	StarredURL        string `json:"starred_url"`
	SubscriptionsURL  string `json:"subscriptions_url"`
	Type              string `json:"type"`
	URL               string `json:"url"`
}

Creator was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type DeleteEvent

type DeleteEvent struct {
	PusherType string     `json:"pusher_type"`
	Ref        string     `json:"ref"`
	RefType    string     `json:"ref_type"`
	Repository Repository `json:"repository"`
	Sender     Sender     `json:"sender"`
}

DeleteEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Deployment

type Deployment struct {
	CreatedAt     Time    `json:"created_at"`
	Creator       Creator `json:"creator"`
	Description   string  `json:"description"`
	Environment   string  `json:"environment"`
	ID            int     `json:"id"`
	Payload       Payload `json:"payload"`
	Ref           string  `json:"ref"`
	RepositoryURL string  `json:"repository_url"`
	SHA           string  `json:"sha"`
	StatusesURL   string  `json:"statuses_url"`
	Task          string  `json:"task"`
	URL           string  `json:"url"`
	UpdatedAt     Time    `json:"updated_at"`
}

Deployment was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type DeploymentEvent

type DeploymentEvent struct {
	Deployment Deployment `json:"deployment"`
	Repository Repository `json:"repository"`
	Sender     Sender     `json:"sender"`
}

DeploymentEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type DeploymentStatus

type DeploymentStatus struct {
	CreatedAt     Time    `json:"created_at"`
	Creator       Creator `json:"creator"`
	DeploymentURL string  `json:"deployment_url"`
	Description   string  `json:"description"`
	ID            int     `json:"id"`
	RepositoryURL string  `json:"repository_url"`
	State         string  `json:"state"`
	TargetURL     string  `json:"target_url"`
	URL           string  `json:"url"`
	UpdatedAt     Time    `json:"updated_at"`
}

DeploymentStatus was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type DeploymentStatusEvent

type DeploymentStatusEvent struct {
	Deployment       Deployment       `json:"deployment"`
	DeploymentStatus DeploymentStatus `json:"deployment_status"`
	Repository       Repository       `json:"repository"`
	Sender           Sender           `json:"sender"`
}

DeploymentStatusEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type DownloadEvent

type DownloadEvent struct {
	ContentType   string `json:"content_type"`
	Description   string `json:"description"`
	DownloadCount int    `json:"download_count"`
	HTMLURL       string `json:"html_url"`
	ID            int    `json:"id"`
	Name          string `json:"name"`
	Size          int    `json:"size"`
	URL           string `json:"url"`
}

DownloadEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Dumper

type Dumper struct {
	Handler http.Handler // underlying handler
	Dir     string       // directory where files are written

	// ErrorLog specifies an optional logger for errors serving requests.
	// If nil, logging goes to os.Stderr via the log package's standard logger.
	ErrorLog *log.Logger

	// WriteFile specifies an optional file writer.
	// If nil, ioutil.WriteFile is used instead.
	WriteFile func(string, []byte, os.FileMode) error
}

Dumper is a helper handler, which wraps other http.Handler and dumps its requests' bodies to files in Dir directory and named after <event>-<delivery>.json, where:

  • <event> is value of X-GitHub-Event header
  • <delivery> is value of X-GitHub-Delivery header

If headers are missing, current time is used instead.

func Dump

func Dump(dir string, handler http.Handler) *Dumper

Dump creates new Dumper handler, which wraps a webhook handler and dumps each request's body to a file. It was added for *webhook.Handler in mind, but works on every generic http.Handler.

If the destination directory is empty, Dump uses ioutil.TempDir instead. If the destination directory is a relative path, Dump uses filepath.Abs on it.

If either of the above functions fails, Dump panics. If handler is a *webhook Handler and its ErrorLog field is non-nil, Dump uses it for logging.

func (*Dumper) ServeHTTP

func (d *Dumper) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP implements the http.Handler interface.

type Error

type Error struct {
	Message string `json:"message"`
}

Error was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type File

type File struct {
	Size      int    `json:"size"`
	RawURL    string `json:"raw_url"`
	Type      string `json:"type"`
	Truncated bool   `json:"truncated"`
	Language  string `json:"language"`
}

File was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Files

type Files map[string]File

Files was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type FollowEvent

type FollowEvent struct {
	AvatarURL         string `json:"avatar_url"`
	Bio               string `json:"bio"`
	Blog              string `json:"blog"`
	Company           string `json:"company"`
	CreatedAt         Time   `json:"created_at"`
	Email             string `json:"email"`
	EventsURL         string `json:"events_url"`
	Followers         int    `json:"followers"`
	FollowersURL      string `json:"followers_url"`
	Following         int    `json:"following"`
	FollowingURL      string `json:"following_url"`
	GistsURL          string `json:"gists_url"`
	GravatarID        string `json:"gravatar_id"`
	HTMLURL           string `json:"html_url"`
	Hireable          bool   `json:"hireable"`
	ID                int    `json:"id"`
	Location          string `json:"location"`
	Login             string `json:"login"`
	Name              string `json:"name"`
	OrganizationsURL  string `json:"organizations_url"`
	PublicGists       int    `json:"public_gists"`
	PublicRepos       int    `json:"public_repos"`
	ReceivedEventsURL string `json:"received_events_url"`
	ReposURL          string `json:"repos_url"`
	SiteAdmin         bool   `json:"site_admin"`
	StarredURL        string `json:"starred_url"`
	SubscriptionsURL  string `json:"subscriptions_url"`
	Type              string `json:"type"`
	URL               string `json:"url"`
	UpdatedAt         Time   `json:"updated_at"`
}

FollowEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type ForkApplyEvent

type ForkApplyEvent struct {
	After  string `json:"after"`
	Before string `json:"before"`
	Head   string `json:"head"`
}

ForkApplyEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type ForkEvent

type ForkEvent struct {
	Forkee     Forkee     `json:"forkee"`
	Repository Repository `json:"repository"`
	Sender     Sender     `json:"sender"`
}

ForkEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Forkee

type Forkee struct {
	ArchiveURL       string `json:"archive_url"`
	AssigneesURL     string `json:"assignees_url"`
	BlobsURL         string `json:"blobs_url"`
	BranchesURL      string `json:"branches_url"`
	CloneURL         string `json:"clone_url"`
	CollaboratorsURL string `json:"collaborators_url"`
	CommentsURL      string `json:"comments_url"`
	CommitsURL       string `json:"commits_url"`
	CompareURL       string `json:"compare_url"`
	ContentsURL      string `json:"contents_url"`
	ContributorsURL  string `json:"contributors_url"`
	CreatedAt        Time   `json:"created_at"`
	DefaultBranch    string `json:"default_branch"`
	Description      string `json:"description"`
	DownloadsURL     string `json:"downloads_url"`
	EventsURL        string `json:"events_url"`
	Fork             bool   `json:"fork"`
	Forks            int    `json:"forks"`
	ForksCount       int    `json:"forks_count"`
	ForksURL         string `json:"forks_url"`
	FullName         string `json:"full_name"`
	GitCommitsURL    string `json:"git_commits_url"`
	GitRefsURL       string `json:"git_refs_url"`
	GitTagsURL       string `json:"git_tags_url"`
	GitURL           string `json:"git_url"`
	HTMLURL          string `json:"html_url"`
	HasDownloads     bool   `json:"has_downloads"`
	HasIssues        bool   `json:"has_issues"`
	HasPages         bool   `json:"has_pages"`
	HasWiki          bool   `json:"has_wiki"`
	Homepage         string `json:"homepage"`
	HooksURL         string `json:"hooks_url"`
	ID               int    `json:"id"`
	IssueCommentURL  string `json:"issue_comment_url"`
	IssueEventsURL   string `json:"issue_events_url"`
	IssuesURL        string `json:"issues_url"`
	KeysURL          string `json:"keys_url"`
	LabelsURL        string `json:"labels_url"`
	Language         string `json:"language"`
	LanguagesURL     string `json:"languages_url"`
	MergesURL        string `json:"merges_url"`
	MilestonesURL    string `json:"milestones_url"`
	MirrorURL        string `json:"mirror_url"`
	Name             string `json:"name"`
	NotificationsURL string `json:"notifications_url"`
	OpenIssues       int    `json:"open_issues"`
	OpenIssuesCount  int    `json:"open_issues_count"`
	Owner            Owner  `json:"owner"`
	Private          bool   `json:"private"`
	Public           bool   `json:"public"`
	PullsURL         string `json:"pulls_url"`
	PushedAt         Time   `json:"pushed_at"`
	ReleasesURL      string `json:"releases_url"`
	SSHURL           string `json:"ssh_url"`
	Size             int    `json:"size"`
	StargazersCount  int    `json:"stargazers_count"`
	StargazersURL    string `json:"stargazers_url"`
	StatusesURL      string `json:"statuses_url"`
	SubscribersURL   string `json:"subscribers_url"`
	SubscriptionURL  string `json:"subscription_url"`
	SvnURL           string `json:"svn_url"`
	TagsURL          string `json:"tags_url"`
	TeamsURL         string `json:"teams_url"`
	TreesURL         string `json:"trees_url"`
	URL              string `json:"url"`
	UpdatedAt        Time   `json:"updated_at"`
	Watchers         int    `json:"watchers"`
	WatchersCount    int    `json:"watchers_count"`
}

Forkee was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Forks

type Forks struct {
	CreatedAt Time   `json:"created_at"`
	ID        string `json:"id"`
	URL       string `json:"url"`
	UpdatedAt Time   `json:"updated_at"`
	User      User   `json:"user"`
}

Forks was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Gist

type Gist struct {
	Comments    int       `json:"comments"`
	CommentsURL string    `json:"comments_url"`
	CommitsURL  string    `json:"commits_url"`
	CreatedAt   Time      `json:"created_at"`
	Description string    `json:"description"`
	Files       Files     `json:"files"`
	Forks       []Forks   `json:"forks"`
	ForksURL    string    `json:"forks_url"`
	GitPullURL  string    `json:"git_pull_url"`
	GitPushURL  string    `json:"git_push_url"`
	HTMLURL     string    `json:"html_url"`
	History     []History `json:"history"`
	ID          string    `json:"id"`
	Owner       Owner     `json:"owner"`
	Public      bool      `json:"public"`
	URL         string    `json:"url"`
	UpdatedAt   Time      `json:"updated_at"`
	User        User      `json:"user"`
}

Gist was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type GistEvent

type GistEvent struct {
	Action string `json:"action"`
	Gist   Gist   `json:"gist"`
}

GistEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type GollumEvent

type GollumEvent struct {
	Pages      []Pages    `json:"pages"`
	Repository Repository `json:"repository"`
	Sender     Sender     `json:"sender"`
}

GollumEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Handler

type Handler struct {
	// ErrorLog specifies an optional logger for errors serving requests.
	// If nil, logging goes to os.Stderr via the log package's standard logger.
	ErrorLog *log.Logger
	// ContextFunc generates context with given http.Request
	// If nil, event handlers creates empty context objects
	ContextFunc func(*http.Request) context.Context
	// contains filtered or unexported fields
}

Handler is a middleware that handles webhook's HTTP requests.

func New

func New(secret string, rcvr interface{}) *Handler

New creates new middleware and registers receiver's method for event handling. It panics if receiver has multiple methods that take the same type of event as an argument.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP implements the http.Handler interface.

type Head struct {
	Label string `json:"label"`
	Ref   string `json:"ref"`
	Repo  Repo   `json:"repo"`
	SHA   string `json:"sha"`
	User  User   `json:"user"`
}

Head was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type HeadCommit

type HeadCommit struct {
	Added     []string  `json:"added"`
	Author    Author    `json:"author"`
	Committer Committer `json:"committer"`
	Distinct  bool      `json:"distinct"`
	ID        string    `json:"id"`
	Message   string    `json:"message"`
	Modified  []string  `json:"modified"`
	Removed   []string  `json:"removed"`
	Timestamp Time      `json:"timestamp"`
	URL       string    `json:"url"`
}

HeadCommit was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type History

type History struct {
	ChangeStatus ChangeStatus `json:"change_status"`
	CommittedAt  Time         `json:"committed_at"`
	URL          string       `json:"url"`
	User         User         `json:"user"`
	Version      string       `json:"version"`
}

History was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Hook

type Hook struct {
	Active    bool     `json:"active"`
	Config    Config   `json:"config"`
	CreatedAt Time     `json:"created_at"`
	Events    []string `json:"events"`
	ID        int      `json:"id"`
	Name      string   `json:"name"`
	PingURL   string   `json:"ping_url"`
	TestURL   string   `json:"test_url"`
	URL       string   `json:"url"`
	UpdatedAt Time     `json:"updated_at"`
}

Hook was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Issue

type Issue struct {
	Assignee    User      `json:"assignee"`
	Body        string    `json:"body"`
	ClosedAt    Time      `json:"closed_at"`
	Comments    int       `json:"comments"`
	CommentsURL string    `json:"comments_url"`
	CreatedAt   Time      `json:"created_at"`
	EventsURL   string    `json:"events_url"`
	HTMLURL     string    `json:"html_url"`
	ID          int       `json:"id"`
	Labels      []Labels  `json:"labels"`
	LabelsURL   string    `json:"labels_url"`
	Locked      bool      `json:"locked"`
	Milestone   Milestone `json:"milestone"`
	Number      int       `json:"number"`
	State       string    `json:"state"`
	Title       string    `json:"title"`
	URL         string    `json:"url"`
	UpdatedAt   Time      `json:"updated_at"`
	User        User      `json:"user"`
}

Issue was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type IssueCommentEvent

type IssueCommentEvent struct {
	Action     string     `json:"action"`
	Comment    Comment    `json:"comment"`
	Issue      Issue      `json:"issue"`
	Repository Repository `json:"repository"`
	Sender     Sender     `json:"sender"`
}

IssueCommentEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type IssuesEvent

type IssuesEvent struct {
	Action     string     `json:"action"`
	Issue      Issue      `json:"issue"`
	Repository Repository `json:"repository"`
	Sender     Sender     `json:"sender"`
}

IssuesEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Labels

type Labels struct {
	Color string `json:"color"`
	Name  string `json:"name"`
	URL   string `json:"url"`
}

Labels was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Member

type Member struct {
	AvatarURL         string `json:"avatar_url"`
	EventsURL         string `json:"events_url"`
	FollowersURL      string `json:"followers_url"`
	FollowingURL      string `json:"following_url"`
	GistsURL          string `json:"gists_url"`
	GravatarID        string `json:"gravatar_id"`
	HTMLURL           string `json:"html_url"`
	ID                int    `json:"id"`
	Login             string `json:"login"`
	OrganizationsURL  string `json:"organizations_url"`
	ReceivedEventsURL string `json:"received_events_url"`
	ReposURL          string `json:"repos_url"`
	SiteAdmin         bool   `json:"site_admin"`
	StarredURL        string `json:"starred_url"`
	SubscriptionsURL  string `json:"subscriptions_url"`
	Type              string `json:"type"`
	URL               string `json:"url"`
}

Member was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type MemberEvent

type MemberEvent struct {
	Action     string     `json:"action"`
	Member     Member     `json:"member"`
	Repository Repository `json:"repository"`
	Sender     Sender     `json:"sender"`
}

MemberEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type MembershipEvent

type MembershipEvent struct {
	Action       string       `json:"action"`
	Member       Member       `json:"member"`
	Organization Organization `json:"organization"`
	Scope        string       `json:"scope"`
	Sender       Sender       `json:"sender"`
	Team         Team         `json:"team"`
}

MembershipEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Milestone

type Milestone struct {
	Creator     Creator `json:"creator"`
	Description string  `json:"description"`
	HTMLURL     string  `json:"html_url"`
	ID          int     `json:"id"`
	LabelsURL   string  `json:"labels_url"`
	Number      int     `json:"number"`
	Title       string  `json:"title"`
	URL         string  `json:"url"`
}

Milestone was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Organization

type Organization struct {
	AvatarURL        string `json:"avatar_url"`
	Description      string `json:"description"`
	EventsURL        string `json:"events_url"`
	ID               int    `json:"id"`
	Login            string `json:"login"`
	MembersURL       string `json:"members_url"`
	PublicMembersURL string `json:"public_members_url"`
	ReposURL         string `json:"repos_url"`
	URL              string `json:"url"`
}

Organization was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Owner

type Owner struct {
	AvatarURL         string `json:"avatar_url"`
	Email             string `json:"email"`
	EventsURL         string `json:"events_url"`
	FollowersURL      string `json:"followers_url"`
	FollowingURL      string `json:"following_url"`
	GistsURL          string `json:"gists_url"`
	GravatarID        string `json:"gravatar_id"`
	HTMLURL           string `json:"html_url"`
	ID                int    `json:"id"`
	Login             string `json:"login"`
	Name              string `json:"name"`
	OrganizationsURL  string `json:"organizations_url"`
	ReceivedEventsURL string `json:"received_events_url"`
	ReposURL          string `json:"repos_url"`
	SiteAdmin         bool   `json:"site_admin"`
	StarredURL        string `json:"starred_url"`
	SubscriptionsURL  string `json:"subscriptions_url"`
	Type              string `json:"type"`
	URL               string `json:"url"`
}

Owner was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type PageBuildEvent

type PageBuildEvent struct {
	Build      Build      `json:"build"`
	ID         int        `json:"id"`
	Repository Repository `json:"repository"`
	Sender     Sender     `json:"sender"`
}

PageBuildEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Pages

type Pages struct {
	Action   string `json:"action"`
	HTMLURL  string `json:"html_url"`
	PageName string `json:"page_name"`
	SHA      string `json:"sha"`
	Summary  string `json:"summary"`
	Title    string `json:"title"`
}

Pages was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Parents

type Parents struct {
	HTMLURL string `json:"html_url"`
	SHA     string `json:"sha"`
	URL     string `json:"url"`
}

Parents was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Payload

type Payload struct {
}

Payload was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type PingEvent

type PingEvent struct {
	Hook   Hook   `json:"hook"`
	HookID int    `json:"hook_id"`
	Zen    string `json:"zen"`
}

PingEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type PublicEvent

type PublicEvent struct {
	Repository Repository `json:"repository"`
	Sender     Sender     `json:"sender"`
}

PublicEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type PullRequest

type PullRequest struct {
	Additions         int       `json:"additions"`
	Assignee          User      `json:"assignee"`
	Base              Base      `json:"base"`
	Body              string    `json:"body"`
	ChangedFiles      int       `json:"changed_files"`
	ClosedAt          Time      `json:"closed_at"`
	Comments          int       `json:"comments"`
	CommentsURL       string    `json:"comments_url"`
	Commits           int       `json:"commits"`
	CommitsURL        string    `json:"commits_url"`
	CreatedAt         Time      `json:"created_at"`
	Deletions         int       `json:"deletions"`
	DiffURL           string    `json:"diff_url"`
	HTMLURL           string    `json:"html_url"`
	Head              Head      `json:"head"`
	ID                int       `json:"id"`
	IssueURL          string    `json:"issue_url"`
	Locked            bool      `json:"locked"`
	MergeCommitSHA    string    `json:"merge_commit_sha"`
	Mergeable         bool      `json:"mergeable"`
	MergeableState    string    `json:"mergeable_state"`
	Merged            bool      `json:"merged"`
	MergedAt          Time      `json:"merged_at"`
	MergedBy          User      `json:"merged_by"`
	Milestone         Milestone `json:"milestone"`
	Number            int       `json:"number"`
	PatchURL          string    `json:"patch_url"`
	ReviewCommentURL  string    `json:"review_comment_url"`
	ReviewComments    int       `json:"review_comments"`
	ReviewCommentsURL string    `json:"review_comments_url"`
	State             string    `json:"state"`
	StatusesURL       string    `json:"statuses_url"`
	Title             string    `json:"title"`
	URL               string    `json:"url"`
	UpdatedAt         Time      `json:"updated_at"`
	User              User      `json:"user"`
}

PullRequest was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type PullRequestEvent

type PullRequestEvent struct {
	Action      string      `json:"action"`
	Assignee    Assignee    `json:"assignee"`
	Number      int         `json:"number"`
	PullRequest PullRequest `json:"pull_request"`
	Repository  Repository  `json:"repository"`
	Sender      Sender      `json:"sender"`
}

PullRequestEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type PullRequestReviewCommentEvent

type PullRequestReviewCommentEvent struct {
	Action      string      `json:"action"`
	Comment     Comment     `json:"comment"`
	PullRequest PullRequest `json:"pull_request"`
	Repository  Repository  `json:"repository"`
	Sender      Sender      `json:"sender"`
}

PullRequestReviewCommentEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type PushEvent

type PushEvent struct {
	After      string     `json:"after"`
	BaseRef    string     `json:"base_ref"`
	Before     string     `json:"before"`
	Commits    []Commits  `json:"commits"`
	Compare    string     `json:"compare"`
	Created    bool       `json:"created"`
	Deleted    bool       `json:"deleted"`
	Forced     bool       `json:"forced"`
	HeadCommit HeadCommit `json:"head_commit"`
	Pusher     Pusher     `json:"pusher"`
	Ref        string     `json:"ref"`
	Repository Repository `json:"repository"`
	Sender     Sender     `json:"sender"`
}

PushEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Pusher

type Pusher struct {
	AvatarURL         string `json:"avatar_url"`
	Email             string `json:"email"`
	EventsURL         string `json:"events_url"`
	FollowersURL      string `json:"followers_url"`
	FollowingURL      string `json:"following_url"`
	GistsURL          string `json:"gists_url"`
	GravatarID        string `json:"gravatar_id"`
	HTMLURL           string `json:"html_url"`
	ID                int    `json:"id"`
	Login             string `json:"login"`
	Name              string `json:"name"`
	OrganizationsURL  string `json:"organizations_url"`
	ReceivedEventsURL string `json:"received_events_url"`
	ReposURL          string `json:"repos_url"`
	SiteAdmin         bool   `json:"site_admin"`
	StarredURL        string `json:"starred_url"`
	SubscriptionsURL  string `json:"subscriptions_url"`
	Type              string `json:"type"`
	URL               string `json:"url"`
}

Pusher was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Release

type Release struct {
	Assets          []Assets `json:"assets"`
	AssetsURL       string   `json:"assets_url"`
	Author          Author   `json:"author"`
	Body            string   `json:"body"`
	CreatedAt       Time     `json:"created_at"`
	Draft           bool     `json:"draft"`
	HTMLURL         string   `json:"html_url"`
	ID              int      `json:"id"`
	Name            string   `json:"name"`
	Prerelease      bool     `json:"prerelease"`
	PublishedAt     Time     `json:"published_at"`
	TagName         string   `json:"tag_name"`
	TarballURL      string   `json:"tarball_url"`
	TargetCommitish string   `json:"target_commitish"`
	URL             string   `json:"url"`
	UploadURL       string   `json:"upload_url"`
	ZipballURL      string   `json:"zipball_url"`
}

Release was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type ReleaseEvent

type ReleaseEvent struct {
	Action     string     `json:"action"`
	Release    Release    `json:"release"`
	Repository Repository `json:"repository"`
	Sender     Sender     `json:"sender"`
}

ReleaseEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Repo

type Repo struct {
	ArchiveURL       string `json:"archive_url"`
	AssigneesURL     string `json:"assignees_url"`
	BlobsURL         string `json:"blobs_url"`
	BranchesURL      string `json:"branches_url"`
	CloneURL         string `json:"clone_url"`
	CollaboratorsURL string `json:"collaborators_url"`
	CommentsURL      string `json:"comments_url"`
	CommitsURL       string `json:"commits_url"`
	CompareURL       string `json:"compare_url"`
	ContentsURL      string `json:"contents_url"`
	ContributorsURL  string `json:"contributors_url"`
	CreatedAt        Time   `json:"created_at"`
	DefaultBranch    string `json:"default_branch"`
	Description      string `json:"description"`
	DownloadsURL     string `json:"downloads_url"`
	EventsURL        string `json:"events_url"`
	Fork             bool   `json:"fork"`
	Forks            int    `json:"forks"`
	ForksCount       int    `json:"forks_count"`
	ForksURL         string `json:"forks_url"`
	FullName         string `json:"full_name"`
	GitCommitsURL    string `json:"git_commits_url"`
	GitRefsURL       string `json:"git_refs_url"`
	GitTagsURL       string `json:"git_tags_url"`
	GitURL           string `json:"git_url"`
	HTMLURL          string `json:"html_url"`
	HasDownloads     bool   `json:"has_downloads"`
	HasIssues        bool   `json:"has_issues"`
	HasPages         bool   `json:"has_pages"`
	HasWiki          bool   `json:"has_wiki"`
	Homepage         string `json:"homepage"`
	HooksURL         string `json:"hooks_url"`
	ID               int    `json:"id"`
	IssueCommentURL  string `json:"issue_comment_url"`
	IssueEventsURL   string `json:"issue_events_url"`
	IssuesURL        string `json:"issues_url"`
	KeysURL          string `json:"keys_url"`
	LabelsURL        string `json:"labels_url"`
	Language         string `json:"language"`
	LanguagesURL     string `json:"languages_url"`
	MergesURL        string `json:"merges_url"`
	MilestonesURL    string `json:"milestones_url"`
	MirrorURL        string `json:"mirror_url"`
	Name             string `json:"name"`
	NotificationsURL string `json:"notifications_url"`
	OpenIssues       int    `json:"open_issues"`
	OpenIssuesCount  int    `json:"open_issues_count"`
	Owner            Owner  `json:"owner"`
	Private          bool   `json:"private"`
	PullsURL         string `json:"pulls_url"`
	PushedAt         Time   `json:"pushed_at"`
	ReleasesURL      string `json:"releases_url"`
	SSHURL           string `json:"ssh_url"`
	Size             int    `json:"size"`
	StargazersCount  int    `json:"stargazers_count"`
	StargazersURL    string `json:"stargazers_url"`
	StatusesURL      string `json:"statuses_url"`
	SubscribersURL   string `json:"subscribers_url"`
	SubscriptionURL  string `json:"subscription_url"`
	SvnURL           string `json:"svn_url"`
	TagsURL          string `json:"tags_url"`
	TeamsURL         string `json:"teams_url"`
	TreesURL         string `json:"trees_url"`
	URL              string `json:"url"`
	UpdatedAt        Time   `json:"updated_at"`
	Watchers         int    `json:"watchers"`
	WatchersCount    int    `json:"watchers_count"`
}

Repo was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Repository

type Repository struct {
	ArchiveURL       string `json:"archive_url"`
	AssigneesURL     string `json:"assignees_url"`
	BlobsURL         string `json:"blobs_url"`
	BranchesURL      string `json:"branches_url"`
	CloneURL         string `json:"clone_url"`
	CollaboratorsURL string `json:"collaborators_url"`
	CommentsURL      string `json:"comments_url"`
	CommitsURL       string `json:"commits_url"`
	CompareURL       string `json:"compare_url"`
	ContentsURL      string `json:"contents_url"`
	ContributorsURL  string `json:"contributors_url"`
	CreatedAt        Time   `json:"created_at"`
	DefaultBranch    string `json:"default_branch"`
	Description      string `json:"description"`
	DownloadsURL     string `json:"downloads_url"`
	EventsURL        string `json:"events_url"`
	Fork             bool   `json:"fork"`
	Forks            int    `json:"forks"`
	ForksCount       int    `json:"forks_count"`
	ForksURL         string `json:"forks_url"`
	FullName         string `json:"full_name"`
	GitCommitsURL    string `json:"git_commits_url"`
	GitRefsURL       string `json:"git_refs_url"`
	GitTagsURL       string `json:"git_tags_url"`
	GitURL           string `json:"git_url"`
	HTMLURL          string `json:"html_url"`
	HasDownloads     bool   `json:"has_downloads"`
	HasIssues        bool   `json:"has_issues"`
	HasPages         bool   `json:"has_pages"`
	HasWiki          bool   `json:"has_wiki"`
	Homepage         string `json:"homepage"`
	HooksURL         string `json:"hooks_url"`
	ID               int    `json:"id"`
	IssueCommentURL  string `json:"issue_comment_url"`
	IssueEventsURL   string `json:"issue_events_url"`
	IssuesURL        string `json:"issues_url"`
	KeysURL          string `json:"keys_url"`
	LabelsURL        string `json:"labels_url"`
	Language         string `json:"language"`
	LanguagesURL     string `json:"languages_url"`
	MasterBranch     string `json:"master_branch"`
	MergesURL        string `json:"merges_url"`
	MilestonesURL    string `json:"milestones_url"`
	MirrorURL        string `json:"mirror_url"`
	Name             string `json:"name"`
	NotificationsURL string `json:"notifications_url"`
	OpenIssues       int    `json:"open_issues"`
	OpenIssuesCount  int    `json:"open_issues_count"`
	Owner            Owner  `json:"owner"`
	Private          bool   `json:"private"`
	PullsURL         string `json:"pulls_url"`
	PushedAt         Time   `json:"pushed_at"`
	ReleasesURL      string `json:"releases_url"`
	SSHURL           string `json:"ssh_url"`
	Size             int    `json:"size"`
	Stargazers       int    `json:"stargazers"`
	StargazersCount  int    `json:"stargazers_count"`
	StargazersURL    string `json:"stargazers_url"`
	StatusesURL      string `json:"statuses_url"`
	SubscribersURL   string `json:"subscribers_url"`
	SubscriptionURL  string `json:"subscription_url"`
	SvnURL           string `json:"svn_url"`
	TagsURL          string `json:"tags_url"`
	TeamsURL         string `json:"teams_url"`
	TreesURL         string `json:"trees_url"`
	URL              string `json:"url"`
	UpdatedAt        Time   `json:"updated_at"`
	Watchers         int    `json:"watchers"`
	WatchersCount    int    `json:"watchers_count"`
}

Repository was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type RepositoryEvent

type RepositoryEvent struct {
	Action       string       `json:"action"`
	Organization Organization `json:"organization"`
	Repository   Repository   `json:"repository"`
	Sender       Sender       `json:"sender"`
}

RepositoryEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Sender

type Sender struct {
	AvatarURL         string `json:"avatar_url"`
	EventsURL         string `json:"events_url"`
	FollowersURL      string `json:"followers_url"`
	FollowingURL      string `json:"following_url"`
	GistsURL          string `json:"gists_url"`
	GravatarID        string `json:"gravatar_id"`
	HTMLURL           string `json:"html_url"`
	ID                int    `json:"id"`
	Login             string `json:"login"`
	OrganizationsURL  string `json:"organizations_url"`
	ReceivedEventsURL string `json:"received_events_url"`
	ReposURL          string `json:"repos_url"`
	SiteAdmin         bool   `json:"site_admin"`
	StarredURL        string `json:"starred_url"`
	SubscriptionsURL  string `json:"subscriptions_url"`
	Type              string `json:"type"`
	URL               string `json:"url"`
}

Sender was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type StatusEvent

type StatusEvent struct {
	Branches    []Branches `json:"branches"`
	Commit      Commit     `json:"commit"`
	Context     string     `json:"context"`
	CreatedAt   Time       `json:"created_at"`
	Description string     `json:"description"`
	ID          int        `json:"id"`
	Name        string     `json:"name"`
	Repository  Repository `json:"repository"`
	SHA         string     `json:"sha"`
	Sender      Sender     `json:"sender"`
	State       string     `json:"state"`
	TargetURL   string     `json:"target_url"`
	UpdatedAt   Time       `json:"updated_at"`
}

StatusEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Team

type Team struct {
	Description     string `json:"description"`
	ID              int    `json:"id"`
	MembersURL      string `json:"members_url"`
	Name            string `json:"name"`
	Permission      string `json:"permission"`
	RepositoriesURL string `json:"repositories_url"`
	Slug            string `json:"slug"`
	URL             string `json:"url"`
}

Team was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type TeamAddEvent

type TeamAddEvent struct {
	Organization Organization `json:"organization"`
	Repository   Repository   `json:"repository"`
	Sender       Sender       `json:"sender"`
	Team         Team         `json:"team"`
}

TeamAddEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type Time

type Time struct {
	time.Time
}

Time embeds time.Time. The wrapper allows for unmarshalling time from JSON null value or unix timestamp.

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. The time is a quoted string in RFC 3339 format or "null" if it's a zero value.

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(p []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface. The time is expected to be a quoted string in RFC 3339 format, a unix timestamp or a "null" string.

type Uploader

type Uploader struct {
	AvatarURL         string `json:"avatar_url"`
	EventsURL         string `json:"events_url"`
	FollowersURL      string `json:"followers_url"`
	FollowingURL      string `json:"following_url"`
	GistsURL          string `json:"gists_url"`
	GravatarID        string `json:"gravatar_id"`
	HTMLURL           string `json:"html_url"`
	ID                int    `json:"id"`
	Login             string `json:"login"`
	OrganizationsURL  string `json:"organizations_url"`
	ReceivedEventsURL string `json:"received_events_url"`
	ReposURL          string `json:"repos_url"`
	SiteAdmin         bool   `json:"site_admin"`
	StarredURL        string `json:"starred_url"`
	SubscriptionsURL  string `json:"subscriptions_url"`
	Type              string `json:"type"`
	URL               string `json:"url"`
}

Uploader was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type User

type User struct {
	AvatarURL         string `json:"avatar_url"`
	EventsURL         string `json:"events_url"`
	FollowersURL      string `json:"followers_url"`
	FollowingURL      string `json:"following_url"`
	GistsURL          string `json:"gists_url"`
	GravatarID        string `json:"gravatar_id"`
	HTMLURL           string `json:"html_url"`
	ID                int    `json:"id"`
	Login             string `json:"login"`
	OrganizationsURL  string `json:"organizations_url"`
	ReceivedEventsURL string `json:"received_events_url"`
	ReposURL          string `json:"repos_url"`
	SiteAdmin         bool   `json:"site_admin"`
	StarredURL        string `json:"starred_url"`
	SubscriptionsURL  string `json:"subscriptions_url"`
	Type              string `json:"type"`
	URL               string `json:"url"`
}

User was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

type WatchEvent

type WatchEvent struct {
	Action     string     `json:"action"`
	Repository Repository `json:"repository"`
	Sender     Sender     `json:"sender"`
}

WatchEvent was autogenerated by go generate. To see more details about this payload type visit https://developer.github.com/v3/activity/events/types.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL