summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/slack-go
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-05-24 00:06:21 +0200
committerGitHub <noreply@github.com>2020-05-24 00:06:21 +0200
commit393f9e998b1b40aa59d3fb8794c3a73da38c3fb7 (patch)
tree2bc9b6e6abdbdc6d811b155997597bdae62bc7db /vendor/github.com/slack-go
parentba0bfe70a8f07164e1341f4b094841acdad5c3a2 (diff)
downloadmatterbridge-msglm-393f9e998b1b40aa59d3fb8794c3a73da38c3fb7.tar.gz
matterbridge-msglm-393f9e998b1b40aa59d3fb8794c3a73da38c3fb7.tar.bz2
matterbridge-msglm-393f9e998b1b40aa59d3fb8794c3a73da38c3fb7.zip
Update dependencies / vendor (#1146)
Diffstat (limited to 'vendor/github.com/slack-go')
-rw-r--r--vendor/github.com/slack-go/slack/block_conv.go2
-rw-r--r--vendor/github.com/slack-go/slack/block_element.go27
-rw-r--r--vendor/github.com/slack-go/slack/chat.go74
-rw-r--r--vendor/github.com/slack-go/slack/go.mod1
-rw-r--r--vendor/github.com/slack-go/slack/go.sum2
-rw-r--r--vendor/github.com/slack-go/slack/groups.go21
-rw-r--r--vendor/github.com/slack-go/slack/history.go1
-rw-r--r--vendor/github.com/slack-go/slack/interactions.go1
-rw-r--r--vendor/github.com/slack-go/slack/messages.go2
-rw-r--r--vendor/github.com/slack-go/slack/oauth.go1
-rw-r--r--vendor/github.com/slack-go/slack/users.go22
-rw-r--r--vendor/github.com/slack-go/slack/websocket_managed_conn.go9
12 files changed, 131 insertions, 32 deletions
diff --git a/vendor/github.com/slack-go/slack/block_conv.go b/vendor/github.com/slack-go/slack/block_conv.go
index 43c0c96b..00d59c3b 100644
--- a/vendor/github.com/slack-go/slack/block_conv.go
+++ b/vendor/github.com/slack-go/slack/block_conv.go
@@ -108,6 +108,8 @@ func (b *InputBlock) UnmarshalJSON(data []byte) error {
e = &PlainTextInputBlockElement{}
case "static_select", "external_select", "users_select", "conversations_select", "channels_select":
e = &SelectBlockElement{}
+ case "multi_static_select", "multi_external_select", "multi_users_select", "multi_conversations_select", "multi_channels_select":
+ e = &MultiSelectBlockElement{}
default:
return errors.New("unsupported block element type")
}
diff --git a/vendor/github.com/slack-go/slack/block_element.go b/vendor/github.com/slack-go/slack/block_element.go
index 8460e957..50971bfa 100644
--- a/vendor/github.com/slack-go/slack/block_element.go
+++ b/vendor/github.com/slack-go/slack/block_element.go
@@ -3,6 +3,7 @@ package slack
// https://api.slack.com/reference/messaging/block-elements
const (
+ METCheckboxGroups MessageElementType = "checkboxes"
METImage MessageElementType = "image"
METButton MessageElementType = "button"
METOverflow MessageElementType = "overflow"
@@ -363,6 +364,32 @@ func NewPlainTextInputBlockElement(placeholder *TextBlockObject, actionID string
}
}
+// CheckboxGroupsBlockElement defines an element which allows users to choose
+// one or more items from a list of possible options.
+//
+// More Information: https://api.slack.com/reference/block-kit/block-elements#checkboxes
+type CheckboxGroupsBlockElement struct {
+ Type MessageElementType `json:"type"`
+ ActionID string `json:"action_id"`
+ Options []*OptionBlockObject `json:"options"`
+ InitialOptions []*OptionBlockObject `json:"initial_options,omitempty"`
+ Confirm *ConfirmationBlockObject `json:"confirm,omitempty"`
+}
+
+// ElementType returns the type of the Element
+func (c CheckboxGroupsBlockElement) ElementType() MessageElementType {
+ return c.Type
+}
+
+// NewRadioButtonsBlockElement returns an instance of a radio block element
+func NewCheckboxGroupsBlockElement(actionID string, options ...*OptionBlockObject) *CheckboxGroupsBlockElement {
+ return &CheckboxGroupsBlockElement{
+ Type: METCheckboxGroups,
+ ActionID: actionID,
+ Options: options,
+ }
+}
+
// RadioButtonsBlockElement defines an element which lets users choose one item
// from a list of possible options.
//
diff --git a/vendor/github.com/slack-go/slack/chat.go b/vendor/github.com/slack-go/slack/chat.go
index 1281b15a..c5b524c1 100644
--- a/vendor/github.com/slack-go/slack/chat.go
+++ b/vendor/github.com/slack-go/slack/chat.go
@@ -261,14 +261,16 @@ const (
)
type sendConfig struct {
- apiurl string
- options []MsgOption
- mode sendMode
- endpoint string
- values url.Values
- attachments []Attachment
- blocks Blocks
- responseType string
+ apiurl string
+ options []MsgOption
+ mode sendMode
+ endpoint string
+ values url.Values
+ attachments []Attachment
+ blocks Blocks
+ responseType string
+ replaceOriginal bool
+ deleteOriginal bool
}
func (t sendConfig) BuildRequest(token, channelID string) (req *http.Request, _ func(*chatResponseFull) responseParser, err error) {
@@ -279,11 +281,13 @@ func (t sendConfig) BuildRequest(token, channelID string) (req *http.Request, _
switch t.mode {
case chatResponse:
return responseURLSender{
- endpoint: t.endpoint,
- values: t.values,
- attachments: t.attachments,
- blocks: t.blocks,
- responseType: t.responseType,
+ endpoint: t.endpoint,
+ values: t.values,
+ attachments: t.attachments,
+ blocks: t.blocks,
+ responseType: t.responseType,
+ replaceOriginal: t.replaceOriginal,
+ deleteOriginal: t.deleteOriginal,
}.BuildRequest()
default:
return formSender{endpoint: t.endpoint, values: t.values}.BuildRequest()
@@ -303,20 +307,24 @@ func (t formSender) BuildRequest() (*http.Request, func(*chatResponseFull) respo
}
type responseURLSender struct {
- endpoint string
- values url.Values
- attachments []Attachment
- blocks Blocks
- responseType string
+ endpoint string
+ values url.Values
+ attachments []Attachment
+ blocks Blocks
+ responseType string
+ replaceOriginal bool
+ deleteOriginal bool
}
func (t responseURLSender) BuildRequest() (*http.Request, func(*chatResponseFull) responseParser, error) {
req, err := jsonReq(t.endpoint, Msg{
- Text: t.values.Get("text"),
- Timestamp: t.values.Get("ts"),
- Attachments: t.attachments,
- Blocks: t.blocks,
- ResponseType: t.responseType,
+ Text: t.values.Get("text"),
+ Timestamp: t.values.Get("ts"),
+ Attachments: t.attachments,
+ Blocks: t.blocks,
+ ResponseType: t.responseType,
+ ReplaceOriginal: t.replaceOriginal,
+ DeleteOriginal: t.deleteOriginal,
})
return req, func(resp *chatResponseFull) responseParser {
return newContentTypeParser(resp)
@@ -405,6 +413,26 @@ func MsgOptionResponseURL(url string, responseType string) MsgOption {
}
}
+// MsgOptionReplaceOriginal replaces original message with response url
+func MsgOptionReplaceOriginal(responseURL string) MsgOption {
+ return func(config *sendConfig) error {
+ config.mode = chatResponse
+ config.endpoint = responseURL
+ config.replaceOriginal = true
+ return nil
+ }
+}
+
+// MsgOptionDeleteOriginal deletes original message with response url
+func MsgOptionDeleteOriginal(responseURL string) MsgOption {
+ return func(config *sendConfig) error {
+ config.mode = chatResponse
+ config.endpoint = responseURL
+ config.deleteOriginal = true
+ return nil
+ }
+}
+
// MsgOptionAsUser whether or not to send the message as the user.
func MsgOptionAsUser(b bool) MsgOption {
return func(config *sendConfig) error {
diff --git a/vendor/github.com/slack-go/slack/go.mod b/vendor/github.com/slack-go/slack/go.mod
index b57c9b35..2107e612 100644
--- a/vendor/github.com/slack-go/slack/go.mod
+++ b/vendor/github.com/slack-go/slack/go.mod
@@ -3,7 +3,6 @@ module github.com/slack-go/slack
require (
github.com/go-test/deep v1.0.4
github.com/gorilla/websocket v1.2.0
- github.com/nlopes/slack v0.6.0
github.com/pkg/errors v0.8.0
github.com/stretchr/testify v1.2.2
)
diff --git a/vendor/github.com/slack-go/slack/go.sum b/vendor/github.com/slack-go/slack/go.sum
index 196525e7..7a0ae46e 100644
--- a/vendor/github.com/slack-go/slack/go.sum
+++ b/vendor/github.com/slack-go/slack/go.sum
@@ -4,8 +4,6 @@ github.com/go-test/deep v1.0.4 h1:u2CU3YKy9I2pmu9pX0eq50wCgjfGIt539SqR7FbHiho=
github.com/go-test/deep v1.0.4/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
github.com/gorilla/websocket v1.2.0 h1:VJtLvh6VQym50czpZzx07z/kw9EgAxI3x1ZB8taTMQQ=
github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
-github.com/nlopes/slack v0.6.0 h1:jt0jxVQGhssx1Ib7naAOZEZcGdtIhTzkP0nopK0AsRA=
-github.com/nlopes/slack v0.6.0/go.mod h1:JzQ9m3PMAqcpeCam7UaHSuBuupz7CmpjehYMayT6YOk=
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
diff --git a/vendor/github.com/slack-go/slack/groups.go b/vendor/github.com/slack-go/slack/groups.go
index 23374869..6ea1b134 100644
--- a/vendor/github.com/slack-go/slack/groups.go
+++ b/vendor/github.com/slack-go/slack/groups.go
@@ -353,3 +353,24 @@ func (api *Client) SetGroupTopicContext(ctx context.Context, group, topic string
}
return response.Topic, nil
}
+
+// GetGroupReplies gets an entire thread (a message plus all the messages in reply to it).
+// see https://api.slack.com/methods/groups.replies
+func (api *Client) GetGroupReplies(channelID, thread_ts string) ([]Message, error) {
+ return api.GetGroupRepliesContext(context.Background(), channelID, thread_ts)
+}
+
+// GetGroupRepliesContext gets an entire thread (a message plus all the messages in reply to it) with a custom context
+// see https://api.slack.com/methods/groups.replies
+func (api *Client) GetGroupRepliesContext(ctx context.Context, channelID, thread_ts string) ([]Message, error) {
+ values := url.Values{
+ "token": {api.token},
+ "channel": {channelID},
+ "thread_ts": {thread_ts},
+ }
+ response, err := api.groupRequest(ctx, "groups.replies", values)
+ if err != nil {
+ return nil, err
+ }
+ return response.History.Messages, nil
+}
diff --git a/vendor/github.com/slack-go/slack/history.go b/vendor/github.com/slack-go/slack/history.go
index 87b2e1ed..49dfe354 100644
--- a/vendor/github.com/slack-go/slack/history.go
+++ b/vendor/github.com/slack-go/slack/history.go
@@ -22,6 +22,7 @@ type History struct {
Latest string `json:"latest"`
Messages []Message `json:"messages"`
HasMore bool `json:"has_more"`
+ Unread int `json:"unread_count_display"`
}
// NewHistoryParameters provides an instance of HistoryParameters with all the sane default values set
diff --git a/vendor/github.com/slack-go/slack/interactions.go b/vendor/github.com/slack-go/slack/interactions.go
index c56a34fe..ec662ee3 100644
--- a/vendor/github.com/slack-go/slack/interactions.go
+++ b/vendor/github.com/slack-go/slack/interactions.go
@@ -27,6 +27,7 @@ const (
InteractionTypeBlockSuggestion = InteractionType("block_suggestion")
InteractionTypeViewSubmission = InteractionType("view_submission")
InteractionTypeViewClosed = InteractionType("view_closed")
+ InteractionTypeShortcut = InteractionType("shortcut")
)
// InteractionCallback is sent from slack when a user interactions with a button or dialog.
diff --git a/vendor/github.com/slack-go/slack/messages.go b/vendor/github.com/slack-go/slack/messages.go
index f2f5b145..09db5463 100644
--- a/vendor/github.com/slack-go/slack/messages.go
+++ b/vendor/github.com/slack-go/slack/messages.go
@@ -22,7 +22,7 @@ type Message struct {
// Msg contains information about a slack message
type Msg struct {
// Basic Message
- ClientMsgID string `json:"client_msg_id"`
+ ClientMsgID string `json:"client_msg_id,omitempty"`
Type string `json:"type,omitempty"`
Channel string `json:"channel,omitempty"`
User string `json:"user,omitempty"`
diff --git a/vendor/github.com/slack-go/slack/oauth.go b/vendor/github.com/slack-go/slack/oauth.go
index 64118fb0..43139768 100644
--- a/vendor/github.com/slack-go/slack/oauth.go
+++ b/vendor/github.com/slack-go/slack/oauth.go
@@ -38,7 +38,6 @@ type OAuthV2Response struct {
Scope string `json:"scope"`
BotUserID string `json:"bot_user_id"`
AppID string `json:"app_id"`
- TeamID string `json:"team_id"`
Team OAuthV2ResponseTeam `json:"team"`
Enterprise OAuthV2ResponseEnterprise `json:"enterprise"`
AuthedUser OAuthV2ResponseAuthedUser `json:"authed_user"`
diff --git a/vendor/github.com/slack-go/slack/users.go b/vendor/github.com/slack-go/slack/users.go
index 6001e0fa..364958e8 100644
--- a/vendor/github.com/slack-go/slack/users.go
+++ b/vendor/github.com/slack-go/slack/users.go
@@ -5,6 +5,7 @@ import (
"encoding/json"
"net/url"
"strconv"
+ "strings"
"time"
)
@@ -184,6 +185,7 @@ type TeamIdentity struct {
type userResponseFull struct {
Members []User `json:"members,omitempty"`
User `json:"user,omitempty"`
+ Users []User `json:"users,omitempty"`
UserPresence
SlackResponse
Metadata ResponseMetadata `json:"response_metadata"`
@@ -252,6 +254,26 @@ func (api *Client) GetUserInfoContext(ctx context.Context, user string) (*User,
return &response.User, nil
}
+// GetUsersInfo will retrieve the complete multi-users information
+func (api *Client) GetUsersInfo(users ...string) (*[]User, error) {
+ return api.GetUsersInfoContext(context.Background(), users...)
+}
+
+// GetUsersInfoContext will retrieve the complete multi-users information with a custom context
+func (api *Client) GetUsersInfoContext(ctx context.Context, users ...string) (*[]User, error) {
+ values := url.Values{
+ "token": {api.token},
+ "users": {strings.Join(users, ",")},
+ "include_locale": {strconv.FormatBool(true)},
+ }
+
+ response, err := api.userRequest(ctx, "users.info", values)
+ if err != nil {
+ return nil, err
+ }
+ return &response.Users, nil
+}
+
// GetUsersOption options for the GetUsers method call.
type GetUsersOption func(*UserPagination)
diff --git a/vendor/github.com/slack-go/slack/websocket_managed_conn.go b/vendor/github.com/slack-go/slack/websocket_managed_conn.go
index a8844f82..8607b3a3 100644
--- a/vendor/github.com/slack-go/slack/websocket_managed_conn.go
+++ b/vendor/github.com/slack-go/slack/websocket_managed_conn.go
@@ -572,10 +572,11 @@ var EventMapping = map[string]interface{}{
"member_joined_channel": MemberJoinedChannelEvent{},
"member_left_channel": MemberLeftChannelEvent{},
- "subteam_created": SubteamCreatedEvent{},
- "subteam_self_added": SubteamSelfAddedEvent{},
- "subteam_self_removed": SubteamSelfRemovedEvent{},
- "subteam_updated": SubteamUpdatedEvent{},
+ "subteam_created": SubteamCreatedEvent{},
+ "subteam_members_changed": SubteamMembersChangedEvent{},
+ "subteam_self_added": SubteamSelfAddedEvent{},
+ "subteam_self_removed": SubteamSelfRemovedEvent{},
+ "subteam_updated": SubteamUpdatedEvent{},
"desktop_notification": DesktopNotificationEvent{},
"mobile_in_app_notification": MobileInAppNotificationEvent{},