2016-09-05 16:34:37 +02:00
|
|
|
package slack
|
|
|
|
|
|
|
|
import (
|
2017-07-16 14:29:46 +02:00
|
|
|
"context"
|
2016-09-05 16:34:37 +02:00
|
|
|
"net/url"
|
|
|
|
)
|
|
|
|
|
|
|
|
type channelResponseFull struct {
|
|
|
|
Channel Channel `json:"channel"`
|
|
|
|
Channels []Channel `json:"channels"`
|
|
|
|
Purpose string `json:"purpose"`
|
|
|
|
Topic string `json:"topic"`
|
|
|
|
NotInChannel bool `json:"not_in_channel"`
|
|
|
|
History
|
|
|
|
SlackResponse
|
2020-03-28 23:50:47 +01:00
|
|
|
Metadata ResponseMetadata `json:"response_metadata"`
|
2016-09-05 16:34:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Channel contains information about the channel
|
|
|
|
type Channel struct {
|
2019-09-07 22:46:58 +02:00
|
|
|
GroupConversation
|
2018-08-10 00:38:19 +02:00
|
|
|
IsChannel bool `json:"is_channel"`
|
|
|
|
IsGeneral bool `json:"is_general"`
|
|
|
|
IsMember bool `json:"is_member"`
|
|
|
|
Locale string `json:"locale"`
|
2016-09-05 16:34:37 +02:00
|
|
|
}
|
|
|
|
|
2019-09-07 22:46:58 +02:00
|
|
|
func (api *Client) channelRequest(ctx context.Context, path string, values url.Values) (*channelResponseFull, error) {
|
2016-09-05 16:34:37 +02:00
|
|
|
response := &channelResponseFull{}
|
2019-09-07 22:46:58 +02:00
|
|
|
err := postForm(ctx, api.httpclient, api.endpoint+path, values, response, api)
|
2016-09-05 16:34:37 +02:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2019-09-07 22:46:58 +02:00
|
|
|
|
|
|
|
return response, response.Err()
|
2016-09-05 16:34:37 +02:00
|
|
|
}
|