mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-06-28 17:19:24 +00:00
Update vendor, move to labstack/echo/v4 Fixes #698
This commit is contained in:
14
vendor/github.com/nlopes/slack/.gometalinter.json
generated
vendored
Normal file
14
vendor/github.com/nlopes/slack/.gometalinter.json
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"DisableAll": true,
|
||||
"Enable": [
|
||||
"structcheck",
|
||||
"vet",
|
||||
"misspell",
|
||||
"unconvert",
|
||||
"interfacer",
|
||||
"goimports"
|
||||
],
|
||||
"Vendor": true,
|
||||
"Exclude": ["vendor"],
|
||||
"Deadline": "300s"
|
||||
}
|
22
vendor/github.com/nlopes/slack/.travis.yml
generated
vendored
22
vendor/github.com/nlopes/slack/.travis.yml
generated
vendored
@ -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
|
||||
|
5
vendor/github.com/nlopes/slack/CHANGELOG.md
generated
vendored
5
vendor/github.com/nlopes/slack/CHANGELOG.md
generated
vendored
@ -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,
|
||||
|
12
vendor/github.com/nlopes/slack/README.md
generated
vendored
12
vendor/github.com/nlopes/slack/README.md
generated
vendored
@ -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
|
||||
|
||||
|
50
vendor/github.com/nlopes/slack/channels.go
generated
vendored
50
vendor/github.com/nlopes/slack/channels.go
generated
vendored
@ -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())
|
||||
}
|
||||
|
||||
response, err := channelRequest(ctx, api.httpclient, "channels.list", values, api)
|
||||
for _, opt := range options {
|
||||
if err := opt(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
response, err := channelRequest(ctx, api.httpclient, "channels.list", config.values, api)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
26
vendor/github.com/nlopes/slack/chat.go
generated
vendored
26
vendor/github.com/nlopes/slack/chat.go
generated
vendored
@ -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,
|
||||
|
13
vendor/github.com/nlopes/slack/dialog.go
generated
vendored
13
vendor/github.com/nlopes/slack/dialog.go
generated
vendored
@ -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) {
|
||||
|
22
vendor/github.com/nlopes/slack/files.go
generated
vendored
22
vendor/github.com/nlopes/slack/files.go
generated
vendored
@ -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},
|
||||
|
24
vendor/github.com/nlopes/slack/groups.go
generated
vendored
24
vendor/github.com/nlopes/slack/groups.go
generated
vendored
@ -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)
|
||||
|
1
vendor/github.com/nlopes/slack/interactions.go
generated
vendored
1
vendor/github.com/nlopes/slack/interactions.go
generated
vendored
@ -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")
|
||||
|
75
vendor/github.com/nlopes/slack/reminders.go
generated
vendored
Normal file
75
vendor/github.com/nlopes/slack/reminders.go
generated
vendored
Normal file
@ -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()
|
||||
}
|
6
vendor/github.com/nlopes/slack/security.go
generated
vendored
6
vendor/github.com/nlopes/slack/security.go
generated
vendored
@ -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")
|
||||
}
|
||||
|
3
vendor/github.com/nlopes/slack/slack.go
generated
vendored
3
vendor/github.com/nlopes/slack/slack.go
generated
vendored
@ -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
|
||||
|
14
vendor/github.com/nlopes/slack/users.go
generated
vendored
14
vendor/github.com/nlopes/slack/users.go
generated
vendored
@ -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 {
|
||||
|
4
vendor/github.com/nlopes/slack/websocket.go
generated
vendored
4
vendor/github.com/nlopes/slack/websocket.go
generated
vendored
@ -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 {
|
||||
|
Reference in New Issue
Block a user