gogs

package
v3.13.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Secret string
}

Config defines the configuration to create a new Gogs Webhook instance

type Event

type Event string

Event defines a Gogs hook event type

const (
	CreateEvent       Event = "create"
	DeleteEvent       Event = "delete"
	ForkEvent         Event = "fork"
	PushEvent         Event = "push"
	IssuesEvent       Event = "issues"
	IssueCommentEvent Event = "issue_comment"
	PullRequestEvent  Event = "pull_request"
	ReleaseEvent      Event = "release"
)

Gogs hook types

type Webhook

type Webhook struct {
	// contains filtered or unexported fields
}

Webhook instance contains all methods needed to process events

func New

func New(config *Config) *Webhook

New creates and returns a WebHook instance denoted by the Provider type

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

func (hook Webhook) RegisterEvents(fn webhooks.ProcessPayloadFunc, events ...Event)

RegisterEvents registers the function to call when the specified event(s) are encountered

Jump to

Keyboard shortcuts

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