Documentation ¶
Index ¶
- Constants
- type API
- type CancelClient
- type Client
- type ClientConfig
- type Command
- type ConfigExtension
- type Configuration
- type Connection
- type ConnectionDetails
- type EID
- type EmptyAction
- type ExecutionResult
- type Executor
- type Extension
- type ExtensionConfig
- func (cfg ExtensionConfig) Boolean(key string) bool
- func (cfg ExtensionConfig) Float(key string, def float64) float64
- func (cfg ExtensionConfig) Integer(key string, def int) int
- func (cfg ExtensionConfig) List(key string) []string
- func (cfg ExtensionConfig) Read(key string, def interface{}) interface{}
- func (cfg ExtensionConfig) String(key string, def string) string
- type ExtensionLoader
- type HttpExecution
- type HttpExecutionResult
- type HttpExtension
- type HttpMessageAction
- type MQTTSync
- type Message
- type MessageAction
- type Profile
- type RTMConnection
- func (conn *RTMConnection) Closed() <-chan error
- func (conn *RTMConnection) Details() ConnectionDetails
- func (conn *RTMConnection) Messages() <-chan Message
- func (conn *RTMConnection) Send(msg *Message) error
- func (conn *RTMConnection) Start(ctx context.Context) error
- func (conn *RTMConnection) Update(msg *Message) error
- type Remote
- type RemoteUser
- type Service
- type SlackAPI
- type Sync
- type SyncAction
- type SyncMessage
- type SyncedService
- type TextEditAction
- func (edit *TextEditAction) Append(app string) *TextEditAction
- func (edit *TextEditAction) Perform(msg *Message) error
- func (edit *TextEditAction) Prepend(pre string) *TextEditAction
- func (edit *TextEditAction) Set(txt string) *TextEditAction
- func (edit *TextEditAction) Substitute(search string, sub string) *TextEditAction
- func (edit *TextEditAction) SubstituteQuery(q text.Query, sub string) *TextEditAction
- type User
Constants ¶
const ( NEW SyncAction = "new" UPDATE = "update" DELETE = "delete" )
const EMOJI = "⚡" // The high voltage/lightning bolt emoji (:zap: in Slack)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CancelClient ¶
type CancelClient struct { *Client // contains filtered or unexported fields }
func (*CancelClient) Start ¶
func (c *CancelClient) Start() error
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(cfg ClientConfig) *Client
type ClientConfig ¶
type ClientConfig struct {
// contains filtered or unexported fields
}
type Command ¶
func (*Command) Arg ¶
Arg returns argument number a, or "" if there is no argument in that position.
func (*Command) CollapseArgs ¶
type ConfigExtension ¶
type ConfigExtension struct { Extension Cfg ExtensionConfig }
ConfigExtension represents an extension with an associated configuration.
func FromConfiguration ¶
func FromConfiguration(l ExtensionLoader, cfg *Configuration) (*ConfigExtension, error)
func LoadFromSettings ¶
func LoadFromSettings(l ExtensionLoader, s Profile) ([]ConfigExtension, error)
func NewConfigExtension ¶
func NewConfigExtension(ex Extension, cfg ExtensionConfig) *ConfigExtension
func (*ConfigExtension) Run ¶
func (ex *ConfigExtension) Run(msg Message) (MessageAction, error)
type Configuration ¶
type Configuration struct { URL string EID EID Cfg ExtensionConfig }
func FromConfigurationMap ¶
func FromConfigurationMap(cfg map[string]interface{}) []Configuration
func NewConfiguration ¶
func NewConfiguration(eid EID) Configuration
func NewHTTPConfiguration ¶
func NewHTTPConfiguration(url string) Configuration
type Connection ¶
type Connection interface { Start(ctx context.Context) error Send(*Message) error Update(*Message) error Messages() <-chan Message Details() ConnectionDetails // Closed returns a channel that can be used for detecting when the connection closes. // If the connection was closed due to an error, the error is returned. Otherwise, nil is returned. Closed() <-chan error }
Connection is a connection to the Slack Messaging services.
type ConnectionDetails ¶
ConnectionDetails are details that cannot be discerned until the client has performed authentication against Slack.
type EmptyAction ¶
type EmptyAction struct{}
func NoAction ¶
func NoAction() *EmptyAction
func (*EmptyAction) Perform ¶
func (*EmptyAction) Perform(*Message) error
type ExecutionResult ¶
type ExecutionResult struct { Err error Action MessageAction }
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
func NewExecutor ¶
func NewExecutor(loader ExtensionLoader, timeout time.Duration) *Executor
func (*Executor) Load ¶
Load sets up the executor by reading s and creating the appropriate extensions.
func (*Executor) Run ¶
func (e *Executor) Run(msg Message) <-chan ExecutionResult
type Extension ¶
type Extension interface {
Run(Message, ExtensionConfig) (MessageAction, error)
}
type ExtensionConfig ¶
type ExtensionConfig map[string]interface{}
func (ExtensionConfig) Boolean ¶
func (cfg ExtensionConfig) Boolean(key string) bool
Boolean fetches a boolean value for key. Returns false if key is not set.
func (ExtensionConfig) Float ¶
func (cfg ExtensionConfig) Float(key string, def float64) float64
Float fetches a float value for key. Returns def if key is not set.
func (ExtensionConfig) Integer ¶
func (cfg ExtensionConfig) Integer(key string, def int) int
Integer fetches an integer value for key. Returns def if key is not set.
func (ExtensionConfig) List ¶
func (cfg ExtensionConfig) List(key string) []string
List fetches a list value for key. Returns an empty list if key is not set.
func (ExtensionConfig) Read ¶
func (cfg ExtensionConfig) Read(key string, def interface{}) interface{}
Read fetches a value of any type for key. Returns def if key is not set.
type ExtensionLoader ¶
type HttpExecution ¶
type HttpExecution struct { Message string `json:"message"` Config ExtensionConfig `json:"config"` // contains filtered or unexported fields }
type HttpExecutionResult ¶
type HttpExecutionResult struct { Err error Actions []HttpMessageAction }
func (*HttpExecutionResult) ExecutionResult ¶
func (her *HttpExecutionResult) ExecutionResult() *ExecutionResult
type HttpExtension ¶
type HttpExtension struct { Host string // contains filtered or unexported fields }
func NewHttpExtension ¶
func NewHttpExtension(host string, client *http.Client) *HttpExtension
func (*HttpExtension) Run ¶
func (x *HttpExtension) Run(m Message, cfg ExtensionConfig) (MessageAction, error)
type HttpMessageAction ¶
type HttpMessageAction map[string]interface{}
func (HttpMessageAction) ToMessageAction ¶
func (act HttpMessageAction) ToMessageAction() MessageAction
type MessageAction ¶
MessageAction is an action that can be performed on a message. Used for serializing the modifications generated by extensions while allowing them to execute in parallel.
type Profile ¶
type Profile struct {
Configurations []Configuration
}
type RTMConnection ¶
type RTMConnection struct {
// contains filtered or unexported fields
}
RTMConnection is a Connection that utilizes the Slack RTM API.
func (*RTMConnection) Closed ¶
func (conn *RTMConnection) Closed() <-chan error
func (*RTMConnection) Details ¶
func (conn *RTMConnection) Details() ConnectionDetails
func (*RTMConnection) Messages ¶
func (conn *RTMConnection) Messages() <-chan Message
func (*RTMConnection) Send ¶
func (conn *RTMConnection) Send(msg *Message) error
func (*RTMConnection) Update ¶
func (conn *RTMConnection) Update(msg *Message) error
type RemoteUser ¶
type RemoteUser struct { IDHash string `json:"sirius_id"` Token string `json:"slack_token"` Extensions interface{} `json:"extensions"` HttpExtensions interface{} `json:"http_extensions"` }
func (*RemoteUser) ToUser ¶
func (ru *RemoteUser) ToUser() *User
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(l ExtensionLoader) *Service
func (*Service) WithSync ¶
func (s *Service) WithSync(sync Sync) *SyncedService
type SlackAPI ¶
type SlackAPI struct {
// contains filtered or unexported fields
}
func NewSlackAPI ¶
func (*SlackAPI) NewRTMConnection ¶
func (api *SlackAPI) NewRTMConnection() *RTMConnection
type SyncAction ¶
type SyncAction string
type SyncMessage ¶
type SyncMessage struct { Type SyncAction ID slack.SecureID }
type SyncedService ¶
type SyncedService struct {
// contains filtered or unexported fields
}
type TextEditAction ¶
type TextEditAction struct {
// contains filtered or unexported fields
}
TextEditAction represents a series of modifications to the message Text property
func TextEdit ¶
func TextEdit() *TextEditAction
func (*TextEditAction) Append ¶
func (edit *TextEditAction) Append(app string) *TextEditAction
func (*TextEditAction) Perform ¶
func (edit *TextEditAction) Perform(msg *Message) error
func (*TextEditAction) Prepend ¶
func (edit *TextEditAction) Prepend(pre string) *TextEditAction
func (*TextEditAction) Set ¶
func (edit *TextEditAction) Set(txt string) *TextEditAction
func (*TextEditAction) Substitute ¶
func (edit *TextEditAction) Substitute(search string, sub string) *TextEditAction
func (*TextEditAction) SubstituteQuery ¶
func (edit *TextEditAction) SubstituteQuery(q text.Query, sub string) *TextEditAction