gogs

package
v6.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEventNotSpecifiedToParse   = errors.New("no Event specified to parse")
	ErrInvalidHTTPMethod          = errors.New("invalid HTTP Method")
	ErrMissingGogsEventHeader     = errors.New("missing X-Gogs-Event Header")
	ErrMissingGogsSignatureHeader = errors.New("missing X-Gogs-Signature Header")
	ErrEventNotFound              = errors.New("event not defined to be parsed")
	ErrParsingPayload             = errors.New("error parsing payload")
	ErrHMACVerificationFailed     = errors.New("HMAC verification failed")
)

parse errors

View Source
var Options = WebhookOptions{}

Options is a namespace var for configuration options

Functions

This section is empty.

Types

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 Option

type Option func(*Webhook) error

Option is a configuration option for the webhook

type Webhook

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

Webhook instance contains all methods needed to process events

func New

func New(options ...Option) (*Webhook, error)

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

func (Webhook) Parse

func (hook Webhook) Parse(r *http.Request, events ...Event) (interface{}, error)

Parse verifies and parses the events specified and returns the payload object or an error

type WebhookOptions

type WebhookOptions struct{}

WebhookOptions is a namespace for configuration option methods

func (WebhookOptions) Secret

func (WebhookOptions) Secret(secret string) Option

Secret registers the GitLab secret

Jump to

Keyboard shortcuts

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