Documentation
¶
Index ¶
- type Action
- type ActionInterceptor
- type App
- type BlockUI
- type Channel
- type CustomEvent
- type EphemeralSender
- type ErrorEvent
- type ErrorFunc
- type ErrorMessage
- type Event
- type EventHandlerFunc
- type EventInterceptor
- type FinishInterceptor
- type HandlerInterceptor
- type HasError
- type InteractiveBlockUI
- type Message
- type Metadata
- type Modal
- type ModalCreator
- type ModalSubmission
- type NonInteractiveBlockUI
- type NonInteractiveMessage
- type Option
- type ReceivedMessage
- type SlashCommand
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionInterceptor ¶ added in v0.1.7
type ActionInterceptor func(ctx context.Context, action Action, next func(context.Context) error) error
ActionInterceptor intercepts a single action to allow for instrumentation. The next function must be called to perform the action itself. The configuration for the action cannot be changed.
type App ¶
type App interface { Run(EventHandlerFunc) error SendCustom(context.Context, CustomEvent) error }
App is the top level for a chat application. Call Run with an event handling function to start the application.
type BlockUI ¶
type BlockUI interface { NonInteractiveBlockUI InteractiveBlockUI }
BlockUI allows the creation of Slack blocks in a message or modal.
type CustomEvent ¶
type CustomEvent interface {
Body() map[string]interface{}
}
type EphemeralSender ¶ added in v0.1.6
type EphemeralSender interface {
SendEphemeralMessage(text string)
}
type ErrorEvent ¶ added in v0.1.9
type ErrorEvent interface { SendMessage(channelID string) ErrorMessage ReceiveError() error }
type ErrorFunc ¶ added in v0.1.9
type ErrorFunc func(ctx context.Context, ev ErrorEvent)
type ErrorMessage ¶ added in v0.1.9
type ErrorMessage interface { NonInteractiveMessage }
type Event ¶
type Event interface { ReceiveConnected() bool ReceiveCustomEvent() CustomEvent ReceiveMessage() ReceivedMessage ReceiveSlashCommand(command string) SlashCommand JoinChannel(channelID string) SendMessage(channelID string) Message }
Event represents an event received from the Slack platform. It provides functions representing each type of event that can be received. For example, ReceivedMessage will return a message that may have been received in this event. Functions will return nil if the current event does not match the type of event.
type EventHandlerFunc ¶ added in v0.1.5
EventHandlerFunc represents a function that processes chat events from Spanner. This function will be called multiple times and is responsible both for creating UI elements and responding to the input received.
type EventInterceptor ¶ added in v0.1.8
type FinishInterceptor ¶ added in v0.1.7
type FinishInterceptor func(ctx context.Context, actions []Action, finish func(context.Context) error) error
FinishInterceptor intercepts the finishing step of handling an event to allow for instrumentation. The finish function must be called to perform the required actions. The set of actions cannot be changed.
type HandlerInterceptor ¶ added in v0.1.8
type InteractiveBlockUI ¶ added in v0.1.9
type InteractiveBlockUI interface { TextInput(label string, hint string, placeholder string) string MultilineTextInput(label string, hint string, placeholder string) string Divider() Select(title string, options []Option) string MultipleSelect(title string, options []Option) []string Button(label string) bool }
type Message ¶
Message represents a message that can be sent to Slack. Messages are constructed using BlockUI commands.
type Modal ¶
type Modal interface { BlockUI SubmitButton(title string) ModalSubmission CloseButton(title string) bool }
Modal represents a Slack modal view. It can be used to create blocks and handle submission or closing of the modal.
type ModalCreator ¶
ModalCreator is an interface that can be used to create Slack modal views.
type ModalSubmission ¶
ModalSubmission handles a modal being submitted. It can be used to send a response message or push a new modal onto the stack.
type NonInteractiveBlockUI ¶ added in v0.1.9
type NonInteractiveMessage ¶ added in v0.1.9
type NonInteractiveMessage interface { NonInteractiveBlockUI HasError Channel(channelID string) }
type ReceivedMessage ¶
ReceivedMessage represents a message received from Slack.
type SlashCommand ¶
type SlashCommand interface { EphemeralSender Metadata ModalCreator }
SlashCommand represents a received slash command. Messages and modal views may be created in response to the command.