diff options
author | Wim <wim@42.be> | 2019-01-31 17:06:36 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2019-01-31 17:06:36 +0100 |
commit | c81c0dd22a7779148c4890cfd4bbf490054f06f1 (patch) | |
tree | 06ce6fcdc8f3a2278a2f3050ba42088dd2e64485 /vendor/github.com/nlopes | |
parent | f8a1ab4622a5b833282e9ee42f382451d17c1a06 (diff) | |
download | matterbridge-msglm-c81c0dd22a7779148c4890cfd4bbf490054f06f1.tar.gz matterbridge-msglm-c81c0dd22a7779148c4890cfd4bbf490054f06f1.tar.bz2 matterbridge-msglm-c81c0dd22a7779148c4890cfd4bbf490054f06f1.zip |
Update vendor, move to labstack/echo/v4 Fixes #698
Diffstat (limited to 'vendor/github.com/nlopes')
-rw-r--r-- | vendor/github.com/nlopes/slack/.gometalinter.json | 14 | ||||
-rw-r--r-- | vendor/github.com/nlopes/slack/.travis.yml | 22 | ||||
-rw-r--r-- | vendor/github.com/nlopes/slack/CHANGELOG.md | 5 | ||||
-rw-r--r-- | vendor/github.com/nlopes/slack/README.md | 12 | ||||
-rw-r--r-- | vendor/github.com/nlopes/slack/channels.go | 50 | ||||
-rw-r--r-- | vendor/github.com/nlopes/slack/chat.go | 26 | ||||
-rw-r--r-- | vendor/github.com/nlopes/slack/dialog.go | 13 | ||||
-rw-r--r-- | vendor/github.com/nlopes/slack/files.go | 22 | ||||
-rw-r--r-- | vendor/github.com/nlopes/slack/groups.go | 24 | ||||
-rw-r--r-- | vendor/github.com/nlopes/slack/interactions.go | 1 | ||||
-rw-r--r-- | vendor/github.com/nlopes/slack/reminders.go | 75 | ||||
-rw-r--r-- | vendor/github.com/nlopes/slack/security.go | 6 | ||||
-rw-r--r-- | vendor/github.com/nlopes/slack/slack.go | 3 | ||||
-rw-r--r-- | vendor/github.com/nlopes/slack/users.go | 14 | ||||
-rw-r--r-- | vendor/github.com/nlopes/slack/websocket.go | 4 |
15 files changed, 213 insertions, 78 deletions
diff --git a/vendor/github.com/nlopes/slack/.gometalinter.json b/vendor/github.com/nlopes/slack/.gometalinter.json new file mode 100644 index 00000000..5fa629d4 --- /dev/null +++ b/vendor/github.com/nlopes/slack/.gometalinter.json @@ -0,0 +1,14 @@ +{ + "DisableAll": true, + "Enable": [ + "structcheck", + "vet", + "misspell", + "unconvert", + "interfacer", + "goimports" + ], + "Vendor": true, + "Exclude": ["vendor"], + "Deadline": "300s" +} diff --git a/vendor/github.com/nlopes/slack/.travis.yml b/vendor/github.com/nlopes/slack/.travis.yml index b0615288..e4b9c754 100644 --- a/vendor/github.com/nlopes/slack/.travis.yml +++ b/vendor/github.com/nlopes/slack/.travis.yml @@ -1,23 +1,25 @@ language: go go: - - 1.7.x - - 1.8.x - - 1.9.x - - 1.10.x - - 1.11.x - - tip + - 1.7.x + - 1.8.x + - 1.9.x + - 1.10.x + - 1.11.x + - tip before_install: - export PATH=$HOME/gopath/bin:$PATH + # install gometalinter + - curl -L https://git.io/vp6lP | sh script: - - go test -race ./... - - go test -cover ./... + - PATH=$PWD/bin:$PATH gometalinter ./... + - go test -race -cover ./... matrix: - allow_failures: - - go: tip + allow_failures: + - go: tip git: depth: 10 diff --git a/vendor/github.com/nlopes/slack/CHANGELOG.md b/vendor/github.com/nlopes/slack/CHANGELOG.md index cf0fc2cc..63309f23 100644 --- a/vendor/github.com/nlopes/slack/CHANGELOG.md +++ b/vendor/github.com/nlopes/slack/CHANGELOG.md @@ -1,3 +1,8 @@ +### v0.5.0 - January 20, 2019
+full differences can be viewed using `git log --oneline --decorate --color v0.4.0..v0.5.0`
+- Breaking changes: various old struct fields have been removed or updated to match slack's api.
+- deadlock fix in RTM disconnect.
+
### v0.4.0 - October 06, 2018
full differences can be viewed using `git log --oneline --decorate --color v0.3.0..v0.4.0`
- Breaking Change: renamed ApplyMessageOption, to mark it as unsafe,
diff --git a/vendor/github.com/nlopes/slack/README.md b/vendor/github.com/nlopes/slack/README.md index 849e8bdc..b4148231 100644 --- a/vendor/github.com/nlopes/slack/README.md +++ b/vendor/github.com/nlopes/slack/README.md @@ -9,18 +9,10 @@ a fully managed way. -## Change log -Support for the EventsAPI has recently been added. It is still in its early stages but nearly all events have been added and tested (except for those events in [Developer Preview](https://api.slack.com/slack-apps-preview) mode). API stability for events is not promised at this time. -### v0.2.0 - Feb 10, 2018 +## Changelog -Release adds a bunch of functionality and improvements, mainly to give people a recent version to vendor against. - -Please check [0.2.0](https://github.com/nlopes/slack/releases/tag/v0.2.0) - -### CHANGELOG.md - - [CHANGELOG.md](https://github.com/nlopes/slack/blob/master/CHANGELOG.md) is available. Please visit it for updates. +[CHANGELOG.md](https://github.com/nlopes/slack/blob/master/CHANGELOG.md) is available. Please visit it for updates. ## Installing diff --git a/vendor/github.com/nlopes/slack/channels.go b/vendor/github.com/nlopes/slack/channels.go index 007985bc..711ae7c5 100644 --- a/vendor/github.com/nlopes/slack/channels.go +++ b/vendor/github.com/nlopes/slack/channels.go @@ -38,6 +38,29 @@ func channelRequest(ctx context.Context, client httpClient, path string, values return response, nil } +type channelsConfig struct { + values url.Values +} + +// GetChannelsOption option provided when getting channels. +type GetChannelsOption func(*channelsConfig) error + +// GetChannelsOptionExcludeMembers excludes the members collection from each channel. +func GetChannelsOptionExcludeMembers() GetChannelsOption { + return func(config *channelsConfig) error { + config.values.Add("exclude_members", "true") + return nil + } +} + +// GetChannelsOptionExcludeArchived excludes archived channels from results. +func GetChannelsOptionExcludeArchived() GetChannelsOption { + return func(config *channelsConfig) error { + config.values.Add("exclude_archived", "true") + return nil + } +} + // ArchiveChannel archives the given channel // see https://api.slack.com/methods/channels.archive func (api *Client) ArchiveChannel(channelID string) error { @@ -150,8 +173,9 @@ func (api *Client) GetChannelInfo(channelID string) (*Channel, error) { // see https://api.slack.com/methods/channels.info func (api *Client) GetChannelInfoContext(ctx context.Context, channelID string) (*Channel, error) { values := url.Values{ - "token": {api.token}, - "channel": {channelID}, + "token": {api.token}, + "channel": {channelID}, + "include_locale": {strconv.FormatBool(true)}, } response, err := channelRequest(ctx, api.httpclient, "channels.info", values, api) @@ -247,21 +271,29 @@ func (api *Client) KickUserFromChannelContext(ctx context.Context, channelID, us // GetChannels retrieves all the channels // see https://api.slack.com/methods/channels.list -func (api *Client) GetChannels(excludeArchived bool) ([]Channel, error) { - return api.GetChannelsContext(context.Background(), excludeArchived) +func (api *Client) GetChannels(excludeArchived bool, options ...GetChannelsOption) ([]Channel, error) { + return api.GetChannelsContext(context.Background(), excludeArchived, options...) } // GetChannelsContext retrieves all the channels with a custom context // see https://api.slack.com/methods/channels.list -func (api *Client) GetChannelsContext(ctx context.Context, excludeArchived bool) ([]Channel, error) { - values := url.Values{ - "token": {api.token}, +func (api *Client) GetChannelsContext(ctx context.Context, excludeArchived bool, options ...GetChannelsOption) ([]Channel, error) { + config := channelsConfig{ + values: url.Values{ + "token": {api.token}, + }, } if excludeArchived { - values.Add("exclude_archived", "1") + options = append(options, GetChannelsOptionExcludeArchived()) + } + + for _, opt := range options { + if err := opt(&config); err != nil { + return nil, err + } } - response, err := channelRequest(ctx, api.httpclient, "channels.list", values, api) + response, err := channelRequest(ctx, api.httpclient, "channels.list", config.values, api) if err != nil { return nil, err } diff --git a/vendor/github.com/nlopes/slack/chat.go b/vendor/github.com/nlopes/slack/chat.go index eb8fd6c8..c08c1808 100644 --- a/vendor/github.com/nlopes/slack/chat.go +++ b/vendor/github.com/nlopes/slack/chat.go @@ -43,19 +43,18 @@ func (c chatResponseFull) getMessageTimestamp() string { // PostMessageParameters contains all the parameters necessary (including the optional ones) for a PostMessage() request type PostMessageParameters struct { - Username string `json:"username"` - AsUser bool `json:"as_user"` - Parse string `json:"parse"` - ThreadTimestamp string `json:"thread_ts"` - ReplyBroadcast bool `json:"reply_broadcast"` - LinkNames int `json:"link_names"` - Attachments []Attachment `json:"attachments"` - UnfurlLinks bool `json:"unfurl_links"` - UnfurlMedia bool `json:"unfurl_media"` - IconURL string `json:"icon_url"` - IconEmoji string `json:"icon_emoji"` - Markdown bool `json:"mrkdwn,omitempty"` - EscapeText bool `json:"escape_text"` + Username string `json:"username"` + AsUser bool `json:"as_user"` + Parse string `json:"parse"` + ThreadTimestamp string `json:"thread_ts"` + ReplyBroadcast bool `json:"reply_broadcast"` + LinkNames int `json:"link_names"` + UnfurlLinks bool `json:"unfurl_links"` + UnfurlMedia bool `json:"unfurl_media"` + IconURL string `json:"icon_url"` + IconEmoji string `json:"icon_emoji"` + Markdown bool `json:"mrkdwn,omitempty"` + EscapeText bool `json:"escape_text"` // chat.postEphemeral support Channel string `json:"channel"` @@ -71,7 +70,6 @@ func NewPostMessageParameters() PostMessageParameters { Parse: DEFAULT_MESSAGE_PARSE, ThreadTimestamp: DEFAULT_MESSAGE_THREAD_TIMESTAMP, LinkNames: DEFAULT_MESSAGE_LINK_NAMES, - Attachments: nil, UnfurlLinks: DEFAULT_MESSAGE_UNFURL_LINKS, UnfurlMedia: DEFAULT_MESSAGE_UNFURL_MEDIA, IconURL: DEFAULT_MESSAGE_ICON_URL, diff --git a/vendor/github.com/nlopes/slack/dialog.go b/vendor/github.com/nlopes/slack/dialog.go index 2e45a06c..7b9e3814 100644 --- a/vendor/github.com/nlopes/slack/dialog.go +++ b/vendor/github.com/nlopes/slack/dialog.go @@ -14,7 +14,7 @@ const ( InputTypeText InputType = "text" // InputTypeTextArea textarea input InputTypeTextArea InputType = "textarea" - // InputTypeSelect textfield input + // InputTypeSelect select menus input InputTypeSelect InputType = "select" ) @@ -68,6 +68,17 @@ type DialogResponseMetadata struct { Messages []string `json:"messages"` } +// DialogInputValidationError is an error when user inputs incorrect value to form from within a dialog +type DialogInputValidationError struct { + Name string `json:"name"` + Error string `json:"error"` +} + +// DialogInputValidationErrors lists the name of field and that error messages +type DialogInputValidationErrors struct { + Errors []DialogInputValidationError `json:"errors"` +} + // OpenDialog opens a dialog window where the triggerID originated from. // EXPERIMENTAL: dialog functionality is currently experimental, api is not considered stable. func (api *Client) OpenDialog(triggerID string, dialog Dialog) (err error) { diff --git a/vendor/github.com/nlopes/slack/files.go b/vendor/github.com/nlopes/slack/files.go index 13158582..136ea266 100644 --- a/vendor/github.com/nlopes/slack/files.go +++ b/vendor/github.com/nlopes/slack/files.go @@ -3,6 +3,7 @@ package slack import ( "context" "errors" + "fmt" "io" "net/url" "strconv" @@ -86,12 +87,30 @@ type File struct { CommentsCount int `json:"comments_count"` NumStars int `json:"num_stars"` IsStarred bool `json:"is_starred"` + Shares Share `json:"shares"` +} + +type Share struct { + Public map[string][]ShareFileInfo `json:"public"` +} + +type ShareFileInfo struct { + ReplyUsers []string `json:"reply_users"` + ReplyUsersCount int `json:"reply_users_count"` + ReplyCount int `json:"reply_count"` + Ts string `json:"ts"` + ThreadTs string `json:"thread_ts"` + LatestReply string `json:"latest_reply"` + ChannelName string `json:"channel_name"` + TeamID string `json:"team_id"` } // FileUploadParameters contains all the parameters necessary (including the optional ones) for an UploadFile() request. // // There are three ways to upload a file. You can either set Content if file is small, set Reader if file is large, // or provide a local file path in File to upload it from your filesystem. +// +// Note that when using the Reader option, you *must* specify the Filename, otherwise the Slack API isn't happy. type FileUploadParameters struct { File string Content string @@ -220,6 +239,9 @@ func (api *Client) UploadFileContext(ctx context.Context, params FileUploadParam if err != nil { return nil, err } + if params.Filename == "" { + return nil, fmt.Errorf("files.upload: FileUploadParameters.Filename is mandatory") + } response := &fileResponseFull{} values := url.Values{ "token": {api.token}, diff --git a/vendor/github.com/nlopes/slack/groups.go b/vendor/github.com/nlopes/slack/groups.go index a248f6fd..560faee9 100644 --- a/vendor/github.com/nlopes/slack/groups.go +++ b/vendor/github.com/nlopes/slack/groups.go @@ -113,25 +113,6 @@ func (api *Client) CreateChildGroupContext(ctx context.Context, group string) (* return &response.Group, nil } -// CloseGroup closes a private group -func (api *Client) CloseGroup(group string) (bool, bool, error) { - return api.CloseGroupContext(context.Background(), group) -} - -// CloseGroupContext closes a private group with a custom context -func (api *Client) CloseGroupContext(ctx context.Context, group string) (bool, bool, error) { - values := url.Values{ - "token": {api.token}, - "channel": {group}, - } - - response, err := imRequest(ctx, api.httpclient, "groups.close", values, api) - if err != nil { - return false, false, err - } - return response.NoOp, response.AlreadyClosed, nil -} - // GetGroupHistory fetches all the history for a private group func (api *Client) GetGroupHistory(group string, params HistoryParameters) (*History, error) { return api.GetGroupHistoryContext(context.Background(), group, params) @@ -256,8 +237,9 @@ func (api *Client) GetGroupInfo(group string) (*Group, error) { // GetGroupInfoContext retrieves the given group with a custom context func (api *Client) GetGroupInfoContext(ctx context.Context, group string) (*Group, error) { values := url.Values{ - "token": {api.token}, - "channel": {group}, + "token": {api.token}, + "channel": {group}, + "include_locale": {strconv.FormatBool(true)}, } response, err := groupRequest(ctx, api.httpclient, "groups.info", values, api) diff --git a/vendor/github.com/nlopes/slack/interactions.go b/vendor/github.com/nlopes/slack/interactions.go index 97e31a49..addc2864 100644 --- a/vendor/github.com/nlopes/slack/interactions.go +++ b/vendor/github.com/nlopes/slack/interactions.go @@ -5,6 +5,7 @@ type InteractionType string // Types of interactions that can be received. const ( + InteractionTypeDialogCancellation = InteractionType("dialog_cancellation") InteractionTypeDialogSubmission = InteractionType("dialog_submission") InteractionTypeDialogSuggestion = InteractionType("dialog_suggestion") InteractionTypeInteractionMessage = InteractionType("interactive_message") diff --git a/vendor/github.com/nlopes/slack/reminders.go b/vendor/github.com/nlopes/slack/reminders.go new file mode 100644 index 00000000..54c91789 --- /dev/null +++ b/vendor/github.com/nlopes/slack/reminders.go @@ -0,0 +1,75 @@ +package slack + +import ( + "context" + "net/url" + "time" +) + +type Reminder struct { + ID string `json:"id"` + Creator string `json:"creator"` + User string `json:"user"` + Text string `json:"text"` + Recurring bool `json:"recurring"` + Time time.Time `json:"time"` + CompleteTS int `json:"complete_ts"` +} + +type reminderResp struct { + SlackResponse + Reminder Reminder `json:"reminder"` +} + +func (api *Client) doReminder(ctx context.Context, path string, values url.Values) (*Reminder, error) { + response := &reminderResp{} + if err := postSlackMethod(ctx, api.httpclient, path, values, response, api); err != nil { + return nil, err + } + return &response.Reminder, response.Err() +} + +// AddChannelReminder adds a reminder for a channel. +// +// See https://api.slack.com/methods/reminders.add (NOTE: the ability to set +// reminders on a channel is currently undocumented but has been tested to +// work) +func (api *Client) AddChannelReminder(channelID, text, time string) (*Reminder, error) { + values := url.Values{ + "token": {api.token}, + "text": {text}, + "time": {time}, + "channel": {channelID}, + } + return api.doReminder(context.Background(), "reminders.add", values) +} + +// AddUserReminder adds a reminder for a user. +// +// See https://api.slack.com/methods/reminders.add (NOTE: the ability to set +// reminders on a channel is currently undocumented but has been tested to +// work) +func (api *Client) AddUserReminder(userID, text, time string) (*Reminder, error) { + values := url.Values{ + "token": {api.token}, + "text": {text}, + "time": {time}, + "user": {userID}, + } + return api.doReminder(context.Background(), "reminders.add", values) +} + +// DeleteReminder deletes an existing reminder. +// +// See https://api.slack.com/methods/reminders.delete +func (api *Client) DeleteReminder(id string) error { + values := url.Values{ + "token": {api.token}, + "reminder": {id}, + } + response := &SlackResponse{} + if err := postSlackMethod(context.Background(), api.httpclient, "reminders.delete", values, response, api); err != nil { + return err + } + return response.Err() +} diff --git a/vendor/github.com/nlopes/slack/security.go b/vendor/github.com/nlopes/slack/security.go index 6ab3c698..35727027 100644 --- a/vendor/github.com/nlopes/slack/security.go +++ b/vendor/github.com/nlopes/slack/security.go @@ -42,7 +42,9 @@ func unsafeSignatureVerifier(header http.Header, secret string) (_ SecretsVerifi } hash := hmac.New(sha256.New, []byte(secret)) - hash.Write([]byte(fmt.Sprintf("v0:%s:", stimestamp))) + if _, err = hash.Write([]byte(fmt.Sprintf("v0:%s:", stimestamp))); err != nil { + return SecretsVerifier{}, err + } return SecretsVerifier{ signature: bsignature, @@ -66,7 +68,7 @@ func NewSecretsVerifier(header http.Header, secret string) (sv SecretsVerifier, return SecretsVerifier{}, err } - diff := absDuration(time.Now().Sub(time.Unix(timestamp, 0))) + diff := absDuration(time.Since(time.Unix(timestamp, 0))) if diff > 5*time.Minute { return SecretsVerifier{}, fmt.Errorf("timestamp is too old") } diff --git a/vendor/github.com/nlopes/slack/slack.go b/vendor/github.com/nlopes/slack/slack.go index 1e75142d..c1ba0fc3 100644 --- a/vendor/github.com/nlopes/slack/slack.go +++ b/vendor/github.com/nlopes/slack/slack.go @@ -9,7 +9,7 @@ import ( "os" ) -// APIURL a dded as a var so that we can change this for testing purposes +// APIURL added as a var so that we can change this for testing purposes var APIURL = "https://slack.com/api/" // WEBAPIURLFormat ... @@ -50,7 +50,6 @@ type authTestResponseFull struct { // Client for the slack api. type Client struct { token string - info Info debug bool log ilogger httpclient httpClient diff --git a/vendor/github.com/nlopes/slack/users.go b/vendor/github.com/nlopes/slack/users.go index aa941a74..74b79372 100644 --- a/vendor/github.com/nlopes/slack/users.go +++ b/vendor/github.com/nlopes/slack/users.go @@ -226,8 +226,9 @@ func (api *Client) GetUserInfo(user string) (*User, error) { // GetUserInfoContext will retrieve the complete user information with a custom context func (api *Client) GetUserInfoContext(ctx context.Context, user string) (*User, error) { values := url.Values{ - "token": {api.token}, - "user": {user}, + "token": {api.token}, + "user": {user}, + "include_locale": {strconv.FormatBool(true)}, } response, err := userRequest(ctx, api.httpclient, "users.info", values, api) @@ -302,10 +303,11 @@ func (t UserPagination) Next(ctx context.Context) (_ UserPagination, err error) t.previousResp = t.previousResp.initialize() values := url.Values{ - "limit": {strconv.Itoa(t.limit)}, - "presence": {strconv.FormatBool(t.presence)}, - "token": {t.c.token}, - "cursor": {t.previousResp.Cursor}, + "limit": {strconv.Itoa(t.limit)}, + "presence": {strconv.FormatBool(t.presence)}, + "token": {t.c.token}, + "cursor": {t.previousResp.Cursor}, + "include_locale": {strconv.FormatBool(true)}, } if resp, err = userRequest(ctx, t.c.httpclient, "users.list", values, t.c); err != nil { diff --git a/vendor/github.com/nlopes/slack/websocket.go b/vendor/github.com/nlopes/slack/websocket.go index ec810a9b..e5dee68a 100644 --- a/vendor/github.com/nlopes/slack/websocket.go +++ b/vendor/github.com/nlopes/slack/websocket.go @@ -39,8 +39,6 @@ type RTM struct { wasIntentional bool isConnected bool - websocketURL string - // UserDetails upon connection info *Info @@ -103,7 +101,7 @@ func (rtm *RTM) SendMessage(msg *OutgoingMessage) { } func (rtm *RTM) resetDeadman() { - timerReset(rtm.pingDeadman, deadmanDuration(rtm.pingInterval)) + rtm.pingDeadman.Reset(deadmanDuration(rtm.pingInterval)) } func deadmanDuration(d time.Duration) time.Duration { |