| 1 | package slack |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "net/url" |
| 6 | ) |
| 7 | |
| 8 | type channelResponseFull struct { |
| 9 | Channel Channel `json:"channel"` |
| 10 | Channels []Channel `json:"channels"` |
| 11 | Purpose string `json:"purpose"` |
| 12 | Topic string `json:"topic"` |
| 13 | NotInChannel bool `json:"not_in_channel"` |
| 14 | History |
| 15 | SlackResponse |
| 16 | Metadata ResponseMetadata `json:"response_metadata"` |
| 17 | } |
| 18 | |
| 19 | // Channel contains information about the channel |
| 20 | type Channel struct { |
| 21 | GroupConversation |
| 22 | IsChannel bool `json:"is_channel"` |
| 23 | IsGeneral bool `json:"is_general"` |
| 24 | IsMember bool `json:"is_member"` |
| 25 | Locale string `json:"locale"` |
| 26 | } |
| 27 | |
| 28 | func (api *Client) channelRequest(ctx context.Context, path string, values url.Values) (*channelResponseFull, error) { |
| 29 | response := &channelResponseFull{} |
| 30 | err := postForm(ctx, api.httpclient, api.endpoint+path, values, response, api) |
| 31 | if err != nil { |
| 32 | return nil, err |
| 33 | } |
| 34 | |
| 35 | return response, response.Err() |
| 36 | } |