github

package
v0.0.0-...-781ef27 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2017 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	EventActionOpened   = "opened"
	EventActionClosed   = "closed"
	EventActionReopened = "reopened"
)

SupportedPullRequestActions defines all pull request event actions which are supported by this app.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticatedGithubClient

type AuthenticatedGithubClient struct {
	Client *gh.Client
	// contains filtered or unexported fields
}

AuthenticatedGithubClient abstracts the github client from google's client

func NewAuthenticatedGithubClient

func NewAuthenticatedGithubClient(accessToken string) *AuthenticatedGithubClient

NewAuthenticatedGithubClient produces a new, authenticated github client

func (*AuthenticatedGithubClient) CreateComment

func (agc *AuthenticatedGithubClient) CreateComment(owner string, repo string, issueNumber int, body string) (*gh.IssueComment, error)

CreateComment creates a new comment on github

type Client

type Client interface {
	CreateComment(owner string, repo string, issueNumber int, body string) (*gh.IssueComment, error)
}

Client defines the interface for a github client

type Event

type Event struct {
	Action             string
	IssueNumber        int
	RepositoryName     string
	RepositoryFullname string
	RepositoryOwner    string
	HeadRef            string
	Type               EventType

	OriginalEvent interface{}
}

Event is the internal structure used for an event

func ConvertGithubEvent

func ConvertGithubEvent(original interface{}) (*Event, bool)

ConvertGithubEvent turns an original Github Event into the internal structure

type EventType

type EventType int
const (
	PullRequestEvent EventType = iota
	PingEvent
)

type WebhookParser

type WebhookParser struct {
	Secret string
}

WebhookParser is responsible for parsing data from github into internal structs

func NewWebhookParser

func NewWebhookParser(secret string) *WebhookParser

NewWebhookParser returns an initialized WebhookParser

func (*WebhookParser) ValidateAndParseWebhook

func (p *WebhookParser) ValidateAndParseWebhook(request *http.Request) (interface{}, error)

ValidateAndParseWebhook validates a request from github against the token and also parses the data into an internal event struct

Jump to

Keyboard shortcuts

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