summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/slack-go/slack/im.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2021-05-05 22:03:28 +0200
committerGitHub <noreply@github.com>2021-05-05 22:03:28 +0200
commita0bca42a7ad98a37f4bdc4d7adc419471163edfb (patch)
tree3e87fdb61128039b016adb4e586636484c63ed52 /vendor/github.com/slack-go/slack/im.go
parentaf543dcd05cfb5341311e2e214727e26411d2f92 (diff)
downloadmatterbridge-msglm-a0bca42a7ad98a37f4bdc4d7adc419471163edfb.tar.gz
matterbridge-msglm-a0bca42a7ad98a37f4bdc4d7adc419471163edfb.tar.bz2
matterbridge-msglm-a0bca42a7ad98a37f4bdc4d7adc419471163edfb.zip
Update vendor (#1461)
* Update vendored libs * Fix slack api changes
Diffstat (limited to 'vendor/github.com/slack-go/slack/im.go')
-rw-r--r--vendor/github.com/slack-go/slack/im.go199
1 files changed, 0 insertions, 199 deletions
diff --git a/vendor/github.com/slack-go/slack/im.go b/vendor/github.com/slack-go/slack/im.go
index a884b295..7c4bc257 100644
--- a/vendor/github.com/slack-go/slack/im.go
+++ b/vendor/github.com/slack-go/slack/im.go
@@ -1,11 +1,5 @@
package slack
-import (
- "context"
- "net/url"
- "strconv"
-)
-
type imChannel struct {
ID string `json:"id"`
}
@@ -21,200 +15,7 @@ type imResponseFull struct {
}
// IM contains information related to the Direct Message channel
-//
-// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version.
-// In Slack, these API are no longer available for newly Apps created after June 10th, 2020.
-// Also, existing applications will not be able to use these APIs after February 24th, 2021.
-//
-// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api
type IM struct {
Conversation
IsUserDeleted bool `json:"is_user_deleted"`
}
-
-func (api *Client) imRequest(ctx context.Context, path string, values url.Values) (*imResponseFull, error) {
- response := &imResponseFull{}
- err := api.postMethod(ctx, path, values, response)
- if err != nil {
- return nil, err
- }
-
- return response, response.Err()
-}
-
-// CloseIMChannel closes the direct message channel
-//
-// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version.
-// In Slack, these API are no longer available for newly Apps created after June 10th, 2020.
-// Also, existing applications will not be able to use these APIs after February 24th, 2021.
-//
-// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api
-func (api *Client) CloseIMChannel(channel string) (bool, bool, error) {
- return api.CloseIMChannelContext(context.Background(), channel)
-}
-
-// CloseIMChannelContext closes the direct message channel with a custom context
-//
-// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version.
-// In Slack, these API are no longer available for newly Apps created after June 10th, 2020.
-// Also, existing applications will not be able to use these APIs after February 24th, 2021.
-//
-// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api
-func (api *Client) CloseIMChannelContext(ctx context.Context, channel string) (bool, bool, error) {
- values := url.Values{
- "token": {api.token},
- "channel": {channel},
- }
-
- response, err := api.imRequest(ctx, "im.close", values)
- if err != nil {
- return false, false, err
- }
- return response.NoOp, response.AlreadyClosed, nil
-}
-
-// OpenIMChannel opens a direct message channel to the user provided as argument
-// Returns some status and the channel ID
-//
-// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version.
-// In Slack, these API are no longer available for newly Apps created after June 10th, 2020.
-// Also, existing applications will not be able to use these APIs after February 24th, 2021.
-//
-// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api
-func (api *Client) OpenIMChannel(user string) (bool, bool, string, error) {
- return api.OpenIMChannelContext(context.Background(), user)
-}
-
-// OpenIMChannelContext opens a direct message channel to the user provided as argument with a custom context
-// Returns some status and the channel ID
-//
-// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version.
-// In Slack, these API are no longer available for newly Apps created after June 10th, 2020.
-// Also, existing applications will not be able to use these APIs after February 24th, 2021.
-//
-// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api
-func (api *Client) OpenIMChannelContext(ctx context.Context, user string) (bool, bool, string, error) {
- values := url.Values{
- "token": {api.token},
- "user": {user},
- }
-
- response, err := api.imRequest(ctx, "im.open", values)
- if err != nil {
- return false, false, "", err
- }
- return response.NoOp, response.AlreadyOpen, response.Channel.ID, nil
-}
-
-// MarkIMChannel sets the read mark of a direct message channel to a specific point
-//
-// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version.
-// In Slack, these API are no longer available for newly Apps created after June 10th, 2020.
-// Also, existing applications will not be able to use these APIs after February 24th, 2021.
-//
-// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api
-func (api *Client) MarkIMChannel(channel, ts string) (err error) {
- return api.MarkIMChannelContext(context.Background(), channel, ts)
-}
-
-// MarkIMChannelContext sets the read mark of a direct message channel to a specific point with a custom context
-//
-// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version.
-// In Slack, these API are no longer available for newly Apps created after June 10th, 2020.
-// Also, existing applications will not be able to use these APIs after February 24th, 2021.
-//
-// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api
-func (api *Client) MarkIMChannelContext(ctx context.Context, channel, ts string) error {
- values := url.Values{
- "token": {api.token},
- "channel": {channel},
- "ts": {ts},
- }
-
- _, err := api.imRequest(ctx, "im.mark", values)
- return err
-}
-
-// GetIMHistory retrieves the direct message channel history
-//
-// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version.
-// In Slack, these API are no longer available for newly Apps created after June 10th, 2020.
-// Also, existing applications will not be able to use these APIs after February 24th, 2021.
-//
-// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api
-func (api *Client) GetIMHistory(channel string, params HistoryParameters) (*History, error) {
- return api.GetIMHistoryContext(context.Background(), channel, params)
-}
-
-// GetIMHistoryContext retrieves the direct message channel history with a custom context
-//
-// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version.
-// In Slack, these API are no longer available for newly Apps created after June 10th, 2020.
-// Also, existing applications will not be able to use these APIs after February 24th, 2021.
-//
-// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api
-func (api *Client) GetIMHistoryContext(ctx context.Context, channel string, params HistoryParameters) (*History, error) {
- values := url.Values{
- "token": {api.token},
- "channel": {channel},
- }
- if params.Latest != DEFAULT_HISTORY_LATEST {
- values.Add("latest", params.Latest)
- }
- if params.Oldest != DEFAULT_HISTORY_OLDEST {
- values.Add("oldest", params.Oldest)
- }
- if params.Count != DEFAULT_HISTORY_COUNT {
- values.Add("count", strconv.Itoa(params.Count))
- }
- if params.Inclusive != DEFAULT_HISTORY_INCLUSIVE {
- if params.Inclusive {
- values.Add("inclusive", "1")
- } else {
- values.Add("inclusive", "0")
- }
- }
- if params.Unreads != DEFAULT_HISTORY_UNREADS {
- if params.Unreads {
- values.Add("unreads", "1")
- } else {
- values.Add("unreads", "0")
- }
- }
-
- response, err := api.imRequest(ctx, "im.history", values)
- if err != nil {
- return nil, err
- }
- return &response.History, nil
-}
-
-// GetIMChannels returns the list of direct message channels
-//
-// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version.
-// In Slack, these API are no longer available for newly Apps created after June 10th, 2020.
-// Also, existing applications will not be able to use these APIs after February 24th, 2021.
-//
-// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api
-func (api *Client) GetIMChannels() ([]IM, error) {
- return api.GetIMChannelsContext(context.Background())
-}
-
-// GetIMChannelsContext returns the list of direct message channels with a custom context
-//
-// Deprecated: channels.*, groups.* im.* and mpim.* methods will be deprecated in the next version.
-// In Slack, these API are no longer available for newly Apps created after June 10th, 2020.
-// Also, existing applications will not be able to use these APIs after February 24th, 2021.
-//
-// See also: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api
-func (api *Client) GetIMChannelsContext(ctx context.Context) ([]IM, error) {
- values := url.Values{
- "token": {api.token},
- }
-
- response, err := api.imRequest(ctx, "im.list", values)
- if err != nil {
- return nil, err
- }
- return response.IMs, nil
-}