hooks

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeCreate = iota
	EventTypePut    = iota
	EventTypeDeleteForOwner
	EventTypeDelete
)

Variables

This section is empty.

Functions

func ListenAndServe

func ListenAndServe(hooksRepo Repository, port int)

func NewHooksRepository

func NewHooksRepository(dbFilename string) (*repo, error)

Types

type EventType

type EventType int

type Hook

type Hook struct {
	Owner       string `json:"owner"`
	Name        string `json:"name"`
	Destination string `json:"destination"`
}

func (Hook) Fire

func (h Hook) Fire(bdy io.Reader) ([]byte, error)

type HookAPIEvent

type HookAPIEvent struct {
	EventType EventType
	Hooks     []*Hook
}

type HooksAPIServer

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

type Repository

type Repository interface {
	CreateHook(h Hook) error
	ListAllHooks() ([]*Hook, error)
	ListHooksForOwner(owner string) ([]*Hook, error)
	DeleteHooksForOwner(owner string) error
	DeleteHookByOwnerAndName(owner, name string) error
	Events() chan HookAPIEvent
	Cleanup() error
}

Jump to

Keyboard shortcuts

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