Documentation ¶
Index ¶
- type APIResult
- type APITestResult
- type AuthRevokeResult
- type AuthTestResult
- type BotInfo
- type BotsInfoResult
- type ChannelArchiveResult
- type ChannelBrief
- type ChannelCreateResult
- type ChannelFull
- type ChannelHistoryResult
- type ChannelId
- type ChannelInfoResult
- type ChannelInviteResult
- type ChannelJoinResult
- type ChannelKickResult
- type ChannelLeaveResult
- type ChannelListResult
- type ChannelMarkResult
- type ChannelMinimal
- type ChannelPurpose
- type ChannelRenameResult
- type ChannelSetPurposeResult
- type ChannelSetTopicResult
- type ChannelSummary
- type ChannelTopic
- type ChannelUnarchiveResult
- type GroupCreateResult
- type GroupFull
- type HandyReactionsInfo
- type IMFull
- type IconInfo
- type MPIMFull
- type Message
- type RTMMessage
- type RTMMessageChan
- type RTMSendMessageRequest
- type RTMStartResult
- type Reaction
- type ReactionListItem
- type Slack
- func (s *Slack) APITest(fail bool) (res *APITestResult, err error)
- func (s *Slack) AuthRevoke(test bool) (res *AuthRevokeResult, err error)
- func (s *Slack) AuthTest() (res *AuthTestResult, err error)
- func (s *Slack) BotsInfo(botid string) (res *BotsInfoResult, err error)
- func (s *Slack) ChannelArchive(channel ChannelId) (res *ChannelArchiveResult, err error)
- func (s *Slack) ChannelCreate(name string) (res *ChannelCreateResult, err error)
- func (s *Slack) ChannelHistory(channel ChannelId, count uint, oldest, latest SlackTime) (res *ChannelHistoryResult, err error)
- func (s *Slack) ChannelInfo(channel ChannelId) (res *ChannelInfoResult, err error)
- func (s *Slack) ChannelInvite(channel ChannelId, user UserId) (res *ChannelInviteResult, err error)
- func (s *Slack) ChannelJoin(name string) (res *ChannelJoinResult, err error)
- func (s *Slack) ChannelKick(channel ChannelId, user UserId) (res *ChannelKickResult, err error)
- func (s *Slack) ChannelLeave(channel ChannelId) (res *ChannelLeaveResult, err error)
- func (s *Slack) ChannelList(excludeArchived bool) (res *ChannelListResult, err error)
- func (s *Slack) ChannelMark(channel ChannelId, ts SlackTime) (res *ChannelMarkResult, err error)
- func (s *Slack) ChannelRename(channel ChannelId, name string) (res *ChannelRenameResult, err error)
- func (s *Slack) ChannelSetPurpose(channel ChannelId, purpose string) (res *ChannelSetPurposeResult, err error)
- func (s *Slack) ChannelSetTopic(channel ChannelId, topic string) (res *ChannelSetTopicResult, err error)
- func (s *Slack) ChannelUnarchive(channel ChannelId) (res *ChannelUnarchiveResult, err error)
- func (s *Slack) GroupCreate(name string) (res *GroupCreateResult, err error)
- func (s *Slack) RTMStart(simpleLatest, noUnreads bool) (res *RTMStartResult, err error)
- type SlackRTM
- type SlackRTMChannel
- type SlackTime
- type TeamPrefs
- type TeamSummary
- type UnixTime
- type UserBrief
- type UserId
- type UserSummary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APITestResult ¶
type APITestResult struct {
APIResult
}
APITestResult contains a delightful affirmation of your competence.
type AuthRevokeResult ¶
AuthRevokeResult includes the response to an AuthRevoke API call. Note that `Revoked` is useful to distinguish whether the API was called in "test mode"
type AuthTestResult ¶
type AuthTestResult struct { APIResult URL string Team string Name string `json:"user"` Team_Id string User_Id UserId }
AuthTestResult includes the response to an AuthTest API call.
type BotsInfoResult ¶
BotsInfoResult contains the response to a BotsInfo request.
type ChannelArchiveResult ¶
type ChannelArchiveResult struct {
APIResult
}
ChannelArchiveResult contains the response to a ChannelArchive request.
type ChannelBrief ¶
type ChannelBrief struct { ChannelMinimal Creator UserId Is_Archived bool Is_General bool }
ChannelBrief is returned in a ChannelJoinResult if already in a channel.
type ChannelCreateResult ¶
type ChannelCreateResult struct { APIResult Channel ChannelFull }
ChannelCreateResult contains the response to a ChannelCreate request.
type ChannelFull ¶
type ChannelFull struct { ChannelSummary Is_Starred bool Members []UserId Last_Read SlackTime Latest Message Unread_Count uint Unread_Count_Display uint }
ChannelFull expands on ChannelSummary to include fields used by eg ChannelInfoResult.
type ChannelHistoryResult ¶
type ChannelHistoryResult struct { APIResult Latest SlackTime Messages []Message Has_More bool Is_Limited bool }
ChannelHistoryResult contains the response to a ChannelHistory request.
type ChannelId ¶
type ChannelId string
A ChannelId is an opaque string that represents a "public" Slack channel, survivng channel renames unchanged.
type ChannelInfoResult ¶
type ChannelInfoResult struct { APIResult Channel ChannelFull }
ChannelInfoResult contains the response to a ChannelInfo request.
type ChannelInviteResult ¶
type ChannelInviteResult struct { APIResult Channel ChannelFull }
ChannelInviteResult contains the response to a ChannelInvite request.
type ChannelJoinResult ¶
type ChannelJoinResult struct { APIResult Already_In_Channel bool Channel ChannelFull }
ChannelJoinResult contains the response to a ChannelJoin request.
type ChannelKickResult ¶
type ChannelKickResult struct {
APIResult
}
ChannelKickResult contains the response to a ChannelKick request.
type ChannelLeaveResult ¶
ChannelLeaveResult contains the response to a ChannelLeave request.
type ChannelListResult ¶
type ChannelListResult struct { APIResult Channels []ChannelSummary }
ChannelListResult contains the response to a ChannelList request.
type ChannelMarkResult ¶
type ChannelMarkResult struct {
APIResult
}
ChannelMarkResult contains the response to a ChannelMark request.
type ChannelMinimal ¶
ChannelMinimal is returned in a ChannelRenameResult.
type ChannelPurpose ¶
ChannelPurpose contains the "purpose" text, as well as the user who set the purpose and when
type ChannelRenameResult ¶
type ChannelRenameResult struct { APIResult Channel ChannelMinimal }
ChannelRenameResult contains the response to a ChannelRename request.
type ChannelSetPurposeResult ¶
ChannelSetPurposeResult contains the response to a ChannelSetPurpose request.
type ChannelSetTopicResult ¶
ChannelSetTopicResult contains the response to a ChannelSetTopic request.
type ChannelSummary ¶
type ChannelSummary struct { ChannelBrief Is_Member bool Num_Members uint Topic ChannelTopic Purpose ChannelPurpose }
ChannelSummary expands on ChannelBrief to include fields used by eg ChannelListResult.
type ChannelTopic ¶
ChannelTopic contains the "topic" text, as well as the user who set the topic and when
type ChannelUnarchiveResult ¶
type ChannelUnarchiveResult struct {
APIResult
}
ChannelUnarchiveResult contains the response to a ChannelUnarchive request.
type GroupCreateResult ¶
type GroupCreateResult struct { APIResult Group ChannelFull }
type GroupFull ¶
type GroupFull struct { Id ChannelId Name string Is_Group bool Created UnixTime Creator UserId Is_Archived bool // Is_MPIM indicates this is a simulated private channel for an IM among 3+ users // This should never be true, because this only happens when API requests are made that // don't signal MPIM awareness, and this code is MPIM aware. Is_MPIM bool Members []UserId Topic ChannelTopic Purpose ChannelPurpose Last_Read SlackTime Latest Message Unread_Count uint Unread_Count_Display uint }
type HandyReactionsInfo ¶
type HandyReactionsInfo struct { Restrict bool List []ReactionListItem }
type Message ¶
type Message struct { Type string Timestamp SlackTime `json:"ts"` User UserId Text string Is_Starred bool Reactions []Reaction }
Message describes an event in a channel or private message.
type RTMMessage ¶
type RTMMessageChan ¶
type RTMMessageChan chan *RTMMessage
type RTMSendMessageRequest ¶
type RTMStartResult ¶
type RTMStartResult struct { APIResult URL string Self UserBrief Team TeamSummary Users []UserSummary Channels []ChannelSummary Groups []GroupFull MPIMs []MPIMFull IMs []IMFull }
RTMStartResult contains the response to a RTMStart request, and a bunch of details about the Slack you're about to start receiving streaming events for.
func (*RTMStartResult) Dial ¶
func (rsr *RTMStartResult) Dial() (rtm *SlackRTM, err error)
type ReactionListItem ¶
type Slack ¶
type Slack struct {
// contains filtered or unexported fields
}
func (*Slack) APITest ¶
func (s *Slack) APITest(fail bool) (res *APITestResult, err error)
APITest issues a call against the Slack API, which you can optionally force to return unsuccessfully.
func (*Slack) AuthRevoke ¶
func (s *Slack) AuthRevoke(test bool) (res *AuthRevokeResult, err error)
AuthRevoke will cause the current authentication token associated with `s` to be revoked, for instance if the user is logging out. Don't use this with bot tokens. Set `test` to exercise the API without really revoking anything.
func (*Slack) AuthTest ¶
func (s *Slack) AuthTest() (res *AuthTestResult, err error)
AuthTest will ask the API whether our authentication token is valid, and if so, give us some boilerplate information about the token
func (*Slack) BotsInfo ¶
func (s *Slack) BotsInfo(botid string) (res *BotsInfoResult, err error)
BotsInfo requests information from Slack about bot named by `botid`. Use an empty string (ie "") to elide this optional parameter.
func (*Slack) ChannelArchive ¶
func (s *Slack) ChannelArchive(channel ChannelId) (res *ChannelArchiveResult, err error)
ChannelArchive causes the public channel named by `channel` to be archived.
func (*Slack) ChannelCreate ¶
func (s *Slack) ChannelCreate(name string) (res *ChannelCreateResult, err error)
ChannelCreate creates a new "public" channel named `name`.
func (*Slack) ChannelHistory ¶
func (s *Slack) ChannelHistory(channel ChannelId, count uint, oldest, latest SlackTime) (res *ChannelHistoryResult, err error)
ChannelHistory requests that the server send us events from a "public" channel identified by `channel`, requesting up to `count` events, optionally bounded by `oldest` and/or `latest` (which can be "" to exclude). Regarding the API, note that the range of timestamps requested will always be inclusive (we always set inclusive=1) and the optional unread_count_display field will always be included (we always set unreads=1). `count` may range from 1 to 1000; the API specifies a default of 100.
func (*Slack) ChannelInfo ¶
func (s *Slack) ChannelInfo(channel ChannelId) (res *ChannelInfoResult, err error)
ChannelInfo requests more detailed info about the channel named by `channel`.
func (*Slack) ChannelInvite ¶
func (s *Slack) ChannelInvite(channel ChannelId, user UserId) (res *ChannelInviteResult, err error)
ChannelInvite invites a user into a "public" channel we currently occupy.
func (*Slack) ChannelJoin ¶
func (s *Slack) ChannelJoin(name string) (res *ChannelJoinResult, err error)
ChannelJoin joins a new "public" channel named `name`, or creates it.
func (*Slack) ChannelKick ¶
func (s *Slack) ChannelKick(channel ChannelId, user UserId) (res *ChannelKickResult, err error)
ChannelKick removes a user from a "public" channel.
func (*Slack) ChannelLeave ¶
func (s *Slack) ChannelLeave(channel ChannelId) (res *ChannelLeaveResult, err error)
ChannelLeave departs the channel named by `channel`.
func (*Slack) ChannelList ¶
func (s *Slack) ChannelList(excludeArchived bool) (res *ChannelListResult, err error)
ChannelList requests the list of "public" channels available on the server.
func (*Slack) ChannelMark ¶
func (s *Slack) ChannelMark(channel ChannelId, ts SlackTime) (res *ChannelMarkResult, err error)
ChannelMark updates server as to the latest message received in the channel named by `channel`.
func (*Slack) ChannelRename ¶
func (s *Slack) ChannelRename(channel ChannelId, name string) (res *ChannelRenameResult, err error)
ChannelRename changes the name of the channel named by `channel`.
func (*Slack) ChannelSetPurpose ¶
func (s *Slack) ChannelSetPurpose(channel ChannelId, purpose string) (res *ChannelSetPurposeResult, err error)
ChannelSetPurpose changes the "purpose" of the channel named by `channel`. The purpose may be up to 250 characters.
func (*Slack) ChannelSetTopic ¶
func (s *Slack) ChannelSetTopic(channel ChannelId, topic string) (res *ChannelSetTopicResult, err error)
ChannelSetTopic changes the "topic" of the channel named by `channel`. The topic may be up to 100 characters.
func (*Slack) ChannelUnarchive ¶
func (s *Slack) ChannelUnarchive(channel ChannelId) (res *ChannelUnarchiveResult, err error)
ChannelUnarchive causes the public channel named by `channel` to be unarchived.
func (*Slack) GroupCreate ¶
func (s *Slack) GroupCreate(name string) (res *GroupCreateResult, err error)
func (*Slack) RTMStart ¶
func (s *Slack) RTMStart(simpleLatest, noUnreads bool) (res *RTMStartResult, err error)
RTMStart request a special Websocket URL plus a ton of anciliary information about the Slack instance we'll be talking to. `simpleLatest` will elide the timestamps for all but the most recent messages in each channel. `noUnreads` will skip counts for unread messages per channel.
type SlackRTM ¶
type SlackRTM struct { Id chan uint64 ChannelsLock sync.RWMutex Channels map[ChannelId]*SlackRTMChannel // contains filtered or unexported fields }
func (*SlackRTM) OpenChannel ¶
func (rtm *SlackRTM) OpenChannel(c ChannelId) (rtmc *SlackRTMChannel)
type SlackRTMChannel ¶
type SlackRTMChannel struct { Rx RTMMessageChan // contains filtered or unexported fields }
func (*SlackRTMChannel) Close ¶
func (rtmc *SlackRTMChannel) Close()
func (*SlackRTMChannel) Send ¶
func (rtmc *SlackRTMChannel) Send(text string) (err error)
type SlackTime ¶
type SlackTime string
SlackTime is a string that represents an unambiguously-sortable timeline event. It appears to be encoded as a unix timestamp, plus a dot, plus a zero-padded atomic index for each event that happens in that second. SlackTimes are mostly used for finding relative events (ie happened before, happened after) and not for precise time.
type TeamPrefs ¶
type TeamPrefs struct { Display_Email_Addresses bool Default_Channels []ChannelId Who_Can_Create_Groups string // "ra", ... set of runes describing capable users? Warn_Before_At_Channel string // "always", ... Auth_Mode string // "normal", ... Invites_Only_Admins bool Retention_Type int // 0, ... Allow_Retention_Override bool Who_Has_Team_Visibility string // "ra", ... Who_Can_Kick_Channels string // "admin", ... Who_Can_Edit_User_Groups string // "admin", ... Msg_Edit_Window_Mins int Group_Retention_Duration int Group_Retention_Type int // 0, ... Invites_Limit bool Who_Can_At_Everyone string // "regular", ... Who_Can_Create_Channels string // "regular", ... Who_Can_Archive_Channsl string // "regular", ... Retention_Duration int Require_At_For_Mention bool Hide_Referers bool Calling_App_Name string // "Slack", ... Who_Can_Post_General string // "ra", ... Who_Can_Kick_Groups string // "regular", ... Compliance_Export_Start int // 0, ... Allow_Message_Deletion bool Allow_Calls bool Display_Real_Names bool Who_Can_At_Channel string // "ra", ... Who_Can_Create_Delete_User_Groups string // "admin", ... Who_Can_Change_Team_Profile string // "admin", ... DM_Retention_Duration int DM_Retention_Type int // 0, ... Disable_File_Editing bool Disable_File_Deleting bool Disable_File_Uploads string // "allow_all", ... Disallow_Public_File_URLs bool File_Retention_Duration int File_Retention_Type int // 0, ... Default_Rxns []string // Rxns -> Reactions Team_Handy_Rxns HandyReactionsInfo Channel_Handy_Rxns HandyReactionsInfo DND_Start_Hour string // "22:00", ... DND_End_Hour string // "08:00", ... DND_Enabled bool // These are not well-documented and look mostly useless Who_Can_Manage_Integrations interface{} }
type TeamSummary ¶
type UnixTime ¶
type UnixTime uint64
UnixTime is simply your bog-standard Unix epoch counter, such as used by time.Unix. No nanoseconds.