From ee5d9b43b54a3becf3cb4025198f24608d35500d Mon Sep 17 00:00:00 2001 From: Wim Date: Sat, 20 Mar 2021 22:40:23 +0100 Subject: Update vendor (#1414) --- vendor/github.com/slack-go/slack/README.md | 2 +- vendor/github.com/slack-go/slack/attachments.go | 5 +++++ vendor/github.com/slack-go/slack/block_element.go | 1 + vendor/github.com/slack-go/slack/block_input.go | 13 +++++++------ vendor/github.com/slack-go/slack/block_object.go | 15 +++++++++++++++ vendor/github.com/slack-go/slack/reminders.go | 4 ++-- vendor/github.com/slack-go/slack/users.go | 5 ++++- vendor/github.com/slack-go/slack/websocket_internals.go | 1 + .../github.com/slack-go/slack/websocket_managed_conn.go | 7 ++++--- 9 files changed, 40 insertions(+), 13 deletions(-) (limited to 'vendor/github.com/slack-go/slack') diff --git a/vendor/github.com/slack-go/slack/README.md b/vendor/github.com/slack-go/slack/README.md index cebbf48b..7be89066 100644 --- a/vendor/github.com/slack-go/slack/README.md +++ b/vendor/github.com/slack-go/slack/README.md @@ -1,6 +1,6 @@ Slack API in Go [![GoDoc](https://godoc.org/github.com/slack-go/slack?status.svg)](https://godoc.org/github.com/slack-go/slack) [![Build Status](https://travis-ci.org/slack-go/slack.svg)](https://travis-ci.org/slack-go/slack) =============== -This is the original Slack library for Go created by Norberto Lopez, transferred to a Github organization. +This is the original Slack library for Go created by Norberto Lopes, transferred to a Github organization. [![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) diff --git a/vendor/github.com/slack-go/slack/attachments.go b/vendor/github.com/slack-go/slack/attachments.go index b5b79f9f..69b223a2 100644 --- a/vendor/github.com/slack-go/slack/attachments.go +++ b/vendor/github.com/slack-go/slack/attachments.go @@ -80,6 +80,11 @@ type Attachment struct { ImageURL string `json:"image_url,omitempty"` ThumbURL string `json:"thumb_url,omitempty"` + ServiceName string `json:"service_name,omitempty"` + ServiceIcon string `json:"service_icon,omitempty"` + FromURL string `json:"from_url,omitempty"` + OriginalURL string `json:"original_url,omitempty"` + Fields []AttachmentField `json:"fields,omitempty"` Actions []AttachmentAction `json:"actions,omitempty"` MarkdownIn []string `json:"mrkdwn_in,omitempty"` diff --git a/vendor/github.com/slack-go/slack/block_element.go b/vendor/github.com/slack-go/slack/block_element.go index 4157016c..bf068440 100644 --- a/vendor/github.com/slack-go/slack/block_element.go +++ b/vendor/github.com/slack-go/slack/block_element.go @@ -268,6 +268,7 @@ type MultiSelectBlockElement struct { InitialConversations []string `json:"initial_conversations,omitempty"` InitialChannels []string `json:"initial_channels,omitempty"` MinQueryLength *int `json:"min_query_length,omitempty"` + MaxSelectedItems *int `json:"max_selected_items,omitempty"` Confirm *ConfirmationBlockObject `json:"confirm,omitempty"` } diff --git a/vendor/github.com/slack-go/slack/block_input.go b/vendor/github.com/slack-go/slack/block_input.go index 10638cd9..087571af 100644 --- a/vendor/github.com/slack-go/slack/block_input.go +++ b/vendor/github.com/slack-go/slack/block_input.go @@ -4,12 +4,13 @@ package slack // // More Information: https://api.slack.com/reference/block-kit/blocks#input type InputBlock struct { - Type MessageBlockType `json:"type"` - BlockID string `json:"block_id,omitempty"` - Label *TextBlockObject `json:"label"` - Element BlockElement `json:"element"` - Hint *TextBlockObject `json:"hint,omitempty"` - Optional bool `json:"optional,omitempty"` + Type MessageBlockType `json:"type"` + BlockID string `json:"block_id,omitempty"` + Label *TextBlockObject `json:"label"` + Element BlockElement `json:"element"` + Hint *TextBlockObject `json:"hint,omitempty"` + Optional bool `json:"optional,omitempty"` + DispatchAction bool `json:"dispatch_action,omitempty"` } // BlockType returns the type of the block diff --git a/vendor/github.com/slack-go/slack/block_object.go b/vendor/github.com/slack-go/slack/block_object.go index d17806ca..5ced7f92 100644 --- a/vendor/github.com/slack-go/slack/block_object.go +++ b/vendor/github.com/slack-go/slack/block_object.go @@ -2,6 +2,7 @@ package slack import ( "encoding/json" + "errors" ) // Block Objects are also known as Composition Objects @@ -135,6 +136,20 @@ func (s TextBlockObject) MixedElementType() MixedElementType { return MixedElementText } +// Validate checks if TextBlockObject has valid values +func (s TextBlockObject) Validate() error { + if s.Type != "plain_text" && s.Type != "mrkdwn" { + return errors.New("type must be either of plain_text or mrkdwn") + } + + // https://github.com/slack-go/slack/issues/881 + if s.Type == "mrkdwn" && s.Emoji { + return errors.New("emoji cannot be true in mrkdown") + } + + return nil +} + // NewTextBlockObject returns an instance of a new Text Block Object func NewTextBlockObject(elementType, text string, emoji, verbatim bool) *TextBlockObject { return &TextBlockObject{ diff --git a/vendor/github.com/slack-go/slack/reminders.go b/vendor/github.com/slack-go/slack/reminders.go index f312af3f..ae1da866 100644 --- a/vendor/github.com/slack-go/slack/reminders.go +++ b/vendor/github.com/slack-go/slack/reminders.go @@ -22,7 +22,7 @@ type reminderResp struct { type remindersResp struct { SlackResponse - Reminders []Reminder `json:"reminders"` + Reminders []*Reminder `json:"reminders"` } func (api *Client) doReminder(ctx context.Context, path string, values url.Values) (*Reminder, error) { @@ -42,7 +42,7 @@ func (api *Client) doReminders(ctx context.Context, path string, values url.Valu // create an array of pointers to reminders var reminders = make([]*Reminder, 0, len(response.Reminders)) for _, reminder := range response.Reminders { - reminders = append(reminders, &reminder) + reminders = append(reminders, reminder) } return reminders, response.Err() diff --git a/vendor/github.com/slack-go/slack/users.go b/vendor/github.com/slack-go/slack/users.go index 5d8cb35f..82657d76 100644 --- a/vendor/github.com/slack-go/slack/users.go +++ b/vendor/github.com/slack-go/slack/users.go @@ -644,10 +644,13 @@ type getUserProfileResponse struct { // GetUserProfileContext retrieves a user's profile information with a context. func (api *Client) GetUserProfileContext(ctx context.Context, userID string, includeLabels bool) (*UserProfile, error) { - values := url.Values{"token": {api.token}, "user": {userID}} + values := url.Values{"token": {api.token}} if includeLabels { values.Add("include_labels", "true") } + if userID != "" { + values.Add("user", userID) + } resp := &getUserProfileResponse{} err := api.postMethod(ctx, "users.profile.get", values, &resp) diff --git a/vendor/github.com/slack-go/slack/websocket_internals.go b/vendor/github.com/slack-go/slack/websocket_internals.go index 3e1906ee..454a2133 100644 --- a/vendor/github.com/slack-go/slack/websocket_internals.go +++ b/vendor/github.com/slack-go/slack/websocket_internals.go @@ -94,6 +94,7 @@ func (i *IncomingEventError) Error() string { // AckErrorEvent i type AckErrorEvent struct { ErrorObj error + ReplyTo int } func (a *AckErrorEvent) Error() string { 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 fe6802e4..5555c316 100644 --- a/vendor/github.com/slack-go/slack/websocket_managed_conn.go +++ b/vendor/github.com/slack-go/slack/websocket_managed_conn.go @@ -91,6 +91,7 @@ func (rtm *RTM) connect(connectionCount int, useRTMStart bool) (*Info, *websocke errInvalidAuth = "invalid_auth" errInactiveAccount = "account_inactive" errMissingAuthToken = "not_authed" + errTokenRevoked = "token_revoked" ) // used to provide exponential backoff wait time with jitter before trying @@ -118,7 +119,7 @@ func (rtm *RTM) connect(connectionCount int, useRTMStart bool) (*Info, *websocke // check for fatal errors switch err.Error() { - case errInvalidAuth, errInactiveAccount, errMissingAuthToken: + case errInvalidAuth, errInactiveAccount, errMissingAuthToken, errTokenRevoked: rtm.Debugf("invalid auth when connecting with RTM: %s", err) rtm.IncomingEvents <- RTMEvent{"invalid_auth", &InvalidAuthEvent{}} return nil, nil, err @@ -438,10 +439,10 @@ func (rtm *RTM) handleAck(event json.RawMessage) { if ack.RTMResponse.Error.Code == -1 && ack.RTMResponse.Error.Msg == "slow down, too many messages..." { rtm.IncomingEvents <- RTMEvent{"ack_error", &RateLimitEvent{}} } else { - rtm.IncomingEvents <- RTMEvent{"ack_error", &AckErrorEvent{ack.Error}} + rtm.IncomingEvents <- RTMEvent{"ack_error", &AckErrorEvent{ack.Error, ack.ReplyTo}} } } else { - rtm.IncomingEvents <- RTMEvent{"ack_error", &AckErrorEvent{fmt.Errorf("ack decode failure")}} + rtm.IncomingEvents <- RTMEvent{"ack_error", &AckErrorEvent{ErrorObj: fmt.Errorf("ack decode failure")}} } } -- cgit v1.2.3