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