summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/slack-go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/slack-go')
-rw-r--r--vendor/github.com/slack-go/slack/CHANGELOG.md44
-rw-r--r--vendor/github.com/slack-go/slack/README.md11
-rw-r--r--vendor/github.com/slack-go/slack/block_element.go12
-rw-r--r--vendor/github.com/slack-go/slack/block_object.go16
-rw-r--r--vendor/github.com/slack-go/slack/chat.go24
-rw-r--r--vendor/github.com/slack-go/slack/conversation.go7
-rw-r--r--vendor/github.com/slack-go/slack/go.sum2
-rw-r--r--vendor/github.com/slack-go/slack/logo.pngbin0 -> 52440 bytes
-rw-r--r--vendor/github.com/slack-go/slack/messages.go27
-rw-r--r--vendor/github.com/slack-go/slack/misc.go5
-rw-r--r--vendor/github.com/slack-go/slack/slack.go5
-rw-r--r--vendor/github.com/slack-go/slack/users.go35
12 files changed, 153 insertions, 35 deletions
diff --git a/vendor/github.com/slack-go/slack/CHANGELOG.md b/vendor/github.com/slack-go/slack/CHANGELOG.md
index 48bcce55..32da687b 100644
--- a/vendor/github.com/slack-go/slack/CHANGELOG.md
+++ b/vendor/github.com/slack-go/slack/CHANGELOG.md
@@ -1,3 +1,47 @@
+### v0.7.0 - October 2, 2020
+full differences can be viewed using `git log --oneline --decorate --color v0.6.6..v0.7.0`
+Thank you for many contributions!
+
+#### Breaking Changes
+- Add ScheduledMessage type ([#753])
+- Add description field to option block object ([#783])
+- Fix wrong conditional branch ([#782])
+ - The behavior of the user's application may change.(The current behavior is incorrect)
+
+#### Highlights
+- example: fix to start up a server ([#773])
+- example: Add explanation how the message could be sent in a proper way ([#787])
+- example: fix typo in error log ([#779])
+- refactor: Make GetConversationsParameters.ExcludeArchived optional ([#791])
+- refactor: Unify variables to "config" ([#800])
+- refactor: Rename wrong file name ([#810])
+- feature: Add SetUserRealName for change user's realName([#755])
+- feature: Add response metadata to slack response ([#772])
+- feature: Add response metadata to slack response ([#778])
+- feature: Add select block element conversations filter field ([#790])
+- feature: Add Root field to MessageEvent to support thread_broadcast subtype ([#793])
+- feature: Add bot_profile to messages ([#794])
+- doc: Add logo to README ([#813])
+- doc: Update current project status and Add changelog for v0.7.0 ([#814])
+
+[#753]: https://github.com/slack-go/slack/pull/753
+[#755]: https://github.com/slack-go/slack/pull/755
+[#772]: https://github.com/slack-go/slack/pull/772
+[#773]: https://github.com/slack-go/slack/pull/773
+[#778]: https://github.com/slack-go/slack/pull/778
+[#779]: https://github.com/slack-go/slack/pull/779
+[#782]: https://github.com/slack-go/slack/pull/782
+[#783]: https://github.com/slack-go/slack/pull/783
+[#787]: https://github.com/slack-go/slack/pull/787
+[#790]: https://github.com/slack-go/slack/pull/790
+[#791]: https://github.com/slack-go/slack/pull/791
+[#793]: https://github.com/slack-go/slack/pull/793
+[#794]: https://github.com/slack-go/slack/pull/794
+[#800]: https://github.com/slack-go/slack/pull/800
+[#810]: https://github.com/slack-go/slack/pull/810
+[#813]: https://github.com/slack-go/slack/pull/813
+[#814]: https://github.com/slack-go/slack/pull/814
+
### v0.6.0 - August 31, 2019
full differences can be viewed using `git log --oneline --decorate --color v0.5.0..v0.6.0`
thanks to everyone who has contributed since January!
diff --git a/vendor/github.com/slack-go/slack/README.md b/vendor/github.com/slack-go/slack/README.md
index eaf07782..cebbf48b 100644
--- a/vendor/github.com/slack-go/slack/README.md
+++ b/vendor/github.com/slack-go/slack/README.md
@@ -4,16 +4,17 @@ This is the original Slack library for Go created by Norberto Lopez, transferred
[![Join the chat at https://gitter.im/go-slack/Lobby](https://badges.gitter.im/go-slack/Lobby.svg)](https://gitter.im/go-slack/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+![logo](logo.png "icon")
+
This library supports most if not all of the `api.slack.com` REST
calls, as well as the Real-Time Messaging protocol over websocket, in
a fully managed way.
+## Project Status
+There is currently no major version released.
+Therefore, minor version releases may include backward incompatible changes.
-
-
-## Changelog
-
-[CHANGELOG.md](https://github.com/slack-go/slack/blob/master/CHANGELOG.md) is available. Please visit it for updates.
+See [CHANGELOG.md](https://github.com/slack-go/slack/blob/master/CHANGELOG.md) for more information about the changes.
## Installing
diff --git a/vendor/github.com/slack-go/slack/block_element.go b/vendor/github.com/slack-go/slack/block_element.go
index bca4e314..91b6adc4 100644
--- a/vendor/github.com/slack-go/slack/block_element.go
+++ b/vendor/github.com/slack-go/slack/block_element.go
@@ -201,10 +201,20 @@ type SelectBlockElement struct {
InitialChannel string `json:"initial_channel,omitempty"`
DefaultToCurrentConversation bool `json:"default_to_current_conversation,omitempty"`
ResponseURLEnabled bool `json:"response_url_enabled,omitempty"`
+ Filter *SelectBlockElementFilter `json:"filter,omitempty"`
MinQueryLength *int `json:"min_query_length,omitempty"`
Confirm *ConfirmationBlockObject `json:"confirm,omitempty"`
}
+// SelectBlockElementFilter allows to filter select element conversation options by type.
+//
+// More Information: https://api.slack.com/reference/block-kit/composition-objects#filter_conversations
+type SelectBlockElementFilter struct {
+ Include []string `json:"include,omitempty"`
+ ExcludeExternalSharedChannels bool `json:"exclude_external_shared_channels,omitempty"`
+ ExcludeBotUsers bool `json:"exclude_bot_users,omitempty"`
+}
+
// ElementType returns the type of the Element
func (s SelectBlockElement) ElementType() MessageElementType {
return MessageElementType(s.Type)
@@ -387,7 +397,7 @@ func (c CheckboxGroupsBlockElement) ElementType() MessageElementType {
return c.Type
}
-// NewCheckboxGroupsBlockElement returns an instance of a radio block element
+// NewCheckboxGroupsBlockElement returns an instance of a checkbox-group block element
func NewCheckboxGroupsBlockElement(actionID string, options ...*OptionBlockObject) *CheckboxGroupsBlockElement {
return &CheckboxGroupsBlockElement{
Type: METCheckboxGroups,
diff --git a/vendor/github.com/slack-go/slack/block_object.go b/vendor/github.com/slack-go/slack/block_object.go
index b6f1da4a..cc510b21 100644
--- a/vendor/github.com/slack-go/slack/block_object.go
+++ b/vendor/github.com/slack-go/slack/block_object.go
@@ -147,7 +147,7 @@ func NewTextBlockObject(elementType, text string, emoji, verbatim bool) *TextBlo
// BlockType returns the type of the block
func (t TextBlockObject) BlockType() MessageBlockType {
- if t.Type == "mrkdown" {
+ if t.Type == "mrkdwn" {
return MarkdownType
}
return PlainTextType
@@ -190,16 +190,18 @@ func NewConfirmationBlockObject(title, text, confirm, deny *TextBlockObject) *Co
//
// More Information: https://api.slack.com/reference/messaging/composition-objects#option
type OptionBlockObject struct {
- Text *TextBlockObject `json:"text"`
- Value string `json:"value"`
- URL string `json:"url,omitempty"`
+ Text *TextBlockObject `json:"text"`
+ Value string `json:"value"`
+ Description *TextBlockObject `json:"description,omitempty"`
+ URL string `json:"url,omitempty"`
}
// NewOptionBlockObject returns an instance of a new Option Block Element
-func NewOptionBlockObject(value string, text *TextBlockObject) *OptionBlockObject {
+func NewOptionBlockObject(value string, text, description *TextBlockObject) *OptionBlockObject {
return &OptionBlockObject{
- Text: text,
- Value: value,
+ Text: text,
+ Value: value,
+ Description: description,
}
}
diff --git a/vendor/github.com/slack-go/slack/chat.go b/vendor/github.com/slack-go/slack/chat.go
index a9f51e1f..439f9373 100644
--- a/vendor/github.com/slack-go/slack/chat.go
+++ b/vendor/github.com/slack-go/slack/chat.go
@@ -571,9 +571,9 @@ func MsgOptionBroadcast() MsgOption {
// MsgOptionCompose combines multiple options into a single option.
func MsgOptionCompose(options ...MsgOption) MsgOption {
- return func(c *sendConfig) error {
+ return func(config *sendConfig) error {
for _, opt := range options {
- if err := opt(c); err != nil {
+ if err := opt(config); err != nil {
return err
}
}
@@ -583,30 +583,30 @@ func MsgOptionCompose(options ...MsgOption) MsgOption {
// MsgOptionParse set parse option.
func MsgOptionParse(b bool) MsgOption {
- return func(c *sendConfig) error {
+ return func(config *sendConfig) error {
var v string
if b {
v = "full"
} else {
v = "none"
}
- c.values.Set("parse", v)
+ config.values.Set("parse", v)
return nil
}
}
// MsgOptionIconURL sets an icon URL
func MsgOptionIconURL(iconURL string) MsgOption {
- return func(c *sendConfig) error {
- c.values.Set("icon_url", iconURL)
+ return func(config *sendConfig) error {
+ config.values.Set("icon_url", iconURL)
return nil
}
}
// MsgOptionIconEmoji sets an icon emoji
func MsgOptionIconEmoji(iconEmoji string) MsgOption {
- return func(c *sendConfig) error {
- c.values.Set("icon_emoji", iconEmoji)
+ return func(config *sendConfig) error {
+ config.values.Set("icon_emoji", iconEmoji)
return nil
}
}
@@ -722,12 +722,12 @@ type GetScheduledMessagesParameters struct {
}
// GetScheduledMessages returns the list of scheduled messages based on params
-func (api *Client) GetScheduledMessages(params *GetScheduledMessagesParameters) (channels []Message, nextCursor string, err error) {
+func (api *Client) GetScheduledMessages(params *GetScheduledMessagesParameters) (channels []ScheduledMessage, nextCursor string, err error) {
return api.GetScheduledMessagesContext(context.Background(), params)
}
// GetScheduledMessagesContext returns the list of scheduled messages in a Slack team with a custom context
-func (api *Client) GetScheduledMessagesContext(ctx context.Context, params *GetScheduledMessagesParameters) (channels []Message, nextCursor string, err error) {
+func (api *Client) GetScheduledMessagesContext(ctx context.Context, params *GetScheduledMessagesParameters) (channels []ScheduledMessage, nextCursor string, err error) {
values := url.Values{
"token": {api.token},
}
@@ -747,8 +747,8 @@ func (api *Client) GetScheduledMessagesContext(ctx context.Context, params *GetS
values.Add("oldest", params.Oldest)
}
response := struct {
- Messages []Message `json:"scheduled_messages"`
- ResponseMetaData responseMetaData `json:"response_metadata"`
+ Messages []ScheduledMessage `json:"scheduled_messages"`
+ ResponseMetaData responseMetaData `json:"response_metadata"`
SlackResponse
}{}
diff --git a/vendor/github.com/slack-go/slack/conversation.go b/vendor/github.com/slack-go/slack/conversation.go
index 1e4a61f1..60c50fc7 100644
--- a/vendor/github.com/slack-go/slack/conversation.go
+++ b/vendor/github.com/slack-go/slack/conversation.go
@@ -468,8 +468,7 @@ func (api *Client) GetConversations(params *GetConversationsParameters) (channel
// GetConversationsContext returns the list of channels in a Slack team with a custom context
func (api *Client) GetConversationsContext(ctx context.Context, params *GetConversationsParameters) (channels []Channel, nextCursor string, err error) {
values := url.Values{
- "token": {api.token},
- "exclude_archived": {params.ExcludeArchived},
+ "token": {api.token},
}
if params.Cursor != "" {
values.Add("cursor", params.Cursor)
@@ -480,6 +479,10 @@ func (api *Client) GetConversationsContext(ctx context.Context, params *GetConve
if params.Types != nil {
values.Add("types", strings.Join(params.Types, ","))
}
+ if params.ExcludeArchived == "true" {
+ values.Add("exclude_archived", "true")
+ }
+
response := struct {
Channels []Channel `json:"channels"`
ResponseMetaData responseMetaData `json:"response_metadata"`
diff --git a/vendor/github.com/slack-go/slack/go.sum b/vendor/github.com/slack-go/slack/go.sum
index a66560ac..d01bacbf 100644
--- a/vendor/github.com/slack-go/slack/go.sum
+++ b/vendor/github.com/slack-go/slack/go.sum
@@ -2,8 +2,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
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/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
diff --git a/vendor/github.com/slack-go/slack/logo.png b/vendor/github.com/slack-go/slack/logo.png
new file mode 100644
index 00000000..9bd14345
--- /dev/null
+++ b/vendor/github.com/slack-go/slack/logo.png
Binary files differ
diff --git a/vendor/github.com/slack-go/slack/messages.go b/vendor/github.com/slack-go/slack/messages.go
index 09db5463..999df5d9 100644
--- a/vendor/github.com/slack-go/slack/messages.go
+++ b/vendor/github.com/slack-go/slack/messages.go
@@ -46,9 +46,10 @@ type Msg struct {
EventTimestamp string `json:"event_ts,omitempty"`
// bot_message (https://api.slack.com/events/message/bot_message)
- BotID string `json:"bot_id,omitempty"`
- Username string `json:"username,omitempty"`
- Icons *Icon `json:"icons,omitempty"`
+ BotID string `json:"bot_id,omitempty"`
+ Username string `json:"username,omitempty"`
+ Icons *Icon `json:"icons,omitempty"`
+ BotProfile *BotProfile `json:"bot_profile,omitempty"`
// channel_join, group_join
Inviter string `json:"inviter,omitempty"`
@@ -106,12 +107,32 @@ const (
ResponseTypeEphemeral = "ephemeral"
)
+// ScheduledMessage contains information about a slack scheduled message
+type ScheduledMessage struct {
+ ID string `json:"id"`
+ Channel string `json:"channel_id"`
+ PostAt int `json:"post_at"`
+ DateCreated int `json:"date_created"`
+ Text string `json:"text"`
+}
+
// Icon is used for bot messages
type Icon struct {
IconURL string `json:"icon_url,omitempty"`
IconEmoji string `json:"icon_emoji,omitempty"`
}
+// BotProfile contains information about a bot
+type BotProfile struct {
+ AppID string `json:"app_id,omitempty"`
+ Deleted bool `json:"deleted,omitempty"`
+ Icons *Icons `json:"icons,omitempty"`
+ ID string `json:"id,omitempty"`
+ Name string `json:"name,omitempty"`
+ TeamID string `json:"team_id,omitempty"`
+ Updated int64 `json:"updated,omitempty"`
+}
+
// Edited indicates that a message has been edited.
type Edited struct {
User string `json:"user,omitempty"`
diff --git a/vendor/github.com/slack-go/slack/misc.go b/vendor/github.com/slack-go/slack/misc.go
index 0dcee950..a5ca51bc 100644
--- a/vendor/github.com/slack-go/slack/misc.go
+++ b/vendor/github.com/slack-go/slack/misc.go
@@ -22,8 +22,9 @@ import (
// SlackResponse handles parsing out errors from the web api.
type SlackResponse struct {
- Ok bool `json:"ok"`
- Error string `json:"error"`
+ Ok bool `json:"ok"`
+ Error string `json:"error"`
+ ResponseMetadata ResponseMetadata `json:"response_metadata"`
}
func (t SlackResponse) Err() error {
diff --git a/vendor/github.com/slack-go/slack/slack.go b/vendor/github.com/slack-go/slack/slack.go
index d342a3e8..0972d52e 100644
--- a/vendor/github.com/slack-go/slack/slack.go
+++ b/vendor/github.com/slack-go/slack/slack.go
@@ -23,7 +23,9 @@ type httpClient interface {
// ResponseMetadata holds pagination metadata
type ResponseMetadata struct {
- Cursor string `json:"next_cursor"`
+ Cursor string `json:"next_cursor"`
+ Messages []string `json:"messages"`
+ Warnings []string `json:"warnings"`
}
func (t *ResponseMetadata) initialize() *ResponseMetadata {
@@ -43,6 +45,7 @@ type AuthTestResponse struct {
UserID string `json:"user_id"`
// EnterpriseID is only returned when an enterprise id present
EnterpriseID string `json:"enterprise_id,omitempty"`
+ BotID string `json:"bot_id"`
}
type authTestResponseFull struct {
diff --git a/vendor/github.com/slack-go/slack/users.go b/vendor/github.com/slack-go/slack/users.go
index 364958e8..cdef4242 100644
--- a/vendor/github.com/slack-go/slack/users.go
+++ b/vendor/github.com/slack-go/slack/users.go
@@ -509,6 +509,41 @@ func (api *Client) DeleteUserPhotoContext(ctx context.Context) (err error) {
return response.Err()
}
+// SetUserRealName changes the currently authenticated user's realName
+//
+// For more information see SetUserRealNameContextWithUser
+func (api *Client) SetUserRealName(realName string) error {
+ return api.SetUserRealNameContextWithUser(context.Background(), realName, realName)
+}
+
+// SetUserRealNameContextWithUser will set a real name for the provided user with a custom context
+func (api *Client) SetUserRealNameContextWithUser(ctx context.Context, user, realName string) error {
+ profile, err := json.Marshal(
+ &struct {
+ RealName string `json:"real_name"`
+ }{
+ RealName: realName,
+ },
+ )
+
+ if err != nil {
+ return err
+ }
+
+ values := url.Values{
+ "user": {user},
+ "token": {api.token},
+ "profile": {string(profile)},
+ }
+
+ response := &userResponseFull{}
+ if err = api.postMethod(ctx, "users.profile.set", values, response); err != nil {
+ return err
+ }
+
+ return response.Err()
+}
+
// SetUserCustomStatus will set a custom status and emoji for the currently
// authenticated user. If statusEmoji is "" and statusText is not, the Slack API
// will automatically set it to ":speech_balloon:". Otherwise, if both are ""