Versions in this module Expand all Collapse all v0 v0.1.2 Mar 23, 2026 Changes in this version + const DisconnectReasonLinkDisabled + const DisconnectReasonRefreshRequested + const DisconnectReasonWarning + const EnvelopeTypeDisconnect + const EnvelopeTypeEventsAPI + const EnvelopeTypeHello + const EnvelopeTypeInteractive + const EnvelopeTypeSlashCommands + var ErrConcurrencyLimit = errors.New("concurrency limit reached") + var ErrConnectionClosed = errors.New("connection closed") + var ErrHandlerTimeout = errors.New("handler timeout") + var ErrHelloTimeout = errors.New("timeout waiting for hello message") + var ErrShuttingDown = errors.New("client is shutting down") + var ErrWriteTimeout = errors.New("write timeout") + func ClassifyHTTPError(statusCode int) error + func ClassifyNetworkError(err error) error + func ClassifySlackError(slackError string) error + func IsPermanentError(err error) bool + func IsRetryableError(err error) bool + func NewColoredLogger() *slog.Logger + func NewColoredLoggerWithLevel(level slog.Level) *slog.Logger + type Ack struct + EnvelopeID string + Payload any + type Backoff struct + func NewBackoff(cfg BackoffConfig) *Backoff + func (b *Backoff) Attempts() int + func (b *Backoff) CheckStable() bool + func (b *Backoff) MarkConnected() + func (b *Backoff) NextDelay() time.Duration + func (b *Backoff) Reset() + type BackoffConfig struct + BaseDelay time.Duration + MaxDelay time.Duration + MaxJitter time.Duration + StableTime time.Duration + func DefaultBackoffConfig() BackoffConfig + type Client struct + func New(appToken string, opts ...Option) *Client + func (c *Client) On(eventType string, handler EventHandler) + func (c *Client) OnEventsAPI(handler EventHandler) + func (c *Client) OnInteractive(handler EventHandler) + func (c *Client) OnSlashCommand(handler EventHandler) + func (c *Client) Run(ctx context.Context) error + type ColoredHandler struct + func NewColoredHandler(opts *ColoredHandlerOptions) *ColoredHandler + func NewColoredHandlerWithWriter(w io.Writer, opts *ColoredHandlerOptions) *ColoredHandler + func (h *ColoredHandler) Enabled(_ context.Context, level slog.Level) bool + func (h *ColoredHandler) Handle(_ context.Context, r slog.Record) error + func (h *ColoredHandler) WithAttrs(attrs []slog.Attr) slog.Handler + func (h *ColoredHandler) WithGroup(name string) slog.Handler + type ColoredHandlerOptions struct + Level slog.Leveler + ShowDate bool + TimeFormat string + type ConnectionInfo struct + AppID string + type ConnectionOpenResponse struct + Error string + OK bool + URL string + type DebugInfo struct + ApproximateConnectionTime int + BuildNumber int + Host string + Started string + type DisconnectMessage struct + DebugInfo DebugInfo + Reason string + Type string + type EmptyResponse struct + type Envelope struct + AcceptsResponsePayload bool + EnvelopeID string + Payload json.RawMessage + RetryAttempt int + RetryReason string + Type string + type EventHandler func(ctx context.Context, envelope *Envelope) Response + type HelloMessage struct + ConnectionInfo ConnectionInfo + DebugInfo DebugInfo + NumConnections int + Type string + type MessageResponse struct + type MetricsHook interface + ConnectionClosed func(connID string, duration time.Duration) + ConnectionOpened func(connID string) + EnvelopeAcked func(envType string, latency time.Duration) + EnvelopeReceived func(envType string) + HandlerCompleted func(envType string, duration time.Duration, err error) + HandlerPanic func(envType string, recovered any) + HandlerStarted func(envType string) + ReconnectAttempt func(attempt int, delay time.Duration) + WriteQueueDepth func(depth int) + type ModalAction int + const ModalActionClear + const ModalActionErrors + const ModalActionPush + const ModalActionUpdate + type ModalResponse struct + type NoopMetrics struct + func (n *NoopMetrics) ConnectionClosed(connID string, duration time.Duration) + func (n *NoopMetrics) ConnectionOpened(connID string) + func (n *NoopMetrics) EnvelopeAcked(envType string, latency time.Duration) + func (n *NoopMetrics) EnvelopeReceived(envType string) + func (n *NoopMetrics) HandlerCompleted(envType string, duration time.Duration, err error) + func (n *NoopMetrics) HandlerPanic(envType string, recovered any) + func (n *NoopMetrics) HandlerStarted(envType string) + func (n *NoopMetrics) ReconnectAttempt(attempt int, delay time.Duration) + func (n *NoopMetrics) WriteQueueDepth(depth int) + type Option func(*Client) + func WithHTTPClient(client *http.Client) Option + func WithHandlerTimeout(d time.Duration) Option + func WithHelloTimeout(d time.Duration) Option + func WithLogger(logger *slog.Logger) Option + func WithMaxConcurrency(n int) Option + func WithMetrics(hook MetricsHook) Option + type OptionsResponse struct + type PermanentError struct + Err error + Message string + func (e *PermanentError) Error() string + func (e *PermanentError) Unwrap() error + type Response interface + func NoResponse() Response + func RespondWithBlocks(blks []blocks.Block) Response + func RespondWithErrors(errors map[string]string) Response + func RespondWithMessage(msg blocks.Message) Response + func RespondWithModalClear() Response + func RespondWithModalPush(modal blocks.Modal) Response + func RespondWithModalUpdate(modal blocks.Modal) Response + func RespondWithOptionGroups(groups []blocks.OptionGroup) Response + func RespondWithOptions(opts []blocks.Option) Response + type RetryableError struct + Err error + Message string + func (e *RetryableError) Error() string + func (e *RetryableError) Unwrap() error v0.1.1 Mar 23, 2026