mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-07-03 18:57:45 +00:00
Update vendor (#1228)
This commit is contained in:
2
vendor/github.com/slack-go/slack/attachments.go
generated
vendored
2
vendor/github.com/slack-go/slack/attachments.go
generated
vendored
@ -75,7 +75,7 @@ type Attachment struct {
|
||||
Title string `json:"title,omitempty"`
|
||||
TitleLink string `json:"title_link,omitempty"`
|
||||
Pretext string `json:"pretext,omitempty"`
|
||||
Text string `json:"text,omitempty"`
|
||||
Text string `json:"text"` // Required
|
||||
|
||||
ImageURL string `json:"image_url,omitempty"`
|
||||
ThumbURL string `json:"thumb_url,omitempty"`
|
||||
|
1
vendor/github.com/slack-go/slack/block.go
generated
vendored
1
vendor/github.com/slack-go/slack/block.go
generated
vendored
@ -16,6 +16,7 @@ const (
|
||||
MBTContext MessageBlockType = "context"
|
||||
MBTFile MessageBlockType = "file"
|
||||
MBTInput MessageBlockType = "input"
|
||||
MBTHeader MessageBlockType = "header"
|
||||
)
|
||||
|
||||
// Block defines an interface all block types should implement
|
||||
|
8
vendor/github.com/slack-go/slack/block_conv.go
generated
vendored
8
vendor/github.com/slack-go/slack/block_conv.go
generated
vendored
@ -111,6 +111,12 @@ func (b *InputBlock) UnmarshalJSON(data []byte) error {
|
||||
e = &SelectBlockElement{}
|
||||
case "multi_static_select", "multi_external_select", "multi_users_select", "multi_conversations_select", "multi_channels_select":
|
||||
e = &MultiSelectBlockElement{}
|
||||
case "checkboxes":
|
||||
e = &CheckboxGroupsBlockElement{}
|
||||
case "overflow":
|
||||
e = &OverflowBlockElement{}
|
||||
case "radio_buttons":
|
||||
e = &RadioButtonsBlockElement{}
|
||||
default:
|
||||
return errors.New("unsupported block element type")
|
||||
}
|
||||
@ -175,6 +181,8 @@ func (b *BlockElements) UnmarshalJSON(data []byte) error {
|
||||
blockElement = &PlainTextInputBlockElement{}
|
||||
case "checkboxes":
|
||||
blockElement = &CheckboxGroupsBlockElement{}
|
||||
case "radio_buttons":
|
||||
blockElement = &RadioButtonsBlockElement{}
|
||||
case "static_select", "external_select", "users_select", "conversations_select", "channels_select":
|
||||
blockElement = &SelectBlockElement{}
|
||||
default:
|
||||
|
38
vendor/github.com/slack-go/slack/block_header.go
generated
vendored
Normal file
38
vendor/github.com/slack-go/slack/block_header.go
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
package slack
|
||||
|
||||
// HeaderBlock defines a new block of type header
|
||||
//
|
||||
// More Information: https://api.slack.com/reference/messaging/blocks#header
|
||||
type HeaderBlock struct {
|
||||
Type MessageBlockType `json:"type"`
|
||||
Text *TextBlockObject `json:"text,omitempty"`
|
||||
BlockID string `json:"block_id,omitempty"`
|
||||
}
|
||||
|
||||
// BlockType returns the type of the block
|
||||
func (s HeaderBlock) BlockType() MessageBlockType {
|
||||
return s.Type
|
||||
}
|
||||
|
||||
// HeaderBlockOption allows configuration of options for a new header block
|
||||
type HeaderBlockOption func(*HeaderBlock)
|
||||
|
||||
func HeaderBlockOptionBlockID(blockID string) HeaderBlockOption {
|
||||
return func(block *HeaderBlock) {
|
||||
block.BlockID = blockID
|
||||
}
|
||||
}
|
||||
|
||||
// NewHeaderBlock returns a new instance of a header block to be rendered
|
||||
func NewHeaderBlock(textObj *TextBlockObject, options ...HeaderBlockOption) *HeaderBlock {
|
||||
block := HeaderBlock{
|
||||
Type: MBTHeader,
|
||||
Text: textObj,
|
||||
}
|
||||
|
||||
for _, option := range options {
|
||||
option(&block)
|
||||
}
|
||||
|
||||
return &block
|
||||
}
|
1
vendor/github.com/slack-go/slack/errors.go
generated
vendored
1
vendor/github.com/slack-go/slack/errors.go
generated
vendored
@ -9,6 +9,7 @@ const (
|
||||
ErrRTMGoodbye = errorsx.String("goodbye detected")
|
||||
ErrRTMDeadman = errorsx.String("deadman switch triggered")
|
||||
ErrParametersMissing = errorsx.String("received empty parameters")
|
||||
ErrBlockIDNotUnique = errorsx.String("Block ID needs to be unique")
|
||||
ErrInvalidConfiguration = errorsx.String("invalid configuration")
|
||||
ErrMissingHeaders = errorsx.String("missing headers")
|
||||
ErrExpiredTimestamp = errorsx.String("timestamp is too old")
|
||||
|
17
vendor/github.com/slack-go/slack/oauth.go
generated
vendored
17
vendor/github.com/slack-go/slack/oauth.go
generated
vendored
@ -33,14 +33,15 @@ type OAuthResponse struct {
|
||||
|
||||
// OAuthV2Response ...
|
||||
type OAuthV2Response struct {
|
||||
AccessToken string `json:"access_token"`
|
||||
TokenType string `json:"token_type"`
|
||||
Scope string `json:"scope"`
|
||||
BotUserID string `json:"bot_user_id"`
|
||||
AppID string `json:"app_id"`
|
||||
Team OAuthV2ResponseTeam `json:"team"`
|
||||
Enterprise OAuthV2ResponseEnterprise `json:"enterprise"`
|
||||
AuthedUser OAuthV2ResponseAuthedUser `json:"authed_user"`
|
||||
AccessToken string `json:"access_token"`
|
||||
TokenType string `json:"token_type"`
|
||||
Scope string `json:"scope"`
|
||||
BotUserID string `json:"bot_user_id"`
|
||||
AppID string `json:"app_id"`
|
||||
Team OAuthV2ResponseTeam `json:"team"`
|
||||
IncomingWebhook OAuthResponseIncomingWebhook `json:"incoming_webhook"`
|
||||
Enterprise OAuthV2ResponseEnterprise `json:"enterprise"`
|
||||
AuthedUser OAuthV2ResponseAuthedUser `json:"authed_user"`
|
||||
SlackResponse
|
||||
}
|
||||
|
||||
|
22
vendor/github.com/slack-go/slack/views.go
generated
vendored
22
vendor/github.com/slack-go/slack/views.go
generated
vendored
@ -150,6 +150,23 @@ func (api *Client) OpenView(triggerID string, view ModalViewRequest) (*ViewRespo
|
||||
return api.OpenViewContext(context.Background(), triggerID, view)
|
||||
}
|
||||
|
||||
// ValidateUniqueBlockID will verify if each input block has a unique block ID if set
|
||||
func ValidateUniqueBlockID(view ModalViewRequest) bool {
|
||||
|
||||
uniqueBlockID := map[string]bool{}
|
||||
|
||||
for _, b := range view.Blocks.BlockSet {
|
||||
if inputBlock, ok := b.(*InputBlock); ok {
|
||||
if _, ok := uniqueBlockID[inputBlock.BlockID]; ok {
|
||||
return false
|
||||
}
|
||||
uniqueBlockID[inputBlock.BlockID] = true
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// OpenViewContext opens a view for a user with a custom context.
|
||||
func (api *Client) OpenViewContext(
|
||||
ctx context.Context,
|
||||
@ -159,6 +176,11 @@ func (api *Client) OpenViewContext(
|
||||
if triggerID == "" {
|
||||
return nil, ErrParametersMissing
|
||||
}
|
||||
|
||||
if !ValidateUniqueBlockID(view) {
|
||||
return nil, ErrBlockIDNotUnique
|
||||
}
|
||||
|
||||
req := openViewRequest{
|
||||
TriggerID: triggerID,
|
||||
View: view,
|
||||
|
Reference in New Issue
Block a user