2016-09-05 14:34:37 +00:00
|
|
|
package slack
|
|
|
|
|
|
|
|
import (
|
2017-07-16 12:29:46 +00:00
|
|
|
"context"
|
2016-09-05 14:34:37 +00: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 22:50:47 +00:00
|
|
|
Metadata ResponseMetadata `json:"response_metadata"`
|
2016-09-05 14:34:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Channel contains information about the channel
|
|
|
|
type Channel struct {
|
2019-09-07 20:46:58 +00:00
|
|
|
GroupConversation
|
2024-08-27 17:04:05 +00:00
|
|
|
IsChannel bool `json:"is_channel"`
|
|
|
|
IsGeneral bool `json:"is_general"`
|
|
|
|
IsMember bool `json:"is_member"`
|
|
|
|
Locale string `json:"locale"`
|
|
|
|
Properties *Properties `json:"properties"`
|
2016-09-05 14:34:37 +00:00
|
|
|
}
|
|
|
|
|
2019-09-07 20:46:58 +00:00
|
|
|
func (api *Client) channelRequest(ctx context.Context, path string, values url.Values) (*channelResponseFull, error) {
|
2016-09-05 14:34:37 +00:00
|
|
|
response := &channelResponseFull{}
|
2019-09-07 20:46:58 +00:00
|
|
|
err := postForm(ctx, api.httpclient, api.endpoint+path, values, response, api)
|
2016-09-05 14:34:37 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2019-09-07 20:46:58 +00:00
|
|
|
|
|
|
|
return response, response.Err()
|
2016-09-05 14:34:37 +00:00
|
|
|
}
|