-
Notifications
You must be signed in to change notification settings - Fork 5
/
api_channels.go
48 lines (41 loc) · 1.31 KB
/
api_channels.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package slacker
// Channel represents a Slack channel
// https://api.slack.com/types/channel
type Channel struct {
Created int `json:"created"`
Creator string `json:"creator"`
ID string `json:"id"`
IsArchived bool `json:"is_archived"`
IsChannel bool `json:"is_channel"`
IsGeneral bool `json:"is_general"`
IsMember bool `json:"is_member"`
Members []string `json:"members"`
Name string `json:"name"`
NumMembers int `json:"num_members"`
Purpose ChannelPurpose `json:"purpose"`
Topic ChannelTopic `json:"topic"`
}
// ChannelPurpose represents a channels' purpose in Slack
type ChannelPurpose struct {
Creator string `json:"creator"`
LastSet int `json:"last_set"`
Value string `json:"value"`
}
// ChannelTopic represents a channel's topic in Slack
type ChannelTopic struct {
Creator string `json:"creator"`
LastSet int `json:"last_set"`
Value string `json:"value"`
}
// ChannelsList is a wrapper for a channels.list API call
type ChannelsList struct {
Channels []*Channel `json:"channels"`
}
// ChannelsList returns a list of Channels from Slack
func (c *APIClient) ChannelsList() ([]*Channel, error) {
dest := ChannelsList{}
if err := c.slackMethodAndParse("channels.list", &dest); err != nil {
return nil, err
}
return dest.Channels, nil
}