Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler interface { Handle(callback *slackevents.EventsAPIEvent, logger *logrus.Entry) error Identifier() string }
Handler knows how to handle an event callback.
func HandlerFromPartial ¶
func HandlerFromPartial(handler PartialHandler) Handler
HandlerFromPartial adapts a partial handler to a singleton when there is just one handler for a callback
func HandlerFunc ¶
func HandlerFunc(identifier string, handle func(callback *slackevents.EventsAPIEvent, logger *logrus.Entry) error) Handler
HandlerFunc returns a Handler for a handling func
func MultiHandler ¶
func MultiHandler(handlers ...PartialHandler) Handler
MultiHandler sends the callback to a chain of partial handlers, greedily allowing them to consume and respond to it.
type PartialHandler ¶
type PartialHandler interface { Handle(callback *slackevents.EventsAPIEvent, logger *logrus.Entry) (handled bool, err error) Identifier() string }
PartialHandler is a Handler that exposes whether it handled a callback, consuming it, or if another Handler should have the chance to handle it instead.
func PartialFromHandler ¶
func PartialFromHandler(handler Handler) PartialHandler
PartialFromHandler adapts a handler to a partial and always expects that the handler consumes the callback
func PartialHandlerFunc ¶
func PartialHandlerFunc(identifier string, handle func(callback *slackevents.EventsAPIEvent, logger *logrus.Entry) (handled bool, err error)) PartialHandler
PartialHandlerFunc returns a PartialHandler for a handling func