Documentation
¶
Index ¶
- func NewAdapter(provider data.SlackProvider) adapter.Adapter
- func ScrubMarkdown(text string) string
- func Send(ctx context.Context, client *slack.Client, a adapter.Adapter, channelID string, ...) error
- func SendError(ctx context.Context, client *slack.Client, channelID string, title string, ...) error
- func SendText(ctx context.Context, client *slack.Client, a adapter.Adapter, channelID string, ...) error
- type ClassicAdapter
- func (s ClassicAdapter) GetChannelInfo(channelID string) (*adapter.ChannelInfo, error)
- func (s ClassicAdapter) GetName() string
- func (s ClassicAdapter) GetPresentChannels() ([]*adapter.ChannelInfo, error)
- func (s ClassicAdapter) GetUserInfo(userID string) (*adapter.UserInfo, error)
- func (s ClassicAdapter) Listen(ctx context.Context) <-chan *adapter.ProviderEvent
- func (s *ClassicAdapter) Send(ctx context.Context, channelID string, elements templates.OutputElements) error
- func (s *ClassicAdapter) SendError(ctx context.Context, channelID string, title string, err error) error
- func (s *ClassicAdapter) SendText(ctx context.Context, channelID string, message string) error
- type SocketModeAdapter
- func (s *SocketModeAdapter) GetChannelInfo(channelID string) (*adapter.ChannelInfo, error)
- func (s *SocketModeAdapter) GetName() string
- func (s *SocketModeAdapter) GetPresentChannels() ([]*adapter.ChannelInfo, error)
- func (s *SocketModeAdapter) GetUserInfo(userID string) (*adapter.UserInfo, error)
- func (s *SocketModeAdapter) Listen(ctx context.Context) <-chan *adapter.ProviderEvent
- func (s *SocketModeAdapter) Send(ctx context.Context, channelID string, elements templates.OutputElements) error
- func (s *SocketModeAdapter) SendError(ctx context.Context, channelID string, title string, err error) error
- func (s *SocketModeAdapter) SendText(ctx context.Context, channelID string, message string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAdapter ¶
func NewAdapter(provider data.SlackProvider) adapter.Adapter
NewAdapter will construct a SlackAdapter instance for a given provider configuration.
func ScrubMarkdown ¶
ScrubMarkdown removes unnecessary/undesirable Slack markdown (of links, of example) from text received from Slack. TODO(mtitmus) Can this be replaced by using Slack's "verbatim text" option?
func Send ¶ added in v0.9.0
func Send(ctx context.Context, client *slack.Client, a adapter.Adapter, channelID string, elements templates.OutputElements) error
Send the contents of a response envelope to a specified channel. If channelID is empty the value of envelope.Request.ChannelID will be used.
Types ¶
type ClassicAdapter ¶ added in v0.8.2
type ClassicAdapter struct {
// contains filtered or unexported fields
}
ClassicAdapter is the Slack provider implementation of a relay, which knows how to receive events from the Slack API, translate them into Gort events, and forward them along.
func (ClassicAdapter) GetChannelInfo ¶ added in v0.8.2
func (s ClassicAdapter) GetChannelInfo(channelID string) (*adapter.ChannelInfo, error)
GetChannelInfo returns the ChannelInfo for a requested channel.
func (ClassicAdapter) GetName ¶ added in v0.8.2
func (s ClassicAdapter) GetName() string
GetName returns this adapter's configured name
func (ClassicAdapter) GetPresentChannels ¶ added in v0.8.2
func (s ClassicAdapter) GetPresentChannels() ([]*adapter.ChannelInfo, error)
GetPresentChannels returns a slice of channel ID strings that the Adapter is present in. This is expensive. Don't use it often.
func (ClassicAdapter) GetUserInfo ¶ added in v0.8.2
func (s ClassicAdapter) GetUserInfo(userID string) (*adapter.UserInfo, error)
GetUserInfo returns the UserInfo for a requested user.
func (ClassicAdapter) Listen ¶ added in v0.8.2
func (s ClassicAdapter) Listen(ctx context.Context) <-chan *adapter.ProviderEvent
Listen instructs the relay to begin listening to the provider that it's attached to. It exits immediately, returning a channel that emits ProviderEvents.
func (*ClassicAdapter) Send ¶ added in v0.9.0
func (s *ClassicAdapter) Send(ctx context.Context, channelID string, elements templates.OutputElements) error
Send the contents of a response envelope to a specified channel. If channelID is empty the value of envelope.Request.ChannelID will be used.
func (*ClassicAdapter) SendError ¶ added in v0.9.0
func (s *ClassicAdapter) SendError(ctx context.Context, channelID string, title string, err error) error
SendError is a break-glass error message function that's used when the templating function fails somehow. Obviously, it does not utilize the templating engine.
type SocketModeAdapter ¶ added in v0.8.2
type SocketModeAdapter struct {
// contains filtered or unexported fields
}
SocketModeAdapter is the Slack provider implementation of a relay, which knows how to receive events from the Slack API, translate them into Gort events, and forward them along.
func (*SocketModeAdapter) GetChannelInfo ¶ added in v0.8.2
func (s *SocketModeAdapter) GetChannelInfo(channelID string) (*adapter.ChannelInfo, error)
GetChannelInfo provides info on a specific provider channel accessible to the adapter.
func (*SocketModeAdapter) GetName ¶ added in v0.8.2
func (s *SocketModeAdapter) GetName() string
GetName provides the name of this adapter as per the configuration.
func (*SocketModeAdapter) GetPresentChannels ¶ added in v0.8.2
func (s *SocketModeAdapter) GetPresentChannels() ([]*adapter.ChannelInfo, error)
GetPresentChannels returns a slice of channels that a user is present in.
func (*SocketModeAdapter) GetUserInfo ¶ added in v0.8.2
func (s *SocketModeAdapter) GetUserInfo(userID string) (*adapter.UserInfo, error)
GetUserInfo provides info on a specific provider user accessible to the adapter.
func (*SocketModeAdapter) Listen ¶ added in v0.8.2
func (s *SocketModeAdapter) Listen(ctx context.Context) <-chan *adapter.ProviderEvent
Listen causes the Adapter to initiate a connection to its provider and begin relaying back events (including errors) via the returned channel.
func (*SocketModeAdapter) Send ¶ added in v0.9.0
func (s *SocketModeAdapter) Send(ctx context.Context, channelID string, elements templates.OutputElements) error
Send the contents of a response envelope to a specified channel. If channelID is empty the value of envelope.Request.ChannelID will be used.
func (*SocketModeAdapter) SendError ¶ added in v0.9.0
func (s *SocketModeAdapter) SendError(ctx context.Context, channelID string, title string, err error) error
SendError is a break-glass error message function that's used when the templating function fails somehow. Obviously, it does not utilize the templating engine.