handler

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2023 License: CC0-1.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIHandler

type APIHandler func(ctx context.Context, request APIRequest) error

type APIRequest

type APIRequest struct {
	GetParams  func(key string, defaultValue ...string) string
	GetQuery   func(interface{}) error
	GetBody    func(interface{}) error
	GetHeaders func(interface{}) error
}

type Controller

type Controller interface {
	GetConfig() ControllerConfig
}

type ControllerConfig

type ControllerConfig struct {
	Handler []Route
}

type ControllerImpl

type ControllerImpl struct{}

func (*ControllerImpl) JoinMiddleware

func (ctrl *ControllerImpl) JoinMiddleware(handlers ...func(http.Handler) http.Handler) *[]func(http.Handler) http.Handler

type EventHandler

type EventHandler func(ctx context.Context, request SocketRequest) error

type EventOptions

type EventOptions func(event *SocketEvent)

func WithEventType

func WithEventType(eventType any) EventOptions

func WithIdentifier

func WithIdentifier(identifier string) EventOptions

type Route

type Route struct {
	Method      string
	Path        string
	Handler     APIHandler
	Version     int
	Middlewares *[]func(http.Handler) http.Handler
}

func RegisterRoute

func RegisterRoute(method string, handler APIHandler, opts ...RouteOption) Route

func (*Route) GetVersionedPath

func (r *Route) GetVersionedPath(controllerPath string) string

type RouteOption

type RouteOption func(event *Route)

func WithMiddleware

func WithMiddleware(handlers ...func(http.Handler) http.Handler) RouteOption

func WithPath

func WithPath(path string) RouteOption

func WithVersion

func WithVersion(version int) RouteOption

type SocketEvent

type SocketEvent struct {
	Handler    EventHandler
	Type       any
	Identifier string
}

func RegisterEvent

func RegisterEvent(handler EventHandler, opts ...EventOptions) SocketEvent

type SocketHandler

type SocketHandler interface {
	GetConfig() SocketHandlerConfig
}

type SocketHandlerConfig

type SocketHandlerConfig struct {
	Handler []SocketEvent
}

type SocketHandlerImpl

type SocketHandlerImpl struct{}

type SocketRequest

type SocketRequest struct {
	GetSlashCommandData func() (*slackpkg.SlashCommand, error)
	GetInteractionData  func() (*slackpkg.InteractionCallback, error)
	GetEventData        func() (*slackevents.EventsAPIEvent, error)
	Client              *socketmode.Client
	Event               *socketmode.Event
}

Jump to

Keyboard shortcuts

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