Documentation
¶
Index ¶
- Variables
- func BlockRetryRequest(header http.Header) error
- func ConvertHeaders(headers map[string]string) http.Header
- func HandleURLVerification(body string) (*slackevents.ChallengeResponse, error)
- func MustJSONMarshal(v any) string
- func MustJSONUnmarshal[T any](data string) T
- func NewResponse(code int) events.APIGatewayProxyResponse
- func RegisterHandler[T any](eh *EventHandler, handler EventHandlerFunc[T])
- func SlackVerificationMiddleware(getSigningSecret func(r *http.Request) (string, error)) func(http.Handler) http.Handler
- func Verify(header http.Header, body []byte, signingSecret string) error
- type BotError
- type Code
- type Command
- type DynamoDBLock
- type EventHandler
- type EventHandlerFunc
- type EventRoutes
- type InteractionCallbackHandler
- type InteractionHandler
- type KingpinHandler
- type LambdaHandler
- type LambdaRouter
- type Message
- type Payload
- type Root
- type SSMLoader
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFoundInteractionType = fmt.Errorf("not found interaction type") ErrNotFoundActionValue = fmt.Errorf("not found action value") )
View Source
var ErrPermissionDenied = errors.New("permission denied")
Functions ¶
func BlockRetryRequest ¶
func HandleURLVerification ¶
func HandleURLVerification(body string) (*slackevents.ChallengeResponse, error)
func MustJSONMarshal ¶
func MustJSONUnmarshal ¶
func NewResponse ¶
func NewResponse(code int) events.APIGatewayProxyResponse
func RegisterHandler ¶
func RegisterHandler[T any](eh *EventHandler, handler EventHandlerFunc[T])
Types ¶
type Command ¶
type Command interface {
// Register registers the command and its flags/args to the kingpin application.
Register(app *kingpin.Application)
}
Command is the interface that kingpin subcommands must implement.
type DynamoDBLock ¶
func NewDynamoDBLock ¶
func NewDynamoDBLock(dynamoDBCli *dynamodb.Client, tableName string) *DynamoDBLock
func (*DynamoDBLock) AcquireLock ¶
func (*DynamoDBLock) ReleaseLock ¶
func (dl *DynamoDBLock) ReleaseLock(ctx context.Context, userID string) error
type EventHandler ¶
type EventHandler struct {
// contains filtered or unexported fields
}
func NewEventHandler ¶
func NewEventHandler(slackVerificationToken *SSMLoader) *EventHandler
func (*EventHandler) HandleEvent ¶
func (eh *EventHandler) HandleEvent(ctx context.Context, request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error)
type EventRoutes ¶
type EventRoutes map[slack.InteractionType]map[string]InteractionCallbackHandler
func (EventRoutes) Register ¶
func (er EventRoutes) Register(kind slack.InteractionType, actionID string, handler InteractionCallbackHandler)
func (EventRoutes) Run ¶
func (er EventRoutes) Run(ctx context.Context, kind slack.InteractionType, action *slack.BlockAction, callback slack.InteractionCallback) error
type InteractionCallbackHandler ¶
type InteractionCallbackHandler func(ctx context.Context, action *slack.BlockAction, callback slack.InteractionCallback) error
type InteractionHandler ¶
type InteractionHandler struct {
EventRoutes EventRoutes
}
func NewInteractionHandler ¶
func NewInteractionHandler() *InteractionHandler
func (*InteractionHandler) Handle ¶
func (ih *InteractionHandler) Handle(ctx context.Context, request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error)
type KingpinHandler ¶
type KingpinHandler struct {
// contains filtered or unexported fields
}
KingpinHandler parses Slack app_mention messages as CLI commands using kingpin.
func NewKingpinHandler ¶
func NewKingpinHandler(slackCli *slack.Client, commandName, commandDesc string) *KingpinHandler
NewKingpinHandler creates a new KingpinHandler.
func (*KingpinHandler) AddCommand ¶
func (kh *KingpinHandler) AddCommand(cmd Command)
AddCommand registers a Command to be available for parsing.
func (*KingpinHandler) HandleAppMention ¶
func (kh *KingpinHandler) HandleAppMention(ctx context.Context, ev *slackevents.AppMentionEvent) error
HandleAppMention is an EventHandlerFunc that handles app_mention events.
type LambdaHandler ¶
type LambdaHandler func(ctx context.Context, request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error)
type LambdaRouter ¶
type LambdaRouter struct {
EventHandler LambdaHandler
InteractionHandler LambdaHandler
}
func NewRouter ¶
func NewRouter(eventHandler, interactionHandler LambdaHandler) *LambdaRouter
func (*LambdaRouter) Handle ¶
func (r *LambdaRouter) Handle(ctx context.Context, request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error)
type SSMLoader ¶
func NewSSMLoaderMock ¶
Click to show internal directories.
Click to hide internal directories.