Documentation ¶
Overview ¶
Package slack is a library implementing the Slack Web and RTM API.
Written by Slavik Markovich at Demisto
Index ¶
- Constants
- Variables
- func SetErrorLog(logger *log.Logger) func(*Slack) error
- func SetTraceLog(logger *log.Logger) func(*Slack) error
- func TimestampToTime(timestamp string) (time.Time, error)
- type Attachment
- type AttachmentField
- type AuthTestResponse
- type BaseChannel
- type Bot
- type Channel
- type ChannelCommonResponse
- type ChannelEvent
- type ChannelListResponse
- type ChannelResponse
- type ChannelTopicPurpose
- type CloseResponse
- type Comment
- type CommentResponse
- type EmojiListResponse
- type Error
- type File
- type FileListResponse
- type FileResponse
- type FileUploadResponse
- type Group
- type GroupListResponse
- type GroupResponse
- type HistoryResponse
- type IM
- type IMListResponse
- type InviteeType
- type Message
- type OAuthAccessResponse
- type OpenIMResponse
- type OpenResponse
- type OptionFunc
- type PostMessageReply
- type PostMessageRequest
- type PurposeResponse
- type RTMMessage
- type RTMStartReply
- type Reaction
- type ReactionsGetResponse
- type ReactionsListResponse
- type Response
- type Slack
- func (s *Slack) Archive(channel string) (Response, error)
- func (s *Slack) AuthTest() (*AuthTestResponse, error)
- func (s *Slack) ChannelCreate(name string) (*ChannelResponse, error)
- func (s *Slack) ChannelInfo(channel string) (*ChannelResponse, error)
- func (s *Slack) ChannelInvite(channel, user string) (*ChannelResponse, error)
- func (s *Slack) ChannelJoin(channel string) (*ChannelResponse, error)
- func (s *Slack) ChannelList(excludeArchived bool) (*ChannelListResponse, error)
- func (s *Slack) CloseGroupOrIM(id string) (*CloseResponse, error)
- func (s *Slack) EmojiList() (*EmojiListResponse, error)
- func (s *Slack) FileAddComment(file, comment string, setActive bool) (*CommentResponse, error)
- func (s *Slack) FileInfo(file string, count, page int) (*FileResponse, error)
- func (s *Slack) FileList(user, tsFrom, tsTo string, types []string, count, page int) (*FileListResponse, error)
- func (s *Slack) GroupCreate(name string) (*GroupResponse, error)
- func (s *Slack) GroupCreateChild(group string) (*GroupResponse, error)
- func (s *Slack) GroupInfo(group string) (*GroupResponse, error)
- func (s *Slack) GroupInvite(channel, user string) (*GroupResponse, error)
- func (s *Slack) GroupList(excludeArchived bool) (*GroupListResponse, error)
- func (s *Slack) History(channel, latest, oldest string, inclusive, unreads bool, count int) (*HistoryResponse, error)
- func (s *Slack) IMList() (*IMListResponse, error)
- func (s *Slack) InviteToSlack(invitee UserInviteDetails, channels []string, inviteType InviteeType) error
- func (s *Slack) Kick(channel, user string) (Response, error)
- func (s *Slack) Leave(channel string) (Response, error)
- func (s *Slack) MPIMList() (*GroupListResponse, error)
- func (s *Slack) Mark(channel, ts string) error
- func (s *Slack) OpenGroup(id string) (*OpenResponse, error)
- func (s *Slack) OpenIM(id string) (*OpenIMResponse, error)
- func (s *Slack) OpenMPIM(users []string) (*GroupResponse, error)
- func (s *Slack) PostMessage(m *PostMessageRequest, escape bool) (*PostMessageReply, error)
- func (s *Slack) RTMRunning() bool
- func (s *Slack) RTMSend(channel, text string) (int, error)
- func (s *Slack) RTMStart(origin string, in chan *Message, context interface{}) (*RTMStartReply, error)
- func (s *Slack) RTMStop() error
- func (s *Slack) ReactionsAdd(name, file, fileComment, channel, timestamp string) (Response, error)
- func (s *Slack) ReactionsGet(file, fileComment, channel, timestamp string, full bool) (*ReactionsGetResponse, error)
- func (s *Slack) ReactionsList(user string, full bool, count, page int) (*ReactionsListResponse, error)
- func (s *Slack) ReactionsRemove(name, file, fileComment, channel, timestamp string) (Response, error)
- func (s *Slack) Rename(channel, name string) (*ChannelCommonResponse, error)
- func (s *Slack) SetPurpose(channel, purpose string) (*PurposeResponse, error)
- func (s *Slack) SetTopic(channel, purpose string) (*TopicResponse, error)
- func (s *Slack) TeamInfo() (*TeamInfoResponse, error)
- func (s *Slack) Unarchive(channel string) (Response, error)
- func (s *Slack) Upload(title, filetype, filename, initialComment string, channels []string, ...) (*FileUploadResponse, error)
- func (s *Slack) UserInfo(user string) (*UserInfoResponse, error)
- func (s *Slack) UserList() (*UserListResponse, error)
- type Team
- type TeamInfoResponse
- type TopicResponse
- type TypedMessage
- type User
- type UserEvent
- type UserInfoResponse
- type UserInviteDetails
- type UserListResponse
- type UserPresence
- type UserProfile
- type WSMessageResponse
Constants ¶
const (
// DefaultURL points to the default Slack API
DefaultURL = "https://slack.com/api/"
)
Variables ¶
var ( // ErrBadToken is returned when a bad token is passed to the API ErrBadToken = &Error{"bad_token", "Bad token was provided to the API"} // ErrNoToken is returned when the token is missing ErrNoToken = &Error{"no_token", "You must provide a Slack token to use the API"} // ErrBadOAuth is returned when OAuth credentials are bad ErrBadOAuth = &Error{"bad_oauth", "Bad OAuth credentials provided"} )
Functions ¶
func SetErrorLog ¶
SetErrorLog sets the logger for critical messages. It is nil by default.
func SetTraceLog ¶
SetTraceLog specifies the logger to use for output of trace messages like HTTP requests and responses. It is nil by default.
Types ¶
type Attachment ¶
type Attachment struct { ServiceName string `json:"service_name"` Fallback string `json:"fallback"` Color string `json:"color,omitempty"` Pretext string `json:"pretext,omitempty"` AuthorName string `json:"author_name,omitempty"` AuthorLink string `json:"author_link,omitempty"` AuthorIcon string `json:"author_icon,omitempty"` Title string `json:"title,omitempty"` TitleLink string `json:"title_link,omitempty"` Text string `json:"text"` ImageURL string `json:"image_url,omitempty"` ThumbURL string `json:"thumb_url,omitempty"` ThumbWidth int `json:"thumb_width"` ThumbHeight int `json:"thumb_height"` FromURL string `json:"from_url"` Fields []AttachmentField `json:"fields,omitempty"` MarkdownIn []string `json:"mrkdwn_in,omitempty"` }
Attachment holds information about an attachment
type AttachmentField ¶
type AttachmentField struct { Title string `json:"title"` Value string `json:"value"` Short bool `json:"short"` }
AttachmentField holds information about an attachment field
type AuthTestResponse ¶
type AuthTestResponse struct { URL string `json:"url"` Team string `json:"team"` User string `json:"user"` TeamID string `json:"team_id"` UserID string `json:"user_id"` // contains filtered or unexported fields }
AuthTestResponse is response to auth.test - see https://api.slack.com/methods/auth.test
type BaseChannel ¶
type BaseChannel struct { ID string `json:"id"` Name string `json:"name"` Created interface{} `json:"created"` // Sometimes a string and sometimes int64 Creator string `json:"creator"` IsArchived bool `json:"is_archived"` IsOpen bool `json:"is_open"` Members []string `json:"members"` Topic ChannelTopicPurpose `json:"topic"` Purpose ChannelTopicPurpose `json:"purpose"` LastRead string `json:"last_read,omitempty"` Latest Message `json:"latest,omitempty"` UnreadCount int `json:"unread_count,omitempty"` UnreadCountDisplay int `json:"unread_count_display,omitempty"` NumMembers int `json:"num_members,omitempty"` }
BaseChannel holds information about channel / group / IM
type Bot ¶
type Bot struct { ID string `json:"id"` Name string `json:"name"` Deleted bool `json:"deleted"` Icons interface{} `json:"icons"` }
Bot holds the info about a bot
type Channel ¶
type Channel struct { BaseChannel IsGeneral bool `json:"is_general"` IsChannel bool `json:"is_channel"` IsMember bool `json:"is_member"` }
Channel holds information about the channel
type ChannelCommonResponse ¶
type ChannelCommonResponse struct { Channel struct { ID string `json:"id"` Name string `json:"name"` Created int64 `json:"created"` IsChannel bool `json:"is_channel"` IsGroup bool `json:"is_group"` } `json:"channel"` // contains filtered or unexported fields }
ChannelCommonResponse holds response to rename request
type ChannelEvent ¶
ChannelEvent is sent when a message contains an actual channel and not ID
type ChannelListResponse ¶
type ChannelListResponse struct { Channels []Channel `json:"channels"` // contains filtered or unexported fields }
ChannelListResponse holds a response to a channel list request
type ChannelResponse ¶
type ChannelResponse struct { Channel Channel `json:"channel"` // contains filtered or unexported fields }
ChannelResponse holds a response to a channel request
type ChannelTopicPurpose ¶
type ChannelTopicPurpose struct { Value string `json:"value"` Creator string `json:"creator"` LastSet int64 `json:"last_set"` }
ChannelTopicPurpose holds the topic or purpose of a channel
type CloseResponse ¶
type CloseResponse struct { NoOp bool `json:"no_op"` AlreadyClosed bool `json:"already_closed"` // contains filtered or unexported fields }
CloseResponse is returned for close requests
type Comment ¶
type Comment struct { ID string `json:"id"` Timestamp int64 `json:"timestamp"` User string `json:"user"` Comment string `json:"comment"` Created int64 `json:"created,omitempty"` Reactions []Reaction `json:"reactions,omitempty"` }
Comment holds information about a file comment
type CommentResponse ¶
type CommentResponse struct { Comment Comment `json:"comment"` // contains filtered or unexported fields }
CommentResponse is returned for comment actions
type EmojiListResponse ¶
type EmojiListResponse struct { Emoji map[string]string `json:"emoji"` // contains filtered or unexported fields }
EmojiListResponse is returned for the emoji list request
type File ¶
type File struct { ID string `json:"id"` Created int64 `json:"created"` Name string `json:"name"` Title string `json:"title,omitempty"` Mimetype string `json:"mimetype"` Filetype string `json:"filetype"` PrettyType string `json:"pretty_type"` UserID string `json:"user"` Mode string `json:"mode,omitempty"` Editable bool `json:"editable"` IsExternal bool `json:"is_external"` ExternalType string `json:"external_type,omitempty"` Size int `json:"size"` URL string `json:"url,omitempty"` URLDownload string `json:"url_download,omitempty"` URLPrivate string `json:"url_private,omitempty"` URLPrivateDownload string `json:"url_private_download,omitempty"` Thumb64 string `json:"thumb_64,omitempty"` Thumb80 string `json:"thumb_80,omitempty"` Thumb360 string `json:"thumb_360,omitempty"` Thumb360Gif string `json:"thumb_360_gif,omitempty"` Thumb360W int `json:"thumb_360_w"` Thumb360H int `json:"thumb_360_h"` Permalink string `json:"permalink,omitempty"` EditLink string `json:"edit_link,omitempty"` Preview string `json:"preview,omitempty"` PreviewHighlight string `json:"preview_highlight,omitempty"` Lines int `json:"lines"` LinesMore int `json:"lines_more"` IsPublic bool `json:"is_public"` Channels []string `json:"channels,omitempty"` Groups []string `json:"groups,omitempty"` InitialComment Comment `json:"initial_comment,omitempty"` NumStars int `json:"num_stars"` IsStarred bool `json:"is_starred"` Reactions []Reaction `json:"reactions,omitempty"` }
File holds information about a file
type FileListResponse ¶
type FileListResponse struct { Files []File `json:"files"` Paging paging `json:"paging"` // contains filtered or unexported fields }
FileListResponse is the response to the file list command
type FileResponse ¶
type FileResponse struct { File File `json:"file"` Comments []Comment `json:"comments"` Paging paging `json:"paging"` // contains filtered or unexported fields }
FileResponse for file info command
type FileUploadResponse ¶
type FileUploadResponse struct { File File `json:"file"` // contains filtered or unexported fields }
FileUploadResponse is the response to the file upload command
type Group ¶
type Group struct { BaseChannel IsGroup bool `json:"is_group"` IsMPIM bool `json:"is_mpim"` }
Group holds information about the group
type GroupListResponse ¶
type GroupListResponse struct { Groups []Group `json:"groups"` // contains filtered or unexported fields }
GroupListResponse holds a response to a group list request
type GroupResponse ¶
type GroupResponse struct { Group Group `json:"group"` // contains filtered or unexported fields }
GroupResponse holds a response to a group request
type HistoryResponse ¶
type HistoryResponse struct { Latest string `json:"latest"` HasMore bool `json:"has_more"` UnreadCountDisplay int `json:"unread_count_display"` Messages []Message `json:"messages"` // contains filtered or unexported fields }
HistoryResponse holds a response to a history request
type IM ¶
type IM struct { BaseChannel IsIM bool `json:"is_im"` User string `json:"user"` IsUserDeleted bool `json:"is_user_deleted"` }
IM holds information about IM
type IMListResponse ¶
type IMListResponse struct { IMs []IM `json:"ims"` // contains filtered or unexported fields }
IMListResponse holds a response to an IM list request
type InviteeType ¶
type InviteeType int
InviteeType for the invite
const ( // InviteeRegular without any restrictions InviteeRegular InviteeType = iota // InviteeRestricted to certain channels and groups InviteeRestricted // InviteeUltraRestricted to a single channel or group InviteeUltraRestricted )
type Message ¶
type Message struct { Type string `json:"type"` Channel string `json:"channel"` User string `json:"user"` Text string `json:"text"` Timestamp string `json:"ts"` Hidden bool `json:"hidden,omitempty"` Subtype string `json:"subtype,omitempty"` Edited struct { User string `json:"user"` Timestamp string `json:"ts"` } `json:"edited,omitempty"` Message struct { Type string `json:"type"` User string `json:"user"` Text string `json:"text"` Timestamp string `json:"ts"` Edited struct { User string `json:"user"` Timestamp string `json:"ts"` } `json:"edited,omitempty"` } `json:"message,omitempty"` DeletedTS string `json:"deleted_ts,omitempty"` Topic string `json:"topic,omitempty"` Purpose string `json:"purpose,omitempty"` Name string `json:"name,omitempty"` OldName string `json:"old_name,omitempty"` Members []string `json:"members,omitempty"` Upload bool `json:"upload,omitempty"` File File `json:"file,omitempty"` Comment Comment `json:"comment,omitempty"` Reactions []Reaction `json:"reactions,omitempty"` Presence string `json:"presence,omitempty"` Value interface{} `json:"value,omitempty"` Plan string `json:"plan,omitempty"` URL string `json:"url,omitempty"` Domain string `json:"domain,omitempty"` EmailDomain string `json:"email_domain,omitempty"` EventTimestamp string `json:"event_ts,omitempty"` Error struct { Code int `json:"code"` Msg string `json:"msg"` Unmarshall bool `json:"unmarshall"` // Is this an unmarshall error and not request error } `json:"error,omitempty"` Context interface{} `json:"context,omitempty"` // A piece of data that will be passed with every message from RTMStart }
Message holds the information about incoming messages in the RTM
func (*Message) MessageType ¶
MessageType of message is returned
type OAuthAccessResponse ¶
type OAuthAccessResponse struct { AccessToken string `json:"access_token"` Scope string `json:"scope"` TeamName string `json:"team_name"` TeamID string `json:"team_id"` Bot struct { BotUserID string `json:"bot_user_id"` BotAccessToken string `json:"bot_access_token"` } `json:"bot"` // contains filtered or unexported fields }
OAuthAccessResponse - See https://api.slack.com/methods/oauth.access
func OAuthAccess ¶
func OAuthAccess(clientID, clientSecret, code, redirectURI string) (*OAuthAccessResponse, error)
OAuthAccess returns the token for OAuth
type OpenIMResponse ¶
type OpenIMResponse struct { NoOp bool `json:"no_op"` AlreadyOpen bool `json:"already_open"` Channel IM `json:"channel"` // contains filtered or unexported fields }
OpenIMResponse is returned for open IM requests
type OpenResponse ¶
type OpenResponse struct { NoOp bool `json:"no_op"` AlreadyOpen bool `json:"already_open"` // contains filtered or unexported fields }
OpenResponse is returned for open requests
type OptionFunc ¶
OptionFunc is a function that configures a Client. It is used in New
func SetHTTPClient ¶
func SetHTTPClient(httpClient *http.Client) OptionFunc
SetHTTPClient can be used to specify the http.Client to use when making requests to Slack.
type PostMessageReply ¶
type PostMessageReply struct { Channel string `json:"channel"` Timestamp string `json:"ts"` Message PostMessageRequest `json:"message"` // contains filtered or unexported fields }
PostMessageReply is the reply to the post message request - see https://api.slack.com/methods/chat.postMessage
type PostMessageRequest ¶
type PostMessageRequest struct { Channel string `json:"channel"` Text string `json:"text"` Username string `json:"username"` AsUser bool `json:"as_user"` Parse string `json:"parse"` LinkNames int `json:"link_names"` Attachments []Attachment `json:"attachments"` UnfurlLinks bool `json:"unfurl_links"` UnfurlMedia bool `json:"unfurl_media"` IconURL string `json:"icon_url"` IconEmoji string `json:"icon_emoji"` ThreadID string `json:"thread_ts"` }
PostMessageRequest includes all the fields in the post message request - see https://api.slack.com/methods/chat.postMessage
type PurposeResponse ¶
type PurposeResponse struct { Purpose string `json:"purpose"` // contains filtered or unexported fields }
PurposeResponse is the response to setPurpose request
type RTMMessage ¶
type RTMMessage struct { ID int `json:"id"` Type string `json:"type"` Channel string `json:"channel"` Text string `json:"text"` }
RTMMessage is sent on the channel for simple text
type RTMStartReply ¶
type RTMStartReply struct { URL string `json:"url"` Self struct { ID string `json:"id"` Name string `json:"name"` Prefs map[string]interface{} `json:"prefs"` Created int64 `json:"created"` ManualPresence string `json:"manual_presence"` } `json:"self"` Team Team `json:"team"` LatestEventTS string `json:"latest_event_ts"` Channels []Channel `json:"channels"` Groups []Group `json:"groups"` IMS []IM `json:"ims"` Users []User `json:"users"` Bots []Bot `json:"bots"` // contains filtered or unexported fields }
RTMStartReply holds the reply to the RTM start message with info about everything
type Reaction ¶
type Reaction struct { Name string `json:"name"` Count int `json:"count"` Uesrs []string `json:"users"` }
Reaction contains the reaction details
type ReactionsGetResponse ¶
type ReactionsGetResponse struct { Type string `json:"type"` Channel string `json:"channel,omitempty"` Message Message `json:"message,omitempty"` File File `json:"file,omitempty"` Comment Comment `json:"comment,omitempty"` // contains filtered or unexported fields }
ReactionsGetResponse is the response to the ReactionsGet request
type ReactionsListResponse ¶
type ReactionsListResponse struct { Items ReactionsGetResponse `json:"items"` Paging paging `json:"paging"` // contains filtered or unexported fields }
ReactionsListResponse is the response to the ReactionsList request
type Slack ¶
type Slack struct {
// contains filtered or unexported fields
}
Slack is the client to the Slack API.
func New ¶
func New(options ...OptionFunc) (*Slack, error)
New creates a new Slack client.
The caller can configure the new client by passing configuration options to the func.
Example:
s, err := slack.New( slack.SetURL("https://some.url.com:port/"), slack.SetErrorLog(log.New(os.Stderr, "Slack: ", log.Lshortfile), slack.SetToken("Your-Token"))
You must provide either a token or the OAuth parameters to retrieve the token. If no URL is configured, Slack uses DefaultURL by default.
If no HttpClient is configured, then http.DefaultClient is used. You can use your own http.Client with some http.Transport for advanced scenarios.
An error is also returned when some configuration option is invalid.
func (*Slack) AuthTest ¶
func (s *Slack) AuthTest() (*AuthTestResponse, error)
AuthTest tests if the authentication is in place - see https://api.slack.com/methods/auth.test
func (*Slack) ChannelCreate ¶
func (s *Slack) ChannelCreate(name string) (*ChannelResponse, error)
ChannelCreate creates a channel
func (*Slack) ChannelInfo ¶
func (s *Slack) ChannelInfo(channel string) (*ChannelResponse, error)
ChannelInfo returns info about the channel
func (*Slack) ChannelInvite ¶
func (s *Slack) ChannelInvite(channel, user string) (*ChannelResponse, error)
ChannelInvite invites a user to a group
func (*Slack) ChannelJoin ¶
func (s *Slack) ChannelJoin(channel string) (*ChannelResponse, error)
ChannelJoin joins a channel - notice that this expects channel name and not id
func (*Slack) ChannelList ¶
func (s *Slack) ChannelList(excludeArchived bool) (*ChannelListResponse, error)
ChannelList returns the list of channels
func (*Slack) CloseGroupOrIM ¶
func (s *Slack) CloseGroupOrIM(id string) (*CloseResponse, error)
CloseGroupOrIM closes the given id
func (*Slack) EmojiList ¶
func (s *Slack) EmojiList() (*EmojiListResponse, error)
EmojiList returns the list of emoji
func (*Slack) FileAddComment ¶
func (s *Slack) FileAddComment(file, comment string, setActive bool) (*CommentResponse, error)
FileAddComment to a given file
func (*Slack) FileInfo ¶
func (s *Slack) FileInfo(file string, count, page int) (*FileResponse, error)
FileInfo command
func (*Slack) FileList ¶
func (s *Slack) FileList(user, tsFrom, tsTo string, types []string, count, page int) (*FileListResponse, error)
FileList the files for the team
func (*Slack) GroupCreate ¶
func (s *Slack) GroupCreate(name string) (*GroupResponse, error)
GroupCreate creates a new group with the given name
func (*Slack) GroupCreateChild ¶
func (s *Slack) GroupCreateChild(group string) (*GroupResponse, error)
GroupCreateChild archives existing group and creates a new group with the given name
func (*Slack) GroupInfo ¶
func (s *Slack) GroupInfo(group string) (*GroupResponse, error)
GroupInfo returns info about the group
func (*Slack) GroupInvite ¶
func (s *Slack) GroupInvite(channel, user string) (*GroupResponse, error)
GroupInvite invites a user to a group
func (*Slack) GroupList ¶
func (s *Slack) GroupList(excludeArchived bool) (*GroupListResponse, error)
GroupList returns the list of groups
func (*Slack) History ¶
func (s *Slack) History(channel, latest, oldest string, inclusive, unreads bool, count int) (*HistoryResponse, error)
History retrieves history of channel, group, MPIM and IM
func (*Slack) IMList ¶
func (s *Slack) IMList() (*IMListResponse, error)
IMList returns the list of IMs
func (*Slack) InviteToSlack ¶
func (s *Slack) InviteToSlack(invitee UserInviteDetails, channels []string, inviteType InviteeType) error
InviteToSlack invites the given user to your team. You can use inviteType (0 - regular, 1 - restricted with a list of channels, 2 - single channel user)
func (*Slack) MPIMList ¶
func (s *Slack) MPIMList() (*GroupListResponse, error)
MPIMList returns the list of MPIMs
func (*Slack) OpenGroup ¶
func (s *Slack) OpenGroup(id string) (*OpenResponse, error)
OpenGroup opens a group
func (*Slack) OpenIM ¶
func (s *Slack) OpenIM(id string) (*OpenIMResponse, error)
OpenIM opens an IM conversation with the given user ID
func (*Slack) OpenMPIM ¶
func (s *Slack) OpenMPIM(users []string) (*GroupResponse, error)
OpenMPIM with the given users
func (*Slack) PostMessage ¶
func (s *Slack) PostMessage(m *PostMessageRequest, escape bool) (*PostMessageReply, error)
PostMessage posts a message to a channel
func (*Slack) RTMRunning ¶
RTMRunning Checks if the RTM is running
func (*Slack) RTMStart ¶
func (s *Slack) RTMStart(origin string, in chan *Message, context interface{}) (*RTMStartReply, error)
RTMStart starts the websocket
func (*Slack) RTMStop ¶
RTMStop closes the WebSocket which in turn closes the in channel passed in RTMStart
func (*Slack) ReactionsAdd ¶
ReactionsAdd to either file, fileComment or a combination of channel and timestamp
func (*Slack) ReactionsGet ¶
func (s *Slack) ReactionsGet(file, fileComment, channel, timestamp string, full bool) (*ReactionsGetResponse, error)
ReactionsGet for either file, fileComment or a combination of channel and timestamp
func (*Slack) ReactionsList ¶
func (s *Slack) ReactionsList(user string, full bool, count, page int) (*ReactionsListResponse, error)
ReactionsList filtered by user (optional and defaults to current)
func (*Slack) ReactionsRemove ¶
func (s *Slack) ReactionsRemove(name, file, fileComment, channel, timestamp string) (Response, error)
ReactionsRemove from either file, fileComment or a combination of channel and timestamp
func (*Slack) Rename ¶
func (s *Slack) Rename(channel, name string) (*ChannelCommonResponse, error)
Rename a channel or a group
func (*Slack) SetPurpose ¶
func (s *Slack) SetPurpose(channel, purpose string) (*PurposeResponse, error)
SetPurpose of the channel / group
func (*Slack) SetTopic ¶
func (s *Slack) SetTopic(channel, purpose string) (*TopicResponse, error)
SetTopic of the channel / group
func (*Slack) TeamInfo ¶
func (s *Slack) TeamInfo() (*TeamInfoResponse, error)
TeamInfo returns info about the team
func (*Slack) Upload ¶
func (s *Slack) Upload(title, filetype, filename, initialComment string, channels []string, data io.Reader) (*FileUploadResponse, error)
Upload a file to Slack optionally sharing it on given channels
func (*Slack) UserInfo ¶
func (s *Slack) UserInfo(user string) (*UserInfoResponse, error)
UserInfo returns info about the requested user
func (*Slack) UserList ¶
func (s *Slack) UserList() (*UserListResponse, error)
UserList returns the list of users
type Team ¶
type Team struct { ID string `json:"id"` Name string `json:"name"` EmailDomain string `json:"email_domain"` Domain string `json:"domain"` Prefs map[string]interface{} `json:"prefs"` Icon struct { Image34 string `json:"image_34"` Image44 string `json:"image_44"` Image68 string `json:"image_68"` Image88 string `json:"image_88"` Image102 string `json:"image_102"` Image132 string `json:"image_132"` ImageDefault bool `json:"image_default"` } `json:"icon"` OverStorageLimit bool `json:"over_storage_limit"` Plan string `json:"plan"` }
Team holds information about the team
type TeamInfoResponse ¶
type TeamInfoResponse struct { Team Team `json:"team"` // contains filtered or unexported fields }
TeamInfoResponse holds thre response to the team info request
type TopicResponse ¶
type TopicResponse struct { Topic string `json:"topic"` // contains filtered or unexported fields }
TopicResponse is the response to setTopic request
type TypedMessage ¶
TypedMessage holds the common fields to all messages
type User ¶
type User struct { ID string `json:"id"` Name string `json:"name"` Deleted bool `json:"deleted"` Color string `json:"color"` RealName string `json:"real_name"` TZ string `json:"tz,omitempty"` TZLabel string `json:"tz_label"` TZOffset int `json:"tz_offset"` Profile UserProfile `json:"profile"` IsBot bool `json:"is_bot"` IsAdmin bool `json:"is_admin"` IsOwner bool `json:"is_owner"` IsPrimaryOwner bool `json:"is_primary_owner"` IsRestricted bool `json:"is_restricted"` IsUltraRestricted bool `json:"is_ultra_restricted"` Has2FA bool `json:"has_2fa"` HasFiles bool `json:"has_files"` Presence string `json:"presence"` }
User contains all the information of a user
type UserInfoResponse ¶
type UserInfoResponse struct { User User `json:"user"` // contains filtered or unexported fields }
UserInfoResponse holds the response to a user info request
type UserInviteDetails ¶
type UserInviteDetails struct { Email string `json:"email"` FirstName string `json:"first_name"` LastName string `json:"last_name"` }
UserInviteDetails with first and last name optional
type UserListResponse ¶
type UserListResponse struct { Members []User `json:"members"` // contains filtered or unexported fields }
UserListResponse holds the response for the user list request
type UserPresence ¶
type UserPresence struct { Presence string `json:"presence,omitempty"` Online bool `json:"online,omitempty"` AutoAway bool `json:"auto_away,omitempty"` ManualAway bool `json:"manual_away,omitempty"` ConnectionCount int `json:"connection_count,omitempty"` LastActivity int64 `json:"last_activity,omitempty"` }
UserPresence contains details about a user online status
type UserProfile ¶
type UserProfile struct { FirstName string `json:"first_name"` LastName string `json:"last_name"` RealName string `json:"real_name"` RealNameNormalized string `json:"real_name_normalized"` Email string `json:"email"` Skype string `json:"skype"` Phone string `json:"phone"` Image24 string `json:"image_24"` Image32 string `json:"image_32"` Image48 string `json:"image_48"` Image72 string `json:"image_72"` Image192 string `json:"image_192"` ImageOriginal string `json:"image_original"` Title string `json:"title"` }
UserProfile contains all the information details of a given user