Documentation ¶
Index ¶
- Constants
- func WithToken(ctx context.Context, tok *AuthToken) context.Context
- type API
- func (st *API) AuthRevoke(ctx context.Context, test bool) (bool, error)
- func (st *API) ChannelsCreate(ctx context.Context, opts ConversationCreateOpts) (*Channel, error)
- func (st *API) ChatPostMessage(ctx context.Context, opts ChatPostMessageOptions) (*Message, error)
- func (st *API) ConversationsInfo(ctx context.Context, id string) (*Channel, error)
- func (st *API) ConversationsList(ctx context.Context, opts ConversationsListOpts) ([]Channel, string, error)
- func (st *API) GroupsCreate(ctx context.Context, opts ConversationCreateOpts) (*Channel, error)
- func (st *API) OAuthAccess(ctx context.Context, opts OAuthAccessOpts) (*AuthToken, error)
- type App
- type AppInfo
- type AuthToken
- type Channel
- type ChannelInfo
- type ChatPostMessageOptions
- type ConversationCreateOpts
- type ConversationsListOpts
- type Message
- type OAuthAccessOpts
- type Server
- func (st Server) API() *API
- func (st Server) InstallApp(name string, scopes ...string) AppInfo
- func (st Server) InstallStaticApp(app AppInfo, scopes ...string) (*AppInfo, error)
- func (st Server) Messages(chanID string) []Message
- func (st Server) NewChannel(name string) ChannelInfo
- func (st Server) NewUser(name string) UserInfo
- func (s *Server) ServeAuthRevoke(w http.ResponseWriter, req *http.Request)
- func (s *Server) ServeChannelsCreate(w http.ResponseWriter, req *http.Request)
- func (s *Server) ServeChatPostMessage(w http.ResponseWriter, req *http.Request)
- func (s *Server) ServeConversationsInfo(w http.ResponseWriter, req *http.Request)
- func (s *Server) ServeConversationsList(w http.ResponseWriter, req *http.Request)
- func (s *Server) ServeGroupsCreate(w http.ResponseWriter, req *http.Request)
- func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (s *Server) ServeOAuthAccess(w http.ResponseWriter, req *http.Request)
- func (s *Server) ServeOAuthAuthorize(w http.ResponseWriter, req *http.Request)
- func (st Server) SetAutoCreateChannel(value bool)
- type User
- type UserInfo
Constants ¶
const TokenCookieName = "slack_token"
TokenCookieName is the name of a cookie containing a token for a user session.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type API ¶
type API state
API allows making calls to implemented Slack API methods.
API methods implement permission/scope checking.
func (*API) AuthRevoke ¶
AuthRevoke will revoke the auth token from the provided context.
func (*API) ChannelsCreate ¶
ChannelsCreate is used to create a channel.
func (*API) ChatPostMessage ¶
ChatPostMessage posts a message to a channel.
func (*API) ConversationsInfo ¶
ConversationsInfo returns information about a conversation.
func (*API) ConversationsList ¶
func (st *API) ConversationsList(ctx context.Context, opts ConversationsListOpts) ([]Channel, string, error)
ConversationsList returns a list of channel-like conversations in a workspace.
func (*API) GroupsCreate ¶
GroupsCreate is used to create a channel.
func (*API) OAuthAccess ¶
OAuthAccess will exchange a temporary code for an access token.
type AuthToken ¶
AuthToken represents a state of authorization with the Slack server.
func ContextToken ¶
ContextToken will return a copy of the AuthToken from the given context.
type Channel ¶
type Channel struct { ID string `json:"id"` Name string `json:"name"` IsChannel bool `json:"is_channel"` IsGroup bool `json:"is_group"` IsArchived bool `json:"is_archived"` }
Channel represents a Slack channel or group.
type ChannelInfo ¶
type ChannelInfo struct {
ID, Name string
}
ChannelInfo contains information about a newly created Slack channel.
type ChatPostMessageOptions ¶
ChatPostMessageOptions are parameters for a `chat.postMessage` call.
type ConversationCreateOpts ¶
ConversationCreateOpts is used to configure a new channel or group.
type ConversationsListOpts ¶
ConversationsListOpts contains parameters for the ConversationsList API call.
type OAuthAccessOpts ¶
OAuthAccessOpts contains parameters for an OAuthAccess API call.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements a mock Slack API.
func (Server) InstallApp ¶
InstallApp will "install" a new app to this Slack server.
func (Server) InstallStaticApp ¶
InstallApp will "install" a new app to this Slack server using pre-configured AppInfo.
func (Server) NewChannel ¶
func (st Server) NewChannel(name string) ChannelInfo
NewChannel will create a new Slack channel with the given name.
func (*Server) ServeAuthRevoke ¶
func (s *Server) ServeAuthRevoke(w http.ResponseWriter, req *http.Request)
ServeAuthRevoke implements the auth.revoke API call.
func (*Server) ServeChannelsCreate ¶
func (s *Server) ServeChannelsCreate(w http.ResponseWriter, req *http.Request)
ServeChannelsCreate serves a request to the `channels.create` API call.
func (*Server) ServeChatPostMessage ¶
func (s *Server) ServeChatPostMessage(w http.ResponseWriter, req *http.Request)
ServeChatPostMessage serves a request to the `chat.postMessage` API call.
func (*Server) ServeConversationsInfo ¶
func (s *Server) ServeConversationsInfo(w http.ResponseWriter, req *http.Request)
ServeConversationsInfo serves a request to the `conversations.info` API call.
func (*Server) ServeConversationsList ¶
func (s *Server) ServeConversationsList(w http.ResponseWriter, req *http.Request)
ServeConversationsList serves a request to the `conversations.list` API call.
func (*Server) ServeGroupsCreate ¶
func (s *Server) ServeGroupsCreate(w http.ResponseWriter, req *http.Request)
ServeGroupsCreate serves a request to the `Groups.create` API call.
func (*Server) ServeHTTP ¶
func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)
ServeHTTP serves the Slack API.
func (*Server) ServeOAuthAccess ¶
func (s *Server) ServeOAuthAccess(w http.ResponseWriter, req *http.Request)
ServeOAuthAccess serves a request to the `oauth.access` API call.
func (*Server) ServeOAuthAuthorize ¶
func (s *Server) ServeOAuthAuthorize(w http.ResponseWriter, req *http.Request)
func (Server) SetAutoCreateChannel ¶
func (st Server) SetAutoCreateChannel(value bool)
SetAutoCreateChannel, if set to true, will cause messages sent to non-existant channels to succeed by creating the channel automatically.