Back to godoc.org

Package hooks

v0.1.4
Latest Go to latest

The latest major version is .

Published: Apr 12, 2020 | License: MIT | Module: github.com/coapcloud/coap-hooks-router

Index

Constants

const (
	EventTypeCreate = iota
	EventTypePut    = iota
	EventTypeDeleteForOwner
	EventTypeDelete
)

func ListenAndServe

func ListenAndServe(hooksRepo Repository, port int)

func NewHooksRepository

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

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
}

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier