Documentation
¶
Index ¶
- Constants
- func Activity(ctx context.Context, clients *shared.ClientFactory, log *logger.Logger, ...) error
- func Deploy(ctx context.Context, clients *shared.ClientFactory, showTriggers bool, ...) (*logger.LogEvent, error)
- func Run(ctx context.Context, clients *shared.ClientFactory, log *logger.Logger, ...) (*logger.LogEvent, types.InstallState, error)
- type DebugInfo
- type LinkResponse
- type LocalHostedContext
- type LocalServer
- func (r *LocalServer) Listen(ctx context.Context, errChan chan<- error, done chan<- bool)
- func (r *LocalServer) Start(ctx context.Context) error
- func (r *LocalServer) StartDelegate(ctx context.Context) error
- func (r *LocalServer) Watch(ctx context.Context, auth types.SlackAuth, app types.App) error
- func (r *LocalServer) WatchActivityLogs(ctx context.Context, minLevel string) error
- type Message
- type RunArgs
- type SocketEvent
- type WebSocketConnMock
- func (m *WebSocketConnMock) AddDefaultMocks()
- func (m *WebSocketConnMock) Close() error
- func (m *WebSocketConnMock) ReadMessage() (int, []byte, error)
- func (m *WebSocketConnMock) WriteControl(messageType int, data []byte, deadline time.Time) error
- func (m *WebSocketConnMock) WriteMessage(messageType int, data []byte) error
- type WebSocketConnection
Constants ¶
const ( ActivityIdleTimeoutDefault = 5 // Minutes ActivityLimitDefault = 100 ActivityMinLevelDefault = "info" ActivityPollingIntervalDefault = 3 // Seconds )
Variables ¶
This section is empty.
Functions ¶
func Activity ¶
func Activity( ctx context.Context, clients *shared.ClientFactory, log *logger.Logger, args types.ActivityArgs, ) error
Activity Reads activity logs in a ticker loop, sleeping in intervals as defined by the args. Returns if the context is canceled or an error occurs. Expected to be used in a goroutine.
Types ¶
type DebugInfo ¶
type DebugInfo struct {
Host string `json:"host,omitempty"`
Started string `json:"started,omitempty"`
Build int `json:"build,omitempty"`
}
DebugInfo may be included in the web socket's incoming Message
type LinkResponse ¶
type LinkResponse struct {
EnvelopeID string `json:"envelope_id,omitempty"`
Payload json.RawMessage `json:"payload,omitempty"`
}
LinkResponse describes a web socket response
type LocalHostedContext ¶
type LocalHostedContext struct {
BotAccessToken string `json:"bot_access_token,omitempty"`
AppID string `json:"app_id,omitempty"`
TeamID string `json:"team_id,omitempty"`
Variables map[string]string `json:"variables,omitempty"`
}
LocalHostedContext describes the locally installed app and workspace
type LocalServer ¶
type LocalServer struct {
Connection WebSocketConnection
// contains filtered or unexported fields
}
LocalServer runs the Slack app locally. It will try to Start a connection ahead of executing a script hook and returning responses. If sdk has indicated that it will manage the connection to Slack, LocalServer will delegate connection response management to the script hook
func (*LocalServer) Listen ¶
func (r *LocalServer) Listen(ctx context.Context, errChan chan<- error, done chan<- bool)
Listen waits for incoming events over a socket connection and invokes the deno-sdk-powered app with each payload. Responds to each event in a way that mimics the behaviour of a hosted app.
func (*LocalServer) Start ¶
func (r *LocalServer) Start(ctx context.Context) error
Start establishes a socket connection to Slack, which will receive app-relevant events. It does so in a loop to support for re-establishing the socket connection.
func (*LocalServer) StartDelegate ¶
func (r *LocalServer) StartDelegate(ctx context.Context) error
StartDelegate passes along required opts to SDK, delegating connection for running app locally to script hook start
func (*LocalServer) Watch ¶
Watch for file changes. If configuration for watch is provided The CLI will watch for a file changes. To watch specific changes provide additional filter regex.
func (*LocalServer) WatchActivityLogs ¶
func (r *LocalServer) WatchActivityLogs(ctx context.Context, minLevel string) error
type Message ¶
type Message struct {
Type string `json:"type,omitempty"`
DebugInfo DebugInfo `json:"debug_info,omitempty"`
Reason string `json:"reason,omitempty"`
EnvelopeID string `json:"envelope_id,omitempty"`
Payload json.RawMessage `json:"payload,omitempty"`
AcceptsResponsePayload bool `json:"accepts_response_payload,omitempty"`
}
Message describes a web socket incoming message
type RunArgs ¶
type RunArgs struct {
Activity bool
ActivityLevel string
App types.App
Auth types.SlackAuth
Cleanup bool
ShowTriggers bool
OrgGrantWorkspaceID string
}
RunArgs are the arguments passed into the Run function
type SocketEvent ¶
type SocketEvent struct {
Body json.RawMessage `json:"body,omitempty"`
Context LocalHostedContext `json:"context,omitempty"`
}
SocketEvent describes an incoming socket event for the SDK
type WebSocketConnMock ¶
WebSocketConnMock mocks the github.com/gorilla/websocket websocket.Conn struct.
func NewWebSocketConnMock ¶
func NewWebSocketConnMock() *WebSocketConnMock
NewWebSocketConnMock creates a mock of WebSocketConnMock.
func (*WebSocketConnMock) AddDefaultMocks ¶
func (m *WebSocketConnMock) AddDefaultMocks()
AddDefaultMocks installs the default mock actions to fallback on.
func (*WebSocketConnMock) ReadMessage ¶
func (m *WebSocketConnMock) ReadMessage() (int, []byte, error)
ReadMessage mock
func (*WebSocketConnMock) WriteControl ¶
WriteControl mock
func (*WebSocketConnMock) WriteMessage ¶
func (m *WebSocketConnMock) WriteMessage(messageType int, data []byte) error
WriteMessage mock
type WebSocketConnection ¶
type WebSocketConnection interface {
ReadMessage() (messageType int, p []byte, err error)
WriteMessage(messageType int, data []byte) error
WriteControl(messageType int, data []byte, deadline time.Time) error
Close() error
}
WebSocketConnection interface representing interacting with a WebSocket connection - mockable