events

package
v0.0.0-...-a0bf729 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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