Documentation
¶
Index ¶
- type BaseAPIResponse
- type Channel
- type ChannelsHistoryOpt
- type ChannelsHistoryResponse
- type ChannelsListAPIResponse
- type ChatPostMessageAPIResponse
- type ChatPostMessageOpt
- type FilesUploadAPIResponse
- type FilesUploadOpt
- type Group
- type GroupsCreateAPIResponse
- type GroupsListAPIResponse
- type Message
- type ProfileInfo
- type Purpose
- type Slack
- func (sl *Slack) ChannelsHistory(opt *ChannelsHistoryOpt) ([]*Message, error)
- func (sl *Slack) ChannelsList() ([]*Channel, error)
- func (sl *Slack) ChatPostMessage(channelId string, text string, opt *ChatPostMessageOpt) error
- func (sl *Slack) CreateGroup(name string) error
- func (sl *Slack) DoRequest(req *http.Request) ([]byte, error)
- func (sl *Slack) FilesUpload(opt *FilesUploadOpt) error
- func (sl *Slack) FindChannel(cb func(*Channel) bool) (*Channel, error)
- func (sl *Slack) FindChannelByName(name string) (*Channel, error)
- func (sl *Slack) FindGroup(cb func(*Group) bool) (*Group, error)
- func (sl *Slack) FindGroupByName(name string) (*Group, error)
- func (sl *Slack) FindUser(cb func(*User) bool) (*User, error)
- func (sl *Slack) GetRequest(endpoint string, uv *url.Values) ([]byte, error)
- func (sl *Slack) GroupsList() ([]*Group, error)
- func (sl *Slack) InviteGroup(channelId, userId string) error
- func (sl *Slack) JoinChannel(name string) error
- func (sl *Slack) PostRequest(endpoint string, uv *url.Values, body *bytes.Buffer) ([]byte, error)
- func (sl *Slack) UsersInfo(userId string) (*User, error)
- func (sl *Slack) UsersList() ([]*User, error)
- type Topic
- type User
- type UsersInfoAPIResponse
- type UsersListAPIResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseAPIResponse ¶
type Channel ¶
type Channel struct { Id string `json:"id"` Name string `json:"name"` IsChannel bool `json:"is_channel"` Created int `json:"created"` Creator string `json:"creator"` IsArchived bool `json:"is_archived"` IsGeneral bool `json:"is_general"` IsMember bool `json:"is_member"` Members []string `json:"members"` RawTopic json.RawMessage `json:"topic"` RawPurpose json.RawMessage `json:"purpose"` NumMembers int `json:"num_members"` }
slack channel type
type ChannelsHistoryOpt ¶
type ChannelsHistoryOpt struct { Channel string `json:"channel"` Latest float64 `json:"latest"` Oldest float64 `json:"oldest"` Inclusive int `json:"inclusive"` Count int `json:"count"` }
option type for `channels.history` api
type ChannelsHistoryResponse ¶
type ChannelsHistoryResponse struct { BaseAPIResponse Latest float64 `json:"latest"` Messages []*Message `json:"messages"` HasMore bool `json:"has_more"` }
response type for `channels.history` api
type ChannelsListAPIResponse ¶
type ChannelsListAPIResponse struct { BaseAPIResponse RawChannels json.RawMessage `json:"channels"` }
response type for `channels.list` api
func (*ChannelsListAPIResponse) Channels ¶
func (res *ChannelsListAPIResponse) Channels() ([]*Channel, error)
Channels returns a slice of channel object from a response of `channels.list` api.
type ChatPostMessageAPIResponse ¶
type ChatPostMessageAPIResponse struct { BaseAPIResponse Channel string `json:"channel"` Ts string `json:"ts"` }
response type for `chat.postMessage` api
type ChatPostMessageOpt ¶
type ChatPostMessageOpt struct { AsUser bool Parse string LinkNames string AttachMents string UnfurlLinks string UnfurlMedia string IconUrl string IconEmoji string }
option type for `chat.postMessage` api
type FilesUploadAPIResponse ¶
response of `files.upload` api
type FilesUploadOpt ¶
type FilesUploadOpt struct { Content string Filepath string Filetype string Filename string Title string InitialComment string Channels []string }
option type for `files.upload` api
type Group ¶
type Group struct { Id string `json:"id"` Name string `json:"name"` Created int `json:"created"` Creator string `json:"creator"` IsArchived bool `json:"is_archived"` Members []string `json:"members"` RawTopic json.RawMessage `json:"topic"` RawPurpose json.RawMessage `json:"purpose"` }
slack group type
type GroupsCreateAPIResponse ¶
type GroupsCreateAPIResponse struct { BaseAPIResponse RawGroup json.RawMessage `json:"group"` }
response type for `groups.create` api
func (*GroupsCreateAPIResponse) Group ¶
func (res *GroupsCreateAPIResponse) Group() (*Group, error)
type GroupsListAPIResponse ¶
type GroupsListAPIResponse struct { BaseAPIResponse RawGroups json.RawMessage `json:"groups"` }
response type for `groups.list` api
func (*GroupsListAPIResponse) Groups ¶
func (res *GroupsListAPIResponse) Groups() ([]*Group, error)
Groups returns a slice of group object from `groups.list` api.
type Message ¶
type ProfileInfo ¶
type ProfileInfo struct { FirstName string `json:"first_name"` LastName string `json:"last_name"` RealName string `json:"real_name"` 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"` }
slack user profile type
type Slack ¶
type Slack struct {
// contains filtered or unexported fields
}
func (*Slack) ChannelsHistory ¶
func (sl *Slack) ChannelsHistory(opt *ChannelsHistoryOpt) ([]*Message, error)
API channels.history: Fetches history of messages and events from a channel.
func (*Slack) ChannelsList ¶
API channels.list: Lists all channels in a Slack team.
func (*Slack) ChatPostMessage ¶
func (sl *Slack) ChatPostMessage(channelId string, text string, opt *ChatPostMessageOpt) error
API chat.postMessage: Sends a message to a channel.
func (*Slack) CreateGroup ¶
API groups.create: Creates a private group.
func (*Slack) FilesUpload ¶
func (sl *Slack) FilesUpload(opt *FilesUploadOpt) error
API files.upload: Uploads or creates a file.
func (*Slack) FindChannel ¶
FindChannel returns a channel object that satisfy conditions specified.
func (*Slack) FindChannelByName ¶
FindChannelByName returns a channel object that matches name specified.
func (*Slack) FindGroupByName ¶
FindGroupByName returns a group object that matches name specified.
func (*Slack) GetRequest ¶
func (*Slack) GroupsList ¶
API groups.list: Lists private groups that the calling user has access to.
func (*Slack) InviteGroup ¶
API groups.invite: Invites a user to a private group.
func (*Slack) JoinChannel ¶
API channels.join: Joins a channel, creating it if needed.
func (*Slack) PostRequest ¶
type User ¶
type User struct { Id string `json:"id"` Name string `json:"name"` Deleted bool `json:"deleted"` Color string `json:"color"` Profile *ProfileInfo IsAdmin bool `json:"is_admin"` IsOwner bool `json:"is_owner"` Has2fa bool `json:"has_2fa"` HasFiles bool `json:"has_files"` }
slack user type
type UsersInfoAPIResponse ¶
type UsersInfoAPIResponse struct { BaseAPIResponse User *User `json:"user"` }
response type of `users.info` api
type UsersListAPIResponse ¶
type UsersListAPIResponse struct { BaseAPIResponse RawMembers json.RawMessage `json:"members"` }
response type of `users.list` api
func (*UsersListAPIResponse) Members ¶
func (res *UsersListAPIResponse) Members() ([]*User, error)